EntityPoolRegistry Class Template
Central registry for managing multiple named EntityPools. More...
Declaration
Public Constructors Index
template <typename THandle> | |
| EntityPoolRegistry ()=default | |
|
Default constructor. More... | |
Public Member Functions Index
template <typename THandle> | |
| auto | addPool (const helios::engine::runtime::pooling::types::EntityPoolId id, std::unique_ptr< EntityPool< THandle > > entityPool) noexcept -> EntityPool< THandle > * |
|
Adds a new pool to the registry. More... | |
template <typename THandle> | |
| auto | pools () -> std::unordered_map< helios::engine::runtime::pooling::types::EntityPoolId, std::unique_ptr< EntityPool< THandle > > > & |
|
Returns a reference to the internal pool map. More... | |
template <typename THandle> | |
| auto | pool (const helios::engine::runtime::pooling::types::EntityPoolId id) const -> EntityPool< THandle > * |
|
Retrieves a pool by its ID. More... | |
template <typename THandle> | |
| bool | has (const helios::engine::runtime::pooling::types::EntityPoolId id) const noexcept |
|
Checks if a pool with the given ID is registered. More... | |
Private Member Attributes Index
template <typename THandle> | |
| std::unordered_map< helios::engine::runtime::pooling::types::EntityPoolId, std::unique_ptr< EntityPool< THandle > > > | pools_ |
|
Maps pool IDs to their corresponding EntityPool instances. More... | |
Description
Central registry for managing multiple named EntityPools.
EntityPoolRegistry provides a single point of access to all object pools in the game. Each pool is identified by a strongly-typed EntityPoolId, enabling type-safe lookup without string comparisons.
The registry owns all pools exclusively via unique_ptr, ensuring proper cleanup when the registry is destroyed.
Example usage:
Definition at line 46 of file EntityPoolRegistry.ixx.
Public Constructors
EntityPoolRegistry()
| default |
Default constructor.
Definition at line 60 of file EntityPoolRegistry.ixx.
Public Member Functions
addPool()
| inline noexcept |
Adds a new pool to the registry.
If a pool with the given ID already exists, it will be replaced. Ownership of the pool is transferred to the registry.
- Parameters
-
id The unique identifier for this pool.
entityPool The pool to add (ownership is transferred).
- Returns
Raw pointer to the added pool for immediate use.
Definition at line 73 of file EntityPoolRegistry.ixx.
Reference helios::engine::runtime::pooling::registerComponents.
Referenced by helios::engine::runtime::pooling::EntityPoolManager< TEntity >::init.
has()
| inline noexcept |
Checks if a pool with the given ID is registered.
- Parameters
-
id The identifier of the pool to check.
- Returns
True if the pool exists, false otherwise.
Definition at line 119 of file EntityPoolRegistry.ixx.
Referenced by helios::engine::runtime::pooling::EntityPoolManager< TEntity >::pool.
pool()
| inline |
Retrieves a pool by its ID.
- Parameters
-
id The identifier of the pool to retrieve.
- Returns
Pointer to the pool, or nullptr if not found.
Definition at line 101 of file EntityPoolRegistry.ixx.
Reference helios::engine::runtime::pooling::registerComponents.
Referenced by helios::engine::runtime::pooling::EntityPoolManager< TEntity >::pool.
pools()
| inline |
Returns a reference to the internal pool map.
Provides direct access to all pools for iteration or bulk operations. The returned map should not be modified directly; use addPool() instead.
- Returns
Reference to the pool map.
Definition at line 89 of file EntityPoolRegistry.ixx.
Referenced by helios::engine::runtime::pooling::EntityPoolManager< TEntity >::reset.
Private Member Attributes
pools_
|
Maps pool IDs to their corresponding EntityPool instances.
Definition at line 53 of file EntityPoolRegistry.ixx.
The documentation for this class was generated from the following file:
Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.9.8.