SRS-control 0.1.4
 
Loading...
Searching...
No Matches
srs::reader::RawFrame Class Reference

#include <RawFrameReader.hpp>

Collaboration diagram for srs::reader::RawFrame:

Public Member Functions

 RawFrame ()=default
 Default Constructor. No memory allocation.
 
 RawFrame (const std::string &filename)
 Constructor that opens a file with the given filename.
 
auto read_one_frame () -> std::string_view
 Read one frame of the binary data from a file specified by the constructor RawFrame(const std::string&).
 
auto get_binary_data () const -> const auto &
 Getter to the internal binary data used by the member function read_one_frame().
 

Static Public Member Functions

static auto read_one_frame (std::vector< char > &binary_data, std::ifstream &input_file) -> std::size_t
 Read one frame of the bianry data to a vector.
 

Private Attributes

std::string input_filename_
 Input binary file name.
 
std::ifstream input_file_
 Input binary file handler.
 
std::vector< char > input_buffer_
 internal binary data buffer
 

Detailed Description

Definition at line 11 of file RawFrameReader.hpp.

Constructor & Destructor Documentation

◆ RawFrame() [1/2]

srs::reader::RawFrame::RawFrame ( )
explicitdefault

Default Constructor. No memory allocation.

◆ RawFrame() [2/2]

srs::reader::RawFrame::RawFrame ( const std::string & filename)
explicit

Constructor that opens a file with the given filename.

Parameters
filenameThe file name of the input binary

Definition at line 8 of file RawFrameReader.cpp.

Member Function Documentation

◆ get_binary_data()

auto srs::reader::RawFrame::get_binary_data ( ) const -> const auto&
inline

Getter to the internal binary data used by the member function read_one_frame().

Definition at line 53 of file RawFrameReader.hpp.

◆ read_one_frame() [1/2]

auto srs::reader::RawFrame::read_one_frame ( ) -> std::string_view

Read one frame of the binary data from a file specified by the constructor RawFrame(const std::string&).

The binary data frame is written to the internal member variable input_buffer_; srs::common::LARGE_READ_MSG_BUFFER_SIZE bytes of memory will be reserved for the vector.

Returns
Non-owning binary data.

Definition at line 49 of file RawFrameReader.cpp.

◆ read_one_frame() [2/2]

auto srs::reader::RawFrame::read_one_frame ( std::vector< char > & binary_data,
std::ifstream & input_file ) -> std::size_t
static

Read one frame of the bianry data to a vector.

The input vector is first reserved with srs::common::LARGE_READ_MSG_BUFFER_SIZE elements and then resized with the size value, which is read from the binary file in the beginning. The vector is then set with size bytes of data from the file.

Parameters
binary_dataThe vector of chars to be filled.
input_fileInput file handler.
Returns
The amount of bytes read from the binary file. If the binary input file is not open, return 0.

Definition at line 19 of file RawFrameReader.cpp.

Member Data Documentation

◆ input_buffer_

std::vector<char> srs::reader::RawFrame::input_buffer_
private

internal binary data buffer

Definition at line 58 of file RawFrameReader.hpp.

◆ input_file_

std::ifstream srs::reader::RawFrame::input_file_
private

Input binary file handler.

Definition at line 57 of file RawFrameReader.hpp.

◆ input_filename_

std::string srs::reader::RawFrame::input_filename_
private

Input binary file name.

Definition at line 56 of file RawFrameReader.hpp.


The documentation for this class was generated from the following files: