Flecs: ecs_query_desc_t Struct Reference
Description: A fast entity component system (ECS) for C & C++

| Flecs v4.1 A fast entity component system (ECS) for C & C++

Loading...
Searching...
No Matches
ecs_query_desc_t Struct Reference
C API » Core » API types | C API » Core » Queries

Used with ecs_query_init(). More...

`#include <flecs.h>`

## Public Attributes
int32_t | _canary
| Used for validity testing.
ecs_term_t | terms [32]
| Query terms.
const char * | expr
| Query DSL expression (optional).
ecs_query_cache_kind_t | cache_kind
| Caching policy of the query.
ecs_flags32_t | flags
| Flags for enabling query features.
ecs_order_by_action_t | order_by_callback
| Callback used for ordering query results.
ecs_sort_table_action_t | order_by_table_callback
| Callback used for ordering query results.
ecs_entity_t | order_by
| Component to sort on, used together with order_by_callback or order_by_table_callback.
ecs_id_t | group_by
| Component ID to be used for grouping.
ecs_group_by_action_t | group_by_callback
| Callback used for grouping results.
ecs_group_create_action_t | on_group_create
| Callback that is invoked when a new group is created.
ecs_group_delete_action_t | on_group_delete
| Callback that is invoked when an existing group is deleted.
void * | group_by_ctx
| Context to pass to group_by.
ecs_ctx_free_t | group_by_ctx_free
| Function to free group_by_ctx.
void * | ctx
| User context to pass to callback.
void * | binding_ctx
| Context to be used for language bindings.
ecs_ctx_free_t | ctx_free
| Callback to free ctx.
ecs_ctx_free_t | binding_ctx_free
| Callback to free binding_ctx.
ecs_entity_t | entity
| Entity associated with query (optional).

## Detailed Description

Used with ecs_query_init().

Definition at line 1301 of file flecs.h.

## Member Data Documentation

## ◆ _canary

int32_t ecs_query_desc_t::_canary

Used for validity testing.

Must be 0.

Definition at line 1303 of file flecs.h.

## ◆ binding_ctx

void* ecs_query_desc_t::binding_ctx

Context to be used for language bindings.

Definition at line 1359 of file flecs.h.

## ◆ binding_ctx_free

ecs_ctx_free_t ecs_query_desc_t::binding_ctx_free

Callback to free binding_ctx.

Definition at line 1365 of file flecs.h.

## ◆ cache_kind

ecs_query_cache_kind_t ecs_query_desc_t::cache_kind

Caching policy of the query.

Definition at line 1312 of file flecs.h.

## ◆ ctx

void* ecs_query_desc_t::ctx

User context to pass to callback.

Definition at line 1356 of file flecs.h.

## ◆ ctx_free

ecs_ctx_free_t ecs_query_desc_t::ctx_free

Callback to free ctx.

Definition at line 1362 of file flecs.h.

## ◆ entity

ecs_entity_t ecs_query_desc_t::entity

Entity associated with query (optional).

Definition at line 1368 of file flecs.h.

## ◆ expr

const char* ecs_query_desc_t::expr

Query DSL expression (optional).

Definition at line 1309 of file flecs.h.

## ◆ flags

ecs_flags32_t ecs_query_desc_t::flags

Flags for enabling query features.

Definition at line 1315 of file flecs.h.

## ◆ group_by

ecs_id_t ecs_query_desc_t::group_by

Component ID to be used for grouping.

Used together with the group_by_callback.

Definition at line 1332 of file flecs.h.

## ◆ group_by_callback

ecs_group_by_action_t ecs_query_desc_t::group_by_callback

Callback used for grouping results.

If the callback is not set, results will not be grouped. When set, this callback will be used to calculate a "rank" for each entity (table) based on its components. This rank is then used to sort entities (tables), so that entities (tables) of the same rank are "grouped" together when iterated.

Definition at line 1339 of file flecs.h.

## ◆ group_by_ctx

void* ecs_query_desc_t::group_by_ctx

Context to pass to group_by.

Definition at line 1350 of file flecs.h.

## ◆ group_by_ctx_free

ecs_ctx_free_t ecs_query_desc_t::group_by_ctx_free

Function to free group_by_ctx.

Definition at line 1353 of file flecs.h.

## ◆ on_group_create

ecs_group_create_action_t ecs_query_desc_t::on_group_create

Callback that is invoked when a new group is created.

The return value of the callback is stored as context for a group.

Definition at line 1343 of file flecs.h.

## ◆ on_group_delete

ecs_group_delete_action_t ecs_query_desc_t::on_group_delete

Callback that is invoked when an existing group is deleted.

The return value of the on_group_create callback is passed as context parameter.

Definition at line 1347 of file flecs.h.

## ◆ order_by

ecs_entity_t ecs_query_desc_t::order_by

Component to sort on, used together with order_by_callback or order_by_table_callback.

Definition at line 1328 of file flecs.h.

## ◆ order_by_callback

ecs_order_by_action_t ecs_query_desc_t::order_by_callback

Callback used for ordering query results.

If order_by is 0, the pointer provided to the callback will be NULL. If the callback is not set, results will not be ordered.

Definition at line 1320 of file flecs.h.

## ◆ order_by_table_callback

ecs_sort_table_action_t ecs_query_desc_t::order_by_table_callback

Callback used for ordering query results.

Same as order_by_callback, but more efficient.

Definition at line 1324 of file flecs.h.

## ◆ terms

ecs_term_t ecs_query_desc_t::terms[32]

Query terms.

Definition at line 1306 of file flecs.h.

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

- include/flecs.h