FECS
Loading...
Searching...
No Matches
FECS::Manager::ComponentManager Class Reference

Provides static access to component pools and handles entity cleanup. More...

#include <component_manager.h>

Static Public Member Functions

template<typename T>
static Container::SparseSet< T > & GetPool (EntityManager *manager)
 Get the component pool for a specific component type.
 
template<typename T>
static std::uint32_t & GetVersion ()
 Returns a per-type version reference for tracking changes.
 
static void Reserve (std::size_t size)
 Reserves storage space for predicted number of component types.
 
static void DeleteEntity (Entity e)
 Removes an entity from all registered component pools.
 
static void ClearRegistry ()
 Clears all component pools and resets internal state.
 

Detailed Description

Provides static access to component pools and handles entity cleanup.

The ComponentManager is a singleton-like utility with static methods and per-type static storage (via Templates) to manage components, and versions efficiently.

Member Function Documentation

◆ ClearRegistry()

static void FECS::Manager::ComponentManager::ClearRegistry ( )
inlinestatic

Clears all component pools and resets internal state.

Typically used in testing or to reset the ECS state.

◆ DeleteEntity()

static void FECS::Manager::ComponentManager::DeleteEntity ( Entity e)
inlinestatic

Removes an entity from all registered component pools.

Used during entity destruction to clean up attached components.

Parameters
eThe entity to remove.

◆ GetPool()

template<typename T>
static Container::SparseSet< T > & FECS::Manager::ComponentManager::GetPool ( EntityManager * manager)
inlinestatic

Get the component pool for a specific component type.

If the pool doesnt exist yet, it's created and registered.

Template Parameters
TThe component type.
Parameters
managerPointer to the EntityManager | nullptr.
Returns
Reference to the SparseSet for type T.
Note
This is a raw method to get the entity manager, its already handled via the Registry.

◆ GetVersion()

template<typename T>
static std::uint32_t & FECS::Manager::ComponentManager::GetVersion ( )
inlinestatic

Returns a per-type version reference for tracking changes.

Used to invalidate views and other systems when component data changes.

Template Parameters
TThe component type.
Returns
Reference to a static version counter.

◆ Reserve()

static void FECS::Manager::ComponentManager::Reserve ( std::size_t size)
inlinestatic

Reserves storage space for predicted number of component types.

Parameters
sizeNumber of components to reserve for
Note
This is a raw method to reserve components, its already handled via the Registry.

The documentation for this class was generated from the following file: