Belle II Software development
RCCommand Class Reference
Inheritance diagram for RCCommand:
NSMCommand Enum

Public Member Functions

 RCCommand (const Enum &e)
 
 RCCommand (const NSMCommand &e)
 
 RCCommand (const RCCommand &cmd)
 
 RCCommand (const std::string &label)
 
 RCCommand (const char *label)
 
 RCCommand (int id)
 
int isAvailable (const RCState &state) const
 
RCState nextState () const
 
RCState nextTState () const
 
const RCCommandoperator= (const RCCommand &command)
 Operator =.
 
const RCCommandoperator= (const std::string &label)
 
const RCCommandoperator= (const char *label)
 
const RCCommandoperator= (int id)
 
int getId () const
 
const char * getLabel () const
 
const std::string & getLabelString () const
 
bool operator== (const Enum &e) const
 
bool operator== (const std::string &label) const
 
bool operator!= (const Enum &e) const
 
bool operator!= (const std::string &label) const
 

Static Public Attributes

static const RCCommand CONFIGURE
 
static const RCCommand BOOT
 
static const RCCommand LOAD
 
static const RCCommand START
 
static const RCCommand STOP
 
static const RCCommand RECOVER
 
static const RCCommand RESUME
 
static const RCCommand PAUSE
 
static const RCCommand ABORT
 
static const RCCommand STATUS
 
static const NSMCommand OK
 
static const NSMCommand STATE
 
static const NSMCommand ERROR
 
static const NSMCommand FATAL
 
static const NSMCommand LOG
 
static const NSMCommand LOGSET
 
static const NSMCommand LOGGET
 
static const NSMCommand VLISTGET
 
static const NSMCommand VLISTSET
 
static const NSMCommand VGET
 
static const NSMCommand VSET
 
static const NSMCommand VREPLY
 
static const NSMCommand DATAGET
 
static const NSMCommand DATASET
 
static const NSMCommand DBGET
 
static const NSMCommand DBSET
 
static const NSMCommand DBLISTGET
 
static const NSMCommand DBLISTSET
 
static const NSMCommand LOGLIST
 
static const int SUGGESTED = 2
 
static const int ENABLED = 1
 
static const int DISABLED = 0
 
static const Enum UNKNOWN
 

Protected Member Functions

 RCCommand (int id, const char *label)
 

Private Attributes

int m_id
 
std::string m_label
 

Detailed Description

Definition at line 21 of file RCCommand.h.

Constructor & Destructor Documentation

◆ RCCommand() [1/8]

RCCommand ( )
inline

Definition at line 36 of file RCCommand.h.

36{}

◆ RCCommand() [2/8]

RCCommand ( const Enum e)
inline

Definition at line 37 of file RCCommand.h.

37: NSMCommand(e) {}

◆ RCCommand() [3/8]

RCCommand ( const NSMCommand e)
inline

Definition at line 38 of file RCCommand.h.

38: NSMCommand(e) {}

◆ RCCommand() [4/8]

RCCommand ( const RCCommand cmd)
inline

Definition at line 39 of file RCCommand.h.

39: NSMCommand(cmd) {}

◆ RCCommand() [5/8]

RCCommand ( const std::string &  label)
inline

Definition at line 40 of file RCCommand.h.

40{ *this = label; }

◆ RCCommand() [6/8]

RCCommand ( const char *  label)
inline

Definition at line 41 of file RCCommand.h.

41{ *this = label; }

◆ RCCommand() [7/8]

RCCommand ( int  id)
inline

Definition at line 42 of file RCCommand.h.

42{ *this = id; }

◆ ~RCCommand()

~RCCommand ( )
inline

Definition at line 43 of file RCCommand.h.

43{}

◆ RCCommand() [8/8]

RCCommand ( int  id,
const char *  label 
)
inlineprotected

Definition at line 46 of file RCCommand.h.

47 : NSMCommand(id, label) {}

Member Function Documentation

◆ getId()

int getId ( ) const
inlineinherited

Definition at line 34 of file Enum.h.

34{ return m_id; }

◆ getLabel()

const char * getLabel ( ) const
inlineinherited

Definition at line 35 of file Enum.h.

35{ return m_label.c_str(); }

◆ getLabelString()

const std::string & getLabelString ( ) const
inlineinherited

Definition at line 36 of file Enum.h.

36{ return m_label; }

◆ isAvailable()

int isAvailable ( const RCState state) const

Definition at line 72 of file RCCommand.cc.

73{
74 const RCCommand& cmd(*this);
75 if ((cmd == LOAD || cmd == CONFIGURE) &&
76 state == RCState::NOTREADY_S) {
77 return SUGGESTED;
78 /* } else if ((cmd == LOAD || cmd == CONFIGURE) &&
79 state == RCState::READY_S) {
80 return ENABLED;
81 */
82 } else if (cmd == START && state == RCState::READY_S) {
83 return SUGGESTED;
84 } else if (cmd == STOP && (state == RCState::RUNNING_S ||
85 state == RCState::PAUSED_S)) {
86 return SUGGESTED;
87 } else if (cmd == PAUSE && state == RCState::RUNNING_S) {
88 return ENABLED;
89 } else if (cmd == RESUME && state == RCState::PAUSED_S) {
90 return ENABLED;
91 } else if (cmd == ABORT) {
92 return ENABLED;
93 } else if (cmd == RECOVER && state == RCState::ERROR_ES) {
94 return ENABLED;
95 } else if (cmd == BOOT && state == RCState::NOTREADY_S) {
96 return ENABLED;
97 } else {
98 return DISABLED;
99 }
100}

◆ nextState()

RCState nextState ( ) const

Definition at line 102 of file RCCommand.cc.

103{
104 const RCCommand& cmd(*this);
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;
115}

◆ nextTState()

RCState nextTState ( ) const

Definition at line 117 of file RCCommand.cc.

118{
119 const RCCommand& cmd(*this);
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;
130}

◆ operator=() [1/4]

const RCCommand & operator= ( const char *  label)

Definition at line 65 of file RCCommand.cc.

66{
67 if (label != NULL) *this = std::string(label);
68 else *this = Enum::UNKNOWN;
69 return *this;
70}

◆ operator=() [2/4]

const RCCommand & operator= ( const RCCommand command)

Operator =.

Definition at line 25 of file RCCommand.cc.

26{
27 NSMCommand::operator=(command);
28 return *this;
29}
const NSMCommand & operator=(const NSMCommand &command)
Operator =.
Definition: NSMCommand.cc:32

◆ operator=() [3/4]

const RCCommand & operator= ( const std::string &  label)

Definition at line 31 of file RCCommand.cc.

32{
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;
45 return *this;
46}

◆ operator=() [4/4]

const RCCommand & operator= ( int  id)

Definition at line 48 of file RCCommand.cc.

49{
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;
62 return *this;
63}

Member Data Documentation

◆ ABORT

const RCCommand ABORT
static

Definition at line 32 of file RCCommand.h.

◆ BOOT

const RCCommand BOOT
static

Definition at line 25 of file RCCommand.h.

◆ CONFIGURE

const RCCommand CONFIGURE
static

Definition at line 24 of file RCCommand.h.

◆ DATAGET

const NSMCommand DATAGET
staticinherited

Definition at line 36 of file NSMCommand.h.

◆ DATASET

const NSMCommand DATASET
staticinherited

Definition at line 37 of file NSMCommand.h.

◆ DBGET

const NSMCommand DBGET
staticinherited

Definition at line 38 of file NSMCommand.h.

◆ DBLISTGET

const NSMCommand DBLISTGET
staticinherited

Definition at line 40 of file NSMCommand.h.

◆ DBLISTSET

const NSMCommand DBLISTSET
staticinherited

Definition at line 41 of file NSMCommand.h.

◆ DBSET

const NSMCommand DBSET
staticinherited

Definition at line 39 of file NSMCommand.h.

◆ DISABLED

const int DISABLED = 0
staticinherited

Definition at line 47 of file NSMCommand.h.

◆ ENABLED

const int ENABLED = 1
staticinherited

Definition at line 46 of file NSMCommand.h.

◆ ERROR

const NSMCommand ERROR
staticinherited

Definition at line 24 of file NSMCommand.h.

◆ FATAL

const NSMCommand FATAL
staticinherited

Definition at line 25 of file NSMCommand.h.

◆ LOAD

const RCCommand LOAD
static

Definition at line 26 of file RCCommand.h.

◆ LOG

const NSMCommand LOG
staticinherited

Definition at line 26 of file NSMCommand.h.

◆ LOGGET

const NSMCommand LOGGET
staticinherited

Definition at line 28 of file NSMCommand.h.

◆ LOGLIST

const NSMCommand LOGLIST
staticinherited

Definition at line 42 of file NSMCommand.h.

◆ LOGSET

const NSMCommand LOGSET
staticinherited

Definition at line 27 of file NSMCommand.h.

◆ m_id

int m_id
privateinherited

Definition at line 45 of file Enum.h.

◆ m_label

std::string m_label
privateinherited

Definition at line 46 of file Enum.h.

◆ OK

const NSMCommand OK
staticinherited

Definition at line 22 of file NSMCommand.h.

◆ PAUSE

const RCCommand PAUSE
static

Definition at line 31 of file RCCommand.h.

◆ RECOVER

const RCCommand RECOVER
static

Definition at line 29 of file RCCommand.h.

◆ RESUME

const RCCommand RESUME
static

Definition at line 30 of file RCCommand.h.

◆ START

const RCCommand START
static

Definition at line 27 of file RCCommand.h.

◆ STATE

const NSMCommand STATE
staticinherited

Definition at line 23 of file NSMCommand.h.

◆ STATUS

const RCCommand STATUS
static

Definition at line 33 of file RCCommand.h.

◆ STOP

const RCCommand STOP
static

Definition at line 28 of file RCCommand.h.

◆ SUGGESTED

const int SUGGESTED = 2
staticinherited

Definition at line 45 of file NSMCommand.h.

◆ UNKNOWN

const Enum UNKNOWN
staticinherited

Definition at line 22 of file Enum.h.

◆ VGET

const NSMCommand VGET
staticinherited

Definition at line 31 of file NSMCommand.h.

◆ VLISTGET

const NSMCommand VLISTGET
staticinherited

Definition at line 29 of file NSMCommand.h.

◆ VLISTSET

const NSMCommand VLISTSET
staticinherited

Definition at line 30 of file NSMCommand.h.

◆ VREPLY

const NSMCommand VREPLY
staticinherited

Definition at line 33 of file NSMCommand.h.

◆ VSET

const NSMCommand VSET
staticinherited

Definition at line 32 of file NSMCommand.h.


The documentation for this class was generated from the following files: