libcwdversion 2.0.0
The C++ Debugging Support Library
Loading...
Searching...
No Matches

The Debug Object class, this object represents one output device (ostream). More...

#include <libcwd/debug.h>

Public Member Functions

DebugStringcolor_on ()
 Colorization code.
DebugStringcolor_off ()
 Turn colorization off.
DebugStringmargin ()
 The margin.
DebugStringmarker ()
 The marker.
void set_indent (unsigned short indentation)
 Set number of spaces to indent.
void inc_indent (unsigned short indentation)
 Increment number of spaces to indent.
void dec_indent (unsigned short indentation)
 Decrement number of spaces to indent.
unsigned short get_indent () const
 Get the current indentation.
void push_margin ()
 Push the current margin on a stack.
void pop_margin ()
 Pop margin from the stack.
void push_marker ()
 Push the current marker on a stack.
void pop_marker ()
 Pop marker from the stack.
std::ostream * get_ostream () const
 Get the ostream device as set with set_ostream().
 DebugObject ()
 Constructor.
void set_ostream (std::ostream *os)
 Set output device (single threaded applications).
template<class T>
void set_ostream (std::ostream *os, T *mutex)
 Set output device and provide external lock.
void off ()
 Turn this debug object off.
void on ()
 Cancel last call to off().
void always_flush_on ()
 Turn always-flush for this debug object on.
void always_flush_off ()
 Cancel last call to always_flush_on().

Friends

class Channel

Detailed Description

Constructor & Destructor Documentation

◆ DebugObject()

libcwd::DebugObject::DebugObject ( )
inline

A debug object must be global.

See also
the-output-device-debug-object
custom-debug-objects

References libcwd::core_dump().

Member Function Documentation

◆ always_flush_off()

void libcwd::DebugObject::always_flush_off ( )
inline

Calls to always_flush_on() and always_flush_off() has to be done in pairs (first on() then off()). These pairs can be nested.

Example:

Debug(libcw_do.always_flush_on());
Dout(dc::notice, "This is flushed.");
Debug(libcw_do.always_flush_off());
#define Dout(cntrl,...)
Macro for writing debug output.
Definition debug.h:97
#define Debug(...)
Encapsulation macro for general debugging code.
Definition debug.h:69
DebugObject libcw_do
The default debug object.
Definition debug.cxx:222

References libcwd::core_dump().

◆ on()

void libcwd::DebugObject::on ( )
inline

Calls to off() and on() has to be done in pairs (first off() then on()). These pairs can be nested.

Example:

int i = 0;
Debug(libcw_do.off());
Dout(dc::notice, "Adding one to " << i++);
Dout(dc::notice, "i == " << i);

Outputs:

NOTICE : i == 0
   

Note that the statement i++ was never executed.


The documentation for this class was generated from the following files: