SUMO - Simulation of Urban MObility
MSLinkCont.cpp
Go to the documentation of this file.
00001 /****************************************************************************/
00007 // Helpers for link vector
00008 /****************************************************************************/
00009 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/
00010 // Copyright (C) 2001-2012 DLR (http://www.dlr.de/) and contributors
00011 /****************************************************************************/
00012 //
00013 //   This file is part of SUMO.
00014 //   SUMO is free software: you can redistribute it and/or modify
00015 //   it under the terms of the GNU General Public License as published by
00016 //   the Free Software Foundation, either version 3 of the License, or
00017 //   (at your option) any later version.
00018 //
00019 /****************************************************************************/
00020 
00021 
00022 // ===========================================================================
00023 // included modules
00024 // ===========================================================================
00025 #ifdef _MSC_VER
00026 #include <windows_config.h>
00027 #else
00028 #include <config.h>
00029 #endif
00030 
00031 #include "MSLinkCont.h"
00032 #include "MSLane.h"
00033 
00034 #ifdef CHECK_MEMORY_LEAKS
00035 #include <foreign/nvwa/debug_new.h>
00036 #endif // CHECK_MEMORY_LEAKS
00037 
00038 
00039 // ===========================================================================
00040 // method definitions
00041 // ===========================================================================
00042 #ifdef HAVE_INTERNAL_LANES
00043 const MSEdge*
00044 MSLinkContHelper::getInternalFollowingEdge(MSLane* fromLane,
00045         MSEdge* followerAfterInternal) {
00046     //@todo to be optimized
00047     const MSLinkCont& lc = fromLane->getLinkCont();
00048     for (MSLinkCont::const_iterator j = lc.begin(); j != lc.end(); j++) {
00049         MSLink* link = *j;
00050         if (&link->getLane()->getEdge() == followerAfterInternal) {
00051             return &link->getViaLane()->getEdge();
00052         }
00053     }
00054     return 0;
00055 }
00056 #endif
00057 
00058 
00059 MSLink*
00060 MSLinkContHelper::getConnectingLink(const MSLane& from, const MSLane& to) {
00061     const MSLinkCont& lc = from.getLinkCont();
00062     for (MSLinkCont::const_iterator j = lc.begin(); j != lc.end(); j++) {
00063         MSLink* link = *j;
00064         if (link->getLane() == &to) {
00065             return link;
00066         }
00067     }
00068     return 0;
00069 }
00070 
00071 
00072 
00073 /****************************************************************************/
00074 
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Defines