SourceForge Project Site
Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

FSM::CFSMState Class Reference

#include <FSMState.h>

Inheritance diagram for FSM::CFSMState::

FSM::CFSMObject List of all members.

Public Methods

CFSMTransitionAddTransition (const char *onEvent="ANY", const char *className="SimpleTransition")
CFSMTransitionAddSimpleTransition (const char *toStateName, const char *onEvent="ANY")
int GetTransitionNumber () const
CFSMTransitionGetTransition (int index) const
bool DeleteTransition (CFSMTransition *trans)
 Delete one transition. More...

Transition_List::const_iterator GetTransitionsBegin () const
 Use (*iterator) to get the pointer to the transition. More...

Transition_List::const_iterator GetTransitionsEnd () const
CFSMActionAddEnterAction (const char *className)
 Create an action, that is executed at entering the state. More...

CFSMActionAddLeaveAction (const char *className)
 Create an action, that is executed at leaving the state. More...

bool DeleteAction (CFSMAction *action)
 Delete an action. More...

CFSMActionGetEnterAction (int index) const
CFSMActionGetLeaveAction (int index) const
Action_List::const_iterator GetEnterActionsBegin () const
 Use (*iterator) to get the pointer to the action. More...

Action_List::const_iterator GetEnterActionsEnd () const
Action_List::const_iterator GetLeaveActionsBegin () const
 Use (*iterator) to get the pointer to the action. More...

Action_List::const_iterator GetLeaveActionsEnd () const
const char * GetName () const
CFiniteStateMachineGetFSM () const
const char * GetNameOfClass () const
 The class name is set by FiniteStateMachine::Create(). More...

virtual bool SetParameter (const char *paramName, const char *paramValue)

Protected Methods

virtual void DeleteThis ()
 "Destructor" Simple call delete this. More...

void SetName (const char *name)
virtual bool GetTransition (CFSMTransition **trans, const char *event, void *a, void *b)
 Get the Transition, that would be triggered. More...

virtual bool Activate ()
 FSM has changed into this state. More...

virtual bool Deactivate ()
 FSM has changed the state. More...

 CFSMState ()
 Use create to create a new instance. More...

virtual ~CFSMState ()
 Use DeleteThis() method instead of delete, because of memory. More...

void SetFSM (CFiniteStateMachine *ptr)
void SetClassName (const char *name)
virtual bool SaveParameters (CFSMSaver *out) const
 Called by the saver. More...


Static Protected Methods

CFSMObjectCreate ()

Protected Attributes

Transition_List m_Transitions
 the list of transitions. More...

Action_List m_EnterActions
 the list of enter actions. More...

Action_List m_LeaveActions
 the list of leave actions. More...


Private Attributes

string m_Name

Friends

class CFiniteStateMachine

Constructor & Destructor Documentation

FSM::CFSMState::CFSMState   [protected]
 

Use create to create a new instance.

Definition at line 32 of file FSMState.cpp.

FSM::CFSMState::~CFSMState   [protected, virtual]
 

Use DeleteThis() method instead of delete, because of memory.

Definition at line 36 of file FSMState.cpp.

References m_EnterActions, m_LeaveActions, and m_Transitions.


Member Function Documentation

bool FSM::CFSMState::Activate   [protected, virtual]
 

FSM has changed into this state.

Enter Actions are executed.

Definition at line 387 of file FSMState.cpp.

References GetName(), FSM::CFSMObject::GetNameOfClass(), iRethrow, m_EnterActions, and m_Transitions.

CFSMAction * FSM::CFSMState::AddEnterAction const char *    className
 

Create an action, that is executed at entering the state.

Definition at line 214 of file FSMState.cpp.

References iRethrow.

CFSMAction * FSM::CFSMState::AddLeaveAction const char *    className
 

Create an action, that is executed at leaving the state.

Definition at line 230 of file FSMState.cpp.

References FSM::CFSMObject::GetFSM(), iRethrow, and m_LeaveActions.

CFSMTransition * FSM::CFSMState::AddSimpleTransition const char *    toStateName,
const char *    onEvent = "ANY"
 

Definition at line 77 of file FSMState.cpp.

References FSM::CFSMObject::GetFSM(), GetName(), iRethrow, and m_Transitions.

CFSMTransition * FSM::CFSMState::AddTransition const char *    onEvent = "ANY",
const char *    className = "SimpleTransition"
 

Definition at line 58 of file FSMState.cpp.

References iRethrow.

CFSMObject * FSM::CFSMState::Create   [static, protected]
 

Definition at line 457 of file FSMState.cpp.

bool FSM::CFSMState::Deactivate   [protected, virtual]
 

FSM has changed the state.

Leave Actions are executed.

Definition at line 420 of file FSMState.cpp.

References GetName(), FSM::CFSMObject::GetNameOfClass(), iRethrow, m_LeaveActions, and m_Transitions.

bool FSM::CFSMState::DeleteAction CFSMAction   action
 

Delete an action.

Definition at line 246 of file FSMState.cpp.

References CRITICAL, iThrow(), m_EnterActions, and m_LeaveActions.

void FSM::CFSMState::DeleteThis   [protected, virtual]
 

"Destructor" Simple call delete this.

This is needed because of the memory management in shared libraries. Provide a static method "Create" in derived classes that returns a new instance of that class and use DeleteThis to destroy it. The constructor and destructor shuld be protected.

Reimplemented from FSM::CFSMObject.

Definition at line 462 of file FSMState.cpp.

bool FSM::CFSMState::DeleteTransition CFSMTransition   trans
 

Delete one transition.

Definition at line 179 of file FSMState.cpp.

References CRITICAL, iThrow(), and m_Transitions.

CFSMAction * FSM::CFSMState::GetEnterAction int    index const
 

Returns:
the index-th enter action. index==0 -> first action. NULL if out of range

Definition at line 285 of file FSMState.cpp.

References CRITICAL, iThrow(), and m_EnterActions.

Action_List::const_iterator FSM::CFSMState::GetEnterActionsBegin   const
 

Use (*iterator) to get the pointer to the action.

Use ++iterator to get the next iterator.

Returns:
the begin-iterator of the actions container

Definition at line 327 of file FSMState.cpp.

References m_EnterActions.

Action_List::const_iterator FSM::CFSMState::GetEnterActionsEnd   const
 

Returns:
the end-iterator of the actions container

Definition at line 332 of file FSMState.cpp.

References m_EnterActions.

CFiniteStateMachine * FSM::CFSMObject::GetFSM   const [inherited]
 

Definition at line 56 of file FSMObject.cpp.

References FSM::CFSMObject::myStateMachine.

Referenced by AddLeaveAction(), AddSimpleTransition(), FSM::CFSMConditionTestVariable::CheckCondition(), FSM::CFSMPopTransition::Execute(), FSM::CFSMPushTransition::Execute(), FSM::CFSMSimpleTransition::Execute(), FSM::CFSMTransition::GetFromState(), and FSM::CFSMSimpleTransition::GetToState().

CFSMAction * FSM::CFSMState::GetLeaveAction int    index const
 

Returns:
the index-th leave action. index==0 -> first action. NULL if out of range

Definition at line 306 of file FSMState.cpp.

References CRITICAL, iThrow(), and m_LeaveActions.

Action_List::const_iterator FSM::CFSMState::GetLeaveActionsBegin   const
 

Use (*iterator) to get the pointer to the action.

Use ++iterator to get the next iterator.

Returns:
the begin-iterator of the actions container

Definition at line 337 of file FSMState.cpp.

References m_LeaveActions.

Action_List::const_iterator FSM::CFSMState::GetLeaveActionsEnd   const
 

Returns:
the end-iterator of the actions container

Definition at line 342 of file FSMState.cpp.

References m_LeaveActions.

const char * FSM::CFSMState::GetName   const
 

Definition at line 350 of file FSMState.cpp.

Referenced by Activate(), AddSimpleTransition(), and Deactivate().

const char * FSM::CFSMObject::GetNameOfClass   const [inherited]
 

The class name is set by FiniteStateMachine::Create().

So do not make Create methods public.

Definition at line 66 of file FSMObject.cpp.

References FSM::CFSMObject::ClassName.

Referenced by Activate(), FSM::CFSMConditionTestVariable::CheckCondition(), Deactivate(), FSM::CFSMSimpleTransition::SetParameter(), FSM::CFSMConditionTestVariable::SetParameter(), FSM::CFSMActionIncrVariable::SetParameter(), and FSM::CFSMActionSetVariable::SetParameter().

bool FSM::CFSMState::GetTransition CFSMTransition **    trans,
const char *    Event,
void *    a,
void *    b
[protected, virtual]
 

Get the Transition, that would be triggered.

Parameters:
trans  pointer, that is set by this method.
event  the id of the event
a  event parameter
b  event parameter
Returns:
false if no transition would be triggered.

Definition at line 363 of file FSMState.cpp.

References iRethrow.

CFSMTransition * FSM::CFSMState::GetTransition int    index const
 

Returns:
the index-th transition. index==0 -> first transition. NULL if out of range

Definition at line 119 of file FSMState.cpp.

References CRITICAL, iThrow(), and m_Transitions.

int FSM::CFSMState::GetTransitionNumber   const
 

Returns:
the number of transitions

Definition at line 114 of file FSMState.cpp.

References m_Transitions.

Transition_List::const_iterator FSM::CFSMState::GetTransitionsBegin   const
 

Use (*iterator) to get the pointer to the transition.

Use ++iterator to get the next iterator.

Returns:
the begin-iterator of the transitions container

Definition at line 201 of file FSMState.cpp.

References m_Transitions.

Transition_List::const_iterator FSM::CFSMState::GetTransitionsEnd   const
 

Returns:
the end-iterator of the transitions container

Definition at line 206 of file FSMState.cpp.

References m_Transitions.

bool FSM::CFSMObject::SaveParameters CFSMSaver   out const [protected, virtual, inherited]
 

Called by the saver.

Do not call directly. Overload and call out->SaveParameter() for each parameter.

Reimplemented in FSM::CFSMActionSetVariable, FSM::CFSMActionIncrVariable, FSM::CFSMConditionTestVariable, and FSM::CFSMSimpleTransition.

Definition at line 80 of file FSMObject.cpp.

void FSM::CFSMObject::SetClassName const char *    name [protected, inherited]
 

Definition at line 61 of file FSMObject.cpp.

References FSM::CFSMObject::ClassName.

void FSM::CFSMObject::SetFSM CFiniteStateMachine   ptr [protected, inherited]
 

Definition at line 51 of file FSMObject.cpp.

void FSM::CFSMState::SetName const char *    name [protected]
 

Definition at line 355 of file FSMState.cpp.

References m_Name.

bool FSM::CFSMObject::SetParameter const char *    paramName,
const char *    paramValue
[virtual, inherited]
 

Reimplemented in FSM::CFSMActionSetVariable, FSM::CFSMActionIncrVariable, FSM::CFSMConditionTestVariable, and FSM::CFSMSimpleTransition.

Definition at line 71 of file FSMObject.cpp.

References iThrow(), and WARNING.


Friends And Related Function Documentation

friend class CFiniteStateMachine [friend]
 

Reimplemented from FSM::CFSMObject.

Definition at line 82 of file FSMState.h.


Member Data Documentation

Action_List FSM::CFSMState::m_EnterActions [protected]
 

the list of enter actions.

Definition at line 181 of file FSMState.h.

Referenced by Activate(), DeleteAction(), GetEnterAction(), GetEnterActionsBegin(), GetEnterActionsEnd(), and ~CFSMState().

Action_List FSM::CFSMState::m_LeaveActions [protected]
 

the list of leave actions.

Definition at line 184 of file FSMState.h.

Referenced by AddLeaveAction(), Deactivate(), DeleteAction(), GetLeaveAction(), GetLeaveActionsBegin(), GetLeaveActionsEnd(), and ~CFSMState().

string FSM::CFSMState::m_Name [private]
 

Definition at line 194 of file FSMState.h.

Referenced by SetName().

Transition_List FSM::CFSMState::m_Transitions [protected]
 

the list of transitions.

Definition at line 178 of file FSMState.h.

Referenced by Activate(), AddSimpleTransition(), Deactivate(), DeleteTransition(), GetTransition(), GetTransitionNumber(), GetTransitionsBegin(), GetTransitionsEnd(), and ~CFSMState().


The documentation for this class was generated from the following files:
© 2002 by C-LAB
generated by doxygen