![]() |
RobWorkProject
23.9.11-
|
Buffers characters before writing them to the output stream. More...
#include <LogBufferedChar.hpp>
Inherits LogWriter.
Public Types | |
| enum | OverflowPolicy { REMOVE_FIRST , REMOVE_LAST , AUTO_FLUSH } |
| Behaviors for the OverflowPolicy. More... | |
Public Types inherited from LogWriter | |
| typedef rw::core::Ptr< LogWriter > | Ptr |
| smart pointer type to this class | |
Public Member Functions | |
| LogBufferedChar (size_t size, std::ostream *stream, OverflowPolicy policy=REMOVE_FIRST) | |
| Constructs a LogBufferedChar. More... | |
| virtual | ~LogBufferedChar () |
| 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 > | |
| LogWriter & | operator<< (T t) |
| general stream operator | |
| LogWriter & | operator<< (const std::string &str) |
| specialized stream operator 2 | |
| LogWriter & | operator<< (const Message &msg) |
| Write Message to log. More... | |
| LogWriter & | operator<< (const char *str) |
| specialized stream operator | |
| LogWriter & | operator<< (std::ostream &(*pf)(std::ostream &)) |
| Handle the std::endl and other stream functions. | |
Protected Member Functions | |
| void | doWrite (const std::string &str) |
| Writes str to the buffer. More... | |
| void | doFlush () |
| Flushes the buffer to the output stream. | |
| void | doSetTabLevel (int tablevel) |
| Set the tab level. More... | |
Buffers characters before writing them to the output stream.
The size of the buffer is fixed. On overflow the behavior depends on the specified OverFlowPolicy. If a single message is larger than the entire content of the buffer it is truncated.
| enum OverflowPolicy |
Behaviors for the OverflowPolicy.
| LogBufferedChar | ( | size_t | size, |
| std::ostream * | stream, | ||
| OverflowPolicy | policy = REMOVE_FIRST |
||
| ) |
Constructs a LogBufferedChar.
The LogBufferedMsg keeps a reference to the stream object. Destroying the stream object while the LogBufferedChar has a reference to it results in undefined behavior.
| size | [in] Size of buffer (in characters) |
| stream | [in] Stream to write to |
| policy | [in] Overflow policy. Default is REMOVE_FIRST |
|
virtual |
Destructor.
Calls flush before destroying the object
|
protectedvirtual |
Set the tab level.
Implements LogWriter.
|
protectedvirtual |