SUMO - Simulation of Urban MObility
RORoutable.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2002-2017 German Aerospace Center (DLR) and others.
4 /****************************************************************************/
5 //
6 // This program and the accompanying materials
7 // are made available under the terms of the Eclipse Public License v2.0
8 // which accompanies this distribution, and is available at
9 // http://www.eclipse.org/legal/epl-v20.html
10 //
11 /****************************************************************************/
17 // A routable thing such as a vehicle or person
18 /****************************************************************************/
19 #ifndef RORoutable_h
20 #define RORoutable_h
21 
22 
23 // ===========================================================================
24 // included modules
25 // ===========================================================================
26 #ifdef _MSC_VER
27 #include <windows_config.h>
28 #else
29 #include <config.h>
30 #endif
31 
32 #include <string>
33 #include <iostream>
34 #include <utils/common/StdDefs.h>
35 #include <utils/common/SUMOTime.h>
39 
40 // ===========================================================================
41 // class declarations
42 // ===========================================================================
43 class OutputDevice;
44 class ROEdge;
45 class ROLane;
46 class RONode;
47 class ROVehicle;
48 
49 typedef std::vector<const ROEdge*> ConstROEdgeVector;
52 
53 
54 // ===========================================================================
55 // class definitions
56 // ===========================================================================
61 class RORoutable {
62 public:
69  : myParameter(pars), myType(type), myRoutingSuccess(false) {}
70 
71 
73  virtual ~RORoutable() {}
74 
75 
80  inline const SUMOVehicleParameter& getParameter() const {
81  return myParameter;
82  }
83 
84 
91  inline const SUMOVTypeParameter* getType() const {
92  return myType;
93  }
94 
95 
100  inline const std::string& getID() const {
101  return myParameter.id;
102  }
103 
104 
109  inline SUMOTime getDepart() const {
110  return myParameter.depart;
111  }
112 
113 
114  inline SUMOVehicleClass getVClass() const {
115  return getType() != 0 ? getType()->vehicleClass : SVC_IGNORING;
116  }
117 
118 
120  inline double getMaxSpeed() const {
121  return myType->maxSpeed;
122  }
123 
124 
125  virtual const ROEdge* getDepartEdge() const = 0;
126 
127 
128  inline bool isPublicTransport() const {
129  return myParameter.line != "";
130  }
131 
132  inline bool isPartOfFlow() const {
133  return myParameter.repetitionNumber >= 0;
134  }
135 
136  virtual void computeRoute(const RORouterProvider& provider,
137  const bool removeLoops, MsgHandler* errorHandler) = 0;
138 
139 
147  void write(OutputDevice& os, OutputDevice* const altos,
148  OutputDevice* const typeos, OptionsCont& options) const {
149  if (altos == 0 && typeos == 0) {
150  saveAsXML(os, &os, false, options);
151  } else {
152  saveAsXML(os, typeos, false, options);
153  }
154  if (altos != 0) {
155  saveAsXML(*altos, typeos, true, options);
156  }
157  }
158 
159 
160  inline bool getRoutingSuccess() const {
161  return myRoutingSuccess;
162  }
163 
164 
165 protected:
176  virtual void saveAsXML(OutputDevice& os, OutputDevice* const typeos, bool asAlternatives, OptionsCont& options) const = 0;
177 
178 
179 private:
182 
185 
186 protected:
189 
190 
191 private:
193  RORoutable(const RORoutable& src);
194 
196  RORoutable& operator=(const RORoutable& src);
197 
198 };
199 
200 
201 #endif
202 
203 /****************************************************************************/
SUMOVehicleParameter myParameter
The vehicle&#39;s parameter.
Definition: RORoutable.h:181
bool isPartOfFlow() const
Definition: RORoutable.h:132
SUMOVehicleClass getVClass() const
Definition: RORoutable.h:114
A single lane the router may use.
Definition: ROLane.h:56
int repetitionNumber
The number of times the vehicle shall be repeatedly inserted.
virtual const ROEdge * getDepartEdge() const =0
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types...
std::vector< const ROEdge * > ConstROEdgeVector
Definition: RORoutable.h:47
RORoutable & operator=(const RORoutable &src)
Invalidated assignment operator.
double getMaxSpeed() const
Returns the vehicle&#39;s maximum speed.
Definition: RORoutable.h:120
Structure representing possible vehicle parameter.
const SUMOVehicleParameter & getParameter() const
Returns the definition of the vehicle / person parameter.
Definition: RORoutable.h:80
void write(OutputDevice &os, OutputDevice *const altos, OutputDevice *const typeos, OptionsCont &options) const
Saves the routable including the vehicle type (if it was not saved before).
Definition: RORoutable.h:147
SUMOVehicleClass vehicleClass
The vehicle&#39;s class.
bool myRoutingSuccess
Whether the last routing was successful.
Definition: RORoutable.h:188
virtual void saveAsXML(OutputDevice &os, OutputDevice *const typeos, bool asAlternatives, OptionsCont &options) const =0
Saves the complete routable description.
IntermodalRouter< ROEdge, ROLane, RONode, ROVehicle > ROIntermodalRouter
Definition: RORoutable.h:50
SUMOTime getDepart() const
Returns the time the vehicle starts at, -1 for triggered vehicles.
Definition: RORoutable.h:109
A routable thing such as a vehicle or person.
Definition: RORoutable.h:61
RouterProvider< ROEdge, ROLane, RONode, ROVehicle > RORouterProvider
Definition: RORoutable.h:51
A vehicle as used by router.
Definition: ROVehicle.h:59
double maxSpeed
The vehicle type&#39;s maximum speed [m/s].
virtual ~RORoutable()
Destructor.
Definition: RORoutable.h:73
bool isPublicTransport() const
Definition: RORoutable.h:128
bool getRoutingSuccess() const
Definition: RORoutable.h:160
SUMOTime depart
The vehicle&#39;s departure time.
const std::string & getID() const
Returns the id of the routable.
Definition: RORoutable.h:100
A basic edge for routing applications.
Definition: ROEdge.h:77
std::string line
The vehicle&#39;s line (mainly for public transport)
RORoutable(const SUMOVehicleParameter &pars, const SUMOVTypeParameter *type)
Constructor.
Definition: RORoutable.h:68
virtual void computeRoute(const RORouterProvider &provider, const bool removeLoops, MsgHandler *errorHandler)=0
const SUMOVTypeParameter *const myType
The type of the vehicle.
Definition: RORoutable.h:184
Structure representing possible vehicle parameter.
const SUMOVTypeParameter * getType() const
Returns the type of the routable.
Definition: RORoutable.h:91
A storage for options typed value containers)
Definition: OptionsCont.h:98
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:70
long long int SUMOTime
Definition: TraCIDefs.h:51
Base class for nodes used by the router.
Definition: RONode.h:52
vehicles ignoring classes
std::string id
The vehicle&#39;s id.