|
ifw-daq 3.1.0
IFW Data Acquisition modules
|
Implements daq::DaqController for states responsible to be executed by OCM.
More...
#include <daqController.hpp>
Inheritance diagram for daq::OcmDaqController:Classes | |
| struct | Aborted |
| struct | Aborting |
| struct | Acquiring |
| struct | NotStarted |
| struct | Starting |
| struct | Stopped |
| struct | Stopping |
Public Member Functions | |
| boost::future< State > | StartAsync () override |
| Starts the data acquisition. | |
| boost::future< Status > | StopAsync (ErrorPolicy policy) override |
| Stops the data acquisition. | |
| boost::future< Status > | AbortAsync (ErrorPolicy policy) override |
| Aborts the data acquisition. | |
| boost::future< State > | ScheduleMergeAsync () override |
| Schedules DAQ for merging by sending request to DPM. | |
| void | UpdateKeywords (fits::KeywordVector const &keywords) override |
| Updates (replace or add) list of keywords. | |
| boost::future< State > | AwaitAsync (std::vector< std::string > sources, std::chrono::milliseconds timeout) override |
| Awaits that data acquisition stops or aborts. | |
| State | GetState () const DAQ_NOEXCEPT override |
| constexpr log4cplus::Logger const & | GetLogger () const noexcept |
Public Member Functions inherited from daq::CommonDaqController | |
| CommonDaqController (boost::asio::io_context &io_context, DaqContext context, std::shared_ptr< ObservableStatus > status, std::shared_ptr< ObservableEventLog > event_log) | |
| std::shared_ptr< ObservableStatus > | GetStatus () DAQ_NOEXCEPT override |
| std::shared_ptr< ObservableStatus const > | GetStatus () const DAQ_NOEXCEPT override |
| std::shared_ptr< ObservableEventLog > | GetEventLog () DAQ_NOEXCEPT override |
| std::string const & | GetId () const DAQ_NOEXCEPT override |
| bool | GetErrorFlag () const DAQ_NOEXCEPT override |
| DaqContext const & | GetContext () const DAQ_NOEXCEPT override |
| boost::signals2::connection | ConnectContext (ContextSignal::slot_type const &slot) override |
| Connect observer that is invoked when context is modified. | |
Public Member Functions inherited from daq::DaqController | |
| DaqController ()=default | |
| virtual | ~DaqController ()=default |
| virtual boost::future< State > | StartAsync ()=0 |
| Starts the data acquisition. | |
| virtual boost::future< Status > | StopAsync (ErrorPolicy policy)=0 |
| Stops the data acquisition. | |
| virtual boost::future< Status > | AbortAsync (ErrorPolicy policy)=0 |
| Aborts the data acquisition. | |
| virtual boost::future< State > | ScheduleMergeAsync ()=0 |
| Schedules DAQ for merging by sending request to DPM. | |
| virtual void | UpdateKeywords (fits::KeywordVector const &keywords)=0 |
| Updates (replace or add) list of keywords. | |
| virtual boost::future< State > | AwaitAsync (std::vector< std::string > sources, std::chrono::milliseconds timeout)=0 |
| Awaits that data acquisition stops or aborts. | |
| virtual State | GetState () const DAQ_NOEXCEPT=0 |
| virtual std::shared_ptr< ObservableStatus > | GetStatus () DAQ_NOEXCEPT=0 |
| virtual std::shared_ptr< ObservableStatus const > | GetStatus () const DAQ_NOEXCEPT=0 |
| virtual std::shared_ptr< ObservableEventLog > | GetEventLog () DAQ_NOEXCEPT=0 |
| virtual std::string const & | GetId () const DAQ_NOEXCEPT=0 |
| virtual bool | GetErrorFlag () const DAQ_NOEXCEPT=0 |
| virtual DaqContext const & | GetContext () const DAQ_NOEXCEPT=0 |
| virtual boost::signals2::connection | ConnectContext (ContextSignal::slot_type const &slot)=0 |
| Connect observer that is invoked when context is modified. | |
Static Public Member Functions | |
| static std::shared_ptr< OcmDaqController > | Create (boost::asio::io_context &io_context, fits::KeywordFormatter const &kw_formatter, DaqContext context, DaqSources const &sources, std::shared_ptr< ObservableStatus > status, std::shared_ptr< ObservableEventLog > event_log, OcmAsyncOperations operations) |
| Construct object. | |
Protected Types | |
| using | StateVariant = std::variant< NotStarted, Starting, Acquiring, Stopping, Stopped, Aborting, Aborted > |
Protected Member Functions | |
| StateVariant | MakeState (State s) const noexcept |
| OcmDaqController (boost::asio::io_context &io_context, fits::KeywordFormatter const &kw_formatter, DaqContext context, DaqSources const &sources, std::shared_ptr< ObservableStatus > status, std::shared_ptr< ObservableEventLog > event_log, OcmAsyncOperations ops) | |
| op::AsyncOpParams | MakeParams (op::AlertState &) |
| Constructs the parameters used for asynchronous operations. | |
| op::AwaitOpParams | MakeAwaitParams (op::AlertState &) |
| void | InitiateStopCondition () |
| Initiate async operation that triggers DAQ stop automatically. | |
| void | CancelAwaitPrimarySources () |
| Cancels the awaiting of primary sources. | |
| void | AddInitialKeywords () |
| auto | HasStatefulSources () noexcept -> bool |
| Queries if ctx has stateful sources (primary or metadata source). | |
| void | SetAlert (std::string key, std::string description) noexcept |
| Set alert with category alert::DAQ_CONTROLLER. | |
| void | SetState (StateVariant &&s) noexcept |
| std::optional< std::variant< Source< PrimSource > *, Source< MetaSource > * > > | FindSource (std::string_view source_id) |
| template<class SourceType > | |
| std::vector< Source< SourceType > > | MakeSources (std::vector< SourceType > sources) |
| Helper to build source vector. | |
Protected Member Functions inherited from daq::CommonDaqController | |
| template<class T , class... Args> | |
| void | AddEvent (Args &&... args) |
| boost::asio::io_context & | GetIoCtx () noexcept |
| rad::IoExecutor & | GetIoExecutor () noexcept |
| DaqContext & | GetContextMut () noexcept |
| ObservableEventLog & | GetEventLogRef () noexcept |
| ObservableStatus & | GetStatusRef () noexcept |
| ObservableStatus const & | GetStatusRef () const noexcept |
| void | EmitContextSignal () |
Protected Attributes | |
| fits::KeywordFormatter const & | m_kw_formatter |
| StateVariant | m_state |
| std::vector< Source< PrimSource > > | m_prim_sources |
| Note: Consider vector immutable! | |
| std::vector< Source< MetaSource > > | m_meta_sources |
| Note: Consider vector immutable! | |
| OcmAsyncOperations | m_async_ops |
| std::shared_ptr< PendingReplies > | m_pending_replies |
| std::vector< std::unique_ptr< boost::asio::steady_timer > > | m_timers |
| std::function< bool()> | m_abort_await_primary_sources |
| If DaqController is awaiting the completion of primary data sources this function will hold the abort function. | |
| log4cplus::Logger | m_logger |
Additional Inherited Members | |
Public Types inherited from daq::DaqController | |
| using | ContextSignal = boost::signals2::signal< void(DaqContext const &)> |
Implements daq::DaqController for states responsible to be executed by OCM.
The states executed by DPM are implemented by DpmDaqController.
Definition at line 396 of file daqController.hpp.
| struct daq::OcmDaqController::Aborted |
Definition at line 442 of file daqController.hpp.
| struct daq::OcmDaqController::Aborting |
Definition at line 441 of file daqController.hpp.
| struct daq::OcmDaqController::Acquiring |
Definition at line 438 of file daqController.hpp.
| struct daq::OcmDaqController::NotStarted |
Definition at line 436 of file daqController.hpp.
| struct daq::OcmDaqController::Starting |
Definition at line 437 of file daqController.hpp.
| struct daq::OcmDaqController::Stopped |
Definition at line 440 of file daqController.hpp.
| struct daq::OcmDaqController::Stopping |
Definition at line 439 of file daqController.hpp.
|
protected |
Definition at line 444 of file daqController.hpp.
|
protected |
Definition at line 187 of file daqController.cpp.
|
overridevirtual |
Aborts the data acquisition.
| policy | Error policy determining if errors are tolerated or not. |
It is possible to issue this request more than once, to e.g. retry a failed abort attempt.
GetState() not in (State::Aborted, State::Stopped) GetState() == State::Aborting if a data acquisition was ongoing otherwise GetState() == State::Aborted. Implements daq::DaqController.
Definition at line 438 of file daqController.cpp.
|
protected |
Definition at line 306 of file daqController.cpp.
|
overridevirtual |
Awaits that data acquisition stops or aborts.
It is possible to await only only a subset of data sources by specifying their ids in sources.
| sources | An optional vector of source-ids to await, if empty all primary sources are awaited on. |
Implements daq::DaqController.
Definition at line 528 of file daqController.cpp.
|
protected |
Cancels the awaiting of primary sources.
This does nothing if no await process is ongoing.
Definition at line 781 of file daqController.cpp.
|
static |
Construct object.
| io_context | Executor used for continuations and timer. |
| context | General context used to control DAQ execution. |
| status | Data acquisition status object, also contains identifier (may not be empty). Caller is responsible for making the id unique. |
| prim | Primary data sources |
| meta | Metadata sources |
status == true. event_log == true. | std::invalid_argument | if arguments are invalid. |
Definition at line 168 of file daqController.cpp.
|
protected |
Definition at line 665 of file daqController.cpp.
|
constexprnoexcept |
Definition at line 246 of file daqController.cpp.
|
overridevirtual |
Implements daq::DaqController.
Definition at line 219 of file daqController.cpp.
|
protectednoexcept |
Queries if ctx has stateful sources (primary or metadata source).
Definition at line 310 of file daqController.cpp.
|
protected |
Initiate async operation that triggers DAQ stop automatically.
If there is no condition for automatic stop (e.g. meta data sources only) this method does nothing.
Definition at line 702 of file daqController.cpp.
|
protected |
Definition at line 292 of file daqController.cpp.
|
protected |
Constructs the parameters used for asynchronous operations.
Definition at line 279 of file daqController.cpp.
|
protected |
Helper to build source vector.
Definition at line 690 of file daqController.cpp.
|
protectednoexcept |
Definition at line 250 of file daqController.cpp.
|
overridevirtual |
Schedules DAQ for merging by sending request to DPM.
Implements daq::DaqController.
Definition at line 508 of file daqController.cpp.
|
protectednoexcept |
Set alert with category alert::DAQ_CONTROLLER.
|
protectednoexcept |
Definition at line 273 of file daqController.cpp.
|
overridevirtual |
Starts the data acquisition.
| std::exception-derived | exception if internal error occurs. |
GetState() == State::Notstarted GetState() == State::Starting on success GetState() == State::Error on error Implements daq::DaqController.
Definition at line 314 of file daqController.cpp.
|
overridevirtual |
Stops the data acquisition.
GetState() not in (State::Stopped or State::Aborted) GetState() == State::Stopping Implements daq::DaqController.
Definition at line 364 of file daqController.cpp.
|
overridevirtual |
Updates (replace or add) list of keywords.
| keywords | Keywords to add. |
Implements daq::DaqController.
Definition at line 513 of file daqController.cpp.
|
protected |
If DaqController is awaiting the completion of primary data sources this function will hold the abort function.
@important Users must check if it is valid before invoking it.
Definition at line 527 of file daqController.hpp.
|
protected |
Definition at line 517 of file daqController.hpp.
|
protected |
Definition at line 511 of file daqController.hpp.
|
protected |
Definition at line 528 of file daqController.hpp.
|
protected |
Note: Consider vector immutable!
Definition at line 515 of file daqController.hpp.
|
protected |
Definition at line 518 of file daqController.hpp.
|
protected |
Note: Consider vector immutable!
Definition at line 514 of file daqController.hpp.
|
protected |
Definition at line 512 of file daqController.hpp.
|
protected |
Definition at line 519 of file daqController.hpp.