Flecs: flecs::term_builder_i< Base > 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::term_builder_i< Base > Struct Template Referenceabstract
C++ API » Core » Queries

Term builder interface. More...

`#include <builder_i.hpp>`

Inheritance diagram for flecs::term_builder_i< Base >:
[legend]

## Public Member Functions
| term_builder_i ()
| Default constructor.
| term_builder_i (ecs_term_t *term_ptr)
| Construct from a term pointer.
Base & | term (id_t id)
| Set the term ID.
Base & | src ()
| Call prior to setting values for the src identifier.
Base & | first ()
| Call prior to setting values for the first identifier.
Base & | second ()
| Call prior to setting values for the second identifier.
Base & | src (flecs::entity_t id)
| Select the src identifier, initialize it with an entity ID.
template<typename T>
Base & | src ()
| Select the src identifier, initialize it with the ID associated with the type.
Base & | src (const char *name)
| Select the src identifier, initialize it with a name.
Base & | first (flecs::entity_t id)
| Select the first identifier, initialize it with an entity ID.
template<typename T>
Base & | first ()
| Select the first identifier, initialize it with the ID associated with the type.
Base & | first (const char *name)
| Select the first identifier, initialize it with a name.
Base & | second (flecs::entity_t id)
| Select the second identifier, initialize it with an entity ID.
template<typename T>
Base & | second ()
| Select the second identifier, initialize it with the ID associated with the type.
Base & | second (const char *name)
| Select the second identifier, initialize it with a name.
Base & | up (flecs::entity_t trav=0)
| The up flag indicates that the term identifier may be substituted by traversing a relationship upwards.
template<typename Trav>
Base & | up ()
| Traverse upwards using the specified relationship type.
Base & | cascade (flecs::entity_t trav=0)
| The cascade flag is like up(), but returns results in breadth-first order.
template<typename Trav>
Base & | cascade ()
| Cascade using the specified relationship type.
Base & | desc ()
| Use with cascade() to iterate results in descending (bottom-to-top) order.
Base & | parent ()
| Same as up().
Base & | trav (flecs::entity_t trav, flecs::flags32_t flags=0)
| Specify the relationship to traverse, and flags to indicate direction.
Base & | id_flags (id_t flags)
| Set ID flags for the term.
Base & | inout (flecs::inout_kind_t inout)
| Set read/write access of the term.
Base & | inout_stage (flecs::inout_kind_t inout)
| Set read/write access for a stage.
Base & | write ()
| Short for inout_stage(flecs::Out).
Base & | read ()
| Short for inout_stage(flecs::In).
Base & | read_write ()
| Short for inout_stage(flecs::InOut).
Base & | in ()
| Short for inout(flecs::In).
Base & | out ()
| Short for inout(flecs::Out).
Base & | inout ()
| Short for inout(flecs::InOut).
Base & | inout_none ()
| Short for inout(flecs::InOutNone).
Base & | oper (flecs::oper_kind_t oper)
| Set the operator of the term.
Base & | and_ ()
| Short for oper(flecs::And).
Base & | or_ ()
| Short for oper(flecs::Or).
Base & | not_ ()
| Short for oper(flecs::Not).
Base & | optional ()
| Short for oper(flecs::Optional).
Base & | and_from ()
| Short for oper(flecs::AndFrom).
Base & | or_from ()
| Short for oper(flecs::OrFrom).
Base & | not_from ()
| Short for oper(flecs::NotFrom).
Base & | filter ()
| Mark the term as a filter.
Public Member Functions inherited from flecs::term_ref_builder_i< Base >
| term_ref_builder_i ()
| Default constructor.
virtual | ~term_ref_builder_i ()
| Destructor.
Base & | self ()
| The self flag indicates that the term identifier itself is used.
Base & | id (flecs::entity_t id)
| Specify the value of the identifier by ID.
Base & | entity (flecs::entity_t entity)
| Specify the value of the identifier by ID.
Base & | name (const char *name)
| Specify the value of the identifier by name.
Base & | var (const char *var_name)
| Specify that the identifier is a variable (resolved at query evaluation time).
Base & | flags (flecs::flags64_t flags)
| Override the term ID flags.

## Public Attributes
ecs_term_t * | term_
| Pointer to the current term.
Public Attributes inherited from flecs::term_ref_builder_i< Base >
ecs_term_ref_t * | term_ref_
| Pointer to the current term reference.

## Protected Member Functions
virtual flecs::world_t * | world_v () override=0
void | set_term (ecs_term_t *term)
| Set the current term pointer.
Protected Member Functions inherited from flecs::term_ref_builder_i< Base >
void | assert_term_ref ()

## Detailed Description

template<typename Base>
struct flecs::term_builder_i< Base >

Term builder interface.

A term is a single element of a query expression.

Definition at line 103 of file builder_i.hpp.

## Constructor & Destructor Documentation

## ◆ term_builder_i() [1/2]

template<typename Base>

flecs::term_builder_i< Base >::term_builder_i | ( |  | ) |
| inline

Default constructor.

Definition at line 105 of file builder_i.hpp.

## ◆ term_builder_i() [2/2]

template<typename Base>

flecs::term_builder_i< Base >::term_builder_i | ( | ecs_term_t * | term_ptr | ) |
| inline

Construct from a term pointer.

Definition at line 108 of file builder_i.hpp.

## Member Function Documentation

## ◆ and_()

template<typename Base>

Base & flecs::term_builder_i< Base >::and_ | ( |  | ) |
| inline

Short for oper(flecs::And).

Definition at line 363 of file builder_i.hpp.

## ◆ and_from()

template<typename Base>

Base & flecs::term_builder_i< Base >::and_from | ( |  | ) |
| inline

Short for oper(flecs::AndFrom).

Definition at line 383 of file builder_i.hpp.

## ◆ cascade() [1/2]

template<typename Base>
template<typename Trav>

Base & flecs::term_builder_i< Base >::cascade | ( |  | ) |
| inline

Cascade using the specified relationship type.

Definition at line 259 of file builder_i.hpp.

## ◆ cascade() [2/2]

template<typename Base>

Base & flecs::term_builder_i< Base >::cascade | ( | flecs::entity_t | trav = 0 | ) |
| inline

The cascade flag is like up(), but returns results in breadth-first order.

Only supported for flecs::query.

Definition at line 247 of file builder_i.hpp.

## ◆ desc()

template<typename Base>

Base & flecs::term_builder_i< Base >::desc | ( |  | ) |
| inline

Use with cascade() to iterate results in descending (bottom-to-top) order.

Definition at line 264 of file builder_i.hpp.

## ◆ filter()

template<typename Base>

Base & flecs::term_builder_i< Base >::filter | ( |  | ) |
| inline

Mark the term as a filter.

Query terms marked as a filter are not triggered by observers.

Definition at line 399 of file builder_i.hpp.

## ◆ first() [1/4]

template<typename Base>
template<typename T>

Base & flecs::term_builder_i< Base >::first | ( |  | ) |
| inline

Select the first identifier, initialize it with the ID associated with the type.

Definition at line 177 of file builder_i.hpp.

## ◆ first() [2/4]

template<typename Base>

Base & flecs::term_builder_i< Base >::first | ( |  | ) |
| inline

Call prior to setting values for the first identifier.

This is either the component identifier, or the first element of a pair (in case the second is populated as well).

Definition at line 127 of file builder_i.hpp.

## ◆ first() [3/4]

template<typename Base>

Base & flecs::term_builder_i< Base >::first | ( | const char * | name | ) |
| inline

Select the first identifier, initialize it with a name.

If the name starts with a $, the name is interpreted as a variable.

Definition at line 184 of file builder_i.hpp.

## ◆ first() [4/4]

template<typename Base>

Base & flecs::term_builder_i< Base >::first | ( | flecs::entity_t | id | ) |
| inline

Select the first identifier, initialize it with an entity ID.

Definition at line 169 of file builder_i.hpp.

## ◆ id_flags()

template<typename Base>

Base & flecs::term_builder_i< Base >::id_flags | ( | id_t | flags | ) |
| inline

Set ID flags for the term.

Definition at line 284 of file builder_i.hpp.

## ◆ in()

template<typename Base>

Base & flecs::term_builder_i< Base >::in | ( |  | ) |
| inline

Short for inout(flecs::In).

Definition at line 336 of file builder_i.hpp.

## ◆ inout() [1/2]

template<typename Base>

Base & flecs::term_builder_i< Base >::inout | ( |  | ) |
| inline

Short for inout(flecs::InOut).

Definition at line 346 of file builder_i.hpp.

## ◆ inout() [2/2]

template<typename Base>

Base & flecs::term_builder_i< Base >::inout | ( | flecs::inout_kind_t | inout | ) |
| inline

Set read/write access of the term.

Definition at line 291 of file builder_i.hpp.

## ◆ inout_none()

template<typename Base>

Base & flecs::term_builder_i< Base >::inout_none | ( |  | ) |
| inline

Short for inout(flecs::InOutNone).

Definition at line 351 of file builder_i.hpp.

## ◆ inout_stage()

template<typename Base>

Base & flecs::term_builder_i< Base >::inout_stage | ( | flecs::inout_kind_t | inout | ) |
| inline

Set read/write access for a stage.

Use this when a system reads or writes components other than the ones provided by the query. This information can be used by schedulers to insert sync/merge points between systems where deferred operations are flushed.

Setting this is optional. If not set, the value of the accessed component may be out of sync for at most one frame.

Definition at line 305 of file builder_i.hpp.

## ◆ not_()

template<typename Base>

Base & flecs::term_builder_i< Base >::not_ | ( |  | ) |
| inline

Short for oper(flecs::Not).

Definition at line 373 of file builder_i.hpp.

## ◆ not_from()

template<typename Base>

Base & flecs::term_builder_i< Base >::not_from | ( |  | ) |
| inline

Short for oper(flecs::NotFrom).

Definition at line 393 of file builder_i.hpp.

## ◆ oper()

template<typename Base>

Base & flecs::term_builder_i< Base >::oper | ( | flecs::oper_kind_t | oper | ) |
| inline

Set the operator of the term.

Definition at line 356 of file builder_i.hpp.

## ◆ optional()

template<typename Base>

Base & flecs::term_builder_i< Base >::optional | ( |  | ) |
| inline

Short for oper(flecs::Optional).

Definition at line 378 of file builder_i.hpp.

## ◆ or_()

template<typename Base>

Base & flecs::term_builder_i< Base >::or_ | ( |  | ) |
| inline

Short for oper(flecs::Or).

Definition at line 368 of file builder_i.hpp.

## ◆ or_from()

template<typename Base>

Base & flecs::term_builder_i< Base >::or_from | ( |  | ) |
| inline

Short for oper(flecs::OrFrom).

Definition at line 388 of file builder_i.hpp.

## ◆ out()

template<typename Base>

Base & flecs::term_builder_i< Base >::out | ( |  | ) |
| inline

Short for inout(flecs::Out).

Definition at line 341 of file builder_i.hpp.

## ◆ parent()

template<typename Base>

Base & flecs::term_builder_i< Base >::parent | ( |  | ) |
| inline

Same as up().

Exists for backwards compatibility.

Definition at line 271 of file builder_i.hpp.

## ◆ read()

template<typename Base>

Base & flecs::term_builder_i< Base >::read | ( |  | ) |
| inline

Short for inout_stage(flecs::In).

Use when the system uses get().

Definition at line 324 of file builder_i.hpp.

## ◆ read_write()

template<typename Base>

Base & flecs::term_builder_i< Base >::read_write | ( |  | ) |
| inline

Short for inout_stage(flecs::InOut).

Use when the system uses ensure().

Definition at line 331 of file builder_i.hpp.

## ◆ second() [1/4]

template<typename Base>
template<typename T>

Base & flecs::term_builder_i< Base >::second | ( |  | ) |
| inline

Select the second identifier, initialize it with the ID associated with the type.

Definition at line 204 of file builder_i.hpp.

## ◆ second() [2/4]

template<typename Base>

Base & flecs::term_builder_i< Base >::second | ( |  | ) |
| inline

Call prior to setting values for the second identifier.

This is the second element of a pair. Requires that first() is populated as well.

Definition at line 135 of file builder_i.hpp.

## ◆ second() [3/4]

template<typename Base>

Base & flecs::term_builder_i< Base >::second | ( | const char * | name | ) |
| inline

Select the second identifier, initialize it with a name.

If the name starts with a $, the name is interpreted as a variable.

Definition at line 211 of file builder_i.hpp.

## ◆ second() [4/4]

template<typename Base>

Base & flecs::term_builder_i< Base >::second | ( | flecs::entity_t | id | ) |
| inline

Select the second identifier, initialize it with an entity ID.

Definition at line 196 of file builder_i.hpp.

## ◆ set_term()

template<typename Base>

void flecs::term_builder_i< Base >::set_term | ( | ecs_term_t * | term | ) |
| inlineprotected

Set the current term pointer.

Definition at line 411 of file builder_i.hpp.

## ◆ src() [1/4]

template<typename Base>
template<typename T>

Base & flecs::term_builder_i< Base >::src | ( |  | ) |
| inline

Select the src identifier, initialize it with the ID associated with the type.

Definition at line 150 of file builder_i.hpp.

## ◆ src() [2/4]

template<typename Base>

Base & flecs::term_builder_i< Base >::src | ( |  | ) |
| inline

Call prior to setting values for the src identifier.

Definition at line 118 of file builder_i.hpp.

## ◆ src() [3/4]

template<typename Base>

Base & flecs::term_builder_i< Base >::src | ( | const char * | name | ) |
| inline

Select the src identifier, initialize it with a name.

If the name starts with a $, the name is interpreted as a variable.

Definition at line 157 of file builder_i.hpp.

## ◆ src() [4/4]

template<typename Base>

Base & flecs::term_builder_i< Base >::src | ( | flecs::entity_t | id | ) |
| inline

Select the src identifier, initialize it with an entity ID.

Definition at line 142 of file builder_i.hpp.

## ◆ term()

template<typename Base>

Base & flecs::term_builder_i< Base >::term | ( | id_t | id | ) |
| inline

Set the term ID.

Definition at line 113 of file builder_i.hpp.

## ◆ trav()

template<typename Base>

Base & flecs::term_builder_i< Base >::trav | ( | flecs::entity_t | trav,
|  | flecs::flags32_t | flags = 0 )
| inline

Specify the relationship to traverse, and flags to indicate direction.

Definition at line 276 of file builder_i.hpp.

## ◆ up() [1/2]

template<typename Base>
template<typename Trav>

Base & flecs::term_builder_i< Base >::up | ( |  | ) |
| inline

Traverse upwards using the specified relationship type.

Definition at line 241 of file builder_i.hpp.

## ◆ up() [2/2]

template<typename Base>

Base & flecs::term_builder_i< Base >::up | ( | flecs::entity_t | trav = 0 | ) |
| inline

The up flag indicates that the term identifier may be substituted by traversing a relationship upwards.

For example, substitute the identifier with its parent by traversing the ChildOf relationship.

Definition at line 225 of file builder_i.hpp.

## ◆ world_v()

template<typename Base>

virtual flecs::world_t * flecs::term_builder_i< Base >::world_v | ( |  | ) |
| overrideprotectedpure virtual

Implements flecs::term_ref_builder_i< Base >.

## ◆ write()

template<typename Base>

Base & flecs::term_builder_i< Base >::write | ( |  | ) |
| inline

Short for inout_stage(flecs::Out).

Use when the system uses add(), remove(), or set().

Definition at line 317 of file builder_i.hpp.

## Member Data Documentation

## ◆ term_

template<typename Base>

ecs_term_t* flecs::term_builder_i< Base >::term_

Pointer to the current term.

Definition at line 405 of file builder_i.hpp.

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

- include/flecs/addons/cpp/mixins/term/builder_i.hpp