28 #ifndef _cmnMultiplexerStreambuf_h
29 #define _cmnMultiplexerStreambuf_h
93 template<
class _element,
class _trait = std::
char_traits<_element> >
99 typedef typename std::basic_streambuf<_element, _trait>::int_type
int_type;
131 return m_ChannelContainer;
142 virtual std::streamsize
xsputn(
const _element *s, std::streamsize n);
165 template<
class _element,
class _trait>
168 typename ChannelContainerType::iterator it = find(m_ChannelContainer.begin(), m_ChannelContainer.end(),
171 if (it == m_ChannelContainer.end()) {
172 m_ChannelContainer.insert(it, channel);
177 template<
class _element,
class _trait>
180 m_ChannelContainer.remove(channel);
184 template<
class _element,
class _trait>
187 std::streamsize ssize;
188 typename ChannelContainerType::iterator it;
189 for (it = m_ChannelContainer.begin(); it != m_ChannelContainer.end(); it++) {
190 ssize = (*it)->sputn(s, n);
196 template<
class _element,
class _trait>
199 typename ChannelContainerType::iterator it;
201 for (it = m_ChannelContainer.begin(); it != m_ChannelContainer.end(); it++) {
208 template<
class _element,
class _trait>
213 if (_trait::eq_int_type(_trait::eof(), c))
214 return (_trait::not_eof(c));
216 typename ChannelContainerType::iterator it;
219 for (it = m_ChannelContainer.begin(); it != m_ChannelContainer.end(); it++) {
220 (*it)->sputc(_trait::to_char_type(c));
224 return _trait::not_eof(c);
228 #endif // _cmnMultiplexerStreambuf_h
const ChannelContainerType & GetChannels() const
Definition: cmnMultiplexerStreambuf.h:129
Portability across compilers and operating systems tools.
virtual int sync()
Definition: cmnMultiplexerStreambuf.h:197
virtual int_type overflow(int_type c=_trait::eof())
Definition: cmnMultiplexerStreambuf.h:210
void RemoveChannel(ChannelType *channel)
Definition: cmnMultiplexerStreambuf.h:178
virtual std::streamsize xsputn(const _element *s, std::streamsize n)
Definition: cmnMultiplexerStreambuf.h:185
cmnMultiplexerStreambuf()
Definition: cmnMultiplexerStreambuf.h:109
A Streambuffer class that allows output to multiple streambuf objects.
Definition: cmnMultiplexerStreambuf.h:94
std::basic_streambuf< _element, _trait > ChannelType
Definition: cmnMultiplexerStreambuf.h:98
std::basic_streambuf< _element, _trait >::int_type int_type
Definition: cmnMultiplexerStreambuf.h:99
std::list< ChannelType * > ChannelContainerType
Definition: cmnMultiplexerStreambuf.h:104
void AddChannel(ChannelType *channel)
Definition: cmnMultiplexerStreambuf.h:166