19 #ifndef SUMOSAXAttributes_h 20 #define SUMOSAXAttributes_h 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,
bool report =
true)
const;
122 bool report =
true)
const;
145 SUMOTime defaultValue,
bool report =
true)
const;
165 virtual bool hasAttribute(
const std::string&
id)
const = 0;
183 virtual bool getBool(
int id)
const = 0;
200 virtual int getInt(
int id)
const = 0;
218 virtual long long int getLong(
int id)
const = 0;
233 virtual std::string
getString(
int id)
const = 0;
249 const std::string& def)
const = 0;
267 virtual double getFloat(
int id)
const = 0;
285 virtual double getFloat(
const std::string&
id)
const = 0;
298 const std::string& def)
const = 0;
360 const std::vector<std::string>
getOptStringVector(
int attr,
const char* objectid,
bool& ok,
bool report =
true)
const;
373 const std::vector<int>
getOptIntVector(
int attr,
const char* objectid,
bool& ok,
bool report =
true)
const;
382 virtual std::string
getName(
int attr)
const = 0;
389 virtual void serialize(std::ostream& os)
const = 0;
412 template <
typename T> T
getInternal(
const int attr)
const;
413 void emitUngivenError(
const std::string& attrname,
const char* objectid)
const;
414 void emitEmptyError(
const std::string& attrname,
const char* objectid)
const;
415 void emitFormatError(
const std::string& attrname,
const std::string& type,
const char* objectid)
const;
482 static const std::vector<std::string>
value;
487 static const std::vector<int>
value;
492 template <
typename T>
494 bool& ok,
bool report)
const {
503 return getInternal<T>(attr);
518 template <
typename T>
520 bool& ok, T defaultValue,
bool report)
const {
525 return getInternal<T>(attr);
virtual std::vector< std::string > getAttributeNames() const =0
Retrieves all attribute names.
SUMOSAXAttributes(const std::string &objectType)
const std::vector< int > getIntVector(int attr) const
Tries to read given attribute assuming it is an int vector.
static const long long int value
virtual RGBColor getColor() const =0
Returns the value of the named attribute.
static const std::string type
virtual SUMOSAXAttributes * clone() const =0
return a new deep-copy attributes object
virtual PositionVector getShape(int attr) const =0
Tries to read given attribute assuming it is a PositionVector.
virtual std::string getName(int attr) const =0
Converts the given attribute id into a man readable string.
std::string myObjectType
the object type to use in error reporting
static const PositionVector value
const std::string & getObjectType() const
return the objecttype to which these attributes belong
static const std::string type
static const Boundary value
static const std::string type
static const std::string value
static const std::vector< std::string > value
RightOfWay
algorithms for computing right of way
virtual bool hasAttribute(int id) const =0
Returns the information whether the named (by its enum-value) attribute is within the current list...
SUMOTime getSUMOTimeReporting(int attr, const char *objectid, bool &ok, bool report=true) const
Tries to read given attribute assuming it is a SUMOTime.
virtual SumoXMLEdgeFunc getEdgeFunc(bool &ok) const =0
Returns the value of the named attribute.
A class that stores a 2D geometrical boundary.
virtual std::string getString(int id) const =0
Returns the string-value of the named (by its enum-value) attribute.
static const std::string type
virtual RightOfWay getRightOfWay(bool &ok) const =0
Returns the right-of-way method.
static const std::string type
virtual long long int getLong(int id) const =0
Returns the long-value of the named (by its enum-value) attribute.
void emitFormatError(const std::string &attrname, const std::string &type, const char *objectid) const
Encapsulated SAX-Attributes.
T get(int attr, const char *objectid, bool &ok, bool report=true) const
Tries to read given attribute assuming it is an int.
static const std::string ENCODING
The encoding of parsed strings.
void emitUngivenError(const std::string &attrname, const char *objectid) const
static const RGBColor value
static const double value
const std::vector< std::string > getOptStringVector(int attr, const char *objectid, bool &ok, bool report=true) const
convenience function to avoid the default argument and the template stuff at getOpt<> ...
virtual Boundary getBoundary(int attr) const =0
Tries to read given attribute assuming it is a Boundary.
virtual SumoXMLNodeType getNodeType(bool &ok) const =0
Returns the value of the named attribute.
void emitEmptyError(const std::string &attrname, const char *objectid) const
const std::vector< int > getOptIntVector(int attr, const char *objectid, bool &ok, bool report=true) const
convenience function to avoid the default argument and the template stuff at getOpt<> ...
virtual void serialize(std::ostream &os) const =0
Prints all attribute names and values into the given stream.
static const std::string type
static const std::vector< int > value
virtual double getFloat(int id) const =0
Returns the double-value of the named (by its enum-value) attribute.
T getOpt(int attr, const char *objectid, bool &ok, T defaultValue, bool report=true) const
Tries to read given attribute assuming it is an int.
SumoXMLNodeType
Numbers representing special SUMO-XML-attribute values for representing node- (junction-) types used ...
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.
static const std::string type
virtual std::string getStringSecure(int id, const std::string &def) const =0
Returns the string-value of the named (by its enum-value) attribute.
const std::vector< std::string > getStringVector(int attr) const
Tries to read given attribute assuming it is a string vector.
T getInternal(const int attr) const
SumoXMLEdgeFunc
Numbers representing special SUMO-XML-attribute values for representing edge functions used in netbui...
static const std::string type
virtual ~SUMOSAXAttributes()
Destructor.
friend std::ostream & operator<<(std::ostream &os, const SUMOSAXAttributes &src)
virtual int getInt(int id) const =0
Returns the int-value of the named (by its enum-value) attribute.
virtual bool getBool(int id) const =0
Returns the bool-value of the named (by its enum-value) attribute.
static const std::string type
FringeType
algorithms for computing right of way
static const std::string type
static const std::string type
virtual FringeType getFringeType(bool &ok) const =0
returns fringe type
SUMOSAXAttributes & operator=(const SUMOSAXAttributes &src)
Invalidated assignment operator.