Belle II Software development
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
13namespace Belle2 {
18
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 // cppcheck-suppress noExplicitConstructor ; implicit conversion is part of the Enum-style API
40 RCState(const Enum& e) : NSMState(e) {}
41 // cppcheck-suppress noExplicitConstructor ; implicit conversion is part of the Enum-style API
42 RCState(const NSMState& num) : NSMState(num) {}
43 RCState(const RCState& st) : NSMState(st) {}
44 // cppcheck-suppress noExplicitConstructor ; implicit conversion is part of the Enum-style API
45 RCState(const char* st) { *this = st; }
46 explicit RCState(const std::string& st) { *this = st; }
47 explicit RCState(int id) { *this = id; }
48 ~RCState() {}
49
50 protected:
51 RCState(int id, const char* label)
52 : NSMState(id, label) {}
53
54 public:
55 bool isStable() const { return getId() > 1 && getId() <= 5; }
56 bool isTransition() const { return getId() > 5 && getId() <= 9; }
57 bool isError() const { return getId() > 9 && getId() <= 11; }
58 bool isRecovering() const { return getId() > 11 && getId() <= 14; }
59 RCState next() const;
60
61 public:
62
66 const RCState& operator=(const RCState& state);
67 const RCState& operator=(const std::string& msg);
68 const RCState& operator=(const char* msg);
69 const RCState& operator=(int id);
70
71 };
72
74}
75
76#endif
const RCState & operator=(const RCState &state)
Operator =.
Definition RCState.cc:27
Abstract base class for different kinds of events.