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::Agents::XMLSimulatorBase Class Referenceabstract

The base class for extracting simulator settings from the XML specification. More...

#include <XMLSimulatorBase.h>

Inheritance diagram for Menge::Agents::XMLSimulatorBase:
Menge::Agents::SimulatorInterface Menge::Agents::SimulatorBase< Agent > ORCA::Simulator PedVO::Simulator

Public Member Functions

 XMLSimulatorBase ()
 Constructor.
 
 ~XMLSimulatorBase ()
 Destructor.
 
virtual bool hasExpTarget ()
 Reports if there are any target-specific experiment parameters. More...
 
virtual bool isExpTarget (const std::string &tagName)=0
 Given the name of a tag which is the child of <Experiment>, reports if it contains target-specific experiment parameters. More...
 
virtual bool setExpParam (const std::string &paramName, const std::string &value)=0 throw ( XMLParamException )
 Given the name of the xml param and its string value, sets the parameter in the simulator. More...
 
virtual BaseAgentaddAgent (const Vector2 &pos, AgentInitializer *agentInit)=0
 Add an agent with specified position to the simulator whose properties are defined by the given agent initializer. More...
 
virtual void setElevationInstance (Elevation *elevation)=0
 Set the elevation instance of the simulator. More...
 
virtual bool hasElevation () const =0
 Reports if the elevation has been set. More...
 
virtual void setSpatialQuery (SpatialQuery *spatialQuery)=0
 Sets the spatial query instance of the simulator. More...
 
virtual SpatialQuerygetSpatialQuery ()=0
 Gets the spatial query instance of the simulator. More...
 
virtual bool hasSpatialQuery () const =0
 Reports if the spatial query has been set. More...
 
virtual bool initSpatialQuery ()=0
 Initalize spatial query structure.
 
virtual void finalize ()
 After all agents and all obstacles have been added to the scene does the work to finish preparing the simulation to be run.
 
SimulatorStategetInitialState ()
 Returns a pointer to the simulator's initial state. More...
 

Protected Attributes

SimulatorState_initState
 The initial state of the simulator.
 

Detailed Description

The base class for extracting simulator settings from the XML specification.

In order to use the SimXMLLoader class to read XML files and set parameters The simulator must extend this abstract class and implement the given virtual functions.

A "target"-specific parameter refers to the simulator type. In other words, If a simulator expects particular parameters, there should be a tag with the target name and a list of parameter values. The functionality of this class defines that functionality.

Member Function Documentation

virtual BaseAgent* Menge::Agents::XMLSimulatorBase::addAgent ( const Vector2 pos,
AgentInitializer agentInit 
)
pure virtual

Add an agent with specified position to the simulator whose properties are defined by the given agent initializer.

It uses the agent initializer to define the values of the remaining agent parameters

Parameters
posThe 2d vector representing the agent's position
agentInitThe AgentInitializer necessary to parse AgentSet properties
Returns
A pointer to the agent (if initialization was succesful) or NULL if failed.

Implemented in Menge::Agents::SimulatorBase< Agent >.

SimulatorState* Menge::Agents::XMLSimulatorBase::getInitialState ( )
inline

Returns a pointer to the simulator's initial state.

Returns
A pointer to the intial state.
virtual SpatialQuery* Menge::Agents::XMLSimulatorBase::getSpatialQuery ( )
pure virtual

Gets the spatial query instance of the simulator.

Returns
pointer to The spatial query object.

Implemented in Menge::Agents::SimulatorInterface.

virtual bool Menge::Agents::XMLSimulatorBase::hasElevation ( ) const
pure virtual

Reports if the elevation has been set.

Returns
True if the elevation has been set, false otherwise.

Implemented in Menge::Agents::SimulatorInterface.

virtual bool Menge::Agents::XMLSimulatorBase::hasExpTarget ( )
inlinevirtual

Reports if there are any target-specific experiment parameters.

The default case is to assume that the simulator does have particular parameters.

Returns
True if this simulator has target-specific experiment parameters, false otherwise.

Reimplemented in Menge::Agents::SimulatorBase< Agent >.

virtual bool Menge::Agents::XMLSimulatorBase::hasSpatialQuery ( ) const
pure virtual

Reports if the spatial query has been set.

Returns
True if the elevation has been set, false otherwise.

Implemented in Menge::Agents::SimulatorInterface.

virtual bool Menge::Agents::XMLSimulatorBase::isExpTarget ( const std::string &  tagName)
pure virtual

Given the name of a tag which is the child of <Experiment>, reports if it contains target-specific experiment parameters.

It is guaranteed that the labels "AgentSet" and "Obstacle" will never be given as input.

Parameters
tagNameThe name of the candidate experiment XML tag.
Returns
True if the given tag corresponds to the unique tag defined for this simulator (and that tag's parameters should be applied to this simulator), false if not.

Implemented in Menge::Agents::SimulatorBase< Agent >.

virtual void Menge::Agents::XMLSimulatorBase::setElevationInstance ( Elevation elevation)
pure virtual

Set the elevation instance of the simulator.

Parameters
elevationThe elevation object.

Implemented in Menge::Agents::SimulatorInterface.

virtual bool Menge::Agents::XMLSimulatorBase::setExpParam ( const std::string &  paramName,
const std::string &  value 
)
throw (XMLParamException
)
pure virtual

Given the name of the xml param and its string value, sets the parameter in the simulator.

Common parameters and target-specific parameters will be passed into this function. It is the responsibility of the programmer to make sure the default case of any parameter should fall through to the SimulatorBase::setExpParam function.

Parameters
paramNameThe name of the XML parameter.
valueThe string representation of the parameter value. It is the responsibility of the particular sub-class to translate the representation as necessary.
Returns
True if the parameter was set successfully, false otherwise.
Exceptions
AnXMLParamException if there was a problem with the parameter name/value

Implemented in Menge::Agents::SimulatorBase< Agent >.

virtual void Menge::Agents::XMLSimulatorBase::setSpatialQuery ( SpatialQuery spatialQuery)
pure virtual

Sets the spatial query instance of the simulator.

Parameters
spatialQueryThe spatial query object.

Implemented in Menge::Agents::SimulatorInterface.


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