Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
SUMOVehicleParameter.cpp
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3// Copyright (C) 2001-2023 German Aerospace Center (DLR) and others.
4// This program and the accompanying materials are made available under the
5// terms of the Eclipse Public License 2.0 which is available at
6// https://www.eclipse.org/legal/epl-2.0/
7// This Source Code may also be made available under the following Secondary
8// Licenses when the conditions for such availability set forth in the Eclipse
9// Public License 2.0 are satisfied: GNU General Public License, version 2
10// or later which is available at
11// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13/****************************************************************************/
20// Structure representing possible vehicle parameter
21/****************************************************************************/
22#include <config.h>
30
32
33// ===========================================================================
34// member method definitions
35// ===========================================================================
36
38 : tag(SUMO_TAG_NOTHING), vtypeid(DEFAULT_VTYPE_ID), color(RGBColor::DEFAULT_COLOR),
39 depart(-1), departProcedure(DepartDefinition::GIVEN),
40 departLane(0), departLaneProcedure(DepartLaneDefinition::DEFAULT),
41 departPos(0), departPosProcedure(DepartPosDefinition::DEFAULT),
42 departPosLat(0), departPosLatProcedure(DepartPosLatDefinition::DEFAULT),
43 departSpeed(-1), departSpeedProcedure(DepartSpeedDefinition::DEFAULT),
44 departEdge(0), departEdgeProcedure(RouteIndexDefinition::DEFAULT),
45 arrivalLane(0), arrivalLaneProcedure(ArrivalLaneDefinition::DEFAULT),
46 arrivalPos(0), arrivalPosProcedure(ArrivalPosDefinition::DEFAULT),
47 arrivalPosLat(0), arrivalPosLatProcedure(ArrivalPosLatDefinition::DEFAULT),
48 arrivalSpeed(-1), arrivalSpeedProcedure(ArrivalSpeedDefinition::DEFAULT),
49 arrivalEdge(-1), arrivalEdgeProcedure(RouteIndexDefinition::DEFAULT),
50 repetitionNumber(-1),
51 repetitionsDone(-1),
52 repetitionOffset(-1),
53 repetitionTotalOffset(0),
54 repetitionProbability(-1),
55 repetitionEnd(-1),
56 line(), fromTaz(), toTaz(), personNumber(0), containerNumber(0),
57 speedFactor(-1),
58 calibratorSpeed(-1),
59 insertionChecks((int)InsertionCheck::ALL),
60 parametersSet(0)
61{ }
62
63
66
67
68bool
69SUMOVehicleParameter::defaultOptionOverrides(const OptionsCont& oc, const std::string& optionName) const {
70 return oc.exists(optionName) && oc.isSet(optionName) && oc.getBool("defaults-override");
71}
72
73
74void
75SUMOVehicleParameter::write(OutputDevice& dev, const OptionsCont& oc, const SumoXMLTag altTag, const std::string& typeID) const {
76 if (!id.empty()) {
77 // only used by calibrator flows
78 dev.openTag(altTag).writeAttr(SUMO_ATTR_ID, id);
79 }
80 if (typeID == "") {
83 }
84 } else {
85 dev.writeAttr(SUMO_ATTR_TYPE, typeID);
86 }
87 // write depart depending of tag
88 if (altTag == SUMO_TAG_FLOW
89 || altTag == SUMO_TAG_PERSONFLOW
90 || altTag == SUMO_TAG_CONTAINERFLOW
91 || altTag == GNE_TAG_FLOW_ROUTE
92 || altTag == GNE_TAG_FLOW_WITHROUTE
93 || altTag == SUMO_TAG_FLOWSTATE) {
95 } else {
97 }
98 // optional parameter
99 // departlane
100 if (wasSet(VEHPARS_DEPARTLANE_SET) && !defaultOptionOverrides(oc, "departlane")) {
102 } else if (oc.exists("departlane") && oc.isSet("departlane")) {
103 dev.writeNonEmptyAttr(SUMO_ATTR_DEPARTLANE, oc.getString("departlane"));
104 }
105 // departpos
106 if (wasSet(VEHPARS_DEPARTPOS_SET) && !defaultOptionOverrides(oc, "departpos")) {
108 } else if (oc.exists("departpos") && oc.isSet("departpos")) {
109 dev.writeNonEmptyAttr(SUMO_ATTR_DEPARTPOS, oc.getString("departpos"));
110 }
111 // departPosLat
114 }
115 // departspeed
116 if (wasSet(VEHPARS_DEPARTSPEED_SET) && !defaultOptionOverrides(oc, "departspeed")) {
118 } else if (oc.exists("departspeed") && oc.isSet("departspeed")) {
119 dev.writeNonEmptyAttr(SUMO_ATTR_DEPARTSPEED, oc.getString("departspeed"));
120 }
121 // departedge
122 if (wasSet(VEHPARS_DEPARTEDGE_SET) && !defaultOptionOverrides(oc, "departedge")) {
124 } else if (oc.exists("departedge") && oc.isSet("departedge")) {
125 dev.writeNonEmptyAttr(SUMO_ATTR_DEPARTEDGE, oc.getString("departedge"));
126 }
127 // arrivallane
128 if (wasSet(VEHPARS_ARRIVALLANE_SET) && !defaultOptionOverrides(oc, "arrivallane")) {
130 } else if (oc.exists("arrivallane") && oc.isSet("arrivallane")) {
131 dev.writeNonEmptyAttr(SUMO_ATTR_ARRIVALLANE, oc.getString("arrivallane"));
132 }
133 // arrivalpos
134 if (wasSet(VEHPARS_ARRIVALPOS_SET) && !defaultOptionOverrides(oc, "arrivalpos")) {
136 } else if (oc.exists("arrivalpos") && oc.isSet("arrivalpos")) {
137 dev.writeNonEmptyAttr(SUMO_ATTR_ARRIVALPOS, oc.getString("arrivalpos"));
138 }
139 // arrivalPosLat
142 }
143 // arrivalspeed
144 if (wasSet(VEHPARS_ARRIVALSPEED_SET) && !defaultOptionOverrides(oc, "arrivalspeed")) {
146 } else if (oc.exists("arrivalspeed") && oc.isSet("arrivalspeed")) {
147 dev.writeNonEmptyAttr(SUMO_ATTR_ARRIVALSPEED, oc.getString("arrivalspeed"));
148 }
149 // arrivalEdge
150 if (wasSet(VEHPARS_ARRIVALEDGE_SET) && !defaultOptionOverrides(oc, "arrivaledge") && arrivalEdge >= 0) {
152 } else if (oc.exists("arrivaledge") && oc.isSet("arrivaledge")) {
153 dev.writeNonEmptyAttr(SUMO_ATTR_ARRIVALEDGE, oc.getString("arrivaledge"));
154 }
155 // color
158 }
159 // line
162 }
163 // from TAZ
166 }
167 // to TAZ
170 }
171 // person number
174 }
175 // container number
178 }
179 // individual speedFactor
181 // might be saving state with custom precision
182 const int precision = dev.precision();
183 dev.setPrecision(MAX2(gPrecisionRandom, precision));
185 dev.setPrecision(precision);
186 }
187 // speed (only used by calibrators)
190 }
191 // speed (only used by calibrators)
193 std::vector<std::string> checks;
195 checks.push_back(toString(InsertionCheck::NONE));
196 } else {
198 if (((int)it & insertionChecks) != 0) {
199 checks.push_back(toString(it));
200 }
201 }
202 }
204 }
205}
206
207
208void
209SUMOVehicleParameter::Stop::write(OutputDevice& dev, const bool close, const bool writeTagAndParents) const {
210 if (writeTagAndParents) {
212 if (busstop != "") {
214 }
215 if (containerstop != "") {
217 }
218 if (chargingStation != "") {
220 }
221 if (parkingarea != "") {
223 }
224 if ((busstop == "") && (containerstop == "") && (parkingarea == "") && (chargingStation == "")) {
225 if (lane != "") {
227 } else {
229 }
230 if ((parametersSet & STOP_START_SET) != 0) {
232 }
233 if ((parametersSet & STOP_END_SET) != 0) {
235 }
236 }
237 }
240 }
241 if ((parametersSet & STOP_ARRIVAL_SET) && (arrival >= 0)) {
243 }
244 if ((parametersSet & STOP_DURATION_SET) && (duration >= 0)) {
246 }
247 if ((parametersSet & STOP_UNTIL_SET) && (until >= 0)) {
249 }
250 if ((parametersSet & STOP_STARTED_SET) && (started >= 0)) {
252 }
253 if ((parametersSet & STOP_ENDED_SET) && (ended >= 0)) {
255 }
256 if ((parametersSet & STOP_EXTENSION_SET) && (extension >= 0)) {
258 }
259 if ((parametersSet & STOP_TRIGGER_SET) != 0) {
260 const std::vector<std::string> triggers = getTriggers();
261 if (triggers.size() > 0) {
262 dev.writeAttr(SUMO_ATTR_TRIGGERED, triggers);
263 }
264 }
265 if ((parametersSet & STOP_PARKING_SET) != 0) {
267 }
268 if ((parametersSet & STOP_EXPECTED_SET) != 0 && awaitedPersons.size() > 0) {
270 }
271 if ((parametersSet & STOP_PERMITTED_SET) != 0 && permitted.size() > 0) {
273 }
276 }
277 if ((parametersSet & STOP_TRIP_ID_SET) != 0) {
279 }
280 if ((parametersSet & STOP_LINE_SET) != 0) {
282 }
283 if ((parametersSet & STOP_SPLIT_SET) != 0) {
285 }
286 if ((parametersSet & STOP_JOIN_SET) != 0) {
288 }
289 if ((parametersSet & STOP_SPEED_SET) != 0) {
291 }
292 if ((parametersSet & STOP_ONDEMAND_SET) != 0) {
294 }
295 if ((parametersSet & STOP_JUMP_SET) != 0 && jump >= 0) {
297 }
298 if (collision) {
300 }
301 // only write friendly position if is true
302 if (friendlyPos == true) {
304 }
305 // only write act type if isn't empty
306 if (!actType.empty()) {
308 }
309 if (close) {
310 // the user is closing the stop it is responsible for writing params
311 writeParams(dev);
312 dev.closeTag();
313 }
314}
315
316
317bool
318SUMOVehicleParameter::parseDepart(const std::string& val, const std::string& element, const std::string& id,
319 SUMOTime& depart, DepartDefinition& dd, std::string& error, const std::string& attr) {
320 if (val == "triggered") {
322 } else if (val == "containerTriggered") {
324 } else if (val == "now") {
325 // only used via TraCI. depart must be set by the calling code
327 } else if (val == "split") {
329 } else if (val == "begin") {
331 } else {
332 try {
333 depart = string2time(val);
335 if (depart < 0) {
336 error = "Negative " + attr + " time in the definition of " + element + " '" + id + "'.";
337 return false;
338 }
339 } catch (...) {
340 if (id.empty()) {
341 error = "Invalid " + attr + " time for " + element + ". Must be one of (\"triggered\", \"containerTriggered\", \"now\", or a float >= 0)";
342 } else {
343 error = "Invalid " + attr + " time for " + element + " '" + id + "';\n must be one of (\"triggered\", \"containerTriggered\", \"now\", or a float >= 0)";
344 }
345 return false;
346 }
347 }
348 return true;
349}
350
351
352bool
353SUMOVehicleParameter::parseDepartLane(const std::string& val, const std::string& element, const std::string& id,
354 int& lane, DepartLaneDefinition& dld, std::string& error) {
355 bool ok = true;
356 lane = 0;
358 if (val == "random") {
360 } else if (val == "free") {
362 } else if (val == "allowed") {
364 } else if (val == "best") {
366 } else if (val == "first") {
368 } else {
369 try {
370 lane = StringUtils::toInt(val);
371 if (lane < 0) {
372 ok = false;
373 }
374 } catch (...) {
375 ok = false;
376 }
377 }
378 if (!ok) {
379 if (id.empty()) {
380 error = "Invalid departLane definition for " + element + ". Must be one of (\"random\", \"free\", \"allowed\", \"best\", \"first\", or an int>=0)";
381 } else {
382 error = "Invalid departLane definition for " + element + " '" + id + "';\n must be one of (\"random\", \"free\", \"allowed\", \"best\", \"first\", or an int>=0)";
383 }
384 }
385 return ok;
386}
387
388
389bool
390SUMOVehicleParameter::parseDepartPos(const std::string& val, const std::string& element, const std::string& id,
391 double& pos, DepartPosDefinition& dpd, std::string& error) {
392 bool ok = true;
393 pos = 0.;
395 if (val == "random") {
397 } else if (val == "random_free") {
399 } else if (val == "free") {
401 } else if (val == "base") {
403 } else if (val == "last") {
405 } else if (val == "stop") {
407 } else {
408 try {
409 pos = StringUtils::toDouble(val);
410 } catch (...) {
411 ok = false;
412 }
413 }
414 if (!ok) {
415 if (id.empty()) {
416 error = "Invalid departPos definition for " + element + ". Must be one of (\"random\", \"random_free\", \"free\", \"base\", \"last\" or a float)";
417 } else {
418 error = "Invalid departPos definition for " + element + " '" + id + "';\n must be one of (\"random\", \"random_free\", \"free\", \"base\", \"last\" or a float)";
419 }
420 }
421 return ok;
422}
423
424
425bool
426SUMOVehicleParameter::parseDepartPosLat(const std::string& val, const std::string& element, const std::string& id,
427 double& pos, DepartPosLatDefinition& dpd, std::string& error) {
428 bool ok = true;
429 pos = 0.;
431 if (val == "random") {
433 } else if (val == "random_free") {
435 } else if (val == "free") {
437 } else if (val == "right") {
439 } else if (val == "center") {
441 } else if (val == "left") {
443 } else {
444 try {
445 pos = StringUtils::toDouble(val);
446 } catch (...) {
447 ok = false;
448 }
449 }
450 if (!ok) {
451 if (id.empty()) {
452 error = "Invalid departPosLat definition for " + element + ". Must be one of (\"random\", \"random_free\", \"free\", \"right\", \"center\", \"left\", or a float)";
453 } else {
454 error = "Invalid departPosLat definition for " + element + " '" + id + "';\n must be one of (\"random\", \"random_free\", \"free\", \"right\", \"center\", \"left\", or a float)";
455 }
456 }
457 return ok;
458}
459
460
461bool
462SUMOVehicleParameter::parseDepartSpeed(const std::string& val, const std::string& element, const std::string& id,
463 double& speed, DepartSpeedDefinition& dsd, std::string& error) {
464 bool ok = true;
465 speed = -1.;
467 if (val == "random") {
469 } else if (val == "max") {
471 } else if (val == "desired") {
473 } else if (val == "speedLimit") {
475 } else if (val == "last") {
477 } else if (val == "avg") {
479 } else {
480 try {
481 speed = StringUtils::toDouble(val);
482 if (speed < 0) {
483 ok = false;
484 }
485 } catch (...) {
486 ok = false;
487 }
488 }
489 if (!ok) {
490 if (id.empty()) {
491 error = "Invalid departSpeed definition for " + element + ". Must be one of (\"random\", \"max\", or a float>=0)";
492 } else {
493 error = "Invalid departSpeed definition for " + element + " '" + id + "';\n must be one of (\"random\", \"max\", or a float>=0)";
494 }
495 }
496 return ok;
497}
498
499
500bool
501SUMOVehicleParameter::parseRouteIndex(const std::string& val, const std::string& element, const std::string& id,
502 const SumoXMLAttr attr, int& edgeIndex, RouteIndexDefinition& rid, std::string& error) {
503 bool ok = true;
504 edgeIndex = -1;
506 if (val == "random") {
508 } else {
509 try {
510 edgeIndex = StringUtils::toInt(val);
511 if (edgeIndex < 0) {
512 ok = false;
513 }
514 } catch (...) {
515 ok = false;
516 }
517 }
518 if (!ok) {
519 if (id.empty()) {
520 error = "Invalid " + toString(attr) + " definition for " + element + ". Must be one of (\"random\", \"free\", or an int>=0)";
521 } else {
522 error = "Invalid " + toString(attr) + " definition for " + element + " '" + id + "';\n must be one of (\"random\", \"free\", or an int>=0)";
523 }
524 }
525 return ok;
526}
527
528
529bool
530SUMOVehicleParameter::parseArrivalLane(const std::string& val, const std::string& element, const std::string& id,
531 int& lane, ArrivalLaneDefinition& ald, std::string& error) {
532 bool ok = true;
533 lane = 0;
535 if (val == "current") {
537 } else if (val == "random") {
539 } else if (val == "first") {
541 } else {
542 try {
543 lane = StringUtils::toInt(val);
544 if (lane < 0) {
545 ok = false;
546 }
547 } catch (...) {
548 ok = false;
549 }
550 }
551 if (!ok) {
552 if (id.empty()) {
553 error = "Invalid arrivalLane definition for " + element + ". Must be one of (\"current\", or an int>=0)";
554 } else {
555 error = "Invalid arrivalLane definition for " + element + " '" + id + "';\n must be one of (\"current\", or an int>=0)";
556 }
557 }
558 return ok;
559}
560
561
562bool
563SUMOVehicleParameter::parseArrivalPos(const std::string& val, const std::string& element, const std::string& id,
564 double& pos, ArrivalPosDefinition& apd, std::string& error) {
565 bool ok = true;
566 pos = 0.;
568 if (val == "random") {
570 } else if (val == "center") {
572 } else if (val == "max") {
574 } else {
575 try {
576 pos = StringUtils::toDouble(val);
577 } catch (...) {
578 ok = false;
579 }
580 }
581 if (!ok) {
582 if (id.empty()) {
583 error = "Invalid arrivalPos definition for " + element + ". Must be one of (\"random\", \"max\", or a float)";
584 } else {
585 error = "Invalid arrivalPos definition for " + element + " '" + id + "';\n must be one of (\"random\", \"max\", or a float)";
586 }
587 }
588 return ok;
589}
590
591
592bool
593SUMOVehicleParameter::parseArrivalPosLat(const std::string& val, const std::string& element, const std::string& id,
594 double& pos, ArrivalPosLatDefinition& apd, std::string& error) {
595 bool ok = true;
596 pos = 0.;
598 if (val == "right") {
600 } else if (val == "center") {
602 } else if (val == "left") {
604 } else {
605 try {
606 pos = StringUtils::toDouble(val);
607 } catch (...) {
608 ok = false;
609 }
610 }
611 if (!ok) {
612 if (id.empty()) {
613 error = "Invalid arrivalPosLat definition for " + element + ". Must be one of (\"right\", \"center\", \"left\", or a float)";
614 } else {
615 error = "Invalid arrivalPosLat definition for " + element + " '" + id + "';\n must be one of (\"right\", \"center\", \"left\", or a float)";
616 }
617 }
618 return ok;
619}
620
621
622bool
623SUMOVehicleParameter::parseArrivalSpeed(const std::string& val, const std::string& element, const std::string& id,
624 double& speed, ArrivalSpeedDefinition& asd, std::string& error) {
625 bool ok = true;
626 speed = -1.;
628 if (val == "current") {
630 } else {
631 try {
632 speed = StringUtils::toDouble(val);
633 if (speed < 0) {
634 ok = false;
635 }
636 } catch (...) {
637 ok = false;
638 }
639 }
640 if (!ok) {
641 if (id.empty()) {
642 error = "Invalid arrivalSpeed definition for " + element + ". Must be one of (\"current\", or a float>=0)";
643 } else {
644 error = "Invalid arrivalSpeed definition for " + element + " '" + id + "';\n must be one of (\"current\", or a float>=0)";
645 }
646 }
647 return ok;
648}
649
650
651double
652SUMOVehicleParameter::interpretEdgePos(double pos, double maximumValue, SumoXMLAttr attr, const std::string& id, bool silent) {
653 if (pos < 0) {
654 pos = maximumValue + pos;
655 }
656 if (pos > maximumValue && pos != std::numeric_limits<double>::infinity()) {
657 if (!silent) {
658 WRITE_WARNINGF(TL("Invalid % % given for %. Using edge end instead."), toString(attr), toString(pos), id);
659 }
660 pos = maximumValue;
661 }
662 return pos;
663}
664
665
666bool
667SUMOVehicleParameter::parsePersonModes(const std::string& modes, const std::string& element, const std::string& id, SVCPermissions& modeSet, std::string& error) {
668 // separte modes in different strings, and check if modes are valid
669 for (StringTokenizer st(modes); st.hasNext();) {
670 const std::string mode = st.next();
671 if (mode == "car") {
672 modeSet |= SVC_PASSENGER;
673 } else if (mode == "taxi") {
674 modeSet |= SVC_TAXI;
675 } else if (mode == "bicycle") {
676 modeSet |= SVC_BICYCLE;
677 } else if (mode == "public") {
678 modeSet |= SVC_BUS;
679 } else {
680 if (id.empty()) {
681 error = "Unknown person mode '" + mode + "'. Must be a combination of (\"car\", \"bicycle\" or \"public\")";
682 } else {
683 error = "Unknown person mode '" + mode + "' for " + element + " '" + id + "';\n must be a combination of (\"car\", \"bicycle\" or \"public\")";
684 }
685 return false;
686 }
687 }
688 return true;
689}
690
691
692void
693SUMOVehicleParameter::parseStopTriggers(const std::vector<std::string>& triggers, bool expectTrigger, Stop& stop) {
694 if (triggers.size() == 0 && expectTrigger) {
695 stop.triggered = true;
696 }
697 for (std::string val : triggers) {
698 if (val == toString(SUMO_TAG_PERSON)) {
699 stop.triggered = true;
700 } else if (val == toString(SUMO_TAG_CONTAINER)) {
701 stop.containerTriggered = true;
702 } else if (val == toString(SUMO_ATTR_JOIN)) {
703 stop.joinTriggered = true;
704 } else {
705 try {
706 stop.triggered = StringUtils::toBool(val);
707 } catch (BoolFormatException&) {
708 WRITE_ERROR(TL("Value of stop attribute 'trigger' must be 'person', 'container', 'join' or a boolean"));
709 }
710 }
711 }
712}
713
714
716SUMOVehicleParameter::parseParkingType(const std::string& value) {
717 if (value == toString(ParkingType::OPPORTUNISTIC)) {
719 } else {
721 }
722}
723
724
725std::vector<std::string>
727 std::vector<std::string> triggers;
728 if (triggered) {
729 triggers.push_back(toString(SUMO_TAG_PERSON));
730 }
731 if (containerTriggered) {
732 triggers.push_back(toString(SUMO_TAG_CONTAINER));
733 }
734 if (joinTriggered) {
735 triggers.push_back(toString(SUMO_ATTR_JOIN));
736 }
737 return triggers;
738}
739
740int
742 return (((parking == ParkingType::OFFROAD) ? 1 : 0) +
743 (triggered ? 2 : 0) +
744 (containerTriggered ? 4 : 0) +
745 (busstop != "" ? 8 : 0) +
746 (containerstop != "" ? 16 : 0) +
747 (chargingStation != "" ? 32 : 0) +
748 (parkingarea != "" ? 64 : 0) +
749 (overheadWireSegment != "" ? 128 : 0));
750}
751
752
753std::string
756 return "triggered";
758 return "containerTriggered";
759// } else if (departProcedure == DepartDefinition::NOW) { // TODO check whether this is useful in XML input (currently TraCI only)
760// return "now";
762 return "split";
764 return "begin";
765 } else {
766 return time2string(depart);
767 }
768}
769
770
771std::string
773 std::string val;
774 switch (departLaneProcedure) {
776 val = toString(departLane);
777 break;
779 val = "random";
780 break;
782 val = "free";
783 break;
785 val = "allowed";
786 break;
788 val = "best";
789 break;
791 val = "first";
792 break;
794 default:
795 break;
796 }
797 return val;
798}
799
800
801std::string
803 std::string val;
804 switch (departPosProcedure) {
806 val = toString(departPos);
807 break;
810 break;
812 val = "random";
813 break;
815 val = "random_free";
816 break;
818 val = "free";
819 break;
821 val = "last";
822 break;
824 val = "base";
825 break;
827 val = "stop";
828 break;
830 default:
831 break;
832 }
833 return val;
834}
835
836
837std::string
839 std::string val;
840 switch (departPosLatProcedure) {
842 val = toString(departPosLat);
843 break;
846 break;
848 val = "random";
849 break;
851 val = "random_free";
852 break;
854 val = "free";
855 break;
857 val = "right";
858 break;
860 val = "center";
861 break;
863 val = "left";
864 break;
866 default:
867 break;
868 }
869 return val;
870}
871
872
873std::string
875 std::string val;
876 switch (departSpeedProcedure) {
878 val = toString(departSpeed);
879 break;
882 break;
884 val = "random";
885 break;
887 val = "max";
888 break;
890 val = "desired";
891 break;
893 val = "speedLimit";
894 break;
896 val = "last";
897 break;
899 val = "avg";
900 break;
902 default:
903 break;
904 }
905 return val;
906}
907
908
909std::string
911 std::string val;
912 switch (departEdgeProcedure) {
914 val = toString(departEdge);
915 break;
917 val = "random";
918 break;
920 default:
921 break;
922 }
923 return val;
924}
925
926std::string
928 std::string val;
929 switch (arrivalEdgeProcedure) {
931 val = toString(arrivalEdge);
932 break;
934 val = "random";
935 break;
937 default:
938 break;
939 }
940 return val;
941}
942
943
944
945
946std::string
948 std::string val;
949 switch (arrivalLaneProcedure) {
951 val = toString(arrivalLane);
952 break;
954 val = "current";
955 break;
957 val = "random";
958 break;
960 val = "first";
961 break;
963 default:
964 break;
965 }
966 return val;
967}
968
969
970std::string
972 std::string val;
973 switch (arrivalPosProcedure) {
975 val = toString(arrivalPos);
976 break;
978 val = "random";
979 break;
981 val = "center";
982 break;
984 val = "max";
985 break;
987 default:
988 break;
989 }
990 return val;
991}
992
993
994std::string
996 std::string val;
997 switch (arrivalPosLatProcedure) {
999 val = toString(arrivalPosLat);
1000 break;
1002 val = "right";
1003 break;
1005 val = "center";
1006 break;
1008 val = "left";
1009 break;
1011 default:
1012 break;
1013 }
1014 return val;
1015}
1016
1017
1018std::string
1020 std::string val;
1021 switch (arrivalSpeedProcedure) {
1023 val = toString(arrivalSpeed);
1024 break;
1026 val = "current";
1027 break;
1029 default:
1030 break;
1031 }
1032 return val;
1033}
1034
1035void
1038 // equidistant or exponential offset (for poisson distributed arrivals)
1039 if (repetitionProbability < 0) {
1040 if (repetitionOffset >= 0) {
1041 repetitionTotalOffset += (SUMOTime)((double)repetitionOffset / scale);
1042 } else {
1043 // we need to cache this do avoid double generation of the rng in the TIME2STEPS macro
1044 const double r = RandHelper::randExp(-STEPS2TIME(repetitionOffset), rng);
1045 repetitionTotalOffset += TIME2STEPS(r / scale);
1046 }
1047 }
1048}
1049
1050
1051std::string
1053 if ((insertionChecks == 0) || (insertionChecks == (int)InsertionCheck::ALL)) {
1055 } else {
1056 std::vector<std::string> insertionChecksStrs;
1057 const auto insertionCheckValues = SUMOXMLDefinitions::InsertionChecks.getValues();
1058 // iterate over values
1059 for (const auto insertionCheckValue : insertionCheckValues) {
1060 if ((insertionCheckValue != InsertionCheck::ALL) && (insertionChecks & (int)insertionCheckValue) != 0) {
1061 insertionChecksStrs.push_back(SUMOXMLDefinitions::InsertionChecks.getString(insertionCheckValue));
1062 }
1063 }
1064 return toString(insertionChecksStrs);
1065 }
1066}
1067
1068
1069bool
1070SUMOVehicleParameter::areInsertionChecksValid(const std::string& value) const {
1071 if (value.empty()) {
1072 return true;
1073 } else {
1074 // split value in substrinsg
1075 StringTokenizer valueStrs(value, " ");
1076 // iterate over values
1077 while (valueStrs.hasNext()) {
1078 if (!SUMOXMLDefinitions::InsertionChecks.hasString(valueStrs.next())) {
1079 return false;
1080 }
1081 }
1082 return true;
1083 }
1084}
1085
1086
1087void
1089 // first reset insertionChecks
1090 insertionChecks = 0;
1091 if (value.empty()) {
1093 } else {
1094 // split value in substrinsg
1095 StringTokenizer insertionCheckStrs(value, " ");
1096 while (insertionCheckStrs.hasNext()) {
1097 insertionChecks |= (int)SUMOXMLDefinitions::InsertionChecks.get(insertionCheckStrs.next());
1098 }
1099 }
1100}
1101
1102/****************************************************************************/
long long int SUMOTime
Definition GUI.h:36
@ DEFAULT
default cursor
#define WRITE_WARNINGF(...)
Definition MsgHandler.h:271
#define WRITE_ERROR(msg)
Definition MsgHandler.h:279
#define TL(string)
Definition MsgHandler.h:287
SUMOTime string2time(const std::string &r)
convert string to SUMOTime
Definition SUMOTime.cpp:46
std::string time2string(SUMOTime t, bool humanReadable)
convert SUMOTime to string (independently of global format setting)
Definition SUMOTime.cpp:69
#define STEPS2TIME(x)
Definition SUMOTime.h:55
#define TIME2STEPS(x)
Definition SUMOTime.h:57
@ SVC_PASSENGER
vehicle is a passenger car (a "normal" car)
@ SVC_BICYCLE
vehicle is a bicycle
@ SVC_TAXI
vehicle is a taxi
@ SVC_BUS
vehicle is a bus
const std::string DEFAULT_VTYPE_ID
int SVCPermissions
bitset where each bit declares whether a certain SVC may use this edge/lane
const int VEHPARS_DEPARTEDGE_SET
const int VEHPARS_ARRIVALEDGE_SET
RouteIndexDefinition
Possible ways to choose the departure and arrival edge.
@ RANDOM
The edge is chosen randomly.
@ GIVEN
The edge index is given.
@ DEFAULT
No information given; use default.
const int STOP_ARRIVAL_SET
const int STOP_DURATION_SET
const int VEHPARS_COLOR_SET
const int STOP_POSLAT_SET
const int STOP_EXPECTED_SET
DepartLaneDefinition
Possible ways to choose a lane on depart.
@ RANDOM
The lane is chosen randomly.
@ BEST_FREE
The least occupied lane from best lanes.
@ GIVEN
The lane is given.
@ ALLOWED_FREE
The least occupied lane from lanes which allow the continuation.
@ DEFAULT
No information given; use default.
@ FIRST_ALLOWED
The rightmost lane the vehicle may use.
@ FREE
The least occupied lane is used.
const int VEHPARS_TO_TAZ_SET
ArrivalSpeedDefinition
Possible ways to choose the arrival speed.
@ GIVEN
The speed is given.
@ DEFAULT
No information given; use default.
@ CURRENT
The current speed is used.
DepartPosLatDefinition
Possible ways to choose the lateral departure position.
@ RANDOM
The lateral position is chosen randomly.
@ RIGHT
At the rightmost side of the lane.
@ GIVEN
The position is given.
@ GIVEN_VEHROUTE
The position is set by the vehroute device.
@ DEFAULT
No information given; use default.
@ LEFT
At the leftmost side of the lane.
@ FREE
A free lateral position is chosen.
@ CENTER
At the center of the lane.
@ RANDOM_FREE
If a fixed number of random choices fails, a free lateral position is chosen.
DepartPosDefinition
Possible ways to choose the departure position.
@ RANDOM
The position is set by the vehroute device.
@ GIVEN
The position is given.
@ GIVEN_VEHROUTE
The position is given.
@ DEFAULT
No information given; use default.
@ STOP
depart position is endPos of first stop
@ FREE
A free position is chosen.
@ BASE
Back-at-zero position.
@ LAST
Insert behind the last vehicle as close as possible to still allow the specified departSpeed....
@ RANDOM_FREE
If a fixed number of random choices fails, a free position is chosen.
const int STOP_SPEED_SET
const int STOP_UNTIL_SET
const int VEHPARS_SPEEDFACTOR_SET
const int STOP_LINE_SET
const int STOP_PARKING_SET
const int STOP_TRIP_ID_SET
ArrivalLaneDefinition
Possible ways to choose the arrival lane.
@ RANDOM
The lane is chosen randomly.
@ GIVEN
The arrival lane is given.
@ DEFAULT
No information given; use default.
@ FIRST_ALLOWED
The rightmost lane the vehicle may use.
@ CURRENT
The current lane shall be used.
const int VEHPARS_DEPARTPOS_SET
const int VEHPARS_CONTAINER_NUMBER_SET
const int STOP_PERMITTED_SET
const int VEHPARS_ARRIVALLANE_SET
DepartSpeedDefinition
Possible ways to choose the departure speed.
@ RANDOM
The speed is chosen randomly.
@ MAX
The maximum safe speed is used.
@ GIVEN
The speed is given.
@ GIVEN_VEHROUTE
The speed is set by the vehroute device.
@ LIMIT
The maximum lane speed is used (speedLimit)
@ DEFAULT
No information given; use default.
@ DESIRED
The maximum lane speed is used (speedLimit * speedFactor)
@ LAST
The speed of the last vehicle. Fallback to DepartSpeedDefinition::DESIRED if there is no vehicle on t...
@ AVG
The average speed on the lane. Fallback to DepartSpeedDefinition::DESIRED if there is no vehicle on t...
const int VEHPARS_DEPARTLANE_SET
const int STOP_SPLIT_SET
const int VEHPARS_ARRIVALPOSLAT_SET
const int STOP_START_SET
const int VEHPARS_FROM_TAZ_SET
const int STOP_JOIN_SET
const int VEHPARS_ARRIVALSPEED_SET
const int VEHPARS_CALIBRATORSPEED_SET
const int STOP_EXTENSION_SET
const int STOP_ENDED_SET
const int STOP_TRIGGER_SET
ArrivalPosDefinition
Possible ways to choose the arrival position.
@ RANDOM
The arrival position is chosen randomly.
@ MAX
The maximum arrival position is used.
@ GIVEN
The arrival position is given.
@ DEFAULT
No information given; use default.
@ CENTER
Half the road length.
const int STOP_JUMP_SET
const int STOP_ONDEMAND_SET
const int STOP_END_SET
const int VEHPARS_LINE_SET
const int STOP_STARTED_SET
const int VEHPARS_PERSON_NUMBER_SET
const int STOP_EXPECTED_CONTAINERS_SET
const int VEHPARS_DEPARTSPEED_SET
ArrivalPosLatDefinition
Possible ways to choose the lateral arrival position.
@ RIGHT
At the rightmost side of the lane.
@ GIVEN
The position is given.
@ DEFAULT
No information given; use default.
@ LEFT
At the leftmost side of the lane.
@ CENTER
At the center of the lane.
const int VEHPARS_VTYPE_SET
const int VEHPARS_ARRIVALPOS_SET
DepartDefinition
Possible ways to depart.
@ BEGIN
The departure is at simulation start.
@ GIVEN
The time is given.
@ NOW
The vehicle is discarded if emission fails (not fully implemented yet)
@ SPLIT
The departure is triggered by a train split.
@ CONTAINER_TRIGGERED
The departure is container triggered.
@ TRIGGERED
The departure is person triggered.
const int VEHPARS_DEPARTPOSLAT_SET
InsertionCheck
different checking levels for vehicle insertion
SumoXMLTag
Numbers representing SUMO-XML - element names.
@ SUMO_TAG_NOTHING
invalid tag
@ SUMO_TAG_CONTAINERFLOW
@ SUMO_TAG_FLOWSTATE
a flow state definition (used when saving and loading simulatino state)
@ SUMO_TAG_STOP
stop for vehicles
@ GNE_TAG_FLOW_ROUTE
a flow definition using a route instead of a from-to edges route
@ GNE_TAG_FLOW_WITHROUTE
description of a vehicle with an embedded route
@ SUMO_TAG_FLOW
a flow definition using from and to edges or a route
@ SUMO_TAG_CONTAINER
@ SUMO_TAG_PERSON
@ SUMO_TAG_PERSONFLOW
ParkingType
Numbers representing special SUMO-XML-attribute values Information on whether a car is parking on the...
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
@ SUMO_ATTR_STARTPOS
@ SUMO_ATTR_PARKING
@ SUMO_ATTR_EXTENSION
@ SUMO_ATTR_ARRIVALSPEED
@ SUMO_ATTR_LANE
@ SUMO_ATTR_ARRIVALLANE
@ SUMO_ATTR_DEPART
@ SUMO_ATTR_DEPARTEDGE
@ SUMO_ATTR_COLLISION
@ SUMO_ATTR_ARRIVALEDGE
@ SUMO_ATTR_SPEED
@ SUMO_ATTR_STARTED
@ SUMO_ATTR_CONTAINER_STOP
@ SUMO_ATTR_PARKING_AREA
@ SUMO_ATTR_EDGE
@ SUMO_ATTR_DEPARTPOS_LAT
@ SUMO_ATTR_BUS_STOP
@ SUMO_ATTR_ENDPOS
@ SUMO_ATTR_ARRIVALPOS
@ SUMO_ATTR_SPLIT
@ SUMO_ATTR_ACTTYPE
@ SUMO_ATTR_BEGIN
weights: time range begin
@ SUMO_ATTR_POSITION_LAT
@ SUMO_ATTR_CONTAINER_NUMBER
@ SUMO_ATTR_EXPECTED
@ SUMO_ATTR_LINE
@ SUMO_ATTR_CHARGING_STATION
@ SUMO_ATTR_DEPARTPOS
@ SUMO_ATTR_ENDED
@ SUMO_ATTR_ONDEMAND
@ SUMO_ATTR_ARRIVAL
@ SUMO_ATTR_TO_TAZ
@ SUMO_ATTR_DEPARTSPEED
@ SUMO_ATTR_TRIP_ID
@ SUMO_ATTR_PERMITTED
@ SUMO_ATTR_FROM_TAZ
@ SUMO_ATTR_DEPARTLANE
@ SUMO_ATTR_JOIN
@ SUMO_ATTR_JUMP
@ SUMO_ATTR_FRIENDLY_POS
@ SUMO_ATTR_SPEEDFACTOR
@ SUMO_ATTR_EXPECTED_CONTAINERS
@ SUMO_ATTR_TYPE
@ SUMO_ATTR_PERSON_NUMBER
@ SUMO_ATTR_COLOR
A color information.
@ SUMO_ATTR_ID
@ SUMO_ATTR_UNTIL
@ SUMO_ATTR_ARRIVALPOS_LAT
@ SUMO_ATTR_INSERTIONCHECKS
@ SUMO_ATTR_TRIGGERED
@ SUMO_ATTR_DURATION
int gPrecision
the precision for floating point outputs
Definition StdDefs.cpp:26
int gPrecisionRandom
Definition StdDefs.cpp:28
const double INVALID_DOUBLE
invalid double
Definition StdDefs.h:64
T MAX2(T a, T b)
Definition StdDefs.h:82
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition ToString.h:46
A storage for options typed value containers)
Definition OptionsCont.h:89
bool isSet(const std::string &name, bool failOnNonExistant=true) const
Returns the information whether the named option is set.
std::string getString(const std::string &name) const
Returns the string-value of the named option (only for Option_String)
bool exists(const std::string &name) const
Returns the information whether the named option is known.
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
Static storage of an output device and its base (abstract) implementation.
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
OutputDevice & writeNonEmptyAttr(const SumoXMLAttr attr, const std::string &val)
writes a string attribute only if it is not the empty string and not the string "default"
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
int precision()
return precision set on the device
bool closeTag(const std::string &comment="")
Closes the most recently opened tag and optionally adds a comment.
void setPrecision(int precision=gPrecision)
Sets the precision or resets it to default.
void writeParams(OutputDevice &device) const
write Params in the given outputdevice
static double randExp(double rate, SumoRNG *rng=nullptr)
Access to a random number from an exponential distribution.
Definition of vehicle stop (position and duration)
int getFlags() const
return flags as per Vehicle::getStops
SUMOTime started
the time at which this stop was reached
std::string edge
The edge to stop at (used only in netedit)
ParkingType parking
whether the vehicle is removed from the net while stopping
std::string lane
The lane to stop at.
SUMOTime extension
The maximum time extension for boarding / loading.
bool friendlyPos
enable or disable friendly position (used by netedit)
double speed
the speed at which this stop counts as reached (waypoint mode)
std::string parkingarea
(Optional) parking area if one is assigned to the stop
std::string split
the id of the vehicle (train portion) that splits of upon reaching this stop
double startPos
The stopping position start.
std::string line
the new line id of the trip within a cyclical public transport route
double posLat
the lateral offset when stopping
bool onDemand
whether the stop may be skipped
std::string chargingStation
(Optional) charging station if one is assigned to the stop
std::vector< std::string > getTriggers() const
write trigger attribute
std::set< std::string > permitted
IDs of persons or containers that may board/load at this stop.
int parametersSet
Information for the output which parameter were set.
SUMOTime jump
transfer time if there shall be a jump from this stop to the next route edge
std::string join
the id of the vehicle (train portion) to which this vehicle shall be joined
SUMOTime until
The time at which the vehicle may continue its journey.
std::string actType
act Type (only used by Persons) (used by netedit)
bool triggered
whether an arriving person lets the vehicle continue
void write(OutputDevice &dev, const bool close=true, const bool writeTagAndParents=true) const
Writes the stop as XML.
SUMOTime ended
the time at which this stop was ended
double endPos
The stopping position end.
std::set< std::string > awaitedPersons
IDs of persons the vehicle has to wait for until departing.
std::set< std::string > awaitedContainers
IDs of containers the vehicle has to wait for until departing.
std::string busstop
(Optional) bus stop if one is assigned to the stop
bool joinTriggered
whether an joined vehicle lets this vehicle continue
std::string tripId
id of the trip within a cyclical public transport route
std::string containerstop
(Optional) container stop if one is assigned to the stop
bool containerTriggered
whether an arriving container lets the vehicle continue
bool collision
Whether this stop was triggered by a collision.
SUMOTime arrival
The (expected) time at which the vehicle reaches the stop.
SUMOTime duration
The stopping duration.
double departPosLat
(optional) The lateral position the vehicle shall depart from
double arrivalPosLat
(optional) The lateral position the vehicle shall arrive on
virtual ~SUMOVehicleParameter()
Destructor.
std::string getArrivalSpeed() const
obtain arrival speed parameter in string format
double repetitionProbability
The probability for emitting a vehicle per second.
int departLane
(optional) The lane the vehicle shall depart from (index in edge)
ArrivalSpeedDefinition arrivalSpeedProcedure
Information how the vehicle's end speed shall be chosen.
double departSpeed
(optional) The initial speed of the vehicle
void incrementFlow(double scale, SumoRNG *rng=nullptr)
increment flow
std::string vtypeid
The vehicle's type id.
std::string getDepartLane() const
obtain depart lane parameter in string format
SUMOTime repetitionOffset
The time offset between vehicle reinsertions.
double speedFactor
individual speedFactor (overriding distribution from vType)
void parseInsertionChecks(const std::string &value)
parses insertion checks
static bool parseArrivalLane(const std::string &val, const std::string &element, const std::string &id, int &lane, ArrivalLaneDefinition &ald, std::string &error)
Validates a given arrivalLane value.
int repetitionsDone
The number of times the vehicle was already inserted.
static bool parseArrivalPosLat(const std::string &val, const std::string &element, const std::string &id, double &pos, ArrivalPosLatDefinition &apd, std::string &error)
Validates a given arrivalPosLat value.
ArrivalLaneDefinition arrivalLaneProcedure
Information how the vehicle shall choose the lane to arrive on.
SUMOTime repetitionTotalOffset
The offset between depart and the time for the next vehicle insertions.
void write(OutputDevice &dev, const OptionsCont &oc, const SumoXMLTag altTag=SUMO_TAG_VEHICLE, const std::string &typeID="") const
Writes the parameters as a beginning element.
DepartLaneDefinition departLaneProcedure
Information how the vehicle shall choose the lane to depart from.
std::string getArrivalLane() const
obtain arrival lane parameter in string format
static bool parseDepartSpeed(const std::string &val, const std::string &element, const std::string &id, double &speed, DepartSpeedDefinition &dsd, std::string &error)
Validates a given departSpeed value.
static bool parseArrivalPos(const std::string &val, const std::string &element, const std::string &id, double &pos, ArrivalPosDefinition &apd, std::string &error)
Validates a given arrivalPos value.
int personNumber
The static number of persons in the vehicle when it departs (not including boarding persons)
static bool parseArrivalSpeed(const std::string &val, const std::string &element, const std::string &id, double &speed, ArrivalSpeedDefinition &asd, std::string &error)
Validates a given arrivalSpeed value.
RouteIndexDefinition arrivalEdgeProcedure
Information how the vehicle's final edge shall be chosen.
DepartPosLatDefinition departPosLatProcedure
Information how the vehicle shall choose the lateral departure position.
std::string getDepartSpeed() const
obtain depart speed parameter in string format
std::string getArrivalPos() const
obtain arrival pos parameter in string format
std::string getDepart() const
obtain depart parameter in string format
double departPos
(optional) The position the vehicle shall depart from
std::string getDepartEdge() const
obtain depart edge parameter in string format
DepartSpeedDefinition departSpeedProcedure
Information how the vehicle's initial speed shall be chosen.
RGBColor color
The vehicle's color, TraCI may change this.
bool areInsertionChecksValid(const std::string &value) const
check if given insertion checks are valid
double arrivalPos
(optional) The position the vehicle shall arrive on
double calibratorSpeed
speed (used by calibrator flows
static bool parseDepartLane(const std::string &val, const std::string &element, const std::string &id, int &lane, DepartLaneDefinition &dld, std::string &error)
Validates a given departLane value.
std::string getInsertionChecks() const
get insertion checks in string format
std::string getArrivalEdge() const
obtain arrival edge parameter in string format
int departEdge
(optional) The initial edge within the route of the vehicle
static bool parseDepart(const std::string &val, const std::string &element, const std::string &id, SUMOTime &depart, DepartDefinition &dd, std::string &error, const std::string &attr="departure")
Validates a given depart value.
static bool parsePersonModes(const std::string &modes, const std::string &element, const std::string &id, SVCPermissions &modeSet, std::string &error)
Validates a given person modes value.
bool wasSet(int what) const
Returns whether the given parameter was set.
ArrivalPosDefinition arrivalPosProcedure
Information how the vehicle shall choose the arrival position.
static bool parseRouteIndex(const std::string &val, const std::string &element, const std::string &id, const SumoXMLAttr attr, int &edgeIndex, RouteIndexDefinition &rid, std::string &error)
Validates a given departEdge or arrivalEdge value.
static bool parseDepartPosLat(const std::string &val, const std::string &element, const std::string &id, double &pos, DepartPosLatDefinition &dpd, std::string &error)
Validates a given departPosLat value.
std::string getDepartPosLat() const
obtain depart pos lat parameter in string format
std::string getArrivalPosLat() const
obtain arrival pos lat parameter in string format
std::string getDepartPos() const
obtain depart pos parameter in string format
std::string toTaz
The vehicle's destination zone (district)
double arrivalSpeed
(optional) The final speed of the vehicle (not used yet)
static double interpretEdgePos(double pos, double maximumValue, SumoXMLAttr attr, const std::string &id, bool silent=false)
Interprets negative edge positions and fits them onto a given edge.
DepartDefinition departProcedure
Information how the vehicle shall choose the depart time.
static bool parseDepartPos(const std::string &val, const std::string &element, const std::string &id, double &pos, DepartPosDefinition &dpd, std::string &error)
Validates a given departPos value.
int insertionChecks
bitset of InsertionCheck
bool defaultOptionOverrides(const OptionsCont &oc, const std::string &optionName) const
Returns whether the defaults shall be used.
int arrivalEdge
(optional) The final edge within the route of the vehicle
std::string fromTaz
The vehicle's origin zone (district)
DepartPosDefinition departPosProcedure
Information how the vehicle shall choose the departure position.
std::string line
The vehicle's line (mainly for public transport)
int containerNumber
The static number of containers in the vehicle when it departs.
static ParkingType parseParkingType(const std::string &value)
parses parking type value
static void parseStopTriggers(const std::vector< std::string > &triggers, bool expectTrigger, Stop &stop)
parses stop trigger values
RouteIndexDefinition departEdgeProcedure
Information how the vehicle's initial edge shall be chosen.
ArrivalPosLatDefinition arrivalPosLatProcedure
Information how the vehicle shall choose the lateral arrival position.
static StringBijection< InsertionCheck > InsertionChecks
traffic light layouts
const std::string & getString(const T key) const
std::vector< T > getValues() const
bool hasNext()
returns the information whether further substrings exist
std::string next()
returns the next substring when it exists. Otherwise the behaviour is undefined
static std::string pruneZeros(const std::string &str, int max)
Removes trailing zeros (at most 'max')
static double toDouble(const std::string &sData)
converts a string into the double value described by it by calling the char-type converter
static int toInt(const std::string &sData)
converts a string into the integer value described by it by calling the char-type converter,...
static bool toBool(const std::string &sData)
converts a string into the bool value described by it by calling the char-type converter