Voyant API 1.0.0
Loading...
Searching...
No Matches
VoyantRecorder Class Reference

Class for recording Voyant frames to binary files with automatic splitting. More...

#include <voyant_data_recorder.hpp>

Public Member Functions

 VoyantRecorder (const VoyantRecorderConfig &config)
 Constructor that takes a configuration struct.
 ~VoyantRecorder ()
 Destructor - automatically finalizes recording if needed.
 VoyantRecorder (const VoyantRecorder &)=delete
 Non-copyable.
VoyantRecorderoperator= (const VoyantRecorder &)=delete
RecordResult recordFrame (const VoyantFrame &frame)
 Records a frame to the current file.
bool finalize ()
 Finalizes the recording and closes all files.
std::optional< size_t > getTotalFramesRecorded () const
 Gets the total number of frames recorded.
std::optional< size_t > getSplitCount () const
 Gets the number of files created.
bool isValid () const
 Checks if the recorder is valid.
std::string getLastError () const
 Why construction failed, or an empty string if it did not.
std::string getCurrentFilePath () const
 Path of the file being written, with timestamp and split naming resolved.

Private Attributes

VoyantRecorderCrecorderHandle_
bool finalized_
std::string lastErrorMsg_
std::optional< size_t > finalFrames_
std::optional< size_t > finalSplits_
std::string finalPath_

Detailed Description

Class for recording Voyant frames to binary files with automatic splitting.

Constructor & Destructor Documentation

◆ VoyantRecorder() [1/2]

VoyantRecorder::VoyantRecorder ( const VoyantRecorderConfig & config)
explicit

Constructor that takes a configuration struct.

Parameters
configThe configuration settings for the recorder

◆ ~VoyantRecorder()

VoyantRecorder::~VoyantRecorder ( )

Destructor - automatically finalizes recording if needed.

◆ VoyantRecorder() [2/2]

VoyantRecorder::VoyantRecorder ( const VoyantRecorder & )
delete

Non-copyable.

Member Function Documentation

◆ finalize()

bool VoyantRecorder::finalize ( )

Finalizes the recording and closes all files.

Returns
true if successful, false otherwise

◆ getCurrentFilePath()

std::string VoyantRecorder::getCurrentFilePath ( ) const

Path of the file being written, with timestamp and split naming resolved.

Construction opens the first file, so this reads immediately — use it to name files that have to pair with the recording. After finalize() the last path stays readable. Empty if the recorder never opened a file.

◆ getLastError()

std::string VoyantRecorder::getLastError ( ) const

Why construction failed, or an empty string if it did not.

Construction opens the first output file, so an invalid recorder has a reason here: a path that is not .vynt, an existing file with overwrite false, a directory that cannot be written. Pair with isValid().

◆ getSplitCount()

std::optional< size_t > VoyantRecorder::getSplitCount ( ) const

Gets the number of files created.

Returns
File count — 1 before any split — or std::nullopt if the recorder is invalid. After finalize() the final count stays readable.

◆ getTotalFramesRecorded()

std::optional< size_t > VoyantRecorder::getTotalFramesRecorded ( ) const

Gets the total number of frames recorded.

Returns
Total frame count, or std::nullopt if recorder is invalid. After finalize() the final count stays readable.

◆ isValid()

bool VoyantRecorder::isValid ( ) const

Checks if the recorder is valid.

Returns
true if recorder is properly initialized

◆ operator=()

VoyantRecorder & VoyantRecorder::operator= ( const VoyantRecorder & )
delete

◆ recordFrame()

RecordResult VoyantRecorder::recordFrame ( const VoyantFrame & frame)

Records a frame to the current file.

Live, replayed, and edited (withPoints()) frames all record identically; a frame that carries no state is recorded as an honest stateless entry.

Parameters
frameFrame to record
Returns
RecordResult indicating the outcome of the recording operation

Member Data Documentation

◆ finalFrames_

std::optional<size_t> VoyantRecorder::finalFrames_
private

◆ finalized_

bool VoyantRecorder::finalized_
private

◆ finalPath_

std::string VoyantRecorder::finalPath_
private

◆ finalSplits_

std::optional<size_t> VoyantRecorder::finalSplits_
private

◆ lastErrorMsg_

std::string VoyantRecorder::lastErrorMsg_
private

◆ recorderHandle_

VoyantRecorderC* VoyantRecorder::recorderHandle_
private

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