Flecs: flecs::iter_iterable< Components > Struct Template Reference
Description: A fast entity component system (ECS) for C & C++

| Flecs v4.1 A fast entity component system (ECS) for C & C++

Loading...
Searching...
No Matches
flecs::iter_iterable< Components > Struct Template Reference

Forward declaration of iter_iterable. More...

`#include <iterable.hpp>`

Inheritance diagram for flecs::iter_iterable< Components >:
[legend]

## Public Member Functions
template<typename Iterable>
| iter_iterable (Iterable *it, flecs::world_t *world)
| Construct iter_iterable from an iterable and a world.
iter_iterable< Components... > & | set_var (int var_id, flecs::entity_t value)
| Set query variable by ID.
iter_iterable< Components... > & | set_var (const char *name, flecs::entity_t value)
| Set query variable by name to an entity value.
iter_iterable< Components... > & | set_var (const char *name, flecs::table_t *value)
| Set query variable by name to a table value.
iter_iterable< Components... > & | set_var (const char *name, ecs_table_range_t value)
| Set query variable by name to a table range (C type).
iter_iterable< Components... > & | set_var (const char *name, flecs::table_range value)
| Set query variable by name to a table range.
flecs::string | to_json (flecs::iter_to_json_desc_t *desc=nullptr)
| Serialize an iterator result to JSON.
int32_t | count ()
| Return the total number of entities in the result.
bool | is_true ()
| Return whether the iterator yields at least one result.
flecs::entity | first ()
| Return the first matching entity.
iter_iterable< Components... > & | set_group (uint64_t group_id)
| Limit results to tables with the specified group ID (grouped queries only).
template<typename Group>
iter_iterable< Components... > & | set_group ()
| Limit results to tables with the specified group type (grouped queries only).
Public Member Functions inherited from flecs::iterable< Components... >
void | each (Func &&func) const
| Each iterator.
void | run (Func &&func) const
| Run the iterator.
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.
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.
iter_iterable< Components... > | set_var (int var_id, flecs::entity_t value) const
| Set query variable by ID.
iter_iterable< Components... > | set_group (uint64_t group_id) const
| Limit results to tables with the specified group ID (grouped queries only).
virtual | ~iterable ()
| Virtual destructor.

## Protected Member Functions
ecs_iter_t | get_iter (flecs::world_t *world) const override
ecs_iter_next_action_t | next_action () const override

## Additional Inherited Members
Protected Attributes inherited from flecs::iterable< Components... >
friend | iter_iterable< Components... >
friend | page_iterable< Components... >
friend | worker_iterable< Components... >

## Detailed Description

template<typename ... Components>
struct flecs::iter_iterable< Components >

Forward declaration of iter_iterable.

Iterable adapter for iterating with iter/each/run.

Definition at line 176 of file iterable.hpp.

## Constructor & Destructor Documentation

## ◆ iter_iterable()

template<typename ... Components>
template<typename Iterable>

flecs::iter_iterable< Components >::iter_iterable | ( | Iterable * | it,
|  | flecs::world_t * | world )
| inline

Construct iter_iterable from an iterable and a world.

Definition at line 179 of file iterable.hpp.

## Member Function Documentation

## ◆ count()

template<typename ... Components>

int32_t flecs::iter_iterable< Components >::count | ( |  | ) |
| inline

Return the total number of entities in the result.

Definition at line 233 of file iterable.hpp.

## ◆ first()

template<typename ... Components>

flecs::entity flecs::iter_iterable< Components >::first | ( |  | ) |
| inline

Return the first matching entity.

Definition at line 251 of file iterable.hpp.

## ◆ get_iter()

template<typename ... Components>

ecs_iter_t flecs::iter_iterable< Components >::get_iter | ( | flecs::world_t * | world | ) | const
| inlineoverrideprotectedvirtual

Implements flecs::iterable< Components... >.

Definition at line 274 of file iterable.hpp.

## ◆ is_true()

template<typename ... Components>

bool flecs::iter_iterable< Components >::is_true | ( |  | ) |
| inline

Return whether the iterator yields at least one result.

Definition at line 242 of file iterable.hpp.

## ◆ next_action()

template<typename ... Components>

ecs_iter_next_action_t flecs::iter_iterable< Components >::next_action | ( |  | ) | const
| inlineoverrideprotectedvirtual

Implements flecs::iterable< Components... >.

Definition at line 283 of file iterable.hpp.

## ◆ set_group() [1/2]

template<typename ... Components>
template<typename Group>

iter_iterable< Components... > & flecs::iter_iterable< Components >::set_group | ( |  | ) |
| inline

Limit results to tables with the specified group type (grouped queries only).

Definition at line 268 of file iterable.hpp.

## ◆ set_group() [2/2]

template<typename ... Components>

iter_iterable< Components... > & flecs::iter_iterable< Components >::set_group | ( | uint64_t | group_id | ) |
| inline

Limit results to tables with the specified group ID (grouped queries only).

Definition at line 261 of file iterable.hpp.

## ◆ set_var() [1/5]

template<typename ... Components>

iter_iterable< Components... > & flecs::iter_iterable< Components >::set_var | ( | const char * | name,
|  | ecs_table_range_t | value )
| inline

Set query variable by name to a table range (C type).

Definition at line 212 of file iterable.hpp.

## ◆ set_var() [2/5]

template<typename ... Components>

iter_iterable< Components... > & flecs::iter_iterable< Components >::set_var | ( | const char * | name,
|  | flecs::entity_t | value )
| inline

Set query variable by name to an entity value.

Definition at line 196 of file iterable.hpp.

## ◆ set_var() [3/5]

template<typename ... Components>

iter_iterable< Components... > & flecs::iter_iterable< Components >::set_var | ( | const char * | name,
|  | flecs::table_range | value )
| inline

Set query variable by name to a table range.

Definition at line 220 of file iterable.hpp.

## ◆ set_var() [4/5]

template<typename ... Components>

iter_iterable< Components... > & flecs::iter_iterable< Components >::set_var | ( | const char * | name,
|  | flecs::table_t * | value )
| inline

Set query variable by name to a table value.

Definition at line 204 of file iterable.hpp.

## ◆ set_var() [5/5]

template<typename ... Components>

iter_iterable< Components... > & flecs::iter_iterable< Components >::set_var | ( | int | var_id,
|  | flecs::entity_t | value )
| inline

Set query variable by ID.

Definition at line 189 of file iterable.hpp.

The documentation for this struct was generated from the following file:

- include/flecs/addons/cpp/utils/iterable.hpp