template<class _element, class _trait = std::char_traits<_element>>
class cmnMultiplexerStreambufProxy< _element, _trait >
Types for dynamic control of output messages.
This includes debugging information, error reporting, state logging etc. This file declares class cmnMultiplexerStreambufProxy. It is a templated class derived from the standard library's basic_streambuf. But is stores a Level Of Detail (LOD) descriptor that applies to each message that's output through it. The LOD descriptor is transferred to a cmnLODMultiplexerStreambuf object, that stores a list of LODed output channels, and decides which ones will be actually used. The proxy is implemented by overriding basic_streambuf output functions xsputn(), overflow() and sync().
Usage: Include the module in your application with: #include <cmnMultiplexerStreambufProxy.h>
Attach a cmnMultiplexerStreambufProxy object with an ostream. The output functions << , put(), write() etc will operate directly on the cmnMultiplexerStreambufProxy.
Example of using a cmnLODOutputMultiplexer, which is an ostream that is attached to a proxy. Assume that the object lodMultiplexerStreambuf is a cmnLODMultiplexerStreambuf.
ofstream log("logfile.txt");
windowoutputstream display;
multiplexerStreambuf << "Hello, world" << endl;
Notes:
- It is assumed that none of the output channels modifies the data arguments.
- cmnMultiplexerStreambufProxy does not buffer data. Instead, whenever at attempt is made to use stream::put() on a stream with a multiplexer streambuf, the cmnMultiplexerStreambuf::overflow() is called automatically, and it forwards the character to the output channels.
- See Also
- C++ manual on basic_ostream and basic_streambuf. cmnOutputMultiplexer.h and cmnLODMultiplexerStreambuf.h