37 #ifdef CHECK_MEMORY_LEAKS
39 #endif // CHECK_MEMORY_LEAKS
106 std::vector<SumoXMLAttr>
108 std::vector<SumoXMLAttr> attr;
110 attr.push_back(i->first);
134 return value.find_first_of(
" \t\n\r@$%^&/|\\{}*'\";:<>") == std::string::npos;
142 return value.find_first_of(
"\t\n\r@$%^&|\\{}*'\";:<>") == std::string::npos;
153 for (
int i = 1; i < (int)value.size(); i++) {
154 if (value.at(i - 1) ==
' ' && value.at(i) ==
' ') {
159 if ((value.at(0) ==
' ') || (value.at(value.size() - 1) ==
' ')) {
164 std::string subString;
165 while (index < (
int)value.size()) {
166 if (value.at(index) ==
' ') {
173 subString.push_back(value.at(index));
185 const std::vector<std::pair <SumoXMLAttr, std::string> >&
192 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_ID,
""));
193 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_FROM,
""));
194 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_TO,
""));
195 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_SPEED,
""));
198 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_TYPE,
""));
199 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_ALLOW,
""));
202 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_SHAPE,
""));
205 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_NAME,
""));
206 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_WIDTH,
""));
210 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_ID,
""));
214 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_TYPE,
""));
215 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_SHAPE,
""));
219 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_TLID,
""));
222 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_ID,
""));
223 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_SPEED,
""));
224 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_ALLOW,
""));
227 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_WIDTH,
""));
229 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_INDEX,
""));
232 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_ID,
""));
236 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_TYPE,
""));
239 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_ID,
""));
241 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_WIDTH,
""));
242 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_EDGES,
""));
245 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_FROM,
""));
246 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_TO,
""));
249 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_PASS,
"false"));
256 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_ID,
""));
257 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_LANE,
""));
259 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_ENDPOS,
"10"));
260 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_LINES,
""));
263 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_ID,
""));
264 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_LANE,
""));
266 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_ENDPOS,
"10"));
267 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_LINES,
""));
270 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_ID,
""));
271 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_LANE,
""));
273 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_ENDPOS,
"10"));
280 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_ID,
""));
281 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_LANE,
""));
284 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_FILE,
""));
288 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_ID,
""));
289 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_LANE,
""));
291 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_LENGTH,
"10"));
293 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_FILE,
""));
294 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_CONT,
"false"));
300 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_ID,
""));
302 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_FILE,
""));
307 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_LANE,
""));
311 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_LANE,
""));
315 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_ID,
""));
316 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_LANES,
""));
317 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_FILE,
""));
320 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_ID,
""));
321 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_LANE,
""));
328 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_ID,
""));
329 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_EDGES,
""));
330 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_FILE,
""));
331 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_PROB,
"1"));
332 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_OFF,
"false"));
335 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_ID,
""));
336 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_EDGE,
""));
338 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_FILE,
""));
339 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_BEGIN,
"0"));
342 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_EDGE,
""));
344 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_END,
"10"));
354 const std::vector<SumoXMLTag>&
380 const std::vector<SumoXMLTag>&
393 const std::vector<SumoXMLTag>&
470 if ((choices.size() == 2) && (choices.at(0) ==
"true") && (choices.at(1) ==
"false")) {
541 const std::vector<std::pair <SumoXMLAttr, std::string> >& attrs =
allowedAttributes(tag);
542 for (std::vector<std::pair <SumoXMLAttr, std::string> >::const_iterator i = attrs.begin(); i != attrs.end(); i++) {
543 if (i->first == attr) {
551 const std::vector<std::string>&
555 std::vector<std::string> choices;
557 for (std::vector<std::string>::const_iterator it = choices.begin(); it != choices.end(); ++it) {
564 for (std::vector<std::string>::const_iterator it = choices.begin(); it != choices.end(); ++it) {
574 for (std::vector<std::string>::const_iterator it = choices.begin(); it != choices.end(); ++it) {
579 for (std::vector<std::string>::const_iterator it = choices.begin(); it != choices.end(); ++it) {
758 int higherNumber = 0;
771 if ((*i).first == attr) {
784 if ((*i).first == attr) {
797 if ((*i).first == attr) {
807 template<> std::string
810 if ((*i).first == attr) {
820 template<> std::vector<int>
822 std::cout <<
"FINISH" << std::endl;
826 return std::vector<int>();
830 template<> std::vector<SUMOReal>
832 std::cout <<
"FINISH" << std::endl;
836 return std::vector<SUMOReal>();
840 template<> std::vector<bool>
842 std::cout <<
"FINISH" << std::endl;
846 return std::vector<bool>();
850 template<> std::vector<std::string>
853 if ((*i).first == attr) {
854 std::vector<std::string> myVectorString;
856 return myVectorString;
861 return std::vector<std::string>();
static bool isList(SumoXMLAttr attr)
whether an attribute is of type bool
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 std::set< SumoXMLAttr > myUniqueAttrs
set with the unique attributes (i.e. attributes without default values)
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 ...
Whether vehicles must keep the junction clear.
static bool isNumerical(SumoXMLAttr attr)
whether an attribute is numerical (int or float)
const SumoXMLTag myTag
the xml tag to which this carrier corresponds
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
static StringBijection< LaneSpreadFunction > LaneSpreadFunctions
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 const std::string LOADED
feature is still unchanged after being loaded (implies approval)
static int getHigherNumberOfAttributes()
return the number of attributes of the tag with the most highter number of attributes ...
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
static std::map< SumoXMLTag, std::vector< std::pair< SumoXMLAttr, std::string > > > _allowedAttributes
map with the allowed attributes
static std::set< SumoXMLAttr > myNumericalFloatAttrs
set with the numerical attributes of type Float
virtual std::string getAttribute(SumoXMLAttr key) const =0
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)
#define WRITE_WARNING(msg)
static std::vector< SumoXMLTag > myAllowedNetElementTags
vector with the allowed tags of netElements
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 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 void parseStringVector(const std::string &def, std::vector< std::string > &into)
Splits the given string.
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
static std::vector< SumoXMLTag > myAllowedTags
vector with the allowed tags
static bool hasAttribute(SumoXMLTag tag, SumoXMLAttr attr)
check if a element with certain tag has a certain attribute
static const std::vector< SumoXMLTag > & allowedTags()
get all editable for tag.
static StringBijection< TrafficLightType > TrafficLightTypes
static bool hasParent(SumoXMLTag tag)
check if a element with certain tag has another additional element as parent
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
StringBijection< SUMOVehicleClass > SumoVehicleClassStrings(sumoVehicleClassStringInitializer, SVC_CUSTOM2, false)
const std::string getID() const
function to support debugging
std::string toString(const T &t, std::streamsize accuracy=OUTPUT_ACCURACY)
static bool isFloat(SumoXMLAttr attr)
whether an attribute is numerical of type float
GNEAttributeCarrier(SumoXMLTag tag)
Constructor.
static bool isValidStringVector(const std::string &value)
true if value is a valid string vector
static const std::vector< SumoXMLTag > & allowedAdditionalTags()
get all editable tags for additionals
static bool isInt(SumoXMLAttr attr)
whether an attribute is numerical or type int
static const std::string APPROVED
feature has been approved but not changed (i.e. after being reguessed)
static const std::vector< SumoXMLTag > & allowedNetElementTags()
get all editable tags for netElements
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
static SumoXMLTag getParentType(SumoXMLTag tag)
get parent's tag of a certain additional element
SumoXMLTag getTag() const
get Tag assigned to this object
static const std::string GUESSED
feature has been reguessed (may still be unchanged be we can't tell (yet)
static bool isUnique(SumoXMLAttr attr)
whether an attribute is unique (may not be edited for a multi-selection)
static bool isString(SumoXMLAttr attr)
whether an attribute is of type string
virtual bool isValid(SumoXMLAttr key, const std::string &value)
Information whether the detector shall be continued on the folowing lanes.
static T parse(const std::string &string)
parses a number of type T from string
static bool isBool(SumoXMLAttr attr)
whether an attribute is of type bool
static std::set< SumoXMLAttr > myListAttrs
set with the attributes of type list
static std::map< SumoXMLTag, SumoXMLTag > myAllowedAdditionalWithParentTags
map with the allowed tags of additionals with parent and their parent
static std::set< SumoXMLAttr > myNumericalIntAttrs
set with the numerical attributes of type Int