42 #ifdef CHECK_MEMORY_LEAKS
44 #endif // CHECK_MEMORY_LEAKS
71 std::vector<std::string> ids;
76 std::vector<std::string> ids;
163 std::string warning =
"";
201 return server.
writeErrorStatusCmd(cmd,
"Setting length requires a double.", outputStorage);
203 if (value == 0.0 || fabs(value) == std::numeric_limits<double>::infinity()) {
212 return server.
writeErrorStatusCmd(cmd,
"Setting maximum speed requires a double.", outputStorage);
214 if (value == 0.0 || fabs(value) == std::numeric_limits<double>::infinity()) {
223 return server.
writeErrorStatusCmd(cmd,
"Setting vehicle class requires a string.", outputStorage);
231 return server.
writeErrorStatusCmd(cmd,
"Setting speed factor requires a double.", outputStorage);
239 return server.
writeErrorStatusCmd(cmd,
"Setting speed deviation requires a double.", outputStorage);
247 return server.
writeErrorStatusCmd(cmd,
"Setting emission class requires a string.", outputStorage);
263 return server.
writeErrorStatusCmd(cmd,
"Setting minimum gap requires a double.", outputStorage);
271 return server.
writeErrorStatusCmd(cmd,
"Setting vehicle shape requires a string.", outputStorage);
279 return server.
writeErrorStatusCmd(cmd,
"Setting acceleration requires a double.", outputStorage);
287 return server.
writeErrorStatusCmd(cmd,
"Setting deceleration requires a double.", outputStorage);
295 return server.
writeErrorStatusCmd(cmd,
"Setting driver imperfection requires a double.", outputStorage);
303 return server.
writeErrorStatusCmd(cmd,
"Setting headway time requires a double.", outputStorage);
311 return server.
writeErrorStatusCmd(cmd,
"The color must be given using the according type.", 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.
SUMOEmissionClass getVehicleEmissionTypeID(const std::string &name)
Returns the class id of the emission class given by its name.
virtual SUMOReal getImperfection() const
Get the driver's imperfection.
#define VAR_EMISSIONCLASS
SUMOReal getMaxSpeed() const
Get vehicle's maximum speed [m/s].
std::string getVehicleEmissionTypeName(SUMOEmissionClass id)
Returns the class name of the emission class given by its id.
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.
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.
MSVehicleType * getVType(const std::string &id=DEFAULT_VTYPE_ID)
Returns the named vehicle type or a sample from the named distribution.
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)
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.
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.
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.
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].
unsigned char red() const
Returns the red-amount of the color.