Akumuli
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends
Public Member Functions | List of all members
Akumuli::ByteStreamReader Struct Referenceabstract

#include <stream.h>

Inheritance diagram for Akumuli::ByteStreamReader:
Akumuli::MemStreamReader Akumuli::ProtocolParser

Public Member Functions

virtual Byte get ()=0
 
virtual Byte pick () const =0
 
virtual bool is_eof ()=0
 
virtual int read (Byte *buffer, size_t buffer_len)=0
 
virtual void close ()=0
 
virtual std::tuple
< std::string, size_t > 
get_error_context (const char *error_message) const =0
 

Detailed Description

Stream reader that operates on byte level.

Member Function Documentation

virtual void Akumuli::ByteStreamReader::close ( )
pure virtual

Close stream.

Implemented in Akumuli::MemStreamReader, and Akumuli::ProtocolParser.

virtual Byte Akumuli::ByteStreamReader::get ( )
pure 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.

Implemented in Akumuli::MemStreamReader, and Akumuli::ProtocolParser.

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

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

Implemented in Akumuli::MemStreamReader, and Akumuli::ProtocolParser.

virtual bool Akumuli::ByteStreamReader::is_eof ( )
pure virtual

Check whether or not stream end is reached.

Returns
true if stream end is reached false otherwise.

Implemented in Akumuli::MemStreamReader, and Akumuli::ProtocolParser.

virtual Byte Akumuli::ByteStreamReader::pick ( ) const
pure 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.

Implemented in Akumuli::MemStreamReader, and Akumuli::ProtocolParser.

virtual int Akumuli::ByteStreamReader::read ( Byte *  buffer,
size_t  buffer_len 
)
pure 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.

Implemented in Akumuli::MemStreamReader, and Akumuli::ProtocolParser.


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