Engine²
Open-source game engine written in C++.
Loading...
Searching...
No Matches
Engine::Id Struct Reference

A strongly-typed identifier wrapper based on entt::id_type. This structure provides a type-safe wrapper around EnTT's id_type, offering implicit conversion to the underlying type for seamless integration with EnTT components. It inherits from BasicId to provide null checking and other common ID operations. More...

#include <Id.hpp>

Inheritance diagram for Engine::Id:
Engine::BasicId< Id, entt::id_type > Engine::EntityId

Public Types

using ValueType = entt::id_type

Public Member Functions

constexpr Id (ValueType v=NullValue())
 Constructor for Id.
constexpr operator ValueType () const
 Implicit conversion operator to the underlying entt::id_type, allowing seamless use of Id instances where entt::id_type is expected.

Static Public Member Functions

static constexpr ValueType NullValue ()
 Get the null value for this ID type. This returns the null value defined by EnTT's id_type, which is typically.
static constexpr Id Null ()
 Get a null instance of Id, which has its value set to the null value defined by NullValue().

Additional Inherited Members

Public Attributes inherited from Engine::BasicId< Id, entt::id_type >
entt::id_type value
 The underlying value of the ID.

Detailed Description

A strongly-typed identifier wrapper based on entt::id_type. This structure provides a type-safe wrapper around EnTT's id_type, offering implicit conversion to the underlying type for seamless integration with EnTT components. It inherits from BasicId to provide null checking and other common ID operations.

Note
Supports implicit construction from entt::id_type values
Supports implicit conversion back to entt::id_type for compatibility
Size is guaranteed to match entt::id_type through static assertion

Member Typedef Documentation

◆ ValueType

using Engine::Id::ValueType = entt::id_type

Constructor & Destructor Documentation

◆ Id()

Engine::Id::Id ( ValueType v = NullValue())
inlineconstexpr

Constructor for Id.

Parameters
vThe value to initialize the ID with. Defaults to the null value defined by the NullValue() method.
Todo

Put the implementation in the cpp file if possible

rename v to something more descriptive, like idValue or rawValue

Member Function Documentation

◆ Null()

constexpr Id Engine::Id::Null ( )
inlinestaticconstexpr

Get a null instance of Id, which has its value set to the null value defined by NullValue().

Returns
A null instance of Id.
Todo
Put the implementation in the cpp file if possible

◆ NullValue()

constexpr ValueType Engine::Id::NullValue ( )
inlinestaticconstexpr

Get the null value for this ID type. This returns the null value defined by EnTT's id_type, which is typically.

Returns
The value representing a null/invalid ID for this type.
Todo
Put the implementation in the cpp file if possible

◆ operator ValueType()

Engine::Id::operator ValueType ( ) const
inlineconstexpr

Implicit conversion operator to the underlying entt::id_type, allowing seamless use of Id instances where entt::id_type is expected.


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