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

The class which specifies an xml attribute with a 2D float distribution value. More...

#include <Attribute.h>

Inheritance diagram for Menge::Vec2DDistributionAttribute:
Menge::Attribute

Public Member Functions

 Vec2DDistributionAttribute (bool required, const Vector2 &defValue, float scale=1.f)
 Constructor. More...
 
virtual ~Vec2DDistributionAttribute ()
 Destructor.
 
virtual bool extract (TiXmlElement *node)
 Extracts the values for this attribute from the xml node. More...
 
virtual void setDefault ()
 If defined, sets the default value for the attribute.
 
virtual Vec2DGeneratorgetVec2DGenerator ()
 Retrieve the parsed 2D float generator. More...
 
- Public Member Functions inherited from Menge::Attribute
 Attribute (const std::string &name, bool required)
 Constructor. More...
 
virtual ~Attribute ()
 Destructor.
 
const std::string & getName () const
 Returns a const reference to the name of the attribute. More...
 
bool isRequired () const
 Reports if this attribute is required to be specified. More...
 
bool isValid () const
 Reports if the attribute is valid. More...
 
void clear ()
 Prepares the attribute for a parse attempt.
 
virtual int getInt ()
 Retrieve the parsed int value. More...
 
virtual bool getBool ()
 Retrieve the parsed boolean value. More...
 
virtual float getFloat ()
 Retrieve the parsed float value. More...
 
virtual std::string getString ()
 Retrieve the parsed string value. More...
 
virtual size_t getSizeT ()
 Retrieve the parsed size_t value. More...
 
virtual FloatGeneratorgetFloatGenerator ()
 Retrieve the parsed float generator. More...
 
virtual IntGeneratorgetIntGenerator ()
 Retrieve the parsed int generator. More...
 

Protected Attributes

Vector2 _default
 The default float value. Meaningless if _required is true.
 
float _scale
 Scale value. Useful for converting units at parse time (i.e. from degrees to radians.
 
Vec2DGenerator_generator
 The parsed generator.
 
- Protected Attributes inherited from Menge::Attribute
std::string _name
 The name of the xml attribute.
 
bool _required
 Determines if the XML must specify this attribute.
 
bool _valid
 Reports if the attribute is valid. An attribute is always valid if it is not required. Otherwise, it is only valid if it was able to be initialized from the XML.
 

Detailed Description

The class which specifies an xml attribute with a 2D float distribution value.

Constructor & Destructor Documentation

Menge::Vec2DDistributionAttribute::Vec2DDistributionAttribute ( bool  required,
const Vector2 defValue,
float  scale = 1.f 
)
inline

Constructor.

The 2D Vector generator does not accept an optional prefix like the float and int distributions.

Parameters
requiredWhether or not the attribute is required (true) or not (false).
defValueThe default value for the attribute if none is provided. This will be interpreted as a const distribution.
scaleThe optional scale value for this float distribution.

Member Function Documentation

bool Menge::Vec2DDistributionAttribute::extract ( TiXmlElement *  node)
virtual

Extracts the values for this attribute from the xml node.

This is the main parsing work. It must be performed by each attribute sub-class.

Parameters
nodeThe XML node containing the attributes.
Returns
True on sucessful extraction, false otherwise.

Implements Menge::Attribute.

virtual Vec2DGenerator* Menge::Vec2DDistributionAttribute::getVec2DGenerator ( )
inlinevirtual

Retrieve the parsed 2D float generator.

Returns
A pointer to a 2D float generator. The float generator becomes the responsibility of the caller.
Exceptions
AnAttributeDefinitionException if the types are wrong.

Reimplemented from Menge::Attribute.


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