ifw-daq
2.1.0-pre1
IFW Data Acquisition modules
|
Go to the documentation of this file.
8 #ifndef OCM_DAQ_DAQ_EVENT_HPP_
9 #define OCM_DAQ_DAQ_EVENT_HPP_
17 #include <boost/signals2/signal.hpp>
30 using TimePoint = std::chrono::time_point<std::chrono::steady_clock>;
66 using ActionEvent::ActionEvent;
72 std::optional<Status>
status,
73 std::string
origin) noexcept;
90 using EventType = std::variant<ActionEvent, UserActionEvent, GenericEvent, ErrorEvent>;
91 using TimePoint = std::chrono::time_point<std::chrono::steady_clock>;
133 template<
class T,
class... Args>
135 m_event_log.
events.emplace_back(std::in_place_type<T>, std::forward<Args>(args)...);
136 m_signal(m_event_log.
events.back());
153 template <
class Observer>
155 return m_signal.connect(std::move(o));
173 return m_event_log.
events;
183 #endif // #ifndef OCM_DAQ_DAQ_EVENT_HPP_
boost::signals2::connection ConnectObserver(Observer o)
Connect observer that is invoked when state is modified.
std::chrono::time_point< std::chrono::steady_clock > TimePoint
void EmplaceEvent(Args &&... args)
Like AddEvent but emplaces the specified event type.
bool operator==(ErrorEvent const &rhs) const noexcept
GenericEvent & operator=(GenericEvent &&)=default
std::optional< Status > status
GenericEvent(std::string id, std::string description, std::optional< Status > status) noexcept
bool operator!=(ErrorEvent const &rhs) const noexcept
std::vector< EventLog::EventType > const & GetEventContainer() const noexcept
Allow implicit conversion to non-observable status.
bool operator!=(EventLog const &rhs) const noexcept
ObservableEventLog()=default
Construct a new object.
ObservableEventLog & operator=(ObservableEventLog const &)=delete
std::chrono::time_point< std::chrono::steady_clock > TimePoint
daqif::DaqStatus & operator<<(daqif::DaqStatus &status, daq::Status const &rhs)
Convert daq::Status -> daqif::DaqStatus by populating from rhs.
GenericEvent & operator=(GenericEvent const &)=default
Contains declaration for Status and ObservableStatus.
Event directly related to user action, such as a command to do something.
std::vector< EventType > events
ErrorEvent(std::string id, std::string description, std::optional< Status > status, std::string origin) noexcept
bool operator!=(GenericEvent const &rhs) const noexcept
ObservableEventLog(ObservableEventLog const &)=delete
std::string origin
Error origin.
bool operator==(GenericEvent const &rhs) const noexcept
std::variant< ActionEvent, UserActionEvent, GenericEvent, ErrorEvent > EventType
Represents a collection of events.
bool operator==(EventLog const &rhs) const noexcept
Represents a generic event if a more specific event is not usable.
boost::signals2::signal< void(EventLog::EventType const &)> Signal
EventLog const & GetEventLog() const noexcept
Allow implicit conversion to non-observable status.
Stores data acquisition status and allows subscription to status changes.
void AddEvent(EventLog::EventType event)
Records that a file has been produced for this data acquisition.
Event related to an action being requested or performed.