Flecs: flecs::query_base Struct Reference
Description: A fast entity component system (ECS) for C & C++

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

Loading...
Searching...
No Matches
flecs::query_base Struct Reference
Inheritance diagram for flecs::query_base:
[legend]

## Public Member Functions
| query_base (query_t *q)
| query_base (const query_t *q)
| query_base (world_t *world, ecs_query_desc_t *desc)
| query_base (const query_base &obj)
query_base & | operator= (const query_base &obj)
| query_base (query_base &&obj) noexcept
query_base & | operator= (query_base &&obj) noexcept
flecs::entity | entity ()
const flecs::query_t * | c_ptr () const
| operator const flecs::query_t * () const
| operator bool () const
void | destruct ()
| Free persistent query.
bool | changed () const
| Returns whether the query data changed since the last iteration.
const flecs::query_group_info_t * | group_info (uint64_t group_id) const
| Get info for group.
void * | group_ctx (uint64_t group_id) const
| Get context for group.
template<typename Func>
void | each_term (const Func &func)
flecs::term | term (int32_t index)
int32_t | term_count ()
int32_t | field_count ()
int32_t | find_var (const char *name)
flecs::string | str ()
flecs::string | plan () const
| Returns a string representing the query plan.
| operator query<> () const
flecs::string | to_json (flecs::iter_to_json_desc_t *desc=nullptr)
| Serialize query to JSON.
flecs::string | to_json (flecs::iter_to_json_desc_t *desc=nullptr)
| Serialize query to JSON.

## Protected Attributes
query_t * | query_ = nullptr

## Detailed Description

Definition at line 13 of file impl.hpp.

## Constructor & Destructor Documentation

## ◆ query_base() [1/6]

flecs::query_base::query_base | ( |  | ) |
| inline

Definition at line 14 of file impl.hpp.

## ◆ query_base() [2/6]

flecs::query_base::query_base | ( | query_t * | q | ) |
| inline

Definition at line 16 of file impl.hpp.

## ◆ query_base() [3/6]

flecs::query_base::query_base | ( | const query_t * | q | ) |
| inline

Definition at line 21 of file impl.hpp.

## ◆ query_base() [4/6]

flecs::query_base::query_base | ( | world_t * | world,
|  | ecs_query_desc_t * | desc )
| inline

Definition at line 26 of file impl.hpp.

## ◆ query_base() [5/6]

flecs::query_base::query_base | ( | const query_base & | obj | ) |
| inline

Definition at line 40 of file impl.hpp.

## ◆ query_base() [6/6]

flecs::query_base::query_base | ( | query_base && | obj | ) |
| inlinenoexcept

Definition at line 58 of file impl.hpp.

## ◆ ~query_base()

flecs::query_base::~query_base | ( |  | ) |
| inline

Definition at line 97 of file impl.hpp.

## Member Function Documentation

## ◆ c_ptr()

const flecs::query_t * flecs::query_base::c_ptr | ( |  | ) | const
| inline

Definition at line 73 of file impl.hpp.

## ◆ changed()

bool flecs::query_base::changed | ( |  | ) | const
| inline

Returns whether the query data changed since the last iteration.

This operation must be invoked before obtaining the iterator, as this will reset the changed state. The operation will return true after:

- new entities have been matched with
- matched entities were deleted
- matched components were changed

Returns
  true if entities changed, otherwise false.

Definition at line 119 of file impl.hpp.

## ◆ destruct()

void flecs::query_base::destruct | ( |  | ) |
| inline

Free persistent query.

A persistent query is a query that is associated with an entity, such as system queries and named queries. Persistent queries must be deleted with destruct(), or will be deleted automatically at world cleanup.

Definition at line 90 of file impl.hpp.

## ◆ each_term()

template<typename Func>

void flecs::query_base::each_term | ( | const Func & | func | ) |
| inline

Definition at line 147 of file impl.hpp.

## ◆ entity()

flecs::entity flecs::query_base::entity | ( |  | ) |
| inline

Definition at line 69 of file impl.hpp.

## ◆ field_count()

int32_t flecs::query_base::field_count | ( |  | ) |
| inline

Definition at line 163 of file impl.hpp.

## ◆ find_var()

int32_t flecs::query_base::find_var | ( | const char * | name | ) |
| inline

Definition at line 167 of file impl.hpp.

## ◆ group_ctx()

void * flecs::query_base::group_ctx | ( | uint64_t | group_id | ) | const
| inline

Get context for group.

Parameters

  group_id | The group id for which to retrieve the context.

Returns
  The group context.

Definition at line 137 of file impl.hpp.

## ◆ group_info()

const flecs::query_group_info_t * flecs::query_base::group_info | ( | uint64_t | group_id | ) | const
| inline

Get info for group.

Parameters

  group_id | The group id for which to retrieve the info.

Returns
  The group info.

Definition at line 128 of file impl.hpp.

## ◆ operator bool()

flecs::query_base::operator bool | ( |  | ) | const
| inline

Definition at line 81 of file impl.hpp.

## ◆ operator const flecs::query_t *()

flecs::query_base::operator const flecs::query_t * | ( |  | ) | const
| inline

Definition at line 77 of file impl.hpp.

## ◆ operator=() [1/2]

query_base & flecs::query_base::operator= | ( | const query_base & | obj | ) |
| inline

Definition at line 48 of file impl.hpp.

## ◆ operator=() [2/2]

query_base & flecs::query_base::operator= | ( | query_base && | obj | ) |
| inlinenoexcept

Definition at line 63 of file impl.hpp.

## ◆ plan()

flecs::string flecs::query_base::plan | ( |  | ) | const
| inline

Returns a string representing the query plan.

This can be used to analyze the behavior & performance of the query.

See also
  ecs_query_plan

Definition at line 180 of file impl.hpp.

## ◆ str()

flecs::string flecs::query_base::str | ( |  | ) |
| inline

Definition at line 171 of file impl.hpp.

## ◆ term()

flecs::term flecs::query_base::term | ( | int32_t | index | ) |
| inline

Definition at line 155 of file impl.hpp.

## ◆ term_count()

int32_t flecs::query_base::term_count | ( |  | ) |
| inline

Definition at line 159 of file impl.hpp.

## ◆ to_json()

flecs::string to_json | ( | flecs::iter_to_json_desc_t * | desc = nullptr | ) |

Serialize query to JSON.

Definition at line 7 of file query.inl.

## Member Data Documentation

## ◆ query_

query_t* flecs::query_base::query_ = nullptr
| protected

Definition at line 192 of file impl.hpp.

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

- include/flecs/addons/cpp/mixins/query/impl.hpp
- include/flecs/addons/cpp/mixins/json/query.inl