8 #ifndef OCM_DAQ_DAQ_STATUS_HPP_
9 #define OCM_DAQ_DAQ_STATUS_HPP_
16 #include <boost/signals2/signal.hpp>
31 constexpr std::string_view
REQUEST =
"request";
73 using Clock = std::chrono::system_clock;
84 Alert MakeAlert(std::string_view category, std::string key, std::string description);
98 std::ostream&
operator<<(std::ostream& os, std::vector<Alert>
const& s);
125 using TimePoint = std::chrono::time_point<std::chrono::steady_clock>;
128 explicit Status(std::string
id, std::string
file_id) noexcept;
187 void Reset() noexcept;
193 return m_status !=
nullptr;
231 std::string
const&
GetId() const noexcept;
236 std::
string const&
GetFileId() const noexcept;
310 template <class Observer>
312 return m_signal.connect(std::move(o));
315 return m_signal.connect(slot);
338 unsigned m_deferred_signals = 0;
Defer signal changes until later time.
void Reset() noexcept
If object is valid.
bool IsValid() const noexcept
Stores data acquisition status and allows subscription to status changes.
void SignalChanges(bool forced=false) noexcept
Signal changes to observers.
boost::signals2::connection ConnectObserver(Observer o)
Connect observer that is invoked when state is modified.
State GetState() const noexcept
ObservableStatus(ObservableStatus const &)=delete
void SetError(bool error) noexcept
Set error flag for data acquisition.
ObservableStatus & operator=(ObservableStatus &&)=default
boost::signals2::signal< void(ObservableStatus const &)> Signal
Connect observer that is invoked when state is modified.
Status const & GetStatus() const noexcept
Connect observer that is invoked when state is modified.
void ClearAlert(AlertId const &alert)
Clear alert.
bool operator==(ObservableStatus const &rhs) const noexcept
void SetState(State s, std::optional< bool > error=std::nullopt) noexcept
Set state of data acquisition.
void DisableSignals() noexcept
ObservableStatus(ObservableStatus &&)=default
void SetResult(std::string result)
Set resulting data product path.
void EnableSignals() noexcept
std::string const & GetFileId() const noexcept
bool GetError() const noexcept
bool operator!=(ObservableStatus const &rhs) const noexcept
void SetAlert(Alert alert)
Set alert.
std::vector< Alert > const & GetAlerts() const noexcept
ObservableStatus & operator=(ObservableStatus const &)=delete
boost::signals2::connection ConnectStatus(Signal::slot_type const &slot)
Connect observer that is invoked when state is modified.
ObservableStatus(std::string id, std::string file_id) noexcept
Construct a new object.
std::string const & GetId() const noexcept
Contains declaration for DpPart.
Contains data structure for FITS keywords.
Declares daq::State and related functions.
constexpr std::string_view REQUEST
Request.
constexpr std::string_view TRANSFERRING_RSYNC
Failure during rsync source copy.
constexpr std::string_view MERGING_MERGE
Merging failed.
daqif::DaqStatus & operator<<(daqif::DaqStatus &status, daq::Status const &rhs)
Convert daq::Status -> daqif::DaqStatus by populating from rhs.
AlertId MakeAlertId(std::string_view category, std::string key)
std::string key
Unique key for each alert.
bool operator==(DaqContext const &lhs, DaqContext const &rhs) noexcept
bool operator!=(AlertId const &lhs, AlertId const &rhs) noexcept
std::string category
Standardized category.
void SetAlert(std::vector< Alert > &alerts, Alert alert)
Set alert.
bool ClearAlert(std::vector< Alert > &alerts, AlertId const &alert)
Clear alert.
State
Observable states of the data acquisition process.
@ NotStarted
Initial state of data acquisition.
Clock::time_point TimePoint
std::chrono::system_clock Clock
Alert MakeAlert(std::string_view category, std::string key, std::string description)
Construct alert.
Describes an active Data Acquisition alert.
Uniquely identfies an alert.
Non observable status object that keeps stores status of data acquisition.
Status & operator=(Status const &)=default
bool operator!=(Status const &rhs) const noexcept
Status & operator=(Status &&)=default
bool operator==(Status const &rhs) const noexcept
std::chrono::time_point< std::chrono::steady_clock > TimePoint
std::string result
Path to resulting data product.
Status(Status const &)=default
Status(Status &&)=default
std::vector< Alert > alerts
Active alerts.