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 /****************************************************************************/
8 // A complete router's route
9 /****************************************************************************/
10 // SUMO, Simulation of Urban MObility; see http://sumo-sim.org/
11 // Copyright (C) 2001-2013 DLR (http://www.dlr.de/) and contributors
12 /****************************************************************************/
13 //
14 // This file is part of SUMO.
15 // SUMO is free software: you can redistribute it and/or modify
16 // it under the terms of the GNU General Public License as published by
17 // the Free Software Foundation, either version 3 of the License, or
18 // (at your option) any later version.
19 //
20 /****************************************************************************/
21 #ifndef RORoute_h
22 #define RORoute_h
23 
24 
25 // ===========================================================================
26 // included modules
27 // ===========================================================================
28 #ifdef _MSC_VER
29 #include <windows_config.h>
30 #else
31 #include <config.h>
32 #endif
33 
34 #include <string>
35 #include <utils/common/Named.h>
36 #include <utils/common/RGBColor.h>
39 
40 
41 // ===========================================================================
42 // class declarations
43 // ===========================================================================
44 class ROEdge;
45 class ROVehicle;
46 class OutputDevice;
47 
48 
49 // ===========================================================================
50 // class definitions
51 // ===========================================================================
59 class RORoute : public Named {
60 public:
71  RORoute(const std::string& id, SUMOReal costs, SUMOReal prob,
72  const std::vector<const ROEdge*>& route, const RGBColor* const color,
73  const std::vector<SUMOVehicleParameter::Stop>& stops);
74 
75 
80  RORoute(const RORoute& src);
81 
82 
84  ~RORoute();
85 
86 
91  const ROEdge* getFirst() const {
92  return myRoute[0];
93  }
94 
95 
100  const ROEdge* getLast() const {
101  return myRoute.back();
102  }
103 
104 
110  SUMOReal getCosts() const {
111  return myCosts;
112  }
113 
114 
121  return myProbability;
122  }
123 
124 
129  void setCosts(SUMOReal costs);
130 
131 
136  void setProbability(SUMOReal prob);
137 
138 
143  unsigned int size() const {
144  return (unsigned int) myRoute.size();
145  }
146 
147 
152  const std::vector<const ROEdge*>& getEdgeVector() const {
153  return myRoute;
154  }
155 
160  const RGBColor* getColor() const {
161  return myColor;
162  }
163 
164 
167  void recheckForLoops();
168 
169  OutputDevice&
170  writeXMLDefinition(OutputDevice& dev, const ROVehicle* const veh,
171  const bool withCosts, const bool withExitTimes) const;
172 
175  void addProbability(SUMOReal prob);
176 
181  const std::vector<SUMOVehicleParameter::Stop>& getStops() const {
182  return myStops;
183  }
184 
185 private:
188 
191 
193  std::vector<const ROEdge*> myRoute;
194 
197 
199  std::vector<SUMOVehicleParameter::Stop> myStops;
200 
201 
202 private:
204  RORoute& operator=(const RORoute& src);
205 
206 };
207 
208 
209 #endif
210 
211 /****************************************************************************/
212 
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:96
unsigned int size() const
Returns the number of edges in this route.
Definition: RORoute.h:143
SUMOReal getCosts() const
Returns the costs of the route.
Definition: RORoute.h:110
void setProbability(SUMOReal 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 addProbability(SUMOReal prob)
add additional vehicles/probability
Definition: RORoute.cpp:90
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:50
A vehicle as used by router.
Definition: ROVehicle.h:58
std::vector< SUMOVehicleParameter::Stop > myStops
List of the stops on the parsed route.
Definition: RORoute.h:199
const ROEdge * getLast() const
Returns the last edge in the route.
Definition: RORoute.h:100
SUMOReal myCosts
The costs of the route.
Definition: RORoute.h:187
const RGBColor * myColor
The color of the route.
Definition: RORoute.h:196
const RGBColor * getColor() const
Returns this route&#39;s color.
Definition: RORoute.h:160
std::vector< const ROEdge * > myRoute
The edges the route consists of.
Definition: RORoute.h:193
SUMOReal getProbability() const
Returns the probability the driver will take this route with.
Definition: RORoute.h:120
void setCosts(SUMOReal costs)
Sets the costs of the route.
Definition: RORoute.cpp:73
SUMOReal myProbability
The probability the driver will take this route with.
Definition: RORoute.h:190
const ROEdge * getFirst() const
Returns the first edge in the route.
Definition: RORoute.h:91
A basic edge for routing applications.
Definition: ROEdge.h:67
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:152
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:70
#define SUMOReal
Definition: config.h:215
const std::vector< SUMOVehicleParameter::Stop > & getStops() const
Returns the list of stops this route contains.
Definition: RORoute.h:181
A complete router&#39;s route.
Definition: RORoute.h:59
~RORoute()
Destructor.
Definition: RORoute.cpp:67