UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
ChunkReferenceTracker.fake.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2#pragma once
3
5#include "Templates/Greater.h"
6#include "Algo/Sort.h"
7
8#if WITH_DEV_AUTOMATION_TESTS
9
10namespace BuildPatchServices
11{
13 : public IChunkReferenceTracker
14 {
15 public:
16 virtual TSet<FGuid> GetReferencedChunks() const override
17 {
18 return ReferencedChunks;
19 }
20
21 virtual int32 GetReferenceCount(const FGuid& ChunkId) const override
22 {
23 return ReferenceCounts.FindRef(ChunkId);
24 }
25
26 virtual void SortByUseOrder(TArray<FGuid>& ChunkList, ESortDirection Direction) const override
27 {
28 switch (Direction)
29 {
30 case ESortDirection::Ascending:
31 Algo::SortBy(ChunkList, [this](const FGuid& Element) { return NextReferences.IndexOfByKey(Element); }, TLess<int32>());
32 break;
33 case ESortDirection::Descending:
34 Algo::SortBy(ChunkList, [this](const FGuid& Element) { return NextReferences.IndexOfByKey(Element); }, TGreater<int32>());
35 break;
36 }
37 }
38
39 virtual TArray<FGuid> GetNextReferences(int32 Count, const TFunction<bool(const FGuid&)>& SelectPredicate) const override
40 {
42 {
43 bool bSelected = (Count > 0) && SelectPredicate(Element);
44 if (bSelected)
45 {
46 --Count;
47 }
48 return bSelected;
49 });
50 }
51
52 virtual TArray<FGuid> SelectFromNextReferences(int32 Count, const TFunction<bool(const FGuid&)>& SelectPredicate) const override
53 {
55 {
56 bool bSelected = (Count > 0) && SelectPredicate(Element);
57 --Count;
58 return bSelected;
59 });
60 }
61
62 virtual bool PopReference(const FGuid& ChunkId) override
63 {
64 if (NextReferences.Num() && NextReferences[0] == ChunkId)
65 {
68 return true;
69 }
70 return false;
71 }
72 virtual int32 GetRemainingChunkCount() const override { return NextReferences.Num(); };
73
74 virtual void CopyOutOrderedUseList(TArray<FGuid>& OutUseList) const
75 {
77 }
78
79 int32 GetNextUsageForChunk(const FGuid& ChunkId, int32& OutLastUsageIndex) const
80 {
81 for (int32 i=0; i < NextReferences.Num(); i++)
82 {
83 if (NextReferences[i] == ChunkId)
84 {
85 return i + PoppedCount;
86 }
87 }
88 return -1;
89 }
90
91 virtual int32 GetCurrentUsageIndex() const
92 {
93 return PoppedCount;
94 }
95
96 public:
101 };
102}
103
104#endif //WITH_DEV_AUTOMATION_TESTS
FPlatformTypes::int32 int32
A 32-bit signed integer.
Definition Platform.h:1125
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
Definition Array.h:670
void RemoveAt(SizeType Index, EAllowShrinking AllowShrinking=UE::Core::Private::AllowShrinkingByDefault< AllocatorType >())
Definition Array.h:2083
TArray< ElementType > FilterByPredicate(Predicate Pred) const
Definition Array.h:1498
Definition AndroidPlatformMisc.h:14
Definition UnrealString.h.inl:34
UE_REWRITE void SortBy(RangeType &&Range, ProjectionType Proj)
Definition Sort.h:40
Definition BuildPatchFileConstructor.h:28
Definition Guid.h:109