SUMO - Simulation of Urban MObility
TraCIAPI.h
Go to the documentation of this file.
1 /****************************************************************************/
9 // C++ TraCI client API implementation
10 /****************************************************************************/
11 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
12 // Copyright (C) 2012-2015 DLR (http://www.dlr.de/) and contributors
13 /****************************************************************************/
14 //
15 // This file is part of SUMO.
16 // SUMO is free software: you can redistribute it and/or modify
17 // it under the terms of the GNU General Public License as published by
18 // the Free Software Foundation, either version 3 of the License, or
19 // (at your option) any later version.
20 //
21 /****************************************************************************/
22 #ifndef TraCIAPI_h
23 #define TraCIAPI_h
24 
25 
26 // ===========================================================================
27 // included modules
28 // ===========================================================================
29 #ifdef _MSC_VER
30 #include <windows_config.h>
31 #else
32 #include <config.h>
33 #endif
34 
35 #include <vector>
36 #include <string>
37 #include <foreign/tcpip/socket.h>
38 #include <utils/common/SUMOTime.h>
39 
40 
41 // ===========================================================================
42 // global definitions
43 // ===========================================================================
44 #define DEFAULT_VIEW "View #0"
45 
46 
47 // ===========================================================================
48 // class definitions
49 // ===========================================================================
54 class TraCIAPI {
55 public:
58 
62  struct TraCIPosition {
63  double x, y, z;
64  };
65 
69  struct TraCIColor {
70  int r, g, b, a;
71  };
72 
76  typedef std::vector<TraCIPosition> TraCIPositionVector;
77 
81  struct TraCIBoundary {
82  double xMin, yMin, zMin;
83  double xMax, yMax, zMax;
84  };
85 
86 
87 
88  class TraCIPhase {
89  public:
90  TraCIPhase(const SUMOTime _duration, const SUMOTime _duration1, const SUMOTime _duration2, const std::string& _phase)
91  : duration(_duration), duration1(_duration1), duration2(_duration2), phase(_phase) {}
93 
94  SUMOTime duration, duration1, duration2;
95  std::string phase;
96  };
97 
98 
99  class TraCILogic {
100  public:
101  TraCILogic(const std::string& _subID, int _type, const std::map<std::string, SUMOReal>& _subParameter, unsigned int _currentPhaseIndex, const std::vector<TraCIPhase>& _phases)
102  : subID(_subID), type(_type), subParameter(_subParameter), currentPhaseIndex(_currentPhaseIndex), phases(_phases) {}
104 
105  std::string subID;
106  int type;
107  std::map<std::string, SUMOReal> subParameter;
108  unsigned int currentPhaseIndex;
109  std::vector<TraCIPhase> phases;
110  };
111 
112  class TraCILink {
113  public:
114  TraCILink(const std::string& _from, const std::string& _via, const std::string& _to)
115  : from(_from), via(_via), to(_to) {}
117 
118  std::string from;
119  std::string via;
120  std::string to;
121  };
122 
124 
125 
126 
129  TraCIAPI();
130 
131 
133  ~TraCIAPI();
134 
135 
138 
144  void connect(const std::string& host, int port);
145 
146 
148  void close();
150 
152  void simulationStep(SUMOTime time = 0);
153 
154 
157 
158  SUMOTime getSUMOTime(int cmd, int var, const std::string& id, tcpip::Storage* add = 0);
159  int getUnsignedByte(int cmd, int var, const std::string& id, tcpip::Storage* add = 0);
160  int getByte(int cmd, int var, const std::string& id, tcpip::Storage* add = 0);
161  int getInt(int cmd, int var, const std::string& id, tcpip::Storage* add = 0);
162  SUMOReal getFloat(int cmd, int var, const std::string& id, tcpip::Storage* add = 0);
163  SUMOReal getDouble(int cmd, int var, const std::string& id, tcpip::Storage* add = 0);
164  TraCIBoundary getBoundingBox(int cmd, int var, const std::string& id, tcpip::Storage* add = 0);
165  TraCIPositionVector getPolygon(int cmd, int var, const std::string& id, tcpip::Storage* add = 0);
166  TraCIPosition getPosition(int cmd, int var, const std::string& id, tcpip::Storage* add = 0);
167  std::string getString(int cmd, int var, const std::string& id, tcpip::Storage* add = 0);
168  std::vector<std::string> getStringVector(int cmd, int var, const std::string& id, tcpip::Storage* add = 0);
169  TraCIColor getColor(int cmd, int var, const std::string& id, tcpip::Storage* add = 0);
171 
172 
173 
180  public:
184  TraCIScopeWrapper(TraCIAPI& parent) : myParent(parent) {}
185 
187  virtual ~TraCIScopeWrapper() {}
188 
189 
190  protected:
193 
194 
195  private:
198 
200  TraCIScopeWrapper& operator=(const TraCIScopeWrapper& src);
201 
202  };
203 
204 
205 
206 
207 
211  class EdgeScope : public TraCIScopeWrapper {
212  public:
213  EdgeScope(TraCIAPI& parent) : TraCIScopeWrapper(parent) {}
214  virtual ~EdgeScope() {}
215 
216  std::vector<std::string> getIDList() const;
217  unsigned int getIDCount() const;
218  SUMOReal getAdaptedTraveltime(const std::string& edgeID, SUMOTime time) const;
219  SUMOReal getEffort(const std::string& edgeID, SUMOTime time) const;
220  SUMOReal getCO2Emission(const std::string& edgeID) const;
221  SUMOReal getCOEmission(const std::string& edgeID) const;
222  SUMOReal getHCEmission(const std::string& edgeID) const;
223  SUMOReal getPMxEmission(const std::string& edgeID) const;
224  SUMOReal getNOxEmission(const std::string& edgeID) const;
225  SUMOReal getFuelConsumption(const std::string& edgeID) const;
226  SUMOReal getNoiseEmission(const std::string& edgeID) const;
227  SUMOReal getLastStepMeanSpeed(const std::string& edgeID) const;
228  SUMOReal getLastStepOccupancy(const std::string& edgeID) const;
229  SUMOReal getLastStepLength(const std::string& edgeID) const;
230  SUMOReal getTraveltime(const std::string& edgeID) const;
231  unsigned int getLastStepVehicleNumber(const std::string& edgeID) const;
232  SUMOReal getLastStepHaltingNumber(const std::string& edgeID) const;
233  std::vector<std::string> getLastStepVehicleIDs(const std::string& edgeID) const;
234 
235  void adaptTraveltime(const std::string& edgeID, SUMOReal time) const;
236  void setEffort(const std::string& edgeID, SUMOReal effort) const;
237  void setMaxSpeed(const std::string& edgeID, SUMOReal speed) const;
238 
239  private:
241  EdgeScope(const EdgeScope& src);
242 
244  EdgeScope& operator=(const EdgeScope& src);
245 
246  };
247 
248 
249 
250 
251 
255  class GUIScope : public TraCIScopeWrapper {
256  public:
257  GUIScope(TraCIAPI& parent) : TraCIScopeWrapper(parent) {}
258  virtual ~GUIScope() {}
259 
260  std::vector<std::string> getIDList() const;
261  SUMOReal getZoom(const std::string& viewID = DEFAULT_VIEW) const;
262  TraCIPosition getOffset(const std::string& viewID = DEFAULT_VIEW) const;
263  std::string getSchema(const std::string& viewID = DEFAULT_VIEW) const;
264  TraCIBoundary getBoundary(const std::string& viewID = DEFAULT_VIEW) const;
265  void setZoom(const std::string& viewID, SUMOReal zoom) const;
266  void setOffset(const std::string& viewID, SUMOReal x, SUMOReal y) const;
267  void setSchema(const std::string& viewID, const std::string& schemeName) const;
268  void setBoundary(const std::string& viewID, SUMOReal xmin, SUMOReal ymin, SUMOReal xmax, SUMOReal ymax) const;
269  void screenshot(const std::string& viewID, const std::string& filename) const;
270  void trackVehicle(const std::string& viewID, const std::string& vehID) const;
271 
272  private:
274  GUIScope(const GUIScope& src);
275 
277  GUIScope& operator=(const GUIScope& src);
278 
279  };
280 
281 
282 
283 
284 
289  public:
291  virtual ~InductionLoopScope() {}
292 
293  std::vector<std::string> getIDList() const;
294  SUMOReal getPosition(const std::string& loopID) const;
295  std::string getLaneID(const std::string& loopID) const;
296  unsigned int getLastStepVehicleNumber(const std::string& loopID) const;
297  SUMOReal getLastStepMeanSpeed(const std::string& loopID) const;
298  std::vector<std::string> getLastStepVehicleIDs(const std::string& loopID) const;
299  SUMOReal getLastStepOccupancy(const std::string& loopID) const;
300  SUMOReal getLastStepMeanLength(const std::string& loopID) const;
301  SUMOReal getTimeSinceDetection(const std::string& loopID) const;
302  unsigned int getVehicleData(const std::string& loopID) const;
303 
304  private:
307 
309  InductionLoopScope& operator=(const InductionLoopScope& src);
310 
311  };
312 
313 
314 
315 
316 
321  public:
323  virtual ~JunctionScope() {}
324 
325  std::vector<std::string> getIDList() const;
326  TraCIPosition getPosition(const std::string& junctionID) const;
327 
328  private:
330  JunctionScope(const JunctionScope& src);
331 
333  JunctionScope& operator=(const JunctionScope& src);
334 
335  };
336 
337 
338 
339 
340 
344  class LaneScope : public TraCIScopeWrapper {
345  public:
346  LaneScope(TraCIAPI& parent) : TraCIScopeWrapper(parent) {}
347  virtual ~LaneScope() {}
348 
349  std::vector<std::string> getIDList() const;
350  SUMOReal getLength(const std::string& laneID) const;
351  SUMOReal getMaxSpeed(const std::string& laneID) const;
352  SUMOReal getWidth(const std::string& laneID) const;
353  std::vector<std::string> getAllowed(const std::string& laneID) const;
354  std::vector<std::string> getDisallowed(const std::string& laneID) const;
355  unsigned int getLinkNumber(const std::string& laneID) const;
356  TraCIPositionVector getShape(const std::string& laneID) const;
357  std::string getEdgeID(const std::string& laneID) const;
358  SUMOReal getCO2Emission(const std::string& laneID) const;
359  SUMOReal getCOEmission(const std::string& laneID) const;
360  SUMOReal getHCEmission(const std::string& laneID) const;
361  SUMOReal getPMxEmission(const std::string& laneID) const;
362  SUMOReal getNOxEmission(const std::string& laneID) const;
363  SUMOReal getFuelConsumption(const std::string& laneID) const;
364  SUMOReal getNoiseEmission(const std::string& laneID) const;
365  SUMOReal getLastStepMeanSpeed(const std::string& laneID) const;
366  SUMOReal getLastStepOccupancy(const std::string& laneID) const;
367  SUMOReal getLastStepLength(const std::string& laneID) const;
368  SUMOReal getTraveltime(const std::string& laneID) const;
369  unsigned int getLastStepVehicleNumber(const std::string& laneID) const;
370  unsigned int getLastStepHaltingNumber(const std::string& laneID) const;
371  std::vector<std::string> getLastStepVehicleIDs(const std::string& laneID) const;
372 
373  void setAllowed(const std::string& laneID, const std::vector<std::string>& allowedClasses) const;
374  void setDisallowed(const std::string& laneID, const std::vector<std::string>& disallowedClasses) const;
375  void setMaxSpeed(const std::string& laneID, SUMOReal speed) const;
376  void setLength(const std::string& laneID, SUMOReal length) const;
377 
378  private:
380  LaneScope(const LaneScope& src);
381 
383  LaneScope& operator=(const LaneScope& src);
384 
385  };
386 
387 
391  class AreaScope : public TraCIScopeWrapper {
392  public:
393  AreaScope(TraCIAPI& parent) : TraCIScopeWrapper(parent) {}
394  virtual ~AreaScope() {}
395 
396  std::vector<std::string> getIDList() const;
397  int getJamLengthVehicle(const std::string& laneID) const;
398  SUMOReal getJamLengthMeters(const std::string& laneID) const;
399 
400  private:
402  AreaScope(const AreaScope& src);
403 
405  AreaScope& operator=(const AreaScope& src);
406 
407  };
408 
409 
413  class MeMeScope : public TraCIScopeWrapper {
414  public:
415  MeMeScope(TraCIAPI& parent) : TraCIScopeWrapper(parent) {}
416  virtual ~MeMeScope() {}
417 
418  std::vector<std::string> getIDList() const;
419  unsigned int getLastStepVehicleNumber(const std::string& detID) const;
420  SUMOReal getLastStepMeanSpeed(const std::string& detID) const;
421  std::vector<std::string> getLastStepVehicleIDs(const std::string& detID) const;
422  unsigned int getLastStepHaltingNumber(const std::string& detID) const;
423 
424  private:
426  MeMeScope(const MeMeScope& src);
427 
429  MeMeScope& operator=(const MeMeScope& src);
430 
431  };
432 
433 
434 
435 
436 
440  class POIScope : public TraCIScopeWrapper {
441  public:
442  POIScope(TraCIAPI& parent) : TraCIScopeWrapper(parent) {}
443  virtual ~POIScope() {}
444 
445  std::vector<std::string> getIDList() const;
446  std::string getType(const std::string& poiID) const;
447  TraCIPosition getPosition(const std::string& poiID) const;
448  TraCIColor getColor(const std::string& poiID) const;
449 
450  void setType(const std::string& poiID, const std::string& setType) const;
451  void setPosition(const std::string& poiID, SUMOReal x, SUMOReal y) const;
452  void setColor(const std::string& poiID, const TraCIColor& c) const;
453  void add(const std::string& poiID, SUMOReal x, SUMOReal y, const TraCIColor& c, const std::string& type, int layer) const;
454  void remove(const std::string& poiID, int layer = 0) const;
455 
456  private:
458  POIScope(const POIScope& src);
459 
461  POIScope& operator=(const POIScope& src);
462 
463  };
464 
465 
466 
467 
468 
473  public:
475  virtual ~PolygonScope() {}
476 
477  std::vector<std::string> getIDList() const;
478  std::string getType(const std::string& polygonID) const;
479  TraCIPositionVector getShape(const std::string& polygonID) const;
480  TraCIColor getColor(const std::string& polygonID) const;
481  void setType(const std::string& polygonID, const std::string& setType) const;
482  void setShape(const std::string& polygonID, const TraCIPositionVector& shape) const;
483  void setColor(const std::string& polygonID, const TraCIColor& c) const;
484  void add(const std::string& polygonID, const TraCIPositionVector& shape, const TraCIColor& c, bool fill, const std::string& type, int layer) const;
485  void remove(const std::string& polygonID, int layer = 0) const;
486 
487  private:
489  PolygonScope(const PolygonScope& src);
490 
492  PolygonScope& operator=(const PolygonScope& src);
493 
494  };
495 
496 
497 
498 
499 
503  class RouteScope : public TraCIScopeWrapper {
504  public:
505  RouteScope(TraCIAPI& parent) : TraCIScopeWrapper(parent) {}
506  virtual ~RouteScope() {}
507 
508  std::vector<std::string> getIDList() const;
509  std::vector<std::string> getEdges(const std::string& routeID) const;
510 
511  void add(const std::string& routeID, const std::vector<std::string>& edges) const;
512 
513  private:
515  RouteScope(const RouteScope& src);
516 
518  RouteScope& operator=(const RouteScope& src);
519 
520  };
521 
522 
523 
524 
525 
530  public:
532  virtual ~SimulationScope() {}
533 
534  SUMOTime getCurrentTime() const;
535  unsigned int getLoadedNumber() const;
536  std::vector<std::string> getLoadedIDList() const;
537  unsigned int getDepartedNumber() const;
538  std::vector<std::string> getDepartedIDList() const;
539  unsigned int getArrivedNumber() const;
540  std::vector<std::string> getArrivedIDList() const;
541  unsigned int getStartingTeleportNumber() const;
542  std::vector<std::string> getStartingTeleportIDList() const;
543  unsigned int getEndingTeleportNumber() const;
544  std::vector<std::string> getEndingTeleportIDList() const;
545  SUMOTime getDeltaT() const;
546  TraCIBoundary getNetBoundary() const;
547  unsigned int getMinExpectedNumber() const;
548 
549  private:
551  SimulationScope(const SimulationScope& src);
552 
554  SimulationScope& operator=(const SimulationScope& src);
555 
556  };
557 
558 
559 
560 
561 
566  public:
568  virtual ~TrafficLightScope() {}
569 
570  std::vector<std::string> getIDList() const;
571  std::string getRedYellowGreenState(const std::string& tlsID) const;
572  std::vector<TraCIAPI::TraCILogic> getCompleteRedYellowGreenDefinition(const std::string& tlsID) const;
573  std::vector<std::string> getControlledLanes(const std::string& tlsID) const;
574  std::vector<TraCIAPI::TraCILink> getControlledLinks(const std::string& tlsID) const;
575  std::string getProgram(const std::string& tlsID) const;
576  unsigned int getPhase(const std::string& tlsID) const;
577  unsigned int getNextSwitch(const std::string& tlsID) const;
578 
579  void setRedYellowGreenState(const std::string& tlsID, const std::string& state) const;
580  void setPhase(const std::string& tlsID, unsigned int index) const;
581  void setProgram(const std::string& tlsID, const std::string& programID) const;
582  void setPhaseDuration(const std::string& tlsID, unsigned int phaseDuration) const;
583  void setCompleteRedYellowGreenDefinition(const std::string& tlsID, const TraCIAPI::TraCILogic& logic) const;
584 
585  private:
588 
590  TrafficLightScope& operator=(const TrafficLightScope& src);
591 
592  };
593 
594 
595 
596 
597 
602  public:
604  virtual ~VehicleTypeScope() {}
605 
606  std::vector<std::string> getIDList() const;
607  SUMOReal getLength(const std::string& typeID) const;
608  SUMOReal getMaxSpeed(const std::string& typeID) const;
609  SUMOReal getSpeedFactor(const std::string& typeID) const;
610  SUMOReal getSpeedDeviation(const std::string& typeID) const;
611  SUMOReal getAccel(const std::string& typeID) const;
612  SUMOReal getDecel(const std::string& typeID) const;
613  SUMOReal getImperfection(const std::string& typeID) const;
614  SUMOReal getTau(const std::string& typeID) const;
615  std::string getVehicleClass(const std::string& typeID) const;
616  std::string getEmissionClass(const std::string& typeID) const;
617  std::string getShapeClass(const std::string& typeID) const;
618  SUMOReal getMinGap(const std::string& typeID) const;
619  SUMOReal getWidth(const std::string& typeID) const;
620  TraCIColor getColor(const std::string& typeID) const;
621 
622  void setLength(const std::string& typeID, SUMOReal length) const;
623  void setMaxSpeed(const std::string& typeID, SUMOReal speed) const;
624  void setVehicleClass(const std::string& typeID, const std::string& clazz) const;
625  void setSpeedFactor(const std::string& typeID, SUMOReal factor) const;
626  void setSpeedDeviation(const std::string& typeID, SUMOReal deviation) const;
627  void setEmissionClass(const std::string& typeID, const std::string& clazz) const;
628  void setWidth(const std::string& typeID, SUMOReal width) const;
629  void setMinGap(const std::string& typeID, SUMOReal minGap) const;
630  void setShapeClass(const std::string& typeID, const std::string& clazz) const;
631  void setAccel(const std::string& typeID, SUMOReal accel) const;
632  void setDecel(const std::string& typeID, SUMOReal decel) const;
633  void setImperfection(const std::string& typeID, SUMOReal imperfection) const;
634  void setTau(const std::string& typeID, SUMOReal tau) const;
635  void setColor(const std::string& typeID, const TraCIColor& c) const;
636 
637  private:
640 
642  VehicleTypeScope& operator=(const VehicleTypeScope& src);
643 
644  };
645 
646 public:
671 
672 
673 protected:
676 
679  void send_commandSimulationStep(SUMOTime time) const;
680 
681 
684  void send_commandClose() const;
685 
686 
693  void send_commandGetVariable(int domID, int varID, const std::string& objID, tcpip::Storage* add = 0) const;
694 
695 
702  void send_commandSetValue(int domID, int varID, const std::string& objID, tcpip::Storage& content) const;
703 
704 
712  void send_commandSubscribeObjectVariable(int domID, const std::string& objID, SUMOTime beginTime, SUMOTime endTime, const std::vector<int>& vars) const;
713 
714 
724  void send_commandSubscribeObjectContext(int domID, const std::string& objID, SUMOTime beginTime, SUMOTime endTime,
725  int domain, SUMOReal range, const std::vector<int>& vars) const;
727 
728 
729 
732 
739  void check_resultState(tcpip::Storage& inMsg, int command, bool ignoreCommandId = false, std::string* acknowledgement = 0) const;
740 
741  void check_commandGetResult(tcpip::Storage& inMsg, int command, int expectedType = -1, bool ignoreCommandId = false) const;
742 
743  void processGET(tcpip::Storage& inMsg, int command, int expectedType, bool ignoreCommandId = false) const;
745 
746 
747 protected:
750 
751 
752 };
753 
754 
755 #endif
756 
757 /****************************************************************************/
758 
EdgeScope edge
Scope for interaction with edges.
Definition: TraCIAPI.h:648
TraCIPosition getPosition(int cmd, int var, const std::string &id, tcpip::Storage *add=0)
Definition: TraCIAPI.cpp:385
LaneScope(TraCIAPI &parent)
Definition: TraCIAPI.h:346
long long int SUMOTime
Definition: SUMOTime.h:43
tcpip::Socket * mySocket
The socket.
Definition: TraCIAPI.h:749
C++ TraCI client API implementation.
Definition: TraCIAPI.h:54
void close()
Closes the connection.
Definition: TraCIAPI.cpp:82
Scope for interaction with edges.
Definition: TraCIAPI.h:211
void connect(const std::string &host, int port)
Connects to the specified SUMO server.
Definition: TraCIAPI.cpp:69
TraCILogic(const std::string &_subID, int _type, const std::map< std::string, SUMOReal > &_subParameter, unsigned int _currentPhaseIndex, const std::vector< TraCIPhase > &_phases)
Definition: TraCIAPI.h:101
MeMeScope(TraCIAPI &parent)
Definition: TraCIAPI.h:415
virtual ~PolygonScope()
Definition: TraCIAPI.h:475
GUIScope(TraCIAPI &parent)
Definition: TraCIAPI.h:257
SUMOReal getDouble(int cmd, int var, const std::string &id, tcpip::Storage *add=0)
Definition: TraCIAPI.cpp:342
void send_commandClose() const
Sends a Close command.
Definition: TraCIAPI.cpp:106
JunctionScope junction
Scope for interaction with junctions.
Definition: TraCIAPI.h:654
TraCIPhase(const SUMOTime _duration, const SUMOTime _duration1, const SUMOTime _duration2, const std::string &_phase)
Definition: TraCIAPI.h:90
LaneScope lane
Scope for interaction with lanes.
Definition: TraCIAPI.h:656
unsigned int currentPhaseIndex
Definition: TraCIAPI.h:108
#define DEFAULT_VIEW
Definition: TraCIAPI.h:44
void processGET(tcpip::Storage &inMsg, int command, int expectedType, bool ignoreCommandId=false) const
Definition: TraCIAPI.cpp:288
virtual ~RouteScope()
Definition: TraCIAPI.h:506
Scope for interaction with traffic lights.
Definition: TraCIAPI.h:565
virtual ~LaneScope()
Definition: TraCIAPI.h:347
void simulationStep(SUMOTime time=0)
Advances by one step (or up to the given time)
Definition: TraCIAPI.cpp:435
Scope for interaction with the gui.
Definition: TraCIAPI.h:255
TrafficLightScope trafficlights
Scope for interaction with traffic lights.
Definition: TraCIAPI.h:668
TraCIPositionVector getPolygon(int cmd, int var, const std::string &id, tcpip::Storage *add=0)
Definition: TraCIAPI.cpp:367
Scope for interaction with routes.
Definition: TraCIAPI.h:503
SUMOTime duration2
Definition: TraCIAPI.h:94
TraCIBoundary getBoundingBox(int cmd, int var, const std::string &id, tcpip::Storage *add=0)
Definition: TraCIAPI.cpp:351
InductionLoopScope inductionloop
Scope for interaction with inductive loops.
Definition: TraCIAPI.h:652
Scope for interaction with inductive loops.
Definition: TraCIAPI.h:288
POIScope(TraCIAPI &parent)
Definition: TraCIAPI.h:442
virtual ~MeMeScope()
Definition: TraCIAPI.h:416
AreaScope(TraCIAPI &parent)
Definition: TraCIAPI.h:393
Scope for interaction with POIs.
Definition: TraCIAPI.h:440
void send_commandSubscribeObjectContext(int domID, const std::string &objID, SUMOTime beginTime, SUMOTime endTime, int domain, SUMOReal range, const std::vector< int > &vars) const
Sends a SubscribeContext request.
Definition: TraCIAPI.cpp:193
Scope for interaction with the simulation.
Definition: TraCIAPI.h:529
Scope for interaction with multi entry/-exit detectors.
Definition: TraCIAPI.h:413
virtual ~AreaScope()
Definition: TraCIAPI.h:394
virtual ~EdgeScope()
Definition: TraCIAPI.h:214
void send_commandSimulationStep(SUMOTime time) const
Sends a SimulationStep command.
Definition: TraCIAPI.cpp:93
InductionLoopScope(TraCIAPI &parent)
Definition: TraCIAPI.h:290
MeMeScope multientryexit
Scope for interaction with multi-entry/-exit detectors.
Definition: TraCIAPI.h:658
Scope for interaction with vehicle types.
Definition: TraCIAPI.h:601
PolygonScope(TraCIAPI &parent)
Definition: TraCIAPI.h:474
void send_commandGetVariable(int domID, int varID, const std::string &objID, tcpip::Storage *add=0) const
Sends a GetVariable request.
Definition: TraCIAPI.cpp:117
TraCIColor getColor(int cmd, int var, const std::string &id, tcpip::Storage *add=0)
Definition: TraCIAPI.cpp:421
virtual ~JunctionScope()
Definition: TraCIAPI.h:323
~TraCIAPI()
Destructor.
Definition: TraCIAPI.cpp:63
RouteScope route
Scope for interaction with routes.
Definition: TraCIAPI.h:664
Scope for interaction with polygons.
Definition: TraCIAPI.h:472
A 3D-bounding box.
Definition: TraCIAPI.h:81
std::vector< TraCIPhase > phases
Definition: TraCIAPI.h:109
int getInt(int cmd, int var, const std::string &id, tcpip::Storage *add=0)
Definition: TraCIAPI.cpp:324
int getByte(int cmd, int var, const std::string &id, tcpip::Storage *add=0)
Definition: TraCIAPI.cpp:315
int getUnsignedByte(int cmd, int var, const std::string &id, tcpip::Storage *add=0)
Definition: TraCIAPI.cpp:306
Scope for interaction with junctions.
Definition: TraCIAPI.h:320
TrafficLightScope(TraCIAPI &parent)
Definition: TraCIAPI.h:567
virtual ~SimulationScope()
Definition: TraCIAPI.h:532
std::vector< std::string > getStringVector(int cmd, int var, const std::string &id, tcpip::Storage *add=0)
Definition: TraCIAPI.cpp:407
EdgeScope(TraCIAPI &parent)
Definition: TraCIAPI.h:213
Scope for interaction with areal detectors.
Definition: TraCIAPI.h:391
POIScope poi
Scope for interaction with POIs.
Definition: TraCIAPI.h:660
virtual ~POIScope()
Definition: TraCIAPI.h:443
void send_commandSubscribeObjectVariable(int domID, const std::string &objID, SUMOTime beginTime, SUMOTime endTime, const std::vector< int > &vars) const
Sends a SubscribeVariable request.
Definition: TraCIAPI.cpp:165
SimulationScope simulation
Scope for interaction with the simulation.
Definition: TraCIAPI.h:666
Scope for interaction with lanes.
Definition: TraCIAPI.h:344
TraCIScopeWrapper(TraCIAPI &parent)
Constructor.
Definition: TraCIAPI.h:184
RouteScope(TraCIAPI &parent)
Definition: TraCIAPI.h:505
SUMOTime getSUMOTime(int cmd, int var, const std::string &id, tcpip::Storage *add=0)
Definition: TraCIAPI.cpp:297
PolygonScope polygon
Scope for interaction with polygons.
Definition: TraCIAPI.h:662
virtual ~TraCIScopeWrapper()
Destructor.
Definition: TraCIAPI.h:187
void check_resultState(tcpip::Storage &inMsg, int command, bool ignoreCommandId=false, std::string *acknowledgement=0) const
Validates the result state of a command.
Definition: TraCIAPI.cpp:226
VehicleTypeScope(TraCIAPI &parent)
Definition: TraCIAPI.h:603
virtual ~GUIScope()
Definition: TraCIAPI.h:258
std::map< std::string, SUMOReal > subParameter
Definition: TraCIAPI.h:107
TraCIAPI & myParent
The parent TraCI client which offers the connection.
Definition: TraCIAPI.h:192
std::string subID
Definition: TraCIAPI.h:105
GUIScope gui
Scope for interaction with the gui.
Definition: TraCIAPI.h:650
void send_commandSetValue(int domID, int varID, const std::string &objID, tcpip::Storage &content) const
Sends a SetVariable request.
Definition: TraCIAPI.cpp:144
#define SUMOReal
Definition: config.h:214
void check_commandGetResult(tcpip::Storage &inMsg, int command, int expectedType=-1, bool ignoreCommandId=false) const
Definition: TraCIAPI.cpp:265
std::string getString(int cmd, int var, const std::string &id, tcpip::Storage *add=0)
Definition: TraCIAPI.cpp:398
SimulationScope(TraCIAPI &parent)
Definition: TraCIAPI.h:531
An abstract interface for accessing type-dependent values.
Definition: TraCIAPI.h:179
TraCIAPI()
Constructor.
Definition: TraCIAPI.cpp:52
std::vector< TraCIPosition > TraCIPositionVector
Definition: TraCIAPI.h:76
SUMOReal getFloat(int cmd, int var, const std::string &id, tcpip::Storage *add=0)
Definition: TraCIAPI.cpp:333
JunctionScope(TraCIAPI &parent)
Definition: TraCIAPI.h:322
A 3D-position.
Definition: TraCIAPI.h:62
std::string phase
Definition: TraCIAPI.h:95
VehicleTypeScope vehicletype
Scope for interaction with vehicle types.
Definition: TraCIAPI.h:670