Datasource which reads TDR data from a disk.
More...
#include <FileReader.hpp>
Datasource which reads TDR data from a disk.
New files can be added to a queue by calling addFile(). File is checked to be a valid TDR file in that moment. Filereader handles gzipped TDR files automatically. After the last file is fully consumed the method allDone() will return true.
◆ FileReader()
| pottu::FileReader::FileReader |
( |
uint32_t |
blocksAtOnce = 1 | ) |
|
|
inline |
Construct the Filereader object.
- Parameters
-
| blocksAtOnce | Maximum number of datablocks the filereader reads and pushes to output in each call to process(). Default is one. |
◆ addFile()
| void pottu::FileReader::addFile |
( |
const std::string & |
filename | ) |
|
|
inline |
Adds a new TDR file into the queue.
- Parameters
-
| filename | Filename of the file to be added. |
This method can be used for both normal and gzipped files. The method opens the file and checks that it is a valid TDR file. Also the total size of the files is incremented.
◆ allDone()
| virtual bool pottu::FileReader::allDone |
( |
| ) |
const |
|
inlinevirtualnoexcept |
Tells if all the files are processed.
- Returns
- True if there is nothing to return anymore by method process().
Implements pottu::DataSource.
◆ getBlocksRead()
| uint64_t pottu::FileReader::getBlocksRead |
( |
| ) |
const |
|
inline |
Returns number of blocks read.
- Returns
- Number of blocks read.
◆ getProgress()
| double pottu::FileReader::getProgress |
( |
| ) |
const |
|
inlinenoexcept |
Returns the fraction of read unpacked bytes to the total size of the all files queued.
- Returns
- The fraction of read unpacked bytes to the total size of the all files queued. Should be unity when the method allDone() returns true.
◆ getProgressReport()
| bool pottu::FileReader::getProgressReport |
( |
| ) |
const |
|
inlinenoexcept |
Returns the state of automatic progress reporting.
- Returns
- Current state of the automatic progress reporting.
◆ getTotalBytesRead()
| uint64_t pottu::FileReader::getTotalBytesRead |
( |
| ) |
const |
|
inline |
Returns number of total bytes read this far by this object.
- Returns
- Number of total bytes read this far by this object.
Note that these bytes are extracted ungzipped bytes i.e. can be more than the file bytes consumed.
◆ getTotalBytesReadFromFile()
| uint64_t pottu::FileReader::getTotalBytesReadFromFile |
( |
| ) |
const |
|
inline |
Returns number of total bytes read from all files without unpacking.
- Returns
- Number of total bytes read from the filesystem without unpacking.
This returns the same number as getTotalBytesRead() if the file is not gzipped.
◆ process()
| virtual void pottu::FileReader::process |
( |
std::vector< dataitem_t > & |
dp | ) |
|
|
inlinevirtual |
Reads data from file to a container.
- Parameters
-
| dp | Container to be filled with raw dataitems read from file. |
Container dp is always cleared by process() before adding new items.
Implements pottu::DataSource.
◆ setProgressReport()
| void pottu::FileReader::setProgressReport |
( |
bool |
state = true | ) |
|
|
inlinenoexcept |
Sets the state of automatic progress reporting.
- Parameters
-
| state | Set to true (default) if you want an automatic progress report every 2 seconds into the console. |
The documentation for this class was generated from the following file: