srs-control 0.2.2
Loading...
Searching...
No Matches
RawFrameReader.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <cstddef>
4#include <expected>
5#include <fstream>
6#include <string>
7#include <string_view>
8#include <vector>
9
10namespace srs::reader
11{
13 {
14 public:
16 explicit RawFrame() = default;
17
24 explicit RawFrame(const std::string& filename);
25
39 auto read_one_frame(std::vector<char>& binary_data, std::ifstream& input_file)
40 -> std::expected<std::size_t, std::string>;
41
53 auto read_one_frame() -> std::expected<std::string_view, std::string>;
54
56 auto get_binary_data() const -> const auto& { return input_buffer_; }
57
58 void reset();
59
60 private:
61 std::string input_filename_;
62 std::ifstream input_file_;
63 std::vector<char> input_buffer_;
64 };
65} // namespace srs::reader
auto read_one_frame(std::vector< char > &binary_data, std::ifstream &input_file) -> std::expected< std::size_t, std::string >
Read one frame of the bianry data to a vector.
std::string input_filename_
Input binary file name.
std::vector< char > input_buffer_
internal binary data buffer
RawFrame()=default
Default Constructor. No memory allocation.
auto get_binary_data() const -> const auto &
Getter to the internal binary data used by the member function read_one_frame().
std::ifstream input_file_
Input binary file handler.