![]() |
Gaia-ECS v1.0.0
A simple and powerful entity component system
|
Stack-only cursor over raw component bytes and runtime field metadata. More...
#include <component_cursor.h>
Public Member Functions | |
| GAIA_NODISCARD bool | valid () const noexcept |
| GAIA_NODISCARD uint32_t | depth () const noexcept |
| GAIA_NODISCARD Entity | type () const noexcept |
| GAIA_NODISCARD RuntimeTypeKind | type_kind () const noexcept |
| Returns the runtime type kind at the current cursor scope. | |
| GAIA_NODISCARD Entity | opaque_as_type () const noexcept |
| Returns the semantic runtime type exposed by the current opaque scope, or EntityBad otherwise. | |
| GAIA_NODISCARD Entity | element_type () const noexcept |
| Returns the element type for the current sequence scope, or EntityBad otherwise. | |
| GAIA_NODISCARD uint32_t | size () const noexcept |
| Returns the current payload or field size in bytes. | |
| GAIA_NODISCARD const void * | ptr () const noexcept |
| GAIA_NODISCARD void * | mut_ptr () const noexcept |
| GAIA_NODISCARD uint32_t | field_count () const |
| GAIA_NODISCARD CursorResult< uint32_t > | count () const noexcept |
| Returns the element count for the current fixed or adapted sequence scope. | |
| bool | field (uint32_t index) |
| Descends into the reflected field at index. | |
| bool | field (util::str_view name) |
| Descends into the reflected field named name. | |
| bool | elem (uint32_t index) noexcept |
| Descends into element index of the current fixed inline or named array scope. | |
| CursorResult< void > | resize (uint32_t count) noexcept |
| Resizes the current adapted dynamic sequence scope. | |
| bool | parent () noexcept |
| Moves back to the parent cursor scope. | |
| GAIA_NODISCARD CursorResult< bool > | b () const noexcept |
| Reads the current cursor value as a bool. | |
| GAIA_NODISCARD CursorResult< void > | b (bool value) noexcept |
| Writes value to the current cursor value as a bool. | |
| GAIA_NODISCARD CursorResult< char > | c8 () const noexcept |
| Reads the current cursor value as a scalar c8. | |
| GAIA_NODISCARD CursorResult< void > | c8 (char value) noexcept |
| Writes value to the current cursor value as a scalar c8. | |
| GAIA_NODISCARD CursorResult< uint32_t > | c8 (char *dst, uint32_t cap) noexcept |
| Reads the current fixed c8 buffer. | |
| GAIA_NODISCARD CursorResult< uint32_t > | c8 (char *dst, uint32_t cap) const noexcept |
| Reads the current fixed c8 buffer. | |
| GAIA_NODISCARD CursorResult< void > | c8 (const char *src, uint32_t len) noexcept |
| Writes bytes to the current fixed c8 buffer. | |
| GAIA_NODISCARD CursorResult< char16_t > | c16 () const noexcept |
| Reads the current cursor value as a scalar c16. | |
| GAIA_NODISCARD CursorResult< void > | c16 (char16_t value) noexcept |
| Writes value to the current cursor value as a scalar c16. | |
| GAIA_NODISCARD CursorResult< char32_t > | c32 () const noexcept |
| Reads the current cursor value as a scalar c32. | |
| GAIA_NODISCARD CursorResult< void > | c32 (char32_t value) noexcept |
| Writes value to the current cursor value as a scalar c32. | |
| GAIA_NODISCARD CursorResult< int8_t > | s8 () const noexcept |
| Reads the current cursor value as an s8. | |
| GAIA_NODISCARD CursorResult< void > | s8 (int8_t value) noexcept |
| Writes value to the current cursor value as an s8. | |
| GAIA_NODISCARD CursorResult< uint8_t > | u8 () const noexcept |
| Reads the current cursor value as a u8. | |
| GAIA_NODISCARD CursorResult< void > | u8 (uint8_t value) noexcept |
| Writes value to the current cursor value as a u8. | |
| GAIA_NODISCARD CursorResult< int16_t > | s16 () const noexcept |
| Reads the current cursor value as an s16. | |
| GAIA_NODISCARD CursorResult< void > | s16 (int16_t value) noexcept |
| Writes value to the current cursor value as an s16. | |
| GAIA_NODISCARD CursorResult< uint16_t > | u16 () const noexcept |
| Reads the current cursor value as a u16. | |
| GAIA_NODISCARD CursorResult< void > | u16 (uint16_t value) noexcept |
| Writes value to the current cursor value as a u16. | |
| GAIA_NODISCARD CursorResult< int32_t > | s32 () const noexcept |
| Reads the current cursor value as an s32. | |
| GAIA_NODISCARD CursorResult< void > | s32 (int32_t value) noexcept |
| Writes value to the current cursor value as an s32. | |
| GAIA_NODISCARD CursorResult< uint32_t > | u32 () const noexcept |
| Reads the current cursor value as a u32. | |
| GAIA_NODISCARD CursorResult< void > | u32 (uint32_t value) noexcept |
| Writes value to the current cursor value as a u32. | |
| GAIA_NODISCARD CursorResult< int64_t > | s64 () const noexcept |
| Reads the current cursor value as an s64. | |
| GAIA_NODISCARD CursorResult< void > | s64 (int64_t value) noexcept |
| Writes value to the current cursor value as an s64. | |
| GAIA_NODISCARD CursorResult< uint64_t > | u64 () const noexcept |
| Reads the current cursor value as a u64. | |
| GAIA_NODISCARD CursorResult< void > | u64 (uint64_t value) noexcept |
| Writes value to the current cursor value as a u64. | |
| GAIA_NODISCARD CursorResult< float > | f32 () const noexcept |
| Reads the current cursor value as an f32. | |
| GAIA_NODISCARD CursorResult< void > | f32 (float value) noexcept |
| Writes value to the current cursor value as an f32. | |
| GAIA_NODISCARD CursorResult< double > | f64 () const noexcept |
| Reads the current cursor value as an f64. | |
| GAIA_NODISCARD CursorResult< void > | f64 (double value) noexcept |
| Writes value to the current cursor value as an f64. | |
| GAIA_NODISCARD CursorResult< uint32_t > | get_raw (void *data, uint32_t byteCount) const noexcept |
| Copies exact bytes from the current cursor position. | |
| CursorResult< void > | set_raw (const void *data, uint32_t byteCount) noexcept |
| Writes exact bytes to the current cursor position. | |
Static Public Member Functions | |
| static GAIA_NODISCARD ComponentCursor | from_raw (const ComponentCache &components, Entity component, ComponentRawView view) |
| Creates a read-only cursor from a raw component view. | |
| static GAIA_NODISCARD ComponentCursor | from_raw (World &world, const ComponentCache &components, Entity entity, Entity component, ComponentRawMutView view) |
| Creates a mutable cursor from a raw component view. | |
| static GAIA_NODISCARD ComponentCursor | from_soa (const World &world, const ComponentCache &components, Entity entity, Entity component, uint32_t size) |
| Creates a read-only cursor over a non-contiguous SoA component value. | |
| static GAIA_NODISCARD ComponentCursor | from_soa (World &world, const ComponentCache &components, Entity entity, Entity component, uint32_t size) |
| Creates a mutable cursor over a non-contiguous SoA component value. | |
Static Public Attributes | |
| static constexpr uint32_t | MaxDepth = 32 |
| Maximum nested field depth tracked by the cursor. | |
Friends | |
| class | World |
Stack-only cursor over raw component bytes and runtime field metadata.
The cursor is a short-lived non-owning view. It never owns component bytes or metadata and is invalidated by structural changes that can move component storage. Field navigation is strict: missing fields, unsupported type metadata, and out-of-bounds field ranges leave the cursor unchanged.
|
inlinenoexcept |
Reads the current cursor value as a bool.
|
inlinenoexcept |
Writes value to the current cursor value as a bool.
| value | Value to write. |
|
inlinenoexcept |
Reads the current cursor value as a scalar c16.
|
inlinenoexcept |
Writes value to the current cursor value as a scalar c16.
| value | Value to write. |
|
inlinenoexcept |
Reads the current cursor value as a scalar c32.
|
inlinenoexcept |
Writes value to the current cursor value as a scalar c32.
| value | Value to write. |
|
inlinenoexcept |
Reads the current cursor value as a scalar c8.
|
inlinenoexcept |
Reads the current fixed c8 buffer.
| dst | Destination buffer receiving bytes. |
| cap | Destination buffer size in bytes. Must be at least the reflected field count. |
|
inlinenoexcept |
Reads the current fixed c8 buffer.
| dst | Destination buffer receiving bytes. |
| cap | Destination buffer size in bytes. Must be at least the reflected field count. |
|
inlinenoexcept |
Writes value to the current cursor value as a scalar c8.
| value | Value to write. |
|
inlinenoexcept |
Writes bytes to the current fixed c8 buffer.
| src | Source bytes to copy. |
| len | Source byte count. Must fit in the reflected field count. |
|
inlinenoexcept |
Returns the element count for the current fixed or adapted sequence scope.
|
inlinenoexcept |
|
inlinenoexcept |
Descends into element index of the current fixed inline or named array scope.
| index | Element index inside the current field. |
|
inlinenoexcept |
Returns the element type for the current sequence scope, or EntityBad otherwise.
|
inlinenoexcept |
Reads the current cursor value as an f32.
|
inlinenoexcept |
Writes value to the current cursor value as an f32.
|
inlinenoexcept |
Reads the current cursor value as an f64.
|
inlinenoexcept |
Writes value to the current cursor value as an f64.
|
inline |
Descends into the reflected field at index.
| index | Reflected field index on the current type. |
|
inline |
Descends into the reflected field named name.
| name | Reflected field name on the current type. |
|
inline |
|
inlinestatic |
Creates a read-only cursor from a raw component view.
| components | Component metadata registry used for field/type lookup. |
| component | Component/type entity represented by view. |
| view | Raw component view returned by World::get_raw(). |
|
inlinestatic |
Creates a mutable cursor from a raw component view.
| world | World owning the mutated chunk storage. |
| components | Component metadata registry used for field/type lookup. |
| entity | Entity whose component payload is represented by view. |
| component | Component/type entity represented by view. |
| view | Raw component view returned by World::mut_raw(). |
|
inlinestatic |
Creates a read-only cursor over a non-contiguous SoA component value.
| world | World owning the SoA storage. |
| components | Component metadata registry used for field/type lookup. |
| entity | Entity owning the resolved component value. |
| component | Component/type entity represented by the cursor. |
| size | Logical AoS value size represented by the SoA fields. |
|
inlinestatic |
Creates a mutable cursor over a non-contiguous SoA component value.
| world | World owning the SoA storage. |
| components | Component metadata registry used for field/type lookup. |
| entity | Entity owning the component value. |
| component | Component/type entity represented by the cursor. |
| size | Logical AoS value size represented by the SoA fields. |
|
inlinenoexcept |
Copies exact bytes from the current cursor position.
This is the cursor read path for runtime component data. It performs no type conversion and copies the whole current cursor scope. Use field navigation to choose the address being read.
| data | Destination bytes. Must be non-null when the current scope size is non-zero. |
| byteCount | Destination capacity in bytes. Must be at least the current scope size. |
|
inlinenoexcept |
|
inlinenoexcept |
Returns the semantic runtime type exposed by the current opaque scope, or EntityBad otherwise.
|
inlinenoexcept |
Moves back to the parent cursor scope.
|
inlinenoexcept |
|
inlinenoexcept |
Resizes the current adapted dynamic sequence scope.
|
inlinenoexcept |
Reads the current cursor value as an s16.
|
inlinenoexcept |
Writes value to the current cursor value as an s16.
|
inlinenoexcept |
Reads the current cursor value as an s32.
|
inlinenoexcept |
Writes value to the current cursor value as an s32.
|
inlinenoexcept |
Reads the current cursor value as an s64.
|
inlinenoexcept |
Writes value to the current cursor value as an s64.
|
inlinenoexcept |
Reads the current cursor value as an s8.
|
inlinenoexcept |
Writes value to the current cursor value as an s8.
|
inlinenoexcept |
Writes exact bytes to the current cursor position.
This is the cursor write path for runtime component data. It performs no type conversion and requires byteCount to match the current cursor scope size. Use field navigation to choose the address being written. Successful writes finish the root component write, so normal chunk write tracking and OnSet observers run.
| data | Bytes to copy. Must be non-null when byteCount is non-zero. |
| byteCount | Number of bytes to copy. |
|
inlinenoexcept |
Returns the current payload or field size in bytes.
|
inlinenoexcept |
|
inlinenoexcept |
Returns the runtime type kind at the current cursor scope.
|
inlinenoexcept |
Reads the current cursor value as a u16.
|
inlinenoexcept |
Writes value to the current cursor value as a u16.
|
inlinenoexcept |
Reads the current cursor value as a u32.
|
inlinenoexcept |
Writes value to the current cursor value as a u32.
|
inlinenoexcept |
Reads the current cursor value as a u64.
|
inlinenoexcept |
Writes value to the current cursor value as a u64.
|
inlinenoexcept |
Reads the current cursor value as a u8.
|
inlinenoexcept |
Writes value to the current cursor value as a u8.
|
inlinenoexcept |