log_streambuf template class More...
#include <Logger.h>
Classes | |
struct | Stream |
Structure for stream management. More... | |
Public Types | |
typedef _CharT | char_type |
typedef coil::Guard< coil::Mutex > | Guard |
typedef coil::Mutex | Mutex |
typedef std::basic_streambuf < char_type, traits_type > | streambuf_type |
typedef _Traits | traits_type |
Public Member Functions | |
void | addStream (streambuf_type *stream, bool cleanup=false) |
Destructor. | |
std::vector< streambuf_type * > | getBuffers () |
Get stream buffer list. | |
log_streambuf () | |
Constructor. | |
bool | removeStream (streambuf_type *stream) |
Destructor. | |
virtual | ~log_streambuf () |
Destructor. | |
Protected Member Functions | |
virtual int | overflow (int c=traits_type::eof()) |
override of basic_streambuf::overflow | |
virtual std::streamsize | stream_sputn () |
Write the stream buffer in stream. | |
virtual std::streamsize | stream_sputn (const char_type *s, std::streamsize n) |
Writes up to n characters from the array pointed by s to the output sequence controlled by the stream buffer. | |
virtual int | sync () |
override of basic_streambuf::sync | |
virtual std::streamsize | xsputn (const char_type *s, std::streamsize n) |
override of basic_streambuf::xsputn | |
Private Member Functions | |
log_streambuf (const log_streambuf &x) | |
Copy Constructor. | |
log_streambuf & | operator= (const log_streambuf &x) |
Assignment operator. | |
Private Attributes | |
char | m_buf [BUFFER_LEN] |
Mutex | m_mutex |
std::vector< Stream > | m_streams |
log_streambuf template class
Definition at line 54 of file coil/common/Logger.h.
typedef _CharT coil::log_streambuf< _CharT, _Traits >::char_type |
Definition at line 58 of file coil/common/Logger.h.
typedef coil::Guard<coil::Mutex> coil::log_streambuf< _CharT, _Traits >::Guard |
Definition at line 62 of file coil/common/Logger.h.
typedef coil::Mutex coil::log_streambuf< _CharT, _Traits >::Mutex |
Definition at line 61 of file coil/common/Logger.h.
typedef std::basic_streambuf<char_type, traits_type> coil::log_streambuf< _CharT, _Traits >::streambuf_type |
Definition at line 60 of file coil/common/Logger.h.
typedef _Traits coil::log_streambuf< _CharT, _Traits >::traits_type |
Definition at line 59 of file coil/common/Logger.h.
coil::log_streambuf< _CharT, _Traits >::log_streambuf | ( | ) | [inline] |
virtual coil::log_streambuf< _CharT, _Traits >::~log_streambuf | ( | ) | [inline, virtual] |
coil::log_streambuf< _CharT, _Traits >::log_streambuf | ( | const log_streambuf< _CharT, _Traits > & | x | ) | [private] |
void coil::log_streambuf< _CharT, _Traits >::addStream | ( | streambuf_type * | stream, |
bool | cleanup = false |
||
) | [inline] |
Destructor.
This operation adds a stream that is actual output stream. User has responsibility to destruct the stream object, since this object never destructs the stream objects. The added stream objects should not be destructed before the destruction of this object. The stream destruction should be done by user after removing it from this object or destructing this object.
stream | a pointer to std::basic_streambuf type stream object |
Definition at line 136 of file coil/common/Logger.h.
std::vector<streambuf_type*> coil::log_streambuf< _CharT, _Traits >::getBuffers | ( | ) | [inline] |
Get stream buffer list.
Return a stream buffer list.
Definition at line 196 of file coil/common/Logger.h.
log_streambuf& coil::log_streambuf< _CharT, _Traits >::operator= | ( | const log_streambuf< _CharT, _Traits > & | x | ) | [private] |
Assignment operator.
Copy a log_streambuf object.
x | log_streambuf object. |
virtual int coil::log_streambuf< _CharT, _Traits >::overflow | ( | int | c = traits_type::eof() | ) | [inline, protected, virtual] |
override of basic_streambuf::overflow
c | input character |
Definition at line 322 of file coil/common/Logger.h.
bool coil::log_streambuf< _CharT, _Traits >::removeStream | ( | streambuf_type * | stream | ) | [inline] |
Destructor.
This operation remove a stream that is actual output stream. User has responsibility to destruct the stream object.
stream | a pointer to std::basic_streambuf type stream object |
Definition at line 163 of file coil/common/Logger.h.
virtual std::streamsize coil::log_streambuf< _CharT, _Traits >::stream_sputn | ( | ) | [inline, protected, virtual] |
Write the stream buffer in stream.
Definition at line 252 of file coil/common/Logger.h.
virtual std::streamsize coil::log_streambuf< _CharT, _Traits >::stream_sputn | ( | const char_type * | s, |
std::streamsize | n | ||
) | [inline, protected, virtual] |
Writes up to n characters from the array pointed by s to the output sequence controlled by the stream buffer.
s | a pointer to input characters |
n | number of input characters |
Definition at line 293 of file coil/common/Logger.h.
virtual int coil::log_streambuf< _CharT, _Traits >::sync | ( | ) | [inline, protected, virtual] |
override of basic_streambuf::sync
Definition at line 389 of file coil/common/Logger.h.
virtual std::streamsize coil::log_streambuf< _CharT, _Traits >::xsputn | ( | const char_type * | s, |
std::streamsize | n | ||
) | [inline, protected, virtual] |
override of basic_streambuf::xsputn
s | a pointer to input characters |
n | number of input characters |
Definition at line 226 of file coil/common/Logger.h.
char coil::log_streambuf< _CharT, _Traits >::m_buf[BUFFER_LEN] [private] |
Definition at line 522 of file coil/common/Logger.h.
Mutex coil::log_streambuf< _CharT, _Traits >::m_mutex [private] |
Definition at line 521 of file coil/common/Logger.h.
std::vector<Stream> coil::log_streambuf< _CharT, _Traits >::m_streams [private] |
Definition at line 520 of file coil/common/Logger.h.