Main Page | Modules | Class Hierarchy | Compound List | File List | Compound Members | Related Pages

rlog::RLogPublisher Class Reference

RLog publisher used by rLog macros. More...

#include <rlog/RLogPublisher.h>

Inheritance diagram for rlog::RLogPublisher:

rlog::RLogNode rlog::RLogNode List of all members.

Public Member Functions

 RLogPublisher (PublishLoc *src)
 RLogPublisher (PublishLoc *src)
bool enabled () const
 Returns true if this node is active.

virtual void enabled (bool newState)
 For derived classes to get notified of activation status change.

bool enabled () const
virtual void enabled (bool newState)
bool enabled () const
 Returns true if this node is active.

virtual void enabled (bool newState)
 For derived classes to get notified of activation status change.

bool enabled () const
virtual void enabled (bool newState)

Static Public Member Functions

void Publish (PublishLoc *, RLogChannel *, const char *format,...)
void PublishVA (PublishLoc *, RLogChannel *, const char *format, va_list args)
void Publish (PublishLoc *, RLogChannel *, const char *format,...)
void PublishVA (PublishLoc *, RLogChannel *, const char *format, va_list args)

Public Attributes

PublishLocsrc
PublishLocsrc

Protected Member Functions

virtual void enabled (bool newState)
 For derived classes to get notified of activation status change.

virtual void enabled (bool newState)
 For derived classes to get notified of activation status change.


Detailed Description

RLog publisher used by rLog macros.

This derives from RLogNode and interfaces to the static PublishLoc logging data allowing them to be enabled or disabled depending on subscriber status.

An instance of this class is created for every error message location. Normally this class is not used directly.

For example, this

     rDebug( "hello world" );

is turned approximatly into this:

     static PublishLoc _rl = {
         publish:  & rlog::RLog_Register ,
         pub: 0,
         component: "component",
         fileName: "myfile.cpp",
         functionName: "functionName()",
         lineNum: __LINE__,
         channel: 0
     };
     if(_rL.publish != 0)
         (*_rl.publish)( &_rL, _RLDebugChannel, "hello world" );

The RLogPublisher instance manages the contents of the static structure _rL. When someone subscribes to it's message, then _rL.publish is set to point to the publishing function, and when there are no subscribers then it is set to 0.

The code produced contains one if statement, and with optimization comes out to about 3 instructions on an x86 computer (not including the function call). If there are no subscribers to this message then that is all the overhead, plus the memory usage for the structures involved and the initial registration when the statement is first encountered..

See also:
RLogChannel
Author:
Valient Gough


Member Function Documentation

void RLogNode::enabled bool  newState  ) 
 

For derived classes to get notified of activation status change.

This is called by isInterested() when our state changes. If true is passed, then this node has become active. If false is passed, then this node has just become dormant.

bool RLogNode::enabled  )  const
 

Returns true if this node is active.

Returns:
true if we have one or more interested subscribers, otherwise false

void RLogNode::enabled bool  newState  ) 
 

For derived classes to get notified of activation status change.

This is called by isInterested() when our state changes. If true is passed, then this node has become active. If false is passed, then this node has just become dormant.

bool RLogNode::enabled  )  const
 

Returns true if this node is active.

Returns:
true if we have one or more interested subscribers, otherwise false

virtual void rlog::RLogPublisher::enabled bool  newState  )  [protected, virtual]
 

For derived classes to get notified of activation status change.

This is called by isInterested() when our state changes. If true is passed, then this node has become active. If false is passed, then this node has just become dormant.

Reimplemented from rlog::RLogNode.

void RLogPublisher::enabled bool  active  )  [protected, virtual]
 

For derived classes to get notified of activation status change.

This is called by isInterested() when our state changes. If true is passed, then this node has become active. If false is passed, then this node has just become dormant.

Reimplemented from rlog::RLogNode.


The documentation for this class was generated from the following files:
Generated on Sun Mar 14 14:49:51 2004 for rlog by doxygen 1.3.2