SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MSEdgeControl.h
Go to the documentation of this file.
1 /****************************************************************************/
12 // Stores edges and lanes, performs moving of vehicle
13 /****************************************************************************/
14 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/
15 // Copyright (C) 2001-2012 DLR (http://www.dlr.de/) and contributors
16 /****************************************************************************/
17 //
18 // This file is part of SUMO.
19 // SUMO is free software: you can redistribute it and/or modify
20 // it under the terms of the GNU General Public License as published by
21 // the Free Software Foundation, either version 3 of the License, or
22 // (at your option) any later version.
23 //
24 /****************************************************************************/
25 #ifndef MSEdgeControl_h
26 #define MSEdgeControl_h
27 
28 
29 // ===========================================================================
30 // included modules
31 // ===========================================================================
32 #ifdef _MSC_VER
33 #include <windows_config.h>
34 #else
35 #include <config.h>
36 #endif
37 
38 #include <vector>
39 #include <map>
40 #include <string>
41 #include <iostream>
42 #include <list>
43 #include <set>
44 #include <utils/common/SUMOTime.h>
45 #include <utils/common/Named.h>
46 
47 
48 // ===========================================================================
49 // class declarations
50 // ===========================================================================
51 class MSEdge;
52 class MSLane;
53 class OutputDevice;
54 class BinaryInputDevice;
55 
56 
57 // ===========================================================================
58 // class definitions
59 // ===========================================================================
75 public:
77  typedef std::vector< MSEdge* > EdgeCont;
78 
79 public:
87  MSEdgeControl(const std::vector< MSEdge* > &edges) ;
88 
89 
91  ~MSEdgeControl() ;
92 
93 
100  void patchActiveLanes() ;
101 
102 
105 
118  void moveCritical(SUMOTime t) ;
119 
120 
139  void moveFirst(SUMOTime t) ;
141 
142 
151  void changeLanes(SUMOTime t) ;
152 
153 
162  void detectCollisions(SUMOTime timestep) ;
163 
164 
170  const std::vector<MSEdge*> &getEdges() const {
171  return myEdges;
172  }
173 
174 
179  std::vector<std::string> getEdgeNames() const ;
180 
181 
187  void gotActive(MSLane* l) ;
188 
189 
190 public:
202  struct LaneUsage {
206  std::vector<MSLane*>::const_iterator firstNeigh;
208  std::vector<MSLane*>::const_iterator lastNeigh;
210  bool amActive;
213  };
214 
215 private:
217  std::vector<MSEdge*> myEdges;
218 
220  typedef std::vector<LaneUsage> LaneUsageVector;
221 
224 
226  std::list<MSLane*> myActiveLanes;
227 
229  std::vector<MSLane*> myWithVehicles2Integrate;
230 
232  std::set<MSLane*, Named::ComparatorIdLess> myChangedStateLanes;
233 
235  std::vector<SUMOTime> myLastLaneChange;
236 
237 private:
240 
243 
244 };
245 
246 
247 #endif
248 
249 /****************************************************************************/
250