42 const std::string
id = inputStorage.
readString();
45 if (!libsumo::TrafficLight::handleVariable(
id, variable, &server, &inputStorage)) {
57 std::string foeSignal;
84 std::string warning =
"";
96 const std::string
id = inputStorage.
readString();
100 libsumo::TrafficLight::setPhase(
id,
StoHelp::readTypedInt(inputStorage,
"The phase index must be given as an integer."));
108 libsumo::TrafficLight::setPhaseName(
id, name);
116 libsumo::TrafficLight::setProgram(
id, subID);
120 double duration = 0.;
124 libsumo::TrafficLight::setPhaseDuration(
id, duration);
132 libsumo::TrafficLight::setRedYellowGreenState(
id, state);
150 const int numPhases = inputStorage.
readInt();
151 for (
int j = 0; j < numPhases; ++j) {
155 const int items = inputStorage.
readInt();
156 if (items != 6 && items != 5) {
159 double duration = 0., minDuration = 0., maxDuration = 0.;
160 std::vector<int> next;
178 const int numNext = inputStorage.
readInt();
179 for (
int k = 0; k < numNext; k++) {
180 next.push_back(
StoHelp::readTypedInt(inputStorage,
"set program: 4.5. parameter (next) must be a list of int."));
192 const int numParams = inputStorage.
readInt();
193 for (
int j = 0; j < numParams; j++) {
194 std::vector<std::string> par;
198 libsumo::TrafficLight::setCompleteRedYellowGreenDefinition(
id, logic);
211 std::string foeSignal;
219 libsumo::TrafficLight::removeConstraints(
id, tripId, foeSignal, foeId);
227 libsumo::TrafficLight::updateConstraints(
id, tripId);
240 std::string foeSignal;
250 libsumo::TrafficLight::addConstraint(
id, tripId, foeSignal, foeId, type, limit);
267 libsumo::TrafficLight::setParameter(
id, name,
value);
291 std::vector<std::string> paramItems;
292 for (
auto item : c.
param) {
293 paramItems.push_back(item.first);
294 paramItems.push_back(item.second);
const std::string invalid_return< std::string >::value
std::string toHex(const T i, std::streamsize numDigits=0)
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.
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 wrapSignalConstraintVector(const std::string &objID, const int variable, const std::vector< libsumo::TraCISignalConstraint > &value)
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 int readTypedInt(tcpip::Storage &ret, const std::string &error="")
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.
virtual std::string readString()
virtual int readUnsignedByte()
TRACI_CONST int CMD_GET_TL_VARIABLE
TRACI_CONST int TL_CONSTRAINT_REMOVE
TRACI_CONST int TL_CONSTRAINT_SWAP
TRACI_CONST int TYPE_COMPOUND
TRACI_CONST int TL_CONSTRAINT_UPDATE
TRACI_CONST int VAR_PARAMETER
TRACI_CONST int TL_PROGRAM
TRACI_CONST int RESPONSE_GET_TL_VARIABLE
TRACI_CONST int TL_PHASE_DURATION
TRACI_CONST int TL_CONSTRAINT_ADD
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
std::map< std::string, std::string > subParameter
std::vector< std::shared_ptr< libsumo::TraCIPhase > > phases
std::string foeId
the tripId or vehicle id of the train that must pass first
std::string tripId
the tripId or vehicle id of the train that is constrained
std::string foeSignal
the tlsID of the rail signla that the foe must pass first
std::string signalId
the idea of the rail signal where this constraint is active
std::map< std::string, std::string > param
additional parameters
bool active
whether this constraint is active
int type
the type of constraint (predecessor:0, insertionPredecessor:1)
bool mustWait
whether tripId must still wait for foeId to pass foeSignal
int limit
the number of trains that must be recorded at the foeSignal