ifw-daq  2.1.0-pre1
IFW Data Acquisition modules
Classes | Public Member Functions | List of all members
daq::ManagerImpl Class Reference

Implements daq::Manager. More...

#include <manager.hpp>

+ Inheritance diagram for daq::ManagerImpl:

Public Member Functions

 ManagerImpl (rad::IoExecutor &executor, ManagerParams params, Workspace &workspace, std::shared_ptr< ObservableEventLog > event_log, DaqControllerFactory &daq_factory)
 
 ~ManagerImpl () noexcept
 
void RestoreFromWorkspace () override
 Loads status and constructs DaqControllers corresponding to stored state. More...
 
std::string MakeDaqId (std::chrono::system_clock::time_point *time=nullptr) const override
 Creates a new unique identifier based on the instrument id and current time. More...
 
bool HaveDaq (std::string_view id, std::string_view file_id={}) const noexcept override
 Query existing data acquisition by id and optional file_id. More...
 
Status GetStatus (std::string_view id) const override
 Get status. More...
 
boost::future< StateStartDaqAsync (DaqContext ctx) override
 Start DaqController identified by id. More...
 
boost::future< StatusStopDaqAsync (std::string_view id, ErrorPolicy policy) override
 Stop DaqController identified by id. More...
 
boost::future< StatusAbortDaqAsync (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...
 
StatusSignalGetStatusSignal () 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 &)>
 

Detailed Description

Implements daq::Manager.

Definition at line 253 of file manager.hpp.

Constructor & Destructor Documentation

◆ ManagerImpl()

daq::ManagerImpl::ManagerImpl ( rad::IoExecutor executor,
ManagerParams  params,
Workspace workspace,
std::shared_ptr< ObservableEventLog event_log,
DaqControllerFactory daq_factory 
)
explicit
Parameters
instrument_idInstrument id.

Definition at line 95 of file manager.cpp.

◆ ~ManagerImpl()

daq::ManagerImpl::~ManagerImpl ( )
noexcept

Definition at line 109 of file manager.cpp.

Member Function Documentation

◆ AbortDaqAsync()

boost::future< Status > daq::ManagerImpl::AbortDaqAsync ( std::string_view  id,
ErrorPolicy  policy 
)
overridevirtual

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.

Implements daq::Manager.

Definition at line 472 of file manager.cpp.

◆ AwaitDaqStateAsync()

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

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.

Implements daq::Manager.

Definition at line 480 of file manager.cpp.

◆ GetDaqControllers()

std::vector< std::shared_ptr< DaqController const > > daq::ManagerImpl::GetDaqControllers ( )
overridevirtual
Returns
current Daq Controllers.

Implements daq::Manager.

Definition at line 526 of file manager.cpp.

◆ GetStatus()

Status daq::ManagerImpl::GetStatus ( std::string_view  id) const
overridevirtual

Get status.

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

Implements daq::Manager.

Definition at line 366 of file manager.cpp.

◆ GetStatusSignal()

StatusSignal & daq::ManagerImpl::GetStatusSignal ( )
overridevirtual
Returns
status observer object.

The status observer observes any DAQ status changes.

Implements daq::Manager.

Definition at line 522 of file manager.cpp.

◆ HaveDaq()

bool daq::ManagerImpl::HaveDaq ( std::string_view  id,
std::string_view  file_id = {} 
) const
overridevirtualnoexcept

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.

Implements daq::Manager.

Definition at line 205 of file manager.cpp.

◆ MakeDaqId()

std::string daq::ManagerImpl::MakeDaqId ( std::chrono::system_clock::time_point *  time = nullptr) const
overridevirtual

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.

Implements daq::Manager.

Definition at line 196 of file manager.cpp.

◆ RestoreFromWorkspace()

void daq::ManagerImpl::RestoreFromWorkspace ( )
overridevirtual

Loads status and constructs DaqControllers corresponding to stored state.

Implements daq::Manager.

Definition at line 124 of file manager.cpp.

◆ StartDaqAsync()

boost::future< State > daq::ManagerImpl::StartDaqAsync ( DaqContext  ctx)
overridevirtual

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.

Implements daq::Manager.

Definition at line 432 of file manager.cpp.

◆ StopDaqAsync()

boost::future< Status > daq::ManagerImpl::StopDaqAsync ( std::string_view  id,
ErrorPolicy  policy 
)
overridevirtual

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.

Implements daq::Manager.

Definition at line 464 of file manager.cpp.

◆ UpdateKeywords()

void daq::ManagerImpl::UpdateKeywords ( std::string_view  id,
fits::KeywordVector const &  keywords 
)
overridevirtual

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).

Implements daq::Manager.

Definition at line 518 of file manager.cpp.


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