rlog::RLogPublisher Class Reference

RLog publisher used by rLog macros. More...

#include <rlog/RLogPublisher.h>

Inheritance diagram for rlog::RLogPublisher:

rlog::RLogNode List of all members.

Public Member Functions

 RLogPublisher (PublishLoc *src)

Static Public Member Functions

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

Public Attributes

PublishLocsrc

Protected Member Functions

virtual void setEnabled (bool newState)
 For derived classes to get notified of activation status change.
 RLogPublisher (const RLogPublisher &)
RLogPublisheroperator= (const RLogPublisher &)

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 RLogPublisher::setEnabled ( 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.


The documentation for this class was generated from the following files:
Generated on Mon Nov 20 22:57:45 2006 for rlog by  doxygen 1.5.0