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

Classes | Macros | Functions
Special Functions And Utilities
Collaboration diagram for Special Functions And Utilities:

Classes

class  libcwd::buf2str
 Print a (char) buffer with a given size to a debug ostream, escaping non-printable characters. More...
 
class  libcwd::char2str
 Print a char to a debug ostream, escaping non-printable characters as needed. More...
 
interface  cwprint
 Print an object to a debug stream without needing an operator<<. More...
 
interface  cwprint_using
 Print an object to an ostream using an arbitrary method of that object. More...
 

Macros

#define ForAllDebugChannels(STATEMENT...)
 Looping over all debug channels. More...
 
#define ForAllDebugObjects(STATEMENT...)
 Looping over all debug objects. More...
 

Functions

channel_ctlibcwd::find_channel (char const *label)
 Find debug channel with label label. More...
 
void libcwd::list_channels_on (debug_ct &debug_object)
 List all debug channels to a given debug object. More...
 

Detailed Description

Macro Definition Documentation

◆ ForAllDebugChannels

#define ForAllDebugChannels (   STATEMENT...)

Looping over all debug channels.

The macro ForAllDebugChannels allows you to run over all debug channels.

For example,

ForAllDebugChannels( while (!debugChannel.is_on()) debugChannel.on() );
#define ForAllDebugChannels(STATEMENT...)
Looping over all debug channels.
Definition: debug.h:190

which turns all channels on.  And

ForAllDebugChannels( if (debugChannel.is_on()) debugChannel.off() );

which turns all channels off.

◆ ForAllDebugObjects

#define ForAllDebugObjects (   STATEMENT...)

Looping over all debug objects.

The macro ForAllDebugObjects allows you to run over all debug objects.

For example,

ForAllDebugObjects( debugObject.set_ostream(&std::cerr, &cerr_mutex) );
#define ForAllDebugObjects(STATEMENT...)
Looping over all debug objects.
Definition: debug.h:209

would set the output stream of all debug objects to std::cerr.

Function Documentation

◆ find_channel()

channel_ct * libcwd::find_channel ( char const *  label)

Find debug channel with label label.

Returns
A pointer to the debug channel object whose name starts with label.  If there is more than one such debug channel, the object with the lexicographically largest name is returned.  When no debug channel could be found, NULL is returned.

◆ list_channels_on()

void libcwd::list_channels_on ( debug_ct debug_object)

List all debug channels to a given debug object.

Example:

Dout( list_channels_on(libcw_do) ); // libcw_do is the (default) debug object of libcwd.
#define Dout(cntrl, data)
Macro for writing debug output.
Definition: debug.h:154
void list_channels_on(debug_ct &debug_object)
List all debug channels to a given debug object.
Definition: debug.cc:1575
debug_ct libcw_do
The default debug object.
Definition: debug.cc:429

Example of output:

DEBUG   : Disabled
NOTICE  : Enabled
WARNING : Enabled
SYSTEM  : Enabled
MALLOC  : Disabled
LLISTS  : Disabled
KERNEL  : Disabled
IO      : Disabled
FOO     : Enabled
BAR     : Enabled

Where FOO and BAR are user defined channels in this example.

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