Dv::DebugSlave Class Reference

A DebugSlave uses a link to another master Debugable to provide its log and bug services. More...

#include <debug.h>

Inheritance diagram for Dv::DebugSlave:
Inheritance graph
[legend]
Collaboration diagram for Dv::DebugSlave:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 DebugSlave (unsigned int minimal_debug_level=0, Debugable *master=0)
 Constructor.
virtual unsigned int debug () const
virtual ostream_ptrlogif (bool condition) const
 Return an Dv::ostream_ptr to write debug or log info on.
virtual void set_debug_master (Debugable *master, unsigned int min_debug_level=0) const
 Set the debug master of this slave.
unsigned int debug_threshold () const
virtual Debugabledebug_master () const

Protected Attributes

unsigned int threshold_
Debugablemaster_

Detailed Description

A DebugSlave uses a link to another master Debugable to provide its log and bug services.

If there is no master, the slave always return a null Dv::ostream_ptr and a debug level of 0.

Note that the liberal use of const_cast. The idea is that adding debug manipulation to existing code should not generate const-correctness errors.

See also:
Dv::Debugable

Definition at line 208 of file debug.h.


Constructor & Destructor Documentation

Dv::DebugSlave::DebugSlave ( unsigned int  minimal_debug_level = 0,
Debugable master = 0 
) [inline]

Constructor.

Parameters:
minimal_debug_level only if the master's debug level is at least this number will the master's Dv::ostream_ptr be returned by the Dv::DebugSlave::logif and Dv::DebugSlave::log member functions.
master to which the object will be connected. This can also be done later using Dv::DebugSlave::set_debug_master

Definition at line 217 of file debug.h.


Member Function Documentation

virtual unsigned int Dv::DebugSlave::debug (  )  const [inline, virtual]
Returns:
the master debug level.

Reimplemented from Dv::Debugable.

Reimplemented in Dv::Debug.

Definition at line 221 of file debug.h.

References Dv::Debugable::debug(), and debug_master().

Referenced by logif().

virtual ostream_ptr& Dv::DebugSlave::logif ( bool  condition  )  const [inline, virtual]

Return an Dv::ostream_ptr to write debug or log info on.

Parameters:
condition a non-null Dv::ostream_ptr will be returned only if this condition is true and the master debug level is at least the treshold specified in the constructor.
Returns:
the master Dv::ostream_ptr if the condition is true and the master debug level is at least the treshold specified in the constructor.
a null Dv::ostream_ptr if the condition is false or the master debug level is less than the treshold specified in the constructor.

Reimplemented from Dv::Debugable.

Reimplemented in Dv::Debug.

Definition at line 236 of file debug.h.

References debug(), debug_master(), Dv::Debugable::logif(), and threshold_.

virtual void Dv::DebugSlave::set_debug_master ( Debugable master,
unsigned int  min_debug_level = 0 
) const [inline, virtual]

Set the debug master of this slave.

Parameters:
master new debug master of this slave.
min_debug_level to use with the new master. If 0, the old threshold remains in effect.

Definition at line 251 of file debug.h.

References master_, and threshold_.

unsigned int Dv::DebugSlave::debug_threshold (  )  const [inline]
Returns:
the minimal debug level of the master for this slave to activate debugging

Definition at line 258 of file debug.h.

References threshold_.

virtual Debugable* Dv::DebugSlave::debug_master (  )  const [inline, virtual]
Returns:
the debug master if this slave (or 0 if none).

Reimplemented in Dv::DebugObserver.

Definition at line 260 of file debug.h.

References master_.

Referenced by debug(), Dv::Debug::logif(), and logif().


Member Data Documentation

unsigned int Dv::DebugSlave::threshold_ [protected]

Definition at line 264 of file debug.h.

Referenced by debug_threshold(), Dv::Debug::logif(), logif(), and set_debug_master().

Definition at line 265 of file debug.h.

Referenced by debug_master(), and set_debug_master().


The documentation for this class was generated from the following file:

dvutil-1.0.10 [ 5 December, 2009]