1 #include "daq/slc/runcontrol/RCState.h"
5 const RCState RCState::OFF_S(1,
"OFF");
6 const RCState RCState::NOTREADY_S(2,
"NOTREADY");
7 const RCState RCState::READY_S(3,
"READY");
8 const RCState RCState::RUNNING_S(4,
"RUNNING");
9 const RCState RCState::PAUSED_S(5,
"PAUSED");
10 const RCState RCState::LOADING_TS(6,
"LOADING");
11 const RCState RCState::STARTING_TS(7,
"STARTING");
12 const RCState RCState::STOPPING_TS(8,
"STOPPING");
13 const RCState RCState::CONFIGURING_TS(9,
"CONFIGURING");
14 const RCState RCState::ERROR_ES(10,
"ERROR");
15 const RCState RCState::FATAL_ES(11,
"FATAL");
16 const RCState RCState::BOOTING_RS(12,
"BOOTING");
17 const RCState RCState::RECOVERING_RS(13,
"RECOVERING");
18 const RCState RCState::ABORTING_RS(14,
"ABORTING");
20 const RCState& RCState::operator=(
const std::string& label)
22 if (label == NOTREADY_S.getLabel()) *
this = NOTREADY_S;
23 else if (label == READY_S.getLabel()) *
this = READY_S;
24 else if (label == RUNNING_S.getLabel()) *
this = RUNNING_S;
25 else if (label == PAUSED_S.getLabel()) *
this = PAUSED_S;
26 else if (label == LOADING_TS.getLabel()) *
this = LOADING_TS;
27 else if (label == STARTING_TS.getLabel()) *
this = STARTING_TS;
28 else if (label == STOPPING_TS.getLabel()) *
this = STOPPING_TS;
29 else if (label == CONFIGURING_TS.getLabel()) *
this = CONFIGURING_TS;
30 else if (label == ERROR_ES.getLabel()) *
this = ERROR_ES;
31 else if (label == FATAL_ES.getLabel()) *
this = FATAL_ES;
32 else if (label == RECOVERING_RS.getLabel()) *
this = RECOVERING_RS;
33 else if (label == ABORTING_RS.getLabel()) *
this = ABORTING_RS;
34 else if (label == BOOTING_RS.getLabel()) *
this = BOOTING_RS;
35 else *
this = Enum::UNKNOWN;
39 const RCState& RCState::operator=(
const char* label)
41 if (label != NULL) *
this = std::string(label);
42 else *
this = Enum::UNKNOWN;
46 const RCState& RCState::operator=(
int id)
48 if (
id == NOTREADY_S.getId()) *
this = NOTREADY_S;
49 else if (
id == READY_S.getId()) *
this = READY_S;
50 else if (
id == RUNNING_S.getId()) *
this = RUNNING_S;
51 else if (
id == PAUSED_S.getId()) *
this = PAUSED_S;
52 else if (
id == LOADING_TS.getId()) *
this = LOADING_TS;
53 else if (
id == STARTING_TS.getId()) *
this = STARTING_TS;
54 else if (
id == STOPPING_TS.getId()) *
this = STOPPING_TS;
55 else if (
id == CONFIGURING_TS.getId()) *
this = CONFIGURING_TS;
56 else if (
id == ERROR_ES.getId()) *
this = ERROR_ES;
57 else if (
id == FATAL_ES.getId()) *
this = FATAL_ES;
58 else if (
id == RECOVERING_RS.getId()) *
this = RECOVERING_RS;
59 else if (
id == ABORTING_RS.getId()) *
this = ABORTING_RS;
60 else if (
id == BOOTING_RS.getId()) *
this = BOOTING_RS;
61 else *
this = Enum::UNKNOWN;
67 if (*
this == LOADING_TS)
return READY_S;
68 else if (*
this == STARTING_TS)
return RUNNING_S;
69 else if (*
this == STOPPING_TS)
return READY_S;
70 else if (*
this == RECOVERING_RS)
return READY_S;
71 else if (*
this == ABORTING_RS)
return NOTREADY_S;
72 else if (*
this == BOOTING_RS)
return NOTREADY_S;
73 else if (*
this == CONFIGURING_TS)
return NOTREADY_S;
74 else return Enum::UNKNOWN;