45 const std::string
id = inputStorage.
readString();
51 std::string paramName =
"";
54 "Retrieval of a parameter requires its name.", outputStorage);
62 "Get Vehicle Type Variable: unsupported variable " +
toHex(variable, 2)
63 +
" specified", outputStorage);
78 std::string warning =
"";
95 "Change Vehicle Type State: unsupported variable " +
toHex(variable, 2)
96 +
" specified", outputStorage);
128 return server.
writeErrorStatusCmd(cmd,
"Setting length requires a double.", outputStorage);
130 if (value <= 0.0 || fabs(value) == std::numeric_limits<double>::infinity()) {
133 libsumo::VehicleType::setLength(
id, value);
139 return server.
writeErrorStatusCmd(cmd,
"Setting height requires a double.", outputStorage);
141 if (value <= 0.0 || fabs(value) == std::numeric_limits<double>::infinity()) {
144 libsumo::VehicleType::setHeight(
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()) {
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);
257 return server.
writeErrorStatusCmd(cmd,
"Unknown lateral alignment " + latAlign +
"'.", outputStorage);
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);
322 if (fabs(value) == std::numeric_limits<double>::infinity()) {
325 bool resetActionOffset = value >= 0.0;
326 libsumo::VehicleType::setActionStepLength(
id, fabs(value), resetActionOffset);
332 return server.
writeErrorStatusCmd(cmd,
"Setting driver imperfection requires a double.", outputStorage);
334 if (value < 0.0 || fabs(value) == std::numeric_limits<double>::infinity()) {
337 libsumo::VehicleType::setImperfection(
id, value);
343 return server.
writeErrorStatusCmd(cmd,
"Setting headway time requires a double.", outputStorage);
345 if (value < 0.0 || fabs(value) == std::numeric_limits<double>::infinity()) {
348 libsumo::VehicleType::setTau(
id, value);
354 return server.
writeErrorStatusCmd(cmd,
"The color must be given using the according type.", outputStorage);
356 libsumo::VehicleType::setColor(
id, col);
360 std::string newTypeID;
370 return server.
writeErrorStatusCmd(cmd,
"A compound object is needed for setting a parameter.",
377 return server.
writeErrorStatusCmd(cmd,
"The name of the parameter must be given as a string.",
382 return server.
writeErrorStatusCmd(cmd,
"The value of the parameter must be given as a string.",
TRACI_CONST int VAR_APPARENT_DECEL
TRACI_CONST int VAR_EMISSIONCLASS
TRACI_CONST int VAR_MINGAP
TRACI_CONST int VAR_MAXSPEED_LAT
bool readTypeCheckingColor(tcpip::Storage &inputStorage, libsumo::TraCIColor &into)
Reads the value type and a color, verifying the type.
TRACI_CONST int VAR_ACTIONSTEPLENGTH
TRACI_CONST int VAR_COLOR
TRACI_CONST int VAR_WIDTH
TRACI_CONST int CMD_GET_VEHICLETYPE_VARIABLE
TRACI_CONST int CMD_SET_VEHICLE_VARIABLE
TRACI_CONST int VAR_MINGAP_LAT
TRACI_CONST int VAR_VEHICLECLASS
static void setSpeedDeviation(const std::string &typeID, double deviation)
TRACI_CONST int VAR_PARAMETER
static LIBSUMO_VEHICLE_TYPE_GETTER std::string getParameter(const std::string &typeID, const std::string &key)
bool readTypeCheckingString(tcpip::Storage &inputStorage, std::string &into)
Reads the value type and a string, verifying the type.
bool readTypeCheckingDouble(tcpip::Storage &inputStorage, double &into)
Reads the value type and a double, verifying the type.
virtual void writeUnsignedByte(int)
TRACI_CONST int VAR_MAXSPEED
bool writeErrorStatusCmd(int commandId, const std::string &description, tcpip::Storage &outputStorage)
Writes a status command to the given storage with status = RTYPE_ERR.
virtual int readUnsignedByte()
TRACI_CONST int VAR_LATALIGNMENT
TRACI_CONST int VAR_ACCEL
TRACI_CONST int CMD_SET_VEHICLETYPE_VARIABLE
static LIBSUMO_VEHICLE_TYPE_SETTER void copy(const std::string &origTypeID, const std::string &newTypeID)
TRACI_CONST int VAR_LENGTH
static bool processGet(TraCIServer &server, tcpip::Storage &inputStorage, tcpip::Storage &outputStorage)
Processes a get value command (Command 0xa5: Get Vehicle Type Variable)
tcpip::Storage & getWrapperStorage()
virtual std::string readString()
TRACI_CONST int TYPE_STRING
TraCI server used to control sumo by a remote TraCI client.
TRACI_CONST int VAR_SPEED_DEVIATION
void writeResponseWithLength(tcpip::Storage &outputStorage, tcpip::Storage &tempMsg)
TRACI_CONST int VAR_EMERGENCY_DECEL
static bool processSet(TraCIServer &server, tcpip::Storage &inputStorage, tcpip::Storage &outputStorage)
Processes a set value command (Command 0xc5: Change Vehicle Type State)
static StringBijection< LateralAlignment > LateralAlignments
lateral alignments
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.
virtual void writeString(const std::string &s)
static void setParameter(const std::string &id, const std::string &name, const std::string &value)
TRACI_CONST int VAR_SPEED_FACTOR
static bool handleVariable(const std::string &objID, const int variable, VariableWrapper *wrapper)
std::string toHex(const T i, std::streamsize numDigits=0)
TRACI_CONST int VAR_SHAPECLASS
void writeStatusCmd(int commandId, int status, const std::string &description, tcpip::Storage &outputStorage)
Writes a status command to the given storage.
TRACI_CONST int RESPONSE_GET_VEHICLETYPE_VARIABLE
TRACI_CONST int VAR_HEIGHT
void initWrapper(const int domainID, const int variable, const std::string &objID)
TRACI_CONST int VAR_IMPERFECTION
TRACI_CONST int VAR_DECEL
TRACI_CONST int TYPE_COMPOUND