Abstract VRS internal helper class to read & (if necessary) uncompress records.
More...
#include <RecordReaders.h>
|
|
FileHandler * | file_ |
| |
|
uint32_t | remainingDiskBytes_ |
| |
|
uint32_t | remainingUncompressedSize_ |
| |
|
int | fileError_ {} |
| |
Abstract VRS internal helper class to read & (if necessary) uncompress records.
◆ finish()
| virtual void vrs::RecordReader::finish |
( |
| ) |
|
|
inlinevirtual |
◆ getCompressionType()
◆ getFileError()
| int vrs::RecordReader::getFileError |
( |
| ) |
const |
|
inline |
Get the first error returned by the file handler while reading the current record, if any. Errors such as decompression failures or reads past the end of the record aren't file errors.
- Returns
- 0 if no file error happened since init().
◆ getUnreadBytes()
| uint32_t vrs::RecordReader::getUnreadBytes |
( |
| ) |
const |
|
inline |
Tell how many bytes of record data haven't been read/consumed yet.
- Returns
- Number of unread bytes (uncompressed).
◆ getUnreadDiskBytes()
| uint32_t vrs::RecordReader::getUnreadDiskBytes |
( |
| ) |
const |
|
inline |
Tell how many disk bytes of record data haven't been read/consumed yet.
- Returns
- Number of unread disk bytes.
◆ init()
Initialize the RecordReader to read a record from a file.
- Parameters
-
| file | File to read from, ready to read the record at the current file position. |
| diskSize | Size of the record on disk. |
| expandedSize | Size of the record uncompressed. |
- Returns
- Pointer to the reader.
◆ read() [1/3]
| virtual int vrs::RecordReader::read |
( |
DataReference & |
destination, |
|
|
uint32_t & |
outReadSize |
|
) |
| |
|
pure virtual |
◆ read() [2/3]
template<typename T , std::enable_if_t< std::is_trivially_copyable< T >::value, int > = 0>
| int vrs::RecordReader::read |
( |
std::vector< T > & |
buffer | ) |
|
|
inline |
Fill-up a buffer. Might reduce the buffer's size, if not enough data was available.
- Parameters
-
| buffer | Reference to a buffer of bytes to fill-up. |
- Returns
- 0 on success, or a non-zero error code.
◆ read() [3/3]
| int vrs::RecordReader::read |
( |
void * |
destination, |
|
|
size_t |
size |
|
) |
| |
|
inline |
Read a number of bytes to the destination buffer. If the record is compressed, the data is uncompressed.
- Parameters
-
| destination | Pointer to the buffer where to write the read data. |
| size | Number of bytes to read. |
- Returns
- 0 on success, or a non-zero error code.
The documentation for this class was generated from the following files: