|
DUNE-DAQ
DUNE Trigger and Data Acquisition software
|
Simple binary file reader for integer types. More...
#include <BinarySignalReader.hpp>
Public Member Functions | |
| BinarySignalReader (const std::string &filepath) | |
| Constructor - opens the file for reading. | |
| ~BinarySignalReader ()=default | |
| Destructor - closes the file. | |
| std::vector< T > | next (size_t n) |
| Read next chunk of data. | |
| bool | eof () |
| Check if we've reached end of file. | |
| std::streampos | tellg () |
| Get current file position. | |
| void | seekg (std::streampos pos) |
| Seek to specific position. | |
Private Attributes | |
| std::ifstream | m_file |
| bool | m_eof_reached |
Simple binary file reader for integer types.
Reads binary data from a file and returns it as the requested integer type. Used for reading int16_t test data.
Definition at line 27 of file BinarySignalReader.hpp.
|
explicit |
Constructor - opens the file for reading.
| filepath | Path to the binary file |
| std::runtime_error | if file cannot be opened |
Definition at line 19 of file BinarySignalReader.hxx.
|
default |
Destructor - closes the file.
| bool tpglibs::testapp::BinarySignalReader< T >::eof | ( | ) |
Check if we've reached end of file.
Definition at line 51 of file BinarySignalReader.hxx.
| std::vector< T > tpglibs::testapp::BinarySignalReader< T >::next | ( | size_t | n | ) |
Read next chunk of data.
| n | Number of elements to read (actual bytes = n * sizeof(T)) |
| std::runtime_error | if read fails |
Definition at line 27 of file BinarySignalReader.hxx.
| void tpglibs::testapp::BinarySignalReader< T >::seekg | ( | std::streampos | pos | ) |
Seek to specific position.
| pos | Position to seek to |
Definition at line 73 of file BinarySignalReader.hxx.
| std::streampos tpglibs::testapp::BinarySignalReader< T >::tellg | ( | ) |
Get current file position.
Definition at line 68 of file BinarySignalReader.hxx.
|
private |
Definition at line 69 of file BinarySignalReader.hpp.
|
private |
Definition at line 68 of file BinarySignalReader.hpp.