43 #ifdef CHECK_MEMORY_LEAKS 45 #endif // CHECK_MEMORY_LEAKS 81 std::vector<std::string> ids;
84 ids.push_back(i->first);
144 tempMsg.
writeString(dynamic_cast<MSPerson*>(p)->getNextEdge());
147 int nextStageIndex = 0;
159 tempMsg.
writeInt((
int)edges.size());
160 for (ConstMSEdgeVector::const_iterator i = edges.begin(); i != edges.end(); ++i) {
166 int nextStageIndex = 0;
191 std::string paramName =
"";
212 std::string warning =
"";
232 const bool shouldExist = variable !=
ADD;
234 if (p == 0 && shouldExist) {
256 if (vehicleType == 0) {
269 if (inputStorage.
readInt() != 4) {
273 vehicleParams.
id = id;
297 const int proc = -depart;
305 WRITE_WARNING(
"Departure time for person '" +
id +
"' is in the past; using current time instead.");
307 vehicleParams.
depart = depart;
341 int numParameters = inputStorage.
readInt();
348 if (numParameters != 4) {
363 if (lines.size() == 0) {
381 if (numParameters != 4) {
391 std::string description;
410 if (numParameters != 6) {
413 std::vector<std::string> edgeIDs;
430 if (fabs(arrivalPos) > edges.back()->getLength()) {
433 if (arrivalPos < 0) {
434 arrivalPos += edges.back()->getLength();
467 int nextStageIndex = 0;
474 if (nextStageIndex < 0) {
526 std::string newID = oType.
getID().find(
'@') == std::string::npos ? oType.
getID() +
"@" + t->
getID() : oType.
getID();
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 MSTransportable * buildPerson(const SUMOVehicleParameter *pars, const MSVehicleType *vtype, MSTransportable::MSTransportablePlan *plan) const
Builds a new person.
RGBColor color
The vehicle's color, TraCI may change this.
SUMOReal getMaxSpeed() const
Get vehicle's maximum speed [m/s].
std::map< std::string, MSTransportable * >::const_iterator constVehIt
Definition of the internal transportables map iterator.
A lane area vehicles can halt at.
const SUMOVehicleParameter & getParameter() const
virtual SUMOReal getWaitingSeconds() const
the time this transportable spent waiting in seconds
static bool getVariable(const int variable, const MSVehicleType &v, tcpip::Storage &tempMsg)
Processes a value request for the given type.
#define CMD_GET_PERSON_VARIABLE
SUMOVehicle * getVehicle() const
The vehicle associated with this transportable.
int getNumRemainingStages() const
Return the number of remaining stages (including the current)
SUMOReal getArrivalPos() const
returns the final arrival pos
bool readTypeCheckingInt(tcpip::Storage &inputStorage, int &into)
Reads the value type and an int, verifying the type.
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.
const std::string & getID() const
returns the id of the transportable
static bool dictionary(const std::string &id, MSEdge *edge)
Inserts edge into the static dictionary Returns true if the key id isn't already in the dictionary...
std::vector< const MSEdge * > ConstMSEdgeVector
virtual SUMOReal getEdgePos() const
Return the position on the edge.
virtual void writeUnsignedByte(int)
const std::string & getParameter(const std::string &key, const std::string &defaultValue) const
Returns the value for a given key.
virtual SUMOReal getAngle() const
return the current angle of the transportable
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
bool writeErrorStatusCmd(int commandId, const std::string &description, tcpip::Storage &outputStorage)
Writes a status command to the given storage with status = RTYPE_ERR.
Tag for the last element in the enum for safe int casting.
SUMOReal x() const
Returns the x-position.
static MSVehicleType * build(SUMOVTypeParameter &from)
Builds the microsim vehicle type described by the given parameter.
virtual void writeInt(int)
#define WRITE_WARNING(msg)
The car-following model and parameter.
virtual int readUnsignedByte()
static bool getPosition(const std::string &id, Position &p)
Returns the named persons's position.
int size() const
Returns the number of known transportables.
unsigned char blue() const
Returns the blue-amount of the color.
void removeStage(int next)
removes the nth next stage
const std::string & getID() const
Returns the id.
A road/street connecting two junctions.
std::vector< MSTransportable::Stage * > MSTransportablePlan
the structure holding the plan of a transportable
SUMOReal getLength() const
return the length of the edge
const MSVehicleType & getVehicleType() const
MSStoppingPlace * getBusStop(const std::string &id) const
Returns the named bus stop.
const MSEdge * getEdge() const
Returns the current edge.
static bool processSet(TraCIServer &server, tcpip::Storage &inputStorage, tcpip::Storage &outputStorage)
Processes a set value command (Command 0xce: Change Person State)
Representation of a vehicle.
MSTransportable * get(const std::string &id) const
Returns the named transportable, if existing.
DepartPosDefinition departPosProcedure
Information how the vehicle shall choose the departure position.
virtual MSTransportableControl & getPersonControl()
Returns the person control.
A point in 2D or 3D with translation and scaling methods.
void appendStage(Stage *stage)
Appends the given stage to the current plan.
MSVehicleControl & getVehicleControl()
Returns the vehicle control.
unsigned char alpha() const
Returns the alpha-amount of the color.
bool readTypeCheckingStringList(tcpip::Storage &inputStorage, std::vector< std::string > &into)
Reads the value type and a string list, verifying the type.
SUMOReal z() const
Returns the z-position.
virtual void writeStringList(const std::vector< std::string > &s)
SUMOTime depart
The vehicle's departure time.
DepartDefinition departProcedure
Information how the vehicle shall choose the depart time.
#define CMD_SET_VEHICLE_VARIABLE
virtual std::string readString()
TraCI server used to control sumo by a remote TraCI client.
static bool processGet(TraCIServer &server, tcpip::Storage &inputStorage, tcpip::Storage &outputStorage)
Processes a get value command (Command 0xae: Get Person Variable)
static SUMOReal naviDegree(const SUMOReal angle)
void writeResponseWithLength(tcpip::Storage &outputStorage, tcpip::Storage &tempMsg)
constVehIt loadedEnd() const
Returns the end of the internal transportables map.
virtual SUMOReal getSpeed() const
the current speed of the transportable
virtual void writeString(const std::string &s)
static MSVehicleType & getSingularType(MSTransportable *const t)
Structure representing possible vehicle parameter.
std::string toHex(const T i, std::streamsize numDigits=0)
SUMOReal y() const
Returns the y-position.
StageType getStageType(int next) const
the stage type for the nth next stage
void setSpeed(SUMOReal speed)
sets the walking speed (ignored in other stages)
bool add(MSTransportable *transportable)
Adds a single transportable, returns false if an id clash occured.
#define RESPONSE_GET_PERSON_VARIABLE
ConstMSEdgeVector getEdges(int next) const
Return the edges of the nth next stage.
const std::string & getID() const
Returns the name of the vehicle type.
virtual const std::string & getID() const =0
Get the vehicle's ID.
void replaceVehicleType(MSVehicleType *type)
replace myVType
SUMOReal departPos
(optional) The position the vehicle shall depart from
virtual Position getPosition() const
Return the Network coordinate of the transportable.
virtual void writeDouble(double)
unsigned char green() const
Returns the green-amount of the color.
int getNumStages() const
Return the total number stages in this persons plan.
void writeStatusCmd(int commandId, int status, const std::string &description, tcpip::Storage &outputStorage)
Writes a status command to the given storage.
constVehIt loadedBegin() const
Returns the begin of the internal transportables map.
#define CMD_SET_PERSON_VARIABLE
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.
#define VAR_STAGES_REMAINING
const MSEdge * getArrivalEdge() const
returns the final arrival edge
static void parseEdgesList(const std::string &desc, ConstMSEdgeVector &into, const std::string &rid)
Parses the given string assuming it contains a list of edge ids divided by spaces.
DepartDefinition
Possible ways to depart.
std::string id
The vehicle's id.