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-2017 German Aerospace Center (DLR) and others.
4 /****************************************************************************/
5 //
6 // This program and the accompanying materials
7 // are made available under the terms of the Eclipse Public License v2.0
8 // which accompanies this distribution, and is available at
9 // http://www.eclipse.org/legal/epl-v20.html
10 //
11 /****************************************************************************/
19 // A vehicle as used by router
20 /****************************************************************************/
21 #ifndef ROVehicle_h
22 #define ROVehicle_h
23 
24 
25 // ===========================================================================
26 // included modules
27 // ===========================================================================
28 #ifdef _MSC_VER
29 #include <windows_config.h>
30 #else
31 #include <config.h>
32 #endif
33 
34 #include <string>
35 #include <iostream>
36 #include <utils/common/StdDefs.h>
37 #include <utils/common/SUMOTime.h>
40 #include "RORoutable.h"
41 
42 
43 // ===========================================================================
44 // class declarations
45 // ===========================================================================
46 class OutputDevice;
47 class ROEdge;
48 class RONet;
49 class RORouteDef;
50 
51 
52 // ===========================================================================
53 // class definitions
54 // ===========================================================================
59 class ROVehicle : public RORoutable {
60 public:
67  ROVehicle(const SUMOVehicleParameter& pars,
68  RORouteDef* route, const SUMOVTypeParameter* type,
69  const RONet* net, MsgHandler* errorHandler = 0);
70 
71 
73  virtual ~ROVehicle();
74 
75 
82  inline RORouteDef* getRouteDefinition() const {
83  return myRoute;
84  }
85 
86 
91  const ROEdge* getDepartEdge() const;
92 
93 
94  void computeRoute(const RORouterProvider& provider,
95  const bool removeLoops, MsgHandler* errorHandler);
96 
101  inline SUMOTime getDepartureTime() const {
102  return MAX2(SUMOTime(0), getParameter().depart);
103  }
104 
105 
106  inline const ConstROEdgeVector& getStopEdges() const {
107  return myStopEdges;
108  }
109 
114  inline double getChosenSpeedFactor() const {
115  return getType()->speedFactor.getMax();
116  }
117 
118 
129  void saveAsXML(OutputDevice& os, OutputDevice* const typeos, bool asAlternatives, OptionsCont& options) const;
130 
131 
132 private:
138  void addStop(const SUMOVehicleParameter::Stop& stopPar,
139  const RONet* net, MsgHandler* errorHandler);
140 
141 private:
144 
147 
148 
149 private:
151  ROVehicle(const ROVehicle& src);
152 
154  ROVehicle& operator=(const ROVehicle& src);
155 
156 };
157 
158 
159 #endif
160 
161 /****************************************************************************/
Structure representing possible vehicle parameter.
const SUMOVehicleParameter & getParameter() const
Returns the definition of the vehicle / person parameter.
Definition: RORoutable.h:80
T MAX2(T a, T b)
Definition: StdDefs.h:73
std::vector< const ROEdge * > ConstROEdgeVector
Definition: ROEdge.h:62
ROVehicle(const SUMOVehicleParameter &pars, RORouteDef *route, const SUMOVTypeParameter *type, const RONet *net, MsgHandler *errorHandler=0)
Constructor.
Definition: ROVehicle.cpp:51
RORouteDef *const myRoute
The route the vehicle takes.
Definition: ROVehicle.h:143
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:114
void addStop(const SUMOVehicleParameter::Stop &stopPar, const RONet *net, MsgHandler *errorHandler)
Adds a stop to this vehicle.
Definition: ROVehicle.cpp:77
A routable thing such as a vehicle or person.
Definition: RORoutable.h:61
const ROEdge * getDepartEdge() const
Returns the first edge the vehicle takes.
Definition: ROVehicle.cpp:124
A vehicle as used by router.
Definition: ROVehicle.h:59
ROVehicle & operator=(const ROVehicle &src)
Invalidated assignment operator.
const ConstROEdgeVector & getStopEdges() const
Definition: ROVehicle.h:106
SUMOTime getDepartureTime() const
Returns the time the vehicle starts at, 0 for triggered vehicles.
Definition: ROVehicle.h:101
A basic edge for routing applications.
Definition: ROEdge.h:77
RORouteDef * getRouteDefinition() const
Returns the definition of the route the vehicle takes.
Definition: ROVehicle.h:82
The router&#39;s network representation.
Definition: RONet.h:74
Structure representing possible vehicle parameter.
const SUMOVTypeParameter * getType() const
Returns the type of the routable.
Definition: RORoutable.h:91
ConstROEdgeVector myStopEdges
The edges where the vehicle stops.
Definition: ROVehicle.h:146
Definition of vehicle stop (position and duration)
A storage for options typed value containers)
Definition: OptionsCont.h:98
void computeRoute(const RORouterProvider &provider, const bool removeLoops, MsgHandler *errorHandler)
Definition: ROVehicle.cpp:130
Base class for a vehicle&#39;s route definition.
Definition: RORouteDef.h:62
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:70
long long int SUMOTime
Definition: TraCIDefs.h:51
virtual ~ROVehicle()
Destructor.
Definition: ROVehicle.cpp:120
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:166