BondSM_sm.h
Go to the documentation of this file.
1 #ifndef BONDCPP__BONDSM_SM_H_
2 #define BONDCPP__BONDSM_SM_H_
3 
4 /*
5  * ex: set ro:
6  * DO NOT EDIT.
7  * generated by smc (http://smc.sourceforge.net/)
8  * from file : BondSM_sm.sm
9  */
10 
11 
12 #define SMC_USES_IOSTREAMS
13 
14 #include <smclib/statemap.h>
15 
16 // Forward declarations.
17 class SM;
19 class SM_Alive;
21 class SM_Dead;
22 class SM_Default;
23 class BondSMState;
24 class BondSMContext;
25 class BondSM;
26 
27 class BondSMState :
28  public statemap::State
29 {
30 public:
31  BondSMState(const char *name, int stateId)
32  : statemap::State(name, stateId)
33  {};
34 
35  virtual void Entry(BondSMContext&) {}
36  virtual void Exit(BondSMContext&) {}
37 
38  virtual void ConnectTimeout(BondSMContext& context);
39  virtual void Die(BondSMContext& context);
40  virtual void DisconnectTimeout(BondSMContext& context);
41  virtual void HeartbeatTimeout(BondSMContext& context);
42  virtual void SisterAlive(BondSMContext& context);
43  virtual void SisterDead(BondSMContext& context);
44 
45 protected:
46  virtual void Default(BondSMContext& context);
47 };
48 
49 class SM
50 {
51 public:
53  static SM_Alive Alive;
55  static SM_Dead Dead;
56 };
57 
58 class SM_Default :
59  public BondSMState
60 {
61 public:
62  SM_Default(const char *name, int stateId)
63  : BondSMState(name, stateId)
64  {};
65 };
66 
68  public SM_Default
69 {
70 public:
71  SM_WaitingForSister(const char *name, int stateId)
72  : SM_Default(name, stateId)
73  {};
74 
75  void ConnectTimeout(BondSMContext& context);
76  void Die(BondSMContext& context);
77  void SisterAlive(BondSMContext& context);
78  void SisterDead(BondSMContext& context);
79 };
80 
81 class SM_Alive :
82  public SM_Default
83 {
84 public:
85  SM_Alive(const char *name, int stateId)
86  : SM_Default(name, stateId)
87  {};
88 
89  void Die(BondSMContext& context);
90  void HeartbeatTimeout(BondSMContext& context);
91  void SisterAlive(BondSMContext& context);
92  void SisterDead(BondSMContext& context);
93 };
94 
96  public SM_Default
97 {
98 public:
99  SM_AwaitSisterDeath(const char *name, int stateId)
100  : SM_Default(name, stateId)
101  {};
102 
103  void Die(BondSMContext& context);
104  void DisconnectTimeout(BondSMContext& context);
105  void HeartbeatTimeout(BondSMContext& context);
106  void SisterAlive(BondSMContext& context);
107  void SisterDead(BondSMContext& context);
108 };
109 
110 class SM_Dead :
111  public SM_Default
112 {
113 public:
114  SM_Dead(const char *name, int stateId)
115  : SM_Default(name, stateId)
116  {};
117 
118  void ConnectTimeout(BondSMContext& context);
119  void Die(BondSMContext& context);
120  void DisconnectTimeout(BondSMContext& context);
121  void HeartbeatTimeout(BondSMContext& context);
122  void SisterAlive(BondSMContext& context);
123  void SisterDead(BondSMContext& context);
124 };
125 
127  public statemap::FSMContext
128 {
129 public:
131  : FSMContext(SM::WaitingForSister),
132  _owner(owner)
133  {};
134 
135  BondSMContext(BondSM& owner, const statemap::State& state)
136  : FSMContext(state),
137  _owner(owner)
138  {};
139 
140  virtual void enterStartState()
141  {
142  getState().Entry(*this);
143  return;
144  }
145 
146  BondSM& getOwner() const
147  {
148  return (_owner);
149  };
150 
152  {
153  if (_state == NULL)
154  {
156  }
157 
158  return (dynamic_cast<BondSMState&>(*_state));
159  };
160 
162  {
163  (getState()).ConnectTimeout(*this);
164  };
165 
166  void Die()
167  {
168  (getState()).Die(*this);
169  };
170 
172  {
173  (getState()).DisconnectTimeout(*this);
174  };
175 
177  {
178  (getState()).HeartbeatTimeout(*this);
179  };
180 
181  void SisterAlive()
182  {
183  (getState()).SisterAlive(*this);
184  };
185 
186  void SisterDead()
187  {
188  (getState()).SisterDead(*this);
189  };
190 
191 private:
192  BondSM& _owner;
193 };
194 
195 
196 /*
197  * Local variables:
198  * buffer-read-only: t
199  * End:
200  */
201 
202 #endif // BONDCPP__BONDSM_SM_H_
void DisconnectTimeout()
Definition: BondSM_sm.h:171
virtual void enterStartState()
Definition: BondSM_sm.h:140
void ConnectTimeout()
Definition: BondSM_sm.h:161
SM_Dead(const char *name, int stateId)
Definition: BondSM_sm.h:114
Definition: bond.h:200
BondSMContext(BondSM &owner)
Definition: BondSM_sm.h:130
void SisterAlive()
Definition: BondSM_sm.h:181
BondSMState(const char *name, int stateId)
Definition: BondSM_sm.h:31
virtual void Die(BondSMContext &context)
Definition: BondSM_sm.cpp:23
virtual void Default(BondSMContext &context)
Definition: BondSM_sm.cpp:53
virtual void SisterDead(BondSMContext &context)
Definition: BondSM_sm.cpp:47
BondSM & getOwner() const
Definition: BondSM_sm.h:146
void Die()
Definition: BondSM_sm.h:166
virtual void DisconnectTimeout(BondSMContext &context)
Definition: BondSM_sm.cpp:29
virtual void Exit(BondSMContext &)
Definition: BondSM_sm.h:36
virtual void SisterAlive(BondSMContext &context)
Definition: BondSM_sm.cpp:41
static SM_WaitingForSister WaitingForSister
Definition: BondSM_sm.h:52
void SisterDead()
Definition: BondSM_sm.h:186
static SM_Alive Alive
Definition: BondSM_sm.h:53
virtual void Entry(BondSMContext &)
Definition: BondSM_sm.h:35
SM_WaitingForSister(const char *name, int stateId)
Definition: BondSM_sm.h:71
static SM_AwaitSisterDeath AwaitSisterDeath
Definition: BondSM_sm.h:54
void HeartbeatTimeout()
Definition: BondSM_sm.h:176
BondSMContext(BondSM &owner, const statemap::State &state)
Definition: BondSM_sm.h:135
virtual void HeartbeatTimeout(BondSMContext &context)
Definition: BondSM_sm.cpp:35
static SM_Dead Dead
Definition: BondSM_sm.h:55
BondSMState & getState() const
Definition: BondSM_sm.h:151
BondSM & _owner
Definition: BondSM_sm.h:189
SM_AwaitSisterDeath(const char *name, int stateId)
Definition: BondSM_sm.h:99
virtual void ConnectTimeout(BondSMContext &context)
Definition: BondSM_sm.cpp:17
Definition: BondSM_sm.h:49
SM_Default(const char *name, int stateId)
Definition: BondSM_sm.h:62
SM_Alive(const char *name, int stateId)
Definition: BondSM_sm.h:85


bondcpp
Author(s): Stuart Glaser
autogenerated on Wed Sep 2 2020 03:40:44