40 #ifdef CHECK_MEMORY_LEAKS 42 #endif // CHECK_MEMORY_LEAKS 50 myLanes(
MSLane::dictSize()),
51 myLastLaneChange(
MSEdge::dictSize()) {
53 for (std::vector< MSEdge* >::const_iterator i =
myEdges.begin(); i !=
myEdges.end(); ++i) {
54 const std::vector<MSLane*>& lanes = (*i)->getLanes();
55 if (lanes.size() == 1) {
56 size_t pos = (*lanes.begin())->getNumericalID();
57 myLanes[pos].lane = *(lanes.begin());
58 myLanes[pos].firstNeigh = lanes.end();
59 myLanes[pos].lastNeigh = lanes.end();
61 myLanes[pos].haveNeighbors =
false;
63 for (std::vector<MSLane*>::const_iterator j = lanes.begin(); j != lanes.end(); ++j) {
64 size_t pos = (*j)->getNumericalID();
66 myLanes[pos].firstNeigh = (j + 1);
67 myLanes[pos].lastNeigh = lanes.end();
69 myLanes[pos].haveNeighbors =
true;
86 if (!lu.
amActive && (*i)->getVehicleNumber() > 0) {
102 if ((*i)->getVehicleNumber() == 0) {
103 myLanes[(*i)->getNumericalID()].amActive =
false;
106 (*i)->planMovements(t);
118 myLanes[(*i)->getNumericalID()].amActive =
false;
125 if ((*i)->integrateNewVehicle(t)) {
142 std::vector<MSLane*> toAdd;
146 MSEdge& edge = (*i)->getEdge();
150 const std::vector<MSLane*>& lanes = edge.
getLanes();
151 for (std::vector<MSLane*>::const_iterator i = lanes.begin(); i != lanes.end(); ++i) {
153 if ((*i)->getVehicleNumber() > 0 && !lu.
amActive) {
164 for (std::vector<MSLane*>::iterator i = toAdd.begin(); i != toAdd.end(); ++i) {
174 (*i)->detectCollisions(timestep, stage);
179 std::vector<std::string>
181 std::vector<std::string> ret;
182 for (MSEdgeVector::const_iterator i =
myEdges.begin(); i !=
myEdges.end(); ++i) {
183 ret.push_back((*i)->getID());
std::list< MSLane * > myActiveLanes
The list of active (not empty) lanes.
~MSEdgeControl()
Destructor.
const std::vector< MSLane * > & getLanes() const
Returns this edge's lanes.
std::vector< std::string > getEdgeNames() const
Returns the list of names of all known edges.
void patchActiveLanes()
Resets information whether a lane is active for all lanes.
std::set< MSLane *, Named::ComparatorIdLess > myChangedStateLanes
Lanes which changed the state without informing the control.
LaneUsageVector myLanes
Information about lanes' number of vehicles and neighbors.
void changeLanes(SUMOTime t)
Moves (precomputes) critical vehicles.
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.
A road/street connecting two junctions.
std::vector< SUMOTime > myLastLaneChange
The list of active (not empty) lanes.
MSEdgeVector myEdges
Loaded edges.
void planMovements(SUMOTime t)
Compute safe velocities for all vehicles based on positions and speeds from the last time step...
void executeMovements(SUMOTime t)
Executes planned vehicle movements with regards to right-of-way.
int getNumericalID() const
Returns the numerical id of the edge.
virtual void changeLanes(SUMOTime t)
Performs lane changing on this edge.
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.
MSEdgeControl(const std::vector< MSEdge * > &edges)
Constructor.
Representation of a lane in the micro simulation.