28 #ifndef _cmnLODMultiplexerStreambuf_h
29 #define _cmnLODMultiplexerStreambuf_h
107 template <
class _element,
class _trait = std::
char_traits<_element> >
235 typedef typename std::basic_streambuf<_element, _trait>::int_type
int_type;
240 virtual std::streamsize
xsputn(
const _element * s, std::streamsize n,
cmnLogLevel level);
256 virtual std::streamsize
xsputn(
const _element *s, std::streamsize n);
301 template <
class _element,
class _trait>
306 if (it == Channels.end()) {
314 template <
class _element,
class _trait>
319 if (it == Multiplexers.end()) {
320 Multiplexers.insert(it, multiplexer);
327 template <
class _element,
class _trait>
332 if (it != Channels.end()) {
338 template <
class _element,
class _trait>
343 if (it != Multiplexers.end()) {
344 Multiplexers.erase(it);
349 template <
class _element,
class _trait>
353 Multiplexers.clear();
357 template <
class _element,
class _trait>
361 if (it != Channels.end()) {
369 template <
class _element,
class _trait>
373 if (it != Channels.end()) {
381 template <
class _element,
class _trait>
385 std::streamsize ssize(0);
388 for (channelIt = Channels.begin();
389 channelIt != channelEnd;
391 if (level & ((*channelIt).second)) {
392 ssize = ((*channelIt).first)->sputn(s, n);
398 for (multiplexerIt = Multiplexers.begin();
399 multiplexerIt != multiplexerEnd;
401 ssize = (*multiplexerIt)->xsputn(s, n, level);
407 template <
class _element,
class _trait>
413 for (channelIt = Channels.begin();
414 channelIt != channelEnd;
416 ((*channelIt).first)->pubsync();
421 for (multiplexerIt = Multiplexers.begin();
422 multiplexerIt != multiplexerEnd;
424 (*multiplexerIt)->sync();
430 template <
class _element,
class _trait>
435 if (_trait::eq_int_type(_trait::eof(), c)) {
436 return (_trait::not_eof(c));
442 for (channelIt = Channels.begin();
443 channelIt != channelEnd;
445 if (level & ((*channelIt).second)) {
446 ((*channelIt).first)->sputc(_trait::to_char_type(c));
452 for (multiplexerIt = Multiplexers.begin();
453 multiplexerIt != multiplexerEnd;
455 (*multiplexerIt)->overflow(c, level);
458 return _trait::not_eof(c);
462 template <
class _element,
class _trait>
465 std::streamsize ssize(0);
469 for (channelIt = Channels.begin();
470 channelIt != channelEnd;
472 ssize = ((*channelIt).first)->sputn(s, n);
477 for (multiplexerIt = Multiplexers.begin();
478 multiplexerIt != multiplexerEnd;
480 ssize = (*multiplexerIt)->xsputn(s, n);
486 template <
class _element,
class _trait>
491 if (_trait::eq_int_type(_trait::eof(), c)) {
492 return (_trait::not_eof(c));
498 for (channelIt = Channels.begin();
499 channelIt != channelEnd;
501 ((*channelIt).first)->sputc(_trait::to_char_type(c));
506 for (multiplexerIt = Multiplexers.begin();
507 multiplexerIt != multiplexerEnd;
509 (*multiplexerIt)->overflow(c);
513 return _trait::not_eof(c);
517 template <
class _element,
class _trait>
522 while (it != Channels.end()) {
523 if ((*it).first == channel) {
532 template <
class _element,
class _trait>
537 while (it != Channels.end()) {
538 if ((*it).first == channel) {
547 template <
class _element,
class _trait>
552 while (it != Multiplexers.end()) {
553 if ((*it) == multiplexer) {
562 template <
class _element,
class _trait>
567 while (it != Multiplexers.end()) {
568 if ((*it) == multiplexer) {
std::basic_streambuf< _element, _trait > BaseClassType
Definition: cmnLODMultiplexerStreambuf.h:115
ChannelContainerType Channels
Definition: cmnLODMultiplexerStreambuf.h:267
Portability across compilers and operating systems tools.
Declaration of Levels of Detail for cmnLogger (human readable logging)
ChannelContainerType::const_iterator ConstIteratorType
Definition: cmnLODMultiplexerStreambuf.h:126
std::basic_streambuf< _element, _trait >::int_type int_type
Definition: cmnLODMultiplexerStreambuf.h:235
MultiplexerContainerType Multiplexers
Definition: cmnLODMultiplexerStreambuf.h:281
ChannelContainerType::iterator IteratorType
Definition: cmnLODMultiplexerStreambuf.h:125
const ChannelContainerType & GetChannels(void) const
Definition: cmnLODMultiplexerStreambuf.h:226
void RemoveChannel(ChannelType *channel)
Definition: cmnLODMultiplexerStreambuf.h:328
short cmnLogLevel
Definition: cmnLogLoD.h:55
Types for dynamic control of output messages.
Definition: cmnForwardDeclarations.h:40
std::list< ThisType * > MultiplexerContainerType
Definition: cmnLODMultiplexerStreambuf.h:128
void RemoveChannel(std::ostream &outstream)
Definition: cmnLODMultiplexerStreambuf.h:190
bool AddChannel(std::ostream &outstream, cmnLogMask mask)
Definition: cmnLODMultiplexerStreambuf.h:163
IteratorType FindChannel(const ChannelType *channel)
Definition: cmnLODMultiplexerStreambuf.h:519
bool AddMultiplexer(ThisType *multiplexer)
Definition: cmnLODMultiplexerStreambuf.h:315
bool SetChannelMask(ChannelType *channel, cmnLogMask mask)
Definition: cmnLODMultiplexerStreambuf.h:358
cmnLODMultiplexerStreambuf< _element, _trait > ThisType
Definition: cmnLODMultiplexerStreambuf.h:114
virtual int_type overflow(int_type c, cmnLogLevel level)
Definition: cmnLODMultiplexerStreambuf.h:432
std::basic_streambuf< _element, _trait > ChannelType
Definition: cmnLODMultiplexerStreambuf.h:116
std::list< ElementType > ChannelContainerType
Definition: cmnLODMultiplexerStreambuf.h:124
virtual std::streamsize xsputn(const _element *s, std::streamsize n, cmnLogLevel level)
Definition: cmnLODMultiplexerStreambuf.h:382
short cmnLogMask
Definition: cmnLogLoD.h:67
void RemoveMultiplexer(ThisType *multiplexer)
Definition: cmnLODMultiplexerStreambuf.h:339
MultiplexerContainerType::iterator MultiplexerIteratorType
Definition: cmnLODMultiplexerStreambuf.h:129
MultiplexerIteratorType FindMultiplexer(const ThisType *multiplexer)
Definition: cmnLODMultiplexerStreambuf.h:549
bool AddChannel(ChannelType *channel, cmnLogMask mask)
Definition: cmnLODMultiplexerStreambuf.h:302
void RemoveAllChannels(void)
Definition: cmnLODMultiplexerStreambuf.h:350
std::pair< ChannelType *, cmnLogMask > ElementType
Definition: cmnLODMultiplexerStreambuf.h:118
#define CMN_LOG_ALLOW_ALL
Definition: cmnLogLoD.h:75
virtual int sync()
Definition: cmnLODMultiplexerStreambuf.h:408
cmnLODMultiplexerStreambuf(std::ofstream &fileStream)
Definition: cmnLODMultiplexerStreambuf.h:136
cmnLODMultiplexerStreambuf()
Definition: cmnLODMultiplexerStreambuf.h:143
bool GetChannelMask(const ChannelType *channel, cmnLogMask &mask) const
Definition: cmnLODMultiplexerStreambuf.h:370
A Streambuffer class that allows output to multiple streambuf objects for Level of Detail information...
Definition: cmnLODMultiplexerStreambuf.h:108
MultiplexerContainerType::const_iterator MultiplexerConstIteratorType
Definition: cmnLODMultiplexerStreambuf.h:130