|
pflib v3.9.0-rc3-11-g2537d8f
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. | |
| bool | eof () const override |
| check if file is done | |
Public Member Functions inherited from pflib::packing::Reader | |
| 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 or done state. | |
| virtual | operator bool () const |
| Check if reader is in good state and is not done reading yet. | |
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 |
check if file is done
Implements pflib::packing::Reader.
|
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.