SUMO - Simulation of Urban MObility
|
00001 /****************************************************************************/ 00008 // A base class for vehicle implementations 00009 /****************************************************************************/ 00010 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/ 00011 // Copyright (C) 2001-2012 DLR (http://www.dlr.de/) and contributors 00012 /****************************************************************************/ 00013 // 00014 // This file is part of SUMO. 00015 // SUMO is free software: you can redistribute it and/or modify 00016 // it under the terms of the GNU General Public License as published by 00017 // the Free Software Foundation, either version 3 of the License, or 00018 // (at your option) any later version. 00019 // 00020 /****************************************************************************/ 00021 #ifndef MSBaseVehicle_h 00022 #define MSBaseVehicle_h 00023 00024 00025 // =========================================================================== 00026 // included modules 00027 // =========================================================================== 00028 #ifdef _MSC_VER 00029 #include <windows_config.h> 00030 #else 00031 #include <config.h> 00032 #endif 00033 00034 #include <iostream> 00035 #include <cassert> 00036 #include <vector> 00037 #include <utils/common/SUMOVehicle.h> 00038 #include <utils/common/StdDefs.h> 00039 #include "MSRoute.h" 00040 #include "MSMoveReminder.h" 00041 00042 00043 // =========================================================================== 00044 // class declarations 00045 // =========================================================================== 00046 class SUMOVehicleParameter; 00047 class MSVehicleType; 00048 00049 00050 // =========================================================================== 00051 // class definitions 00052 // =========================================================================== 00057 class MSBaseVehicle : public SUMOVehicle { 00058 public: 00061 MSBaseVehicle(SUMOVehicleParameter* pars, const MSRoute* route, const MSVehicleType* type) ; 00062 00063 00065 virtual ~MSBaseVehicle() ; 00066 00067 00069 const std::string& getID() const ; 00070 00075 const SUMOVehicleParameter& getParameter() const ; 00076 00077 00081 const MSRoute& getRoute() const ; 00082 00083 00087 const MSVehicleType& getVehicleType() const ; 00088 00089 00093 SUMOReal getMaxSpeed() const; 00094 00095 00099 SUMOReal adaptMaxSpeed(SUMOReal referenceSpeed); 00100 00101 00109 const MSEdge* succEdge(unsigned int nSuccs) const ; 00110 00115 const MSEdge* getEdge() const; 00116 00117 00121 virtual bool isOnRoad() const { 00122 return true; 00123 } 00124 00125 00135 void reroute(SUMOTime t, SUMOAbstractRouter<MSEdge, SUMOVehicle> &router, bool withTaz = false) ; 00136 00137 00148 bool replaceRouteEdges(const MSEdgeVector& edges, bool onInit = false) ; 00149 00150 00157 virtual SUMOReal getPreDawdleAcceleration() const ; 00158 00164 void onDepart() ; 00165 00169 SUMOTime getDeparture() const ; 00170 00174 unsigned int getNumberReroutes() const ; 00175 00179 const std::vector<MSDevice*> &getDevices() const { 00180 return myDevices; 00181 } 00182 00189 virtual void addPerson(MSPerson* person) ; 00190 00195 bool hasValidRoute(std::string& msg) const ; 00196 00202 void addReminder(MSMoveReminder* rem) ; 00203 00209 void removeReminder(MSMoveReminder* rem) ; 00210 00221 virtual void activateReminders(const MSMoveReminder::Notification reason) ; 00222 00223 protected: 00226 void calculateArrivalPos() ; 00227 00228 protected: 00230 const SUMOVehicleParameter* myParameter; 00231 00233 const MSRoute* myRoute; 00234 00236 const MSVehicleType* myType; 00237 00239 MSRouteIterator myCurrEdge; 00240 00245 SUMOReal myIndividualMaxSpeed; 00246 00248 bool myHasIndividualMaxSpeed; 00249 00251 SUMOReal myReferenceSpeed; 00252 00255 00257 typedef std::vector< std::pair<MSMoveReminder*, SUMOReal> > MoveReminderCont; 00258 00260 MoveReminderCont myMoveReminders; 00262 00264 std::vector<MSDevice*> myDevices; 00265 00267 SUMOTime myDeparture; 00268 00270 SUMOReal myArrivalPos; 00271 00273 unsigned int myNumberReroutes; 00274 00275 }; 00276 00277 #endif 00278 00279 /****************************************************************************/