ERC CISST - cisst software

cmnOutputMultiplexer Class Reference

#include <cmnOutputMultiplexer.h>

Inheritance diagram for cmnOutputMultiplexer:

Inheritance graph
[legend]
Collaboration diagram for cmnOutputMultiplexer:

Collaboration graph
[legend]
List of all members.

Detailed Description

Creates a collection of objects that channels output to multiple sinks.

Types for dynamic control of output messages. This includes debugging information, error reporting, state logging etc. This file declares *class cmnOutputMultiplexer*. a cmnOutputMultiplexer inherits the public interface of a generic ostream, and channels the output to multiple sinks.

Usage: Include the module in your application with: #include "cmnOutputMultiplexer.h"

Create a collection of ostream objects, and attach them to a cmnOutputMultiplexer. Use the standrard ostream syntax (operator <<) to stream objects to the multiplexer.

       ofstream log("logfile.txt");
       windowoutputstream display;  // hypothetical class

       cmnOutputMultiplexer multiplexer;
       multiplexer.AddChannel(&log);
       multiplexer.AddChannel(&windowoutputstream);

       multiplexer << "Hello, world" << endl;  // channel the message ot all streams.

Notes:

  1. cmnOutputMultiplexer does not OWN the output streams. They are created and destroyed externally.
  2. The initial implementation uses a list to store the addresses of the output channels. There is no guarantee on the order of storage or the order of output channelling.
  3. It is assumed that none of the output channels modifies the data arguments.
  4. The multiplexer does not buffer any output. There is no implementation for seekp() and tellp().
  5. It is guaranteed that at most one instance of an ostream object is stored as a channel in a single multiplexer. The AddChannel() function checks for uniqueness.

Definition at line 81 of file cmnOutputMultiplexer.h.

Public Types

Public Member Functions

Protected Attributes


Member Typedef Documentation

typedef std::list<ChannelType *> cmnOutputMultiplexer::ChannelContainerType

Type of internal data structure storing the channels.

Definition at line 88 of file cmnOutputMultiplexer.h.


Constructor & Destructor Documentation

cmnOutputMultiplexer::cmnOutputMultiplexer (  )  [inline]

Default constructor - initialize base class.

Definition at line 91 of file cmnOutputMultiplexer.h.


Member Function Documentation

ChannelType& cmnOutputMultiplexer::AddChannel ( ChannelType channel  ) 

Add an output channel. See notes above.

Parameters:
channel A pointer to the output channel to be added.

ChannelType& cmnOutputMultiplexer::RemoveChannel ( ChannelType channel  ) 

Remove an output channel.

Parameters:
channel A pointer to the output channel to be removed. No change occurs if the pointer is not on the list of channels for this multiplexer.
Returns:
channel Returns *this, The output channel.

const ChannelContainerType& cmnOutputMultiplexer::GetChannels (  )  const [inline]

Enable access to the channel storage, without addition or removal of channels. Elements of the container can be accessed using the standard const_iterator interfaces. Note that the channels themselves are non-const, so individual manipulation of each is enabled.

Definition at line 111 of file cmnOutputMultiplexer.h.


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