ifw-daq
1.0.0
IFW Data Acquisition modules
ocm
libdaq
src
state.cpp
Go to the documentation of this file.
1
/**
2
* @file
3
* @ingroup daq_ocm_libdaq
4
* @copyright 2021 ESO - European Southern Observatory
5
*
6
* @brief Definitions from daq/state.hpp
7
*/
8
#include <
daq/state.hpp
>
9
10
11
namespace
daq
{
12
13
14
bool
IsFinalState
(
State
state) noexcept {
15
switch
(state) {
16
case
State::Stopped:
17
case
State::Aborted
:
18
return
true
;
19
default
:
20
return
false
;
21
}
22
}
23
24
25
bool
IsSubsequentState
(
State
before,
State
after) noexcept {
26
if
(before == after) {
27
return
false
;
28
}
29
// If after is a final before it doesn't matter what before is, it cannot occur after a final before
30
if
(
IsFinalState
(after)) {
31
return
false
;
32
}
33
34
// note: We take advantage of that the life-cycle is completely linear, *except* for
35
// aborting + aborted. So those are checked first.
36
// As it's always possible to abort: Aborting can occur after any state except Aborted.
37
38
if
(before == State::Aborting) {
39
// Only state that occurs after Aborting is Aborted
40
return
after ==
State::Aborted
;
41
}
42
43
// What remains is the linear befores for the normal life-cycle
44
return
static_cast<
int
>
(before) >
static_cast<
int
>
(after);
45
}
46
47
48
}
// namespace daq
daq::State
State
Observable states of the data acquisition process.
Definition:
state.hpp:41
daq::IsFinalState
bool IsFinalState(State state) noexcept
Query whether state is in a final state.
Definition:
state.cpp:14
daq
Definition:
daqController.cpp:18
daq::IsSubsequentState
bool IsSubsequentState(State state, State after) noexcept
Compares states and returns whether state occurs after after.
Definition:
state.cpp:25
state.hpp
Declares daq::State and related functions.
daq::State::NotStarted
@ NotStarted
Initial state of data acquisition.
Generated by
1.8.20