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-2013 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 <utils/common/SUMOTime.h>
40 
41 
42 // ===========================================================================
43 // class declarations
44 // ===========================================================================
45 class MSVehicleType;
46 class MSRoute;
47 class MSEdge;
48 class MSLane;
49 class MSDevice;
50 class MSPerson;
52 
53 typedef std::vector<const MSEdge*> MSEdgeVector;
54 
55 
56 // ===========================================================================
57 // class definitions
58 // ===========================================================================
63 class SUMOVehicle {
64 public:
66  virtual ~SUMOVehicle() {}
67 
71  virtual const std::string& getID() const = 0;
72 
76  virtual SUMOReal getPositionOnLane() const = 0;
77 
81  virtual SUMOReal getMaxSpeed() const = 0;
82 
86  virtual SUMOReal getSpeed() const = 0;
87 
91  virtual const MSVehicleType& getVehicleType() const = 0;
92 
94  virtual const MSRoute& getRoute() const = 0;
95 
103  virtual const MSEdge* succEdge(unsigned int nSuccs) const = 0;
104 
106  virtual bool replaceRouteEdges(const MSEdgeVector& edges, bool onInit = false) = 0;
107 
109  virtual bool replaceRoute(const MSRoute* route, bool onInit = false) = 0;
110 
120  virtual void reroute(SUMOTime t, SUMOAbstractRouter<MSEdge, SUMOVehicle>& router, bool withTaz = false) = 0;
121 
125  virtual SUMOReal getAcceleration() const = 0;
126 
131  virtual const MSEdge* getEdge() const = 0;
132 
137  virtual const SUMOVehicleParameter& getParameter() const = 0;
138 
144  virtual void onDepart() = 0;
145 
149  virtual bool isOnRoad() const = 0;
150 
154  virtual SUMOTime getDeparture() const = 0;
155 
160  virtual SUMOReal getArrivalPos() const = 0;
161 
164  virtual bool hasDeparted() const = 0;
165 
168  virtual bool hasArrived() const = 0;
169 
173  virtual unsigned int getNumberReroutes() const = 0;
174 
178  virtual const std::vector<MSDevice*>& getDevices() const = 0;
179 
186  virtual void addPerson(MSPerson* person) = 0;
187 
194  virtual bool addStop(const SUMOVehicleParameter::Stop& stopPar, SUMOTime untilOffset = 0) = 0;
195 
199  virtual bool isStopped() const = 0;
200 
202  virtual MSDevice* getDevice(const std::type_info& type) const = 0;
203 
204 
205  virtual SUMOReal getChosenSpeedFactor() const = 0;
206 
207  virtual SUMOTime getWaitingTime() const = 0;
208 
210 
211 
213  virtual void saveState(OutputDevice& out) = 0;
214 
217  virtual void loadState(const SUMOSAXAttributes& attrs, const SUMOTime offset) = 0;
219 };
220 
221 
222 #endif
223 
224 /****************************************************************************/