Go to the documentation of this file.
19 #include <farm_ng/core/event.pb.h>
29 explicit EventLogEof(std::string
const& what) : std::runtime_error(what) {}
33 explicit EventLogExist(std::string
const& what) : std::runtime_error(what) {}
36 class EventLogReaderImpl;
40 core::proto::Event
event,
42 std::weak_ptr<EventLogReaderImpl> log);
44 core::proto::Event
const&
event()
const;
48 core::proto::Event event_;
50 std::weak_ptr<EventLogReaderImpl> log_;
56 :
public std::enable_shared_from_this<EventLogReaderImpl> {
61 virtual void reset() = 0;
67 core::proto::Event
const& event, std::streampos pos) = 0;
70 virtual std::filesystem::path
getPath()
const = 0;
72 std::vector<EventLogPos>
const&
getIndex();
75 std::vector<EventLogPos> index_;
99 std::vector<EventLogPos>
const&
getIndex();
102 [[nodiscard]] std::filesystem::path
getPath()
const;
108 std::shared_ptr<EventLogReaderImpl> impl_;
114 core::proto::Timestamp
const*
getStamp(
115 core::proto::Event
const& event,
116 std::string
const& clock_name,
117 std::string
const& semantics);
132 std::string
const& clock_name,
133 std::string
const& semantics,
134 std::vector<EventLogReader>
const& readers);
std::string readPayload() const
Definition: event_log_reader.cpp:110
core::proto::Event const & event() const
Definition: event_log_reader.cpp:108
Definition: backtrace.cpp:102
virtual std::string readPayload(core::proto::Event const &event, std::streampos pos)=0
virtual ~EventLogReaderImpl()
https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Rh-dtor
Definition: event_log_reader.h:59
EventLogReader(std::filesystem::path const &log_path)
Open's log file to read.
Definition: event_log_reader.cpp:131
std::string semantics
Definition: event_log_reader.h:121
Definition: event_log_reader.h:27
std::string clock_name
Definition: event_log_reader.h:120
std::vector< EventLogPos > const & getIndex()
Definition: event_log_reader.cpp:116
virtual std::filesystem::path getPath() const =0
Returns the path including the fileaname.
EventLogExist(std::string const &what)
Definition: event_log_reader.h:33
virtual ~EventLogReader()
https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Rh-dtor
Definition: event_log_reader.cpp:134
std::filesystem::path getPath() const
Returns the path including the fileaname.
Definition: event_log_reader.cpp:144
auto eventLogTimeOrderedIndex(std::string const &clock_name, std::string const &semantics, std::vector< EventLogReader > const &readers) -> std::vector< EventLogPos >
Definition: event_log_reader.cpp:187
virtual EventLogPos readNextEvent(std::string *payload=nullptr)=0
Returns next event.
Definition: event_log_reader.h:37
Definition: event_log_reader.h:31
auto getStamp(core::proto::Event const &event, std::string const &clock_name, std::string const &semantics) -> core::proto::Timestamp const *
Definition: event_log_reader.cpp:152
EventLogEof(std::string const &what)
Definition: event_log_reader.h:29
std::vector< EventLogPos > const & getIndex()
Definition: event_log_reader.cpp:140
EventLogPos(core::proto::Event event, std::streampos pos, std::weak_ptr< EventLogReaderImpl > log)
Definition: event_log_reader.cpp:102
Implementation of the EventLogReader class.
Definition: event_log_reader.h:55
EventLogPos readNextEvent(std::string *payload=nullptr)
Definition: event_log_reader.cpp:136
bool operator()(EventLogPos const &lhs, EventLogPos const &rhs) const
Definition: event_log_reader.cpp:164
Definition: event_log_reader.h:119
void reset()
Reset the writer to the beginning of the file.
Definition: event_log_reader.cpp:148
Reader to deserialize data written by the EventLogWriter.
Definition: event_log_reader.h:80