SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MSSimpleTrafficLightLogic.h
Go to the documentation of this file.
1 /****************************************************************************/
11 // A fixed traffic light logic
12 /****************************************************************************/
13 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/
14 // Copyright (C) 2001-2012 DLR (http://www.dlr.de/) and contributors
15 /****************************************************************************/
16 //
17 // This file is part of SUMO.
18 // SUMO is free software: you can redistribute it and/or modify
19 // it under the terms of the GNU General Public License as published by
20 // the Free Software Foundation, either version 3 of the License, or
21 // (at your option) any later version.
22 //
23 /****************************************************************************/
24 #ifndef MSSimpleTrafficLightLogic_h
25 #define MSSimpleTrafficLightLogic_h
26 
27 
28 // ===========================================================================
29 // included modules
30 // ===========================================================================
31 #ifdef _MSC_VER
32 #include <windows_config.h>
33 #else
34 #include <config.h>
35 #endif
36 
37 #include <utility>
38 #include <vector>
39 #include <bitset>
41 #include <microsim/MSNet.h>
42 #include "MSTrafficLightLogic.h"
43 #include "MSPhaseDefinition.h"
44 
45 
46 // ===========================================================================
47 // class definitions
48 // ===========================================================================
60 public:
70  const std::string& id, const std::string& subid,
71  const Phases& phases, unsigned int step, SUMOTime delay);
72 
73 
76 
77 
78 
81 
87  SUMOTime trySwitch(bool isActive);
89 
90 
91 
94 
99  unsigned int getPhaseNumber() const;
100 
101 
106  const Phases& getPhases() const;
107 
108 
113  Phases& getPhases();
114 
115 
121  const MSPhaseDefinition& getPhase(unsigned int givenstep) const;
123 
124 
125 
128 
133  unsigned int getCurrentPhaseIndex() const;
134 
135 
140  const MSPhaseDefinition& getCurrentPhaseDef() const;
142 
143 
144 
147 
152  SUMOTime getPhaseIndexAtTime(SUMOTime simStep) const;
153 
154 
160  SUMOTime getOffsetFromIndex(unsigned int index) const;
161 
162 
168  unsigned int getIndexFromOffset(SUMOTime offset) const;
170 
171 
172 
175 
183  void changeStepAndDuration(MSTLLogicControl& tlcontrol, SUMOTime simStep,
184  unsigned int step, SUMOTime stepDuration);
185 
188  void setPhases(const Phases& phases, unsigned int index);
190 
191 
192 protected:
195 
197  unsigned int myStep;
198 
199 
200 private:
202  void deletePhases();
203 
204 };
205 
206 
207 #endif
208 
209 /****************************************************************************/
210