|
ifw-daq
1.0.0
IFW Data Acquisition modules
|
OCM data acquisition library. More...
Modules | |
| libdaq-test | |
| OCM data acquisition library tests. | |
Files | |
| file | error.cpp |
| Contains error related definitions for DAQ. | |
| file | eventLog.cpp |
| Contains definitions for EventLog, ObservableEventLog and related events. | |
| file | eventLogObserver.cpp |
| Contains definitions for EventLogObserverLogger. | |
| file | fitsController.cpp |
| Contains declaration for for FitsControllerImpl. | |
| file | daqController.hpp |
| Contains declaration for for DaqController. | |
| file | daqProperties.hpp |
Contains declaration of daq::Properties. | |
| file | dpPart.hpp |
| Contains declaration for DpPart. | |
| file | error.hpp |
| Contains error related declarations for DAQ. | |
| file | eventLog.hpp |
| Contains declaration for EventLog, ObservableEventLog and related events. | |
| file | eventLogObserver.hpp |
| Contains declaration for EventLogObserverLogger. | |
| file | fitsController.hpp |
| Contains declaration for for FitsController. | |
| file | manager.hpp |
Declaration of daq::Manager | |
| file | abort.hpp |
| Contains declaration for the AbortAsync operation. | |
| file | awaitPrim.hpp |
| Contains declaration for the AwaitPrimAsync operation. | |
| file | awaitState.hpp |
| Contains declaration for the AwaitStateAsync operation. | |
| file | initiate.hpp |
| Contains declarations for the helper functions to initiate operations. | |
| file | start.hpp |
| Contains declaration for the StartAsync operation. | |
| file | stop.hpp |
| Contains declaration for the StopAsync operation. | |
| file | util.hpp |
| Contains declaration for the async op utilities. | |
| file | pendingReplies.hpp |
| Contains declaration for classes related to pending replies. | |
| file | source.hpp |
Declarations for daq::Source and related classes. | |
| file | state.hpp |
Declares daq::State and related functions. | |
| file | status.hpp |
| Contains declaration for Status and ObservableStatus. | |
| file | manager.cpp |
Definition of daq::ManagerImpl and related utilities. | |
| file | awaitState.cpp |
| Contains definitions for the AwaitStateAsync operation. | |
| file | state.cpp |
| Definitions from daq/state.hpp. | |
Classes | |
| struct | daq::AsyncOperations |
| Async operations. More... | |
| class | daq::DaqController |
| Controls the execution of single data acquisition that ultimately result in a set of FITS keywords and/or FITS files. More... | |
| class | daq::DaqControllerImpl |
Implements daq::DaqController More... | |
| struct | daq::DaqProperties |
| Structure carrying properties needed to start a DataAcquisition. More... | |
| struct | daq::DpPart |
| Provides information of the location and origin of a FITS file or keywords produced by a data acquisition. More... | |
| class | daq::DaqOperationAborted |
| Started operation was aborted. More... | |
| class | daq::DaqOperationTimeout |
| Started operation timed out. More... | |
| class | daq::DaqSourceError |
| Represents error in single source. More... | |
| class | daq::DaqSourceErrors |
| Exception thrown to carry reply errors. More... | |
| struct | daq::GenericEvent |
| Represents a generic event if a more specific event is not usable. More... | |
| struct | daq::ActionEvent |
| Event related to an action being requested or performed. More... | |
| struct | daq::UserActionEvent |
| Event directly related to user action, such as a command to do something. More... | |
| struct | daq::EventLog |
| Represents a collection of events. More... | |
| class | daq::ObservableEventLog |
| Stores data acquisition status and allows subscription to status changes. More... | |
| class | daq::EventLogObserverLogger |
| A simple daq::ObservableEventLog observer that logs observed events to provided logger. More... | |
| class | daq::FitsController |
| Create FITS file containing keywords from OCM for the Data Acquisition. More... | |
| class | daq::Manager |
| Manager owns DaqController and FitsController (active data acquisitions) instances and multiplexes requests to them. More... | |
| class | daq::ManagerImpl |
Implements daq::Manager. More... | |
| struct | daq::op::AbortAsync |
| A composite async operation that aborts a DAQ. More... | |
| struct | daq::op::AwaitPrimAsync |
| A composite async operation that awaits primary data sources. More... | |
| struct | daq::op::AwaitStateAsync |
| Async operation to await Data Acquisition state. More... | |
| struct | daq::op::StartAsync |
| A composite async operation that starts DAQ. More... | |
| struct | daq::op::StopAsync |
| A composite async operation that starts DAQ. More... | |
| class | daq::ReplyToken |
| Token representing a not-yet-received reply. More... | |
| class | daq::PendingReplies |
| Simple class that allows you to keep track of how many replies are pending. More... | |
| struct | daq::Source< T > |
| Simple class that holds the source and associated state. More... | |
| class | daq::PrimSource |
| Keeps relevant state to be able to communicate with a primary data source. More... | |
| class | daq::MetaSource |
| Keeps relevant state to be able to communicate with a primary data source. More... | |
| struct | daq::Status |
| Non observable status object that keeps stores status of data acquisition. More... | |
| class | daq::ObservableStatus |
| Stores data acquisition status and allows subscription to status changes. More... | |
Enumerations | |
| enum | daq::State { daq::State::NotStarted = 0, daq::State::Starting = 1, daq::State::Acquiring = 2, daq::State::Stopping = 3, daq::State::Stopped = 4, daq::State::Aborting = 100, daq::State::Aborted = 101 } |
| Observable states of the data acquisition process. More... | |
Functions | |
| std::ostream & | daq::operator<< (std::ostream &os, FitsController const &ctl) |
| Print status information to provided ostream. More... | |
| std::string | daq::MakeDaqIdCandidate (char const *instrument_id, unsigned jitter=0) |
| Creates a DAQ id candidate that may or may not be unique. More... | |
| template<class R , class Iterator , class Pred , class Sender , class ReplyHandler > | |
| boost::future< std::vector< boost::future< R > > > | daq::op::SendRequestAndCollectReplies (Iterator begin, Iterator end, Pred filter_pred, AsyncOpParams params, Sender sender, ReplyHandler reply_handler, std::string_view logging_description) |
| Utility function to Send requests and collect replies. More... | |
| void | daq::op::UnwrapVoidReplies (boost::future< std::vector< boost::future< void >>> &&futures) |
| Unwrap futures to extract errors. More... | |
| template<class R > | |
| std::vector< R > | daq::op::UnwrapReplies (boost::future< std::vector< boost::future< R >>> &&futures) |
| Unwrap replies. More... | |
| template<class ReplyType > | |
| std::optional< ReplyType > | daq::op::HandleMetaDaqReply (std::optional< State > expected_state, State success_state, std::optional< State > error_state, AsyncOpParams params, Source< MetaSource > &source, boost::future< ReplyType > &&fut) |
| Reply handler that checks for exceptions in reply. More... | |
| template<class ReplyType > | |
| std::optional< ReplyType > | daq::op::HandlePrimDaqReply (std::optional< State > expected_state, State success_state, std::optional< State > error_state, AsyncOpParams params, Source< PrimSource > &source, boost::future< ReplyType > &&fut) |
| Reply handler that checks for exceptions in reply. More... | |
| std::ostream & | daq::operator<< (std::ostream &os, State state) |
| Prints state string representation to os. More... | |
| bool | daq::IsFinalState (State state) noexcept |
| Query whether state is in a final state. More... | |
| bool | daq::IsSubsequentState (State state, State after) noexcept |
| Compares states and returns whether state occurs after after. More... | |
OCM data acquisition library.
| struct daq::AsyncOperations |
Async operations.
Definition at line 46 of file daqController.hpp.
Public Types | |
| using | AwaitReturnType = std::pair< boost::future< Result< DpParts > >, std::function< bool()> > |
Public Member Functions | |
| AsyncOperations () | |
| Default constructs object with standard async operations. More... | |
| AsyncOperations (AsyncOperations &&)=default | |
| AsyncOperations (AsyncOperations const &)=default | |
| AsyncOperations & | operator= (AsyncOperations &&)=default |
| AsyncOperations & | operator= (AsyncOperations const &)=default |
| bool | IsValid () const noexcept |
Public Attributes | |
| std::function< boost::future< void >op::AsyncOpParams)> | start |
| std::function< boost::future< Result< void > >ErrorPolicy, op::AsyncOpParams)> | abort |
| std::function< boost::future< Result< DpParts > >ErrorPolicy, op::AsyncOpParams)> | stop |
| std::function< AwaitReturnType(op::AwaitOpParams)> | await_prim |
| using daq::AsyncOperations::AwaitReturnType = std::pair<boost::future<Result<DpParts> >, std::function<bool()> > |
Definition at line 48 of file daqController.hpp.
| daq::AsyncOperations::AsyncOperations | ( | ) |
Default constructs object with standard async operations.
Definition at line 32 of file daqController.cpp.
|
default |
|
default |
|
noexcept |
Definition at line 45 of file daqController.cpp.
|
default |
|
default |
| std::function<boost::future<Result<void> >ErrorPolicy, op::AsyncOpParams)> daq::AsyncOperations::abort |
Definition at line 63 of file daqController.hpp.
| std::function<AwaitReturnType(op::AwaitOpParams)> daq::AsyncOperations::await_prim |
Definition at line 65 of file daqController.hpp.
| std::function<boost::future<void>op::AsyncOpParams)> daq::AsyncOperations::start |
Definition at line 62 of file daqController.hpp.
| std::function<boost::future<Result<DpParts> >ErrorPolicy, op::AsyncOpParams)> daq::AsyncOperations::stop |
Definition at line 64 of file daqController.hpp.
| class daq::DaqController |
Controls the execution of single data acquisition that ultimately result in a set of FITS keywords and/or FITS files.
Due to the dynamic nature of data acquisitions (mostly w.r.t. fatal errors from data soures and commands from user) the following assumptions are made:
Aborting and even if the await operation completes successfully, the result will be discarded because user asked to abort.Starting
Start with StartAsync
Stop/abort with StopAsync or AbortAsync.
Automatically initiate stop if all primary sources are automatically stopped as indicated by ObservableStatus status update topic.
If asynchronous operations have been started, it is still possible to abort. This command will then supersede ongoing commands, and ongoing commands will be aborted at the next synchronization point (typically when reply is received).
It is not possible to retry or go backwards by executing StartAsync after StopAsync or AbortAsync. The reasoning behind this is to avoid the risk of duplicate data acquisition id being "in flight" at the same time..
It is possible to abort on the other hand, even though the data acquisition might not have been started yet.
For StartAsync, StopAsync, AbortAsync:
The error handling strategy is to not Set result until we have a result from each source either by reply or internal error when Sending/receiving (MAL issues e.g.).
This implies:
Starting then DaqController remains in Starting with the error flag Set.Pending decision decisions:
Definition at line 163 of file daqController.hpp.
Inheritance diagram for daq::DaqController:Public Member Functions | |
| DaqController ()=default | |
| virtual | ~DaqController ()=default |
| virtual boost::future< State > | StartAsync ()=0 |
| Starts the data acquisition. More... | |
| virtual boost::future< Status > | StopAsync (ErrorPolicy policy)=0 |
| Stops the data acquisition. More... | |
| virtual boost::future< Status > | AbortAsync (ErrorPolicy policy)=0 |
| Aborts the data acquisition. More... | |
| virtual void | UpdateKeywords (fits::KeywordVector const &keywords)=0 |
| Updates (replace or add) list of keywords. More... | |
| virtual boost::future< State > | AwaitAsync (std::vector< std::string > sources, std::chrono::milliseconds timeout)=0 |
| Awaits that data acquisition stops or aborts. More... | |
| 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 |
|
default |
|
virtualdefault |
|
pure virtual |
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. Implemented in daq::DaqControllerImpl, and DaqControllerFake.
|
pure virtual |
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. |
Implemented in DaqControllerFake, and daq::DaqControllerImpl.
|
pure virtual |
Implemented in DaqControllerFake, and daq::DaqControllerImpl.
|
pure virtual |
Implemented in DaqControllerFake, and daq::DaqControllerImpl.
|
pure virtual |
Implemented in DaqControllerFake, and daq::DaqControllerImpl.
|
pure virtual |
Implemented in daq::DaqControllerMock, DaqControllerFake, and daq::DaqControllerImpl.
|
pure virtual |
Implemented in DaqControllerFake, and daq::DaqControllerImpl.
|
pure virtual |
Implemented in DaqControllerFake, and daq::DaqControllerImpl.
|
pure virtual |
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 Implemented in DaqControllerFake, and daq::DaqControllerImpl.
|
pure virtual |
Stops the data acquisition.
GetState() not in (State::Stopped or State::Aborted) GetState() == State::Stopping Implemented in daq::DaqControllerImpl, and DaqControllerFake.
|
pure virtual |
Updates (replace or add) list of keywords.
| keywords | Keywords to add. |
Implemented in daq::DaqControllerImpl, and DaqControllerFake.
| class daq::DaqControllerImpl |
Implements daq::DaqController
Definition at line 259 of file daqController.hpp.
Inheritance diagram for daq::DaqControllerImpl:Public Member Functions | |
| boost::future< State > | StartAsync () override |
| Starts the data acquisition. More... | |
| boost::future< Status > | StopAsync (ErrorPolicy policy) override |
| Stops the data acquisition. More... | |
| boost::future< Status > | AbortAsync (ErrorPolicy policy) override |
| Aborts the data acquisition. More... | |
| void | UpdateKeywords (fits::KeywordVector const &keywords) override |
| Updates (replace or add) list of keywords. More... | |
| boost::future< State > | AwaitAsync (std::vector< std::string > sources, std::chrono::milliseconds timeout) override |
| Awaits that data acquisition stops or aborts. More... | |
| State | GetState () const DAQ_NOEXCEPT override |
| 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 |
| constexpr log4cplus::Logger const & | GetLogger () const noexcept |
Public Member Functions inherited from daq::DaqController | |
| DaqController ()=default | |
| virtual | ~DaqController ()=default |
Static Public Member Functions | |
| static std::shared_ptr< DaqControllerImpl > | Create (boost::asio::io_context &io_context, DaqProperties properties, std::shared_ptr< ObservableStatus > status, std::shared_ptr< ObservableEventLog > event_log, AsyncOperations operations) |
| Construct object. More... | |
Protected Types | |
| using | StateVariant = std::variant< NotStarted, Starting, Acquiring, Stopping, Stopped, Aborting, Aborted > |
Protected Member Functions | |
| StateVariant | MakeState (State s) const noexcept |
| DaqControllerImpl (boost::asio::io_context &io_context, DaqProperties properties, std::unique_ptr< FitsController > fits_controller, std::shared_ptr< ObservableStatus > status, std::shared_ptr< ObservableEventLog > event_log, AsyncOperations ops) | |
| template<class T , class... Args> | |
| void | AddEvent (Args &&... args) |
| op::AsyncOpParams | MakeParams () |
| Constructs the parameters used for asynchronous operations. More... | |
| op::AwaitOpParams | MakeAwaitParams () |
| void | InitiateAwaitPrimarySources () |
| Await completion of primary sources. More... | |
| void | SetErrorFlag (bool error) noexcept |
| void | SetState (StateVariant &&s) noexcept |
| std::optional< std::variant< gsl::not_null< Source< PrimSource > * >, gsl::not_null< 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. More... | |
Protected Attributes | |
| StateVariant | m_state |
| boost::asio::io_context & | m_io_ctx |
| rad::IoExecutor | m_executor |
| DaqProperties | m_properties |
| std::unique_ptr< FitsController > | m_fits_ctl |
| std::shared_ptr< ObservableStatus > | m_status |
| std::shared_ptr< ObservableEventLog > | m_event_log |
| std::vector< Source< PrimSource > > | m_prim_sources |
| Note: Consider vector immutable! More... | |
| std::vector< Source< MetaSource > > | m_meta_sources |
| Note: Consider vector immutable! More... | |
| AsyncOperations | 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. More... | |
| log4cplus::Logger | m_logger |
|
protected |
Definition at line 308 of file daqController.hpp.
|
protected |
Definition at line 103 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 368 of file daqController.cpp.
|
inlineprotected |
Definition at line 331 of file daqController.hpp.
|
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 451 of file daqController.cpp.
|
static |
Construct object.
| io_context | Executor used for continuations and timer. |
| properties | General properties 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 86 of file daqController.cpp.
|
protected |
Definition at line 590 of file daqController.cpp.
|
overridevirtual |
|
overridevirtual |
Implements daq::DaqController.
Definition at line 173 of file daqController.cpp.
|
overridevirtual |
Implements daq::DaqController.
Definition at line 177 of file daqController.cpp.
|
constexprnoexcept |
Definition at line 185 of file daqController.cpp.
|
overridevirtual |
Implements daq::DaqController.
Definition at line 138 of file daqController.cpp.
|
overridevirtual |
Implements daq::DaqController.
Definition at line 169 of file daqController.cpp.
|
overridevirtual |
Implements daq::DaqController.
Definition at line 165 of file daqController.cpp.
|
protected |
Await completion of primary sources.
If there are no sources this method does nothing.
Definition at line 627 of file daqController.cpp.
|
protected |
Definition at line 231 of file daqController.cpp.
|
protected |
Constructs the parameters used for asynchronous operations.
Definition at line 220 of file daqController.cpp.
|
protected |
Helper to build source vector.
Definition at line 615 of file daqController.cpp.
|
protectednoexcept |
Definition at line 189 of file daqController.cpp.
|
protectednoexcept |
Definition at line 210 of file daqController.cpp.
|
protectednoexcept |
Definition at line 214 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 243 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 291 of file daqController.cpp.
|
overridevirtual |
Updates (replace or add) list of keywords.
| keywords | Keywords to add. |
Implements daq::DaqController.
Definition at line 438 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 386 of file daqController.hpp.
|
protected |
Definition at line 376 of file daqController.hpp.
|
protected |
Definition at line 371 of file daqController.hpp.
|
protected |
Definition at line 366 of file daqController.hpp.
|
protected |
Definition at line 369 of file daqController.hpp.
|
protected |
Definition at line 365 of file daqController.hpp.
|
protected |
Definition at line 387 of file daqController.hpp.
|
protected |
Note: Consider vector immutable!
Definition at line 374 of file daqController.hpp.
|
protected |
Definition at line 377 of file daqController.hpp.
|
protected |
Note: Consider vector immutable!
Definition at line 373 of file daqController.hpp.
|
protected |
Definition at line 367 of file daqController.hpp.
|
protected |
Definition at line 364 of file daqController.hpp.
|
protected |
Definition at line 370 of file daqController.hpp.
|
protected |
Definition at line 378 of file daqController.hpp.
| struct daq::DaqProperties |
Structure carrying properties needed to start a DataAcquisition.
This information can be serialized and deserialized to facilitate persitant storage.
@seealso daq::Status
Definition at line 28 of file daqProperties.hpp.
Public Member Functions | |
| DaqProperties ()=default | |
| DaqProperties (DaqProperties const &)=default | |
| DaqProperties (DaqProperties &&)=default | |
| DaqProperties & | operator= (DaqProperties &&)=default |
| DaqProperties & | operator= (DaqProperties const &)=default |
Public Attributes | |
| std::string | id |
| std::string | process_name |
| User defined process name. More... | |
| std::string | dp_name_prefix |
| Data product file name prefix. More... | |
| std::string | ocm_dppart_root |
| Root directory for OCM data product part output. More... | |
| std::vector< PrimSource > | prim_sources |
| std::vector< MetaSource > | meta_sources |
| std::vector< daq::fits::KeywordVariant > | keywords |
| Initial list of keywords provided by user when starting data acquisitions. More... | |
| std::chrono::milliseconds | await_interval = std::chrono::seconds(10) |
| Interval (and thus duration) of the requests sent to primary sources to await end of recording. More... | |
|
default |
|
default |
|
default |
|
default |
|
default |
| std::chrono::milliseconds daq::DaqProperties::await_interval = std::chrono::seconds(10) |
Interval (and thus duration) of the requests sent to primary sources to await end of recording.
Default is 10 seconds.
Definition at line 61 of file daqProperties.hpp.
| std::string daq::DaqProperties::dp_name_prefix |
Data product file name prefix.
Definition at line 44 of file daqProperties.hpp.
| std::string daq::DaqProperties::id |
Definition at line 35 of file daqProperties.hpp.
| std::vector<daq::fits::KeywordVariant> daq::DaqProperties::keywords |
Initial list of keywords provided by user when starting data acquisitions.
Definition at line 54 of file daqProperties.hpp.
| std::vector<MetaSource> daq::DaqProperties::meta_sources |
Definition at line 50 of file daqProperties.hpp.
| std::string daq::DaqProperties::ocm_dppart_root |
Root directory for OCM data product part output.
Definition at line 48 of file daqProperties.hpp.
| std::vector<PrimSource> daq::DaqProperties::prim_sources |
Definition at line 49 of file daqProperties.hpp.
| std::string daq::DaqProperties::process_name |
User defined process name.
Definition at line 39 of file daqProperties.hpp.
| struct daq::DpPart |
Provides information of the location and origin of a FITS file or keywords produced by a data acquisition.
Definition at line 26 of file dpPart.hpp.
Public Member Functions | |
| DpPart (std::string origin, std::string path) noexcept | |
| DpPart (std::string origin, fits::KeywordVector keywords) noexcept | |
| DpPart ()=default | |
| DpPart (DpPart const &)=default | |
| DpPart (DpPart &&) noexcept=default | |
| DpPart & | operator= (DpPart const &)=default |
| DpPart & | operator= (DpPart &&) noexcept=default |
| bool | operator== (DpPart const &rhs) const noexcept |
| bool | operator!= (DpPart const &rhs) const noexcept |
Public Attributes | |
| std::string | origin |
| Component/process origin of the file. More... | |
| std::variant< std::string, fits::KeywordVector > | info |
Holds a std::string path [[user]@host:]path or FITS keywords. More... | |
|
noexcept |
Definition at line 17 of file dpPart.cpp.
|
noexcept |
Definition at line 21 of file dpPart.cpp.
|
default |
|
default |
|
defaultnoexcept |
|
noexcept |
Definition at line 30 of file dpPart.cpp.
|
noexcept |
Definition at line 26 of file dpPart.cpp.
| std::variant<std::string, fits::KeywordVector> daq::DpPart::info |
Holds a std::string path [[user]@host:]path or FITS keywords.
Definition at line 46 of file dpPart.hpp.
| std::string daq::DpPart::origin |
Component/process origin of the file.
Definition at line 41 of file dpPart.hpp.
| class daq::DaqOperationAborted |
| class daq::DaqOperationTimeout |
| class daq::DaqSourceError |
Inheritance diagram for daq::DaqSourceError:Public Member Functions | |
| DaqSourceError (std::string request, std::string source, std::string message) | |
| char const * | what () const noexcept override |
Public Attributes | |
| std::string | m_request |
| std::string | m_source |
| std::string | m_message |
| std::string | m_formatted |
| daq::DaqSourceError::DaqSourceError | ( | std::string | request, |
| std::string | source, | ||
| std::string | message | ||
| ) |
|
overridenoexcept |
| class daq::DaqSourceErrors |
Inheritance diagram for daq::DaqSourceErrors:Public Member Functions | |
| DaqSourceErrors (std::vector< std::exception_ptr > errors) | |
| DaqSourceErrors (std::vector< std::variant< DaqSourceError, std::exception_ptr >> errors) | |
Public Attributes | |
| std::vector< std::variant< DaqSourceError, std::exception_ptr > > | m_errors |
| daq::DaqSourceErrors::DaqSourceErrors | ( | std::vector< std::exception_ptr > | errors | ) |
| daq::DaqSourceErrors::DaqSourceErrors | ( | std::vector< std::variant< DaqSourceError, std::exception_ptr >> | errors | ) |
| std::vector<std::variant<DaqSourceError, std::exception_ptr> > daq::DaqSourceErrors::m_errors |
| struct daq::GenericEvent |
Represents a generic event if a more specific event is not usable.
Definition at line 29 of file eventLog.hpp.
Inheritance diagram for daq::GenericEvent:Public Types | |
| using | TimePoint = std::chrono::time_point< std::chrono::steady_clock > |
Public Member Functions | |
| GenericEvent (std::string id, std::string description, std::optional< Status > status) noexcept | |
| GenericEvent (GenericEvent &&)=default | |
| GenericEvent (GenericEvent const &)=default | |
| GenericEvent & | operator= (GenericEvent &&)=default |
| GenericEvent & | operator= (GenericEvent const &)=default |
| bool | operator== (GenericEvent const &rhs) const noexcept |
| bool | operator!= (GenericEvent const &rhs) const noexcept |
Public Attributes | |
| TimePoint | timestamp |
| std::string | id |
| std::string | description |
| std::optional< Status > | status |
| using daq::GenericEvent::TimePoint = std::chrono::time_point<std::chrono::steady_clock> |
Definition at line 30 of file eventLog.hpp.
|
noexcept |
Definition at line 12 of file eventLog.cpp.
|
default |
|
default |
|
noexcept |
Definition at line 22 of file eventLog.cpp.
|
default |
|
default |
|
noexcept |
Definition at line 18 of file eventLog.cpp.
| std::string daq::GenericEvent::description |
Definition at line 44 of file eventLog.hpp.
| std::string daq::GenericEvent::id |
Definition at line 43 of file eventLog.hpp.
| std::optional<Status> daq::GenericEvent::status |
Definition at line 45 of file eventLog.hpp.
| TimePoint daq::GenericEvent::timestamp |
Definition at line 42 of file eventLog.hpp.
| struct daq::ActionEvent |
Event related to an action being requested or performed.
Definition at line 56 of file eventLog.hpp.
Inheritance diagram for daq::ActionEvent:Public Member Functions | |
| GenericEvent (std::string id, std::string description, std::optional< Status > status) noexcept | |
| GenericEvent (GenericEvent &&)=default | |
| GenericEvent (GenericEvent const &)=default | |
Public Member Functions inherited from daq::GenericEvent | |
| GenericEvent (std::string id, std::string description, std::optional< Status > status) noexcept | |
| GenericEvent (GenericEvent &&)=default | |
| GenericEvent (GenericEvent const &)=default | |
| GenericEvent & | operator= (GenericEvent &&)=default |
| GenericEvent & | operator= (GenericEvent const &)=default |
| bool | operator== (GenericEvent const &rhs) const noexcept |
| bool | operator!= (GenericEvent const &rhs) const noexcept |
Additional Inherited Members | |
Public Types inherited from daq::GenericEvent | |
| using | TimePoint = std::chrono::time_point< std::chrono::steady_clock > |
Public Attributes inherited from daq::GenericEvent | |
| TimePoint | timestamp |
| std::string | id |
| std::string | description |
| std::optional< Status > | status |
|
default |
|
default |
|
noexcept |
Definition at line 32 of file eventLog.cpp.
| struct daq::UserActionEvent |
Event directly related to user action, such as a command to do something.
Definition at line 65 of file eventLog.hpp.
Inheritance diagram for daq::UserActionEvent:Additional Inherited Members | |
Public Types inherited from daq::GenericEvent | |
| using | TimePoint = std::chrono::time_point< std::chrono::steady_clock > |
Public Member Functions inherited from daq::ActionEvent | |
| GenericEvent (std::string id, std::string description, std::optional< Status > status) noexcept | |
| GenericEvent (GenericEvent &&)=default | |
| GenericEvent (GenericEvent const &)=default | |
Public Member Functions inherited from daq::GenericEvent | |
| GenericEvent (std::string id, std::string description, std::optional< Status > status) noexcept | |
| GenericEvent (GenericEvent &&)=default | |
| GenericEvent (GenericEvent const &)=default | |
| GenericEvent & | operator= (GenericEvent &&)=default |
| GenericEvent & | operator= (GenericEvent const &)=default |
| bool | operator== (GenericEvent const &rhs) const noexcept |
| bool | operator!= (GenericEvent const &rhs) const noexcept |
Public Attributes inherited from daq::GenericEvent | |
| TimePoint | timestamp |
| std::string | id |
| std::string | description |
| std::optional< Status > | status |
| struct daq::EventLog |
Represents a collection of events.
Definition at line 89 of file eventLog.hpp.
Public Types | |
| using | EventType = std::variant< ActionEvent, UserActionEvent, GenericEvent, ErrorEvent > |
| using | TimePoint = std::chrono::time_point< std::chrono::steady_clock > |
Public Member Functions | |
| bool | operator== (EventLog const &rhs) const noexcept |
| bool | operator!= (EventLog const &rhs) const noexcept |
Public Attributes | |
| std::vector< EventType > | events |
| using daq::EventLog::EventType = std::variant<ActionEvent, UserActionEvent, GenericEvent, ErrorEvent> |
Definition at line 90 of file eventLog.hpp.
| using daq::EventLog::TimePoint = std::chrono::time_point<std::chrono::steady_clock> |
Definition at line 91 of file eventLog.hpp.
|
noexcept |
|
noexcept |
| std::vector<EventType> daq::EventLog::events |
Definition at line 96 of file eventLog.hpp.
| class daq::ObservableEventLog |
Stores data acquisition status and allows subscription to status changes.
DaqController and other objects will update ObservableEvent as changes occur.
Definition at line 107 of file eventLog.hpp.
Public Types | |
| using | Signal = boost::signals2::signal< void(EventLog::EventType const &)> |
Public Member Functions | |
| ObservableEventLog ()=default | |
| Construct a new object. More... | |
| ObservableEventLog (ObservableEventLog const &)=delete | |
| ObservableEventLog & | operator= (ObservableEventLog const &)=delete |
Modifiers | |
| void | AddEvent (EventLog::EventType event) |
| Records that a file has been produced for this data acquisition. More... | |
| template<class T , class... Args> | |
| void | EmplaceEvent (Args &&... args) |
| Like AddEvent but emplaces the specified event type. More... | |
| template<class Observer > | |
| boost::signals2::connection | ConnectObserver (Observer o) |
| Connect observer that is invoked when state is modified. More... | |
Accessors | |
| operator EventLog const & () | |
| Allow implicit conversion to non-observable status. More... | |
| EventLog const & | GetEventLog () const noexcept |
| Allow implicit conversion to non-observable status. More... | |
| std::vector< EventLog::EventType > const & | GetEventContainer () const noexcept |
| Allow implicit conversion to non-observable status. More... | |
| using daq::ObservableEventLog::Signal = boost::signals2::signal<void(EventLog::EventType const&)> |
Definition at line 109 of file eventLog.hpp.
|
explicitdefault |
Construct a new object.
| id | Data acquisition identifier. |
|
delete |
| void daq::ObservableEventLog::AddEvent | ( | EventLog::EventType | event | ) |
Records that a file has been produced for this data acquisition.
| files | Files to add/record. |
Definition at line 54 of file eventLog.cpp.
|
inline |
Connect observer that is invoked when state is modified.
| o | Observer callable invoked on status changes (state or file changes) Observer must be invocable with signature void(ObservableEvent const&). |
Definition at line 154 of file eventLog.hpp.
|
inline |
Like AddEvent but emplaces the specified event type.
Definition at line 134 of file eventLog.hpp.
|
inlinenoexcept |
Allow implicit conversion to non-observable status.
Definition at line 172 of file eventLog.hpp.
|
inlinenoexcept |
Allow implicit conversion to non-observable status.
Definition at line 168 of file eventLog.hpp.
|
inline |
Allow implicit conversion to non-observable status.
Definition at line 164 of file eventLog.hpp.
|
delete |
| class daq::EventLogObserverLogger |
A simple daq::ObservableEventLog observer that logs observed events to provided logger.
Definition at line 22 of file eventLogObserver.hpp.
Public Member Functions | |
| EventLogObserverLogger (log4cplus::Logger logger) | |
| void | operator() (EventLog::EventType const &event) noexcept |
| Observer callback that immediately logs the event. More... | |
| daq::EventLogObserverLogger::EventLogObserverLogger | ( | log4cplus::Logger | logger | ) |
Definition at line 19 of file eventLogObserver.cpp.
|
noexcept |
Observer callback that immediately logs the event.
Definition at line 26 of file eventLogObserver.cpp.
| class daq::FitsController |
Create FITS file containing keywords from OCM for the Data Acquisition.
Responsibilities:
Design notes:
Pending interface:
Definition at line 58 of file fitsController.hpp.
Inheritance diagram for daq::FitsController:Public Member Functions | |
| virtual | ~FitsController ()=default |
Modifiers | |
| virtual void | Start ()=0 |
| Creates FITS file and pupulates it with initial list of keywords. More... | |
| virtual std::optional< DpPart > | Stop (ErrorPolicy policy)=0 |
| Finalizes the FITS file. More... | |
| virtual void | Abort (ErrorPolicy policy)=0 |
| Aborts and deletes FITS file. More... | |
| virtual void | UpdateKeywords (std::vector< fits::KeywordVariant > const &keywords)=0 |
| Updates with provided keywords. More... | |
| virtual void | AddComment (std::string comment)=0 |
| Add comment. More... | |
Accessors | |
| virtual std::string const & | GetId () const DAQ_NOEXCEPT=0 |
| Query FITS file path. More... | |
| virtual std::optional< DpPart > | GetResult () const DAQ_NOEXCEPT=0 |
| Query FITS file path. More... | |
| virtual State | GetState () const DAQ_NOEXCEPT=0 |
| Query state. More... | |
|
virtualdefault |
|
pure virtual |
Aborts and deletes FITS file.
GetState() == State::Acquiring. Implemented in daq::FitsControllerImpl.
|
pure virtual |
Add comment.
GetState() != State::Stopped && GetState() != State::Aborted.| comment | Comment to add to FITS file. " |
| std::runtime_error | if GetState() == State::Stopped || GetState() == State::Aborted. |
Implemented in daq::FitsControllerImpl.
|
pure virtual |
|
pure virtual |
|
pure virtual |
|
pure virtual |
Creates FITS file and pupulates it with initial list of keywords.
GetState() == State::NotStarted. | fits::CfitsioError | on errors with cfitsio. |
| std::runtime_error | on error. |
Implemented in daq::FitsControllerImpl.
|
pure virtual |
Finalizes the FITS file.
If policy ErrorPolicy::Strict the function will throw if there was any error in creating the FITS file. If policy is ErrorPolicy::Tolerant exception will only be thrown for fatal errors, not if FITS file failed to be created.
| policy | Controls the error policy. |
| std::runtime_error | if GetState() != State::Acquiring. |
| daq::fits::CfitsioError | if no FITS file could be created and policy == ErrorPolicy::Strict. |
Implemented in daq::FitsControllerImpl.
|
pure virtual |
Updates with provided keywords.
| keywords | Keywords to add or replace. " |
| std::runtime_error | if GetState() == State::Stopped || GetState() == State::Aborted. |
Implemented in daq::FitsControllerImpl.
| class daq::Manager |
Manager owns DaqController and FitsController (active data acquisitions) instances and multiplexes requests to them.
Important responsibilities:
FitsController also act as a data source.
Out of scope:
DaqController instances.FitsController instances.Definition at line 86 of file manager.hpp.
Inheritance diagram for daq::Manager:Public Types | |
| using | Signal = boost::signals2::signal< void(ObservableStatus const &)> |
Public Member Functions | |
| virtual | ~Manager () |
| virtual std::string | MakeDaqId () const =0 |
| Creates a new unique identifier based on the instrumend id and current time. More... | |
| virtual bool | HaveDaq (std::string_view id) const DAQ_NOEXCEPT=0 |
Query existing data acquisition by id. More... | |
| virtual Status | GetStatus (std::string_view id) const =0 |
| Get status. More... | |
| virtual void | AddDaq (std::shared_ptr< DaqController > daq)=0 |
| Add data acquisition. More... | |
| virtual boost::future< State > | StartDaqAsync (std::string_view id)=0 |
Start DaqController identified by id. More... | |
| virtual boost::future< Status > | StopDaqAsync (std::string_view id, ErrorPolicy policy)=0 |
Stop DaqController identified by id. More... | |
| virtual boost::future< Status > | AbortDaqAsync (std::string_view id, ErrorPolicy policy)=0 |
Abort DaqController identified by id. More... | |
| virtual boost::future< Result< Status > > | AwaitDaqStateAsync (std::string_view id, State state, std::chrono::milliseconds timeout)=0 |
| Await DAQ state. More... | |
| virtual void | UpdateKeywords (std::string_view id, fits::KeywordVector const &keywords)=0 |
Update FITS keywords for DaqController identified by id. More... | |
| virtual StatusSignal & | GetStatusSignal ()=0 |
| virtual std::vector< std::shared_ptr< DaqController const > > | GetDaqControllers ()=0 |
| using daq::Manager::Signal = boost::signals2::signal<void(ObservableStatus const&)> |
Definition at line 89 of file manager.hpp.
|
inlinevirtual |
Definition at line 88 of file manager.hpp.
|
pure virtual |
Abort DaqController identified by id.
| id | Data acquisition id. |
| policy | Error policy determining if errors are tolerated or not. |
id does not exist. Implemented in daq::ManagerImpl.
|
pure virtual |
Add data acquisition.
When a DataAcqusition is added the Manager will also start subscribing to events from primary data sources for monitoring purposes.
Implemented in daq::ManagerImpl.
|
pure virtual |
Await DAQ state.
| id | Data acquisition id. |
| state | target state to await. |
| timeout | How long to wait for state to be reached. |
id does not exist or timeout is negative. Implemented in daq::ManagerImpl.
|
pure virtual |
Implemented in daq::ManagerImpl.
|
pure virtual |
Get status.
| std::invalid_argument | if no data acquisition exist with provided id. |
Implemented in daq::ManagerImpl.
|
pure virtual |
The status observer observes any DAQ status changes.
Implemented in daq::ManagerImpl.
|
pure virtual |
Query existing data acquisition by id.
Implemented in daq::ManagerImpl.
|
pure virtual |
Creates a new unique identifier based on the instrumend id and current time.
If there is a id collision when using current time a millisecond jitter component is added until a unique id is found.
The format is the same as ARCFILE - the file extension: "<OLAS_ID>-2020-08-19T09:33:11.951"
| std::system_error | on failure. |
Implemented in daq::ManagerImpl.
|
pure virtual |
Start DaqController identified by id.
| id | Data acquisition id. |
id does not exist. Implemented in daq::ManagerImpl.
|
pure virtual |
Stop DaqController identified by id.
| id | Data acquisition id. |
| policy | Error policy determining if errors are tolerated or not. |
id does not exist. Implemented in daq::ManagerImpl.
|
pure virtual |
Update FITS keywords for DaqController identified by id.
| id | Data acquisition id. |
| keywords | FITS keywords to update. |
| std::invalid_argument | if no data acquisition exist with provided id. |
| std::runtime_error | If DaqController state does not allow updating of keywords (it's e.g. already been submitted for merging). |
Implemented in daq::ManagerImpl.
| class daq::ManagerImpl |
Implements daq::Manager.
Definition at line 211 of file manager.hpp.
Inheritance diagram for daq::ManagerImpl:Public Member Functions | |
| ManagerImpl (rad::IoExecutor &executor, std::string instrument_id) | |
| ~ManagerImpl () noexcept | |
| std::string | MakeDaqId () const override |
| Creates a new unique identifier based on the instrumend id and current time. More... | |
| bool | HaveDaq (std::string_view id) const noexcept override |
Query existing data acquisition by id. More... | |
| Status | GetStatus (std::string_view id) const override |
| Get status. More... | |
| void | AddDaq (std::shared_ptr< DaqController > daq) override |
| Add data acquisition. More... | |
| boost::future< State > | StartDaqAsync (std::string_view id) override |
Start DaqController identified by id. More... | |
| boost::future< Status > | StopDaqAsync (std::string_view id, ErrorPolicy policy) override |
Stop DaqController identified by id. More... | |
| boost::future< Status > | AbortDaqAsync (std::string_view id, ErrorPolicy policy) override |
Abort DaqController identified by id. More... | |
| boost::future< Result< Status > > | AwaitDaqStateAsync (std::string_view id, State, std::chrono::milliseconds timeout) override |
| Await DAQ state. More... | |
| void | UpdateKeywords (std::string_view id, fits::KeywordVector const &keywords) override |
Update FITS keywords for DaqController identified by id. More... | |
| StatusSignal & | GetStatusSignal () override |
| std::vector< std::shared_ptr< DaqController const > > | GetDaqControllers () override |
Public Member Functions inherited from daq::Manager | |
| virtual | ~Manager () |
Additional Inherited Members | |
Public Types inherited from daq::Manager | |
| using | Signal = boost::signals2::signal< void(ObservableStatus const &)> |
|
explicit |
| instrument_id | Instrument id. |
Definition at line 63 of file manager.cpp.
|
noexcept |
Definition at line 71 of file manager.cpp.
|
overridevirtual |
Abort DaqController identified by id.
| id | Data acquisition id. |
| policy | Error policy determining if errors are tolerated or not. |
id does not exist. Implements daq::Manager.
Definition at line 171 of file manager.cpp.
|
overridevirtual |
Add data acquisition.
When a DataAcqusition is added the Manager will also start subscribing to events from primary data sources for monitoring purposes.
Implements daq::Manager.
Definition at line 100 of file manager.cpp.
|
overridevirtual |
Await DAQ state.
| id | Data acquisition id. |
| state | target state to await. |
| timeout | How long to wait for state to be reached. |
id does not exist or timeout is negative. Implements daq::Manager.
Definition at line 179 of file manager.cpp.
|
overridevirtual |
Implements daq::Manager.
Definition at line 227 of file manager.cpp.
|
overridevirtual |
Get status.
| std::invalid_argument | if no data acquisition exist with provided id. |
Implements daq::Manager.
Definition at line 114 of file manager.cpp.
|
overridevirtual |
The status observer observes any DAQ status changes.
Implements daq::Manager.
Definition at line 223 of file manager.cpp.
|
overridevirtualnoexcept |
Query existing data acquisition by id.
Implements daq::Manager.
Definition at line 96 of file manager.cpp.
|
overridevirtual |
Creates a new unique identifier based on the instrumend id and current time.
If there is a id collision when using current time a millisecond jitter component is added until a unique id is found.
The format is the same as ARCFILE - the file extension: "<OLAS_ID>-2020-08-19T09:33:11.951"
| std::system_error | on failure. |
Implements daq::Manager.
Definition at line 87 of file manager.cpp.
|
overridevirtual |
Start DaqController identified by id.
| id | Data acquisition id. |
id does not exist. Implements daq::Manager.
Definition at line 155 of file manager.cpp.
|
overridevirtual |
Stop DaqController identified by id.
| id | Data acquisition id. |
| policy | Error policy determining if errors are tolerated or not. |
id does not exist. Implements daq::Manager.
Definition at line 163 of file manager.cpp.
|
overridevirtual |
Update FITS keywords for DaqController identified by id.
| id | Data acquisition id. |
| keywords | FITS keywords to update. |
| std::invalid_argument | if no data acquisition exist with provided id. |
| std::runtime_error | If DaqController state does not allow updating of keywords (it's e.g. already been submitted for merging). |
Implements daq::Manager.
Definition at line 219 of file manager.cpp.
| struct daq::op::AbortAsync |
Public Types | |
| using | ResultType = Result< void > |
Public Member Functions | |
| AbortAsync (ErrorPolicy policy, AsyncOpParams params) noexcept | |
| boost::future< ResultType > | Initiate () |
| Initiates operation that stats metadata acquisition. More... | |
| using daq::op::AbortAsync::ResultType = Result<void> |
|
explicitnoexcept |
| boost::future< AbortAsync::ResultType > daq::op::AbortAsync::Initiate | ( | ) |
Initiates operation that stats metadata acquisition.
If tolerant policy is used exceptions from AbortMeta() or AbortPrim() are ignored.
| struct daq::op::AwaitPrimAsync |
A composite async operation that awaits primary data sources.
This is used by OCM to await primary data sources completion. Since sources may acquire data for a long time the operation is implemented by sending await commands to client with a smaller timeout, and then resending request on timeout. This is done to be able to have a reasonable MAL timeout to detect network related issues.
The await operation returns files produced from awaited-on sources (using DpParts result).
Await requests are ony sent to source if observed state requires it (i.e. if source is not already observed to be stopped, from a previous AwaitPrimAsync operation).
Await operation is completed when any of the following conditions are fulfilled:
The operation does not allow configurable error policy but behaves as if ErrorPolicy::Robust is set. The following are condidered fatal errors (causing result of operation to be an exception):
Internal errors.
Definition at line 56 of file awaitPrim.hpp.
Public Member Functions | |
| AwaitPrimAsync (AwaitOpParams params) noexcept | |
| Constructs operation with the privided parameters. More... | |
| boost::future< Result< DpParts > > | Initiate () |
| Initiates operation that await acquisition completion. More... | |
| void | Abort () noexcept |
| Aborts the operation. More... | |
|
explicitnoexcept |
Constructs operation with the privided parameters.
| params | parameters. |
Definition at line 98 of file awaitPrim.cpp.
|
noexcept |
Aborts the operation.
Definition at line 168 of file awaitPrim.cpp.
Initiates operation that await acquisition completion.
Definition at line 102 of file awaitPrim.cpp.
| struct daq::op::AwaitStateAsync |
Async operation to await Data Acquisition state.
Satisfies concept requirements for op::InitiateAbortableOperation and op::InitiateOperation.
Definition at line 32 of file awaitState.hpp.
Public Types | |
| using | ResultType = ::daq::Result< Status > |
Public Member Functions | |
| AwaitStateAsync (boost::asio::io_context &io_ctx, std::shared_ptr< ObservableStatus > status, State state, std::chrono::milliseconds timeout) | |
| Constructs operation with the privided parameters. More... | |
| boost::future< ResultType > | Initiate () |
| Initiates operation that await state. More... | |
| void | Abort () noexcept |
| Aborts the operation and completes the operation with DaqOperationAborted. More... | |
Definition at line 34 of file awaitState.hpp.
|
explicit |
Constructs operation with the privided parameters.
| io_ctx | ASIO context. |
| status | DAQ status to monitor/observe changes on. |
| state | Target state. |
| timeout | Operation timeout. |
Definition at line 20 of file awaitState.cpp.
|
noexcept |
Aborts the operation and completes the operation with DaqOperationAborted.
Definition at line 93 of file awaitState.cpp.
| boost::future< AwaitStateAsync::ResultType > daq::op::AwaitStateAsync::Initiate | ( | ) |
Initiates operation that await state.
Definition at line 35 of file awaitState.cpp.
| struct daq::op::StartAsync |
Public Member Functions | |
| StartAsync (AsyncOpParams params) noexcept | |
| boost::future< void > | Initiate () |
| Initiates operation that starts metadata acquisition. More... | |
|
explicitnoexcept |
| boost::future< void > daq::op::StartAsync::Initiate | ( | ) |
| struct daq::op::StopAsync |
Public Member Functions | |
| StopAsync (ErrorPolicy policy, AsyncOpParams params) noexcept | |
| boost::future< Result< DpParts > > | Initiate () |
| Initiates operation that stop metadata acquisition. More... | |
|
explicitnoexcept |
| class daq::ReplyToken |
Token representing a not-yet-received reply.
Definition at line 26 of file pendingReplies.hpp.
Public Member Functions | |
| ReplyToken (ReplyToken &&)=default | |
| ReplyToken & | operator= (ReplyToken &&)=default |
| ~ReplyToken () | |
| void | Release () |
| Release token explicitly. More... | |
Protected Member Functions | |
| ReplyToken (uint64_t token, std::weak_ptr< PendingReplies > pending_replies) noexcept | |
Protected Attributes | |
| friend | PendingReplies |
|
default |
| daq::ReplyToken::~ReplyToken | ( | ) |
Definition at line 11 of file pendingReplies.cpp.
|
explicitprotectednoexcept |
Definition at line 7 of file pendingReplies.cpp.
|
default |
| void daq::ReplyToken::Release | ( | ) |
Release token explicitly.
Definition at line 16 of file pendingReplies.cpp.
|
protected |
Definition at line 38 of file pendingReplies.hpp.
| class daq::PendingReplies |
Simple class that allows you to keep track of how many replies are pending.
Usage:
For each request acquire a token with acquire. The token is movable but not copyable to guarantee uniqueness.
Once reply is released release the token by deleting it.
Definition at line 58 of file pendingReplies.hpp.
Inheritance diagram for daq::PendingReplies:Public Member Functions | |
| ReplyToken | Acquire (std::string source_id, std::string request) |
| Acquire token. More... | |
| std::shared_ptr< ReplyToken > | AcquireShared (std::string source_id, std::string request) |
| bool | HasPendingReplies () const |
| std::vector< PendingReply > | GetPendingReplies () const |
Static Public Member Functions | |
| static std::shared_ptr< PendingReplies > | Create () |
| Create instance. More... | |
Protected Member Functions | |
| void | Release (uint64_t token) |
| PendingReplies ()=default | |
Protected Attributes | |
| friend | ReplyToken |
|
protecteddefault |
| ReplyToken daq::PendingReplies::Acquire | ( | std::string | source_id, |
| std::string | request | ||
| ) |
Acquire token.
Keep the token alive until reply is received, then delete it.
Definition at line 38 of file pendingReplies.cpp.
| std::shared_ptr< ReplyToken > daq::PendingReplies::AcquireShared | ( | std::string | source_id, |
| std::string | request | ||
| ) |
Definition at line 45 of file pendingReplies.cpp.
|
static |
Create instance.
Definition at line 22 of file pendingReplies.cpp.
| std::vector< PendingReplies::PendingReply > daq::PendingReplies::GetPendingReplies | ( | ) | const |
Definition at line 30 of file pendingReplies.cpp.
| bool daq::PendingReplies::HasPendingReplies | ( | ) | const |
Definition at line 26 of file pendingReplies.cpp.
|
protected |
Definition at line 53 of file pendingReplies.cpp.
|
protected |
Definition at line 82 of file pendingReplies.hpp.
| struct daq::Source |
Simple class that holds the source and associated state.
Definition at line 29 of file source.hpp.
Public Types | |
| using | StateSignal = boost::signals2::signal< void(State, bool)> |
Public Member Functions | |
| Source (T &&s) | |
| template<class Subscriber > | |
| boost::signals2::connection | ConnectStateListener (Subscriber subscriber) |
Connect subscriber that is invoked on state changes. More... | |
| void | SetState (State state, std::optional< bool > error_flag={}) |
| void | ClearErrorFlag () |
| void | SetErrorFlag () |
| bool | GetErrorFlag () const |
| State | GetState () const |
| T & | GetSource () |
| T const & | GetSource () const |
Protected Attributes | |
| T | m_source |
| State | m_state = State::NotStarted |
| bool | m_error_flag = false |
| StateSignal | m_state_signal |
Friends | |
| std::ostream & | operator<< (std::ostream &os, Source< T > const &s) |
| using daq::Source< T >::StateSignal = boost::signals2::signal<void(State, bool)> |
Definition at line 30 of file source.hpp.
|
inline |
Definition at line 32 of file source.hpp.
|
inline |
Definition at line 59 of file source.hpp.
|
inline |
Connect subscriber that is invoked on state changes.
Type requirements of subscriber: Signature void(State, bool)
Definition at line 47 of file source.hpp.
|
inline |
Definition at line 69 of file source.hpp.
|
inline |
Definition at line 76 of file source.hpp.
|
inline |
Definition at line 80 of file source.hpp.
|
inline |
Definition at line 72 of file source.hpp.
|
inline |
Definition at line 64 of file source.hpp.
|
inline |
Definition at line 51 of file source.hpp.
|
friend |
Definition at line 33 of file source.hpp.
|
protected |
Definition at line 87 of file source.hpp.
|
protected |
Definition at line 85 of file source.hpp.
|
protected |
Definition at line 86 of file source.hpp.
|
protected |
Definition at line 88 of file source.hpp.
| class daq::PrimSource |
Keeps relevant state to be able to communicate with a primary data source.
Definition at line 96 of file source.hpp.
Public Types | |
| using | RrClient = recif::RecCmdsAsync |
Public Member Functions | |
| PrimSource (std::string name, std::shared_ptr< RrClient > client) | |
| PrimSource (PrimSource &&)=default | |
| PrimSource (PrimSource const &)=default | |
| PrimSource & | operator= (PrimSource &)=default |
| PrimSource & | operator= (PrimSource &&)=default |
| std::string_view | GetName () const |
| RrClient & | GetRrClient () |
Friends | |
| std::ostream & | operator<< (std::ostream &os, PrimSource const &s) |
| using daq::PrimSource::RrClient = recif::RecCmdsAsync |
Definition at line 98 of file source.hpp.
|
inline |
| std::invalid_argument | if name or client is invalid. |
Definition at line 103 of file source.hpp.
|
default |
|
default |
|
inline |
Definition at line 116 of file source.hpp.
|
inline |
Definition at line 120 of file source.hpp.
|
default |
|
default |
|
friend |
Definition at line 124 of file source.hpp.
| class daq::MetaSource |
Keeps relevant state to be able to communicate with a primary data source.
Definition at line 139 of file source.hpp.
Public Types | |
| using | RrClient = metadaqif::MetaDaqAsync |
Public Member Functions | |
| MetaSource (std::string name, std::shared_ptr< RrClient > client) | |
| MetaSource (MetaSource &&)=default | |
| MetaSource (MetaSource const &)=default | |
| MetaSource & | operator= (MetaSource const &)=default |
| MetaSource & | operator= (MetaSource &&)=default |
| std::string_view | GetName () const |
| RrClient & | GetRrClient () |
Friends | |
| std::ostream & | operator<< (std::ostream &os, MetaSource const &s) |
| using daq::MetaSource::RrClient = metadaqif::MetaDaqAsync |
Definition at line 141 of file source.hpp.
|
inline |
| std::invalid_argument | if name or client is invalid. |
Definition at line 146 of file source.hpp.
|
default |
|
default |
|
inline |
Definition at line 159 of file source.hpp.
|
inline |
Definition at line 163 of file source.hpp.
|
default |
|
default |
|
friend |
Definition at line 167 of file source.hpp.
| struct daq::Status |
Non observable status object that keeps stores status of data acquisition.
It is also planned to be serializable to allow crash recovery from persistent storage.
Definition at line 32 of file status.hpp.
Public Types | |
| using | TimePoint = std::chrono::time_point< std::chrono::steady_clock > |
Public Member Functions | |
| Status (std::string id) noexcept | |
| Status (std::string id, State state, bool error, DpParts files, fits::KeywordVector keywords, TimePoint timestamp) noexcept | |
| Status (Status &&)=default | |
| Status (Status const &)=default | |
| Status & | operator= (Status &&)=default |
| Status & | operator= (Status const &)=default |
| bool | operator== (Status const &rhs) const noexcept |
| bool | operator!= (Status const &rhs) const noexcept |
Public Attributes | |
| std::string | id |
| State | state |
| bool | error |
| DpParts | files |
| fits::KeywordVector | keywords |
| TimePoint | timestamp |
| using daq::Status::TimePoint = std::chrono::time_point<std::chrono::steady_clock> |
Definition at line 33 of file status.hpp.
|
explicitnoexcept |
Definition at line 21 of file status.cpp.
|
noexcept |
Definition at line 7 of file status.cpp.
|
default |
|
default |
|
noexcept |
Definition at line 34 of file status.cpp.
|
noexcept |
Definition at line 30 of file status.cpp.
| bool daq::Status::error |
Definition at line 53 of file status.hpp.
| DpParts daq::Status::files |
Definition at line 54 of file status.hpp.
| std::string daq::Status::id |
Definition at line 51 of file status.hpp.
| fits::KeywordVector daq::Status::keywords |
Definition at line 55 of file status.hpp.
| State daq::Status::state |
Definition at line 52 of file status.hpp.
| TimePoint daq::Status::timestamp |
Definition at line 56 of file status.hpp.
| class daq::ObservableStatus |
Stores data acquisition status and allows subscription to status changes.
DaqController instances will update ObservableStatus as changes occur.
Definition at line 68 of file status.hpp.
Public Member Functions | |
| ObservableStatus (std::string id) noexcept | |
| Construct a new object. More... | |
| ObservableStatus (ObservableStatus const &)=delete | |
| ObservableStatus & | operator= (ObservableStatus const &)=delete |
| bool | operator== (ObservableStatus const &rhs) const noexcept |
| bool | operator!= (ObservableStatus const &rhs) const noexcept |
| bool | operator== (Status const &rhs) const noexcept |
| bool | operator!= (Status const &rhs) const noexcept |
Accessors | |
| std::string const & | GetId () const noexcept |
| State | GetState () const noexcept |
| bool | GetError () const noexcept |
| std::vector< DpPart > const & | GetFiles () const noexcept |
| fits::KeywordVector const & | GetKeywords () const noexcept |
Modifiers | |
| using | Signal = boost::signals2::signal< void(ObservableStatus const &)> |
| Connect observer that is invoked when state is modified. More... | |
| void | AddFiles (std::vector< DpPart > const &files) |
| Records that a file has been produced for this data acquisition. More... | |
| void | UpdateKeywords (fits::KeywordVector const &) noexcept |
| Updates (adds or replaces) Primary HDU keywords. More... | |
| void | SetState (State s) noexcept |
| Set state of data acquisition. More... | |
| void | SetError (bool error) noexcept |
| Set error flag for data acquisition. More... | |
| template<class Observer > | |
| boost::signals2::connection | ConnectObserver (Observer o) |
| Connect observer that is invoked when state is modified. More... | |
| operator Status () const | |
| Allow implicit conversion to non-observable status. More... | |
| Status const & | GetStatus () const noexcept |
| Connect observer that is invoked when state is modified. More... | |
| using daq::ObservableStatus::Signal = boost::signals2::signal<void(ObservableStatus const&)> |
Connect observer that is invoked when state is modified.
| o | Observer callable invoked on status changes (state or file changes) Observer must be invocable with signature void(ObservableStatus const&). |
Definition at line 162 of file status.hpp.
|
explicitnoexcept |
Construct a new object.
| id | Data acquisition identifier. |
Definition at line 44 of file status.cpp.
|
delete |
| void daq::ObservableStatus::AddFiles | ( | std::vector< DpPart > const & | files | ) |
Records that a file has been produced for this data acquisition.
| files | Files to add/record. |
Definition at line 83 of file status.cpp.
|
inline |
Connect observer that is invoked when state is modified.
| o | Observer callable invoked on status changes (state or file changes) Observer must be invocable with signature void(ObservableStatus const&). |
Definition at line 164 of file status.hpp.
|
noexcept |
Definition at line 71 of file status.cpp.
|
noexcept |
Definition at line 75 of file status.cpp.
|
noexcept |
Definition at line 63 of file status.cpp.
|
noexcept |
Definition at line 79 of file status.cpp.
|
noexcept |
Definition at line 67 of file status.cpp.
|
noexcept |
Connect observer that is invoked when state is modified.
| o | Observer callable invoked on status changes (state or file changes) Observer must be invocable with signature void(ObservableStatus const&). |
Definition at line 125 of file status.cpp.
| daq::ObservableStatus::operator Status | ( | ) | const |
Allow implicit conversion to non-observable status.
Definition at line 121 of file status.cpp.
|
noexcept |
Definition at line 51 of file status.cpp.
|
noexcept |
Definition at line 59 of file status.cpp.
|
delete |
|
noexcept |
Definition at line 47 of file status.cpp.
|
noexcept |
Definition at line 55 of file status.cpp.
|
noexcept |
Set error flag for data acquisition.
| error | New error flag status. |
Definition at line 105 of file status.cpp.
|
noexcept |
Set state of data acquisition.
| s | New state |
Definition at line 97 of file status.cpp.
|
noexcept |
Updates (adds or replaces) Primary HDU keywords.
Definition at line 89 of file status.cpp.
|
strong |
Observable states of the data acquisition process.
Note: This does not yet include the separate states for creating the data product.
Daq can end up in either Stopped or Aborted. At this point it is not possible to start it again.
* Init * | * | +——————————+ +—————————+ +—————————+ +—————————+ +—————————+ * +—>+NotStarted+—————>|Starting +————>|Acquiring|————>|Stopping |———>|Stopped | * +————+—————+ +————+————+ +—————————+ +—————————+ +—————————+ * | | | | * | | | | +—————————+ * +————————————————>+——————————————>+——————————————>+————————>|Aborting | * +—————————+ * | * + * +—————————+ * |Aborted | * +—————————+ * *
| std::optional< ReplyType > daq::op::HandleMetaDaqReply | ( | std::optional< State > | expected_state, |
| State | success_state, | ||
| std::optional< State > | error_state, | ||
| AsyncOpParams | params, | ||
| Source< MetaSource > & | source, | ||
| boost::future< ReplyType > && | fut | ||
| ) |
Reply handler that checks for exceptions in reply.
| Exception | contained in reply. |
| expected_state | The state the source is expected to be in when receving the reply. |
| success_state | The state the source is set to on success. |
| daq | Data acquisition the operation belongs to. |
| source | The source to handle reply from. |
| fut | Reply. |
| std::optional< ReplyType > daq::op::HandlePrimDaqReply | ( | std::optional< State > | expected_state, |
| State | success_state, | ||
| std::optional< State > | error_state, | ||
| AsyncOpParams | params, | ||
| Source< PrimSource > & | source, | ||
| boost::future< ReplyType > && | fut | ||
| ) |
Reply handler that checks for exceptions in reply.
| Exception | contained in reply. |
| expected_state | The state the source is expected to be in when receving the reply. |
| success_state | The state the source is set to on success. |
| daq | Data acquisition the operation belongs to. |
| source | The source to handle reply from. |
| fut | Reply. |
|
noexcept |
Compares states and returns whether state occurs after after.
If states are the same it returns false.
This is e.g. useful to decide when an await condition is fulfillled or when to reject a wait condition because will never occur.
| std::string daq::MakeDaqIdCandidate | ( | char const * | instrument_id, |
| unsigned | jitter = 0 |
||
| ) |
Creates a DAQ id candidate that may or may not be unique.
| instrument_id | The instrument ID to use for the id. Only the 5 first characters will be used if the name is longer than 5. |
| jitter | Jitter is a millisecond component added to the current time. This is meant to be used to find a unique id by adding jitter until a unique id is found. |
Definition at line 27 of file manager.cpp.
| std::ostream & daq::operator<< | ( | std::ostream & | os, |
| FitsController const & | ctl | ||
| ) |
Print status information to provided ostream.
Definition at line 87 of file fitsController.cpp.
| std::ostream & daq::operator<< | ( | std::ostream & | os, |
| State | state | ||
| ) |
Prints state string representation to os.
Definition at line 54 of file daqController.cpp.
| boost::future< std::vector< boost::future< R > > > daq::op::SendRequestAndCollectReplies | ( | Iterator | begin, |
| Iterator | end, | ||
| Pred | filter_pred, | ||
| AsyncOpParams | params, | ||
| Sender | sender, | ||
| ReplyHandler | reply_handler, | ||
| std::string_view | logging_description | ||
| ) |
Utility function to Send requests and collect replies.
| begin | Beginning of sequence of sources to send request. |
| end | End of sequence of sources to send request. |
| params | Parameters for this async operation. |
| sender | Functor that sends request and returns future. |
| reply_handler | Handler invoked once for each reply received. The handler may transform the reply and return a value containing a different type than the input. It should not return a future. |
| replies_handler | Handler invoked once when all replies are received. It will be passed the vector of replies returned from reply_handler. To communicate failure it shall throw an exception. |
Type requirement:
with T being the requestor reply type.
Sender: boost::future<T> (Source&) ReplyHandler: R (AsyncOpParams, Source, boost::future<T>)
| std::vector<R> daq::op::UnwrapReplies | ( | boost::future< std::vector< boost::future< R >>> && | futures | ) |
| void daq::op::UnwrapVoidReplies | ( | boost::future< std::vector< boost::future< void >>> && | futures | ) |
Unwrap futures to extract errors.
| DaqSourceErrors | containing all exceptions. |