9#ifndef TPGLIBS_TESTAPP_BINARYSIGNALREADER_HXX_
10#define TPGLIBS_TESTAPP_BINARYSIGNALREADER_HXX_
22 throw std::runtime_error(
"Failed to open file: " + filepath);
29 return std::vector<T>();
32 std::vector<T> result;
35 for (
size_t i = 0; i < n; ++i) {
37 m_file.read(
reinterpret_cast<char*
>(&value),
sizeof(T));
39 if (
m_file.gcount() !=
sizeof(T)) {
44 result.push_back(value);
53 std::streampos current_pos =
m_file.tellg();
54 m_file.seekg(0, std::ios::end);
55 std::streampos end_pos =
m_file.tellg();
58 if (current_pos >= end_pos) {
std::streampos tellg()
Get current file position.
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.