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 /****************************************************************************/
RORoutable::myRoutingSuccess
bool myRoutingSuccess
Whether the last routing was successful.
Definition: RORoutable.h:182
SUMOVehicleClass
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
Definition: SUMOVehicleClass.h:134
ConstROEdgeVector
std::vector< const ROEdge * > ConstROEdgeVector
Definition: RORoutable.h:41
SUMOTime.h
OutputDevice
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:64
IntermodalRouter
Definition: MSNet.h:80
RORoutable::isPublicTransport
bool isPublicTransport() const
Definition: RORoutable.h:122
RORoutable::isPartOfFlow
bool isPartOfFlow() const
Definition: RORoutable.h:126
SUMOTime
long long int SUMOTime
Definition: SUMOTime.h:35
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:51
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:85
ROVehicle
A vehicle as used by router.
Definition: ROVehicle.h:53
SUMOVehicleParameter
Structure representing possible vehicle parameter.
Definition: SUMOVehicleParameter.h:291
ROIntermodalRouter
IntermodalRouter< ROEdge, ROLane, RONode, ROVehicle > ROIntermodalRouter
Definition: RORoutable.h:44
RORoutable::getDepart
SUMOTime getDepart() const
Returns the time the vehicle starts at, -1 for triggered vehicles.
Definition: RORoutable.h:103
SUMOVehicleParameter::depart
SUMOTime depart
Definition: SUMOVehicleParameter.h:476
RORoutable::getVClass
SUMOVehicleClass getVClass() const
Definition: RORoutable.h:108
SUMOVehicleParameter.h
SUMOVehicleParameter::line
std::string line
The vehicle's line (mainly for public transport)
Definition: SUMOVehicleParameter.h:555
MsgHandler
Definition: MsgHandler.h:44
RORoutable::getRoutingSuccess
bool getRoutingSuccess() const
Definition: RORoutable.h:154
SUMOVTypeParameter
Structure representing possible vehicle parameter.
Definition: SUMOVTypeParameter.h:86
RORouterProvider
RouterProvider< ROEdge, ROLane, RONode, ROVehicle > RORouterProvider
Definition: RORoutable.h:45
RORoutable::getParameter
const SUMOVehicleParameter & getParameter() const
Returns the definition of the vehicle / person parameter.
Definition: RORoutable.h:74
SUMOVehicleParameter::id
std::string id
The vehicle's id.
Definition: SUMOVehicleParameter.h:462
RORoutable::getID
const std::string & getID() const
Returns the id of the routable.
Definition: RORoutable.h:94
OptionsCont
A storage for options typed value containers)
Definition: OptionsCont.h:90
SUMOVTypeParameter::maxSpeed
double maxSpeed
The vehicle type's maximum speed [m/s].
Definition: SUMOVTypeParameter.h:219
RouterProvider
Definition: RouterProvider.h:38
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:141
RORoutable
A routable thing such as a vehicle or person.
Definition: RORoutable.h:55
RORoutable::RORoutable
RORoutable(const SUMOVehicleParameter &pars, const SUMOVTypeParameter *type)
Constructor.
Definition: RORoutable.h:62
ROEdge
A basic edge for routing applications.
Definition: ROEdge.h:73
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:178
config.h
StdDefs.h
RORoutable::getMaxSpeed
double getMaxSpeed() const
Returns the vehicle's maximum speed.
Definition: RORoutable.h:114
SUMOVehicleParameter::repetitionNumber
int repetitionNumber
Definition: SUMOVehicleParameter.h:538
SVC_IGNORING
vehicles ignoring classes
Definition: SUMOVehicleClass.h:136
RONode
Base class for nodes used by the router.
Definition: RONode.h:46
SUMOVTypeParameter.h
SUMOVTypeParameter::vehicleClass
SUMOVehicleClass vehicleClass
The vehicle's class.
Definition: SUMOVTypeParameter.h:238
RORoutable::myParameter
SUMOVehicleParameter myParameter
The vehicle's parameter.
Definition: RORoutable.h:175
RORoutable::~RORoutable
virtual ~RORoutable()
Destructor.
Definition: RORoutable.h:67
RORoutable::getDepartEdge
virtual const ROEdge * getDepartEdge() const =0