rlog: rlog::RLogPublisher Class Reference

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

# rlog::RLogPublisher Class Reference

RLog publisher used by rLog macros. More...

`#include <rlog/RLogPublisher.h>`

Inheritance diagram for rlog::RLogPublisher:

List of all members.

## Public Member Functions
| RLogPublisher (PublishLoc *src)
| RLogPublisher (PublishLoc *src)
## 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
PublishLoc * | src
PublishLoc * | src
## Protected Member Functions
virtual void | setEnabled (bool newState)
| For derived classes to get notified of activation status change.
| RLogPublisher (const RLogPublisher &)
RLogPublisher & | operator= (const RLogPublisher &)
virtual void | setEnabled (bool newState)
| For derived classes to get notified of activation status change.
| RLogPublisher (const RLogPublisher &)
RLogPublisher & | operator= (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

virtual void rlog::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.

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

- RLogPublisher.h
- 1.3.6/rlog/RLogPublisher.h
- RLogPublisher.cpp
- 1.3.6/rlog/RLogPublisher.cpp