SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
NIVisumTL.h
Go to the documentation of this file.
1 /****************************************************************************/
7 // Intermediate class for storing visum traffic lights during their import
8 /****************************************************************************/
9 // SUMO, Simulation of Urban MObility; see http://sumo-sim.org/
10 // Copyright (C) 2001-2013 DLR (http://www.dlr.de/) and contributors
11 /****************************************************************************/
12 //
13 // This file is part of SUMO.
14 // SUMO is free software: you can redistribute it and/or modify
15 // it under the terms of the GNU General Public License as published by
16 // the Free Software Foundation, either version 3 of the License, or
17 // (at your option) any later version.
18 //
19 /****************************************************************************/
20 #ifndef NIVisumTL_h
21 #define NIVisumTL_h
22 
23 
24 // ===========================================================================
25 // included modules
26 // ===========================================================================
27 #ifdef _MSC_VER
28 #include <windows_config.h>
29 #else
30 #include <config.h>
31 #endif
32 
33 #include <vector>
34 #include <map>
35 #include <string>
37 #include <netbuild/NBNodeCont.h>
38 #include <utils/common/SUMOTime.h>
39 
41 
42 
43 // ===========================================================================
44 // class declaration
45 // ===========================================================================
50 class NIVisumTL {
51 public:
55  class TimePeriod {
56  public:
58  TimePeriod(SUMOTime startTime, SUMOTime endTime, SUMOTime yellowTime)
59  : myStartTime(startTime), myEndTime(endTime), myYellowTime(yellowTime) {}
60 
63 
66  return myStartTime;
67  }
68 
71  return myEndTime;
72  }
73 
76  return myYellowTime;
77  }
78 
79  private:
86  };
87 
88 
89 
93  class Phase : public TimePeriod {
94  public:
96  Phase(SUMOTime startTime, SUMOTime endTime, SUMOTime yellowTime) : NIVisumTL::TimePeriod(startTime, endTime, yellowTime) {}
97 
99  ~Phase() {}
100 
101  };
102 
103 
104 
108  class SignalGroup : public TimePeriod {
109  public:
111  SignalGroup(const std::string& name, SUMOTime startTime, SUMOTime endTime, SUMOTime yellowTime)
112  : NIVisumTL::TimePeriod(startTime, endTime, yellowTime), myName(name) {}
113 
116 
119  return myConnections;
120  }
121 
123  std::map<std::string, Phase*>& phases() {
124  return myPhases;
125  }
126 
127  private:
131  std::map<std::string, Phase*> myPhases;
133  std::string myName;
134  };
135 
136 
137 
138 public:
146  NIVisumTL(const std::string& name, SUMOTime cycleTime, SUMOTime offset, SUMOTime intermediateTime,
147  bool phaseDefined);
148 
150  ~NIVisumTL();
151 
153  void addNode(NBNode* n) {
154  myNodes.push_back(n);
155  }
156 
158  void addSignalGroup(const std::string& name, SUMOTime startTime, SUMOTime endTime, SUMOTime yellowTime);
159 
161  void addPhase(const std::string& name, SUMOTime startTime, SUMOTime endTime, SUMOTime yellowTime);
162 
164  std::map<std::string, Phase*>& getPhases() {
165  return myPhases;
166  }
167 
169  SignalGroup& getSignalGroup(const std::string& name);
170 
172  void build(NBTrafficLightLogicCont& tlc);
173 
174 private:
176  std::string myName;
177 
180 
183 
186 
189 
191  std::vector<NBNode*> myNodes;
192 
194  std::map<std::string, Phase*> myPhases;
195 
197  std::map<std::string, SignalGroup*> mySignalGroups;
198 
199 
200 };
201 
202 
203 #endif
204 
205 /****************************************************************************/
206