40 static const char*
vmsg[] =
41 {
"start",
"waiting",
"complete",
"error",
"unknown state" };
90 while (
s_.read (&
c, 1) == 1)
94 if (
b_.m_buffer.size() <
b_.m_delimiter.size()) {
98 if (
b_.m_buffer.substr (
99 b_.m_buffer.size ()-
b_.m_delimiter.size ()) ==
b_.m_delimiter)
106 if (
b_.m_buffer.length () >=
b_.m_max_size) {
A bucket for collecting character-based stream records of certain length or terminated by designated ...
An abstraction to message logging facility.
#define DL(X)
A macro for writing debug message to the Logger.
#define trace_with_mask(s, m)
trace_with_mask() is used to trace function call chain in C++ program.
A Hex/Ascii memory dump of similar to od(1) UNIX utility.
A wrapper class to provide AutoPtr with reference semantics.
CharInBuffer is a bucket for the character-based streams/messages.
static const char * state_name(state_t state_)
Report the state name.
std::string m_buffer
Buffer to store the bytes received.
state_t m_state
Internal state of an object.
CharInBuffer(size_t size_, const string &delimiter_)
Constructor.
std::string m_delimiter
Delimiter. Multibyte delimiter is allowed.
state_t
States: start, waiting, complete, error.
@ complete
matched end-of-record - full record
@ error
overflow or Socket I/O error
@ waiting
incomplete record is in the buffer
size_t m_max_size
Maximum allowable size (delimiter included) before overflow occurs.
state_t state() const
Report the current state of the object.
void dump() const
Write the state of an object to the log file.
static void dump_to_log(unsigned long mask_, const char *info_, const char *msg_, int len_)
Write hex/ascii dump of a memory region to log file.
@ TRACE
Function call trace
@ CHARINBUF
Class CharInBuffer messages
Socket & operator>>(Socket &s_, CharInBuffer &b_)
Regardless of the delimeter size, which can be >1, add the character received to the buffer and compa...