21 inline void Init(
uint inObjectStoreSizeBytes);
41 uint8 * mObjectStore =
nullptr;
42 uint32 mObjectStoreSizeBytes = 0;
43 atomic<uint32> mWriteOffset { 0 };
70template <
class Key,
class Value>
102 const Key &
GetKey()
const {
return mKey; }
116 template <
class... Params>
131#ifdef JPH_ENABLE_ASSERTS
134 inline uint32 GetNumKeyValues()
const {
return mNumKeyValues; }
165 void TraceStats()
const;
171#ifdef JPH_ENABLE_ASSERTS
172 atomic<uint32> mNumKeyValues = 0;
175 atomic<uint32> * mBuckets =
nullptr;
std::uint8_t uint8
Definition: Core.h:453
std::uint64_t uint64
Definition: Core.h:456
unsigned int uint
Definition: Core.h:452
#define JPH_NAMESPACE_END
Definition: Core.h:378
std::uint32_t uint32
Definition: Core.h:455
#define JPH_NAMESPACE_BEGIN
Definition: Core.h:372
AllocateFunction Allocate
Definition: Memory.cpp:68
Definition: LockFreeHashMap.h:49
Allocator for a lock free hash map.
Definition: LockFreeHashMap.h:14
uint32 ToOffset(const T *inData) const
Convert a pointer to an offset.
Definition: LockFreeHashMap.inl:62
~LFHMAllocator()
Destructor.
Definition: LockFreeHashMap.inl:13
void Init(uint inObjectStoreSizeBytes)
Definition: LockFreeHashMap.inl:18
T * FromOffset(uint32 inOffset) const
Convert an offset to a pointer.
Definition: LockFreeHashMap.inl:70
void Clear()
Clear all allocations.
Definition: LockFreeHashMap.inl:26
A key / value pair that is inserted in the map.
Definition: LockFreeHashMap.h:100
const Key & GetKey() const
Definition: LockFreeHashMap.h:102
Value & GetValue()
Definition: LockFreeHashMap.h:103
const Value & GetValue() const
Definition: LockFreeHashMap.h:104
Definition: LockFreeHashMap.h:72
const KeyValue * FromHandle(uint32 inHandle) const
Convert uint32 handle back to key and value.
Definition: LockFreeHashMap.inl:238
Iterator begin()
Definition: LockFreeHashMap.inl:259
void GetAllKeyValues(Array< const KeyValue * > &outAll) const
Get all key/value pairs.
Definition: LockFreeHashMap.inl:244
void Init(uint32 inMaxBuckets)
Definition: LockFreeHashMap.inl:119
void SetNumBuckets(uint32 inNumBuckets)
Definition: LockFreeHashMap.inl:160
uint32 GetMaxBuckets() const
Get the maximum amount of buckets that this map supports.
Definition: LockFreeHashMap.h:92
LockFreeHashMap(LFHMAllocator &inAllocator)
Destructor.
Definition: LockFreeHashMap.h:77
KeyValue * Create(LFHMAllocatorContext &ioContext, const Key &inKey, uint64 inKeyHash, int inExtraBytes, Params &&... inConstructorParams)
Definition: LockFreeHashMap.inl:171
~LockFreeHashMap()
Definition: LockFreeHashMap.inl:133
uint32 GetNumBuckets() const
Get the current amount of buckets that the map is using.
Definition: LockFreeHashMap.h:89
const KeyValue * Find(const Key &inKey, uint64 inKeyHash) const
Find an element, returns null if not found.
Definition: LockFreeHashMap.inl:214
uint32 ToHandle(const KeyValue *inKeyValue) const
Get convert key value pair to uint32 handle.
Definition: LockFreeHashMap.inl:232
Iterator end()
Definition: LockFreeHashMap.inl:272
static const uint32 cInvalidHandle
Value of an invalid handle.
Definition: LockFreeHashMap.h:123
void Clear()
Definition: LockFreeHashMap.inl:139
Class that makes another class non-copyable. Usage: Inherit from NonCopyable.
Definition: NonCopyable.h:11
Non-const iterator.
Definition: LockFreeHashMap.h:142
bool operator==(const Iterator &inRHS) const
Comparison.
Definition: LockFreeHashMap.h:144
uint32 mOffset
Definition: LockFreeHashMap.h:155
Iterator & operator++()
Next item.
Definition: LockFreeHashMap.inl:286
uint32 mBucket
Definition: LockFreeHashMap.h:154
bool operator!=(const Iterator &inRHS) const
Definition: LockFreeHashMap.h:145
MapType * mMap
Definition: LockFreeHashMap.h:153
KeyValue & operator*()
Convert to key value pair.
Definition: LockFreeHashMap.inl:278