1 #ifndef DAQ_OP_ASYNC_OP_PARAMS_HPP_
2 #define DAQ_OP_ASYNC_OP_PARAMS_HPP_
4 #include <boost/asio/io_context.hpp>
5 #include <log4cplus/logger.h>
9 #include "../status.hpp"
10 #include "../eventLog.hpp"
11 #include "../pendingReplies.hpp"
12 #include "../source.hpp"
13 #include "../state.hpp"
14 #include "../utility.hpp"
19 std::vector<Alert>
set;
26 auto alert =
MakeAlert(std::move(
id),
"");
30 *it = std::move(alert);
33 cleared.emplace_back(std::move(alert));
46 for (
auto& a : src.
set) {
47 auto it = std::find(active.begin(), active.end(), a);
49 if (it == active.end() || a.timestamp > it->timestamp) {
54 auto it = std::find(active.begin(), active.end(), a);
56 if (it != active.end() && a.timestamp > it->timestamp) {
72 log4cplus::Logger& logger_arg,
73 std::string
const& id_arg,
102 std::string
const&
id;
Stores data acquisition status and allows subscription to status changes.
Stores data acquisition status and allows subscription to status changes.
void ClearAlert(AlertId const &alert)
Clear alert.
void SetAlert(Alert alert)
Set alert.
std::vector< Alert > const & GetAlerts() const noexcept
Simple class that allows you to keep track of how many replies are pending.
Adapts boost::asio::io_context into a compatible boost::thread Executor type.
void MergeAlerts(ObservableStatus &dest, AlertState &src)
Merge alerts.
void SetAlert(std::vector< Alert > &alerts, Alert alert)
Set alert.
Alert MakeAlert(std::string_view category, std::string key, std::string description)
Construct alert.
Describes an active Data Acquisition alert.
Uniquely identfies an alert.
Simple class that holds the source and associated state.
std::vector< Alert > cleared
Parameters required for each async operation.
std::vector< Source< MetaSource > > & meta_sources
Note: Consider vector immutable!a.
AsyncOpParams(ObservableStatus &status_arg, ObservableEventLog &event_log_arg, AlertState &alerts, rad::IoExecutor &executor_arg, log4cplus::Logger &logger_arg, std::string const &id_arg, PendingReplies &pending_replies_arg, std::vector< Source< PrimSource >> &prim_sources_arg, std::vector< Source< MetaSource >> &meta_sources_arg)
ObservableEventLog & event_log
AsyncOpParams(AsyncOpParams &&)=default
AsyncOpParams(AsyncOpParams const &)=default
AlertState & alerts
Alerts to be merged only after completion of async operation.
std::vector< Source< PrimSource > > & prim_sources
Note: Consider vector immutable!
PendingReplies & pending_replies
rad::IoExecutor & executor
ObservableStatus & status
Async operations should not modify state directly DaqController does that.
log4cplus::Logger & logger
Await specific parameters that is not provided with AsyncOpParams.
AwaitOpParams(AwaitOpParams const &)=default
Duration wait_interval
Total amount of time to wait for condition to be fulfilled.
AwaitOpParams(AwaitOpParams &&)=default
AwaitOpParams(AsyncOpParams common_arg, AwaitOpParams::Duration wait_interval_arg) noexcept
std::chrono::milliseconds Duration