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 from smclib 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     def SisterDead(self, fsm):
00076         ctxt = fsm.getOwner()
00077         fsm.getState().Exit(fsm)
00078         fsm.clearState()
00079         try:
00080             ctxt.Connected()
00081             ctxt.SisterDied()
00082             ctxt.Death()
00083         finally:
00084             fsm.setState(SM.Dead)
00085             fsm.getState().Entry(fsm)
00086 
00087 class SM_Alive(SM_Default):
00088 
00089     def Die(self, fsm):
00090         ctxt = fsm.getOwner()
00091         fsm.getState().Exit(fsm)
00092         fsm.clearState()
00093         try:
00094             ctxt.StartDying()
00095         finally:
00096             fsm.setState(SM.AwaitSisterDeath)
00097             fsm.getState().Entry(fsm)
00098 
00099     def HeartbeatTimeout(self, fsm):
00100         ctxt = fsm.getOwner()
00101         fsm.getState().Exit(fsm)
00102         fsm.clearState()
00103         try:
00104             ctxt.Death()
00105         finally:
00106             fsm.setState(SM.Dead)
00107             fsm.getState().Entry(fsm)
00108 
00109     def SisterAlive(self, fsm):
00110         ctxt = fsm.getOwner()
00111         fsm.getState().Exit(fsm)
00112         fsm.clearState()
00113         try:
00114             ctxt.Heartbeat()
00115         finally:
00116             fsm.setState(SM.Alive)
00117             fsm.getState().Entry(fsm)
00118 
00119     def SisterDead(self, fsm):
00120         ctxt = fsm.getOwner()
00121         fsm.getState().Exit(fsm)
00122         fsm.clearState()
00123         try:
00124             ctxt.SisterDied()
00125             ctxt.Death()
00126         finally:
00127             fsm.setState(SM.Dead)
00128             fsm.getState().Entry(fsm)
00129 
00130 class SM_AwaitSisterDeath(SM_Default):
00131 
00132     def Die(self, fsm):
00133         fsm.getState().Exit(fsm)
00134         fsm.setState(SM.AwaitSisterDeath)
00135         fsm.getState().Entry(fsm)
00136 
00137     def DisconnectTimeout(self, fsm):
00138         ctxt = fsm.getOwner()
00139         fsm.getState().Exit(fsm)
00140         fsm.clearState()
00141         try:
00142             ctxt.Death()
00143         finally:
00144             fsm.setState(SM.Dead)
00145             fsm.getState().Entry(fsm)
00146 
00147     def HeartbeatTimeout(self, fsm):
00148         fsm.getState().Exit(fsm)
00149         fsm.setState(SM.AwaitSisterDeath)
00150         fsm.getState().Entry(fsm)
00151 
00152     def SisterAlive(self, fsm):
00153         fsm.getState().Exit(fsm)
00154         fsm.setState(SM.AwaitSisterDeath)
00155         fsm.getState().Entry(fsm)
00156 
00157     def SisterDead(self, fsm):
00158         ctxt = fsm.getOwner()
00159         fsm.getState().Exit(fsm)
00160         fsm.clearState()
00161         try:
00162             ctxt.Death()
00163         finally:
00164             fsm.setState(SM.Dead)
00165             fsm.getState().Entry(fsm)
00166 
00167 class SM_Dead(SM_Default):
00168 
00169     def ConnectTimeout(self, fsm):
00170         fsm.getState().Exit(fsm)
00171         fsm.setState(SM.Dead)
00172         fsm.getState().Entry(fsm)
00173 
00174     def Die(self, fsm):
00175         fsm.getState().Exit(fsm)
00176         fsm.setState(SM.Dead)
00177         fsm.getState().Entry(fsm)
00178 
00179     def DisconnectTimeout(self, fsm):
00180         fsm.getState().Exit(fsm)
00181         fsm.setState(SM.Dead)
00182         fsm.getState().Entry(fsm)
00183 
00184     def HeartbeatTimeout(self, fsm):
00185         fsm.getState().Exit(fsm)
00186         fsm.setState(SM.Dead)
00187         fsm.getState().Entry(fsm)
00188 
00189     def SisterAlive(self, fsm):
00190         fsm.getState().Exit(fsm)
00191         fsm.setState(SM.Dead)
00192         fsm.getState().Entry(fsm)
00193 
00194     def SisterDead(self, fsm):
00195         fsm.getState().Exit(fsm)
00196         fsm.setState(SM.Dead)
00197         fsm.getState().Entry(fsm)
00198 
00199 class SM(object):
00200 
00201     WaitingForSister = SM_WaitingForSister('SM.WaitingForSister', 0)
00202     Alive = SM_Alive('SM.Alive', 1)
00203     AwaitSisterDeath = SM_AwaitSisterDeath('SM.AwaitSisterDeath', 2)
00204     Dead = SM_Dead('SM.Dead', 3)
00205     Default = SM_Default('SM.Default', -1)
00206 
00207 class BondSM_sm(statemap.FSMContext):
00208 
00209     def __init__(self, owner):
00210         statemap.FSMContext.__init__(self, SM.WaitingForSister)
00211         self._owner = owner
00212 
00213     def __getattr__(self, attrib):
00214         def trans_sm(*arglist):
00215             self._transition = attrib
00216             getattr(self.getState(), attrib)(self, *arglist)
00217             self._transition = None
00218         return trans_sm
00219 
00220     def enterStartState(self):
00221         self._state.Entry(self)
00222 
00223     def getOwner(self):
00224         return self._owner
00225 
00226 # Local variables:
00227 #  buffer-read-only: t
00228 # End:


bondpy
Author(s): Stuart Glaser
autogenerated on Sun Oct 5 2014 22:32:32