LCOV - code coverage report
Current view: top level - src/microsim - MSLogicJunction.cpp (source / functions) Coverage Total Hit
Test: lcov.info Lines: 85.0 % 20 17
Test Date: 2024-11-22 15:46:21 Functions: 60.0 % 5 3

            Line data    Source code
       1              : /****************************************************************************/
       2              : // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
       3              : // Copyright (C) 2001-2024 German Aerospace Center (DLR) and others.
       4              : // This program and the accompanying materials are made available under the
       5              : // terms of the Eclipse Public License 2.0 which is available at
       6              : // https://www.eclipse.org/legal/epl-2.0/
       7              : // This Source Code may also be made available under the following Secondary
       8              : // Licenses when the conditions for such availability set forth in the Eclipse
       9              : // Public License 2.0 are satisfied: GNU General Public License, version 2
      10              : // or later which is available at
      11              : // https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
      12              : // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
      13              : /****************************************************************************/
      14              : /// @file    MSLogicJunction.cpp
      15              : /// @author  Christian Roessel
      16              : /// @author  Daniel Krajzewicz
      17              : /// @author  Michael Behrisch
      18              : /// @author  Jakob Erdmann
      19              : /// @date    Wed, 12 Dez 2001
      20              : ///
      21              : // with one ore more logics.
      22              : /****************************************************************************/
      23              : #include <config.h>
      24              : 
      25              : #include "MSLogicJunction.h"
      26              : #include "MSLane.h"
      27              : 
      28              : 
      29              : // ===========================================================================
      30              : // member method definitions
      31              : // ===========================================================================
      32              : /* -------------------------------------------------------------------------
      33              :  * methods from MSLogicJunction
      34              :  * ----------------------------------------------------------------------- */
      35       471542 : MSLogicJunction::MSLogicJunction(const std::string& id,
      36              :                                  SumoXMLNodeType type,
      37              :                                  const Position& position,
      38              :                                  const PositionVector& shape,
      39              :                                  const std::string& name,
      40              :                                  std::vector<MSLane*> incoming,
      41       471542 :                                  std::vector<MSLane*> internal):
      42              :     MSJunction(id, type, position, shape, name),
      43       471542 :     myIncomingLanes(incoming),
      44       471542 :     myInternalLanes(internal) {
      45       471542 : }
      46              : 
      47              : 
      48       434955 : MSLogicJunction::~MSLogicJunction() {}
      49              : 
      50              : 
      51              : void
      52            0 : MSLogicJunction::postloadInit() {
      53              :     /*
      54              :     if(getID()=="1565") {
      55              :         int bla = 0;
      56              :     }
      57              :     // inform links where they have to report approaching vehicles to
      58              :     int requestPos = 0;
      59              :     std::vector<MSLane*>::iterator i;
      60              :     // going through the incoming lanes...
      61              :     for(i=myIncomingLanes.begin(); i!=myIncomingLanes.end(); ++i) {
      62              :         const MSLinkCont &links = (*i)->getLinkCont();
      63              :         // ... set information for every link
      64              :         for(MSLinkCont::const_iterator j=links.begin(); j!=links.end(); j++) {
      65              :             (*j)->setRequestInformation(&myRequest, requestPos,
      66              :                 &myRespond, requestPos/, clearInfo/);
      67              :             requestPos++;
      68              :         }
      69              :     }
      70              :     // set information for the internal lanes
      71              :     requestPos = 0;
      72              :     for(i=myInternalLanes.begin(); i!=myInternalLanes.end(); ++i) {
      73              :         // ... set information about participation
      74              :         static_cast<MSInternalLane*>(*i)->setParentJunctionInformation(
      75              :             &myInnerState, requestPos++);
      76              :     }
      77              :     */
      78            0 : }
      79              : 
      80              : const std::vector<MSLane*>
      81       283258 : MSLogicJunction::getInternalLanes() const {
      82              :     // Besides the lanes im myInternal lanes, which are only the last parts of the connections,
      83              :     // this collects all lanes on the junction
      84              :     std::vector<MSLane*> allInternalLanes;
      85      1467012 :     for (std::vector<MSLane*>::const_iterator i = myInternalLanes.begin(); i != myInternalLanes.end(); ++i) {
      86      1183754 :         MSLane* l = *i;
      87      1248106 :         while (l != nullptr) {
      88      1248106 :             allInternalLanes.push_back(l);
      89      1248106 :             const std::vector<MSLane::IncomingLaneInfo> incoming = l->getIncomingLanes();
      90      1248106 :             if (incoming.size() == 0) {
      91              :                 break;
      92              :             }
      93              :             assert(l->getIncomingLanes().size() == 1);
      94      1248106 :             l = l->getIncomingLanes()[0].lane;
      95      1248106 :             if (!l->isInternal()) {
      96              :                 break;
      97              :             }
      98      1248106 :         }
      99              :     }
     100       283258 :     return allInternalLanes;
     101            0 : }
     102              : 
     103              : 
     104              : /****************************************************************************/
        

Generated by: LCOV version 2.0-1