farm-ng-core
farm_ng::EventLogWriter Class Reference

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 &timestamps=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 &timestamps)
 
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...
 

Detailed Description

Class that serializes incoming protobuf events to a file in disk.

Constructor & Destructor Documentation

◆ EventLogWriter()

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.

◆ ~EventLogWriter()

farm_ng::EventLogWriter::~EventLogWriter ( )
virtualnoexcept

Main destructor.

Member Function Documentation

◆ getBytesWritten()

ssize_t farm_ng::EventLogWriter::getBytesWritten ( )

Returns the number of bytes written to the file so far.

◆ getPath()

std::filesystem::path farm_ng::EventLogWriter::getPath ( ) const
inline

Returns the path including the fileaname.

◆ write() [1/2]

void farm_ng::EventLogWriter::write ( std::string const &  path,
google::protobuf::Message const &  message,
google::protobuf::RepeatedPtrField< core::proto::Timestamp > const &  timestamps 
)

◆ write() [2/2]

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.


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