GREM 3.12.0
Game/Rendering Engine Modules for C++
Loading...
Searching...
No Matches
grem::execution::EntityID Class Reference

Handle to a specific entity in a registry. More...

#include <GREM/execution/EntityRegistry.hpp>

Public Types

using Identifier = uint64_t
 Underlying value type.
using Index = uint32_t
 Index type.
using Generation = uint16_t
 Generation counter type.
using Flags = uint16_t
 User-defined flags type.

Public Member Functions

GREM_ALWAYS_INLINE constexpr EntityID () noexcept=default
 Construct an invalid entity handle.
GREM_ALWAYS_INLINE constexpr EntityID (Index index, Generation generation, Flags flags)
 Construct an entity handle with a specific set of parameters.
GREM_ALWAYS_INLINE constexpr operator bool () const noexcept
 Check if this handle is potentially valid.
GREM_ALWAYS_INLINE constexpr Identifier getIdentifier () const noexcept
 Get a unique identifier for the underlying representation of the entity handle.
GREM_ALWAYS_INLINE constexpr Index getIndex () const noexcept
 Get the index of the entity's generation slot.
GREM_ALWAYS_INLINE constexpr Generation getGeneration () const noexcept
 Get the generation counter value of the entity.
GREM_ALWAYS_INLINE constexpr Flags getFlags () const noexcept
 Get the user-defined flags of the entity.
GREM_ALWAYS_INLINE constexpr bool operator== (const EntityID &other) const noexcept=default
 Compare this handle to another for equality.
GREM_ALWAYS_INLINE constexpr std::strong_ordering operator<=> (const EntityID &other) const noexcept=default
 Compare this handle to another.

Static Public Attributes

static constexpr Index INVALID_INDEX = Limits<Index>::MAX
 Reserved index value for an invalid entity handle.
static constexpr Index MAX_INDEX = Limits<Index>::MAX - 1
 Maximum valid index value.
static constexpr Generation MAX_GENERATION = Limits<Generation>::MAX
 Maximum valid generation counter value.
static constexpr Flags ALL_FLAGS = Limits<Flags>::MAX
 Maximum valid set of user-defined flags.

Detailed Description

Handle to a specific entity in a registry.

Member Typedef Documentation

◆ Identifier

Underlying value type.

◆ Index

Index type.

◆ Generation

Generation counter type.

◆ Flags

User-defined flags type.

Constructor & Destructor Documentation

◆ EntityID() [1/2]

GREM_ALWAYS_INLINE constexpr grem::execution::EntityID::EntityID ( )
constexprdefaultnoexcept

Construct an invalid entity handle.

◆ EntityID() [2/2]

GREM_ALWAYS_INLINE constexpr grem::execution::EntityID::EntityID ( Index index,
Generation generation,
Flags flags )
inlineconstexpr

Construct an entity handle with a specific set of parameters.

Parameters
indexindex of the entity's generation slot within the registry. Must be less than or equal to MAX_INDEX.
generationgeneration counter value of the entity. Must be less than or equal to MAX_GENERATION.
flagsuser-defined flags. Must be less than or equal to ALL_FLAGS.

Member Function Documentation

◆ operator bool()

GREM_ALWAYS_INLINE constexpr grem::execution::EntityID::operator bool ( ) const
inlineexplicitconstexprnoexcept

Check if this handle is potentially valid.

Returns
true if this handle is potentially valid, false if it is equal to a default-constructed invalid handle.

◆ getIdentifier()

GREM_ALWAYS_INLINE constexpr Identifier grem::execution::EntityID::getIdentifier ( ) const
inlinenodiscardconstexprnoexcept

Get a unique identifier for the underlying representation of the entity handle.

Returns
the underlying value of the handle.

◆ getIndex()

GREM_ALWAYS_INLINE constexpr Index grem::execution::EntityID::getIndex ( ) const
inlinenodiscardconstexprnoexcept

Get the index of the entity's generation slot.

Returns
the entity index.

◆ getGeneration()

GREM_ALWAYS_INLINE constexpr Generation grem::execution::EntityID::getGeneration ( ) const
inlinenodiscardconstexprnoexcept

Get the generation counter value of the entity.

Returns
the entity generation.

◆ getFlags()

GREM_ALWAYS_INLINE constexpr Flags grem::execution::EntityID::getFlags ( ) const
inlinenodiscardconstexprnoexcept

Get the user-defined flags of the entity.

Returns
the entity flags.

◆ operator==()

GREM_ALWAYS_INLINE constexpr bool grem::execution::EntityID::operator== ( const EntityID & other) const
nodiscardconstexprdefaultnoexcept

Compare this handle to another for equality.

Parameters
otherthe handle to compare this one to.
Returns
true if the handles are equal, false otherwise.

◆ operator<=>()

GREM_ALWAYS_INLINE constexpr std::strong_ordering grem::execution::EntityID::operator<=> ( const EntityID & other) const
nodiscardconstexprdefaultnoexcept

Compare this handle to another.

Parameters
otherthe handle to compare this one to.
Returns
a strong ordering between the two handles.

Member Data Documentation

◆ INVALID_INDEX

Index grem::execution::EntityID::INVALID_INDEX = Limits<Index>::MAX
staticconstexpr

Reserved index value for an invalid entity handle.

◆ MAX_INDEX

Index grem::execution::EntityID::MAX_INDEX = Limits<Index>::MAX - 1
staticconstexpr

Maximum valid index value.

◆ MAX_GENERATION

Generation grem::execution::EntityID::MAX_GENERATION = Limits<Generation>::MAX
staticconstexpr

Maximum valid generation counter value.

◆ ALL_FLAGS

Flags grem::execution::EntityID::ALL_FLAGS = Limits<Flags>::MAX
staticconstexpr

Maximum valid set of user-defined flags.


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