SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SUMOVehicle.h
Go to the documentation of this file.
1 /****************************************************************************/
9 // Abstract base class for vehicle representations
10 /****************************************************************************/
11 // SUMO, Simulation of Urban MObility; see http://sumo-sim.org/
12 // Copyright (C) 2001-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 SUMOVehicle_h
23 #define SUMOVehicle_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 <vector>
36 #include <typeinfo>
37 #include <utils/common/SUMOTime.h>
41 
42 
43 // ===========================================================================
44 // class declarations
45 // ===========================================================================
46 class MSVehicleType;
47 class MSRoute;
48 class MSEdge;
49 class MSLane;
50 class MSDevice;
51 class MSPerson;
53 
54 typedef std::vector<const MSEdge*> MSEdgeVector;
55 
56 
57 // ===========================================================================
58 // class definitions
59 // ===========================================================================
64 class SUMOVehicle {
65 public:
67  virtual ~SUMOVehicle() {}
68 
72  virtual const std::string& getID() const = 0;
73 
77  virtual SUMOReal getPositionOnLane() const = 0;
78 
82  virtual SUMOReal getMaxSpeed() const = 0;
83 
87  virtual SUMOReal getSpeed() const = 0;
88 
92  virtual const MSVehicleType& getVehicleType() const = 0;
93 
95  virtual const MSRoute& getRoute() const = 0;
96 
104  virtual const MSEdge* succEdge(unsigned int nSuccs) const = 0;
105 
107  virtual bool replaceRouteEdges(MSEdgeVector& edges, bool onInit = false) = 0;
108 
110  virtual bool replaceRoute(const MSRoute* route, bool onInit = false, int offset = 0) = 0;
111 
121  virtual void reroute(SUMOTime t, SUMOAbstractRouter<MSEdge, SUMOVehicle>& router, bool withTaz = false) = 0;
122 
126  virtual SUMOReal getAcceleration() const = 0;
127 
131  virtual SUMOReal getSlope() const = 0;
132 
137  virtual const MSEdge* getEdge() const = 0;
138 
143  virtual const SUMOVehicleParameter& getParameter() const = 0;
144 
150  virtual void onDepart() = 0;
151 
155  virtual bool isOnRoad() const = 0;
156 
160  virtual SUMOTime getDeparture() const = 0;
161 
166  virtual SUMOReal getArrivalPos() const = 0;
167 
170  virtual bool hasDeparted() const = 0;
171 
174  virtual bool hasArrived() const = 0;
175 
179  virtual unsigned int getNumberReroutes() const = 0;
180 
184  virtual const std::vector<MSDevice*>& getDevices() const = 0;
185 
192  virtual void addPerson(MSPerson* person) = 0;
193 
200  virtual bool addStop(const SUMOVehicleParameter::Stop& stopPar, SUMOTime untilOffset = 0) = 0;
201 
205  virtual bool isStopped() const = 0;
206 
208  virtual MSDevice* getDevice(const std::type_info& type) const = 0;
209 
210 
211  virtual SUMOReal getChosenSpeedFactor() const = 0;
212 
213  virtual SUMOTime getWaitingTime() const = 0;
214 
216  virtual SUMOReal getImpatience() const = 0;
217 
219 
220 
222  virtual void saveState(OutputDevice& out) = 0;
223 
226  virtual void loadState(const SUMOSAXAttributes& attrs, const SUMOTime offset) = 0;
228 };
229 
230 
231 #endif
232 
233 /****************************************************************************/