|
SUMO - Simulation of Urban MObility
|
00001 /****************************************************************************/ 00007 // An instantaneous induction loop 00008 /****************************************************************************/ 00009 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/ 00010 // Copyright (C) 2001-2011 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 MSInstantInductLoop_h 00020 #define MSInstantInductLoop_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 <deque> 00034 #include <map> 00035 #include <functional> 00036 #include <microsim/MSMoveReminder.h> 00037 #include <microsim/output/MSDetectorFileOutput.h> 00038 00039 00040 // =========================================================================== 00041 // class declarations 00042 // =========================================================================== 00043 class MSLane; 00044 class MSVehicle; 00045 class OutputDevice; 00046 00047 00048 // =========================================================================== 00049 // class definitions 00050 // =========================================================================== 00058 class MSInstantInductLoop 00059 : public MSMoveReminder, public MSDetectorFileOutput { 00060 public: 00069 MSInstantInductLoop(const std::string& id, OutputDevice& od, 00070 MSLane* const lane, SUMOReal positionInMeters) throw(); 00071 00072 00074 ~MSInstantInductLoop() throw(); 00075 00076 00077 00080 00097 bool notifyMove(SUMOVehicle& veh, SUMOReal oldPos, SUMOReal newPos, SUMOReal newSpeed) throw(); 00098 00099 00114 bool notifyLeave(SUMOVehicle& veh, SUMOReal lastPos, MSMoveReminder::Notification reason) throw(); 00115 00116 00130 bool notifyEnter(SUMOVehicle& veh, MSMoveReminder::Notification reason) throw(); 00132 00133 00134 00144 void writeXMLOutput(OutputDevice& dev, 00145 SUMOTime startTime, SUMOTime stopTime) throw(IOError) { } 00146 00147 00156 void writeXMLDetectorProlog(OutputDevice& dev) const throw(IOError); 00157 00158 00159 protected: 00168 void write(const char* state, SUMOReal t, SUMOVehicle& veh, SUMOReal speed, const char* add=0, SUMOReal addValue=-1); 00169 00170 00171 protected: 00173 OutputDevice& myOutputDevice; 00174 00176 const SUMOReal myPosition; 00177 00179 SUMOReal myLastExitTime; 00180 00182 std::map<SUMOVehicle*, SUMOReal> myEntryTimes; 00183 00184 private: 00186 MSInstantInductLoop(const MSInstantInductLoop&); 00187 00189 MSInstantInductLoop& operator=(const MSInstantInductLoop&); 00190 00191 00192 }; 00193 00194 00195 #endif 00196 00197 /****************************************************************************/ 00198