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 Member Functions | List of all members
Menge::BFSM::TransitionTarget Class Referenceabstract

The base class for transition targets. More...

#include <Target.h>

Inheritance diagram for Menge::BFSM::TransitionTarget:
Menge::Element Menge::BFSM::ProbTarget Menge::BFSM::ReturnTarget Menge::BFSM::SingleTarget

Public Member Functions

 TransitionTarget ()
 Constructor.
 
 TransitionTarget (const TransitionTarget &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 StatenextState (Agents::BaseAgent *agent)=0
 Determines the next state for the given agent. More...
 
virtual bool connectStates (std::map< std::string, State * > &stateMap)=0
 Performs any necessary connections to the target state(s). More...
 
virtual TransitionTargetcopy ()=0
 Create a copy of this target. More...
 
- Public Member Functions inherited from Menge::Element
void destroy ()
 This supplants the destructor. More...
 
virtual BFSM::TaskgetTask ()
 Return an optional task associated with this element. More...
 
virtual SceneGraph::GLNodegetSGNode ()
 Returns an optional visualization element associated with the element. More...
 

Protected Member Functions

virtual ~TransitionTarget ()
 Protected destructor.
 

Detailed Description

The base class for transition targets.

A transition target is the state a transition moves an agent to. In the simplest case, the transition simply connects two states and when the transition is active, the agent moves from the source state to the destination state.

However, Target's can be more complex. The destination can be one of a set of states selected by arbitrary criteria (such as probability). The target is responsible for providing a next state according to its criteria upon request.

Constructor & Destructor Documentation

Menge::BFSM::TransitionTarget::TransitionTarget ( const TransitionTarget tgt)

Copy constructor.

Parameters
tgtTransitionTarget to copy.

Member Function Documentation

virtual bool Menge::BFSM::TransitionTarget::connectStates ( std::map< std::string, State * > &  stateMap)
pure 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.

Parameters
stateMapA mapping from state names to state pointers.
Returns
True if connection was successful, false otherwise.

Implemented in Menge::BFSM::SingleTarget, Menge::BFSM::ReturnTarget, and Menge::BFSM::ProbTarget.

virtual TransitionTarget* Menge::BFSM::TransitionTarget::copy ( )
pure virtual

Create a copy of this target.

It is the responsibility of the caller to delete the object.

Returns
: A "deep copy" of this target - such that there is no shared objects between this and its copy.

Implemented in Menge::BFSM::SingleTarget, Menge::BFSM::ReturnTarget, and Menge::BFSM::ProbTarget.

virtual State* Menge::BFSM::TransitionTarget::nextState ( Agents::BaseAgent agent)
pure 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.

Parameters
agentThe agent to test the transition for.
Returns
A pointer to the next state.

Implemented in Menge::BFSM::SingleTarget, Menge::BFSM::ReturnTarget, and Menge::BFSM::ProbTarget.

virtual void Menge::BFSM::TransitionTarget::onEnter ( Agents::BaseAgent agent)
inlinevirtual

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.

Parameters
agentThe agent who has entered the state which uses this transition.

Reimplemented in Menge::BFSM::ReturnTarget.

virtual void Menge::BFSM::TransitionTarget::onLeave ( Agents::BaseAgent agent)
inlinevirtual

Called when an agent exits the state with this transition.

Parameters
agentThe agent who left the state.

Reimplemented in Menge::BFSM::ReturnTarget.


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