5#include "Containers/Array.h"
16#include <initializer_list>
19template <
typename InElementType,
int32 InPageSizeInBytes = 16384,
typename InAllocatorType = FDefaultAllocator>
28template <
typename InElementType,
int32 InPageSizeInBytes>
42template <
typename InElementType,
typename InPageType,
typename InPageTraits>
64 return Data[PageIndex][PageOffset];
69 if (++PageOffset == PageTraits::Capacity)
78 return Data ==
Other.Data && PageIndex ==
Other.PageIndex && PageOffset ==
Other.PageOffset;
87template <
typename InElementType,
typename InPageType,
typename InPageTraits>
91template <
typename ElementType,
int32 PageSizeInBytes,
typename AllocatorType>
94 using SizeType =
typename AllocatorType::SizeType;
105 for (SizeType ElementIndex = 0; ElementIndex < NumElements; ++ElementIndex)
121template <
typename ElementType,
int32 PageSizeInBytes,
typename AllocatorType>
130 for (
int32 ElementIndex = 0; ElementIndex < NumElements; ++ElementIndex)
158template <
typename InElementType,
int32 InPageSizeInBytes,
typename InAllocatorType>
161 template <
typename AnyElementType,
int32 AnyPageSizeInBytes,
typename AnyAllocatorType>
169 using SizeType =
typename InAllocatorType::SizeType;
172 AllocatorType::NeedsElementType,
174 typename AllocatorType::ForAnyElementType>;
248 CheckValidIndex(
Index);
249 return Pages[GetPageIndex(
Index)][GetPageOffset(
Index)];
254 CheckValidIndex(
Index);
255 return Pages[GetPageIndex(
Index)][GetPageOffset(
Index)];
267 Size += Pages.GetAllocatedSize();
314 return Pages[GetPageIndex(LastIndex)][GetPageOffset(LastIndex)];
321 return Pages[GetPageIndex(LastIndex)][GetPageOffset(LastIndex)];
393 GrowIfRequired(Count +
InSize);
403 typename ContainerType
415 template <
int32 OtherPageSizeInBytes,
typename OtherAllocator>
420 GrowIfRequired(Count +
Other.Count);
423 CopyUnchecked(
Page.GetData(),
Page.Num());
444 typename ContainerType
458 template <
int32 OtherPageSizeInBytes,
typename OtherAllocator>
474 const SizeType PageIndex = GetPageIndex(ElementIndex);
556 CheckValidIndex(
Index);
600 const SizeType PageCount = Pages.Num();
643 template <
typename AnyAllocator>
661 template <
typename AnyAllocator>
680 return GetIterator(0);
684 return GetIterator(0);
688 return GetIterator(Count);
692 return GetIterator(Count);
705 if (Pages[PageIndex] !=
Right.Pages[PageIndex])
715 return !(*
this ==
Right);
763 SizeType PageIndex = GetPageIndex(Count);
765 if (
const SizeType PageOffset = GetPageOffset(Count))
806 void GrowIfRequired()
833template <
typename ElementType,
int32 PageSizeInBytes,
typename AllocatorType>
840template <
typename ElementType,
int32 PageSizeInBytes,
typename AllocatorType>
EAllowShrinking
Definition AllowShrinking.h:10
#define UE_ALLOWSHRINKING_BOOL_DEPRECATED(FunctionName)
Definition AllowShrinking.h:31
#define checkSlow(expr)
Definition AssertionMacros.h:332
#define check(expr)
Definition AssertionMacros.h:314
#define checkf(expr, format,...)
Definition AssertionMacros.h:315
#define UE_STATIC_ASSERT_WARN(bExpression, Message)
Definition CoreMiscDefines.h:431
@ InPlace
Definition CoreMiscDefines.h:162
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
UE_FORCEINLINE_HINT FArchive & operator<<(FArchive &Ar, TPagedArray< ElementType, PageSizeInBytes, AllocatorType > &InOutPagedArray)
Definition PagedArray.h:834
#define UE_REQUIRES(...)
Definition Requires.h:86
auto GetNum(const TStringConversion< Converter, DefaultConversionSize > &Conversion) -> decltype(Conversion.Length())
Definition StringConv.h:808
auto GetData(const TStringConversion< Converter, DefaultConversionSize > &Conversion) -> decltype(Conversion.Get())
Definition StringConv.h:802
UE_INTRINSIC_CAST UE_REWRITE constexpr std::remove_reference_t< T > && MoveTempIfPossible(T &&Obj) noexcept
Definition UnrealTemplate.h:538
UE_INTRINSIC_CAST UE_REWRITE constexpr std::remove_reference_t< T > && MoveTemp(T &&Obj) noexcept
Definition UnrealTemplate.h:520
uint32 Offset
Definition VulkanMemory.cpp:4033
uint32 Size
Definition VulkanMemory.cpp:4034
Definition Archive.h:1208
UE_FORCEINLINE_HINT bool IsLoading() const
Definition Archive.h:236
virtual void CountBytes(SIZE_T InNum, SIZE_T InMax)
Definition Archive.h:125
Definition StructuredArchiveSlots.h:172
Definition StructuredArchiveSlots.h:52
UE_API FStructuredArchiveArray EnterArray(int32 &Num)
Definition StructuredArchiveSlots.h:257
UE_REWRITE SizeType Num() const
Definition Array.h:1144
UE_NODEBUG UE_FORCEINLINE_HINT ElementType * GetData() UE_LIFETIMEBOUND
Definition Array.h:1027
UE_FORCEINLINE_HINT ElementType & Emplace_GetRef(ArgsType &&... Args) UE_LIFETIMEBOUND
Definition Array.h:2613
void Append(const TArray< OtherElementType, OtherAllocatorType > &Source)
Definition Array.h:2412
UE_FORCEINLINE_HINT void Reserve(SizeType Number)
Definition Array.h:3016
Definition IteratorAdapter.h:30
Definition PagedArray.h:160
UE_FORCEINLINE_HINT SizeType Max() const
Definition PagedArray.h:285
UE_FORCEINLINE_HINT bool IsEmpty() const
Definition PagedArray.h:305
void RemoveAtSwap(SizeType Index, EAllowShrinking AllowShrinking=UE::Core::Private::AllowShrinkingByDefault< AllocatorType >())
Definition PagedArray.h:554
void Reset(SizeType InCapacity)
Definition PagedArray.h:625
TPagedArray(const TPagedArray &Other)=default
UE::Core::PagedArray::Private::TIterator< const ElementType, const PageType, PageTraits > ConstIteratorType
Definition PagedArray.h:194
std::conditional_t< AllocatorType::NeedsElementType, typename AllocatorType::template ForElementType< ElementType >, typename AllocatorType::ForAnyElementType > ElementAllocatorType
Definition PagedArray.h:174
UE_FORCEINLINE_HINT void Push(const ElementType &Element)
Definition PagedArray.h:517
void ToArray(TArray< ElementType, AnyAllocator > &OutDestination) &&
Definition PagedArray.h:662
typename InAllocatorType::SizeType SizeType
Definition PagedArray.h:169
void Reserve(SizeType InCount)
Definition PagedArray.h:634
UE_FORCEINLINE_HINT ElementType & Add_GetRef(ElementType &&Element)
Definition PagedArray.h:512
ElementType & operator[](SizeType Index)
Definition PagedArray.h:252
ElementType & Last()
Definition PagedArray.h:317
void Assign(ContainerType &&Container)
Definition PagedArray.h:447
void Pop(EAllowShrinking AllowShrinking=UE::Core::Private::AllowShrinkingByDefault< AllocatorType >())
Definition PagedArray.h:530
UE_FORCEINLINE_HINT SizeType NumPages() const
Definition PagedArray.h:295
~TPagedArray()
Definition PagedArray.h:222
InElementType ElementType
Definition PagedArray.h:170
UE_FORCEINLINE_HINT ConstIteratorType end() const
Definition PagedArray.h:686
void Assign(std::initializer_list< ElementType > InList)
Definition PagedArray.h:437
UE_FORCEINLINE_HINT SizeType Add(const ElementType &Element)
Definition PagedArray.h:497
void SetNum(SizeType NewNum, EAllowShrinking AllowShrinking=UE::Core::Private::AllowShrinkingByDefault< AllocatorType >())
Definition PagedArray.h:328
void Assign(const ElementType *InSource, SizeType InSize)
Definition PagedArray.h:431
static constexpr SizeType MaxPerPage()
Definition PagedArray.h:197
bool operator==(const TPagedArray &Right) const
Definition PagedArray.h:696
UE_FORCEINLINE_HINT ElementType & Add_GetRef(const ElementType &Element)
Definition PagedArray.h:507
void ToArray(TArray< ElementType, AnyAllocator > &OutDestination) const &
Definition PagedArray.h:644
void Empty(SizeType InCapacity)
Definition PagedArray.h:596
TPagedArray & operator=(const TPagedArray &Other)=default
UE_FORCEINLINE_HINT IteratorType begin()
Definition PagedArray.h:682
TPagedArray(const ElementType *InSource, SizeType InSize)
Definition PagedArray.h:216
void Append(const TPagedArray< ElementType, OtherPageSizeInBytes, OtherAllocator > &Other)
Definition PagedArray.h:416
UE_FORCEINLINE_HINT ConstIteratorType begin() const
Definition PagedArray.h:678
UE_FORCEINLINE_HINT void SetZero()
Definition PagedArray.h:382
TPagedArray(TPagedArray &&Other)
Definition PagedArray.h:204
void Empty()
Definition PagedArray.h:586
void Append(std::initializer_list< ElementType > InList)
Definition PagedArray.h:397
TPagedArray & operator=(std::initializer_list< ElementType > InList)
Definition PagedArray.h:240
void Append(const ElementType *InSource, SizeType InSize)
Definition PagedArray.h:390
UE_FORCEINLINE_HINT void Push(ElementType &&Element)
Definition PagedArray.h:522
UE_FORCEINLINE_HINT SizeType Num() const
Definition PagedArray.h:290
const ElementType & operator[](SizeType Index) const
Definition PagedArray.h:246
UE_FORCEINLINE_HINT IteratorType end()
Definition PagedArray.h:690
TPagedArray & operator=(TPagedArray &&Other)
Definition PagedArray.h:227
void SetMem(uint8 ByteValue)
Definition PagedArray.h:367
void CountBytes(FArchive &Ar) const
Definition PagedArray.h:280
UE::Core::PagedArray::Private::TIterator< ElementType, PageType, PageTraits > IteratorType
Definition PagedArray.h:195
TPagedArray(std::initializer_list< ElementType > InList)
Definition PagedArray.h:211
UE_FORCEINLINE_HINT void Append(ContainerType &&Container)
Definition PagedArray.h:406
UE_FORCEINLINE_HINT SizeType Add(ElementType &&Element)
Definition PagedArray.h:502
void Reset()
Definition PagedArray.h:612
SizeType Emplace(ArgsType &&... Args)
Definition PagedArray.h:470
ElementType & Emplace_GetRef(ArgsType &&... Args)
Definition PagedArray.h:485
UE_FORCEINLINE_HINT bool IsValidIndex(SizeType Index) const
Definition PagedArray.h:300
void Assign(const TPagedArray< ElementType, OtherPageSizeInBytes, OtherAllocator > &Other)
Definition PagedArray.h:459
UE_FORCEINLINE_HINT bool operator!=(const TPagedArray &Right) const
Definition PagedArray.h:713
const ElementType & Last() const
Definition PagedArray.h:310
InAllocatorType AllocatorType
Definition PagedArray.h:168
SIZE_T GetAllocatedSize() const
Definition PagedArray.h:264
Definition PagedArray.h:44
TIteratorBase(InPageType *Data, SizeType Offset)
Definition PagedArray.h:57
UE_FORCEINLINE_HINT ElementType & Dereference() const
Definition PagedArray.h:62
InElementType ElementType
Definition PagedArray.h:46
typename PageType::SizeType SizeType
Definition PagedArray.h:49
void Increment()
Definition PagedArray.h:67
InPageTraits PageTraits
Definition PagedArray.h:48
InPageType PageType
Definition PagedArray.h:47
UE_FORCEINLINE_HINT bool Equals(const TIteratorBase &Other) const
Definition PagedArray.h:76
CORE_API FArchive & GetUnderlyingArchive() const
Definition StructuredArchiveSlots.cpp:7
@ Count
Definition AudioMixerDevice.h:90
Definition PagedArray.h:23
void SerializeStructured(FStructuredArchive::FSlot Slot, TPagedArray< ElementType, PageSizeInBytes, AllocatorType > &InOutPagedArray)
Definition PagedArray.h:122
FArchive & Serialize(FArchive &Ar, TPagedArray< ElementType, PageSizeInBytes, AllocatorType > &InOutPagedArray)
Definition PagedArray.h:92
FValue Div(const FValue &Lhs, const FValue &Rhs)
Definition ShaderValue.cpp:1519
U16 Index
Definition radfft.cpp:71
Definition IsContiguousContainer.h:16
Definition PagedArray.h:30
InElementType ElementType
Definition PagedArray.h:33
static constexpr int32 Size
Definition PagedArray.h:35
static constexpr int32 Capacity
Definition PagedArray.h:36