TXTHTraceFileWriter¶
-
class TXTHTraceFileWriter : public osi3::TraceFileWriter¶
Implementation of TraceFileWriter for text format files containing OSI messages.
This class provides functionality to write OSI messages to text format files. It converts protobuf messages to their text representation for human-readable storage.
- Deprecated:
The
.txthtext format is intended for human consumption only (debugging, manual inspection). According to the OSI specification, it is “not unambiguously
deserializable” — protobuf text format output is not guaranteed to be stable across library versions, and round-tripping (write then read) is unreliable. Prefer
.osi(binary) for single-channel or.mcapfor multi-channel trace files.
Note
Thread Safety: Not thread-safe. External synchronization required for concurrent access.
Public Functions
-
~TXTHTraceFileWriter() override¶
Destructor, closes the file if still open.
-
virtual bool Open(const std::filesystem::path &file_path) override¶
Opens a text trace file for writing.
- 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.
-
virtual bool WriteMessage(const google::protobuf::Message &message, const std::string &topic = "") override¶
Writes a protobuf message to the file (type-erased, virtual)
The topic parameter is ignored for this single-channel format.
- Parameters:
message – The protobuf message to write
topic – Ignored (single-channel format)
- Returns:
true if successful, false otherwise