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

Classes

struct  Dependencies
 
struct  LookupIdentity
 

Public Member Functions

GAIA_NODISCARD std::span< const Entityids_view () const
 
GAIA_NODISCARD std::span< const Entitychanged_view () const
 
GAIA_NODISCARD std::span< const uint8_t > changed_fields_view () const
 Returns query-term indices matching changed-filter components.
 
GAIA_NODISCARD std::span< const Entitygroup_deps_view () const
 
GAIA_NODISCARD std::span< const QueryTermlookup_terms_view () const
 Returns canonicalized lookup terms used by shared query deduplication.
 
GAIA_NODISCARD std::span< QueryTermlookup_terms_view_mut ()
 Returns mutable canonicalized lookup terms used by shared query deduplication.
 
GAIA_NODISCARD std::span< const Entitychanged_lookup_view () const
 Returns canonicalized changed-filter lookup ids used by shared query deduplication.
 
GAIA_NODISCARD std::span< Entitychanged_lookup_view_mut ()
 Returns mutable canonicalized changed-filter lookup ids used by shared query deduplication.
 
GAIA_NODISCARD std::span< const Entitygroup_deps_lookup_view () const
 Returns canonicalized group dependency lookup ids used by shared query deduplication.
 
GAIA_NODISCARD std::span< Entitygroup_deps_lookup_view_mut ()
 Returns mutable canonicalized group dependency lookup ids used by shared query deduplication.
 
void add_group_dep (Entity relation)
 Adds a declared grouping invalidation dependency.
 
void add_group_deps ()
 Adds all grouping invalidation relations to the dependency set.
 
GAIA_NODISCARD std::span< QueryTermterms_view_mut ()
 
GAIA_NODISCARD std::span< const QueryTermterms_view () const
 
GAIA_NODISCARD DynamicCacheKind calc_dynamic_cache_kind () const
 Returns the dynamic-cache dependency shape derived from cache policy and dependencies.
 
GAIA_NODISCARD bool uses_direct_src_version_tracking () const
 Returns whether reusable dynamic-cache checks use direct source entity archetype versions.
 
GAIA_NODISCARD bool uses_src_trav_snapshot () const
 Returns whether reusable dynamic-cache checks use a traversed source closure snapshot.
 
GAIA_NODISCARD bool calc_can_reuse_dynamic_cache () const
 Returns whether the current query shape can reuse dynamic-cache results.
 
void refresh_lookup_keys ()
 Refreshes canonical lookup arrays used by shared query deduplication.
 
GAIA_NODISCARD bool lookup_keys_equal (const Data &other) const
 Returns true when canonical lookup arrays match another query context payload.
 
GAIA_NODISCARD QueryLookupHash::Type hash_lookup_key_payload () const
 Returns the hash contribution from canonical lookup-key payload arrays.
 
GAIA_NODISCARD bool grouping_payload_equal (const Data &other) const
 Returns true when grouping identity payload matches another query context payload.
 
GAIA_NODISCARD bool sort_payload_equal (const Data &other) const
 Returns true when the sort identity payload matches another query context payload.
 
GAIA_NODISCARD bool has_sort_payload () const
 Returns true when sort identity payload is active.
 
GAIA_NODISCARD QueryLookupHash::Type hash_sort_payload () const
 Returns the hash contribution from sort identity payload.
 
GAIA_NODISCARD bool identity_payload_equal (const Data &other) const
 Returns true when the shared query identity payload matches another query context payload.
 
GAIA_NODISCARD QueryLookupHash::Type hash_grouping_payload () const
 Returns the hash contribution from grouping identity payload.
 
GAIA_NODISCARD QueryLookupHash::Type hash_identity_payload () const
 Returns the hash contribution from the full shared query identity payload.
 
GAIA_NODISCARD QueryLookupHash calc_lookup_hash () const
 Returns the finalized lookup hash for shared query identity.
 

Public Attributes

QueryEntityArray ids
 Array of queried ids.
 
cnt::sarray< QueryTerm, MAX_ITEMS_IN_QUERY > terms
 Array of terms.
 
QueryArchetypeCacheIndexMap lastMatchedArchetypeIdx_All
 Index of the last checked archetype in the component-to-archetype map.
 
QueryArchetypeCacheIndexMap lastMatchedArchetypeIdx_Or
 
QueryArchetypeCacheIndexMap lastMatchedArchetypeIdx_Not
 
uint8_t idsCnt = 0
 
uint8_t changedCnt = 0
 
QueryEntityArray changed
 Array of filtered components.
 
cnt::sarray< uint8_t, MAX_ITEMS_IN_QUERY > changedFields
 Query term index for each changed-filter component after query canonicalization.
 
QueryEntityArray groupDeps
 Explicit grouping invalidation dependencies for custom group_by callbacks.
 
Entity sortBy
 Entity to sort the archetypes by. EntityBad for no sorting.
 
TSortByFunc sortByFunc
 Function to use to perform sorting.
 
Entity groupBy
 Entity to group the archetypes by. EntityBad for no grouping.
 
TGroupByFunc groupByFunc
 Function to use to perform the grouping.
 
QueryMask queryMask
 Component mask used for faster matching of simple queries.
 
uint32_t as_mask_0
 Mask for items with Is relationship pair. If the id is a pair, the first part (id) is written here.
 
uint32_t as_mask_1
 Mask for items with Is relationship pair. If the id is a pair, the second part (gen) is written here.
 
uint8_t firstNot
 First NOT record in pairs/ids/ops.
 
uint8_t firstAny
 First ANY record in pairs/ids/ops.
 
uint8_t firstOr
 First OR record in pairs/ids/ops.
 
uint8_t groupDepCnt = 0
 Number of defined group dependencies.
 
uint16_t readWriteMask
 Read-write mask. Bit 0 stands for component 0 in component arrays. A set bit means write access is requested.
 
uint16_t flags
 Query flags.
 
uint16_t cacheSrcTrav = 0
 Maximum allowed size of an explicitly cached traversed-source lookup closure.
 
DirectTargetEvalKind directTargetEvalKind = DirectTargetEvalKind::Generic
 Specialized direct-target evaluation shape for single-term queries.
 
Entity directTargetEvalId = EntityBad
 Term id used by the specialized direct-target evaluation shape.
 
bool canDirectTargetEval = false
 True when the query can evaluate concrete target entities directly.
 
bool canDirectEntitySeedEvalShape = false
 True when the query shape is eligible for direct entity seed evaluation.
 
bool hasOnlyDirectOrTerms = false
 True when the query contains only direct OR/NOT terms and at least one OR term.
 
bool canReuseDynamicCache = false
 True when a dynamic cache can be reused by checking tracked runtime inputs.
 
Dependencies deps
 Explicit dependency metadata derived from query shape.
 
CachePolicy cachePolicy = CachePolicy::Lazy
 Cache maintenance policy derived from query shape.
 
CreateArchetypeMatchKind createArchetypeMatchKind = CreateArchetypeMatchKind::Vm
 Create-time archetype matcher derived from query shape.
 
DynamicCacheKind dynamicCacheKind = DynamicCacheKind::None
 Dynamic-cache dependency shape derived from compiled query metadata.
 
LookupIdentity lookupIdentity
 Cold canonical shared-query identity payload.
 

Member Function Documentation

◆ calc_can_reuse_dynamic_cache()

GAIA_NODISCARD bool gaia::ecs::QueryCtx::Data::calc_can_reuse_dynamic_cache ( ) const
inline

Returns whether the current query shape can reuse dynamic-cache results.

Returns
True when tracked runtime inputs are sufficient to validate the dynamic cache.

◆ calc_dynamic_cache_kind()

GAIA_NODISCARD DynamicCacheKind gaia::ecs::QueryCtx::Data::calc_dynamic_cache_kind ( ) const
inline

Returns the dynamic-cache dependency shape derived from cache policy and dependencies.

Returns
Dynamic-cache shape used by storage and invalidation planning.

◆ uses_direct_src_version_tracking()

GAIA_NODISCARD bool gaia::ecs::QueryCtx::Data::uses_direct_src_version_tracking ( ) const
inline

Returns whether reusable dynamic-cache checks use direct source entity archetype versions.

Returns
True when direct source entity archetype versions validate this dynamic cache.

◆ uses_src_trav_snapshot()

GAIA_NODISCARD bool gaia::ecs::QueryCtx::Data::uses_src_trav_snapshot ( ) const
inline

Returns whether reusable dynamic-cache checks use a traversed source closure snapshot.

Returns
True when a traversed-source snapshot validates this dynamic cache.

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