SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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-2014 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 
42 
43 // ===========================================================================
44 // class declarations
45 // ===========================================================================
46 class RORouteDef;
47 class OutputDevice;
48 class ROEdge;
49 class RONet;
50 
51 
52 // ===========================================================================
53 // class definitions
54 // ===========================================================================
59 class ROVehicle {
60 public:
67  ROVehicle(const SUMOVehicleParameter& pars,
68  RORouteDef* route, const SUMOVTypeParameter* type,
69  const RONet* net);
70 
71 
73  virtual ~ROVehicle();
74 
75 
83  return myRoute;
84  }
85 
86 
93  const SUMOVTypeParameter* getType() const {
94  return myType;
95  }
96 
97 
102  const std::string& getID() const {
103  return myParameter.id;
104  }
105 
106 
112  return MAX2(0, myParameter.depart);
113  }
114 
119  SUMOTime getDepart() const {
120  return myParameter.depart;
121  }
122 
123  const std::vector<const ROEdge*>& getStopEdges() const {
124  return myStopEdges;
125  }
126 
128  SUMOReal getMaxSpeed() const;
129 
130 
131  inline SUMOVehicleClass getVClass() const {
132  return getType() != 0 ? getType()->vehicleClass : SVC_IGNORING;
133  }
134 
140  return SUMOReal(2. * getType()->speedDev + 1.) * getType()->speedFactor;
141  }
142 
143 
156  void saveAllAsXML(OutputDevice& os, OutputDevice* const altos,
157  OutputDevice* const typeos, bool withExitTimes) const;
158 
159  inline void setRoutingSuccess(const bool val) {
160  myRoutingSuccess = val;
161  }
162 
163  inline bool getRoutingSuccess() const {
164  return myRoutingSuccess;
165  }
166 private:
172  void addStop(const SUMOVehicleParameter::Stop& stopPar, const RONet* net);
173 
174 
175 protected:
178 
181 
184 
186  std::vector<const ROEdge*> myStopEdges;
187 
190 
191 
192 private:
194  ROVehicle(const ROVehicle& src);
195 
197  ROVehicle& operator=(const ROVehicle& src);
198 
199 };
200 
201 
202 #endif
203 
204 /****************************************************************************/
205 
SUMOTime getDepartureTime() const
Returns the time the vehicle starts at, 0 for triggered vehicles.
Definition: ROVehicle.h:111
const std::string & getID() const
Returns the id of the vehicle.
Definition: ROVehicle.h:102
ROVehicle(const SUMOVehicleParameter &pars, RORouteDef *route, const SUMOVTypeParameter *type, const RONet *net)
Constructor.
Definition: ROVehicle.cpp:56
void setRoutingSuccess(const bool val)
Definition: ROVehicle.h:159
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types...
SUMOVehicleParameter myParameter
The vehicle&#39;s parameter.
Definition: ROVehicle.h:177
SUMOVehicleClass getVClass() const
Definition: ROVehicle.h:131
Structure representing possible vehicle parameter.
SUMOVehicleClass vehicleClass
The vehicle&#39;s class.
const SUMOVTypeParameter * getType() const
Returns the type of the vehicle.
Definition: ROVehicle.h:93
SUMOReal getMaxSpeed() const
Returns the vehicle&#39;s maximum speed.
Definition: ROVehicle.cpp:155
T MAX2(T a, T b)
Definition: StdDefs.h:74
SUMOTime getDepart() const
Returns the time the vehicle starts at, -1 for triggered vehicles.
Definition: ROVehicle.h:119
RORouteDef *const myRoute
The route the vehicle takes.
Definition: ROVehicle.h:183
void saveAllAsXML(OutputDevice &os, OutputDevice *const altos, OutputDevice *const typeos, bool withExitTimes) const
Saves the complete vehicle description.
Definition: ROVehicle.cpp:116
bool getRoutingSuccess() const
Definition: ROVehicle.h:163
A vehicle as used by router.
Definition: ROVehicle.h:59
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.
void addStop(const SUMOVehicleParameter::Stop &stopPar, const RONet *net)
Adds a stop to this vehicle.
Definition: ROVehicle.cpp:72
const std::vector< const ROEdge * > & getStopEdges() const
Definition: ROVehicle.h:123
SUMOTime depart
The vehicle&#39;s departure time.
const SUMOVTypeParameter *const myType
The type of the vehicle.
Definition: ROVehicle.h:180
A basic edge for routing applications.
Definition: ROEdge.h:70
The router&#39;s network representation.
Definition: RONet.h:72
Structure representing possible vehicle parameter.
Definition of vehicle stop (position and duration)
Base class for a vehicle&#39;s route definition.
Definition: RORouteDef.h:63
int SUMOTime
Definition: SUMOTime.h:43
SUMOReal getChosenSpeedFactor() const
Returns an upper bound for the speed factor of this vehicle.
Definition: ROVehicle.h:139
std::vector< const ROEdge * > myStopEdges
The edges where the vehicle stops.
Definition: ROVehicle.h:186
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:71
#define SUMOReal
Definition: config.h:218
virtual ~ROVehicle()
Destructor.
Definition: ROVehicle.cpp:112
RORouteDef * getRouteDefinition() const
Returns the definition of the route the vehicle takes.
Definition: ROVehicle.h:82
vehicles ignoring classes
std::string id
The vehicle&#39;s id.
bool myRoutingSuccess
Whether the last routing was successful.
Definition: ROVehicle.h:189