43 #ifdef CHECK_MEMORY_LEAKS
45 #endif // CHECK_MEMORY_LEAKS
85 if (maxRoutes < INT_MAX) {
122 (*i).route->release();
160 os <<
" replacedOnEdge=\"";
171 const MSEdge* lastEdge = 0;
172 for (; i < index; ++i) {
179 const MSEdge* lastEdge = 0;
194 int remainingWithExitTime = (int)
myExits.size() - numWritten;
195 assert(remainingWithExitTime >= 0);
203 os <<
"\" exitTimes=\"";
204 for (std::vector<SUMOTime>::const_iterator it =
myExits.begin(); it !=
myExits.end(); ++it) {
212 (os <<
"\"").closeTag();
234 if (routeDist != 0) {
235 const std::vector<const MSRoute*>& routes = routeDist->
getVals();
237 while (index < routes.size() && routes[index] !=
myCurrentRoute) {
241 const std::vector<SUMOReal>& probs = routeDist->
getProbs();
242 for (
unsigned int i = 0; i < routes.size(); ++i) {
249 routes[i]->writeEdgeIDs(od, *routes[i]->begin());
250 (od <<
"\"").closeTag();
275 std::map<const std::string, std::string>& infos =
myRouteInfos[it->first];
276 for (std::map<const std::string, std::string>::const_iterator it2 = infos.begin(); it2 != infos.end(); ++it2) {
277 routeOut << it2->second;
284 routeOut << od.getString();
319 if (it->first->hasDeparted()) {
320 it->second->generateOutput();
static std::map< const SUMOTime, int > myDepartureCounts
Map needed to sort vehicles by departure time.
static bool myWithTaz
A shortcut for the Option "device.routing.with-taz".
virtual bool hasDeparted() const =0
Returns whether this vehicle has departed.
const MSRoute * myCurrentRoute
The currently used route.
const std::vector< SUMOReal > & getProbs() const
Returns the probabilities assigned to the members of the distribution.
MSDevice_Vehroutes(SUMOVehicle &holder, const std::string &id, unsigned int maxRoutes)
Constructor.
static StateListener myStateListener
A class that is notified about reroutings.
Function-object for stable sorting of objects acting like Named without being derived (SUMOVehicle) ...
virtual const MSRoute & getRoute() const =0
Returns the current route.
int writeEdgeIDs(OutputDevice &os, const MSEdge *const from, const MSEdge *const upTo=0) const
Output the edge ids up to but not including the id of the given edge.
void vehicleStateChanged(const SUMOVehicle *const vehicle, MSNet::VehicleState to)
Called if a vehicle changes its state.
SUMOVehicle & myHolder
The vehicle that stores the device.
static bool myDUAStyle
A shortcut for the Option "vehroute-output.dua".
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
virtual const MSEdge * getEdge() const =0
Returns the edge the vehicle is currently at.
Notification
Definition of a vehicle state.
std::string time2string(SUMOTime t)
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
std::vector< SUMOTime > myExits
The times the vehicle exites an edge.
static bool mySorted
A shortcut for the Option "vehroute-output.sorted".
static RandomDistributor< const MSRoute * > * distDictionary(const std::string &id)
Returns the named route distribution.
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
const std::string DEFAULT_VTYPE_ID
static bool mySaveExits
A shortcut for the Option "vehroute-output.exit-times".
void addVehicleStateListener(VehicleStateListener *listener)
Adds a vehicle states listener.
bool notifyLeave(SUMOVehicle &veh, SUMOReal lastPos, Notification reason)
Saves exit times if needed.
static bool myIntendedDepart
A shortcut for the Option "vehroute-output.intended-depart".
static OptionsCont & getOptions()
Retrieves the options.
std::string toTaz
The vehicle's destination zone (district)
const std::vector< T > & getVals() const
Returns the members of the distribution.
static void init()
Static intialization.
A road/street connecting two junctions.
The vehicle changes lanes (micro only)
static bool myLastRouteOnly
A shortcut for the Option "vehroute-output.last-route".
The vehicle got a new route.
void addRoute()
Called on route change.
Representation of a vehicle.
std::vector< RouteReplaceInfo > myReplacedRoutes
Prior routes.
SUMOTime depart
The vehicle's departure time.
std::string fromTaz
The vehicle's origin zone (district)
A class that is notified about reroutings.
const unsigned int myMaxRoutes
The maximum number of routes to report.
void addReference() const
increments the reference counter for the route
static void generateOutputForUnfinished()
generate vehroute output for vehicles which are still in the network
VehicleState
Definition of a vehicle state.
Abstract in-vehicle device.
The vehicle has departed (was inserted into the network)
virtual SUMOTime getDeparture() const =0
Returns this vehicle's real departure time.
virtual bool hasArrived() const =0
Returns whether this vehicle has arrived.
static OutputDevice & getDeviceByOption(const std::string &name)
Returns the device described by the option.
virtual const SUMOVehicleParameter & getParameter() const =0
Returns the vehicle's parameter (including departure definition)
static MSDevice_Vehroutes * buildVehicleDevices(SUMOVehicle &v, std::vector< MSDevice * > &into, unsigned int maxRoutes=INT_MAX)
Build devices for the given vehicle, if needed.
const std::string & getID() const
Returns the name of the vehicle type.
void writeXMLRoute(OutputDevice &os, int index=-1) const
Called on route output.
A device which collects info on the vehicle trip (mainly on departure and arrival) ...
unsigned size() const
Returns the number of edges to pass.
static bool createDeviceByOption(const std::string &optionName, const std::string &rootElement="", const std::string &schemaFile="")
Creates the device using the output definition stored in the named option.
Static storage of an output device and its base (abstract) implementation.
static std::map< const SUMOTime, std::map< const std::string, std::string > > myRouteInfos
void release() const
deletes the route if there are no further references to it
std::map< const SUMOVehicle *, MSDevice_Vehroutes *, Named::NamedLikeComparatorIdLess< SUMOVehicle > > myDevices
A map for internal notification.
void generateOutput() const
Called on writing tripinfo output.
bool notifyEnter(SUMOVehicle &veh, MSMoveReminder::Notification reason)
Does nothing, returns true only if exit times should be collected.
virtual unsigned int getNumberReroutes() const =0
Returns the number of new routes this vehicle got.
virtual const std::string & getID() const =0
Get the vehicle's ID.
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
An output device that encapsulates an ofstream.
MSRouteIterator begin() const
Returns the begin of the list of edges to pass.
The vehicle is being teleported.
bool isSet(const std::string &name, bool failOnNonExistant=true) const
Returns the information whether the named option is set.
const MSRoute * getRoute(int index) const
Called on route retrieval.
const MSEdge * myLastSavedAt
The last edge the exit time was saved for.
bool isBinary() const
Returns whether we have a binary output.
virtual const MSVehicleType & getVehicleType() const =0
Returns the vehicle's type.
~MSDevice_Vehroutes()
Destructor.
Information about a replaced route.