66 myLastParameterised(0) {
81 out.
writeAttr(
"xmlns:xsi",
"http://www.w3.org/2001/XMLSchema-instance").
writeAttr(
"xsi:noNamespaceSchemaLocation",
"http://sumo.dlr.de/xsd/state_file.xsd");
95 for (std::vector<MSLane*>::const_iterator it = lanes.begin(); it != lanes.end(); ++it) {
96 (*it)->saveState(out);
162 std::vector<std::string> vehIDs;
215 if (routingDevice != 0) {
222 for (std::vector<MSDevice*>::const_iterator dev = v->
getDevices().begin(); dev != v->
getDevices().end(); ++dev) {
223 if ((*dev)->getID() == attrID) {
MESegment * getNextSegment() const
Returns the following segment on the same edge (0 if it is the last).
void myStartElement(int element, const SUMOSAXAttributes &attrs)
Called on the opening of a tag;.
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
void discountStateLoaded(bool removed=false)
avoid counting a vehicle twice if it was loaded from state and route input
void close()
Closes the device and removes it from the dictionary.
virtual bool hasDeparted() const =0
Returns whether this vehicle has departed.
description of a vehicle type
Parameterised * myLastParameterised
the last object that potentially carries parameters
virtual SUMOSAXAttributes * clone() const =0
return a new deep-copy attributes object
MESegment * getSegmentForEdge(const MSEdge &e, double pos=0)
Get the segment for a given edge at a given position.
virtual void closeVehicle()
Ends the processing of a vehicle.
begin/end of the description of a single lane
static int dictSize()
Returns the number of edges.
SUMOVehicleParameter * myVehicleParameter
Parameter of the current vehicle, trip, person, container or flow.
void closeVehicle()
Ends the processing of a vehicle.
SUMOVehicle * getVehicle(const std::string &id) const
Returns the vehicle with the given id.
SUMOVTypeParameter * myCurrentVType
The currently parsed vehicle type.
std::string time2string(SUMOTime t)
A device that performs vehicle rerouting based on current edge speeds.
weights: time range begin
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
int getNumericalID() const
Returns the numerical id of the edge.
virtual bool hasAttribute(int id) const =0
Returns the information whether the named (by its enum-value) attribute is within the current list...
void setState(int runningVehNo, int loadedVehNo, int endedVehNo, double totalDepartureDelay, double totalTravelTime)
Sets the current state variables as loaded from the stream.
#define WRITE_WARNING(msg)
static void dict_saveState(OutputDevice &out)
Saves all known routes into the given stream.
static OptionsCont & getOptions()
Retrieves the options.
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.
virtual const std::vector< MSDevice * > & getDevices() const =0
Returns this vehicle's devices.
void saveState(OutputDevice &out) const
Saves the current state into the given stream.
MSStateHandler(const std::string &file, const SUMOTime offset)
standard constructor
Representation of a vehicle.
Encapsulated SAX-Attributes.
T get(int attr, const char *objectid, bool &ok, bool report=true) const
Tries to read given attribute assuming it is an int.
parameter associated to a certain key
MSVehicleControl & getVehicleControl()
Returns the vehicle control.
SUMOTime depart
The vehicle's departure time.
SUMOTime string2time(const std::string &r)
std::vector< std::string > getStringVector(const std::string &name) const
Returns the list of string-vector-value of the named option (only for Option_String) ...
void saveState(OutputDevice &out)
Saves the current state into the given stream.
SUMOSAXAttributes * myAttrs
cached attrs (used when loading vehicles)
void loadState(const SUMOSAXAttributes &attrs, const SUMOTime offset, MSVehicleControl &vc)
Loads one transfer vehicle state from the given descriptionn.
virtual void myStartElement(int element, const SUMOSAXAttributes &attrs)
Called on the opening of a tag;.
void alreadyDeparted(SUMOVehicle *veh)
stops trying to emit the given vehicle (because it already departed)
static MSVehicleTransfer * getInstance()
Returns the instance of this object.
void addParameter(const std::string &key, const std::string &value)
Adds a parameter.
virtual void myEndElement(int element)
Called when a closing tag occurs.
virtual double getFloat(int id) const =0
Returns the double-value of the named (by its enum-value) attribute.
trigger: the time of the step
The vehicle has departed (was inserted into the network)
bool myAmLoadingState
whether a state file is being loaded
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.
std::vector< SUMOSAXAttributes * > myDeviceAttrs
cached device attrs (used when loading vehicles)
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.
bool notifyEnter(SUMOVehicle &veh, MSMoveReminder::Notification reason, const MSLane *enteredLane=0)
Computes a new route on vehicle insertion.
std::set< std::string > myVehiclesToRemove
vehicles that shall be removed when loading state
Static storage of an output device and its base (abstract) implementation.
virtual MSDevice * getDevice(const std::type_info &type) const =0
Returns a device of the given type if it exists or 0.
The class responsible for building and deletion of vehicles.
const MSEdge & getEdge() const
Returns the edge this segment belongs to.
virtual void loadState(const SUMOSAXAttributes &attrs, const SUMOTime offset)=0
Loads the state of this vehicle from the given description.
Parser and container for routes during their loading.
static void saveState(const std::string &file, SUMOTime step)
Saves the current state.
std::string id
The vehicle's id.