54template<
typename EntryType,
typename KeyType,
typename ValueType>
59 : Malloc(
InMalloc), HashTable(nullptr)
81 check(HashTable.load(std::memory_order_relaxed) ==
nullptr);
85 Count = DEFAULT_INITIAL_SIZE;
87 Count = FPlatformMath::RoundUpToPowerOfTwo(
Count);
106 FHashHeader*
HashTableLocal = HashTable.load(std::memory_order_acquire);
178 if (!Entry.IsEmpty())
180 HashInsertInternal(
HashTableGrow, Entry.GetKey(), Entry.GetValue());
226 std::atomic<FHashHeader*> HashTable;
229 static constexpr int32 DEFAULT_INITIAL_SIZE = 1024;
#define check(expr)
Definition AssertionMacros.h:314
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
UE::FPlatformRecursiveMutex FCriticalSection
Definition CriticalSection.h:53
Definition MemoryBase.h:99
virtual void Free(void *Original)=0
virtual void * Malloc(SIZE_T Count, uint32 Alignment=DEFAULT_ALIGNMENT)=0
Definition ScopeLock.h:141
Definition GrowOnlyLockFreeHash.h:56
void Reserve(int32 Count)
Definition GrowOnlyLockFreeHash.h:78
TGrowOnlyLockFreeHash(FMalloc *InMalloc)
Definition GrowOnlyLockFreeHash.h:58
void Find(KeyType Key, ValueType *OutValue, bool *bIsAlreadyInTable=nullptr) const
Definition GrowOnlyLockFreeHash.h:104
void FindOrAdd(KeyType Key, ValueType Value, bool *bIsAlreadyInTable=nullptr)
Definition GrowOnlyLockFreeHash.h:198
~TGrowOnlyLockFreeHash()
Definition GrowOnlyLockFreeHash.h:62
void Emplace(KeyType Key, ValueType Value, bool *bIsAlreadyInTable=nullptr)
Definition GrowOnlyLockFreeHash.h:141