Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
AFInfo.h
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3// Copyright (C) 2012-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/****************************************************************************/
18// Definitions of informations associated with an edge for use in the arc flag
19// routing algorithm (Hilger et al.). In more detail, these informations are:
20// flag information for arc flag routing, a key for sorting the heap, a flag
21// indicating whether the edge has already been touched, labels for holding
22// (tentative / final) distances to the boundary nodes
23/****************************************************************************/
24#pragma once
25#include <config.h>
26#include <unordered_set>
27
28template<class E>
29class AFInfo {
30public:
37 class FlagInfo {
38 public:
42 FlagInfo(const E* const e) :
43 edge(e) {
44 }
49 FlagInfo& operator=(const FlagInfo& other) {
50 // guard self assignment
51 if (this == &other) {
52 return *this;
53 }
54 edge = other.edge;
55 arcFlags = other.arcFlags;
56 return *this;
57 }
59 virtual ~FlagInfo() {}
61 virtual void reset() {
62 arcFlags.clear();
63 }
65 const E* const edge;
67 std::vector<bool> arcFlags;
68 }; // end of class FlagInfo declaration
69
78 class ArcInfoBase : public FlagInfo {
79 public:
83 ArcInfoBase(const E* const e) :
84 FlagInfo(e),
85 key(std::numeric_limits<double>::max()),
86 touched(false) {
87 }
93 // guard self assignment
94 if (this == &other) {
95 return *this;
96 }
97 static_cast<FlagInfo>(this) = static_cast<FlagInfo>(other);
98 key = other.key;
99 touched = other.touched;
100 return *this;
101 }
103 void reset() {
104 // do nothing
105 }
107 std::vector<bool> arcFlags;
109 double key;
112 }; // end of class ArcInfoBase declaration
113
123 class ArcInfo : public ArcInfoBase {
124 public:
128 ArcInfo(const E* const e) :
129 ArcInfoBase(e) {
130 }
135 ArcInfo& operator=(const ArcInfo& other) {
136 // guard self assignment
137 if (this == &other) {
138 return *this;
139 }
140 static_cast<ArcInfoBase>(this) = static_cast<ArcInfoBase>(other);
142 return *this;
143 }
147 void reset() {
148 // do nothing
149 }
151 std::vector<double> effortsToBoundaryNodes;
152 }; // end of class ArcInfo declaration
153};
std::vector< bool > arcFlags
The arc flags.
Definition AFInfo.h:107
void reset()
Reset the flag information.
Definition AFInfo.h:103
ArcInfoBase(const E *const e)
Constructor param[in] e The edge.
Definition AFInfo.h:83
ArcInfoBase & operator=(const ArcInfoBase &other)
Copy constructor.
Definition AFInfo.h:92
double key
The key for sorting the heap.
Definition AFInfo.h:109
bool touched
The flag indicating whether the edge has already been touched or not.
Definition AFInfo.h:111
void reset()
Reset the arc information.
Definition AFInfo.h:147
std::vector< double > effortsToBoundaryNodes
The efforts to boundary nodes.
Definition AFInfo.h:151
ArcInfo & operator=(const ArcInfo &other)
Copy constructor.
Definition AFInfo.h:135
ArcInfo(const E *const e)
Constructor param[in] e The edge.
Definition AFInfo.h:128
~ArcInfo()
Destructor.
Definition AFInfo.h:145
FlagInfo(const E *const e)
Constructor param[in] e The edge.
Definition AFInfo.h:42
FlagInfo & operator=(const FlagInfo &other)
Copy constructor.
Definition AFInfo.h:49
virtual void reset()
Reset the flag information.
Definition AFInfo.h:61
std::vector< bool > arcFlags
The arc flags.
Definition AFInfo.h:67
const E *const edge
The current edge.
Definition AFInfo.h:65
virtual ~FlagInfo()
Destructor.
Definition AFInfo.h:59
Definition json.hpp:4471