SUMO - Simulation of Urban MObility
ROVehicle.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-2018 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 /****************************************************************************/
17 // A vehicle as used by router
18 /****************************************************************************/
19 #ifndef ROVehicle_h
20 #define ROVehicle_h
21 
22 
23 // ===========================================================================
24 // included modules
25 // ===========================================================================
26 #include <config.h>
27 
28 #include <string>
29 #include <iostream>
30 #include <utils/common/StdDefs.h>
31 #include <utils/common/SUMOTime.h>
34 #include "RORoutable.h"
35 
36 
37 // ===========================================================================
38 // class declarations
39 // ===========================================================================
40 class OutputDevice;
41 class ROEdge;
42 class RONet;
43 class RORouteDef;
44 
45 
46 // ===========================================================================
47 // class definitions
48 // ===========================================================================
53 class ROVehicle : public RORoutable {
54 public:
61  ROVehicle(const SUMOVehicleParameter& pars,
62  RORouteDef* route, const SUMOVTypeParameter* type,
63  const RONet* net, MsgHandler* errorHandler = 0);
64 
65 
67  virtual ~ROVehicle();
68 
69 
76  inline RORouteDef* getRouteDefinition() const {
77  return myRoute;
78  }
79 
80 
85  const ROEdge* getDepartEdge() const;
86 
87 
88  void computeRoute(const RORouterProvider& provider,
89  const bool removeLoops, MsgHandler* errorHandler);
90 
95  inline SUMOTime getDepartureTime() const {
96  return MAX2(SUMOTime(0), getParameter().depart);
97  }
98 
99 
100  inline const ConstROEdgeVector& getStopEdges() const {
101  return myStopEdges;
102  }
103 
104 
106  ConstROEdgeVector getMandatoryEdges(const ROEdge* requiredStart, const ROEdge* requiredEnd) const;
107 
112  inline double getChosenSpeedFactor() const {
113  return getType()->speedFactor.getMax();
114  }
115 
116 
127  void saveAsXML(OutputDevice& os, OutputDevice* const typeos, bool asAlternatives, OptionsCont& options) const;
128 
129 
130 private:
136  void addStop(const SUMOVehicleParameter::Stop& stopPar,
137  const RONet* net, MsgHandler* errorHandler);
138 
139 private:
142 
145 
146 
147 private:
149  ROVehicle(const ROVehicle& src);
150 
152  ROVehicle& operator=(const ROVehicle& src);
153 
154 };
155 
156 
157 #endif
158 
159 /****************************************************************************/
long long int SUMOTime
Definition: SUMOTime.h:36
Structure representing possible vehicle parameter.
const SUMOVehicleParameter & getParameter() const
Returns the definition of the vehicle / person parameter.
Definition: RORoutable.h:74
T MAX2(T a, T b)
Definition: StdDefs.h:76
std::vector< const ROEdge * > ConstROEdgeVector
Definition: ROEdge.h:56
ROVehicle(const SUMOVehicleParameter &pars, RORouteDef *route, const SUMOVTypeParameter *type, const RONet *net, MsgHandler *errorHandler=0)
Constructor.
Definition: ROVehicle.cpp:45
RORouteDef *const myRoute
The route the vehicle takes.
Definition: ROVehicle.h:141
double getMax() const
Returns the maximum value of this distribution.
double getChosenSpeedFactor() const
Returns an upper bound for the speed factor of this vehicle.
Definition: ROVehicle.h:112
void addStop(const SUMOVehicleParameter::Stop &stopPar, const RONet *net, MsgHandler *errorHandler)
Adds a stop to this vehicle.
Definition: ROVehicle.cpp:71
A routable thing such as a vehicle or person.
Definition: RORoutable.h:55
const ROEdge * getDepartEdge() const
Returns the first edge the vehicle takes.
Definition: ROVehicle.cpp:118
A vehicle as used by router.
Definition: ROVehicle.h:53
ROVehicle & operator=(const ROVehicle &src)
Invalidated assignment operator.
ConstROEdgeVector getMandatoryEdges(const ROEdge *requiredStart, const ROEdge *requiredEnd) const
compute mandatory edges
Definition: ROVehicle.cpp:164
const ConstROEdgeVector & getStopEdges() const
Definition: ROVehicle.h:100
SUMOTime getDepartureTime() const
Returns the time the vehicle starts at, 0 for triggered vehicles.
Definition: ROVehicle.h:95
A basic edge for routing applications.
Definition: ROEdge.h:72
RORouteDef * getRouteDefinition() const
Returns the definition of the route the vehicle takes.
Definition: ROVehicle.h:76
The router&#39;s network representation.
Definition: RONet.h:68
Structure representing possible vehicle parameter.
const SUMOVTypeParameter * getType() const
Returns the type of the routable.
Definition: RORoutable.h:85
ConstROEdgeVector myStopEdges
The edges where the vehicle stops.
Definition: ROVehicle.h:144
Definition of vehicle stop (position and duration)
A storage for options typed value containers)
Definition: OptionsCont.h:92
void computeRoute(const RORouterProvider &provider, const bool removeLoops, MsgHandler *errorHandler)
Definition: ROVehicle.cpp:124
Base class for a vehicle&#39;s route definition.
Definition: RORouteDef.h:56
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:64
virtual ~ROVehicle()
Destructor.
Definition: ROVehicle.cpp:114
Distribution_Parameterized speedFactor
The factor by which the maximum speed may deviate from the allowed max speed on the street...
void saveAsXML(OutputDevice &os, OutputDevice *const typeos, bool asAlternatives, OptionsCont &options) const
Saves the complete vehicle description.
Definition: ROVehicle.cpp:194