83 T
get(
int attr,
const char* objectid,
bool& ok,
bool report =
true)
const;
101 template <
typename T>
102 T
getOpt(
int attr,
const char* objectid,
bool& ok, T defaultValue = T(),
bool report =
true)
const;
122 bool report =
true)
const;
164 SUMOTime defaultValue,
bool report =
true)
const;
186 SUMOTime defaultValue,
bool report =
true)
const;
306 virtual std::string
getString(
int id,
bool* isPresent =
nullptr)
const = 0;
359 virtual double getFloat(
const std::string&
id)
const = 0;
372 const std::string& def)
const = 0;
381 virtual std::string
getName(
int attr)
const = 0;
408 template <
typename T> T
fromString(
const std::string& value)
const;
409 void emitUngivenError(
const std::string& attrname,
const char* objectid)
const;
410 void emitEmptyError(
const std::string& attrname,
const char* objectid)
const;
411 void emitFormatError(
const std::string& attrname,
const std::string& type,
const char* objectid)
const;
436#define INVALID_RETURN(TYPE) \
437template<> struct invalid_return<TYPE> { \
438 static const TYPE value; \
462 bool& ok,
bool report)
const {
464 bool isPresent =
true;
465 const std::string& strAttr =
getString(attr, &isPresent);
467 return fromString<T>(strAttr);
488 bool& ok, T defaultValue,
bool report)
const {
490 bool isPresent =
true;
491 const std::string& strAttr =
getString(attr, &isPresent);
493 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...
RoundaboutType
classifying roundabout type for nodes
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 getOptOffsetReporting(int attr, const char *objectid, bool &ok, SUMOTime defaultValue, bool report=true) const
Tries to read given attribute assuming it is a tls offset (SUMOTime or "begin")
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.
StopOffset getStopOffset(bool &ok) const
Parses a stop offset definition (vClasses/exceptions and value) from the attributes.
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