54 #ifdef CHECK_MEMORY_LEAKS 56 #endif // CHECK_MEMORY_LEAKS 91 for (std::vector<MSLane*>::const_iterator it = lanes.begin(); it != lanes.end(); ++it) {
92 (*it)->saveState(out);
126 0, std::vector<SUMOVehicleParameter::Stop>());
135 std::vector<std::string> routeIDs;
138 for (std::vector<std::string>::const_iterator it = routeIDs.begin(); it != routeIDs.end(); ++it) {
143 dist->
add(prob, r,
false);
158 std::vector<std::string> typeIDs;
161 for (std::vector<std::string>::const_iterator it = typeIDs.begin(); it != typeIDs.end(); ++it) {
166 dist->
add(prob, t,
false);
188 throw ProcessError(
"Error: Could not build vehicle " + p->
id +
"!");
190 if (!v->hasDeparted()) {
196 if (routingDevice != 0) {
222 std::vector<std::string> vehIDs;
void myStartElement(int element, const SUMOSAXAttributes &attrs)
Called on the opening of a tag;.
bool addVTypeDistribution(const std::string &id, RandomDistributor< MSVehicleType * > *vehTypeDistribution)
Adds a vehicle type distribution.
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
void close()
Closes the device and removes it from the dictionary.
std::string vtypeid
The vehicle's type id.
static int dictSize()
Returns the number of edges.
static void parseVTypeEmbedded(SUMOVTypeParameter &into, int element, const SUMOSAXAttributes &attrs, bool fromVType=false)
Parses an element embedded in vtype definition.
bool add(SUMOReal prob, T val, bool checkDuplicates=true)
Adds a value with an assigned probability to the distribution.
std::string time2string(SUMOTime t)
A device that performs vehicle rerouting based on current edge speeds.
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
std::pair< int, int > myEdgeAndLane
static long long int _2long(const E *const data)
converts a char-type array into the long value described by it
virtual bool addVehicle(const std::string &id, SUMOVehicle *v)
Tries to insert the vehicle into the internal vehicle container.
std::vector< const MSEdge * > ConstMSEdgeVector
SAX-handler base for SUMO-files.
SUMOVTypeParameter * myCurrentVType
The currently parsed vehicle type.
const MSEdge & getEdge() const
Returns the edge this segment belongs to.
static MSVehicleType * build(SUMOVTypeParameter &from)
Builds the microsim vehicle type described by the given parameter.
#define WRITE_WARNING(msg)
The car-following model and parameter.
static void dict_saveState(OutputDevice &out)
Saves all known routes into the given stream.
virtual std::string getString(int id) const =0
Returns the string-value of the named (by its enum-value) attribute.
void loadState(std::vector< std::string > &vehIDs, MSVehicleControl &vc, const SUMOTime blockTime, const int queIdx)
Loads the state of this segment with the given parameters.
bool writeHeader(const SumoXMLTag &rootElement)
A road/street connecting two junctions.
static void parseStringVector(const std::string &def, std::vector< std::string > &into)
Splits the given string.
const std::string & getFileName() const
returns the current file name
MESegment * getNextSegment() const
Returns the following segment on the same edge (0 if it is the last).
MSStateHandler(const std::string &file, const SUMOTime offset)
standard constructor
std::string routeid
The vehicle's route id.
Representation of a vehicle.
Encapsulated SAX-Attributes.
virtual SUMOReal getFloat(int id) const =0
Returns the SUMOReal-value of the named (by its enum-value) attribute.
MSVehicleControl & getVehicleControl()
Returns the vehicle control.
virtual SUMOVehicle * buildVehicle(SUMOVehicleParameter *defs, const MSRoute *route, const MSVehicleType *type, const bool ignoreStopErrors, const bool fromRouteFile=true)
Builds a vehicle, increases the number of built vehicles.
SUMOTime depart
The vehicle's departure time.
SUMOTime string2time(const std::string &r)
void saveState(OutputDevice &out)
Saves the current state into the given stream.
void setState(int runningVehNo, int loadedVehNo, int endedVehNo, SUMOReal totalDepartureDelay, SUMOReal totalTravelTime)
Sets the current state variables as loaded from the stream.
void addReference() const
increments the reference counter for the route
bool addVType(MSVehicleType *vehType)
Adds a vehicle type.
The vehicle has departed (was inserted into the network)
Structure representing possible vehicle parameter.
int getNumericalID() const
Returns the numerical id of the edge.
MSInsertionControl & getInsertionControl()
Returns the insertion control.
static OutputDevice & getDevice(const std::string &name)
Returns the described OutputDevice.
static const MSEdgeVector & getAllEdges()
Returns all edges with a numerical id.
virtual ~MSStateHandler()
standard destructor
A single mesoscopic segment (cell)
void myEndElement(int element)
Called when a closing tag occurs.
MESegment * getSegmentForEdge(const MSEdge &e, SUMOReal pos=0)
Get the segment for a given edge at a given position.
static MELoop * gMesoNet
mesoscopic simulation infrastructure
virtual int getInt(int id) const =0
Returns the int-value of the named (by its enum-value) attribute.
virtual bool getBool(int id) const =0
Returns the bool-value of the named (by its enum-value) attribute.
SUMOVehicle * getVehicle(const std::string &id) const
Returns the vehicle with the given id.
bool notifyEnter(SUMOVehicle &veh, MSMoveReminder::Notification reason)
Computes a new route on vehicle insertion.
Static storage of an output device and its base (abstract) implementation.
The class responsible for building and deletion of vehicles.
void discountStateLoaded()
avoid counting a vehicle twice if it was loaded from state and route input
MSVehicleType * getVType(const std::string &id=DEFAULT_VTYPE_ID, MTRand *rng=0)
Returns the named vehicle type or a sample from the named distribution.
static SUMOVTypeParameter * beginVTypeParsing(const SUMOSAXAttributes &attrs, const std::string &file)
Starts to parse a vehicle type.
void add(SUMOVehicle *veh)
Adds a single vehicle for departure.
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.
static void saveState(const std::string &file, SUMOTime step)
Saves the current state.
std::string id
The vehicle's id.
static bool dictionary(const std::string &id, const MSRoute *route)
Adds a route to the dictionary.