Gaia-ECS v0.9.3
A simple and powerful entity component system
Loading...
Searching...
No Matches
gaia::ecs::QueryAccessSet Struct Reference

Explicit component/entity access declarations used for scheduling decisions. More...

#include <query_common.h>

Public Member Functions

GAIA_NODISCARD std::span< const Entityreads_view () const
 Returns the explicitly declared read ids.
 
GAIA_NODISCARD std::span< const Entitywrites_view () const
 Returns the explicitly declared write ids.
 
void add_read (Entity entity)
 Declares that an id is read.
 
void add_write (Entity entity)
 Declares that an id is written.
 
GAIA_NODISCARD QueryAccess access (Entity entity) const
 Returns explicitly declared access for an id.
 

Public Attributes

cnt::sarray< Entity, MAX_ITEMS_IN_QUERY > reads
 Component/entity ids read by the callback outside the query terms.
 
cnt::sarray< Entity, MAX_ITEMS_IN_QUERY > writes
 Component/entity ids written by the callback outside the query terms.
 
uint8_t readCnt = 0
 Number of valid entries in reads.
 
uint8_t writeCnt = 0
 Number of valid entries in writes.
 

Detailed Description

Explicit component/entity access declarations used for scheduling decisions.

Queries derive read/write access from their positive query terms. This small side-band set stores accesses that are not part of the query shape, for example a component fetched manually inside the query callback.

Note
This metadata is intentionally not part of query identity. It does not affect query hashing, matching, cache sharing, or cache invalidation.

Member Function Documentation

◆ access()

GAIA_NODISCARD QueryAccess gaia::ecs::QueryAccessSet::access ( Entity  entity) const
inline

Returns explicitly declared access for an id.

Parameters
entityComponent/entity id to look up.
Returns
Write if explicitly written, Read if explicitly read, None otherwise.

◆ add_read()

void gaia::ecs::QueryAccessSet::add_read ( Entity  entity)
inline

Declares that an id is read.

Parameters
entityComponent/entity id read by user code.

◆ add_write()

void gaia::ecs::QueryAccessSet::add_write ( Entity  entity)
inline

Declares that an id is written.

Parameters
entityComponent/entity id written by user code.

◆ reads_view()

GAIA_NODISCARD std::span< const Entity > gaia::ecs::QueryAccessSet::reads_view ( ) const
inline

Returns the explicitly declared read ids.

Returns
Read-only span over explicit read ids.

◆ writes_view()

GAIA_NODISCARD std::span< const Entity > gaia::ecs::QueryAccessSet::writes_view ( ) const
inline

Returns the explicitly declared write ids.

Returns
Read-only span over explicit write ids.

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