26 #include <SimoxUtility/algorithm/string/string_tools.h>
30 bool flushOnlyOnNewLine) :
31 _buffer(1024), flushOnlyOnNewLine(flushOnlyOnNewLine)
33 _outBuffer.reserve(1024);
34 char* base = &_buffer.front();
35 setp(base, base + _buffer.size() - 1);
41 armarx::ArmarXLogBuf::overflow(
int c)
43 std::unique_lock lock(mutex);
49 if (epptr() == pptr())
60 armarx::ArmarXLogBuf::sync()
62 std::unique_lock lock(mutex);
68 armarx::ArmarXLogBuf::write()
70 for (
char *p = pbase(), *e = pptr(); p != e; ++p)
74 std::ptrdiff_t n = pptr() - pbase();
79 armarx::ArmarXLogBuf::flush()
82 if (!flushOnlyOnNewLine)
84 simox::alg::trim(_outBuffer);
86 if (_outBuffer.size() == 0)
94 if (!flushOnlyOnNewLine || _outBuffer.find(
'\n') != std::string::npos)