37 return value_ != other.value_;
40 T
const& operator*()
const
80 row_iterator begin()
const {
81 return row_iterator(0);
84 row_iterator end()
const {
85 return row_iterator(
static_cast<size_t>(iter_->
count));
100 size_t count()
const {
102 "operation invalid before calling next()");
103 return static_cast<size_t>(iter_->
count);
134 template <
typename T>
136 return static_cast<T*
>(iter_->
ctx);
149 template <
typename T>
152 return static_cast<T*
>(iter_->
param);
195 size_t size(int8_t index)
const {
247 template <
typename T,
typename A = actual_type_t<T>,
248 typename std::enable_if<std::is_const<T>::value,
void>::type* =
nullptr>
259 template <
typename T,
typename A = actual_type_t<T>,
260 typename std::enable_if<
261 std::is_const<T>::value == false,
void>::type* =
nullptr>
272 "cannot .field from .each, use .field_at(%d, row) instead", index);
273 return get_unchecked_field(index);
279 return get_unchecked_field_at(index, row)[0];
281 return get_unchecked_field(index)[row];
286 template <
typename T,
typename A = actual_type_t<T>,
287 typename std::enable_if<std::is_const<T>::value,
void>::type* =
nullptr>
288 const A&
field_at(int8_t index,
size_t row)
const {
290 return get_field_at<A>(index, row)[0];
292 return get_field<A>(index)[row];
297 template <
typename T,
typename A = actual_type_t<T>,
298 typename std::enable_if<
299 std::is_const<T>::value == false,
void>::type* =
nullptr>
302 ECS_ACCESS_VIOLATION, NULL);
304 return get_field_at<A>(index, row)[0];
306 return get_field<A>(index)[row];
337 uint64_t group_id()
const {
358 if (iter_->
flags & EcsIterIsValid && iter_->
table) {
361 bool result = iter_->
next(iter_);
362 iter_->
flags |= EcsIterIsValid;
363 if (result && iter_->
table) {
387 if (iter_->
flags & EcsIterIsValid && iter_->
table) {
395 template <
typename T,
typename A = actual_type_t<T>>
402 ECS_COLUMN_TYPE_MISMATCH, NULL);
416 count =
static_cast<size_t>(iter_->
count);
425 template <
typename T,
typename A = actual_type_t<T>>
431 term_id == _::type<T>::id(iter_->
world),
432 ECS_COLUMN_TYPE_MISMATCH, NULL);
453 count =
static_cast<size_t>(iter_->
count);
#define ecs_assert(condition, error_code,...)
Assert.
#define ecs_check(condition, error_code,...)
Check.
ecs_id_t ecs_entity_t
An entity identifier.
bool ecs_iter_changed(ecs_iter_t *it)
Returns whether current iterator result has changed.
bool ecs_field_is_readonly(const ecs_iter_t *it, int8_t index)
Test whether the field is readonly.
void ecs_iter_fini(ecs_iter_t *it)
Cleanup iterator resources.
char * ecs_iter_str(const ecs_iter_t *it)
Convert iterator to string.
void * ecs_field_at_w_size(const ecs_iter_t *it, size_t size, int8_t index, int32_t row)
Get data for field at specified row.
ecs_id_t ecs_field_id(const ecs_iter_t *it, int8_t index)
Return id matched for field.
bool ecs_field_is_set(const ecs_iter_t *it, int8_t index)
Test whether 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 index of matched table column.
void * ecs_field_w_size(const ecs_iter_t *it, size_t size, int8_t index)
Get data for field.
size_t ecs_field_size(const ecs_iter_t *it, int8_t index)
Return 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 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 iterator.
int32_t count
Number of entities to iterate.
uint64_t group_id
Group id for table, if group_by is used.
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 id matched for field.
size_t size(int8_t index) const
Size of field data type.
flecs::field< A > field(int8_t index) const
Get readonly access to field data.
const A & field_at(int8_t index, size_t row) const
Get reference to field at row.
bool is_self(int8_t index) const
Returns whether field is matched on self.
flecs::string str() const
Convert current iterator result to string.
int32_t field_count() const
Number of fields in iterator.
int32_t column_index(int8_t index) const
Obtain column index for field.
void * param()
Access param.
void * field_at(int8_t index, size_t row) const
Get pointer to field at row.
bool is_readonly(int8_t index) const
Returns whether field is readonly.
bool changed()
Check if the current table has changed since the last iteration.
int8_t term_index() const
Obtain term that triggered an observer.
void fini()
Free iterator resources.
bool is_set(int8_t index) const
Returns whether field is set.
A & field_at(int8_t index, size_t row) const
Get reference to field at row.
flecs::entity entity(size_t row) const
Obtain mutable handle to 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 pair id matched for field.
flecs::entity get_var(int var_id) const
Get value of variable by id.
flecs::field< const flecs::entity_t > entities() const
Get readonly access to entity ids.
iter(ecs_iter_t *it)
Construct iterator from C iterator object.
flecs::entity src(int8_t index) const
Obtain field source (0 if This).
void skip()
Skip current table.
bool next()
Progress iterator.
Unsafe wrapper class around a field.