All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends
Public Member Functions | List of all members
Akumuli::ProtocolParser Class Reference
Inheritance diagram for Akumuli::ProtocolParser:

Public Member Functions

 ProtocolParser (std::shared_ptr< ProtocolConsumer > consumer)
void start ()
void parse_next (PDU pdu)
virtual Byte get ()
virtual Byte pick () const
virtual bool is_eof ()
virtual int read (Byte *buffer, size_t buffer_len)
virtual void close ()
virtual std::tuple
< std::string, size_t > 
get_error_context (const char *msg) const

Member Function Documentation

void Akumuli::ProtocolParser::close ( )

Close stream.

Implements Akumuli::ByteStreamReader.

Byte Akumuli::ProtocolParser::get ( )

Read one byte from stream (if any). If stream is empty StreamError exception is generated. User should check if there any data in the stream using function is_eof.

Implements Akumuli::ByteStreamReader.

std::tuple< std::string, size_t > Akumuli::ProtocolParser::get_error_context ( const char *  error_message) const

Method returns error context in form: Error message at "abcdefgh" ^

Implements Akumuli::ByteStreamReader.

bool Akumuli::ProtocolParser::is_eof ( )

Check whether or not stream end is reached.

true if stream end is reached false otherwise.

Implements Akumuli::ByteStreamReader.

Byte Akumuli::ProtocolParser::pick ( ) const

Read top element of the stream. If stream is closed or empty StreamError exception is generated. This method doesn't changes the state of the stream.

Implements Akumuli::ByteStreamReader.

int Akumuli::ProtocolParser::read ( Byte *  buffer,
size_t  buffer_len 

Read chunk of bytes from the stream. If buffer_len bytes was read to the buffer output parameter - method should return number of bytes read (it should be equal to buffer_len. If stream doesn't contains enough bytes, method should read all thats left to the buffer array and return number of bytes read (it should be less then buffer_len). If EOF was reached - method should return zero. If error occured (stream already closed) - negative value should be returned.

Implements Akumuli::ByteStreamReader.

The documentation for this class was generated from the following files: