Eclipse 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-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 /****************************************************************************/
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 /****************************************************************************/
SUMOTime.h
ROVehicle::getDepartureTime
SUMOTime getDepartureTime() const
Returns the time the vehicle starts at, 0 for triggered vehicles.
Definition: ROVehicle.h:95
OutputDevice
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:64
ROVehicle::addStop
void addStop(const SUMOVehicleParameter::Stop &stopPar, const RONet *net, MsgHandler *errorHandler)
Adds a stop to this vehicle.
Definition: ROVehicle.cpp:73
SUMOTime
long long int SUMOTime
Definition: SUMOTime.h:35
RORouteDef
Base class for a vehicle's route definition.
Definition: RORouteDef.h:56
RONet
The router's network representation.
Definition: RONet.h:64
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
RORoutable.h
SUMOVehicleParameter
Structure representing possible vehicle parameter.
Definition: SUMOVehicleParameter.h:291
ROVehicle::getChosenSpeedFactor
double getChosenSpeedFactor() const
Returns an upper bound for the speed factor of this vehicle.
Definition: ROVehicle.h:112
SUMOVehicleParameter.h
MAX2
T MAX2(T a, T b)
Definition: StdDefs.h:80
ROVehicle::operator=
ROVehicle & operator=(const ROVehicle &src)
Invalidated assignment operator.
ROVehicle::ROVehicle
ROVehicle(const SUMOVehicleParameter &pars, RORouteDef *route, const SUMOVTypeParameter *type, const RONet *net, MsgHandler *errorHandler=0)
Constructor.
Definition: ROVehicle.cpp:47
MsgHandler
Definition: MsgHandler.h:44
SUMOVTypeParameter
Structure representing possible vehicle parameter.
Definition: SUMOVTypeParameter.h:86
ROVehicle::getMandatoryEdges
ConstROEdgeVector getMandatoryEdges(const ROEdge *requiredStart, const ROEdge *requiredEnd) const
compute mandatory edges
Definition: ROVehicle.cpp:166
RORoutable::getParameter
const SUMOVehicleParameter & getParameter() const
Returns the definition of the vehicle / person parameter.
Definition: RORoutable.h:74
Distribution_Parameterized::getMax
double getMax() const
Returns the maximum value of this distribution.
Definition: Distribution_Parameterized.cpp:102
ROVehicle::getDepartEdge
const ROEdge * getDepartEdge() const
Returns the first edge the vehicle takes.
Definition: ROVehicle.cpp:120
ROVehicle::getRouteDefinition
RORouteDef * getRouteDefinition() const
Returns the definition of the route the vehicle takes.
Definition: ROVehicle.h:76
OptionsCont
A storage for options typed value containers)
Definition: OptionsCont.h:90
RouterProvider
Definition: RouterProvider.h:38
ROVehicle::getStopEdges
const ConstROEdgeVector & getStopEdges() const
Definition: ROVehicle.h:100
SUMOVTypeParameter::speedFactor
Distribution_Parameterized speedFactor
The factor by which the maximum speed may deviate from the allowed max speed on the street.
Definition: SUMOVTypeParameter.h:229
RORoutable
A routable thing such as a vehicle or person.
Definition: RORoutable.h:55
ROEdge
A basic edge for routing applications.
Definition: ROEdge.h:73
config.h
ROVehicle::computeRoute
void computeRoute(const RORouterProvider &provider, const bool removeLoops, MsgHandler *errorHandler)
Definition: ROVehicle.cpp:126
ROVehicle::~ROVehicle
virtual ~ROVehicle()
Destructor.
Definition: ROVehicle.cpp:116
StdDefs.h
ROVehicle::myRoute
RORouteDef *const myRoute
The route the vehicle takes.
Definition: ROVehicle.h:141
SUMOVTypeParameter.h
ROVehicle::myStopEdges
ConstROEdgeVector myStopEdges
The edges where the vehicle stops.
Definition: ROVehicle.h:144
ConstROEdgeVector
std::vector< const ROEdge * > ConstROEdgeVector
Definition: ROEdge.h:57
SUMOVehicleParameter::Stop
Definition of vehicle stop (position and duration)
Definition: SUMOVehicleParameter.h:566
ROVehicle::saveAsXML
void saveAsXML(OutputDevice &os, OutputDevice *const typeos, bool asAlternatives, OptionsCont &options) const
Saves the complete vehicle description.
Definition: ROVehicle.cpp:196