SUMO - Simulation of Urban MObility
ROVehicle.h
Go to the documentation of this file.
1 /****************************************************************************/
9 // A vehicle as used by router
10 /****************************************************************************/
11 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
12 // Copyright (C) 2002-2016 DLR (http://www.dlr.de/) and contributors
13 /****************************************************************************/
14 //
15 // This file is part of SUMO.
16 // SUMO is free software: you can redistribute it and/or modify
17 // it under the terms of the GNU General Public License as published by
18 // the Free Software Foundation, either version 3 of the License, or
19 // (at your option) any later version.
20 //
21 /****************************************************************************/
22 #ifndef ROVehicle_h
23 #define ROVehicle_h
24 
25 
26 // ===========================================================================
27 // included modules
28 // ===========================================================================
29 #ifdef _MSC_VER
30 #include <windows_config.h>
31 #else
32 #include <config.h>
33 #endif
34 
35 #include <string>
36 #include <iostream>
37 #include <utils/common/StdDefs.h>
38 #include <utils/common/SUMOTime.h>
41 #include "RORoutable.h"
42 
43 
44 // ===========================================================================
45 // class declarations
46 // ===========================================================================
47 class OutputDevice;
48 class ROEdge;
49 class RONet;
50 class RORouteDef;
51 
52 
53 // ===========================================================================
54 // class definitions
55 // ===========================================================================
60 class ROVehicle : public RORoutable {
61 public:
68  ROVehicle(const SUMOVehicleParameter& pars,
69  RORouteDef* route, const SUMOVTypeParameter* type,
70  const RONet* net, MsgHandler* errorHandler = 0);
71 
72 
74  virtual ~ROVehicle();
75 
76 
83  inline RORouteDef* getRouteDefinition() const {
84  return myRoute;
85  }
86 
87 
92  inline const SUMOVehicleParameter& getParameter() const {
93  return myParameter;
94  }
95 
96 
101  const ROEdge* getDepartEdge() const;
102 
103 
104  void computeRoute(const RORouterProvider& provider,
105  const bool removeLoops, MsgHandler* errorHandler);
106 
111  inline SUMOTime getDepartureTime() const {
112  return MAX2(SUMOTime(0), myParameter.depart);
113  }
114 
115 
116  inline const ConstROEdgeVector& getStopEdges() const {
117  return myStopEdges;
118  }
119 
125  return SUMOReal(2. * getType()->speedDev + 1.) * getType()->speedFactor;
126  }
127 
128 
139  void saveAsXML(OutputDevice& os, OutputDevice* const typeos, bool asAlternatives, OptionsCont& options) const;
140 
141 
142 private:
148  void addStop(const SUMOVehicleParameter::Stop& stopPar,
149  const RONet* net, MsgHandler* errorHandler);
150 
151 private:
154 
157 
158 
159 private:
161  ROVehicle(const ROVehicle& src);
162 
164  ROVehicle& operator=(const ROVehicle& src);
165 
166 };
167 
168 
169 #endif
170 
171 /****************************************************************************/
SUMOVehicleParameter myParameter
The vehicle&#39;s parameter.
Definition: RORoutable.h:165
long long int SUMOTime
Definition: SUMOTime.h:43
Structure representing possible vehicle parameter.
T MAX2(T a, T b)
Definition: StdDefs.h:75
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:56
RORouteDef *const myRoute
The route the vehicle takes.
Definition: ROVehicle.h:153
void addStop(const SUMOVehicleParameter::Stop &stopPar, const RONet *net, MsgHandler *errorHandler)
Adds a stop to this vehicle.
Definition: ROVehicle.cpp:82
A routable thing such as a vehicle or person.
Definition: RORoutable.h:62
const ROEdge * getDepartEdge() const
Returns the first edge the vehicle takes.
Definition: ROVehicle.cpp:129
A vehicle as used by router.
Definition: ROVehicle.h:60
SUMOReal speedFactor
The factor by which the maximum speed may deviate from the allowed max speed on the street...
ROVehicle & operator=(const ROVehicle &src)
Invalidated assignment operator.
SUMOReal getChosenSpeedFactor() const
Returns an upper bound for the speed factor of this vehicle.
Definition: ROVehicle.h:124
SUMOTime depart
The vehicle&#39;s departure time.
const ConstROEdgeVector & getStopEdges() const
Definition: ROVehicle.h:116
const SUMOVehicleParameter & getParameter() const
Returns the definition of the vehicle parameter.
Definition: ROVehicle.h:92
SUMOTime getDepartureTime() const
Returns the time the vehicle starts at, 0 for triggered vehicles.
Definition: ROVehicle.h:111
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:83
The router&#39;s network representation.
Definition: RONet.h:76
Structure representing possible vehicle parameter.
const SUMOVTypeParameter * getType() const
Returns the type of the vehicle.
Definition: RORoutable.h:83
ConstROEdgeVector myStopEdges
The edges where the vehicle stops.
Definition: ROVehicle.h:156
Definition of vehicle stop (position and duration)
A storage for options typed value containers)
Definition: OptionsCont.h:99
void computeRoute(const RORouterProvider &provider, const bool removeLoops, MsgHandler *errorHandler)
Definition: ROVehicle.cpp:135
Base class for a vehicle&#39;s route definition.
Definition: RORouteDef.h:63
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:71
#define SUMOReal
Definition: config.h:213
virtual ~ROVehicle()
Destructor.
Definition: ROVehicle.cpp:125
void saveAsXML(OutputDevice &os, OutputDevice *const typeos, bool asAlternatives, OptionsCont &options) const
Saves the complete vehicle description.
Definition: ROVehicle.cpp:171