Menge
Modular Pedestrian Simulation Framework for Research and Development
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Protected Attributes | List of all members
Menge::BFSM::Transition Class Reference

The transition between BFSM states. More...

#include <Transition.h>

Public Member Functions

 Transition (const Transition &trans)
 Copy constructor. More...
 
 Transition (Condition *condition, TransitionTarget *target)
 Constructor. More...
 
 ~Transition ()
 Destructor.
 
bool connectStates (std::map< std::string, State * > &stateMap)
 Performs any necessary connections to the "to" state. More...
 
virtual void onEnter (Agents::BaseAgent *agent)
 Called when an agent enters a state with this exiting transition. More...
 
void onLeave (Agents::BaseAgent *agent)
 Called when an agent exits the state with this transition. More...
 
Statetest (Agents::BaseAgent *agent, const Goal *goal)
 Tests to see if this transition's conditions are met. More...
 
void getTasks (FSM *fsm)
 Gets the tasks for all of the transitions target and condition. More...
 
Transitioncopy ()
 Creats a deep copy of this transition. More...
 

Protected Attributes

Condition_condition
 The Condition instance for this transition.
 
TransitionTarget_target
 The target for this transition.
 

Detailed Description

The transition between BFSM states.

Transitions can key on arbitrary state. For each agent, the transition is "tested". If the condition is met, the transition is active and that reports to the state (which then "follows" the transition).

Constructor & Destructor Documentation

Menge::BFSM::Transition::Transition ( const Transition trans)

Copy constructor.

Parameters
transThe transition to copy to this one.
Menge::BFSM::Transition::Transition ( Condition condition,
TransitionTarget target 
)

Constructor.

The transition takes ownership of the Condition and TransitionTarget given as parameters to the constructor and will destroy them in their destructor. As such, they should be unique.

Parameters
conditionThe condition instance for this transition.
targetThe target instance for this transition.

Member Function Documentation

bool Menge::BFSM::Transition::connectStates ( std::map< std::string, State * > &  stateMap)

Performs any necessary connections to the "to" state.

Sub-classes must override this because a transition must transition to a state. See the sub-classes SingleTransition for an example.

Parameters
stateMapA mapping from state names to state pointers.
Returns
True if connection was successful, false otherwise.
Transition * Menge::BFSM::Transition::copy ( )

Creats a deep copy of this transition.

Returns
A new transition whose values are identical to this one.
void Menge::BFSM::Transition::getTasks ( FSM fsm)

Gets the tasks for all of the transitions target and condition.

Parameters
fsmA pointer to the fsm. Tasks are fed to the fsm.
void Menge::BFSM::Transition::onEnter ( Agents::BaseAgent agent)
virtual

Called when an agent enters a state with this exiting transition.

Parameters
agentThe agent who has entered the state which uses this transition.
void Menge::BFSM::Transition::onLeave ( Agents::BaseAgent agent)

Called when an agent exits the state with this transition.

Parameters
agentThe agent who left the state.
State * Menge::BFSM::Transition::test ( Agents::BaseAgent agent,
const Goal goal 
)

Tests to see if this transition's conditions are met.

Parameters
agentThe agent to test the transition for.
goalThe agent's goal (although this may be ignored).
Returns
A pointer to the next state if the test passes, otherwise returns NULL.

The documentation for this class was generated from the following files: