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

Modules | Functions
Setting The Output Destination
Collaboration diagram for Setting The Output Destination:

Modules

 Custom Debug Objects
 

Functions

void libcwd::debug_ct::set_ostream (std::ostream *os)
 Set output device (single threaded applications). More...
 
std::ostream * libcwd::debug_ct::get_ostream () const
 Get the ostream device as set with set_ostream().
 
template<class T >
void libcwd::debug_ct::set_ostream (std::ostream *os, T *mutex)
 Set output device and provide external lock. More...
 

Detailed Description


Detailed Description

Basically, a debug object (debug_ct ) is a pointer to an ostream with a few extra attributes added to give it an internal state for on (pass output on) and off (don't pass output on) as well as some formatting information of how to write the data that is passed on to its ostream.The methods of debug_ct given here allow you to set or get this ostream (pointer).

Function Documentation

◆ set_ostream() [1/2]

void libcwd::debug_ct::set_ostream ( std::ostream *  os)

Set output device (single threaded applications).

Assign a new ostream to this debug object (default is std::cerr). For use in single threaded applications only.

References libcwd::builtin_return_address_offset, libcwd::channels::dc::core, Dout, DoutFatal, and libcwd::channels::dc::warning.

◆ set_ostream() [2/2]

template<class T >
void libcwd::debug_ct::set_ostream ( std::ostream *  os,
T *  mutex 
)

Set output device and provide external lock.

Assign a new ostream to this debug object.  The ostream will only be written to after obtaining the lock that is passed as second argument. Each ostream needs to have a unique lock.  If the application also writes directly to the same ostream then use the same lock.

Example:

MyLock lock;
// Uses MyLock::lock(), MyLock::try_lock() and MyLock::unlock().
Debug( libcw_do.set_ostream(&std::cerr, &lock) );
lock.lock();
std::cerr << "The application uses cerr too\n";
lock.unlock();
#define Debug(STATEMENTS...)
Encapsulation macro for general debugging code.
Definition: debug.h:124
void set_ostream(std::ostream *os)
Set output device (single threaded applications).
Definition: debug.cc:2041
debug_ct libcw_do
The default debug object.
Definition: debug.cc:429
Copyright © 2001 - 2004 Carlo Wood.  All rights reserved.