Eclipse SUMO - Simulation of Urban MObility
RORoute.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2002-2019 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
17 // A complete router's route
18 /****************************************************************************/
19 #ifndef RORoute_h
20 #define RORoute_h
21 
22 
23 // ===========================================================================
24 // included modules
25 // ===========================================================================
26 #include <config.h>
27 
28 #include <string>
29 #include <utils/common/Named.h>
30 #include <utils/common/RGBColor.h>
33 
34 
35 // ===========================================================================
36 // class declarations
37 // ===========================================================================
38 class ROEdge;
39 class ROVehicle;
40 class OutputDevice;
41 
42 typedef std::vector<const ROEdge*> ConstROEdgeVector;
43 
44 // ===========================================================================
45 // class definitions
46 // ===========================================================================
54 class RORoute : public Named {
55 public:
66  RORoute(const std::string& id, double costs, double prob,
67  const ConstROEdgeVector& route, const RGBColor* const color,
68  const std::vector<SUMOVehicleParameter::Stop>& stops);
69 
70 
76  RORoute(const std::string& id, const ConstROEdgeVector& route);
77 
82  RORoute(const RORoute& src);
83 
84 
86  ~RORoute();
87 
88 
93  const ROEdge* getFirst() const {
94  return myRoute[0];
95  }
96 
97 
102  const ROEdge* getLast() const {
103  return myRoute.back();
104  }
105 
106 
112  double getCosts() const {
113  return myCosts;
114  }
115 
116 
122  double getProbability() const {
123  return myProbability;
124  }
125 
126 
131  void setCosts(double costs);
132 
133 
138  void setProbability(double prob);
139 
140 
145  int size() const {
146  return (int) myRoute.size();
147  }
148 
149 
155  return myRoute;
156  }
157 
162  const RGBColor* getColor() const {
163  return myColor;
164  }
165 
166 
169  void recheckForLoops(const ConstROEdgeVector& mandatory);
170 
171  OutputDevice&
172  writeXMLDefinition(OutputDevice& dev, const ROVehicle* const veh,
173  const bool withCosts, const bool withExitTimes) const;
174 
177  void addProbability(double prob);
178 
183  const std::vector<SUMOVehicleParameter::Stop>& getStops() const {
184  return myStops;
185  }
186 
189  void addStopOffset(const SUMOTime offset) {
190  for (std::vector<SUMOVehicleParameter::Stop>::iterator stop = myStops.begin(); stop != myStops.end(); ++stop) {
191  if (stop->until >= 0) {
192  stop->until += offset;
193  }
194  }
195  }
196 
197 private:
199  double myCosts;
200 
203 
206 
209 
211  std::vector<SUMOVehicleParameter::Stop> myStops;
212 
213 
214 private:
216  RORoute& operator=(const RORoute& src);
217 
218 };
219 
220 
221 #endif
222 
223 /****************************************************************************/
224 
RORoute::getLast
const ROEdge * getLast() const
Returns the last edge in the route.
Definition: RORoute.h:102
RORoute::myColor
const RGBColor * myColor
The color of the route.
Definition: RORoute.h:208
RORoute::getProbability
double getProbability() const
Returns the probability the driver will take this route with.
Definition: RORoute.h:122
Named
Base class for objects which have an id.
Definition: Named.h:56
RORoute::getCosts
double getCosts() const
Returns the costs of the route.
Definition: RORoute.h:112
OutputDevice
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:63
ConstROEdgeVector
std::vector< const ROEdge * > ConstROEdgeVector
Definition: RORoute.h:40
RORoute::RORoute
RORoute(const std::string &id, double costs, double prob, const ConstROEdgeVector &route, const RGBColor *const color, const std::vector< SUMOVehicleParameter::Stop > &stops)
Constructor.
Definition: RORoute.cpp:39
SUMOTime
long long int SUMOTime
Definition: SUMOTime.h:34
RORoute::getEdgeVector
const ConstROEdgeVector & getEdgeVector() const
Returns the list of edges this route consists of.
Definition: RORoute.h:154
RORoute::myCosts
double myCosts
The costs of the route.
Definition: RORoute.h:199
RORoute::addProbability
void addProbability(double prob)
add additional vehicles/probability
Definition: RORoute.cpp:82
RORoute::setCosts
void setCosts(double costs)
Sets the costs of the route.
Definition: RORoute.cpp:65
ROVehicle
A vehicle as used by router.
Definition: ROVehicle.h:52
RORoute::getColor
const RGBColor * getColor() const
Returns this route's color.
Definition: RORoute.h:162
RORoute::size
int size() const
Returns the number of edges in this route.
Definition: RORoute.h:145
RGBColor.h
SUMOVehicleParameter.h
RORoute::recheckForLoops
void recheckForLoops(const ConstROEdgeVector &mandatory)
Checks whether this route contains loops and removes such.
Definition: RORoute.cpp:77
RGBColor
Definition: RGBColor.h:39
RORoute::~RORoute
~RORoute()
Destructor.
Definition: RORoute.cpp:59
RORoute::myRoute
ConstROEdgeVector myRoute
The edges the route consists of.
Definition: RORoute.h:205
RORoute::operator=
RORoute & operator=(const RORoute &src)
Invalidated assignment operator.
Named.h
RORoute
A complete router's route.
Definition: RORoute.h:54
RORoute::addStopOffset
void addStopOffset(const SUMOTime offset)
Adapts the until time of all stops by the given offset.
Definition: RORoute.h:189
RORoute::writeXMLDefinition
OutputDevice & writeXMLDefinition(OutputDevice &dev, const ROVehicle *const veh, const bool withCosts, const bool withExitTimes) const
Definition: RORoute.cpp:88
RORoute::setProbability
void setProbability(double prob)
Sets the probability of the route.
Definition: RORoute.cpp:71
RORoute::getFirst
const ROEdge * getFirst() const
Returns the first edge in the route.
Definition: RORoute.h:93
RORoute::myStops
std::vector< SUMOVehicleParameter::Stop > myStops
List of the stops on the parsed route.
Definition: RORoute.h:211
ROEdge
A basic edge for routing applications.
Definition: ROEdge.h:72
config.h
SUMOAbstractRouter.h
RORoute::myProbability
double myProbability
The probability the driver will take this route with.
Definition: RORoute.h:202
ConstROEdgeVector
std::vector< const ROEdge * > ConstROEdgeVector
Definition: ROEdge.h:56
RORoute::getStops
const std::vector< SUMOVehicleParameter::Stop > & getStops() const
Returns the list of stops this route contains.
Definition: RORoute.h:183