libcwd: The C++ Debugging Support Library - Reference Manual
Author: Carlo Wood
Description: C++ debugging support library with ostream debug output
Keywords: libcwd, debug output, debug facility, debug channel, object orientation, OO, C++, nested debug output, ostream, memory allocation, debugging, source file and line number

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

# libcwd::channel_ct Class Reference
[Controlling The Output Level (Debug Channels)]

This object represents a debug channel, it has a fixed label. A debug channel can be viewed upon as a single bit: on or off. More...

`#include <libcwd/debug.h>`

List of all members.

## Public Member Functions
| channel_ct (char const *label, bool add_to_channel_list=true)
| Construct a new debug channel with name label.
void | off (void)
| Turn this channel off.
void | on (void)
| Cancel one call to `off()'.
char const * | get_label (void) const
| Pointer to the label of the debug channel.
bool | is_on (void) const
| Returns `true' if the channel is active.

## Detailed Description

This object represents a debug channel, it has a fixed label. A debug channel can be viewed upon as a single bit: on or off.

Whenever debug output is written, one or more debug channels must be specified (as first parameter of the Dout macro). The debug output is then written to the ostream of the debug object unless the debug object is turned off or when all specified debug channels are off. Each debug channel can be turned on and off independently.

Multiple debug channels can be given by using `operator|` between the channel names. This shouldn't be read as `or' but merely be seen as the bit-wise OR operation on the bit-masks that these channels actually represent.

Example:

     Dout( dc::notice, "Libcwd is a great library" );

gives as result

NOTICE: Libcwd is a great library

and

     Dout( dc::hello, "Hello World!" );
     Dout( dc::kernel|dc::io, "This is written when either the kernel"
         "or io channel is turned on." );

gives as result

HELLO : Hello World! KERNEL: This is written when either the kernel or io channel is turned on.

## Constructor & Destructor Documentation

libcwd::channel_ct::channel_ct | ( | char const * | label,
|  | bool | add_to_channel_list = `true` |
| ) |  |  | `[inline, explicit]`

Construct a new debug channel with name label.

A newly created channel is off by default (except dc::warning). All channel objects must be global objects.

See also:
  The Custom debug.h File

## Member Function Documentation

void libcwd::channel_ct::off | ( | void |  | ) |

Turn this channel off.

See also:
  on()

void libcwd::channel_ct::on | ( | void |  | ) |

Cancel one call to `off()'.

The channel is turned on when on() is called as often as off() was called before.

References libcwd::channels::dc::core, and DoutFatal.