/****************************************************************************/1// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo2// Copyright (C) 2012-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 AFInfo.h14/// @author Ruediger Ebendt15/// @date 01.12.202316///17// Definitions of informations associated with an edge for use in the arc flag18// routing algorithm (Hilger et al.). In more detail, these informations are:19// flag information for arc flag routing, a key for sorting the heap, a flag20// indicating whether the edge has already been touched, labels for holding21// (tentative / final) distances to the boundary nodes22/****************************************************************************/23#pragma once24#include <config.h>25#include <unordered_set>2627template<class E>28class AFInfo {29public:30/**31* @class FlagInfo32*33* It holds a pointer to the associated edge, and flag information34* for arc flag routing35*/36class FlagInfo {37public:38/** @brief Constructor39* param[in] e The edge40*/41FlagInfo(const E* const e) :42edge(e) {43}44/** @brief Copy constructor45* @param[in] other The other FLAG info instance to copy46* @return This instance (i.e., the result of the copy)47*/48FlagInfo& operator=(const FlagInfo& other) {49// guard self assignment50if (this == &other) {51return *this;52}53edge = other.edge;54arcFlags = other.arcFlags;55return *this;56}57/// @brief Destructor58virtual ~FlagInfo() {}59/// @brief Reset the flag information60virtual void reset() {61arcFlags.clear();62}63/// @brief The current edge64const E* const edge;65/// @brief The arc flags66std::vector<bool> arcFlags;67}; // end of class FlagInfo declaration6869/**70* @class ArcInfoBase71*72* Derived from FlagInfo. Therefore holds a pointer73* to the associated edge, and flag information for arc flag routing.74* Additionally, it holds a key for sorting the heap, and a flag75* indicating whether the edge has already been touched76*/77class ArcInfoBase : public FlagInfo {78public:79/** @brief Constructor80* param[in] e The edge81*/82ArcInfoBase(const E* const e) :83FlagInfo(e),84key(std::numeric_limits<double>::max()),85touched(false) {86}87/** @brief Copy constructor88* @param[in] other The other ArcInfoBase instance to copy89* @return This instance (i.e., the result of the copy)90*/91ArcInfoBase& operator=(const ArcInfoBase& other) {92// guard self assignment93if (this == &other) {94return *this;95}96static_cast<FlagInfo>(this) = static_cast<FlagInfo>(other);97key = other.key;98touched = other.touched;99return *this;100}101~ArcInfoBase() {}102void reset() {103// do nothing104}105/// @brief The arc flags106std::vector<bool> arcFlags;107/// @brief The key for sorting the heap108double key;109/// @brief The flag indicating whether the edge has already been touched or not110bool touched;111}; // end of class ArcInfoBase declaration112113/**114* @class ArcInfo115*116* Derived from ArcInfoBase. Therefore it tholds a117* pointer to the associated edge, flag information for arc flag routing,118* a key for sorting the heap, a flag indicating whether the edge has119* already been touched. Additionally, it has labels for holding120* (tentative/final) distances to the boundary nodes121*/122class ArcInfo : public ArcInfoBase {123public:124/** @brief Constructor125* param[in] e The edge126*/127ArcInfo(const E* const e) :128ArcInfoBase(e) {129}130/** @brief Copy constructor131* @param[in] other The other arc info instance to copy132* @return This instance (i.e., the result of the copy)133*/134ArcInfo& operator=(const ArcInfo& other) {135// guard self assignment136if (this == &other) {137return *this;138}139static_cast<ArcInfoBase>(this) = static_cast<ArcInfoBase>(other);140effortsToBoundaryNodes = other.effortsToBoundaryNodes;141return *this;142}143/// @brief Destructor144~ArcInfo() {}145/// @brief Reset the arc information146void reset() {147// do nothing148}149/// @brief The efforts to boundary nodes150std::vector<double> effortsToBoundaryNodes;151}; // end of class ArcInfo declaration152};153154155