BondSM_sm.h
Go to the documentation of this file.
00001 #ifndef BONDCPP__BONDSM_SM_H_
00002 #define BONDCPP__BONDSM_SM_H_
00003 
00004 /*
00005  * ex: set ro:
00006  * DO NOT EDIT.
00007  * generated by smc (http://smc.sourceforge.net/)
00008  * from file : BondSM_sm.sm
00009  */
00010 
00011 
00012 #define SMC_USES_IOSTREAMS
00013 
00014 #include <smclib/statemap.h>
00015 
00016 // Forward declarations.
00017 class SM;
00018 class SM_WaitingForSister;
00019 class SM_Alive;
00020 class SM_AwaitSisterDeath;
00021 class SM_Dead;
00022 class SM_Default;
00023 class BondSMState;
00024 class BondSMContext;
00025 class BondSM;
00026 
00027 class BondSMState :
00028     public statemap::State
00029 {
00030 public:
00031     BondSMState(const char *name, int stateId)
00032     : statemap::State(name, stateId)
00033     {};
00034 
00035     virtual void Entry(BondSMContext&) {}
00036     virtual void Exit(BondSMContext&) {}
00037 
00038     virtual void ConnectTimeout(BondSMContext& context);
00039     virtual void Die(BondSMContext& context);
00040     virtual void DisconnectTimeout(BondSMContext& context);
00041     virtual void HeartbeatTimeout(BondSMContext& context);
00042     virtual void SisterAlive(BondSMContext& context);
00043     virtual void SisterDead(BondSMContext& context);
00044 
00045 protected:
00046     virtual void Default(BondSMContext& context);
00047 };
00048 
00049 class SM
00050 {
00051 public:
00052     static SM_WaitingForSister WaitingForSister;
00053     static SM_Alive Alive;
00054     static SM_AwaitSisterDeath AwaitSisterDeath;
00055     static SM_Dead Dead;
00056 };
00057 
00058 class SM_Default :
00059     public BondSMState
00060 {
00061 public:
00062     SM_Default(const char *name, int stateId)
00063     : BondSMState(name, stateId)
00064     {};
00065 };
00066 
00067 class SM_WaitingForSister :
00068     public SM_Default
00069 {
00070 public:
00071     SM_WaitingForSister(const char *name, int stateId)
00072     : SM_Default(name, stateId)
00073     {};
00074 
00075     void ConnectTimeout(BondSMContext& context);
00076     void Die(BondSMContext& context);
00077     void SisterAlive(BondSMContext& context);
00078     void SisterDead(BondSMContext& context);
00079 };
00080 
00081 class SM_Alive :
00082     public SM_Default
00083 {
00084 public:
00085     SM_Alive(const char *name, int stateId)
00086     : SM_Default(name, stateId)
00087     {};
00088 
00089     void Die(BondSMContext& context);
00090     void HeartbeatTimeout(BondSMContext& context);
00091     void SisterAlive(BondSMContext& context);
00092     void SisterDead(BondSMContext& context);
00093 };
00094 
00095 class SM_AwaitSisterDeath :
00096     public SM_Default
00097 {
00098 public:
00099     SM_AwaitSisterDeath(const char *name, int stateId)
00100     : SM_Default(name, stateId)
00101     {};
00102 
00103     void Die(BondSMContext& context);
00104     void DisconnectTimeout(BondSMContext& context);
00105     void HeartbeatTimeout(BondSMContext& context);
00106     void SisterAlive(BondSMContext& context);
00107     void SisterDead(BondSMContext& context);
00108 };
00109 
00110 class SM_Dead :
00111     public SM_Default
00112 {
00113 public:
00114     SM_Dead(const char *name, int stateId)
00115     : SM_Default(name, stateId)
00116     {};
00117 
00118     void ConnectTimeout(BondSMContext& context);
00119     void Die(BondSMContext& context);
00120     void DisconnectTimeout(BondSMContext& context);
00121     void HeartbeatTimeout(BondSMContext& context);
00122     void SisterAlive(BondSMContext& context);
00123     void SisterDead(BondSMContext& context);
00124 };
00125 
00126 class BondSMContext :
00127     public statemap::FSMContext
00128 {
00129 public:
00130     BondSMContext(BondSM& owner)
00131     : FSMContext(SM::WaitingForSister),
00132       _owner(owner)
00133     {};
00134 
00135     BondSMContext(BondSM& owner, const statemap::State& state)
00136     : FSMContext(state),
00137       _owner(owner)
00138     {};
00139 
00140     virtual void enterStartState()
00141     {
00142         getState().Entry(*this);
00143         return;
00144     }
00145 
00146     BondSM& getOwner() const
00147     {
00148         return (_owner);
00149     };
00150 
00151     BondSMState& getState() const
00152     {
00153         if (_state == NULL)
00154         {
00155             throw statemap::StateUndefinedException();
00156         }
00157 
00158         return (dynamic_cast<BondSMState&>(*_state));
00159     };
00160 
00161     void ConnectTimeout()
00162     {
00163         (getState()).ConnectTimeout(*this);
00164     };
00165 
00166     void Die()
00167     {
00168         (getState()).Die(*this);
00169     };
00170 
00171     void DisconnectTimeout()
00172     {
00173         (getState()).DisconnectTimeout(*this);
00174     };
00175 
00176     void HeartbeatTimeout()
00177     {
00178         (getState()).HeartbeatTimeout(*this);
00179     };
00180 
00181     void SisterAlive()
00182     {
00183         (getState()).SisterAlive(*this);
00184     };
00185 
00186     void SisterDead()
00187     {
00188         (getState()).SisterDead(*this);
00189     };
00190 
00191 private:
00192     BondSM& _owner;
00193 };
00194 
00195 
00196 /*
00197  * Local variables:
00198  *  buffer-read-only: t
00199  * End:
00200  */
00201 
00202 #endif  // BONDCPP__BONDSM_SM_H_


bondcpp
Author(s): Stuart Glaser
autogenerated on Thu Aug 17 2017 03:12:47