BondSM_sm.py
Go to the documentation of this file.
00001 # ex: set ro:
00002 # DO NOT EDIT.
00003 # generated by smc (http://smc.sourceforge.net/)
00004 # from file : BondSM_sm.sm
00005 
00006 import statemap
00007 
00008 
00009 class BondSMState(statemap.State):
00010 
00011     def Entry(self, fsm):
00012         pass
00013 
00014     def Exit(self, fsm):
00015         pass
00016 
00017     def ConnectTimeout(self, fsm):
00018         self.Default(fsm)
00019 
00020     def Die(self, fsm):
00021         self.Default(fsm)
00022 
00023     def DisconnectTimeout(self, fsm):
00024         self.Default(fsm)
00025 
00026     def HeartbeatTimeout(self, fsm):
00027         self.Default(fsm)
00028 
00029     def SisterAlive(self, fsm):
00030         self.Default(fsm)
00031 
00032     def SisterDead(self, fsm):
00033         self.Default(fsm)
00034 
00035     def Default(self, fsm):
00036         msg = "\n\tState: %s\n\tTransition: %s" % (
00037             fsm.getState().getName(), fsm.getTransition())
00038         raise statemap.TransitionUndefinedException, msg
00039 
00040 class SM_Default(BondSMState):
00041     pass
00042 
00043 class SM_WaitingForSister(SM_Default):
00044 
00045     def ConnectTimeout(self, fsm):
00046         ctxt = fsm.getOwner()
00047         fsm.getState().Exit(fsm)
00048         fsm.clearState()
00049         try:
00050             ctxt.Death()
00051         finally:
00052             fsm.setState(SM.Dead)
00053             fsm.getState().Entry(fsm)
00054 
00055     def Die(self, fsm):
00056         ctxt = fsm.getOwner()
00057         fsm.getState().Exit(fsm)
00058         fsm.clearState()
00059         try:
00060             ctxt.Death()
00061         finally:
00062             fsm.setState(SM.Dead)
00063             fsm.getState().Entry(fsm)
00064 
00065     def SisterAlive(self, fsm):
00066         ctxt = fsm.getOwner()
00067         fsm.getState().Exit(fsm)
00068         fsm.clearState()
00069         try:
00070             ctxt.Connected()
00071         finally:
00072             fsm.setState(SM.Alive)
00073             fsm.getState().Entry(fsm)
00074 
00075 class SM_Alive(SM_Default):
00076 
00077     def Die(self, fsm):
00078         ctxt = fsm.getOwner()
00079         fsm.getState().Exit(fsm)
00080         fsm.clearState()
00081         try:
00082             ctxt.StartDying()
00083         finally:
00084             fsm.setState(SM.AwaitSisterDeath)
00085             fsm.getState().Entry(fsm)
00086 
00087     def HeartbeatTimeout(self, fsm):
00088         ctxt = fsm.getOwner()
00089         fsm.getState().Exit(fsm)
00090         fsm.clearState()
00091         try:
00092             ctxt.Death()
00093         finally:
00094             fsm.setState(SM.Dead)
00095             fsm.getState().Entry(fsm)
00096 
00097     def SisterAlive(self, fsm):
00098         ctxt = fsm.getOwner()
00099         fsm.getState().Exit(fsm)
00100         fsm.clearState()
00101         try:
00102             ctxt.Heartbeat()
00103         finally:
00104             fsm.setState(SM.Alive)
00105             fsm.getState().Entry(fsm)
00106 
00107     def SisterDead(self, fsm):
00108         ctxt = fsm.getOwner()
00109         fsm.getState().Exit(fsm)
00110         fsm.clearState()
00111         try:
00112             ctxt.SisterDied()
00113             ctxt.Death()
00114         finally:
00115             fsm.setState(SM.Dead)
00116             fsm.getState().Entry(fsm)
00117 
00118 class SM_AwaitSisterDeath(SM_Default):
00119 
00120     def DisconnectTimeout(self, fsm):
00121         ctxt = fsm.getOwner()
00122         fsm.getState().Exit(fsm)
00123         fsm.clearState()
00124         try:
00125             ctxt.Death()
00126         finally:
00127             fsm.setState(SM.Dead)
00128             fsm.getState().Entry(fsm)
00129 
00130     def HeartbeatTimeout(self, fsm):
00131         fsm.getState().Exit(fsm)
00132         fsm.setState(SM.AwaitSisterDeath)
00133         fsm.getState().Entry(fsm)
00134 
00135     def SisterAlive(self, fsm):
00136         fsm.getState().Exit(fsm)
00137         fsm.setState(SM.AwaitSisterDeath)
00138         fsm.getState().Entry(fsm)
00139 
00140     def SisterDead(self, fsm):
00141         ctxt = fsm.getOwner()
00142         fsm.getState().Exit(fsm)
00143         fsm.clearState()
00144         try:
00145             ctxt.Death()
00146         finally:
00147             fsm.setState(SM.Dead)
00148             fsm.getState().Entry(fsm)
00149 
00150 class SM_Dead(SM_Default):
00151 
00152     def ConnectTimeout(self, fsm):
00153         fsm.getState().Exit(fsm)
00154         fsm.setState(SM.Dead)
00155         fsm.getState().Entry(fsm)
00156 
00157     def Die(self, fsm):
00158         fsm.getState().Exit(fsm)
00159         fsm.setState(SM.Dead)
00160         fsm.getState().Entry(fsm)
00161 
00162     def DisconnectTimeout(self, fsm):
00163         fsm.getState().Exit(fsm)
00164         fsm.setState(SM.Dead)
00165         fsm.getState().Entry(fsm)
00166 
00167     def HeartbeatTimeout(self, fsm):
00168         fsm.getState().Exit(fsm)
00169         fsm.setState(SM.Dead)
00170         fsm.getState().Entry(fsm)
00171 
00172     def SisterDead(self, fsm):
00173         fsm.getState().Exit(fsm)
00174         fsm.setState(SM.Dead)
00175         fsm.getState().Entry(fsm)
00176 
00177 class SM(object):
00178 
00179     WaitingForSister = SM_WaitingForSister('SM.WaitingForSister', 0)
00180     Alive = SM_Alive('SM.Alive', 1)
00181     AwaitSisterDeath = SM_AwaitSisterDeath('SM.AwaitSisterDeath', 2)
00182     Dead = SM_Dead('SM.Dead', 3)
00183     Default = SM_Default('SM.Default', -1)
00184 
00185 class BondSM_sm(statemap.FSMContext):
00186 
00187     def __init__(self, owner):
00188         statemap.FSMContext.__init__(self, SM.WaitingForSister)
00189         self._owner = owner
00190 
00191     def __getattr__(self, attrib):
00192         def trans_sm(*arglist):
00193             self._transition = attrib
00194             getattr(self.getState(), attrib)(self, *arglist)
00195             self._transition = None
00196         return trans_sm
00197 
00198     def enterStartState(self):
00199         self._state.Entry(self)
00200 
00201     def getOwner(self):
00202         return self._owner
00203 
00204 # Local variables:
00205 #  buffer-read-only: t
00206 # End:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Properties Friends


test_bond
Author(s): Stuart Glaser
autogenerated on Thu Aug 15 2013 10:10:43