Skip to content

ludus::foundation::identity::Handle

Ludus Wiki · API overview · Browse API

Struct

Nonowning reference to one runtime incarnation in one owning registry.
Tag is a compile-time domain marker: handles of different tags are distinct types with no conversion, so an entity handle cannot be passed where a texture handle is expected. The owner field distinguishes two registries of the same domain at run time. Neither check replaces the other.
All-zero is the canonical null value. Owner zero or generation zero is never issued; slot zero is a valid first slot. Equality compares the complete value, including the owner. Neither equality nor IsNull() says anything about liveness: only the issuing registry can validate a handle. A handle does not own its object, pin its memory, or contain a pointer, UUID or manager lookup.
The value is trivially copyable, 16 bytes, and safe to copy across threads; the registry that resolves it defines its own synchronization. Do not persist it: owner tokens are process-scoped (see TryIssueLifetimeId()).
Template parameterDescription
Tag
Domain marker type; it is never instantiated.

Declared in modules/foundation/identity/include/ludus/foundation/identity/handle.hpp

#include <ludus/foundation/identity/handle.hpp>
template <typename Tag>
struct ludus::foundation::identity::Handle final

Fields

Owner

uint64 ludus::foundation::identity::Handle< Tag >::Owner = 0
Lifetime token of the issuing registry; zero only in the null handle.

Related types: uint64

Declared in modules/foundation/identity/include/ludus/foundation/identity/handle.hpp

Slot

uint32 ludus::foundation::identity::Handle< Tag >::Slot = 0
Registry slot index; zero is a valid slot.

Related types: uint32

Declared in modules/foundation/identity/include/ludus/foundation/identity/handle.hpp

Generation

uint32 ludus::foundation::identity::Handle< Tag >::Generation = 0
Incarnation of the slot; zero only in the null handle.

Related types: uint32

Declared in modules/foundation/identity/include/ludus/foundation/identity/handle.hpp

Methods

operator==

constexpr bool ludus::foundation::identity::Handle< Tag >::operator==(const Handle &) const noexcept=default
Compare all fields exactly. Equal handles name the same incarnation, not a live one.

Related types: Handle

Declared in modules/foundation/identity/include/ludus/foundation/identity/handle.hpp

IsNull

LUDUS_INLINE constexpr bool ludus::foundation::identity::Handle< Tag >::IsNull() const noexcept
Report whether this is the canonical all-zero null value. A nonnull handle may still be malformed, stale or owned by another registry.

Declared in modules/foundation/identity/include/ludus/foundation/identity/handle.hpp