Eclipse SUMO - Simulation of Urban MObility
TraCIAPI.cpp
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2012-2019 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
17 // C++ TraCI client API implementation
18 /****************************************************************************/
19 
20 
21 // ===========================================================================
22 // included modules
23 // ===========================================================================
24 #include "TraCIAPI.h"
25 
26 
27 // ===========================================================================
28 // member definitions
29 // ===========================================================================
30 
31 // ---------------------------------------------------------------------------
32 // TraCIAPI-methods
33 // ---------------------------------------------------------------------------
34 #ifdef _MSC_VER
35 /* Disable "decorated name length exceeded, name was truncated" warnings for the whole file. */
36 #pragma warning(disable: 4503)
37 #pragma warning(push)
38 /* Disable warning about using "this" in the constructor */
39 #pragma warning(disable: 4355)
40 #endif
42  : edge(*this), gui(*this), inductionloop(*this),
43  junction(*this), lane(*this), lanearea(*this), multientryexit(*this),
44  person(*this), poi(*this), polygon(*this), route(*this),
45  simulation(*this), trafficlights(*this),
46  vehicle(*this), vehicletype(*this),
47  mySocket(nullptr) {
62 }
63 #ifdef _MSC_VER
64 #pragma warning(pop)
65 #endif
66 
67 
69  delete mySocket;
70 }
71 
72 
73 void
74 TraCIAPI::connect(const std::string& host, int port) {
75  mySocket = new tcpip::Socket(host, port);
76  try {
77  mySocket->connect();
78  } catch (tcpip::SocketException&) {
79  delete mySocket;
80  mySocket = nullptr;
81  throw;
82  }
83 }
84 
85 
86 void
87 TraCIAPI::setOrder(int order) {
88  tcpip::Storage outMsg;
89  // command length
90  outMsg.writeUnsignedByte(1 + 1 + 4);
91  // command id
93  outMsg.writeInt(order);
94  // send request message
95  mySocket->sendExact(outMsg);
96  tcpip::Storage inMsg;
98 }
99 
100 
101 void
104  tcpip::Storage inMsg;
105  std::string acknowledgement;
106  check_resultState(inMsg, libsumo::CMD_CLOSE, false, &acknowledgement);
107  closeSocket();
108 }
109 
110 
111 void
113  if (mySocket == nullptr) {
114  return;
115  }
116  mySocket->close();
117  delete mySocket;
118  mySocket = nullptr;
119 }
120 
121 
122 void
124  tcpip::Storage outMsg;
125  // command length
126  outMsg.writeUnsignedByte(1 + 1 + 8);
127  // command id
129  outMsg.writeDouble(time);
130  // send request message
131  mySocket->sendExact(outMsg);
132 }
133 
134 
135 void
137  tcpip::Storage outMsg;
138  // command length
139  outMsg.writeUnsignedByte(1 + 1);
140  // command id
142  mySocket->sendExact(outMsg);
143 }
144 
145 
146 void
148  tcpip::Storage outMsg;
149  // command length
150  outMsg.writeUnsignedByte(1 + 1 + 4);
151  // command id
153  // client index
154  outMsg.writeInt(order);
155  mySocket->sendExact(outMsg);
156 }
157 
158 
159 void
160 TraCIAPI::createCommand(int cmdID, int varID, const std::string& objID, tcpip::Storage* add) const {
161  myOutput.reset();
162  // command length
163  int length = 1 + 1 + 1 + 4 + (int) objID.length();
164  if (add != nullptr) {
165  length += (int)add->size();
166  }
167  if (length <= 255) {
168  myOutput.writeUnsignedByte(length);
169  } else {
171  myOutput.writeInt(length + 4);
172  }
175  myOutput.writeString(objID);
176  // additional values
177  if (add != nullptr) {
178  myOutput.writeStorage(*add);
179  }
180 }
181 
182 
183 void
184 TraCIAPI::createFilterCommand(int cmdID, int varID, tcpip::Storage* add) const {
185  myOutput.reset();
186  // command length
187  int length = 1 + 1 + 1;
188  if (add != nullptr) {
189  length += (int)add->size();
190  }
191  if (length <= 255) {
192  myOutput.writeUnsignedByte(length);
193  } else {
195  myOutput.writeInt(length + 4);
196  }
199  // additional values
200  if (add != nullptr) {
201  myOutput.writeStorage(*add);
202  }
203 }
204 
205 
206 void
207 TraCIAPI::send_commandSubscribeObjectVariable(int domID, const std::string& objID, double beginTime, double endTime,
208  const std::vector<int>& vars) const {
209  if (mySocket == nullptr) {
210  throw tcpip::SocketException("Socket is not initialised");
211  }
212  tcpip::Storage outMsg;
213  // command length (domID, objID, beginTime, endTime, length, vars)
214  int varNo = (int) vars.size();
215  outMsg.writeUnsignedByte(0);
216  outMsg.writeInt(5 + 1 + 8 + 8 + 4 + (int) objID.length() + 1 + varNo);
217  // command id
218  outMsg.writeUnsignedByte(domID);
219  // time
220  outMsg.writeDouble(beginTime);
221  outMsg.writeDouble(endTime);
222  // object id
223  outMsg.writeString(objID);
224  // command id
225  outMsg.writeUnsignedByte((int)vars.size());
226  for (int i = 0; i < varNo; ++i) {
227  outMsg.writeUnsignedByte(vars[i]);
228  }
229  // send message
230  mySocket->sendExact(outMsg);
231 }
232 
233 
234 void
235 TraCIAPI::send_commandSubscribeObjectContext(int domID, const std::string& objID, double beginTime, double endTime,
236  int domain, double range, const std::vector<int>& vars) const {
237  if (mySocket == nullptr) {
238  throw tcpip::SocketException("Socket is not initialised");
239  }
240  tcpip::Storage outMsg;
241  // command length (domID, objID, beginTime, endTime, length, vars)
242  int varNo = (int) vars.size();
243  outMsg.writeUnsignedByte(0);
244  outMsg.writeInt(5 + 1 + 8 + 8 + 4 + (int) objID.length() + 1 + 8 + 1 + varNo);
245  // command id
246  outMsg.writeUnsignedByte(domID);
247  // time
248  outMsg.writeDouble(beginTime);
249  outMsg.writeDouble(endTime);
250  // object id
251  outMsg.writeString(objID);
252  // domain and range
253  outMsg.writeUnsignedByte(domain);
254  outMsg.writeDouble(range);
255  // command id
256  outMsg.writeUnsignedByte((int)vars.size());
257  for (int i = 0; i < varNo; ++i) {
258  outMsg.writeUnsignedByte(vars[i]);
259  }
260  // send message
261  mySocket->sendExact(outMsg);
262 }
263 
264 
265 void
266 TraCIAPI::check_resultState(tcpip::Storage& inMsg, int command, bool ignoreCommandId, std::string* acknowledgement) const {
267  mySocket->receiveExact(inMsg);
268  int cmdLength;
269  int cmdId;
270  int resultType;
271  int cmdStart;
272  std::string msg;
273  try {
274  cmdStart = inMsg.position();
275  cmdLength = inMsg.readUnsignedByte();
276  cmdId = inMsg.readUnsignedByte();
277  if (command != cmdId && !ignoreCommandId) {
278  throw libsumo::TraCIException("#Error: received status response to command: " + toString(cmdId) + " but expected: " + toString(command));
279  }
280  resultType = inMsg.readUnsignedByte();
281  msg = inMsg.readString();
282  } catch (std::invalid_argument&) {
283  throw libsumo::TraCIException("#Error: an exception was thrown while reading result state message");
284  }
285  switch (resultType) {
286  case libsumo::RTYPE_ERR:
287  throw libsumo::TraCIException(".. Answered with error to command (" + toString(command) + "), [description: " + msg + "]");
289  throw libsumo::TraCIException(".. Sent command is not implemented (" + toString(command) + "), [description: " + msg + "]");
290  case libsumo::RTYPE_OK:
291  if (acknowledgement != nullptr) {
292  (*acknowledgement) = ".. Command acknowledged (" + toString(command) + "), [description: " + msg + "]";
293  }
294  break;
295  default:
296  throw libsumo::TraCIException(".. Answered with unknown result code(" + toString(resultType) + ") to command(" + toString(command) + "), [description: " + msg + "]");
297  }
298  if ((cmdStart + cmdLength) != (int) inMsg.position()) {
299  throw libsumo::TraCIException("#Error: command at position " + toString(cmdStart) + " has wrong length");
300  }
301 }
302 
303 
304 int
305 TraCIAPI::check_commandGetResult(tcpip::Storage& inMsg, int command, int expectedType, bool ignoreCommandId) const {
306  inMsg.position(); // respStart
307  int length = inMsg.readUnsignedByte();
308  if (length == 0) {
309  length = inMsg.readInt();
310  }
311  int cmdId = inMsg.readUnsignedByte();
312  if (!ignoreCommandId && cmdId != (command + 0x10)) {
313  throw libsumo::TraCIException("#Error: received response with command id: " + toString(cmdId) + "but expected: " + toString(command + 0x10));
314  }
315  if (expectedType >= 0) {
316  // not called from the TraCITestClient but from within the TraCIAPI
317  inMsg.readUnsignedByte(); // variableID
318  inMsg.readString(); // objectID
319  int valueDataType = inMsg.readUnsignedByte();
320  if (valueDataType != expectedType) {
321  throw libsumo::TraCIException("Expected " + toString(expectedType) + " but got " + toString(valueDataType));
322  }
323  }
324  return cmdId;
325 }
326 
327 
328 bool
329 TraCIAPI::processGet(int command, int expectedType, bool ignoreCommandId) {
330  if (mySocket != nullptr) {
332  myInput.reset();
333  check_resultState(myInput, command, ignoreCommandId);
334  check_commandGetResult(myInput, command, expectedType, ignoreCommandId);
335  return true;
336  }
337  return false;
338 }
339 
340 
341 bool
342 TraCIAPI::processSet(int command) {
343  if (mySocket != nullptr) {
345  myInput.reset();
346  check_resultState(myInput, command);
347  return true;
348  }
349  return false;
350 }
351 
352 
353 int
354 TraCIAPI::getUnsignedByte(int cmd, int var, const std::string& id, tcpip::Storage* add) {
355  createCommand(cmd, var, id, add);
356  if (processGet(cmd, libsumo::TYPE_UBYTE)) {
357  return myInput.readUnsignedByte();
358  }
360 }
361 
362 
363 int
364 TraCIAPI::getByte(int cmd, int var, const std::string& id, tcpip::Storage* add) {
365  createCommand(cmd, var, id, add);
366  if (processGet(cmd, libsumo::TYPE_BYTE)) {
367  return myInput.readByte();
368  }
370 }
371 
372 
373 
374 int
375 TraCIAPI::getInt(int cmd, int var, const std::string& id, tcpip::Storage* add) {
376  createCommand(cmd, var, id, add);
377  if (processGet(cmd, libsumo::TYPE_INTEGER)) {
378  return myInput.readInt();
379  }
381 }
382 
383 
384 double
385 TraCIAPI::getDouble(int cmd, int var, const std::string& id, tcpip::Storage* add) {
386  createCommand(cmd, var, id, add);
387  if (processGet(cmd, libsumo::TYPE_DOUBLE)) {
388  return myInput.readDouble();
389  }
391 }
392 
393 
395 TraCIAPI::getPolygon(int cmd, int var, const std::string& id, tcpip::Storage* add) {
397  createCommand(cmd, var, id, add);
398  if (processGet(cmd, libsumo::TYPE_POLYGON)) {
399  int size = myInput.readUnsignedByte();
400  if (size == 0) {
401  size = myInput.readInt();
402  }
403  for (int i = 0; i < size; ++i) {
405  p.x = myInput.readDouble();
406  p.y = myInput.readDouble();
407  p.z = 0.;
408  ret.push_back(p);
409  }
410  }
411  return ret;
412 }
413 
414 
416 TraCIAPI::getPosition(int cmd, int var, const std::string& id, tcpip::Storage* add) {
418  createCommand(cmd, var, id, add);
419  if (processGet(cmd, libsumo::POSITION_2D)) {
420  p.x = myInput.readDouble();
421  p.y = myInput.readDouble();
422  p.z = 0;
423  }
424  return p;
425 }
426 
427 
429 TraCIAPI::getPosition3D(int cmd, int var, const std::string& id, tcpip::Storage* add) {
431  createCommand(cmd, var, id, add);
432  if (processGet(cmd, libsumo::POSITION_3D)) {
433  p.x = myInput.readDouble();
434  p.y = myInput.readDouble();
435  p.z = myInput.readDouble();
436  }
437  return p;
438 }
439 
440 
441 std::string
442 TraCIAPI::getString(int cmd, int var, const std::string& id, tcpip::Storage* add) {
443  createCommand(cmd, var, id, add);
444  if (processGet(cmd, libsumo::TYPE_STRING)) {
445  return myInput.readString();
446  }
447  return "";
448 }
449 
450 
451 std::vector<std::string>
452 TraCIAPI::getStringVector(int cmd, int var, const std::string& id, tcpip::Storage* add) {
453  std::vector<std::string> r;
454  createCommand(cmd, var, id, add);
456  const int size = myInput.readInt();
457  for (int i = 0; i < size; ++i) {
458  r.push_back(myInput.readString());
459  }
460  }
461  return r;
462 }
463 
464 
466 TraCIAPI::getColor(int cmd, int var, const std::string& id, tcpip::Storage* add) {
468  createCommand(cmd, var, id, add);
469  if (processGet(cmd, libsumo::TYPE_COLOR)) {
470  c.r = (unsigned char)myInput.readUnsignedByte();
471  c.g = (unsigned char)myInput.readUnsignedByte();
472  c.b = (unsigned char)myInput.readUnsignedByte();
473  c.a = (unsigned char)myInput.readUnsignedByte();
474  }
475  return c;
476 }
477 
478 
480 TraCIAPI::getTraCIStage(int cmd, int var, const std::string& id, tcpip::Storage* add) {
482  createCommand(cmd, var, id, add);
484  myInput.readInt(); // components
486  s.type = myInput.readInt();
487 
489  s.vType = myInput.readString();
490 
492  s.line = myInput.readString();
493 
496 
499 
502 
504  s.cost = myInput.readDouble();
505 
507  s.length = myInput.readDouble();
508 
511 
513  s.depart = myInput.readDouble();
514 
517 
520 
523  }
524  return s;
525 }
526 
527 
528 void
529 TraCIAPI::readVariables(tcpip::Storage& inMsg, const std::string& objectID, int variableCount, libsumo::SubscriptionResults& into) {
530  while (variableCount > 0) {
531 
532  const int variableID = inMsg.readUnsignedByte();
533  const int status = inMsg.readUnsignedByte();
534  const int type = inMsg.readUnsignedByte();
535 
536  if (status == libsumo::RTYPE_OK) {
537  switch (type) {
539  into[objectID][variableID] = std::make_shared<libsumo::TraCIDouble>(inMsg.readDouble());
540  break;
542  into[objectID][variableID] = std::make_shared<libsumo::TraCIString>(inMsg.readString());
543  break;
544  case libsumo::POSITION_2D: {
545  auto p = std::make_shared<libsumo::TraCIPosition>();
546  p->x = inMsg.readDouble();
547  p->y = inMsg.readDouble();
548  p->z = 0.;
549  into[objectID][variableID] = p;
550  break;
551  }
552  case libsumo::POSITION_3D: {
553  auto p = std::make_shared<libsumo::TraCIPosition>();
554  p->x = inMsg.readDouble();
555  p->y = inMsg.readDouble();
556  p->z = inMsg.readDouble();
557  into[objectID][variableID] = p;
558  break;
559  }
560  case libsumo::TYPE_COLOR: {
561  auto c = std::make_shared<libsumo::TraCIColor>();
562  c->r = (unsigned char)inMsg.readUnsignedByte();
563  c->g = (unsigned char)inMsg.readUnsignedByte();
564  c->b = (unsigned char)inMsg.readUnsignedByte();
565  c->a = (unsigned char)inMsg.readUnsignedByte();
566  into[objectID][variableID] = c;
567  break;
568  }
570  into[objectID][variableID] = std::make_shared<libsumo::TraCIInt>(inMsg.readInt());
571  break;
573  auto sl = std::make_shared<libsumo::TraCIStringList>();
574  int n = inMsg.readInt();
575  for (int i = 0; i < n; ++i) {
576  sl->value.push_back(inMsg.readString());
577  }
578  into[objectID][variableID] = sl;
579  }
580  break;
581 
582  // TODO Other data types
583 
584  default:
585  throw libsumo::TraCIException("Unimplemented subscription type: " + toString(type));
586  }
587  } else {
588  throw libsumo::TraCIException("Subscription response error: variableID=" + toString(variableID) + " status=" + toString(status));
589  }
590 
591  variableCount--;
592  }
593 }
594 
595 
596 void
598  const std::string objectID = inMsg.readString();
599  const int variableCount = inMsg.readUnsignedByte();
600  readVariables(inMsg, objectID, variableCount, myDomains[cmdId]->getModifiableSubscriptionResults());
601 }
602 
603 
604 void
606  const std::string contextID = inMsg.readString();
607  inMsg.readUnsignedByte(); // context domain
608  const int variableCount = inMsg.readUnsignedByte();
609  int numObjects = inMsg.readInt();
610 
611  while (numObjects > 0) {
612  std::string objectID = inMsg.readString();
613  readVariables(inMsg, objectID, variableCount, myDomains[cmdId]->getModifiableContextSubscriptionResults(contextID));
614  numObjects--;
615  }
616 }
617 
618 
619 void
622  tcpip::Storage inMsg;
624 
625  for (auto it : myDomains) {
626  it.second->clearSubscriptionResults();
627  }
628  int numSubs = inMsg.readInt();
629  while (numSubs > 0) {
630  int cmdId = check_commandGetResult(inMsg, 0, -1, true);
632  readVariableSubscription(cmdId, inMsg);
633  } else {
634  readContextSubscription(cmdId + 0x50, inMsg);
635  }
636  numSubs--;
637  }
638 }
639 
640 
641 void
642 TraCIAPI::load(const std::vector<std::string>& args) {
643  int numChars = 0;
644  for (int i = 0; i < (int)args.size(); ++i) {
645  numChars += (int)args[i].size();
646  }
647  tcpip::Storage content;
648  content.writeUnsignedByte(0);
649  content.writeInt(1 + 4 + 1 + 1 + 4 + numChars + 4 * (int)args.size());
652  content.writeStringList(args);
653  mySocket->sendExact(content);
654  tcpip::Storage inMsg;
656 }
657 
658 
659 // ---------------------------------------------------------------------------
660 // TraCIAPI::EdgeScope-methods
661 // ---------------------------------------------------------------------------
662 std::vector<std::string>
665 }
666 
667 int
669  return myParent.getInt(libsumo::CMD_GET_EDGE_VARIABLE, libsumo::ID_COUNT, "");
670 }
671 
672 double
673 TraCIAPI::EdgeScope::getAdaptedTraveltime(const std::string& edgeID, double time) const {
674  tcpip::Storage content;
676  content.writeDouble(time);
677  return myParent.getDouble(libsumo::CMD_GET_EDGE_VARIABLE, libsumo::VAR_EDGE_TRAVELTIME, edgeID, &content);
678 }
679 
680 double
681 TraCIAPI::EdgeScope::getEffort(const std::string& edgeID, double time) const {
682  tcpip::Storage content;
684  content.writeDouble(time);
685  return myParent.getDouble(libsumo::CMD_GET_EDGE_VARIABLE, libsumo::VAR_EDGE_EFFORT, edgeID, &content);
686 }
687 
688 double
689 TraCIAPI::EdgeScope::getCO2Emission(const std::string& edgeID) const {
690  return myParent.getDouble(libsumo::CMD_GET_EDGE_VARIABLE, libsumo::VAR_CO2EMISSION, edgeID);
691 }
692 
693 
694 double
695 TraCIAPI::EdgeScope::getCOEmission(const std::string& edgeID) const {
696  return myParent.getDouble(libsumo::CMD_GET_EDGE_VARIABLE, libsumo::VAR_COEMISSION, edgeID);
697 }
698 
699 double
700 TraCIAPI::EdgeScope::getHCEmission(const std::string& edgeID) const {
701  return myParent.getDouble(libsumo::CMD_GET_EDGE_VARIABLE, libsumo::VAR_HCEMISSION, edgeID);
702 }
703 
704 double
705 TraCIAPI::EdgeScope::getPMxEmission(const std::string& edgeID) const {
706  return myParent.getDouble(libsumo::CMD_GET_EDGE_VARIABLE, libsumo::VAR_PMXEMISSION, edgeID);
707 }
708 
709 double
710 TraCIAPI::EdgeScope::getNOxEmission(const std::string& edgeID) const {
711  return myParent.getDouble(libsumo::CMD_GET_EDGE_VARIABLE, libsumo::VAR_NOXEMISSION, edgeID);
712 }
713 
714 double
715 TraCIAPI::EdgeScope::getFuelConsumption(const std::string& edgeID) const {
716  return myParent.getDouble(libsumo::CMD_GET_EDGE_VARIABLE, libsumo::VAR_FUELCONSUMPTION, edgeID);
717 }
718 
719 double
720 TraCIAPI::EdgeScope::getNoiseEmission(const std::string& edgeID) const {
721  return myParent.getDouble(libsumo::CMD_GET_EDGE_VARIABLE, libsumo::VAR_NOISEEMISSION, edgeID);
722 }
723 
724 double
725 TraCIAPI::EdgeScope::getElectricityConsumption(const std::string& edgeID) const {
726  return myParent.getDouble(libsumo::CMD_GET_EDGE_VARIABLE, libsumo::VAR_ELECTRICITYCONSUMPTION, edgeID);
727 }
728 
729 double
730 TraCIAPI::EdgeScope::getLastStepMeanSpeed(const std::string& edgeID) const {
731  return myParent.getDouble(libsumo::CMD_GET_EDGE_VARIABLE, libsumo::LAST_STEP_MEAN_SPEED, edgeID);
732 }
733 
734 double
735 TraCIAPI::EdgeScope::getLastStepOccupancy(const std::string& edgeID) const {
736  return myParent.getDouble(libsumo::CMD_GET_EDGE_VARIABLE, libsumo::LAST_STEP_OCCUPANCY, edgeID);
737 }
738 
739 double
740 TraCIAPI::EdgeScope::getLastStepLength(const std::string& edgeID) const {
741  return myParent.getDouble(libsumo::CMD_GET_EDGE_VARIABLE, libsumo::LAST_STEP_LENGTH, edgeID);
742 }
743 
744 double
745 TraCIAPI::EdgeScope::getTraveltime(const std::string& edgeID) const {
746  return myParent.getDouble(libsumo::CMD_GET_EDGE_VARIABLE, libsumo::VAR_CURRENT_TRAVELTIME, edgeID);
747 }
748 
749 int
750 TraCIAPI::EdgeScope::getLastStepVehicleNumber(const std::string& edgeID) const {
751  return myParent.getInt(libsumo::CMD_GET_EDGE_VARIABLE, libsumo::LAST_STEP_VEHICLE_NUMBER, edgeID);
752 }
753 
754 double
755 TraCIAPI::EdgeScope::getLastStepHaltingNumber(const std::string& edgeID) const {
757 }
758 
759 std::vector<std::string>
760 TraCIAPI::EdgeScope::getLastStepVehicleIDs(const std::string& edgeID) const {
761  return myParent.getStringVector(libsumo::CMD_GET_EDGE_VARIABLE, libsumo::LAST_STEP_VEHICLE_ID_LIST, edgeID);
762 }
763 
764 
765 int
766 TraCIAPI::EdgeScope::getLaneNumber(const std::string& edgeID) const {
767  return myParent.getInt(libsumo::CMD_GET_EDGE_VARIABLE, libsumo::VAR_LANE_INDEX, edgeID);
768 }
769 
770 
771 std::string
772 TraCIAPI::EdgeScope::getStreetName(const std::string& edgeID) const {
773  return myParent.getString(libsumo::CMD_GET_EDGE_VARIABLE, libsumo::VAR_NAME, edgeID);
774 }
775 
776 
777 void
778 TraCIAPI::EdgeScope::adaptTraveltime(const std::string& edgeID, double time, double beginSeconds, double endSeconds) const {
779  tcpip::Storage content;
781  if (endSeconds != std::numeric_limits<double>::max()) {
782  content.writeInt(3);
784  content.writeDouble(beginSeconds);
786  content.writeDouble(endSeconds);
787  } else {
788  content.writeInt(1);
789  }
791  content.writeDouble(time);
792  myParent.createCommand(libsumo::CMD_SET_EDGE_VARIABLE, libsumo::VAR_EDGE_TRAVELTIME, edgeID, &content);
793  myParent.processSet(libsumo::CMD_SET_EDGE_VARIABLE);
794 }
795 
796 
797 void
798 TraCIAPI::EdgeScope::setEffort(const std::string& edgeID, double effort, double beginSeconds, double endSeconds) const {
799  tcpip::Storage content;
801  if (endSeconds != std::numeric_limits<double>::max()) {
802  content.writeInt(3);
804  content.writeDouble(beginSeconds);
806  content.writeDouble(endSeconds);
807  } else {
808  content.writeInt(1);
809  }
811  content.writeDouble(effort);
812  myParent.createCommand(libsumo::CMD_SET_EDGE_VARIABLE, libsumo::VAR_EDGE_EFFORT, edgeID, &content);
813  myParent.processSet(libsumo::CMD_SET_EDGE_VARIABLE);
814 }
815 
816 void
817 TraCIAPI::EdgeScope::setMaxSpeed(const std::string& edgeID, double speed) const {
818  tcpip::Storage content;
820  content.writeDouble(speed);
821  myParent.createCommand(libsumo::CMD_SET_EDGE_VARIABLE, libsumo::VAR_MAXSPEED, edgeID, &content);
822  myParent.processSet(libsumo::CMD_SET_EDGE_VARIABLE);
823 }
824 
825 
826 // ---------------------------------------------------------------------------
827 // TraCIAPI::GUIScope-methods
828 // ---------------------------------------------------------------------------
829 std::vector<std::string>
831  return myParent.getStringVector(libsumo::CMD_GET_GUI_VARIABLE, libsumo::TRACI_ID_LIST, "");
832 }
833 
834 double
835 TraCIAPI::GUIScope::getZoom(const std::string& viewID) const {
836  return myParent.getDouble(libsumo::CMD_GET_GUI_VARIABLE, libsumo::VAR_VIEW_ZOOM, viewID);
837 }
838 
840 TraCIAPI::GUIScope::getOffset(const std::string& viewID) const {
841  return myParent.getPosition(libsumo::CMD_GET_GUI_VARIABLE, libsumo::VAR_VIEW_OFFSET, viewID);
842 }
843 
844 std::string
845 TraCIAPI::GUIScope::getSchema(const std::string& viewID) const {
846  return myParent.getString(libsumo::CMD_GET_GUI_VARIABLE, libsumo::VAR_VIEW_SCHEMA, viewID);
847 }
848 
850 TraCIAPI::GUIScope::getBoundary(const std::string& viewID) const {
851  return myParent.getPolygon(libsumo::CMD_GET_GUI_VARIABLE, libsumo::VAR_VIEW_BOUNDARY, viewID);
852 }
853 
854 
855 void
856 TraCIAPI::GUIScope::setZoom(const std::string& viewID, double zoom) const {
857  tcpip::Storage content;
859  content.writeDouble(zoom);
860  myParent.createCommand(libsumo::CMD_SET_GUI_VARIABLE, libsumo::VAR_VIEW_ZOOM, viewID, &content);
861  myParent.processSet(libsumo::CMD_SET_GUI_VARIABLE);
862 }
863 
864 void
865 TraCIAPI::GUIScope::setOffset(const std::string& viewID, double x, double y) const {
866  tcpip::Storage content;
868  content.writeDouble(x);
869  content.writeDouble(y);
870  myParent.createCommand(libsumo::CMD_SET_GUI_VARIABLE, libsumo::VAR_VIEW_OFFSET, viewID, &content);
871  myParent.processSet(libsumo::CMD_SET_GUI_VARIABLE);
872 }
873 
874 void
875 TraCIAPI::GUIScope::setSchema(const std::string& viewID, const std::string& schemeName) const {
876  tcpip::Storage content;
878  content.writeString(schemeName);
879  myParent.createCommand(libsumo::CMD_SET_GUI_VARIABLE, libsumo::VAR_VIEW_SCHEMA, viewID, &content);
880  myParent.processSet(libsumo::CMD_SET_GUI_VARIABLE);
881 }
882 
883 void
884 TraCIAPI::GUIScope::setBoundary(const std::string& viewID, double xmin, double ymin, double xmax, double ymax) const {
885  tcpip::Storage content;
887  content.writeByte(2);
888  content.writeDouble(xmin);
889  content.writeDouble(ymin);
890  content.writeDouble(xmax);
891  content.writeDouble(ymax);
892  myParent.createCommand(libsumo::CMD_SET_GUI_VARIABLE, libsumo::VAR_VIEW_BOUNDARY, viewID, &content);
893  myParent.processSet(libsumo::CMD_SET_GUI_VARIABLE);
894 }
895 
896 void
897 TraCIAPI::GUIScope::screenshot(const std::string& viewID, const std::string& filename, const int width, const int height) const {
898  tcpip::Storage content;
900  content.writeInt(3);
902  content.writeString(filename);
904  content.writeInt(width);
906  content.writeInt(height);
907  myParent.createCommand(libsumo::CMD_SET_GUI_VARIABLE, libsumo::VAR_SCREENSHOT, viewID, &content);
908  myParent.processSet(libsumo::CMD_SET_GUI_VARIABLE);
909 }
910 
911 void
912 TraCIAPI::GUIScope::trackVehicle(const std::string& viewID, const std::string& vehID) const {
913  tcpip::Storage content;
915  content.writeString(vehID);
916  myParent.createCommand(libsumo::CMD_SET_GUI_VARIABLE, libsumo::VAR_TRACK_VEHICLE, viewID, &content);
917  myParent.processSet(libsumo::CMD_SET_GUI_VARIABLE);
918 }
919 
920 
921 // ---------------------------------------------------------------------------
922 // TraCIAPI::InductionLoopScope-methods
923 // ---------------------------------------------------------------------------
924 std::vector<std::string>
926  return myParent.getStringVector(libsumo::CMD_GET_INDUCTIONLOOP_VARIABLE, libsumo::TRACI_ID_LIST, "");
927 }
928 
929 double
930 TraCIAPI::InductionLoopScope::getPosition(const std::string& loopID) const {
931  return myParent.getDouble(libsumo::CMD_GET_INDUCTIONLOOP_VARIABLE, libsumo::VAR_POSITION, loopID);
932 }
933 
934 std::string
935 TraCIAPI::InductionLoopScope::getLaneID(const std::string& loopID) const {
936  return myParent.getString(libsumo::CMD_GET_INDUCTIONLOOP_VARIABLE, libsumo::VAR_LANE_ID, loopID);
937 }
938 
939 int
942 }
943 
944 double
945 TraCIAPI::InductionLoopScope::getLastStepMeanSpeed(const std::string& loopID) const {
947 }
948 
949 std::vector<std::string>
950 TraCIAPI::InductionLoopScope::getLastStepVehicleIDs(const std::string& loopID) const {
951  return myParent.getStringVector(libsumo::CMD_GET_INDUCTIONLOOP_VARIABLE, libsumo::LAST_STEP_VEHICLE_ID_LIST, loopID);
952 }
953 
954 double
955 TraCIAPI::InductionLoopScope::getLastStepOccupancy(const std::string& loopID) const {
956  return myParent.getDouble(libsumo::CMD_GET_INDUCTIONLOOP_VARIABLE, libsumo::LAST_STEP_OCCUPANCY, loopID);
957 }
958 
959 double
960 TraCIAPI::InductionLoopScope::getLastStepMeanLength(const std::string& loopID) const {
961  return myParent.getDouble(libsumo::CMD_GET_INDUCTIONLOOP_VARIABLE, libsumo::LAST_STEP_LENGTH, loopID);
962 }
963 
964 double
965 TraCIAPI::InductionLoopScope::getTimeSinceDetection(const std::string& loopID) const {
967 }
968 
969 
970 std::vector<libsumo::TraCIVehicleData>
971 TraCIAPI::InductionLoopScope::getVehicleData(const std::string& loopID) const {
972  std::vector<libsumo::TraCIVehicleData> result;
975  myParent.myInput.readInt(); // components
976  // number of items
977  myParent.myInput.readUnsignedByte();
978  const int n = myParent.myInput.readInt();
979  for (int i = 0; i < n; ++i) {
981 
982  myParent.myInput.readUnsignedByte();
983  vd.id = myParent.myInput.readString();
984 
985  myParent.myInput.readUnsignedByte();
986  vd.length = myParent.myInput.readDouble();
987 
988  myParent.myInput.readUnsignedByte();
989  vd.entryTime = myParent.myInput.readDouble();
990 
991  myParent.myInput.readUnsignedByte();
992  vd.leaveTime = myParent.myInput.readDouble();
993 
994  myParent.myInput.readUnsignedByte();
995  vd.typeID = myParent.myInput.readString();
996 
997  result.push_back(vd);
998  }
999  }
1000  return result;
1001 }
1002 
1003 
1004 // ---------------------------------------------------------------------------
1005 // TraCIAPI::JunctionScope-methods
1006 // ---------------------------------------------------------------------------
1007 std::vector<std::string>
1009  return myParent.getStringVector(libsumo::CMD_GET_JUNCTION_VARIABLE, libsumo::TRACI_ID_LIST, "");
1010 }
1011 
1012 int
1014  return myParent.getInt(libsumo::CMD_GET_JUNCTION_VARIABLE, libsumo::ID_COUNT, "");
1015 }
1016 
1017 
1019 TraCIAPI::JunctionScope::getPosition(const std::string& junctionID) const {
1020  return myParent.getPosition(libsumo::CMD_GET_JUNCTION_VARIABLE, libsumo::VAR_POSITION, junctionID);
1021 }
1022 
1024 TraCIAPI::JunctionScope::getShape(const std::string& junctionID) const {
1025  return myParent.getPolygon(libsumo::CMD_GET_JUNCTION_VARIABLE, libsumo::VAR_SHAPE, junctionID);
1026 }
1027 
1028 
1029 // ---------------------------------------------------------------------------
1030 // TraCIAPI::LaneScope-methods
1031 // ---------------------------------------------------------------------------
1032 std::vector<std::string>
1034  return myParent.getStringVector(libsumo::CMD_GET_LANE_VARIABLE, libsumo::TRACI_ID_LIST, "");
1035 }
1036 
1037 int
1039  return myParent.getInt(libsumo::CMD_GET_LANE_VARIABLE, libsumo::ID_COUNT, "");
1040 }
1041 
1042 double
1043 TraCIAPI::LaneScope::getLength(const std::string& laneID) const {
1044  return myParent.getDouble(libsumo::CMD_GET_LANE_VARIABLE, libsumo::VAR_LENGTH, laneID);
1045 }
1046 
1047 double
1048 TraCIAPI::LaneScope::getMaxSpeed(const std::string& laneID) const {
1049  return myParent.getDouble(libsumo::CMD_GET_LANE_VARIABLE, libsumo::VAR_MAXSPEED, laneID);
1050 }
1051 
1052 double
1053 TraCIAPI::LaneScope::getWidth(const std::string& laneID) const {
1054  return myParent.getDouble(libsumo::CMD_GET_LANE_VARIABLE, libsumo::VAR_WIDTH, laneID);
1055 }
1056 
1057 std::vector<std::string>
1058 TraCIAPI::LaneScope::getAllowed(const std::string& laneID) const {
1059  return myParent.getStringVector(libsumo::CMD_GET_LANE_VARIABLE, libsumo::LANE_ALLOWED, laneID);
1060 }
1061 
1062 std::vector<std::string>
1063 TraCIAPI::LaneScope::getDisallowed(const std::string& laneID) const {
1064  return myParent.getStringVector(libsumo::CMD_GET_LANE_VARIABLE, libsumo::LANE_DISALLOWED, laneID);
1065 }
1066 
1067 int
1068 TraCIAPI::LaneScope::getLinkNumber(const std::string& laneID) const {
1069  return myParent.getInt(libsumo::CMD_GET_LANE_VARIABLE, libsumo::LANE_LINK_NUMBER, laneID);
1070 }
1071 
1072 std::vector<libsumo::TraCIConnection>
1073 TraCIAPI::LaneScope::getLinks(const std::string& laneID) const {
1074  std::vector<libsumo::TraCIConnection> ret;
1075  myParent.createCommand(libsumo::CMD_GET_LANE_VARIABLE, libsumo::LANE_LINKS, laneID);
1076  if (myParent.processGet(libsumo::CMD_GET_LANE_VARIABLE, libsumo::TYPE_COMPOUND)) {
1077  myParent.myInput.readUnsignedByte();
1078  myParent.myInput.readInt();
1079 
1080  int linkNo = myParent.myInput.readInt();
1081  for (int i = 0; i < linkNo; ++i) {
1082 
1083  myParent.myInput.readUnsignedByte();
1084  std::string approachedLane = myParent.myInput.readString();
1085 
1086  myParent.myInput.readUnsignedByte();
1087  std::string approachedLaneInternal = myParent.myInput.readString();
1088 
1089  myParent.myInput.readUnsignedByte();
1090  bool hasPrio = myParent.myInput.readUnsignedByte() != 0;
1091 
1092  myParent.myInput.readUnsignedByte();
1093  bool isOpen = myParent.myInput.readUnsignedByte() != 0;
1094 
1095  myParent.myInput.readUnsignedByte();
1096  bool hasFoe = myParent.myInput.readUnsignedByte() != 0;
1097 
1098  myParent.myInput.readUnsignedByte();
1099  std::string state = myParent.myInput.readString();
1100 
1101  myParent.myInput.readUnsignedByte();
1102  std::string direction = myParent.myInput.readString();
1103 
1104  myParent.myInput.readUnsignedByte();
1105  double length = myParent.myInput.readDouble();
1106 
1107  ret.push_back(libsumo::TraCIConnection(approachedLane,
1108  hasPrio,
1109  isOpen,
1110  hasFoe,
1111  approachedLaneInternal,
1112  state,
1113  direction,
1114  length));
1115 
1116  }
1117 
1118  }
1119  return ret;
1120 }
1121 
1123 TraCIAPI::LaneScope::getShape(const std::string& laneID) const {
1124  return myParent.getPolygon(libsumo::CMD_GET_LANE_VARIABLE, libsumo::VAR_SHAPE, laneID);
1125 }
1126 
1127 std::string
1128 TraCIAPI::LaneScope::getEdgeID(const std::string& laneID) const {
1129  return myParent.getString(libsumo::CMD_GET_LANE_VARIABLE, libsumo::LANE_EDGE_ID, laneID);
1130 }
1131 
1132 double
1133 TraCIAPI::LaneScope::getCO2Emission(const std::string& laneID) const {
1134  return myParent.getDouble(libsumo::CMD_GET_LANE_VARIABLE, libsumo::VAR_CO2EMISSION, laneID);
1135 }
1136 
1137 double
1138 TraCIAPI::LaneScope::getCOEmission(const std::string& laneID) const {
1139  return myParent.getDouble(libsumo::CMD_GET_LANE_VARIABLE, libsumo::VAR_COEMISSION, laneID);
1140 }
1141 
1142 double
1143 TraCIAPI::LaneScope::getHCEmission(const std::string& laneID) const {
1144  return myParent.getDouble(libsumo::CMD_GET_LANE_VARIABLE, libsumo::VAR_HCEMISSION, laneID);
1145 }
1146 
1147 double
1148 TraCIAPI::LaneScope::getPMxEmission(const std::string& laneID) const {
1149  return myParent.getDouble(libsumo::CMD_GET_LANE_VARIABLE, libsumo::VAR_PMXEMISSION, laneID);
1150 }
1151 
1152 double
1153 TraCIAPI::LaneScope::getNOxEmission(const std::string& laneID) const {
1154  return myParent.getDouble(libsumo::CMD_GET_LANE_VARIABLE, libsumo::VAR_NOXEMISSION, laneID);
1155 }
1156 
1157 double
1158 TraCIAPI::LaneScope::getFuelConsumption(const std::string& laneID) const {
1159  return myParent.getDouble(libsumo::CMD_GET_LANE_VARIABLE, libsumo::VAR_FUELCONSUMPTION, laneID);
1160 }
1161 
1162 double
1163 TraCIAPI::LaneScope::getNoiseEmission(const std::string& laneID) const {
1164  return myParent.getDouble(libsumo::CMD_GET_LANE_VARIABLE, libsumo::VAR_NOISEEMISSION, laneID);
1165 }
1166 
1167 double
1168 TraCIAPI::LaneScope::getElectricityConsumption(const std::string& laneID) const {
1169  return myParent.getDouble(libsumo::CMD_GET_LANE_VARIABLE, libsumo::VAR_ELECTRICITYCONSUMPTION, laneID);
1170 }
1171 
1172 double
1173 TraCIAPI::LaneScope::getLastStepMeanSpeed(const std::string& laneID) const {
1174  return myParent.getDouble(libsumo::CMD_GET_LANE_VARIABLE, libsumo::LAST_STEP_MEAN_SPEED, laneID);
1175 }
1176 
1177 double
1178 TraCIAPI::LaneScope::getLastStepOccupancy(const std::string& laneID) const {
1179  return myParent.getDouble(libsumo::CMD_GET_LANE_VARIABLE, libsumo::LAST_STEP_OCCUPANCY, laneID);
1180 }
1181 
1182 double
1183 TraCIAPI::LaneScope::getLastStepLength(const std::string& laneID) const {
1184  return myParent.getDouble(libsumo::CMD_GET_LANE_VARIABLE, libsumo::LAST_STEP_LENGTH, laneID);
1185 }
1186 
1187 double
1188 TraCIAPI::LaneScope::getTraveltime(const std::string& laneID) const {
1189  return myParent.getDouble(libsumo::CMD_GET_LANE_VARIABLE, libsumo::VAR_CURRENT_TRAVELTIME, laneID);
1190 }
1191 
1192 int
1193 TraCIAPI::LaneScope::getLastStepVehicleNumber(const std::string& laneID) const {
1194  return myParent.getInt(libsumo::CMD_GET_LANE_VARIABLE, libsumo::LAST_STEP_VEHICLE_NUMBER, laneID);
1195 }
1196 
1197 int
1198 TraCIAPI::LaneScope::getLastStepHaltingNumber(const std::string& laneID) const {
1200 }
1201 
1202 std::vector<std::string>
1203 TraCIAPI::LaneScope::getLastStepVehicleIDs(const std::string& laneID) const {
1204  return myParent.getStringVector(libsumo::CMD_GET_LANE_VARIABLE, libsumo::LAST_STEP_VEHICLE_ID_LIST, laneID);
1205 }
1206 
1207 
1208 std::vector<std::string>
1209 TraCIAPI::LaneScope::getFoes(const std::string& laneID, const std::string& toLaneID) const {
1210  std::vector<std::string> r;
1211  tcpip::Storage content;
1213  content.writeString(toLaneID);
1214  myParent.createCommand(libsumo::CMD_GET_LANE_VARIABLE, libsumo::VAR_FOES, laneID, &content);
1215  if (myParent.processGet(libsumo::CMD_GET_LANE_VARIABLE, libsumo::TYPE_STRINGLIST)) {
1216  const int size = myParent.myInput.readInt();
1217  for (int i = 0; i < size; ++i) {
1218  r.push_back(myParent.myInput.readString());
1219  }
1220  }
1221  return r;
1222 }
1223 
1224 std::vector<std::string>
1225 TraCIAPI::LaneScope::getInternalFoes(const std::string& laneID) const {
1226  return getFoes(laneID, "");
1227 }
1228 
1229 
1230 void
1231 TraCIAPI::LaneScope::setAllowed(const std::string& laneID, const std::vector<std::string>& allowedClasses) const {
1232  tcpip::Storage content;
1234  content.writeInt((int)allowedClasses.size());
1235  for (int i = 0; i < (int)allowedClasses.size(); ++i) {
1236  content.writeString(allowedClasses[i]);
1237  }
1238  myParent.createCommand(libsumo::CMD_SET_LANE_VARIABLE, libsumo::LANE_ALLOWED, laneID, &content);
1239  myParent.processSet(libsumo::CMD_SET_LANE_VARIABLE);
1240 }
1241 
1242 void
1243 TraCIAPI::LaneScope::setDisallowed(const std::string& laneID, const std::vector<std::string>& disallowedClasses) const {
1244  tcpip::Storage content;
1246  content.writeInt((int)disallowedClasses.size());
1247  for (int i = 0; i < (int)disallowedClasses.size(); ++i) {
1248  content.writeString(disallowedClasses[i]);
1249  }
1250  myParent.createCommand(libsumo::CMD_SET_LANE_VARIABLE, libsumo::LANE_DISALLOWED, laneID, &content);
1251  myParent.processSet(libsumo::CMD_SET_LANE_VARIABLE);
1252 }
1253 
1254 void
1255 TraCIAPI::LaneScope::setMaxSpeed(const std::string& laneID, double speed) const {
1256  tcpip::Storage content;
1258  content.writeDouble(speed);
1259  myParent.createCommand(libsumo::CMD_SET_LANE_VARIABLE, libsumo::VAR_MAXSPEED, laneID, &content);
1260  myParent.processSet(libsumo::CMD_SET_LANE_VARIABLE);
1261 }
1262 
1263 void
1264 TraCIAPI::LaneScope::setLength(const std::string& laneID, double length) const {
1265  tcpip::Storage content;
1267  content.writeDouble(length);
1268  myParent.createCommand(libsumo::CMD_SET_LANE_VARIABLE, libsumo::VAR_LENGTH, laneID, &content);
1269  myParent.processSet(libsumo::CMD_SET_LANE_VARIABLE);
1270 }
1271 
1272 
1273 // ---------------------------------------------------------------------------
1274 // TraCIAPI::LaneAreaDetector-methods
1275 // ---------------------------------------------------------------------------
1276 std::vector<std::string>
1278  return myParent.getStringVector(libsumo::CMD_GET_LANEAREA_VARIABLE, libsumo::TRACI_ID_LIST, "");
1279 }
1280 
1281 
1282 
1283 
1284 // ---------------------------------------------------------------------------
1285 // TraCIAPI::MeMeScope-methods
1286 // ---------------------------------------------------------------------------
1287 std::vector<std::string>
1289  return myParent.getStringVector(libsumo::CMD_GET_MULTIENTRYEXIT_VARIABLE, libsumo::TRACI_ID_LIST, "");
1290 }
1291 
1292 int
1293 TraCIAPI::MeMeScope::getLastStepVehicleNumber(const std::string& detID) const {
1295 }
1296 
1297 double
1298 TraCIAPI::MeMeScope::getLastStepMeanSpeed(const std::string& detID) const {
1300 }
1301 
1302 std::vector<std::string>
1303 TraCIAPI::MeMeScope::getLastStepVehicleIDs(const std::string& detID) const {
1304  return myParent.getStringVector(libsumo::CMD_GET_MULTIENTRYEXIT_VARIABLE, libsumo::LAST_STEP_VEHICLE_ID_LIST, detID);
1305 }
1306 
1307 int
1308 TraCIAPI::MeMeScope::getLastStepHaltingNumber(const std::string& detID) const {
1310 }
1311 
1312 
1313 
1314 // ---------------------------------------------------------------------------
1315 // TraCIAPI::POIScope-methods
1316 // ---------------------------------------------------------------------------
1317 std::vector<std::string>
1319  return myParent.getStringVector(libsumo::CMD_GET_POI_VARIABLE, libsumo::TRACI_ID_LIST, "");
1320 }
1321 
1322 int
1324  return myParent.getInt(libsumo::CMD_GET_POI_VARIABLE, libsumo::ID_COUNT, "");
1325 }
1326 
1327 std::string
1328 TraCIAPI::POIScope::getType(const std::string& poiID) const {
1329  return myParent.getString(libsumo::CMD_GET_POI_VARIABLE, libsumo::VAR_TYPE, poiID);
1330 }
1331 
1333 TraCIAPI::POIScope::getPosition(const std::string& poiID) const {
1334  return myParent.getPosition(libsumo::CMD_GET_POI_VARIABLE, libsumo::VAR_POSITION, poiID);
1335 }
1336 
1338 TraCIAPI::POIScope::getColor(const std::string& poiID) const {
1339  return myParent.getColor(libsumo::CMD_GET_POI_VARIABLE, libsumo::VAR_COLOR, poiID);
1340 }
1341 
1342 double
1343 TraCIAPI::POIScope::getWidth(const std::string& poiID) const {
1344  return myParent.getDouble(libsumo::CMD_GET_POI_VARIABLE, libsumo::VAR_WIDTH, poiID);
1345 }
1346 
1347 double
1348 TraCIAPI::POIScope::getHeight(const std::string& poiID) const {
1349  return myParent.getDouble(libsumo::CMD_GET_POI_VARIABLE, libsumo::VAR_HEIGHT, poiID);
1350 }
1351 
1352 double
1353 TraCIAPI::POIScope::getAngle(const std::string& poiID) const {
1354  return myParent.getDouble(libsumo::CMD_GET_POI_VARIABLE, libsumo::VAR_ANGLE, poiID);
1355 }
1356 
1357 std::string
1358 TraCIAPI::POIScope::getImageFile(const std::string& poiID) const {
1359  return myParent.getString(libsumo::CMD_GET_POI_VARIABLE, libsumo::VAR_IMAGEFILE, poiID);
1360 }
1361 
1362 
1363 void
1364 TraCIAPI::POIScope::setType(const std::string& poiID, const std::string& setType) const {
1365  tcpip::Storage content;
1367  content.writeString(setType);
1368  myParent.createCommand(libsumo::CMD_SET_POI_VARIABLE, libsumo::VAR_TYPE, poiID, &content);
1369  myParent.processSet(libsumo::CMD_SET_POI_VARIABLE);
1370 }
1371 
1372 
1373 void
1374 TraCIAPI::POIScope::setPosition(const std::string& poiID, double x, double y) const {
1375  tcpip::Storage content;
1377  content.writeDouble(x);
1378  content.writeDouble(y);
1379  myParent.createCommand(libsumo::CMD_SET_POI_VARIABLE, libsumo::VAR_POSITION, poiID, &content);
1380  myParent.processSet(libsumo::CMD_SET_POI_VARIABLE);
1381 }
1382 
1383 
1384 void
1385 TraCIAPI::POIScope::setColor(const std::string& poiID, const libsumo::TraCIColor& c) const {
1386  tcpip::Storage content;
1388  content.writeUnsignedByte(c.r);
1389  content.writeUnsignedByte(c.g);
1390  content.writeUnsignedByte(c.b);
1391  content.writeUnsignedByte(c.a);
1392  myParent.createCommand(libsumo::CMD_SET_POI_VARIABLE, libsumo::VAR_COLOR, poiID, &content);
1393  myParent.processSet(libsumo::CMD_SET_POI_VARIABLE);
1394 }
1395 
1396 
1397 void
1398 TraCIAPI::POIScope::setWidth(const std::string& poiID, double width) const {
1399  tcpip::Storage content;
1401  content.writeDouble(width);
1402  myParent.createCommand(libsumo::CMD_SET_POI_VARIABLE, libsumo::VAR_WIDTH, poiID, &content);
1403  myParent.processSet(libsumo::CMD_SET_POI_VARIABLE);
1404 }
1405 
1406 
1407 void
1408 TraCIAPI::POIScope::setHeight(const std::string& poiID, double height) const {
1409  tcpip::Storage content;
1411  content.writeDouble(height);
1412  myParent.createCommand(libsumo::CMD_SET_POI_VARIABLE, libsumo::VAR_HEIGHT, poiID, &content);
1413  myParent.processSet(libsumo::CMD_SET_POI_VARIABLE);
1414 }
1415 
1416 
1417 void
1418 TraCIAPI::POIScope::setAngle(const std::string& poiID, double angle) const {
1419  tcpip::Storage content;
1421  content.writeDouble(angle);
1422  myParent.createCommand(libsumo::CMD_SET_POI_VARIABLE, libsumo::VAR_ANGLE, poiID, &content);
1423  myParent.processSet(libsumo::CMD_SET_POI_VARIABLE);
1424 }
1425 
1426 
1427 void
1428 TraCIAPI::POIScope::setImageFile(const std::string& poiID, const std::string& imageFile) const {
1429  tcpip::Storage content;
1431  content.writeString(imageFile);
1432  myParent.createCommand(libsumo::CMD_SET_POI_VARIABLE, libsumo::VAR_IMAGEFILE, poiID, &content);
1433  myParent.processSet(libsumo::CMD_SET_POI_VARIABLE);
1434 }
1435 
1436 
1437 void
1438 TraCIAPI::POIScope::add(const std::string& poiID, double x, double y, const libsumo::TraCIColor& c, const std::string& type, int layer, const std::string& imgFile, double width, double height, double angle) const {
1439  tcpip::Storage content;
1441  content.writeInt(8);
1443  content.writeString(type);
1445  content.writeUnsignedByte(c.r);
1446  content.writeUnsignedByte(c.g);
1447  content.writeUnsignedByte(c.b);
1448  content.writeUnsignedByte(c.a);
1450  content.writeInt(layer);
1452  content.writeDouble(x);
1453  content.writeDouble(y);
1455  content.writeString(imgFile);
1457  content.writeDouble(width);
1459  content.writeDouble(height);
1461  content.writeDouble(angle);
1462  myParent.createCommand(libsumo::CMD_SET_POI_VARIABLE, libsumo::ADD, poiID, &content);
1463  myParent.processSet(libsumo::CMD_SET_POI_VARIABLE);
1464 }
1465 
1466 void
1467 TraCIAPI::POIScope::remove(const std::string& poiID, int layer) const {
1468  tcpip::Storage content;
1470  content.writeInt(layer);
1471  myParent.createCommand(libsumo::CMD_SET_POI_VARIABLE, libsumo::REMOVE, poiID, &content);
1472  myParent.processSet(libsumo::CMD_SET_POI_VARIABLE);
1473 }
1474 
1475 
1476 
1477 // ---------------------------------------------------------------------------
1478 // TraCIAPI::PolygonScope-methods
1479 // ---------------------------------------------------------------------------
1480 std::vector<std::string>
1482  return myParent.getStringVector(libsumo::CMD_GET_POLYGON_VARIABLE, libsumo::TRACI_ID_LIST, "");
1483 }
1484 
1485 int
1487  return myParent.getInt(libsumo::CMD_GET_POLYGON_VARIABLE, libsumo::ID_COUNT, "");
1488 }
1489 
1490 double
1491 TraCIAPI::PolygonScope::getLineWidth(const std::string& polygonID) const {
1492  return myParent.getDouble(libsumo::CMD_GET_POLYGON_VARIABLE, libsumo::VAR_WIDTH, polygonID);
1493 }
1494 
1495 std::string
1496 TraCIAPI::PolygonScope::getType(const std::string& polygonID) const {
1497  return myParent.getString(libsumo::CMD_GET_POLYGON_VARIABLE, libsumo::VAR_TYPE, polygonID);
1498 }
1499 
1501 TraCIAPI::PolygonScope::getShape(const std::string& polygonID) const {
1502  return myParent.getPolygon(libsumo::CMD_GET_POLYGON_VARIABLE, libsumo::VAR_SHAPE, polygonID);
1503 }
1504 
1506 TraCIAPI::PolygonScope::getColor(const std::string& polygonID) const {
1507  return myParent.getColor(libsumo::CMD_GET_POLYGON_VARIABLE, libsumo::VAR_COLOR, polygonID);
1508 }
1509 
1510 void
1511 TraCIAPI::PolygonScope::setLineWidth(const std::string& polygonID, const double lineWidth) const {
1512  tcpip::Storage content;
1514  content.writeDouble(lineWidth);
1515  myParent.createCommand(libsumo::CMD_SET_POLYGON_VARIABLE, libsumo::VAR_WIDTH, polygonID, &content);
1516  myParent.processSet(libsumo::CMD_SET_POLYGON_VARIABLE);
1517 }
1518 
1519 void
1520 TraCIAPI::PolygonScope::setType(const std::string& polygonID, const std::string& setType) const {
1521  tcpip::Storage content;
1523  content.writeString(setType);
1524  myParent.createCommand(libsumo::CMD_SET_POLYGON_VARIABLE, libsumo::VAR_TYPE, polygonID, &content);
1525  myParent.processSet(libsumo::CMD_SET_POLYGON_VARIABLE);
1526 }
1527 
1528 
1529 void
1530 TraCIAPI::PolygonScope::setShape(const std::string& polygonID, const libsumo::TraCIPositionVector& shape) const {
1531  tcpip::Storage content;
1533  if (shape.size() < 256) {
1534  content.writeUnsignedByte((int)shape.size());
1535  } else {
1536  content.writeUnsignedByte(0);
1537  content.writeInt((int)shape.size());
1538  }
1539  for (const libsumo::TraCIPosition& pos : shape) {
1540  content.writeDouble(pos.x);
1541  content.writeDouble(pos.y);
1542  }
1543  myParent.createCommand(libsumo::CMD_SET_POLYGON_VARIABLE, libsumo::VAR_SHAPE, polygonID, &content);
1544  myParent.processSet(libsumo::CMD_SET_POLYGON_VARIABLE);
1545 }
1546 
1547 
1548 void
1549 TraCIAPI::PolygonScope::setColor(const std::string& polygonID, const libsumo::TraCIColor& c) const {
1550  tcpip::Storage content;
1552  content.writeUnsignedByte(c.r);
1553  content.writeUnsignedByte(c.g);
1554  content.writeUnsignedByte(c.b);
1555  content.writeUnsignedByte(c.a);
1556  myParent.createCommand(libsumo::CMD_SET_POLYGON_VARIABLE, libsumo::VAR_COLOR, polygonID, &content);
1557  myParent.processSet(libsumo::CMD_SET_POLYGON_VARIABLE);
1558 }
1559 
1560 void
1561 TraCIAPI::PolygonScope::add(const std::string& polygonID, const libsumo::TraCIPositionVector& shape, const libsumo::TraCIColor& c, bool fill, const std::string& type, int layer) const {
1562  tcpip::Storage content;
1564  content.writeInt(5);
1566  content.writeString(type);
1568  content.writeUnsignedByte(c.r);
1569  content.writeUnsignedByte(c.g);
1570  content.writeUnsignedByte(c.b);
1571  content.writeUnsignedByte(c.a);
1573  int f = fill ? 1 : 0;
1574  content.writeUnsignedByte(f);
1576  content.writeInt(layer);
1578  content.writeUnsignedByte((int)shape.size());
1579  for (int i = 0; i < (int)shape.size(); ++i) {
1580  content.writeDouble(shape[i].x);
1581  content.writeDouble(shape[i].y);
1582  }
1583  myParent.createCommand(libsumo::CMD_SET_POLYGON_VARIABLE, libsumo::ADD, polygonID, &content);
1584  myParent.processSet(libsumo::CMD_SET_POLYGON_VARIABLE);
1585 }
1586 
1587 void
1588 TraCIAPI::PolygonScope::remove(const std::string& polygonID, int layer) const {
1589  tcpip::Storage content;
1591  content.writeInt(layer);
1592  myParent.createCommand(libsumo::CMD_SET_POLYGON_VARIABLE, libsumo::REMOVE, polygonID, &content);
1593  myParent.processSet(libsumo::CMD_SET_POLYGON_VARIABLE);
1594 }
1595 
1596 
1597 // ---------------------------------------------------------------------------
1598 // TraCIAPI::RouteScope-methods
1599 // ---------------------------------------------------------------------------
1600 std::vector<std::string>
1602  return myParent.getStringVector(libsumo::CMD_GET_ROUTE_VARIABLE, libsumo::TRACI_ID_LIST, "");
1603 }
1604 
1605 std::vector<std::string>
1606 TraCIAPI::RouteScope::getEdges(const std::string& routeID) const {
1607  return myParent.getStringVector(libsumo::CMD_GET_ROUTE_VARIABLE, libsumo::VAR_EDGES, routeID);
1608 }
1609 
1610 
1611 void
1612 TraCIAPI::RouteScope::add(const std::string& routeID, const std::vector<std::string>& edges) const {
1613  tcpip::Storage content;
1615  content.writeStringList(edges);
1616  myParent.createCommand(libsumo::CMD_SET_ROUTE_VARIABLE, libsumo::ADD, routeID, &content);
1617  myParent.processSet(libsumo::CMD_SET_ROUTE_VARIABLE);
1618 }
1619 
1620 
1621 // ---------------------------------------------------------------------------
1622 // TraCIAPI::SimulationScope-methods
1623 // ---------------------------------------------------------------------------
1624 int
1626  return myParent.getInt(libsumo::CMD_GET_SIM_VARIABLE, libsumo::VAR_TIME_STEP, "");
1627 }
1628 
1629 double
1631  return myParent.getDouble(libsumo::CMD_GET_SIM_VARIABLE, libsumo::VAR_TIME, "");
1632 }
1633 
1634 int
1636  return (int) myParent.getInt(libsumo::CMD_GET_SIM_VARIABLE, libsumo::VAR_LOADED_VEHICLES_NUMBER, "");
1637 }
1638 
1639 std::vector<std::string>
1641  return myParent.getStringVector(libsumo::CMD_GET_SIM_VARIABLE, libsumo::VAR_LOADED_VEHICLES_IDS, "");
1642 }
1643 
1644 int
1646  return (int) myParent.getInt(libsumo::CMD_GET_SIM_VARIABLE, libsumo::VAR_DEPARTED_VEHICLES_NUMBER, "");
1647 }
1648 
1649 std::vector<std::string>
1651  return myParent.getStringVector(libsumo::CMD_GET_SIM_VARIABLE, libsumo::VAR_DEPARTED_VEHICLES_IDS, "");
1652 }
1653 
1654 int
1656  return (int) myParent.getInt(libsumo::CMD_GET_SIM_VARIABLE, libsumo::VAR_ARRIVED_VEHICLES_NUMBER, "");
1657 }
1658 
1659 std::vector<std::string>
1661  return myParent.getStringVector(libsumo::CMD_GET_SIM_VARIABLE, libsumo::VAR_ARRIVED_VEHICLES_IDS, "");
1662 }
1663 
1664 int
1667 }
1668 
1669 std::vector<std::string>
1671  return myParent.getStringVector(libsumo::CMD_GET_SIM_VARIABLE, libsumo::VAR_TELEPORT_STARTING_VEHICLES_IDS, "");
1672 }
1673 
1674 int
1677 }
1678 
1679 std::vector<std::string>
1681  return myParent.getStringVector(libsumo::CMD_GET_SIM_VARIABLE, libsumo::VAR_TELEPORT_ENDING_VEHICLES_IDS, "");
1682 }
1683 
1684 double
1686  return myParent.getDouble(libsumo::CMD_GET_SIM_VARIABLE, libsumo::VAR_DELTA_T, "");
1687 }
1688 
1691  return myParent.getPolygon(libsumo::CMD_GET_SIM_VARIABLE, libsumo::VAR_NET_BOUNDING_BOX, "");
1692 }
1693 
1694 
1695 int
1698 }
1699 
1700 int
1701 TraCIAPI::SimulationScope::getBusStopWaiting(const std::string& stopID) const {
1702  return (int) myParent.getInt(libsumo::CMD_GET_SIM_VARIABLE, libsumo::VAR_BUS_STOP_WAITING, stopID);
1703 }
1704 
1705 std::vector<std::string>
1706 TraCIAPI::SimulationScope::getBusStopWaitingIDList(const std::string& stopID) const {
1707  return myParent.getStringVector(libsumo::CMD_GET_SIM_VARIABLE, libsumo::VAR_BUS_STOP_WAITING_IDS, stopID);
1708 }
1709 
1710 
1712 TraCIAPI::SimulationScope::convert2D(const std::string& edgeID, double pos, int laneIndex, bool toGeo) const {
1713  const int posType = toGeo ? libsumo::POSITION_LON_LAT : libsumo::POSITION_2D;
1714  libsumo::TraCIPosition result;
1715  tcpip::Storage content;
1717  content.writeInt(2);
1719  content.writeString(edgeID);
1720  content.writeDouble(pos);
1721  content.writeByte(laneIndex);
1722  content.writeByte(libsumo::TYPE_UBYTE);
1723  content.writeByte(posType);
1724  myParent.createCommand(libsumo::CMD_GET_SIM_VARIABLE, libsumo::POSITION_CONVERSION, "", &content);
1725  if (myParent.processGet(libsumo::CMD_GET_SIM_VARIABLE, posType)) {
1726  result.x = myParent.myInput.readDouble();
1727  result.y = myParent.myInput.readDouble();
1728  }
1729  return result;
1730 }
1731 
1732 
1734 TraCIAPI::SimulationScope::convert3D(const std::string& edgeID, double pos, int laneIndex, bool toGeo) const {
1735  const int posType = toGeo ? libsumo::POSITION_LON_LAT_ALT : libsumo::POSITION_3D;
1736  libsumo::TraCIPosition result;
1737  tcpip::Storage content;
1739  content.writeInt(2);
1741  content.writeString(edgeID);
1742  content.writeDouble(pos);
1743  content.writeByte(laneIndex);
1744  content.writeByte(libsumo::TYPE_UBYTE);
1745  content.writeByte(posType);
1746  myParent.createCommand(libsumo::CMD_GET_SIM_VARIABLE, libsumo::POSITION_CONVERSION, "", &content);
1747  if (myParent.processGet(libsumo::CMD_GET_SIM_VARIABLE, posType)) {
1748  result.x = myParent.myInput.readDouble();
1749  result.y = myParent.myInput.readDouble();
1750  result.z = myParent.myInput.readDouble();
1751  }
1752  return result;
1753 }
1754 
1755 
1757 TraCIAPI::SimulationScope::convertRoad(double x, double y, bool isGeo, const std::string& vClass) const {
1759  tcpip::Storage content;
1761  content.writeInt(3);
1763  content.writeDouble(x);
1764  content.writeDouble(y);
1765  content.writeByte(libsumo::TYPE_UBYTE);
1768  content.writeString(vClass);
1769  myParent.createCommand(libsumo::CMD_GET_SIM_VARIABLE, libsumo::POSITION_CONVERSION, "", &content);
1770  if (myParent.processGet(libsumo::CMD_GET_SIM_VARIABLE, libsumo::POSITION_ROADMAP)) {
1771  result.edgeID = myParent.myInput.readString();
1772  result.pos = myParent.myInput.readDouble();
1773  result.laneIndex = myParent.myInput.readUnsignedByte();
1774  }
1775  return result;
1776 }
1777 
1778 
1780 TraCIAPI::SimulationScope::convertGeo(double x, double y, bool fromGeo) const {
1781  const int posType = fromGeo ? libsumo::POSITION_2D : libsumo::POSITION_LON_LAT;
1782  libsumo::TraCIPosition result;
1783  tcpip::Storage content;
1785  content.writeInt(2);
1787  content.writeDouble(x);
1788  content.writeDouble(y);
1789  content.writeByte(libsumo::TYPE_UBYTE);
1790  content.writeByte(posType);
1791  myParent.createCommand(libsumo::CMD_GET_SIM_VARIABLE, libsumo::POSITION_CONVERSION, "", &content);
1792  if (myParent.processGet(libsumo::CMD_GET_SIM_VARIABLE, posType)) {
1793  result.x = myParent.myInput.readDouble();
1794  result.y = myParent.myInput.readDouble();
1795  }
1796  return result;
1797 }
1798 
1799 
1800 double
1801 TraCIAPI::SimulationScope::getDistance2D(double x1, double y1, double x2, double y2, bool isGeo, bool isDriving) {
1802  tcpip::Storage content;
1804  content.writeInt(3);
1806  content.writeDouble(x1);
1807  content.writeDouble(y1);
1809  content.writeDouble(x2);
1810  content.writeDouble(y2);
1812  myParent.createCommand(libsumo::CMD_GET_SIM_VARIABLE, libsumo::DISTANCE_REQUEST, "", &content);
1813  if (myParent.processGet(libsumo::CMD_GET_SIM_VARIABLE, libsumo::TYPE_DOUBLE)) {
1814  return myParent.myInput.readDouble();
1815  }
1816  return 0.;
1817 }
1818 
1819 
1820 double
1821 TraCIAPI::SimulationScope::getDistanceRoad(const std::string& edgeID1, double pos1, const std::string& edgeID2, double pos2, bool isDriving) {
1822  tcpip::Storage content;
1824  content.writeInt(3);
1826  content.writeString(edgeID1);
1827  content.writeDouble(pos1);
1828  content.writeByte(0); // lane
1830  content.writeString(edgeID2);
1831  content.writeDouble(pos2);
1832  content.writeByte(0); // lane
1834  myParent.createCommand(libsumo::CMD_GET_SIM_VARIABLE, libsumo::DISTANCE_REQUEST, "", &content);
1835  if (myParent.processGet(libsumo::CMD_GET_SIM_VARIABLE, libsumo::TYPE_DOUBLE)) {
1836  return myParent.myInput.readDouble();
1837  }
1838  return 0.;
1839 }
1840 
1841 
1843 TraCIAPI::SimulationScope::findRoute(const std::string& fromEdge, const std::string& toEdge, const std::string& vType, double pos, int routingMode) const {
1844  tcpip::Storage content;
1846  content.writeInt(5);
1848  content.writeString(fromEdge);
1850  content.writeString(toEdge);
1852  content.writeString(vType);
1854  content.writeDouble(pos);
1856  content.writeInt(routingMode);
1857  return myParent.getTraCIStage(libsumo::CMD_GET_SIM_VARIABLE, libsumo::FIND_ROUTE, "", &content);
1858 }
1859 
1860 
1861 void
1863  tcpip::Storage content;
1865  content.writeString(msg);
1866  myParent.createCommand(libsumo::CMD_SET_SIM_VARIABLE, libsumo::CMD_MESSAGE, "", &content);
1867  myParent.processSet(libsumo::CMD_SET_SIM_VARIABLE);
1868 }
1869 
1870 // ---------------------------------------------------------------------------
1871 // TraCIAPI::TrafficLightScope-methods
1872 // ---------------------------------------------------------------------------
1873 std::vector<std::string>
1875  return myParent.getStringVector(libsumo::CMD_GET_TL_VARIABLE, libsumo::TRACI_ID_LIST, "");
1876 }
1877 
1878 int
1880  return myParent.getInt(libsumo::CMD_GET_TL_VARIABLE, libsumo::ID_COUNT, "");
1881 }
1882 
1883 std::string
1885  return myParent.getString(libsumo::CMD_GET_TL_VARIABLE, libsumo::TL_RED_YELLOW_GREEN_STATE, tlsID);
1886 }
1887 
1888 std::vector<libsumo::TraCILogic>
1890  std::vector<libsumo::TraCILogic> ret;
1891  myParent.createCommand(libsumo::CMD_GET_TL_VARIABLE, libsumo::TL_COMPLETE_DEFINITION_RYG, tlsID);
1892  if (myParent.processGet(libsumo::CMD_GET_TL_VARIABLE, libsumo::TYPE_COMPOUND)) {
1893  const int logicNo = myParent.myInput.readInt();
1894  for (int i = 0; i < logicNo; ++i) {
1895  myParent.myInput.readUnsignedByte();
1896  myParent.myInput.readInt();
1897  myParent.myInput.readUnsignedByte();
1898  const std::string programID = myParent.myInput.readString();
1899  myParent.myInput.readUnsignedByte();
1900  const int type = myParent.myInput.readInt();
1901  myParent.myInput.readUnsignedByte();
1902  const int phaseIndex = myParent.myInput.readInt();
1903  myParent.myInput.readUnsignedByte();
1904  const int phaseNumber = myParent.myInput.readInt();
1905  libsumo::TraCILogic logic(programID, type, phaseIndex);
1906  for (int j = 0; j < phaseNumber; j++) {
1907  myParent.myInput.readUnsignedByte();
1908  myParent.myInput.readInt();
1909  myParent.myInput.readUnsignedByte();
1910  const double duration = myParent.myInput.readDouble();
1911  myParent.myInput.readUnsignedByte();
1912  const std::string state = myParent.myInput.readString();
1913  myParent.myInput.readUnsignedByte();
1914  const double minDur = myParent.myInput.readDouble();
1915  myParent.myInput.readUnsignedByte();
1916  const double maxDur = myParent.myInput.readDouble();
1917  myParent.myInput.readUnsignedByte();
1918  const int numNext = myParent.myInput.readInt();
1919  std::vector<int> next;
1920  for (int k = 0; k < numNext; k++) {
1921  myParent.myInput.readUnsignedByte();
1922  next.push_back(myParent.myInput.readInt());
1923  }
1924  myParent.myInput.readUnsignedByte();
1925  const std::string name = myParent.myInput.readString();
1926  logic.phases.emplace_back(libsumo::TraCIPhase(duration, state, minDur, maxDur, next, name));
1927  }
1928  myParent.myInput.readUnsignedByte();
1929  const int paramNumber = myParent.myInput.readInt();
1930  for (int j = 0; j < paramNumber; j++) {
1931  myParent.myInput.readUnsignedByte();
1932  const std::vector<std::string> par = myParent.myInput.readStringList();
1933  logic.subParameter[par[0]] = par[1];
1934  }
1935  ret.emplace_back(logic);
1936  }
1937  }
1938  return ret;
1939 }
1940 
1941 std::vector<std::string>
1942 TraCIAPI::TrafficLightScope::getControlledLanes(const std::string& tlsID) const {
1943  return myParent.getStringVector(libsumo::CMD_GET_TL_VARIABLE, libsumo::TL_CONTROLLED_LANES, tlsID);
1944 }
1945 
1946 std::vector<std::vector<libsumo::TraCILink> >
1947 TraCIAPI::TrafficLightScope::getControlledLinks(const std::string& tlsID) const {
1948  std::vector<std::vector<libsumo::TraCILink> > result;
1949  myParent.createCommand(libsumo::CMD_GET_TL_VARIABLE, libsumo::TL_CONTROLLED_LINKS, tlsID);
1950  if (myParent.processGet(libsumo::CMD_GET_TL_VARIABLE, libsumo::TYPE_COMPOUND)) {
1951 
1952  myParent.myInput.readUnsignedByte();
1953  myParent.myInput.readInt();
1954 
1955  int linkNo = myParent.myInput.readInt();
1956  for (int i = 0; i < linkNo; ++i) {
1957  myParent.myInput.readUnsignedByte();
1958  int no = myParent.myInput.readInt();
1959  std::vector<libsumo::TraCILink> ret;
1960  for (int i1 = 0; i1 < no; ++i1) {
1961  myParent.myInput.readUnsignedByte();
1962  myParent.myInput.readInt();
1963  std::string from = myParent.myInput.readString();
1964  std::string to = myParent.myInput.readString();
1965  std::string via = myParent.myInput.readString();
1966  ret.emplace_back(libsumo::TraCILink(from, via, to));
1967  }
1968  result.emplace_back(ret);
1969  }
1970  }
1971  return result;
1972 }
1973 
1974 std::string
1975 TraCIAPI::TrafficLightScope::getProgram(const std::string& tlsID) const {
1976  return myParent.getString(libsumo::CMD_GET_TL_VARIABLE, libsumo::TL_CURRENT_PROGRAM, tlsID);
1977 }
1978 
1979 int
1980 TraCIAPI::TrafficLightScope::getPhase(const std::string& tlsID) const {
1981  return myParent.getInt(libsumo::CMD_GET_TL_VARIABLE, libsumo::TL_CURRENT_PHASE, tlsID);
1982 }
1983 
1984 std::string
1985 TraCIAPI::TrafficLightScope::getPhaseName(const std::string& tlsID) const {
1986  return myParent.getString(libsumo::CMD_GET_TL_VARIABLE, libsumo::VAR_NAME, tlsID);
1987 }
1988 
1989 double
1990 TraCIAPI::TrafficLightScope::getPhaseDuration(const std::string& tlsID) const {
1991  return myParent.getDouble(libsumo::CMD_GET_TL_VARIABLE, libsumo::TL_PHASE_DURATION, tlsID);
1992 }
1993 
1994 double
1995 TraCIAPI::TrafficLightScope::getNextSwitch(const std::string& tlsID) const {
1996  return myParent.getDouble(libsumo::CMD_GET_TL_VARIABLE, libsumo::TL_NEXT_SWITCH, tlsID);
1997 }
1998 
1999 
2000 int
2001 TraCIAPI::TrafficLightScope::getServedPersonCount(const std::string& tlsID, int index) const {
2002  tcpip::Storage content;
2004  content.writeInt(index);
2005  return myParent.getInt(myCmdGetID, libsumo::VAR_PERSON_NUMBER, tlsID, &content);
2006 }
2007 
2008 
2009 void
2010 TraCIAPI::TrafficLightScope::setRedYellowGreenState(const std::string& tlsID, const std::string& state) const {
2011  tcpip::Storage content;
2013  content.writeString(state);
2014  myParent.createCommand(libsumo::CMD_SET_TL_VARIABLE, libsumo::TL_RED_YELLOW_GREEN_STATE, tlsID, &content);
2015  myParent.processSet(libsumo::CMD_SET_TL_VARIABLE);
2016 }
2017 
2018 void
2019 TraCIAPI::TrafficLightScope::setPhase(const std::string& tlsID, int index) const {
2020  tcpip::Storage content;
2022  content.writeInt(index);
2023  myParent.createCommand(libsumo::CMD_SET_TL_VARIABLE, libsumo::TL_PHASE_INDEX, tlsID, &content);
2024  myParent.processSet(libsumo::CMD_SET_TL_VARIABLE);
2025 }
2026 
2027 void
2028 TraCIAPI::TrafficLightScope::setPhaseName(const std::string& tlsID, const std::string& name) const {
2029  tcpip::Storage content;
2031  content.writeString(name);
2032  myParent.createCommand(libsumo::CMD_SET_TL_VARIABLE, libsumo::VAR_NAME, tlsID, &content);
2033  myParent.processSet(libsumo::CMD_SET_TL_VARIABLE);
2034 }
2035 
2036 void
2037 TraCIAPI::TrafficLightScope::setProgram(const std::string& tlsID, const std::string& programID) const {
2038  tcpip::Storage content;
2040  content.writeString(programID);
2041  myParent.createCommand(libsumo::CMD_SET_TL_VARIABLE, libsumo::TL_PROGRAM, tlsID, &content);
2042  myParent.processSet(libsumo::CMD_SET_TL_VARIABLE);
2043 }
2044 
2045 void
2046 TraCIAPI::TrafficLightScope::setPhaseDuration(const std::string& tlsID, double phaseDuration) const {
2047  tcpip::Storage content;
2049  content.writeDouble(phaseDuration);
2050  myParent.createCommand(libsumo::CMD_SET_TL_VARIABLE, libsumo::TL_PHASE_DURATION, tlsID, &content);
2051  myParent.processSet(libsumo::CMD_SET_TL_VARIABLE);
2052 }
2053 
2054 void
2056  tcpip::Storage content;
2058  content.writeInt(5);
2060  content.writeString(logic.programID);
2062  content.writeInt(logic.type);
2064  content.writeInt(logic.currentPhaseIndex);
2066  content.writeInt((int)logic.phases.size());
2067  for (const libsumo::TraCIPhase& p : logic.phases) {
2069  content.writeInt(6);
2071  content.writeDouble(p.duration);
2073  content.writeString(p.state);
2075  content.writeDouble(p.minDur);
2077  content.writeDouble(p.maxDur);
2079  content.writeInt((int)p.next.size());
2080  for (int n : p.next) {
2082  content.writeInt(n);
2083  }
2085  content.writeString(p.name);
2086  }
2088  content.writeInt((int)logic.subParameter.size());
2089  for (const auto& item : logic.subParameter) {
2091  content.writeInt(2);
2092  content.writeString(item.first);
2093  content.writeString(item.second);
2094  }
2095  myParent.createCommand(libsumo::CMD_SET_TL_VARIABLE, libsumo::TL_COMPLETE_PROGRAM_RYG, tlsID, &content);
2096  myParent.processSet(libsumo::CMD_SET_TL_VARIABLE);
2097 }
2098 
2099 
2100 // ---------------------------------------------------------------------------
2101 // TraCIAPI::VehicleTypeScope-methods
2102 // ---------------------------------------------------------------------------
2103 std::vector<std::string>
2105  return myParent.getStringVector(libsumo::CMD_GET_VEHICLETYPE_VARIABLE, libsumo::TRACI_ID_LIST, "");
2106 }
2107 
2108 double
2109 TraCIAPI::VehicleTypeScope::getLength(const std::string& typeID) const {
2110  return myParent.getDouble(libsumo::CMD_GET_VEHICLETYPE_VARIABLE, libsumo::VAR_LENGTH, typeID);
2111 }
2112 
2113 double
2114 TraCIAPI::VehicleTypeScope::getMaxSpeed(const std::string& typeID) const {
2115  return myParent.getDouble(libsumo::CMD_GET_VEHICLETYPE_VARIABLE, libsumo::VAR_MAXSPEED, typeID);
2116 }
2117 
2118 double
2119 TraCIAPI::VehicleTypeScope::getSpeedFactor(const std::string& typeID) const {
2120  return myParent.getDouble(libsumo::CMD_GET_VEHICLETYPE_VARIABLE, libsumo::VAR_SPEED_FACTOR, typeID);
2121 }
2122 
2123 double
2124 TraCIAPI::VehicleTypeScope::getSpeedDeviation(const std::string& typeID) const {
2125  return myParent.getDouble(libsumo::CMD_GET_VEHICLETYPE_VARIABLE, libsumo::VAR_SPEED_DEVIATION, typeID);
2126 }
2127 
2128 double
2129 TraCIAPI::VehicleTypeScope::getAccel(const std::string& typeID) const {
2130  return myParent.getDouble(libsumo::CMD_GET_VEHICLETYPE_VARIABLE, libsumo::VAR_ACCEL, typeID);
2131 }
2132 
2133 double
2134 TraCIAPI::VehicleTypeScope::getDecel(const std::string& typeID) const {
2135  return myParent.getDouble(libsumo::CMD_GET_VEHICLETYPE_VARIABLE, libsumo::VAR_DECEL, typeID);
2136 }
2137 
2138 double
2139 TraCIAPI::VehicleTypeScope::getEmergencyDecel(const std::string& typeID) const {
2140  return myParent.getDouble(libsumo::CMD_GET_VEHICLETYPE_VARIABLE, libsumo::VAR_EMERGENCY_DECEL, typeID);
2141 }
2142 
2143 double
2144 TraCIAPI::VehicleTypeScope::getApparentDecel(const std::string& typeID) const {
2145  return myParent.getDouble(libsumo::CMD_GET_VEHICLETYPE_VARIABLE, libsumo::VAR_APPARENT_DECEL, typeID);
2146 }
2147 
2148 double
2149 TraCIAPI::VehicleTypeScope::getImperfection(const std::string& typeID) const {
2150  return myParent.getDouble(libsumo::CMD_GET_VEHICLETYPE_VARIABLE, libsumo::VAR_IMPERFECTION, typeID);
2151 }
2152 
2153 double
2154 TraCIAPI::VehicleTypeScope::getTau(const std::string& typeID) const {
2155  return myParent.getDouble(libsumo::CMD_GET_VEHICLETYPE_VARIABLE, libsumo::VAR_TAU, typeID);
2156 }
2157 
2158 std::string
2159 TraCIAPI::VehicleTypeScope::getVehicleClass(const std::string& typeID) const {
2160  return myParent.getString(libsumo::CMD_GET_VEHICLETYPE_VARIABLE, libsumo::VAR_VEHICLECLASS, typeID);
2161 }
2162 
2163 std::string
2164 TraCIAPI::VehicleTypeScope::getEmissionClass(const std::string& typeID) const {
2165  return myParent.getString(libsumo::CMD_GET_VEHICLETYPE_VARIABLE, libsumo::VAR_EMISSIONCLASS, typeID);
2166 }
2167 
2168 std::string
2169 TraCIAPI::VehicleTypeScope::getShapeClass(const std::string& typeID) const {
2170  return myParent.getString(libsumo::CMD_GET_VEHICLETYPE_VARIABLE, libsumo::VAR_SHAPECLASS, typeID);
2171 }
2172 
2173 double
2174 TraCIAPI::VehicleTypeScope::getMinGap(const std::string& typeID) const {
2175  return myParent.getDouble(libsumo::CMD_GET_VEHICLETYPE_VARIABLE, libsumo::VAR_MINGAP, typeID);
2176 }
2177 
2178 double
2179 TraCIAPI::VehicleTypeScope::getMinGapLat(const std::string& typeID) const {
2180  return myParent.getDouble(libsumo::CMD_GET_VEHICLETYPE_VARIABLE, libsumo::VAR_MINGAP_LAT, typeID);
2181 }
2182 
2183 double
2184 TraCIAPI::VehicleTypeScope::getMaxSpeedLat(const std::string& typeID) const {
2185  return myParent.getDouble(libsumo::CMD_GET_VEHICLETYPE_VARIABLE, libsumo::VAR_MAXSPEED_LAT, typeID);
2186 }
2187 
2188 std::string
2189 TraCIAPI::VehicleTypeScope::getLateralAlignment(const std::string& typeID) const {
2190  return myParent.getString(libsumo::CMD_GET_VEHICLETYPE_VARIABLE, libsumo::VAR_LATALIGNMENT, typeID);
2191 }
2192 
2193 int
2194 TraCIAPI::VehicleTypeScope::getPersonCapacity(const std::string& typeID) const {
2196 }
2197 
2198 double
2199 TraCIAPI::VehicleTypeScope::getWidth(const std::string& typeID) const {
2200  return myParent.getDouble(libsumo::CMD_GET_VEHICLETYPE_VARIABLE, libsumo::VAR_WIDTH, typeID);
2201 }
2202 
2203 double
2204 TraCIAPI::VehicleTypeScope::getHeight(const std::string& typeID) const {
2205  return myParent.getDouble(libsumo::CMD_GET_VEHICLETYPE_VARIABLE, libsumo::VAR_HEIGHT, typeID);
2206 }
2207 
2209 TraCIAPI::VehicleTypeScope::getColor(const std::string& typeID) const {
2210  return myParent.getColor(libsumo::CMD_GET_VEHICLETYPE_VARIABLE, libsumo::VAR_COLOR, typeID);
2211 }
2212 
2213 
2214 
2215 void
2216 TraCIAPI::VehicleTypeScope::setLength(const std::string& typeID, double length) const {
2217  tcpip::Storage content;
2219  content.writeDouble(length);
2220  myParent.createCommand(libsumo::CMD_SET_VEHICLETYPE_VARIABLE, libsumo::VAR_LENGTH, typeID, &content);
2221  myParent.processSet(libsumo::CMD_SET_VEHICLETYPE_VARIABLE);
2222 }
2223 
2224 void
2225 TraCIAPI::VehicleTypeScope::setMaxSpeed(const std::string& typeID, double speed) const {
2226  tcpip::Storage content;
2228  content.writeDouble(speed);
2229  myParent.createCommand(libsumo::CMD_SET_VEHICLETYPE_VARIABLE, libsumo::VAR_MAXSPEED, typeID, &content);
2230  myParent.processSet(libsumo::CMD_SET_VEHICLETYPE_VARIABLE);
2231 }
2232 
2233 void
2234 TraCIAPI::VehicleTypeScope::setVehicleClass(const std::string& typeID, const std::string& clazz) const {
2235  tcpip::Storage content;
2237  content.writeString(clazz);
2238  myParent.createCommand(libsumo::CMD_SET_VEHICLETYPE_VARIABLE, libsumo::VAR_VEHICLECLASS, typeID, &content);
2239  myParent.processSet(libsumo::CMD_SET_VEHICLETYPE_VARIABLE);
2240 }
2241 
2242 void
2243 TraCIAPI::VehicleTypeScope::setSpeedFactor(const std::string& typeID, double factor) const {
2244  tcpip::Storage content;
2246  content.writeDouble(factor);
2247  myParent.createCommand(libsumo::CMD_SET_VEHICLETYPE_VARIABLE, libsumo::VAR_SPEED_FACTOR, typeID, &content);
2248  myParent.processSet(libsumo::CMD_SET_VEHICLETYPE_VARIABLE);
2249 }
2250 
2251 void
2252 TraCIAPI::VehicleTypeScope::setSpeedDeviation(const std::string& typeID, double deviation) const {
2253  tcpip::Storage content;
2255  content.writeDouble(deviation);
2256  myParent.createCommand(libsumo::CMD_SET_VEHICLETYPE_VARIABLE, libsumo::VAR_SPEED_DEVIATION, typeID, &content);
2257  myParent.processSet(libsumo::CMD_SET_VEHICLETYPE_VARIABLE);
2258 }
2259 
2260 
2261 void
2262 TraCIAPI::VehicleTypeScope::setEmissionClass(const std::string& typeID, const std::string& clazz) const {
2263  tcpip::Storage content;
2265  content.writeString(clazz);
2266  myParent.createCommand(libsumo::CMD_SET_VEHICLETYPE_VARIABLE, libsumo::VAR_EMISSIONCLASS, typeID, &content);
2267  myParent.processSet(libsumo::CMD_SET_VEHICLETYPE_VARIABLE);
2268 }
2269 
2270 void
2271 TraCIAPI::VehicleTypeScope::setWidth(const std::string& typeID, double width) const {
2272  tcpip::Storage content;
2274  content.writeDouble(width);
2275  myParent.createCommand(libsumo::CMD_SET_VEHICLETYPE_VARIABLE, libsumo::VAR_WIDTH, typeID, &content);
2276  myParent.processSet(libsumo::CMD_SET_VEHICLETYPE_VARIABLE);
2277 }
2278 
2279 void
2280 TraCIAPI::VehicleTypeScope::setHeight(const std::string& typeID, double height) const {
2281  tcpip::Storage content;
2283  content.writeDouble(height);
2284  myParent.createCommand(libsumo::CMD_SET_VEHICLETYPE_VARIABLE, libsumo::VAR_HEIGHT, typeID, &content);
2285  myParent.processSet(libsumo::CMD_SET_VEHICLETYPE_VARIABLE);
2286 }
2287 
2288 void
2289 TraCIAPI::VehicleTypeScope::setMinGap(const std::string& typeID, double minGap) const {
2290  tcpip::Storage content;
2292  content.writeDouble(minGap);
2293  myParent.createCommand(libsumo::CMD_SET_VEHICLETYPE_VARIABLE, libsumo::VAR_MINGAP, typeID, &content);
2294  myParent.processSet(libsumo::CMD_SET_VEHICLETYPE_VARIABLE);
2295 }
2296 
2297 
2298 void
2299 TraCIAPI::VehicleTypeScope::setMinGapLat(const std::string& typeID, double minGapLat) const {
2300  tcpip::Storage content;
2302  content.writeDouble(minGapLat);
2303  myParent.createCommand(libsumo::CMD_SET_VEHICLETYPE_VARIABLE, libsumo::VAR_MINGAP_LAT, typeID, &content);
2304  myParent.processSet(libsumo::CMD_SET_VEHICLETYPE_VARIABLE);
2305 }
2306 
2307 void
2308 TraCIAPI::VehicleTypeScope::setMaxSpeedLat(const std::string& typeID, double speed) const {
2309  tcpip::Storage content;
2311  content.writeDouble(speed);
2312  myParent.createCommand(libsumo::CMD_SET_VEHICLETYPE_VARIABLE, libsumo::VAR_MAXSPEED_LAT, typeID, &content);
2313  myParent.processSet(libsumo::CMD_SET_VEHICLETYPE_VARIABLE);
2314 }
2315 
2316 void
2317 TraCIAPI::VehicleTypeScope::setLateralAlignment(const std::string& typeID, const std::string& latAlignment) const {
2318  tcpip::Storage content;
2320  content.writeString(latAlignment);
2321  myParent.createCommand(libsumo::CMD_SET_VEHICLETYPE_VARIABLE, libsumo::VAR_LATALIGNMENT, typeID, &content);
2322  myParent.processSet(libsumo::CMD_SET_VEHICLETYPE_VARIABLE);
2323 }
2324 
2325 void
2326 TraCIAPI::VehicleTypeScope::copy(const std::string& origTypeID, const std::string& newTypeID) const {
2327  tcpip::Storage content;
2329  content.writeString(newTypeID);
2330  myParent.createCommand(libsumo::CMD_SET_VEHICLETYPE_VARIABLE, libsumo::COPY, origTypeID, &content);
2331  myParent.processSet(libsumo::CMD_SET_VEHICLETYPE_VARIABLE);
2332 }
2333 
2334 void
2335 TraCIAPI::VehicleTypeScope::setShapeClass(const std::string& typeID, const std::string& clazz) const {
2336  tcpip::Storage content;
2338  content.writeString(clazz);
2339  myParent.createCommand(libsumo::CMD_SET_VEHICLETYPE_VARIABLE, libsumo::VAR_SHAPECLASS, typeID, &content);
2340  myParent.processSet(libsumo::CMD_SET_VEHICLETYPE_VARIABLE);
2341 }
2342 
2343 void
2344 TraCIAPI::VehicleTypeScope::setAccel(const std::string& typeID, double accel) const {
2345  tcpip::Storage content;
2347  content.writeDouble(accel);
2348  myParent.createCommand(libsumo::CMD_SET_VEHICLETYPE_VARIABLE, libsumo::VAR_ACCEL, typeID, &content);
2349  myParent.processSet(libsumo::CMD_SET_VEHICLETYPE_VARIABLE);
2350 }
2351 
2352 void
2353 TraCIAPI::VehicleTypeScope::setDecel(const std::string& typeID, double decel) const {
2354  tcpip::Storage content;
2356  content.writeDouble(decel);
2357  myParent.createCommand(libsumo::CMD_SET_VEHICLETYPE_VARIABLE, libsumo::VAR_DECEL, typeID, &content);
2358  myParent.processSet(libsumo::CMD_SET_VEHICLETYPE_VARIABLE);
2359 }
2360 
2361 void
2362 TraCIAPI::VehicleTypeScope::setEmergencyDecel(const std::string& typeID, double decel) const {
2363  tcpip::Storage content;
2365  content.writeDouble(decel);
2366  myParent.createCommand(libsumo::CMD_SET_VEHICLETYPE_VARIABLE, libsumo::VAR_EMERGENCY_DECEL, typeID, &content);
2367  myParent.processSet(libsumo::CMD_SET_VEHICLETYPE_VARIABLE);
2368 }
2369 
2370 void
2371 TraCIAPI::VehicleTypeScope::setApparentDecel(const std::string& typeID, double decel) const {
2372  tcpip::Storage content;
2374  content.writeDouble(decel);
2375  myParent.createCommand(libsumo::CMD_SET_VEHICLETYPE_VARIABLE, libsumo::VAR_APPARENT_DECEL, typeID, &content);
2376  myParent.processSet(libsumo::CMD_SET_VEHICLETYPE_VARIABLE);
2377 }
2378 
2379 void
2380 TraCIAPI::VehicleTypeScope::setImperfection(const std::string& typeID, double imperfection) const {
2381  tcpip::Storage content;
2383  content.writeDouble(imperfection);
2384  myParent.createCommand(libsumo::CMD_SET_VEHICLETYPE_VARIABLE, libsumo::VAR_IMPERFECTION, typeID, &content);
2385  myParent.processSet(libsumo::CMD_SET_VEHICLETYPE_VARIABLE);
2386 }
2387 
2388 void
2389 TraCIAPI::VehicleTypeScope::setTau(const std::string& typeID, double tau) const {
2390  tcpip::Storage content;
2392  content.writeDouble(tau);
2393  myParent.createCommand(libsumo::CMD_SET_VEHICLETYPE_VARIABLE, libsumo::VAR_TAU, typeID, &content);
2394  myParent.processSet(libsumo::CMD_SET_VEHICLETYPE_VARIABLE);
2395 }
2396 
2397 void
2398 TraCIAPI::VehicleTypeScope::setColor(const std::string& typeID, const libsumo::TraCIColor& c) const {
2399  tcpip::Storage content;
2401  content.writeUnsignedByte(c.r);
2402  content.writeUnsignedByte(c.g);
2403  content.writeUnsignedByte(c.b);
2404  content.writeUnsignedByte(c.a);
2405  myParent.createCommand(libsumo::CMD_SET_VEHICLETYPE_VARIABLE, libsumo::VAR_COLOR, typeID, &content);
2406  myParent.processSet(libsumo::CMD_SET_VEHICLETYPE_VARIABLE);
2407 }
2408 
2409 
2410 // ---------------------------------------------------------------------------
2411 // TraCIAPI::VehicleScope-methods
2412 // ---------------------------------------------------------------------------
2413 std::vector<std::string>
2415  return myParent.getStringVector(libsumo::CMD_GET_VEHICLE_VARIABLE, libsumo::TRACI_ID_LIST, "");
2416 }
2417 
2418 int
2420  return myParent.getInt(libsumo::CMD_GET_VEHICLE_VARIABLE, libsumo::ID_COUNT, "");
2421 }
2422 
2423 double
2424 TraCIAPI::VehicleScope::getSpeed(const std::string& vehicleID) const {
2425  return myParent.getDouble(libsumo::CMD_GET_VEHICLE_VARIABLE, libsumo::VAR_SPEED, vehicleID);
2426 }
2427 
2428 double
2429 TraCIAPI::VehicleScope::getLateralSpeed(const std::string& vehicleID) const {
2430  return myParent.getDouble(libsumo::CMD_GET_VEHICLE_VARIABLE, libsumo::VAR_SPEED_LAT, vehicleID);
2431 }
2432 
2433 double
2434 TraCIAPI::VehicleScope::getAcceleration(const std::string& vehicleID) const {
2435  return myParent.getDouble(libsumo::CMD_GET_VEHICLE_VARIABLE, libsumo::VAR_ACCELERATION, vehicleID);
2436 }
2437 
2438 double
2439 TraCIAPI::VehicleScope::getMaxSpeed(const std::string& vehicleID) const {
2440  return myParent.getDouble(libsumo::CMD_GET_VEHICLE_VARIABLE, libsumo::VAR_MAXSPEED, vehicleID);
2441 }
2442 
2444 TraCIAPI::VehicleScope::getPosition(const std::string& vehicleID) const {
2445  return myParent.getPosition(libsumo::CMD_GET_VEHICLE_VARIABLE, libsumo::VAR_POSITION, vehicleID);
2446 }
2447 
2449 TraCIAPI::VehicleScope::getPosition3D(const std::string& vehicleID) const {
2450  return myParent.getPosition3D(libsumo::CMD_GET_VEHICLE_VARIABLE, libsumo::VAR_POSITION3D, vehicleID);
2451 }
2452 
2453 double
2454 TraCIAPI::VehicleScope::getAngle(const std::string& vehicleID) const {
2455  return myParent.getDouble(libsumo::CMD_GET_VEHICLE_VARIABLE, libsumo::VAR_ANGLE, vehicleID);
2456 }
2457 
2458 std::string
2459 TraCIAPI::VehicleScope::getRoadID(const std::string& vehicleID) const {
2460  return myParent.getString(libsumo::CMD_GET_VEHICLE_VARIABLE, libsumo::VAR_ROAD_ID, vehicleID);
2461 }
2462 
2463 std::string
2464 TraCIAPI::VehicleScope::getLaneID(const std::string& vehicleID) const {
2465  return myParent.getString(libsumo::CMD_GET_VEHICLE_VARIABLE, libsumo::VAR_LANE_ID, vehicleID);
2466 }
2467 
2468 int
2469 TraCIAPI::VehicleScope::getLaneIndex(const std::string& vehicleID) const {
2470  return myParent.getInt(libsumo::CMD_GET_VEHICLE_VARIABLE, libsumo::VAR_LANE_INDEX, vehicleID);
2471 }
2472 
2473 std::string
2474 TraCIAPI::VehicleScope::getTypeID(const std::string& vehicleID) const {
2475  return myParent.getString(libsumo::CMD_GET_VEHICLE_VARIABLE, libsumo::VAR_TYPE, vehicleID);
2476 }
2477 
2478 std::string
2479 TraCIAPI::VehicleScope::getRouteID(const std::string& vehicleID) const {
2480  return myParent.getString(libsumo::CMD_GET_VEHICLE_VARIABLE, libsumo::VAR_ROUTE_ID, vehicleID);
2481 }
2482 
2483 int
2484 TraCIAPI::VehicleScope::getRouteIndex(const std::string& vehicleID) const {
2485  return myParent.getInt(libsumo::CMD_GET_VEHICLE_VARIABLE, libsumo::VAR_ROUTE_INDEX, vehicleID);
2486 }
2487 
2488 
2489 std::vector<std::string>
2490 TraCIAPI::VehicleScope::getRoute(const std::string& vehicleID) const {
2491  return myParent.getStringVector(libsumo::CMD_GET_VEHICLE_VARIABLE, libsumo::VAR_EDGES, vehicleID);
2492 }
2493 
2495 TraCIAPI::VehicleScope::getColor(const std::string& vehicleID) const {
2496  return myParent.getColor(libsumo::CMD_GET_VEHICLE_VARIABLE, libsumo::VAR_COLOR, vehicleID);
2497 }
2498 
2499 double
2500 TraCIAPI::VehicleScope::getLanePosition(const std::string& vehicleID) const {
2501  return myParent.getDouble(libsumo::CMD_GET_VEHICLE_VARIABLE, libsumo::VAR_LANEPOSITION, vehicleID);
2502 }
2503 
2504 double
2505 TraCIAPI::VehicleScope::getDistance(const std::string& vehicleID) const {
2506  return myParent.getDouble(libsumo::CMD_GET_VEHICLE_VARIABLE, libsumo::VAR_DISTANCE, vehicleID);
2507 }
2508 
2509 int
2510 TraCIAPI::VehicleScope::getSignals(const std::string& vehicleID) const {
2511  return myParent.getInt(libsumo::CMD_GET_VEHICLE_VARIABLE, libsumo::VAR_SIGNALS, vehicleID);
2512 }
2513 
2514 double
2515 TraCIAPI::VehicleScope::getLateralLanePosition(const std::string& vehicleID) const {
2516  return myParent.getDouble(libsumo::CMD_GET_VEHICLE_VARIABLE, libsumo::VAR_LANEPOSITION_LAT, vehicleID);
2517 }
2518 
2519 double
2520 TraCIAPI::VehicleScope::getCO2Emission(const std::string& vehicleID) const {
2521  return myParent.getDouble(libsumo::CMD_GET_VEHICLE_VARIABLE, libsumo::VAR_CO2EMISSION, vehicleID);
2522 }
2523 
2524 double
2525 TraCIAPI::VehicleScope::getCOEmission(const std::string& vehicleID) const {
2526  return myParent.getDouble(libsumo::CMD_GET_VEHICLE_VARIABLE, libsumo::VAR_COEMISSION, vehicleID);
2527 }
2528 
2529 double
2530 TraCIAPI::VehicleScope::getHCEmission(const std::string& vehicleID) const {
2531  return myParent.getDouble(libsumo::CMD_GET_VEHICLE_VARIABLE, libsumo::VAR_HCEMISSION, vehicleID);
2532 }
2533 
2534 double
2535 TraCIAPI::VehicleScope::getPMxEmission(const std::string& vehicleID) const {
2536  return myParent.getDouble(libsumo::CMD_GET_VEHICLE_VARIABLE, libsumo::VAR_PMXEMISSION, vehicleID);
2537 }
2538 
2539 double
2540 TraCIAPI::VehicleScope::getNOxEmission(const std::string& vehicleID) const {
2541  return myParent.getDouble(libsumo::CMD_GET_VEHICLE_VARIABLE, libsumo::VAR_NOXEMISSION, vehicleID);
2542 }
2543 
2544 double
2545 TraCIAPI::VehicleScope::getFuelConsumption(const std::string& vehicleID) const {
2546  return myParent.getDouble(libsumo::CMD_GET_VEHICLE_VARIABLE, libsumo::VAR_FUELCONSUMPTION, vehicleID);
2547 }
2548 
2549 double
2550 TraCIAPI::VehicleScope::getNoiseEmission(const std::string& vehicleID) const {
2551  return myParent.getDouble(libsumo::CMD_GET_VEHICLE_VARIABLE, libsumo::VAR_NOISEEMISSION, vehicleID);
2552 }
2553 
2554 double
2555 TraCIAPI::VehicleScope::getElectricityConsumption(const std::string& vehicleID) const {
2556  return myParent.getDouble(libsumo::CMD_GET_VEHICLE_VARIABLE, libsumo::VAR_ELECTRICITYCONSUMPTION, vehicleID);
2557 }
2558 
2559 double
2560 TraCIAPI::VehicleScope::getWaitingTime(const std::string& vehID) const {
2561  return myParent.getDouble(libsumo::CMD_GET_VEHICLE_VARIABLE, libsumo::VAR_WAITING_TIME, vehID);
2562 }
2563 
2564 int
2565 TraCIAPI::VehicleScope::getSpeedMode(const std::string& vehID) const {
2566  return myParent.getInt(libsumo::CMD_GET_VEHICLE_VARIABLE, libsumo::VAR_SPEEDSETMODE, vehID);
2567 }
2568 
2569 
2570 double
2571 TraCIAPI::VehicleScope::getSlope(const std::string& vehID) const {
2572  return myParent.getDouble(libsumo::CMD_GET_VEHICLE_VARIABLE, libsumo::VAR_SLOPE, vehID);
2573 }
2574 
2575 
2576 std::string
2577 TraCIAPI::VehicleScope::getLine(const std::string& typeID) const {
2578  return myParent.getString(libsumo::CMD_GET_VEHICLE_VARIABLE, libsumo::VAR_LINE, typeID);
2579 }
2580 
2581 std::vector<std::string>
2582 TraCIAPI::VehicleScope::getVia(const std::string& vehicleID) const {
2583  return myParent.getStringVector(libsumo::CMD_GET_VEHICLE_VARIABLE, libsumo::VAR_VIA, vehicleID);
2584 }
2585 
2586 std::string
2587 TraCIAPI::VehicleScope::getEmissionClass(const std::string& vehicleID) const {
2588  return myParent.getString(libsumo::CMD_GET_VEHICLE_VARIABLE, libsumo::VAR_EMISSIONCLASS, vehicleID);
2589 }
2590 
2591 std::string
2592 TraCIAPI::VehicleScope::getShapeClass(const std::string& vehicleID) const {
2593  return myParent.getString(libsumo::CMD_GET_VEHICLE_VARIABLE, libsumo::VAR_SHAPECLASS, vehicleID);
2594 }
2595 
2596 std::vector<libsumo::TraCINextTLSData>
2597 TraCIAPI::VehicleScope::getNextTLS(const std::string& vehID) const {
2598  std::vector<libsumo::TraCINextTLSData> result;
2599  myParent.createCommand(libsumo::CMD_GET_VEHICLE_VARIABLE, libsumo::VAR_NEXT_TLS, vehID);
2600  if (myParent.processGet(libsumo::CMD_GET_VEHICLE_VARIABLE, libsumo::TYPE_COMPOUND)) {
2601  myParent.myInput.readInt(); // components
2602  // number of items
2603  myParent.myInput.readUnsignedByte();
2604  const int n = myParent.myInput.readInt();
2605  for (int i = 0; i < n; ++i) {
2607  myParent.myInput.readUnsignedByte();
2608  d.id = myParent.myInput.readString();
2609 
2610  myParent.myInput.readUnsignedByte();
2611  d.tlIndex = myParent.myInput.readInt();
2612 
2613  myParent.myInput.readUnsignedByte();
2614  d.dist = myParent.myInput.readDouble();
2615 
2616  myParent.myInput.readUnsignedByte();
2617  d.state = (char)myParent.myInput.readByte();
2618 
2619  result.push_back(d);
2620  }
2621  }
2622  return result;
2623 }
2624 
2625 std::vector<libsumo::TraCIBestLanesData>
2626 TraCIAPI::VehicleScope::getBestLanes(const std::string& vehicleID) const {
2627  std::vector<libsumo::TraCIBestLanesData> result;
2628  myParent.createCommand(libsumo::CMD_GET_VEHICLE_VARIABLE, libsumo::VAR_BEST_LANES, vehicleID);
2629  if (myParent.processGet(libsumo::CMD_GET_VEHICLE_VARIABLE, libsumo::TYPE_COMPOUND)) {
2630  myParent.myInput.readInt();
2631  myParent.myInput.readUnsignedByte();
2632 
2633  const int n = myParent.myInput.readInt(); // number of following edge information
2634  for (int i = 0; i < n; ++i) {
2636  myParent.myInput.readUnsignedByte();
2637  info.laneID = myParent.myInput.readString();
2638 
2639  myParent.myInput.readUnsignedByte();
2640  info.length = myParent.myInput.readDouble();
2641 
2642  myParent.myInput.readUnsignedByte();
2643  info.occupation = myParent.myInput.readDouble();
2644 
2645  myParent.myInput.readUnsignedByte();
2646  info.bestLaneOffset = myParent.myInput.readByte();
2647 
2648  myParent.myInput.readUnsignedByte();
2649  info.allowsContinuation = (myParent.myInput.readUnsignedByte() == 1);
2650 
2651  myParent.myInput.readUnsignedByte();
2652  const int m = myParent.myInput.readInt();
2653  for (int i = 0; i < m; ++i) {
2654  info.continuationLanes.push_back(myParent.myInput.readString());
2655  }
2656 
2657  result.push_back(info);
2658  }
2659  }
2660  return result;
2661 }
2662 
2663 
2664 std::pair<std::string, double>
2665 TraCIAPI::VehicleScope::getLeader(const std::string& vehicleID, double dist) const {
2666  tcpip::Storage content;
2668  content.writeDouble(dist);
2669  myParent.createCommand(libsumo::CMD_GET_VEHICLE_VARIABLE, libsumo::VAR_LEADER, vehicleID, &content);
2670  if (myParent.processGet(libsumo::CMD_GET_VEHICLE_VARIABLE, libsumo::TYPE_COMPOUND)) {
2671  myParent.myInput.readInt(); // components
2672  myParent.myInput.readUnsignedByte();
2673  const std::string leaderID = myParent.myInput.readString();
2674  myParent.myInput.readUnsignedByte();
2675  const double gap = myParent.myInput.readDouble();
2676  return std::make_pair(leaderID, gap);
2677  }
2678  return std::make_pair("", libsumo::INVALID_DOUBLE_VALUE);
2679 }
2680 
2681 
2682 std::pair<int, int>
2683 TraCIAPI::VehicleScope::getLaneChangeState(const std::string& vehicleID, int direction) const {
2684  tcpip::Storage content;
2686  content.writeInt(direction);
2687  myParent.createCommand(libsumo::CMD_GET_VEHICLE_VARIABLE, libsumo::CMD_CHANGELANE, vehicleID, &content);
2688  if (myParent.processGet(libsumo::CMD_GET_VEHICLE_VARIABLE, libsumo::TYPE_COMPOUND)) {
2689  myParent.myInput.readInt(); // components
2690  myParent.myInput.readUnsignedByte();
2691  const int stateWithoutTraCI = myParent.myInput.readInt();
2692  myParent.myInput.readUnsignedByte();
2693  const int state = myParent.myInput.readInt();
2694  return std::make_pair(stateWithoutTraCI, state);
2695  }
2697 }
2698 
2699 
2700 int
2701 TraCIAPI::VehicleScope::getStopState(const std::string& vehicleID) const {
2702  return myParent.getInt(libsumo::CMD_GET_VEHICLE_VARIABLE, libsumo::VAR_STOPSTATE, vehicleID);
2703 }
2704 
2705 int
2706 TraCIAPI::VehicleScope::getRoutingMode(const std::string& vehicleID) const {
2707  return myParent.getInt(libsumo::CMD_GET_VEHICLE_VARIABLE, libsumo::VAR_ROUTING_MODE, vehicleID);
2708 }
2709 
2710 double
2711 TraCIAPI::VehicleScope::getAccel(const std::string& vehicleID) const {
2712  return myParent.getDouble(libsumo::CMD_GET_VEHICLE_VARIABLE, libsumo::VAR_ACCEL, vehicleID);
2713 }
2714 
2715 double
2716 TraCIAPI::VehicleScope::getDecel(const std::string& vehicleID) const {
2717  return myParent.getDouble(libsumo::CMD_GET_VEHICLE_VARIABLE, libsumo::VAR_DECEL, vehicleID);
2718 }
2719 
2720 double
2721 TraCIAPI::VehicleScope::getTau(const std::string& vehicleID) const {
2722  return myParent.getDouble(libsumo::CMD_GET_VEHICLE_VARIABLE, libsumo::VAR_TAU, vehicleID);
2723 }
2724 
2725 double
2726 TraCIAPI::VehicleScope::getImperfection(const std::string& vehicleID) const {
2727  return myParent.getDouble(libsumo::CMD_GET_VEHICLE_VARIABLE, libsumo::VAR_IMPERFECTION, vehicleID);
2728 }
2729 
2730 double
2731 TraCIAPI::VehicleScope::getSpeedFactor(const std::string& vehicleID) const {
2732  return myParent.getDouble(libsumo::CMD_GET_VEHICLE_VARIABLE, libsumo::VAR_SPEED_FACTOR, vehicleID);
2733 }
2734 
2735 double
2736 TraCIAPI::VehicleScope::getSpeedDeviation(const std::string& vehicleID) const {
2737  return myParent.getDouble(libsumo::CMD_GET_VEHICLE_VARIABLE, libsumo::VAR_SPEED_DEVIATION, vehicleID);
2738 }
2739 
2740 std::string
2741 TraCIAPI::VehicleScope::getVehicleClass(const std::string& vehicleID) const {
2742  return myParent.getString(libsumo::CMD_GET_VEHICLE_VARIABLE, libsumo::VAR_VEHICLECLASS, vehicleID);
2743 }
2744 
2745 double
2746 TraCIAPI::VehicleScope::getMinGap(const std::string& vehicleID) const {
2747  return myParent.getDouble(libsumo::CMD_GET_VEHICLE_VARIABLE, libsumo::VAR_MINGAP, vehicleID);
2748 }
2749 
2750 double
2751 TraCIAPI::VehicleScope::getWidth(const std::string& vehicleID) const {
2752  return myParent.getDouble(libsumo::CMD_GET_VEHICLE_VARIABLE, libsumo::VAR_WIDTH, vehicleID);
2753 }
2754 
2755 double
2756 TraCIAPI::VehicleScope::getLength(const std::string& vehicleID) const {
2757  return myParent.getDouble(libsumo::CMD_GET_VEHICLE_VARIABLE, libsumo::VAR_LENGTH, vehicleID);
2758 }
2759 
2760 double
2761 TraCIAPI::VehicleScope::getHeight(const std::string& vehicleID) const {
2762  return myParent.getDouble(libsumo::CMD_GET_VEHICLE_VARIABLE, libsumo::VAR_HEIGHT, vehicleID);
2763 }
2764 
2765 double
2766 TraCIAPI::VehicleScope::getAccumulatedWaitingTime(const std::string& vehicleID) const {
2767  return myParent.getDouble(libsumo::CMD_GET_VEHICLE_VARIABLE, libsumo::VAR_ACCUMULATED_WAITING_TIME, vehicleID);
2768 }
2769 
2770 double
2771 TraCIAPI::VehicleScope::getAllowedSpeed(const std::string& vehicleID) const {
2772  return myParent.getDouble(libsumo::CMD_GET_VEHICLE_VARIABLE, libsumo::VAR_ALLOWED_SPEED, vehicleID);
2773 }
2774 
2775 int
2776 TraCIAPI::VehicleScope::getPersonNumber(const std::string& vehicleID) const {
2777  return myParent.getInt(libsumo::CMD_GET_VEHICLE_VARIABLE, libsumo::VAR_PERSON_NUMBER, vehicleID);
2778 }
2779 
2780 int
2781 TraCIAPI::VehicleScope::getPersonCapacity(const std::string& vehicleID) const {
2782  return myParent.getInt(libsumo::CMD_GET_VEHICLE_VARIABLE, libsumo::VAR_PERSON_CAPACITY, vehicleID);
2783 }
2784 
2785 std::vector<std::string>
2786 TraCIAPI::VehicleScope::getPersonIDList(const std::string& vehicleID) const {
2787  return myParent.getStringVector(libsumo::CMD_GET_VEHICLE_VARIABLE, libsumo::LAST_STEP_PERSON_ID_LIST, vehicleID);
2788 }
2789 
2790 double
2791 TraCIAPI::VehicleScope::getSpeedWithoutTraCI(const std::string& vehicleID) const {
2792  return myParent.getDouble(libsumo::CMD_GET_VEHICLE_VARIABLE, libsumo::VAR_SPEED_WITHOUT_TRACI, vehicleID);
2793 }
2794 
2795 bool
2796 TraCIAPI::VehicleScope::isRouteValid(const std::string& vehicleID) const {
2797  return myParent.getInt(libsumo::CMD_GET_VEHICLE_VARIABLE, libsumo::VAR_ROUTE_VALID, vehicleID) != 0;
2798 }
2799 
2800 double
2801 TraCIAPI::VehicleScope::getMaxSpeedLat(const std::string& vehicleID) const {
2802  return myParent.getDouble(libsumo::CMD_GET_VEHICLE_VARIABLE, libsumo::VAR_MAXSPEED_LAT, vehicleID);
2803 }
2804 
2805 double
2806 TraCIAPI::VehicleScope::getMinGapLat(const std::string& vehicleID) const {
2807  return myParent.getDouble(libsumo::CMD_GET_VEHICLE_VARIABLE, libsumo::VAR_MINGAP_LAT, vehicleID);
2808 }
2809 
2810 std::string
2811 TraCIAPI::VehicleScope::getLateralAlignment(const std::string& vehicleID) const {
2812  return myParent.getString(libsumo::CMD_GET_VEHICLE_VARIABLE, libsumo::VAR_LATALIGNMENT, vehicleID);
2813 }
2814 
2815 void
2816 TraCIAPI::VehicleScope::add(const std::string& vehicleID,
2817  const std::string& routeID,
2818  const std::string& typeID,
2819  std::string depart,
2820  const std::string& departLane,
2821  const std::string& departPos,
2822  const std::string& departSpeed,
2823  const std::string& arrivalLane,
2824  const std::string& arrivalPos,
2825  const std::string& arrivalSpeed,
2826  const std::string& fromTaz,
2827  const std::string& toTaz,
2828  const std::string& line,
2829  int personCapacity,
2830  int personNumber) const {
2831 
2832  if (depart == "-1") {
2833  depart = toString(myParent.simulation.getCurrentTime() / 1000.0);
2834  }
2835  tcpip::Storage content;
2837  content.writeInt(14);
2839  content.writeString(routeID);
2841  content.writeString(typeID);
2843  content.writeString(depart);
2845  content.writeString(departLane);
2847  content.writeString(departPos);
2849  content.writeString(departSpeed);
2850 
2852  content.writeString(arrivalLane);
2854  content.writeString(arrivalPos);
2856  content.writeString(arrivalSpeed);
2857 
2859  content.writeString(fromTaz);
2861  content.writeString(toTaz);
2863  content.writeString(line);
2864 
2866  content.writeInt(personCapacity);
2868  content.writeInt(personNumber);
2869 
2870  myParent.createCommand(libsumo::CMD_SET_VEHICLE_VARIABLE, libsumo::ADD_FULL, vehicleID, &content);
2871  myParent.processSet(libsumo::CMD_SET_VEHICLE_VARIABLE);
2872 }
2873 
2874 
2875 void
2876 TraCIAPI::VehicleScope::remove(const std::string& vehicleID, char reason) const {
2877  tcpip::Storage content;
2879  content.writeUnsignedByte(reason);
2880  myParent.createCommand(libsumo::CMD_SET_VEHICLE_VARIABLE, libsumo::REMOVE, vehicleID, &content);
2881  myParent.processSet(libsumo::CMD_SET_VEHICLE_VARIABLE);
2882 
2883 }
2884 
2885 
2886 void
2887 TraCIAPI::VehicleScope::changeTarget(const std::string& vehicleID, const std::string& edgeID) const {
2888  tcpip::Storage content;
2890  content.writeString(edgeID);
2891  myParent.createCommand(libsumo::CMD_SET_VEHICLE_VARIABLE, libsumo::CMD_CHANGETARGET, vehicleID, &content);
2892  myParent.processSet(libsumo::CMD_SET_VEHICLE_VARIABLE);
2893 }
2894 
2895 
2896 void
2897 TraCIAPI::VehicleScope::changeLane(const std::string& vehicleID, int laneIndex, double duration) const {
2898  tcpip::Storage content;
2900  content.writeInt(2);
2902  content.writeByte(laneIndex);
2904  content.writeDouble(duration);
2905  myParent.createCommand(libsumo::CMD_SET_VEHICLE_VARIABLE, libsumo::CMD_CHANGELANE, vehicleID, &content);
2906  myParent.processSet(libsumo::CMD_SET_VEHICLE_VARIABLE);
2907 }
2908 
2909 
2910 void
2911 TraCIAPI::VehicleScope::changeLaneRelative(const std::string& vehicleID, int laneChange, double duration) const {
2912  tcpip::Storage content;
2914  content.writeInt(3);
2916  content.writeByte(laneChange);
2918  content.writeDouble(duration);
2920  content.writeByte(1);
2921  myParent.createCommand(libsumo::CMD_SET_VEHICLE_VARIABLE, libsumo::CMD_CHANGELANE, vehicleID, &content);
2922  myParent.processSet(libsumo::CMD_SET_VEHICLE_VARIABLE);
2923 }
2924 
2925 
2926 void
2927 TraCIAPI::VehicleScope::changeSublane(const std::string& vehicleID, double latDist) const {
2928  tcpip::Storage content;
2930  content.writeDouble(latDist);
2931  myParent.createCommand(libsumo::CMD_SET_VEHICLE_VARIABLE, libsumo::CMD_CHANGESUBLANE, vehicleID, &content);
2932  myParent.processSet(libsumo::CMD_SET_VEHICLE_VARIABLE);
2933 }
2934 
2935 
2936 void
2937 TraCIAPI::VehicleScope::setRouteID(const std::string& vehicleID, const std::string& routeID) const {
2938  tcpip::Storage content;
2940  content.writeString(routeID);
2941  myParent.createCommand(libsumo::CMD_SET_VEHICLE_VARIABLE, libsumo::VAR_ROUTE_ID, vehicleID, &content);
2942  myParent.processSet(libsumo::CMD_SET_VEHICLE_VARIABLE);
2943 }
2944 
2945 
2946 void
2947 TraCIAPI::VehicleScope::setRoute(const std::string& vehicleID, const std::vector<std::string>& edges) const {
2948  tcpip::Storage content;
2950  content.writeInt((int)edges.size());
2951  for (int i = 0; i < (int)edges.size(); ++i) {
2952  content.writeString(edges[i]);
2953  }
2954  myParent.createCommand(libsumo::CMD_SET_VEHICLE_VARIABLE, libsumo::VAR_ROUTE, vehicleID, &content);
2955  myParent.processSet(libsumo::CMD_SET_VEHICLE_VARIABLE);
2956 }
2957 
2958 
2959 void
2960 TraCIAPI::VehicleScope::rerouteTraveltime(const std::string& vehicleID, bool currentTravelTimes) const {
2961  if (currentTravelTimes) {
2962  // updated edge weights with current network traveltimes (at most once per simulation step)
2963  std::vector<std::string> edges = myParent.edge.getIDList();
2964  for (std::vector<std::string>::iterator it = edges.begin(); it != edges.end(); ++it) {
2965  myParent.edge.adaptTraveltime(*it, myParent.edge.getTraveltime(*it));
2966  }
2967  }
2968 
2969  tcpip::Storage content;
2971  content.writeInt(0);
2972  myParent.createCommand(libsumo::CMD_SET_VEHICLE_VARIABLE, libsumo::CMD_REROUTE_TRAVELTIME, vehicleID, &content);
2973  myParent.processSet(libsumo::CMD_SET_VEHICLE_VARIABLE);
2974 }
2975 
2976 void
2977 TraCIAPI::VehicleScope::moveTo(const std::string& vehicleID, const std::string& laneID, double position) const {
2978  tcpip::Storage content;
2980  content.writeInt(2);
2982  content.writeString(laneID);
2984  content.writeDouble(position);
2985  myParent.createCommand(libsumo::CMD_SET_VEHICLE_VARIABLE, libsumo::VAR_MOVE_TO, vehicleID, &content);
2986  myParent.processSet(libsumo::CMD_SET_VEHICLE_VARIABLE);
2987 }
2988 
2989 void
2990 TraCIAPI::VehicleScope::moveToXY(const std::string& vehicleID, const std::string& edgeID, const int lane, const double x, const double y, const double angle, const int keepRoute) const {
2991  tcpip::Storage content;
2993  content.writeInt(6);
2995  content.writeString(edgeID);
2997  content.writeInt(lane);
2999  content.writeDouble(x);
3001  content.writeDouble(y);
3003  content.writeDouble(angle);
3005  content.writeByte(keepRoute);
3006  myParent.createCommand(libsumo::CMD_SET_VEHICLE_VARIABLE, libsumo::MOVE_TO_XY, vehicleID, &content);
3007  myParent.processSet(libsumo::CMD_SET_VEHICLE_VARIABLE);
3008 }
3009 
3010 
3011 void
3012 TraCIAPI::VehicleScope::slowDown(const std::string& vehicleID, double speed, double duration) const {
3013  tcpip::Storage content;
3015  content.writeInt(2);
3017  content.writeDouble(speed);
3019  content.writeDouble(duration);
3020  myParent.createCommand(libsumo::CMD_SET_VEHICLE_VARIABLE, libsumo::CMD_SLOWDOWN, vehicleID, &content);
3021  myParent.processSet(libsumo::CMD_SET_VEHICLE_VARIABLE);
3022 }
3023 
3024 void
3025 TraCIAPI::VehicleScope::openGap(const std::string& vehicleID, double newTau, double duration, double changeRate, double maxDecel) const {
3026  tcpip::Storage content;
3028  if (maxDecel > 0) {
3029  content.writeInt(4);
3030  } else {
3031  content.writeInt(3);
3032  }
3034  content.writeDouble(newTau);
3036  content.writeDouble(duration);
3038  content.writeDouble(changeRate);
3039  if (maxDecel > 0) {
3041  content.writeDouble(maxDecel);
3042  }
3043  myParent.createCommand(libsumo::CMD_SET_VEHICLE_VARIABLE, libsumo::CMD_OPENGAP, vehicleID, &content);
3044  myParent.processSet(libsumo::CMD_SET_VEHICLE_VARIABLE);
3045 }
3046 
3047 void
3048 TraCIAPI::VehicleScope::setSpeed(const std::string& vehicleID, double speed) const {
3049  tcpip::Storage content;
3051  content.writeDouble(speed);
3052  myParent.createCommand(libsumo::CMD_SET_VEHICLE_VARIABLE, libsumo::VAR_SPEED, vehicleID, &content);
3053  myParent.processSet(libsumo::CMD_SET_VEHICLE_VARIABLE);
3054 }
3055 
3056 void
3057 TraCIAPI::VehicleScope::setSpeedMode(const std::string& vehicleID, int mode) const {
3058  tcpip::Storage content;
3060  content.writeInt(mode);
3061  myParent.createCommand(libsumo::CMD_SET_VEHICLE_VARIABLE, libsumo::VAR_SPEEDSETMODE, vehicleID, &content);
3062  myParent.processSet(libsumo::CMD_SET_VEHICLE_VARIABLE);
3063 }
3064 
3065 void
3066 TraCIAPI::VehicleScope::setStop(const std::string vehicleID, const std::string edgeID, const double endPos, const int laneIndex,
3067  const double duration, const int flags, const double startPos, const double until) const {
3068  tcpip::Storage content;
3070  content.writeInt(7);
3072  content.writeString(edgeID);
3074  content.writeDouble(endPos);
3076  content.writeByte(laneIndex);
3078  content.writeDouble(duration);
3080  content.writeByte(flags);
3082  content.writeDouble(startPos);
3084  content.writeDouble(until);
3085  myParent.createCommand(libsumo::CMD_SET_VEHICLE_VARIABLE, libsumo::CMD_STOP, vehicleID, &content);
3086  myParent.processSet(libsumo::CMD_SET_VEHICLE_VARIABLE);
3087 }
3088 
3089 void
3090 TraCIAPI::VehicleScope::setType(const std::string& vehicleID, const std::string& typeID) const {
3091  tcpip::Storage content;
3093  content.writeString(typeID);
3094  myParent.createCommand(libsumo::CMD_SET_VEHICLE_VARIABLE, libsumo::VAR_TYPE, vehicleID, &content);
3095  myParent.processSet(libsumo::CMD_SET_VEHICLE_VARIABLE);
3096 }
3097 
3098 void
3099 TraCIAPI::VehicleScope::setSpeedFactor(const std::string& vehicleID, double factor) const {
3100  tcpip::Storage content;
3102  content.writeDouble(factor);
3103  myParent.createCommand(libsumo::CMD_SET_VEHICLE_VARIABLE, libsumo::VAR_SPEED_FACTOR, vehicleID, &content);
3104  myParent.processSet(libsumo::CMD_SET_VEHICLE_VARIABLE);
3105 }
3106 
3107 void
3108 TraCIAPI::VehicleScope::setMaxSpeed(const std::string& vehicleID, double speed) const {
3109  tcpip::Storage content;
3111  content.writeDouble(speed);
3112  myParent.createCommand(libsumo::CMD_SET_VEHICLE_VARIABLE, libsumo::VAR_MAXSPEED, vehicleID, &content);
3113  myParent.processSet(libsumo::CMD_SET_VEHICLE_VARIABLE);
3114 }
3115 
3116 void
3117 TraCIAPI::VehicleScope::setColor(const std::string& vehicleID, const libsumo::TraCIColor& c) const {
3118  tcpip::Storage content;
3120  content.writeUnsignedByte(c.r);
3121  content.writeUnsignedByte(c.g);
3122  content.writeUnsignedByte(c.b);
3123  content.writeUnsignedByte(c.a);
3124  myParent.createCommand(libsumo::CMD_SET_VEHICLE_VARIABLE, libsumo::VAR_COLOR, vehicleID, &content);
3125  myParent.processSet(libsumo::CMD_SET_VEHICLE_VARIABLE);
3126 }
3127 
3128 void
3129 TraCIAPI::VehicleScope::setLine(const std::string& vehicleID, const std::string& line) const {
3130  tcpip::Storage content;
3132  content.writeString(line);
3133  myParent.createCommand(libsumo::CMD_SET_VEHICLE_VARIABLE, libsumo::VAR_LINE, vehicleID, &content);
3134  myParent.processSet(libsumo::CMD_SET_VEHICLE_VARIABLE);
3135 }
3136 
3137 void
3138 TraCIAPI::VehicleScope::setVia(const std::string& vehicleID, const std::vector<std::string>& via) const {
3139  tcpip::Storage content;
3141  content.writeInt((int)via.size());
3142  for (int i = 0; i < (int)via.size(); ++i) {
3143  content.writeString(via[i]);
3144  }
3145  myParent.createCommand(libsumo::CMD_SET_VEHICLE_VARIABLE, libsumo::VAR_VIA, vehicleID, &content);
3146  myParent.processSet(libsumo::CMD_SET_VEHICLE_VARIABLE);
3147 }
3148 
3149 void
3150 TraCIAPI::VehicleScope::setSignals(const std::string& vehicleID, int signals) const {
3151  tcpip::Storage content;
3153  content.writeInt(signals);
3154  myParent.createCommand(libsumo::CMD_SET_VEHICLE_VARIABLE, libsumo::VAR_SIGNALS, vehicleID, &content);
3155  myParent.processSet(libsumo::CMD_SET_VEHICLE_VARIABLE);
3156 }
3157 
3158 void
3159 TraCIAPI::VehicleScope::setRoutingMode(const std::string& vehicleID, int routingMode) const {
3160  tcpip::Storage content;
3162  content.writeInt(routingMode);
3163  myParent.createCommand(libsumo::CMD_SET_VEHICLE_VARIABLE, libsumo::VAR_ROUTING_MODE, vehicleID, &content);
3164  myParent.processSet(libsumo::CMD_SET_VEHICLE_VARIABLE);
3165 }
3166 
3167 void
3168 TraCIAPI::VehicleScope::setShapeClass(const std::string& vehicleID, const std::string& clazz) const {
3169  tcpip::Storage content;
3171  content.writeString(clazz);
3172  myParent.createCommand(libsumo::CMD_SET_VEHICLE_VARIABLE, libsumo::VAR_SHAPECLASS, vehicleID, &content);
3173  myParent.processSet(libsumo::CMD_SET_VEHICLE_VARIABLE);
3174 }
3175 
3176 
3177 void
3178 TraCIAPI::VehicleScope::setEmissionClass(const std::string& vehicleID, const std::string& clazz) const {
3179  tcpip::Storage content;
3181  content.writeString(clazz);
3182  myParent.createCommand(libsumo::CMD_SET_VEHICLE_VARIABLE, libsumo::VAR_EMISSIONCLASS, vehicleID, &content);
3183  myParent.processSet(libsumo::CMD_SET_VEHICLE_VARIABLE);
3184 }
3185 
3186 void
3188  bool noOpposite, double downstreamDist, double upstreamDist) const {
3189  addSubscriptionFilterByteList(libsumo::FILTER_TYPE_LANES, lanes);
3190  if (noOpposite) {
3191  addSubscriptionFilterNoOpposite();
3192  }
3193  if (downstreamDist >= 0) {
3194  addSubscriptionFilterDownstreamDistance(downstreamDist);
3195  }
3196  if (upstreamDist >= 0) {
3197  addSubscriptionFilterUpstreamDistance(upstreamDist);
3198  }
3199 }
3200 
3201 
3202 void
3204  addSubscriptionFilterEmpty(libsumo::FILTER_TYPE_NOOPPOSITE);
3205 }
3206 
3207 void
3209  addSubscriptionFilterFloat(libsumo::FILTER_TYPE_DOWNSTREAM_DIST, dist);
3210 }
3211 
3212 void
3214  addSubscriptionFilterFloat(libsumo::FILTER_TYPE_UPSTREAM_DIST, dist);
3215 }
3216 
3217 
3218 void
3219 TraCIAPI::VehicleScope::addSubscriptionFilterCFManeuver(double downstreamDist, double upstreamDist) const {
3220  addSubscriptionFilterLeadFollow(std::vector<int>({0}));
3221  if (downstreamDist >= 0) {
3222  addSubscriptionFilterDownstreamDistance(downstreamDist);
3223  }
3224  if (upstreamDist >= 0) {
3225  addSubscriptionFilterUpstreamDistance(upstreamDist);
3226  }
3227 }
3228 
3229 void
3230 TraCIAPI::VehicleScope::addSubscriptionFilterLCManeuver(int direction, bool noOpposite, double downstreamDist, double upstreamDist) const {
3231  if (abs(direction) != 1) {
3232  std::cerr << "Ignoring lane change subscription filter with non-neighboring lane offset direction " << direction << "\n";
3233  return;
3234  }
3235  addSubscriptionFilterLeadFollow(std::vector<int>({0, direction}));
3236  if (noOpposite) {
3237  addSubscriptionFilterNoOpposite();
3238  }
3239  if (downstreamDist >= 0) {
3240  addSubscriptionFilterDownstreamDistance(downstreamDist);
3241  }
3242  if (upstreamDist >= 0) {
3243  addSubscriptionFilterUpstreamDistance(upstreamDist);
3244  }
3245 }
3246 
3247 void
3248 TraCIAPI::VehicleScope::addSubscriptionFilterLeadFollow(const std::vector<int>& lanes) const {
3249  addSubscriptionFilterEmpty(libsumo::FILTER_TYPE_LEAD_FOLLOW);
3250  addSubscriptionFilterByteList(libsumo::FILTER_TYPE_LANES, lanes);
3251 }
3252 
3253 void
3254 TraCIAPI::VehicleScope::addSubscriptionFilterTurn(double downstreamDist, double upstreamDist) const {
3255  addSubscriptionFilterEmpty(libsumo::FILTER_TYPE_TURN);
3256  if (downstreamDist >= 0) {
3257  addSubscriptionFilterDownstreamDistance(downstreamDist);
3258  }
3259  if (upstreamDist >= 0) {
3260  addSubscriptionFilterUpstreamDistance(upstreamDist);
3261  }
3262 }
3263 
3264 
3265 void
3266 TraCIAPI::VehicleScope::addSubscriptionFilterVClass(const std::vector<std::string>& vClasses) const {
3267  addSubscriptionFilterStringList(libsumo::FILTER_TYPE_VCLASS, vClasses);
3268 }
3269 
3270 
3271 void
3272 TraCIAPI::VehicleScope::addSubscriptionFilterVType(const std::vector<std::string>& vTypes) const {
3273  addSubscriptionFilterStringList(libsumo::FILTER_TYPE_VTYPE, vTypes);
3274 }
3275 
3276 
3277 void
3279  addSubscriptionFilterFloat(libsumo::FILTER_TYPE_FIELD_OF_VISION, angle);
3280 }
3281 
3282 void
3284  myParent.createFilterCommand(libsumo::CMD_ADD_SUBSCRIPTION_FILTER, filterType);
3285  myParent.processSet(libsumo::CMD_ADD_SUBSCRIPTION_FILTER);
3286 }
3287 
3288 void
3289 TraCIAPI::VehicleScope::addSubscriptionFilterFloat(int filterType, double val) const {
3290  tcpip::Storage content;
3292  content.writeDouble(val);
3293  myParent.createFilterCommand(libsumo::CMD_ADD_SUBSCRIPTION_FILTER, filterType, &content);
3294  myParent.processSet(libsumo::CMD_ADD_SUBSCRIPTION_FILTER);
3295 }
3296 
3297 
3298 void
3299 TraCIAPI::VehicleScope::addSubscriptionFilterStringList(int filterType, const std::vector<std::string>& vals) const {
3300  tcpip::Storage content;
3302  content.writeStringList(vals);
3303  myParent.createFilterCommand(libsumo::CMD_ADD_SUBSCRIPTION_FILTER, filterType, &content);
3304  myParent.processSet(libsumo::CMD_ADD_SUBSCRIPTION_FILTER);
3305 }
3306 
3307 
3308 void
3309 TraCIAPI::VehicleScope::addSubscriptionFilterByteList(int filterType, const std::vector<int>& vals) const {
3310  tcpip::Storage content;
3311  content.writeUnsignedByte((int)vals.size());
3312  for (int i : vals) {
3313  content.writeByte(i);
3314  }
3315  myParent.createFilterCommand(libsumo::CMD_ADD_SUBSCRIPTION_FILTER, filterType, &content);
3316  myParent.processSet(libsumo::CMD_ADD_SUBSCRIPTION_FILTER);
3317 }
3318 
3319 
3320 // ---------------------------------------------------------------------------
3321 // // TraCIAPI::PersonScope-methods
3322 // ---------------------------------------------------------------------------
3323 
3324 std::vector<std::string>
3326  return myParent.getStringVector(libsumo::CMD_GET_PERSON_VARIABLE, libsumo::TRACI_ID_LIST, "");
3327 }
3328 
3329 int
3331  return myParent.getInt(libsumo::CMD_GET_PERSON_VARIABLE, libsumo::ID_COUNT, "");
3332 }
3333 
3334 double
3335 TraCIAPI::PersonScope::getSpeed(const std::string& personID) const {
3336  return myParent.getDouble(libsumo::CMD_GET_PERSON_VARIABLE, libsumo::VAR_SPEED, personID);
3337 }
3338 
3340 TraCIAPI::PersonScope::getPosition(const std::string& personID) const {
3341  return myParent.getPosition(libsumo::CMD_GET_PERSON_VARIABLE, libsumo::VAR_POSITION, personID);
3342 }
3343 
3345 TraCIAPI::PersonScope::getPosition3D(const std::string& personID) const {
3346  return myParent.getPosition3D(libsumo::CMD_GET_PERSON_VARIABLE, libsumo::VAR_POSITION3D, personID);
3347 }
3348 
3349 double
3350 TraCIAPI::PersonScope::getAngle(const std::string& personID) const {
3351  return myParent.getDouble(libsumo::CMD_GET_PERSON_VARIABLE, libsumo::VAR_ANGLE, personID);
3352 }
3353 
3354 double
3355 TraCIAPI::PersonScope::getSlope(const std::string& personID) const {
3356  return myParent.getDouble(libsumo::CMD_GET_PERSON_VARIABLE, libsumo::VAR_SLOPE, personID);
3357 }
3358 
3359 double
3360 TraCIAPI::PersonScope::getLanePosition(const std::string& personID) const {
3361  return myParent.getDouble(libsumo::CMD_GET_PERSON_VARIABLE, libsumo::VAR_LANEPOSITION, personID);
3362 }
3363 
3365 TraCIAPI::PersonScope::getColor(const std::string& personID) const {
3366  return myParent.getColor(libsumo::CMD_GET_PERSON_VARIABLE, libsumo::VAR_COLOR, personID);
3367 }
3368 
3369 double
3370 TraCIAPI::PersonScope::getLength(const std::string& personID) const {
3371  return myParent.getDouble(libsumo::CMD_GET_PERSON_VARIABLE, libsumo::VAR_LENGTH, personID);
3372 }
3373 
3374 std::string
3375 TraCIAPI::PersonScope::getRoadID(const std::string& personID) const {
3376  return myParent.getString(libsumo::CMD_GET_PERSON_VARIABLE, libsumo::VAR_ROAD_ID, personID);
3377 }
3378 
3379 std::string
3380 TraCIAPI::PersonScope::getTypeID(const std::string& personID) const {
3381  return myParent.getString(libsumo::CMD_GET_PERSON_VARIABLE, libsumo::VAR_TYPE, personID);
3382 }
3383 
3384 double
3385 TraCIAPI::PersonScope::getWaitingTime(const std::string& personID) const {
3386  return myParent.getDouble(libsumo::CMD_GET_PERSON_VARIABLE, libsumo::VAR_WAITING_TIME, personID);
3387 }
3388 
3389 std::string
3390 TraCIAPI::PersonScope::getNextEdge(const std::string& personID) const {
3391  return myParent.getString(libsumo::CMD_GET_PERSON_VARIABLE, libsumo::VAR_NEXT_EDGE, personID);
3392 }
3393 
3394 
3395 std::string
3396 TraCIAPI::PersonScope::getVehicle(const std::string& personID) const {
3397  return myParent.getString(libsumo::CMD_GET_PERSON_VARIABLE, libsumo::VAR_VEHICLE, personID);
3398 }
3399 
3400 int
3401 TraCIAPI::PersonScope::getRemainingStages(const std::string& personID) const {
3402  return myParent.getInt(libsumo::CMD_GET_PERSON_VARIABLE, libsumo::VAR_STAGES_REMAINING, personID);
3403 }
3404 
3406 TraCIAPI::PersonScope::getStage(const std::string& personID, int nextStageIndex) const {
3407  tcpip::Storage content;
3409  content.writeInt(nextStageIndex);
3410  return myParent.getTraCIStage(libsumo::CMD_GET_PERSON_VARIABLE, libsumo::VAR_STAGE, personID, &content);
3411 }
3412 
3413 std::vector<std::string>
3414 TraCIAPI::PersonScope::getEdges(const std::string& personID, int nextStageIndex) const {
3415  tcpip::Storage content;
3417  content.writeInt(nextStageIndex);
3418  return myParent.getStringVector(libsumo::CMD_GET_PERSON_VARIABLE, libsumo::VAR_EDGES, personID, &content);
3419 }
3420 
3421 void
3422 TraCIAPI::PersonScope::removeStages(const std::string& personID) const {
3423  // remove all stages after the current and then abort the current stage
3424  while (getRemainingStages(personID) > 1) {
3425  removeStage(personID, 1);
3426  }
3427  removeStage(personID, 0);
3428 }
3429 
3430 
3431 void
3432 TraCIAPI::PersonScope::rerouteTraveltime(const std::string& personID) const {
3433  tcpip::Storage content;
3435  content.writeInt(0);
3436  myParent.createCommand(libsumo::CMD_SET_PERSON_VARIABLE, libsumo::CMD_REROUTE_TRAVELTIME, personID, &content);
3437  myParent.processSet(libsumo::CMD_SET_PERSON_VARIABLE);
3438 }
3439 
3440 
3441 void
3442 TraCIAPI::PersonScope::add(const std::string& personID, const std::string& edgeID, double pos, double depart, const std::string typeID) {
3443  tcpip::Storage content;
3445  content.writeInt(4);
3447  content.writeString(typeID);
3449  content.writeString(edgeID);
3451  content.writeDouble(depart);
3453  content.writeDouble(pos);
3454  myParent.createCommand(libsumo::CMD_SET_PERSON_VARIABLE, libsumo::ADD, personID, &content);
3455  myParent.processSet(libsumo::CMD_SET_PERSON_VARIABLE);
3456 }
3457 
3458 void
3459 TraCIAPI::PersonScope::appendStage(const std::string& personID, const libsumo::TraCIStage& stage) {
3460  tcpip::Storage content;
3462  content.writeInt(13);
3464  content.writeInt(stage.type);
3466  content.writeString(stage.vType);
3468  content.writeString(stage.line);
3470  content.writeString(stage.destStop);
3472  content.writeStringList(stage.edges);
3474  content.writeDouble(stage.travelTime);
3476  content.writeDouble(stage.cost);
3478  content.writeDouble(stage.length);
3480  content.writeString(stage.intended);
3482  content.writeDouble(stage.depart);
3484  content.writeDouble(stage.departPos);
3486  content.writeDouble(stage.arrivalPos);
3488  content.writeString(stage.description);
3489  myParent.createCommand(libsumo::CMD_SET_PERSON_VARIABLE, libsumo::APPEND_STAGE, personID, &content);
3490  myParent.processSet(libsumo::CMD_SET_PERSON_VARIABLE);
3491 }
3492 
3493 
3494 void
3495 TraCIAPI::PersonScope::appendWaitingStage(const std::string& personID, double duration, const std::string& description, const std::string& stopID) {
3496  tcpip::Storage content;
3498  content.writeInt(4);
3502  content.writeDouble(duration);
3504  content.writeString(description);
3506  content.writeString(stopID);
3507  myParent.createCommand(libsumo::CMD_SET_PERSON_VARIABLE, libsumo::APPEND_STAGE, personID, &content);
3508  myParent.processSet(libsumo::CMD_SET_PERSON_VARIABLE);
3509 }
3510 
3511 void
3512 TraCIAPI::PersonScope::appendWalkingStage(const std::string& personID, const std::vector<std::string>& edges, double arrivalPos, double duration, double speed, const std::string& stopID) {
3513  tcpip::Storage content;
3515  content.writeInt(6);
3519  content.writeStringList(edges);
3521  content.writeDouble(arrivalPos);
3523  content.writeDouble(duration);
3525  content.writeDouble(speed);
3527  content.writeString(stopID);
3528  myParent.createCommand(libsumo::CMD_SET_PERSON_VARIABLE, libsumo::APPEND_STAGE, personID, &content);
3529  myParent.processSet(libsumo::CMD_SET_PERSON_VARIABLE);
3530 }
3531 
3532 void
3533 TraCIAPI::PersonScope::appendDrivingStage(const std::string& personID, const std::string& toEdge, const std::string& lines, const std::string& stopID) {
3534  tcpip::Storage content;
3536  content.writeInt(4);
3540  content.writeString(toEdge);
3542  content.writeString(lines);
3544  content.writeString(stopID);
3545  myParent.createCommand(libsumo::CMD_SET_PERSON_VARIABLE, libsumo::APPEND_STAGE, personID, &content);
3546  myParent.processSet(libsumo::CMD_SET_PERSON_VARIABLE);
3547 }
3548 
3549 void
3550 TraCIAPI::PersonScope::removeStage(const std::string& personID, int nextStageIndex) const {
3551  tcpip::Storage content;
3553  content.writeInt(nextStageIndex);
3554  myParent.createCommand(libsumo::CMD_SET_PERSON_VARIABLE, libsumo::REMOVE_STAGE, personID, &content);
3555  myParent.processSet(libsumo::CMD_SET_PERSON_VARIABLE);
3556 }
3557 
3558 
3559 void
3560 TraCIAPI::PersonScope::setSpeed(const std::string& personID, double speed) const {
3561  tcpip::Storage content;
3563  content.writeDouble(speed);
3564  myParent.createCommand(libsumo::CMD_SET_PERSON_VARIABLE, libsumo::VAR_SPEED, personID, &content);
3565  myParent.processSet(libsumo::CMD_SET_PERSON_VARIABLE);
3566 }
3567 
3568 
3569 void
3570 TraCIAPI::PersonScope::setType(const std::string& personID, const std::string& typeID) const {
3571  tcpip::Storage content;
3573  content.writeString(typeID);
3574  myParent.createCommand(libsumo::CMD_SET_PERSON_VARIABLE, libsumo::VAR_TYPE, personID, &content);
3575  myParent.processSet(libsumo::CMD_SET_PERSON_VARIABLE);
3576 }
3577 
3578 void
3579 TraCIAPI::PersonScope::setLength(const std::string& personID, double length) const {
3580  tcpip::Storage content;
3582  content.writeDouble(length);
3583  myParent.createCommand(libsumo::CMD_SET_PERSON_VARIABLE, libsumo::VAR_LENGTH, personID, &content);
3584  myParent.processSet(libsumo::CMD_SET_PERSON_VARIABLE);
3585 }
3586 
3587 
3588 void
3589 TraCIAPI::PersonScope::setWidth(const std::string& personID, double width) const {
3590  tcpip::Storage content;
3592  content.writeDouble(width);
3593  myParent.createCommand(libsumo::CMD_SET_PERSON_VARIABLE, libsumo::VAR_WIDTH, personID, &content);
3594  myParent.processSet(libsumo::CMD_SET_PERSON_VARIABLE);
3595 }
3596 
3597 void
3598 TraCIAPI::PersonScope::setHeight(const std::string& personID, double height) const {
3599  tcpip::Storage content;
3601  content.writeDouble(height);
3602  myParent.createCommand(libsumo::CMD_SET_PERSON_VARIABLE, libsumo::VAR_HEIGHT, personID, &content);
3603  myParent.processSet(libsumo::CMD_SET_PERSON_VARIABLE);
3604 }
3605 
3606 void
3607 TraCIAPI::PersonScope::setMinGap(const std::string& personID, double minGap) const {
3608  tcpip::Storage content;
3610  content.writeDouble(minGap);
3611  myParent.createCommand(libsumo::CMD_SET_PERSON_VARIABLE, libsumo::VAR_MINGAP, personID, &content);
3612  myParent.processSet(libsumo::CMD_SET_PERSON_VARIABLE);
3613 }
3614 
3615 
3616 void
3617 TraCIAPI::PersonScope::setColor(const std::string& personID, const libsumo::TraCIColor& c) const {
3618  tcpip::Storage content;
3620  content.writeUnsignedByte(c.r);
3621  content.writeUnsignedByte(c.g);
3622  content.writeUnsignedByte(c.b);
3623  content.writeUnsignedByte(c.a);
3624  myParent.createCommand(libsumo::CMD_SET_PERSON_VARIABLE, libsumo::VAR_COLOR, personID, &content);
3625  myParent.processSet(libsumo::CMD_SET_PERSON_VARIABLE);
3626 }
3627 
3628 
3629 std::string
3630 TraCIAPI::TraCIScopeWrapper::getParameter(const std::string& objectID, const std::string& key) const {
3631  tcpip::Storage content;
3633  content.writeString(key);
3634  return myParent.getString(myCmdGetID, libsumo::VAR_PARAMETER, objectID, &content);
3635 }
3636 
3637 
3638 void
3639 TraCIAPI::TraCIScopeWrapper::setParameter(const std::string& objectID, const std::string& key, const std::string& value) const {
3640  tcpip::Storage content;
3642  content.writeInt(2);
3644  content.writeString(key);
3646  content.writeString(value);
3647  myParent.createCommand(myCmdSetID, libsumo::VAR_PARAMETER, objectID, &content);
3648  myParent.processSet(myCmdSetID);
3649 }
3650 
3651 
3652 void
3653 TraCIAPI::TraCIScopeWrapper::subscribe(const std::string& objID, const std::vector<int>& vars, double beginTime, double endTime) const {
3654  myParent.send_commandSubscribeObjectVariable(mySubscribeID, objID, beginTime, endTime, vars);
3655  tcpip::Storage inMsg;
3656  myParent.check_resultState(inMsg, mySubscribeID);
3657  if (vars.size() > 0) {
3658  myParent.check_commandGetResult(inMsg, mySubscribeID);
3659  myParent.readVariableSubscription(mySubscribeID + 0x10, inMsg);
3660  }
3661 }
3662 
3663 
3664 void
3665 TraCIAPI::TraCIScopeWrapper::subscribeContext(const std::string& objID, int domain, double range, const std::vector<int>& vars, double beginTime, double endTime) const {
3666  myParent.send_commandSubscribeObjectContext(myContextSubscribeID, objID, beginTime, endTime, domain, range, vars);
3667  tcpip::Storage inMsg;
3668  myParent.check_resultState(inMsg, myContextSubscribeID);
3669  myParent.check_commandGetResult(inMsg, myContextSubscribeID);
3670  myParent.readContextSubscription(myContextSubscribeID + 0x60, inMsg);
3671 }
3672 
3673 
3676  return mySubscriptionResults;
3677 }
3678 
3679 
3682  if (mySubscriptionResults.find(objID) != mySubscriptionResults.end()) {
3683  return mySubscriptionResults.find(objID)->second;
3684  } else {
3685  return libsumo::TraCIResults();
3686  }
3687 }
3688 
3689 
3692  return myContextSubscriptionResults;
3693 }
3694 
3695 
3698  if (myContextSubscriptionResults.find(objID) != myContextSubscriptionResults.end()) {
3699  return myContextSubscriptionResults.find(objID)->second;
3700  } else {
3702  }
3703 }
3704 
3705 
3706 void
3708  mySubscriptionResults.clear();
3709  myContextSubscriptionResults.clear();
3710 }
3711 
3712 
3715  return mySubscriptionResults;
3716 }
3717 
3718 
3721  return myContextSubscriptionResults[objID];
3722 }
3723 
3724 
3725 /****************************************************************************/
TraCIAPI::EdgeScope::getCO2Emission
double getCO2Emission(const std::string &edgeID) const
Definition: TraCIAPI.cpp:689
libsumo::CMD_GET_TL_VARIABLE
TRACI_CONST int CMD_GET_TL_VARIABLE
Definition: TraCIConstants.h:119
TraCIAPI::VehicleScope::getLeader
std::pair< std::string, double > getLeader(const std::string &vehicleID, double dist) const
Definition: TraCIAPI.cpp:2665
TraCIAPI::PersonScope::setLength
void setLength(const std::string &personID, double length) const
Definition: TraCIAPI.cpp:3579
TraCIAPI::TrafficLightScope::getProgram
std::string getProgram(const std::string &tlsID) const
Definition: TraCIAPI.cpp:1975
libsumo::VAR_LANE_ID
TRACI_CONST int VAR_LANE_ID
Definition: TraCIConstants.h:678
TraCIAPI::POIScope::getHeight
double getHeight(const std::string &poiID) const
Definition: TraCIAPI.cpp:1348
libsumo::FILTER_TYPE_VCLASS
TRACI_CONST int FILTER_TYPE_VCLASS
Definition: TraCIConstants.h:486
TraCIAPI::VehicleScope::getAllowedSpeed
double getAllowedSpeed(const std::string &vehicleID) const
Definition: TraCIAPI.cpp:2771
libsumo::VAR_VIEW_SCHEMA
TRACI_CONST int VAR_VIEW_SCHEMA
Definition: TraCIConstants.h:1006
TraCIAPI::VehicleScope::addSubscriptionFilterNoOpposite
void addSubscriptionFilterNoOpposite() const
Definition: TraCIAPI.cpp:3203
libsumo::RTYPE_OK
TRACI_CONST int RTYPE_OK
Definition: TraCIConstants.h:352
TraCIAPI::EdgeScope::getFuelConsumption
double getFuelConsumption(const std::string &edgeID) const
Definition: TraCIAPI.cpp:715
TraCIAPI::PersonScope::getIDCount
int getIDCount() const
Definition: TraCIAPI.cpp:3330
libsumo::TL_PHASE_INDEX
TRACI_CONST int TL_PHASE_INDEX
Definition: TraCIConstants.h:552
TraCIAPI::POIScope::getIDCount
int getIDCount() const
Definition: TraCIAPI.cpp:1323
libsumo::VAR_SPEEDSETMODE
TRACI_CONST int VAR_SPEEDSETMODE
Definition: TraCIConstants.h:744
libsumo::VAR_HEIGHT
TRACI_CONST int VAR_HEIGHT
Definition: TraCIConstants.h:772
TraCIAPI::SimulationScope::getArrivedNumber
int getArrivedNumber() const
Definition: TraCIAPI.cpp:1655
TraCIAPI::POIScope::add
void add(const std::string &poiID, double x, double y, const libsumo::TraCIColor &c, const std::string &type, int layer, const std::string &imgFile, double width, double height, double angle) const
Definition: TraCIAPI.cpp:1438
tcpip::Storage::readDouble
virtual double readDouble()
TraCIAPI::VehicleTypeScope::getHeight
double getHeight(const std::string &typeID) const
Definition: TraCIAPI.cpp:2204
libsumo::LAST_STEP_VEHICLE_HALTING_NUMBER
TRACI_CONST int LAST_STEP_VEHICLE_HALTING_NUMBER
Definition: TraCIConstants.h:525
TraCIAPI::TrafficLightScope::getIDList
std::vector< std::string > getIDList() const
Definition: TraCIAPI.cpp:1874
TraCIAPI::VehicleScope::getPosition
libsumo::TraCIPosition getPosition(const std::string &vehicleID) const
Definition: TraCIAPI.cpp:2444
libsumo::CMD_GET_POLYGON_VARIABLE
TRACI_CONST int CMD_GET_POLYGON_VARIABLE
Definition: TraCIConstants.h:209
TraCIAPI::VehicleScope::getRoute
std::vector< std::string > getRoute(const std::string &vehicleID) const
Definition: TraCIAPI.cpp:2490
TraCIAPI::VehicleScope::getSpeedWithoutTraCI
double getSpeedWithoutTraCI(const std::string &vehicleID) const
Definition: TraCIAPI.cpp:2791
TraCIAPI::VehicleScope::changeLane
void changeLane(const std::string &vehicleID, int laneIndex, double duration) const
Definition: TraCIAPI.cpp:2897
TraCIAPI::VehicleScope::changeLaneRelative
void changeLaneRelative(const std::string &vehicleID, int laneChange, double duration) const
Definition: TraCIAPI.cpp:2911
libsumo::VAR_LOADED_VEHICLES_NUMBER
TRACI_CONST int VAR_LOADED_VEHICLES_NUMBER
Definition: TraCIConstants.h:852
TraCIAPI::PersonScope::setType
void setType(const std::string &personID, const std::string &typeID) const
Definition: TraCIAPI.cpp:3570
TraCIAPI::VehicleScope::changeTarget
void changeTarget(const std::string &vehicleID, const std::string &edgeID) const
Definition: TraCIAPI.cpp:2887
libsumo::CMD_SET_GUI_VARIABLE
TRACI_CONST int CMD_SET_GUI_VARIABLE
Definition: TraCIConstants.h:273
libsumo::STAGE_WAITING
TRACI_CONST int STAGE_WAITING
Definition: TraCIConstants.h:398
TraCIAPI::MeMeScope::getLastStepMeanSpeed
double getLastStepMeanSpeed(const std::string &detID) const
Definition: TraCIAPI.cpp:1298
TraCIAPI::VehicleScope::setMaxSpeed
void setMaxSpeed(const std::string &vehicleID, double speed) const
Definition: TraCIAPI.cpp:3108
TraCIAPI::VehicleScope::getPersonNumber
int getPersonNumber(const std::string &vehicleID) const
Definition: TraCIAPI.cpp:2776
TraCIAPI::GUIScope::getSchema
std::string getSchema(const std::string &viewID=DEFAULT_VIEW) const
Definition: TraCIAPI.cpp:845
TraCIAPI::VehicleScope::getRoadID
std::string getRoadID(const std::string &vehicleID) const
Definition: TraCIAPI.cpp:2459
libsumo::TYPE_COLOR
TRACI_CONST int TYPE_COLOR
Definition: TraCIConstants.h:345
libsumo::VAR_ROUTE_INDEX
TRACI_CONST int VAR_ROUTE_INDEX
Definition: TraCIConstants.h:822
TraCIAPI::VehicleScope::getPosition3D
libsumo::TraCIPosition getPosition3D(const std::string &vehicleID) const
Definition: TraCIAPI.cpp:2449
TraCIAPI::VehicleScope::moveToXY
void moveToXY(const std::string &vehicleID, const std::string &edgeID, const int lane, const double x, const double y, const double angle, const int keepRoute) const
Definition: TraCIAPI.cpp:2990
libsumo::TL_CURRENT_PHASE
TRACI_CONST int TL_CURRENT_PHASE
Definition: TraCIConstants.h:567
TraCIAPI::VehicleScope::addSubscriptionFilterCFManeuver
void addSubscriptionFilterCFManeuver(double downstreamDist=-1, double upstreamDist=-1) const
Definition: TraCIAPI.cpp:3219
TraCIAPI::LaneScope::getNOxEmission
double getNOxEmission(const std::string &laneID) const
Definition: TraCIAPI.cpp:1153
TraCIAPI::VehicleTypeScope::getMinGapLat
double getMinGapLat(const std::string &typeID) const
Definition: TraCIAPI.cpp:2179
TraCIAPI::PersonScope::getAngle
double getAngle(const std::string &personID) const
Definition: TraCIAPI.cpp:3350
TraCIAPI::VehicleTypeScope::getMaxSpeedLat
double getMaxSpeedLat(const std::string &typeID) const
Definition: TraCIAPI.cpp:2184
TraCIAPI::lane
LaneScope lane
Scope for interaction with lanes.
Definition: TraCIAPI.h:942
TraCIAPI::EdgeScope::getNOxEmission
double getNOxEmission(const std::string &edgeID) const
Definition: TraCIAPI.cpp:710
TraCIAPI::InductionLoopScope::getIDList
std::vector< std::string > getIDList() const
Definition: TraCIAPI.cpp:925
tcpip::Socket
Definition: socket.h:59
TraCIAPI::LaneScope::getInternalFoes
std::vector< std::string > getInternalFoes(const std::string &laneID) const
Definition: TraCIAPI.cpp:1225
TraCIAPI::readContextSubscription
void readContextSubscription(int cmdId, tcpip::Storage &inMsg)
Definition: TraCIAPI.cpp:605
libsumo::TL_CONTROLLED_LINKS
TRACI_CONST int TL_CONTROLLED_LINKS
Definition: TraCIConstants.h:564
TraCIAPI::close
void close()
ends the simulation and closes the connection
Definition: TraCIAPI.cpp:102
TraCIAPI::LaneScope::getHCEmission
double getHCEmission(const std::string &laneID) const
Definition: TraCIAPI.cpp:1143
libsumo::VAR_EMISSIONCLASS
TRACI_CONST int VAR_EMISSIONCLASS
Definition: TraCIConstants.h:657
libsumo::INVALID_DOUBLE_VALUE
TRACI_CONST double INVALID_DOUBLE_VALUE
Definition: TraCIConstants.h:362
TraCIAPI::JunctionScope::getIDCount
int getIDCount() const
Definition: TraCIAPI.cpp:1013
libsumo::VAR_POSITION
TRACI_CONST int VAR_POSITION
Definition: TraCIConstants.h:618
TraCIAPI::processSet
bool processSet(int command)
Definition: TraCIAPI.cpp:342
TraCIAPI::LaneScope::getFoes
std::vector< std::string > getFoes(const std::string &laneID, const std::string &toLaneID) const
Definition: TraCIAPI.cpp:1209
TraCIAPI::VehicleTypeScope::getTau
double getTau(const std::string &typeID) const
Definition: TraCIAPI.cpp:2154
libsumo::VAR_FUELCONSUMPTION
TRACI_CONST int VAR_FUELCONSUMPTION
Definition: TraCIConstants.h:799
TraCIAPI::LaneScope::getLastStepLength
double getLastStepLength(const std::string &laneID) const
Definition: TraCIAPI.cpp:1183
TraCIAPI::POIScope::getPosition
libsumo::TraCIPosition getPosition(const std::string &poiID) const
Definition: TraCIAPI.cpp:1333
TraCIAPI::PersonScope::getIDList
std::vector< std::string > getIDList() const
Definition: TraCIAPI.cpp:3325
libsumo::VAR_MINGAP
TRACI_CONST int VAR_MINGAP
Definition: TraCIConstants.h:663
libsumo::POSITION_3D
TRACI_CONST int POSITION_3D
Definition: TraCIConstants.h:318
libsumo::VAR_NAME
TRACI_CONST int VAR_NAME
Definition: TraCIConstants.h:546
TraCIAPI::POIScope::getType
std::string getType(const std::string &poiID) const
Definition: TraCIAPI.cpp:1328
TraCIAPI::VehicleScope::moveTo
void moveTo(const std::string &vehicleID, const std::string &laneID, double position) const
Definition: TraCIAPI.cpp:2977
libsumo::TL_PROGRAM
TRACI_CONST int TL_PROGRAM
Definition: TraCIConstants.h:555
libsumo::VAR_STAGES_REMAINING
TRACI_CONST int VAR_STAGES_REMAINING
Definition: TraCIConstants.h:985
libsumo::VAR_TELEPORT_ENDING_VEHICLES_NUMBER
TRACI_CONST int VAR_TELEPORT_ENDING_VEHICLES_NUMBER
Definition: TraCIConstants.h:870
TraCIAPI::EdgeScope::getNoiseEmission
double getNoiseEmission(const std::string &edgeID) const
Definition: TraCIAPI.cpp:720
libsumo::VAR_SPEED_WITHOUT_TRACI
TRACI_CONST int VAR_SPEED_WITHOUT_TRACI
Definition: TraCIConstants.h:738
libsumo::VAR_ROAD_ID
TRACI_CONST int VAR_ROAD_ID
Definition: TraCIConstants.h:675
libsumo::TraCIResults
std::map< int, std::shared_ptr< TraCIResult > > TraCIResults
{variable->value}
Definition: TraCIDefs.h:201
libsumo::TraCIPosition
A 3D-position.
Definition: TraCIDefs.h:109
TraCIAPI::PersonScope::getPosition
libsumo::TraCIPosition getPosition(const std::string &personID) const
Definition: TraCIAPI.cpp:3340
TraCIAPI::VehicleScope::setSpeedFactor
void setSpeedFactor(const std::string &vehicleID, double factor) const
Definition: TraCIAPI.cpp:3099
libsumo::VAR_MAXSPEED
TRACI_CONST int VAR_MAXSPEED
Definition: TraCIConstants.h:615
tcpip::Socket::close
void close()
Definition: socket.cpp:387
libsumo::TraCIPosition::x
double x
Definition: TraCIDefs.h:115
TraCIAPI::TraCIScopeWrapper::getContextSubscriptionResults
const libsumo::SubscriptionResults getContextSubscriptionResults(const std::string &objID) const
Definition: TraCIAPI.cpp:3697
TraCIAPI::VehicleScope::setRoutingMode
void setRoutingMode(const std::string &vehicleID, int routingMode) const
Definition: TraCIAPI.cpp:3159
libsumo::CMD_CLOSE
TRACI_CONST int CMD_CLOSE
Definition: TraCIConstants.h:82
TraCIAPI::MeMeScope::getLastStepVehicleNumber
int getLastStepVehicleNumber(const std::string &detID) const
Definition: TraCIAPI.cpp:1293
libsumo::TraCILogic::type
int type
Definition: TraCIDefs.h:246
tcpip::Storage::writeUnsignedByte
virtual void writeUnsignedByte(int)
TraCIAPI::VehicleScope::getLength
double getLength(const std::string &vehicleID) const
Definition: TraCIAPI.cpp:2756
TraCIAPI::junction
JunctionScope junction
Scope for interaction with junctions.
Definition: TraCIAPI.h:940
TraCIAPI::POIScope::setAngle
void setAngle(const std::string &poiID, double angle) const
Definition: TraCIAPI.cpp:1418
libsumo::TL_COMPLETE_PROGRAM_RYG
TRACI_CONST int TL_COMPLETE_PROGRAM_RYG
Definition: TraCIConstants.h:579
TraCIAPI::send_commandSetOrder
void send_commandSetOrder(int order) const
Sends a SetOrder command.
Definition: TraCIAPI.cpp:147
TraCIAPI::VehicleScope::getMinGap
double getMinGap(const std::string &vehicleID) const
Definition: TraCIAPI.cpp:2746
TraCIAPI::TrafficLightScope::setPhase
void setPhase(const std::string &tlsID, int index) const
Definition: TraCIAPI.cpp:2019
TraCIAPI::VehicleScope::addSubscriptionFilterStringList
void addSubscriptionFilterStringList(int filterType, const std::vector< std::string > &vals) const
Definition: TraCIAPI.cpp:3299
libsumo::VAR_TELEPORT_STARTING_VEHICLES_NUMBER
TRACI_CONST int VAR_TELEPORT_STARTING_VEHICLES_NUMBER
Definition: TraCIConstants.h:864
libsumo::VAR_COLOR
TRACI_CONST int VAR_COLOR
Definition: TraCIConstants.h:630
libsumo::TL_NEXT_SWITCH
TRACI_CONST int TL_NEXT_SWITCH
Definition: TraCIConstants.h:582
TraCIAPI::PersonScope::getVehicle
std::string getVehicle(const std::string &personID) const
Definition: TraCIAPI.cpp:3396
libsumo::TraCIPhase::maxDur
double maxDur
Definition: TraCIDefs.h:219
TraCIAPI::VehicleTypeScope::setShapeClass
void setShapeClass(const std::string &typeID, const std::string &shapeClass) const
Definition: TraCIAPI.cpp:2335
libsumo::VAR_VIA
TRACI_CONST int VAR_VIA
Definition: TraCIConstants.h:778
libsumo::VAR_SIGNALS
TRACI_CONST int VAR_SIGNALS
Definition: TraCIConstants.h:714
TraCIAPI::PolygonScope::add
void add(const std::string &polygonID, const libsumo::TraCIPositionVector &shape, const libsumo::TraCIColor &c, bool fill, const std::string &type, int layer) const
Definition: TraCIAPI.cpp:1561
libsumo::CMD_GET_PERSON_VARIABLE
TRACI_CONST int CMD_GET_PERSON_VARIABLE
Definition: TraCIConstants.h:297
libsumo::TraCIColor::a
int a
Definition: TraCIDefs.h:143
tcpip::Storage::readStringList
virtual std::vector< std::string > readStringList()
TraCIAPI::VehicleTypeScope::getSpeedDeviation
double getSpeedDeviation(const std::string &typeID) const
Definition: TraCIAPI.cpp:2124
TraCIAPI::POIScope::setImageFile
void setImageFile(const std::string &poiID, const std::string &imageFile) const
Definition: TraCIAPI.cpp:1428
libsumo::CMD_SET_POI_VARIABLE
TRACI_CONST int CMD_SET_POI_VARIABLE
Definition: TraCIConstants.h:198
libsumo::TraCIBestLanesData::bestLaneOffset
int bestLaneOffset
The offset of this lane from the best lane.
Definition: TraCIDefs.h:336
TraCIAPI::getPolygon
libsumo::TraCIPositionVector getPolygon(int cmd, int var, const std::string &id, tcpip::Storage *add=0)
Definition: TraCIAPI.cpp:395
libsumo::TL_PHASE_DURATION
TRACI_CONST int TL_PHASE_DURATION
Definition: TraCIConstants.h:558
libsumo::RESPONSE_SUBSCRIBE_GUI_VARIABLE
TRACI_CONST int RESPONSE_SUBSCRIBE_GUI_VARIABLE
Definition: TraCIConstants.h:277
TraCIAPI::SimulationScope::getDistanceRoad
double getDistanceRoad(const std::string &edgeID1, double pos1, const std::string &edgeID2, double pos2, bool isDriving=false)
Definition: TraCIAPI.cpp:1821
TraCIAPI::VehicleScope::setSpeedMode
void setSpeedMode(const std::string &vehicleID, int mode) const
Definition: TraCIAPI.cpp:3057
TraCIAPI::TrafficLightScope::getRedYellowGreenState
std::string getRedYellowGreenState(const std::string &tlsID) const
Definition: TraCIAPI.cpp:1884
TraCIAPI::TraCIScopeWrapper::subscribe
void subscribe(const std::string &objID, const std::vector< int > &vars, double beginTime, double endTime) const
Definition: TraCIAPI.cpp:3653
TraCIAPI::person
PersonScope person
Scope for interaction with persons.
Definition: TraCIAPI.h:948
libsumo::VAR_WAITING_TIME
TRACI_CONST int VAR_WAITING_TIME
Definition: TraCIConstants.h:825
libsumo::VAR_BUS_STOP_WAITING
TRACI_CONST int VAR_BUS_STOP_WAITING
Definition: TraCIConstants.h:813
libsumo::VAR_WIDTH
TRACI_CONST int VAR_WIDTH
Definition: TraCIConstants.h:666
libsumo::TraCIColor::g
int g
Definition: TraCIDefs.h:143
TraCIAPI::VehicleScope::getIDList
std::vector< std::string > getIDList() const
Definition: TraCIAPI.cpp:2414
libsumo::CMD_SET_POLYGON_VARIABLE
TRACI_CONST int CMD_SET_POLYGON_VARIABLE
Definition: TraCIConstants.h:213
TraCIAPI::VehicleTypeScope::setMinGap
void setMinGap(const std::string &typeID, double minGap) const
Definition: TraCIAPI.cpp:2289
TraCIAPI::LaneScope::getLinks
std::vector< libsumo::TraCIConnection > getLinks(const std::string &laneID) const
Definition: TraCIAPI.cpp:1073
tcpip::Socket::connect
void connect()
Connects to host_:port_.
Definition: socket.cpp:363
libsumo::VAR_ALLOWED_SPEED
TRACI_CONST int VAR_ALLOWED_SPEED
Definition: TraCIConstants.h:757
TraCIAPI::VehicleScope::addSubscriptionFilterTurn
void addSubscriptionFilterTurn(double downstreamDist=-1, double upstreamDist=-1) const
Definition: TraCIAPI.cpp:3254
TraCIAPI::LaneScope::setAllowed
void setAllowed(const std::string &laneID, const std::vector< std::string > &allowedClasses) const
Definition: TraCIAPI.cpp:1231
libsumo::CMD_GET_LANEAREA_VARIABLE
TRACI_CONST int CMD_GET_LANEAREA_VARIABLE
Definition: TraCIConstants.h:284
TraCIAPI::setOrder
void setOrder(int order)
set priority (execution order) for the client
Definition: TraCIAPI.cpp:87
libsumo::LANE_DISALLOWED
TRACI_CONST int LANE_DISALLOWED
Definition: TraCIConstants.h:600
TraCIAPI::LaneScope::getLastStepVehicleIDs
std::vector< std::string > getLastStepVehicleIDs(const std::string &laneID) const
Definition: TraCIAPI.cpp:1203
libsumo::VAR_TIME
TRACI_CONST int VAR_TIME
Definition: TraCIConstants.h:843
TraCIAPI::VehicleScope::getNoiseEmission
double getNoiseEmission(const std::string &vehicleID) const
Definition: TraCIAPI.cpp:2550
TraCIAPI::SimulationScope::getDepartedNumber
int getDepartedNumber() const
Definition: TraCIAPI.cpp:1645
TraCIAPI::GUIScope::setOffset
void setOffset(const std::string &viewID, double x, double y) const
Definition: TraCIAPI.cpp:865
TraCIAPI::VehicleScope::getSlope
double getSlope(const std::string &vehicleID) const
Definition: TraCIAPI.cpp:2571
libsumo::VAR_PERSON_NUMBER
TRACI_CONST int VAR_PERSON_NUMBER
Definition: TraCIConstants.h:805
libsumo::RESPONSE_SUBSCRIBE_EDGE_VARIABLE
TRACI_CONST int RESPONSE_SUBSCRIBE_EDGE_VARIABLE
Definition: TraCIConstants.h:247
TraCIAPI::SimulationScope::getNetBoundary
libsumo::TraCIPositionVector getNetBoundary() const
Definition: TraCIAPI.cpp:1690
TraCIAPI::SimulationScope::getMinExpectedNumber
int getMinExpectedNumber() const
Definition: TraCIAPI.cpp:1696
libsumo::CMD_CHANGETARGET
TRACI_CONST int CMD_CHANGETARGET
Definition: TraCIConstants.h:79
libsumo::CMD_SET_SIM_VARIABLE
TRACI_CONST int CMD_SET_SIM_VARIABLE
Definition: TraCIConstants.h:258
libsumo::TraCIVehicleData::leaveTime
double leaveTime
Leave-time of the vehicle in [s].
Definition: TraCIDefs.h:294
libsumo::VAR_COEMISSION
TRACI_CONST int VAR_COEMISSION
Definition: TraCIConstants.h:787
libsumo::VAR_VEHICLECLASS
TRACI_CONST int VAR_VEHICLECLASS
Definition: TraCIConstants.h:654
TraCIAPI::VehicleScope::remove
void remove(const std::string &vehicleID, char reason=libsumo::REMOVE_VAPORIZED) const
Definition: TraCIAPI.cpp:2876
TraCIAPI::TrafficLightScope::setPhaseName
void setPhaseName(const std::string &tlsID, const std::string &name) const
Definition: TraCIAPI.cpp:2028
TraCIAPI::MeMeScope::getLastStepHaltingNumber
int getLastStepHaltingNumber(const std::string &detID) const
Definition: TraCIAPI.cpp:1308
libsumo::ContextSubscriptionResults
std::map< std::string, SubscriptionResults > ContextSubscriptionResults
Definition: TraCIDefs.h:204
TraCIAPI::RouteScope::getIDList
std::vector< std::string > getIDList() const
Definition: TraCIAPI.cpp:1601
libsumo::TraCILogic::currentPhaseIndex
int currentPhaseIndex
Definition: TraCIDefs.h:247
TraCIAPI::VehicleScope::getLanePosition
double getLanePosition(const std::string &vehicleID) const
Definition: TraCIAPI.cpp:2500
libsumo::VAR_PARAMETER
TRACI_CONST int VAR_PARAMETER
Definition: TraCIConstants.h:939
TraCIAPI::TrafficLightScope::getControlledLinks
std::vector< std::vector< libsumo::TraCILink > > getControlledLinks(const std::string &tlsID) const
Definition: TraCIAPI.cpp:1947
TraCIAPI::VehicleScope::getLateralAlignment
std::string getLateralAlignment(const std::string &vehicleID) const
Definition: TraCIAPI.cpp:2811
libsumo::VAR_ACCEL
TRACI_CONST int VAR_ACCEL
Definition: TraCIConstants.h:633
TraCIAPI::PolygonScope::getIDList
std::vector< std::string > getIDList() const
Definition: TraCIAPI.cpp:1481
libsumo::TYPE_BYTE
TRACI_CONST int TYPE_BYTE
Definition: TraCIConstants.h:331
TraCIAPI::PersonScope::getWaitingTime
double getWaitingTime(const std::string &personID) const
Definition: TraCIAPI.cpp:3385
libsumo::TraCINextTLSData::tlIndex
int tlIndex
The tls index of the controlled link.
Definition: TraCIDefs.h:304
TraCIAPI::VehicleScope::setSignals
void setSignals(const std::string &vehicleID, int signals) const
Definition: TraCIAPI.cpp:3150
libsumo::VAR_TIME_STEP
TRACI_CONST int VAR_TIME_STEP
Definition: TraCIConstants.h:846
TraCIAPI::POIScope::setWidth
void setWidth(const std::string &poiID, double width) const
Definition: TraCIAPI.cpp:1398
TraCIAPI::EdgeScope::getElectricityConsumption
double getElectricityConsumption(const std::string &edgeID) const
Definition: TraCIAPI.cpp:725
libsumo::VAR_EDGE_TRAVELTIME
TRACI_CONST int VAR_EDGE_TRAVELTIME
Definition: TraCIConstants.h:705
TraCIAPI::PersonScope::getStage
libsumo::TraCIStage getStage(const std::string &personID, int nextStageIndex=0) const
Definition: TraCIAPI.cpp:3406
TraCIAPI::myDomains
std::map< int, TraCIScopeWrapper * > myDomains
Definition: TraCIAPI.h:1055
libsumo::LAST_STEP_VEHICLE_ID_LIST
TRACI_CONST int LAST_STEP_VEHICLE_ID_LIST
Definition: TraCIConstants.h:519
libsumo::APPEND_STAGE
TRACI_CONST int APPEND_STAGE
Definition: TraCIConstants.h:991
libsumo::INVALID_INT_VALUE
TRACI_CONST int INVALID_INT_VALUE
Definition: TraCIConstants.h:364
libsumo::TraCIStage::intended
std::string intended
id of the intended vehicle for public transport ride
Definition: TraCIDefs.h:365
libsumo::VAR_MOVE_TO
TRACI_CONST int VAR_MOVE_TO
Definition: TraCIConstants.h:717
TraCIAPI::createFilterCommand
void createFilterCommand(int cmdID, int varID, tcpip::Storage *add=nullptr) const
Definition: TraCIAPI.cpp:184
libsumo::FILTER_TYPE_FIELD_OF_VISION
TRACI_CONST int FILTER_TYPE_FIELD_OF_VISION
Definition: TraCIConstants.h:492
TraCIAPI::VehicleTypeScope::setVehicleClass
void setVehicleClass(const std::string &typeID, const std::string &clazz) const
Definition: TraCIAPI.cpp:2234
TraCIAPI::VehicleTypeScope::getMaxSpeed
double getMaxSpeed(const std::string &typeID) const
Definition: TraCIAPI.cpp:2114
libsumo::TraCIColor
A color.
Definition: TraCIDefs.h:135
TraCIAPI::TraCIScopeWrapper::getAllContextSubscriptionResults
const libsumo::ContextSubscriptionResults getAllContextSubscriptionResults() const
Definition: TraCIAPI.cpp:3691
TraCIAPI::VehicleScope::getRouteIndex
int getRouteIndex(const std::string &vehicleID) const
Definition: TraCIAPI.cpp:2484
libsumo::VAR_VEHICLE
TRACI_CONST int VAR_VEHICLE
Definition: TraCIConstants.h:988
libsumo::VAR_NOISEEMISSION
TRACI_CONST int VAR_NOISEEMISSION
Definition: TraCIConstants.h:802
TraCIAPI::VehicleScope::addSubscriptionFilterVType
void addSubscriptionFilterVType(const std::vector< std::string > &vTypes) const
Definition: TraCIAPI.cpp:3272
libsumo::VAR_LEADER
TRACI_CONST int VAR_LEADER
Definition: TraCIConstants.h:819
TraCIAPI::VehicleScope::rerouteTraveltime
void rerouteTraveltime(const std::string &vehicleID, bool currentTravelTimes=true) const
Definition: TraCIAPI.cpp:2960
libsumo::CMD_GET_LANE_VARIABLE
TRACI_CONST int CMD_GET_LANE_VARIABLE
Definition: TraCIConstants.h:134
libsumo::TraCIVehicleData
mirrors MSInductLoop::VehicleData
Definition: TraCIDefs.h:286
TraCIAPI::LaneScope::getLength
double getLength(const std::string &laneID) const
Definition: TraCIAPI.cpp:1043
TraCIAPI::VehicleScope::getMaxSpeed
double getMaxSpeed(const std::string &vehicleID) const
Definition: TraCIAPI.cpp:2439
TraCIAPI::VehicleScope::setLine
void setLine(const std::string &vehicleID, const std::string &line) const
Definition: TraCIAPI.cpp:3129
TraCIAPI::LaneScope::getShape
libsumo::TraCIPositionVector getShape(const std::string &laneID) const
Definition: TraCIAPI.cpp:1123
libsumo::RESPONSE_SUBSCRIBE_ROUTE_VARIABLE
TRACI_CONST int RESPONSE_SUBSCRIBE_ROUTE_VARIABLE
Definition: TraCIConstants.h:187
TraCIAPI::SimulationScope::getStartingTeleportIDList
std::vector< std::string > getStartingTeleportIDList() const
Definition: TraCIAPI.cpp:1670
libsumo::VAR_ROUTE_ID
TRACI_CONST int VAR_ROUTE_ID
Definition: TraCIConstants.h:684
TraCIAPI::LaneScope::getLastStepHaltingNumber
int getLastStepHaltingNumber(const std::string &laneID) const
Definition: TraCIAPI.cpp:1198
TraCIAPI::SimulationScope::getBusStopWaitingIDList
std::vector< std::string > getBusStopWaitingIDList(const std::string &stopID) const
Definition: TraCIAPI.cpp:1706
libsumo::TraCIRoadPosition::edgeID
std::string edgeID
Definition: TraCIDefs.h:127
TraCIAPI::VehicleScope::getCO2Emission
double getCO2Emission(const std::string &vehicleID) const
Definition: TraCIAPI.cpp:2520
libsumo::TraCINextTLSData::dist
double dist
The distance to the tls.
Definition: TraCIDefs.h:306
TraCIAPI::getTraCIStage
libsumo::TraCIStage getTraCIStage(int cmd, int var, const std::string &id, tcpip::Storage *add=0)
Definition: TraCIAPI.cpp:480
TraCIAPI::VehicleScope::setEmissionClass
void setEmissionClass(const std::string &vehicleID, const std::string &clazz) const
Definition: TraCIAPI.cpp:3178
libsumo::TraCIColor::b
int b
Definition: TraCIDefs.h:143
TraCIAPI::getColor
libsumo::TraCIColor getColor(int cmd, int var, const std::string &id, tcpip::Storage *add=0)
Definition: TraCIAPI.cpp:466
TraCIAPI::LaneScope::getEdgeID
std::string getEdgeID(const std::string &laneID) const
Definition: TraCIAPI.cpp:1128
TraCIAPI::PersonScope::setWidth
void setWidth(const std::string &personID, double width) const
Definition: TraCIAPI.cpp:3589
TraCIAPI::SimulationScope::getStartingTeleportNumber
int getStartingTeleportNumber() const
Definition: TraCIAPI.cpp:1665
TraCIAPI::PersonScope::rerouteTraveltime
void rerouteTraveltime(const std::string &personID) const
Definition: TraCIAPI.cpp:3432
libsumo::CMD_GET_VEHICLE_VARIABLE
TRACI_CONST int CMD_GET_VEHICLE_VARIABLE
Definition: TraCIConstants.h:149
libsumo::CMD_SET_VEHICLE_VARIABLE
TRACI_CONST int CMD_SET_VEHICLE_VARIABLE
Definition: TraCIConstants.h:153
libsumo::ADD
TRACI_CONST int ADD
Definition: TraCIConstants.h:943
libsumo::CMD_GET_VEHICLETYPE_VARIABLE
TRACI_CONST int CMD_GET_VEHICLETYPE_VARIABLE
Definition: TraCIConstants.h:164
libsumo::FIND_ROUTE
TRACI_CONST int FIND_ROUTE
Definition: TraCIConstants.h:964
libsumo::VAR_BUS_STOP_WAITING_IDS
TRACI_CONST int VAR_BUS_STOP_WAITING_IDS
Definition: TraCIConstants.h:816
TraCIAPI::InductionLoopScope::getLastStepMeanSpeed
double getLastStepMeanSpeed(const std::string &loopID) const
Definition: TraCIAPI.cpp:945
TraCIAPI::EdgeScope::getLastStepVehicleIDs
std::vector< std::string > getLastStepVehicleIDs(const std::string &edgeID) const
Definition: TraCIAPI.cpp:760
libsumo::CMD_ADD_SUBSCRIPTION_FILTER
TRACI_CONST int CMD_ADD_SUBSCRIPTION_FILTER
Definition: TraCIConstants.h:85
libsumo::TraCIStage::arrivalPos
double arrivalPos
position on the lane when ending the stage
Definition: TraCIDefs.h:371
TraCIAPI::LaneAreaScope::getIDList
std::vector< std::string > getIDList() const
Definition: TraCIAPI.cpp:1277
libsumo::RESPONSE_SUBSCRIBE_VEHICLE_VARIABLE
TRACI_CONST int RESPONSE_SUBSCRIBE_VEHICLE_VARIABLE
Definition: TraCIConstants.h:157
libsumo::CMD_STOP
TRACI_CONST int CMD_STOP
Definition: TraCIConstants.h:58
TraCIAPI::VehicleScope::addSubscriptionFilterFloat
void addSubscriptionFilterFloat(int filterType, double val) const
Definition: TraCIAPI.cpp:3289
TraCIAPI::TrafficLightScope::setRedYellowGreenState
void setRedYellowGreenState(const std::string &tlsID, const std::string &state) const
Definition: TraCIAPI.cpp:2010
libsumo::LAST_STEP_VEHICLE_DATA
TRACI_CONST int LAST_STEP_VEHICLE_DATA
Definition: TraCIConstants.h:534
TraCIAPI::createCommand
void createCommand(int cmdID, int varID, const std::string &objID, tcpip::Storage *add=nullptr) const
Sends a GetVariable / SetVariable request if mySocket is connected. Otherwise writes to myOutput only...
Definition: TraCIAPI.cpp:160
TraCIAPI::EdgeScope::getLastStepOccupancy
double getLastStepOccupancy(const std::string &edgeID) const
Definition: TraCIAPI.cpp:735
libsumo::TraCIBestLanesData::allowsContinuation
bool allowsContinuation
Whether this lane allows continuing the route.
Definition: TraCIDefs.h:338
libsumo::FILTER_TYPE_UPSTREAM_DIST
TRACI_CONST int FILTER_TYPE_UPSTREAM_DIST
Definition: TraCIConstants.h:477
tcpip::Storage::writeByte
virtual void writeByte(int)
TraCIAPI::POIScope::setHeight
void setHeight(const std::string &poiID, double height) const
Definition: TraCIAPI.cpp:1408
TraCIAPI::MeMeScope::getLastStepVehicleIDs
std::vector< std::string > getLastStepVehicleIDs(const std::string &detID) const
Definition: TraCIAPI.cpp:1303
TraCIAPI::VehicleScope::addSubscriptionFilterLCManeuver
void addSubscriptionFilterLCManeuver(int direction, bool noOpposite=false, double downstreamDist=-1, double upstreamDist=-1) const
Definition: TraCIAPI.cpp:3230
TraCIAPI::VehicleScope::getImperfection
double getImperfection(const std::string &vehicleID) const
Definition: TraCIAPI.cpp:2726
TraCIAPI::GUIScope::screenshot
void screenshot(const std::string &viewID, const std::string &filename, const int width=-1, const int height=-1) const
Definition: TraCIAPI.cpp:897
TraCIAPI::PersonScope::appendDrivingStage
void appendDrivingStage(const std::string &personID, const std::string &toEdge, const std::string &lines, const std::string &stopID="")
Definition: TraCIAPI.cpp:3533
libsumo::VAR_BEST_LANES
TRACI_CONST int VAR_BEST_LANES
Definition: TraCIConstants.h:741
libsumo::VAR_TAU
TRACI_CONST int VAR_TAU
Definition: TraCIConstants.h:651
TraCIAPI::VehicleScope::getNOxEmission
double getNOxEmission(const std::string &vehicleID) const
Definition: TraCIAPI.cpp:2540
TraCIAPI::LaneScope::getPMxEmission
double getPMxEmission(const std::string &laneID) const
Definition: TraCIAPI.cpp:1148
TraCIAPI::VehicleTypeScope::setSpeedDeviation
void setSpeedDeviation(const std::string &typeID, double deviation) const
Definition: TraCIAPI.cpp:2252
libsumo::FILTER_TYPE_LEAD_FOLLOW
TRACI_CONST int FILTER_TYPE_LEAD_FOLLOW
Definition: TraCIConstants.h:480
libsumo::VAR_NOXEMISSION
TRACI_CONST int VAR_NOXEMISSION
Definition: TraCIConstants.h:796
TraCIAPI::GUIScope::getOffset
libsumo::TraCIPosition getOffset(const std::string &viewID=DEFAULT_VIEW) const
Definition: TraCIAPI.cpp:840
libsumo::VAR_CURRENT_TRAVELTIME
TRACI_CONST int VAR_CURRENT_TRAVELTIME
Definition: TraCIConstants.h:711
libsumo::FILTER_TYPE_NOOPPOSITE
TRACI_CONST int FILTER_TYPE_NOOPPOSITE
Definition: TraCIConstants.h:471
TraCIAPI::TraCIScopeWrapper::getParameter
std::string getParameter(const std::string &objectID, const std::string &key) const
retrieve generic paramter
Definition: TraCIAPI.cpp:3630
TraCIAPI::EdgeScope::getPMxEmission
double getPMxEmission(const std::string &edgeID) const
Definition: TraCIAPI.cpp:705
TraCIAPI::VehicleScope::getLateralSpeed
double getLateralSpeed(const std::string &vehicleID) const
Definition: TraCIAPI.cpp:2429
TraCIAPI::load
void load(const std::vector< std::string > &args)
Let sumo load a simulation using the given command line like options.
Definition: TraCIAPI.cpp:642
libsumo::CMD_SETORDER
TRACI_CONST int CMD_SETORDER
Definition: TraCIConstants.h:55
TraCIAPI::VehicleScope::addSubscriptionFilterLeadFollow
void addSubscriptionFilterLeadFollow(const std::vector< int > &lanes) const
Definition: TraCIAPI.cpp:3248
TraCIAPI::VehicleScope::getHeight
double getHeight(const std::string &veihcleID) const
Definition: TraCIAPI.cpp:2761
TraCIAPI::SimulationScope::getEndingTeleportNumber
int getEndingTeleportNumber() const
Definition: TraCIAPI.cpp:1675
TraCIAPI::PolygonScope::remove
void remove(const std::string &polygonID, int layer=0) const
Definition: TraCIAPI.cpp:1588
libsumo::VAR_MINGAP_LAT
TRACI_CONST int VAR_MINGAP_LAT
Definition: TraCIConstants.h:769
libsumo::TraCIBestLanesData
Definition: TraCIDefs.h:328
TraCIAPI::~TraCIAPI
~TraCIAPI()
Destructor.
Definition: TraCIAPI.cpp:68
TraCIAPI::EdgeScope::getStreetName
std::string getStreetName(const std::string &id) const
Definition: TraCIAPI.cpp:772
TraCIAPI::VehicleScope::getStopState
int getStopState(const std::string &vehicleID) const
Definition: TraCIAPI.cpp:2701
TraCIAPI::LaneScope::getDisallowed
std::vector< std::string > getDisallowed(const std::string &laneID) const
Definition: TraCIAPI.cpp:1063
libsumo::VAR_STOPSTATE
TRACI_CONST int VAR_STOPSTATE
Definition: TraCIConstants.h:751
TraCIAPI::PersonScope::setHeight
void setHeight(const std::string &personID, double height) const
Definition: TraCIAPI.cpp:3598
TraCIAPI::LaneScope::getLastStepVehicleNumber
int getLastStepVehicleNumber(const std::string &laneID) const
Definition: TraCIAPI.cpp:1193
libsumo::VAR_SHAPE
TRACI_CONST int VAR_SHAPE
Definition: TraCIConstants.h:669
libsumo::TraCILogic
Definition: TraCIDefs.h:232
TraCIAPI::closeSocket
void closeSocket()
Closes the connection.
Definition: TraCIAPI.cpp:112
libsumo::TraCINextTLSData::state
char state
The current state of the tls.
Definition: TraCIDefs.h:308
libsumo::TraCIStage::travelTime
double travelTime
duration of the stage in seconds
Definition: TraCIDefs.h:359
tcpip::Storage::readUnsignedByte
virtual int readUnsignedByte()
tcpip::Storage::writeInt
virtual void writeInt(int)
libsumo::TraCIBestLanesData::occupation
double occupation
The traffic density along length.
Definition: TraCIDefs.h:334
TraCIAPI::VehicleScope::addSubscriptionFilterUpstreamDistance
void addSubscriptionFilterUpstreamDistance(double dist) const
Definition: TraCIAPI.cpp:3213
libsumo::VAR_LATALIGNMENT
TRACI_CONST int VAR_LATALIGNMENT
Definition: TraCIConstants.h:763
libsumo::VAR_ACCUMULATED_WAITING_TIME
TRACI_CONST int VAR_ACCUMULATED_WAITING_TIME
Definition: TraCIConstants.h:828
libsumo::FILTER_TYPE_TURN
TRACI_CONST int FILTER_TYPE_TURN
Definition: TraCIConstants.h:483
TraCIAPI::simulationStep
void simulationStep(double time=0)
Advances by one step (or up to the given time)
Definition: TraCIAPI.cpp:620
libsumo::TYPE_DOUBLE
TRACI_CONST int TYPE_DOUBLE
Definition: TraCIConstants.h:335
TraCIAPI::VehicleScope::setColor
void setColor(const std::string &vehicleID, const libsumo::TraCIColor &c) const
Definition: TraCIAPI.cpp:3117
libsumo::TYPE_POLYGON
TRACI_CONST int TYPE_POLYGON
Definition: TraCIConstants.h:327
tcpip::Storage::position
virtual unsigned int position() const
libsumo::RESPONSE_SUBSCRIBE_POI_VARIABLE
TRACI_CONST int RESPONSE_SUBSCRIBE_POI_VARIABLE
Definition: TraCIConstants.h:202
libsumo::RESPONSE_SUBSCRIBE_PERSON_VARIABLE
TRACI_CONST int RESPONSE_SUBSCRIBE_PERSON_VARIABLE
Definition: TraCIConstants.h:305
TraCIAPI::send_commandSubscribeObjectVariable
void send_commandSubscribeObjectVariable(int domID, const std::string &objID, double beginTime, double endTime, const std::vector< int > &vars) const
Sends a SubscribeVariable request.
Definition: TraCIAPI.cpp:207
TraCIAPI::VehicleTypeScope::setColor
void setColor(const std::string &typeID, const libsumo::TraCIColor &c) const
Definition: TraCIAPI.cpp:2398
libsumo::CMD_GET_POI_VARIABLE
TRACI_CONST int CMD_GET_POI_VARIABLE
Definition: TraCIConstants.h:194
tcpip::Storage::readString
virtual std::string readString()
libsumo::VAR_NET_BOUNDING_BOX
TRACI_CONST int VAR_NET_BOUNDING_BOX
Definition: TraCIConstants.h:885
TraCIAPI::LaneScope::getLastStepOccupancy
double getLastStepOccupancy(const std::string &laneID) const
Definition: TraCIAPI.cpp:1178
TraCIAPI::SimulationScope::convert2D
libsumo::TraCIPosition convert2D(const std::string &edgeID, double pos, int laneIndex=0, bool toGeo=false) const
Definition: TraCIAPI.cpp:1712
TraCIAPI::VehicleScope::setType
void setType(const std::string &vehicleID, const std::string &typeID) const
Definition: TraCIAPI.cpp:3090
TraCIAPI::VehicleScope::addSubscriptionFilterFieldOfVision
void addSubscriptionFilterFieldOfVision(double angle) const
Definition: TraCIAPI.cpp:3278
TraCIAPI::trafficlights
TrafficLightScope trafficlights
Scope for interaction with traffic lights.
Definition: TraCIAPI.h:958
libsumo::VAR_VIEW_ZOOM
TRACI_CONST int VAR_VIEW_ZOOM
Definition: TraCIConstants.h:1000
TraCIAPI::TrafficLightScope::getNextSwitch
double getNextSwitch(const std::string &tlsID) const
Definition: TraCIAPI.cpp:1995
TraCIAPI::getInt
int getInt(int cmd, int var, const std::string &id, tcpip::Storage *add=0)
Definition: TraCIAPI.cpp:375
libsumo::VAR_ROUTE_VALID
TRACI_CONST int VAR_ROUTE_VALID
Definition: TraCIConstants.h:976
libsumo::TraCIStage::description
std::string description
arbitrary description string
Definition: TraCIDefs.h:373
libsumo::VAR_ANGLE
TRACI_CONST int VAR_ANGLE
Definition: TraCIConstants.h:624
TraCIAPI::GUIScope::setSchema
void setSchema(const std::string &viewID, const std::string &schemeName) const
Definition: TraCIAPI.cpp:875
tcpip::Storage::readInt
virtual int readInt()
libsumo::FILTER_TYPE_VTYPE
TRACI_CONST int FILTER_TYPE_VTYPE
Definition: TraCIConstants.h:489
libsumo::POSITION_LON_LAT
TRACI_CONST int POSITION_LON_LAT
Definition: TraCIConstants.h:312
libsumo::TYPE_INTEGER
TRACI_CONST int TYPE_INTEGER
Definition: TraCIConstants.h:333
TraCIAPI::VehicleScope::addSubscriptionFilterDownstreamDistance
void addSubscriptionFilterDownstreamDistance(double dist) const
Definition: TraCIAPI.cpp:3208
TraCIAPI::VehicleScope::addSubscriptionFilterLanes
void addSubscriptionFilterLanes(const std::vector< int > &lanes, bool noOpposite=false, double downstreamDist=-1, double upstreamDist=-1) const
Definition: TraCIAPI.cpp:3187
TraCIAPI::EdgeScope::getHCEmission
double getHCEmission(const std::string &edgeID) const
Definition: TraCIAPI.cpp:700
libsumo::TraCIVehicleData::typeID
std::string typeID
Type of the vehicle in.
Definition: TraCIDefs.h:296
TraCIAPI::POIScope::getImageFile
std::string getImageFile(const std::string &poiID) const
Definition: TraCIAPI.cpp:1358
libsumo::TraCIBestLanesData::length
double length
The length than can be driven from that lane without lane change.
Definition: TraCIDefs.h:332
TraCIAPI::readVariables
void readVariables(tcpip::Storage &inMsg, const std::string &objectID, int variableCount, libsumo::SubscriptionResults &into)
Definition: TraCIAPI.cpp:529
libsumo::VAR_DEPARTED_VEHICLES_IDS
TRACI_CONST int VAR_DEPARTED_VEHICLES_IDS
Definition: TraCIConstants.h:861
libsumo::CMD_SET_VEHICLETYPE_VARIABLE
TRACI_CONST int CMD_SET_VEHICLETYPE_VARIABLE
Definition: TraCIConstants.h:168
TraCIAPI::VehicleScope::getElectricityConsumption
double getElectricityConsumption(const std::string &vehicleID) const
Definition: TraCIAPI.cpp:2555
libsumo::VAR_NEXT_EDGE
TRACI_CONST int VAR_NEXT_EDGE
Definition: TraCIConstants.h:982
tcpip::Storage::writeStorage
virtual void writeStorage(tcpip::Storage &store)
libsumo::TraCILogic::programID
std::string programID
Definition: TraCIDefs.h:245
TraCIAPI::VehicleScope::getLaneIndex
int getLaneIndex(const std::string &vehicleID) const
Definition: TraCIAPI.cpp:2469
TraCIAPI::toString
static std::string toString(const T &t, std::streamsize accuracy=PRECISION)
Definition: TraCIAPI.h:1043
TraCIAPI::VehicleTypeScope::getWidth
double getWidth(const std::string &typeID) const
Definition: TraCIAPI.cpp:2199
libsumo::RESPONSE_SUBSCRIBE_LANEAREA_VARIABLE
TRACI_CONST int RESPONSE_SUBSCRIBE_LANEAREA_VARIABLE
Definition: TraCIConstants.h:290
libsumo::RESPONSE_SUBSCRIBE_VEHICLETYPE_VARIABLE
TRACI_CONST int RESPONSE_SUBSCRIBE_VEHICLETYPE_VARIABLE
Definition: TraCIConstants.h:172
TraCIAPI::InductionLoopScope::getVehicleData
std::vector< libsumo::TraCIVehicleData > getVehicleData(const std::string &loopID) const
Definition: TraCIAPI.cpp:971
TraCIAPI::SimulationScope::getEndingTeleportIDList
std::vector< std::string > getEndingTeleportIDList() const
Definition: TraCIAPI.cpp:1680
TraCIAPI::PersonScope::getLanePosition
double getLanePosition(const std::string &personID) const
Definition: TraCIAPI.cpp:3360
tcpip::Storage::writeStringList
virtual void writeStringList(const std::vector< std::string > &s)
libsumo::TraCIStage::line
std::string line
The line or the id of the vehicle type.
Definition: TraCIDefs.h:353
libsumo::VAR_DELTA_T
TRACI_CONST int VAR_DELTA_T
Definition: TraCIConstants.h:882
TraCIAPI::SimulationScope::writeMessage
void writeMessage(const std::string msg)
Definition: TraCIAPI.cpp:1862
libsumo::TL_CONTROLLED_LANES
TRACI_CONST int TL_CONTROLLED_LANES
Definition: TraCIConstants.h:561
libsumo::TraCIConnection
Definition: TraCIDefs.h:265
TraCIAPI::VehicleTypeScope::setMaxSpeed
void setMaxSpeed(const std::string &typeID, double speed) const
Definition: TraCIAPI.cpp:2225
libsumo::VAR_SLOPE
TRACI_CONST int VAR_SLOPE
Definition: TraCIConstants.h:606
libsumo::STAGE_WALKING
TRACI_CONST int STAGE_WALKING
Definition: TraCIConstants.h:400
TraCIAPI::SimulationScope::convert3D
libsumo::TraCIPosition convert3D(const std::string &edgeID, double pos, int laneIndex=0, bool toGeo=false) const
Definition: TraCIAPI.cpp:1734
libsumo::CMD_SET_LANE_VARIABLE
TRACI_CONST int CMD_SET_LANE_VARIABLE
Definition: TraCIConstants.h:138
libsumo::RTYPE_ERR
TRACI_CONST int RTYPE_ERR
Definition: TraCIConstants.h:356
libsumo::VAR_PMXEMISSION
TRACI_CONST int VAR_PMXEMISSION
Definition: TraCIConstants.h:793
TraCIAPI::TraCIScopeWrapper::setParameter
void setParameter(const std::string &objectID, const std::string &key, const std::string &value) const
set generic paramter
Definition: TraCIAPI.cpp:3639
TraCIAPI::JunctionScope::getPosition
libsumo::TraCIPosition getPosition(const std::string &junctionID) const
Definition: TraCIAPI.cpp:1019
TraCIAPI::GUIScope::getBoundary
libsumo::TraCIPositionVector getBoundary(const std::string &viewID=DEFAULT_VIEW) const
Definition: TraCIAPI.cpp:850
libsumo::ADD_FULL
TRACI_CONST int ADD_FULL
Definition: TraCIConstants.h:961
TraCIAPI::VehicleScope::getVia
std::vector< std::string > getVia(const std::string &vehicleID) const
Definition: TraCIAPI.cpp:2582
libsumo::TraCIPhase::state
std::string state
Definition: TraCIDefs.h:218
TraCIAPI::EdgeScope::getIDCount
int getIDCount() const
Definition: TraCIAPI.cpp:668
libsumo::CMD_CHANGESUBLANE
TRACI_CONST int CMD_CHANGESUBLANE
Definition: TraCIConstants.h:73
libsumo::TraCIStage
Definition: TraCIDefs.h:344
TraCIAPI::VehicleTypeScope::setLength
void setLength(const std::string &typeID, double length) const
Definition: TraCIAPI.cpp:2216
TraCIAPI::MeMeScope::getIDList
std::vector< std::string > getIDList() const
Definition: TraCIAPI.cpp:1288
TraCIAPI::LaneScope::getFuelConsumption
double getFuelConsumption(const std::string &laneID) const
Definition: TraCIAPI.cpp:1158
libsumo::TraCIPosition::z
double z
Definition: TraCIDefs.h:115
TraCIAPI::EdgeScope::getLastStepHaltingNumber
double getLastStepHaltingNumber(const std::string &edgeID) const
Definition: TraCIAPI.cpp:755
TraCIAPI::VehicleScope::getEmissionClass
std::string getEmissionClass(const std::string &vehicleID) const
Definition: TraCIAPI.cpp:2587
TraCIAPI::VehicleTypeScope::getLateralAlignment
std::string getLateralAlignment(const std::string &typeID) const
Definition: TraCIAPI.cpp:2189
libsumo::VAR_TELEPORT_ENDING_VEHICLES_IDS
TRACI_CONST int VAR_TELEPORT_ENDING_VEHICLES_IDS
Definition: TraCIConstants.h:873
libsumo::VAR_TELEPORT_STARTING_VEHICLES_IDS
TRACI_CONST int VAR_TELEPORT_STARTING_VEHICLES_IDS
Definition: TraCIConstants.h:867
TraCIAPI::VehicleTypeScope::getPersonCapacity
int getPersonCapacity(const std::string &typeID) const
Definition: TraCIAPI.cpp:2194
TraCIAPI::PersonScope::setMinGap
void setMinGap(const std::string &personID, double minGap) const
Definition: TraCIAPI.cpp:3607
TraCIAPI::getPosition3D
libsumo::TraCIPosition getPosition3D(int cmd, int var, const std::string &id, tcpip::Storage *add=0)
Definition: TraCIAPI.cpp:429
libsumo::REMOVE
TRACI_CONST int REMOVE
Definition: TraCIConstants.h:946
TraCIAPI::VehicleScope::getSpeed
double getSpeed(const std::string &vehicleID) const
Definition: TraCIAPI.cpp:2424
TraCIAPI::VehicleTypeScope::getColor
libsumo::TraCIColor getColor(const std::string &typeID) const
Definition: TraCIAPI.cpp:2209
libsumo::TraCIStage::length
double length
length in m
Definition: TraCIDefs.h:363
libsumo::VAR_FOES
TRACI_CONST int VAR_FOES
Definition: TraCIConstants.h:603
TraCIAPI::send_commandSubscribeObjectContext
void send_commandSubscribeObjectContext(int domID, const std::string &objID, double beginTime, double endTime, int domain, double range, const std::vector< int > &vars) const
Sends a SubscribeContext request.
Definition: TraCIAPI.cpp:235
libsumo::CMD_SET_TL_VARIABLE
TRACI_CONST int CMD_SET_TL_VARIABLE
Definition: TraCIConstants.h:123
libsumo::CMD_SET_PERSON_VARIABLE
TRACI_CONST int CMD_SET_PERSON_VARIABLE
Definition: TraCIConstants.h:301
TraCIAPI::PolygonScope::getIDCount
int getIDCount() const
Definition: TraCIAPI.cpp:1486
TraCIAPI::PolygonScope::getType
std::string getType(const std::string &polygonID) const
Definition: TraCIAPI.cpp:1496
libsumo::CMD_GET_SIM_VARIABLE
TRACI_CONST int CMD_GET_SIM_VARIABLE
Definition: TraCIConstants.h:254
TraCIAPI::getStringVector
std::vector< std::string > getStringVector(int cmd, int var, const std::string &id, tcpip::Storage *add=0)
Definition: TraCIAPI.cpp:452
TraCIAPI::VehicleTypeScope::setMinGapLat
void setMinGapLat(const std::string &typeID, double minGapLat) const
Definition: TraCIAPI.cpp:2299
TraCIAPI::TrafficLightScope::getPhase
int getPhase(const std::string &tlsID) const
Definition: TraCIAPI.cpp:1980
TraCIAPI::VehicleTypeScope::setWidth
void setWidth(const std::string &typeID, double width) const
Definition: TraCIAPI.cpp:2271
TraCIAPI::route
RouteScope route
Scope for interaction with routes.
Definition: TraCIAPI.h:954
TraCIAPI::GUIScope::setZoom
void setZoom(const std::string &viewID, double zoom) const
Definition: TraCIAPI.cpp:856
TraCIAPI::VehicleTypeScope::setEmissionClass
void setEmissionClass(const std::string &typeID, const std::string &clazz) const
Definition: TraCIAPI.cpp:2262
TraCIAPI::POIScope::setType
void setType(const std::string &poiID, const std::string &setType) const
Definition: TraCIAPI.cpp:1364
TraCIAPI::EdgeScope::getLastStepMeanSpeed
double getLastStepMeanSpeed(const std::string &edgeID) const
Definition: TraCIAPI.cpp:730
TraCIAPI::VehicleTypeScope::setHeight
void setHeight(const std::string &typeID, double height) const
Definition: TraCIAPI.cpp:2280
TraCIAPI::PersonScope::appendWalkingStage
void appendWalkingStage(const std::string &personID, const std::vector< std::string > &edges, double arrivalPos, double duration=-1, double speed=-1, const std::string &stopID="")
Definition: TraCIAPI.cpp:3512
TraCIAPI::VehicleScope::getHCEmission
double getHCEmission(const std::string &vehicleID) const
Definition: TraCIAPI.cpp:2530
libsumo::TRACI_ID_LIST
TRACI_CONST int TRACI_ID_LIST
Definition: TraCIConstants.h:498
TraCIAPI::LaneScope::getTraveltime
double getTraveltime(const std::string &laneID) const
Definition: TraCIAPI.cpp:1188
libsumo::CMD_CHANGELANE
TRACI_CONST int CMD_CHANGELANE
Definition: TraCIConstants.h:67
TraCIAPI::TraCIScopeWrapper::myParent
TraCIAPI & myParent
The parent TraCI client which offers the connection.
Definition: TraCIAPI.h:144
TraCIAPI::InductionLoopScope::getLastStepVehicleNumber
int getLastStepVehicleNumber(const std::string &loopID) const
Definition: TraCIAPI.cpp:940
TraCIAPI::InductionLoopScope::getPosition
double getPosition(const std::string &loopID) const
Definition: TraCIAPI.cpp:930
libsumo::VAR_ARRIVED_VEHICLES_NUMBER
TRACI_CONST int VAR_ARRIVED_VEHICLES_NUMBER
Definition: TraCIConstants.h:876
TraCIAPI::LaneScope::getMaxSpeed
double getMaxSpeed(const std::string &laneID) const
Definition: TraCIAPI.cpp:1048
libsumo::TraCIVehicleData::id
std::string id
The id of the vehicle.
Definition: TraCIDefs.h:288
TraCIAPI::VehicleScope::getAccel
double getAccel(const std::string &vehicleID) const
Definition: TraCIAPI.cpp:2711
TraCIAPI::JunctionScope::getShape
libsumo::TraCIPositionVector getShape(const std::string &junctionID) const
Definition: TraCIAPI.cpp:1024
TraCIAPI::VehicleTypeScope::getMinGap
double getMinGap(const std::string &typeID) const
Definition: TraCIAPI.cpp:2174
libsumo::TraCIColor::r
int r
Definition: TraCIDefs.h:143
TraCIAPI::VehicleTypeScope::setDecel
void setDecel(const std::string &typeID, double decel) const
Definition: TraCIAPI.cpp:2353
TraCIAPI::multientryexit
MeMeScope multientryexit
Scope for interaction with multi-entry/-exit detectors.
Definition: TraCIAPI.h:946
TraCIAPI::TrafficLightScope::getCompleteRedYellowGreenDefinition
std::vector< libsumo::TraCILogic > getCompleteRedYellowGreenDefinition(const std::string &tlsID) const
Definition: TraCIAPI.cpp:1889
libsumo::TraCIBestLanesData::laneID
std::string laneID
The id of the lane.
Definition: TraCIDefs.h:330
TraCIAPI::RouteScope::getEdges
std::vector< std::string > getEdges(const std::string &routeID) const
Definition: TraCIAPI.cpp:1606
TraCIAPI::InductionLoopScope::getTimeSinceDetection
double getTimeSinceDetection(const std::string &loopID) const
Definition: TraCIAPI.cpp:965
libsumo::POSITION_ROADMAP
TRACI_CONST int POSITION_ROADMAP
Definition: TraCIConstants.h:320
TraCIAPI::InductionLoopScope::getLastStepVehicleIDs
std::vector< std::string > getLastStepVehicleIDs(const std::string &loopID) const
Definition: TraCIAPI.cpp:950
TraCIAPI::VehicleScope::setVia
void setVia(const std::string &vehicleID, const std::vector< std::string > &via) const
Definition: TraCIAPI.cpp:3138
TraCIAPI::VehicleScope::getCOEmission
double getCOEmission(const std::string &vehicleID) const
Definition: TraCIAPI.cpp:2525
libsumo::TraCIPhase::minDur
double minDur
Definition: TraCIDefs.h:219
TraCIAPI::VehicleScope::getWidth
double getWidth(const std::string &vehicleID) const
Definition: TraCIAPI.cpp:2751
tcpip::Storage::reset
void reset()
TraCIAPI::LaneScope::getCOEmission
double getCOEmission(const std::string &laneID) const
Definition: TraCIAPI.cpp:1138
libsumo::DISTANCE_REQUEST
TRACI_CONST int DISTANCE_REQUEST
Definition: TraCIConstants.h:955
TraCIAPI::VehicleScope::getSignals
int getSignals(const std::string &vehicleID) const
Definition: TraCIAPI.cpp:2510
TraCIAPI::LaneScope::getLastStepMeanSpeed
double getLastStepMeanSpeed(const std::string &laneID) const
Definition: TraCIAPI.cpp:1173
TraCIAPI::simulation
SimulationScope simulation
Scope for interaction with the simulation.
Definition: TraCIAPI.h:956
libsumo::TraCIPhase::duration
double duration
Definition: TraCIDefs.h:217
TraCIAPI::VehicleScope::setShapeClass
void setShapeClass(const std::string &vehicleID, const std::string &clazz) const
Definition: TraCIAPI.cpp:3168
TraCIAPI.h
TraCIAPI::VehicleTypeScope::getDecel
double getDecel(const std::string &typeID) const
Definition: TraCIAPI.cpp:2134
TraCIAPI::SimulationScope::getDepartedIDList
std::vector< std::string > getDepartedIDList() const
Definition: TraCIAPI.cpp:1650
libsumo::ID_COUNT
TRACI_CONST int ID_COUNT
Definition: TraCIConstants.h:501
libsumo::VAR_SPEED_FACTOR
TRACI_CONST int VAR_SPEED_FACTOR
Definition: TraCIConstants.h:729
libsumo::RESPONSE_SUBSCRIBE_JUNCTION_VARIABLE
TRACI_CONST int RESPONSE_SUBSCRIBE_JUNCTION_VARIABLE
Definition: TraCIConstants.h:232
libsumo::VAR_LINE
TRACI_CONST int VAR_LINE
Definition: TraCIConstants.h:775
libsumo::VAR_SPEED_DEVIATION
TRACI_CONST int VAR_SPEED_DEVIATION
Definition: TraCIConstants.h:732
TraCIAPI::VehicleScope::getSpeedFactor
double getSpeedFactor(const std::string &vehicleID) const
Definition: TraCIAPI.cpp:2731
TraCIAPI::VehicleScope::getAngle
double getAngle(const std::string &vehicleID) const
Definition: TraCIAPI.cpp:2454
TraCIAPI::VehicleScope::getBestLanes
std::vector< libsumo::TraCIBestLanesData > getBestLanes(const std::string &vehicleID) const
Definition: TraCIAPI.cpp:2626
libsumo::CMD_SLOWDOWN
TRACI_CONST int CMD_SLOWDOWN
Definition: TraCIConstants.h:70
libsumo::TraCIStage::depart
double depart
intended depart time for public transport ride or INVALID_DOUBLE_VALUE
Definition: TraCIDefs.h:367
libsumo::TraCIPhase::next
std::vector< int > next
Definition: TraCIDefs.h:220
TraCIAPI::TrafficLightScope::getPhaseDuration
double getPhaseDuration(const std::string &tlsID) const
Definition: TraCIAPI.cpp:1990
libsumo::VAR_LENGTH
TRACI_CONST int VAR_LENGTH
Definition: TraCIConstants.h:627
TraCIAPI::PersonScope::getNextEdge
std::string getNextEdge(const std::string &personID) const
Definition: TraCIAPI.cpp:3390
TraCIAPI::VehicleScope::getLateralLanePosition
double getLateralLanePosition(const std::string &vehicleID) const
Definition: TraCIAPI.cpp:2515
TraCIAPI::getUnsignedByte
int getUnsignedByte(int cmd, int var, const std::string &id, tcpip::Storage *add=0)
Definition: TraCIAPI.cpp:354
TraCIAPI::VehicleScope::slowDown
void slowDown(const std::string &vehicleID, double speed, double duration) const
Definition: TraCIAPI.cpp:3012
TraCIAPI::VehicleScope::setStop
void setStop(const std::string vehicleID, const std::string edgeID, const double endPos=1., const int laneIndex=0, const double duration=std::numeric_limits< double >::max(), const int flags=0, const double startPos=std::numeric_limits< int >::min(), const double until=-1) const
Definition: TraCIAPI.cpp:3066
TraCIAPI::SimulationScope::getCurrentTime
int getCurrentTime() const
Definition: TraCIAPI.cpp:1625
TraCIAPI::PolygonScope::getColor
libsumo::TraCIColor getColor(const std::string &polygonID) const
Definition: TraCIAPI.cpp:1506
TraCIAPI::PersonScope::getColor
libsumo::TraCIColor getColor(const std::string &personID) const
Definition: TraCIAPI.cpp:3365
libsumo::CMD_MESSAGE
TRACI_CONST int CMD_MESSAGE
Definition: TraCIConstants.h:840
libsumo::TraCIException
Definition: TraCIDefs.h:89
libsumo::RESPONSE_SUBSCRIBE_MULTIENTRYEXIT_VARIABLE
TRACI_CONST int RESPONSE_SUBSCRIBE_MULTIENTRYEXIT_VARIABLE
Definition: TraCIConstants.h:112
TraCIAPI::PolygonScope::setLineWidth
void setLineWidth(const std::string &polygonID, const double lineWidth) const
Definition: TraCIAPI.cpp:1511
TraCIAPI::GUIScope::trackVehicle
void trackVehicle(const std::string &viewID, const std::string &vehID) const
Definition: TraCIAPI.cpp:912
libsumo::VAR_DISTANCE
TRACI_CONST int VAR_DISTANCE
Definition: TraCIConstants.h:958
libsumo::VAR_EMERGENCY_DECEL
TRACI_CONST int VAR_EMERGENCY_DECEL
Definition: TraCIConstants.h:639
libsumo::RESPONSE_SUBSCRIBE_LANE_VARIABLE
TRACI_CONST int RESPONSE_SUBSCRIBE_LANE_VARIABLE
Definition: TraCIConstants.h:142
TraCIAPI::VehicleScope::getWaitingTime
double getWaitingTime(const std::string &vehicleID) const
Definition: TraCIAPI.cpp:2560
TraCIAPI::EdgeScope::adaptTraveltime
void adaptTraveltime(const std::string &edgeID, double time, double beginSeconds=0., double endSeconds=std::numeric_limits< double >::max()) const
Definition: TraCIAPI.cpp:778
TraCIAPI::TrafficLightScope::getControlledLanes
std::vector< std::string > getControlledLanes(const std::string &tlsID) const
Definition: TraCIAPI.cpp:1942
TraCIAPI::myOutput
tcpip::Storage myOutput
The reusable output storage.
Definition: TraCIAPI.h:1059
libsumo::LANE_EDGE_ID
TRACI_CONST int LANE_EDGE_ID
Definition: TraCIConstants.h:591
libsumo::TYPE_STRINGLIST
TRACI_CONST int TYPE_STRINGLIST
Definition: TraCIConstants.h:339
tcpip::SocketException
Definition: socket.h:53
TraCIAPI::POIScope::setColor
void setColor(const std::string &poiID, const libsumo::TraCIColor &c) const
Definition: TraCIAPI.cpp:1385
TraCIAPI::VehicleTypeScope::getVehicleClass
std::string getVehicleClass(const std::string &typeID) const
Definition: TraCIAPI.cpp:2159
TraCIAPI::VehicleScope::addSubscriptionFilterByteList
void addSubscriptionFilterByteList(int filterType, const std::vector< int > &vals) const
Definition: TraCIAPI.cpp:3309
TraCIAPI::TrafficLightScope::getPhaseName
std::string getPhaseName(const std::string &tlsID) const
Definition: TraCIAPI.cpp:1985
libsumo::VAR_EDGES
TRACI_CONST int VAR_EDGES
Definition: TraCIConstants.h:687
libsumo::TL_CURRENT_PROGRAM
TRACI_CONST int TL_CURRENT_PROGRAM
Definition: TraCIConstants.h:570
TraCIAPI::PersonScope::removeStage
void removeStage(const std::string &personID, int nextStageIndex) const
Definition: TraCIAPI.cpp:3550
TraCIAPI::SimulationScope::getArrivedIDList
std::vector< std::string > getArrivedIDList() const
Definition: TraCIAPI.cpp:1660
TraCIAPI::SimulationScope::convertRoad
libsumo::TraCIRoadPosition convertRoad(double x, double y, bool isGeo=false, const std::string &vClass="ignoring") const
Definition: TraCIAPI.cpp:1757
libsumo::TraCIVehicleData::length
double length
Length of the vehicle.
Definition: TraCIDefs.h:290
libsumo::RESPONSE_SUBSCRIBE_TL_VARIABLE
TRACI_CONST int RESPONSE_SUBSCRIBE_TL_VARIABLE
Definition: TraCIConstants.h:127
TraCIAPI::VehicleScope::changeSublane
void changeSublane(const std::string &vehicleID, double latDist) const
Definition: TraCIAPI.cpp:2927
TraCIAPI::PolygonScope::setColor
void setColor(const std::string &polygonID, const libsumo::TraCIColor &c) const
Definition: TraCIAPI.cpp:1549
tcpip::Storage::writeString
virtual void writeString(const std::string &s)
TraCIAPI::VehicleScope::getShapeClass
std::string getShapeClass(const std::string &vehicleID) const
Definition: TraCIAPI.cpp:2592
libsumo::TraCINextTLSData::id
std::string id
The id of the next tls.
Definition: TraCIDefs.h:302
TraCIAPI::POIScope::remove
void remove(const std::string &poiID, int layer=0) const
Definition: TraCIAPI.cpp:1467
libsumo::VAR_TYPE
TRACI_CONST int VAR_TYPE
Definition: TraCIConstants.h:672
TraCIAPI::LaneScope::getWidth
double getWidth(const std::string &laneID) const
Definition: TraCIAPI.cpp:1053
TraCIAPI::VehicleScope::getRouteID
std::string getRouteID(const std::string &vehicleID) const
Definition: TraCIAPI.cpp:2479
libsumo::TraCILogic::phases
std::vector< TraCIPhase > phases
Definition: TraCIDefs.h:248
TraCIAPI::VehicleTypeScope::setSpeedFactor
void setSpeedFactor(const std::string &typeID, double factor) const
Definition: TraCIAPI.cpp:2243
libsumo::CMD_GET_GUI_VARIABLE
TRACI_CONST int CMD_GET_GUI_VARIABLE
Definition: TraCIConstants.h:269
TraCIAPI::processGet
bool processGet(int command, int expectedType, bool ignoreCommandId=false)
Definition: TraCIAPI.cpp:329
libsumo::VAR_SHAPECLASS
TRACI_CONST int VAR_SHAPECLASS
Definition: TraCIConstants.h:660
libsumo::VAR_CO2EMISSION
TRACI_CONST int VAR_CO2EMISSION
Definition: TraCIConstants.h:784
TraCIAPI::check_commandGetResult
int check_commandGetResult(tcpip::Storage &inMsg, int command, int expectedType=-1, bool ignoreCommandId=false) const
Validates the result state of a command.
Definition: TraCIAPI.cpp:305
libsumo::TraCIPhase
Definition: TraCIDefs.h:207
TraCIAPI::SimulationScope::getTime
double getTime() const
Definition: TraCIAPI.cpp:1630
TraCIAPI::VehicleScope::getLine
std::string getLine(const std::string &vehicleID) const
Definition: TraCIAPI.cpp:2577
TraCIAPI::VehicleScope::getDistance
double getDistance(const std::string &vehicleID) const
Definition: TraCIAPI.cpp:2505
TraCIAPI::EdgeScope::getIDList
std::vector< std::string > getIDList() const
Definition: TraCIAPI.cpp:663
TraCIAPI::getByte
int getByte(int cmd, int var, const std::string &id, tcpip::Storage *add=0)
Definition: TraCIAPI.cpp:364
TraCIAPI::POIScope::getColor
libsumo::TraCIColor getColor(const std::string &poiID) const
Definition: TraCIAPI.cpp:1338
libsumo::CMD_GET_MULTIENTRYEXIT_VARIABLE
TRACI_CONST int CMD_GET_MULTIENTRYEXIT_VARIABLE
Definition: TraCIConstants.h:106
libsumo::VAR_LANEPOSITION_LAT
TRACI_CONST int VAR_LANEPOSITION_LAT
Definition: TraCIConstants.h:760
libsumo::RESPONSE_SUBSCRIBE_SIM_VARIABLE
TRACI_CONST int RESPONSE_SUBSCRIBE_SIM_VARIABLE
Definition: TraCIConstants.h:262
TraCIAPI::PersonScope::getRoadID
std::string getRoadID(const std::string &personID) const
Definition: TraCIAPI.cpp:3375
libsumo::LANE_LINK_NUMBER
TRACI_CONST int LANE_LINK_NUMBER
Definition: TraCIConstants.h:588
libsumo::TraCIStage::type
int type
The type of stage (walking, driving, ...)
Definition: TraCIDefs.h:349
TraCIAPI::VehicleTypeScope::getImperfection
double getImperfection(const std::string &typeID) const
Definition: TraCIAPI.cpp:2149
libsumo::FILTER_TYPE_DOWNSTREAM_DIST
TRACI_CONST int FILTER_TYPE_DOWNSTREAM_DIST
Definition: TraCIConstants.h:474
TraCIAPI::SimulationScope::getDistance2D
double getDistance2D(double x1, double y1, double x2, double y2, bool isGeo=false, bool isDriving=false)
Definition: TraCIAPI.cpp:1801
TraCIAPI::getDouble
double getDouble(int cmd, int var, const std::string &id, tcpip::Storage *add=0)
Definition: TraCIAPI.cpp:385
TraCIAPI::vehicle
VehicleScope vehicle
Scope for interaction with vehicles.
Definition: TraCIAPI.h:960
TraCIAPI::LaneScope::setLength
void setLength(const std::string &laneID, double length) const
Definition: TraCIAPI.cpp:1264
libsumo::LAST_STEP_PERSON_ID_LIST
TRACI_CONST int LAST_STEP_PERSON_ID_LIST
Definition: TraCIConstants.h:543
libsumo::LANE_ALLOWED
TRACI_CONST int LANE_ALLOWED
Definition: TraCIConstants.h:597
TraCIAPI::EdgeScope::setEffort
void setEffort(const std::string &edgeID, double effort, double beginSeconds=0., double endSeconds=std::numeric_limits< double >::max()) const
Definition: TraCIAPI.cpp:798
TraCIAPI::TraCIScopeWrapper::getModifiableContextSubscriptionResults
libsumo::SubscriptionResults & getModifiableContextSubscriptionResults(const std::string &objID)
Definition: TraCIAPI.cpp:3720
libsumo::POSITION_2D
TRACI_CONST int POSITION_2D
Definition: TraCIConstants.h:314
TraCIAPI::VehicleTypeScope::setMaxSpeedLat
void setMaxSpeedLat(const std::string &typeID, double speed) const
Definition: TraCIAPI.cpp:2308
libsumo::RESPONSE_SUBSCRIBE_POLYGON_VARIABLE
TRACI_CONST int RESPONSE_SUBSCRIBE_POLYGON_VARIABLE
Definition: TraCIConstants.h:217
TraCIAPI::GUIScope::getIDList
std::vector< std::string > getIDList() const
Definition: TraCIAPI.cpp:830
libsumo::CMD_OPENGAP
TRACI_CONST int CMD_OPENGAP
Definition: TraCIConstants.h:76
TraCIAPI::VehicleTypeScope::getApparentDecel
double getApparentDecel(const std::string &typeID) const
Definition: TraCIAPI.cpp:2144
TraCIAPI::LaneScope::getAllowed
std::vector< std::string > getAllowed(const std::string &laneID) const
Definition: TraCIAPI.cpp:1058
TraCIAPI::VehicleScope::getAccumulatedWaitingTime
double getAccumulatedWaitingTime(const std::string &vehicleID) const
Definition: TraCIAPI.cpp:2766
libsumo::CMD_GET_INDUCTIONLOOP_VARIABLE
TRACI_CONST int CMD_GET_INDUCTIONLOOP_VARIABLE
Definition: TraCIConstants.h:93
libsumo::LAST_STEP_MEAN_SPEED
TRACI_CONST int LAST_STEP_MEAN_SPEED
Definition: TraCIConstants.h:516
TraCIAPI::InductionLoopScope::getLastStepOccupancy
double getLastStepOccupancy(const std::string &loopID) const
Definition: TraCIAPI.cpp:955
TraCIAPI::VehicleScope::setSpeed
void setSpeed(const std::string &vehicleID, double speed) const
Definition: TraCIAPI.cpp:3048
TraCIAPI::VehicleTypeScope::setAccel
void setAccel(const std::string &typeID, double accel) const
Definition: TraCIAPI.cpp:2344
libsumo::TYPE_STRING
TRACI_CONST int TYPE_STRING
Definition: TraCIConstants.h:337
TraCIAPI::VehicleTypeScope::copy
void copy(const std::string &origTypeID, const std::string &newTypeID) const
Definition: TraCIAPI.cpp:2326
libsumo::VAR_EDGE_EFFORT
TRACI_CONST int VAR_EDGE_EFFORT
Definition: TraCIConstants.h:708
libsumo::TraCIStage::edges
std::vector< std::string > edges
The sequence of edges to travel.
Definition: TraCIDefs.h:357
libsumo::VAR_NEXT_TLS
TRACI_CONST int VAR_NEXT_TLS
Definition: TraCIConstants.h:831
TraCIAPI::VehicleScope::getLaneChangeState
std::pair< int, int > getLaneChangeState(const std::string &vehicleID, int direction) const
Definition: TraCIAPI.cpp:2683
libsumo::VAR_SPEED_LAT
TRACI_CONST int VAR_SPEED_LAT
Definition: TraCIConstants.h:612
TraCIAPI::TraCIScopeWrapper::clearSubscriptionResults
void clearSubscriptionResults()
Definition: TraCIAPI.cpp:3707
TraCIAPI::TrafficLightScope::setCompleteRedYellowGreenDefinition
void setCompleteRedYellowGreenDefinition(const std::string &tlsID, const libsumo::TraCILogic &logic) const
Definition: TraCIAPI.cpp:2055
TraCIAPI::EdgeScope::getLaneNumber
int getLaneNumber(const std::string &edgeID) const
Definition: TraCIAPI.cpp:766
TraCIAPI::VehicleScope::isRouteValid
bool isRouteValid(const std::string &vehicleID) const
Definition: TraCIAPI.cpp:2796
TraCIAPI::VehicleScope::addSubscriptionFilterEmpty
void addSubscriptionFilterEmpty(int filterType) const
Definition: TraCIAPI.cpp:3283
libsumo::TL_RED_YELLOW_GREEN_STATE
TRACI_CONST int TL_RED_YELLOW_GREEN_STATE
Definition: TraCIConstants.h:549
libsumo::VAR_TRACK_VEHICLE
TRACI_CONST int VAR_TRACK_VEHICLE
Definition: TraCIConstants.h:1015
TraCIAPI::EdgeScope::getAdaptedTraveltime
double getAdaptedTraveltime(const std::string &edgeID, double time) const
Definition: TraCIAPI.cpp:673
TraCIAPI::polygon
PolygonScope polygon
Scope for interaction with polygons.
Definition: TraCIAPI.h:952
TraCIAPI::VehicleScope::getIDCount
int getIDCount() const
Definition: TraCIAPI.cpp:2419
TraCIAPI::LaneScope::getIDCount
int getIDCount() const
Definition: TraCIAPI.cpp:1038
libsumo::VAR_LANEPOSITION
TRACI_CONST int VAR_LANEPOSITION
Definition: TraCIConstants.h:699
libsumo::VAR_POSITION3D
TRACI_CONST int VAR_POSITION3D
Definition: TraCIConstants.h:621
libsumo::VAR_ACCELERATION
TRACI_CONST int VAR_ACCELERATION
Definition: TraCIConstants.h:837
libsumo::VAR_DEPARTED_VEHICLES_NUMBER
TRACI_CONST int VAR_DEPARTED_VEHICLES_NUMBER
Definition: TraCIConstants.h:858
TraCIAPI::VehicleTypeScope::getEmissionClass
std::string getEmissionClass(const std::string &typeID) const
Definition: TraCIAPI.cpp:2164
TraCIAPI::SimulationScope::getLoadedNumber
int getLoadedNumber() const
Definition: TraCIAPI.cpp:1635
TraCIAPI::lanearea
LaneAreaScope lanearea
Scope for interaction with lanes.
Definition: TraCIAPI.h:944
libsumo::POSITION_CONVERSION
TRACI_CONST int POSITION_CONVERSION
Definition: TraCIConstants.h:952
TraCIAPI::InductionLoopScope::getLaneID
std::string getLaneID(const std::string &loopID) const
Definition: TraCIAPI.cpp:935
TraCIAPI::LaneScope::setDisallowed
void setDisallowed(const std::string &laneID, const std::vector< std::string > &disallowedClasses) const
Definition: TraCIAPI.cpp:1243
TraCIAPI::send_commandSimulationStep
void send_commandSimulationStep(double time) const
Sends a SimulationStep command.
Definition: TraCIAPI.cpp:123
TraCIAPI::VehicleTypeScope::setImperfection
void setImperfection(const std::string &typeID, double imperfection) const
Definition: TraCIAPI.cpp:2380
TraCIAPI::VehicleScope::getSpeedDeviation
double getSpeedDeviation(const std::string &vehicleID) const
Definition: TraCIAPI.cpp:2736
TraCIAPI::VehicleTypeScope::getShapeClass
std::string getShapeClass(const std::string &typeID) const
Definition: TraCIAPI.cpp:2169
TraCIAPI::TraCIAPI
TraCIAPI()
Constructor.
Definition: TraCIAPI.cpp:41
TraCIAPI::TrafficLightScope::setPhaseDuration
void setPhaseDuration(const std::string &tlsID, double phaseDuration) const
Definition: TraCIAPI.cpp:2046
libsumo::CMD_SET_EDGE_VARIABLE
TRACI_CONST int CMD_SET_EDGE_VARIABLE
Definition: TraCIConstants.h:243
libsumo::POSITION_LON_LAT_ALT
TRACI_CONST int POSITION_LON_LAT_ALT
Definition: TraCIConstants.h:316
TraCIAPI::LaneScope::getCO2Emission
double getCO2Emission(const std::string &laneID) const
Definition: TraCIAPI.cpp:1133
TraCIAPI::send_commandClose
void send_commandClose() const
Sends a Close command.
Definition: TraCIAPI.cpp:136
libsumo::VAR_DECEL
TRACI_CONST int VAR_DECEL
Definition: TraCIConstants.h:636
TraCIAPI::POIScope::setPosition
void setPosition(const std::string &poiID, double x, double y) const
Definition: TraCIAPI.cpp:1374
TraCIAPI::VehicleScope::getLaneID
std::string getLaneID(const std::string &vehicleID) const
Definition: TraCIAPI.cpp:2464
TraCIAPI::VehicleScope::setRouteID
void setRouteID(const std::string &vehicleID, const std::string &routeID) const
Definition: TraCIAPI.cpp:2937
libsumo::FILTER_TYPE_LANES
TRACI_CONST int FILTER_TYPE_LANES
Definition: TraCIConstants.h:468
libsumo::TYPE_UBYTE
TRACI_CONST int TYPE_UBYTE
Definition: TraCIConstants.h:329
TraCIAPI::getPosition
libsumo::TraCIPosition getPosition(int cmd, int var, const std::string &id, tcpip::Storage *add=0)
Definition: TraCIAPI.cpp:416
TraCIAPI::PolygonScope::getShape
libsumo::TraCIPositionVector getShape(const std::string &polygonID) const
Definition: TraCIAPI.cpp:1501
TraCIAPI::poi
POIScope poi
Scope for interaction with POIs.
Definition: TraCIAPI.h:950
libsumo::TraCIRoadPosition::pos
double pos
Definition: TraCIDefs.h:128
TraCIAPI::PersonScope::getLength
double getLength(const std::string &personID) const
Definition: TraCIAPI.cpp:3370
TraCIAPI::VehicleTypeScope::setTau
void setTau(const std::string &typeID, double tau) const
Definition: TraCIAPI.cpp:2389
TraCIAPI::VehicleScope::getTau
double getTau(const std::string &vehicleID) const
Definition: TraCIAPI.cpp:2721
TraCIAPI::TraCIScopeWrapper::getModifiableSubscriptionResults
libsumo::SubscriptionResults & getModifiableSubscriptionResults()
Definition: TraCIAPI.cpp:3714
tcpip::Storage::size
StorageType::size_type size() const
Definition: storage.h:117
TraCIAPI::VehicleScope::getPersonCapacity
int getPersonCapacity(const std::string &vehicleID) const
Definition: TraCIAPI.cpp:2781
TraCIAPI::EdgeScope::getLastStepVehicleNumber
int getLastStepVehicleNumber(const std::string &edgeID) const
Definition: TraCIAPI.cpp:750
TraCIAPI::PolygonScope::setShape
void setShape(const std::string &polygonID, const libsumo::TraCIPositionVector &shape) const
Definition: TraCIAPI.cpp:1530
libsumo::VAR_ELECTRICITYCONSUMPTION
TRACI_CONST int VAR_ELECTRICITYCONSUMPTION
Definition: TraCIConstants.h:849
libsumo::REQUEST_AIRDIST
TRACI_CONST int REQUEST_AIRDIST
Definition: TraCIConstants.h:373
libsumo::MOVE_TO_XY
TRACI_CONST int MOVE_TO_XY
Definition: TraCIConstants.h:747
libsumo::VAR_VIEW_OFFSET
TRACI_CONST int VAR_VIEW_OFFSET
Definition: TraCIConstants.h:1003
TraCIAPI::GUIScope::getZoom
double getZoom(const std::string &viewID=DEFAULT_VIEW) const
Definition: TraCIAPI.cpp:835
tcpip::Storage::readByte
virtual int readByte()
TraCIAPI::VehicleTypeScope::getSpeedFactor
double getSpeedFactor(const std::string &typeID) const
Definition: TraCIAPI.cpp:2119
libsumo::VAR_LOADED_VEHICLES_IDS
TRACI_CONST int VAR_LOADED_VEHICLES_IDS
Definition: TraCIConstants.h:855
libsumo::STAGE_DRIVING
TRACI_CONST int STAGE_DRIVING
Definition: TraCIConstants.h:402
TraCIAPI::VehicleScope::setRoute
void setRoute(const std::string &vehicleID, const std::vector< std::string > &edge) const
Definition: TraCIAPI.cpp:2947
TraCIAPI::VehicleScope::getMaxSpeedLat
double getMaxSpeedLat(const std::string &vehicleID) const
Definition: TraCIAPI.cpp:2801
TraCIAPI::VehicleScope::getAcceleration
double getAcceleration(const std::string &vehicleID) const
Definition: TraCIAPI.cpp:2434
libsumo::TraCINextTLSData
Definition: TraCIDefs.h:300
libsumo::TraCILogic::subParameter
std::map< std::string, std::string > subParameter
Definition: TraCIDefs.h:249
libsumo::TraCIRoadPosition
An edgeId, position and laneIndex.
Definition: TraCIDefs.h:121
TraCIAPI::SimulationScope::getLoadedIDList
std::vector< std::string > getLoadedIDList() const
Definition: TraCIAPI.cpp:1640
TraCIAPI::PersonScope::removeStages
void removeStages(const std::string &personID) const
Definition: TraCIAPI.cpp:3422
libsumo::VAR_HCEMISSION
TRACI_CONST int VAR_HCEMISSION
Definition: TraCIConstants.h:790
TraCIAPI::VehicleTypeScope::setLateralAlignment
void setLateralAlignment(const std::string &typeID, const std::string &latAlignment) const
Definition: TraCIAPI.cpp:2317
TraCIAPI::PersonScope::setColor
void setColor(const std::string &personID, const libsumo::TraCIColor &c) const
Definition: TraCIAPI.cpp:3617
TraCIAPI::VehicleScope::getVehicleClass
std::string getVehicleClass(const std::string &vehicleID) const
Definition: TraCIAPI.cpp:2741
TraCIAPI::EdgeScope::getLastStepLength
double getLastStepLength(const std::string &edgeID) const
Definition: TraCIAPI.cpp:740
TraCIAPI::VehicleScope::add
void add(const std::string &vehicleID, const std::string &routeID, const std::string &typeID="DEFAULT_VEHTYPE", std::string depart="-1", const std::string &departLane="first", const std::string &departPos="base", const std::string &departSpeed="0", const std::string &arrivalLane="current", const std::string &arrivalPos="max", const std::string &arrivalSpeed="current", const std::string &fromTaz="", const std::string &toTaz="", const std::string &line="", int personCapacity=0, int personNumber=0) const
Definition: TraCIAPI.cpp:2816
libsumo::VAR_IMPERFECTION
TRACI_CONST int VAR_IMPERFECTION
Definition: TraCIConstants.h:726
TraCIAPI::gui
GUIScope gui
Scope for interaction with the gui.
Definition: TraCIAPI.h:936
TraCIAPI::VehicleScope::getSpeedMode
int getSpeedMode(const std::string &vehicleID) const
Definition: TraCIAPI.cpp:2565
libsumo::VAR_ARRIVED_VEHICLES_IDS
TRACI_CONST int VAR_ARRIVED_VEHICLES_IDS
Definition: TraCIConstants.h:879
TraCIAPI::RouteScope::add
void add(const std::string &routeID, const std::vector< std::string > &edges) const
Definition: TraCIAPI.cpp:1612
TraCIAPI::VehicleTypeScope::setEmergencyDecel
void setEmergencyDecel(const std::string &typeID, double decel) const
Definition: TraCIAPI.cpp:2362
TraCIAPI::JunctionScope::getIDList
std::vector< std::string > getIDList() const
Definition: TraCIAPI.cpp:1008
libsumo::VAR_SPEED
TRACI_CONST int VAR_SPEED
Definition: TraCIConstants.h:609
TraCIAPI::EdgeScope::setMaxSpeed
void setMaxSpeed(const std::string &edgeID, double speed) const
Definition: TraCIAPI.cpp:817
libsumo::LAST_STEP_VEHICLE_NUMBER
TRACI_CONST int LAST_STEP_VEHICLE_NUMBER
Definition: TraCIConstants.h:513
TraCIAPI::PolygonScope::setType
void setType(const std::string &polygonID, const std::string &setType) const
Definition: TraCIAPI.cpp:1520
tcpip::Storage::writeDouble
virtual void writeDouble(double)
libsumo::TraCIPositionVector
std::vector< TraCIPosition > TraCIPositionVector
Definition: TraCIDefs.h:149
TraCIAPI::SimulationScope::findRoute
libsumo::TraCIStage findRoute(const std::string &fromEdge, const std::string &toEdge, const std::string &vType="", double pos=-1., int routingMode=0) const
Definition: TraCIAPI.cpp:1843
libsumo::VAR_APPARENT_DECEL
TRACI_CONST int VAR_APPARENT_DECEL
Definition: TraCIConstants.h:642
libsumo::LANE_LINKS
TRACI_CONST int LANE_LINKS
Definition: TraCIConstants.h:594
libsumo::TraCIBestLanesData::continuationLanes
std::vector< std::string > continuationLanes
The sequence of lanes that best allows continuing the route without lane change.
Definition: TraCIDefs.h:340
TraCIAPI::SimulationScope::convertGeo
libsumo::TraCIPosition convertGeo(double x, double y, bool fromGeo=false) const
Definition: TraCIAPI.cpp:1780
TraCIAPI::readVariableSubscription
void readVariableSubscription(int cmdId, tcpip::Storage &inMsg)
Definition: TraCIAPI.cpp:597
libsumo::TraCIStage::departPos
double departPos
position on the lane when starting the stage
Definition: TraCIDefs.h:369
TraCIAPI::EdgeScope::getTraveltime
double getTraveltime(const std::string &edgeID) const
Definition: TraCIAPI.cpp:745
libsumo::VAR_VIEW_BOUNDARY
TRACI_CONST int VAR_VIEW_BOUNDARY
Definition: TraCIConstants.h:1009
TraCIAPI::VehicleScope::getTypeID
std::string getTypeID(const std::string &vehicleID) const
Definition: TraCIAPI.cpp:2474
libsumo::VAR_MAXSPEED_LAT
TRACI_CONST int VAR_MAXSPEED_LAT
Definition: TraCIConstants.h:766
libsumo::TraCIPhase::name
std::string name
Definition: TraCIDefs.h:221
TraCIAPI::VehicleScope::getMinGapLat
double getMinGapLat(const std::string &vehicleID) const
Definition: TraCIAPI.cpp:2806
TraCIAPI::VehicleTypeScope::getIDList
std::vector< std::string > getIDList() const
Definition: TraCIAPI.cpp:2104
TraCIAPI::VehicleTypeScope::getLength
double getLength(const std::string &typeID) const
Definition: TraCIAPI.cpp:2109
libsumo::REQUEST_DRIVINGDIST
TRACI_CONST int REQUEST_DRIVINGDIST
Definition: TraCIConstants.h:375
TraCIAPI::TraCIScopeWrapper::getSubscriptionResults
const libsumo::TraCIResults getSubscriptionResults(const std::string &objID) const
Definition: TraCIAPI.cpp:3681
libsumo::TraCIStage::vType
std::string vType
The vehicle type when using a private car or bike.
Definition: TraCIDefs.h:351
libsumo::VAR_PERSON_CAPACITY
TRACI_CONST int VAR_PERSON_CAPACITY
Definition: TraCIConstants.h:808
TraCIAPI::VehicleTypeScope::getEmergencyDecel
double getEmergencyDecel(const std::string &typeID) const
Definition: TraCIAPI.cpp:2139
libsumo::LAST_STEP_OCCUPANCY
TRACI_CONST int LAST_STEP_OCCUPANCY
Definition: TraCIConstants.h:522
libsumo::TraCIStage::destStop
std::string destStop
The id of the destination stop.
Definition: TraCIDefs.h:355
TraCIAPI::LaneScope::getLinkNumber
int getLinkNumber(const std::string &laneID) const
Definition: TraCIAPI.cpp:1068
libsumo::LAST_STEP_TIME_SINCE_DETECTION
TRACI_CONST int LAST_STEP_TIME_SINCE_DETECTION
Definition: TraCIConstants.h:531
libsumo::VAR_IMAGEFILE
TRACI_CONST int VAR_IMAGEFILE
Definition: TraCIConstants.h:696
libsumo::CMD_SET_ROUTE_VARIABLE
TRACI_CONST int CMD_SET_ROUTE_VARIABLE
Definition: TraCIConstants.h:183
tcpip::Socket::sendExact
void sendExact(const Storage &)
Definition: socket.cpp:435
TraCIAPI::PersonScope::appendWaitingStage
void appendWaitingStage(const std::string &personID, double duration, const std::string &description="waiting", const std::string &stopID="")
Definition: TraCIAPI.cpp:3495
libsumo::RESPONSE_SUBSCRIBE_INDUCTIONLOOP_VARIABLE
TRACI_CONST int RESPONSE_SUBSCRIBE_INDUCTIONLOOP_VARIABLE
Definition: TraCIConstants.h:99
TraCIAPI::LaneScope::getIDList
std::vector< std::string > getIDList() const
Definition: TraCIAPI.cpp:1033
TraCIAPI::LaneScope::getElectricityConsumption
double getElectricityConsumption(const std::string &laneID) const
Definition: TraCIAPI.cpp:1168
libsumo::TL_COMPLETE_DEFINITION_RYG
TRACI_CONST int TL_COMPLETE_DEFINITION_RYG
Definition: TraCIConstants.h:576
TraCIAPI::EdgeScope::getCOEmission
double getCOEmission(const std::string &edgeID) const
Definition: TraCIAPI.cpp:695
libsumo::CMD_LOAD
TRACI_CONST int CMD_LOAD
Definition: TraCIConstants.h:49
TraCIAPI::VehicleScope::getPMxEmission
double getPMxEmission(const std::string &vehicleID) const
Definition: TraCIAPI.cpp:2535
TraCIAPI::PersonScope::getSlope
double getSlope(const std::string &personID) const
Definition: TraCIAPI.cpp:3355
TraCIAPI::InductionLoopScope::getLastStepMeanLength
double getLastStepMeanLength(const std::string &loopID) const
Definition: TraCIAPI.cpp:960
libsumo::COPY
TRACI_CONST int COPY
Definition: TraCIConstants.h:949
TraCIAPI::PolygonScope::getLineWidth
double getLineWidth(const std::string &polygonID) const
Definition: TraCIAPI.cpp:1491
TraCIAPI::VehicleTypeScope::setApparentDecel
void setApparentDecel(const std::string &typeID, double decel) const
Definition: TraCIAPI.cpp:2371
TraCIAPI::SimulationScope::getBusStopWaiting
int getBusStopWaiting(const std::string &stopID) const
Definition: TraCIAPI.cpp:1701
libsumo::CMD_GET_EDGE_VARIABLE
TRACI_CONST int CMD_GET_EDGE_VARIABLE
Definition: TraCIConstants.h:239
TraCIAPI::VehicleScope::getPersonIDList
std::vector< std::string > getPersonIDList(const std::string &vehicleID) const
Definition: TraCIAPI.cpp:2786
TraCIAPI::PersonScope::setSpeed
void setSpeed(const std::string &personID, double speed) const
Definition: TraCIAPI.cpp:3560
TraCIAPI::POIScope::getWidth
double getWidth(const std::string &poiID) const
Definition: TraCIAPI.cpp:1343
TraCIAPI::POIScope::getIDList
std::vector< std::string > getIDList() const
Definition: TraCIAPI.cpp:1318
libsumo::VAR_LANE_INDEX
TRACI_CONST int VAR_LANE_INDEX
Definition: TraCIConstants.h:681
TraCIAPI::PersonScope::add
void add(const std::string &personID, const std::string &edgeID, double pos, double depart=libsumo::DEPARTFLAG_NOW, const std::string typeID="DEFAULT_PEDTYPE")
Definition: TraCIAPI.cpp:3442
TraCIAPI::TraCIScopeWrapper::getAllSubscriptionResults
const libsumo::SubscriptionResults getAllSubscriptionResults() const
Definition: TraCIAPI.cpp:3675
libsumo::REMOVE_STAGE
TRACI_CONST int REMOVE_STAGE
Definition: TraCIConstants.h:997
TraCIAPI::myInput
tcpip::Storage myInput
The reusable input storage.
Definition: TraCIAPI.h:1061
TraCIAPI::TrafficLightScope::getServedPersonCount
int getServedPersonCount(const std::string &tlsID, int index) const
Definition: TraCIAPI.cpp:2001
TraCIAPI::TrafficLightScope::setProgram
void setProgram(const std::string &tlsID, const std::string &programID) const
Definition: TraCIAPI.cpp:2037
TraCIAPI::LaneScope::getNoiseEmission
double getNoiseEmission(const std::string &laneID) const
Definition: TraCIAPI.cpp:1163
libsumo::VAR_SCREENSHOT
TRACI_CONST int VAR_SCREENSHOT
Definition: TraCIConstants.h:1012
TraCIAPI::mySocket
tcpip::Socket * mySocket
The socket.
Definition: TraCIAPI.h:1057
TraCIAPI::TraCIScopeWrapper::subscribeContext
void subscribeContext(const std::string &objID, int domain, double range, const std::vector< int > &vars, double beginTime, double endTime) const
Definition: TraCIAPI.cpp:3665
libsumo::RTYPE_NOTIMPLEMENTED
TRACI_CONST int RTYPE_NOTIMPLEMENTED
Definition: TraCIConstants.h:354
TraCIAPI::VehicleScope::getNextTLS
std::vector< libsumo::TraCINextTLSData > getNextTLS(const std::string &vehID) const
Definition: TraCIAPI.cpp:2597
TraCIAPI::check_resultState
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:266
TraCIAPI::connect
void connect(const std::string &host, int port)
Connects to the specified SUMO server.
Definition: TraCIAPI.cpp:74
TraCIAPI::PersonScope::appendStage
void appendStage(const std::string &personID, const libsumo::TraCIStage &stage)
Definition: TraCIAPI.cpp:3459
TraCIAPI::VehicleScope::getFuelConsumption
double getFuelConsumption(const std::string &vehicleID) const
Definition: TraCIAPI.cpp:2545
tcpip::Storage
Definition: storage.h:36
libsumo::VAR_MIN_EXPECTED_VEHICLES
TRACI_CONST int VAR_MIN_EXPECTED_VEHICLES
Definition: TraCIConstants.h:888
TraCIAPI::PersonScope::getRemainingStages
int getRemainingStages(const std::string &personID) const
Definition: TraCIAPI.cpp:3401
libsumo::LAST_STEP_LENGTH
TRACI_CONST int LAST_STEP_LENGTH
Definition: TraCIConstants.h:528
libsumo::SubscriptionResults
std::map< std::string, TraCIResults > SubscriptionResults
{object->{variable->value}}
Definition: TraCIDefs.h:203
TraCIAPI::PersonScope::getTypeID
std::string getTypeID(const std::string &personID) const
Definition: TraCIAPI.cpp:3380
libsumo::TraCIRoadPosition::laneIndex
int laneIndex
Definition: TraCIDefs.h:129
libsumo::TraCIStage::cost
double cost
effort needed
Definition: TraCIDefs.h:361
TraCIAPI::SimulationScope::getDeltaT
double getDeltaT() const
Definition: TraCIAPI.cpp:1685
libsumo::VAR_STAGE
TRACI_CONST int VAR_STAGE
Definition: TraCIConstants.h:979
TraCIAPI::PersonScope::getPosition3D
libsumo::TraCIPosition getPosition3D(const std::string &personID) const
Definition: TraCIAPI.cpp:3345
TraCIAPI::VehicleTypeScope::getAccel
double getAccel(const std::string &typeID) const
Definition: TraCIAPI.cpp:2129
TraCIAPI::PersonScope::getSpeed
double getSpeed(const std::string &personID) const
Definition: TraCIAPI.cpp:3335
TraCIAPI::EdgeScope::getEffort
double getEffort(const std::string &edgeID, double time) const
Definition: TraCIAPI.cpp:681
libsumo::CMD_REROUTE_TRAVELTIME
TRACI_CONST int CMD_REROUTE_TRAVELTIME
Definition: TraCIConstants.h:970
libsumo::VAR_ROUTING_MODE
TRACI_CONST int VAR_ROUTING_MODE
Definition: TraCIConstants.h:735
tcpip::Socket::receiveExact
bool receiveExact(Storage &)
Receive a complete TraCI message from Socket::socket_.
Definition: socket.cpp:532
TraCIAPI::VehicleScope::addSubscriptionFilterVClass
void addSubscriptionFilterVClass(const std::vector< std::string > &vClasses) const
Definition: TraCIAPI.cpp:3266
libsumo::CMD_SIMSTEP
TRACI_CONST int CMD_SIMSTEP
Definition: TraCIConstants.h:52
libsumo::TraCIVehicleData::entryTime
double entryTime
Entry-time of the vehicle in [s].
Definition: TraCIDefs.h:292
TraCIAPI::VehicleScope::openGap
void openGap(const std::string &vehicleID, double newTau, double duration, double changeRate, double maxDecel) const
Definition: TraCIAPI.cpp:3025
TraCIAPI::vehicletype
VehicleTypeScope vehicletype
Scope for interaction with vehicle types.
Definition: TraCIAPI.h:962
TraCIAPI::getString
std::string getString(int cmd, int var, const std::string &id, tcpip::Storage *add=0)
Definition: TraCIAPI.cpp:442
TraCIAPI::edge
EdgeScope edge
Scope for interaction with edges.
Definition: TraCIAPI.h:934
libsumo::CMD_GET_JUNCTION_VARIABLE
TRACI_CONST int CMD_GET_JUNCTION_VARIABLE
Definition: TraCIConstants.h:224
TraCIAPI::VehicleScope::getDecel
double getDecel(const std::string &vehicleID) const
Definition: TraCIAPI.cpp:2716
TraCIAPI::VehicleScope::getRoutingMode
int getRoutingMode(const std::string &vehicleID) const
Definition: TraCIAPI.cpp:2706
TraCIAPI::GUIScope::setBoundary
void setBoundary(const std::string &viewID, double xmin, double ymin, double xmax, double ymax) const
Definition: TraCIAPI.cpp:884
TraCIAPI::POIScope::getAngle
double getAngle(const std::string &poiID) const
Definition: TraCIAPI.cpp:1353
TraCIAPI::LaneScope::setMaxSpeed
void setMaxSpeed(const std::string &laneID, double speed) const
Definition: TraCIAPI.cpp:1255
libsumo::CMD_GET_ROUTE_VARIABLE
TRACI_CONST int CMD_GET_ROUTE_VARIABLE
Definition: TraCIConstants.h:179
libsumo::TraCIPosition::y
double y
Definition: TraCIDefs.h:115
TraCIAPI::TrafficLightScope::getIDCount
int getIDCount() const
Definition: TraCIAPI.cpp:1879
libsumo::TYPE_COMPOUND
TRACI_CONST int TYPE_COMPOUND
Definition: TraCIConstants.h:341
libsumo::VAR_ROUTE
TRACI_CONST int VAR_ROUTE
Definition: TraCIConstants.h:702
TraCIAPI::VehicleScope::getColor
libsumo::TraCIColor getColor(const std::string &vehicleID) const
Definition: TraCIAPI.cpp:2495
TraCIAPI::PersonScope::getEdges
std::vector< std::string > getEdges(const std::string &personID, int nextStageIndex=0) const
Definition: TraCIAPI.cpp:3414