44 #ifndef __ATTRIBUTE_H__
45 #define __ATTRIBUTE_H__
123 Attribute(
const std::string & name,
bool required ): _name(name), _required(required) {}
138 virtual bool extract( TiXmlElement * node ) = 0;
145 inline const std::string &
getName()
const {
return _name; }
159 inline bool isValid()
const {
return _valid; }
169 virtual void setDefault() = 0;
287 StringAttribute(
const std::string & name,
bool required,
const std::string & defValue=
"" ):
Attribute(name,required), _default(defValue) {}
297 virtual bool extract( TiXmlElement * node );
339 IntAttribute(
const std::string & name,
bool required,
int defValue ):
Attribute(name,required), _default(defValue) {}
349 virtual bool extract( TiXmlElement * node );
401 virtual bool extract( TiXmlElement * node );
452 virtual bool extract( TiXmlElement * node );
504 virtual bool extract( TiXmlElement * node );
564 virtual bool extract( TiXmlElement * node );
632 virtual bool extract( TiXmlElement * node );
698 virtual bool extract( TiXmlElement * node );
726 #endif // __ATTRIBUTE_H__
const std::string & getName() const
Returns a const reference to the name of the attribute.
Definition: Attribute.h:145
AttributeDefinitionException()
Default constructor.
Definition: Attribute.h:74
virtual ~Attribute()
Destructor.
Definition: Attribute.h:128
IntAttribute(const std::string &name, bool required, int defValue)
Constructor.
Definition: Attribute.h:339
The core namespace. All elements of Menge are contained in this namespace.
Definition: AgentGenerator.cpp:43
Generic abstract class which generates a scalar float value.
Definition: RandGenerator.h:99
float _default
The default float value. Meaningless if _required is true.
Definition: Attribute.h:419
virtual bool getBool()
Retrieve the parsed boolean value.
Definition: Attribute.h:465
An element attribute.
Definition: Attribute.h:114
Sets up the proper compiler directives for platform and dll export/import.
bool _required
Determines if the XML must specify this attribute.
Definition: Attribute.h:261
virtual IntGenerator * getIntGenerator()
Retrieve the parsed int generator.
Definition: Attribute.h:712
virtual void setDefault()
If defined, sets the default value for the attribute.
Definition: Attribute.h:703
std::string _default
The default string value. Meaningless if _required is true.
Definition: Attribute.h:316
FloatAttribute(const std::string &name, bool required, float defValue)
Constructor.
Definition: Attribute.h:391
virtual void setDefault()
If defined, sets the default value for the attribute.
Definition: Attribute.h:569
std::string _value
The parsed attribute value.
Definition: Attribute.h:321
virtual std::string getString()
Retrieve the parsed string value.
Definition: Attribute.h:209
The class which specifies an xml attribute with a float-type value.
Definition: Attribute.h:381
virtual int getInt()
Retrieve the parsed int value.
Definition: Attribute.h:362
Attribute(const std::string &name, bool required)
Constructor.
Definition: Attribute.h:123
The fatal attribute definition exception.
Definition: Attribute.h:87
The base definition for exceptions in Menge.
Generic abstract class which generates a 2D vector float values.
Definition: RandGenerator.h:706
float _value
The parsed attribute value.
Definition: Attribute.h:424
The class which specifies an xml attribute with a int-type value.
Definition: Attribute.h:329
AttributeDefinitionFatalException()
Default constructor.
Definition: Attribute.h:92
virtual void setDefault()
If defined, sets the default value for the attribute.
Definition: Attribute.h:637
float _default
The default float value. Meaningless if _required is true.
Definition: Attribute.h:584
Exception class for attribute definition problems (i.e., using the wrong type of attribute for the wr...
Definition: Attribute.h:69
virtual size_t getSizeT()
Retrieve the parsed size_t value.
Definition: Attribute.h:517
The class which specifies an xml attribute with a boolean-type value.
Definition: Attribute.h:432
virtual void setDefault()
If defined, sets the default value for the attribute.
Definition: Attribute.h:457
virtual void setDefault()
If defined, sets the default value for the attribute.
Definition: Attribute.h:406
The class which specifies an xml attribute with a float distribution value.
Definition: Attribute.h:536
int _default
The default int value. Meaningless if _required is true.
Definition: Attribute.h:718
virtual void setDefault()
If defined, sets the default value for the attribute.
Definition: Attribute.h:509
Base exception class for menge operations.
Definition: MengeException.h:58
AttributeDefinitionException(const std::string &s)
Constructor with message.
Definition: Attribute.h:81
virtual FloatGenerator * getFloatGenerator()
Retrieve the parsed float generator.
Definition: Attribute.h:578
Vec2DDistributionAttribute(bool required, const Vector2 &defValue, float scale=1.f)
Constructor.
Definition: Attribute.h:617
The namespace for math primitives for simulation and visualization.
Definition of a vector in R2.
FloatDistributionAttribute(const std::string &name, bool required, float defValue, float scale=1.f)
Constructor.
Definition: Attribute.h:549
The class which specifies an xml attribute with an int distribution value.
Definition: Attribute.h:671
bool isValid() const
Reports if the attribute is valid.
Definition: Attribute.h:159
virtual void setDefault()
If defined, sets the default value for the attribute.
Definition: Attribute.h:354
float _scale
Scale value. Useful for converting units at parse time (i.e. from degrees to radians.
Definition: Attribute.h:590
IntGenerator * _generator
The parsed generator.
Definition: Attribute.h:723
virtual FloatGenerator * getFloatGenerator()
Retrieve the parsed float generator.
Definition: Attribute.h:230
int _default
The default int value. Meaningless if _required is true.
Definition: Attribute.h:368
Vector2 _default
The default float value. Meaningless if _required is true.
Definition: Attribute.h:652
virtual float getFloat()
Retrieve the parsed float value.
Definition: Attribute.h:414
virtual Vec2DGenerator * getVec2DGenerator()
Retrieve the parsed 2D float generator.
Definition: Attribute.h:239
IntDistributionAttribute(const std::string &name, bool required, int defValue)
Constructor.
Definition: Attribute.h:683
bool isRequired() const
Reports if this attribute is required to be specified.
Definition: Attribute.h:152
virtual Vec2DGenerator * getVec2DGenerator()
Retrieve the parsed 2D float generator.
Definition: Attribute.h:646
The class which specifies an xml attribute with a 2D float distribution value.
Definition: Attribute.h:603
Generic abstract class which generates a scalar integer value.
Definition: RandGenerator.h:486
virtual void setDefault()
If defined, sets the default value for the attribute.
Definition: Attribute.h:302
size_t _default
The default bool value. Meaningless if _required is true.
Definition: Attribute.h:523
Base class for fatal exceptions.
Definition: MengeException.h:99
FloatGenerator * _generator
The parsed generator.
Definition: Attribute.h:595
float _scale
Scale value. Useful for converting units at parse time (i.e. from degrees to radians.
Definition: Attribute.h:658
virtual bool getBool()
Retrieve the parsed boolean value.
Definition: Attribute.h:189
bool _value
The parsed attribute value.
Definition: Attribute.h:476
virtual IntGenerator * getIntGenerator()
Retrieve the parsed int generator.
Definition: Attribute.h:250
int _value
The parsed attribute value.
Definition: Attribute.h:373
StringAttribute(const std::string &name, bool required, const std::string &defValue="")
Constructor.
Definition: Attribute.h:287
virtual size_t getSizeT()
Retrieve the parsed size_t value.
Definition: Attribute.h:219
The class which specifies an xml attribute with a size_t-type value.
Definition: Attribute.h:484
std::string _name
The name of the xml attribute.
Definition: Attribute.h:256
The class which specifies an xml attribute with a string-type value.
Definition: Attribute.h:277
size_t _value
The parsed attribute value.
Definition: Attribute.h:528
bool _default
The default bool value. Meaningless if _required is true.
Definition: Attribute.h:471
SizeTAttribute(const std::string &name, bool required, size_t defValue)
Constructor.
Definition: Attribute.h:494
virtual std::string getString()
Retrieve the parsed string value.
Definition: Attribute.h:310
BoolAttribute(const std::string &name, bool required, bool defValue)
Constructor.
Definition: Attribute.h:442
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.
Definition: Attribute.h:268
Vec2DGenerator * _generator
The parsed generator.
Definition: Attribute.h:663
virtual float getFloat()
Retrieve the parsed float value.
Definition: Attribute.h:199
virtual int getInt()
Retrieve the parsed int value.
Definition: Attribute.h:179
AttributeDefinitionFatalException(const std::string &s)
Constructor with message.
Definition: Attribute.h:99