37 return value_ != other.value_;
40 T
const& operator*()
const
113 "operation invalid before calling next()");
114 return static_cast<size_t>(iter_->
count);
160 template <
typename T>
162 return static_cast<T*
>(iter_->
ctx);
175 template <
typename T>
178 return static_cast<T*
>(iter_->
param);
228 size_t size(int8_t index)
const {
292 template <
typename T,
typename A = actual_type_t<T>, if_t<is_const_v<T>> = 0>
307 template <
typename T,
typename A = actual_type_t<T>, if_not_t<is_const_v<T>> = 0>
323 "cannot .field from .each, use .field_at(%d, row) instead", index);
324 return get_unchecked_field(index);
336 return get_unchecked_field_at(index, row)[0];
338 return get_unchecked_field(index)[row];
350 template <
typename T,
typename A = actual_type_t<T>, if_t< is_const_v<T> > = 0>
351 const A&
field_at(int8_t index,
size_t row)
const {
353 return get_field_at<A>(index, row)[0];
355 return get_field<A>(index)[row];
367 template <
typename T,
typename A = actual_type_t<T>, if_not_t< is_const_v<T> > = 0>
372 return get_field_at<A>(index, row)[0];
374 return get_field<A>(index)[row];
440 if (iter_->
flags & EcsIterIsValid && iter_->
table) {
443 bool result = iter_->
next(iter_);
444 iter_->
flags |= EcsIterIsValid;
445 if (result && iter_->
table) {
464 template <
typename Func>
465 void targets(int8_t index,
const Func& func);
477 if (iter_->
flags & EcsIterIsValid && iter_->
table) {
485 template <
typename T,
typename A = actual_type_t<T>>
515 template <
typename T,
typename A = actual_type_t<T>>
521 term_id == _::type<T>::id(iter_->
world),
#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_COLUMN_TYPE_MISMATCH
Column type mismatch error code.
#define ECS_INVALID_PARAMETER
Invalid parameter error code.
#define ecs_check(condition, error_code,...)
Check.
ecs_id_t ecs_entity_t
An entity identifier.
ecs_entity_t ecs_field_src(const ecs_iter_t *it, int8_t index)
Return the field source.
bool ecs_iter_changed(ecs_iter_t *it)
Return whether the current iterator result has changed.
bool ecs_field_is_readonly(const ecs_iter_t *it, int8_t index)
Test whether the field is read-only.
void ecs_iter_fini(ecs_iter_t *it)
Clean up iterator resources.
char * ecs_iter_str(const ecs_iter_t *it)
Convert an iterator to a string.
void * ecs_field_at_w_size(const ecs_iter_t *it, size_t size, int8_t index, int32_t row)
Get data for a field at a specified row.
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.
bool ecs_field_is_self(const ecs_iter_t *it, int8_t index)
Test whether the field is matched on self.
int32_t ecs_field_column(const ecs_iter_t *it, int8_t index)
Return the index of a matched table column.
uint64_t ecs_iter_get_group(const ecs_iter_t *it)
Return the group ID for the currently iterated result.
void * ecs_field_w_size(const ecs_iter_t *it, size_t size, int8_t index)
Get data for a field.
size_t ecs_field_size(const ecs_iter_t *it, int8_t index)
Return the field type size.
#define ecs_ftime_t
Customizable precision for scalar time values.
void ecs_iter_skip(ecs_iter_t *it)
Skip a table while iterating.
void * param
Param passed to ecs_run().
ecs_flags32_t flags
Iterator flags.
void * ctx
System context.
ecs_table_t * table
Current table.
ecs_world_t * world
The world.
ecs_flags32_t row_fields
Fields that must be obtained with field_at.
float delta_system_time
Time elapsed since last system invocation.
int8_t term_index
Index of the term that emitted an event.
float delta_time
Time elapsed since last frame.
ecs_iter_action_t callback
Callback of system or observer.
int8_t field_count
Number of fields in the iterator.
int32_t count
Number of entities to iterate.
ecs_iter_next_action_t next
Function to progress iterator.
const ecs_entity_t * entities
Entity identifiers.
Iterate over an integer range (used to iterate over entity range).
Wrapper class around a field.
Class that wraps around a flecs::id_t.
Class for iterating over query results.
flecs::id id(int8_t index) const
Obtain the ID matched for the field.
size_t size(int8_t index) const
Size of the field data type.
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.
const A & field_at(int8_t index, size_t row) const
Get const reference to field at row.
flecs::table table() const
Get the table for the current iterator result.
bool is_self(int8_t index) const
Return whether the field is matched on self.
flecs::string str() const
Convert current iterator result to string.
flecs::type type() const
Get the type of the iterated table.
int32_t field_count() const
Number of fields in the iterator.
ecs_ftime_t delta_system_time() const
Get the time elapsed since the last system invocation.
int32_t column_index(int8_t index) const
Obtain the column index for the field.
void * param()
Access param.
row_iterator begin() const
Get an iterator to the beginning of the entity range.
row_iterator end() const
Get an iterator to the end of the entity range.
void * field_at(int8_t index, size_t row) const
Get pointer to field at row.
ecs_ftime_t delta_time() const
Get the time elapsed since the last frame.
bool is_readonly(int8_t index) const
Return whether the field is readonly.
flecs::table other_table() const
Get the other table for the current iterator result.
const flecs::iter_t * c_ptr() const
Get a pointer to the underlying C iterator object.
bool changed()
Check if the current table has changed since the last iteration.
int8_t term_index() const
Obtain the term that triggered an observer.
void fini()
Free iterator resources.
bool is_set(int8_t index) const
Return whether the field is set.
A & field_at(int8_t index, size_t row) const
Get mutable reference to field at row.
flecs::entity entity(size_t row) const
Obtain a mutable handle to the entity being iterated over.
void each()
Forward to each().
flecs::untyped_field field(int8_t index) const
Get unchecked access to field data.
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.
size_t count() const
Get the number of entities to iterate over.
flecs::field< const flecs::entity_t > entities() const
Get read-only access to entity IDs.
uint64_t group_id() const
Return the group ID for the current table (grouped queries only).
iter(ecs_iter_t *it)
Construct iterator from C iterator object.
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).
void skip()
Skip current table.
bool next()
Progress iterator.
flecs::world world() const
Get the world associated with the iterator.
flecs::entity system() const
Get the system entity associated with the iterator.
Unsafe wrapper class around a field.