MSSimpleTrafficLightLogic.h

Go to the documentation of this file.
00001 /****************************************************************************/
00007 // A fixed traffic light logic
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 MSSimpleTrafficLightLogic_h
00020 #define MSSimpleTrafficLightLogic_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 // ===========================================================================
00054 class MSSimpleTrafficLightLogic : public MSTrafficLightLogic {
00055 public:
00064     MSSimpleTrafficLightLogic(MSTLLogicControl &tlcontrol,
00065                               const std::string &id, const std::string &subid,
00066                               const Phases &phases, unsigned int step, SUMOTime delay) throw();
00067 
00068 
00070     ~MSSimpleTrafficLightLogic() throw();
00071 
00072 
00073 
00076 
00082     SUMOTime trySwitch(bool isActive) throw();
00083 
00084 
00089     void setLinkPriorities() const throw();
00090 
00091 
00095     bool setTrafficLightSignals() const throw();
00097 
00098 
00099 
00102 
00107     unsigned int getPhaseNumber() const throw();
00108 
00109 
00114     const Phases &getPhases() const throw();
00115 
00116 
00121     Phases &getPhases() throw();
00122 
00123 
00129     const MSPhaseDefinition &getPhase(unsigned int givenstep) const throw();
00131 
00132 
00133 
00136 
00141     unsigned int getCurrentPhaseIndex() const throw();
00142 
00143 
00148     const MSPhaseDefinition &getCurrentPhaseDef() const throw();
00150 
00151 
00152 
00155 
00160     unsigned int getPhaseIndexAtTime(SUMOTime simStep) const throw();
00161 
00162 
00168     unsigned int getOffsetFromIndex(unsigned int index) const throw();
00169 
00170 
00176     unsigned int getIndexFromOffset(unsigned int offset) const throw();
00178 
00179 
00180 
00183 
00191     void changeStepAndDuration(MSTLLogicControl &tlcontrol, SUMOTime simStep,
00192                                unsigned int step, SUMOTime stepDuration) throw();
00194 
00195 
00196 protected:
00198     Phases myPhases;
00199 
00201     unsigned int myStep;
00202 
00203 
00204 };
00205 
00206 
00207 #endif
00208 
00209 /****************************************************************************/
00210 

Generated on Wed May 5 00:06:32 2010 for Sumo - Simulation of Urban MObility by  doxygen 1.5.6