SUMO - Simulation of Urban MObility
RORoute.h
Go to the documentation of this file.
1 /****************************************************************************/
10 // A complete router's route
11 /****************************************************************************/
12 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
13 // Copyright (C) 2002-2017 DLR (http://www.dlr.de/) and contributors
14 /****************************************************************************/
15 //
16 // This file is part of SUMO.
17 // SUMO is free software: you can redistribute it and/or modify
18 // it under the terms of the GNU General Public License as published by
19 // the Free Software Foundation, either version 3 of the License, or
20 // (at your option) any later version.
21 //
22 /****************************************************************************/
23 #ifndef RORoute_h
24 #define RORoute_h
25 
26 
27 // ===========================================================================
28 // included modules
29 // ===========================================================================
30 #ifdef _MSC_VER
31 #include <windows_config.h>
32 #else
33 #include <config.h>
34 #endif
35 
36 #include <string>
37 #include <utils/common/Named.h>
38 #include <utils/common/RGBColor.h>
41 
42 
43 // ===========================================================================
44 // class declarations
45 // ===========================================================================
46 class ROEdge;
47 class ROVehicle;
49 
50 typedef std::vector<const ROEdge*> ConstROEdgeVector;
51 
52 // ===========================================================================
53 // class definitions
54 // ===========================================================================
62 class RORoute : public Named {
63 public:
74  RORoute(const std::string& id, double costs, double prob,
75  const ConstROEdgeVector& route, const RGBColor* const color,
76  const std::vector<SUMOVehicleParameter::Stop>& stops);
77 
78 
84  RORoute(const std::string& id, const ConstROEdgeVector& route);
85 
90  RORoute(const RORoute& src);
91 
92 
94  ~RORoute();
95 
96 
101  const ROEdge* getFirst() const {
102  return myRoute[0];
103  }
104 
105 
110  const ROEdge* getLast() const {
111  return myRoute.back();
112  }
113 
114 
120  double getCosts() const {
121  return myCosts;
122  }
123 
124 
130  double getProbability() const {
131  return myProbability;
132  }
133 
134 
139  void setCosts(double costs);
140 
141 
146  void setProbability(double prob);
147 
148 
153  int size() const {
154  return (int) myRoute.size();
155  }
156 
157 
163  return myRoute;
164  }
165 
170  const RGBColor* getColor() const {
171  return myColor;
172  }
173 
174 
177  void recheckForLoops();
178 
179  OutputDevice&
180  writeXMLDefinition(OutputDevice& dev, const ROVehicle* const veh,
181  const bool withCosts, const bool withExitTimes) const;
182 
185  void addProbability(double prob);
186 
191  const std::vector<SUMOVehicleParameter::Stop>& getStops() const {
192  return myStops;
193  }
194 
197  void addStopOffset(const SUMOTime offset) {
198  for (std::vector<SUMOVehicleParameter::Stop>::iterator stop = myStops.begin(); stop != myStops.end(); ++stop) {
199  if (stop->until >= 0) {
200  stop->until += offset;
201  }
202  }
203  }
204 
205 private:
207  double myCosts;
208 
211 
214 
217 
219  std::vector<SUMOVehicleParameter::Stop> myStops;
220 
221 
222 private:
224  RORoute& operator=(const RORoute& src);
225 
226 };
227 
228 
229 #endif
230 
231 /****************************************************************************/
232 
RORoute & operator=(const RORoute &src)
Invalidated assignment operator.
void setProbability(double prob)
Sets the probability of the route.
Definition: RORoute.cpp:79
void recheckForLoops()
Checks whether this route contains loops and removes such.
Definition: RORoute.cpp:85
void addStopOffset(const SUMOTime offset)
Adapts the until time of all stops by the given offset.
Definition: RORoute.h:197
const ROEdge * getFirst() const
Returns the first edge in the route.
Definition: RORoute.h:101
std::vector< const ROEdge * > ConstROEdgeVector
Definition: ROEdge.h:62
A vehicle as used by router.
Definition: ROVehicle.h:60
std::vector< SUMOVehicleParameter::Stop > myStops
List of the stops on the parsed route.
Definition: RORoute.h:219
double getProbability() const
Returns the probability the driver will take this route with.
Definition: RORoute.h:130
const RGBColor * myColor
The color of the route.
Definition: RORoute.h:216
const std::vector< SUMOVehicleParameter::Stop > & getStops() const
Returns the list of stops this route contains.
Definition: RORoute.h:191
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:47
const ROEdge * getLast() const
Returns the last edge in the route.
Definition: RORoute.h:110
double myProbability
The probability the driver will take this route with.
Definition: RORoute.h:210
double myCosts
The costs of the route.
Definition: RORoute.h:207
const RGBColor * getColor() const
Returns this route&#39;s color.
Definition: RORoute.h:170
A basic edge for routing applications.
Definition: ROEdge.h:77
Base class for objects which have an id.
Definition: Named.h:46
double getCosts() const
Returns the costs of the route.
Definition: RORoute.h:120
int size() const
Returns the number of edges in this route.
Definition: RORoute.h:153
void setCosts(double costs)
Sets the costs of the route.
Definition: RORoute.cpp:73
const ConstROEdgeVector & getEdgeVector() const
Returns the list of edges this route consists of.
Definition: RORoute.h:162
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:71
long long int SUMOTime
Definition: TraCIDefs.h:52
void addProbability(double prob)
add additional vehicles/probability
Definition: RORoute.cpp:90
std::vector< const ROEdge * > ConstROEdgeVector
Definition: RORoute.h:48
OutputDevice & writeXMLDefinition(OutputDevice &dev, const ROVehicle *const veh, const bool withCosts, const bool withExitTimes) const
Definition: RORoute.cpp:96
A complete router&#39;s route.
Definition: RORoute.h:62
~RORoute()
Destructor.
Definition: RORoute.cpp:67
ConstROEdgeVector myRoute
The edges the route consists of.
Definition: RORoute.h:213