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>
38 
39 
40 // ===========================================================================
41 // class declarations
42 // ===========================================================================
43 class ROEdge;
44 class ROVehicle;
45 class OutputDevice;
46 
47 
48 // ===========================================================================
49 // class definitions
50 // ===========================================================================
58 class RORoute : public Named {
59 public:
70  RORoute(const std::string& id, SUMOReal costs, SUMOReal prob,
71  const std::vector<const ROEdge*>& route, const RGBColor* const color);
72 
73 
78  RORoute(const RORoute& src);
79 
80 
82  ~RORoute();
83 
84 
90  void add(ROEdge* edge);
91 
92 
97  const ROEdge* getFirst() const {
98  return myRoute[0];
99  }
100 
101 
106  const ROEdge* getLast() const {
107  return myRoute.back();
108  }
109 
110 
116  SUMOReal getCosts() const {
117  return myCosts;
118  }
119 
120 
127  return myProbability;
128  }
129 
130 
135  void setCosts(SUMOReal costs);
136 
137 
142  void setProbability(SUMOReal prob);
143 
144 
149  unsigned int size() const {
150  return (unsigned int) myRoute.size();
151  }
152 
153 
158  const std::vector<const ROEdge*>& getEdgeVector() const {
159  return myRoute;
160  }
161 
166  const RGBColor* getColor() const {
167  return myColor;
168  }
169 
170 
173  void recheckForLoops();
174 
175  OutputDevice&
176  writeXMLDefinition(OutputDevice& dev, const ROVehicle* const veh,
177  const bool withCosts, const bool withExitTimes) const;
178 
181  void addProbability(SUMOReal prob);
182 
183 private:
186 
189 
191  std::vector<const ROEdge*> myRoute;
192 
195 
196 
197 private:
199  RORoute& operator=(const RORoute& src);
200 
201 };
202 
203 
204 #endif
205 
206 /****************************************************************************/
207 
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:101
void add(ROEdge *edge)
Adds an edge to the end of the route.
Definition: RORoute.cpp:72
unsigned int size() const
Returns the number of edges in this route.
Definition: RORoute.h:149
SUMOReal getCosts() const
Returns the costs of the route.
Definition: RORoute.h:116
void setProbability(SUMOReal prob)
Sets the probability of the route.
Definition: RORoute.cpp:84
void recheckForLoops()
Checks whether this route contains loops and removes such.
Definition: RORoute.cpp:90
void addProbability(SUMOReal prob)
add additional vehicles/probability
Definition: RORoute.cpp:95
A vehicle as used by router.
Definition: ROVehicle.h:57
const ROEdge * getLast() const
Returns the last edge in the route.
Definition: RORoute.h:106
SUMOReal myCosts
The costs of the route.
Definition: RORoute.h:185
const RGBColor * myColor
The color of the route.
Definition: RORoute.h:194
const RGBColor * getColor() const
Returns this route&#39;s color.
Definition: RORoute.h:166
std::vector< const ROEdge * > myRoute
The edges the route consists of.
Definition: RORoute.h:191
SUMOReal getProbability() const
Returns the probability the driver will take this route with.
Definition: RORoute.h:126
void setCosts(SUMOReal costs)
Sets the costs of the route.
Definition: RORoute.cpp:78
SUMOReal myProbability
The probability the driver will take this route with.
Definition: RORoute.h:188
const ROEdge * getFirst() const
Returns the first edge in the route.
Definition: RORoute.h:97
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:158
RORoute(const std::string &id, SUMOReal costs, SUMOReal prob, const std::vector< const ROEdge * > &route, const RGBColor *const color)
Constructor.
Definition: RORoute.cpp:50
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:70
#define SUMOReal
Definition: config.h:221
A complete router&#39;s route.
Definition: RORoute.h:58
~RORoute()
Destructor.
Definition: RORoute.cpp:66