Belle II Software  release-06-02-00
RCState.h
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 #ifndef _Belle2_RCState_hh
9 #define _Belle2_RCState_hh
10 
11 #include <daq/slc/nsm/NSMState.h>
12 
13 namespace Belle2 {
19  class RCState : public NSMState {
20 
21  public:
22  static const RCState OFF_S;
23  static const RCState NOTREADY_S;
24  static const RCState READY_S;
25  static const RCState RUNNING_S;
26  static const RCState PAUSED_S;
27  static const RCState CONFIGURING_TS;
28  static const RCState LOADING_TS;
29  static const RCState STARTING_TS;
30  static const RCState STOPPING_TS;
31  static const RCState ERROR_ES;
32  static const RCState FATAL_ES;
33  static const RCState RECOVERING_RS;
34  static const RCState ABORTING_RS;
35  static const RCState BOOTING_RS;
36 
37  public:
38  RCState() : NSMState(Enum::UNKNOWN) {}
39  RCState(const Enum& e) : NSMState(e) {}
40  RCState(const NSMState& num) : NSMState(num) {}
41  RCState(const RCState& st) : NSMState(st) {}
42  RCState(const char* st) { *this = st; }
43  RCState(const std::string& st) { *this = st; }
44  RCState(int id) { *this = id; }
45  ~RCState() {}
46 
47  protected:
48  RCState(int id, const char* label)
49  : NSMState(id, label) {}
50 
51  public:
52  bool isStable() const { return getId() > 1 && getId() <= 5; }
53  bool isTransition() const { return getId() > 5 && getId() <= 9; }
54  bool isError() const { return getId() > 9 && getId() <= 11; }
55  bool isRecovering() const { return getId() > 11 && getId() <= 14; }
56  RCState next() const;
57 
58  public:
59  const RCState& operator=(const std::string& msg);
60  const RCState& operator=(const char* msg);
61  const RCState& operator=(int id);
62 
63  };
64 
66 }
67 
68 #endif
Abstract base class for different kinds of events.