DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
BinarySignalReader.hpp
Go to the documentation of this file.
1
9#ifndef TPGLIBS_TESTAPP_BINARYSIGNALREADER_HPP_
10#define TPGLIBS_TESTAPP_BINARYSIGNALREADER_HPP_
11
12#include <fstream>
13#include <vector>
14#include <string>
15#include <stdexcept>
16
17namespace tpglibs {
18namespace testapp {
19
26template<typename T>
28 public:
34 explicit BinarySignalReader(const std::string& filepath);
35
40
47 std::vector<T> next(size_t n);
48
53 bool eof();
54
59 std::streampos tellg();
60
65 void seekg(std::streampos pos);
66
67 private:
68 std::ifstream m_file;
70};
71
72} // namespace testapp
73} // namespace tpglibs
74
76
77#endif // TPGLIBS_TESTAPP_BINARYSIGNALREADER_HPP_
Simple binary file reader for integer types.
std::streampos tellg()
Get current file position.
~BinarySignalReader()=default
Destructor - closes the file.
std::vector< T > next(size_t n)
Read next chunk of data.
void seekg(std::streampos pos)
Seek to specific position.
bool eof()
Check if we've reached end of file.
BinarySignalReader(const std::string &filepath)
Constructor - opens the file for reading.