ifw-daq  2.1.0-pre1
IFW Data Acquisition modules
start.hpp
Go to the documentation of this file.
1 /**
2  * @file
3  * @ingroup daq_common_libdaq
4  * @copyright 2022 ESO - European Southern Observatory
5  *
6  * @brief Contains declaration for the StartAsync operation
7  */
8 #ifndef OCM_DAQ_OP_START_HPP_
9 #define OCM_DAQ_OP_START_HPP_
10 #include "../config.hpp"
11 #include "../dpPart.hpp"
12 #include "asyncOpParams.hpp"
13 
14 #include <vector>
15 #include <chrono>
16 
17 #include <boost/thread/future.hpp>
18 
19 namespace daq::op {
20 
21 /**
22  * Keeps record when operation started and finished
23  */
24 struct OpStat {
25 
26  std::chrono::time_point<std::chrono::steady_clock> begin;
27  std::chrono::time_point<std::chrono::steady_clock> end;
28 
29 };
30 
31 /**
32  * A composite async operation that starts DAQ
33  *
34  * @ingroup daq_common_libdaq
35  */
36 struct StartAsync {
37  explicit StartAsync(AsyncOpParams params) noexcept;
38 
39  /**
40  * Initiates operation that starts metadata acquisition.
41  *
42  * @post Async operation has been initated.
43  *
44  * @returns future that is set on failure when when primary data acquisition has started.
45  *
46  * @note Caller is responsible for keeping object alive until
47  * result is set.
48  */
49  [[nodiscard]] boost::future<void> Initiate();
50 
51 private:
52  [[nodiscard]] boost::future<void> StartMeta();
53  [[nodiscard]] boost::future<void> StartPrim();
54 
55  AsyncOpParams m_params;
56 };
57 
58 } // namespace daq::op
59 
60 #endif // #ifndef OCM_DAQ_OP_START_HPP_
daq::op::OpStat
Keeps record when operation started and finished.
Definition: start.hpp:24
asyncOpParams.hpp
daq::op
Definition: abort.hpp:19
daq::op::OpStat::end
std::chrono::time_point< std::chrono::steady_clock > end
Definition: start.hpp:27
daq::op::StartAsync::Initiate
boost::future< void > Initiate()
Initiates operation that starts metadata acquisition.
Definition: start.cpp:68
daq::op::StartAsync
A composite async operation that starts DAQ.
Definition: start.hpp:36
daq::op::StartAsync::StartAsync
StartAsync(AsyncOpParams params) noexcept
Definition: start.cpp:65
daq::op::AsyncOpParams
Parameters required for each async operation.
Definition: asyncOpParams.hpp:67
daq::op::OpStat::begin
std::chrono::time_point< std::chrono::steady_clock > begin
Definition: start.hpp:26