ifw-daq  3.0.0-pre2
IFW Data Acquisition modules
Public Types | Public Member Functions | List of all members
daq::DaqController Class Referenceabstract

Controls the execution of single data acquisition that ultimately result in a set of FITS keywords and/or FITS files. More...

#include <daqController.hpp>

+ Inheritance diagram for daq::DaqController:

Public Types

using ContextSignal = boost::signals2::signal< void(DaqContext const &)>
 

Public Member Functions

 DaqController ()=default
 
virtual ~DaqController ()=default
 
virtual boost::future< StateStartAsync ()=0
 Starts the data acquisition. More...
 
virtual boost::future< StatusStopAsync (ErrorPolicy policy)=0
 Stops the data acquisition. More...
 
virtual boost::future< StatusAbortAsync (ErrorPolicy policy)=0
 Aborts the data acquisition. More...
 
virtual boost::future< StateScheduleMergeAsync ()=0
 Schedules DAQ for merging by sending request to DPM. More...
 
virtual void UpdateKeywords (fits::KeywordVector const &keywords)=0
 Updates (replace or add) list of keywords. More...
 
virtual boost::future< StateAwaitAsync (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< ObservableStatusGetStatus () DAQ_NOEXCEPT=0
 
virtual std::shared_ptr< ObservableStatus const > GetStatus () const DAQ_NOEXCEPT=0
 
virtual std::shared_ptr< ObservableEventLogGetEventLog () 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. More...
 

Detailed Description

Controls the execution of single data acquisition that ultimately result in a set of FITS keywords and/or FITS files.

Important

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:

Usage

  1. Starting

    Start with StartAsync

  2. Stopping

Manual option

Stop/abort with StopAsync or AbortAsync.

Automatic option

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:

Pending decision decisions:

Definition at line 215 of file daqController.hpp.

Member Typedef Documentation

◆ ContextSignal

using daq::DaqController::ContextSignal = boost::signals2::signal<void(DaqContext const&)>

Definition at line 316 of file daqController.hpp.

Constructor & Destructor Documentation

◆ DaqController()

daq::DaqController::DaqController ( )
default

◆ ~DaqController()

virtual daq::DaqController::~DaqController ( )
virtualdefault

Member Function Documentation

◆ AbortAsync()

virtual boost::future<Status> daq::DaqController::AbortAsync ( ErrorPolicy  policy)
pure virtual

Aborts the data acquisition.

Parameters
policyError 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.

Precondition
GetState() not in (State::Aborted, State::Stopped)
Postcondition
GetState() == State::Aborting if a data acquisition was ongoing otherwise GetState() == State::Aborted.

Implemented in daq::DpmDaqController, daq::OcmDaqController, and DaqControllerFake.

◆ AwaitAsync()

virtual boost::future<State> daq::DaqController::AwaitAsync ( std::vector< std::string >  sources,
std::chrono::milliseconds  timeout 
)
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.

Parameters
sourcesAn optional vector of source-ids to await, if empty all primary sources are awaited on.
Returns
future set with std::invalid_argument if source-id is not recognized.
future set with boost::broken_promise if DaqController is destroyed before operation completes.

Implemented in DaqControllerFake, daq::DpmDaqController, and daq::OcmDaqController.

◆ ConnectContext()

virtual boost::signals2::connection daq::DaqController::ConnectContext ( ContextSignal::slot_type const &  slot)
pure virtual

Connect observer that is invoked when context is modified.

Parameters
oObserver callable invoked on context changes.
Returns
signal connection object that can be used to disconnect observer:

Implemented in DaqControllerFake, daq::DaqControllerMock, and daq::CommonDaqController.

◆ GetContext()

virtual DaqContext const& daq::DaqController::GetContext ( ) const
pure virtual

◆ GetErrorFlag()

virtual bool daq::DaqController::GetErrorFlag ( ) const
pure virtual
Returns
Error flag.

Implemented in DaqControllerFake, and daq::CommonDaqController.

◆ GetEventLog()

virtual std::shared_ptr<ObservableEventLog> daq::DaqController::GetEventLog ( )
pure virtual
Returns
event log associated with this daq.

Implemented in DaqControllerFake, and daq::CommonDaqController.

◆ GetId()

virtual std::string const& daq::DaqController::GetId ( ) const
pure virtual
Returns
data acquisition identifier.

Implemented in DaqControllerFake, and daq::CommonDaqController.

◆ GetState()

virtual State daq::DaqController::GetState ( ) const
pure virtual
Returns
state of data acquisition.

Implemented in daq::DaqControllerMock, DaqControllerFake, daq::DpmDaqController, and daq::OcmDaqController.

◆ GetStatus() [1/2]

virtual std::shared_ptr<ObservableStatus const> daq::DaqController::GetStatus ( ) const
pure virtual

◆ GetStatus() [2/2]

virtual std::shared_ptr<ObservableStatus> daq::DaqController::GetStatus ( )
pure virtual
Returns
status object associated with this daq.

Implemented in DaqControllerFake, and daq::CommonDaqController.

◆ ScheduleMergeAsync()

virtual boost::future<State> daq::DaqController::ScheduleMergeAsync ( )
pure virtual

Schedules DAQ for merging by sending request to DPM.

Returns
future containing exception:
  • std::logic_error if DAQ has already been scheduled
  • mal::TimeoutException if DPM is offline (timeout).
  • unspecified DPM fails

Implemented in DaqControllerFake, daq::DpmDaqController, and daq::OcmDaqController.

◆ StartAsync()

virtual boost::future<State> daq::DaqController::StartAsync ( )
pure virtual

Starts the data acquisition.

Returns
A future that will be Set once data acquisition has started or or fails.
Exceptions
std::exception-derivedexception if internal error occurs.
Returns
Future that is ready once all sources are started or failed.
Precondition
GetState() == State::Notstarted
Postcondition
GetState() == State::Starting on success GetState() == State::Error on error

Implemented in DaqControllerFake, daq::DpmDaqController, and daq::OcmDaqController.

◆ StopAsync()

virtual boost::future<Status> daq::DaqController::StopAsync ( ErrorPolicy  policy)
pure virtual

Stops the data acquisition.

Precondition
GetState() not in (State::Stopped or State::Aborted)
Postcondition
GetState() == State::Stopping

Implemented in daq::DpmDaqController, daq::OcmDaqController, and DaqControllerFake.

◆ UpdateKeywords()

virtual void daq::DaqController::UpdateKeywords ( fits::KeywordVector const &  keywords)
pure virtual

Updates (replace or add) list of keywords.

Parameters
keywordsKeywords to add.

Implemented in daq::DpmDaqController, daq::OcmDaqController, and DaqControllerFake.


The documentation for this class was generated from the following file: