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


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.
// The multiple output channels ofstream log("logfile.txt"); windowoutputstream display; // hypothesized class lodMultiplexerStreambuf.AddChannel(log.rdbuf(), CMN_LOG_LOD_RUN_ERROR); lodMultiplexerStreambuf.AddChannel(windowoutputstream.rdbuf(), CMN_LOG_LOD_INIT_WARNING); cmnLODMultiplexer multiplexerOutput(&lodMultiplexetStreambuf, CMN_LOG_LOD_INIT_DEBUG); multiplexerStreambuf << "Hello, world" << endl; // channel the message only to 'log'
Notes:
Definition at line 88 of file cmnMultiplexerStreambufProxy.h.
| cmnMultiplexerStreambufProxy< _element, _trait >::cmnMultiplexerStreambufProxy | ( | ChannelType * | output, | |
| LogLoDType | lod | |||
| ) | [inline] |
Constructor: initialize the true output multiplexer and the current LOD.
Definition at line 102 of file cmnMultiplexerStreambufProxy.h.
| LogLoDType cmnMultiplexerStreambufProxy< _element, _trait >::GetLOD | ( | void | ) | const [inline] |
Returns the Level of Detail.
Definition at line 107 of file cmnMultiplexerStreambufProxy.h.
| void cmnMultiplexerStreambufProxy< _element, _trait >::SetLOD | ( | LogLoDType | lod | ) | [inline] |
Sets the Level of Detail.
Definition at line 112 of file cmnMultiplexerStreambufProxy.h.
| ChannelType* cmnMultiplexerStreambufProxy< _element, _trait >::GetOutput | ( | void | ) | const [inline] |
Returns a pointer to the output multiplexer.
Definition at line 122 of file cmnMultiplexerStreambufProxy.h.
| std::streamsize cmnMultiplexerStreambufProxy< _element, _trait >::xsputn | ( | const _element * | s, | |
| std::streamsize | n | |||
| ) | [protected, virtual] |
Override the basic_streambuf xsputn to do the multiplexing.
Definition at line 159 of file cmnMultiplexerStreambufProxy.h.
References cmnLODMultiplexerStreambuf< _element, _trait >::xsputn().
| int cmnMultiplexerStreambufProxy< _element, _trait >::sync | ( | void | ) | [protected, virtual] |
Override the basic_streambuf sync for multiplexing.
Definition at line 167 of file cmnMultiplexerStreambufProxy.h.
References cmnLODMultiplexerStreambuf< _element, _trait >::sync().
| cmnMultiplexerStreambufProxy< _element, _trait >::int_type cmnMultiplexerStreambufProxy< _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 179 of file cmnMultiplexerStreambufProxy.h.
References cmnLODMultiplexerStreambuf< _element, _trait >::overflow().