43 #ifdef CHECK_MEMORY_LEAKS
45 #endif // CHECK_MEMORY_LEAKS
73 std::vector<std::string> ids;
78 std::vector<std::string> ids;
89 std::string paramName =
"";
178 std::string warning =
"";
216 return server.
writeErrorStatusCmd(cmd,
"Setting length requires a double.", outputStorage);
218 if (value <= 0.0 || fabs(value) == std::numeric_limits<double>::infinity()) {
227 return server.
writeErrorStatusCmd(cmd,
"Setting maximum speed requires a double.", outputStorage);
229 if (value <= 0.0 || fabs(value) == std::numeric_limits<double>::infinity()) {
238 return server.
writeErrorStatusCmd(cmd,
"Setting vehicle class requires a string.", outputStorage);
243 return server.
writeErrorStatusCmd(cmd,
"Unknown vehicle class '" + vclass +
"'.", outputStorage);
250 return server.
writeErrorStatusCmd(cmd,
"Setting speed factor requires a double.", outputStorage);
252 if (value <= 0.0 || fabs(value) == std::numeric_limits<double>::infinity()) {
261 return server.
writeErrorStatusCmd(cmd,
"Setting speed deviation requires a double.", outputStorage);
263 if (value < 0.0 || fabs(value) == std::numeric_limits<double>::infinity()) {
272 return server.
writeErrorStatusCmd(cmd,
"Setting emission class requires a string.", outputStorage);
277 return server.
writeErrorStatusCmd(cmd,
"Unknown emission class '" + eclass +
"'.", outputStorage);
286 if (value <= 0.0 || fabs(value) == std::numeric_limits<double>::infinity()) {
295 return server.
writeErrorStatusCmd(cmd,
"Setting minimum gap requires a double.", outputStorage);
297 if (value < 0.0 || fabs(value) == std::numeric_limits<double>::infinity()) {
306 return server.
writeErrorStatusCmd(cmd,
"Setting vehicle shape requires a string.", outputStorage);
311 return server.
writeErrorStatusCmd(cmd,
"Unknown vehicle shape " + sclass +
"'.", outputStorage);
318 return server.
writeErrorStatusCmd(cmd,
"Setting acceleration requires a double.", outputStorage);
320 if (value < 0.0 || fabs(value) == std::numeric_limits<double>::infinity()) {
329 return server.
writeErrorStatusCmd(cmd,
"Setting deceleration requires a double.", outputStorage);
331 if (value < 0.0 || fabs(value) == std::numeric_limits<double>::infinity()) {
340 return server.
writeErrorStatusCmd(cmd,
"Setting driver imperfection requires a double.", outputStorage);
342 if (value < 0.0 || fabs(value) == std::numeric_limits<double>::infinity()) {
351 return server.
writeErrorStatusCmd(cmd,
"Setting headway time requires a double.", outputStorage);
353 if (value < 0.0 || fabs(value) == std::numeric_limits<double>::infinity()) {
362 return server.
writeErrorStatusCmd(cmd,
"The color must be given using the according type.", outputStorage);
369 return server.
writeErrorStatusCmd(cmd,
"A compound object is needed for setting a parameter.", outputStorage);
375 return server.
writeErrorStatusCmd(cmd,
"The name of the parameter must be given as a string.", outputStorage);
379 return server.
writeErrorStatusCmd(cmd,
"The value of the parameter must be given as a string.", outputStorage);
SUMOVehicleClass getVehicleClassID(const std::string &name)
Returns the class id of the abstract class given by its name.
static bool setVariable(const int cmd, const int variable, MSVehicleType &v, TraCIServer &server, tcpip::Storage &inputStorage, tcpip::Storage &outputStorage)
Processes a set value for the given type.
virtual SUMOReal getImperfection() const
Get the driver's imperfection.
#define VAR_EMISSIONCLASS
SUMOReal getMaxSpeed() const
Get vehicle's maximum speed [m/s].
SUMOVehicleClass getVehicleClass() const
Get this vehicle type's vehicle class.
#define RESPONSE_GET_VEHICLETYPE_VARIABLE
virtual void setMaxDecel(SUMOReal decel)
Sets a new value for maximum deceleration [m/s^2].
bool readTypeCheckingColor(tcpip::Storage &inputStorage, RGBColor &into)
Reads the value type and a color, verifying the type.
void setShape(SUMOVehicleShape shape)
Set a new value for this type's shape.
Structure representing possible vehicle parameter.
void setSpeedFactor(const SUMOReal &factor)
Set a new value for this type's speed factor.
void setLength(const SUMOReal &length)
Set a new value for this type's length.
static bool getVariable(const int variable, const MSVehicleType &v, tcpip::Storage &tempMsg)
Processes a value request for the given type.
SUMOReal getLength() const
Get vehicle's length [m].
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
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.
void setWidth(const SUMOReal &width)
Set a new value for this type's width.
void insertVTypeIDs(std::vector< std::string > &into) const
Inserts ids of all known vehicle types and vehicle type distributions to the given vector...
virtual void writeUnsignedByte(int)
const std::string & getParameter(const std::string &key, const std::string &defaultValue) const
Returns the value for a given key.
bool writeErrorStatusCmd(int commandId, const std::string &description, tcpip::Storage &outputStorage)
Writes a status command to the given storage with status = RTYPE_ERR.
virtual void setMaxAccel(SUMOReal accel)
Sets a new value for maximum acceleration [m/s^2].
#define VAR_SPEED_DEVIATION
virtual void writeInt(int)
The car-following model and parameter.
virtual int readUnsignedByte()
const MSCFModel & getCarFollowModel() const
Returns the vehicle type's car following model definition (const version)
std::string getVehicleShapeName(SUMOVehicleShape id)
Returns the class name of the shape class given by its id.
unsigned char blue() const
Returns the blue-amount of the color.
#define CMD_GET_VEHICLETYPE_VARIABLE
void setSpeedDeviation(const SUMOReal &dev)
Set a new value for this type's speed deviation.
SUMOReal getSpeedDeviation() const
Returns this type's speed deviation.
const SUMOVTypeParameter & getParameter() const
SUMOReal getMinGap() const
Get the free space in front of vehicles of this class.
MSVehicleControl & getVehicleControl()
Returns the vehicle control.
unsigned char alpha() const
Returns the alpha-amount of the color.
#define CMD_SET_VEHICLETYPE_VARIABLE
virtual void writeStringList(const std::vector< std::string > &s)
static bool processGet(TraCIServer &server, tcpip::Storage &inputStorage, tcpip::Storage &outputStorage)
Processes a get value command (Command 0xa5: Get Vehicle Type Variable)
virtual std::string readString()
void setEmissionClass(SUMOEmissionClass eclass)
Set a new value for this type's emission class.
static std::string getName(const SUMOEmissionClass c)
Checks whether the string describes a known vehicle class.
SUMOReal getMaxDecel() const
Get the vehicle type's maximum deceleration [m/s^2].
std::string toString(const T &t, std::streamsize accuracy=OUTPUT_ACCURACY)
TraCI server used to control sumo by a remote TraCI client.
void setMinGap(const SUMOReal &minGap)
Set a new value for this type's minimum gap.
virtual SUMOReal getHeadwayTime() const
Get the driver's reaction time [s].
SUMOVehicleShape getGuiShape() const
Get this vehicle type's shape.
void writeResponseWithLength(tcpip::Storage &outputStorage, tcpip::Storage &tempMsg)
SUMOReal getMaxAccel() const
Get the vehicle type's maximum acceleration [m/s^2].
SUMOReal getSpeedFactor() const
Returns this type's speed factor.
SUMOReal getWidth() const
Get the width which vehicles of this class shall have when being drawn.
static bool processSet(TraCIServer &server, tcpip::Storage &inputStorage, tcpip::Storage &outputStorage)
Processes a set value command (Command 0xc5: Change Vehicle Type State)
virtual void writeString(const std::string &s)
virtual void setImperfection(SUMOReal imperfection)
Sets a new value for driver imperfection.
static SUMOEmissionClass getClassByName(const std::string &eClass, const SUMOVehicleClass vc=SVC_IGNORING)
Checks whether the string describes a known vehicle class.
const RGBColor & getColor() const
Returns this type's color.
virtual void writeDouble(double)
void setVClass(SUMOVehicleClass vclass)
Set a new value for this type's vehicle class.
void setMaxSpeed(const SUMOReal &maxSpeed)
Set a new value for this type's maximum speed.
void setColor(const RGBColor &color)
Set a new value for this type's color.
SUMOVehicleShape getVehicleShapeID(const std::string &name)
Returns the class id of the shape class given by its name.
unsigned char green() const
Returns the green-amount of the color.
void writeStatusCmd(int commandId, int status, const std::string &description, tcpip::Storage &outputStorage)
Writes a status command to the given storage.
SUMOEmissionClass getEmissionClass() const
Get this vehicle type's emission class.
virtual void setHeadwayTime(SUMOReal headwayTime)
Sets a new value for driver reaction time [s].
MSVehicleType * getVType(const std::string &id=DEFAULT_VTYPE_ID, MTRand *rng=0)
Returns the named vehicle type or a sample from the named distribution.
unsigned char red() const
Returns the red-amount of the color.