00001 /****************************************************************************/ 00007 // Abstract in-vehicle device 00008 /****************************************************************************/ 00009 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/ 00010 // Copyright 2001-2010 DLR (http://www.dlr.de/) and contributors 00011 /****************************************************************************/ 00012 // 00013 // This program is free software; you can redistribute it and/or modify 00014 // it under the terms of the GNU General Public License as published by 00015 // the Free Software Foundation; either version 2 of the License, or 00016 // (at your option) any later version. 00017 // 00018 /****************************************************************************/ 00019 #ifndef MSDevice_h 00020 #define MSDevice_h 00021 00022 00023 // =========================================================================== 00024 // included modules 00025 // =========================================================================== 00026 #ifdef _MSC_VER 00027 #include <windows_config.h> 00028 #else 00029 #include <config.h> 00030 #endif 00031 00032 #include <string> 00033 #include <vector> 00034 #include <microsim/MSVehicle.h> 00035 #include <utils/common/UtilExceptions.h> 00036 00037 00038 // =========================================================================== 00039 // class declarations 00040 // =========================================================================== 00041 class OutputDevice; 00042 00043 00044 // =========================================================================== 00045 // class definitions 00046 // =========================================================================== 00061 class MSDevice { 00062 public: 00068 MSDevice(MSVehicle &holder, const std::string &id) throw() 00069 : myHolder(holder), myID(id) { 00070 } 00071 00072 00074 virtual ~MSDevice() throw() { } 00075 00076 00081 MSVehicle &getHolder() const throw() { 00082 return myHolder; 00083 } 00084 00085 00089 const std::string &getID() throw() { 00090 return myID; 00091 } 00092 00093 00096 00098 virtual void onTryEmit() { } 00099 00100 00106 virtual void enterLaneAtMove(MSLane* enteredLane, SUMOReal driven) { } 00107 00108 00114 virtual void enterLaneAtEmit(MSLane* enteredLane, const MSVehicle::State &state) { } 00115 00116 00121 virtual void enterLaneAtLaneChange(MSLane* enteredLane) { } 00122 00123 00128 virtual void leaveLaneAtMove(SUMOReal driven) { } 00129 00130 00132 virtual void leaveLane() { } 00133 00134 00136 virtual void onRemovalFromNet() { } 00137 // @} 00138 00139 00152 virtual void tripInfoOutput(OutputDevice &os) const throw(IOError) { 00153 } 00154 00155 00156 protected: 00158 MSVehicle &myHolder; 00159 00160 00161 private: 00163 std::string myID; 00164 00165 00166 private: 00168 MSDevice(const MSDevice&); 00169 00171 MSDevice& operator=(const MSDevice&); 00172 00173 }; 00174 00175 00176 #endif 00177 00178 /****************************************************************************/ 00179
1.5.6