INTRODUCTION Overview Download and Install Quick Start Documentation Publications NONFRAMEWORK CODE Driver Interfaces Drivers Libraries Utilities FRAMEWORK CODE Interfaces Components Libraries Utilities Full Software Listings DEVELOPER Tutorials Examples Dev Guide Dashboard PEOPLE Contributors Users Project Download Mailing lists
|
browserfsm.h00001 /* 00002 * Orca-Robotics Project: Components for robotics 00003 * http://orca-robotics.sf.net/ 00004 * Copyright (c) 2004-2009 Alex Brooks, Alexei Makarenko, Tobias Kaupp 00005 00006 * This copy of Orca is licensed to you under the terms described in 00007 * the LICENSE file included in this distribution. 00008 */ 00009 00010 // Autogenerated by orcasmc which is based on smc by R. Martin. 00011 // See http://www.objectmentor.com/resources/downloads/index. 00012 00013 #ifndef ORCASMC_AUTOGEN_BROWSERFSM_FSM_H 00014 #define ORCASMC_AUTOGEN_BROWSERFSM_FSM_H 00015 00016 #include <IceUtil/Mutex.h> 00017 00018 class BrowserFsm; 00019 00020 class BrowserFsmState 00021 { 00022 public: 00023 virtual ~BrowserFsmState() {}; 00024 virtual const char* StateName() const = 0; 00025 virtual void top(BrowserFsm& s); 00026 virtual void up(BrowserFsm& s); 00027 virtual void deactivate(BrowserFsm& s); 00028 virtual void fault(BrowserFsm& s); 00029 virtual void filter(BrowserFsm& s); 00030 virtual void reload(BrowserFsm& s); 00031 virtual void pick(BrowserFsm& s); 00032 virtual void activate(BrowserFsm& s); 00033 }; 00034 00035 class BrowserFsmOperationState : public BrowserFsmState 00036 { 00037 public: 00038 virtual const char* StateName() const 00039 {return("Operation");}; 00040 virtual void deactivate(BrowserFsm&); 00041 virtual void fault(BrowserFsm&); 00042 virtual void top(BrowserFsm&); 00043 virtual void up(BrowserFsm&); 00044 virtual void reload(BrowserFsm&); 00045 }; 00046 00047 class BrowserFsmInterfaceState : public BrowserFsmState 00048 { 00049 public: 00050 virtual const char* StateName() const 00051 {return("Interface");}; 00052 virtual void deactivate(BrowserFsm&); 00053 virtual void fault(BrowserFsm&); 00054 virtual void top(BrowserFsm&); 00055 virtual void up(BrowserFsm&); 00056 virtual void reload(BrowserFsm&); 00057 virtual void pick(BrowserFsm&); 00058 }; 00059 00060 class BrowserFsmComponentState : public BrowserFsmState 00061 { 00062 public: 00063 virtual const char* StateName() const 00064 {return("Component");}; 00065 virtual void deactivate(BrowserFsm&); 00066 virtual void fault(BrowserFsm&); 00067 virtual void top(BrowserFsm&); 00068 virtual void up(BrowserFsm&); 00069 virtual void reload(BrowserFsm&); 00070 virtual void pick(BrowserFsm&); 00071 }; 00072 00073 class BrowserFsmPlatformState : public BrowserFsmState 00074 { 00075 public: 00076 virtual const char* StateName() const 00077 {return("Platform");}; 00078 virtual void deactivate(BrowserFsm&); 00079 virtual void fault(BrowserFsm&); 00080 virtual void up(BrowserFsm&); 00081 virtual void reload(BrowserFsm&); 00082 virtual void pick(BrowserFsm&); 00083 }; 00084 00085 class BrowserFsmRegistryState : public BrowserFsmState 00086 { 00087 public: 00088 virtual const char* StateName() const 00089 {return("Registry");}; 00090 virtual void deactivate(BrowserFsm&); 00091 virtual void fault(BrowserFsm&); 00092 virtual void filter(BrowserFsm&); 00093 virtual void reload(BrowserFsm&); 00094 virtual void pick(BrowserFsm&); 00095 }; 00096 00097 class BrowserFsmIdleState : public BrowserFsmState 00098 { 00099 public: 00100 virtual const char* StateName() const 00101 {return("Idle");}; 00102 virtual void activate(BrowserFsm&); 00103 }; 00104 00105 // Human-written FSM should derive from this class 00106 class BrowserFsm 00107 { 00108 friend class BrowserFsmState; 00109 friend class BrowserFsmOperationState; 00110 friend class BrowserFsmInterfaceState; 00111 friend class BrowserFsmComponentState; 00112 friend class BrowserFsmPlatformState; 00113 friend class BrowserFsmRegistryState; 00114 friend class BrowserFsmIdleState; 00115 00116 public: 00117 // default constructor sets initial state 00118 BrowserFsm() : itsState(&IdleState) {}; 00119 virtual ~BrowserFsm() {}; 00120 00121 // anybody can issue events to the FSM 00122 void top() {itsState->top(*this);} 00123 void up() {itsState->up(*this);} 00124 void deactivate() {itsState->deactivate(*this);} 00125 void fault() {itsState->fault(*this);} 00126 void filter() {itsState->filter(*this);} 00127 void reload() {itsState->reload(*this);} 00128 void pick() {itsState->pick(*this);} 00129 void activate() {itsState->activate(*this);} 00130 00131 protected: 00132 // Implement these actions in the derived class 00133 virtual void pickLastOperation() = 0; 00134 virtual void pickLastInterface() = 0; 00135 virtual void showOperation() = 0; 00136 virtual void loadOperation() = 0; 00137 virtual void pickLastComponent() = 0; 00138 virtual void showInterface() = 0; 00139 virtual void loadInterface() = 0; 00140 virtual void pickLastPlatform() = 0; 00141 virtual void showComponent() = 0; 00142 virtual void loadComponent() = 0; 00143 virtual void quit() = 0; 00144 virtual void filterRegistry() = 0; 00145 virtual void showPlatform() = 0; 00146 virtual void loadPlatform() = 0; 00147 virtual void showRegistry() = 0; 00148 virtual void loadRegistry() = 0; 00149 00150 // Overwrite the base implementation if needed. 00151 virtual void fsmError(const char* t, const char* s); 00152 00153 private: 00154 BrowserFsmState* itsState; 00155 BrowserFsmState& GetState() const {return *itsState;}; 00156 void SetState(BrowserFsmState& theState) {itsState=&theState;} 00157 IceUtil::Mutex mutex_; 00158 00159 static BrowserFsmOperationState OperationState; 00160 static BrowserFsmInterfaceState InterfaceState; 00161 static BrowserFsmComponentState ComponentState; 00162 static BrowserFsmPlatformState PlatformState; 00163 static BrowserFsmRegistryState RegistryState; 00164 static BrowserFsmIdleState IdleState; 00165 }; 00166 00167 #endif |
Webmaster: Tobias Kaupp (tobasco at users.sourceforge.net)