farm-ng-core
|
Class that serializes incoming protobuf events to a file in disk. More...
#include <event_log_writer.h>
Public Member Functions | |
EventLogWriter (std::filesystem::path const &log_path) | |
Main constructor of the class. More... | |
virtual | ~EventLogWriter () noexcept |
Main destructor. More... | |
void | write (std::string const &path, google::protobuf::Message const &message, std::vector< core::proto::Timestamp > const ×tamps=std::vector< core::proto::Timestamp >()) |
Writes an incoming protobuf in the log file. More... | |
void | write (std::string const &path, google::protobuf::Message const &message, google::protobuf::RepeatedPtrField< core::proto::Timestamp > const ×tamps) |
std::filesystem::path | getPath () const |
Returns the path including the fileaname. More... | |
ssize_t | getBytesWritten () |
Returns the number of bytes written to the file so far. More... | |
Class that serializes incoming protobuf events to a file in disk.
farm_ng::EventLogWriter::EventLogWriter | ( | std::filesystem::path const & | log_path | ) |
Main constructor of the class.
Precondition: It must be possible to create the folder log_path_
if it does not exist. If log-path
does exist, it must be a folder and it must be empty.
|
virtualnoexcept |
Main destructor.
ssize_t farm_ng::EventLogWriter::getBytesWritten | ( | ) |
Returns the number of bytes written to the file so far.
|
inline |
Returns the path including the fileaname.
void farm_ng::EventLogWriter::write | ( | std::string const & | path, |
google::protobuf::Message const & | message, | ||
google::protobuf::RepeatedPtrField< core::proto::Timestamp > const & | timestamps | ||
) |
void farm_ng::EventLogWriter::write | ( | std::string const & | path, |
google::protobuf::Message const & | message, | ||
std::vector< core::proto::Timestamp > const & | timestamps = std::vector<core::proto::Timestamp>() |
||
) |
Writes an incoming protobuf in the log file.