ERC CISST - cisst software

cmnLODOutputMultiplexer Class Reference

#include <cmnLODOutputMultiplexer.h>

Inheritance diagram for cmnLODOutputMultiplexer:

Inheritance graph
[legend]
Collaboration diagram for cmnLODOutputMultiplexer:

Collaboration graph
[legend]
List of all members.

Detailed Description

Types for dynamic control of output messages.

This includes debugging information, error reporting, state logging etc. This file declares class cmnLODOutputMultiplexer. A cmnLODOutputMultiplexer inherits the public interface of a generic ostream, and attaches each output message with a Level Of Detail (LOD) descriptor. The LOD descriptor is forwarded through a cmnMultiplexerStreambufProxy to a cmnLODMultiplexerStreambuf that performs the actual multiplexing.

Create a collection of ostream objects, and attach them to a cmnLODMultiplexerStreambuf. Create a cmnLODOutputMultiplexer and assign it with the LOD value and the cmnLODMultiplexerStreambuf address. Use the standard ostream syntax (operator <<) to stream objects to the multiplexer.

Example (assume that the object lodMultiplexerStreambuf is a cmnLODMultiplexerStreambuf):

       // The multiple output channels
       ofstream log("logfile.txt");
       windowoutputstream display;  // hypothetical class

       cmnLODOutputMultiplexer multiplexerOutput(&lodMultiplexetStreambuf, CMN_LOG_LOD_RUN_ERROR);

       lodMultiplexerStreambuf.AddChannel(log, CMN_LOG_LOD_RUN_ERROR;
       lodMultiplexerStreambuf.AddChannel(windowoutputstream, CMN_LOG_LOD_INIT_WARNING);

       multiplexerStreambuf << "Hello, world" << endl;  // channel the message only to 'log'

See also:
cmnLODMultiplexerStreambuf.h, cmnMultiplexerStreambufProxy.h, C++ documentation of basic_streambuf and iostream

Definition at line 72 of file cmnLODOutputMultiplexer.h.

Public Types

Public Member Functions


Constructor & Destructor Documentation

cmnLODOutputMultiplexer::cmnLODOutputMultiplexer ( SinkType multiplexer,
LogLoDType  lod 
) [inline]

Constructor that initializes base class and stores LOD.

Definition at line 91 of file cmnLODOutputMultiplexer.h.


Member Function Documentation

cmnLODOutputMultiplexer& cmnLODOutputMultiplexer::Ref ( void   )  [inline]

This method simply returns a reference to this object. It is used when a cmnLODOutputMultiplexer is created and immediately operated on, to ensure that the object operated on is an l-value rather than r-value. This solves compiler ambiguities and errors that lead to incorrect printout. Use it where the old CMN_LOG_HACK would be used. Normally, one doesn't need to call this method in other cases.

Definition at line 106 of file cmnLODOutputMultiplexer.h.

LogLoDType cmnLODOutputMultiplexer::GetLOD ( void   )  const [inline]

Returns the Level of Detail.

Definition at line 114 of file cmnLODOutputMultiplexer.h.

void cmnLODOutputMultiplexer::SetLOD ( LogLoDType  lod  )  [inline]

Sets the Level of Detail.

Definition at line 121 of file cmnLODOutputMultiplexer.h.


The documentation for this class was generated from the following file:
erc-cisst-devel<at>lists.johnshopkins.edu