![]() |
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. | |
ecs_entity_t * | entities |
Entity identifiers. | |
void ** | ptrs |
Pointers to components. | |
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) | |
int32_t * | columns |
Query term to table column mapping. | |
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. | |
int32_t | field_count |
Number of fields in iterator. | |
ecs_flags32_t | set_fields |
Fields that are set. | |
ecs_flags32_t | shared_fields |
Bitset with shared fields. | |
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. | |
const ecs_query_t * | query |
Query being evaluated. | |
int32_t | term_index |
Index of term that emitted an event. | |
int32_t | variable_count |
Number of variables for query. | |
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. | |
int32_t | instance_count |
Number of entities to iterate before next table. | |
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 |
int32_t* ecs_iter_t::columns |
ecs_flags64_t ecs_iter_t::constrained_vars |
float ecs_iter_t::delta_system_time |
float ecs_iter_t::delta_time |
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 |
int32_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 |
int32_t ecs_iter_t::instance_count |
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 |
void** ecs_iter_t::ptrs |
const ecs_query_t* ecs_iter_t::query |
ecs_world_t* ecs_iter_t::real_world |
ecs_flags32_t ecs_iter_t::shared_fields |
ecs_entity_t* ecs_iter_t::sources |
ecs_entity_t ecs_iter_t::system |
ecs_table_t* ecs_iter_t::table |
int32_t ecs_iter_t::term_index |
ecs_flags32_t ecs_iter_t::up_fields |
int32_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 |