Ark Server API (ASA) - Wiki
Loading...
Searching...
No Matches
TopologicalSort.h
Go to the documentation of this file.
1
// Copyright Epic Games, Inc. All Rights Reserved.
2
3
#
pragma
once
4
5
#
include
"Algo/KahnTopologicalSort.h"
6
#
include
"HAL/Platform.h"
7
#
include
"Templates/UnrealTemplate.h"
8
9
namespace
Algo
10
{
11
/**
12
* Sorts the given range in leaf to root order:
13
* For every pair of elements (A,B) where SortedIndex(A) < SortedIndex(B),
14
* either B is not reachable from A, or A and B are mutually reachable.
15
*
16
* @param UniqueRange A range with element type T
17
* Type T must support GetTypeHash and copy+move constructors; T being pointertype is recommended.
18
* In/Out Variable, is sorted in place. Will be unmodified if function returns false.
19
* @param GetElementDependencies A callable with prototype that is one of
20
* RangeType<T> GetElementDependencies(const T& Element)
21
* const RangeType<T>& GetElementDependencies(const T& Element)
22
* It should return the leaf-ward vertices of directed edges from the root-wards Element.
23
* @param Flags
24
* ETopologicalSort::AllowCycles: If present, cycles will be allowed, with the caveat that the sorted
25
* ordering of MutuallyReachable vertices in the sorted range is arbitrary.
26
* If not present, the presence of a cycle will cause a failure to sort.
27
*
28
* @return True if succeeded, false if failed due to cycles.
29
*/
30
template
<
typename
RangeType,
typename
GetElementDependenciesType>
31
FORCEINLINE
bool
TopologicalSort
(RangeType& UniqueRange, GetElementDependenciesType GetElementDependencies,
32
ETopologicalSort
Flags =
ETopologicalSort
::
None
)
33
{
34
return
KahnTopologicalSort
(
UniqueRange
,
Forward
<
GetElementDependenciesType
>(
GetElementDependencies
),
Flags
);
35
}
36
}
FORCEINLINE
#define FORCEINLINE
Definition
Platform.h:644
Algo
Definition
Heapify.h:12
Algo::ETopologicalSort
ETopologicalSort
Definition
KahnTopologicalSort.h:55
Algo::ETopologicalSort::None
@ None
Algo::TopologicalSort
FORCEINLINE bool TopologicalSort(RangeType &UniqueRange, GetElementDependenciesType GetElementDependencies, ETopologicalSort Flags=ETopologicalSort::None)
Definition
TopologicalSort.h:31
Downloads
ArkServerAPI_NEW
ASA
AsaApi
AsaApi
Core
Public
API
UE
Algo
TopologicalSort.h
Generated by
1.10.0