SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules 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-2015 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 typedef std::vector<const ROEdge*> ConstROEdgeVector;
52 
53 // ===========================================================================
54 // class definitions
55 // ===========================================================================
60 class ROVehicle {
61 public:
68  ROVehicle(const SUMOVehicleParameter& pars,
69  RORouteDef* route, const SUMOVTypeParameter* type,
70  const RONet* net);
71 
72 
74  virtual ~ROVehicle();
75 
76 
84  return myRoute;
85  }
86 
87 
94  const SUMOVTypeParameter* getType() const {
95  return myType;
96  }
97 
98 
103  const std::string& getID() const {
104  return myParameter.id;
105  }
106 
107 
113  return MAX2(0, myParameter.depart);
114  }
115 
120  SUMOTime getDepart() const {
121  return myParameter.depart;
122  }
123 
125  return myStopEdges;
126  }
127 
129  SUMOReal getMaxSpeed() const;
130 
131 
132  inline SUMOVehicleClass getVClass() const {
133  return getType() != 0 ? getType()->vehicleClass : SVC_IGNORING;
134  }
135 
141  return SUMOReal(2. * getType()->speedDev + 1.) * getType()->speedFactor;
142  }
143 
144 
152  void saveTypeAsXML(OutputDevice& os, OutputDevice* const altos,
153  OutputDevice* const typeos) const;
154 
164  void saveAllAsXML(OutputDevice& os, bool asAlternatives, bool withExitTimes) const;
165 
166  inline void setRoutingSuccess(const bool val) {
167  myRoutingSuccess = val;
168  }
169 
170  inline bool getRoutingSuccess() const {
171  return myRoutingSuccess;
172  }
173 private:
179  void addStop(const SUMOVehicleParameter::Stop& stopPar, const RONet* net);
180 
181 
182 protected:
185 
188 
191 
194 
197 
198 
199 private:
201  ROVehicle(const ROVehicle& src);
202 
204  ROVehicle& operator=(const ROVehicle& src);
205 
206 };
207 
208 
209 #endif
210 
211 /****************************************************************************/
212 
SUMOTime getDepartureTime() const
Returns the time the vehicle starts at, 0 for triggered vehicles.
Definition: ROVehicle.h:112
const std::string & getID() const
Returns the id of the vehicle.
Definition: ROVehicle.h:103
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:166
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types...
SUMOVehicleParameter myParameter
The vehicle's parameter.
Definition: ROVehicle.h:184
SUMOVehicleClass getVClass() const
Definition: ROVehicle.h:132
Structure representing possible vehicle parameter.
SUMOVehicleClass vehicleClass
The vehicle's class.
const SUMOVTypeParameter * getType() const
Returns the type of the vehicle.
Definition: ROVehicle.h:94
SUMOReal getMaxSpeed() const
Returns the vehicle's maximum speed.
Definition: ROVehicle.cpp:153
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:120
std::vector< const ROEdge * > ConstROEdgeVector
Definition: ROEdge.h:59
RORouteDef *const myRoute
The route the vehicle takes.
Definition: ROVehicle.h:190
std::vector< const ROEdge * > ConstROEdgeVector
Definition: ROVehicle.h:49
void saveTypeAsXML(OutputDevice &os, OutputDevice *const altos, OutputDevice *const typeos) const
Saves the vehicle type if it was not saved before.
Definition: ROVehicle.cpp:116
bool getRoutingSuccess() const
Definition: ROVehicle.h:170
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.
void addStop(const SUMOVehicleParameter::Stop &stopPar, const RONet *net)
Adds a stop to this vehicle.
Definition: ROVehicle.cpp:72
SUMOTime depart
The vehicle's departure time.
const SUMOVTypeParameter *const myType
The type of the vehicle.
Definition: ROVehicle.h:187
A basic edge for routing applications.
Definition: ROEdge.h:73
void saveAllAsXML(OutputDevice &os, bool asAlternatives, bool withExitTimes) const
Saves the complete vehicle description.
Definition: ROVehicle.cpp:135
The router's network representation.
Definition: RONet.h:72
Structure representing possible vehicle parameter.
ConstROEdgeVector myStopEdges
The edges where the vehicle stops.
Definition: ROVehicle.h:193
const ConstROEdgeVector & getStopEdges() const
Definition: ROVehicle.h:124
Definition of vehicle stop (position and duration)
Base class for a vehicle'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:140
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:83
vehicles ignoring classes
std::string id
The vehicle's id.
bool myRoutingSuccess
Whether the last routing was successful.
Definition: ROVehicle.h:196