Common Analysis Framework » QFRAMEWORK » TQMessageStream

class TQMessageStream


 TQMessageStream

 TQMessageStream is a helper class that provides an additional
 abstraction layer between I/O tasks and the I/O stream objects of
 the standard library. It can be helpful to control verbosity levels
 and redirect text output into log files.


Function Members (Methods)

public:
~TQMessageStream()
voidabsorb(const TQMessageStream& other)
ostream&activeStream()
voidclearMessages()
voidclose()
voidendProcessInfo(TQMessageStream::InfoType result)
voidflushBuffer()
TStringformatClassFunctionArgsMessage(TQMessageStream::MessageType type, TClass* tclass, const TString& fname, const TString& fargs, TString fmt,...)
TStringformatClassFunctionMessage(TQMessageStream::MessageType type, TClass* tclass, const TString& fname, TString fmt,...)
TStringformatFileLineMessage(TQMessageStream::MessageType type, const TString& file, int line, TString fmt,...)
TStringformatFunctionArgsMessage(TQMessageStream::MessageType type, const TString& fname, const TString& fargs, TString fmt,...)
TStringformatFunctionMessage(TQMessageStream::MessageType type, const TString& fname, TString fmt,...)
TStringformatMessage(TQMessageStream::MessageType type, TString fmt,...)
const TString&getFilename()
static unsigned intgetGlobMessageCount(TQMessageStream::MessageType type)
TStringgetLineEnd()
TStringgetMessages()
TStringgetStatusString()
boolisCERR()
boolisCOUT()
boolisFile()
boolisGood()
voidnewline()
voidnewlines(size_t n)
boolopen(const TString& fname, bool append = false)
TQMessageStream&operator=(const TQMessageStream& other)
static voidprintGlobAlertMessageCount()
static voidprintGlobMessageCount()
static boolprintGlobMessageCount(TQMessageStream::MessageType type, bool onlyNonZero = false)
voidreopen(bool append = true)
voidresetTmpMessageCount()
voidsendClassFunctionArgsMessage(TQMessageStream::MessageType type, TClass* tclass, const TString& fname, const TString& fargs, TString fmt,...)
voidsendClassFunctionMessage(TQMessageStream::MessageType type, TClass* tclass, const TString& fname, TString fmt,...)
voidsendFileLineMessage(TQMessageStream::MessageType type, const TString& file, int line, TString fmt,...)
voidsendFunctionArgsMessage(TQMessageStream::MessageType type, const TString& fname, const TString& fargs, TString fmt,...)
voidsendFunctionMessage(TQMessageStream::MessageType type, const TString& fname, TString fmt,...)
voidsendMessage(TQMessageStream::MessageType type, TString,...)
voidsetLineEnd(const TString& s)
voidstartBuffer()
voidstartProcessInfo(TQMessageStream::MessageType type, int lineWidth, const TString& align, TString fmt,...)
TQMessageStream()
TQMessageStream(const TString& filename, bool _colors = false)
TQMessageStream(ostream& _stream, bool _owner = false, bool _colors = true)
TQMessageStream(ostream* _stream, bool _owner = false, bool _colors = true)
voidwriteMessagesToStdout()
protected:
voidaddTmpMessageCountToGlobal()
static voidcountGlobMessage(TQMessageStream::MessageType type, int increment = 1)
voidcountMessage(TQMessageStream::MessageType type)
voidcountTmpMessage(TQMessageStream::MessageType type, int increment = 1)
TStringformatMessageContentText(TQMessageStream::MessageType type, const TString& text)
TStringformatMessageMetaText(TQMessageStream::MessageType type, const TString& text)
TStringgetInfoTypeString(TQMessageStream::InfoType type)
TStringgetMessageTypeString(TQMessageStream::MessageType type)
static TStringgetMessageTypeString_colors(TQMessageStream::MessageType type)
static TStringgetMessageTypeString_noColors(TQMessageStream::MessageType type)
voidtriggerMessageAction(TQMessageStream::MessageType type)
static voiduncountGlobMessage(TQMessageStream::MessageType type)

Data Members

public:
static TQMessageStream::MessageTypeBREAK
static TQMessageStream::MessageTypeCRITICAL
static TQMessageStream::MessageTypeDEBUG
static TQMessageStream::MessageTypeERROR
static TQMessageStream::InfoTypeFAIL
static TQMessageStream::MessageTypeINFO
static TQMessageStream::InfoTypeOK
static TQMessageStream::InfoTypePENDING
static TQMessageStream::MessageTypeVERBOSE
static TQMessageStream::InfoTypeWARN
static TQMessageStream::MessageTypeWARNING
static initializer_list<TQMessageStream::MessageType>messageTypesAlert
static initializer_list<TQMessageStream::MessageType>messageTypesAll
protected:
stringstreambuffer
boolcolors
TStringendl
TStringfilename
static map<TQMessageStream::MessageType,unsigned int>globMessageCounter
booloverhang
boolowner
ostream*stream
map<TQMessageStream::MessageType,unsigned int>tmpMessageCounter
TStringtmpString
booluseBuffer

Class Charts

Inheritance Chart:
TQMessageStream

Function documentation

TQMessageStream& operator=(const TQMessageStream& other)
 assign another stream to this one
 this stream will become an exact copy of the other
 stream ownership will stay with the other
 if ownership shall be transferred, please use absorb(...)
TString getMessages()
 retrieve the messages
 if the underlying stream is I/O (stringstream),
 this will return a string of all messages sent
 since the last call of clearMessages
 of the underlying stream is O (ofstream,cout),
 this will return the empty string
void close()
 close the underlying stream
 calling this function will only have an effect if
 - the stream is owned by this instance, and
 - the stream is an ofstream
bool isFile()
 return true if this message stream streams to a file, false otherwise
bool isCOUT()
 return true if this message stream streams to std::cout, false otherwise
bool isCERR()
 return true if this message stream streams to std::cerr, false otherwise
void clearMessages()
 clear all messages since the beginning of time
 will only take effect if the underlying stream
 is I/O (stringstream)
TQMessageStream()
 default constructor (will use colored ASCII std::cout)
TQMessageStream(ostream& _stream, bool _owner = false, bool _colors = true)
 custom constructor with stream reference
TQMessageStream(ostream* _stream, bool _owner = false, bool _colors = true)
 custom constructor with stream pointer
TQMessageStream(const TString& filename, bool _colors = false)
 custom constructor with filename
 will open a log file at the given location
void reopen(bool append = true)
 re-open the log file
bool open(const TString& fname, bool append = false)
 open a log file at the given location
~TQMessageStream()
 destructor - will call close()
void absorb(const TQMessageStream& other)
 absorb another stream
 this stream will become an exact copy of the other
 and henceforth own the other's stream
 the ownership of the other stream will be removed
bool isGood()
 return true if this instance is good for streaming output
 return false otherwise
const TString& getFilename()
 return the filename associated to this stream
void startProcessInfo(TQMessageStream::MessageType type, int lineWidth, const TString& align, TString fmt, ...)
 start a "process info"
void endProcessInfo(TQMessageStream::InfoType result)
 end a "process info"
void newline()
 submit a newline
void newlines(size_t n)
 submit n newlines
void sendMessage(TQMessageStream::MessageType type, TString fmt, ...)
 send a message
void sendFileLineMessage(TQMessageStream::MessageType type, const TString& file, int line, TString fmt, ...)
 send a message message with file and line information
void sendClassFunctionMessage(TQMessageStream::MessageType type, TClass* tclass, const TString& fname, TString fmt, ...)
 send a message with class and function information
void sendFunctionMessage(TQMessageStream::MessageType type, const TString& fname, TString fmt, ...)
 send a message with function information
void sendClassFunctionArgsMessage(TQMessageStream::MessageType type, TClass* tclass, const TString& fname, const TString& fargs, TString fmt, ...)
 send a message with class, function and argument information
void sendFunctionArgsMessage(TQMessageStream::MessageType type, const TString& fname, const TString& fargs, TString fmt, ...)
 send a message with function and argument information
TString formatMessage(TQMessageStream::MessageType type, TString fmt, ...)
 format a message
TString formatFileLineMessage(TQMessageStream::MessageType type, const TString& file, int line, TString fmt, ...)
 format a message message with file and line information
TString formatClassFunctionMessage(TQMessageStream::MessageType type, TClass* tclass, const TString& fname, TString fmt, ...)
 format a message with class and function information
TString formatFunctionMessage(TQMessageStream::MessageType type, const TString& fname, TString fmt, ...)
 format a message with function information
TString formatClassFunctionArgsMessage(TQMessageStream::MessageType type, TClass* tclass, const TString& fname, const TString& fargs, TString fmt, ...)
 format a message with class, function and argument information
TString formatFunctionArgsMessage(TQMessageStream::MessageType type, const TString& fname, const TString& fargs, TString fmt, ...)
 format a message with function and argument information
void setLineEnd(const TString& s)
 set the line endings to be used
TString getLineEnd()
 retrieve the currently used line endings
void startBuffer()
 start using the internal buffer
void flushBuffer()
 flush the internal buffer to the stream and close it
TString getStatusString()
 retrieve a human-readable string identfying the current status of this stream
void countMessage(TQMessageStream::MessageType type)
void resetTmpMessageCount()
void countTmpMessage(TQMessageStream::MessageType type, int increment = 1)
void countGlobMessage(TQMessageStream::MessageType type, int increment = 1)
void uncountGlobMessage(TQMessageStream::MessageType type)
unsigned int getGlobMessageCount(TQMessageStream::MessageType type)
bool printGlobMessageCount(TQMessageStream::MessageType type, bool onlyNonZero = false)
void printGlobMessageCount()
void printGlobAlertMessageCount()
void addTmpMessageCountToGlobal()
 Add temporary message count to global message count and reset
 temporary counter.
void writeMessagesToStdout()
 Write temporarily stored messages to stdout and add them to the
 global count of printed messages.
std::ostream& activeStream()
TString getInfoTypeString(TQMessageStream::InfoType type)
#endif
#ifndef __CINT__
TString getMessageTypeString(TQMessageStream::MessageType type)
return getMessageTypeString_colors(TQMessageStream::MessageType type)
return getMessageTypeString_noColors(TQMessageStream::MessageType type)
TString formatMessageContentText(TQMessageStream::MessageType type, const TString& text)
TString formatMessageMetaText(TQMessageStream::MessageType type, const TString& text)
void triggerMessageAction(TQMessageStream::MessageType type)
 this line takes care that "refreshing lines" will never overlap the last message