48 myObjectType(objectType) {}
65 bool& ok,
bool report)
const {
74 const std::string val = getInternal<std::string>(attr);
92 bool& ok,
SUMOTime defaultValue,
bool report)
const {
97 const std::string val = getInternal<std::string>(attr);
113 const std::vector<std::string>
123 const std::vector<std::string>
125 return getOpt<std::vector<std::string> >(attr, objectid, ok, std::vector<std::string>(), report);
128 const std::vector<int>
134 std::vector<int> ret;
135 for (
const std::string& s : tmp) {
142 const std::vector<int>
144 return getOpt<std::vector<int> >(attr, objectid, ok, std::vector<int>(), report);
149 std::ostringstream oss;
150 oss <<
"Attribute '" << attrname <<
"' is missing in definition of ";
151 if (objectid ==
nullptr || objectid[0] == 0) {
163 std::ostringstream oss;
164 oss <<
"Attribute '" << attrname <<
"' in definition of ";
165 if (objectid ==
nullptr || objectid[0] == 0) {
177 std::ostringstream oss;
178 oss <<
"Attribute '" << attrname <<
"' in definition of ";
179 if (objectid ==
nullptr || objectid[0] == 0) {
184 oss <<
" is not " << type <<
".";
SUMOSAXAttributes(const std::string &objectType)
const std::vector< int > getIntVector(int attr) const
Tries to read given attribute assuming it is an int vector.
virtual RGBColor getColor() const =0
Returns the value of the named attribute.
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
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.
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.
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
static const std::string ENCODING
The encoding of parsed strings.
SUMOTime string2time(const std::string &r)
void emitUngivenError(const std::string &attrname, const char *objectid) const
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.
static int toInt(const std::string &sData)
converts a string into the integer value described by it by calling the char-type converter...
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<> ...
std::vector< std::string > getVector()
return vector of strings
virtual double getFloat(int id) const =0
Returns the double-value of the named (by its enum-value) attribute.
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.
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
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.