SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MSBaseVehicle.h
Go to the documentation of this file.
1 /****************************************************************************/
8 // A base class for vehicle implementations
9 /****************************************************************************/
10 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/
11 // Copyright (C) 2001-2012 DLR (http://www.dlr.de/) and contributors
12 /****************************************************************************/
13 //
14 // This file is part of SUMO.
15 // SUMO is free software: you can redistribute it and/or modify
16 // it under the terms of the GNU General Public License as published by
17 // the Free Software Foundation, either version 3 of the License, or
18 // (at your option) any later version.
19 //
20 /****************************************************************************/
21 #ifndef MSBaseVehicle_h
22 #define MSBaseVehicle_h
23 
24 
25 // ===========================================================================
26 // included modules
27 // ===========================================================================
28 #ifdef _MSC_VER
29 #include <windows_config.h>
30 #else
31 #include <config.h>
32 #endif
33 
34 #include <iostream>
35 #include <cassert>
36 #include <vector>
38 #include <utils/common/StdDefs.h>
39 #include "MSRoute.h"
40 #include "MSMoveReminder.h"
41 
42 
43 // ===========================================================================
44 // class declarations
45 // ===========================================================================
47 class MSVehicleType;
48 
49 
50 // ===========================================================================
51 // class definitions
52 // ===========================================================================
57 class MSBaseVehicle : public SUMOVehicle {
58 public:
61  MSBaseVehicle(SUMOVehicleParameter* pars, const MSRoute* route, const MSVehicleType* type) ;
62 
63 
65  virtual ~MSBaseVehicle() ;
66 
67 
69  const std::string& getID() const ;
70 
75  const SUMOVehicleParameter& getParameter() const ;
76 
77 
81  const MSRoute& getRoute() const ;
82 
83 
87  const MSVehicleType& getVehicleType() const ;
88 
89 
93  SUMOReal getMaxSpeed() const;
94 
95 
99  SUMOReal adaptMaxSpeed(SUMOReal referenceSpeed);
100 
101 
109  const MSEdge* succEdge(unsigned int nSuccs) const ;
110 
115  const MSEdge* getEdge() const;
116 
117 
121  virtual bool isOnRoad() const {
122  return true;
123  }
124 
125 
135  void reroute(SUMOTime t, SUMOAbstractRouter<MSEdge, SUMOVehicle> &router, bool withTaz = false) ;
136 
137 
148  bool replaceRouteEdges(const MSEdgeVector& edges, bool onInit = false) ;
149 
150 
157  virtual SUMOReal getPreDawdleAcceleration() const ;
158 
164  void onDepart() ;
165 
169  SUMOTime getDeparture() const ;
170 
174  unsigned int getNumberReroutes() const ;
175 
179  const std::vector<MSDevice*> &getDevices() const {
180  return myDevices;
181  }
182 
189  virtual void addPerson(MSPerson* person) ;
190 
195  bool hasValidRoute(std::string& msg) const ;
196 
202  void addReminder(MSMoveReminder* rem) ;
203 
209  void removeReminder(MSMoveReminder* rem) ;
210 
221  virtual void activateReminders(const MSMoveReminder::Notification reason) ;
222 
223 protected:
226  void calculateArrivalPos() ;
227 
228 protected:
231 
233  const MSRoute* myRoute;
234 
237 
240 
246 
249 
252 
255 
257  typedef std::vector< std::pair<MSMoveReminder*, SUMOReal> > MoveReminderCont;
258 
262 
264  std::vector<MSDevice*> myDevices;
265 
268 
271 
273  unsigned int myNumberReroutes;
274 
275 };
276 
277 #endif
278 
279 /****************************************************************************/