pflib v3.0.0-rc1-29-g3a901ac
Pretty Fine HGCROC Interaction Library
|
This class is a helper class for reading the buffer stored in the raw data format. More...
#include <BufferReader.h>
Public Member Functions | |
BufferReader (const std::vector< uint8_t > &b) | |
Initialize a reader by wrapping a buffer to read. | |
~BufferReader ()=default | |
default destructor so handle to buffer is given up | |
void | seek (int off) override |
go to the index off in bytes | |
int | tell () override |
return where in the word we are in bytes | |
Reader & | read (char *w, std::size_t count) override |
read the next count bytes into array w and move the index | |
bool | good () const override |
Return state of buffer. | |
![]() | |
Reader ()=default | |
default constructor | |
virtual | ~Reader ()=default |
virtual destructor for inheritance | |
template<typename WordType , std::enable_if_t< std::is_integral< WordType >::value, bool > = true> | |
void | seek (int off) |
Seek by number of words. | |
template<typename WordType > | |
int | tell () |
Tell by number of words. | |
template<typename WordType , std::enable_if_t< std::is_integral< WordType >::value, bool > = true> | |
Reader & | read (WordType *w, std::size_t count) |
Read the next 'count' words into the input handle. | |
template<typename WordType , std::enable_if_t< std::is_integral< WordType >::value, bool > = true> | |
Reader & | operator>> (WordType &w) |
Stream the next word into the input handle. | |
template<typename ObjectType , std::enable_if_t< std::is_class< ObjectType >::value, bool > = true> | |
Reader & | operator>> (ObjectType &o) |
Stream into a class object. | |
template<typename ContentType > | |
Reader & | read (std::vector< ContentType > &vec, std::size_t count, std::size_t offset=0) |
Read the next 'count' objects into the input vector. | |
virtual bool | operator! () const |
Check if reader is in a fail state. | |
virtual | operator bool () const |
Check if reader is in good/bad state. | |
virtual bool | eof ()=0 |
check if file is done | |
Private Attributes | |
const std::vector< uint8_t > & | buffer_ |
std::size_t | i_word_ |
This class is a helper class for reading the buffer stored in the raw data format.
The raw data format specifies that the buffer for all data is a specific type (vector of bytes), but the users in different subsystems/translators may want the buffer to be read in different size words than single bytes. This class helps in that translation.
|
overridevirtual |
Return state of buffer.
false if buffer is done being read, true otherwise.
Implements pflib::packing::Reader.
|
overridevirtual |
read the next count bytes into array w and move the index
Implements pflib::packing::Reader.
|
overridevirtual |
go to the index off in bytes
Implements pflib::packing::Reader.
|
overridevirtual |
return where in the word we are in bytes
Implements pflib::packing::Reader.