SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
NBOwnTLDef.h
Go to the documentation of this file.
1 /****************************************************************************/
9 // A traffic light logics which must be computed (only nodes/edges are given)
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 NBOwnTLDef_h
23 #define NBOwnTLDef_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 <vector>
36 #include <set>
39 
40 
41 // ===========================================================================
42 // class declarations
43 // ===========================================================================
44 class NBNode;
45 
46 
47 // ===========================================================================
48 // class definitions
49 // ===========================================================================
55 public:
60  NBOwnTLDef(const std::string& id,
61  const std::vector<NBNode*> &junctions) ;
62 
63 
68  NBOwnTLDef(const std::string& id, NBNode* junction) ;
69 
70 
74  NBOwnTLDef(const std::string& id) ;
75 
76 
78  ~NBOwnTLDef() ;
79 
80 
85 
86 
89 
96  void remapRemoved(NBEdge* removed,
97  const EdgeVector& incoming, const EdgeVector& outgoing) ;
98 
99 
104  void setTLControllingInformation(const NBEdgeCont& ec) const ;
106 
107 
108 protected:
111 
119  unsigned int brakingTimeSeconds) ;
120 
121 
125  void collectNodes() ;
126 
127 
132  void collectLinks() ;
133 
134 
142  void replaceRemoved(NBEdge* removed, int removedLane,
143  NBEdge* by, int byLane) ;
145 
146 
147 protected:
154 
155 
160  int getToPrio(const NBEdge* const e) ;
161 
162 
168  SUMOReal computeUnblockedWeightedStreamNumber(const NBEdge* const e1, const NBEdge* const e2) ;
169 
170 
175  std::pair<NBEdge*, NBEdge*> getBestCombination(const EdgeVector& edges) ;
176 
177 
185  std::pair<NBEdge*, NBEdge*> getBestPair(EdgeVector& incoming) ;
186 
187 
192  public:
197  int operator()(const NBEdge* const e1, const NBEdge* const e2) const {
198  if (e1->getJunctionPriority(e1->getToNode()) != e2->getJunctionPriority(e2->getToNode())) {
199  return e1->getJunctionPriority(e1->getToNode()) > e2->getJunctionPriority(e2->getToNode());
200  }
201  return e1->getID() > e2->getID();
202  }
203  };
204 
205 };
206 
207 
208 #endif
209 
210 /****************************************************************************/
211