SUMO - Simulation of Urban MObility

MSOffTrafficLightLogic.h

Go to the documentation of this file.
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 (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 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 <utils/common/StdDefs.h>
00038 #include "MSTrafficLightLogic.h"
00039 #include "MSPhaseDefinition.h"
00040 #include "MSTLLogicControl.h"
00041 
00042 
00043 // ===========================================================================
00044 // class definitions
00045 // ===========================================================================
00050 class MSOffTrafficLightLogic : public MSTrafficLightLogic {
00051 public:
00057     MSOffTrafficLightLogic(MSTLLogicControl& tlcontrol,
00058                            const std::string& id);
00059 
00060 
00065     virtual void init(NLDetectorBuilder& nb);
00066 
00067 
00069     ~MSOffTrafficLightLogic();
00070 
00071 
00074 
00079     void adaptLinkInformationFrom(const MSTrafficLightLogic& logic);
00081 
00082 
00083 
00086 
00092     SUMOTime trySwitch(bool isActive) {
00093         UNUSED_PARAMETER(isActive);
00094         return 120*DELTA_T;
00095     }
00096 
00098 
00099 
00102 
00107     unsigned int getPhaseNumber() const;
00108 
00109 
00114     const Phases& getPhases() const;
00115 
00116 
00122     const MSPhaseDefinition& getPhase(unsigned int givenstep) const;
00124 
00125 
00126 
00129 
00134     unsigned int getCurrentPhaseIndex() const;
00135 
00136 
00141     const MSPhaseDefinition& getCurrentPhaseDef() const;
00143 
00144 
00145 
00148 
00153     SUMOTime getPhaseIndexAtTime(SUMOTime simStep) const;
00154 
00155 
00161     SUMOTime getOffsetFromIndex(unsigned int index) const;
00162 
00163 
00169     unsigned int getIndexFromOffset(SUMOTime offset) const;
00171 
00172 
00173 
00176 
00184     void changeStepAndDuration(MSTLLogicControl& tlcontrol, SUMOTime simStep, unsigned int step, SUMOTime stepDuration) {
00185         UNUSED_PARAMETER(tlcontrol);
00186         UNUSED_PARAMETER(simStep);
00187         UNUSED_PARAMETER(step);
00188         UNUSED_PARAMETER(stepDuration);
00189     }
00191 
00192 
00193 private:
00196     void rebuildPhase();
00197 
00198 
00199 private:
00201     MSTrafficLightLogic::Phases myPhaseDefinition;
00202 
00203 
00204 };
00205 
00206 
00207 #endif
00208 
00209 /****************************************************************************/
00210 
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Defines