00001 /****************************************************************************/ 00007 // A traffic lights logic which represents a tls in an off-mode 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 MSOffTrafficLightLogic_h 00020 #define MSOffTrafficLightLogic_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 <utility> 00033 #include <vector> 00034 #include <bitset> 00035 #include <microsim/MSEventControl.h> 00036 #include <microsim/MSNet.h> 00037 #include "MSTrafficLightLogic.h" 00038 #include "MSPhaseDefinition.h" 00039 00040 00041 // =========================================================================== 00042 // class definitions 00043 // =========================================================================== 00048 class MSOffTrafficLightLogic : public MSTrafficLightLogic { 00049 public: 00055 MSOffTrafficLightLogic(MSTLLogicControl &tlcontrol, 00056 const std::string &id) throw(); 00057 00058 00064 virtual void init(NLDetectorBuilder &nb) throw(ProcessError); 00065 00066 00068 ~MSOffTrafficLightLogic() throw(); 00069 00070 00073 00078 void adaptLinkInformationFrom(const MSTrafficLightLogic &logic) throw(); 00080 00081 00082 00085 00091 SUMOTime trySwitch(bool isActive) throw() { 00092 return 120*DELTA_T; 00093 } 00094 00095 00103 void setLinkPriorities() const throw() { } 00104 00105 00110 bool setTrafficLightSignals() const throw() { 00111 return true; 00112 } 00114 00115 00116 00119 00124 unsigned int getPhaseNumber() const throw(); 00125 00126 00131 const Phases &getPhases() const throw(); 00132 00133 00139 const MSPhaseDefinition &getPhase(unsigned int givenstep) const throw(); 00141 00142 00143 00146 00151 unsigned int getCurrentPhaseIndex() const throw(); 00152 00153 00158 const MSPhaseDefinition &getCurrentPhaseDef() const throw(); 00160 00161 00162 00165 00170 unsigned int getPhaseIndexAtTime(SUMOTime simStep) const throw(); 00171 00172 00178 unsigned int getOffsetFromIndex(unsigned int index) const throw(); 00179 00180 00186 unsigned int getIndexFromOffset(unsigned int offset) const throw(); 00188 00189 00190 00193 00201 void changeStepAndDuration(MSTLLogicControl &tlcontrol, SUMOTime simStep, unsigned int step, SUMOTime stepDuration) throw() { 00202 } 00204 00205 00206 private: 00209 void rebuildPhase() throw(); 00210 00211 00212 private: 00214 MSTrafficLightLogic::Phases myPhaseDefinition; 00215 00216 00217 }; 00218 00219 00220 #endif 00221 00222 /****************************************************************************/ 00223
1.5.6