ifw-sup 5.0.0
Loading...
Searching...
No Matches
states.hpp
Go to the documentation of this file.
1
9#ifndef SUP_SYSSUP_COMMON_STATES_HPP
10#define SUP_SYSSUP_COMMON_STATES_HPP
11
12#include <boost/signals2.hpp>
13#include <boost/bimap.hpp>
14#include <boost/assign.hpp>
15
17
18 // State and substate definitions
19 constexpr auto KEY_STATUS_SUBSYS_STATE = "state";
20 constexpr auto KEY_STATUS_SUBSYS_SUBSTATE = "substate";
21
22 constexpr auto STATE_UNDEFINED_STR = "Undefined";
23 constexpr auto STATE_NOT_OP_ERROR_STR = "NotOpError";
24 constexpr auto STATE_ERROR_STR = "Error";
25 constexpr auto STATE_OFF_STR = "Off";
26 constexpr auto STATE_NOT_OPERATIONAL_STR = "NotOperational";
27 constexpr auto STATE_OPERATIONAL_STR = "Operational";
28
29 constexpr auto SUBSTATE_NOTREADY_STR = "NotReady";
30 constexpr auto SUBSTATE_INITIALISING_STR = "Initialising";
31 constexpr auto SUBSTATE_READY_STR = "Ready";
32 constexpr auto SUBSTATE_ENABLING_STR = "Enabling";
33 constexpr auto SUBSTATE_RECOVERING_STR = "Recovering";
34 constexpr auto SUBSTATE_IDLE_STR = "Idle";
35 constexpr auto SUBSTATE_BUSY_STR = "Busy";
36
37 //FCF Substates
38 constexpr auto SUBSTATE_SETTING_UP_STR = "SettingUp";
39
40 //CCF Substates
41 constexpr auto SUBSTATE_NOT_RECORDING_STR = "NotRecording";
42 constexpr auto SUBSTATE_RECORDING_STR = "Recording";
43 constexpr auto SUBSTATE_REC_PAUSED_STR = "RecPaused";
44
45 //OCM Substate
46 constexpr auto SUBSTATE_ACTIVE_STR = "Active";
47
55 struct State {
56 public:
57
58 enum class StateEnum : short {
59 OFF = -8,
60 UNDEFINED = -7,
62 OPERATIONAL = 2
63 };
64 enum class SubstateEnum : short {
65 UNDEFINED = 90,
66 ERROR = 95,
67 NOT_OP_NOT_READY = 100,
68 INITIALISING = 101,
69 NOT_OP_READY = 102,
70 ENABLING = 103,
71 RECOVERING = 106,
72 IDLE = 110,
73 BUSY = 115,
74 SETTING_UP = 130,
75 NOT_RECORDING = 200,
76 RECORDING = 201,
77 REC_PAUSED = 202,
78 ACTIVE = 205
79 };
80
81 using StateNumMap_t = boost::bimap<std::string, StateEnum>;
82 using SubstateNumMap_t = boost::bimap<std::string, SubstateEnum>;
83
84
85 //C++17 feature: you can define static members when they are inline.
86 //Used BOOST bidirectional maps.
87 inline static StateNumMap_t StateMap = boost::assign::list_of<State::StateNumMap_t::relation >
92
93 inline static SubstateNumMap_t SubstateMap = boost::assign::list_of<State::SubstateNumMap_t::relation >
107
108
114 inline static StateEnum GetState(const std::string& state);
120 inline static std::optional<std::string> GetStateStr(const StateEnum state);
126 inline static SubstateEnum GetSubstate(const std::string& substate);
132 inline static std::optional<std::string> GetSubstateStr(const SubstateEnum substate);
133
134 };
135
136}
137
138#include "states.ipp"
139
140#endif //SUP_SYSSUP_COMMON_STATES_HPP
ActionsInit class source file.
Definition actionMgr.cpp:32
constexpr auto SUBSTATE_NOT_RECORDING_STR
Definition states.hpp:41
constexpr auto STATE_NOT_OPERATIONAL_STR
Definition states.hpp:26
constexpr auto SUBSTATE_RECORDING_STR
Definition states.hpp:42
constexpr auto KEY_STATUS_SUBSYS_SUBSTATE
Definition states.hpp:20
constexpr auto SUBSTATE_BUSY_STR
Definition states.hpp:35
constexpr auto SUBSTATE_IDLE_STR
Definition states.hpp:34
constexpr auto SUBSTATE_ENABLING_STR
Definition states.hpp:32
constexpr auto SUBSTATE_NOTREADY_STR
Definition states.hpp:29
constexpr auto SUBSTATE_RECOVERING_STR
Definition states.hpp:33
constexpr auto STATE_OPERATIONAL_STR
Definition states.hpp:27
constexpr auto SUBSTATE_READY_STR
Definition states.hpp:31
constexpr auto STATE_OFF_STR
Definition states.hpp:25
constexpr auto SUBSTATE_INITIALISING_STR
Definition states.hpp:30
constexpr auto SUBSTATE_REC_PAUSED_STR
Definition states.hpp:43
constexpr auto KEY_STATUS_SUBSYS_STATE
Definition states.hpp:19
constexpr auto STATE_NOT_OP_ERROR_STR
Definition states.hpp:23
constexpr auto STATE_ERROR_STR
Definition states.hpp:24
constexpr auto SUBSTATE_SETTING_UP_STR
Definition states.hpp:38
constexpr auto SUBSTATE_ACTIVE_STR
Definition states.hpp:46
constexpr auto STATE_UNDEFINED_STR
Definition states.hpp:22
The State struct.
Definition states.hpp:55
static StateNumMap_t StateMap
Definition states.hpp:87
boost::bimap< std::string, StateEnum > StateNumMap_t
Definition states.hpp:81
static StateEnum GetState(const std::string &state)
Get state as an enumeration.
static SubstateEnum GetSubstate(const std::string &substate)
Get state as an enumeration.
static std::optional< std::string > GetStateStr(const StateEnum state)
Get state as an optional string.
boost::bimap< std::string, SubstateEnum > SubstateNumMap_t
Definition states.hpp:82
static std::optional< std::string > GetSubstateStr(const SubstateEnum substate)
Get substate as an optional string.
StateEnum
Definition states.hpp:58
SubstateEnum
Definition states.hpp:64
static SubstateNumMap_t SubstateMap
Definition states.hpp:93