SRS-control 0.1.4
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>
7#include <string>
8#include <string_view>
9#include <vector>
10
11namespace srs::reader
12{
14 {
15 public:
17 explicit RawFrame() = default;
18
25 explicit RawFrame(const std::string& filename);
26
40 auto read_one_frame(std::vector<char>& binary_data, std::ifstream& input_file)
41 -> std::expected<std::size_t, std::string>;
42
54 auto read_one_frame() -> std::expected<std::string_view, std::string>;
55
57 auto get_binary_data() const -> const auto& { return input_buffer_; }
58
59 void reset();
60
61 private:
62 std::string input_filename_;
63 std::ifstream input_file_;
64 std::vector<char> input_buffer_;
65 };
66} // 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.