Eclipse SUMO - Simulation of Urban MObility
SUMOVehicleParameter.cpp
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3// Copyright (C) 2001-2022 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
65}
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 {
197 for (auto it : SUMOXMLDefinitions::InsertionChecks.getValues()) {
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) {
261 }
262 if ((parametersSet & STOP_PARKING_SET) != 0) {
264 }
265 if ((parametersSet & STOP_EXPECTED_SET) != 0 && awaitedPersons.size() > 0) {
267 }
268 if ((parametersSet & STOP_PERMITTED_SET) != 0 && permitted.size() > 0) {
270 }
273 }
274 if ((parametersSet & STOP_TRIP_ID_SET) != 0) {
276 }
277 if ((parametersSet & STOP_LINE_SET) != 0) {
279 }
280 if ((parametersSet & STOP_SPLIT_SET) != 0) {
282 }
283 if ((parametersSet & STOP_JOIN_SET) != 0) {
285 }
286 if ((parametersSet & STOP_SPEED_SET) != 0) {
288 }
289 if ((parametersSet & STOP_ONDEMAND_SET) != 0) {
291 }
292 if (collision) {
294 }
295 // only write friendly position if is true
296 if (friendlyPos == true) {
298 }
299 // only write act type if isn't empty
300 if (!actType.empty()) {
302 }
303 if (close) {
304 dev.closeTag();
305 }
306}
307
308
309bool
310SUMOVehicleParameter::parseDepart(const std::string& val, const std::string& element, const std::string& id,
311 SUMOTime& depart, DepartDefinition& dd, std::string& error, const std::string& attr) {
312 if (val == "triggered") {
314 } else if (val == "containerTriggered") {
316 } else if (val == "split") {
318 } else if (val == "now") {
319 // only used via TraCI. depart must be set by the calling code
321 } else {
322 try {
323 depart = string2time(val);
325 if (depart < 0) {
326 error = "Negative " + attr + " time in the definition of " + element + " '" + id + "'.";
327 return false;
328 }
329 } catch (...) {
330 if (id.empty()) {
331 error = "Invalid " + attr + " time for " + element + ". Must be one of (\"triggered\", \"containerTriggered\", \"now\", or a float >= 0)";
332 } else {
333 error = "Invalid " + attr + " time for " + element + " '" + id + "';\n must be one of (\"triggered\", \"containerTriggered\", \"now\", or a float >= 0)";
334 }
335 return false;
336 }
337 }
338 return true;
339}
340
341
342bool
343SUMOVehicleParameter::parseDepartLane(const std::string& val, const std::string& element, const std::string& id,
344 int& lane, DepartLaneDefinition& dld, std::string& error) {
345 bool ok = true;
346 lane = 0;
348 if (val == "random") {
350 } else if (val == "free") {
352 } else if (val == "allowed") {
354 } else if (val == "best") {
356 } else if (val == "first") {
358 } else {
359 try {
360 lane = StringUtils::toInt(val);
361 if (lane < 0) {
362 ok = false;
363 }
364 } catch (...) {
365 ok = false;
366 }
367 }
368 if (!ok) {
369 if (id.empty()) {
370 error = "Invalid departLane definition for " + element + ". Must be one of (\"random\", \"free\", \"allowed\", \"best\", \"first\", or an int>=0)";
371 } else {
372 error = "Invalid departLane definition for " + element + " '" + id + "';\n must be one of (\"random\", \"free\", \"allowed\", \"best\", \"first\", or an int>=0)";
373 }
374 }
375 return ok;
376}
377
378
379bool
380SUMOVehicleParameter::parseDepartPos(const std::string& val, const std::string& element, const std::string& id,
381 double& pos, DepartPosDefinition& dpd, std::string& error) {
382 bool ok = true;
383 pos = 0.;
385 if (val == "random") {
387 } else if (val == "random_free") {
389 } else if (val == "free") {
391 } else if (val == "base") {
393 } else if (val == "last") {
395 } else if (val == "stop") {
397 } else {
398 try {
399 pos = StringUtils::toDouble(val);
400 } catch (...) {
401 ok = false;
402 }
403 }
404 if (!ok) {
405 if (id.empty()) {
406 error = "Invalid departPos definition for " + element + ". Must be one of (\"random\", \"random_free\", \"free\", \"base\", \"last\" or a float)";
407 } else {
408 error = "Invalid departPos definition for " + element + " '" + id + "';\n must be one of (\"random\", \"random_free\", \"free\", \"base\", \"last\" or a float)";
409 }
410 }
411 return ok;
412}
413
414
415bool
416SUMOVehicleParameter::parseDepartPosLat(const std::string& val, const std::string& element, const std::string& id,
417 double& pos, DepartPosLatDefinition& dpd, std::string& error) {
418 bool ok = true;
419 pos = 0.;
421 if (val == "random") {
423 } else if (val == "random_free") {
425 } else if (val == "free") {
427 } else if (val == "right") {
429 } else if (val == "center") {
431 } else if (val == "left") {
433 } else {
434 try {
435 pos = StringUtils::toDouble(val);
436 } catch (...) {
437 ok = false;
438 }
439 }
440 if (!ok) {
441 if (id.empty()) {
442 error = "Invalid departPosLat definition for " + element + ". Must be one of (\"random\", \"random_free\", \"free\", \"right\", \"center\", \"left\", or a float)";
443 } else {
444 error = "Invalid departPosLat definition for " + element + " '" + id + "';\n must be one of (\"random\", \"random_free\", \"free\", \"right\", \"center\", \"left\", or a float)";
445 }
446 }
447 return ok;
448}
449
450
451bool
452SUMOVehicleParameter::parseDepartSpeed(const std::string& val, const std::string& element, const std::string& id,
453 double& speed, DepartSpeedDefinition& dsd, std::string& error) {
454 bool ok = true;
455 speed = -1.;
457 if (val == "random") {
459 } else if (val == "max") {
461 } else if (val == "desired") {
463 } else if (val == "speedLimit") {
465 } else if (val == "last") {
467 } else if (val == "avg") {
469 } else {
470 try {
471 speed = StringUtils::toDouble(val);
472 if (speed < 0) {
473 ok = false;
474 }
475 } catch (...) {
476 ok = false;
477 }
478 }
479 if (!ok) {
480 if (id.empty()) {
481 error = "Invalid departSpeed definition for " + element + ". Must be one of (\"random\", \"max\", or a float>=0)";
482 } else {
483 error = "Invalid departSpeed definition for " + element + " '" + id + "';\n must be one of (\"random\", \"max\", or a float>=0)";
484 }
485 }
486 return ok;
487}
488
489
490bool
491SUMOVehicleParameter::parseRouteIndex(const std::string& val, const std::string& element, const std::string& id,
492 const SumoXMLAttr attr, int& edgeIndex, RouteIndexDefinition& rid, std::string& error) {
493 bool ok = true;
494 edgeIndex = -1;
496 if (val == "random") {
498 } else {
499 try {
500 edgeIndex = StringUtils::toInt(val);
501 if (edgeIndex < 0) {
502 ok = false;
503 }
504 } catch (...) {
505 ok = false;
506 }
507 }
508 if (!ok) {
509 if (id.empty()) {
510 error = "Invalid " + toString(attr) + " definition for " + element + ". Must be one of (\"random\", \"free\", or an int>=0)";
511 } else {
512 error = "Invalid " + toString(attr) + " definition for " + element + " '" + id + "';\n must be one of (\"random\", \"free\", or an int>=0)";
513 }
514 }
515 return ok;
516}
517
518
519bool
520SUMOVehicleParameter::parseArrivalLane(const std::string& val, const std::string& element, const std::string& id,
521 int& lane, ArrivalLaneDefinition& ald, std::string& error) {
522 bool ok = true;
523 lane = 0;
525 if (val == "current") {
527 } else if (val == "random") {
529 } else if (val == "first") {
531 } else {
532 try {
533 lane = StringUtils::toInt(val);
534 if (lane < 0) {
535 ok = false;
536 }
537 } catch (...) {
538 ok = false;
539 }
540 }
541 if (!ok) {
542 if (id.empty()) {
543 error = "Invalid arrivalLane definition for " + element + ". Must be one of (\"current\", or an int>=0)";
544 } else {
545 error = "Invalid arrivalLane definition for " + element + " '" + id + "';\n must be one of (\"current\", or an int>=0)";
546 }
547 }
548 return ok;
549}
550
551
552bool
553SUMOVehicleParameter::parseArrivalPos(const std::string& val, const std::string& element, const std::string& id,
554 double& pos, ArrivalPosDefinition& apd, std::string& error) {
555 bool ok = true;
556 pos = 0.;
558 if (val == "random") {
560 } else if (val == "center") {
562 } else if (val == "max") {
564 } else {
565 try {
566 pos = StringUtils::toDouble(val);
567 } catch (...) {
568 ok = false;
569 }
570 }
571 if (!ok) {
572 if (id.empty()) {
573 error = "Invalid arrivalPos definition for " + element + ". Must be one of (\"random\", \"max\", or a float)";
574 } else {
575 error = "Invalid arrivalPos definition for " + element + " '" + id + "';\n must be one of (\"random\", \"max\", or a float)";
576 }
577 }
578 return ok;
579}
580
581
582bool
583SUMOVehicleParameter::parseArrivalPosLat(const std::string& val, const std::string& element, const std::string& id,
584 double& pos, ArrivalPosLatDefinition& apd, std::string& error) {
585 bool ok = true;
586 pos = 0.;
588 if (val == "right") {
590 } else if (val == "center") {
592 } else if (val == "left") {
594 } else {
595 try {
596 pos = StringUtils::toDouble(val);
597 } catch (...) {
598 ok = false;
599 }
600 }
601 if (!ok) {
602 if (id.empty()) {
603 error = "Invalid arrivalPosLat definition for " + element + ". Must be one of (\"right\", \"center\", \"left\", or a float)";
604 } else {
605 error = "Invalid arrivalPosLat definition for " + element + " '" + id + "';\n must be one of (\"right\", \"center\", \"left\", or a float)";
606 }
607 }
608 return ok;
609}
610
611
612bool
613SUMOVehicleParameter::parseArrivalSpeed(const std::string& val, const std::string& element, const std::string& id,
614 double& speed, ArrivalSpeedDefinition& asd, std::string& error) {
615 bool ok = true;
616 speed = -1.;
618 if (val == "current") {
620 } else {
621 try {
622 speed = StringUtils::toDouble(val);
623 if (speed < 0) {
624 ok = false;
625 }
626 } catch (...) {
627 ok = false;
628 }
629 }
630 if (!ok) {
631 if (id.empty()) {
632 error = "Invalid arrivalSpeed definition for " + element + ". Must be one of (\"current\", or a float>=0)";
633 } else {
634 error = "Invalid arrivalSpeed definition for " + element + " '" + id + "';\n must be one of (\"current\", or a float>=0)";
635 }
636 }
637 return ok;
638}
639
640
641double
642SUMOVehicleParameter::interpretEdgePos(double pos, double maximumValue, SumoXMLAttr attr, const std::string& id, bool silent) {
643 if (pos < 0) {
644 pos = maximumValue + pos;
645 }
646 if (pos > maximumValue && pos != std::numeric_limits<double>::infinity()) {
647 if (!silent) {
648 WRITE_WARNING("Invalid " + toString(attr) + " " + toString(pos) + " given for " + id + ". Using edge end instead.");
649 }
650 pos = maximumValue;
651 }
652 return pos;
653}
654
655
656bool
657SUMOVehicleParameter::parsePersonModes(const std::string& modes, const std::string& element, const std::string& id, SVCPermissions& modeSet, std::string& error) {
658 // separte modes in different strings, and check if modes are valid
659 for (StringTokenizer st(modes); st.hasNext();) {
660 const std::string mode = st.next();
661 if (mode == "car") {
662 modeSet |= SVC_PASSENGER;
663 } else if (mode == "taxi") {
664 modeSet |= SVC_TAXI;
665 } else if (mode == "bicycle") {
666 modeSet |= SVC_BICYCLE;
667 } else if (mode == "public") {
668 modeSet |= SVC_BUS;
669 } else {
670 if (id.empty()) {
671 error = "Unknown person mode '" + mode + "'. Must be a combination of (\"car\", \"bicycle\" or \"public\")";
672 } else {
673 error = "Unknown person mode '" + mode + "' for " + element + " '" + id + "';\n must be a combination of (\"car\", \"bicycle\" or \"public\")";
674 }
675 return false;
676 }
677 }
678 return true;
679}
680
681
682void
683SUMOVehicleParameter::parseStopTriggers(const std::vector<std::string>& triggers, bool expectTrigger, Stop& stop) {
684 if (triggers.size() == 0 && expectTrigger) {
685 stop.triggered = true;
686 }
687 for (std::string val : triggers) {
688 if (val == toString(SUMO_TAG_PERSON)) {
689 stop.triggered = true;
690 } else if (val == toString(SUMO_TAG_CONTAINER)) {
691 stop.containerTriggered = true;
692 } else if (val == toString(SUMO_ATTR_JOIN)) {
693 stop.joinTriggered = true;
694 } else {
695 try {
696 stop.triggered = StringUtils::toBool(val);
697 } catch (BoolFormatException&) {
698 WRITE_ERROR(TL("Value of stop attribute 'trigger' must be 'person', 'container', 'join' or a boolean"));
699 }
700 }
701 }
702}
703
704
706SUMOVehicleParameter::parseParkingType(const std::string& value) {
707 if (value == toString(ParkingType::OPPORTUNISTIC)) {
709 } else {
711 }
712}
713
714
715std::vector<std::string>
717 std::vector<std::string> triggers;
718 if (triggered) {
719 triggers.push_back(toString(SUMO_TAG_PERSON));
720 }
721 if (containerTriggered) {
722 triggers.push_back(toString(SUMO_TAG_CONTAINER));
723 }
724 if (joinTriggered) {
725 triggers.push_back(toString(SUMO_ATTR_JOIN));
726 }
727 return triggers;
728}
729
730int
732 return (((parking == ParkingType::OFFROAD) ? 1 : 0) +
733 (triggered ? 2 : 0) +
734 (containerTriggered ? 4 : 0) +
735 (busstop != "" ? 8 : 0) +
736 (containerstop != "" ? 16 : 0) +
737 (chargingStation != "" ? 32 : 0) +
738 (parkingarea != "" ? 64 : 0) +
739 (overheadWireSegment != "" ? 128 : 0));
740}
741
742
743std::string
746 return "triggered";
748 return "containerTriggered";
750 return "split";
751 } else {
752 return time2string(depart);
753 }
754}
755
756
757std::string
759 std::string val;
760 switch (departLaneProcedure) {
762 val = toString(departLane);
763 break;
765 val = "random";
766 break;
768 val = "free";
769 break;
771 val = "allowed";
772 break;
774 val = "best";
775 break;
777 val = "first";
778 break;
780 default:
781 break;
782 }
783 return val;
784}
785
786
787std::string
789 std::string val;
790 switch (departPosProcedure) {
792 val = toString(departPos);
793 break;
796 break;
798 val = "random";
799 break;
801 val = "random_free";
802 break;
804 val = "free";
805 break;
807 val = "last";
808 break;
810 val = "base";
811 break;
813 val = "stop";
814 break;
816 default:
817 break;
818 }
819 return val;
820}
821
822
823std::string
825 std::string val;
826 switch (departPosLatProcedure) {
828 val = toString(departPosLat);
829 break;
832 break;
834 val = "random";
835 break;
837 val = "random_free";
838 break;
840 val = "free";
841 break;
843 val = "right";
844 break;
846 val = "center";
847 break;
849 val = "left";
850 break;
852 default:
853 break;
854 }
855 return val;
856}
857
858
859std::string
861 std::string val;
862 switch (departSpeedProcedure) {
864 val = toString(departSpeed);
865 break;
868 break;
870 val = "random";
871 break;
873 val = "max";
874 break;
876 val = "desired";
877 break;
879 val = "speedLimit";
880 break;
882 val = "last";
883 break;
885 val = "avg";
886 break;
888 default:
889 break;
890 }
891 return val;
892}
893
894
895std::string
897 std::string val;
898 switch (departEdgeProcedure) {
900 val = toString(departEdge);
901 break;
903 val = "random";
904 break;
906 default:
907 break;
908 }
909 return val;
910}
911
912std::string
914 std::string val;
915 switch (arrivalEdgeProcedure) {
917 val = toString(arrivalEdge);
918 break;
920 val = "random";
921 break;
923 default:
924 break;
925 }
926 return val;
927}
928
929
930
931
932std::string
934 std::string val;
935 switch (arrivalLaneProcedure) {
937 val = toString(arrivalLane);
938 break;
940 val = "current";
941 break;
943 val = "random";
944 break;
946 val = "first";
947 break;
949 default:
950 break;
951 }
952 return val;
953}
954
955
956std::string
958 std::string val;
959 switch (arrivalPosProcedure) {
961 val = toString(arrivalPos);
962 break;
964 val = "random";
965 break;
967 val = "center";
968 break;
970 val = "max";
971 break;
973 default:
974 break;
975 }
976 return val;
977}
978
979
980std::string
982 std::string val;
983 switch (arrivalPosLatProcedure) {
985 val = toString(arrivalPosLat);
986 break;
988 val = "right";
989 break;
991 val = "center";
992 break;
994 val = "left";
995 break;
997 default:
998 break;
999 }
1000 return val;
1001}
1002
1003
1004std::string
1006 std::string val;
1007 switch (arrivalSpeedProcedure) {
1009 val = toString(arrivalSpeed);
1010 break;
1012 val = "current";
1013 break;
1015 default:
1016 break;
1017 }
1018 return val;
1019}
1020
1021void
1024 // equidistant or exponential offset (for poisson distributed arrivals)
1025 if (repetitionProbability < 0) {
1026 if (repetitionOffset >= 0) {
1027 repetitionTotalOffset += (SUMOTime)((double)repetitionOffset / scale);
1028 } else {
1029 // we need to cache this do avoid double generation of the rng in the TIME2STEPS macro
1030 const double r = RandHelper::randExp(-STEPS2TIME(repetitionOffset), rng);
1031 repetitionTotalOffset += TIME2STEPS(r / scale);
1032 }
1033 }
1034}
1035
1036
1037std::string
1039 if ((insertionChecks == 0) || (insertionChecks == (int)InsertionCheck::ALL)) {
1041 } else {
1042 std::vector<std::string> insertionChecksStrs;
1043 const auto insertionCheckValues = SUMOXMLDefinitions::InsertionChecks.getValues();
1044 // iterate over values
1045 for (const auto insertionCheckValue : insertionCheckValues) {
1046 if ((insertionCheckValue != InsertionCheck::ALL) && (insertionChecks & (int)insertionCheckValue) != 0) {
1047 insertionChecksStrs.push_back(SUMOXMLDefinitions::InsertionChecks.getString(insertionCheckValue));
1048 }
1049 }
1050 return toString(insertionChecksStrs);
1051 }
1052}
1053
1054
1055bool
1056SUMOVehicleParameter::areInsertionChecksValid(const std::string& value) const {
1057 if (value.empty()) {
1058 return true;
1059 } else {
1060 // split value in substrinsg
1061 StringTokenizer valueStrs(value, " ");
1062 // iterate over values
1063 while (valueStrs.hasNext()) {
1064 if (!SUMOXMLDefinitions::InsertionChecks.hasString(valueStrs.next())) {
1065 return false;
1066 }
1067 }
1068 return true;
1069 }
1070}
1071
1072
1073void
1075 // first reset insertionChecks
1076 insertionChecks = 0;
1077 if (value.empty()) {
1079 } else {
1080 // split value in substrinsg
1081 StringTokenizer insertionCheckStrs(value, " ");
1082 while (insertionCheckStrs.hasNext()) {
1083 insertionChecks |= (int)SUMOXMLDefinitions::InsertionChecks.get(insertionCheckStrs.next());
1084 }
1085 }
1086}
1087
1088/****************************************************************************/
long long int SUMOTime
Definition: GUI.h:36
@ DEFAULT
default cursor
#define WRITE_ERROR(msg)
Definition: MsgHandler.h:274
#define WRITE_WARNING(msg)
Definition: MsgHandler.h:265
#define TL(string)
Definition: MsgHandler.h:282
std::string time2string(SUMOTime t)
convert SUMOTime to string
Definition: SUMOTime.cpp:68
SUMOTime string2time(const std::string &r)
convert string to SUMOTime
Definition: SUMOTime.cpp:45
#define STEPS2TIME(x)
Definition: SUMOTime.h:54
#define TIME2STEPS(x)
Definition: SUMOTime.h:56
@ 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_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.
@ 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 (used in NETEDIT)
@ GNE_TAG_FLOW_WITHROUTE
description of a vehicle with an embedded route (used in NETEDIT)
@ SUMO_TAG_FLOW
a flow definitio nusing a from-to edges instead of a route (used by router)
@ 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_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:25
int gPrecisionRandom
Definition: StdDefs.cpp:27
const double INVALID_DOUBLE
Definition: StdDefs.h:60
T MAX2(T a, T b)
Definition: StdDefs.h:77
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.
Definition: OutputDevice.h:61
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
Definition: OutputDevice.h:251
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"
Definition: OutputDevice.h:295
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.
static double randExp(double rate, SumoRNG *rng=nullptr)
Access to a random number from an exponential distribution.
Definition: RandHelper.cpp:150
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.
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
SUMOVehicleParameter()
Constructor.
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')
Definition: StringUtils.cpp:66
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
auto get(const nlohmann::detail::iteration_proxy_value< IteratorType > &i) -> decltype(i.key())
Definition: json.hpp:4451