Base class for iterable query objects. More...
#include <iterable.hpp>
Public Member Functions | |
| template<typename Func> | |
| void | each (Func &&func) const |
| Each iterator. | |
| template<typename Func> | |
| void | run (Func &&func) const |
| Run the iterator. | |
| template<typename Func> | |
| flecs::entity | find (Func &&func) const |
| Find the first entity matching a condition. | |
| iter_iterable< Components... > | iter (flecs::world_t *world=nullptr) const |
| Create an iterator. | |
| iter_iterable< Components... > | iter (flecs::iter &iter) const |
| Create an iterator. | |
| iter_iterable< Components... > | iter (flecs::entity e) const |
| Create an iterator. | |
| page_iterable< Components... > | page (int32_t offset, int32_t limit) |
| Page iterator. | |
| worker_iterable< Components... > | worker (int32_t index, int32_t count) |
| Worker iterator. | |
| int32_t | count () const |
| Return the number of entities matched by the iterable. | |
| bool | is_true () const |
| Return whether the iterable has any matches. | |
| flecs::entity | first () const |
| Return the first entity matched by the iterable. | |
| template<typename Var, typename Value> | |
| iter_iterable< Components... > | set_var (Var var, Value value) const |
| iter_iterable< Components... > | set_group (uint64_t group_id) const |
| Limit results to tables with the specified group ID (grouped queries only). | |
| template<typename Group> | |
| iter_iterable< Components... > | set_group () const |
| Limit results to tables with the specified group type (grouped queries only). | |
| virtual | ~iterable () |
| Virtual destructor. | |
Protected Member Functions | |
| virtual ecs_iter_t | get_iter (flecs::world_t *stage) const =0 |
| virtual ecs_iter_next_action_t | next_action () const =0 |
Protected Attributes | |
| friend | iter_iterable< Components... > |
| friend | page_iterable< Components... > |
| friend | worker_iterable< Components... > |
Base class for iterable query objects.
Definition at line 25 of file iterable.hpp.
|
inlinevirtual |
Virtual destructor.
Definition at line 149 of file iterable.hpp.
|
inline |
Return the number of entities matched by the iterable.
Definition at line 116 of file iterable.hpp.
|
inline |
Each iterator.
The "each" iterator accepts a function that is invoked for each matching entity. The following function signatures are valid:
| func | The callback function. |
Definition at line 37 of file iterable.hpp.
|
inline |
Find the first entity matching a condition.
Return the first entity for which the provided function returns true.
| func | The predicate function. |
Definition at line 65 of file iterable.hpp.
|
inline |
Return the first entity matched by the iterable.
Definition at line 126 of file iterable.hpp.
|
inline |
Return whether the iterable has any matches.
Definition at line 121 of file iterable.hpp.
| iter_iterable< Components... > flecs::iterable< Components >::iter | ( | flecs::entity | e | ) | const |
Create an iterator.
Create an iterator object that can be modified before iterating.
Definition at line 282 of file iterable.hpp.
| iter_iterable< Components... > flecs::iterable< Components >::iter | ( | flecs::iter & | iter | ) | const |
Create an iterator.
Create an iterator object that can be modified before iterating.
Definition at line 276 of file iterable.hpp.
| iter_iterable< Components... > flecs::iterable< Components >::iter | ( | flecs::world_t * | world = nullptr | ) | const |
Create an iterator.
Create an iterator object that can be modified before iterating.
Definition at line 270 of file iterable.hpp.
| page_iterable< Components... > flecs::iterable< Components >::page | ( | int32_t | offset, |
| int32_t | limit ) |
Page iterator.
Create an iterator that limits the returned entities with offset/limit.
| offset | How many entities to skip. |
| limit | The maximum number of entities to return. |
Definition at line 311 of file iterable.hpp.
|
inline |
Run the iterator.
The "run" callback accepts a function that is invoked once for a query with a valid iterator. The following signature is valid:
| func | The callback function. |
Definition at line 53 of file iterable.hpp.
|
inline |
Limit results to tables with the specified group type (grouped queries only).
Definition at line 143 of file iterable.hpp.
|
inline |
Limit results to tables with the specified group ID (grouped queries only).
Definition at line 137 of file iterable.hpp.
|
inline |
Definition at line 131 of file iterable.hpp.
| worker_iterable< Components... > flecs::iterable< Components >::worker | ( | int32_t | index, |
| int32_t | count ) |
Worker iterator.
Create an iterator that divides the number of matched entities across a number of resources.
| index | The index of the current resource. |
| count | The total number of resources to divide entities between. |
Definition at line 316 of file iterable.hpp.
|
protected |
Definition at line 151 of file iterable.hpp.
|
protected |
Definition at line 152 of file iterable.hpp.
|
protected |
Definition at line 153 of file iterable.hpp.