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 /****************************************************************************/
16 // A vehicle as used by router
17 /****************************************************************************/
18 #ifndef ROVehicle_h
19 #define ROVehicle_h
20 
21 
22 // ===========================================================================
23 // included modules
24 // ===========================================================================
25 #include <config.h>
26 
27 #include <string>
28 #include <iostream>
29 #include <utils/common/StdDefs.h>
30 #include <utils/common/SUMOTime.h>
33 #include "RORoutable.h"
34 
35 
36 // ===========================================================================
37 // class declarations
38 // ===========================================================================
39 class OutputDevice;
40 class ROEdge;
41 class RONet;
42 class RORouteDef;
43 
44 
45 // ===========================================================================
46 // class definitions
47 // ===========================================================================
52 class ROVehicle : public RORoutable {
53 public:
60  ROVehicle(const SUMOVehicleParameter& pars,
61  RORouteDef* route, const SUMOVTypeParameter* type,
62  const RONet* net, MsgHandler* errorHandler = 0);
63 
64 
66  virtual ~ROVehicle();
67 
68 
75  inline RORouteDef* getRouteDefinition() const {
76  return myRoute;
77  }
78 
79 
84  const ROEdge* getDepartEdge() const;
85 
86 
87  void computeRoute(const RORouterProvider& provider,
88  const bool removeLoops, MsgHandler* errorHandler);
89 
94  inline SUMOTime getDepartureTime() const {
95  return MAX2(SUMOTime(0), getParameter().depart);
96  }
97 
98 
99  inline const ConstROEdgeVector& getStopEdges() const {
100  return myStopEdges;
101  }
102 
103 
105  ConstROEdgeVector getMandatoryEdges(const ROEdge* requiredStart, const ROEdge* requiredEnd) const;
106 
111  inline double getChosenSpeedFactor() const {
112  return getType()->speedFactor.getMax();
113  }
114 
115 
126  void saveAsXML(OutputDevice& os, OutputDevice* const typeos, bool asAlternatives, OptionsCont& options) const;
127 
128 
129 private:
135  void addStop(const SUMOVehicleParameter::Stop& stopPar,
136  const RONet* net, MsgHandler* errorHandler);
137 
138 private:
141 
144 
145 
146 private:
148  ROVehicle(const ROVehicle& src);
149 
152 
153 };
154 
155 
156 #endif
157 
158 /****************************************************************************/
SUMOTime.h
ROVehicle::getDepartureTime
SUMOTime getDepartureTime() const
Returns the time the vehicle starts at, 0 for triggered vehicles.
Definition: ROVehicle.h:94
OutputDevice
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:63
ROVehicle::addStop
void addStop(const SUMOVehicleParameter::Stop &stopPar, const RONet *net, MsgHandler *errorHandler)
Adds a stop to this vehicle.
Definition: ROVehicle.cpp:72
SUMOTime
long long int SUMOTime
Definition: SUMOTime.h:34
RORouteDef
Base class for a vehicle's route definition.
Definition: RORouteDef.h:55
RONet
The router's network representation.
Definition: RONet.h:63
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
RORoutable.h
SUMOVehicleParameter
Structure representing possible vehicle parameter.
Definition: SUMOVehicleParameter.h:297
ROVehicle::getChosenSpeedFactor
double getChosenSpeedFactor() const
Returns an upper bound for the speed factor of this vehicle.
Definition: ROVehicle.h:111
SUMOVehicleParameter.h
MAX2
T MAX2(T a, T b)
Definition: StdDefs.h:79
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:46
MsgHandler
Definition: MsgHandler.h:38
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:165
RORoutable::getParameter
const SUMOVehicleParameter & getParameter() const
Returns the definition of the vehicle / person parameter.
Definition: RORoutable.h:73
Distribution_Parameterized::getMax
double getMax() const
Returns the maximum value of this distribution.
Definition: Distribution_Parameterized.cpp:101
ROVehicle::getDepartEdge
const ROEdge * getDepartEdge() const
Returns the first edge the vehicle takes.
Definition: ROVehicle.cpp:119
ROVehicle::getRouteDefinition
RORouteDef * getRouteDefinition() const
Returns the definition of the route the vehicle takes.
Definition: ROVehicle.h:75
OptionsCont
A storage for options typed value containers)
Definition: OptionsCont.h:89
RouterProvider
Definition: RouterProvider.h:37
ROVehicle::getStopEdges
const ConstROEdgeVector & getStopEdges() const
Definition: ROVehicle.h:99
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:231
RORoutable
A routable thing such as a vehicle or person.
Definition: RORoutable.h:54
ROVehicle::ROVehicle
ROVehicle(const ROVehicle &src)
Invalidated copy constructor.
ROEdge
A basic edge for routing applications.
Definition: ROEdge.h:72
config.h
ROVehicle::computeRoute
void computeRoute(const RORouterProvider &provider, const bool removeLoops, MsgHandler *errorHandler)
Definition: ROVehicle.cpp:125
ROVehicle::~ROVehicle
virtual ~ROVehicle()
Destructor.
Definition: ROVehicle.cpp:115
StdDefs.h
ROVehicle::myRoute
RORouteDef *const myRoute
The route the vehicle takes.
Definition: ROVehicle.h:140
SUMOVTypeParameter.h
ROVehicle::myStopEdges
ConstROEdgeVector myStopEdges
The edges where the vehicle stops.
Definition: ROVehicle.h:143
ConstROEdgeVector
std::vector< const ROEdge * > ConstROEdgeVector
Definition: ROEdge.h:56
SUMOVehicleParameter::Stop
Definition of vehicle stop (position and duration)
Definition: SUMOVehicleParameter.h:572
ROVehicle::saveAsXML
void saveAsXML(OutputDevice &os, OutputDevice *const typeos, bool asAlternatives, OptionsCont &options) const
Saves the complete vehicle description.
Definition: ROVehicle.cpp:195