64 #define NODEFAULTVALUE "<NODEFAULTVALUE>" 93 template<> std::string
101 if (
string.size() == 0) {
113 if (
string.size() == 0) {
123 template<> std::vector<std::string>
125 std::vector<std::string> parsedValues;
131 template<> std::vector<int>
133 std::vector<std::string> parsedValues = parse<std::vector<std::string> >(string);
134 std::vector<int> parsedIntValues;
135 for (std::vector<std::string>::const_iterator i = parsedValues.begin(); i != parsedValues.end(); i++) {
136 parsedIntValues.push_back(parse<int>(*i));
138 return parsedIntValues;
142 template<> std::vector<double>
144 std::vector<std::string> parsedValues = parse<std::vector<std::string> >(string);
145 std::vector<double> parsedDoubleValues;
146 for (std::vector<std::string>::const_iterator i = parsedValues.begin(); i != parsedValues.end(); i++) {
147 parsedDoubleValues.push_back(parse<double>(*i));
149 return parsedDoubleValues;
153 template<> std::vector<bool>
155 std::vector<std::string> parsedValues = parse<std::vector<std::string> >(string);
156 std::vector<bool> parsedBoolValues;
157 for (std::vector<std::string>::const_iterator i = parsedValues.begin(); i != parsedValues.end(); i++) {
158 parsedBoolValues.push_back(parse<bool>(*i));
160 return parsedBoolValues;
195 std::vector<SumoXMLAttr>
197 std::vector<SumoXMLAttr> attr;
199 attr.push_back(i->first);
213 if (
isInt(tag, attr)) {
215 }
else if (
isFloat(tag, attr)) {
217 }
else if (
isTime(tag, attr)) {
219 }
else if (
isBool(tag, attr)) {
223 }
else if (
isList(tag, attr)) {
233 return value.find_first_of(
" \t\n\r@$%^&/|\\{}*'\";:<>") == std::string::npos;
241 return (value.find_first_of(
"\t\n\r@$%^&|\\{}*'\";:<>") == std::string::npos);
249 const std::vector<std::pair <SumoXMLAttr, std::string> >&
259 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_SPEED,
"13.89"));
262 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_TYPE,
""));
263 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_ALLOW,
"all"));
266 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_SHAPE,
""));
269 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_NAME,
""));
270 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_WIDTH,
"default"));
278 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_TYPE,
""));
279 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_SHAPE,
""));
280 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_RADIUS,
"1.5"));
283 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_TLID,
""));
287 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_SPEED,
"13.89"));
288 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_ALLOW,
"all"));
291 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_WIDTH,
"default"));
299 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_TYPE,
""));
305 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_WIDTH,
"3"));
312 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_PASS,
"false"));
323 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_LINES,
""));
330 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_LINES,
""));
347 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_FILE,
""));
354 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_LENGTH,
"10"));
356 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_FILE,
""));
357 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_CONT,
"false"));
364 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_X,
"0"));
365 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_Y,
"0"));
367 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_FILE,
""));
381 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_LANES,
""));
382 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_FILE,
""));
395 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_FILE,
""));
396 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_PROB,
"1"));
397 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_OFF,
"false"));
403 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_FILE,
""));
404 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_BEGIN,
"0"));
409 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_END,
"10"));
418 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_PERIOD,
"-1"));
419 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_PROB,
"-1"));
420 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_NUMBER,
"100"));
427 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_LINE,
""));
430 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_REROUTE,
"false"));
437 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_COLOR,
""));
441 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_ACCEL,
"2.6"));
442 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_DECEL,
"4.5"));
443 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_SIGMA,
"0.5"));
444 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_TAU,
"1.0"));
445 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_LENGTH,
"5.0"));
446 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_MINGAP,
"2.5"));
450 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_COLOR,
"1,1,0"));
451 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_VCLASS,
"unknown"));
454 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_WIDTH,
"2.0"));
469 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_SPEED,
"50.0"));
480 const std::vector<SumoXMLTag>&
918 const std::vector<std::pair <SumoXMLAttr, std::string> >& attrs =
allowedAttributes(tag);
919 for (std::vector<std::pair <SumoXMLAttr, std::string> >::const_iterator i = attrs.begin(); i != attrs.end(); i++) {
920 if (i->first == attr) {
931 const std::vector<std::pair <SumoXMLAttr, std::string> >& attrs =
allowedAttributes(tag);
932 for (std::vector<std::pair <SumoXMLAttr, std::string> >::const_iterator i = attrs.begin(); i != attrs.end(); i++) {
933 if ((*i).first == attr) {
945 const std::vector<std::string>&
949 std::vector<std::string> choices;
952 for (std::vector<std::string>::const_iterator it = choices.begin(); it != choices.end(); ++it) {
960 for (std::vector<std::string>::const_iterator it = choices.begin(); it != choices.end(); ++it) {
968 for (std::vector<std::string>::const_iterator it = choices.begin(); it != choices.end(); ++it) {
974 for (std::vector<std::string>::const_iterator it = choices.begin(); it != choices.end(); ++it) {
986 for (std::vector<std::string>::const_iterator it = choices.begin(); it != choices.end(); ++it) {
1220 return parse<int>((*i).second);
1232 return parse<double>((*i).second);
1244 return parse<bool>((*i).second);
1252 template<> std::string
1268 return parse<SUMOVehicleClass>((*i).second);
1281 return parse<SUMOVehicleShape>((*i).second);
1289 template<> std::vector<int>
1293 return parse<std::vector<int> >((*i).second);
1301 template<> std::vector<double>
1305 return parse<std::vector<double> >((*i).second);
1313 template<> std::vector<bool>
1317 return parse<std::vector<bool> >((*i).second);
1325 template<> std::vector<std::string>
1328 if ((*i).first == attr) {
1329 return parse<std::vector<std::string> >((*i).second);
static bool _str2Bool(const std::string &sData)
converts a string into the bool value described by it by calling the char-type converter ...
The information about how to spread the lanes from the given position.
SumoXMLTag
Numbers representing SUMO-XML - element names.
static StringBijection< SumoXMLNodeType > NodeTypes
node types
static bool isFloat(SumoXMLTag tag, SumoXMLAttr attr)
whether an attribute is numerical of type float
description of a vehicle type
Whether vehicles must keep the junction clear.
static std::string getAttributeType(SumoXMLTag tag, SumoXMLAttr attr)
get type of attribute
GNEAttributeCarrier(SumoXMLTag tag, GUIIcon icon)
Constructor.
const SumoXMLTag myTag
the xml tag to which this attribute carrier corresponds
begin/end of the description of a junction
begin/end of the description of a single lane
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types...
StringBijection< SUMOVehicleShape > SumoVehicleShapeStrings(sumoVehicleShapeStringInitializer, SVS_UNKNOWN, false)
a flow definition (used by router)
static std::map< SumoXMLTag, std::map< SumoXMLAttr, std::string > > myAttrDefinitions
map with the definition of attributes
static bool isDiscrete(SumoXMLTag tag, SumoXMLAttr attr)
whether an attribute is Discrete
GUIIcon
An enumeration of icons used by the gui applications.
static StringBijection< LaneSpreadFunction > LaneSpreadFunctions
lane spread functions
static std::map< SumoXMLTag, std::set< SumoXMLAttr > > myPositiveAttrs
map with the positive attributes
connectio between two lanes
Allow/disallow charge in transit in Charging Stations.
static std::map< SumoXMLTag, std::set< SumoXMLAttr > > myUniqueAttrs
map with the unique attributes (i.e. attributes without default values)
static std::map< SumoXMLTag, std::map< SumoXMLAttr, std::vector< std::string > > > myDiscreteChoices
map with the values of discrete choices
foe visibility distance of a link
static std::map< SumoXMLTag, std::set< SumoXMLAttr > > myBoolAttrs
map with the boolean attributes
static const std::string LOADED
feature is still unchanged after being loaded (implies approval)
static std::map< SumoXMLTag, std::set< SumoXMLAttr > > myProbabilityAttrs
map with the probability attributes
static int getHigherNumberOfAttributes()
return the number of attributes of the tag with the most highter number of attributes ...
GUIIcon myIcon
icon associated to this AC
static std::map< SumoXMLTag, std::set< SumoXMLAttr > > myTimeAttrs
map with the attributes of type time
weights: time range begin
link,node: the traffic light id responsible for this link
static bool isPositive(SumoXMLTag tag, SumoXMLAttr attr)
whether an attribute is only Positive (i.e. cannot take negative values)
FXIcon * getIcon() const
get FXIcon assigned to this object
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
begin/end of the description of a polygon
static std::map< SumoXMLTag, std::vector< std::pair< SumoXMLAttr, std::string > > > _allowedAttributes
map with the allowed attributes and their default values
static bool isValidFilename(const std::string &value)
true if value is a valid file value
virtual std::string getAttribute(SumoXMLAttr key) const =0
first coordinate of edge shape
static const std::vector< std::pair< SumoXMLAttr, std::string > > & allowedAttributes(SumoXMLTag tag)
get all editable attributes for tag and their default values.
#define UNUSED_PARAMETER(x)
begin/end of the description of a route
std::vector< std::string > getStrings() const
static double _str2double(const std::string &sData)
converts a string into the double value described by it by calling the char-type converter ...
static std::vector< SumoXMLTag > myAllowedNetElementTags
vector with the allowed tags of netElements
static bool isString(SumoXMLTag tag, SumoXMLAttr attr)
whether an attribute is of type string
static const std::vector< std::string > & discreteChoices(SumoXMLTag tag, SumoXMLAttr attr)
return a list of discrete choices for this attribute or an empty vector
static std::map< SumoXMLTag, std::set< SumoXMLAttr > > myListAttrs
map with the attributes of type list
static bool isInt(SumoXMLTag tag, SumoXMLAttr attr)
whether an attribute is numerical or type int
static bool isValidID(const std::string &value)
true if value is a valid sumo ID
static const std::string MODIFIED
feature has been manually modified (implies approval)
static bool isTime(SumoXMLTag tag, SumoXMLAttr attr)
whether an attribute is time
static void parseStringVector(const std::string &def, std::vector< std::string > &into)
Splits the given string.
static bool isNonEditable(SumoXMLTag tag, SumoXMLAttr attr)
whether an attribute is non editable
The turning radius at an intersection in m.
static std::vector< SumoXMLTag > myAllowedAdditionalTags
vector with the allowed tags of additionals
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
static bool hasAttribute(SumoXMLTag tag, SumoXMLAttr attr)
check if an element with certain tag has a certain attribute
static bool hasDefaultValue(SumoXMLTag tag, SumoXMLAttr attr)
check if attribute of an element has a default avlue
static StringBijection< TrafficLightType > TrafficLightTypes
traffic light types
static bool isFilename(SumoXMLTag tag, SumoXMLAttr attr)
whether a string attribute is a filename
static int _str2int(const std::string &sData)
converts a string into the integer value described by it by calling the char-type converter...
virtual std::string getDescription()
how should this attribute carrier be called
static T getDefaultValue(SumoXMLTag tag, SumoXMLAttr attr)
return the default value of the attribute of an element
static const std::vector< SumoXMLTag > & allowedTags(bool net)
get all editable for tag (net or additional).
node: the type of traffic light
edge: the shape in xml-definition
std::vector< SumoXMLAttr > getAttrs() const
get vector of attributes
const std::string getID() const
function to support debugging
StringBijection< SUMOVehicleClass > SumoVehicleClassStrings(sumoVehicleClassStringInitializer, SVC_CUSTOM2, false)
static std::map< SumoXMLTag, std::set< SumoXMLAttr > > myNonEditableAttrs
map with the non-editable attributes
begin/end of the description of an edge
static bool isUnique(SumoXMLTag tag, SumoXMLAttr attr)
whether an attribute is unique (may not be edited for a multi-selection and don't have a default valu...
static int myMaxNumAttribute
maximum number of attributes of all tags
trigger: the time of the step
static bool isProbability(SumoXMLTag tag, SumoXMLAttr attr)
whether an attribute is a probability (i.e. oly can values between [0, 1])
SUMOVehicleShape
Definition of vehicle classes to differ between different appearences.
static const std::string APPROVED
feature has been approved but not changed (i.e. after being reguessed)
static bool isBool(SumoXMLTag tag, SumoXMLAttr attr)
whether an attribute is of type bool for a certain tag
crossing between edges for pedestrians
static std::string getDefinition(SumoXMLTag tag, SumoXMLAttr attr)
return definition of a certain SumoXMLAttr
static bool discreteCombinableChoices(SumoXMLTag tag, SumoXMLAttr attr)
return whether the given attribute allows for a combination of discrete values
Eficiency of the charge in Charging Stations.
static const std::string GUESSED
feature has been reguessed (may still be unchanged be we can't tell (yet)
GUIIcon getGUIIcon() const
get GUI icon assigned to this object
last coordinate of edge shape
Delay in the charge of charging stations.
static bool isNumerical(SumoXMLTag tag, SumoXMLAttr attr)
whether an attribute is numerical (int or float)
virtual bool isValid(SumoXMLAttr key, const std::string &value)
static std::map< SumoXMLTag, std::set< SumoXMLAttr > > myNumericalIntAttrs
map with the numerical attributes of type Int
static T parse(const std::string &string)
parses a number of type T from string
static FXIcon * getIcon(GUIIcon which)
returns a icon previously defined in the enum GUIIcon
static std::map< SumoXMLTag, std::set< SumoXMLAttr > > myNumericalFloatAttrs
map with the numerical attributes of type Float
vehicles ignoring classes
static std::map< SumoXMLTag, SumoXMLTag > myAllowedAdditionalWithParentTags
map with the allowed tags of additionals with parent and their parent
static bool isList(SumoXMLTag tag, SumoXMLAttr attr)
whether an attribute is of type bool
trigger: a step description
SumoXMLTag getTag() const
get XML Tag assigned to this object
static std::map< SumoXMLTag, std::set< SumoXMLAttr > > myFileAttrs
map with the empty attributes