35 #ifdef CHECK_MEMORY_LEAKS
37 #endif // CHECK_MEMORY_LEAKS
47 #pragma warning(disable: 4355)
50 : edge(*this), gui(*this), inductionloop(*this),
51 junction(*this), lane(*this), multientryexit(*this), poi(*this),
52 polygon(*this), route(*this), simulation(*this), trafficlights(*this),
56 #pragma warning(default: 4355)
120 unsigned int length = 1 + 1 + 1 + 4 + (
int) objID.length();
163 const std::vector<int>& vars)
const {
171 outMsg.
writeInt(5 + 1 + 4 + 4 + 4 + (
int) objID.length() + 1 + varNo);
181 for (
int i = 0; i < varNo; ++i) {
191 int domain,
SUMOReal range,
const std::vector<int>& vars)
const {
199 outMsg.
writeInt(5 + 1 + 4 + 4 + 4 + (
int) objID.length() + 1 + 8 + 1 + varNo);
212 for (
int i = 0; i < varNo; ++i) {
234 if (command != cmdId && !ignoreCommandId) {
239 }
catch (std::invalid_argument&) {
242 switch (resultType) {
248 if (acknowledgement != 0) {
249 (*acknowledgement) =
".. Command acknowledged (" +
toString(command) +
"), [description: " + msg +
"]";
255 if ((cmdStart + cmdLength) != (
int) inMsg.
position()) {
269 if (!ignoreCommandId && cmdId != (command + 0x10)) {
272 if (expectedType >= 0) {
274 if (valueDataType != expectedType) {
365 unsigned int size = inMsg.
readInt();
367 for (
unsigned int i = 0; i < size; ++i) {
400 std::vector<std::string>
405 unsigned int size = inMsg.
readInt();
406 std::vector<std::string> r;
407 for (
unsigned int i = 0; i < size; ++i) {
432 std::vector<std::string>
521 std::vector<std::string>
555 std::vector<std::string>
635 std::vector<std::string>
660 std::vector<std::string>
691 std::vector<std::string>
707 std::vector<std::string>
727 std::vector<std::string>
732 std::vector<std::string>
817 std::vector<std::string>
827 content.
writeInt((
int)allowedClasses.size());
828 for (
unsigned int i = 0; i < allowedClasses.size(); ++i) {
838 content.
writeInt((
int)disallowedClasses.size());
839 for (
unsigned int i = 0; i < disallowedClasses.size(); ++i) {
866 std::vector<std::string>
881 std::vector<std::string>
896 std::vector<std::string>
978 std::vector<std::string>
1011 content.
writeInt((
int)shape.size());
1012 for (
unsigned int i = 0; i < shape.size(); ++i) {
1043 int f = fill ? 1 : 0;
1048 content.
writeInt((
int)shape.size());
1049 for (
unsigned int i = 0; i < shape.size(); ++i) {
1069 std::vector<std::string>
1074 std::vector<std::string>
1105 std::vector<std::string>
1115 std::vector<std::string>
1125 std::vector<std::string>
1135 std::vector<std::string>
1145 std::vector<std::string>
1170 std::vector<std::string>
1180 std::vector<TraCIAPI::TraCILogic>
1185 std::vector<TraCIAPI::TraCILogic> ret;
1186 int logicNo = inMsg.
readInt();
1187 for (
int i = 0; i < logicNo; ++i) {
1195 int phaseIndex = inMsg.
readInt();
1197 int phaseNumber = inMsg.
readInt();
1198 std::vector<TraCIAPI::TraCIPhase> phases;
1199 for (
int j = 0; j < phaseNumber; ++j) {
1201 int duration = inMsg.
readInt();
1203 int duration1 = inMsg.
readInt();
1205 int duration2 = inMsg.
readInt();
1210 ret.push_back(
TraCIAPI::TraCILogic(subID, type, std::map<std::string, SUMOReal>(), phaseIndex, phases));
1215 std::vector<std::string>
1220 std::vector<TraCIAPI::TraCILink>
1225 std::vector<TraCIAPI::TraCILink> ret;
1227 for (
int i = 0; i < linkNo; ++i) {
1283 content.
writeInt(
int(1000 * phaseDuration));
1302 for (
int i = 0; i < (
int) logic.
phases.size(); ++i) {
1322 std::vector<std::string>
std::vector< std::string > getIDList() const
SUMOReal getImperfection(const std::string &typeID) const
#define LAST_STEP_MEAN_SPEED
TraCIPosition getPosition(int cmd, int var, const std::string &id, tcpip::Storage *add=0)
std::vector< std::string > getIDList() const
SUMOReal getMaxSpeed(const std::string &typeID) const
TraCIPosition getOffset(const std::string &viewID=DEFAULT_VIEW) const
void setLength(const std::string &typeID, SUMOReal length) const
#define VAR_EMISSIONCLASS
void setMaxSpeed(const std::string &edgeID, SUMOReal speed) const
SUMOReal getNoiseEmission(const std::string &laneID) const
tcpip::Socket * mySocket
The socket.
std::vector< std::string > getIDList() const
std::vector< std::string > getLoadedIDList() const
unsigned int getLastStepVehicleNumber(const std::string &loopID) const
void close()
Closes the connection.
void connect(const std::string &host, int port)
Connects to the specified SUMO server.
#define CMD_GET_TL_VARIABLE
std::vector< std::string > getArrivedIDList() const
std::vector< std::string > getIDList() const
unsigned int getLastStepVehicleNumber(const std::string &edgeID) const
#define VAR_CURRENT_TRAVELTIME
TraCIColor getColor(const std::string &poiID) const
void add(const std::string &poiID, SUMOReal x, SUMOReal y, const TraCIColor &c, const std::string &type, int layer) const
SUMOReal getLastStepMeanSpeed(const std::string &edgeID) const
std::vector< std::string > getDisallowed(const std::string &laneID) const
SUMOReal getCOEmission(const std::string &edgeID) const
void setShapeClass(const std::string &typeID, const std::string &clazz) const
void setPhase(const std::string &tlsID, unsigned int index) const
void setProgram(const std::string &tlsID, const std::string &programID) const
void setVehicleClass(const std::string &typeID, const std::string &clazz) const
bool receiveExact(Storage &)
Receive a complete TraCI message from Socket::socket_.
#define CMD_GET_INDUCTIONLOOP_VARIABLE
std::string getVehicleClass(const std::string &typeID) const
void setColor(const std::string &polygonID, const TraCIColor &c) const
SUMOReal getDouble(int cmd, int var, const std::string &id, tcpip::Storage *add=0)
#define LAST_STEP_VEHICLE_DATA
void send_commandClose() const
Sends a Close command.
virtual unsigned int position() const
void send_commandSubscribeObjectContext(int domID, const std::string &objID, int beginTime, int endTime, int domain, SUMOReal range, const std::vector< int > &vars) const
Sends a SubscribeContext request.
virtual double readDouble()
void setMaxSpeed(const std::string &typeID, SUMOReal speed) const
void setCompleteRedYellowGreenDefinition(const std::string &tlsID, const TraCIAPI::TraCILogic &logic) const
unsigned int currentPhaseIndex
std::string getEmissionClass(const std::string &typeID) const
void add(const std::string &polygonID, const TraCIPositionVector &shape, const TraCIColor &c, bool fill, const std::string &type, int layer) const
SUMOReal getLastStepMeanSpeed(const std::string &detID) const
void processGET(tcpip::Storage &inMsg, int command, int expectedType, bool ignoreCommandId=false) const
StorageType::size_type size() const
SUMOReal getPMxEmission(const std::string &laneID) const
SUMOReal getLastStepOccupancy(const std::string &edgeID) const
unsigned int getLastStepHaltingNumber(const std::string &detID) const
#define VAR_LOADED_VEHICLES_IDS
std::vector< std::string > getLastStepVehicleIDs(const std::string &loopID) const
TraCIPosition getPosition(const std::string &junctionID) const
void trackVehicle(const std::string &viewID, const std::string &vehID) const
std::vector< std::string > getIDList() const
SUMOTime getCurrentTime() const
SUMOReal getLength(const std::string &laneID) const
SUMOReal getLastStepMeanSpeed(const std::string &laneID) const
std::vector< std::string > getIDList() const
SUMOReal getMinGap(const std::string &typeID) const
#define VAR_TELEPORT_STARTING_VEHICLES_IDS
#define CMD_GET_POLYGON_VARIABLE
std::vector< std::string > getControlledLanes(const std::string &tlsID) const
SUMOReal getLastStepMeanLength(const std::string &loopID) const
void setAllowed(const std::string &laneID, const std::vector< std::string > &allowedClasses) const
virtual void writeUnsignedByte(int)
#define CMD_SET_EDGE_VARIABLE
#define CMD_SET_GUI_VARIABLE
SUMOReal getWidth(const std::string &typeID) const
TraCIPositionVector getPolygon(int cmd, int var, const std::string &id, tcpip::Storage *add=0)
SUMOReal getLastStepOccupancy(const std::string &laneID) const
std::string getProgram(const std::string &tlsID) const
#define VAR_LOADED_VEHICLES_NUMBER
#define VAR_SPEED_DEVIATION
#define VAR_NOISEEMISSION
std::vector< std::string > getIDList() const
#define VAR_FUELCONSUMPTION
#define CMD_GET_ROUTE_VARIABLE
TraCIBoundary getBoundingBox(int cmd, int var, const std::string &id, tcpip::Storage *add=0)
virtual void writeInt(int)
void setDisallowed(const std::string &laneID, const std::vector< std::string > &disallowedClasses) const
void setTau(const std::string &typeID, SUMOReal tau) const
SUMOReal getCO2Emission(const std::string &laneID) const
std::vector< std::string > getAllowed(const std::string &laneID) const
void setBoundary(const std::string &viewID, SUMOReal xmin, SUMOReal ymin, SUMOReal xmax, SUMOReal ymax) const
void setMaxSpeed(const std::string &laneID, SUMOReal speed) const
virtual int readUnsignedByte()
#define TL_PHASE_DURATION
void connect()
Connects to host_:port_.
unsigned int getIDCount() const
#define TL_CURRENT_PROGRAM
#define CMD_SET_TL_VARIABLE
#define CMD_GET_VEHICLETYPE_VARIABLE
void remove(const std::string &polygonID, int layer=0) const
void send_commandSimulationStep(SUMOTime time) const
Sends a SimulationStep command.
std::string getRedYellowGreenState(const std::string &tlsID) const
#define VAR_DEPARTED_VEHICLES_NUMBER
void adaptTraveltime(const std::string &edgeID, SUMOReal time) const
#define LAST_STEP_TIME_SINCE_DETECTION
#define CMD_SET_ROUTE_VARIABLE
#define VAR_MIN_EXPECTED_VEHICLES
#define VAR_VIEW_BOUNDARY
#define VAR_TRACK_VEHICLE
void setDecel(const std::string &typeID, SUMOReal decel) const
void setLength(const std::string &laneID, SUMOReal length) const
SUMOTime getDeltaT() const
void setSchema(const std::string &viewID, const std::string &schemeName) const
TraCIColor getColor(const std::string &typeID) const
#define TL_COMPLETE_PROGRAM_RYG
std::string getType(const std::string &polygonID) const
SUMOReal getTraveltime(const std::string &laneID) const
void setType(const std::string &poiID, const std::string &setType) const
SUMOReal getNOxEmission(const std::string &laneID) const
#define VAR_NET_BOUNDING_BOX
void send_commandGetVariable(int domID, int varID, const std::string &objID, tcpip::Storage *add=0) const
Sends a GetVariable request.
TraCIColor getColor(int cmd, int var, const std::string &id, tcpip::Storage *add=0)
#define CMD_GET_POI_VARIABLE
std::vector< std::string > getIDList() const
void screenshot(const std::string &viewID, const std::string &filename) const
std::vector< std::string > getDepartedIDList() const
#define TL_COMPLETE_DEFINITION_RYG
#define VAR_TELEPORT_STARTING_VEHICLES_NUMBER
unsigned int getLastStepHaltingNumber(const std::string &laneID) const
#define CMD_SET_VEHICLETYPE_VARIABLE
std::vector< TraCIAPI::TraCILink > getControlledLinks(const std::string &tlsID) const
unsigned int getArrivedNumber() const
SUMOReal getHCEmission(const std::string &laneID) const
void setWidth(const std::string &typeID, SUMOReal width) const
void setEmissionClass(const std::string &typeID, const std::string &clazz) const
unsigned int getNextSwitch(const std::string &tlsID) const
TraCIPositionVector getShape(const std::string &polygonID) const
void setSpeedFactor(const std::string &typeID, SUMOReal factor) const
virtual void writeStringList(const std::vector< std::string > &s)
#define VAR_TELEPORT_ENDING_VEHICLES_IDS
#define CMD_GET_LANE_VARIABLE
std::vector< TraCIPhase > phases
int getInt(int cmd, int var, const std::string &id, tcpip::Storage *add=0)
SUMOReal getSpeedFactor(const std::string &typeID) const
std::vector< std::string > getIDList() const
SUMOReal getLastStepLength(const std::string &edgeID) const
void setRedYellowGreenState(const std::string &tlsID, const std::string &state) const
#define CMD_GET_SIM_VARIABLE
virtual std::string readString()
std::string getShapeClass(const std::string &typeID) const
#define CMD_GET_EDGE_VARIABLE
int getByte(int cmd, int var, const std::string &id, tcpip::Storage *add=0)
#define CMD_GET_GUI_VARIABLE
std::string getSchema(const std::string &viewID=DEFAULT_VIEW) const
SUMOReal getLastStepOccupancy(const std::string &loopID) const
#define VAR_DEPARTED_VEHICLES_IDS
#define CMD_SET_POI_VARIABLE
int getUnsignedByte(int cmd, int var, const std::string &id, tcpip::Storage *add=0)
void setMinGap(const std::string &typeID, SUMOReal minGap) const
TraCIColor getColor(const std::string &polygonID) const
SUMOReal getDecel(const std::string &typeID) const
void setPhaseDuration(const std::string &tlsID, unsigned int phaseDuration) const
std::vector< std::string > getEndingTeleportIDList() const
SUMOReal getPosition(const std::string &loopID) const
#define CMD_GET_JUNCTION_VARIABLE
TraCIBoundary getBoundary(const std::string &viewID=DEFAULT_VIEW) const
std::string toString(const T &t, std::streamsize accuracy=OUTPUT_ACCURACY)
SUMOReal getTimeSinceDetection(const std::string &loopID) const
void setOffset(const std::string &viewID, SUMOReal x, SUMOReal y) const
std::string getEdgeID(const std::string &laneID) const
unsigned int getEndingTeleportNumber() const
virtual void writeStorage(tcpip::Storage &store)
#define TL_CONTROLLED_LINKS
SUMOReal getMaxSpeed(const std::string &laneID) const
unsigned int getLastStepVehicleNumber(const std::string &laneID) const
SUMOReal getLastStepMeanSpeed(const std::string &loopID) const
void setAccel(const std::string &typeID, SUMOReal accel) const
void setImperfection(const std::string &typeID, SUMOReal imperfection) const
std::vector< std::string > getStringVector(int cmd, int var, const std::string &id, tcpip::Storage *add=0)
SUMOReal getCOEmission(const std::string &laneID) const
TraCIPosition getPosition(const std::string &poiID) const
#define TL_RED_YELLOW_GREEN_STATE
SUMOReal getFuelConsumption(const std::string &edgeID) const
throw SocketException("tcpip::Socket::recvAndCheck @ recv: peer shutdown")
#define LAST_STEP_VEHICLE_NUMBER
#define VAR_EDGE_TRAVELTIME
#define VAR_ARRIVED_VEHICLES_NUMBER
SUMOReal getZoom(const std::string &viewID=DEFAULT_VIEW) const
SUMOReal getWidth(const std::string &laneID) const
#define CMD_SET_POLYGON_VARIABLE
void send_commandSubscribeObjectVariable(int domID, const std::string &objID, int beginTime, int endTime, const std::vector< int > &vars) const
Sends a SubscribeVariable request.
std::vector< TraCIAPI::TraCILogic > getCompleteRedYellowGreenDefinition(const std::string &tlsID) const
virtual void writeString(const std::string &s)
#define RTYPE_NOTIMPLEMENTED
void setType(const std::string &polygonID, const std::string &setType) const
TraCIPositionVector getShape(const std::string &laneID) const
#define LAST_STEP_VEHICLE_ID_LIST
#define CMD_GET_MULTI_ENTRY_EXIT_DETECTOR_VARIABLE
void setEffort(const std::string &edgeID, SUMOReal effort) const
SUMOReal getEffort(const std::string &edgeID, SUMOTime time) const
SUMOTime getSUMOTime(int cmd, int var, const std::string &id, tcpip::Storage *add=0)
SUMOReal getHCEmission(const std::string &edgeID) const
std::vector< std::string > getLastStepVehicleIDs(const std::string &detID) const
unsigned int getDepartedNumber() const
void sendExact(const Storage &)
virtual float readFloat()
std::string getType(const std::string &poiID) const
#define CMD_SET_LANE_VARIABLE
std::string getLaneID(const std::string &loopID) const
std::vector< std::string > getIDList() const
void check_resultState(tcpip::Storage &inMsg, int command, bool ignoreCommandId=false, std::string *acknowledgement=0) const
Validates the result state of a command.
unsigned int getLinkNumber(const std::string &laneID) const
SUMOReal getNoiseEmission(const std::string &edgeID) const
SUMOReal getAccel(const std::string &typeID) const
SUMOReal getTraveltime(const std::string &edgeID) const
void setZoom(const std::string &viewID, SUMOReal zoom) const
TraCIAPI & myParent
The parent TraCI client which offers the connection.
std::vector< std::string > getLastStepVehicleIDs(const std::string &laneID) const
virtual void writeDouble(double)
#define VAR_TELEPORT_ENDING_VEHICLES_NUMBER
SUMOReal getLastStepLength(const std::string &laneID) const
void setShape(const std::string &polygonID, const TraCIPositionVector &shape) const
void setColor(const std::string &typeID, const TraCIColor &c) const
void send_commandSetValue(int domID, int varID, const std::string &objID, tcpip::Storage &content) const
Sends a SetVariable request.
unsigned int getStartingTeleportNumber() const
SUMOReal getPMxEmission(const std::string &edgeID) const
void setPosition(const std::string &poiID, SUMOReal x, SUMOReal y) const
SUMOReal getSpeedDeviation(const std::string &typeID) const
SUMOReal getCO2Emission(const std::string &edgeID) const
#define LAST_STEP_OCCUPANCY
unsigned int getLoadedNumber() const
#define TL_CONTROLLED_LANES
void check_commandGetResult(tcpip::Storage &inMsg, int command, int expectedType=-1, bool ignoreCommandId=false) const
std::string getString(int cmd, int var, const std::string &id, tcpip::Storage *add=0)
void setSpeedDeviation(const std::string &typeID, SUMOReal deviation) const
SUMOReal getNOxEmission(const std::string &edgeID) const
TraCIBoundary getNetBoundary() const
std::vector< TraCIPosition > TraCIPositionVector
unsigned int getMinExpectedNumber() const
SUMOReal getAdaptedTraveltime(const std::string &edgeID, SUMOTime time) const
std::vector< std::string > getEdges(const std::string &routeID) const
void remove(const std::string &poiID, int layer=0) const
SUMOReal getFloat(int cmd, int var, const std::string &id, tcpip::Storage *add=0)
unsigned int getVehicleData(const std::string &loopID) const
unsigned int getPhase(const std::string &tlsID) const
SUMOReal getLength(const std::string &typeID) const
SUMOReal getTau(const std::string &typeID) const
unsigned int getLastStepVehicleNumber(const std::string &detID) const
#define VAR_ARRIVED_VEHICLES_IDS
std::vector< std::string > getLastStepVehicleIDs(const std::string &edgeID) const
#define LAST_STEP_VEHICLE_HALTING_NUMBER
SUMOReal getFuelConsumption(const std::string &laneID) const
void setColor(const std::string &poiID, const TraCIColor &c) const
void add(const std::string &routeID, const std::vector< std::string > &edges) const
std::vector< std::string > getIDList() const
SUMOReal getLastStepHaltingNumber(const std::string &edgeID) const
std::vector< std::string > getStartingTeleportIDList() const