/****************************************************************************/1// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo2// Copyright (C) 2001-2025 German Aerospace Center (DLR) and others.3// This program and the accompanying materials are made available under the4// terms of the Eclipse Public License 2.0 which is available at5// https://www.eclipse.org/legal/epl-2.0/6// This Source Code may also be made available under the following Secondary7// Licenses when the conditions for such availability set forth in the Eclipse8// Public License 2.0 are satisfied: GNU General Public License, version 29// or later which is available at10// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html11// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later12/****************************************************************************/13/// @file FlippedNode.h14/// @author Ruediger Ebendt15/// @date 01.12.202316///17// Wrapper around an RONode used for backward search. It swaps incoming18// with outgoing edges, and replaces the original edges by reversed19// ones (i.e., by instances of FlippedEdge)20/****************************************************************************/21#pragma once22#include <config.h>23#include <vector>24#include "FlippedEdge.h"2526// ===========================================================================27// class definitions28// ===========================================================================29/// @brief the node type representing nodes used for backward search30template<class E, class N, class V>31class FlippedNode {32public:33typedef std::vector<const FlippedEdge<E, N, V>*> ConstFlippedEdgeVector;3435/** Constructor36* @param[in] originalNode The original node37*/38FlippedNode(const N* originalNode) :39myOriginalNode(originalNode) {}4041/// @brief Destructor42~FlippedNode() {}4344/** @brief Returns the position of the node45* @return This node's position46*/47const Position& getPosition() const {48return myOriginalNode->getPosition();49}50/** @brief Returns the id(entifier) of the node51* @return This node's id(entifier)52*/53const std::string& getID() const {54return myOriginalNode->getID();55}5657/** @brief Returns the incoming edges of the node58* @return The incoming edges of the node59*/60const ConstFlippedEdgeVector& getIncoming() const {61if (myIncoming.empty()) {62const std::vector<const E*>& incoming = myOriginalNode->getOutgoing();63for (const E* edge : incoming) {64myIncoming.push_back(edge->getFlippedRoutingEdge());65}66}67return myIncoming;68}6970/** @brief Returns the outgoing edges of the node71* @return The outgoing edges of the node72*/73const ConstFlippedEdgeVector& getOutgoing() const {74if (myOutgoing.empty()) {75const std::vector<const E*>& outgoing = myOriginalNode->getIncoming();76for (const E* edge : outgoing) {77myOutgoing.push_back(edge->getFlippedRoutingEdge());78}79}80return myOutgoing;81}8283/// @brief Returns the original node84const N* getOriginalNode() const {85return myOriginalNode;86}87private:88/// @brief The original node89const N* const myOriginalNode;90/// @brief The incoming edges91mutable ConstFlippedEdgeVector myIncoming;92/// @brief The outgoing edges93mutable ConstFlippedEdgeVector myOutgoing;94};959697