LCOV - code coverage report
Current view: top level - src/netgen - NGEdge.h (source / functions) Hit Total Coverage
Test: lcov.info Lines: 2 2 100.0 %
Date: 2024-09-16 15:39:55 Functions: 0 0 -

          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    NGEdge.h
      15             : /// @author  Markus Hartinger
      16             : /// @author  Daniel Krajzewicz
      17             : /// @author  Michael Behrisch
      18             : /// @date    Mar, 2003
      19             : ///
      20             : // A netgen-representation of an edge
      21             : /****************************************************************************/
      22             : #pragma once
      23             : #include <config.h>
      24             : 
      25             : #include <list>
      26             : #include <utils/common/Named.h>
      27             : #include <utils/common/UtilExceptions.h>
      28             : #include <utils/geom/Position.h>
      29             : #include <utils/geom/GeomHelper.h>
      30             : 
      31             : 
      32             : // ===========================================================================
      33             : // class declarations
      34             : // ===========================================================================
      35             : class NGNode;
      36             : class NBNode;
      37             : class NBEdge;
      38             : class NBNetBuilder;
      39             : 
      40             : 
      41             : // ===========================================================================
      42             : // class definitions
      43             : // ===========================================================================
      44             : /**
      45             :  * @class NGEdge
      46             :  * @brief A netgen-representation of an edge
      47             :  *
      48             :  * Please note that the edge makes itself known to the from- and the to-nodes
      49             :  *  on initialisation and removes this information from the nodes when being
      50             :  *  deleted. This implicates that nodes have to be deleted after the edges.
      51             :  */
      52             : class NGEdge : public Named {
      53             : public:
      54             :     /** @brief Constructor
      55             :      *
      56             :      * Adds itself to the start and the end node's lists of connections.
      57             :      *
      58             :      * @param[in] id The id of the link
      59             :      * @param[in] StarNGNode The begin node
      60             :      * @param[in] EndNode The end node
      61             :      */
      62             :     NGEdge(const std::string& id, NGNode* startNode, NGNode* endNode, const std::string& reverseID = "");
      63             : 
      64             : 
      65             :     /** @brief Destructor
      66             :      *
      67             :      * Removes itself from the start and the end node's lists of connections.
      68             :      */
      69             :     ~NGEdge();
      70             : 
      71             : 
      72             :     /** @brief Returns this link's start node
      73             :      *
      74             :      * @return The start node of the link
      75             :      */
      76             :     NGNode* getStartNode() const {
      77     1499873 :         return myStartNode;
      78             :     }
      79             : 
      80             : 
      81             :     /** @brief Returns this link's end node
      82             :      *
      83             :      * @return The end node of the link
      84             :      */
      85             :     NGNode* getEndNode() const {
      86     4736397 :         return myEndNode;
      87             :     }
      88             : 
      89             : 
      90             :     /** @brief Builds and returns this link's netbuild-representation
      91             :      *
      92             :      * Returns an edge built using the known values. Other values, such as the
      93             :      *  number of lanes, are gathered from defaults.
      94             :      * The starting and the ending node must have been built in prior.
      95             :      *
      96             :      * @param[in] nb The netbuilder to retrieve the referenced nodes from
      97             :      * @return The built edge
      98             :      */
      99             :     NBEdge* buildNBEdge(NBNetBuilder& nb, std::string type, const bool reversed = false) const;
     100             : 
     101             : 
     102             : private:
     103             :     /// @brief The node the edge starts at
     104             :     NGNode* myStartNode;
     105             : 
     106             :     /// @brief The node the edge ends at
     107             :     NGNode* myEndNode;
     108             : 
     109             :     /// @brief The id when building the reverse edge
     110             :     const std::string myReverseID;
     111             : };
     112             : 
     113             : 
     114             : /**
     115             :  * @typedef NGEdgeList
     116             :  * @brief A list of edges (edge pointers)
     117             :  */
     118             : typedef std::list<NGEdge*> NGEdgeList;

Generated by: LCOV version 1.14