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::SingleTarget Class Reference

A TransitionTarget which assumes there is only one destination state. More...

#include <Target.h>

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

Public Member Functions

 SingleTarget ()
 Default constructor.
 
 SingleTarget (const SingleTarget &tgt)
 Copy constructor. More...
 
 SingleTarget (const std::string &toName)
 Constructor. 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...
 
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...
 
- 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::string _nextName
 The name of the state to which this transition leads.
 
State_next
 a pointer to the state to which this transition leads.
 

Additional Inherited Members

- Protected Member Functions inherited from Menge::BFSM::TransitionTarget
virtual ~TransitionTarget ()
 Protected destructor.
 

Detailed Description

A TransitionTarget which assumes there is only one destination state.

This will always return a single state, regardless of the agent.

Constructor & Destructor Documentation

Menge::BFSM::SingleTarget::SingleTarget ( const SingleTarget tgt)

Copy constructor.

Parameters
tgtThe transition target to copy.
Menge::BFSM::SingleTarget::SingleTarget ( const std::string &  toName)

Constructor.

Parameters
toNameThe name of the destination (aka "to") node.

Member Function Documentation

bool Menge::BFSM::SingleTarget::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::SingleTarget::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.

virtual State* Menge::BFSM::SingleTarget::nextState ( Agents::BaseAgent agent)
inlinevirtual

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.


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