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-sim.org/
12 // Copyright (C) 2001-2014 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  size_t getNumExtracted() const {
128  return myExtracted.size();
129  }
130 
131 
133  std::vector<NBTrafficLightLogic*> getComputed() const;
134 
135 
146  std::pair<unsigned int, unsigned int> computeLogics(NBEdgeCont& ec, OptionsCont& oc);
147 
148 
157 
158 
166  void remapRemoved(NBEdge* removed,
167  const EdgeVector& incoming, const EdgeVector& outgoing);
168 
169 
178  void replaceRemoved(NBEdge* removed, int removedLane,
179  NBEdge* by, int byLane);
180 
181 
188  NBTrafficLightDefinition* getDefinition(const std::string& id, const std::string& programID) const;
189 
190 
196  const std::map<std::string, NBTrafficLightDefinition*>& getPrograms(const std::string& id) const;
197 
198 
205  NBTrafficLightLogic* getLogic(const std::string& id, const std::string& programID) const;
206 
207 
217  void setTLControllingInformation(const NBEdgeCont& ec);
218 
219 
220 private:
222  typedef std::map<std::string, NBTrafficLightLogic*> Program2Logic;
223  typedef std::map<std::string, Program2Logic> Id2Logics;
224  typedef std::map<std::string, NBTrafficLightDefinition*> Program2Def;
225  typedef std::map<std::string, Program2Def> Id2Defs;
226  typedef std::vector<NBTrafficLightLogic*> Logics;
227  typedef std::vector<NBTrafficLightDefinition*> Definitions;
228 
231 
234 
236  std::set<NBTrafficLightDefinition*> myExtracted;
237 
239  std::set<std::string> myHalfOffsetTLS;
240 
242  std::set<std::string> myQuarterOffsetTLS;
243 
245 
246 private:
248  Definitions getDefinitions() const;
249 
252  void clear();
253 
254 
255 };
256 
257 
258 #endif
259 
260 /****************************************************************************/
261