SUMO - Simulation of Urban MObility
MSEdgeControl.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2017 German Aerospace Center (DLR) and others.
4 /****************************************************************************/
5 //
6 // This program and the accompanying materials
7 // are made available under the terms of the Eclipse Public License v2.0
8 // which accompanies this distribution, and is available at
9 // http://www.eclipse.org/legal/epl-v20.html
10 //
11 /****************************************************************************/
22 // Stores edges and lanes, performs moving of vehicle
23 /****************************************************************************/
24 #ifndef MSEdgeControl_h
25 #define MSEdgeControl_h
26 
27 
28 // ===========================================================================
29 // included modules
30 // ===========================================================================
31 #ifdef _MSC_VER
32 #include <windows_config.h>
33 #else
34 #include <config.h>
35 #endif
36 
37 #include <vector>
38 #include <map>
39 #include <string>
40 #include <iostream>
41 #include <list>
42 #include <set>
43 #include <utils/common/SUMOTime.h>
44 #include <utils/common/Named.h>
45 
46 
47 // ===========================================================================
48 // class declarations
49 // ===========================================================================
50 class MSEdge;
51 class MSLane;
53 
54 typedef std::vector<MSEdge*> MSEdgeVector;
55 
56 // ===========================================================================
57 // class definitions
58 // ===========================================================================
74 
75 public:
83  MSEdgeControl(const std::vector< MSEdge* >& edges);
84 
85 
88 
89 
96  void patchActiveLanes();
97 
98 
101 
109  void planMovements(SUMOTime t);
110 
111 
125  void executeMovements(SUMOTime t);
127 
128 
137  void changeLanes(SUMOTime t);
138 
139 
150  void detectCollisions(SUMOTime timestep, const std::string& stage);
151 
152 
158  const MSEdgeVector& getEdges() const {
159  return myEdges;
160  }
161 
162 
167  std::vector<std::string> getEdgeNames() const;
168 
169 
175  void gotActive(MSLane* l);
176 
179 
180 
181 public:
193  struct LaneUsage {
197  std::vector<MSLane*>::const_iterator firstNeigh;
199  std::vector<MSLane*>::const_iterator lastNeigh;
201  bool amActive;
204  };
205 
206 private:
209 
211  typedef std::vector<LaneUsage> LaneUsageVector;
212 
214  LaneUsageVector myLanes;
215 
217  std::list<MSLane*> myActiveLanes;
218 
220  std::vector<MSLane*> myWithVehicles2Integrate;
221 
223  std::set<MSLane*, ComparatorIdLess> myChangedStateLanes;
224 
226  std::vector<SUMOTime> myLastLaneChange;
227 
228 private:
231 
234 
235 };
236 
237 
238 #endif
239 
240 /****************************************************************************/
241 
std::list< MSLane * > myActiveLanes
The list of active (not empty) lanes.
~MSEdgeControl()
Destructor.
void patchActiveLanes()
Resets information whether a lane is active for all lanes.
MSLane * lane
The described lane.
std::vector< LaneUsage > LaneUsageVector
Definition of a container about a lane&#39;s number of vehicles and neighbors.
LaneUsageVector myLanes
Information about lanes&#39; number of vehicles and neighbors.
MSEdgeControl & operator=(const MSEdgeControl &)
Assignment operator.
void changeLanes(SUMOTime t)
Moves (precomputes) critical vehicles.
std::vector< MSLane * >::const_iterator firstNeigh
The lane left to the described lane (==lastNeigh if none)
bool amActive
Information whether this lane is active.
A structure holding some basic information about a simulated lane.
void gotActive(MSLane *l)
Informs the control that the given lane got active.
void detectCollisions(SUMOTime timestep, const std::string &stage)
Detect collisions.
void setAdditionalRestrictions()
apply additional restrictions
std::vector< std::string > getEdgeNames() const
Returns the list of names of all known edges.
A road/street connecting two junctions.
Definition: MSEdge.h:80
std::vector< SUMOTime > myLastLaneChange
The list of active (not empty) lanes.
Stores edges and lanes, performs moving of vehicle.
Definition: MSEdgeControl.h:73
MSEdgeVector myEdges
Loaded edges.
void planMovements(SUMOTime t)
Compute safe velocities for all vehicles based on positions and speeds from the last time step...
std::set< MSLane *, ComparatorIdLess > myChangedStateLanes
Lanes which changed the state without informing the control.
void executeMovements(SUMOTime t)
Executes planned vehicle movements with regards to right-of-way.
bool haveNeighbors
Information whether this lane belongs to a multi-lane edge.
std::vector< MSLane * > myWithVehicles2Integrate
A storage for lanes which shall be integrated because vehicles have moved onto them.
const MSEdgeVector & getEdges() const
Returns loaded edges.
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:70
std::vector< MSLane * >::const_iterator lastNeigh
The end of this lane&#39;s edge&#39;s lane container.
long long int SUMOTime
Definition: TraCIDefs.h:51
std::vector< MSEdge * > MSEdgeVector
Definition: MSEdge.h:77
MSEdgeControl(const std::vector< MSEdge * > &edges)
Constructor.
Representation of a lane in the micro simulation.
Definition: MSLane.h:77
std::vector< MSEdge * > MSEdgeVector
Definition: MSEdgeControl.h:52