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-2017 German Aerospace Center (DLR) and others.
4 /****************************************************************************/
5 //
6 // This program and the accompanying materials
7 // are made available under the terms of the Eclipse Public License v2.0
8 // which accompanies this distribution, and is available at
9 // http://www.eclipse.org/legal/epl-v20.html
10 //
11 /****************************************************************************/
20 // A complete router's route
21 /****************************************************************************/
22 #ifndef RORoute_h
23 #define RORoute_h
24 
25 
26 // ===========================================================================
27 // included modules
28 // ===========================================================================
29 #ifdef _MSC_VER
30 #include <windows_config.h>
31 #else
32 #include <config.h>
33 #endif
34 
35 #include <string>
36 #include <utils/common/Named.h>
37 #include <utils/common/RGBColor.h>
40 
41 
42 // ===========================================================================
43 // class declarations
44 // ===========================================================================
45 class ROEdge;
46 class ROVehicle;
48 
49 typedef std::vector<const ROEdge*> ConstROEdgeVector;
50 
51 // ===========================================================================
52 // class definitions
53 // ===========================================================================
61 class RORoute : public Named {
62 public:
73  RORoute(const std::string& id, double costs, double prob,
74  const ConstROEdgeVector& route, const RGBColor* const color,
75  const std::vector<SUMOVehicleParameter::Stop>& stops);
76 
77 
83  RORoute(const std::string& id, const ConstROEdgeVector& route);
84 
89  RORoute(const RORoute& src);
90 
91 
93  ~RORoute();
94 
95 
100  const ROEdge* getFirst() const {
101  return myRoute[0];
102  }
103 
104 
109  const ROEdge* getLast() const {
110  return myRoute.back();
111  }
112 
113 
119  double getCosts() const {
120  return myCosts;
121  }
122 
123 
129  double getProbability() const {
130  return myProbability;
131  }
132 
133 
138  void setCosts(double costs);
139 
140 
145  void setProbability(double prob);
146 
147 
152  int size() const {
153  return (int) myRoute.size();
154  }
155 
156 
162  return myRoute;
163  }
164 
169  const RGBColor* getColor() const {
170  return myColor;
171  }
172 
173 
176  void recheckForLoops();
177 
178  OutputDevice&
179  writeXMLDefinition(OutputDevice& dev, const ROVehicle* const veh,
180  const bool withCosts, const bool withExitTimes) const;
181 
184  void addProbability(double prob);
185 
190  const std::vector<SUMOVehicleParameter::Stop>& getStops() const {
191  return myStops;
192  }
193 
196  void addStopOffset(const SUMOTime offset) {
197  for (std::vector<SUMOVehicleParameter::Stop>::iterator stop = myStops.begin(); stop != myStops.end(); ++stop) {
198  if (stop->until >= 0) {
199  stop->until += offset;
200  }
201  }
202  }
203 
204 private:
206  double myCosts;
207 
210 
213 
216 
218  std::vector<SUMOVehicleParameter::Stop> myStops;
219 
220 
221 private:
223  RORoute& operator=(const RORoute& src);
224 
225 };
226 
227 
228 #endif
229 
230 /****************************************************************************/
231 
RORoute & operator=(const RORoute &src)
Invalidated assignment operator.
void setProbability(double prob)
Sets the probability of the route.
Definition: RORoute.cpp:78
void recheckForLoops()
Checks whether this route contains loops and removes such.
Definition: RORoute.cpp:84
void addStopOffset(const SUMOTime offset)
Adapts the until time of all stops by the given offset.
Definition: RORoute.h:196
const ROEdge * getFirst() const
Returns the first edge in the route.
Definition: RORoute.h:100
std::vector< const ROEdge * > ConstROEdgeVector
Definition: ROEdge.h:62
A vehicle as used by router.
Definition: ROVehicle.h:59
std::vector< SUMOVehicleParameter::Stop > myStops
List of the stops on the parsed route.
Definition: RORoute.h:218
double getProbability() const
Returns the probability the driver will take this route with.
Definition: RORoute.h:129
const RGBColor * myColor
The color of the route.
Definition: RORoute.h:215
const std::vector< SUMOVehicleParameter::Stop > & getStops() const
Returns the list of stops this route contains.
Definition: RORoute.h:190
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:46
const ROEdge * getLast() const
Returns the last edge in the route.
Definition: RORoute.h:109
double myProbability
The probability the driver will take this route with.
Definition: RORoute.h:209
double myCosts
The costs of the route.
Definition: RORoute.h:206
const RGBColor * getColor() const
Returns this route&#39;s color.
Definition: RORoute.h:169
A basic edge for routing applications.
Definition: ROEdge.h:77
Base class for objects which have an id.
Definition: Named.h:54
double getCosts() const
Returns the costs of the route.
Definition: RORoute.h:119
int size() const
Returns the number of edges in this route.
Definition: RORoute.h:152
void setCosts(double costs)
Sets the costs of the route.
Definition: RORoute.cpp:72
const ConstROEdgeVector & getEdgeVector() const
Returns the list of edges this route consists of.
Definition: RORoute.h:161
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:70
long long int SUMOTime
Definition: TraCIDefs.h:51
void addProbability(double prob)
add additional vehicles/probability
Definition: RORoute.cpp:89
std::vector< const ROEdge * > ConstROEdgeVector
Definition: RORoute.h:47
OutputDevice & writeXMLDefinition(OutputDevice &dev, const ROVehicle *const veh, const bool withCosts, const bool withExitTimes) const
Definition: RORoute.cpp:95
A complete router&#39;s route.
Definition: RORoute.h:61
~RORoute()
Destructor.
Definition: RORoute.cpp:66
ConstROEdgeVector myRoute
The edges the route consists of.
Definition: RORoute.h:212