8#include "daq/slc/runcontrol/RCCommand.h"
10#include "daq/slc/runcontrol/RCState.h"
14const RCCommand RCCommand::CONFIGURE(101,
"RC_CONFIGURE");
15const RCCommand RCCommand::LOAD(102,
"RC_LOAD");
16const RCCommand RCCommand::START(103,
"RC_START");
17const RCCommand RCCommand::STOP(104,
"RC_STOP");
18const RCCommand RCCommand::RESUME(105,
"RC_RESUME");
19const RCCommand RCCommand::PAUSE(106,
"RC_PAUSE");
20const RCCommand RCCommand::RECOVER(107,
"RC_RECOVER");
21const RCCommand RCCommand::ABORT(108,
"RC_ABORT");
22const RCCommand RCCommand::BOOT(109,
"RC_BOOT");
23const RCCommand RCCommand::STATUS(110,
"RC_STATUS");
33 if (NSMCommand::operator=(label) != Enum::UNKNOWN)
return *
this;
34 else if (label == CONFIGURE.getLabel()) *
this = CONFIGURE;
35 else if (label == LOAD.getLabel()) *
this = LOAD;
36 else if (label == START.getLabel()) *
this = START;
37 else if (label == STOP.getLabel()) *
this = STOP;
38 else if (label == RECOVER.getLabel()) *
this = RECOVER;
39 else if (label == RESUME.getLabel()) *
this = RESUME;
40 else if (label == PAUSE.getLabel()) *
this = PAUSE;
41 else if (label == ABORT.getLabel()) *
this = ABORT;
42 else if (label == BOOT.getLabel()) *
this = BOOT;
43 else if (label == STATUS.getLabel()) *
this = STATUS;
44 else *
this = Enum::UNKNOWN;
50 if (NSMCommand::operator=(
id) != Enum::UNKNOWN)
return *
this;
51 else if (
id == CONFIGURE.getId()) *
this = CONFIGURE;
52 else if (
id == LOAD.getId()) *
this = LOAD;
53 else if (
id == START.getId()) *
this = START;
54 else if (
id == STOP.getId()) *
this = STOP;
55 else if (
id == RECOVER.getId()) *
this = RECOVER;
56 else if (
id == RESUME.getId()) *
this = RESUME;
57 else if (
id == PAUSE.getId()) *
this = PAUSE;
58 else if (
id == ABORT.getId()) *
this = ABORT;
59 else if (
id == BOOT.getId()) *
this = BOOT;
60 else if (
id == STATUS.getId()) *
this = STATUS;
61 else *
this = Enum::UNKNOWN;
67 if (label != NULL) *
this = std::string(label);
68 else *
this = Enum::UNKNOWN;
72int RCCommand::isAvailable(
const RCState& state)
const
75 if ((cmd == LOAD || cmd == CONFIGURE) &&
76 state == RCState::NOTREADY_S) {
82 }
else if (cmd == START && state == RCState::READY_S) {
84 }
else if (cmd == STOP && (state == RCState::RUNNING_S ||
85 state == RCState::PAUSED_S)) {
87 }
else if (cmd == PAUSE && state == RCState::RUNNING_S) {
89 }
else if (cmd == RESUME && state == RCState::PAUSED_S) {
91 }
else if (cmd == ABORT) {
93 }
else if (cmd == RECOVER && state == RCState::ERROR_ES) {
95 }
else if (cmd == BOOT && state == RCState::NOTREADY_S) {
102RCState RCCommand::nextState()
const
105 if (cmd == LOAD)
return RCState::READY_S;
106 else if (cmd == START)
return RCState::RUNNING_S;
107 else if (cmd == STOP)
return RCState::READY_S;
108 else if (cmd == RESUME)
return RCState::RUNNING_S;
109 else if (cmd == PAUSE)
return RCState::PAUSED_S;
110 else if (cmd == RECOVER)
return RCState::READY_S;
111 else if (cmd == ABORT)
return RCState::NOTREADY_S;
112 else if (cmd == BOOT)
return RCState::NOTREADY_S;
113 else if (cmd == CONFIGURE)
return RCState::NOTREADY_S;
114 else return Enum::UNKNOWN;
117RCState RCCommand::nextTState()
const
120 if (cmd == CONFIGURE)
return RCState::CONFIGURING_TS;
121 else if (cmd == LOAD)
return RCState::LOADING_TS;
122 else if (cmd == START)
return RCState::STARTING_TS;
123 else if (cmd == STOP)
return RCState::STOPPING_TS;
124 else if (cmd == RESUME)
return RCState::RUNNING_S;
125 else if (cmd == PAUSE)
return RCState::PAUSED_S;
126 else if (cmd == RECOVER)
return RCState::RECOVERING_RS;
127 else if (cmd == ABORT)
return RCState::ABORTING_RS;
128 else if (cmd == BOOT)
return RCState::BOOTING_RS;
129 else return Enum::UNKNOWN;
const NSMCommand & operator=(const NSMCommand &command)
Operator =.
const RCCommand & operator=(const RCCommand &command)
Operator =.
Abstract base class for different kinds of events.