Classes | Public Types | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
coil::log_streambuf< _CharT, _Traits > Class Template Reference

log_streambuf template class More...

#include <Logger.h>

Inheritance diagram for coil::log_streambuf< _CharT, _Traits >:
Inheritance graph
[legend]

Classes

struct  Stream
 Structure for stream management. More...
 

Public Types

typedef _CharT char_type
 
typedef coil::Guard< coil::MutexGuard
 
typedef coil::Mutex Mutex
 
typedef std::basic_streambuf< char_type, traits_typestreambuf_type
 
typedef _Traits traits_type
 

Public Member Functions

void addStream (streambuf_type *stream, bool cleanup=false)
 Destructor. More...
 
std::vector< streambuf_type * > getBuffers ()
 Get stream buffer list. More...
 
 log_streambuf ()
 Constructor. More...
 
bool removeStream (streambuf_type *stream)
 Destructor. More...
 
virtual ~log_streambuf ()
 Destructor. More...
 

Protected Member Functions

virtual int overflow (int c=traits_type::eof())
 override of basic_streambuf::overflow More...
 
virtual std::streamsize stream_sputn ()
 Write the stream buffer in stream. More...
 
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. More...
 
virtual int sync ()
 override of basic_streambuf::sync More...
 
virtual std::streamsize xsputn (const char_type *s, std::streamsize n)
 override of basic_streambuf::xsputn More...
 

Private Member Functions

 log_streambuf (const log_streambuf &x)
 Copy Constructor. More...
 
log_streambufoperator= (const log_streambuf &x)
 Assignment operator. More...
 

Private Attributes

char m_buf [BUFFER_LEN]
 
Mutex m_mutex
 
std::vector< Streamm_streams
 

Detailed Description

template<typename _CharT, typename _Traits = std::char_traits<_CharT>>
class coil::log_streambuf< _CharT, _Traits >

log_streambuf template class

Definition at line 54 of file coil/common/Logger.h.

Member Typedef Documentation

template<typename _CharT , typename _Traits = std::char_traits<_CharT>>
typedef _CharT coil::log_streambuf< _CharT, _Traits >::char_type

Definition at line 58 of file coil/common/Logger.h.

template<typename _CharT , typename _Traits = std::char_traits<_CharT>>
typedef coil::Guard<coil::Mutex> coil::log_streambuf< _CharT, _Traits >::Guard

Definition at line 62 of file coil/common/Logger.h.

template<typename _CharT , typename _Traits = std::char_traits<_CharT>>
typedef coil::Mutex coil::log_streambuf< _CharT, _Traits >::Mutex

Definition at line 61 of file coil/common/Logger.h.

template<typename _CharT , typename _Traits = std::char_traits<_CharT>>
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.

template<typename _CharT , typename _Traits = std::char_traits<_CharT>>
typedef _Traits coil::log_streambuf< _CharT, _Traits >::traits_type

Definition at line 59 of file coil/common/Logger.h.

Constructor & Destructor Documentation

template<typename _CharT , typename _Traits = std::char_traits<_CharT>>
coil::log_streambuf< _CharT, _Traits >::log_streambuf ( )
inline

Constructor.

Constructor

Definition at line 79 of file coil/common/Logger.h.

template<typename _CharT , typename _Traits = std::char_traits<_CharT>>
virtual coil::log_streambuf< _CharT, _Traits >::~log_streambuf ( )
inlinevirtual

Destructor.

Destructor

Definition at line 103 of file coil/common/Logger.h.

template<typename _CharT , typename _Traits = std::char_traits<_CharT>>
coil::log_streambuf< _CharT, _Traits >::log_streambuf ( const log_streambuf< _CharT, _Traits > &  x)
private

Copy Constructor.

Copy Constructor

Parameters
xlog_streambuf object

Member Function Documentation

template<typename _CharT , typename _Traits = std::char_traits<_CharT>>
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.

Parameters
streama pointer to std::basic_streambuf type stream object

Definition at line 136 of file coil/common/Logger.h.

template<typename _CharT , typename _Traits = std::char_traits<_CharT>>
std::vector<streambuf_type*> coil::log_streambuf< _CharT, _Traits >::getBuffers ( )
inline

Get stream buffer list.

Return a stream buffer list.

Returns
streambuf_type list

Definition at line 196 of file coil/common/Logger.h.

template<typename _CharT , typename _Traits = std::char_traits<_CharT>>
log_streambuf& coil::log_streambuf< _CharT, _Traits >::operator= ( const log_streambuf< _CharT, _Traits > &  x)
private

Assignment operator.

Copy a log_streambuf object.

Parameters
xlog_streambuf object.
Returns
Assignment result.
template<typename _CharT , typename _Traits = std::char_traits<_CharT>>
virtual int coil::log_streambuf< _CharT, _Traits >::overflow ( int  c = traits_type::eof())
inlineprotectedvirtual

override of basic_streambuf::overflow

Parameters
cinput character
Returns
return value

Definition at line 322 of file coil/common/Logger.h.

template<typename _CharT , typename _Traits = std::char_traits<_CharT>>
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.

Parameters
streama pointer to std::basic_streambuf type stream object
Returns
Whether removing the stream succeeded.

Definition at line 163 of file coil/common/Logger.h.

template<typename _CharT , typename _Traits = std::char_traits<_CharT>>
virtual std::streamsize coil::log_streambuf< _CharT, _Traits >::stream_sputn ( )
inlineprotectedvirtual

Write the stream buffer in stream.

Returns
The number of characters written.

Definition at line 252 of file coil/common/Logger.h.

template<typename _CharT , typename _Traits = std::char_traits<_CharT>>
virtual std::streamsize coil::log_streambuf< _CharT, _Traits >::stream_sputn ( const char_type s,
std::streamsize  n 
)
inlineprotectedvirtual

Writes up to n characters from the array pointed by s to the output sequence controlled by the stream buffer.

Parameters
sa pointer to input characters
nnumber of input characters
Returns
The number of characters written.

Definition at line 293 of file coil/common/Logger.h.

template<typename _CharT , typename _Traits = std::char_traits<_CharT>>
virtual int coil::log_streambuf< _CharT, _Traits >::sync ( )
inlineprotectedvirtual

override of basic_streambuf::sync

Returns
return value

Definition at line 389 of file coil/common/Logger.h.

template<typename _CharT , typename _Traits = std::char_traits<_CharT>>
virtual std::streamsize coil::log_streambuf< _CharT, _Traits >::xsputn ( const char_type s,
std::streamsize  n 
)
inlineprotectedvirtual

override of basic_streambuf::xsputn

Parameters
sa pointer to input characters
nnumber of input characters
Returns
input stream size

Definition at line 226 of file coil/common/Logger.h.

Member Data Documentation

template<typename _CharT , typename _Traits = std::char_traits<_CharT>>
char coil::log_streambuf< _CharT, _Traits >::m_buf[BUFFER_LEN]
private

Definition at line 522 of file coil/common/Logger.h.

template<typename _CharT , typename _Traits = std::char_traits<_CharT>>
Mutex coil::log_streambuf< _CharT, _Traits >::m_mutex
private

Definition at line 521 of file coil/common/Logger.h.

template<typename _CharT , typename _Traits = std::char_traits<_CharT>>
std::vector<Stream> coil::log_streambuf< _CharT, _Traits >::m_streams
private

Definition at line 520 of file coil/common/Logger.h.


The documentation for this class was generated from the following file:


openrtm_aist
Author(s): Noriaki Ando
autogenerated on Thu Jun 6 2019 19:26:02