|
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-2012 DLR (http://www.dlr.de/) and contributors 00011 /****************************************************************************/ 00012 // 00013 // This file is part of SUMO. 00014 // SUMO is free software: you can redistribute it and/or modify 00015 // it under the terms of the GNU General Public License as published by 00016 // the Free Software Foundation, either version 3 of the License, or 00017 // (at your option) any later version. 00018 // 00019 /****************************************************************************/ 00020 #ifndef MSInstantInductLoop_h 00021 #define MSInstantInductLoop_h 00022 00023 00024 // =========================================================================== 00025 // included modules 00026 // =========================================================================== 00027 #ifdef _MSC_VER 00028 #include <windows_config.h> 00029 #else 00030 #include <config.h> 00031 #endif 00032 00033 #include <string> 00034 #include <deque> 00035 #include <map> 00036 #include <functional> 00037 #include <microsim/MSMoveReminder.h> 00038 #include <microsim/output/MSDetectorFileOutput.h> 00039 00040 00041 // =========================================================================== 00042 // class declarations 00043 // =========================================================================== 00044 class MSLane; 00045 class MSVehicle; 00046 class OutputDevice; 00047 00048 00049 // =========================================================================== 00050 // class definitions 00051 // =========================================================================== 00059 class MSInstantInductLoop 00060 : public MSMoveReminder, public MSDetectorFileOutput { 00061 public: 00070 MSInstantInductLoop(const std::string& id, OutputDevice& od, 00071 MSLane* const lane, SUMOReal positionInMeters) ; 00072 00073 00075 ~MSInstantInductLoop() ; 00076 00077 00078 00081 00098 bool notifyMove(SUMOVehicle& veh, SUMOReal oldPos, SUMOReal newPos, SUMOReal newSpeed) ; 00099 00100 00115 bool notifyLeave(SUMOVehicle& veh, SUMOReal lastPos, MSMoveReminder::Notification reason) ; 00116 00117 00131 bool notifyEnter(SUMOVehicle& veh, MSMoveReminder::Notification reason) ; 00133 00134 00135 00145 void writeXMLOutput(OutputDevice& dev, 00146 SUMOTime startTime, SUMOTime stopTime) { } 00147 00148 00157 void writeXMLDetectorProlog(OutputDevice& dev) const; 00158 00159 00160 protected: 00169 void write(const char* state, SUMOReal t, SUMOVehicle& veh, SUMOReal speed, const char* add = 0, SUMOReal addValue = -1); 00170 00171 00172 protected: 00174 OutputDevice& myOutputDevice; 00175 00177 const SUMOReal myPosition; 00178 00180 SUMOReal myLastExitTime; 00181 00183 std::map<SUMOVehicle*, SUMOReal> myEntryTimes; 00184 00185 private: 00187 MSInstantInductLoop(const MSInstantInductLoop&); 00188 00190 MSInstantInductLoop& operator=(const MSInstantInductLoop&); 00191 00192 00193 }; 00194 00195 00196 #endif 00197 00198 /****************************************************************************/ 00199