Akumuli
 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:
Akumuli::ByteStreamReader

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 ( )
virtual

Close stream.

Implements Akumuli::ByteStreamReader.

Byte Akumuli::ProtocolParser::get ( )
virtual

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
virtual

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

Implements Akumuli::ByteStreamReader.

bool Akumuli::ProtocolParser::is_eof ( )
virtual

Check whether or not stream end is reached.

Returns
true if stream end is reached false otherwise.

Implements Akumuli::ByteStreamReader.

Byte Akumuli::ProtocolParser::pick ( ) const
virtual

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 
)
virtual

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: