SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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-sim.org/
13 // Copyright (C) 2002-2014 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;
48 class OutputDevice;
49 
50 
51 // ===========================================================================
52 // class definitions
53 // ===========================================================================
61 class RORoute : public Named {
62 public:
73  RORoute(const std::string& id, SUMOReal costs, SUMOReal prob,
74  const std::vector<const ROEdge*>& route, const RGBColor* const color,
75  const std::vector<SUMOVehicleParameter::Stop>& stops);
76 
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  SUMOReal getCosts() const {
113  return myCosts;
114  }
115 
116 
123  return myProbability;
124  }
125 
126 
131  void setCosts(SUMOReal costs);
132 
133 
138  void setProbability(SUMOReal prob);
139 
140 
145  unsigned int size() const {
146  return (unsigned int) myRoute.size();
147  }
148 
149 
154  const std::vector<const ROEdge*>& getEdgeVector() const {
155  return myRoute;
156  }
157 
162  const RGBColor* getColor() const {
163  return myColor;
164  }
165 
166 
169  void recheckForLoops();
170 
171  OutputDevice&
172  writeXMLDefinition(OutputDevice& dev, const ROVehicle* const veh,
173  const bool withCosts, const bool withExitTimes) const;
174 
177  void addProbability(SUMOReal prob);
178 
183  const std::vector<SUMOVehicleParameter::Stop>& getStops() const {
184  return myStops;
185  }
186 
187 private:
190 
193 
195  std::vector<const ROEdge*> myRoute;
196 
199 
201  std::vector<SUMOVehicleParameter::Stop> myStops;
202 
203 
204 private:
206  RORoute& operator=(const RORoute& src);
207 
208 };
209 
210 
211 #endif
212 
213 /****************************************************************************/
214 
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:145
SUMOReal getCosts() const
Returns the costs of the route.
Definition: RORoute.h:112
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
void addProbability(SUMOReal prob)
add additional vehicles/probability
Definition: RORoute.cpp:91
RORoute(const std::string &id, SUMOReal costs, SUMOReal prob, const std::vector< const ROEdge * > &route, const RGBColor *const color, const std::vector< SUMOVehicleParameter::Stop > &stops)
Constructor.
Definition: RORoute.cpp:51
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:201
const ROEdge * getLast() const
Returns the last edge in the route.
Definition: RORoute.h:102
SUMOReal myCosts
The costs of the route.
Definition: RORoute.h:189
const RGBColor * myColor
The color of the route.
Definition: RORoute.h:198
const RGBColor * getColor() const
Returns this route's color.
Definition: RORoute.h:162
std::vector< const ROEdge * > myRoute
The edges the route consists of.
Definition: RORoute.h:195
SUMOReal getProbability() const
Returns the probability the driver will take this route with.
Definition: RORoute.h:122
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:192
const ROEdge * getFirst() const
Returns the first edge in the route.
Definition: RORoute.h:93
A basic edge for routing applications.
Definition: ROEdge.h:69
Base class for objects which have an id.
Definition: Named.h:45
const std::vector< const ROEdge * > & getEdgeVector() const
Returns the list of edges this route consists of.
Definition: RORoute.h:154
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:71
#define SUMOReal
Definition: config.h:215
const std::vector< SUMOVehicleParameter::Stop > & getStops() const
Returns the list of stops this route contains.
Definition: RORoute.h:183
A complete router's route.
Definition: RORoute.h:61
~RORoute()
Destructor.
Definition: RORoute.cpp:68