ifw-daq  1.0.0
IFW Data Acquisition modules
Modules | Files | Classes | Enumerations | Functions

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

Detailed Description

OCM data acquisition library.


Class Documentation

◆ daq::AsyncOperations

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
 
AsyncOperationsoperator= (AsyncOperations &&)=default
 
AsyncOperationsoperator= (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
 

Member Typedef Documentation

◆ AwaitReturnType

using daq::AsyncOperations::AwaitReturnType = std::pair<boost::future<Result<DpParts> >, std::function<bool()> >

Definition at line 48 of file daqController.hpp.

Constructor & Destructor Documentation

◆ AsyncOperations() [1/3]

daq::AsyncOperations::AsyncOperations ( )

Default constructs object with standard async operations.

Definition at line 32 of file daqController.cpp.

◆ AsyncOperations() [2/3]

daq::AsyncOperations::AsyncOperations ( AsyncOperations &&  )
default

◆ AsyncOperations() [3/3]

daq::AsyncOperations::AsyncOperations ( AsyncOperations const &  )
default

Member Function Documentation

◆ IsValid()

bool daq::AsyncOperations::IsValid ( ) const
noexcept

Definition at line 45 of file daqController.cpp.

◆ operator=() [1/2]

AsyncOperations& daq::AsyncOperations::operator= ( AsyncOperations &&  )
default

◆ operator=() [2/2]

AsyncOperations& daq::AsyncOperations::operator= ( AsyncOperations const &  )
default

Member Data Documentation

◆ abort

std::function<boost::future<Result<void> >ErrorPolicy, op::AsyncOpParams)> daq::AsyncOperations::abort

Definition at line 63 of file daqController.hpp.

◆ await_prim

std::function<AwaitReturnType(op::AwaitOpParams)> daq::AsyncOperations::await_prim

Definition at line 65 of file daqController.hpp.

◆ start

std::function<boost::future<void>op::AsyncOpParams)> daq::AsyncOperations::start

Definition at line 62 of file daqController.hpp.

◆ stop

std::function<boost::future<Result<DpParts> >ErrorPolicy, op::AsyncOpParams)> daq::AsyncOperations::stop

Definition at line 64 of file daqController.hpp.

◆ daq::DaqController

class daq::DaqController

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:

  • Each data source completes only once.
    • This means that any command that deals with potential completion (mainly the stop and await operations) must record the outcome (DpParts + Keywords) and mark the source state as completed.
    • This ensures that no outcome is lost and that subsequent commands does not include completed sources.
  • Conflicting commands are resolved in the order they are received and w.r.t. to state.
    • If data sources are awaited on, some of which has aleady completed, and DaqController is asked to abort, this means that the DAQ state is Aborting and even if the await operation completes successfully, the result will be discarded because user asked to abort.
    • If user asks to stop and primary soures are awaited on, there's a race between which request to data source completes first.
      • Commands are only sent to sources that are in-progress (not completed/aborted/stopped).
      • Whichever reply is received first (from await or stop) will determine the result from that data souce.
  • Async operations must be able to deal with partial failures.
    • This is required to allow user to retry operation.
  • Asynchronous errors are published and user response is requied.
    • If e.g. the await operation fails partially it means user must intervene to decide if it should try to stop or abort the DAQ (in the future a DAQ-wide policy could be set to decide what to do automatically).

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:

  • That way we can communicate the full result using the promise. On errors it contains the exception(s) on success the new state.
  • We can have a mixed result of partial success and partial failure, although the future will contain exception(s).
  • We let caller decide what to do (e.g. abort).
  • We use an error flag to indicate that error occurred, which is possible in any state.
  • We stay in the state that had the error to e.g. allow retries. So if an error occurred in Starting then DaqController remains in Starting with the error flag Set.

Pending decision decisions:

  • Whether to fail fast or be robust, or even whether to be configurable.
    • This was addressed with the ErrorPolicy option when stopping/aborting.
  • Support aborting while there are still replies pending for startDaq? This would mean that one can be in state Starting and Stopping at the same time.
    • This was addressed to ignore errors when forcibly aborting.
  • Who connects the clients + configure QoS? Since connect is done implicitly there's no need actually. Simply specify timeout should be sufficient. And that should be done by the caller.

Definition at line 163 of file daqController.hpp.

+ Inheritance diagram for daq::DaqController:

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

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::DaqControllerImpl, 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, and daq::DaqControllerImpl.

◆ GetErrorFlag()

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

Implemented in DaqControllerFake, and daq::DaqControllerImpl.

◆ GetEventLog()

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

Implemented in DaqControllerFake, and daq::DaqControllerImpl.

◆ GetId()

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

Implemented in DaqControllerFake, and daq::DaqControllerImpl.

◆ GetState()

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

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

◆ 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::DaqControllerImpl.

◆ 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, and daq::DaqControllerImpl.

◆ 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::DaqControllerImpl, 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::DaqControllerImpl, and DaqControllerFake.

◆ daq::DaqControllerImpl

class daq::DaqControllerImpl

Implements daq::DaqController

Definition at line 259 of file daqController.hpp.

+ Inheritance diagram for daq::DaqControllerImpl:

Public Member Functions

boost::future< StateStartAsync () override
 Starts the data acquisition. More...
 
boost::future< StatusStopAsync (ErrorPolicy policy) override
 Stops the data acquisition. More...
 
boost::future< StatusAbortAsync (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< StateAwaitAsync (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< ObservableStatusGetStatus () DAQ_NOEXCEPT override
 
std::shared_ptr< ObservableStatus const > GetStatus () const DAQ_NOEXCEPT override
 
std::shared_ptr< ObservableEventLogGetEventLog () 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< DaqControllerImplCreate (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< FitsControllerm_fits_ctl
 
std::shared_ptr< ObservableStatusm_status
 
std::shared_ptr< ObservableEventLogm_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< PendingRepliesm_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
 

Member Typedef Documentation

◆ StateVariant

Definition at line 308 of file daqController.hpp.

Constructor & Destructor Documentation

◆ DaqControllerImpl()

daq::DaqControllerImpl::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 
)
protected

Definition at line 103 of file daqController.cpp.

Member Function Documentation

◆ AbortAsync()

boost::future< Status > daq::DaqControllerImpl::AbortAsync ( ErrorPolicy  policy)
overridevirtual

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.

Implements daq::DaqController.

Definition at line 368 of file daqController.cpp.

◆ AddEvent()

template<class T , class... Args>
void daq::DaqControllerImpl::AddEvent ( Args &&...  args)
inlineprotected

Definition at line 331 of file daqController.hpp.

◆ AwaitAsync()

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

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.

Implements daq::DaqController.

Definition at line 451 of file daqController.cpp.

◆ Create()

std::shared_ptr< DaqControllerImpl > daq::DaqControllerImpl::Create ( boost::asio::io_context &  io_context,
DaqProperties  properties,
std::shared_ptr< ObservableStatus status,
std::shared_ptr< ObservableEventLog event_log,
AsyncOperations  operations 
)
static

Construct object.

Parameters
io_contextExecutor used for continuations and timer.
propertiesGeneral properties used to control DAQ execution.
statusData acquisition status object, also contains identifier (may not be empty). Caller is responsible for making the id unique.
primPrimary data sources
metaMetadata sources
Precondition
status == true.
event_log == true.
Exceptions
std::invalid_argumentif arguments are invalid.

Definition at line 86 of file daqController.cpp.

◆ FindSource()

std::optional< std::variant< gsl::not_null< Source< PrimSource > * >, gsl::not_null< Source< MetaSource > * > > > daq::DaqControllerImpl::FindSource ( std::string_view  source_id)
protected

Definition at line 590 of file daqController.cpp.

◆ GetErrorFlag()

bool daq::DaqControllerImpl::GetErrorFlag ( ) const
overridevirtual
Returns
Error flag.

Implements daq::DaqController.

Definition at line 181 of file daqController.cpp.

◆ GetEventLog()

std::shared_ptr< ObservableEventLog > daq::DaqControllerImpl::GetEventLog ( )
overridevirtual
Returns
event log associated with this daq.

Implements daq::DaqController.

Definition at line 173 of file daqController.cpp.

◆ GetId()

std::string const & daq::DaqControllerImpl::GetId ( ) const
overridevirtual
Returns
data acquisition identifier.

Implements daq::DaqController.

Definition at line 177 of file daqController.cpp.

◆ GetLogger()

constexpr log4cplus::Logger const & daq::DaqControllerImpl::GetLogger ( ) const
constexprnoexcept
Returns
Logger associated with this DaqController.

Definition at line 185 of file daqController.cpp.

◆ GetState()

State daq::DaqControllerImpl::GetState ( ) const
overridevirtual
Returns
state of data acquisition.

Implements daq::DaqController.

Definition at line 138 of file daqController.cpp.

◆ GetStatus() [1/2]

std::shared_ptr< ObservableStatus const > daq::DaqControllerImpl::GetStatus ( ) const
overridevirtual

Implements daq::DaqController.

Definition at line 169 of file daqController.cpp.

◆ GetStatus() [2/2]

std::shared_ptr< ObservableStatus > daq::DaqControllerImpl::GetStatus ( )
overridevirtual
Returns
status object associated with this daq.

Implements daq::DaqController.

Definition at line 165 of file daqController.cpp.

◆ InitiateAwaitPrimarySources()

void daq::DaqControllerImpl::InitiateAwaitPrimarySources ( )
protected

Await completion of primary sources.

If there are no sources this method does nothing.

Definition at line 627 of file daqController.cpp.

◆ MakeAwaitParams()

op::AwaitOpParams daq::DaqControllerImpl::MakeAwaitParams ( )
protected

Definition at line 231 of file daqController.cpp.

◆ MakeParams()

op::AsyncOpParams daq::DaqControllerImpl::MakeParams ( )
protected

Constructs the parameters used for asynchronous operations.

Note
AsyncOpParams will bind references to member variables so caller must guarantee that DaqController outlives the async operation. This is normally done by holding a shared copy in the last .then continuation for the async operation, thus guaranteeing that all intermediate continuations will access a valid object.

Definition at line 220 of file daqController.cpp.

◆ MakeSources()

template<class SourceType >
std::vector< Source< SourceType > > daq::DaqControllerImpl::MakeSources ( std::vector< SourceType >  sources)
protected

Helper to build source vector.

Definition at line 615 of file daqController.cpp.

◆ MakeState()

DaqControllerImpl::StateVariant daq::DaqControllerImpl::MakeState ( State  s) const
protectednoexcept

Definition at line 189 of file daqController.cpp.

◆ SetErrorFlag()

void daq::DaqControllerImpl::SetErrorFlag ( bool  error)
protectednoexcept

Definition at line 210 of file daqController.cpp.

◆ SetState()

void daq::DaqControllerImpl::SetState ( DaqControllerImpl::StateVariant &&  s)
protectednoexcept

Definition at line 214 of file daqController.cpp.

◆ StartAsync()

boost::future< State > daq::DaqControllerImpl::StartAsync ( )
overridevirtual

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

Implements daq::DaqController.

Definition at line 243 of file daqController.cpp.

◆ StopAsync()

boost::future< Status > daq::DaqControllerImpl::StopAsync ( ErrorPolicy  policy)
overridevirtual

Stops the data acquisition.

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

Implements daq::DaqController.

Definition at line 291 of file daqController.cpp.

◆ UpdateKeywords()

void daq::DaqControllerImpl::UpdateKeywords ( fits::KeywordVector const &  keywords)
overridevirtual

Updates (replace or add) list of keywords.

Parameters
keywordsKeywords to add.

Implements daq::DaqController.

Definition at line 438 of file daqController.cpp.

Member Data Documentation

◆ m_abort_await_primary_sources

std::function<bool()> daq::DaqControllerImpl::m_abort_await_primary_sources
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.

◆ m_async_ops

AsyncOperations daq::DaqControllerImpl::m_async_ops
protected

Definition at line 376 of file daqController.hpp.

◆ m_event_log

std::shared_ptr<ObservableEventLog> daq::DaqControllerImpl::m_event_log
protected

Definition at line 371 of file daqController.hpp.

◆ m_executor

rad::IoExecutor daq::DaqControllerImpl::m_executor
protected

Definition at line 366 of file daqController.hpp.

◆ m_fits_ctl

std::unique_ptr<FitsController> daq::DaqControllerImpl::m_fits_ctl
protected

Definition at line 369 of file daqController.hpp.

◆ m_io_ctx

boost::asio::io_context& daq::DaqControllerImpl::m_io_ctx
protected

Definition at line 365 of file daqController.hpp.

◆ m_logger

log4cplus::Logger daq::DaqControllerImpl::m_logger
protected

Definition at line 387 of file daqController.hpp.

◆ m_meta_sources

std::vector<Source<MetaSource> > daq::DaqControllerImpl::m_meta_sources
protected

Note: Consider vector immutable!

Definition at line 374 of file daqController.hpp.

◆ m_pending_replies

std::shared_ptr<PendingReplies> daq::DaqControllerImpl::m_pending_replies
protected

Definition at line 377 of file daqController.hpp.

◆ m_prim_sources

std::vector<Source<PrimSource> > daq::DaqControllerImpl::m_prim_sources
protected

Note: Consider vector immutable!

Definition at line 373 of file daqController.hpp.

◆ m_properties

DaqProperties daq::DaqControllerImpl::m_properties
protected

Definition at line 367 of file daqController.hpp.

◆ m_state

StateVariant daq::DaqControllerImpl::m_state
protected

Definition at line 364 of file daqController.hpp.

◆ m_status

std::shared_ptr<ObservableStatus> daq::DaqControllerImpl::m_status
protected

Definition at line 370 of file daqController.hpp.

◆ m_timers

std::vector<std::unique_ptr<boost::asio::steady_timer> > daq::DaqControllerImpl::m_timers
protected

Definition at line 378 of file daqController.hpp.

◆ daq::DaqProperties

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
 
DaqPropertiesoperator= (DaqProperties &&)=default
 
DaqPropertiesoperator= (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< PrimSourceprim_sources
 
std::vector< MetaSourcemeta_sources
 
std::vector< daq::fits::KeywordVariantkeywords
 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...
 

Constructor & Destructor Documentation

◆ DaqProperties() [1/3]

daq::DaqProperties::DaqProperties ( )
default

◆ DaqProperties() [2/3]

daq::DaqProperties::DaqProperties ( DaqProperties const &  )
default

◆ DaqProperties() [3/3]

daq::DaqProperties::DaqProperties ( DaqProperties &&  )
default

Member Function Documentation

◆ operator=() [1/2]

DaqProperties& daq::DaqProperties::operator= ( DaqProperties &&  )
default

◆ operator=() [2/2]

DaqProperties& daq::DaqProperties::operator= ( DaqProperties const &  )
default

Member Data Documentation

◆ await_interval

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.

◆ dp_name_prefix

std::string daq::DaqProperties::dp_name_prefix

Data product file name prefix.

Definition at line 44 of file daqProperties.hpp.

◆ id

std::string daq::DaqProperties::id

Definition at line 35 of file daqProperties.hpp.

◆ keywords

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.

◆ meta_sources

std::vector<MetaSource> daq::DaqProperties::meta_sources

Definition at line 50 of file daqProperties.hpp.

◆ ocm_dppart_root

std::string daq::DaqProperties::ocm_dppart_root

Root directory for OCM data product part output.

Definition at line 48 of file daqProperties.hpp.

◆ prim_sources

std::vector<PrimSource> daq::DaqProperties::prim_sources

Definition at line 49 of file daqProperties.hpp.

◆ process_name

std::string daq::DaqProperties::process_name

User defined process name.

Definition at line 39 of file daqProperties.hpp.

◆ daq::DpPart

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
 
DpPartoperator= (DpPart const &)=default
 
DpPartoperator= (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::KeywordVectorinfo
 Holds a std::string path [[user]@host:]path or FITS keywords. More...
 

Constructor & Destructor Documentation

◆ DpPart() [1/5]

daq::DpPart::DpPart ( std::string  origin,
std::string  path 
)
noexcept

Definition at line 17 of file dpPart.cpp.

◆ DpPart() [2/5]

daq::DpPart::DpPart ( std::string  origin,
fits::KeywordVector  keywords 
)
noexcept

Definition at line 21 of file dpPart.cpp.

◆ DpPart() [3/5]

daq::DpPart::DpPart ( )
default

◆ DpPart() [4/5]

daq::DpPart::DpPart ( DpPart const &  )
default

◆ DpPart() [5/5]

daq::DpPart::DpPart ( DpPart &&  )
defaultnoexcept

Member Function Documentation

◆ operator!=()

bool daq::DpPart::operator!= ( DpPart const &  rhs) const
noexcept

Definition at line 30 of file dpPart.cpp.

◆ operator=() [1/2]

DpPart& daq::DpPart::operator= ( DpPart &&  )
defaultnoexcept

◆ operator=() [2/2]

DpPart& daq::DpPart::operator= ( DpPart const &  )
default

◆ operator==()

bool daq::DpPart::operator== ( DpPart const &  rhs) const
noexcept

Definition at line 26 of file dpPart.cpp.

Member Data Documentation

◆ info

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.

◆ origin

std::string daq::DpPart::origin

Component/process origin of the file.

Definition at line 41 of file dpPart.hpp.

◆ daq::DaqOperationAborted

class daq::DaqOperationAborted

Started operation was aborted.

Typically used to communicate that asynchronous operation has been aborted.

Definition at line 47 of file error.hpp.

+ Inheritance diagram for daq::DaqOperationAborted:

◆ daq::DaqOperationTimeout

class daq::DaqOperationTimeout

Started operation timed out.

Definition at line 57 of file error.hpp.

+ Inheritance diagram for daq::DaqOperationTimeout:

◆ daq::DaqSourceError

class daq::DaqSourceError

Represents error in single source.

Definition at line 67 of file error.hpp.

+ 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
 

Constructor & Destructor Documentation

◆ DaqSourceError()

daq::DaqSourceError::DaqSourceError ( std::string  request,
std::string  source,
std::string  message 
)

Definition at line 31 of file error.cpp.

Member Function Documentation

◆ what()

char const * daq::DaqSourceError::what ( ) const
overridenoexcept

Definition at line 37 of file error.cpp.

Member Data Documentation

◆ m_formatted

std::string daq::DaqSourceError::m_formatted

Definition at line 76 of file error.hpp.

◆ m_message

std::string daq::DaqSourceError::m_message

Definition at line 75 of file error.hpp.

◆ m_request

std::string daq::DaqSourceError::m_request

Definition at line 73 of file error.hpp.

◆ m_source

std::string daq::DaqSourceError::m_source

Definition at line 74 of file error.hpp.

◆ daq::DaqSourceErrors

class daq::DaqSourceErrors

Exception thrown to carry reply errors.

Definition at line 84 of file error.hpp.

+ 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
 

Constructor & Destructor Documentation

◆ DaqSourceErrors() [1/2]

daq::DaqSourceErrors::DaqSourceErrors ( std::vector< std::exception_ptr >  errors)

Definition at line 41 of file error.cpp.

◆ DaqSourceErrors() [2/2]

daq::DaqSourceErrors::DaqSourceErrors ( std::vector< std::variant< DaqSourceError, std::exception_ptr >>  errors)

Definition at line 45 of file error.cpp.

Member Data Documentation

◆ m_errors

std::vector<std::variant<DaqSourceError, std::exception_ptr> > daq::DaqSourceErrors::m_errors

Definition at line 89 of file error.hpp.

◆ daq::GenericEvent

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
 
GenericEventoperator= (GenericEvent &&)=default
 
GenericEventoperator= (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< Statusstatus
 

Member Typedef Documentation

◆ TimePoint

using daq::GenericEvent::TimePoint = std::chrono::time_point<std::chrono::steady_clock>

Definition at line 30 of file eventLog.hpp.

Constructor & Destructor Documentation

◆ GenericEvent() [1/3]

daq::GenericEvent::GenericEvent ( std::string  id,
std::string  description,
std::optional< Status status 
)
noexcept

Definition at line 12 of file eventLog.cpp.

◆ GenericEvent() [2/3]

daq::GenericEvent::GenericEvent ( GenericEvent &&  )
default

◆ GenericEvent() [3/3]

daq::GenericEvent::GenericEvent ( GenericEvent const &  )
default

Member Function Documentation

◆ operator!=()

bool daq::GenericEvent::operator!= ( GenericEvent const &  rhs) const
noexcept

Definition at line 22 of file eventLog.cpp.

◆ operator=() [1/2]

GenericEvent& daq::GenericEvent::operator= ( GenericEvent &&  )
default

◆ operator=() [2/2]

GenericEvent& daq::GenericEvent::operator= ( GenericEvent const &  )
default

◆ operator==()

bool daq::GenericEvent::operator== ( GenericEvent const &  rhs) const
noexcept

Definition at line 18 of file eventLog.cpp.

Member Data Documentation

◆ description

std::string daq::GenericEvent::description

Definition at line 44 of file eventLog.hpp.

◆ id

std::string daq::GenericEvent::id

Definition at line 43 of file eventLog.hpp.

◆ status

std::optional<Status> daq::GenericEvent::status

Definition at line 45 of file eventLog.hpp.

◆ timestamp

TimePoint daq::GenericEvent::timestamp

Definition at line 42 of file eventLog.hpp.

◆ daq::ActionEvent

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
 
GenericEventoperator= (GenericEvent &&)=default
 
GenericEventoperator= (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< Statusstatus
 

Member Function Documentation

◆ GenericEvent() [1/3]

daq::GenericEvent::GenericEvent
default

◆ GenericEvent() [2/3]

daq::GenericEvent::GenericEvent
default

◆ GenericEvent() [3/3]

daq::GenericEvent::GenericEvent
noexcept

Definition at line 32 of file eventLog.cpp.

◆ daq::UserActionEvent

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
 
GenericEventoperator= (GenericEvent &&)=default
 
GenericEventoperator= (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< Statusstatus
 

◆ daq::EventLog

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< EventTypeevents
 

Member Typedef Documentation

◆ EventType

Definition at line 90 of file eventLog.hpp.

◆ TimePoint

using daq::EventLog::TimePoint = std::chrono::time_point<std::chrono::steady_clock>

Definition at line 91 of file eventLog.hpp.

Member Function Documentation

◆ operator!=()

bool daq::EventLog::operator!= ( EventLog const &  rhs) const
noexcept

◆ operator==()

bool daq::EventLog::operator== ( EventLog const &  rhs) const
noexcept

Member Data Documentation

◆ events

std::vector<EventType> daq::EventLog::events

Definition at line 96 of file eventLog.hpp.

◆ daq::ObservableEventLog

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
 
ObservableEventLogoperator= (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...
 

Member Typedef Documentation

◆ Signal

using daq::ObservableEventLog::Signal = boost::signals2::signal<void(EventLog::EventType const&)>

Definition at line 109 of file eventLog.hpp.

Constructor & Destructor Documentation

◆ ObservableEventLog() [1/2]

daq::ObservableEventLog::ObservableEventLog ( )
explicitdefault

Construct a new object.

Parameters
idData acquisition identifier.

◆ ObservableEventLog() [2/2]

daq::ObservableEventLog::ObservableEventLog ( ObservableEventLog const &  )
delete

Member Function Documentation

◆ AddEvent()

void daq::ObservableEventLog::AddEvent ( EventLog::EventType  event)

Records that a file has been produced for this data acquisition.

Parameters
filesFiles to add/record.
Postcondition
Connected observers have been signalled.

Definition at line 54 of file eventLog.cpp.

◆ ConnectObserver()

template<class Observer >
boost::signals2::connection daq::ObservableEventLog::ConnectObserver ( Observer  o)
inline

Connect observer that is invoked when state is modified.

Parameters
oObserver callable invoked on status changes (state or file changes) Observer must be invocable with signature void(ObservableEvent const&).
Returns
signal connection object that can be used to disconnect observer:
auto c = status.ConnectObserver([](ObservableEvent const& s){});
// later the connection object can be used to disconnect
c.disconnect();

Definition at line 154 of file eventLog.hpp.

◆ EmplaceEvent()

template<class T , class... Args>
void daq::ObservableEventLog::EmplaceEvent ( Args &&...  args)
inline

Like AddEvent but emplaces the specified event type.

Definition at line 134 of file eventLog.hpp.

◆ GetEventContainer()

std::vector<EventLog::EventType> const& daq::ObservableEventLog::GetEventContainer ( ) const
inlinenoexcept

Allow implicit conversion to non-observable status.

Definition at line 172 of file eventLog.hpp.

◆ GetEventLog()

EventLog const& daq::ObservableEventLog::GetEventLog ( ) const
inlinenoexcept

Allow implicit conversion to non-observable status.

Definition at line 168 of file eventLog.hpp.

◆ operator EventLog const &()

daq::ObservableEventLog::operator EventLog const & ( )
inline

Allow implicit conversion to non-observable status.

Definition at line 164 of file eventLog.hpp.

◆ operator=()

ObservableEventLog& daq::ObservableEventLog::operator= ( ObservableEventLog const &  )
delete

◆ daq::EventLogObserverLogger

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

Constructor & Destructor Documentation

◆ EventLogObserverLogger()

daq::EventLogObserverLogger::EventLogObserverLogger ( log4cplus::Logger  logger)

Definition at line 19 of file eventLogObserver.cpp.

Member Function Documentation

◆ operator()()

void daq::EventLogObserverLogger::operator() ( EventLog::EventType const &  event)
noexcept

Observer callback that immediately logs the event.

Definition at line 26 of file eventLogObserver.cpp.

◆ daq::FitsController

class daq::FitsController

Create FITS file containing keywords from OCM for the Data Acquisition.

Responsibilities:

  • Create FITS file for persistance.
  • Accept keywords and keyword changes from user and store them in FITS file.
Note
It is not planned to be responsible for any crash recovery storage. List of keywords are temporarily stored in daq::Status/daq::ObservableStatus.

Design notes:

  • Async interface was not deemed necessary.

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< DpPartStop (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< DpPartGetResult () const DAQ_NOEXCEPT=0
 Query FITS file path. More...
 
virtual State GetState () const DAQ_NOEXCEPT=0
 Query state. More...
 

Constructor & Destructor Documentation

◆ ~FitsController()

virtual daq::FitsController::~FitsController ( )
virtualdefault

Member Function Documentation

◆ Abort()

virtual void daq::FitsController::Abort ( ErrorPolicy  policy)
pure virtual

Aborts and deletes FITS file.

Precondition
GetState() == State::Acquiring.

Implemented in daq::FitsControllerImpl.

◆ AddComment()

virtual void daq::FitsController::AddComment ( std::string  comment)
pure virtual

Add comment.

Precondition
GetState() != State::Stopped && GetState() != State::Aborted.
Parameters
commentComment to add to FITS file. "
Exceptions
std::runtime_errorif GetState() == State::Stopped || GetState() == State::Aborted.

Implemented in daq::FitsControllerImpl.

◆ GetId()

virtual std::string const& daq::FitsController::GetId ( ) const
pure virtual

Query FITS file path.

Returns
FITS file name.

Implemented in daq::FitsControllerImpl.

◆ GetResult()

virtual std::optional<DpPart> daq::FitsController::GetResult ( ) const
pure virtual

Query FITS file path.

Returns
FITS file name.

Implemented in daq::FitsControllerImpl.

◆ GetState()

virtual State daq::FitsController::GetState ( ) const
pure virtual

Query state.

Returns
state.

Implemented in daq::FitsControllerImpl.

◆ Start()

virtual void daq::FitsController::Start ( )
pure virtual

Creates FITS file and pupulates it with initial list of keywords.

Precondition
GetState() == State::NotStarted.
Exceptions
fits::CfitsioErroron errors with cfitsio.
std::runtime_erroron error.

Implemented in daq::FitsControllerImpl.

◆ Stop()

virtual std::optional<DpPart> daq::FitsController::Stop ( ErrorPolicy  policy)
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.

Parameters
policyControls the error policy.
Returns
Created and closed FITS file if successful.
std::nullopt if file could not be created and policy is ErrorPolicy;:Tolerant.
Exceptions
std::runtime_errorif GetState() != State::Acquiring.
daq::fits::CfitsioErrorif no FITS file could be created and policy == ErrorPolicy::Strict.

Implemented in daq::FitsControllerImpl.

◆ UpdateKeywords()

virtual void daq::FitsController::UpdateKeywords ( std::vector< fits::KeywordVariant > const &  keywords)
pure virtual

Updates with provided keywords.

Parameters
keywordsKeywords to add or replace. "
Exceptions
std::runtime_errorif GetState() == State::Stopped || GetState() == State::Aborted.

Implemented in daq::FitsControllerImpl.

◆ daq::Manager

class daq::Manager

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

Important responsibilities:

  • Provide interface that allows multiplexing of multiple DaqControllers and FitsControllers (identified by unique id). This interface is close to what the MAL ICD interface looks like to control DaqControllers and FitsControllers.
  • Monitor primary data sources to stop DaqController if a primary source completes (TODO).

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 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< StateStartDaqAsync (std::string_view id)=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
 

Member Typedef Documentation

◆ Signal

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

Definition at line 89 of file manager.hpp.

Constructor & Destructor Documentation

◆ ~Manager()

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

Definition at line 88 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.

◆ AddDaq()

virtual void daq::Manager::AddDaq ( std::shared_ptr< DaqController daq)
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.

◆ 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) const
pure virtual

Query existing data acquisition by id.

Returns
true if there is a already a DAQ with the same ID.
false otherwise.

Implemented in daq::ManagerImpl.

◆ MakeDaqId()

virtual std::string daq::Manager::MakeDaqId ( ) const
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"

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).
Exceptions
std::system_erroron failure.

Implemented in daq::ManagerImpl.

◆ StartDaqAsync()

virtual boost::future<State> daq::Manager::StartDaqAsync ( std::string_view  id)
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.

◆ 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< StateStartDaqAsync (std::string_view id) 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 &)>
 

Constructor & Destructor Documentation

◆ ManagerImpl()

daq::ManagerImpl::ManagerImpl ( rad::IoExecutor executor,
std::string  instrument_id 
)
explicit
Parameters
instrument_idInstrument id.

Definition at line 63 of file manager.cpp.

◆ ~ManagerImpl()

daq::ManagerImpl::~ManagerImpl ( )
noexcept

Definition at line 71 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 171 of file manager.cpp.

◆ AddDaq()

void daq::ManagerImpl::AddDaq ( std::shared_ptr< DaqController daq)
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.

◆ 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 179 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 227 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 114 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 223 of file manager.cpp.

◆ HaveDaq()

bool daq::ManagerImpl::HaveDaq ( std::string_view  id) const
overridevirtualnoexcept

Query existing data acquisition by id.

Returns
true if there is a already a DAQ with the same ID.
false otherwise.

Implements daq::Manager.

Definition at line 96 of file manager.cpp.

◆ MakeDaqId()

std::string daq::ManagerImpl::MakeDaqId ( ) const
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"

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).
Exceptions
std::system_erroron failure.

Implements daq::Manager.

Definition at line 87 of file manager.cpp.

◆ StartDaqAsync()

boost::future< State > daq::ManagerImpl::StartDaqAsync ( std::string_view  id)
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 155 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 163 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 219 of file manager.cpp.

◆ daq::op::AbortAsync

struct daq::op::AbortAsync

A composite async operation that aborts a DAQ.

Definition at line 26 of file abort.hpp.

Public Types

using ResultType = Result< void >
 

Public Member Functions

 AbortAsync (ErrorPolicy policy, AsyncOpParams params) noexcept
 
boost::future< ResultTypeInitiate ()
 Initiates operation that stats metadata acquisition. More...
 

Member Typedef Documentation

◆ ResultType

Definition at line 28 of file abort.hpp.

Constructor & Destructor Documentation

◆ AbortAsync()

daq::op::AbortAsync::AbortAsync ( ErrorPolicy  policy,
AsyncOpParams  params 
)
explicitnoexcept

Definition at line 20 of file abort.cpp.

Member Function Documentation

◆ Initiate()

boost::future< AbortAsync::ResultType > daq::op::AbortAsync::Initiate ( )

Initiates operation that stats metadata acquisition.

Returns
future that is Set on failure or when also primary data acquisition has started. the value is Set after starting all (or failed).

If tolerant policy is used exceptions from AbortMeta() or AbortPrim() are ignored.

Definition at line 24 of file abort.cpp.

◆ daq::op::AwaitPrimAsync

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.

Notes

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:

  • All sources reply that recording is complete.
  • Any source reply with fatal error.
  • Operation is aborted.

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.

    Todo:
    Do not assume commands are honoring the timeout parameter. Instead keep track of the send interval. Otherwise a malfunctioning subsystem that immediately returns exception will be spammed with requests.

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

Constructor & Destructor Documentation

◆ AwaitPrimAsync()

daq::op::AwaitPrimAsync::AwaitPrimAsync ( AwaitOpParams  params)
explicitnoexcept

Constructs operation with the privided parameters.

Parameters
paramsparameters.

Definition at line 98 of file awaitPrim.cpp.

Member Function Documentation

◆ Abort()

void daq::op::AwaitPrimAsync::Abort ( )
noexcept

Aborts the operation.

Definition at line 168 of file awaitPrim.cpp.

◆ Initiate()

boost::future< Result< DpParts > > daq::op::AwaitPrimAsync::Initiate ( )

Initiates operation that await acquisition completion.

Note
Caller is responsible for keeping object alive until result is set.

Definition at line 102 of file awaitPrim.cpp.

◆ daq::op::AwaitStateAsync

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< ResultTypeInitiate ()
 Initiates operation that await state. More...
 
void Abort () noexcept
 Aborts the operation and completes the operation with DaqOperationAborted. More...
 

Member Typedef Documentation

◆ ResultType

Constructor & Destructor Documentation

◆ AwaitStateAsync()

daq::op::AwaitStateAsync::AwaitStateAsync ( boost::asio::io_context &  io_ctx,
std::shared_ptr< ObservableStatus status,
State  state,
std::chrono::milliseconds  timeout 
)
explicit

Constructs operation with the privided parameters.

Parameters
io_ctxASIO context.
statusDAQ status to monitor/observe changes on.
stateTarget state.
timeoutOperation timeout.

Definition at line 20 of file awaitState.cpp.

Member Function Documentation

◆ Abort()

void daq::op::AwaitStateAsync::Abort ( )
noexcept

Aborts the operation and completes the operation with DaqOperationAborted.

Definition at line 93 of file awaitState.cpp.

◆ Initiate()

boost::future< AwaitStateAsync::ResultType > daq::op::AwaitStateAsync::Initiate ( )

Initiates operation that await state.

Returns
future with value being set when condition is satisifed or times out. Exception DaqOperationAborted is set when operation is aborted. ResultType::error is true if operation times out with await condition unsatisfied.
Note
Caller is responsible for keeping object alive until result is set.

Definition at line 35 of file awaitState.cpp.

◆ daq::op::StartAsync

struct daq::op::StartAsync

A composite async operation that starts DAQ.

Definition at line 36 of file start.hpp.

Public Member Functions

 StartAsync (AsyncOpParams params) noexcept
 
boost::future< void > Initiate ()
 Initiates operation that starts metadata acquisition. More...
 

Constructor & Destructor Documentation

◆ StartAsync()

daq::op::StartAsync::StartAsync ( AsyncOpParams  params)
explicitnoexcept

Definition at line 65 of file start.cpp.

Member Function Documentation

◆ Initiate()

boost::future< void > daq::op::StartAsync::Initiate ( )

Initiates operation that starts metadata acquisition.

Postcondition
Async operation has been initated.
Returns
future that is set on failure when when primary data acquisition has started.
Note
Caller is responsible for keeping object alive until result is set.

Definition at line 68 of file start.cpp.

◆ daq::op::StopAsync

struct daq::op::StopAsync

A composite async operation that starts DAQ.

Definition at line 27 of file stop.hpp.

Public Member Functions

 StopAsync (ErrorPolicy policy, AsyncOpParams params) noexcept
 
boost::future< Result< DpParts > > Initiate ()
 Initiates operation that stop metadata acquisition. More...
 

Constructor & Destructor Documentation

◆ StopAsync()

daq::op::StopAsync::StopAsync ( ErrorPolicy  policy,
AsyncOpParams  params 
)
explicitnoexcept

Definition at line 23 of file stop.cpp.

Member Function Documentation

◆ Initiate()

boost::future< Result< DpParts > > daq::op::StopAsync::Initiate ( )

Initiates operation that stop metadata acquisition.

Note
Caller is responsible for keeping object alive until result is set.
Todo:
: Return a move-only type containing only the data?

Definition at line 27 of file stop.cpp.

◆ daq::ReplyToken

class daq::ReplyToken

Token representing a not-yet-received reply.

Definition at line 26 of file pendingReplies.hpp.

Public Member Functions

 ReplyToken (ReplyToken &&)=default
 
ReplyTokenoperator= (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
 

Constructor & Destructor Documentation

◆ ReplyToken() [1/2]

daq::ReplyToken::ReplyToken ( ReplyToken &&  )
default

◆ ~ReplyToken()

daq::ReplyToken::~ReplyToken ( )

Definition at line 11 of file pendingReplies.cpp.

◆ ReplyToken() [2/2]

daq::ReplyToken::ReplyToken ( uint64_t  token,
std::weak_ptr< PendingReplies pending_replies 
)
explicitprotectednoexcept

Definition at line 7 of file pendingReplies.cpp.

Member Function Documentation

◆ operator=()

ReplyToken& daq::ReplyToken::operator= ( ReplyToken &&  )
default

◆ Release()

void daq::ReplyToken::Release ( )

Release token explicitly.

Definition at line 16 of file pendingReplies.cpp.

Member Data Documentation

◆ PendingReplies

friend daq::ReplyToken::PendingReplies
protected

Definition at line 38 of file pendingReplies.hpp.

◆ daq::PendingReplies

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< ReplyTokenAcquireShared (std::string source_id, std::string request)
 
bool HasPendingReplies () const
 
std::vector< PendingReplyGetPendingReplies () const
 

Static Public Member Functions

static std::shared_ptr< PendingRepliesCreate ()
 Create instance. More...
 

Protected Member Functions

void Release (uint64_t token)
 
 PendingReplies ()=default
 

Protected Attributes

friend ReplyToken
 

Constructor & Destructor Documentation

◆ PendingReplies()

daq::PendingReplies::PendingReplies ( )
protecteddefault

Member Function Documentation

◆ Acquire()

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.

◆ AcquireShared()

std::shared_ptr< ReplyToken > daq::PendingReplies::AcquireShared ( std::string  source_id,
std::string  request 
)

Definition at line 45 of file pendingReplies.cpp.

◆ Create()

std::shared_ptr< PendingReplies > daq::PendingReplies::Create ( )
static

Create instance.

Definition at line 22 of file pendingReplies.cpp.

◆ GetPendingReplies()

std::vector< PendingReplies::PendingReply > daq::PendingReplies::GetPendingReplies ( ) const

Definition at line 30 of file pendingReplies.cpp.

◆ HasPendingReplies()

bool daq::PendingReplies::HasPendingReplies ( ) const

Definition at line 26 of file pendingReplies.cpp.

◆ Release()

void daq::PendingReplies::Release ( uint64_t  token)
protected

Definition at line 53 of file pendingReplies.cpp.

Member Data Documentation

◆ ReplyToken

friend daq::PendingReplies::ReplyToken
protected

Definition at line 82 of file pendingReplies.hpp.

◆ daq::Source

struct daq::Source

template<class T>
struct daq::Source< T >

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

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)
 

Member Typedef Documentation

◆ StateSignal

template<class T >
using daq::Source< T >::StateSignal = boost::signals2::signal<void(State, bool)>

Definition at line 30 of file source.hpp.

Constructor & Destructor Documentation

◆ Source()

template<class T >
daq::Source< T >::Source ( T &&  s)
inline

Definition at line 32 of file source.hpp.

Member Function Documentation

◆ ClearErrorFlag()

template<class T >
void daq::Source< T >::ClearErrorFlag ( )
inline

Definition at line 59 of file source.hpp.

◆ ConnectStateListener()

template<class T >
template<class Subscriber >
boost::signals2::connection daq::Source< T >::ConnectStateListener ( Subscriber  subscriber)
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.

◆ GetErrorFlag()

template<class T >
bool daq::Source< T >::GetErrorFlag ( ) const
inline

Definition at line 69 of file source.hpp.

◆ GetSource() [1/2]

template<class T >
T& daq::Source< T >::GetSource ( )
inline

Definition at line 76 of file source.hpp.

◆ GetSource() [2/2]

template<class T >
T const& daq::Source< T >::GetSource ( ) const
inline

Definition at line 80 of file source.hpp.

◆ GetState()

template<class T >
State daq::Source< T >::GetState ( ) const
inline

Definition at line 72 of file source.hpp.

◆ SetErrorFlag()

template<class T >
void daq::Source< T >::SetErrorFlag ( )
inline

Definition at line 64 of file source.hpp.

◆ SetState()

template<class T >
void daq::Source< T >::SetState ( State  state,
std::optional< bool >  error_flag = {} 
)
inline

Definition at line 51 of file source.hpp.

Friends And Related Function Documentation

◆ operator<<

template<class T >
std::ostream& operator<< ( std::ostream &  os,
Source< T > const &  s 
)
friend

Definition at line 33 of file source.hpp.

Member Data Documentation

◆ m_error_flag

template<class T >
bool daq::Source< T >::m_error_flag = false
protected

Definition at line 87 of file source.hpp.

◆ m_source

template<class T >
T daq::Source< T >::m_source
protected

Definition at line 85 of file source.hpp.

◆ m_state

template<class T >
State daq::Source< T >::m_state = State::NotStarted
protected

Definition at line 86 of file source.hpp.

◆ m_state_signal

template<class T >
StateSignal daq::Source< T >::m_state_signal
protected

Definition at line 88 of file source.hpp.

◆ daq::PrimSource

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
 
PrimSourceoperator= (PrimSource &)=default
 
PrimSourceoperator= (PrimSource &&)=default
 
std::string_view GetName () const
 
RrClientGetRrClient ()
 

Friends

std::ostream & operator<< (std::ostream &os, PrimSource const &s)
 

Member Typedef Documentation

◆ RrClient

using daq::PrimSource::RrClient = recif::RecCmdsAsync

Definition at line 98 of file source.hpp.

Constructor & Destructor Documentation

◆ PrimSource() [1/3]

daq::PrimSource::PrimSource ( std::string  name,
std::shared_ptr< RrClient client 
)
inline
Exceptions
std::invalid_argumentif name or client is invalid.

Definition at line 103 of file source.hpp.

◆ PrimSource() [2/3]

daq::PrimSource::PrimSource ( PrimSource &&  )
default

◆ PrimSource() [3/3]

daq::PrimSource::PrimSource ( PrimSource const &  )
default

Member Function Documentation

◆ GetName()

std::string_view daq::PrimSource::GetName ( ) const
inline

Definition at line 116 of file source.hpp.

◆ GetRrClient()

RrClient& daq::PrimSource::GetRrClient ( )
inline

Definition at line 120 of file source.hpp.

◆ operator=() [1/2]

PrimSource& daq::PrimSource::operator= ( PrimSource &&  )
default

◆ operator=() [2/2]

PrimSource& daq::PrimSource::operator= ( PrimSource )
default

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  os,
PrimSource const &  s 
)
friend

Definition at line 124 of file source.hpp.

◆ daq::MetaSource

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
 
MetaSourceoperator= (MetaSource const &)=default
 
MetaSourceoperator= (MetaSource &&)=default
 
std::string_view GetName () const
 
RrClientGetRrClient ()
 

Friends

std::ostream & operator<< (std::ostream &os, MetaSource const &s)
 

Member Typedef Documentation

◆ RrClient

using daq::MetaSource::RrClient = metadaqif::MetaDaqAsync

Definition at line 141 of file source.hpp.

Constructor & Destructor Documentation

◆ MetaSource() [1/3]

daq::MetaSource::MetaSource ( std::string  name,
std::shared_ptr< RrClient client 
)
inline
Exceptions
std::invalid_argumentif name or client is invalid.

Definition at line 146 of file source.hpp.

◆ MetaSource() [2/3]

daq::MetaSource::MetaSource ( MetaSource &&  )
default

◆ MetaSource() [3/3]

daq::MetaSource::MetaSource ( MetaSource const &  )
default

Member Function Documentation

◆ GetName()

std::string_view daq::MetaSource::GetName ( ) const
inline

Definition at line 159 of file source.hpp.

◆ GetRrClient()

RrClient& daq::MetaSource::GetRrClient ( )
inline

Definition at line 163 of file source.hpp.

◆ operator=() [1/2]

MetaSource& daq::MetaSource::operator= ( MetaSource &&  )
default

◆ operator=() [2/2]

MetaSource& daq::MetaSource::operator= ( MetaSource const &  )
default

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  os,
MetaSource const &  s 
)
friend

Definition at line 167 of file source.hpp.

◆ daq::Status

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
 
Statusoperator= (Status &&)=default
 
Statusoperator= (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
 

Member Typedef Documentation

◆ TimePoint

using daq::Status::TimePoint = std::chrono::time_point<std::chrono::steady_clock>

Definition at line 33 of file status.hpp.

Constructor & Destructor Documentation

◆ Status() [1/4]

daq::Status::Status ( std::string  id)
explicitnoexcept

Definition at line 21 of file status.cpp.

◆ Status() [2/4]

daq::Status::Status ( std::string  id,
State  state,
bool  error,
DpParts  files,
fits::KeywordVector  keywords,
TimePoint  timestamp 
)
noexcept

Definition at line 7 of file status.cpp.

◆ Status() [3/4]

daq::Status::Status ( Status &&  )
default

◆ Status() [4/4]

daq::Status::Status ( Status const &  )
default

Member Function Documentation

◆ operator!=()

bool daq::Status::operator!= ( Status const &  rhs) const
noexcept

Definition at line 34 of file status.cpp.

◆ operator=() [1/2]

Status& daq::Status::operator= ( Status &&  )
default

◆ operator=() [2/2]

Status& daq::Status::operator= ( Status const &  )
default

◆ operator==()

bool daq::Status::operator== ( Status const &  rhs) const
noexcept

Definition at line 30 of file status.cpp.

Member Data Documentation

◆ error

bool daq::Status::error

Definition at line 53 of file status.hpp.

◆ files

DpParts daq::Status::files

Definition at line 54 of file status.hpp.

◆ id

std::string daq::Status::id

Definition at line 51 of file status.hpp.

◆ keywords

fits::KeywordVector daq::Status::keywords

Definition at line 55 of file status.hpp.

◆ state

State daq::Status::state

Definition at line 52 of file status.hpp.

◆ timestamp

TimePoint daq::Status::timestamp

Definition at line 56 of file status.hpp.

◆ daq::ObservableStatus

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
 
ObservableStatusoperator= (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...
 

Member Typedef Documentation

◆ Signal

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

Connect observer that is invoked when state is modified.

Parameters
oObserver callable invoked on status changes (state or file changes) Observer must be invocable with signature void(ObservableStatus const&).
Returns
signal connection object that can be used to disconnect observer:
auto c = status.ConnectObserver([](ObservableStatus const& s){});
// later the connection object can be used to disconnect
c.disconnect();

Definition at line 162 of file status.hpp.

Constructor & Destructor Documentation

◆ ObservableStatus() [1/2]

daq::ObservableStatus::ObservableStatus ( std::string  id)
explicitnoexcept

Construct a new object.

Parameters
idData acquisition identifier.

Definition at line 44 of file status.cpp.

◆ ObservableStatus() [2/2]

daq::ObservableStatus::ObservableStatus ( ObservableStatus const &  )
delete

Member Function Documentation

◆ AddFiles()

void daq::ObservableStatus::AddFiles ( std::vector< DpPart > const &  files)

Records that a file has been produced for this data acquisition.

Parameters
filesFiles to add/record.
Postcondition
Connected observers have been signalled.

Definition at line 83 of file status.cpp.

◆ ConnectObserver()

template<class Observer >
boost::signals2::connection daq::ObservableStatus::ConnectObserver ( Observer  o)
inline

Connect observer that is invoked when state is modified.

Parameters
oObserver callable invoked on status changes (state or file changes) Observer must be invocable with signature void(ObservableStatus const&).
Returns
signal connection object that can be used to disconnect observer:
auto c = status.ConnectObserver([](ObservableStatus const& s){});
// later the connection object can be used to disconnect
c.disconnect();

Definition at line 164 of file status.hpp.

◆ GetError()

bool daq::ObservableStatus::GetError ( ) const
noexcept
Returns
Data acquisition error flag.

Definition at line 71 of file status.cpp.

◆ GetFiles()

std::vector< DpPart > const & daq::ObservableStatus::GetFiles ( ) const
noexcept
Returns
Files created for this data acquisition

Definition at line 75 of file status.cpp.

◆ GetId()

std::string const & daq::ObservableStatus::GetId ( ) const
noexcept
Returns
Data acquisition identifier

Definition at line 63 of file status.cpp.

◆ GetKeywords()

fits::KeywordVector const & daq::ObservableStatus::GetKeywords ( ) const
noexcept
Returns
Primary HDU keywords provided by OCM for this data acquisition

Definition at line 79 of file status.cpp.

◆ GetState()

State daq::ObservableStatus::GetState ( ) const
noexcept
Returns
Data acquisition state

Definition at line 67 of file status.cpp.

◆ GetStatus()

Status const & daq::ObservableStatus::GetStatus ( ) const
noexcept

Connect observer that is invoked when state is modified.

Parameters
oObserver callable invoked on status changes (state or file changes) Observer must be invocable with signature void(ObservableStatus const&).
Returns
signal connection object that can be used to disconnect observer:
auto c = status.ConnectObserver([](ObservableStatus const& s){});
// later the connection object can be used to disconnect
c.disconnect();

Definition at line 125 of file status.cpp.

◆ operator Status()

daq::ObservableStatus::operator Status ( ) const

Allow implicit conversion to non-observable status.

Definition at line 121 of file status.cpp.

◆ operator!=() [1/2]

bool daq::ObservableStatus::operator!= ( ObservableStatus const &  rhs) const
noexcept

Definition at line 51 of file status.cpp.

◆ operator!=() [2/2]

bool daq::ObservableStatus::operator!= ( Status const &  rhs) const
noexcept

Definition at line 59 of file status.cpp.

◆ operator=()

ObservableStatus& daq::ObservableStatus::operator= ( ObservableStatus const &  )
delete

◆ operator==() [1/2]

bool daq::ObservableStatus::operator== ( ObservableStatus const &  rhs) const
noexcept

Definition at line 47 of file status.cpp.

◆ operator==() [2/2]

bool daq::ObservableStatus::operator== ( Status const &  rhs) const
noexcept

Definition at line 55 of file status.cpp.

◆ SetError()

void daq::ObservableStatus::SetError ( bool  error)
noexcept

Set error flag for data acquisition.

Parameters
errorNew error flag status.
Postcondition
Connected observers have been signalled.

Definition at line 105 of file status.cpp.

◆ SetState()

void daq::ObservableStatus::SetState ( State  s)
noexcept

Set state of data acquisition.

Parameters
sNew state
Postcondition
Connected observers have been signalled.

Definition at line 97 of file status.cpp.

◆ UpdateKeywords()

void daq::ObservableStatus::UpdateKeywords ( fits::KeywordVector const &  keywords)
noexcept

Updates (adds or replaces) Primary HDU keywords.

Definition at line 89 of file status.cpp.

Enumeration Type Documentation

◆ State

enum daq::State
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  |
*                                                                       +—————————+
*
* 
Enumerator
NotStarted 

Initial state of data acquisition.

Starting 

Transitional state between NotStarted and Acquiring when sources have not begun acquiring data yet.

Acquiring 

All data sources have reported data acquisition is in progress.

Stopping 

Transitional state between Acquiring and Stopped.

Stopped 

All data sources have reported they have stopped acquiring data.

Aborting 

Transitional state from previous states to Aborted.

Aborted 

Data acquisition has been aborted by user.

Definition at line 41 of file state.hpp.

Function Documentation

◆ HandleMetaDaqReply()

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.

Exceptions
Exceptioncontained in reply.
Returns
fut
Parameters
expected_stateThe state the source is expected to be in when receving the reply.
success_stateThe state the source is set to on success.
daqData acquisition the operation belongs to.
sourceThe source to handle reply from.
futReply.

Definition at line 65 of file util.cpp.

◆ HandlePrimDaqReply()

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.

Exceptions
Exceptioncontained in reply.
Returns
fut contained value or std::nullopt of expected state is already satisifed
Parameters
expected_stateThe state the source is expected to be in when receving the reply.
success_stateThe state the source is set to on success.
daqData acquisition the operation belongs to.
sourceThe source to handle reply from.
futReply.

Definition at line 136 of file util.cpp.

◆ IsFinalState()

bool daq::IsFinalState ( State  state)
noexcept

Query whether state is in a final state.

Returns
true if state is Stopped or Aborted.
false otherwise.

Definition at line 14 of file state.cpp.

◆ IsSubsequentState()

bool daq::IsSubsequentState ( State  state,
State  after 
)
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.

Returns
true if state comes after after in the DAQ life-cycle.

Definition at line 25 of file state.cpp.

◆ MakeDaqIdCandidate()

std::string daq::MakeDaqIdCandidate ( char const *  instrument_id,
unsigned  jitter = 0 
)

Creates a DAQ id candidate that may or may not be unique.

Parameters
instrument_idThe instrument ID to use for the id. Only the 5 first characters will be used if the name is longer than 5.
jitterJitter 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.
Note
The function cannot guarantee unique ID and is the responsibility of the caller.

Definition at line 27 of file manager.cpp.

◆ operator<<() [1/2]

std::ostream & daq::operator<< ( std::ostream &  os,
FitsController const &  ctl 
)

Print status information to provided ostream.

Definition at line 87 of file fitsController.cpp.

◆ operator<<() [2/2]

std::ostream & daq::operator<< ( std::ostream &  os,
State  state 
)

Prints state string representation to os.

Definition at line 54 of file daqController.cpp.

◆ SendRequestAndCollectReplies()

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.

Todo:
: Need to generalize based on requestor reply type.
Parameters
beginBeginning of sequence of sources to send request.
endEnd of sequence of sources to send request.
paramsParameters for this async operation.
senderFunctor that sends request and returns future.
reply_handlerHandler 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_handlerHandler 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.
Returns
Future of R, as returned by replies handler

Type requirement:

with T being the requestor reply type.

Sender: boost::future<T> (Source&) ReplyHandler: R (AsyncOpParams, Source, boost::future<T>)

Definition at line 173 of file util.hpp.

◆ UnwrapReplies()

template<class R >
std::vector<R> daq::op::UnwrapReplies ( boost::future< std::vector< boost::future< R >>> &&  futures)

Unwrap replies.

Definition at line 119 of file util.hpp.

◆ UnwrapVoidReplies()

void daq::op::UnwrapVoidReplies ( boost::future< std::vector< boost::future< void >>> &&  futures)

Unwrap futures to extract errors.

Exceptions
DaqSourceErrorscontaining all exceptions.

Definition at line 54 of file util.cpp.

daq::ObservableStatus::ObservableStatus
ObservableStatus(std::string id) noexcept
Construct a new object.
Definition: status.cpp:44