EntropyEngine::Core::TypeSystem::TypedHandle
EntropyEngine::Core::TypeSystem::TypedHandle
Section titled “EntropyEngine::Core::TypeSystem::TypedHandle”Type-safe handle template that derives from GenericHandle. More…
#include <GenericHandle.h>
Inherits from EntropyEngine::Core::TypeSystem::GenericHandle< void >
Public Classes
Section titled “Public Classes”| Name | |
|---|---|
| struct | Hash Hash support for use in unordered containers. |
Public Types
Section titled “Public Types”| Name | |
|---|---|
| using T | Type |
Public Functions
Section titled “Public Functions”| Name | |
|---|---|
| TypedHandle | invalid() Creates an invalid handle of this type. |
| uint64_t | getDebugId() const Gets a debug identifier for this handle (for logging/debugging). |
| constexpr | TypedHandle() Default constructor creates an invalid handle. |
| constexpr | TypedHandle(OwnerType * owner, uint32_t index, uint32_t generation) Constructs a typed handle with the specified owner, index and generation. |
| constexpr | TypedHandle(OwnerType * owner, uint64_t id) Constructs a typed handle with the specified owner and raw ID. |
| constexpr | TypedHandle(const GenericHandle< OwnerType > & generic) Constructs from a generic handle (explicit to prevent accidental conversion). |
Additional inherited members
Section titled “Additional inherited members”Public Classes inherited from EntropyEngine::Core::TypeSystem::GenericHandle< void >
| Name | |
|---|---|
| struct | Hash Hash support for use in unordered containers. |
Public Functions inherited from EntropyEngine::Core::TypeSystem::GenericHandle< void >
| Name | |
|---|---|
| bool | operator==(const GenericHandle & other) const Equality comparison. |
| bool | operator<(const GenericHandle & other) const Less-than comparison for use in sorted containers. |
| bool | operator!=(const GenericHandle & other) const Inequality comparison. |
| bool | isValid() const Checks if this handle is potentially valid. |
| void | invalidate() Invalidates this handle. |
| uint64_t | getRawData() const Gets the raw packed data. |
| OwnerType * | getOwner() const Gets the owner of this handle. |
| uint32_t | getIndex() const Gets the index component of this handle. |
| uint64_t | getId() const Gets the raw data as a 64-bit ID (for non-generation use cases). |
| uint32_t | getGeneration() const Gets the generation component of this handle. |
| constexpr | GenericHandle() Default constructor creates an invalid handle. |
| constexpr | GenericHandle(OwnerType * owner, uint32_t index, uint32_t generation) Constructs a handle with the specified owner, index and generation. |
| constexpr | GenericHandle(OwnerType * owner, uint64_t id) Constructs a handle with the specified owner and raw ID (for non-generation use). |
Protected Functions inherited from EntropyEngine::Core::TypeSystem::GenericHandle< void >
| Name | |
|---|---|
| uint64_t | pack(uint32_t index, uint32_t generation) Packs index and generation into a single 64-bit value. |
Protected Attributes inherited from EntropyEngine::Core::TypeSystem::GenericHandle< void >
| Name | |
|---|---|
| OwnerType * | _owner |
| uint64_t | _data |
| uint64_t | INVALID_HANDLE |
| uint64_t | INDEX_MASK |
| uint32_t | GENERATION_SHIFT |
| uint64_t | GENERATION_MASK |
Detailed Description
Section titled “Detailed Description”template <typename T ,typename OwnerType =void>class EntropyEngine::Core::TypeSystem::TypedHandle;Type-safe handle template that derives from GenericHandle.
Template Parameters:
- T The tag type this handle represents (usually an empty struct)
- OwnerType The type of the owning container (optional)
This template provides type safety on top of GenericHandle, preventing accidental mixing of handles to different types of objects. The template parameter T is typically a tag struct that exists solely for type safety.
The handle is storage-agnostic - it only provides the index/generation validation mechanism. Storage classes implement their own validation logic using the handle’s getIndex() and getGeneration() methods.
Example usage:
struct EntityTag {};struct ComponentTag {};
using EntityHandle = TypedHandle<EntityTag, EntityManager>;using ComponentHandle = TypedHandle<ComponentTag, ComponentManager>;
EntityManager entityMgr;EntityHandle entity(&entityMgr, 5, 1);ComponentHandle component(&componentMgr, 5, 1);// entity == component would be a compile error (different types)
// Usage with custom storage:class EntityManager { bool isHandleValid(const EntityHandle& handle) const { return validateWithGeneration(handle.getIndex(), handle.getGeneration()); }};Public Types Documentation
Section titled “Public Types Documentation”using Type
Section titled “using Type”using EntropyEngine::Core::TypeSystem::TypedHandle< T, OwnerType >::Type = T;Public Functions Documentation
Section titled “Public Functions Documentation”function invalid
Section titled “function invalid”static inline TypedHandle invalid()Creates an invalid handle of this type.
function getDebugId
Section titled “function getDebugId”inline uint64_t getDebugId() constGets a debug identifier for this handle (for logging/debugging).
Return: Unique identifier combining index and generation
function TypedHandle
Section titled “function TypedHandle”inline constexpr TypedHandle()Default constructor creates an invalid handle.
function TypedHandle
Section titled “function TypedHandle”inline constexpr TypedHandle( OwnerType * owner, uint32_t index, uint32_t generation)Constructs a typed handle with the specified owner, index and generation.
function TypedHandle
Section titled “function TypedHandle”inline constexpr TypedHandle( OwnerType * owner, uint64_t id)Constructs a typed handle with the specified owner and raw ID.
function TypedHandle
Section titled “function TypedHandle”inline explicit constexpr TypedHandle( const GenericHandle< OwnerType > & generic)Constructs from a generic handle (explicit to prevent accidental conversion).
Updated on 2026-01-26 at 16:50:32 -0500