Flecs v4.0
A fast entity component system (ECS) for C & C++
|
Iterator. More...
#include <flecs.h>
Public Attributes | |
ecs_world_t * | world |
The world. | |
ecs_world_t * | real_world |
Actual world. | |
const ecs_entity_t * | entities |
Entity identifiers. | |
const ecs_size_t * | sizes |
Component sizes. | |
ecs_table_t * | table |
Current table. | |
ecs_table_t * | other_table |
Prev or next table when adding/removing. | |
ecs_id_t * | ids |
(Component) ids | |
ecs_var_t * | variables |
Values of variables (if any) | |
const ecs_table_record_t ** | trs |
Info on where to find field in table. | |
ecs_entity_t * | sources |
Entity on which the id was matched (0 if same as entities) | |
ecs_flags64_t | constrained_vars |
Bitset that marks constrained variables. | |
uint64_t | group_id |
Group id for table, if group_by is used. | |
ecs_flags32_t | set_fields |
Fields that are set. | |
ecs_flags32_t | ref_fields |
Bitset with fields that aren't component arrays. | |
ecs_flags32_t | row_fields |
Fields that must be obtained with field_at. | |
ecs_flags32_t | up_fields |
Bitset with fields matched through up traversal. | |
ecs_entity_t | system |
The system (if applicable) | |
ecs_entity_t | event |
The event (if applicable) | |
ecs_id_t | event_id |
The (component) id for the event. | |
int32_t | event_cur |
Unique event id. | |
int8_t | field_count |
Number of fields in iterator. | |
int8_t | term_index |
Index of term that emitted an event. | |
int8_t | variable_count |
Number of variables for query. | |
const ecs_query_t * | query |
Query being evaluated. | |
char ** | variable_names |
Names of variables (if any) | |
void * | param |
Param passed to ecs_run. | |
void * | ctx |
System context. | |
void * | binding_ctx |
System binding context. | |
void * | callback_ctx |
Callback language binding context. | |
void * | run_ctx |
Run language binding context. | |
float | delta_time |
Time elapsed since last frame. | |
float | delta_system_time |
Time elapsed since last system invocation. | |
int32_t | frame_offset |
Offset relative to start of iteration. | |
int32_t | offset |
Offset relative to current table. | |
int32_t | count |
Number of entities to iterate. | |
ecs_flags32_t | flags |
Iterator flags. | |
ecs_entity_t | interrupted_by |
When set, system execution is interrupted. | |
ecs_iter_private_t | priv_ |
Private data. | |
ecs_iter_next_action_t | next |
Function to progress iterator. | |
ecs_iter_action_t | callback |
Callback of system or observer. | |
ecs_iter_fini_action_t | fini |
Function to cleanup iterator resources. | |
ecs_iter_t * | chain_it |
Optional, allows for creating iterator chains. | |
Iterator.
Used for iterating queries. The ecs_iter_t type contains all the information that is provided by a query, and contains all the state required for the iterator code.
Functions that create iterators accept as first argument the world, and as second argument the object they iterate. For example:
When this code is called from a system, it is important to use the world provided by its iterator object to ensure thread safety. For example:
An iterator contains resources that need to be released. By default this is handled by the last call to next() that returns false. When iteration is ended before iteration has completed, an application has to manually call ecs_iter_fini() to release the iterator resources:
ecs_iter_action_t ecs_iter_t::callback |
void* ecs_iter_t::callback_ctx |
ecs_iter_t* ecs_iter_t::chain_it |
ecs_flags64_t ecs_iter_t::constrained_vars |
float ecs_iter_t::delta_system_time |
float ecs_iter_t::delta_time |
const ecs_entity_t* ecs_iter_t::entities |
ecs_entity_t ecs_iter_t::event |
int32_t ecs_iter_t::event_cur |
ecs_id_t ecs_iter_t::event_id |
int8_t ecs_iter_t::field_count |
ecs_iter_fini_action_t ecs_iter_t::fini |
int32_t ecs_iter_t::frame_offset |
uint64_t ecs_iter_t::group_id |
ecs_entity_t ecs_iter_t::interrupted_by |
ecs_iter_next_action_t ecs_iter_t::next |
int32_t ecs_iter_t::offset |
ecs_table_t* ecs_iter_t::other_table |
const ecs_query_t* ecs_iter_t::query |
ecs_world_t* ecs_iter_t::real_world |
ecs_flags32_t ecs_iter_t::ref_fields |
ecs_flags32_t ecs_iter_t::row_fields |
ecs_entity_t* ecs_iter_t::sources |
ecs_entity_t ecs_iter_t::system |
ecs_table_t* ecs_iter_t::table |
int8_t ecs_iter_t::term_index |
const ecs_table_record_t** ecs_iter_t::trs |
ecs_flags32_t ecs_iter_t::up_fields |
int8_t ecs_iter_t::variable_count |
char** ecs_iter_t::variable_names |
ecs_var_t* ecs_iter_t::variables |
ecs_world_t* ecs_iter_t::world |