42 #include <mesosim/MELoop.h>
43 #include <mesosim/MESegment.h>
47 #ifdef CHECK_MEMORY_LEAKS
49 #endif // CHECK_MEMORY_LEAKS
58 myCurrentRouteDistribution(0) {
59 const std::string distID =
id +
"_" +
toString(begin);
67 MESegment* seg = MSGlobals::gMesoNet->getSegmentForEdge(*edge);
69 seg->addDetector(
this);
70 seg = seg->getNextSegment();
75 for (std::vector<MSLane*>::const_iterator it = edge->
getLanes().begin(); it != edge->
getLanes().end(); ++it) {
76 (*it)->addMoveReminder(
this);
102 for (
unsigned int j = 0; j < routes.size(); ++j) {
106 if (i != r->
begin()) {
109 dev << (*i)->getID();
111 dev <<
"\" probability=\"" << probs[j] <<
"\"";
const std::vector< SUMOReal > & getProbs() const
Returns the probabilities assigned to the members of the distribution.
virtual const MSRoute & getRoute() const =0
Returns the current route.
const std::vector< MSLane * > & getLanes() const
Returns this edge's lanes.
MSEdgeVector::const_iterator MSRouteIterator
Notification
Definition of a vehicle state.
std::string time2string(SUMOTime t)
The vehicle changes the segment (meso only)
static RandomDistributor< const MSRoute * > * distDictionary(const std::string &id)
Returns the named route distribution.
void writeXMLOutput(OutputDevice &dev, SUMOTime startTime, SUMOTime stopTime)
Writes values into the given stream.
static void releaseRoute(const MSRoute *route)
release the route (to be used as function pointer with RandomDistributor)
virtual ~MSRouteProbe()
Destructor.
const std::vector< T > & getVals() const
Returns the members of the distribution.
static unsigned int getMaxRouteDistSize()
bool writeXMLHeader(const std::string &rootElement, const std::string &attrs="", const std::string &comment="")
Writes an XML header with optional configuration.
const std::string & getID() const
Returns the id.
A road/street connecting two junctions.
The vehicle changes lanes (micro only)
Representation of a vehicle.
void writeXMLDetectorProlog(OutputDevice &dev) const
Opens the XML-output using "detector" as root element.
MSRouteProbe(const std::string &id, const MSEdge *edge, SUMOTime begin)
Constructor.
Something on a lane to be noticed about vehicle movement.
std::string toString(const T &t, std::streamsize accuracy=OUTPUT_ACCURACY)
void addReference() const
increments the reference counter for the route
bool notifyEnter(SUMOVehicle &veh, MSMoveReminder::Notification reason)
Returns whether the vehicle shall be aware of this entry.
SUMOReal getOverallProb() const
Return the sum of the probabilites assigned to the members.
MSRouteIterator end() const
Returns the end of the list of edges to pass.
Static storage of an output device and its base (abstract) implementation.
bool closeTag()
Closes the most recently opened tag.
static const bool gUseMesoSim
RandomDistributor< const MSRoute * > * myCurrentRouteDistribution
The current distribution of routes (probability->route)
void add(SUMOReal prob, T val, bool checkDuplicates=true)
Adds a value with an assigned probability to the distribution.
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
Base of value-generating classes (detectors)
MSRouteIterator begin() const
Returns the begin of the list of edges to pass.
static bool dictionary(const std::string &id, const MSRoute *route)
Adds a route to the dictionary.