SingleChannelBinaryTraceFileWriter

class SingleChannelBinaryTraceFileWriter : public osi3::TraceFileWriter

Implementation of TraceFileWriter for binary format files containing OSI messages.

This class provides functionality to write OSI messages in the single binary channel format. It stores messages in their serialized protobuf binary representation in a single channel. Messages are separated by a length specification before each message. The length is represented by a four-byte, little-endian, unsigned integer.

Note

Thread Safety: Not thread-safe. External synchronization required for concurrent access.

Public Functions

~SingleChannelBinaryTraceFileWriter() override

Destructor, closes the file if still open.

virtual bool Open(const std::filesystem::path &file_path) override

Opens a file for binary trace output.

Parameters:

file_path – Path to the file to be created/opened

Returns:

true if successful, false otherwise

virtual void Close() override

Closes the trace file.

template<typename T>
bool WriteMessage(const T &top_level_message)

Writes a protobuf message to the file.

Template Parameters:

T – Type of the protobuf message

Parameters:

top_level_message – The message to write

Returns:

true if successful, false otherwise