SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
NBTrafficLightLogicCont.h
Go to the documentation of this file.
1 /****************************************************************************/
9 // A container for traffic light definitions and built programs
10 /****************************************************************************/
11 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/
12 // Copyright (C) 2001-2012 DLR (http://www.dlr.de/) and contributors
13 /****************************************************************************/
14 //
15 // This file is part of SUMO.
16 // SUMO is free software: you can redistribute it and/or modify
17 // it under the terms of the GNU General Public License as published by
18 // the Free Software Foundation, either version 3 of the License, or
19 // (at your option) any later version.
20 //
21 /****************************************************************************/
22 #ifndef NBTrafficLightLogicCont_h
23 #define NBTrafficLightLogicCont_h
24 
25 
26 // ===========================================================================
27 // included modules
28 // ===========================================================================
29 #ifdef _MSC_VER
30 #include <windows_config.h>
31 #else
32 #include <config.h>
33 #endif
34 
35 #include <map>
36 #include <string>
38 
39 
40 // ===========================================================================
41 // class declarations
42 // ===========================================================================
43 class OptionsCont;
44 class NBEdgeCont;
45 class OutputDevice;
46 
47 
48 // ===========================================================================
49 // class definitions
50 // ===========================================================================
66 public:
69 
72 
81  void applyOptions(OptionsCont& oc) ;
82 
83 
93  bool insert(NBTrafficLightDefinition* logic, bool forceInsert = false) ;
94 
95 
104  bool removeFully(const std::string id);
105 
106 
117  bool removeProgram(const std::string id, const std::string programID, bool del = true);
118 
119 
123  void extract(NBTrafficLightDefinition* definition);
124 
125 
127  std::vector<NBTrafficLightLogic*> getComputed() const;
128 
129 
140  std::pair<unsigned int, unsigned int> computeLogics(NBEdgeCont& ec, OptionsCont& oc);
141 
142 
151 
152 
160  void remapRemoved(NBEdge* removed,
161  const EdgeVector& incoming, const EdgeVector& outgoing) ;
162 
163 
172  void replaceRemoved(NBEdge* removed, int removedLane,
173  NBEdge* by, int byLane) ;
174 
175 
182  NBTrafficLightDefinition* getDefinition(const std::string& id, const std::string& programID) const;
183 
184 
190  const std::map<std::string, NBTrafficLightDefinition*>& getPrograms(const std::string& id) const;
191 
192 
199  NBTrafficLightLogic* getLogic(const std::string& id, const std::string& programID) const;
200 
201 
211  void setTLControllingInformation(const NBEdgeCont& ec) ;
212 
213 
214 private:
216  typedef std::map<std::string, NBTrafficLightLogic*> Program2Logic;
217  typedef std::map<std::string, Program2Logic> Id2Logics;
218  typedef std::map<std::string, NBTrafficLightDefinition*> Program2Def;
219  typedef std::map<std::string, Program2Def> Id2Defs;
220  typedef std::vector<NBTrafficLightLogic*> Logics;
221  typedef std::vector<NBTrafficLightDefinition*> Definitions;
222 
225 
228 
230  std::set<NBTrafficLightDefinition*> myExtracted;
231 
233  std::set<std::string> myHalfOffsetTLS;
234 
236  std::set<std::string> myQuarterOffsetTLS;
237 
239 
240 private:
242  Definitions getDefinitions() const;
243 
246  void clear() ;
247 
248 
249 };
250 
251 
252 #endif
253 
254 /****************************************************************************/
255