82 T
get(
int attr,
const char* objectid,
bool& ok,
bool report =
true)
const;
100 template <
typename T>
101 T
getOpt(
int attr,
const char* objectid,
bool& ok, T defaultValue = T(),
bool report =
true)
const;
121 bool report =
true)
const;
163 SUMOTime defaultValue,
bool report =
true)
const;
279 virtual std::string
getString(
int id,
bool* isPresent =
nullptr)
const = 0;
332 virtual double getFloat(
const std::string&
id)
const = 0;
345 const std::string& def)
const = 0;
354 virtual std::string
getName(
int attr)
const = 0;
381 template <
typename T> T
fromString(
const std::string& value)
const;
382 void emitUngivenError(
const std::string& attrname,
const char* objectid)
const;
383 void emitEmptyError(
const std::string& attrname,
const char* objectid)
const;
384 void emitFormatError(
const std::string& attrname,
const std::string& type,
const char* objectid)
const;
409#define INVALID_RETURN(TYPE) \
410template<> struct invalid_return<TYPE> { \
411 static const TYPE value; \
434 bool& ok,
bool report)
const {
436 bool isPresent =
true;
437 const std::string& strAttr =
getString(attr, &isPresent);
439 return fromString<T>(strAttr);
460 bool& ok, T defaultValue,
bool report)
const {
462 bool isPresent =
true;
463 const std::string& strAttr =
getString(attr, &isPresent);
465 return fromString<T>(strAttr);
std::ostream & operator<<(std::ostream &os, const SUMOSAXAttributes &src)
#define INVALID_RETURN(TYPE)
ParkingType
Numbers representing special SUMO-XML-attribute values Information on whether a car is parking on the...
FringeType
classifying boundary nodes
SumoXMLEdgeFunc
Numbers representing special SUMO-XML-attribute values for representing edge functions used in netbui...
SumoXMLNodeType
Numbers representing special SUMO-XML-attribute values for representing node- (junction-) types used ...
RightOfWay
algorithms for computing right of way
A class that stores a 2D geometrical boundary.
A point in 2D or 3D with translation and scaling methods.
Encapsulated SAX-Attributes.
virtual std::string getString(int id, bool *isPresent=nullptr) const =0
Returns the string-value of the named (by its enum-value) attribute.
virtual std::string getStringSecure(const std::string &id, const std::string &def) const =0
Returns the string-value of the named (by its enum-value) attribute.
friend std::ostream & operator<<(std::ostream &os, const SUMOSAXAttributes &src)
SUMOTime getOptPeriod(const char *objectid, bool &ok, SUMOTime defaultValue, bool report=true) const
Tries to read the SUMOTime 'period' attribute.
bool getBool(int id) const
Returns the bool-value of the named (by its enum-value) attribute.
virtual void serialize(std::ostream &os) const =0
Prints all attribute names and values into the given stream.
T getOpt(int attr, const char *objectid, bool &ok, T defaultValue=T(), bool report=true) const
Tries to read given attribute assuming it is an int.
virtual ~SUMOSAXAttributes()
Destructor.
T fromString(const std::string &value) const
virtual long long int getLong(int id) const
Returns the long-value of the named (by its enum-value) attribute.
virtual std::vector< std::string > getAttributeNames() const =0
Retrieves all attribute names.
SUMOTime getOptSUMOTimeReporting(int attr, const char *objectid, bool &ok, SUMOTime defaultValue, bool report=true) const
Tries to read given attribute assuming it is a SUMOTime.
virtual std::string getStringSecure(int id, const std::string &def) const =0
Returns the string-value of the named (by its enum-value) attribute.
SUMOSAXAttributes(const SUMOSAXAttributes &src)=delete
Invalidated copy constructor.
virtual double getFloat(const std::string &id) const =0
Returns the double-value of the named attribute.
void emitFormatError(const std::string &attrname, const std::string &type, const char *objectid) const
virtual std::string getName(int attr) const =0
Converts the given attribute id into a man readable string.
void emitEmptyError(const std::string &attrname, const char *objectid) const
std::string myObjectType
the object type to use in error reporting
static const std::string ENCODING
The encoding of parsed strings.
T get(int attr, const char *objectid, bool &ok, bool report=true) const
Tries to read given attribute assuming it is an int.
void emitUngivenError(const std::string &attrname, const char *objectid) const
virtual SUMOSAXAttributes * clone() const =0
return a new deep-copy attributes object
const std::string & getObjectType() const
return the objecttype to which these attributes belong
virtual bool hasAttribute(int id) const =0
Returns the information whether the named (by its enum-value) attribute is within the current list.
virtual bool hasAttribute(const std::string &id) const =0
Returns the information whether the named attribute is within the current list.
SUMOTime getPeriod(const char *objectid, bool &ok, bool report=true) const
Tries to read the SUMOTime 'period' attribute.
SUMOTime getSUMOTimeReporting(int attr, const char *objectid, bool &ok, bool report=true) const
Tries to read given attribute assuming it is a SUMOTime.
SUMOSAXAttributes & operator=(const SUMOSAXAttributes &src)=delete
Invalidated assignment operator.
int getInt(int id) const
Returns the int-value of the named (by its enum-value) attribute.
double getFloat(int id) const
Returns the double-value of the named (by its enum-value) attribute.
static long long int toLong(const std::string &sData)
converts a string into the long value described by it by calling the char-type converter,...
static double toDouble(const std::string &sData)
converts a string into the double value described by it by calling the char-type converter
static int toInt(const std::string &sData)
converts a string into the integer value described by it by calling the char-type converter,...
static bool toBool(const std::string &sData)
converts a string into the bool value described by it by calling the char-type converter