BondSM_sm.py
Go to the documentation of this file.
1 # ex: set ro:
2 # DO NOT EDIT.
3 # generated by smc (http://smc.sourceforge.net/)
4 # from file : BondSM_sm.sm
5 
6 from smclib import statemap
7 
8 
10 
11  def Entry(self, fsm):
12  pass
13 
14  def Exit(self, fsm):
15  pass
16 
17  def ConnectTimeout(self, fsm):
18  self.Default(fsm)
19 
20  def Die(self, fsm):
21  self.Default(fsm)
22 
23  def DisconnectTimeout(self, fsm):
24  self.Default(fsm)
25 
26  def HeartbeatTimeout(self, fsm):
27  self.Default(fsm)
28 
29  def SisterAlive(self, fsm):
30  self.Default(fsm)
31 
32  def SisterDead(self, fsm):
33  self.Default(fsm)
34 
35  def Default(self, fsm):
36  msg = "\n\tState: %s\n\tTransition: %s" % (
37  fsm.getState().getName(), fsm.getTransition())
39 
40 
42  pass
43 
44 
45 class SM_WaitingForSister(SM_Default):
46 
47  def ConnectTimeout(self, fsm):
48  ctxt = fsm.getOwner()
49  fsm.getState().Exit(fsm)
50  fsm.clearState()
51  try:
52  ctxt.Death()
53  finally:
54  fsm.setState(SM.Dead)
55  fsm.getState().Entry(fsm)
56 
57  def Die(self, fsm):
58  ctxt = fsm.getOwner()
59  fsm.getState().Exit(fsm)
60  fsm.clearState()
61  try:
62  ctxt.Death()
63  finally:
64  fsm.setState(SM.Dead)
65  fsm.getState().Entry(fsm)
66 
67  def SisterAlive(self, fsm):
68  ctxt = fsm.getOwner()
69  fsm.getState().Exit(fsm)
70  fsm.clearState()
71  try:
72  ctxt.Connected()
73  finally:
74  fsm.setState(SM.Alive)
75  fsm.getState().Entry(fsm)
76 
77  def SisterDead(self, fsm):
78  ctxt = fsm.getOwner()
79  fsm.getState().Exit(fsm)
80  fsm.clearState()
81  try:
82  ctxt.Connected()
83  ctxt.SisterDied()
84  ctxt.Death()
85  finally:
86  fsm.setState(SM.Dead)
87  fsm.getState().Entry(fsm)
88 
89 
91 
92  def Die(self, fsm):
93  ctxt = fsm.getOwner()
94  fsm.getState().Exit(fsm)
95  fsm.clearState()
96  try:
97  ctxt.StartDying()
98  finally:
99  fsm.setState(SM.AwaitSisterDeath)
100  fsm.getState().Entry(fsm)
101 
102  def HeartbeatTimeout(self, fsm):
103  ctxt = fsm.getOwner()
104  fsm.getState().Exit(fsm)
105  fsm.clearState()
106  try:
107  ctxt.Death()
108  finally:
109  fsm.setState(SM.Dead)
110  fsm.getState().Entry(fsm)
111 
112  def SisterAlive(self, fsm):
113  ctxt = fsm.getOwner()
114  fsm.getState().Exit(fsm)
115  fsm.clearState()
116  try:
117  ctxt.Heartbeat()
118  finally:
119  fsm.setState(SM.Alive)
120  fsm.getState().Entry(fsm)
121 
122  def SisterDead(self, fsm):
123  ctxt = fsm.getOwner()
124  fsm.getState().Exit(fsm)
125  fsm.clearState()
126  try:
127  ctxt.SisterDied()
128  ctxt.Death()
129  finally:
130  fsm.setState(SM.Dead)
131  fsm.getState().Entry(fsm)
132 
133 
135 
136  def Die(self, fsm):
137  fsm.getState().Exit(fsm)
138  fsm.setState(SM.AwaitSisterDeath)
139  fsm.getState().Entry(fsm)
140 
141  def DisconnectTimeout(self, fsm):
142  ctxt = fsm.getOwner()
143  fsm.getState().Exit(fsm)
144  fsm.clearState()
145  try:
146  ctxt.Death()
147  finally:
148  fsm.setState(SM.Dead)
149  fsm.getState().Entry(fsm)
150 
151  def HeartbeatTimeout(self, fsm):
152  fsm.getState().Exit(fsm)
153  fsm.setState(SM.AwaitSisterDeath)
154  fsm.getState().Entry(fsm)
155 
156  def SisterAlive(self, fsm):
157  fsm.getState().Exit(fsm)
158  fsm.setState(SM.AwaitSisterDeath)
159  fsm.getState().Entry(fsm)
160 
161  def SisterDead(self, fsm):
162  ctxt = fsm.getOwner()
163  fsm.getState().Exit(fsm)
164  fsm.clearState()
165  try:
166  ctxt.Death()
167  finally:
168  fsm.setState(SM.Dead)
169  fsm.getState().Entry(fsm)
170 
171 
173 
174  def ConnectTimeout(self, fsm):
175  fsm.getState().Exit(fsm)
176  fsm.setState(SM.Dead)
177  fsm.getState().Entry(fsm)
178 
179  def Die(self, fsm):
180  fsm.getState().Exit(fsm)
181  fsm.setState(SM.Dead)
182  fsm.getState().Entry(fsm)
183 
184  def DisconnectTimeout(self, fsm):
185  fsm.getState().Exit(fsm)
186  fsm.setState(SM.Dead)
187  fsm.getState().Entry(fsm)
188 
189  def HeartbeatTimeout(self, fsm):
190  fsm.getState().Exit(fsm)
191  fsm.setState(SM.Dead)
192  fsm.getState().Entry(fsm)
193 
194  def SisterAlive(self, fsm):
195  fsm.getState().Exit(fsm)
196  fsm.setState(SM.Dead)
197  fsm.getState().Entry(fsm)
198 
199  def SisterDead(self, fsm):
200  fsm.getState().Exit(fsm)
201  fsm.setState(SM.Dead)
202  fsm.getState().Entry(fsm)
203 
204 
205 class SM(object):
206 
207  WaitingForSister = SM_WaitingForSister('SM.WaitingForSister', 0)
208  Alive = SM_Alive('SM.Alive', 1)
209  AwaitSisterDeath = SM_AwaitSisterDeath('SM.AwaitSisterDeath', 2)
210  Dead = SM_Dead('SM.Dead', 3)
211  Default = SM_Default('SM.Default', -1)
212 
213 
215 
216  def __init__(self, owner):
217  statemap.FSMContext.__init__(self, SM.WaitingForSister)
218  self._owner = owner
219 
220  def __getattr__(self, attrib):
221  def trans_sm(*arglist):
222  self._transition = attrib
223  getattr(self.getState(), attrib)(self, *arglist)
224  self._transition = None
225  return trans_sm
226 
227  def enterStartState(self):
228  self._state.Entry(self)
229 
230  def getOwner(self):
231  return self._owner
232 
233 # Local variables:
234 # buffer-read-only: t
235 # End:
def SisterDead(self, fsm)
Definition: BondSM_sm.py:199
def SisterAlive(self, fsm)
Definition: BondSM_sm.py:29
virtual void enterStartState()=0
def SisterDead(self, fsm)
Definition: BondSM_sm.py:32
def Die(self, fsm)
Definition: BondSM_sm.py:92
const char * getName() const
def SisterAlive(self, fsm)
Definition: BondSM_sm.py:112
def __init__(self, owner)
Definition: BondSM_sm.py:216
def SisterAlive(self, fsm)
Definition: BondSM_sm.py:194
def DisconnectTimeout(self, fsm)
Definition: BondSM_sm.py:184
def __getattr__(self, attrib)
Definition: BondSM_sm.py:220
def ConnectTimeout(self, fsm)
Definition: BondSM_sm.py:17
def Default(self, fsm)
Definition: BondSM_sm.py:35
def HeartbeatTimeout(self, fsm)
Definition: BondSM_sm.py:189
def ConnectTimeout(self, fsm)
Definition: BondSM_sm.py:174
def SisterDead(self, fsm)
Definition: BondSM_sm.py:122
def DisconnectTimeout(self, fsm)
Definition: BondSM_sm.py:23
def Die(self, fsm)
Definition: BondSM_sm.py:179
def HeartbeatTimeout(self, fsm)
Definition: BondSM_sm.py:26
def HeartbeatTimeout(self, fsm)
Definition: BondSM_sm.py:102


bondpy
Author(s): Stuart Glaser
autogenerated on Wed Mar 20 2019 07:55:37