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

The definition of the probabalistic target. More...

#include <TargetProb.h>

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

Public Member Functions

 ProbTarget ()
 ProbTarget (const ProbTarget &tgt)
 Copy 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 ()
 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

UniformFloatGenerator _randNum
 The random number generator for selecting the next state.
float _totalWeight
 The total weight of all the target states. More...
std::list< std::pair< float,
std::string > > 
 The set of target state names and their relative weights.
std::map< State *, float > _targets
 The set of target states and their corresponding relative weights.


class ProbTargetFactory

Additional Inherited Members

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

Detailed Description

The definition of the probabalistic target.

Typically, the FSM will be deterministic in that if an agent is in a current state, with a particualr condition being true, it will transition to a deterministic state. The probabalistic target allows the transition to be implicitly connected to a number of states. Upon transitioning, the destination state is computed randomly from the set.

Constructor & Destructor Documentation

Menge::BFSM::ProbTarget::ProbTarget ( const ProbTarget tgt)

Copy constructor.

tgtThe target to copy.

Member Function Documentation

bool Menge::BFSM::ProbTarget::connectStates ( std::map< std::string, State * > &  stateMap)

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.

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

Implements Menge::BFSM::TransitionTarget.

TransitionTarget * Menge::BFSM::ProbTarget::copy ( )

Create a copy of this target.

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

: 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::ProbTarget::nextState ( Agents::BaseAgent agent)

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.

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

Implements Menge::BFSM::TransitionTarget.

Member Data Documentation

float Menge::BFSM::ProbTarget::_totalWeight

The total weight of all the target states.

This gets set after a call to connectStates.

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