ifw-daq 3.1.0
IFW Data Acquisition modules
Loading...
Searching...
No Matches
state.cpp
Go to the documentation of this file.
1/**
2 * @file
3 * @ingroup daq_ocm_libdaqif_suppport
4 * @copyright 2022 ESO - European Southern Observatory
5 *
6 * @brief Contains definitions for daqif/state.hpp
7 */
8#include <daqif/state.hpp>
9
10namespace daqif {
11
12bool operator==(FullState lhs, FullState rhs) noexcept {
13 return lhs.state == rhs.state && lhs.substate == rhs.substate;
14}
15
16bool IsStateValid(DaqState state, DaqSubState substate) {
17 switch (state) {
18 case StateAcquiring:
19 switch (substate) {
20 case daqif::NotStarted:
21 case daqif::Starting:
22 case daqif::Acquiring:
23 case daqif::Stopping:
24 case daqif::Stopped:
25 case daqif::Aborting:
26 return true;
27 default:
28 return false;
29 }
30 case StateMerging:
31 switch (substate) {
32 case daqif::NotScheduled:
33 case daqif::Scheduled:
34 case daqif::Collecting:
35 case daqif::Merging:
36 case daqif::Releasing:
37 case daqif::Aborting:
38 return true;
39 default:
40 return false;
41 }
42 case StateCompleted:
43 switch (substate) {
44 case daqif::Completed:
45 case daqif::Aborted:
46 return true;
47 default:
48 return false;
49 }
50 default:
51 return false;
52 }
53}
54
56 return IsStateValid(state.state, state.substate);
57}
58
59} // namespace daqif
Contains State support functions for daqif.
DaqState state
Definition: state.hpp:18
DaqSubState substate
Definition: state.hpp:19
bool operator==(FullState lhs, FullState rhs) noexcept
Equality operator for FullState.
Definition: state.cpp:12
bool IsStateValid(DaqState state, DaqSubState substate)
Validate state combination.
Definition: state.cpp:16
Describes the full state and substate.
Definition: state.hpp:17