Eclipse 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-2019 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
15 // A routable thing such as a vehicle or person
16 /****************************************************************************/
17 #ifndef RORoutable_h
18 #define RORoutable_h
19 
20 
21 // ===========================================================================
22 // included modules
23 // ===========================================================================
24 #include <config.h>
25 
26 #include <string>
27 #include <iostream>
28 #include <utils/common/StdDefs.h>
29 #include <utils/common/SUMOTime.h>
33 
34 // ===========================================================================
35 // class declarations
36 // ===========================================================================
37 class OutputDevice;
38 class ROEdge;
39 class ROLane;
40 class RONode;
41 class ROVehicle;
42 
43 typedef std::vector<const ROEdge*> ConstROEdgeVector;
46 
47 
48 // ===========================================================================
49 // class definitions
50 // ===========================================================================
55 class RORoutable {
56 public:
63  : myParameter(pars), myType(type), myRoutingSuccess(false) {}
64 
65 
67  virtual ~RORoutable() {}
68 
69 
74  inline const SUMOVehicleParameter& getParameter() const {
75  return myParameter;
76  }
77 
78 
85  inline const SUMOVTypeParameter* getType() const {
86  return myType;
87  }
88 
89 
94  inline const std::string& getID() const {
95  return myParameter.id;
96  }
97 
98 
103  inline SUMOTime getDepart() const {
104  return myParameter.depart;
105  }
106 
107 
108  inline SUMOVehicleClass getVClass() const {
109  return getType() != 0 ? getType()->vehicleClass : SVC_IGNORING;
110  }
111 
112 
114  inline double getMaxSpeed() const {
115  return myType->maxSpeed;
116  }
117 
118 
119  virtual const ROEdge* getDepartEdge() const = 0;
120 
121 
122  inline bool isPublicTransport() const {
123  return myParameter.line != "";
124  }
125 
126  inline bool isPartOfFlow() const {
127  return myParameter.repetitionNumber >= 0;
128  }
129 
130  virtual void computeRoute(const RORouterProvider& provider,
131  const bool removeLoops, MsgHandler* errorHandler) = 0;
132 
133 
141  void write(OutputDevice& os, OutputDevice* const altos,
142  OutputDevice* const typeos, OptionsCont& options) const {
143  if (altos == 0 && typeos == 0) {
144  saveAsXML(os, &os, false, options);
145  } else {
146  saveAsXML(os, typeos, false, options);
147  }
148  if (altos != 0) {
149  saveAsXML(*altos, typeos, true, options);
150  }
151  }
152 
153 
154  inline bool getRoutingSuccess() const {
155  return myRoutingSuccess;
156  }
157 
158 
159 protected:
170  virtual void saveAsXML(OutputDevice& os, OutputDevice* const typeos, bool asAlternatives, OptionsCont& options) const = 0;
171 
172 
173 private:
176 
179 
180 protected:
183 
184 
185 private:
187  RORoutable(const RORoutable& src);
188 
190  RORoutable& operator=(const RORoutable& src);
191 
192 };
193 
194 
195 #endif
196 
197 /****************************************************************************/
SUMOVehicleParameter myParameter
The vehicle&#39;s parameter.
Definition: RORoutable.h:175
bool isPartOfFlow() const
Definition: RORoutable.h:126
SUMOVehicleClass getVClass() const
Definition: RORoutable.h:108
long long int SUMOTime
Definition: SUMOTime.h:35
A single lane the router may use.
Definition: ROLane.h:51
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:41
RORoutable & operator=(const RORoutable &src)
Invalidated assignment operator.
double getMaxSpeed() const
Returns the vehicle&#39;s maximum speed.
Definition: RORoutable.h:114
Structure representing possible vehicle parameter.
const SUMOVehicleParameter & getParameter() const
Returns the definition of the vehicle / person parameter.
Definition: RORoutable.h:74
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:141
SUMOVehicleClass vehicleClass
The vehicle&#39;s class.
bool myRoutingSuccess
Whether the last routing was successful.
Definition: RORoutable.h:182
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:44
SUMOTime getDepart() const
Returns the time the vehicle starts at, -1 for triggered vehicles.
Definition: RORoutable.h:103
A routable thing such as a vehicle or person.
Definition: RORoutable.h:55
RouterProvider< ROEdge, ROLane, RONode, ROVehicle > RORouterProvider
Definition: RORoutable.h:45
A vehicle as used by router.
Definition: ROVehicle.h:53
double maxSpeed
The vehicle type&#39;s maximum speed [m/s].
virtual ~RORoutable()
Destructor.
Definition: RORoutable.h:67
bool isPublicTransport() const
Definition: RORoutable.h:122
bool getRoutingSuccess() const
Definition: RORoutable.h:154
const std::string & getID() const
Returns the id of the routable.
Definition: RORoutable.h:94
A basic edge for routing applications.
Definition: ROEdge.h:73
std::string line
The vehicle&#39;s line (mainly for public transport)
RORoutable(const SUMOVehicleParameter &pars, const SUMOVTypeParameter *type)
Constructor.
Definition: RORoutable.h:62
virtual void computeRoute(const RORouterProvider &provider, const bool removeLoops, MsgHandler *errorHandler)=0
const SUMOVTypeParameter *const myType
The type of the vehicle.
Definition: RORoutable.h:178
Structure representing possible vehicle parameter.
const SUMOVTypeParameter * getType() const
Returns the type of the routable.
Definition: RORoutable.h:85
A storage for options typed value containers)
Definition: OptionsCont.h:90
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:64
Base class for nodes used by the router.
Definition: RONode.h:46
vehicles ignoring classes
std::string id
The vehicle&#39;s id.