38 #ifdef CHECK_MEMORY_LEAKS 40 #endif // CHECK_MEMORY_LEAKS 67 #define NODEFAULTVALUE "<NODEFAULTVALUE>" 96 template<> std::string
133 std::vector<SumoXMLAttr>
135 std::vector<SumoXMLAttr> attr;
137 attr.push_back(i->first);
151 if (
isInt(tag, attr)) {
153 }
else if (
isFloat(tag, attr)) {
155 }
else if (
isTime(tag, attr)) {
157 }
else if (
isBool(tag, attr)) {
161 }
else if (
isList(tag, attr)) {
171 return value.find_first_of(
" \t\n\r@$%^&/|\\{}*'\";:<>") == std::string::npos;
179 return value.find_first_of(
"\t\n\r@$%^&|\\{}*'\";:<>") == std::string::npos;
190 for (
int i = 1; i < (int)value.size(); i++) {
191 if (value.at(i - 1) ==
' ' && value.at(i) ==
' ') {
196 if ((value.at(0) ==
' ') || (value.at(value.size() - 1) ==
' ')) {
201 std::string subString;
202 while (index < (
int)value.size()) {
203 if (value.at(index) ==
' ') {
210 subString.push_back(value.at(index));
222 const std::vector<std::pair <SumoXMLAttr, std::string> >&
232 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_SPEED,
"13.89"));
235 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_TYPE,
""));
236 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_ALLOW,
"all"));
239 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_SHAPE,
""));
242 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_NAME,
""));
243 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_WIDTH,
"default"));
249 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_TYPE,
""));
250 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_SHAPE,
""));
251 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_RADIUS,
"1.5"));
254 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_TLID,
""));
258 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_SPEED,
"13.89"));
259 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_ALLOW,
"all"));
262 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_WIDTH,
"default"));
269 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_TYPE,
""));
275 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_WIDTH,
"3"));
282 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_PASS,
"false"));
293 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_LINES,
""));
300 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_LINES,
""));
317 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_FILE,
""));
324 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_LENGTH,
"10"));
326 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_FILE,
""));
327 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_CONT,
"false"));
334 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_X,
"0"));
335 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_Y,
"0"));
337 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_FILE,
""));
351 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_LANES,
""));
352 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_FILE,
""));
365 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_FILE,
""));
366 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_PROB,
"1"));
367 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_OFF,
"false"));
373 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_FILE,
""));
374 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_BEGIN,
"0"));
379 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_END,
"10"));
390 const std::vector<SumoXMLTag>&
673 const std::vector<std::pair <SumoXMLAttr, std::string> >& attrs =
allowedAttributes(tag);
674 for (std::vector<std::pair <SumoXMLAttr, std::string> >::const_iterator i = attrs.begin(); i != attrs.end(); i++) {
675 if (i->first == attr) {
687 if ((*i).first == attr) {
699 const std::vector<std::string>&
703 std::vector<std::string> choices;
706 for (std::vector<std::string>::const_iterator it = choices.begin(); it != choices.end(); ++it) {
713 for (std::vector<std::string>::const_iterator it = choices.begin(); it != choices.end(); ++it) {
720 for (std::vector<std::string>::const_iterator it = choices.begin(); it != choices.end(); ++it) {
725 for (std::vector<std::string>::const_iterator it = choices.begin(); it != choices.end(); ++it) {
931 template<> std::string
943 template<> std::vector<int>
945 std::cout <<
"FINISH" << std::endl;
952 template<> std::vector<SUMOReal>
954 std::cout <<
"FINISH" << std::endl;
961 template<> std::vector<bool>
963 std::cout <<
"FINISH" << std::endl;
970 template<> std::vector<std::string>
973 if ((*i).first == attr) {
974 std::vector<std::string> myVectorString;
976 return myVectorString;
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
static SUMOReal _str2SUMOReal(const std::string &sData)
converts a string into the SUMOReal value described by it by calling the char-type converter ...
static bool isFloat(SumoXMLTag tag, SumoXMLAttr attr)
whether an attribute is numerical of type float
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
std::vector< SumoXMLAttr > getAttrs() const
get vector of attributes
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)
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 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)
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
std::vector< std::string > getStrings() const
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 bool isValidFileValue(const std::string &value)
true if value is a valid file value
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 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
StringBijection< SUMOVehicleClass > SumoVehicleClassStrings(sumoVehicleClassStringInitializer, SVC_CUSTOM2, false)
const std::string getID() const
function to support debugging
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
FXIcon * getIcon() const
get FXIcon assigned to this object
static bool isValidStringVector(const std::string &value)
true if value is a valid string vector
static bool isProbability(SumoXMLTag tag, SumoXMLAttr attr)
whether an attribute is a probability (i.e. oly can values between [0, 1])
virtual std::string getAttribute(SumoXMLAttr key) const =0
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
SumoXMLTag getTag() const
get XML Tag assigned to this object
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)
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)
GUIIcon getGUIIcon() const
get GUI icon assigned to this object
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
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