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;
multiplexer << "Hello, world" << endl;
Notes:
- cmnOutputMultiplexer does not OWN the output streams. They are created and destroyed externally.
- 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.
- It is assumed that none of the output channels modifies the data arguments.
- The multiplexer does not buffer any output. There is no implementation for seekp() and tellp().
- 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.