ifw-daq 3.1.0
IFW Data Acquisition modules
Loading...
Searching...
No Matches
eventLog.cpp
Go to the documentation of this file.
1/**
2 * @file
3 * @ingroup daq_common_libdaq
4 * @copyright 2022 ESO - European Southern Observatory
5 *
6 * @brief Contains definitions for EventLog, ObservableEventLog and related events.
7 */
8#include <daq/eventLog.hpp>
9
10#include <iostream>
11
12namespace daq {
13
15 std::string description,
16 std::optional<Status> status) noexcept
17 : timestamp(TimePoint::clock::now()), id(std::move(id)), description(std::move(description)), status(std::move(status)) {
18}
19
20bool GenericEvent::operator==(GenericEvent const& rhs) const noexcept {
21 return id == rhs.id && description == rhs.description && status == rhs.status;
22}
23
24bool GenericEvent::operator!=(GenericEvent const& rhs) const noexcept {
25 return !(*this == rhs);
26}
27
29 std::string description,
30 std::optional<Status> status,
31 std::string origin) noexcept
32 : GenericEvent(std::move(id), std::move(description), std::move(status))
33 , origin(std::move(origin)) {
34}
35
36bool ErrorEvent::operator==(ErrorEvent const& rhs) const noexcept {
37 return GenericEvent::operator==(rhs) && origin == rhs.origin;
38}
39
40bool ErrorEvent::operator!=(ErrorEvent const& rhs) const noexcept {
41 return !(*this == rhs);
42}
43
44std::ostream& operator<<(std::ostream& os, GenericEvent const& s) {
45 os << "ErrorEvent(id='" << s.id << "', description=" << s.description
46 << ")";
47 return os;
48}
49
50std::ostream& operator<<(std::ostream& os, ErrorEvent const& s) {
51 os << "ErrorEvent(id='" << s.id << "', origin=" << s.origin << ", description=" << s.description
52 << ")";
53 return os;
54}
55
57 m_signal(event);
58 m_event_log.events.emplace_back(std::move(event));
59}
60
61} // namespace daq
void AddEvent(EventLog::EventType event)
Records that a file has been produced for this data acquisition.
Definition: eventLog.cpp:56
Contains declaration for EventLog, ObservableEventLog and related events.
std::ostream & operator<<(std::ostream &os, AsyncProcessIf const &proc)
Formats proc representation in the form [<pid>] <args>
ErrorEvent(std::string id, std::string description, std::optional< Status > status, std::string origin) noexcept
Definition: eventLog.cpp:28
bool operator!=(ErrorEvent const &rhs) const noexcept
Definition: eventLog.cpp:40
std::string origin
Error origin.
Definition: eventLog.hpp:79
bool operator==(ErrorEvent const &rhs) const noexcept
Definition: eventLog.cpp:36
std::variant< ActionEvent, UserActionEvent, GenericEvent, ErrorEvent > EventType
Definition: eventLog.hpp:90
std::vector< EventType > events
Definition: eventLog.hpp:96
Represents a generic event if a more specific event is not usable.
Definition: eventLog.hpp:29
bool operator!=(GenericEvent const &rhs) const noexcept
Definition: eventLog.cpp:24
std::string description
Definition: eventLog.hpp:44
GenericEvent(std::string id, std::string description, std::optional< Status > status) noexcept
Definition: eventLog.cpp:14
bool operator==(GenericEvent const &rhs) const noexcept
Definition: eventLog.cpp:20
std::string id
Definition: eventLog.hpp:43