ifw-daq  2.1.0-pre1
IFW Data Acquisition modules
Public Types | Public Member Functions | List of all members
daq::Manager Class Referenceabstract

Manager owns DaqController and FitsController (active data acquisitions) instances and multiplexes requests to them. More...

#include <manager.hpp>

+ Inheritance diagram for daq::Manager:

Public Types

using Signal = boost::signals2::signal< void(ObservableStatus const &)>
 

Public Member Functions

virtual ~Manager ()
 
virtual void RestoreFromWorkspace ()=0
 Restore from state stored in workspace. More...
 
virtual std::string MakeDaqId (std::chrono::system_clock::time_point *time=nullptr) const =0
 Creates a new unique identifier based on the instrument id and current time. More...
 
virtual bool HaveDaq (std::string_view id, std::string_view file_id={}) const DAQ_NOEXCEPT=0
 Query existing data acquisition by id and optional file_id. More...
 
virtual Status GetStatus (std::string_view id) const =0
 Get status. More...
 
virtual boost::future< StateStartDaqAsync (DaqContext ctx)=0
 Start DaqController identified by id. More...
 
virtual boost::future< StatusStopDaqAsync (std::string_view id, ErrorPolicy policy)=0
 Stop DaqController identified by id. More...
 
virtual boost::future< StatusAbortDaqAsync (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 StatusSignalGetStatusSignal ()=0
 
virtual std::vector< std::shared_ptr< DaqController const > > GetDaqControllers ()=0
 

Detailed Description

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:

Note
: It's a template only to facilitate mocking of DaqController, without requiring it to be an interface.

Definition at line 124 of file manager.hpp.

Member Typedef Documentation

◆ Signal

using daq::Manager::Signal = boost::signals2::signal<void(ObservableStatus const&)>

Definition at line 128 of file manager.hpp.

Constructor & Destructor Documentation

◆ ~Manager()

virtual daq::Manager::~Manager ( )
inlinevirtual

Definition at line 126 of file manager.hpp.

Member Function Documentation

◆ AbortDaqAsync()

virtual boost::future<Status> daq::Manager::AbortDaqAsync ( std::string_view  id,
ErrorPolicy  policy 
)
pure virtual

Abort DaqController identified by id.

Parameters
idData acquisition id.
policyError policy determining if errors are tolerated or not.
Returns
Exceptional future containing std::invalid_argument, if data acquisition with id does not exist.
Future that will eventually be ready when data acquisition has aborted, or failed to abort.

Implemented in daq::ManagerImpl.

◆ AwaitDaqStateAsync()

virtual boost::future<Result<Status> > daq::Manager::AwaitDaqStateAsync ( std::string_view  id,
State  state,
std::chrono::milliseconds  timeout 
)
pure virtual

Await DAQ state.

Parameters
idData acquisition id.
statetarget state to await.
timeoutHow long to wait for state to be reached.
Returns
Exceptional future containing std::invalid_argument, if data acquisition with id does not exist or timeout is negative.
Future with a value set when condition is fulfilled or times out.

Implemented in daq::ManagerImpl.

◆ GetDaqControllers()

virtual std::vector<std::shared_ptr<DaqController const> > daq::Manager::GetDaqControllers ( )
pure virtual
Returns
current Daq Controllers.

Implemented in daq::ManagerImpl.

◆ GetStatus()

virtual Status daq::Manager::GetStatus ( std::string_view  id) const
pure virtual

Get status.

Exceptions
std::invalid_argumentif no data acquisition exist with provided id.

Implemented in daq::ManagerImpl.

◆ GetStatusSignal()

virtual StatusSignal& daq::Manager::GetStatusSignal ( )
pure virtual
Returns
status observer object.

The status observer observes any DAQ status changes.

Implemented in daq::ManagerImpl.

◆ HaveDaq()

virtual bool daq::Manager::HaveDaq ( std::string_view  id,
std::string_view  file_id = {} 
) const
pure virtual

Query existing data acquisition by id and optional file_id.

Parameters
idDAQ id to look up.
file_idOptional file_id to look up.
Returns
true if there is a already a DAQ with the same ID (or same file_id if argument is provided).
false otherwise.

Implemented in daq::ManagerImpl.

◆ MakeDaqId()

virtual std::string daq::Manager::MakeDaqId ( std::chrono::system_clock::time_point *  time = nullptr) const
pure virtual

Creates a new unique identifier based on the instrument 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"

Note
OLAS_ID is the first 5 characters of instrument id.
The returned ID is guaranteed to be unique for all IDs known by Manager (there is currently no global repository of previous IDs) and is suitable for both DAQ id and OLAS FileId.
Parameters
[out]timeOptional time used to produce the ID.
Exceptions
std::system_erroron failure.

Implemented in daq::ManagerImpl.

◆ RestoreFromWorkspace()

virtual void daq::Manager::RestoreFromWorkspace ( )
pure virtual

Restore from state stored in workspace.

This should typically only be done after construction and not when running.

Implemented in daq::ManagerImpl.

◆ StartDaqAsync()

virtual boost::future<State> daq::Manager::StartDaqAsync ( DaqContext  ctx)
pure virtual

Start DaqController identified by id.

Parameters
idData acquisition id.
Returns
Exceptional future containing std::invalid_argument, if data acquisition with id does not exist.
Future that will eventually be ready when data acquisition has started, or failed to start.

Implemented in daq::ManagerImpl.

◆ StopDaqAsync()

virtual boost::future<Status> daq::Manager::StopDaqAsync ( std::string_view  id,
ErrorPolicy  policy 
)
pure virtual

Stop DaqController identified by id.

Parameters
idData acquisition id.
policyError policy determining if errors are tolerated or not.
Returns
Exceptional future containing std::invalid_argument, if data acquisition with id does not exist.
Future that will eventually be ready when data acquisition has stopped, or failed to stop.

Implemented in daq::ManagerImpl.

◆ UpdateKeywords()

virtual void daq::Manager::UpdateKeywords ( std::string_view  id,
fits::KeywordVector const &  keywords 
)
pure virtual

Update FITS keywords for DaqController identified by id.

Parameters
idData acquisition id.
keywordsFITS keywords to update.
Exceptions
std::invalid_argumentif no data acquisition exist with provided id.
std::runtime_errorIf DaqController state does not allow updating of keywords (it's e.g. already been submitted for merging).

Implemented in daq::ManagerImpl.


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