Class HashSetBase
Base class for unordered set of values (without duplicates with O(1) lookup access).
Inheritance
Inherited Members
Assembly: FlaxEngine.dll
File: Engine/Core/Collections/HashSetBase.h
Syntax
public class HashSetBase<AllocationType, BucketType>
Type Parameters
|
AllocationType
The type of memory allocator. |
|
BucketType
The type of bucket structure that stores element data and state. |
Constructors
~HashSetBase()
Declaration
protected ~HashSetBase()
HashSetBase()
Declaration
protected HashSetBase()
HashSetBase(AllocationTag tag)
Declaration
protected HashSetBase(AllocationTag tag)
Parameters
|
AllocationTag
tag
|
Fields
_allocation
Declaration
protected AllocationData _allocation
Field Value
|
AllocationData
|
_deletedCount
Declaration
protected int32 _deletedCount = 0
Field Value
|
int32
|
_elementsCount
Declaration
protected int32 _elementsCount = 0
Field Value
|
int32
|
_size
Declaration
protected int32 _size = 0
Field Value
|
int32
|
Methods
Capacity()
Gets the amount of the elements that can be contained by the collection.
Declaration
public int32 Capacity() const
Returns
|
int32
|
Clear()
Removes all elements from the collection.
Declaration
public void Clear()
Compact()
Declaration
protected void Compact()
Count()
Gets the amount of the elements in the collection.
Declaration
public int32 Count() const
Returns
|
int32
|
EnsureCapacity(int32 minCapacity, const bool preserveContents=true)
Ensures that collection has given capacity.
Declaration
public void EnsureCapacity(int32 minCapacity, const bool preserveContents=true)
Parameters
|
int32
minCapacity
The minimum required capacity. |
|
bool
preserveContents
True if preserve collection data when changing its size, otherwise collection after resize will be empty. |
FindPosition(const KeyComparableType& key, FindPositionResult& result)
Returns a pair of positions: 1st where the object is, 2nd where it would go if you wanted to insert it. 1st is -1 if object is not found; 2nd is -1 if it is. Because of deletions where-to-insert is not trivial: it's the first deleted bucket we see, as long as we don't find the item later.
Declaration
protected void FindPosition(const KeyComparableType& key, FindPositionResult& result) const
Parameters
|
KeyComparableType
key
The key to find |
|
FindPositionResult
result
A pair of values: where the object is and where it would go if you wanted to insert it |
Type Parameters
|
typename KeyComparableType
|
HasItems()
Returns true if collection has one or more elements.
Declaration
public bool HasItems() const
Returns
|
bool
|
IsEmpty()
Returns true if collection is empty.
Declaration
public bool IsEmpty() const
Returns
|
bool
|
MoveToEmpty(HashSetBase&& other)
OnAdd(const KeyComparableType& key, bool checkUnique=true, bool nullIfNonUnique=false)
Declaration
protected BucketType* OnAdd(const KeyComparableType& key, bool checkUnique=true, bool nullIfNonUnique=false)
Parameters
|
KeyComparableType
key
|
|
bool
checkUnique
|
|
bool
nullIfNonUnique
|
Returns
|
BucketType
|
Type Parameters
|
typename KeyComparableType
|
SetCapacity(int32 capacity, const bool preserveContents=true)
Changes the capacity of the collection.
Declaration
public void SetCapacity(int32 capacity, const bool preserveContents=true)
Parameters
|
int32
capacity
The new capacity. |
|
bool
preserveContents
True if preserve collection data when changing its size, otherwise collection after resize will be empty. |
Swap(HashSetBase& other)
Swaps the contents of collection with the other object without copy operation. Performs fast internal data exchange.
Declaration
public void Swap(HashSetBase& other)
Parameters
|
HashSetBase
other
The other collection. |