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

Public Member Functions

 MemStreamReader (const Byte *buffer, size_t buffer_len)
 
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 *error_message) const
 

Member Function Documentation

void Akumuli::MemStreamReader::close ( )
virtual

Close stream.

Implements Akumuli::ByteStreamReader.

Byte Akumuli::MemStreamReader::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::MemStreamReader::get_error_context ( const char *  error_message) const
virtual

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

Implements Akumuli::ByteStreamReader.

bool Akumuli::MemStreamReader::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::MemStreamReader::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::MemStreamReader::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: