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 
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 
79 
80  def Die(self, fsm):
81  ctxt = fsm.getOwner()
82  fsm.getState().Exit(fsm)
83  fsm.clearState()
84  try:
85  ctxt.StartDying()
86  finally:
87  fsm.setState(SM.AwaitSisterDeath)
88  fsm.getState().Entry(fsm)
89 
90  def HeartbeatTimeout(self, fsm):
91  ctxt = fsm.getOwner()
92  fsm.getState().Exit(fsm)
93  fsm.clearState()
94  try:
95  ctxt.Death()
96  finally:
97  fsm.setState(SM.Dead)
98  fsm.getState().Entry(fsm)
99 
100  def SisterAlive(self, fsm):
101  ctxt = fsm.getOwner()
102  fsm.getState().Exit(fsm)
103  fsm.clearState()
104  try:
105  ctxt.Heartbeat()
106  finally:
107  fsm.setState(SM.Alive)
108  fsm.getState().Entry(fsm)
109 
110  def SisterDead(self, fsm):
111  ctxt = fsm.getOwner()
112  fsm.getState().Exit(fsm)
113  fsm.clearState()
114  try:
115  ctxt.SisterDied()
116  ctxt.Death()
117  finally:
118  fsm.setState(SM.Dead)
119  fsm.getState().Entry(fsm)
120 
121 
123 
124  def DisconnectTimeout(self, fsm):
125  ctxt = fsm.getOwner()
126  fsm.getState().Exit(fsm)
127  fsm.clearState()
128  try:
129  ctxt.Death()
130  finally:
131  fsm.setState(SM.Dead)
132  fsm.getState().Entry(fsm)
133 
134  def HeartbeatTimeout(self, fsm):
135  fsm.getState().Exit(fsm)
136  fsm.setState(SM.AwaitSisterDeath)
137  fsm.getState().Entry(fsm)
138 
139  def SisterAlive(self, fsm):
140  fsm.getState().Exit(fsm)
141  fsm.setState(SM.AwaitSisterDeath)
142  fsm.getState().Entry(fsm)
143 
144  def SisterDead(self, fsm):
145  ctxt = fsm.getOwner()
146  fsm.getState().Exit(fsm)
147  fsm.clearState()
148  try:
149  ctxt.Death()
150  finally:
151  fsm.setState(SM.Dead)
152  fsm.getState().Entry(fsm)
153 
154 
156 
157  def ConnectTimeout(self, fsm):
158  fsm.getState().Exit(fsm)
159  fsm.setState(SM.Dead)
160  fsm.getState().Entry(fsm)
161 
162  def Die(self, fsm):
163  fsm.getState().Exit(fsm)
164  fsm.setState(SM.Dead)
165  fsm.getState().Entry(fsm)
166 
167  def DisconnectTimeout(self, fsm):
168  fsm.getState().Exit(fsm)
169  fsm.setState(SM.Dead)
170  fsm.getState().Entry(fsm)
171 
172  def HeartbeatTimeout(self, fsm):
173  fsm.getState().Exit(fsm)
174  fsm.setState(SM.Dead)
175  fsm.getState().Entry(fsm)
176 
177  def SisterDead(self, fsm):
178  fsm.getState().Exit(fsm)
179  fsm.setState(SM.Dead)
180  fsm.getState().Entry(fsm)
181 
182 
183 class SM(object):
184 
185  WaitingForSister = SM_WaitingForSister('SM.WaitingForSister', 0)
186  Alive = SM_Alive('SM.Alive', 1)
187  AwaitSisterDeath = SM_AwaitSisterDeath('SM.AwaitSisterDeath', 2)
188  Dead = SM_Dead('SM.Dead', 3)
189  Default = SM_Default('SM.Default', -1)
190 
191 
193 
194  def __init__(self, owner):
195  statemap.FSMContext.__init__(self, SM.WaitingForSister)
196  self._owner = owner
197 
198  def __getattr__(self, attrib):
199  def trans_sm(*arglist):
200  self._transition = attrib
201  getattr(self.getState(), attrib)(self, *arglist)
202  self._transition = None
203  return trans_sm
204 
205  def enterStartState(self):
206  self._state.Entry(self)
207 
208  def getOwner(self):
209  return self._owner
210 
211 # Local variables:
212 # buffer-read-only: t
213 # End:
def SisterAlive(self, fsm)
Definition: BondSM_sm.py:29
virtual void enterStartState()=0
def HeartbeatTimeout(self, fsm)
Definition: BondSM_sm.py:134
def __init__(self, owner)
Definition: BondSM_sm.py:194
def __getattr__(self, attrib)
Definition: BondSM_sm.py:198
def ConnectTimeout(self, fsm)
Definition: BondSM_sm.py:17
def Entry(self, fsm)
Definition: BondSM_sm.py:11
def ConnectTimeout(self, fsm)
Definition: BondSM_sm.py:157
def Exit(self, fsm)
Definition: BondSM_sm.py:14
def Die(self, fsm)
Definition: BondSM_sm.py:20
const char * getName() const
def ConnectTimeout(self, fsm)
Definition: BondSM_sm.py:47
def getOwner(self)
Definition: BondSM_sm.py:208
def HeartbeatTimeout(self, fsm)
Definition: BondSM_sm.py:90
def SisterDead(self, fsm)
Definition: BondSM_sm.py:110
def DisconnectTimeout(self, fsm)
Definition: BondSM_sm.py:167
def DisconnectTimeout(self, fsm)
Definition: BondSM_sm.py:124
def SisterDead(self, fsm)
Definition: BondSM_sm.py:32
def SisterAlive(self, fsm)
Definition: BondSM_sm.py:100
def HeartbeatTimeout(self, fsm)
Definition: BondSM_sm.py:172
def SisterAlive(self, fsm)
Definition: BondSM_sm.py:67
def HeartbeatTimeout(self, fsm)
Definition: BondSM_sm.py:26
def DisconnectTimeout(self, fsm)
Definition: BondSM_sm.py:23
def SisterAlive(self, fsm)
Definition: BondSM_sm.py:139
def Die(self, fsm)
Definition: BondSM_sm.py:80
def Default(self, fsm)
Definition: BondSM_sm.py:35
def SisterDead(self, fsm)
Definition: BondSM_sm.py:177
def Die(self, fsm)
Definition: BondSM_sm.py:162


test_bond
Author(s): Stuart Glaser
autogenerated on Wed Sep 2 2020 03:40:47