[ GAMB | Source | Keywords | Summary | Ancestors | All Members | Descendants ]
public: | |
explicit | DebugStream(ostream& outStream ); |
explicit | DebugStream(const char *filename); |
~DebugStream(); | |
void | setDebugLevel(const unsigned int debugLevel); |
unsigned | getDebugLevel() const; |
void | flush(); |
void | newLines(const bool print ); |
void | messageLevels(const bool print ); |
void | messageTimes(const bool print ); |
void | indent(const bool print ); |
void | resetTimer(); |
void | setFloatPrecision(unsigned int prec); |
void | setWidth(unsigned int prec); |
void | setWidth(unsigned int numOfChars, unsigned int adjustment); |
void | autoFlush(const bool autoflush ); |
DebugStream& | operator()(unsigned int newMsgLevel ); |
template< class T> DebugStream& | operator<<(T& data); |
protected: |
Back to the top of DebugStream
Copyright: SAMBA group, Tel-Aviv Univ. Israel, 1997.
Back to the top of DebugStream
Back to the top of DebugStream
Back to the top of DebugStream
The following program will output all messages of level 10 and under.
DebugStream log(cout); log.setDebugLevel(10); log(10) << "This is a level " << 10 << " message"; log << " and so is this"; log(15) << "But this is a level" << 15 << " message and will not be shown"; << " because the DebugLevel is lower"; log() << "This is a level" << 0 << " message. You should definitely see it";
The debug stream can also be initialized by a file name. In this case the DebugStream will open the file when created and close it when done.
The DebugStream class allows the user to control the format of the stream output. The user may choose to output the user time, a new-line after every message or the message level itself.
If you wish the DebugStream not to use writing buffers use the autoFlush. This option may make the DebugStream work a little slower but will ensure that the data was written to the file before the next command was preformed.
Back to the top of DebugStream
explicit DebugStream(ostream& outStream );
Contructor: Intialize the DebugStream class with a true output stream
output that the DebugStream decides should be printed will be forwarded
to this output stream.
explicit DebugStream(ostream& outStream = cout);
Back to the top of DebugStream
explicit DebugStream(const char *filename);
Constructor: Initialize the DebugStream class with the name of the
output file. This way the class can be initilized when declared as a
global varialb. If file is unavailable DebugStream will use cerr and
will notify to the problem.
explicit DebugStream(const char *filename);
Back to the top of DebugStream
~DebugStream();
destructor: mainly closes the file if ownStream is true.
~DebugStream();
Back to the top of DebugStream
void setDebugLevel(const unsigned int debugLevel);
Set the debug level controlling the extent of the debugging messages
seen. The higher the level the more messages the user will actually see.
This parameter may be read from a prameters file controlling the extent
of information actually shown during run-time.
void setDebugLevel(const unsigned int debugLevel);
Back to the top of DebugStream
unsigned getDebugLevel() const;
In line function returning the debug level
for logging purposes
inline unsigned getDebugLevel() const;
Function is currently defined inline.
Back to the top of DebugStream
void flush();
flushing mechanism like that of the ostream type
inline void flush();
Function is currently defined inline.
Back to the top of DebugStream
void newLines(const bool print );
Set the new-lines option. If true, starting a new message with
operator() causes a new-line to be printed.
void newLines(const bool print = true);
Back to the top of DebugStream
void messageLevels(const bool print );
Set the message levels option. If true, for each mesasage the message
level is shown at the beginning. Set to false by default.
void messageLevels(const bool print = true);
Back to the top of DebugStream
void messageTimes(const bool print );
Set the timer option. If true the time of each message is shown at the
head of the message. The time show is the system's user time and not the
real clocked time.
void messageTimes(const bool print = true);
Back to the top of DebugStream
void indent(const bool print );
Set the indent option. If true log messages are indented according to
message levels. 2 spaces per 10 debug levels.
void indent(const bool print = true);
Back to the top of DebugStream
void resetTimer();
Resets timer to 0.
void resetTimer();
Back to the top of DebugStream
void setFloatPrecision(unsigned int prec);
Useful Function for working with a specific floating point percision
void setFloatPrecision(unsigned int prec);
Back to the top of DebugStream
void setWidth(unsigned int prec);
another useful funciton for indenting
void setWidth(unsigned int prec);
Back to the top of DebugStream
void setWidth(unsigned int numOfChars, unsigned int adjustment);
A function for indentation: Params: numOfChars - Sets the width of the filed adjustment - Defines the adjustment of the charecters within the field (possible options: left or right)
void setWidth(unsigned int numOfChars, unsigned int adjustment);
Back to the top of DebugStream
void autoFlush(const bool autoflush );
Set the automaticFlush on so that each writing to the stream will be
automatially accompanied by a flush.
void autoFlush(const bool autoflush = true);
Back to the top of DebugStream
DebugStream& operator()(unsigned int newMsgLevel );
Starts a new message specifying the messages level. If no message level
is given then a default message level of 0 is assumed and the message is
always shown.
DebugStream& operator()(unsigned int newMsgLevel = 0);
Back to the top of DebugStream
template< class T> DebugStream& operator<<(T& data);
Output operator. If message was started with a low enough message level
then data will be passed on to the output stream with which DebugStream
was intialized.
template< class T> DebugStream& operator<<(T& data);
Back to the top of DebugStream
public: | ||
---|---|---|
explicit | DebugStream(ostream& outStream ); | |
explicit | DebugStream(const char *filename); | |
void | setDebugLevel(const unsigned int debugLevel); | |
unsigned | getDebugLevel() const; | |
void | flush(); | |
void | newLines(const bool print ); | |
void | messageLevels(const bool print ); | |
void | messageTimes(const bool print ); | |
void | indent(const bool print ); | |
void | resetTimer(); | |
void | setFloatPrecision(unsigned int prec); | |
void | setWidth(unsigned int prec); | |
void | setWidth(unsigned int numOfChars, unsigned int adjustment); | |
void | autoFlush(const bool autoflush ); | |
DebugStream& | operator()(unsigned int newMsgLevel ); | |
template< class T> DebugStream& | operator<<(T& data); | |
protected: |
Back to the top of DebugStream
Back to the top of DebugStream
Back to the top of DebugStream
Report problems to jkotula@unimax.com