43 const std::string
id = inputStorage.
readString();
46 if (!libsumo::VehicleType::handleVariable(
id, variable, &server, &inputStorage)) {
48 "Get Vehicle Type Variable: unsupported variable " +
toHex(variable, 2)
49 +
" specified", outputStorage);
63 std::string warning =
"";
84 "Change Vehicle Type State: unsupported variable " +
toHex(variable, 2)
85 +
" specified", outputStorage);
117 return server.
writeErrorStatusCmd(cmd,
"Setting length requires a double.", outputStorage);
119 if (
value <= 0.0 || fabs(
value) == std::numeric_limits<double>::infinity()) {
122 libsumo::VehicleType::setLength(
id,
value);
128 return server.
writeErrorStatusCmd(cmd,
"Setting height requires a double.", outputStorage);
130 if (
value <= 0.0 || fabs(
value) == std::numeric_limits<double>::infinity()) {
133 libsumo::VehicleType::setHeight(
id,
value);
141 if (
value <= 0.0 || fabs(
value) == std::numeric_limits<double>::infinity()) {
144 libsumo::VehicleType::setMass(
id,
value);
150 return server.
writeErrorStatusCmd(cmd,
"Setting maximum speed requires a double.", outputStorage);
152 if (
value <= 0.0 || fabs(
value) == std::numeric_limits<double>::infinity()) {
155 libsumo::VehicleType::setMaxSpeed(
id,
value);
161 return server.
writeErrorStatusCmd(cmd,
"Setting vehicle class requires a string.", outputStorage);
164 libsumo::VehicleType::setVehicleClass(
id, vclass);
166 return server.
writeErrorStatusCmd(cmd,
"Unknown vehicle class '" + vclass +
"'.", outputStorage);
173 return server.
writeErrorStatusCmd(cmd,
"Setting speed factor requires a double.", outputStorage);
175 if (
value <= 0.0 || fabs(
value) == std::numeric_limits<double>::infinity()) {
178 libsumo::VehicleType::setSpeedFactor(
id,
value);
184 return server.
writeErrorStatusCmd(cmd,
"Setting speed deviation requires a double.", outputStorage);
186 if (
value < 0.0 || fabs(
value) == std::numeric_limits<double>::infinity()) {
189 libsumo::VehicleType::setSpeedDeviation(
id,
value);
195 return server.
writeErrorStatusCmd(cmd,
"Setting emission class requires a string.", outputStorage);
198 libsumo::VehicleType::setEmissionClass(
id, eclass);
209 if (
value <= 0.0 || fabs(
value) == std::numeric_limits<double>::infinity()) {
212 libsumo::VehicleType::setWidth(
id,
value);
218 return server.
writeErrorStatusCmd(cmd,
"Setting minimum gap requires a double.", outputStorage);
220 if (
value < 0.0 || fabs(
value) == std::numeric_limits<double>::infinity()) {
223 libsumo::VehicleType::setMinGap(
id,
value);
229 return server.
writeErrorStatusCmd(cmd,
"Setting minimum lateral gap requires a double.", outputStorage);
231 if (
value < 0.0 || fabs(
value) == std::numeric_limits<double>::infinity()) {
234 libsumo::VehicleType::setMinGapLat(
id,
value);
240 return server.
writeErrorStatusCmd(cmd,
"Setting maximum lateral speed requires a double.", outputStorage);
242 if (
value < 0.0 || fabs(
value) == std::numeric_limits<double>::infinity()) {
245 libsumo::VehicleType::setMaxSpeedLat(
id,
value);
249 std::string latAlign;
251 return server.
writeErrorStatusCmd(cmd,
"Setting preferred lateral alignment requires a string.",
255 libsumo::VehicleType::setLateralAlignment(
id, latAlign);
264 return server.
writeErrorStatusCmd(cmd,
"Setting vehicle shape requires a string.", outputStorage);
267 libsumo::VehicleType::setShapeClass(
id, sclass);
276 return server.
writeErrorStatusCmd(cmd,
"Setting acceleration requires a double.", outputStorage);
278 if (
value < 0.0 || fabs(
value) == std::numeric_limits<double>::infinity()) {
281 libsumo::VehicleType::setAccel(
id,
value);
287 return server.
writeErrorStatusCmd(cmd,
"Setting deceleration requires a double.", outputStorage);
289 if (
value < 0.0 || fabs(
value) == std::numeric_limits<double>::infinity()) {
292 libsumo::VehicleType::setDecel(
id,
value);
298 return server.
writeErrorStatusCmd(cmd,
"Setting deceleration requires a double.", outputStorage);
300 if (
value < 0.0 || fabs(
value) == std::numeric_limits<double>::infinity()) {
303 libsumo::VehicleType::setEmergencyDecel(
id,
value);
309 return server.
writeErrorStatusCmd(cmd,
"Setting deceleration requires a double.", outputStorage);
311 if (
value < 0.0 || fabs(
value) == std::numeric_limits<double>::infinity()) {
314 libsumo::VehicleType::setApparentDecel(
id,
value);
320 return server.
writeErrorStatusCmd(cmd,
"Setting traffic scale requires a double.", outputStorage);
323 return server.
writeErrorStatusCmd(cmd,
"Traffic scale may not be negative.", outputStorage);
325 libsumo::VehicleType::setScale(
id,
value);
333 if (fabs(
value) == std::numeric_limits<double>::infinity()) {
336 bool resetActionOffset =
value >= 0.0;
337 libsumo::VehicleType::setActionStepLength(
id, fabs(
value), resetActionOffset);
343 return server.
writeErrorStatusCmd(cmd,
"Setting driver imperfection requires a double.", outputStorage);
345 if (
value < 0.0 || fabs(
value) == std::numeric_limits<double>::infinity()) {
348 libsumo::VehicleType::setImperfection(
id,
value);
354 return server.
writeErrorStatusCmd(cmd,
"Setting headway time requires a double.", outputStorage);
356 if (
value < 0.0 || fabs(
value) == std::numeric_limits<double>::infinity()) {
359 libsumo::VehicleType::setTau(
id,
value);
365 return server.
writeErrorStatusCmd(cmd,
"Setting impatience requires a double.", outputStorage);
367 libsumo::VehicleType::setImpatience(
id,
value);
373 return server.
writeErrorStatusCmd(cmd,
"Setting boardingDuration requires a double.", outputStorage);
375 libsumo::VehicleType::setBoardingDuration(
id,
value);
381 return server.
writeErrorStatusCmd(cmd,
"The color must be given using the according type.", outputStorage);
383 libsumo::VehicleType::setColor(
id, col);
387 std::string newTypeID;
392 libsumo::VehicleType::copy(
id, newTypeID);
397 return server.
writeErrorStatusCmd(cmd,
"A compound object is needed for setting a parameter.",
404 return server.
writeErrorStatusCmd(cmd,
"The name of the parameter must be given as a string.",
409 return server.
writeErrorStatusCmd(cmd,
"The value of the parameter must be given as a string.",
412 libsumo::VehicleType::setParameter(
id, name,
value);
const std::string invalid_return< std::string >::value
std::string toHex(const T i, std::streamsize numDigits=0)
static bool processSet(TraCIServer &server, tcpip::Storage &inputStorage, tcpip::Storage &outputStorage)
Processes a set value command (Command 0xc5: Change Vehicle Type State).
static bool processGet(TraCIServer &server, tcpip::Storage &inputStorage, tcpip::Storage &outputStorage)
Processes a get value command (Command 0xa5: Get Vehicle Type Variable).
static bool setVariable(const int cmd, const int variable, const std::string &id, TraCIServer &server, tcpip::Storage &inputStorage, tcpip::Storage &outputStorage)
Processes a set value for the given type.
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 readTypeCheckingDouble(tcpip::Storage &inputStorage, double &into)
Reads the value type and a double, verifying the type.
void writeResponseWithLength(tcpip::Storage &outputStorage, tcpip::Storage &tempMsg)
bool readTypeCheckingColor(tcpip::Storage &inputStorage, libsumo::TraCIColor &into)
Reads the value type and a color, verifying the type.
An error which allows to continue.
virtual std::string readString()
virtual int readUnsignedByte()
TRACI_CONST int VAR_VEHICLECLASS
TRACI_CONST int VAR_IMPATIENCE
TRACI_CONST int VAR_LATALIGNMENT
TRACI_CONST int VAR_SCALE
TRACI_CONST int VAR_MINGAP
TRACI_CONST int VAR_SHAPECLASS
TRACI_CONST int VAR_ACTIONSTEPLENGTH
TRACI_CONST int VAR_SPEED_FACTOR
TRACI_CONST int TYPE_COMPOUND
TRACI_CONST int VAR_BOARDING_DURATION
TRACI_CONST int VAR_COLOR
TRACI_CONST int VAR_WIDTH
TRACI_CONST int VAR_MAXSPEED
TRACI_CONST int CMD_SET_VEHICLE_VARIABLE
TRACI_CONST int VAR_LENGTH
TRACI_CONST int VAR_MAXSPEED_LAT
TRACI_CONST int VAR_PARAMETER
TRACI_CONST int CMD_SET_VEHICLETYPE_VARIABLE
TRACI_CONST int CMD_GET_VEHICLETYPE_VARIABLE
TRACI_CONST int VAR_IMPERFECTION
TRACI_CONST int VAR_HEIGHT
TRACI_CONST int VAR_APPARENT_DECEL
TRACI_CONST int VAR_DECEL
TRACI_CONST int VAR_MINGAP_LAT
TRACI_CONST int VAR_EMERGENCY_DECEL
TRACI_CONST int RESPONSE_GET_VEHICLETYPE_VARIABLE
TRACI_CONST int VAR_EMISSIONCLASS
TRACI_CONST int VAR_ACCEL
TRACI_CONST int VAR_SPEED_DEVIATION