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 /****************************************************************************/
18 // A complete router's route
19 /****************************************************************************/
20 #ifndef RORoute_h
21 #define RORoute_h
22 
23 
24 // ===========================================================================
25 // included modules
26 // ===========================================================================
27 #include <config.h>
28 
29 #include <string>
30 #include <utils/common/Named.h>
31 #include <utils/common/RGBColor.h>
34 
35 
36 // ===========================================================================
37 // class declarations
38 // ===========================================================================
39 class ROEdge;
40 class ROVehicle;
42 
43 typedef std::vector<const ROEdge*> ConstROEdgeVector;
44 
45 // ===========================================================================
46 // class definitions
47 // ===========================================================================
55 class RORoute : public Named {
56 public:
67  RORoute(const std::string& id, double costs, double prob,
68  const ConstROEdgeVector& route, const RGBColor* const color,
69  const std::vector<SUMOVehicleParameter::Stop>& stops);
70 
71 
77  RORoute(const std::string& id, const ConstROEdgeVector& route);
78 
83  RORoute(const RORoute& src);
84 
85 
87  ~RORoute();
88 
89 
94  const ROEdge* getFirst() const {
95  return myRoute[0];
96  }
97 
98 
103  const ROEdge* getLast() const {
104  return myRoute.back();
105  }
106 
107 
113  double getCosts() const {
114  return myCosts;
115  }
116 
117 
123  double getProbability() const {
124  return myProbability;
125  }
126 
127 
132  void setCosts(double costs);
133 
134 
139  void setProbability(double prob);
140 
141 
146  int size() const {
147  return (int) myRoute.size();
148  }
149 
150 
156  return myRoute;
157  }
158 
163  const RGBColor* getColor() const {
164  return myColor;
165  }
166 
167 
170  void recheckForLoops(const ConstROEdgeVector& mandatory);
171 
172  OutputDevice&
173  writeXMLDefinition(OutputDevice& dev, const ROVehicle* const veh,
174  const bool withCosts, const bool withExitTimes) const;
175 
178  void addProbability(double prob);
179 
184  const std::vector<SUMOVehicleParameter::Stop>& getStops() const {
185  return myStops;
186  }
187 
190  void addStopOffset(const SUMOTime offset) {
191  for (std::vector<SUMOVehicleParameter::Stop>::iterator stop = myStops.begin(); stop != myStops.end(); ++stop) {
192  if (stop->until >= 0) {
193  stop->until += offset;
194  }
195  }
196  }
197 
198 private:
200  double myCosts;
201 
204 
207 
210 
212  std::vector<SUMOVehicleParameter::Stop> myStops;
213 
214 
215 private:
217  RORoute& operator=(const RORoute& src);
218 
219 };
220 
221 
222 #endif
223 
224 /****************************************************************************/
225 
RORoute & operator=(const RORoute &src)
Invalidated assignment operator.
void setProbability(double prob)
Sets the probability of the route.
Definition: RORoute.cpp:72
long long int SUMOTime
Definition: SUMOTime.h:35
void addStopOffset(const SUMOTime offset)
Adapts the until time of all stops by the given offset.
Definition: RORoute.h:190
const ROEdge * getFirst() const
Returns the first edge in the route.
Definition: RORoute.h:94
std::vector< const ROEdge * > ConstROEdgeVector
Definition: ROEdge.h:57
A vehicle as used by router.
Definition: ROVehicle.h:53
std::vector< SUMOVehicleParameter::Stop > myStops
List of the stops on the parsed route.
Definition: RORoute.h:212
double getProbability() const
Returns the probability the driver will take this route with.
Definition: RORoute.h:123
const RGBColor * myColor
The color of the route.
Definition: RORoute.h:209
const std::vector< SUMOVehicleParameter::Stop > & getStops() const
Returns the list of stops this route contains.
Definition: RORoute.h:184
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:40
const ROEdge * getLast() const
Returns the last edge in the route.
Definition: RORoute.h:103
double myProbability
The probability the driver will take this route with.
Definition: RORoute.h:203
double myCosts
The costs of the route.
Definition: RORoute.h:200
const RGBColor * getColor() const
Returns this route&#39;s color.
Definition: RORoute.h:163
A basic edge for routing applications.
Definition: ROEdge.h:73
Base class for objects which have an id.
Definition: Named.h:57
double getCosts() const
Returns the costs of the route.
Definition: RORoute.h:113
int size() const
Returns the number of edges in this route.
Definition: RORoute.h:146
void setCosts(double costs)
Sets the costs of the route.
Definition: RORoute.cpp:66
const ConstROEdgeVector & getEdgeVector() const
Returns the list of edges this route consists of.
Definition: RORoute.h:155
void recheckForLoops(const ConstROEdgeVector &mandatory)
Checks whether this route contains loops and removes such.
Definition: RORoute.cpp:78
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:64
void addProbability(double prob)
add additional vehicles/probability
Definition: RORoute.cpp:83
std::vector< const ROEdge * > ConstROEdgeVector
Definition: RORoute.h:41
OutputDevice & writeXMLDefinition(OutputDevice &dev, const ROVehicle *const veh, const bool withCosts, const bool withExitTimes) const
Definition: RORoute.cpp:89
A complete router&#39;s route.
Definition: RORoute.h:55
~RORoute()
Destructor.
Definition: RORoute.cpp:60
ConstROEdgeVector myRoute
The edges the route consists of.
Definition: RORoute.h:206