79template <
typename T,
typename A, if_t< is_const_v<T> >>
83 "cannot .field from .each, use .field_at<%s>(%d, row) instead",
84 _::type_name<T>(), index);
85 return get_field<A>(index);
89template <
typename T,
typename A, if_not_t< is_const_v<T> >>
93 "cannot .field from .each, use .field_at<%s>(%d, row) instead",
94 _::type_name<T>(), index);
97 return get_field<A>(index);
118template <
typename Func>
125 int32_t i = tr->index,
end = i + tr->count;
126 for (; i <
end; i ++) {
129 "field does not match a pair");
#define ecs_assert(condition, error_code,...)
Assert.
#define ECS_ACCESS_VIOLATION
Access violation error code.
#define ECS_INVALID_OPERATION
Invalid operation error code.
#define ECS_INVALID_PARAMETER
Invalid parameter error code.
#define ECS_COLUMN_INDEX_OUT_OF_RANGE
Column index out of range error code.
#define ecs_check(condition, error_code,...)
Check.
struct ecs_table_record_t ecs_table_record_t
Opaque type for table record.
uint64_t ecs_id_t
IDs are the things that can be added to an entity.
ecs_entity_t ecs_field_src(const ecs_iter_t *it, int8_t index)
Return the field source.
bool ecs_field_is_readonly(const ecs_iter_t *it, int8_t index)
Test whether the field is read-only.
ecs_id_t ecs_field_id(const ecs_iter_t *it, int8_t index)
Return the ID matched for a field.
bool ecs_field_is_set(const ecs_iter_t *it, int8_t index)
Test whether a field is set.
ecs_entity_t ecs_iter_get_var(ecs_iter_t *it, int32_t var_id)
Get the value of an iterator variable as an entity.
int32_t ecs_query_find_var(const ecs_query_t *query, const char *name)
Find a variable index.
const ecs_type_t * ecs_table_get_type(const ecs_table_t *table)
Get the type for a table.
ecs_world_t * real_world
Actual world.
ecs_entity_t event
The event (if applicable).
ecs_flags32_t flags
Iterator flags.
ecs_table_t * table
Current table.
int32_t offset
Offset relative to the current table.
ecs_id_t event_id
The (component) ID for the event.
ecs_world_t * world
The world.
const ecs_query_t * query
Query being evaluated.
ecs_entity_t system
The system (if applicable).
ecs_table_t * other_table
Previous or next table when adding or removing.
const ecs_table_record_t ** trs
Info on where to find the field in the table.
int32_t count
Number of entities to iterate.
const ecs_entity_t * entities
Entity identifiers.
Queries are lists of constraints (terms) that match entities.
A type is a list of (component) IDs.
ecs_id_t * array
Array with IDs.
Wrapper class around a field.
Class that wraps around a flecs::id_t.
flecs::id id(int8_t index) const
Obtain the ID matched for the field.
flecs::field< A > field(int8_t index) const
Get read-only access to field data.
flecs::entity event() const
Get the event entity associated with the iterator.
flecs::table table() const
Get the table for the current iterator result.
flecs::type type() const
Get the type of the iterated table.
int32_t field_count() const
Number of fields in the iterator.
row_iterator end() const
Get an iterator to the end of the entity range.
flecs::table other_table() const
Get the other table for the current iterator result.
flecs::entity entity(size_t row) const
Obtain a mutable handle to the entity being iterated over.
flecs::id pair(int8_t index) const
Obtain the pair ID matched for the field.
flecs::id event_id() const
Get the event ID associated with the iterator.
flecs::entity get_var(int var_id) const
Get value of variable by ID.
flecs::table_range range() const
Get the table range for the current iterator result.
void targets(int8_t index, const Func &func)
Iterate targets for pair field.
flecs::entity src(int8_t index) const
Obtain the field source (0 if This).
flecs::world world() const
Get the world associated with the iterator.
flecs::entity system() const
Get the system entity associated with the iterator.