LCOV - code coverage report
Current view: top level - src/utils/traci - TraCIAPI.cpp (source / functions) Coverage Total Hit
Test: lcov.info Lines: 63.3 % 2374 1503
Test Date: 2026-10-12 15:53:19 Functions: 52.7 % 408 215

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

Generated by: LCOV version 2.0-1