Class which determines the agent properties for each new Helbing agent.
More...
#include <HelbingInitializer.h>
|
FloatGenerator * | _mass |
| The mass of the agent.
|
|
Class which determines the agent properties for each new Helbing agent.
Helbing::AgentInitializer::AgentInitializer |
( |
| ) |
|
Constructor.
The values for each agent take a hard-coded default values.
Copy Constructor.
- Parameters
-
init | The initializer to copy values from |
Creates a copy of this AgentInitializer instance.
- Returns
- A pointer to a new AgentInitializer with all of the same values as this. The caller is responsible for freeing up the new instance.
bool Helbing::AgentInitializer::isRelevant |
( |
const ::std::string & |
tagName | ) |
|
|
protectedvirtual |
Reports if this AgentInitializer cares about the given AgentSet property XML tag.
This is the mechanism by which new sub-classes can extend the parameter space. Each pedestrian model which introduces new per-agent properties that must override this function. However, the overriden function must, in turn, call the parent class if it doesn't consider the tag relevant, giving the parent class a chance to determine if the tag is relevant. This is the mechanism by which derived classes will also benefit from the <Helbing>
parameter set.
- Parameters
-
tagName | The tag to test for relevancy. |
- Returns
- True if the tag is relevant, false otherwise.
AgentInitializer::ParseResult Helbing::AgentInitializer::processProperty |
( |
::std::string |
propName, |
|
|
TiXmlElement * |
node |
|
) |
| |
|
protectedvirtual |
Process the given <Property .../> tag.
As a pre-condition to this function, the XML node contains a <Property.../> tag and has been confirmed to have, at least, a name attribute. Nothing else about the tag has been validated.
If the property name is unexpected, it will be ignored. If it is expected, this function will attempt to interpret the XML tag as a number distribution for a valid agent attribute. If it can do so, it is successful, if it can't, it fails.
- Parameters
-
propName | The extractd "name" property from the Property tag. |
node | The XML node for the Property tag. |
- Returns
- True if parsing was "successful", false otherwise.
void Helbing::AgentInitializer::setDefaults |
( |
| ) |
|
|
virtual |
Sets all generators to default values.
Resets all number generators to default const values. This assumes that all required number generators already exist and will delete them appropriately. Do not call this in the constructor.
Defines a constant value for an agent property as specified by the attribute of an agent property tag.
Derived classes should override this function, but possibly call the parent class's implementation. First, it should test to see if the paramName is expected by the derived class. If so, the derived class can determine fail or accept. If it is not expected, it should call the parent class's implementation and returns its value.
- Parameters
-
paramName | A string containing the parameter name. |
value | A string containing the value for the parameter. |
- Returns
- The result of the parse: failure, ignored, or accepted.
bool Helbing::AgentInitializer::setProperties |
( |
Agents::BaseAgent * |
agent | ) |
|
|
virtual |
Sets the properties of the given agent based on the initializer's values.
This needs to be overridden by sub-classes. The first thing the sub-class should do is dynamic_cast the argument to its expected type to make sure it is the proper agent type. If not, this should be considered failure. Then it should set its unique properties an+d then call the super class's setProperties function.
- Parameters
-
agent | The agent whose properties are to be set. |
- Returns
- True if the properties were set successfully, false otherwise.
The documentation for this class was generated from the following files: