A Debug object is typically a master. More...
#include <debug.h>


Public Member Functions | |
| Debug (std::ostream *log=0, int dbg=0) | |
| Constructor. | |
| unsigned int | set_debug (unsigned int dbg) |
| Set the debug level. | |
| unsigned int | add_debug (unsigned int dbg) |
| Set some bits in the current debug flag. | |
| unsigned int | del_debug (unsigned int dbg) |
| Clear bits in the current debug flag. | |
| unsigned int | debug () const |
| std::ostream * | set_log (std::ostream *log) |
| Set a log stream. | |
| ostream_ptr & | logif (bool condition) const |
| Retrieve log file, depending on a condition. | |
Private Attributes | |
| unsigned int | debug_ |
| Dv::ostream_ptr | log_1 |
A Debug object is typically a master.
It has an actual debug level and Dv::ostream_ptr for debug and log output.
However, it can also be made to act as a slave. The latter is accomplished by using DebugSlave::set_debug_master.
Definition at line 280 of file debug.h.
| Dv::Debug::Debug | ( | std::ostream * | log = 0, |
|
| int | dbg = 0 | |||
| ) | [inline] |
| unsigned int Dv::Debug::set_debug | ( | unsigned int | dbg | ) | [inline] |
Set the debug level.
| dbg | the new debug level. |
Definition at line 293 of file debug.h.
References debug_.
Referenced by add_debug(), and del_debug().
| unsigned int Dv::Debug::add_debug | ( | unsigned int | dbg | ) | [inline] |
Set some bits in the current debug flag.
| dbg | bit pattern to add |
Definition at line 303 of file debug.h.
References debug(), and set_debug().
| unsigned int Dv::Debug::del_debug | ( | unsigned int | dbg | ) | [inline] |
Clear bits in the current debug flag.
| dbg | bit pattern to add |
Definition at line 311 of file debug.h.
References debug(), and set_debug().
| unsigned int Dv::Debug::debug | ( | ) | const [inline, virtual] |
Reimplemented from Dv::DebugSlave.
Definition at line 316 of file debug.h.
References debug_.
Referenced by add_debug(), del_debug(), and logif().
| std::ostream* Dv::Debug::set_log | ( | std::ostream * | log | ) | [inline] |
Set a log stream.
| log | the new log stream (or 0) |
Definition at line 322 of file debug.h.
References log_1, and Dv::ostream_ptr::set_os().
| ostream_ptr& Dv::Debug::logif | ( | bool | condition | ) | const [inline, virtual] |
Retrieve log file, depending on a condition.
This allows one to write e.g.
x.log(debug() & THIS_MODULE_DEBUG) << "blabla"
which will actually write only if there is a non-zero log stream and the current debug level has the appropriate THIS_MODULE_DEBUG bits set.
| condition | only return valid log stream if condition is true |
Reimplemented from Dv::DebugSlave.
Definition at line 335 of file debug.h.
References debug(), Dv::DebugSlave::debug_master(), Dv::Debugable::log_0, log_1, and Dv::DebugSlave::threshold_.
unsigned int Dv::Debug::debug_ [private] |
Definition at line 346 of file debug.h.
Referenced by debug(), and set_debug().
Dv::ostream_ptr Dv::Debug::log_1 [private] |
| dvutil-1.0.10 | [ 5 December, 2009] |