FECS
|
SparseSet stores components in a densely packed array while allowing fast indexed lookup via sparse indirection. More...
#include <sparse_set.h>
Public Member Functions | |
void | Insert (Entity e, const T &component) |
Inserts or overrides a component for an entity,. | |
virtual void | Remove (Entity e) override |
Removes the component associated with an entity. | |
bool | Has (Entity e) const |
Checks if the entity has a component. | |
T & | Get (Entity e) |
Returns a mutable reference to the entity's components. | |
const T & | Get (Entity e) const |
Returns a const reference to the entity's components. | |
std::size_t | Size () const |
Returns the number of components currently stored. | |
Entity | EntityAt (std::uint32_t i) const |
Returns the entity as a specific index in the dense array. | |
void | Reserve (std::size_t amount) |
Pre-allocates memory for the given number of components. | |
virtual void | SetEntityManager (Manager::EntityManager *m) override |
Assigns the EntityManager used for liveness checks. | |
virtual Manager::EntityManager * | GetEntityManager () override |
Returns the EntityManager associated with this pool. | |
virtual void | Clear () override |
Clears the sparse and dense storage completely. | |
SparseSet stores components in a densely packed array while allowing fast indexed lookup via sparse indirection.
Uses paged sparse arrays and dense vectors to provide fast O(1) insertion, removal, and access with minimal memory waste.
T | The component type stored in the set. |
|
inlineoverridevirtual |
Clears the sparse and dense storage completely.
Implements FECS::Container::ISparseSet.
|
inline |
Returns the entity as a specific index in the dense array.
i | The index |
|
inline |
Returns a mutable reference to the entity's components.
e | The entity. |
|
inline |
Returns a const reference to the entity's components.
e | The entity. |
|
inlineoverridevirtual |
Returns the EntityManager associated with this pool.
Implements FECS::Container::ISparseSet.
|
inline |
Checks if the entity has a component.
e | The entity. |
|
inline |
Inserts or overrides a component for an entity,.
e | The entity. |
component | The component data |
|
inlineoverridevirtual |
Removes the component associated with an entity.
e | The entity whose component to remove. |
Implements FECS::Container::ISparseSet.
|
inline |
Pre-allocates memory for the given number of components.
amount | Number of component entries to reserve. |
|
inlineoverridevirtual |
Assigns the EntityManager used for liveness checks.
m | Pointer to the EntityManager. |
Implements FECS::Container::ISparseSet.
|
inline |
Returns the number of components currently stored.