ifw-daq  2.1.0-pre1
IFW Data Acquisition modules
Namespaces | Classes | Functions
daq::op Namespace Reference

Namespaces

 eventlog
 

Classes

struct  AbortAsync
 A composite async operation that aborts a DAQ. More...
 
struct  AlertState
 
struct  AsyncOpParams
 Parameters required for each async operation. More...
 
struct  AwaitOpParams
 Await specific parameters that is not provided with AsyncOpParams. More...
 
struct  AwaitPrimAsync
 A composite async operation that awaits primary data sources. More...
 
struct  AwaitStateAsync
 Async operation to await Data Acquisition state. More...
 
struct  OpStat
 Keeps record when operation started and finished. More...
 
struct  StartAsync
 A composite async operation that starts DAQ. More...
 
struct  StopAsync
 A composite async operation that starts DAQ. More...
 

Functions

void MergeAlerts (ObservableStatus &dest, AlertState &src)
 Merge alerts. More...
 
template<class Op , class R = decltype(std::declval<Op&>().Initiate()), class... Params>
InitiateOperation (Params &&... params)
 Constructs and initiates Op and return the future result. More...
 
template<class Op , class R = decltype(std::declval<Op&>().Initiate()), class... Params>
std::pair< R, std::function< bool()> > InitiateAbortableOperation (Params &&... params)
 Like InitiateOperation but in addition to returning the future it also returns an unspecified object Abort that can be invoked to abort the operation. More...
 
template<class R , class Iterator , class Pred , class Sender , class ReplyHandler >
boost::future< std::vector< boost::future< R > > > 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...
 
template<class T >
std::vector< std::exception_ptr > ExtractExceptions (std::vector< boost::future< T >> &futures)
 
void UnwrapVoidReplies (boost::future< std::vector< boost::future< void >>> futures)
 Unwrap futures to extract errors. More...
 
template<class R >
std::vector< R > UnwrapReplies (boost::future< std::vector< boost::future< R >>> &&futures)
 Unwrap replies. More...
 
template<class ReplyType >
std::optional< ReplyType > HandleMetaDaqReply (char const *request, 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 > HandlePrimDaqReply (char const *request, 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...
 
template std::optional< std::shared_ptr< DaqReply > > HandleMetaDaqReply< std::shared_ptr< DaqReply > > (char const *request, std::optional< State > expected_state, State success_state, std::optional< State > error_state, AsyncOpParams params, Source< MetaSource > &source, boost::future< std::shared_ptr< DaqReply >> &&fut)
 
template std::optional< std::shared_ptr< DaqStopReply > > HandleMetaDaqReply< std::shared_ptr< DaqStopReply > > (char const *request, std::optional< State > expected_state, State success_state, std::optional< State > error_state, AsyncOpParams params, Source< MetaSource > &source, boost::future< std::shared_ptr< DaqStopReply >> &&fut)
 
template std::optional< std::string > HandlePrimDaqReply< std::string > (char const *request, std::optional< State > expected_state, State success_state, std::optional< State > error_state, AsyncOpParams params, Source< PrimSource > &source, boost::future< std::string > &&fut)
 
template std::optional< std::shared_ptr< RecStatus > > HandlePrimDaqReply< std::shared_ptr< RecStatus > > (char const *request, std::optional< State > expected_state, State success_state, std::optional< State > error_state, AsyncOpParams params, Source< PrimSource > &source, boost::future< std::shared_ptr< RecStatus >> &&fut)
 

Class Documentation

◆ daq::op::OpStat

struct daq::op::OpStat

Keeps record when operation started and finished.

Definition at line 24 of file start.hpp.

Class Members
time_point< steady_clock > begin
time_point< steady_clock > end

Function Documentation

◆ ExtractExceptions()

template<class T >
std::vector<std::exception_ptr> daq::op::ExtractExceptions ( std::vector< boost::future< T >> &  futures)

Definition at line 92 of file util.hpp.

◆ HandleMetaDaqReply()

template<class ReplyType >
std::optional< ReplyType > daq::op::HandleMetaDaqReply ( char const *  request,
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 72 of file util.cpp.

◆ HandleMetaDaqReply< std::shared_ptr< DaqReply > >()

template std::optional<std::shared_ptr<DaqReply> > daq::op::HandleMetaDaqReply< std::shared_ptr< DaqReply > > ( char const *  request,
std::optional< State expected_state,
State  success_state,
std::optional< State error_state,
AsyncOpParams  params,
Source< MetaSource > &  source,
boost::future< std::shared_ptr< DaqReply >> &&  fut 
)

◆ HandleMetaDaqReply< std::shared_ptr< DaqStopReply > >()

template std::optional<std::shared_ptr<DaqStopReply> > daq::op::HandleMetaDaqReply< std::shared_ptr< DaqStopReply > > ( char const *  request,
std::optional< State expected_state,
State  success_state,
std::optional< State error_state,
AsyncOpParams  params,
Source< MetaSource > &  source,
boost::future< std::shared_ptr< DaqStopReply >> &&  fut 
)

◆ HandlePrimDaqReply()

template<class ReplyType >
std::optional< ReplyType > daq::op::HandlePrimDaqReply ( char const *  request,
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 162 of file util.cpp.

◆ HandlePrimDaqReply< std::shared_ptr< RecStatus > >()

template std::optional<std::shared_ptr<RecStatus> > daq::op::HandlePrimDaqReply< std::shared_ptr< RecStatus > > ( char const *  request,
std::optional< State expected_state,
State  success_state,
std::optional< State error_state,
AsyncOpParams  params,
Source< PrimSource > &  source,
boost::future< std::shared_ptr< RecStatus >> &&  fut 
)

◆ HandlePrimDaqReply< std::string >()

template std::optional<std::string> daq::op::HandlePrimDaqReply< std::string > ( char const *  request,
std::optional< State expected_state,
State  success_state,
std::optional< State error_state,
AsyncOpParams  params,
Source< PrimSource > &  source,
boost::future< std::string > &&  fut 
)

◆ InitiateAbortableOperation()

template<class Op , class R = decltype(std::declval<Op&>().Initiate()), class... Params>
std::pair< R, std::function< bool()> > daq::op::InitiateAbortableOperation ( Params &&...  params)

Like InitiateOperation but in addition to returning the future it also returns an unspecified object Abort that can be invoked to abort the operation.

If Abort return true it will have invoked Op::Abort(). If Abort return false the operation has already been completed and future value has been set.

Type Requirements:

Op: Op::Op(Params...) Op::Initiate() -> boost::future<R> Op::Abort() -> void note: It's not required that the future returned from Initiate() has a value set when returning from Abort.

Definition at line 75 of file initiate.hpp.

◆ InitiateOperation()

template<class Op , class R = decltype(std::declval<Op&>().Initiate()), class... Params>
R daq::op::InitiateOperation ( Params &&...  params)

Constructs and initiates Op and return the future result.

InitiateOperation performs the following:

  1. Constructs the operation by forwarding the parameters Params.
  2. Invokes Op::Initiate() -> boost::future<R>
  3. Returns result of Op::Initiate().
  4. Keeps Operation alive until result of Op::Initiate() is set, such that the operation itself does not have to manage this.

Type Requirements:

Op: Op::Op(Params...) Op::Initiate() -> boost::future<R>

Definition at line 66 of file initiate.hpp.

◆ MergeAlerts()

void daq::op::MergeAlerts ( ObservableStatus dest,
AlertState src 
)
inline

Merge alerts.

It only set/clears if timestamp is newer.

Definition at line 43 of file asyncOpParams.hpp.

◆ 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 176 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 120 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 60 of file util.cpp.