rili::stream::ReadableFileProxy Class Reference
Inheritance diagram for rili::stream::ReadableFileProxy:
[legend]
Collaboration diagram for rili::stream::ReadableFileProxy:
[legend]

Public Member Functions

 ReadableFileProxy (FILE *readableFile)
 
 ReadableFileProxy (FILE *readableFile, std::size_t preferedChunkSize)
 
void consume (std::size_t size) override
 
view::Base const & readableView () const override
 
std::exception_ptr pull (std::size_t count) override
 
- Public Member Functions inherited from rili::stream::Readable
void read (unsigned char *data, std::size_t size)
 
void read (char *data, std::size_t size)
 
void read (unsigned char &c)
 
void read (char &c)
 
OperationResult operator>> (char &v)
 
OperationResult operator>> (unsigned char &v)
 
OperationResult operator>> (short &v)
 
OperationResult operator>> (unsigned short &v)
 
OperationResult operator>> (long &v)
 
OperationResult operator>> (unsigned long &v)
 
OperationResult operator>> (long long &v)
 
OperationResult operator>> (unsigned long long &v)
 
OperationResult operator>> (int &v)
 
OperationResult operator>> (unsigned int &v)
 
OperationResult operator>> (float &v)
 
OperationResult operator>> (double &v)
 
OperationResult operator>> (bool &v)
 
OperationResult operator>> (void *&v)
 
OperationResult operator>> (std::string &v)
 
OperationResult operator>> (Reader const &fn)
 

Constructor & Destructor Documentation

rili::stream::ReadableFileProxy::ReadableFileProxy ( FILE *  readableFile)
inlineexplicit

ReadableFileProxy check if file is not nullptr and construct stream with prefferedChunkSize = 1024, otherwise throw std::invalid_argument exception.

Parameters
readableFileready to use open readable FILE*
rili::stream::ReadableFileProxy::ReadableFileProxy ( FILE *  readableFile,
std::size_t  preferedChunkSize 
)
inline

ReadableFileProxy check if file is not nullptr and construct stream with given prefferedChunkSize, otherwise throw exception.

Parameters
readableFileready to use open readable FILE*
preferedChunkSizenumber of bytes which will be tried to fetch at one shot from file if other size not explicitely asked for pull(std::size_t count) method. In case of unreliable/unpredictiable blocking data sources it's better to keep it relatively small. Otherwise read operation will block until whole chunk is avaliable even if higher level Reader do not need whole chunk. For reliable data sources like normal files bigger values will benefit in better preformance.

Member Function Documentation

void rili::stream::ReadableFileProxy::consume ( std::size_t  size)
overridevirtual

consume remove given number of bytes from front of view

Parameters
sizenumber of bytes to remove

Implements rili::stream::Readable.

std::exception_ptr rili::stream::ReadableFileProxy::pull ( std::size_t  count)
overridevirtual

pull used to pull from stream underlying sink at least given number of bytes

Parameters
countnumber of bytes to retrieve from sink
Returns
error exception if occured
Note
implementation of this function do not should provide at least count number of bytes to view.
count equal to 0 means implementation should provide zero or more bytes to view and implementation should choose easiest amount to provide.

Implements rili::stream::Readable.

view::Base const& rili::stream::ReadableFileProxy::readableView ( ) const
overridevirtual

readableView used to access stream view

Returns
view

Implements rili::stream::Readable.


The documentation for this class was generated from the following file:
  • rili/stream/CstdioWrappers.hpp