Menge
Modular Pedestrian Simulation Framework for Research and Development
|
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... | |
State * | test (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... | |
Transition * | copy () |
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. | |
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).
Menge::BFSM::Transition::Transition | ( | const Transition & | trans | ) |
Copy constructor.
trans | The 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.
condition | The condition instance for this transition. |
target | The target instance for this transition. |
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.
stateMap | A mapping from state names to state pointers. |
Transition * Menge::BFSM::Transition::copy | ( | ) |
Creats a deep copy of this transition.
void Menge::BFSM::Transition::getTasks | ( | FSM * | fsm | ) |
Gets the tasks for all of the transitions target and condition.
fsm | A pointer to the fsm. Tasks are fed to the fsm. |
|
virtual |
Called when an agent enters a state with this exiting transition.
agent | The 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.
agent | The 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.
agent | The agent to test the transition for. |
goal | The agent's goal (although this may be ignored). |