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

The base class for modifying preferred velocities. More...

#include <VelModifier.h>

Inheritance diagram for Menge::BFSM::VelModifier:
Menge::Element Menge::BFSM::ScaleVelModifier

Public Member Functions

 VelModifier ()
 Default constructor.
 
virtual void adaptPrefVelocity (const Agents::BaseAgent *agent, Agents::PrefVelocity &pVel)=0
 Modifies the input preferred velocity in place. More...
 
virtual void registerAgent (const Agents::BaseAgent *agent)
 Registers an agent for use with the VelModifier. More...
 
virtual void unregisterAgent (const Agents::BaseAgent *agent)
 Unregisters a registed agent. More...
 
void onEnter (const Agents::BaseAgent *agent)
 Called when an agent enters the state with this velocity modifier. More...
 
void onLeave (const Agents::BaseAgent *agent)
 Called when an agent exits the state with this velocity modifier. More...
 
virtual VelModifiercopy () const =0
 Creates a copy of this velocity modifier. More...
 
virtual VelModContextgetContext ()
 Provides a display context for interacting with this velocity modifier. 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 ~VelModifier ()
 Virtual destructor.
 

Friends

class ElementFactory< VelModifier >
 

Detailed Description

The base class for modifying preferred velocities.

Each velocity modifier is allowed to change the input preferred velocity without limit based on arbitrary criteria. They have an order, which defines which order in which they are executed. Modifiers are chained so that the input of each modifier is the output of the previous, making order very important.

Member Function Documentation

virtual void Menge::BFSM::VelModifier::adaptPrefVelocity ( const Agents::BaseAgent agent,
Agents::PrefVelocity pVel 
)
pure virtual

Modifies the input preferred velocity in place.

The main function of the velocity modifier. Applies its own algorithms to the input preferred velocity, transforming it into a new transform, in place. All VelModifier sub-classes must implement this function.

Parameters
agentThe agent for which a preferred velocity is adapted.
pVelThe instance of Agents::PrefVelocity to set.

Implemented in Menge::BFSM::ScaleVelModifier.

virtual VelModifier* Menge::BFSM::VelModifier::copy ( ) const
pure virtual

Creates a copy of this velocity modifier.

Returns
A unique, deep copy of this velocity modifier.

Implemented in Menge::BFSM::ScaleVelModifier.

VelModContext * Menge::BFSM::VelModifier::getContext ( )
virtual

Provides a display context for interacting with this velocity modifier.

It is the responsibility of the caller to delete the provided context.

Returns
A pointer to a context for this velocity modifier

Reimplemented in Menge::BFSM::ScaleVelModifier.

void Menge::BFSM::VelModifier::onEnter ( const Agents::BaseAgent agent)

Called when an agent enters the state with this velocity modifier.

This function calls registerAgent. Entering a state which has one or more velocity modifiers assigned to it, causes the velocity modifiers to be temporarily assigned to the agent.

Parameters
agentThe agent entering the state
void Menge::BFSM::VelModifier::onLeave ( const Agents::BaseAgent agent)

Called when an agent exits the state with this velocity modifier.

The dual of onEnter. This function calls unregisterAgent. Agents departing a state with one or more velocity modifiers will be unregistered.

Parameters
agentThe agent entering the state
virtual void Menge::BFSM::VelModifier::registerAgent ( const Agents::BaseAgent agent)
inlinevirtual

Registers an agent for use with the VelModifier.

When a velocity modifier is assigned to the agent, the agent is "registered" to it. If the velocity modifier needs to maintain per-agent data, this is the time to instantiate that data. Default implementation does nothing.

Parameters
agentThe agent to be registered
virtual void Menge::BFSM::VelModifier::unregisterAgent ( const Agents::BaseAgent agent)
inlinevirtual

Unregisters a registed agent.

If an velocity modifier is removed from an agent, this allows the velocity modifier to destroy any agent-specific data. Default implementation does nothing.

Parameters
agentThe agent to be unregistered

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