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

FSM::CFSMTransition Class Reference

Base class for transitions. More...

#include <FSMTransition.h>

Inheritance diagram for FSM::CFSMTransition::

FSM::CFSMObject FSM::CFSMPopTransition FSM::CFSMSimpleTransition FSM::CFSMPushTransition List of all members.

Public Methods

CFSMActionAddAction (const char *className)
CFSMActionGetAction (int index) const
bool DeleteAction (CFSMAction *action)
Action_List::const_iterator GetActionsBegin () const
 Use (*iterator) to get the pointer to the action. More...

Action_List::const_iterator GetActionsEnd () const
CFSMConditionAddCondition (const char *className="TestVariable")
CFSMConditionGetCondition (int index) const
bool DeleteCondition (CFSMCondition *condition)
Condition_List::const_iterator GetConditionsBegin () const
 Use (*iterator) to get the pointer to the condition. More...

Condition_List::const_iterator GetConditionsEnd () const
CFSMStateGetFromState () const
const char * GetOnEvent () const
void SetOnEvent (const char *event="ANY")
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

void SetFromState (const char *stateName)
virtual bool Check (bool &result, const char *event, void *a, void *b)
 the answer is in result!!! More...

virtual bool Execute (const char *event, void *a, void *b)
 Called if the transition match. More...

virtual bool Activate ()
 Called when the state is activated. More...

virtual bool Deactivate ()
 Called when the state is deactivated Calls Deactivate() of conditions (e.g. More...

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

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


Private Attributes

Action_List m_Actions
Condition_List m_Conditions
string m_FromState
string m_ToState
string m_Event

Friends

class CFSMState
class CFiniteStateMachine

Detailed Description

Base class for transitions.

Definition at line 81 of file FSMTransition.h.


Constructor & Destructor Documentation

FSM::CFSMTransition::CFSMTransition   [protected]
 

Definition at line 37 of file FSMTransition.cpp.

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

Definition at line 43 of file FSMTransition.cpp.

References m_Actions, m_Conditions, m_Event, and m_FromState.


Member Function Documentation

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

Called when the state is activated.

Calls Activate() of conditions (e.g. to start a timer)

Definition at line 286 of file FSMTransition.cpp.

References iRethrow.

CFSMAction * FSM::CFSMTransition::AddAction const char *    className
 

Definition at line 64 of file FSMTransition.cpp.

References iRethrow.

CFSMCondition * FSM::CFSMTransition::AddCondition const char *    className = "TestVariable"
 

Definition at line 135 of file FSMTransition.cpp.

References iRethrow.

bool FSM::CFSMTransition::Check bool &    retval,
const char *    event,
void *    a,
void *    b
[protected, virtual]
 

the answer is in result!!!

Returns:
is false if there where errors. Do not execute actions here, just check.

Definition at line 236 of file FSMTransition.cpp.

References iThrow(), and WARNING.

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

Called when the state is deactivated Calls Deactivate() of conditions (e.g.

to stop a timer)

Definition at line 301 of file FSMTransition.cpp.

References iRethrow, and m_Conditions.

bool FSM::CFSMTransition::DeleteAction CFSMAction   action
 

Definition at line 100 of file FSMTransition.cpp.

References CRITICAL, iThrow(), and m_Actions.

bool FSM::CFSMTransition::DeleteCondition CFSMCondition   condition
 

Definition at line 171 of file FSMTransition.cpp.

References CRITICAL, iThrow(), and m_Conditions.

virtual void FSM::CFSMObject::DeleteThis   [protected, pure virtual, inherited]
 

"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 in FSM::CFSMActionSetVariable, FSM::CFSMActionIncrVariable, FSM::CFSMConditionTestVariable, FSM::CFSMState, FSM::CFSMSimpleTransition, FSM::CFSMPushTransition, and FSM::CFSMPopTransition.

bool FSM::CFSMTransition::Execute const char *    event,
void *    a,
void *    b
[protected, virtual]
 

Called if the transition match.

Execute actions.

Reimplemented in FSM::CFSMSimpleTransition, FSM::CFSMPushTransition, and FSM::CFSMPopTransition.

Definition at line 263 of file FSMTransition.cpp.

References iRethrow, and m_Actions.

CFSMAction * FSM::CFSMTransition::GetAction int    index const
 

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

Definition at line 79 of file FSMTransition.cpp.

References CRITICAL, iThrow(), and m_Actions.

Action_List::const_iterator FSM::CFSMTransition::GetActionsBegin   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 122 of file FSMTransition.cpp.

References m_Actions.

Action_List::const_iterator FSM::CFSMTransition::GetActionsEnd   const
 

Returns:
the end-iterator of the actions container

Definition at line 127 of file FSMTransition.cpp.

References m_Actions.

CFSMCondition * FSM::CFSMTransition::GetCondition int    index const
 

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

Definition at line 150 of file FSMTransition.cpp.

References CRITICAL, iThrow(), and m_Conditions.

Condition_List::const_iterator FSM::CFSMTransition::GetConditionsBegin   const
 

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

Use ++iterator to get the next iterator.

Returns:
the begin-iterator of the conditions container

Definition at line 193 of file FSMTransition.cpp.

References m_Conditions.

Condition_List::const_iterator FSM::CFSMTransition::GetConditionsEnd   const
 

Returns:
the end-iterator of the conditions container

Definition at line 198 of file FSMTransition.cpp.

References m_Conditions.

CFSMState * FSM::CFSMTransition::GetFromState   const
 

Definition at line 216 of file FSMTransition.cpp.

References CFSMState, FSM::CFSMObject::GetFSM(), iRethrow, and m_FromState.

Referenced by FSM::CFSMSimpleTransition::GetToState().

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

Definition at line 56 of file FSMObject.cpp.

References FSM::CFSMObject::myStateMachine.

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

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 FSM::CFSMState::Activate(), FSM::CFSMConditionTestVariable::CheckCondition(), FSM::CFSMState::Deactivate(), FSM::CFSMSimpleTransition::SetParameter(), FSM::CFSMConditionTestVariable::SetParameter(), FSM::CFSMActionIncrVariable::SetParameter(), and FSM::CFSMActionSetVariable::SetParameter().

const char * FSM::CFSMTransition::GetOnEvent   const
 

Definition at line 227 of file FSMTransition.cpp.

References m_Event.

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::CFSMTransition::SetFromState const char *    stateName [protected]
 

Definition at line 206 of file FSMTransition.cpp.

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

Definition at line 51 of file FSMObject.cpp.

void FSM::CFSMTransition::SetOnEvent const char *    event = "ANY"
 

Definition at line 211 of file FSMTransition.cpp.

References m_Event.

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.

Reimplemented in FSM::CFSMSimpleTransition, FSM::CFSMPushTransition, and FSM::CFSMPopTransition.

Definition at line 85 of file FSMTransition.h.

friend class CFSMState [friend]
 

Reimplemented in FSM::CFSMSimpleTransition, FSM::CFSMPushTransition, and FSM::CFSMPopTransition.

Definition at line 84 of file FSMTransition.h.

Referenced by GetFromState().


Member Data Documentation

Action_List FSM::CFSMTransition::m_Actions [private]
 

Definition at line 159 of file FSMTransition.h.

Referenced by DeleteAction(), Execute(), GetAction(), GetActionsBegin(), GetActionsEnd(), and ~CFSMTransition().

Condition_List FSM::CFSMTransition::m_Conditions [private]
 

Definition at line 160 of file FSMTransition.h.

Referenced by Deactivate(), DeleteCondition(), GetCondition(), GetConditionsBegin(), GetConditionsEnd(), and ~CFSMTransition().

string FSM::CFSMTransition::m_Event [private]
 

Definition at line 163 of file FSMTransition.h.

Referenced by GetOnEvent(), SetOnEvent(), and ~CFSMTransition().

string FSM::CFSMTransition::m_FromState [private]
 

Definition at line 161 of file FSMTransition.h.

Referenced by GetFromState(), and ~CFSMTransition().

string FSM::CFSMTransition::m_ToState [private]
 

Reimplemented in FSM::CFSMSimpleTransition.

Definition at line 162 of file FSMTransition.h.


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