Helios Engine
A modular ECS based data-oriented C++23 game engine framework
Loading...
Searching...
No Matches
helios::utils::TypeIndex Class Reference

#include <type_info.hpp>

Public Member Functions

constexpr TypeIndex () noexcept=default
 Constructs empty TypeIndex.
constexpr TypeIndex (const TypeId &type_id) noexcept
 Constructs a TypeIndex from a TypeId.
constexpr TypeIndex (const TypeIndex &) noexcept=default
constexpr TypeIndex (TypeIndex &&) noexcept=default
constexpr ~TypeIndex () noexcept=default
constexpr TypeIndexoperator= (const TypeIndex &) noexcept=default
constexpr TypeIndexoperator= (TypeIndex &&) noexcept=default
constexpr bool Empty () const noexcept
 Checks if this TypeIndex is empty (i.e., has a hash value of 0).
constexpr size_t Hash () const noexcept
 Retrieves the hash value associated with this TypeIndex.
constexpr operator size_t () const noexcept
constexpr std::strong_ordering operator<=> (const TypeIndex &other) const noexcept=default
constexpr bool operator== (const TypeIndex &other) const noexcept=default

Static Public Member Functions

template<typename T>
static constexpr TypeIndex From () noexcept
 Constructs a TypeIndex from a type T.
template<typename T>
static constexpr TypeIndex From (const T &) noexcept
 Constructs a TypeIndex from an instance of type T.
static constexpr TypeIndex FromHash (size_t hash) noexcept
 Constructs a TypeIndex from a precomputed hash value.

Detailed Description

Definition at line 248 of file type_info.hpp.

Constructor & Destructor Documentation

◆ TypeIndex() [1/4]

helios::utils::TypeIndex::TypeIndex ( )
constexprdefaultnoexcept

Constructs empty TypeIndex.

◆ TypeIndex() [2/4]

helios::utils::TypeIndex::TypeIndex ( const TypeId & type_id)
explicitconstexprnoexcept

Constructs a TypeIndex from a TypeId.

Parameters
type_idThe TypeId to construct from

Definition at line 415 of file type_info.hpp.

◆ TypeIndex() [3/4]

helios::utils::TypeIndex::TypeIndex ( const TypeIndex & )
constexprdefaultnoexcept

◆ TypeIndex() [4/4]

helios::utils::TypeIndex::TypeIndex ( TypeIndex && )
constexprdefaultnoexcept

◆ ~TypeIndex()

helios::utils::TypeIndex::~TypeIndex ( )
constexprdefaultnoexcept

Member Function Documentation

◆ Empty()

bool helios::utils::TypeIndex::Empty ( ) const
inlinenodiscardconstexprnoexcept

Checks if this TypeIndex is empty (i.e., has a hash value of 0).

Returns
true if this TypeIndex is empty, false otherwise

Definition at line 300 of file type_info.hpp.

◆ From() [1/2]

template<typename T>
constexpr TypeIndex helios::utils::TypeIndex::From ( )
inlinestaticnodiscardconstexprnoexcept

Constructs a TypeIndex from a type T.

Template Parameters
TThe type to construct the TypeIndex for
Returns
TypeIndex representing the type T

Definition at line 268 of file type_info.hpp.

◆ From() [2/2]

template<typename T>
constexpr TypeIndex helios::utils::TypeIndex::From ( const T & )
inlinestaticnodiscardconstexprnoexcept

Constructs a TypeIndex from an instance of type T.

Template Parameters
TThe type of the instance
Parameters
instanceThe instance to construct the TypeIndex from (unused)
Returns
TypeIndex representing the type of the instance

Definition at line 279 of file type_info.hpp.

◆ FromHash()

constexpr TypeIndex helios::utils::TypeIndex::FromHash ( size_t hash)
inlinestaticnodiscardconstexprnoexcept

Constructs a TypeIndex from a precomputed hash value.

Parameters
hashType hash value
Returns
TypeIndex with the given hash

Definition at line 289 of file type_info.hpp.

◆ Hash()

size_t helios::utils::TypeIndex::Hash ( ) const
inlinenodiscardconstexprnoexcept

Retrieves the hash value associated with this TypeIndex.

Returns
Hash value or 0 if this TypeIndex is empty

Definition at line 306 of file type_info.hpp.

◆ operator size_t()

helios::utils::TypeIndex::operator size_t ( ) const
inlineexplicitconstexprnoexcept

Definition at line 308 of file type_info.hpp.

◆ operator<=>()

std::strong_ordering helios::utils::TypeIndex::operator<=> ( const TypeIndex & other) const
nodiscardconstexprdefaultnoexcept

◆ operator=() [1/2]

TypeIndex & helios::utils::TypeIndex::operator= ( const TypeIndex & )
constexprdefaultnoexcept

◆ operator=() [2/2]

TypeIndex & helios::utils::TypeIndex::operator= ( TypeIndex && )
constexprdefaultnoexcept

◆ operator==()

bool helios::utils::TypeIndex::operator== ( const TypeIndex & other) const
nodiscardconstexprdefaultnoexcept