Gaia-ECS v1.0.0
A simple and powerful entity component system
Loading...
Searching...
No Matches
gaia::ecs::ComponentSetter Struct Reference

Entity-scoped mutable component accessor bound to a specific world, chunk and row. It is not a standalone chunk view and expects the referenced entity to remain valid. More...

#include <component_setter.h>

+ Inheritance diagram for gaia::ecs::ComponentSetter:

Public Member Functions

template<typename T >
decltype(auto) mut ()
 Returns a mutable reference to component without triggering hooks, observers or world-version updates. Call World::modify<T, true>(entity) if the write should emit OnSet.
 
template<typename T , typename U = typename actual_type_t<T>::Type>
ComponentSetterset (U &&value)
 Sets the value of the component.
 
template<typename T >
decltype(auto) mut (Entity type)
 Returns a mutable reference to component without triggering hooks, observers or world-version updates. Call World::modify<T, true>(entity, type) if the write should emit OnSet.
 
template<typename T >
ComponentSetterset (Entity type, T &&value)
 Sets the value of the component type and then emits the normal post-write set notifications.
 
template<typename T >
decltype(auto) smut ()
 Returns a mutable reference to component without triggering a world version update.
 
template<typename T , typename U = typename actual_type_t<T>::Type>
ComponentSettersset (U &&value)
 Sets the value of the component without triggering a world version update.
 
template<typename T >
decltype(auto) smut (Entity type)
 Returns a mutable reference to component without triggering a world version update.
 
template<typename T >
ComponentSettersset (Entity type, T &&value)
 Sets the value of the component without triggering a world version update.
 
GAIA_NODISCARD ComponentRawMutView mut_raw (Entity component)
 Returns a mutable raw byte view for a runtime component without finishing the write. Pair with modify_raw(component) when set hooks or OnSet observers should run.
 
GAIA_NODISCARD ComponentRawMutView mut_raw_field (Entity component, uint32_t fieldIdx)
 Returns one mutable SoA field value without finishing the component write. Pair with modify_raw(component) when set hooks or OnSet observers should run.
 
ComponentSetterset_raw (Entity component, const void *data, uint32_t size)
 Replaces a runtime component payload and emits normal post-write set notifications.
 
ComponentSettermodify_raw (Entity component)
 Marks a raw payload or SoA field returned by a mutable raw view as modified.
 
 ComponentGetter (const World &world, const Chunk *pChunk, Entity entity, uint16_t row)
 Creates a mutable accessor using the ComponentGetter constructor arguments.
 
- Public Member Functions inherited from gaia::ecs::ComponentGetter
 ComponentGetter (const World &world, const Chunk *pChunk, Entity entity, uint16_t row)
 Creates an accessor for one entity row.
 
template<typename T >
GAIA_NODISCARD decltype(auto) get () const
 Returns the value stored in the component T on entity.
 
template<typename T >
GAIA_NODISCARD decltype(auto) get (Entity type) const
 Returns the value stored in the component associated with type on entity.
 
GAIA_NODISCARD ComponentRawView get_raw (Entity component) const
 Returns a raw byte view for a runtime component on this entity.
 
GAIA_NODISCARD ComponentRawView get_raw_field (Entity component, uint32_t fieldIdx) const
 Returns one read-only SoA field value for a runtime component on this entity.
 

Additional Inherited Members

- Public Attributes inherited from gaia::ecs::ComponentGetter
const Worldm_pWorld
 World used to resolve inherited and sparse component data.
 
const Chunkm_pChunk
 Chunk containing the entity's table-backed data.
 
Entity m_entity
 Entity whose components are accessed.
 
uint16_t m_row
 Entity row within the chunk.
 

Detailed Description

Entity-scoped mutable component accessor bound to a specific world, chunk and row. It is not a standalone chunk view and expects the referenced entity to remain valid.

Member Function Documentation

◆ ComponentGetter()

gaia::ecs::ComponentGetter::ComponentGetter ( const World world,
const Chunk pChunk,
Entity  entity,
uint16_t  row 
)
inline

Creates a mutable accessor using the ComponentGetter constructor arguments.

Parameters
worldWorld that owns the entity.
pChunkChunk containing the entity row.
entityEntity being accessed.
rowEntity row within pChunk.

◆ modify_raw()

ComponentSetter & gaia::ecs::ComponentSetter::modify_raw ( Entity  component)
inline

Marks a raw payload or SoA field returned by a mutable raw view as modified.

Parameters
componentRuntime component entity.
Returns
ComponentSetter.

◆ mut() [1/2]

template<typename T >
decltype(auto) gaia::ecs::ComponentSetter::mut ( )
inline

Returns a mutable reference to component without triggering hooks, observers or world-version updates. Call World::modify<T, true>(entity) if the write should emit OnSet.

Template Parameters
TComponent or pair
Returns
Reference to data for AoS, or mutable accessor for SoA types

◆ mut() [2/2]

template<typename T >
decltype(auto) gaia::ecs::ComponentSetter::mut ( Entity  type)

Returns a mutable reference to component without triggering hooks, observers or world-version updates. Call World::modify<T, true>(entity, type) if the write should emit OnSet.

Template Parameters
TComponent or pair
Parameters
typeEntity associated with the component type.
Returns
Reference to data for AoS, or mutable accessor for SoA types

◆ mut_raw()

ComponentRawMutView gaia::ecs::ComponentSetter::mut_raw ( Entity  component)
inline

Returns a mutable raw byte view for a runtime component without finishing the write. Pair with modify_raw(component) when set hooks or OnSet observers should run.

Parameters
componentRuntime component entity.
Returns
Mutable raw payload view, or an invalid view when unavailable.

◆ mut_raw_field()

ComponentRawMutView gaia::ecs::ComponentSetter::mut_raw_field ( Entity  component,
uint32_t  fieldIdx 
)
inline

Returns one mutable SoA field value without finishing the component write. Pair with modify_raw(component) when set hooks or OnSet observers should run.

Parameters
componentRuntime component entity.
fieldIdxSoA field array index.
Returns
Mutable raw field value view, or an invalid view when unavailable.

◆ set() [1/2]

template<typename T >
ComponentSetter & gaia::ecs::ComponentSetter::set ( Entity  type,
T &&  value 
)

Sets the value of the component type and then emits the normal post-write set notifications.

Template Parameters
TComponent or pair
Parameters
typeEntity associated with the type
valueValue to set for the component
Returns
ComponentSetter

◆ set() [2/2]

template<typename T , typename U = typename actual_type_t<T>::Type>
ComponentSetter & gaia::ecs::ComponentSetter::set ( U &&  value)
inline

Sets the value of the component.

Template Parameters
Tand then emits the normal post-write set notifications.
TComponent or pair
Parameters
valueValue to set for the component
Returns
ComponentSetter

◆ set_raw()

ComponentSetter & gaia::ecs::ComponentSetter::set_raw ( Entity  component,
const void *  data,
uint32_t  size 
)
inline

Replaces a runtime component payload and emits normal post-write set notifications.

Parameters
componentRuntime component entity.
dataPayload bytes. Must be non-null when the component size is non-zero.
sizePayload byte count. Must match the registered component size.
Returns
ComponentSetter.

◆ smut() [1/2]

template<typename T >
decltype(auto) gaia::ecs::ComponentSetter::smut ( )
inline

Returns a mutable reference to component without triggering a world version update.

Template Parameters
TComponent or pair
Returns
Reference to data for AoS, or mutable accessor for SoA types

◆ smut() [2/2]

template<typename T >
decltype(auto) gaia::ecs::ComponentSetter::smut ( Entity  type)

Returns a mutable reference to component without triggering a world version update.

Template Parameters
TComponent or pair
Parameters
typeEntity associated with the type
Returns
Reference to data for AoS, or mutable accessor for SoA types

◆ sset() [1/2]

template<typename T >
ComponentSetter & gaia::ecs::ComponentSetter::sset ( Entity  type,
T &&  value 
)

Sets the value of the component without triggering a world version update.

Template Parameters
TComponent or pair
Parameters
typeEntity associated with the type
valueValue to set for the component
Returns
ComponentSetter

◆ sset() [2/2]

template<typename T , typename U = typename actual_type_t<T>::Type>
ComponentSetter & gaia::ecs::ComponentSetter::sset ( U &&  value)
inline

Sets the value of the component without triggering a world version update.

Template Parameters
TComponent or pair
Parameters
valueValue to set for the component
Returns
ComponentSetter

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