Gaia-ECS v1.0.0
A simple and powerful entity component system
Loading...
Searching...
No Matches
gaia::ecs::detail::ComponentDesc< T > Struct Template Referencefinal

Compile-time adapter that converts typed component metadata into a plain ComponentDesc. More...

#include <component_desc.h>

Public Types

using CT = component_type_t< T >
 Reflected Gaia component type wrapper.
 
using U = typename component_type_t< T >::Type
 Stored C++ payload type.
 
using DescU = typename CT::TypeFull
 Fully-qualified component type used for stable symbol/hash generation.
 

Static Public Member Functions

static constexpr ComponentLookupHash hash_lookup ()
 Returns the stable lookup hash for the component type. The constexpr local forces compile-time evaluation. Unoptimized builds would otherwise re-hash the type name on every typed component lookup (has, get, set, views).
 
static constexpr auto name ()
 Returns the reflected component symbol name.
 
static constexpr uint32_t size ()
 Returns the payload size stored in chunks.
 
static constexpr uint32_t alig ()
 Returns the payload alignment required by the component storage policy. Table columns are aligned within the chunk data area, so their alignment can't exceed MemoryBlockAlignment. Sparse payloads live in heap containers, which only guarantee alignof(std::max_align_t).
 
static uint32_t soa (std::span< uint8_t, meta::StructToTupleMaxTypes > soaSizes)
 Populates SoA element sizes for SoA payloads.
 
static constexpr DataStorageType storage_type ()
 Returns the compile-time storage mode requested for the component payload. GAIA_STORAGE(DontFragment) maps to table storage for empty tags and sparse storage for AoS payloads.
 
static constexpr auto func_ctor ()
 Builds the optional constructor callback for typed AoS payloads.
 
static constexpr auto func_dtor ()
 Builds the optional destructor callback for typed AoS payloads.
 
static constexpr auto func_copy_ctor ()
 Builds the copy-constructor callback used when typed payload storage grows or migrates.
 
static constexpr auto func_move_ctor ()
 Builds the move-constructor callback used when typed payload storage grows or migrates.
 
static constexpr auto func_copy ()
 Builds the copy-assignment callback used for typed payload writes.
 
static constexpr auto func_move ()
 Builds the move-assignment callback used for typed payload writes.
 
static constexpr auto func_swap ()
 Builds the swap callback used by storage operations.
 
static constexpr auto func_cmp ()
 Builds the equality comparison callback for typed payload values.
 
static constexpr auto func_save ()
 Builds the serializer save callback for typed payload values.
 
static constexpr auto func_load ()
 Builds the serializer load callback for typed payload values.
 
static ecs::ComponentDesc make (util::str_view descName, std::span< uint8_t, meta::StructToTupleMaxTypes > soaSizes)
 Builds the plain descriptor used by component cache registration.
 

Detailed Description

template<typename T>
struct gaia::ecs::detail::ComponentDesc< T >

Compile-time adapter that converts typed component metadata into a plain ComponentDesc.

Template Parameters
TComponent type or component wrapper being registered.

Member Function Documentation

◆ alig()

template<typename T >
static constexpr uint32_t gaia::ecs::detail::ComponentDesc< T >::alig ( )
inlinestaticconstexpr

Returns the payload alignment required by the component storage policy. Table columns are aligned within the chunk data area, so their alignment can't exceed MemoryBlockAlignment. Sparse payloads live in heap containers, which only guarantee alignof(std::max_align_t).

Returns
Component payload alignment in bytes.

◆ func_cmp()

template<typename T >
static constexpr auto gaia::ecs::detail::ComponentDesc< T >::func_cmp ( )
inlinestaticconstexpr

Builds the equality comparison callback for typed payload values.

Returns
Equality callback using operator== when available, otherwise byte comparison.

◆ func_copy()

template<typename T >
static constexpr auto gaia::ecs::detail::ComponentDesc< T >::func_copy ( )
inlinestaticconstexpr

Builds the copy-assignment callback used for typed payload writes.

Returns
Copy-assignment callback for the component payload type.

◆ func_copy_ctor()

template<typename T >
static constexpr auto gaia::ecs::detail::ComponentDesc< T >::func_copy_ctor ( )
inlinestaticconstexpr

Builds the copy-constructor callback used when typed payload storage grows or migrates.

Returns
Copy-constructor callback for the component payload type.

◆ func_ctor()

template<typename T >
static constexpr auto gaia::ecs::detail::ComponentDesc< T >::func_ctor ( )
inlinestaticconstexpr

Builds the optional constructor callback for typed AoS payloads.

Returns
Constructor callback, or nullptr when construction is trivial or SoA-managed.

◆ func_dtor()

template<typename T >
static constexpr auto gaia::ecs::detail::ComponentDesc< T >::func_dtor ( )
inlinestaticconstexpr

Builds the optional destructor callback for typed AoS payloads.

Returns
Destructor callback, or nullptr when destruction is trivial or SoA-managed.

◆ func_load()

template<typename T >
static constexpr auto gaia::ecs::detail::ComponentDesc< T >::func_load ( )
inlinestaticconstexpr

Builds the serializer load callback for typed payload values.

Returns
Load callback for the component payload type.

◆ func_move()

template<typename T >
static constexpr auto gaia::ecs::detail::ComponentDesc< T >::func_move ( )
inlinestaticconstexpr

Builds the move-assignment callback used for typed payload writes.

Returns
Move-assignment callback for the component payload type.

◆ func_move_ctor()

template<typename T >
static constexpr auto gaia::ecs::detail::ComponentDesc< T >::func_move_ctor ( )
inlinestaticconstexpr

Builds the move-constructor callback used when typed payload storage grows or migrates.

Returns
Move-constructor callback for the component payload type.

◆ func_save()

template<typename T >
static constexpr auto gaia::ecs::detail::ComponentDesc< T >::func_save ( )
inlinestaticconstexpr

Builds the serializer save callback for typed payload values.

Returns
Save callback for the component payload type.

◆ func_swap()

template<typename T >
static constexpr auto gaia::ecs::detail::ComponentDesc< T >::func_swap ( )
inlinestaticconstexpr

Builds the swap callback used by storage operations.

Returns
Swap callback for the component payload type.

◆ hash_lookup()

template<typename T >
static constexpr ComponentLookupHash gaia::ecs::detail::ComponentDesc< T >::hash_lookup ( )
inlinestaticconstexpr

Returns the stable lookup hash for the component type. The constexpr local forces compile-time evaluation. Unoptimized builds would otherwise re-hash the type name on every typed component lookup (has, get, set, views).

Returns
Component lookup hash derived from reflected type metadata.

◆ make()

template<typename T >
static ecs::ComponentDesc gaia::ecs::detail::ComponentDesc< T >::make ( util::str_view  descName,
std::span< uint8_t, meta::StructToTupleMaxTypes >  soaSizes 
)
inlinestatic

Builds the plain descriptor used by component cache registration.

Parameters
descNameNormalized component symbol name.
soaSizesScratch/output storage for SoA element sizes. The returned descriptor keeps a non-owning pointer to this buffer and must be consumed before the buffer expires.
Returns
Component descriptor for the current component type.

◆ name()

template<typename T >
static constexpr auto gaia::ecs::detail::ComponentDesc< T >::name ( )
inlinestaticconstexpr

Returns the reflected component symbol name.

Returns
Reflected type name for descriptor registration.

◆ size()

template<typename T >
static constexpr uint32_t gaia::ecs::detail::ComponentDesc< T >::size ( )
inlinestaticconstexpr

Returns the payload size stored in chunks.

Returns
0 for empty marker components, otherwise sizeof(payload type).

◆ soa()

template<typename T >
static uint32_t gaia::ecs::detail::ComponentDesc< T >::soa ( std::span< uint8_t, meta::StructToTupleMaxTypes >  soaSizes)
inlinestatic

Populates SoA element sizes for SoA payloads.

Parameters
soaSizesScratch/output storage for per-element byte sizes.
Returns
Number of SoA elements, or 0 for AoS payloads.

◆ storage_type()

template<typename T >
static constexpr DataStorageType gaia::ecs::detail::ComponentDesc< T >::storage_type ( )
inlinestaticconstexpr

Returns the compile-time storage mode requested for the component payload. GAIA_STORAGE(DontFragment) maps to table storage for empty tags and sparse storage for AoS payloads.

Returns
Component storage mode.

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