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

Public Member Functions

 QueryCache (QueryCache &&)=delete
 
 QueryCache (const QueryCache &)=delete
 
QueryCacheoperator= (QueryCache &&)=delete
 
QueryCacheoperator= (const QueryCache &)=delete
 
GAIA_NODISCARD bool valid (QueryHandle handle) const
 
void clear ()
 
QueryInfotry_get (QueryHandle handle)
 Returns a QueryInfo object associated with handle.
 
QueryInfoget (QueryHandle handle)
 Returns a QueryInfo object associated with handle.
 
QueryInfoadd (QueryCtx &&ctx, const EntityToArchetypeMap &entityToArchetypeMap, const ArchetypeDArray &allArchetypes)
 Registers the provided query lookup context ctx. If it already exists it is returned.
 
bool del (QueryHandle handle)
 Deletes an existing QueryInfo object given the provided query handle.
 
cnt::darray< QueryInfo >::iterator begin ()
 
cnt::darray< QueryInfo >::iterator end ()
 
void invalidate_queries_for_entity (EntityLookupKey entityKey)
 Invalidates all cached queries that work with the given entity This covers the following kinds of query terms: 1) X 2) (*, X) 3) (X, *)
 

Member Function Documentation

◆ add()

QueryInfo & gaia::ecs::QueryCache::add ( QueryCtx &&  ctx,
const EntityToArchetypeMap entityToArchetypeMap,
const ArchetypeDArray allArchetypes 
)
inline

Registers the provided query lookup context ctx. If it already exists it is returned.

Parameters
ctxQuery context
entityToArchetypeMapMap of all archetypes
allArchetypesArray of all archetypes
Returns
Reference to the newly created or an already existing QueryInfo object.

◆ del()

bool gaia::ecs::QueryCache::del ( QueryHandle  handle)
inline

Deletes an existing QueryInfo object given the provided query handle.

Parameters
handleQuery handle
Returns
True if handle was found. False otherwise.

◆ get()

QueryInfo & gaia::ecs::QueryCache::get ( QueryHandle  handle)
inline

Returns a QueryInfo object associated with handle.

Parameters
handleQuery handle
Returns
Query info

◆ invalidate_queries_for_entity()

void gaia::ecs::QueryCache::invalidate_queries_for_entity ( EntityLookupKey  entityKey)
inline

Invalidates all cached queries that work with the given entity This covers the following kinds of query terms: 1) X 2) (*, X) 3) (X, *)

Parameters
entityKeyEntity lookup key

◆ try_get()

QueryInfo * gaia::ecs::QueryCache::try_get ( QueryHandle  handle)
inline

Returns a QueryInfo object associated with handle.

Parameters
handleQuery handle
Returns
Query info

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