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 | Friends | List of all members
Menge::BFSM::ReturnTarget Class Reference

The definition of the return target. More...

#include <TargetReturn.h>

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

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 StatenextState (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 TransitionTargetcopy ()
 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::TaskgetTask ()
 Return an optional task associated with this element. More...
 
virtual SceneGraph::GLNodegetSGNode ()
 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.
 

Detailed Description

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.)

Constructor & Destructor Documentation

Menge::BFSM::ReturnTarget::ReturnTarget ( const ReturnTarget tgt)

Copy constructor.

Parameters
tgtThe transition target to copy.

Member Function Documentation

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

Implements Menge::BFSM::TransitionTarget.

TransitionTarget * Menge::BFSM::ReturnTarget::copy ( )
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.

Implements Menge::BFSM::TransitionTarget.

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

Implements Menge::BFSM::TransitionTarget.

void Menge::BFSM::ReturnTarget::onEnter ( Agents::BaseAgent agent)
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.

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

Reimplemented from Menge::BFSM::TransitionTarget.

void Menge::BFSM::ReturnTarget::onLeave ( Agents::BaseAgent agent)
virtual

Called when an agent exits the state with this transition.

Parameters
agentThe agent who left the state.

Reimplemented from Menge::BFSM::TransitionTarget.


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