48 #ifdef CHECK_MEMORY_LEAKS 50 #endif // CHECK_MEMORY_LEAKS 66 for (std::vector<SUMOVehicleParameter::Stop>::const_iterator s = pars.
stops.begin(); s != pars.
stops.end(); ++s) {
69 if (pars.
via.size() != 0) {
73 for (std::vector<std::string>::const_iterator it = pars.
via.begin(); it != pars.
via.end(); ++it) {
84 assert(stopEdge != 0);
86 if (errorHandler != 0) {
87 errorHandler->
inform(
"Stop edge '" + stopEdge->
getID() +
"' does not allow vehicle '" +
getID() +
"'.");
92 std::vector<SUMOVehicleParameter::Stop>::iterator iter =
myParameter.
stops.begin();
93 ConstROEdgeVector::iterator edgeIter =
myStopEdges.begin();
102 ConstROEdgeVector::const_iterator stopEdgeIt = std::find(edges.begin(), edges.end(), stopEdge);
103 if (stopEdgeIt == edges.end()) {
108 if (edgeIter > stopEdgeIt || (edgeIter == stopEdgeIt && iter->endPos >= stopPar.
endPos)) {
116 iter += stopPar.
index;
117 edgeIter += stopPar.
index;
136 const bool removeLoops,
MsgHandler* errorHandler) {
138 std::string noRouteMsg =
"The vehicle '" +
getID() +
"' has no valid route.";
142 errorHandler->
inform(noRouteMsg);
147 if (current == 0 || current->
size() == 0) {
149 errorHandler->
inform(noRouteMsg);
157 if (current->
size() == 0) {
159 errorHandler->
inform(noRouteMsg +
" (after removing loops)");
SUMOTime getDepartureTime() const
Returns the time the vehicle starts at, 0 for triggered vehicles.
SUMOVehicleParameter myParameter
The vehicle's parameter.
void saveAsXML(OutputDevice &os, OutputDevice *const typeos, bool asAlternatives, OptionsCont &options) const
Saves the complete vehicle description.
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
Structure representing possible vehicle parameter.
bool saved
Information whether this type was already saved (needed by routers)
void addAlternative(SUMOAbstractRouter< ROEdge, ROVehicle > &router, const ROVehicle *const, RORoute *current, SUMOTime begin)
Adds an alternative to the list of routes.
RORoute * buildCurrentRoute(SUMOAbstractRouter< ROEdge, ROVehicle > &router, SUMOTime begin, const ROVehicle &veh) const
Triggers building of the complete route (via preComputeCurrentRoute) or returns precomputed route...
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)
const ConstROEdgeVector & getEdgeVector() const
Returns the list of edges this route consists of.
void recheckForLoops()
Checks whether this route contains loops and removes such.
const std::map< std::string, std::string > & getMap() const
Returns the inner key/value map.
std::vector< const ROEdge * > ConstROEdgeVector
bool myRoutingSuccess
Whether the last routing was successful.
const ROEdge * getDepartEdge() const
Returns the first edge the vehicle takes.
ROVehicle(const SUMOVehicleParameter &pars, RORouteDef *route, const SUMOVTypeParameter *type, const RONet *net, MsgHandler *errorHandler=0)
Constructor.
RORouteDef *const myRoute
The route the vehicle takes.
std::vector< Stop > stops
List of the stops the vehicle will make.
void addStop(const SUMOVehicleParameter::Stop &stopPar, const RONet *net, MsgHandler *errorHandler)
Adds a stop to this vehicle.
A routable thing such as a vehicle or person.
const std::string & getID() const
Returns the id.
OutputDevice & writeXMLDefinition(OutputDevice &dev, const ROVehicle *const veh, bool asAlternatives, bool withExitTimes) const
Saves the built route / route alternatives.
SUMOReal endPos
The stopping position end.
void write(OutputDevice &dev, const OptionsCont &oc, const SumoXMLTag tag=SUMO_TAG_VEHICLE) const
Writes the parameters as a beginning element.
SUMOAbstractRouter< E, V > & getVehicleRouter() const
const ROEdge * getFirst() const
Returns the first edge in the route.
A basic edge for routing applications.
std::string lane
The lane to stop at.
std::vector< std::string > via
List of the via-edges the vehicle must visit.
void write(OutputDevice &dev) const
Writes the vtype.
ROEdge * getEdgeForLaneID(const std::string &laneID) const
Retrieves an edge from the network when the lane id is given.
const SUMOVTypeParameter *const myType
The type of the vehicle.
The router's network representation.
Structure representing possible vehicle parameter.
ConstROEdgeVector myStopEdges
The edges where the vehicle stops.
bool prohibits(const ROVehicle *const vehicle) const
Returns whether this edge prohibits the given vehicle to pass it.
const std::string & getID() const
Returns the id of the vehicle.
Definition of vehicle stop (position and duration)
void inform(std::string msg, bool addType=true)
adds a new error to the list
A storage for options typed value containers)
int index
at which position in the stops list
void computeRoute(const RORouterProvider &provider, const bool removeLoops, MsgHandler *errorHandler)
Base class for a vehicle's route definition.
Static storage of an output device and its base (abstract) implementation.
bool closeTag()
Closes the most recently opened tag.
const RORoute * getFirstRoute() const
virtual ~ROVehicle()
Destructor.
RORouteDef * getRouteDefinition() const
Returns the definition of the route the vehicle takes.
int size() const
Returns the number of edges in this route.
const std::vector< SUMOVehicleParameter::Stop > & getStops() const
Returns the list of stops this route contains.
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
A complete router's route.