RobWorkProject  23.9.11-
Public Member Functions | Protected Member Functions | List of all members
LogBufferedMsg Class Reference

Buffers messages before writing them to the output stream. More...

#include <LogBufferedMsg.hpp>

Inherits LogWriter.

Public Member Functions

 LogBufferedMsg (std::ostream *stream)
 Constructs LogBufferedMsg with a target ostream. More...
 
virtual ~LogBufferedMsg ()
 Destructor. More...
 
- Public Member Functions inherited from LogWriter
virtual ~LogWriter ()
 Descructor.
 
void flush ()
 Flush method.
 
void setTabLevel (int tabLevel)
 Set the tab level.
 
void write (const std::string &str)
 Writes str to the log. More...
 
void write (const Message &msg)
 Writes msg to the log. More...
 
void writeln (const std::string &str)
 Writes str as a line. More...
 
template<class T >
LogWriteroperator<< (T t)
 general stream operator
 
LogWriteroperator<< (const std::string &str)
 specialized stream operator 2
 
LogWriteroperator<< (const Message &msg)
 Write Message to log. More...
 
LogWriteroperator<< (const char *str)
 specialized stream operator
 
LogWriteroperator<< (std::ostream &(*pf)(std::ostream &))
 Handle the std::endl and other stream functions.
 

Protected Member Functions

virtual void doWrite (const std::string &str)
 Writes str to the buffer. More...
 
virtual void doFlush ()
 Write content of buffer to output stream and flush it.
 
virtual void doSetTabLevel (int tablevel)
 Set the tab level. More...
 

Additional Inherited Members

- Public Types inherited from LogWriter
typedef rw::core::Ptr< LogWriterPtr
 smart pointer type to this class
 

Detailed Description

Buffers messages before writing them to the output stream.

The size of the buffer is not fixed and will grow until flush is called. To have a fixed size buffer use LogBufferedChar instead.

Constructor & Destructor Documentation

◆ LogBufferedMsg()

LogBufferedMsg ( std::ostream *  stream)

Constructs LogBufferedMsg with a target ostream.

The LogBufferedMsg keeps a reference to the stream object. Destroying the stream object while the LogBufferedMsg has a reference to it results in undefined behavior.

Parameters
stream[in] Stream to write to

◆ ~LogBufferedMsg()

virtual ~LogBufferedMsg ( )
virtual

Destructor.

Calls flush before destruction

Member Function Documentation

◆ doSetTabLevel()

virtual void doSetTabLevel ( int  tablevel)
protectedvirtual

Set the tab level.

Implements LogWriter.

◆ doWrite()

virtual void doWrite ( const std::string &  str)
protectedvirtual

Writes str to the buffer.

Parameters
str[in] str to write

Implements LogWriter.


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