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 /****************************************************************************/
14 // A routable thing such as a vehicle or person
15 /****************************************************************************/
16 #ifndef RORoutable_h
17 #define RORoutable_h
18 
19 
20 // ===========================================================================
21 // included modules
22 // ===========================================================================
23 #include <config.h>
24 
25 #include <string>
26 #include <iostream>
27 #include <utils/common/StdDefs.h>
28 #include <utils/common/SUMOTime.h>
32 
33 // ===========================================================================
34 // class declarations
35 // ===========================================================================
36 class OutputDevice;
37 class ROEdge;
38 class ROLane;
39 class RONode;
40 class ROVehicle;
41 
42 typedef std::vector<const ROEdge*> ConstROEdgeVector;
45 
46 
47 // ===========================================================================
48 // class definitions
49 // ===========================================================================
54 class RORoutable {
55 public:
62  : myParameter(pars), myType(type), myRoutingSuccess(false) {}
63 
64 
66  virtual ~RORoutable() {}
67 
68 
73  inline const SUMOVehicleParameter& getParameter() const {
74  return myParameter;
75  }
76 
77 
84  inline const SUMOVTypeParameter* getType() const {
85  return myType;
86  }
87 
88 
93  inline const std::string& getID() const {
94  return myParameter.id;
95  }
96 
97 
102  inline SUMOTime getDepart() const {
103  return myParameter.depart;
104  }
105 
106 
107  inline SUMOVehicleClass getVClass() const {
108  return getType() != 0 ? getType()->vehicleClass : SVC_IGNORING;
109  }
110 
111 
113  inline double getMaxSpeed() const {
114  return myType->maxSpeed;
115  }
116 
117 
118  virtual const ROEdge* getDepartEdge() const = 0;
119 
120 
121  inline bool isPublicTransport() const {
122  return myParameter.line != "";
123  }
124 
125  inline bool isPartOfFlow() const {
126  return myParameter.repetitionNumber >= 0;
127  }
128 
129  virtual void computeRoute(const RORouterProvider& provider,
130  const bool removeLoops, MsgHandler* errorHandler) = 0;
131 
132 
140  void write(OutputDevice& os, OutputDevice* const altos,
141  OutputDevice* const typeos, OptionsCont& options) const {
142  if (altos == 0 && typeos == 0) {
143  saveAsXML(os, &os, false, options);
144  } else {
145  saveAsXML(os, typeos, false, options);
146  }
147  if (altos != 0) {
148  saveAsXML(*altos, typeos, true, options);
149  }
150  }
151 
152 
153  inline bool getRoutingSuccess() const {
154  return myRoutingSuccess;
155  }
156 
157 
158 protected:
169  virtual void saveAsXML(OutputDevice& os, OutputDevice* const typeos, bool asAlternatives, OptionsCont& options) const = 0;
170 
171 
172 private:
175 
178 
179 protected:
182 
183 
184 private:
186  RORoutable(const RORoutable& src);
187 
189  RORoutable& operator=(const RORoutable& src);
190 
191 };
192 
193 
194 #endif
195 
196 /****************************************************************************/
RORoutable::myRoutingSuccess
bool myRoutingSuccess
Whether the last routing was successful.
Definition: RORoutable.h:181
SUMOVehicleClass
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
Definition: SUMOVehicleClass.h:133
ConstROEdgeVector
std::vector< const ROEdge * > ConstROEdgeVector
Definition: RORoutable.h:40
SUMOTime.h
OutputDevice
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:63
IntermodalRouter
Definition: MSNet.h:79
RORoutable::isPublicTransport
bool isPublicTransport() const
Definition: RORoutable.h:121
RORoutable::isPartOfFlow
bool isPartOfFlow() const
Definition: RORoutable.h:125
SUMOTime
long long int SUMOTime
Definition: SUMOTime.h:34
RORoutable::saveAsXML
virtual void saveAsXML(OutputDevice &os, OutputDevice *const typeos, bool asAlternatives, OptionsCont &options) const =0
Saves the complete routable description.
ROLane
A single lane the router may use.
Definition: ROLane.h:50
RORoutable::operator=
RORoutable & operator=(const RORoutable &src)
Invalidated assignment operator.
RORoutable::getType
const SUMOVTypeParameter * getType() const
Returns the type of the routable.
Definition: RORoutable.h:84
ROVehicle
A vehicle as used by router.
Definition: ROVehicle.h:52
SUMOVehicleParameter
Structure representing possible vehicle parameter.
Definition: SUMOVehicleParameter.h:297
ROIntermodalRouter
IntermodalRouter< ROEdge, ROLane, RONode, ROVehicle > ROIntermodalRouter
Definition: RORoutable.h:43
RORoutable::getDepart
SUMOTime getDepart() const
Returns the time the vehicle starts at, -1 for triggered vehicles.
Definition: RORoutable.h:102
SUMOVehicleParameter::depart
SUMOTime depart
Definition: SUMOVehicleParameter.h:482
RORoutable::getVClass
SUMOVehicleClass getVClass() const
Definition: RORoutable.h:107
SUMOVehicleParameter.h
SUMOVehicleParameter::line
std::string line
The vehicle's line (mainly for public transport)
Definition: SUMOVehicleParameter.h:561
MsgHandler
Definition: MsgHandler.h:38
RORoutable::getRoutingSuccess
bool getRoutingSuccess() const
Definition: RORoutable.h:153
SUMOVTypeParameter
Structure representing possible vehicle parameter.
Definition: SUMOVTypeParameter.h:86
RORouterProvider
RouterProvider< ROEdge, ROLane, RONode, ROVehicle > RORouterProvider
Definition: RORoutable.h:44
RORoutable::getParameter
const SUMOVehicleParameter & getParameter() const
Returns the definition of the vehicle / person parameter.
Definition: RORoutable.h:73
SUMOVehicleParameter::id
std::string id
The vehicle's id.
Definition: SUMOVehicleParameter.h:468
RORoutable::getID
const std::string & getID() const
Returns the id of the routable.
Definition: RORoutable.h:93
OptionsCont
A storage for options typed value containers)
Definition: OptionsCont.h:89
SUMOVTypeParameter::maxSpeed
double maxSpeed
The vehicle type's maximum speed [m/s].
Definition: SUMOVTypeParameter.h:221
RouterProvider
Definition: RouterProvider.h:37
RORoutable::write
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:140
RORoutable
A routable thing such as a vehicle or person.
Definition: RORoutable.h:54
RORoutable::RORoutable
RORoutable(const SUMOVehicleParameter &pars, const SUMOVTypeParameter *type)
Constructor.
Definition: RORoutable.h:61
ROEdge
A basic edge for routing applications.
Definition: ROEdge.h:72
RORoutable::computeRoute
virtual void computeRoute(const RORouterProvider &provider, const bool removeLoops, MsgHandler *errorHandler)=0
RouterProvider.h
RORoutable::myType
const SUMOVTypeParameter *const myType
The type of the vehicle.
Definition: RORoutable.h:177
config.h
StdDefs.h
RORoutable::getMaxSpeed
double getMaxSpeed() const
Returns the vehicle's maximum speed.
Definition: RORoutable.h:113
SUMOVehicleParameter::repetitionNumber
int repetitionNumber
Definition: SUMOVehicleParameter.h:544
SVC_IGNORING
vehicles ignoring classes
Definition: SUMOVehicleClass.h:135
RONode
Base class for nodes used by the router.
Definition: RONode.h:45
SUMOVTypeParameter.h
SUMOVTypeParameter::vehicleClass
SUMOVehicleClass vehicleClass
The vehicle's class.
Definition: SUMOVTypeParameter.h:240
RORoutable::myParameter
SUMOVehicleParameter myParameter
The vehicle's parameter.
Definition: RORoutable.h:174
RORoutable::~RORoutable
virtual ~RORoutable()
Destructor.
Definition: RORoutable.h:66
RORoutable::getDepartEdge
virtual const ROEdge * getDepartEdge() const =0