42 #ifdef CHECK_MEMORY_LEAKS
44 #endif // CHECK_MEMORY_LEAKS
56 #ifndef HAVE_INTERNAL_LANES
62 myRequestIdx(0), myRespondIdx(0),
63 myState(state), myDirection(dir), myLength(length) {}
69 myRequestIdx(0), myRespondIdx(0),
70 myState(state), myDirection(dir), myLength(length),
71 myJunctionInlane(via) {}
80 const std::vector<MSLink*>& foeLinks,
81 const std::vector<MSLane*>& foeLanes) {
93 const bool setRequest,
const SUMOTime arrivalTimeBraking,
const SUMOReal arrivalSpeedBraking,
const SUMOTime waitingTime) {
97 arrivalTimeBraking, arrivalSpeedBraking, waitingTime)));
111 if ((*i)->isBlockingAnyone()) {
127 std::map<const SUMOVehicle*, ApproachingVehicleInformation>::const_iterator i =
myApproachingVehicles.find(veh);
138 return arrivalTime +
TIME2STEPS((
getLength() + vehicleLength) / (0.5 * (arrivalSpeed + leaveSpeed)));
145 std::vector<const SUMOVehicle*>* collectFoes)
const {
164 if ((*i)->blockedAtTime(arrivalTime, leaveTime, arrivalSpeed, leaveSpeed,
myLane == (*i)->getLane(),
165 impatience, decel, waitingTime, collectFoes)) {
176 std::vector<const SUMOVehicle*>* collectFoes)
const {
178 if (!i->second.willPass) {
182 assert(waitingTime > 0);
183 if (waitingTime > i->second.waitingTime) {
186 if (waitingTime == i->second.waitingTime && arrivalTime < i->second.arrivalTime) {
190 const SUMOTime foeArrivalTime = (
SUMOTime)((1.0 - impatience) * i->second.arrivalTime + impatience * i->second.arrivalTimeBraking);
191 if (i->second.leavingTime < arrivalTime) {
193 if (sameTargetLane && (arrivalTime - i->second.leavingTime <
myLookaheadTime
195 i->first->getVehicleType().getCarFollowModel().getMaxDecel(), decel))) {
196 if (collectFoes == 0) {
199 collectFoes->push_back(i->first);
202 }
else if (foeArrivalTime > leaveTime) {
206 decel, i->first->getVehicleType().getCarFollowModel().getMaxDecel()))) {
207 if (collectFoes == 0) {
210 collectFoes->push_back(i->first);
215 if (collectFoes == 0) {
218 collectFoes->push_back(i->first);
239 assert(distLeft > 0);
250 if ((*i)->blockedAtTime(arrivalTime, leaveTime, speed, speed,
myLane == (*i)->getLane(), 0, decel, 0)) {
255 if ((*i)->getVehicleNumber() > 0 || (*i)->getPartialOccupator() != 0) {
286 #ifdef HAVE_INTERNAL_LANES
287 const std::string via = getViaLane() == 0 ?
"" : getViaLane()->getID();
289 const std::string via =
"";
293 std::vector<std::pair<SUMOTime, const SUMOVehicle*> > toSort;
295 toSort.push_back(std::make_pair(it->second.arrivalTime, it->first));
297 std::sort(toSort.begin(), toSort.end());
298 for (std::vector<std::pair<SUMOTime, const SUMOVehicle*> >::const_iterator it = toSort.begin(); it != toSort.end(); ++it) {
314 #ifdef HAVE_INTERNAL_LANES
316 MSLink::getViaLane()
const {
317 return myJunctionInlane;
322 MSLink::getLeaderInfo(
SUMOReal dist)
const {
327 for (std::vector<MSLane*>::const_iterator it_lane =
myFoeLanes.begin(); it_lane !=
myFoeLanes.end(); ++it_lane) {
335 (*it_lane)->releaseVehicles();
336 for (MSLane::VehCont::const_iterator it_veh = vehicles.begin(); it_veh != vehicles.end(); ++it_veh) {
340 result.push_back(std::make_pair(leader,
346 MSVehicle* leader = (*it_lane)->getPartialOccupator();
348 result.push_back(std::make_pair(leader,
350 dist - ((*it_lane)->getLength() - (*it_lane)->getPartialOccupatorEnd())));
361 #ifdef HAVE_INTERNAL_LANES
362 if (myJunctionInlane != 0) {
363 return myJunctionInlane;