Common Analysis Framework » QFRAMEWORK » TQLibrary

class TQLibrary


 TQLibrary

 The TQLibrary is a global/static class of which there should only be one instance at a time.
 It is not intended to be instantiated by the user -- instead, an instance of it is created
 automatically at runtime as a global static member variable TQLibrary::gQFramework.

 It facilitates a set of OS and/or root-version specific 'hacks' to help the user
 in keeping his or her own code clean of such workarounds.

 It also provides functions to access version numbers of the compiler and root itself.


Function Members (Methods)

public:
virtual~TQLibrary()
static voidallowCapturing(bool allow = true)
static voidallowCapturing_stderr(bool allow = true)
static voidallowCapturing_stdout(bool allow = true)
static voidallowRedirection(bool allow = true)
static voidallowRedirection_stderr(bool allow = true)
static voidallowRedirection_stdout(bool allow = true)
static intcaptureStderr()
static intcaptureStdout()
static intcaptureStdoutStderr()
voidcd(TString newpath)
static TClass*Class()
static boolcloseLogFile()
static boolembedFonts(const TString& filename, bool verbose = false)
static boolenableEXIFsupport(bool val = true)
static boolenablePDFfontEmbedding(bool val = true)
voidfindConsoleWidth()
static TStringfindLibrary(const TString& filename)
static TStringgetAbsolutePath(const TString& path)
static const TString&getApplicationName()
static intgetConsoleWidth()
static const TString&getdCachePathHead()
static const TString&getDQ2cmd()
static const TString&getDQ2PathHead()
static TStringgetEOScmd()
static const TString&getEXIFtoolPath()
static const TString&getGCCVersion()
static floatgetGCCVersionNumber()
static const TString&getlibXMLpath()
static vector<string>getListOfPackages()
static const TString&getLocalGroupDisk()
static TMultiGraph*getMemoryGraph(bool differential = false)
static const TString&getPDFfontEmbedCommand()
static const TString&getProcStatPath()
static TQLibrary*getQLibrary()
static const TString&getROOTVersion()
static floatgetROOTVersionNumber()
boolgetSnowflakeMode()
unsigned longgetTimeOfConstruction()
unsigned longgetTimeSinceConstruction()
static const TString&getTQPATH()
static const TString&getVersion()
static intgetVersionNumber()
static Long64_tgetVirtualMemory()
static const TString&getWebsite()
static const TString&getWorkingDirectory()
static boolhasEXIFsupport()
static boolhasPackage(const char* pkgname)
static boolhasPDFfontEmbedding()
virtual TClass*IsA() const
static boolopenLogFile(const TString& fname, bool allowColors = false)
static voidprintGlobAlertMessageCount()
static voidprintGlobMessageCount()
static voidprintMemory()
static voidprintMessage()
static const TString&pwd()
static TStringreadAndResetCapturedStderr()
static TStringreadAndResetCapturedStdout()
static TStringreadAndResetCapturedStdoutStderr()
static TStringreadCapturedStderr()
static TStringreadCapturedStdout()
static TStringreadCapturedStdoutStderr()
static voidrecordMemory(short color = 1)
static intredirect(const TString& fname, bool append = false)
static intredirect_stderr(const TString& fname, bool append = false)
static intredirect_stdout(const TString& fname, bool append = false)
static intresetCapturedStderr()
static intresetCapturedStdout()
static intresetCapturedStdoutStderr()
static boolrestore()
static intrestore_stderr()
static intrestore_stdout()
voidsetApplicationName(TString newName)
static voidsetConsoleWidth(int width)
voidsetdCachePathHead(const TString&)
voidsetDQ2cmd(const TString&)
voidsetDQ2PathHead(const TString&)
voidsetEOScmd(TString neweoscmd)
voidsetEOSurl(TString neweoscmd)
static boolsetEXIF(const TString& fname, const TString& title, const TString& keywords = "ROOT ATLAS HSG3")
voidsetEXIFtoolPath(TString newpath)
voidsetLocalGroupDisk(const TString&)
static voidsetMessageStream(ostream& os, bool allowColors = true)
static voidsetMessageStream(ostream* os = __null, bool allowColors = true)
voidsetPDFfontEmbedCommand(TString newpath)
voidsetProcStatPath(TString newpath)
voidsetSnowflakeMode(bool snowflakeMode, unsigned int maxWarningsAllowed = 0)
voidsetTQPATH(TString newpath)
voidsetWorkingDirectory(TString newpath)
virtual voidShowMembers(TMemberInspector& insp) const
virtual voidStreamer(TBuffer&)
voidStreamerNVirtual(TBuffer& ClassDef_StreamerNVirtual_b)
TQLibrary()
TQLibrary(const TQLibrary&)
private:
virtual Bool_tCheckTObjectHashConsistency() const

Data Members

public:
static TQMessageStreammsgStream
protected:
TStringappName
static stringstream*capturingStderrStream
static stringstream*capturingStdoutStderrStream
static stringstream*capturingStdoutStream
intconsoleWidth
TStringdCachePathHead
static streambuf*defaultStderrStreamBuf
static streambuf*defaultStdoutStreamBuf
TStringdq2PathHead
TStringdq2cmd
TStringeoscmd
TStringeosmgmurl
boolexiftoolEnabled
TStringexiftoolPath
static TQLibrarygQFramework
const TStringgccversion
static boolisInitialized
TStringlibXMLpath
const TStringlibversion
TStringlocalGroupDiskIdentifier
unsigned intmaxWarningsAllowed
vector<string>packages
TStringpdfFontEmbedCommand
boolpdfFontEmbedEnabled
TStringprocStatPath
const TStringrootversion
vector<short>rssUsageColors
vector<size_t>rssUsageMemory
vector<unsigned long>rssUsageTimestamps
boolsnowflakeMode
static intstderrfd
static boolstderrfd_allowRedirection
static boolstderrfd_isRedirected
static boolstderrstr_allowCapturing
static boolstderrstr_isCaptured
static boolstdouterrstr_areCaptured
static intstdoutfd
static boolstdoutfd_allowRedirection
static boolstdoutfd_isRedirected
static boolstdoutstr_allowCapturing
static boolstdoutstr_isCaptured
unsigned longtimeOfConstruction
TStringtqpath
TStringwebsite
TStringworkingDirectory

Class Charts

Inheritance Chart:
TQLibrary

Function documentation

TQLibrary* getQLibrary()
 return a pointer to gQFramework
TQLibrary()
~TQLibrary()
 If snowflakeMode, check the number of printed messages. If they exceed
 a threshold, break. A threshold can be set for warnings. The threshold
 value for everything worse than that is 0.
const TString& getLocalGroupDisk()
 retrieve the string identifying the local group disk
 this is the local group disk identifier, i.e. something like
 UNI-FREIBURG_LOCALGROUPDISK
void setLocalGroupDisk(const TString& )
 set the string identifying the local group disk
 this is the local group disk identifier, i.e. something like
 UNI-FREIBURG_LOCALGROUPDISK
const TString& getDQ2PathHead()
 retrieve the DQ2 path head for the local storage
 this is something like
 srm://se.bfg.uni-freiburg.de
void setDQ2PathHead(const TString& )
 set the DQ2 path head for the local storage
 this is something like
 srm://se.bfg.uni-freiburg.de
const TString& getdCachePathHead()
 retrieve the dCache path head for the local storage
 this is something like
 dcap://se.bfg.uni-freiburg.de:22125
void setdCachePathHead(const TString& )
 set the dCache path head for the local storage
 this is something like
 dcap://se.bfg.uni-freiburg.de:22125
const TString& getDQ2cmd()
 retrieve the local DQ2 command
 this usually either "dq2" or "rucio"
void setDQ2cmd(const TString& )
 set the local DQ2 command
 this usually either "dq2" or "rucio"
TString getEOScmd()
 retrieve the eos activation command
 on CERN AFS and for the ATLAS EOS, this is
 export EOS_MGM_URL=root://eosatlas.cern.ch; /afs/cern.ch/project/eos/installation/atlas/bin/eos
void setEOScmd(TString neweoscmd)
 set the path to the eos binary
 on CERN AFS, this is
 /afs/cern.ch/project/eos/installation/atlas/bin/eos
void setEOSurl(TString neweoscmd)
 set the eos url, for example
 root://eosuser.cern.ch for USER EOS
 root://eosatlas.cern.ch for ATLAS EOS
void printMessage()
 print an informational message
 containing all important version numbers
const TString& getVersion()
 return the svn revision of the libQFramework
const TString& getROOTVersion()
 return the root version
const TString& getGCCVersion()
 return the compiler version
int getVersionNumber()
 return the svn revision of the libQFramework (numeric value);
float getROOTVersionNumber()
 return the root version (numeric value)
float getGCCVersionNumber()
 return the compiler version (numeric value)
int redirect_stdout(const TString& fname, bool append = false)
 redirect stdout to the file of the given name
 if the file exists, it will be overwritten
 if the file does not exist, it will be created
int restore_stdout()
 if TQLibrary::redirect_stdout or TQLibrary::capture_stdout
 was called previously this function will restore the
 original output stream
TString readCapturedStdout()
int resetCapturedStdout()
TString readAndResetCapturedStdout()
TString readCapturedStderr()
int resetCapturedStderr()
TString readAndResetCapturedStderr()
TString readCapturedStdoutStderr()
int resetCapturedStdoutStderr()
TString readAndResetCapturedStdoutStderr()
int redirect_stderr(const TString& fname, bool append = false)
 redirect stderr to the file of the given name
 if the file exists, it will be overwritten
 if the file does not exist, it will be created
int restore_stderr()
 if TQLibrary::redirect_stderr or TQLibrary::capture_stderr
 was called previously this function will restore the
 original output stream
int captureStdout()
 Don't print stdout, but instead store it in
 TQLibrary::capturingStdoutStream. The stored string
 can be read using TQLibrary::readCapturedStdout().
 Use TQLibrary::restore_stdout() to stop capturing.
int captureStderr()
 Don't print stderr, but instead store it in
 TQLibrary::capturingStderrStream. The stored string
 can be read using TQLibrary::readCapturedStderr().
 Use TQLibrary::restore_stderr() to stop capturing.
int captureStdoutStderr()
 Captures both stdout and stderr and writes them to the same
 stream.
void allowRedirection_stdout(bool allow = true)
void allowRedirection_stderr(bool allow = true)
void allowRedirection(bool allow = true)
void allowCapturing_stdout(bool allow = true)
void allowCapturing_stderr(bool allow = true)
void allowCapturing(bool allow = true)
int redirect(const TString& fname, bool append = false)
 redirect stdout and stderr to the file of the given name
 if the file exists, it will be overwritten
 if the file does not exist, it will be created
bool restore()
 if TQLibrary::redirect_stdout was called previously
 this function will restore the original output stream
Long64_t getVirtualMemory()
void printMemory()
 print the current memory usage of the code
void recordMemory(short color = 1)
TMultiGraph* getMemoryGraph(bool differential = false)
 returns a TGraph recording the memory usage over time
const TString& getProcStatPath()
 retrieve the path to the file/device providing process information
void setProcStatPath(TString newpath)
 set the path to the file/device providing process information
const TString& getEXIFtoolPath()
 retrieve the path of the EXIFtool binary
 which allows modifying PDF meta-information
void setEXIFtoolPath(TString newpath)
 set the path of the EXIFtool binary
 which allows modifying PDF meta-information
bool hasEXIFsupport()
 return true if TQLibrary is configured for EXIF support
 return false otherwise
bool enableEXIFsupport(bool val = true)
 enable support of EXIFtool
 this requires a valid EXIFtool path to be set
bool setEXIF(const TString& fname, const TString& title, const TString& keywords = "ROOT ATLAS HSG3")
 use the EXIFtool to set the title and keywords metainformation on some PDF
const TString& getPDFfontEmbedCommand()
 retrieve the command used to embed fonts in PDF files
void setPDFfontEmbedCommand(TString newpath)
 set the command used to embed fonts in PDF files
bool hasPDFfontEmbedding()
 return true if TQLibrary is configured to perfrom font embedding in PDFs
 return false otherwise
bool enablePDFfontEmbedding(bool val = true)
 enable font embedding in PDFs
 this requires pdfFonntEmbedCommand to be set
bool embedFonts(const TString& filename, bool verbose = false)
 embed fonts in some PDF file
 if verbose, print the command output
const TString& getApplicationName()
 get the name of this application
void setApplicationName(TString newName)
 set the name of this application
TString getAbsolutePath(const TString& path)
 retrieve the absolute path to some local path inside the working directory
const TString& getWorkingDirectory()
 retrieve the current working directory
void setWorkingDirectory(TString newpath)
 set the current working directory
const TString& pwd()
 retrieve the current working directory
 same as getWorkingDirectory
void cd(TString newpath)
 change the current working directory
 same as setWorkingDirectory
const TString& getTQPATH()
 get the TQPATH
void setTQPATH(TString newpath)
 set the TQPATH
const TString& getlibXMLpath()
const TString& getWebsite()
 retrieve the URL of the documentation website
void setMessageStream(ostream& os, bool allowColors = true)
 set the message output stream
void setMessageStream(ostream* os = __null, bool allowColors = true)
 set the message output stream
bool openLogFile(const TString& fname, bool allowColors = false)
 open a log file at the given location
bool closeLogFile()
 close the currently opened log file and redirect logging to std::cout
 the same effect can be accomplished by calling TQLibrary::setMessageStream(std::cout)
int getConsoleWidth()
 get the currently set console width
void setConsoleWidth(int width)
 set the global console width
void findConsoleWidth()
 recalculate the console width from the kernel
TString findLibrary(const TString& filename)
 find the path of some library
bool hasPackage(const char* pkgname)
 check if a given package was known at build time
std::vector<std::string> getListOfPackages()
void printGlobMessageCount()
void printGlobAlertMessageCount()
void setSnowflakeMode(bool snowflakeMode, unsigned int maxWarningsAllowed = 0)
bool getSnowflakeMode()
unsigned long getTimeOfConstruction()
unsigned long getTimeSinceConstruction()
TQLibrary()