Eclipse SUMO - Simulation of Urban MObility
TraCIServerAPI_TrafficLight.cpp
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3// Copyright (C) 2009-2022 German Aerospace Center (DLR) and others.
4// This program and the accompanying materials are made available under the
5// terms of the Eclipse Public License 2.0 which is available at
6// https://www.eclipse.org/legal/epl-2.0/
7// This Source Code may also be made available under the following Secondary
8// Licenses when the conditions for such availability set forth in the Eclipse
9// Public License 2.0 are satisfied: GNU General Public License, version 2
10// or later which is available at
11// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13/****************************************************************************/
21// APIs for getting/setting traffic light values via TraCI
22/****************************************************************************/
23#include <config.h>
24
25#include <microsim/MSLane.h>
26#include <microsim/MSEdge.h>
33
34
35// ===========================================================================
36// method definitions
37// ===========================================================================
38bool
40 tcpip::Storage& outputStorage) {
41 const int variable = inputStorage.readUnsignedByte();
42 const std::string id = inputStorage.readString();
44 try {
45 if (!libsumo::TrafficLight::handleVariable(id, variable, &server, &inputStorage)) {
46 switch (variable) {
48 std::vector<libsumo::TraCILogic> logics = libsumo::TrafficLight::getAllProgramLogics(id);
49 tcpip::Storage& storage = server.getWrapperStorage();
50 StoHelp::writeCompound(storage, (int)logics.size());
51 for (const libsumo::TraCILogic& logic : logics) {
52 StoHelp::writeCompound(storage, 5);
53 StoHelp::writeTypedString(storage, logic.programID);
54 StoHelp::writeTypedInt(storage, logic.type);
55 StoHelp::writeTypedInt(storage, logic.currentPhaseIndex);
56 StoHelp::writeCompound(storage, (int)logic.phases.size());
57 for (const std::shared_ptr<libsumo::TraCIPhase>& phase : logic.phases) {
58 StoHelp::writeCompound(storage, 6);
59 StoHelp::writeTypedDouble(storage, phase->duration);
60 StoHelp::writeTypedString(storage, phase->state);
61 StoHelp::writeTypedDouble(storage, phase->minDur);
62 StoHelp::writeTypedDouble(storage, phase->maxDur);
63 StoHelp::writeCompound(storage, (int)phase->next.size());
64 for (int n : phase->next) {
65 StoHelp::writeTypedInt(storage, n);
66 }
67 StoHelp::writeTypedString(storage, phase->name);
68 }
69 StoHelp::writeCompound(storage, (int)logic.subParameter.size());
70 for (const auto& item : logic.subParameter) {
71 StoHelp::writeTypedStringList(storage, std::vector<std::string> {item.first, item.second});
72 }
73 }
74 break;
75 }
77 const std::vector<std::vector<libsumo::TraCILink> > links = libsumo::TrafficLight::getControlledLinks(id);
79 tcpip::Storage tempContent;
81 tempContent.writeInt((int)links.size());
82 int cnt = 1;
83 for (const std::vector<libsumo::TraCILink>& sublinks : links) {
85 tempContent.writeInt((int)sublinks.size());
86 ++cnt;
87 for (const libsumo::TraCILink& link : sublinks) {
89 tempContent.writeStringList(std::vector<std::string>({ link.fromLane, link.toLane, link.viaLane }));
90 ++cnt;
91 }
92 }
93 server.getWrapperStorage().writeInt(cnt);
94 server.getWrapperStorage().writeStorage(tempContent);
95 break;
96 }
98 int index = 0;
99 if (!server.readTypeCheckingInt(inputStorage, index)) {
100 return server.writeErrorStatusCmd(libsumo::CMD_SET_TL_VARIABLE, "The phase index must be given as an integer.", outputStorage);
101 }
103 server.getWrapperStorage().writeInt(libsumo::TrafficLight::getServedPersonCount(id, index));
104 break;
105 }
107 int index = 0;
108 if (!server.readTypeCheckingInt(inputStorage, index)) {
109 return server.writeErrorStatusCmd(libsumo::CMD_SET_TL_VARIABLE, "The link index must be given as an integer.", outputStorage);
110 }
112 server.getWrapperStorage().writeStringList(libsumo::TrafficLight::getBlockingVehicles(id, index));
113 break;
114 }
116 int index = 0;
117 if (!server.readTypeCheckingInt(inputStorage, index)) {
118 return server.writeErrorStatusCmd(libsumo::CMD_SET_TL_VARIABLE, "The link index must be given as an integer.", outputStorage);
119 }
121 server.getWrapperStorage().writeStringList(libsumo::TrafficLight::getRivalVehicles(id, index));
122 break;
123 }
125 int index = 0;
126 if (!server.readTypeCheckingInt(inputStorage, index)) {
127 return server.writeErrorStatusCmd(libsumo::CMD_SET_TL_VARIABLE, "The link index must be given as an integer.", outputStorage);
128 }
130 server.getWrapperStorage().writeStringList(libsumo::TrafficLight::getPriorityVehicles(id, index));
131 break;
132 }
134 std::string tripId;
135 if (!server.readTypeCheckingString(inputStorage, tripId)) {
136 return server.writeErrorStatusCmd(libsumo::CMD_SET_TL_VARIABLE, "The tripId must be given as a string.", outputStorage);
137 }
138 std::vector<libsumo::TraCISignalConstraint> constraints = libsumo::TrafficLight::getConstraints(id, tripId);
140 const int cnt = 1 + (int)constraints.size() * 5;
141 server.getWrapperStorage().writeInt(cnt);
143 server.getWrapperStorage().writeInt((int)constraints.size());
144 for (const auto& c : constraints) {
145 writeConstraint(server, c);
146 }
147 break;
148 }
150 std::string foeId;
151 if (!server.readTypeCheckingString(inputStorage, foeId)) {
152 return server.writeErrorStatusCmd(libsumo::CMD_SET_TL_VARIABLE, "The foeId must be given as a string.", outputStorage);
153 }
154 std::vector<libsumo::TraCISignalConstraint> constraints = libsumo::TrafficLight::getConstraintsByFoe(id, foeId);
156 const int cnt = 1 + (int)constraints.size() * 5;
157 server.getWrapperStorage().writeInt(cnt);
159 server.getWrapperStorage().writeInt((int)constraints.size());
160 for (const auto& c : constraints) {
161 writeConstraint(server, c);
162 }
163 break;
164 }
166 if (inputStorage.readUnsignedByte() != libsumo::TYPE_COMPOUND) {
167 return server.writeErrorStatusCmd(libsumo::CMD_SET_TL_VARIABLE, "A compound object is needed for swapping constraints.", outputStorage);
168 }
169 //read itemNo
170 inputStorage.readInt();
171 std::string tripId;
172 if (!server.readTypeCheckingString(inputStorage, tripId)) {
173 return server.writeErrorStatusCmd(libsumo::CMD_SET_TL_VARIABLE, "The tripId must be given as a string.", outputStorage);
174 }
175 std::string foeSignal;
176 if (!server.readTypeCheckingString(inputStorage, foeSignal)) {
177 return server.writeErrorStatusCmd(libsumo::CMD_SET_TL_VARIABLE, "The foeSignal id must be given as a string.", outputStorage);
178 }
179 std::string foeId;
180 if (!server.readTypeCheckingString(inputStorage, foeId)) {
181 return server.writeErrorStatusCmd(libsumo::CMD_SET_TL_VARIABLE, "The foe tripId must be given as a string.", outputStorage);
182 }
183 std::vector<libsumo::TraCISignalConstraint> constraints = libsumo::TrafficLight::swapConstraints(id, tripId, foeSignal, foeId);
185 const int cnt = 1 + (int)constraints.size() * 5;
186 server.getWrapperStorage().writeInt(cnt);
188 server.getWrapperStorage().writeInt((int)constraints.size());
189 for (const auto& c : constraints) {
190 writeConstraint(server, c);
191 }
192 break;
193 }
195 if (!MSNet::getInstance()->getTLSControl().knows(id)) {
196 throw libsumo::TraCIException("Traffic light '" + id + "' is not known");
197 }
199 const std::string& state = tls->getCurrentPhaseDef().getState();
200 const Parameterised::Map& params = tls->getParametersMap();
201 int num = 0;
202 for (Parameterised::Map::const_iterator i = params.begin(); i != params.end(); ++i) {
203 if ("connection:" == (*i).first.substr(0, 11)) {
204 ++num;
205 }
206 }
207
210 server.getWrapperStorage().writeInt(num * 2);
211 for (Parameterised::Map::const_iterator i = params.begin(); i != params.end(); ++i) {
212 if ("connection:" != (*i).first.substr(0, 11)) {
213 continue;
214 }
216 server.getWrapperStorage().writeString((*i).second); // foreign id
217 std::string connection = (*i).first.substr(11);
218 std::string from, to;
219 const std::string::size_type b = connection.find("->");
220 if (b == std::string::npos) {
221 from = connection;
222 } else {
223 from = connection.substr(0, b);
224 to = connection.substr(b + 2);
225 }
226 bool denotesEdge = from.find("_") == std::string::npos;
227 MSLane* fromLane = nullptr;
229 MSTrafficLightLogic::LaneVectorVector::const_iterator j = lanes.begin();
230 for (; j != lanes.end() && fromLane == nullptr;) {
231 for (MSTrafficLightLogic::LaneVector::const_iterator k = (*j).begin(); k != (*j).end() && fromLane == nullptr;) {
232 if (denotesEdge && (*k)->getEdge().getID() == from) {
233 fromLane = *k;
234 } else if (!denotesEdge && (*k)->getID() == from) {
235 fromLane = *k;
236 }
237 if (fromLane == nullptr) {
238 ++k;
239 }
240 }
241 if (fromLane == nullptr) {
242 ++j;
243 }
244 }
245 if (fromLane == nullptr) {
246 return server.writeErrorStatusCmd(libsumo::CMD_GET_TL_VARIABLE, "Could not find edge or lane '" + from + "' in traffic light '" + id + "'.", outputStorage);
247 }
248 int pos = (int)std::distance(lanes.begin(), j);
250 server.getWrapperStorage().writeUnsignedByte(state[pos]); // state
251 }
252 break;
253 }
254 default:
255 return server.writeErrorStatusCmd(libsumo::CMD_GET_TL_VARIABLE, "Get TLS Variable: unsupported variable " + toHex(variable, 2) + " specified", outputStorage);
256 }
257 }
258 } catch (libsumo::TraCIException& e) {
259 return server.writeErrorStatusCmd(libsumo::CMD_GET_TL_VARIABLE, e.what(), outputStorage);
260 }
262 server.writeResponseWithLength(outputStorage, server.getWrapperStorage());
263 return true;
264}
265
266
267bool
269 tcpip::Storage& outputStorage) {
270 std::string warning = ""; // additional description for response
271 // variable
272 const int variable = inputStorage.readUnsignedByte();
273 if (variable != libsumo::TL_PHASE_INDEX && variable != libsumo::TL_PROGRAM && variable != libsumo::TL_PHASE_DURATION
275 && variable != libsumo::VAR_NAME
276 && variable != libsumo::TL_CONSTRAINT_REMOVE
277 && variable != libsumo::TL_CONSTRAINT_UPDATE
278 && variable != libsumo::VAR_PARAMETER) {
279 return server.writeErrorStatusCmd(libsumo::CMD_SET_TL_VARIABLE, "Change TLS State: unsupported variable " + toHex(variable, 2) + " specified", outputStorage);
280 }
281 const std::string id = inputStorage.readString();
282 try {
283 switch (variable) {
285 int index = 0;
286 if (!server.readTypeCheckingInt(inputStorage, index)) {
287 return server.writeErrorStatusCmd(libsumo::CMD_SET_TL_VARIABLE, "The phase index must be given as an integer.", outputStorage);
288 }
289 libsumo::TrafficLight::setPhase(id, index);
290 }
291 break;
292 case libsumo::VAR_NAME: {
293 std::string name;
294 if (!server.readTypeCheckingString(inputStorage, name)) {
295 return server.writeErrorStatusCmd(libsumo::CMD_SET_TL_VARIABLE, "The phase name must be given as a string.", outputStorage);
296 }
297 libsumo::TrafficLight::setPhaseName(id, name);
298 }
299 break;
300 case libsumo::TL_PROGRAM: {
301 std::string subID;
302 if (!server.readTypeCheckingString(inputStorage, subID)) {
303 return server.writeErrorStatusCmd(libsumo::CMD_SET_TL_VARIABLE, "The program must be given as a string.", outputStorage);
304 }
305 libsumo::TrafficLight::setProgram(id, subID);
306 }
307 break;
309 double duration = 0.;
310 if (!server.readTypeCheckingDouble(inputStorage, duration)) {
311 return server.writeErrorStatusCmd(libsumo::CMD_SET_TL_VARIABLE, "The phase duration must be given as a double.", outputStorage);
312 }
313 libsumo::TrafficLight::setPhaseDuration(id, duration);
314 }
315 break;
317 std::string state;
318 if (!server.readTypeCheckingString(inputStorage, state)) {
319 return server.writeErrorStatusCmd(libsumo::CMD_SET_TL_VARIABLE, "The phase must be given as a string.", outputStorage);
320 }
321 libsumo::TrafficLight::setRedYellowGreenState(id, state);
322 }
323 break;
325 if (inputStorage.readUnsignedByte() != libsumo::TYPE_COMPOUND) {
326 return server.writeErrorStatusCmd(libsumo::CMD_SET_TL_VARIABLE, "A compound object is needed for setting a new program.", outputStorage);
327 }
328 //read itemNo
329 inputStorage.readInt();
331 if (!server.readTypeCheckingString(inputStorage, logic.programID)) {
332 return server.writeErrorStatusCmd(libsumo::CMD_SET_TL_VARIABLE, "set program: 1. parameter (programID) must be a string.", outputStorage);
333 }
334 if (!server.readTypeCheckingInt(inputStorage, logic.type)) {
335 return server.writeErrorStatusCmd(libsumo::CMD_SET_TL_VARIABLE, "set program: 2. parameter (type) must be an int.", outputStorage);
336 }
337 if (!server.readTypeCheckingInt(inputStorage, logic.currentPhaseIndex)) {
338 return server.writeErrorStatusCmd(libsumo::CMD_SET_TL_VARIABLE, "set program: 3. parameter (index) must be an int.", outputStorage);
339 }
340 if (inputStorage.readUnsignedByte() != libsumo::TYPE_COMPOUND) {
341 return server.writeErrorStatusCmd(libsumo::CMD_SET_TL_VARIABLE, "A compound object is needed for the phases.", outputStorage);
342 }
343 const int numPhases = inputStorage.readInt();
344 for (int j = 0; j < numPhases; ++j) {
345 if (inputStorage.readUnsignedByte() != libsumo::TYPE_COMPOUND) {
346 return server.writeErrorStatusCmd(libsumo::CMD_SET_TL_VARIABLE, "A compound object is needed for every phase.", outputStorage);
347 }
348 const int items = inputStorage.readInt();
349 if (items != 6 && items != 5) {
350 return server.writeErrorStatusCmd(libsumo::CMD_SET_TL_VARIABLE, "A phase compound object requires 5 or 6 items.", outputStorage);
351 }
352 double duration = 0., minDuration = 0., maxDuration = 0.;
353 std::vector<int> next;
354 std::string name;
355 if (!server.readTypeCheckingDouble(inputStorage, duration)) {
356 return server.writeErrorStatusCmd(libsumo::CMD_SET_TL_VARIABLE, "set program: 4.1. parameter (duration) must be a double.", outputStorage);
357 }
358 std::string state;
359 if (!server.readTypeCheckingString(inputStorage, state)) {
360 return server.writeErrorStatusCmd(libsumo::CMD_SET_TL_VARIABLE, "set program: 4.2. parameter (phase) must be a string.", outputStorage);
361 }
362 if (!server.readTypeCheckingDouble(inputStorage, minDuration)) {
363 return server.writeErrorStatusCmd(libsumo::CMD_SET_TL_VARIABLE, "set program: 4.3. parameter (min duration) must be a double.", outputStorage);
364 }
365 if (!server.readTypeCheckingDouble(inputStorage, maxDuration)) {
366 return server.writeErrorStatusCmd(libsumo::CMD_SET_TL_VARIABLE, "set program: 4.4. parameter (max duration) must be a double.", outputStorage);
367 }
368 if (inputStorage.readUnsignedByte() != libsumo::TYPE_COMPOUND) {
369 return server.writeErrorStatusCmd(libsumo::CMD_SET_TL_VARIABLE, "set program 4.5 parameter (next) must be a compound (list of ints).", outputStorage);
370 }
371 const int numNext = inputStorage.readInt();
372 for (int k = 0; k < numNext; k++) {
373 int nextEntry;
374 if (!server.readTypeCheckingInt(inputStorage, nextEntry)) {
375 return server.writeErrorStatusCmd(libsumo::CMD_SET_TL_VARIABLE, "set program: 4.5. parameter (next) must be a list of int.", outputStorage);
376 }
377 next.push_back(nextEntry);
378 }
379 if (items == 6) {
380 if (!server.readTypeCheckingString(inputStorage, name)) {
381 return server.writeErrorStatusCmd(libsumo::CMD_SET_TL_VARIABLE, "set program: 4.6. parameter (name) must be a string.", outputStorage);
382 }
383 }
384 logic.phases.emplace_back(new libsumo::TraCIPhase(duration, state, minDuration, maxDuration, next, name));
385 }
386 if (inputStorage.readUnsignedByte() != libsumo::TYPE_COMPOUND) {
387 return server.writeErrorStatusCmd(libsumo::CMD_SET_TL_VARIABLE, "set program: 5. parameter (subparams) must be a compound object.", outputStorage);
388 }
389 const int numParams = inputStorage.readInt();
390 for (int j = 0; j < numParams; j++) {
391 std::vector<std::string> par;
392 server.readTypeCheckingStringList(inputStorage, par);
393 logic.subParameter[par[0]] = par[1];
394 }
395 libsumo::TrafficLight::setCompleteRedYellowGreenDefinition(id, logic);
396 }
397 break;
399 if (inputStorage.readUnsignedByte() != libsumo::TYPE_COMPOUND) {
400 return server.writeErrorStatusCmd(libsumo::CMD_SET_TL_VARIABLE, "A compound object is needed for removing constraints.", outputStorage);
401 }
402 //read itemNo
403 inputStorage.readInt();
404 std::string tripId;
405 if (!server.readTypeCheckingString(inputStorage, tripId)) {
406 return server.writeErrorStatusCmd(libsumo::CMD_SET_TL_VARIABLE, "The tripId must be given as a string.", outputStorage);
407 }
408 std::string foeSignal;
409 if (!server.readTypeCheckingString(inputStorage, foeSignal)) {
410 return server.writeErrorStatusCmd(libsumo::CMD_SET_TL_VARIABLE, "The foeSignal id must be given as a string.", outputStorage);
411 }
412 std::string foeId;
413 if (!server.readTypeCheckingString(inputStorage, foeId)) {
414 return server.writeErrorStatusCmd(libsumo::CMD_SET_TL_VARIABLE, "The foe tripId must be given as a string.", outputStorage);
415 }
416 libsumo::TrafficLight::removeConstraints(id, tripId, foeSignal, foeId);
417 }
418 break;
420 std::string tripId;
421 if (!server.readTypeCheckingString(inputStorage, tripId)) {
422 return server.writeErrorStatusCmd(libsumo::CMD_SET_TL_VARIABLE, "The tripId index must be given as a string.", outputStorage);
423 }
424 libsumo::TrafficLight::updateConstraints(id, tripId);
425 }
426 break;
428 if (inputStorage.readUnsignedByte() != libsumo::TYPE_COMPOUND) {
429 return server.writeErrorStatusCmd(libsumo::CMD_SET_TL_VARIABLE, "A compound object is needed for setting a parameter.", outputStorage);
430 }
431 //read itemNo
432 inputStorage.readInt();
433 std::string name;
434 if (!server.readTypeCheckingString(inputStorage, name)) {
435 return server.writeErrorStatusCmd(libsumo::CMD_SET_TL_VARIABLE, "The name of the parameter must be given as a string.", outputStorage);
436 }
437 std::string value;
438 if (!server.readTypeCheckingString(inputStorage, value)) {
439 return server.writeErrorStatusCmd(libsumo::CMD_SET_TL_VARIABLE, "The value of the parameter must be given as a string.", outputStorage);
440 }
441 libsumo::TrafficLight::setParameter(id, name, value);
442 }
443 break;
444 default:
445 break;
446 }
447 } catch (libsumo::TraCIException& e) {
448 return server.writeErrorStatusCmd(libsumo::CMD_SET_TL_VARIABLE, e.what(), outputStorage);
449 }
450 server.writeStatusCmd(libsumo::CMD_SET_TL_VARIABLE, libsumo::RTYPE_OK, warning, outputStorage);
451 return true;
452}
453
454
455void
465 std::vector<std::string> paramItems;
466 for (auto item : c.param) {
467 paramItems.push_back(item.first);
468 paramItems.push_back(item.second);
469 }
471}
472
473
474/****************************************************************************/
std::string toHex(const T i, std::streamsize numDigits=0)
Definition: ToString.h:56
Representation of a lane in the micro simulation.
Definition: MSLane.h:84
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
Definition: MSNet.cpp:183
MSTLLogicControl & getTLSControl()
Returns the tls logics control.
Definition: MSNet.h:452
const std::string & getState() const
Returns the state within this phase.
MSTrafficLightLogic * getActive() const
TLSLogicVariants & get(const std::string &id) const
Returns the variants of a named tls.
The parent class for traffic light logics.
std::vector< LaneVector > LaneVectorVector
Definition of a list that holds lists of lanes that do have the same attribute.
virtual const MSPhaseDefinition & getCurrentPhaseDef() const =0
Returns the definition of the current phase.
const LaneVectorVector & getLaneVectors() const
Returns the list of lists of all lanes controlled by this tls.
std::map< std::string, std::string > Map
parameters map
Definition: Parameterised.h:45
const Parameterised::Map & getParametersMap() const
Returns the inner key/value map.
static bool processGet(TraCIServer &server, tcpip::Storage &inputStorage, tcpip::Storage &outputStorage)
Processes a get value command (Command 0xa2: Get Traffic Lights Variable)
static void writeConstraint(TraCIServer &server, const libsumo::TraCISignalConstraint &c)
static bool processSet(TraCIServer &server, tcpip::Storage &inputStorage, tcpip::Storage &outputStorage)
Processes a set value command (Command 0xc2: Change Traffic Lights State)
TraCI server used to control sumo by a remote TraCI client.
Definition: TraCIServer.h:59
void writeStatusCmd(int commandId, int status, const std::string &description, tcpip::Storage &outputStorage)
Writes a status command to the given storage.
bool readTypeCheckingString(tcpip::Storage &inputStorage, std::string &into)
Reads the value type and a string, verifying the type.
tcpip::Storage & getWrapperStorage()
void initWrapper(const int domainID, const int variable, const std::string &objID)
bool writeErrorStatusCmd(int commandId, const std::string &description, tcpip::Storage &outputStorage)
Writes a status command to the given storage with status = RTYPE_ERR.
bool readTypeCheckingInt(tcpip::Storage &inputStorage, int &into)
Reads the value type and an int, verifying the type.
bool readTypeCheckingStringList(tcpip::Storage &inputStorage, std::vector< std::string > &into)
Reads the value type and a string list, verifying the type.
bool readTypeCheckingDouble(tcpip::Storage &inputStorage, double &into)
Reads the value type and a double, verifying the type.
void writeResponseWithLength(tcpip::Storage &outputStorage, tcpip::Storage &tempMsg)
static void writeTypedDouble(tcpip::Storage &content, double value)
static void writeCompound(tcpip::Storage &content, int size)
static void writeTypedInt(tcpip::Storage &content, int value)
static void writeTypedStringList(tcpip::Storage &content, const std::vector< std::string > &value)
static void writeTypedByte(tcpip::Storage &content, int value)
static void writeTypedString(tcpip::Storage &content, const std::string &value)
An error which allows to continue.
Definition: TraCIDefs.h:138
std::map< std::string, std::string > subParameter
Definition: TraCIDefs.h:341
std::string programID
Definition: TraCIDefs.h:337
std::vector< std::shared_ptr< libsumo::TraCIPhase > > phases
Definition: TraCIDefs.h:340
virtual std::string readString()
Definition: storage.cpp:180
virtual void writeString(const std::string &s)
Definition: storage.cpp:197
virtual void writeInt(int)
Definition: storage.cpp:321
virtual int readUnsignedByte()
Definition: storage.cpp:155
virtual void writeStringList(const std::vector< std::string > &s)
Definition: storage.cpp:247
virtual void writeUnsignedByte(int)
Definition: storage.cpp:165
StorageType::size_type size() const
Definition: storage.h:119
virtual void writeStorage(tcpip::Storage &store)
Definition: storage.cpp:388
virtual int readInt()
Definition: storage.cpp:311
TRACI_CONST int VAR_NAME
TRACI_CONST int CMD_GET_TL_VARIABLE
TRACI_CONST int TL_CONSTRAINT_REMOVE
TRACI_CONST int TL_BLOCKING_VEHICLES
TRACI_CONST int TL_CONSTRAINT_SWAP
TRACI_CONST int TL_PRIORITY_VEHICLES
TRACI_CONST int TYPE_COMPOUND
TRACI_CONST int TL_COMPLETE_DEFINITION_RYG
TRACI_CONST int TYPE_UBYTE
TRACI_CONST int VAR_PERSON_NUMBER
TRACI_CONST int TL_CONSTRAINT_UPDATE
TRACI_CONST int TL_EXTERNAL_STATE
TRACI_CONST int TYPE_STRINGLIST
TRACI_CONST int TL_CONTROLLED_LINKS
TRACI_CONST int TYPE_INTEGER
TRACI_CONST int VAR_PARAMETER
TRACI_CONST int TL_CONSTRAINT_BYFOE
TRACI_CONST int TL_CONSTRAINT
TRACI_CONST int TL_PROGRAM
TRACI_CONST int RESPONSE_GET_TL_VARIABLE
TRACI_CONST int TL_PHASE_DURATION
TRACI_CONST int TL_PHASE_INDEX
TRACI_CONST int TL_COMPLETE_PROGRAM_RYG
TRACI_CONST int CMD_SET_TL_VARIABLE
TRACI_CONST int TL_RED_YELLOW_GREEN_STATE
TRACI_CONST int RTYPE_OK
TRACI_CONST int TYPE_STRING
TRACI_CONST int TL_RIVAL_VEHICLES
std::string foeId
the tripId or vehicle id of the train that must pass first
Definition: TraCIDefs.h:618
std::string tripId
the tripId or vehicle id of the train that is constrained
Definition: TraCIDefs.h:616
std::string foeSignal
the tlsID of the rail signla that the foe must pass first
Definition: TraCIDefs.h:620
std::string signalId
the idea of the rail signal where this constraint is active
Definition: TraCIDefs.h:614
std::map< std::string, std::string > param
additional parameters
Definition: TraCIDefs.h:630
bool active
whether this constraint is active
Definition: TraCIDefs.h:628
int type
the type of constraint (predecessor:0, insertionPredecessor:1)
Definition: TraCIDefs.h:624
bool mustWait
whether tripId must still wait for foeId to pass foeSignal
Definition: TraCIDefs.h:626
int limit
the number of trains that must be recorded at the foeSignal
Definition: TraCIDefs.h:622