52 #ifdef CHECK_MEMORY_LEAKS
54 #endif // CHECK_MEMORY_LEAKS
62 const bool emptyDestinationsAllowed,
63 const bool ignoreErrors) :
67 myTryRepair(tryRepair),
68 myEmptyDestinationsAllowed(emptyDestinationsAllowed),
70 myCurrentVTypeDistribution(0),
71 myCurrentAlternatives(0) {
130 (*myActivePlan) << attrs;
134 (*myActivePlan) << attrs;
140 (*myActivePlan) << attrs;
172 while (st.hasNext()) {
230 WRITE_WARNING(
"No probability for a route in '" + rid +
"', using default.");
330 if (ok && index < 0) {
340 const std::string routeID = st.
next();
381 if (route->
getID()[0] !=
'!') {
441 (*myActivePlan) << attrs;
446 std::string errorSuffix;
459 if (!ok || stop.
lane ==
"") {
499 std::set<std::string> personIDs;
506 }
else if (idx ==
"fit") {
510 if (!ok || stop.
index < 0) {
525 const std::string& rid) {
527 std::istringstream in(desc, std::ios::binary);
533 const std::string
id = st.next();
537 +
"\n The route can not be build.");
539 into.push_back(edge);
RORouteDef * myCurrentAlternatives
The currently parsed route alternatives.
static MsgHandler * getErrorInstance()
Returns the instance to add errors to.
virtual void myEndElement(int element)
Called when a closing tag occurs.
static void parseStringSet(const std::string &def, std::set< std::string > &into)
Splits the given string, stores it in a set.
const bool myEmptyDestinationsAllowed
Information whether the "to" attribute is mandatory.
void closeVehicleTypeDistribution()
SUMOReal myCurrentCosts
The currently parsed route costs.
int repetitionNumber
The number of times the vehicle shall be repeatedly inserted.
std::vector< const ROEdge * > myActiveRoute
The current route.
void closePerson()
Ends the processing of a person.
std::string vtypeid
The vehicle's type id.
bool parking
whether the vehicle is removed from the net while stopping
void openRouteDistribution(const SUMOSAXAttributes &attrs)
static void parseVTypeEmbedded(SUMOVTypeParameter &into, int element, const SUMOSAXAttributes &attrs, bool fromVType=false)
Parses an element embedded in vtype definition.
SUMOTime duration
The stopping duration.
SUMOVehicleParameter * myVehicleParameter
Parameter of the current vehicle, trip, person, or flow.
Structure representing possible vehicle parameter.
void addAlternativeDef(const RORouteDef *alternative)
Adds an alternative loaded from the file.
ROEdge * getEdge(const std::string &name) const
Retrieves an edge from the network.
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
bool checkStopPos(SUMOReal &startPos, SUMOReal &endPos, const SUMOReal laneLength, const SUMOReal minLength, const bool friendlyPos)
check start and end position of a stop
SUMOVTypeParameter * myCurrentVType
The currently parsed vehicle type.
int repetitionsDone
The number of times the vehicle was already inserted.
virtual void myStartElement(int element, const SUMOSAXAttributes &attrs)
Called on the opening of a tag;.
MsgHandler *const myErrorOutput
Depending on the "ignore-errors" option different outputs are used.
const SUMOReal DEFAULT_VEH_PROB
SUMOReal myActiveRouteProbability
The id of the current route.
SUMOTime until
The time at which the vehicle may continue its journey.
virtual void myEndElement(int element)
Called when a closing tag occurs.
void registerLastDepart()
save last depart (only to be used if vehicle is not discarded)
std::set< std::string > awaitedPersons
IDs of persons the vehicle has to wait for until departing.
void openVehicleTypeDistribution(const SUMOSAXAttributes &attrs)
std::string myActiveRouteID
The id of the current route.
SUMOReal repetitionOffset
The time offset between vehicle reinsertions.
void closeVehicle()
Ends the processing of a vehicle.
virtual bool hasAttribute(int id) const =0
Returns the information whether the named (by its enum-value) attribute is within the current list...
#define WRITE_WARNING(msg)
virtual bool addVehicleType(SUMOVTypeParameter *type)
Adds a read vehicle type definition to the network.
RandomDistributor< SUMOVTypeParameter * > * myCurrentVTypeDistribution
The currently parsed distribution of vehicle types (probability->vehicle type)
virtual bool addVehicle(const std::string &id, ROVehicle *veh)
static OptionsCont & getOptions()
Retrieves the options.
std::string toTaz
The vehicle's destination zone (district)
std::vector< Stop > stops
List of the stops the vehicle will make.
RORouteHandler(RONet &net, const std::string &file, const bool tryRepair, const bool emptyDestinationsAllowed, const bool ignoreErrors)
standard constructor
SUMOTime getOptSUMOTimeReporting(int attr, const char *objectid, bool &ok, SUMOTime defaultValue, bool report=true) const
Tries to read given attribute assuming it is a SUMOTime.
RONet & myNet
The current route.
std::string busstop
(Optional) bus stop if one is assigned to the stop
const std::string & getID() const
Returns the id.
bool addVTypeDistribution(const std::string &id, RandomDistributor< SUMOVTypeParameter * > *vehTypeDistribution)
Adds a vehicle type distribution.
A vehicle as used by router.
bool addRouteDef(RORouteDef *def)
SUMOReal startPos
The stopping position start.
std::string routeid
The vehicle's route id.
Encapsulated SAX-Attributes.
bool wasSet(int what) const
Returns whether the given parameter was set.
SUMOReal endPos
The stopping position end.
bool triggered
whether an arriving person lets the vehicle continue
SUMOTime depart
The vehicle's departure time.
void addPerson(const SUMOTime depart, const std::string desc)
DepartDefinition departProcedure
Information how the vehicle shall choose the depart time.
SUMOTime string2time(const std::string &r)
void addStop(const SUMOSAXAttributes &attrs)
Processing of a stop.
std::string getString()
Returns the current content as a string.
std::string fromTaz
The vehicle's origin zone (district)
A basic edge for routing applications.
void parseEdges(const std::string &desc, std::vector< const ROEdge * > &into, const std::string &rid)
Parse edges from strings.
std::string lane
The lane to stop at.
Parser for routes during their loading.
unsigned int getNoFollowing() const
Returns the number of edges this edge is connected to.
SUMOReal getOverallProb() const
Return the sum of the probabilites assigned to the members.
std::vector< SUMOVehicleParameter::Stop > myActiveRouteStops
List of the stops on the parsed route.
The router's network representation.
void openRoute(const SUMOSAXAttributes &attrs)
virtual void myStartElement(int element, const SUMOSAXAttributes &attrs)
Called on the opening of a tag;.
static void parseStop(SUMOVehicleParameter::Stop &stop, const SUMOSAXAttributes &attrs)
SUMOReal getLength() const
Returns the length of the edge.
RORouteDef * copy(const std::string &id) const
Returns a deep copy of the route definition.
void parseFromTo(std::string element, const SUMOSAXAttributes &attrs)
Called for parsing from and to and the corresponding taz attributes.
SUMOReal defaultProbability
The probability when being added to a distribution without an explicit probability.
Definition of vehicle stop (position and duration)
const bool myTryRepair
Information whether routes shall be repaired.
void inform(std::string msg, bool addType=true)
adds a new error to the list
int index
at which position in the stops list
Base class for a vehicle's route definition.
void addLoadedAlternative(RORoute *alternative)
Adds a single alternative loaded from the file An alternative may also be generated during DUA...
void closeRoute(const bool mayBeDisconnected=false)
const int VEHPARS_TAZ_SET
OutputDevice_String * myActivePlan
The plan of the current person.
const RGBColor * myActiveRouteColor
The currently parsed route's color.
virtual ~RORouteHandler()
standard destructor
static void readEdgeVector(std::istream &in, std::vector< const E * > &edges, const std::string &rid)
Reads an edge vector binary.
bool closeTag()
Closes the most recently opened tag.
SUMOVTypeParameter * getVehicleTypeSecure(const std::string &id)
Retrieves the named vehicle type.
T getOpt(int attr, const char *objectid, bool &ok, T defaultValue, bool report=true) const
Tries to read given attribute assuming it is an int.
void closeFlow()
Ends the processing of a flow.
T get(int attr, const char *objectid, bool &ok, bool report=true) const
Tries to read given attribute assuming it is an int.
bool addFlow(SUMOVehicleParameter *flow, const bool randomize)
void add(SUMOReal prob, T val, bool checkDuplicates=true)
Adds a value with an assigned probability to the distribution.
std::string myActiveRouteRefID
The id of the route the current route references to.
RORouteDef * getRouteDef(const std::string &name) const
Returns the named route definition.
SUMOReal getOverallProb() const
Returns the sum of the probablities of the contained routes.
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
A complete router's route.
An output device that encapsulates an ofstream.
void closeRouteDistribution()
std::string myCurrentVTypeDistributionID
The id of the currently parsed vehicle type distribution.
std::string id
The vehicle's id.