class
ecs::TSparseSet
template<SparseSetDeletePolicy DeletePolicy>Implements features of SparseSet that depend on a particular deletion policy.
Public
Constructors
TSparseSet<DeletePolicy>
TSparseSet<DeletePolicy>
Methods
~TSparseSet<DeletePolicy>
Clear
Removes everything from the set and clears the internal arrays.
ClearInvalid
Removes all invalid entities from the set.
Only relevant for sets using in-place deletion policy.
Swap
Swaps the location of the provided entities in the packed array, as well as the relevant payload (data associated with the entities), if any.
GetDeletePolicy
Returns the current delete policy.
GetFirstFreeElementPackedIndex
When using in-place deletion policy returns the packed index to the first invalid element.
When using swap-only deletion policy returns the number of valid entities in the set. Not relevant if using swap-and-erase deletion policy.
Protected
Methods
AddInternal
Adds a new entity to the set.
- entity
- Entity to add.
- forceAddAtEnd
- Only relevant when using in-place deletion policy. When true it will add an entity at the end of the packaged data array, rather than re-using the first available invalid entity entry.
Returns: Iterator to the added entity.
EraseInternal
Removed an entity from the sparse set.
Entity must be a part of the sparse set.
ClearInternal
Same as SparseSet::ClearInternal but also resets the free list head.
Private
Methods
MoveOrSwapPayload
Default implementation that doesn't do anything as there is no payload to move.
Fields
mFreeListHead
For in-place delete policy points to first free entry, or kMaximumEntryCount if no free entries.
For swap-only delete policy points to the first free entry, where all other elements are sequentially following the first free element. This value corresponds to valid entry count. For swap-and-erase delete policy this value is not used.