Belle II Software development
RCState.cc
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8#include "daq/slc/runcontrol/RCState.h"
9
10using namespace Belle2;
11
12const RCState RCState::OFF_S(1, "OFF");
13const RCState RCState::NOTREADY_S(2, "NOTREADY");
14const RCState RCState::READY_S(3, "READY");
15const RCState RCState::RUNNING_S(4, "RUNNING");
16const RCState RCState::PAUSED_S(5, "PAUSED");
17const RCState RCState::LOADING_TS(6, "LOADING");
18const RCState RCState::STARTING_TS(7, "STARTING");
19const RCState RCState::STOPPING_TS(8, "STOPPING");
20const RCState RCState::CONFIGURING_TS(9, "CONFIGURING");
21const RCState RCState::ERROR_ES(10, "ERROR");
22const RCState RCState::FATAL_ES(11, "FATAL");
23const RCState RCState::BOOTING_RS(12, "BOOTING");
24const RCState RCState::RECOVERING_RS(13, "RECOVERING");
25const RCState RCState::ABORTING_RS(14, "ABORTING");
26
28{
30 return *this;
31}
32
33const RCState& RCState::operator=(const std::string& label)
34{
35 if (label == NOTREADY_S.getLabel()) *this = NOTREADY_S;
36 else if (label == READY_S.getLabel()) *this = READY_S;
37 else if (label == RUNNING_S.getLabel()) *this = RUNNING_S;
38 else if (label == PAUSED_S.getLabel()) *this = PAUSED_S;
39 else if (label == LOADING_TS.getLabel()) *this = LOADING_TS;
40 else if (label == STARTING_TS.getLabel()) *this = STARTING_TS;
41 else if (label == STOPPING_TS.getLabel()) *this = STOPPING_TS;
42 else if (label == CONFIGURING_TS.getLabel()) *this = CONFIGURING_TS;
43 else if (label == ERROR_ES.getLabel()) *this = ERROR_ES;
44 else if (label == FATAL_ES.getLabel()) *this = FATAL_ES;
45 else if (label == RECOVERING_RS.getLabel()) *this = RECOVERING_RS;
46 else if (label == ABORTING_RS.getLabel()) *this = ABORTING_RS;
47 else if (label == BOOTING_RS.getLabel()) *this = BOOTING_RS;
48 else *this = Enum::UNKNOWN;
49 return *this;
50}
51
52const RCState& RCState::operator=(const char* label)
53{
54 if (label != NULL) *this = std::string(label);
55 else *this = Enum::UNKNOWN;
56 return *this;
57}
58
59const RCState& RCState::operator=(int id)
60{
61 if (id == NOTREADY_S.getId()) *this = NOTREADY_S;
62 else if (id == READY_S.getId()) *this = READY_S;
63 else if (id == RUNNING_S.getId()) *this = RUNNING_S;
64 else if (id == PAUSED_S.getId()) *this = PAUSED_S;
65 else if (id == LOADING_TS.getId()) *this = LOADING_TS;
66 else if (id == STARTING_TS.getId()) *this = STARTING_TS;
67 else if (id == STOPPING_TS.getId()) *this = STOPPING_TS;
68 else if (id == CONFIGURING_TS.getId()) *this = CONFIGURING_TS;
69 else if (id == ERROR_ES.getId()) *this = ERROR_ES;
70 else if (id == FATAL_ES.getId()) *this = FATAL_ES;
71 else if (id == RECOVERING_RS.getId()) *this = RECOVERING_RS;
72 else if (id == ABORTING_RS.getId()) *this = ABORTING_RS;
73 else if (id == BOOTING_RS.getId()) *this = BOOTING_RS;
74 else *this = Enum::UNKNOWN;
75 return *this;
76}
77
78RCState RCState::next() const
79{
80 if (*this == LOADING_TS) return READY_S;
81 else if (*this == STARTING_TS) return RUNNING_S;
82 else if (*this == STOPPING_TS) return READY_S;
83 else if (*this == RECOVERING_RS) return READY_S;
84 else if (*this == ABORTING_RS) return NOTREADY_S;
85 else if (*this == BOOTING_RS) return NOTREADY_S;
86 else if (*this == CONFIGURING_TS) return NOTREADY_S;
87 else return Enum::UNKNOWN;
88}
const NSMState & operator=(const NSMState &state)
Operator =.
Definition: NSMState.cc:14
const RCState & operator=(const RCState &state)
Operator =.
Definition: RCState.cc:27
Abstract base class for different kinds of events.