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,
""));
220 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_ID,
""));
221 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_SPEED,
""));
222 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_ALLOW,
""));
225 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_WIDTH,
""));
227 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_INDEX,
""));
230 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_ID,
""));
234 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_TYPE,
""));
237 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_ID,
""));
239 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_WIDTH,
""));
240 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_EDGES,
""));
243 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_FROM,
""));
244 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_TO,
""));
247 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_PASS,
"false"));
253 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_ID,
""));
254 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_LANE,
""));
256 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_ENDPOS,
"10"));
257 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_LINES,
""));
260 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_ID,
""));
261 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_LANE,
""));
263 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_ENDPOS,
"10"));
264 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_LINES,
""));
267 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_ID,
""));
268 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_LANE,
""));
270 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_ENDPOS,
"10"));
277 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_ID,
""));
278 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_LANE,
""));
281 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_FILE,
""));
285 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_ID,
""));
286 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_LANE,
""));
288 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_LENGTH,
"10"));
290 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_FILE,
""));
291 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_CONT,
"false"));
297 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_ID,
""));
299 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_FILE,
""));
304 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_LANE,
""));
308 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_LANE,
""));
312 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_ID,
""));
313 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_LANES,
""));
314 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_FILE,
""));
317 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_ID,
""));
318 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_LANE,
""));
325 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_ID,
""));
326 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_EDGES,
""));
327 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_FILE,
""));
328 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_PROB,
"1"));
329 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_OFF,
"false"));
332 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_ID,
""));
333 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_EDGE,
""));
335 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_FILE,
""));
336 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_BEGIN,
"0"));
339 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_EDGE,
""));
341 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_END,
"10"));
351 const std::vector<SumoXMLTag>&
377 const std::vector<SumoXMLTag>&
390 const std::vector<SumoXMLTag>&
466 if ((choices.size() == 2) && (choices.at(0) ==
"true") && (choices.at(1) ==
"false")) {
537 const std::vector<std::pair <SumoXMLAttr, std::string> >& attrs =
allowedAttributes(tag);
538 for (std::vector<std::pair <SumoXMLAttr, std::string> >::const_iterator i = attrs.begin(); i != attrs.end(); i++) {
539 if (i->first == attr) {
547 const std::vector<std::string>&
551 std::vector<std::string> choices;
553 for (std::vector<std::string>::const_iterator it = choices.begin(); it != choices.end(); ++it) {
563 for (std::vector<std::string>::const_iterator it = choices.begin(); it != choices.end(); ++it) {
568 for (std::vector<std::string>::const_iterator it = choices.begin(); it != choices.end(); ++it) {
741 int higherNumber = 0;
754 if ((*i).first == attr) {
767 if ((*i).first == attr) {
780 if ((*i).first == attr) {
790 template<> std::string
793 if ((*i).first == attr) {
803 template<> std::vector<int>
805 std::cout <<
"FINISH" << std::endl;
809 return std::vector<int>();
813 template<> std::vector<SUMOReal>
815 std::cout <<
"FINISH" << std::endl;
819 return std::vector<SUMOReal>();
823 template<> std::vector<bool>
825 std::cout <<
"FINISH" << std::endl;
829 return std::vector<bool>();
833 template<> std::vector<std::string>
836 if ((*i).first == attr) {
837 std::vector<std::string> myVectorString;
839 return myVectorString;
844 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
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 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