Main Page   Reference Manual   Namespace List   Compound List   Namespace Members   Compound Members   File Members  

Public Member Functions | List of all members
libcwd::debug_ct Class Reference

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

#include <libcwd/debug.h>

Public Member Functions

debug_string_ctmargin ()
 The margin. More...
 
debug_string_ctmarker ()
 The marker. More...
 
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().
 
 debug_ct ()
 Constructor. More...
 
void set_ostream (std::ostream *os)
 Set output device (single threaded applications). More...
 
template<class T >
void set_ostream (std::ostream *os, T *mutex)
 Set output device and provide external lock. More...
 
void off ()
 Turn this debug object off.
 
void on ()
 Cancel last call to off(). More...
 

Detailed Description

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

See The Output Device (Debug Object).

Constructor & Destructor Documentation

◆ debug_ct()

libcwd::debug_ct::debug_ct ( )
inline

Constructor.

A debug object must be global.

See also
The Output Device (Debug Object)
Custom Debug Objects

Member Function Documentation

◆ on()

void libcwd::debug_ct::on ( )
inline

Cancel last call to off().

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

Example:

int i = 0;
Dout( dc::notice, "Adding one to " << i++ );
Dout( dc::notice, "i == " << i );
void on()
Cancel last call to off().
Definition: class_debug.inl:202
void off()
Turn this debug object off.
Definition: class_debug.inl:171
#define Dout(cntrl, data)
Macro for writing debug output.
Definition: debug.h:154
#define Debug(STATEMENTS...)
Encapsulation macro for general debugging code.
Definition: debug.h:124
channel_ct notice
Definition: debug.cc:460
debug_ct libcw_do
The default debug object.
Definition: debug.cc:429

Outputs:

NOTICE : i == 0

Note that the statement i++ was never executed.

Copyright © 2001 - 2004 Carlo Wood.  All rights reserved.