TypedHandleWorld Class Template
A multi-domain entity world that dispatches operations to the correct EntityManager based on the handle type. More...
Declaration
Public Member Typedefs Index
template <typename... TEntityManagers> | |
| using | EntityManager_types = std::tuple< TEntityManagers... > |
Public Member Functions Index
template <typename THandle> | |
| auto & | entityManager () |
|
Returns a reference to the EntityManager that owns handles of type THandle. More... | |
template <typename THandle> | |
| const auto & | entityManager () const |
|
Returns a const reference to the EntityManager that owns handles of type THandle. More... | |
template <typename THandle> | |
| auto | addEntity (typename THandle::StrongId_type strongId) |
|
Creates a new entity in the domain identified by THandle. More... | |
template <typename THandle> | |
| auto | addEntity () |
|
Creates a new entity with an auto-generated id. More... | |
template <typename THandle> | |
| bool | destroy (THandle handle) |
|
Destroys an entity identified by its handle. More... | |
template <typename THandle> | |
| auto | findEntity (THandle handle) |
|
Looks up an existing entity by its handle. More... | |
template <typename THandle> | |
| auto | cloneEntity (THandle source) noexcept |
|
Clones all components from a source entity into a new entity. More... | |
template <typename THandle, typename ... TComponents> | |
| auto | view () |
|
Creates a View for iterating entities with specific components. More... | |
Private Member Attributes Index
template <typename... TEntityManagers> | |
| EntityManager_types | entityManagers_ |
Description
A multi-domain entity world that dispatches operations to the correct EntityManager based on the handle type.
TypedHandleWorld holds a tuple of EntityManager instances, each responsible for a different entity domain (identified by its handle type). All public methods accept a handle-type template argument and resolve the matching manager at compile time via HandleToManager.
This enables a single world object to manage entities from multiple independent registries — for example game entities, UI entities, and audio entities — without runtime dispatch overhead.
Definition at line 121 of file TypedHandleWorld.ixx.
Public Member Typedefs
EntityManager_types
|
Definition at line 126 of file TypedHandleWorld.ixx.
Public Member Functions
addEntity()
| inline |
Creates a new entity in the domain identified by THandle.
Delegates to the matching EntityManager::create() and wraps the result in an Entity facade.
- Template Parameters
-
THandle The handle type identifying the target domain.
- Returns
An Entity wrapping the newly created handle.
Definition at line 171 of file TypedHandleWorld.ixx.
addEntity()
| inline |
Creates a new entity with an auto-generated id.
- Template Parameters
-
THandle The handle type identifying the target domain.
- Returns
An Entity wrapping the newly created handle.
Definition at line 187 of file TypedHandleWorld.ixx.
cloneEntity()
| inline noexcept |
Clones all components from a source entity into a new entity.
Creates a new entity in the same domain and copies every component attached to source into it via EntityManager::clone().
- Template Parameters
-
THandle The handle type identifying the target domain.
- Parameters
-
source The handle of the entity to clone.
- Returns
An Entity wrapping the newly created clone.
Definition at line 253 of file TypedHandleWorld.ixx.
destroy()
| inline |
Destroys an entity identified by its handle.
Delegates to the owning EntityManager::destroy(). The handle's version is incremented, making all existing copies stale.
- Template Parameters
-
THandle The handle type identifying the target domain.
- Parameters
-
handle The handle of the entity to destroy.
- Returns
True if the entity was valid and successfully destroyed.
Definition at line 208 of file TypedHandleWorld.ixx.
entityManager()
| inline |
Returns a reference to the EntityManager that owns handles of type THandle.
Uses HandleToManager to resolve the tuple index at compile time. A static_assert fires if no manager matches.
- Template Parameters
-
THandle The handle type identifying the target domain.
- Returns
Mutable reference to the matching EntityManager.
Definition at line 140 of file TypedHandleWorld.ixx.
entityManager()
| inline |
Returns a const reference to the EntityManager that owns handles of type THandle.
- Template Parameters
-
THandle The handle type identifying the target domain.
- Returns
Const reference to the matching EntityManager.
Definition at line 154 of file TypedHandleWorld.ixx.
findEntity()
| inline |
Looks up an existing entity by its handle.
Validates the handle via the owning EntityManager. If valid, returns an Entity facade; otherwise returns std::nullopt.
- Template Parameters
-
THandle The handle type (and thus the domain) to search.
- Parameters
-
handle The entity handle to resolve.
- Returns
std::optional<Entity> — engaged if the handle is valid.
Definition at line 227 of file TypedHandleWorld.ixx.
view()
| inline |
Creates a View for iterating entities with specific components.
The view operates on the EntityManager identified by THandle. The first component type in TComponents serves as the lead set for iteration.
- Template Parameters
-
THandle The handle type selecting the domain.
TComponents The component types to include in the view.
- Returns
A View over the matching EntityManager.
- See Also
Definition at line 278 of file TypedHandleWorld.ixx.
Private Member Attributes
entityManagers_
|
Definition at line 286 of file TypedHandleWorld.ixx.
The documentation for this class was generated from the following file:
Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.9.8.