12 #ifndef CHAR_IN_BUFFER_H 13 #define CHAR_IN_BUFFER_H 21 #include <sys/types.h> 63 operator void* ()
const;
124 using namespace ASSA;
128 operator
void* ()
const size_t m_max_size
Maximum allowable size (delimiter included) before overflow occurs.
matched end-of-record - full record
const char * c_str() const
Get the constant character pointer to the buffer.
void reset()
Discard all accumulated characters and be ready to receive a new message.
incomplete record is in the buffer
void chop()
Remove the delimiter from the end of the buffer.
state_t state() const
Report the current state of the object.
state_t
States: start, waiting, complete, error.
friend ASSA::Socket & operator>>(ASSA::Socket &, ASSA::CharInBuffer &)
Read bytes from Socket stream until either record delimiter is detected, or EOF occured, or Socket stream is exhausted.
A collection of assert function wrappers.
std::string m_delimiter
Delimiter. Multibyte delimiter is allowed.
size_t length() const
Bytes in the buffer so far.
static const char * state_name(state_t state_)
Report the state name.
void dump() const
Write the state of an object to the log file.
CharInBuffer is a bucket for the character-based streams/messages.
std::string m_buffer
Buffer to store the bytes received.
size_t size() const
Bytes in the buffer so far.
CharInBuffer(size_t size_, const string &delimiter_)
Constructor.
overflow or Socket I/O error
void state(state_t new_state_)
Go to the new state.
state_t m_state
Internal state of an object.
Abstraction of socket data type.