SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
NLJunctionControlBuilder.h
Go to the documentation of this file.
1 /****************************************************************************/
9 // Builder of microsim-junctions and tls
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 NLJunctionControlBuilder_h
23 #define NLJunctionControlBuilder_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 <string>
36 #include <vector>
37 #include <microsim/MSJunction.h>
40 #include <utils/geom/Position.h>
44 #include <microsim/MSBitSetLogic.h>
47 
48 
49 // ===========================================================================
50 // class declarations
51 // ===========================================================================
52 class OptionsCont;
53 class NLDetectorBuilder;
54 
55 
56 // ===========================================================================
57 // class definitions
58 // ===========================================================================
70 private:
72  typedef std::vector<MSLane*> LaneVector;
73 
74 public:
83 
84 
90  virtual ~NLJunctionControlBuilder() ;
91 
92 
106  void openJunction(const std::string& id, const std::string& key,
107  const std::string& type, SUMOReal x, SUMOReal y,
108  const PositionVector& shape,
109  const std::vector<MSLane*> &incomingLanes,
110  const std::vector<MSLane*> &internalLanes) throw(InvalidArgument);
111 
112 
126 
127 
135  MSJunctionControl* build() const ;
136 
137 
141  void initJunctionLogic(const std::string& id) ;
142 
143 
155  void addLogicItem(int request, const std::string& response,
156  const std::string& foes, bool cont) throw(InvalidArgument);
157 
158 
168  void initTrafficLightLogic(const std::string& id, const std::string& programID,
169  TrafficLightType type, SUMOTime offset) ;
170 
171 
181  void addPhase(SUMOTime duration, const std::string& state,
182  int min, int max) ;
183 
184 
191  MSTLLogicControl::TLSLogicVariants& getTLLogic(const std::string& id)
192  const throw(InvalidArgument);
193 
194 
205 
206 
215  virtual void closeTrafficLightLogic() throw(InvalidArgument, ProcessError);
216 
217 
228  void closeJunctionLogic() throw(InvalidArgument);
229 
230 
238  void addParam(const std::string& key, const std::string& value) ;
239 
240 
244  const std::string& getActiveKey() const ;
245 
246 
250  const std::string& getActiveSubKey() const ;
251 
252 
261 
262 
263 protected:
273  MSJunctionLogic* getJunctionLogicSecure() throw(InvalidArgument);
274 
275 
276 protected:
279 
286  virtual MSJunction* buildNoLogicJunction() ;
287 
288 
297  virtual MSJunction* buildLogicJunction() throw(InvalidArgument);
298 
299 
300 #ifdef HAVE_INTERNAL_LANES
301 
307  virtual MSJunction* buildInternalJunction() ;
308 #endif
309 
310 
311 
312 protected:
315 
318 
321 
324 
327 
330 
332  std::bitset<64> myActiveConts;
333 
336 
339 
342 
345 
348 
349 #ifdef HAVE_INTERNAL_LANES
350 
351  LaneVector myActiveInternalLanes;
352 #endif
353 
355  std::string myActiveID;
356 
359 
362 
365 
368 
371 
372 
374  struct TLInitInfo {
378  std::map<std::string, std::string> params;
379  };
380 
382  std::vector<TLInitInfo> myJunctions2PostLoadInit;
383 
384 
387 
388 
390  typedef std::map<std::string, std::string> StringParameterMap;
391 
394 
395 
397  std::map<std::string, MSJunctionLogic*> myLogics;
398 
401 
402 
403 private:
406 
409 
410  static const int NO_REQUEST_SIZE;
411 
412 };
413 
414 
415 #endif
416 
417 /****************************************************************************/
418