Menge
Modular Pedestrian Simulation Framework for Research and Development
|
The definition of the return target. More...
#include <TargetReturn.h>
Public Member Functions | |
ReturnTarget () | |
Constructor. | |
ReturnTarget (const ReturnTarget &tgt) | |
Copy constructor. More... | |
virtual void | onEnter (Agents::BaseAgent *agent) |
Called when an agent enters a state with this exiting transition. More... | |
virtual void | onLeave (Agents::BaseAgent *agent) |
Called when an agent exits the state with this transition. More... | |
virtual State * | nextState (Agents::BaseAgent *agent) |
Determines the next state for the given agent. More... | |
virtual bool | connectStates (std::map< std::string, State * > &stateMap) |
Performs any necessary connections to the target state(s). More... | |
virtual TransitionTarget * | copy () |
Create a copy of this target. More... | |
Public Member Functions inherited from Menge::BFSM::TransitionTarget | |
TransitionTarget () | |
Constructor. | |
TransitionTarget (const TransitionTarget &tgt) | |
Copy constructor. More... | |
Public Member Functions inherited from Menge::Element | |
void | destroy () |
This supplants the destructor. More... | |
virtual BFSM::Task * | getTask () |
Return an optional task associated with this element. More... | |
virtual SceneGraph::GLNode * | getSGNode () |
Returns an optional visualization element associated with the element. More... | |
Protected Attributes | |
std::map< size_t, State * > | _targets |
A mapping between an agent id and its return state. | |
ReadersWriterLock | _lock |
Lock to protect _targets;. | |
Friends | |
class | ReturnTargetFactory |
Additional Inherited Members | |
Protected Member Functions inherited from Menge::BFSM::TransitionTarget | |
virtual | ~TransitionTarget () |
Protected destructor. | |
The definition of the return target.
The return target causes the agent to go back to the state from which the agent transitioned to the current state. However, this isn't necessarily the literal previous state. The FSM can advance multiple states in a single time step. This target returns the agent to the state it was in at the beginning of this call to advance (and not the immediately previous state which was simply passed through.)
Menge::BFSM::ReturnTarget::ReturnTarget | ( | const ReturnTarget & | tgt | ) |
Copy constructor.
tgt | The transition target to copy. |
|
virtual |
Performs any necessary connections to the target state(s).
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. |
Implements Menge::BFSM::TransitionTarget.
|
virtual |
Create a copy of this target.
It is the responsibility of the caller to delete the object.
Implements Menge::BFSM::TransitionTarget.
|
virtual |
Determines the next state for the given agent.
This function defines the main functionality of the target. Given the current agent and the class's internal state, it determines The state to move the agent into. This should be overridden by each sub-class.
agent | The agent to test the transition for. |
Implements Menge::BFSM::TransitionTarget.
|
virtual |
Called when an agent enters a state with this exiting transition.
Sub-classes should use this function as the opportunity to cache any particular per-agent data.
agent | The agent who has entered the state which uses this transition. |
Reimplemented from Menge::BFSM::TransitionTarget.
|
virtual |
Called when an agent exits the state with this transition.
agent | The agent who left the state. |
Reimplemented from Menge::BFSM::TransitionTarget.