#include <FiniteStateMachine.h>
Public Methods | |
CFiniteStateMachine () | |
~CFiniteStateMachine () | |
CFSMState * | AddState (const char *stateName, const char *className="State") |
CFSMState * | GetState (const char *stateName) const |
bool | DeleteState (CFSMState *state) |
bool | DeleteState (const char *stateName) |
State_Map::const_iterator | GetStatesBegin () const |
Use (*iterator) to get the pointer to the state. More... | |
State_Map::const_iterator | GetStatesEnd () const |
CFSMTransition * | AddTransition (const char *fromStateName, const char *onEvent="ANY", const char *className="SimpleTransition") |
CFSMTransition * | AddSimpleTransition (const char *fromStateName, const char *toStateName, const char *onEvent="ANY") |
bool | DeleteTransition (const char *fromState, int index) |
Delete the specified transition. More... | |
CFSMCondition * | AddCondition (const char *stateName, int transition, const char *className="TestVariable") |
Create a new condition of the given class and add it to a transition. More... | |
CFSMAction * | AddEnterAction (const char *stateName, const char *className) |
Create a new action to a state, that is executed each time the state is entered. More... | |
CFSMAction * | AddLeaveAction (const char *stateName, const char *className) |
Create a new action to a state, that is executed each time the state is leaved. More... | |
CFSMAction * | AddAction (const char *stateName, int transition, const char *className) |
Create a new action of the given class and add it to a transition. More... | |
bool | AddVariable (const char *varName, const int initValue=0) |
bool | DeleteVariable (const char *varName) |
bool | SetVariable (const char *varName, const int value) |
bool | GetVariable (const char *varName, int &value) const |
Var_Map::const_iterator | GetVarsBegin () const |
Var_Map::const_iterator | GetVarsEnd () const |
bool | SetInitialState (const char *stateName) |
const char * | GetInitialState () const |
bool | Start (const char *stateName=0) |
void | Stop () |
bool | ProcessEvent (const char *Event, void *a=NULL, void *b=NULL, bool *consumed=NULL) |
CFSMState * | GetCurrentState () const |
bool | Clear () |
bool | SwitchToState (CFSMState *newState) |
Set a new state. More... | |
bool | PushState (CFSMState *newState) |
Set a new state and push it onto the stack. More... | |
bool | PopState () |
Pop a state from the stack and switch to it. More... | |
void | Register (const char *className, FSMObjectCreateMethod create) |
CFSMObject * | Create (const char *className) |
create an object of certain class. More... | |
Protected Methods | |
bool | LoadClass (const char *className) |
Private Methods | |
void | RegisterBaseTypes () |
Private Attributes | |
FSMObjectCreate_Map | FSMObjectCreationMethods |
State_Map | m_States |
Var_Map | m_Variables |
CFSMState * | m_CurrentState |
string | m_InitialState |
bool | m_Running |
|
Definition at line 51 of file FiniteStateMachine.cpp. |
|
Definition at line 62 of file FiniteStateMachine.cpp. |
|
Create a new action of the given class and add it to a transition.
Definition at line 343 of file FiniteStateMachine.cpp. |
|
Create a new condition of the given class and add it to a transition.
Definition at line 281 of file FiniteStateMachine.cpp. References iRethrow. |
|
Create a new action to a state, that is executed each time the state is entered.
Definition at line 309 of file FiniteStateMachine.cpp. References iRethrow. |
|
Create a new action to a state, that is executed each time the state is leaved.
Definition at line 326 of file FiniteStateMachine.cpp. |
|
Definition at line 180 of file FiniteStateMachine.cpp. |
|
Definition at line 71 of file FiniteStateMachine.cpp. |
|
Definition at line 163 of file FiniteStateMachine.cpp. References iRethrow. |
|
Definition at line 371 of file FiniteStateMachine.cpp. References iThrow(), FSM::VM_VT, and WARNING. |
|
Definition at line 534 of file FiniteStateMachine.cpp. References CRITICAL, iThrow(), m_InitialState, m_Running, m_States, and m_Variables. |
|
create an object of certain class.
Definition at line 663 of file FiniteStateMachine.cpp. References FSM::FSMObjectCreateMethod, iRethrow, iThrow(), and WARNING. |
|
Definition at line 136 of file FiniteStateMachine.cpp. References DeleteState(), GetState(), and iRethrow. |
|
Definition at line 108 of file FiniteStateMachine.cpp. References CRITICAL, iThrow(), m_CurrentState, m_Running, and m_States. Referenced by DeleteState(). |
|
Delete the specified transition. NULL if not found or error.
Definition at line 244 of file FiniteStateMachine.cpp. |
|
Definition at line 382 of file FiniteStateMachine.cpp. References CRITICAL, iThrow(), and m_Variables. |
|
Definition at line 529 of file FiniteStateMachine.cpp. References m_CurrentState. |
|
Definition at line 453 of file FiniteStateMachine.cpp. References m_InitialState. |
|
Definition at line 89 of file FiniteStateMachine.cpp. References CRITICAL, iThrow(), and m_States. Referenced by AddAction(), AddLeaveAction(), AddSimpleTransition(), DeleteState(), DeleteTransition(), and Start(). |
|
Use (*iterator) to get the pointer to the state. Use ++iterator to get the next iterator.
Definition at line 150 of file FiniteStateMachine.cpp. References m_States. |
|
Definition at line 155 of file FiniteStateMachine.cpp. References m_States. |
|
Definition at line 412 of file FiniteStateMachine.cpp. References CRITICAL, iThrow(), and m_Variables. |
|
Definition at line 426 of file FiniteStateMachine.cpp. References m_Variables. |
|
Definition at line 431 of file FiniteStateMachine.cpp. References m_Variables. |
|
Definition at line 704 of file FiniteStateMachine.cpp. References iHandleLastError, and FSM::InitClassF. |
|
Pop a state from the stack and switch to it.
Definition at line 631 of file FiniteStateMachine.cpp. References iRethrow, and SwitchToState(). |
|
Definition at line 492 of file FiniteStateMachine.cpp. References CRITICAL, iRethrow, iThrow(), and m_CurrentState. Referenced by SwitchToState(). |
|
Set a new state and push it onto the stack.
Definition at line 618 of file FiniteStateMachine.cpp. References iRethrow, and SwitchToState(). |
|
Definition at line 649 of file FiniteStateMachine.cpp. References iThrow(), and WARNING. Referenced by RegisterBaseTypes(). |
|
Definition at line 572 of file FiniteStateMachine.cpp. References Register(). |
|
Definition at line 439 of file FiniteStateMachine.cpp. |
|
Definition at line 398 of file FiniteStateMachine.cpp. References CRITICAL, iThrow(), and m_Variables. |
|
Definition at line 458 of file FiniteStateMachine.cpp. References CRITICAL, GetState(), iRethrow, iThrow(), m_CurrentState, m_InitialState, and m_Running. |
|
Definition at line 482 of file FiniteStateMachine.cpp. References m_CurrentState, and m_Running. |
|
Set a new state.
Definition at line 583 of file FiniteStateMachine.cpp. References CRITICAL, iRethrow, iThrow(), m_CurrentState, and ProcessEvent(). |
|
Definition at line 262 of file FiniteStateMachine.h. |
|
Definition at line 265 of file FiniteStateMachine.h. Referenced by DeleteState(), GetCurrentState(), ProcessEvent(), Start(), Stop(), and SwitchToState(). |
|
Definition at line 266 of file FiniteStateMachine.h. Referenced by Clear(), GetInitialState(), and Start(). |
|
Definition at line 267 of file FiniteStateMachine.h. Referenced by Clear(), DeleteState(), Start(), and Stop(). |
|
Definition at line 263 of file FiniteStateMachine.h. Referenced by Clear(), DeleteState(), GetState(), GetStatesBegin(), and GetStatesEnd(). |
|
Definition at line 264 of file FiniteStateMachine.h. Referenced by Clear(), DeleteVariable(), GetVariable(), GetVarsBegin(), GetVarsEnd(), and SetVariable(). |