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-2015 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, SUMOReal costs, SUMOReal prob,
75  const ConstROEdgeVector& route, const RGBColor* const color,
76  const std::vector<SUMOVehicleParameter::Stop>& stops);
77 
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  SUMOReal getCosts() const {
114  return myCosts;
115  }
116 
117 
124  return myProbability;
125  }
126 
127 
132  void setCosts(SUMOReal costs);
133 
134 
139  void setProbability(SUMOReal prob);
140 
141 
146  unsigned int size() const {
147  return (unsigned 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();
171 
172  OutputDevice&
173  writeXMLDefinition(OutputDevice& dev, const ROVehicle* const veh,
174  const bool withCosts, const bool withExitTimes) const;
175 
178  void addProbability(SUMOReal prob);
179 
184  const std::vector<SUMOVehicleParameter::Stop>& getStops() const {
185  return myStops;
186  }
187 
188 private:
191 
194 
197 
200 
202  std::vector<SUMOVehicleParameter::Stop> myStops;
203 
204 
205 private:
207  RORoute& operator=(const RORoute& src);
208 
209 };
210 
211 
212 #endif
213 
214 /****************************************************************************/
215 
RORoute & operator=(const RORoute &src)
Invalidated assignment operator.
OutputDevice & writeXMLDefinition(OutputDevice &dev, const ROVehicle *const veh, const bool withCosts, const bool withExitTimes) const
Definition: RORoute.cpp:97
unsigned int size() const
Returns the number of edges in this route.
Definition: RORoute.h:146
SUMOReal getCosts() const
Returns the costs of the route.
Definition: RORoute.h:113
const ConstROEdgeVector & getEdgeVector() const
Returns the list of edges this route consists of.
Definition: RORoute.h:155
void setProbability(SUMOReal prob)
Sets the probability of the route.
Definition: RORoute.cpp:80
void recheckForLoops()
Checks whether this route contains loops and removes such.
Definition: RORoute.cpp:86
std::vector< const ROEdge * > ConstROEdgeVector
Definition: ROEdge.h:59
void addProbability(SUMOReal prob)
add additional vehicles/probability
Definition: RORoute.cpp:91
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:202
const ROEdge * getLast() const
Returns the last edge in the route.
Definition: RORoute.h:103
SUMOReal myCosts
The costs of the route.
Definition: RORoute.h:190
const RGBColor * myColor
The color of the route.
Definition: RORoute.h:199
const RGBColor * getColor() const
Returns this route's color.
Definition: RORoute.h:163
SUMOReal getProbability() const
Returns the probability the driver will take this route with.
Definition: RORoute.h:123
void setCosts(SUMOReal costs)
Sets the costs of the route.
Definition: RORoute.cpp:74
SUMOReal myProbability
The probability the driver will take this route with.
Definition: RORoute.h:193
const ROEdge * getFirst() const
Returns the first edge in the route.
Definition: RORoute.h:94
A basic edge for routing applications.
Definition: ROEdge.h:73
Base class for objects which have an id.
Definition: Named.h:45
RORoute(const std::string &id, SUMOReal costs, SUMOReal prob, const ConstROEdgeVector &route, const RGBColor *const color, const std::vector< SUMOVehicleParameter::Stop > &stops)
Constructor.
Definition: RORoute.cpp:51
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:71
#define SUMOReal
Definition: config.h:218
std::vector< const ROEdge * > ConstROEdgeVector
Definition: RORoute.h:48
const std::vector< SUMOVehicleParameter::Stop > & getStops() const
Returns the list of stops this route contains.
Definition: RORoute.h:184
A complete router's route.
Definition: RORoute.h:62
~RORoute()
Destructor.
Definition: RORoute.cpp:68
ConstROEdgeVector myRoute
The edges the route consists of.
Definition: RORoute.h:196