Go to the documentation of this file.
26 : m_state (start), m_max_size (size_), m_delimiter (delimiter_)
40 static const char* vmsg[] =
41 {
"start",
"waiting",
"complete",
"error",
"unknown state" };
44 return vmsg [
sizeof (vmsg)-1];
90 while (s_.
read (&c, 1) == 1)
std::string m_delimiter
Delimiter. Multibyte delimiter is allowed.
CharInBuffer is a bucket for the character-based streams/messages.
static const char * state_name(state_t state_)
Report the state name.
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
std::string m_buffer
Buffer to store the bytes received.
size_t m_max_size
Maximum allowable size (delimiter included) before overflow occurs.
@ complete
matched end-of-record - full record
virtual int read(char *buf_, const u_int size_)
Read expected number of bytes from the socket.
@ waiting
incomplete record is in the buffer
CharInBuffer(size_t size_, const string &delimiter_)
Constructor.
@ 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...
state_t state() const
Report the current state of the object.
@ error
overflow or Socket I/O error
state_t m_state
Internal state of an object.
void chop()
Remove the delimiter from the end of the buffer.
#define trace_with_mask(s, m)
void dump() const
Write the state of an object to the log file.