#include <cmnMultiplexerStreambuf.h>
Inheritance diagram for cmnMultiplexerStreambuf< _element, _trait >:


Types for dynamic control of output messages. This includes debugging information, error reporting, state logging etc. This file declares *class cmnMultiplexerStreambuf*. It is a templated class derived from the standard library's basic_streambuf, with the main additional feature that enables channeling the output to multiple other streambuf objects. The multiplexing is implemented by overriding basic_streambuf output functions xsputn(), overflow() and sync().
Usage: Include the module in your application with: #include "cmnMultiplexerStreambuf.h"
Add output streambuf channels to the multiplexer using the AddChannel() method.
Remove output channels from the multiplexer using the RemoveChannel() method.
Attach a cmnMultiplexerStreambuf object with an ostream. The output functions << , put(), write() etc will operate directly on the cmnMultiplexerStreambuf.
Example of using a cmnOutputMultiplexer, which is an ostream using a cmnMultiplexerStrembuf (an output stream with multiplexer streambuf):
ofstream log("logfile.txt"); windowoutputstream display; // hypothesized class cmnOutputMultiplexer multiplexer; multiplexer.AddChannel(&log); multiplexer.AddChannel(&windowoutputstream); multiplexer << "Hello, world" << endl; // channel the message to all streams.
Notes:
Definition at line 95 of file cmnMultiplexerStreambuf.h.
| typedef std::list<ChannelType *> cmnMultiplexerStreambuf< _element, _trait >::ChannelContainerType |
Type of internal data structure storing the channels.
Definition at line 105 of file cmnMultiplexerStreambuf.h.
| cmnMultiplexerStreambuf< _element, _trait >::cmnMultiplexerStreambuf | ( | ) | [inline] |
Constructor: currently empty.
Definition at line 110 of file cmnMultiplexerStreambuf.h.
| void cmnMultiplexerStreambuf< _element, _trait >::AddChannel | ( | ChannelType * | channel | ) |
Add an output channel. See notes above.
| channel | A pointer to the output channel to be added. |
Definition at line 167 of file cmnMultiplexerStreambuf.h.
| void cmnMultiplexerStreambuf< _element, _trait >::RemoveChannel | ( | ChannelType * | channel | ) |
Remove an output channel.
| 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. |
Definition at line 179 of file cmnMultiplexerStreambuf.h.
| const ChannelContainerType& cmnMultiplexerStreambuf< _element, _trait >::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 130 of file cmnMultiplexerStreambuf.h.
| std::streamsize cmnMultiplexerStreambuf< _element, _trait >::xsputn | ( | const _element * | s, | |
| std::streamsize | n | |||
| ) | [protected, virtual] |
Override the basic_streambuf xsputn to do the multiplexing.
Definition at line 186 of file cmnMultiplexerStreambuf.h.
| int cmnMultiplexerStreambuf< _element, _trait >::sync | ( | ) | [protected, virtual] |
Override the basic_streambuf sync for multiplexing.
Definition at line 198 of file cmnMultiplexerStreambuf.h.
| cmnMultiplexerStreambuf< _element, _trait >::int_type cmnMultiplexerStreambuf< _element, _trait >::overflow | ( | int_type | c = _trait::eof() |
) | [protected, virtual] |
Override the basic_streambuf overflow for multiplexing. overflow() is called when sputc() discovers it does not have space in the storage buffer. In our case, it's always. See more on it in the basic_streambuf documentation.
Definition at line 211 of file cmnMultiplexerStreambuf.h.