Flecs: flecs::entity_view 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::entity_view Struct Reference
C++ API » Core » Entities

Entity view. More...

`#include <entity_view.hpp>`

Inheritance diagram for flecs::entity_view:
[legend]

## Public Member Functions
| entity_view (flecs::world_t *world, flecs::id_t id)
| Wrap an existing entity id.
| entity_view (entity_t id)
| Implicit conversion from flecs::entity_t to flecs::entity_view.
entity_t | id () const
| Get entity id.
bool | is_valid () const
| Check if entity is valid.
| operator bool () const
bool | is_alive () const
| Check if entity is alive.
flecs::string_view | name () const
| Return the entity name.
flecs::string_view | symbol () const
| Return the entity symbol.
flecs::string | path (const char *sep="::", const char *init_sep="::") const
| Return the entity path.
flecs::string | path_from (flecs::entity_t parent, const char *sep="::", const char *init_sep="::") const
| Return the entity path relative to a parent.
template<typename Parent>
flecs::string | path_from (const char *sep="::", const char *init_sep="::") const
| Return the entity path relative to a parent.
bool | enabled () const
flecs::type | type () const
| Get the entity's type.
flecs::table | table () const
| Get the entity's table.
flecs::table_range | range () const
| Get table range for the entity.
template<typename Func>
void | each (const Func &func) const
| Iterate (component) ids of an entity.
template<typename Func>
void | each (flecs::id_t first, flecs::id_t second, const Func &func) const
| Iterate matching pair ids of an entity.
template<typename Func>
void | each (const flecs::entity_view &rel, const Func &func) const
| Iterate targets for a given relationship.
template<typename First, typename Func>
void | each (const Func &func) const
| Iterate targets for a given relationship.
template<typename Func>
void | children (flecs::entity_t rel, Func &&func) const
| Iterate children for entity.
template<typename Rel, typename Func>
void | children (Func &&func) const
| Iterate children for entity.
template<typename Func>
void | children (Func &&func) const
| Iterate children for entity.
template<typename T, if_t< is_actual< T >::value > = 0>
const T * | try_get () const
| Get component value.
template<typename T, typename A = actual_type_t<T>, if_t< flecs::is_pair< T >::value > = 0>
const A * | try_get () const
| Get component value.
template<typename First, typename Second, typename P = pair<First, Second>, typename A = actual_type_t<P>, if_not_t< flecs::is_pair< First >::value > = 0>
const A * | try_get () const
| Get a pair.
template<typename First, typename Second, if_not_t< is_enum< Second >::value > = 0>
const First * | try_get (Second second) const
| Get a pair.
template<typename First, typename Second, if_t< is_enum< Second >::value &&!std::is_same< First, Second >::value > = 0>
const First * | try_get (Second constant) const
| Get a pair.
const void * | try_get (flecs::id_t comp) const
| Get component value (untyped).
const void * | try_get (flecs::entity_t first, flecs::entity_t second) const
| Get a pair (untyped).
template<typename Second>
const Second * | try_get_second (flecs::entity_t first) const
| Get the second part for a pair.
template<typename First, typename Second>
const Second * | try_get_second () const
| Get the second part for a pair.
template<typename T, if_t< is_actual< T >::value > = 0>
const T & | get () const
| Get component value.
template<typename T, typename A = actual_type_t<T>, if_t< flecs::is_pair< T >::value > = 0>
const A & | get () const
| Get component value.
template<typename First, typename Second, typename P = pair<First, Second>, typename A = actual_type_t<P>, if_not_t< flecs::is_pair< First >::value > = 0>
const A & | get () const
| Get a pair.
template<typename First, typename Second, if_not_t< is_enum< Second >::value > = 0>
const First & | get (Second second) const
| Get a pair.
template<typename First, typename Second, if_t< is_enum< Second >::value &&!std::is_same< First, Second >::value > = 0>
const First & | get (Second constant) const
| Get a pair.
const void * | get (flecs::id_t comp) const
| Get component value (untyped).
const void * | get (flecs::entity_t first, flecs::entity_t second) const
| Get a pair (untyped).
template<typename Func, if_t< is_callable< Func >::value > = 0>
bool | get (const Func &func) const
| Get 1..N components.
template<typename Second>
const Second & | get_second (flecs::entity_t first) const
| Get the second part for a pair.
template<typename First, typename Second>
const Second & | get_second () const
| Get the second part for a pair.
template<typename T, if_t< is_actual< T >::value > = 0>
T * | try_get_mut () const
| Get mutable component value.
template<typename T, typename A = actual_type_t<T>, if_t< flecs::is_pair< T >::value > = 0>
A * | try_get_mut () const
| Get mutable component value.
template<typename First, typename Second, typename P = pair<First, Second>, typename A = actual_type_t<P>, if_not_t< flecs::is_pair< First >::value > = 0>
A * | try_get_mut () const
| Get a mutable pair.
template<typename First, typename Second, if_not_t< is_enum< Second >::value > = 0>
First * | try_get_mut (Second second) const
| Get a mutable pair.
template<typename First, typename Second, if_t< is_enum< Second >::value &&!std::is_same< First, Second >::value > = 0>
First * | try_get_mut (Second constant) const
| Get a mutable pair.
void * | try_get_mut (flecs::id_t comp) const
| Get mutable component value (untyped).
void * | try_get_mut (flecs::entity_t first, flecs::entity_t second) const
| Get a mutable pair (untyped).
template<typename Second>
Second * | try_get_mut_second (flecs::entity_t first) const
| Get the second part for a pair.
template<typename First, typename Second>
Second * | try_get_mut_second () const
| Get the second part for a pair.
template<typename T, if_t< is_actual< T >::value > = 0>
T & | get_mut () const
| Get mutable component value.
template<typename T, typename A = actual_type_t<T>, if_t< flecs::is_pair< T >::value > = 0>
A & | get_mut () const
| Get mutable component value.
template<typename First, typename Second, typename P = pair<First, Second>, typename A = actual_type_t<P>, if_not_t< flecs::is_pair< First >::value > = 0>
A & | get_mut () const
| Get a mutable pair.
template<typename First, typename Second, if_not_t< is_enum< Second >::value > = 0>
First & | get_mut (Second second) const
| Get a mutable pair.
template<typename First, typename Second, if_t< is_enum< Second >::value &&!std::is_same< First, Second >::value > = 0>
First & | get_mut (Second constant) const
| Get a mutable pair.
void * | get_mut (flecs::id_t comp) const
| Get mutable component value (untyped).
void * | get_mut (flecs::entity_t first, flecs::entity_t second) const
| Get a mutable pair (untyped).
template<typename Second>
Second & | get_mut_second (flecs::entity_t first) const
| Get the second part for a pair.
template<typename First, typename Second>
Second * | get_mut_second () const
| Get the second part for a pair.
template<typename Enum>
Enum | get_constant () const
| Get enum constant for enum relationship.
template<typename First>
flecs::entity | target (int32_t index=0) const
| Get target for a given pair.
flecs::entity | target (flecs::entity_t first, int32_t index=0) const
| Get target for a given pair.
flecs::entity | target_for (flecs::entity_t relationship, flecs::id_t id) const
| Get the target of a pair for a given relationship id.
template<typename T>
flecs::entity | target_for (flecs::entity_t relationship) const
template<typename First, typename Second>
flecs::entity | target_for (flecs::entity_t relationship) const
int32_t | depth (flecs::entity_t rel) const
| Get depth for given relationship.
template<typename Rel>
int32_t | depth () const
| Get depth for given relationship.
flecs::entity | parent () const
| Get parent of entity.
flecs::entity | lookup (const char *path, bool search_path=false) const
| Lookup an entity by name.
bool | has (flecs::id_t e) const
| Check if entity has the provided entity.
template<typename T>
bool | has () const
| Check if entity has the provided component.
template<typename E, if_t< is_enum< E >::value > = 0>
bool | has (E value) const
| Check if entity has the provided enum constant.
template<typename First, typename Second>
bool | has () const
| Check if entity has the provided pair.
template<typename First, typename Second, if_not_t< is_enum< Second >::value > = 0>
bool | has (Second second) const
| Check if entity has the provided pair.
template<typename Second>
bool | has_second (flecs::entity_t first) const
| Check if entity has the provided pair.
template<typename First, typename E, if_t< is_enum< E >::value &&!std::is_same< First, E >::value > = 0>
bool | has (E value) const
| Check if entity has the provided pair.
bool | has (flecs::id_t first, flecs::id_t second) const
| Check if entity has the provided pair.
bool | owns (flecs::id_t e) const
| Check if entity owns the provided entity.
template<typename First>
bool | owns (flecs::id_t second) const
| Check if entity owns the provided pair.
bool | owns (flecs::id_t first, flecs::id_t second) const
| Check if entity owns the provided pair.
template<typename T>
bool | owns () const
| Check if entity owns the provided component.
template<typename First, typename Second>
bool | owns () const
| Check if entity owns the provided pair.
bool | enabled (flecs::id_t id) const
| Test if id is enabled.
template<typename T>
bool | enabled () const
| Test if component is enabled.
bool | enabled (flecs::id_t first, flecs::id_t second) const
| Test if pair is enabled.
template<typename First>
bool | enabled (flecs::id_t second) const
| Test if pair is enabled.
template<typename First, typename Second>
bool | enabled () const
| Test if pair is enabled.
flecs::entity | clone (bool clone_value=true, flecs::entity_t dst_id=0) const
flecs::entity | mut (const flecs::world &stage) const
| Return mutable entity handle for current stage When an entity handle created from the world is used while the world is in staged mode, it will only allow for readonly operations since structural changes are not allowed on the world while in staged mode.
flecs::entity | mut (const flecs::iter &it) const
| Same as mut(world), but for iterator.
flecs::entity | mut (const flecs::entity_view &e) const
| Same as mut(world), but for entity.
flecs::string | to_json (const flecs::entity_to_json_desc_t *desc=nullptr) const
| Serialize entity to JSON.
const char * | doc_name () const
| Get human readable name.
const char * | doc_brief () const
| Get brief description.
const char * | doc_detail () const
| Get detailed description.
const char * | doc_link () const
| Get link to external documentation.
const char * | doc_color () const
| Get color.
const char * | doc_uuid () const
| Get UUID.
int32_t | alert_count (flecs::entity_t alert=0) const
| Return number of alerts for entity.
template<typename E>
E | to_constant () const
| Convert entity to enum constant.
void | emit (flecs::entity_t evt) const
| Emit event for entity.
void | emit (flecs::entity evt) const
| Emit event for entity.
template<typename Evt, if_t< is_empty< Evt >::value > = 0>
void | emit () const
| Emit event for entity.
template<typename Evt, if_not_t< is_empty< Evt >::value > = 0>
void | emit (const Evt &payload) const
| Emit event with payload for entity.
void | enqueue (flecs::entity_t evt) const
| Enqueue event for entity.
void | enqueue (flecs::entity evt) const
| Enqueue event for entity.
template<typename Evt, if_t< is_empty< Evt >::value > = 0>
void | enqueue () const
| Enqueue event for entity.
template<typename Evt, if_not_t< is_empty< Evt >::value > = 0>
void | enqueue (const Evt &payload) const
| Enqueue event with payload for entity.
int32_t | alert_count (flecs::entity_t alert=0) const
| Return number of alerts for entity.
const char * | doc_name () const
| Get human readable name.
const char * | doc_brief () const
| Get brief description.
const char * | doc_detail () const
| Get detailed description.
const char * | doc_link () const
| Get link to external documentation.
const char * | doc_color () const
| Get color.
const char * | doc_uuid () const
| Get UUID.
template<typename E>
E | to_constant () const
| Convert entity to enum constant.
void | emit (flecs::entity_t evt) const
| Emit event for entity.
void | emit (flecs::entity evt) const
| Emit event for entity.
template<typename Evt, if_t< is_empty< Evt >::value > = 0>
void | emit () const
| Emit event for entity.
template<typename Evt, if_not_t< is_empty< Evt >::value > = 0>
void | emit (const Evt &payload) const
| Emit event with payload for entity.
void | enqueue (flecs::entity_t evt) const
| Enqueue event for entity.
void | enqueue (flecs::entity evt) const
| Enqueue event for entity.
template<typename Evt, if_t< is_empty< Evt >::value > = 0>
void | enqueue () const
| Enqueue event for entity.
template<typename Evt, if_not_t< is_empty< Evt >::value > = 0>
void | enqueue (const Evt &payload) const
| Enqueue event with payload for entity.
flecs::string | to_json (const flecs::entity_to_json_desc_t *desc=nullptr) const
| Serialize entity to JSON.
Public Member Functions inherited from flecs::id
| id (flecs::id_t value)
| id (flecs::world_t *world, flecs::id_t value=0)
| id (flecs::world_t *world, flecs::id_t first, flecs::id_t second)
| id (flecs::world_t *world, const char *expr)
| id (flecs::id_t first, flecs::id_t second)
| id (const flecs::id &first, const flecs::id &second)
bool | is_pair () const
| Test if id is pair (has first, second)
bool | is_wildcard () const
| Test if id is a wildcard.
bool | is_entity () const
| Test if id is entity.
flecs::entity | entity () const
| Return id as entity (only allowed when id is valid entity)
flecs::entity | add_flags (flecs::id_t flags) const
| Return id with role added.
flecs::entity | remove_flags (flecs::id_t flags) const
| Return id with role removed.
flecs::entity | remove_flags () const
| Return id without role.
flecs::entity | remove_generation () const
| Return id without role.
flecs::entity | type_id () const
| Return component type of id.
bool | has_flags (flecs::id_t flags) const
| Test if id has specified role.
bool | has_flags () const
| Test if id has any role.
flecs::entity | flags () const
| Return id flags set on id.
bool | has_relation (flecs::id_t first) const
| Test if id has specified first.
flecs::entity | first () const
| Get first element from a pair.
flecs::entity | second () const
| Get second element from a pair.
flecs::string | str () const
flecs::string | flags_str () const
| Convert role of id to string.
flecs::id_t | raw_id () const
| Return flecs::id_t value.
| operator flecs::id_t () const
flecs::world | world () const
const Self & | unit (const char *symbol, flecs::entity_t prefix=0, flecs::entity_t base=0, flecs::entity_t over=0, int32_t factor=0, int32_t power=0) const
| Make entity a unit.
const Self & | unit (flecs::entity_t prefix=0, flecs::entity_t base=0, flecs::entity_t over=0, int32_t factor=0, int32_t power=0) const
| Make entity a derived unit.
const Self & | unit_prefix (const char *symbol, int32_t factor=0, int32_t power=0) const
| Make entity a derived unit.
const Self & | quantity (flecs::entity_t quantity) const
| Add quantity to unit.
template<typename Quantity>
const Self & | quantity () const
| Make entity a unity prefix.
const Self & | quantity () const
| Make entity a quantity.

## Additional Inherited Members
Protected Attributes inherited from flecs::id
flecs::world_t * | world_
flecs::id_t | id_

## Detailed Description

Entity view.

Class with read operations for entities. Base for flecs::entity.

Definition at line 28 of file entity_view.hpp.

## Constructor & Destructor Documentation

## ◆ entity_view() [1/3]

flecs::entity_view::entity_view | ( |  | ) |
| inline

Definition at line 30 of file entity_view.hpp.

## ◆ entity_view() [2/3]

flecs::entity_view::entity_view | ( | flecs::world_t * | world,
|  | flecs::id_t | id )
| inlineexplicit

Wrap an existing entity id.

Parameters

  world | The world in which the entity is created.
  id | The entity id.

Definition at line 37 of file entity_view.hpp.

## ◆ entity_view() [3/3]

flecs::entity_view::entity_view | ( | entity_t | id | ) |
| inline

Implicit conversion from flecs::entity_t to flecs::entity_view.

Definition at line 44 of file entity_view.hpp.

## Member Function Documentation

## ◆ alert_count()

int32_t alert_count | ( | flecs::entity_t | alert = 0 | ) | const

Return number of alerts for entity.

Definition at line 11 of file entity_view.inl.

## ◆ children() [1/3]

template<typename Func>

void flecs::entity_view::children | ( | flecs::entity_t | rel,
|  | Func && | func ) const
| inline

Iterate children for entity.

The function parameter must match the following signature:

void(*)(flecs::entity target)
flecs::entity_view::target
flecs::entity target(int32_t index=0) const
Get target for a given pair.
Definition impl.hpp:36
flecs::entity
Entity.
Definition entity.hpp:30

Parameters

  rel | The relationship to follow.
  func | The function invoked for each child.

Definition at line 204 of file entity_view.hpp.

## ◆ children() [2/3]

template<typename Rel, typename Func>

void flecs::entity_view::children | ( | Func && | func | ) | const
| inline

Iterate children for entity.

The function parameter must match the following signature:

void(*)(flecs::entity target)

Template Parameters

  Rel | The relationship to follow.

Parameters

  func | The function invoked for each child.

Definition at line 239 of file entity_view.hpp.

## ◆ children() [3/3]

template<typename Func>

void flecs::entity_view::children | ( | Func && | func | ) | const
| inline

Iterate children for entity.

The function parameter must match the following signature:

void(*)(flecs::entity target)

This operation follows the ChildOf relationship.

Parameters

  func | The function invoked for each child.

Definition at line 255 of file entity_view.hpp.

## ◆ clone()

flecs::entity flecs::entity_view::clone | ( | bool | clone_value = true,
|  | flecs::entity_t | dst_id = 0 ) const
| inline

Definition at line 178 of file impl.hpp.

## ◆ depth() [1/2]

template<typename Rel>

int32_t flecs::entity_view::depth | ( |  | ) | const
| inline

Get depth for given relationship.

Template Parameters

  Rel | The relationship.

Returns
  The depth.

Definition at line 891 of file entity_view.hpp.

## ◆ depth() [2/2]

int32_t flecs::entity_view::depth | ( | flecs::entity_t | rel | ) | const
| inline

Get depth for given relationship.

Parameters

  rel | The relationship.

Returns
  The depth.

Definition at line 881 of file entity_view.hpp.

## ◆ doc_brief()

const char * doc_brief | ( |  | ) | const

Get brief description.

See also
  ecs_doc_get_brief()
  flecs::doc::get_brief()
  flecs::entity_builder::set_doc_brief()

Definition at line 28 of file entity_view.inl.

## ◆ doc_color()

const char * doc_color | ( |  | ) | const

Get color.

See also
  ecs_doc_get_color()
  flecs::doc::get_color()
  flecs::entity_builder::set_doc_color()

Definition at line 67 of file entity_view.inl.

## ◆ doc_detail()

const char * doc_detail | ( |  | ) | const

Get detailed description.

See also
  ecs_doc_get_detail()
  flecs::doc::get_detail()
  flecs::entity_builder::set_doc_detail()

Definition at line 41 of file entity_view.inl.

## ◆ doc_link()

const char * doc_link | ( |  | ) | const

Get link to external documentation.

See also
  ecs_doc_get_link()
  flecs::doc::get_link()
  flecs::entity_builder::set_doc_link()

Definition at line 54 of file entity_view.inl.

## ◆ doc_name()

const char * doc_name | ( |  | ) | const

Get human readable name.

See also
  ecs_doc_get_name()
  flecs::doc::get_name()
  flecs::entity_builder::set_doc_name()

Definition at line 15 of file entity_view.inl.

## ◆ doc_uuid()

const char * doc_uuid | ( |  | ) | const

Get UUID.

See also
  ecs_doc_get_uuid()
  flecs::doc::get_uuid()
  flecs::entity_builder::set_doc_uuid()

Definition at line 80 of file entity_view.inl.

## ◆ each() [1/4]

template<typename Func>

void flecs::entity_view::each | ( | const flecs::entity_view & | rel,
|  | const Func & | func ) const
| inline

Iterate targets for a given relationship.

The function parameter must match the following signature:

void(*)(flecs::entity target)

Parameters

  rel | The relationship for which to iterate the targets.
  func | The function invoked for each target.

Definition at line 160 of file impl.hpp.

## ◆ each() [2/4]

template<typename Func>

void flecs::entity_view::each | ( | const Func & | func | ) | const
| inline

Iterate (component) ids of an entity.

The function parameter must match the following signature:

void(*)(flecs::id id)
flecs::entity_view::id
entity_t id() const
Get entity id.
Definition entity_view.hpp:50
flecs::id
Class that wraps around a flecs::id_t.
Definition decl.hpp:27

Parameters

  func | The function invoked for each id.

Definition at line 112 of file impl.hpp.

## ◆ each() [3/4]

template<typename First, typename Func>

void flecs::entity_view::each | ( | const Func & | func | ) | const
| inline

Iterate targets for a given relationship.

The function parameter must match the following signature:

void(*)(flecs::entity target)

Template Parameters

  First | The relationship for which to iterate the targets.

Parameters

  func | The function invoked for each target.

Definition at line 189 of file entity_view.hpp.

## ◆ each() [4/4]

template<typename Func>

void flecs::entity_view::each | ( | flecs::id_t | first,
|  | flecs::id_t | second,
|  | const Func & | func ) const
| inline

Iterate matching pair ids of an entity.

The function parameter must match the following signature:

void(*)(flecs::id id)

Parameters

  func | The function invoked for each id.

Definition at line 129 of file impl.hpp.

## ◆ emit() [1/8]

template<typename Evt, if_t< is_empty< Evt >::value > = 0>

void emit | ( |  | ) | const

Emit event for entity.

Template Parameters

  Evt | The event to emit.

Definition at line 34 of file entity_view.inl.

## ◆ emit() [2/8]

template<typename Evt, if_t< is_empty< Evt >::value > = 0>

void emit | ( |  | ) | const
| inline

Emit event for entity.

Template Parameters

  Evt | The event to emit.

Definition at line 35 of file entity_view.hpp.

## ◆ emit() [3/8]

template<typename Evt, if_not_t< is_empty< Evt >::value > = 0>

void emit | ( | const Evt & | payload | ) | const

Emit event with payload for entity.

Template Parameters

  Evt | The event to emit.

Definition at line 45 of file entity_view.inl.

## ◆ emit() [4/8]

template<typename Evt, if_not_t< is_empty< Evt >::value > = 0>

void emit | ( | const Evt & | payload | ) | const
| inline

Emit event with payload for entity.

Template Parameters

  Evt | The event to emit.

Definition at line 46 of file entity_view.hpp.

## ◆ emit() [5/8]

void emit | ( | flecs::entity | evt | ) | const

Emit event for entity.

Parameters

  evt | The event to emit.

## ◆ emit() [6/8]

void flecs::entity_view::emit | ( | flecs::entity | evt | ) | const
| inline

Emit event for entity.

Parameters

  evt | The event to emit.

Definition at line 96 of file impl.hpp.

## ◆ emit() [7/8]

void emit | ( | flecs::entity_t | evt | ) | const

Emit event for entity.

Parameters

  evt | The event to emit.

Definition at line 12 of file entity_view.inl.

## ◆ emit() [8/8]

void emit | ( | flecs::entity_t | evt | ) | const
| inline

Emit event for entity.

Parameters

  evt | The event to emit.

Definition at line 13 of file entity_view.hpp.

## ◆ enabled() [1/6]

bool flecs::entity_view::enabled | ( |  | ) | const
| inline

Definition at line 116 of file entity_view.hpp.

## ◆ enabled() [2/6]

template<typename T>

bool flecs::entity_view::enabled | ( |  | ) | const
| inline

Test if component is enabled.

Template Parameters

  T | The component to test.

Returns
  True if enabled, false if not.

Definition at line 1086 of file entity_view.hpp.

## ◆ enabled() [3/6]

template<typename First, typename Second>

bool flecs::entity_view::enabled | ( |  | ) | const
| inline

Test if pair is enabled.

Template Parameters

  First | The first element of the pair.
  Second | The second element of the pair.

Returns
  True if enabled, false if not.

Definition at line 1118 of file entity_view.hpp.

## ◆ enabled() [4/6]

bool flecs::entity_view::enabled | ( | flecs::id_t | first,
|  | flecs::id_t | second ) const
| inline

Test if pair is enabled.

Parameters

  first | The first element of the pair.
  second | The second element of the pair.

Returns
  True if enabled, false if not.

Definition at line 1096 of file entity_view.hpp.

## ◆ enabled() [5/6]

bool flecs::entity_view::enabled | ( | flecs::id_t | id | ) | const
| inline

Test if id is enabled.

Parameters

  id | The id to test.

Returns
  True if enabled, false if not.

Definition at line 1076 of file entity_view.hpp.

## ◆ enabled() [6/6]

template<typename First>

bool flecs::entity_view::enabled | ( | flecs::id_t | second | ) | const
| inline

Test if pair is enabled.

Template Parameters

  First | The first element of the pair.

Parameters

  second | The second element of the pair.

Returns
  True if enabled, false if not.

Definition at line 1107 of file entity_view.hpp.

## ◆ enqueue() [1/8]

template<typename Evt, if_t< is_empty< Evt >::value > = 0>

void enqueue | ( |  | ) | const

Enqueue event for entity.

Template Parameters

  Evt | The event to enqueue.

Definition at line 82 of file entity_view.inl.

## ◆ enqueue() [2/8]

template<typename Evt, if_t< is_empty< Evt >::value > = 0>

void enqueue | ( |  | ) | const
| inline

Enqueue event for entity.

Template Parameters

  Evt | The event to enqueue.

Definition at line 83 of file entity_view.hpp.

## ◆ enqueue() [3/8]

template<typename Evt, if_not_t< is_empty< Evt >::value > = 0>

void enqueue | ( | const Evt & | payload | ) | const

Enqueue event with payload for entity.

Template Parameters

  Evt | The event to enqueue.

Definition at line 93 of file entity_view.inl.

## ◆ enqueue() [4/8]

template<typename Evt, if_not_t< is_empty< Evt >::value > = 0>

void enqueue | ( | const Evt & | payload | ) | const
| inline

Enqueue event with payload for entity.

Template Parameters

  Evt | The event to enqueue.

Definition at line 94 of file entity_view.hpp.

## ◆ enqueue() [5/8]

void enqueue | ( | flecs::entity | evt | ) | const

Enqueue event for entity.

Parameters

  evt | The event to enqueue.

## ◆ enqueue() [6/8]

void flecs::entity_view::enqueue | ( | flecs::entity | evt | ) | const
| inline

Enqueue event for entity.

Parameters

  evt | The event to enqueue.

Definition at line 100 of file impl.hpp.

## ◆ enqueue() [7/8]

void enqueue | ( | flecs::entity_t | evt | ) | const

Enqueue event for entity.

Parameters

  evt | The event to enqueue.

Definition at line 60 of file entity_view.inl.

## ◆ enqueue() [8/8]

void enqueue | ( | flecs::entity_t | evt | ) | const
| inline

Enqueue event for entity.

Parameters

  evt | The event to enqueue.

Definition at line 61 of file entity_view.hpp.

## ◆ get() [1/8]

template<typename T, if_t< is_actual< T >::value > = 0>

const T & flecs::entity_view::get | ( |  | ) | const
| inline

Get component value.

Template Parameters

  T | The component to get.

Returns
  Ref to the component value, panics if the entity does not have the component.

Definition at line 397 of file entity_view.hpp.

## ◆ get() [2/8]

template<typename T, typename A = actual_type_t<T>, if_t< flecs::is_pair< T >::value > = 0>

const A & flecs::entity_view::get | ( |  | ) | const
| inline

Get component value.

Overload for when T is not the same as the actual type, which happens when using pair types.

Template Parameters

  T | The component to get.

Returns
  Ref to the component value, panics if the entity does not have the component.

Definition at line 414 of file entity_view.hpp.

## ◆ get() [3/8]

template<typename First, typename Second, typename P = pair<First, Second>, typename A = actual_type_t<P>, if_not_t< flecs::is_pair< First >::value > = 0>

const A & flecs::entity_view::get | ( |  | ) | const
| inline

Get a pair.

This operation gets the value for a pair from the entity.

Template Parameters

  First | The first element of the pair.
  Second | the second element of a pair.

Returns
  Ref to the component value, panics if the entity does not have the component.

Definition at line 431 of file entity_view.hpp.

## ◆ get() [4/8]

template<typename Func, if_t< is_callable< Func >::value >>

bool flecs::entity_view::get | ( | const Func & | func | ) | const
| inline

Get 1..N components.

This operation accepts a callback with as arguments the components to retrieve. The callback will only be invoked when the entity has all the components.

This operation is faster than individually calling get for each component as it only obtains entity metadata once.

While the callback is invoked the table in which the components are stored is locked, which prevents mutations that could cause invalidation of the component references. Note that this is not an actual lock: invalid access causes a runtime panic and so it is still up to the application to ensure access is protected.

The component arguments must be references and can be either const or non-const. When all arguments are const, the function will read-lock the table (see ecs_read_begin). If one or more arguments are non-const the function will write-lock the table (see ecs_write_begin).

Example:

e.get([](Position& p, Velocity& v) { // write lock
p.x += v.x;
});
e.get([](const Position& p) { // read lock
std::cout << p.x << std::endl;
});

Parameters

  func | The callback to invoke.

Returns
  True if the entity has all components, false if not.

Definition at line 168 of file impl.hpp.

## ◆ get() [5/8]

const void * flecs::entity_view::get | ( | flecs::entity_t | first,
|  | flecs::entity_t | second ) const
| inline

Get a pair (untyped).

This operation gets the value for a pair from the entity. If neither the first nor the second part of the pair are components, the operation will fail.

Parameters

  first | The first element of the pair.
  second | The second element of the pair.

Returns
  Pointer to the component value, panics if the entity does not have the component.

Definition at line 489 of file entity_view.hpp.

## ◆ get() [6/8]

const void * flecs::entity_view::get | ( | flecs::id_t | comp | ) | const
| inline

Get component value (untyped).

Parameters

  comp | The component to get.

Returns
  Pointer to the component value, panics if the entity does not have the component.

Definition at line 472 of file entity_view.hpp.

## ◆ get() [7/8]

template<typename First, typename Second, if_t< is_enum< Second >::value &&!std::is_same< First, Second >::value > = 0>

const First & flecs::entity_view::get | ( | Second | constant | ) | const
| inline

Get a pair.

This operation gets the value for a pair from the entity.

Template Parameters

  First | The first element of the pair.

Parameters

  constant | the enum constant.

Returns
  Ref to the component value, panics if the entity does not have the component.

Definition at line 460 of file entity_view.hpp.

## ◆ get() [8/8]

template<typename First, typename Second, if_not_t< is_enum< Second >::value > = 0>

const First & flecs::entity_view::get | ( | Second | second | ) | const
| inline

Get a pair.

This operation gets the value for a pair from the entity.

Template Parameters

  First | The first element of the pair.

Parameters

  second | The second element of the pair.

Returns
  Ref to the component value, panics if the entity does not have the component.

Definition at line 444 of file entity_view.hpp.

## ◆ get_constant()

template<typename Enum>

Enum flecs::entity_view::get_constant | ( |  | ) | const
| inline

Get enum constant for enum relationship.

Definition at line 30 of file impl.hpp.

## ◆ get_mut() [1/7]

template<typename T, if_t< is_actual< T >::value > = 0>

T & flecs::entity_view::get_mut | ( |  | ) | const
| inline

Get mutable component value.

Template Parameters

  T | The component to get.

Returns
  Pointer to the component value, nullptr if the entity does not have the component.

Definition at line 701 of file entity_view.hpp.

## ◆ get_mut() [2/7]

template<typename T, typename A = actual_type_t<T>, if_t< flecs::is_pair< T >::value > = 0>

A & flecs::entity_view::get_mut | ( |  | ) | const
| inline

Get mutable component value.

Overload for when T is not the same as the actual type, which happens when using pair types.

Template Parameters

  T | The component to get.

Returns
  Pointer to the component value, nullptr if the entity does not have the component.

Definition at line 718 of file entity_view.hpp.

## ◆ get_mut() [3/7]

template<typename First, typename Second, typename P = pair<First, Second>, typename A = actual_type_t<P>, if_not_t< flecs::is_pair< First >::value > = 0>

A & flecs::entity_view::get_mut | ( |  | ) | const
| inline

Get a mutable pair.

This operation gets the value for a pair from the entity.

Template Parameters

  First | The first element of the pair.
  Second | the second element of a pair.

Definition at line 733 of file entity_view.hpp.

## ◆ get_mut() [4/7]

void * flecs::entity_view::get_mut | ( | flecs::entity_t | first,
|  | flecs::entity_t | second ) const
| inline

Get a mutable pair (untyped).

This operation gets the value for a pair from the entity. If neither the first nor the second part of the pair are components, the operation will fail.

Parameters

  first | The first element of the pair.
  second | The second element of the pair.

Definition at line 788 of file entity_view.hpp.

## ◆ get_mut() [5/7]

void * flecs::entity_view::get_mut | ( | flecs::id_t | comp | ) | const
| inline

Get mutable component value (untyped).

Parameters

  comp | The component to get.

Returns
  Pointer to the component value, nullptr if the entity does not have the component.

Definition at line 773 of file entity_view.hpp.

## ◆ get_mut() [6/7]

template<typename First, typename Second, if_t< is_enum< Second >::value &&!std::is_same< First, Second >::value > = 0>

First & flecs::entity_view::get_mut | ( | Second | constant | ) | const
| inline

Get a mutable pair.

This operation gets the value for a pair from the entity.

Template Parameters

  First | The first element of the pair.

Parameters

  constant | the enum constant.

Definition at line 761 of file entity_view.hpp.

## ◆ get_mut() [7/7]

template<typename First, typename Second, if_not_t< is_enum< Second >::value > = 0>

First & flecs::entity_view::get_mut | ( | Second | second | ) | const
| inline

Get a mutable pair.

This operation gets the value for a pair from the entity.

Template Parameters

  First | The first element of the pair.

Parameters

  second | The second element of the pair.

Definition at line 747 of file entity_view.hpp.

## ◆ get_mut_second() [1/2]

template<typename First, typename Second>

Second * flecs::entity_view::get_mut_second | ( |  | ) | const
| inline

Get the second part for a pair.

This operation gets the value for a pair from the entity. The first part of the pair should not be a component.

Template Parameters

  First | The first element of the pair.
  Second | the second element of a pair.

Definition at line 818 of file entity_view.hpp.

## ◆ get_mut_second() [2/2]

template<typename Second>

Second & flecs::entity_view::get_mut_second | ( | flecs::entity_t | first | ) | const
| inline

Get the second part for a pair.

This operation gets the value for a pair from the entity. The first part of the pair should not be a component.

Template Parameters

  Second | the second element of a pair.

Parameters

  first | The first part of the pair.

Definition at line 803 of file entity_view.hpp.

## ◆ get_second() [1/2]

template<typename First, typename Second>

const Second & flecs::entity_view::get_second | ( |  | ) | const
| inline

Get the second part for a pair.

This operation gets the value for a pair from the entity. The first part of the pair should not be a component.

Template Parameters

  First | The first element of the pair.
  Second | the second element of a pair.

Definition at line 556 of file entity_view.hpp.

## ◆ get_second() [2/2]

template<typename Second>

const Second & flecs::entity_view::get_second | ( | flecs::entity_t | first | ) | const
| inline

Get the second part for a pair.

This operation gets the value for a pair from the entity. The first part of the pair should not be a component.

Template Parameters

  Second | the second element of a pair.

Parameters

  first | The first part of the pair.

Definition at line 541 of file entity_view.hpp.

## ◆ has() [1/7]

template<typename T>

bool flecs::entity_view::has | ( |  | ) | const
| inline

Check if entity has the provided component.

Template Parameters

  T | The component to check.

Returns
  True if the entity has the provided component, false otherwise.

Definition at line 927 of file entity_view.hpp.

## ◆ has() [2/7]

template<typename First, typename Second>

bool flecs::entity_view::has | ( |  | ) | const
| inline

Check if entity has the provided pair.

Template Parameters

  First | The first element of the pair.
  Second | The second element of the pair.

Returns
  True if the entity has the provided component, false otherwise.

Definition at line 964 of file entity_view.hpp.

## ◆ has() [3/7]

template<typename E, if_t< is_enum< E >::value > = 0>

bool flecs::entity_view::has | ( | E | value | ) | const
| inline

Check if entity has the provided enum constant.

Template Parameters

  E | The enum type (can be deduced).

Parameters

  value | The enum constant to check.

Returns
  True if the entity has the provided constant, false otherwise.

Definition at line 948 of file entity_view.hpp.

## ◆ has() [4/7]

template<typename First, typename E, if_t< is_enum< E >::value &&!std::is_same< First, E >::value > = 0>

bool flecs::entity_view::has | ( | E | value | ) | const
| inline

Check if entity has the provided pair.

Template Parameters

  First | The first element of the pair.

Parameters

  value | The enum constant.

Returns
  True if the entity has the provided component, false otherwise.

Definition at line 998 of file entity_view.hpp.

## ◆ has() [5/7]

bool flecs::entity_view::has | ( | flecs::id_t | e | ) | const
| inline

Check if entity has the provided entity.

Parameters

  e | The entity to check.

Returns
  True if the entity has the provided entity, false otherwise.

Definition at line 917 of file entity_view.hpp.

## ◆ has() [6/7]

bool flecs::entity_view::has | ( | flecs::id_t | first,
|  | flecs::id_t | second ) const
| inline

Check if entity has the provided pair.

Parameters

  first | The first element of the pair.
  second | The second element of the pair.

Returns
  True if the entity has the provided component, false otherwise.

Definition at line 1010 of file entity_view.hpp.

## ◆ has() [7/7]

template<typename First, typename Second, if_not_t< is_enum< Second >::value > = 0>

bool flecs::entity_view::has | ( | Second | second | ) | const
| inline

Check if entity has the provided pair.

Template Parameters

  First | The first element of the pair.

Parameters

  second | The second element of the pair.

Returns
  True if the entity has the provided component, false otherwise.

Definition at line 975 of file entity_view.hpp.

## ◆ has_second()

template<typename Second>

bool flecs::entity_view::has_second | ( | flecs::entity_t | first | ) | const
| inline

Check if entity has the provided pair.

Template Parameters

  Second | The second element of the pair.

Parameters

  first | The first element of the pair.

Returns
  True if the entity has the provided component, false otherwise.

Definition at line 987 of file entity_view.hpp.

## ◆ id()

entity_t flecs::entity_view::id | ( |  | ) | const
| inline

Get entity id.

Returns
  The integer entity id.

Definition at line 50 of file entity_view.hpp.

## ◆ is_alive()

bool flecs::entity_view::is_alive | ( |  | ) | const
| inline

Check if entity is alive.

Returns
  True if the entity is alive, false otherwise.

Definition at line 70 of file entity_view.hpp.

## ◆ is_valid()

bool flecs::entity_view::is_valid | ( |  | ) | const
| inline

Check if entity is valid.

Returns
  True if the entity is alive, false otherwise.

Definition at line 58 of file entity_view.hpp.

## ◆ lookup()

flecs::entity flecs::entity_view::lookup | ( | const char * | path,
|  | bool | search_path = false ) const
| inline

Lookup an entity by name.

Lookup an entity in the scope of this entity. The provided path may contain double colons as scope separators, for example: "Foo::Bar".

Parameters

  path | The name of the entity to lookup.
  search_path | When false, only the entity's scope is searched.

Returns
  The found entity, or entity::null if no entity matched.

Definition at line 172 of file impl.hpp.

## ◆ mut() [1/3]

flecs::entity flecs::entity_view::mut | ( | const flecs::entity_view & | e | ) | const
| inline

Same as mut(world), but for entity.

This operation allows for the construction of a mutable entity handle from another entity. This is useful in each() functions, which only provide a handle to the entity being iterated over.

Parameters

  e | Another mutable entity.

Returns
  An entity handle that allows for mutations in the current stage.

Definition at line 84 of file impl.hpp.

## ◆ mut() [2/3]

flecs::entity flecs::entity_view::mut | ( | const flecs::iter & | it | ) | const
| inline

Same as mut(world), but for iterator.

This operation allows for the construction of a mutable entity handle from an iterator.

Parameters

  it | An iterator that contains a reference to the world or stage.

Returns
  An entity handle that allows for mutations in the current stage.

Definition at line 78 of file impl.hpp.

## ◆ mut() [3/3]

flecs::entity flecs::entity_view::mut | ( | const flecs::world & | stage | ) | const
| inline

Return mutable entity handle for current stage When an entity handle created from the world is used while the world is in staged mode, it will only allow for readonly operations since structural changes are not allowed on the world while in staged mode.

To do mutations on the entity, this operation provides a handle to the entity that uses the stage instead of the actual world.

Note that staged entity handles should never be stored persistently, in components or elsewhere. An entity handle should always point to the main world.

Also note that this operation is not necessary when doing mutations on an entity outside of a system. It is allowed to do entity operations directly on the world, as long as the world is not in staged mode.

Parameters

  stage | The current stage.

Returns
  An entity handle that allows for mutations in the current stage.

Definition at line 72 of file impl.hpp.

## ◆ name()

flecs::string_view flecs::entity_view::name | ( |  | ) | const
| inline

Return the entity name.

Returns
  The entity name.

Definition at line 78 of file entity_view.hpp.

## ◆ operator bool()

flecs::entity_view::operator bool | ( |  | ) | const
| inlineexplicit

Definition at line 62 of file entity_view.hpp.

## ◆ owns() [1/5]

template<typename T>

bool flecs::entity_view::owns | ( |  | ) | const
| inline

Check if entity owns the provided component.

An component is owned if it is not shared from a base entity.

Template Parameters

  T | The component to check.

Returns
  True if the entity owns the provided component, false otherwise.

Definition at line 1053 of file entity_view.hpp.

## ◆ owns() [2/5]

template<typename First, typename Second>

bool flecs::entity_view::owns | ( |  | ) | const
| inline

Check if entity owns the provided pair.

An pair is owned if it is not shared from a base entity.

Template Parameters

  First | The first element of the pair.
  Second | The second element of the pair.

Returns
  True if the entity owns the provided pair, false otherwise.

Definition at line 1065 of file entity_view.hpp.

## ◆ owns() [3/5]

bool flecs::entity_view::owns | ( | flecs::id_t | e | ) | const
| inline

Check if entity owns the provided entity.

An entity is owned if it is not shared from a base entity.

Parameters

  e | The entity to check.

Returns
  True if the entity owns the provided entity, false otherwise.

Definition at line 1020 of file entity_view.hpp.

## ◆ owns() [4/5]

bool flecs::entity_view::owns | ( | flecs::id_t | first,
|  | flecs::id_t | second ) const
| inline

Check if entity owns the provided pair.

Parameters

  first | The first element of the pair.
  second | The second element of the pair.

Returns
  True if the entity owns the provided component, false otherwise.

Definition at line 1042 of file entity_view.hpp.

## ◆ owns() [5/5]

template<typename First>

bool flecs::entity_view::owns | ( | flecs::id_t | second | ) | const
| inline

Check if entity owns the provided pair.

Template Parameters

  First | The first element of the pair.

Parameters

  second | The second element of the pair.

Returns
  True if the entity owns the provided component, false otherwise.

Definition at line 1031 of file entity_view.hpp.

## ◆ parent()

flecs::entity flecs::entity_view::parent | ( |  | ) | const
| inline

Get parent of entity.

Short for target(flecs::ChildOf).

Returns
  The parent of the entity.

Definition at line 68 of file impl.hpp.

## ◆ path()

flecs::string flecs::entity_view::path | ( | const char * | sep = "::",
|  | const char * | init_sep = "::" ) const
| inline

Return the entity path.

Returns
  The hierarchical entity path.

Definition at line 94 of file entity_view.hpp.

## ◆ path_from() [1/2]

template<typename Parent>

flecs::string flecs::entity_view::path_from | ( | const char * | sep = "::",
|  | const char * | init_sep = "::" ) const
| inline

Return the entity path relative to a parent.

Returns
  The relative hierarchical entity path.

Definition at line 112 of file entity_view.hpp.

## ◆ path_from() [2/2]

flecs::string flecs::entity_view::path_from | ( | flecs::entity_t | parent,
|  | const char * | sep = "::",
|  | const char * | init_sep = "::" ) const
| inline

Return the entity path relative to a parent.

Returns
  The relative hierarchical entity path.

Definition at line 102 of file entity_view.hpp.

## ◆ range()

flecs::table_range flecs::entity_view::range | ( |  | ) | const
| inline

Get table range for the entity.

Returns a range with the entity's row as offset and count set to 1. If the entity is not stored in a table, the function returns a range with count 0.

Returns
  Returns the entity's table range.

Definition at line 102 of file impl.hpp.

## ◆ symbol()

flecs::string_view flecs::entity_view::symbol | ( |  | ) | const
| inline

Return the entity symbol.

Returns
  The entity symbol.

Definition at line 86 of file entity_view.hpp.

## ◆ table()

flecs::table flecs::entity_view::table | ( |  | ) | const
| inline

Get the entity's table.

Returns
  Returns the entity's table.

Definition at line 98 of file impl.hpp.

## ◆ target() [1/2]

flecs::entity flecs::entity_view::target | ( | flecs::entity_t | first,
|  | int32_t | index = 0 ) const
| inline

Get target for a given pair.

This operation returns the target for a given pair. The optional index can be used to iterate through targets, in case the entity has multiple instances for the same relationship.

Parameters

  first | The first element of the pair for which to retrieve the target.
  index | The index (0 for the first instance of the relationship).

Definition at line 42 of file impl.hpp.

## ◆ target() [2/2]

template<typename First>

flecs::entity flecs::entity_view::target | ( | int32_t | index = 0 | ) | const
| inline

Get target for a given pair.

This operation returns the target for a given pair. The optional index can be used to iterate through targets, in case the entity has multiple instances for the same relationship.

Template Parameters

  First | The first element of the pair.

Parameters

  index | The index (0 for the first instance of the relationship).

Definition at line 36 of file impl.hpp.

## ◆ target_for() [1/3]

template<typename T>

flecs::entity flecs::entity_view::target_for | ( | flecs::entity_t | relationship | ) | const
| inline

Definition at line 59 of file impl.hpp.

## ◆ target_for() [2/3]

template<typename First, typename Second>

flecs::entity flecs::entity_view::target_for | ( | flecs::entity_t | relationship | ) | const
| inline

Definition at line 64 of file impl.hpp.

## ◆ target_for() [3/3]

flecs::entity flecs::entity_view::target_for | ( | flecs::entity_t | relationship,
|  | flecs::id_t | id ) const
| inline

Get the target of a pair for a given relationship id.

This operation returns the first entity that has the provided id by following the specified relationship. If the entity itself has the id then entity will be returned. If the id cannot be found on the entity or by following the relationship, the operation will return 0.

This operation can be used to lookup, for example, which prefab is providing a component by specifying the IsA pair:

// Is Position provided by the entity or one of its base entities?
ecs_get_target_for_id(world, entity, EcsIsA, ecs_id(Position))
EcsIsA
const ecs_entity_t EcsIsA
Used to express inheritance relationships.
ecs_id
FLECS_API const ecs_entity_t ecs_id(EcsDocDescription)
Component id for EcsDocDescription.
ecs_get_target_for_id
ecs_entity_t ecs_get_target_for_id(const ecs_world_t *world, ecs_entity_t entity, ecs_entity_t rel, ecs_id_t id)
Get the target of a relationship for a given id.
flecs::id::entity
flecs::entity entity() const
Return id as entity (only allowed when id is valid entity)
Definition impl.hpp:10

Parameters

  relationship | The relationship to follow.
  id | The id to lookup.

Returns
  The entity for which the target has been found.

Definition at line 50 of file impl.hpp.

## ◆ to_json()

flecs::string to_json | ( | const flecs::entity_to_json_desc_t * | desc = nullptr | ) | const

Serialize entity to JSON.

Definition at line 11 of file entity_view.inl.

## ◆ try_get() [1/7]

template<typename T, if_t< is_actual< T >::value > = 0>

const T * flecs::entity_view::try_get | ( |  | ) | const
| inline

Get component value.

Template Parameters

  T | The component to get.

Returns
  Pointer to the component value, nullptr if the entity does not have the component.

Definition at line 269 of file entity_view.hpp.

## ◆ try_get() [2/7]

template<typename T, typename A = actual_type_t<T>, if_t< flecs::is_pair< T >::value > = 0>

const A * flecs::entity_view::try_get | ( |  | ) | const
| inline

Get component value.

Overload for when T is not the same as the actual type, which happens when using pair types.

Template Parameters

  T | The component to get.

Returns
  Pointer to the component value, nullptr if the entity does not have the component.

Definition at line 286 of file entity_view.hpp.

## ◆ try_get() [3/7]

template<typename First, typename Second, typename P = pair<First, Second>, typename A = actual_type_t<P>, if_not_t< flecs::is_pair< First >::value > = 0>

const A * flecs::entity_view::try_get | ( |  | ) | const
| inline

Get a pair.

This operation gets the value for a pair from the entity.

Template Parameters

  First | The first element of the pair.
  Second | the second element of a pair.

Definition at line 301 of file entity_view.hpp.

## ◆ try_get() [4/7]

const void * flecs::entity_view::try_get | ( | flecs::entity_t | first,
|  | flecs::entity_t | second ) const
| inline

Get a pair (untyped).

This operation gets the value for a pair from the entity. If neither the first nor the second part of the pair are components, the operation will fail.

Parameters

  first | The first element of the pair.
  second | The second element of the pair.

Definition at line 351 of file entity_view.hpp.

## ◆ try_get() [5/7]

const void * flecs::entity_view::try_get | ( | flecs::id_t | comp | ) | const
| inline

Get component value (untyped).

Parameters

  comp | The component to get.

Returns
  Pointer to the component value, nullptr if the entity does not have the component.

Definition at line 339 of file entity_view.hpp.

## ◆ try_get() [6/7]

template<typename First, typename Second, if_t< is_enum< Second >::value &&!std::is_same< First, Second >::value > = 0>

const First * flecs::entity_view::try_get | ( | Second | constant | ) | const
| inline

Get a pair.

This operation gets the value for a pair from the entity.

Template Parameters

  First | The first element of the pair.

Parameters

  constant | the enum constant.

Definition at line 327 of file entity_view.hpp.

## ◆ try_get() [7/7]

template<typename First, typename Second, if_not_t< is_enum< Second >::value > = 0>

const First * flecs::entity_view::try_get | ( | Second | second | ) | const
| inline

Get a pair.

This operation gets the value for a pair from the entity.

Template Parameters

  First | The first element of the pair.

Parameters

  second | The second element of the pair.

Definition at line 312 of file entity_view.hpp.

## ◆ try_get_mut() [1/7]

template<typename T, if_t< is_actual< T >::value > = 0>

T * flecs::entity_view::try_get_mut | ( |  | ) | const
| inline

Get mutable component value.

Template Parameters

  T | The component to get.

Returns
  Pointer to the component value, nullptr if the entity does not have the component.

Definition at line 573 of file entity_view.hpp.

## ◆ try_get_mut() [2/7]

template<typename T, typename A = actual_type_t<T>, if_t< flecs::is_pair< T >::value > = 0>

A * flecs::entity_view::try_get_mut | ( |  | ) | const
| inline

Get mutable component value.

Overload for when T is not the same as the actual type, which happens when using pair types.

Template Parameters

  T | The component to get.

Returns
  Pointer to the component value, nullptr if the entity does not have the component.

Definition at line 590 of file entity_view.hpp.

## ◆ try_get_mut() [3/7]

template<typename First, typename Second, typename P = pair<First, Second>, typename A = actual_type_t<P>, if_not_t< flecs::is_pair< First >::value > = 0>

A * flecs::entity_view::try_get_mut | ( |  | ) | const
| inline

Get a mutable pair.

This operation gets the value for a pair from the entity.

Template Parameters

  First | The first element of the pair.
  Second | the second element of a pair.

Definition at line 605 of file entity_view.hpp.

## ◆ try_get_mut() [4/7]

void * flecs::entity_view::try_get_mut | ( | flecs::entity_t | first,
|  | flecs::entity_t | second ) const
| inline

Get a mutable pair (untyped).

This operation gets the value for a pair from the entity. If neither the first nor the second part of the pair are components, the operation will fail.

Parameters

  first | The first element of the pair.
  second | The second element of the pair.

Definition at line 655 of file entity_view.hpp.

## ◆ try_get_mut() [5/7]

void * flecs::entity_view::try_get_mut | ( | flecs::id_t | comp | ) | const
| inline

Get mutable component value (untyped).

Parameters

  comp | The component to get.

Returns
  Pointer to the component value, nullptr if the entity does not have the component.

Definition at line 643 of file entity_view.hpp.

## ◆ try_get_mut() [6/7]

template<typename First, typename Second, if_t< is_enum< Second >::value &&!std::is_same< First, Second >::value > = 0>

First * flecs::entity_view::try_get_mut | ( | Second | constant | ) | const
| inline

Get a mutable pair.

This operation gets the value for a pair from the entity.

Template Parameters

  First | The first element of the pair.

Parameters

  constant | the enum constant.

Definition at line 631 of file entity_view.hpp.

## ◆ try_get_mut() [7/7]

template<typename First, typename Second, if_not_t< is_enum< Second >::value > = 0>

First * flecs::entity_view::try_get_mut | ( | Second | second | ) | const
| inline

Get a mutable pair.

This operation gets the value for a pair from the entity.

Template Parameters

  First | The first element of the pair.

Parameters

  second | The second element of the pair.

Definition at line 616 of file entity_view.hpp.

## ◆ try_get_mut_second() [1/2]

template<typename First, typename Second>

Second * flecs::entity_view::try_get_mut_second | ( |  | ) | const
| inline

Get the second part for a pair.

This operation gets the value for a pair from the entity. The first part of the pair should not be a component.

Template Parameters

  First | The first element of the pair.
  Second | the second element of a pair.

Definition at line 687 of file entity_view.hpp.

## ◆ try_get_mut_second() [2/2]

template<typename Second>

Second * flecs::entity_view::try_get_mut_second | ( | flecs::entity_t | first | ) | const
| inline

Get the second part for a pair.

This operation gets the value for a pair from the entity. The first part of the pair should not be a component.

Template Parameters

  Second | the second element of a pair.

Parameters

  first | The first part of the pair.

Definition at line 667 of file entity_view.hpp.

## ◆ try_get_second() [1/2]

template<typename First, typename Second>

const Second * flecs::entity_view::try_get_second | ( |  | ) | const
| inline

Get the second part for a pair.

This operation gets the value for a pair from the entity. The first part of the pair should not be a component.

Template Parameters

  First | The first element of the pair.
  Second | the second element of a pair.

Definition at line 383 of file entity_view.hpp.

## ◆ try_get_second() [2/2]

template<typename Second>

const Second * flecs::entity_view::try_get_second | ( | flecs::entity_t | first | ) | const
| inline

Get the second part for a pair.

This operation gets the value for a pair from the entity. The first part of the pair should not be a component.

Template Parameters

  Second | the second element of a pair.

Parameters

  first | The first part of the pair.

Definition at line 363 of file entity_view.hpp.

## ◆ type()

flecs::type flecs::entity_view::type | ( |  | ) | const
| inline

Get the entity's type.

Returns
  The entity's type.

Definition at line 94 of file impl.hpp.

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

- include/flecs/addons/cpp/entity_view.hpp
- include/flecs/addons/cpp/mixins/alerts/entity_view.inl
- include/flecs/addons/cpp/mixins/doc/entity_view.inl
- include/flecs/addons/cpp/mixins/entity/impl.hpp
- include/flecs/addons/cpp/mixins/enum/entity_view.inl
- include/flecs/addons/cpp/mixins/enum/impl.hpp
- include/flecs/addons/cpp/mixins/event/entity_view.inl
- include/flecs/addons/cpp/mixins/event/impl.hpp
- include/flecs/addons/cpp/mixins/json/entity_view.inl
- include/flecs/addons/cpp/mixins/meta/entity_builder.inl