Flecs v3.2
A fast entity component system (ECS) for C & C++
Loading...
Searching...
No Matches
flecs::entity Struct Reference

Entity. More...

#include <entity.hpp>

Inheritance diagram for flecs::entity:
[legend]

Public Member Functions

 entity (world_t *world)
 Create entity.
 
 entity (const flecs::world_t *world, flecs::entity_t id)
 Wrap an existing entity id.
 
 entity (world_t *world, const char *name)
 Create a named entity.
 
 entity (entity_t id)
 Conversion from flecs::entity_t to flecs::entity.
 
template<typename T >
T & ensure () const
 Get mutable component value.
 
void * ensure (entity_t comp) const
 Get mutable component value (untyped).
 
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 & ensure () const
 Get mutable pointer for a pair.
 
template<typename First >
First & ensure (entity_t second) const
 Get mutable pointer for the first element of a pair.
 
void * ensure (entity_t first, entity_t second) const
 Get mutable pointer for a pair (untyped).
 
template<typename Second >
Second & ensure_second (entity_t first) const
 Get mutable pointer for the second element of a pair.
 
template<typename T >
void modified () const
 Signal that component was modified.
 
template<typename First , typename Second >
void modified () const
 Signal that the first element of a pair was modified.
 
template<typename First >
void modified (entity_t second) const
 Signal that the first part of a pair was modified.
 
void modified (entity_t first, entity_t second) const
 Signal that a pair has modified (untyped).
 
void modified (entity_t comp) const
 Signal that component was modified.
 
template<typename T , if_t< is_actual< T >::value > = 0>
ref< T > get_ref () const
 Get reference to component.
 
template<typename T , typename A = actual_type_t<T>, if_t< flecs::is_pair< T >::value > = 0>
ref< A > get_ref () const
 Get reference to component.
 
template<typename First , typename Second , typename P = flecs::pair<First, Second>, typename A = actual_type_t<P>>
ref< A > get_ref () const
 
template<typename First >
ref< First > get_ref (flecs::entity_t second) const
 
template<typename Second >
ref< Second > get_ref_second (flecs::entity_t first) const
 
void flatten (flecs::entity_t r, const ecs_flatten_desc_t *desc=nullptr)
 Recursively flatten relationship.
 
void clear () const
 Clear an entity.
 
void destruct () const
 Delete an entity.
 
flecs::entity_view view () const
 Return entity as entity_view.
 
const char * from_json (const char *json)
 Deserialize entity to JSON.
 
- Public Member Functions inherited from flecs::entity_builder< entity >
entityadd ()
 Add a component to an entity.
 
entityadd (E value)
 Add pair for enum constant.
 
entityadd (id_t component)
 Add an entity to an entity.
 
entityadd (entity_t first, entity_t second)
 Add a pair.
 
entityadd ()
 Add a pair.
 
entityadd (Second second)
 Add a pair.
 
entityadd (Second constant)
 Add a pair.
 
entityadd_second (flecs::entity_t first)
 Add a pair.
 
entityadd_if (bool cond, flecs::id_t component)
 Conditional add.
 
entityadd_if (bool cond)
 Conditional add.
 
entityadd_if (bool cond, flecs::entity_t first, flecs::entity_t second)
 Conditional add.
 
entityadd_if (bool cond, flecs::entity_t second)
 Conditional add.
 
entityadd_if (bool cond)
 Conditional add.
 
entityadd_if (bool cond, E constant)
 Conditional add.
 
entityis_a (entity_t second)
 Shortcut for add(IsA, entity).
 
entityis_a ()
 Shortcut for add(IsA, entity).
 
entitychild_of (entity_t second)
 Shortcut for add(ChildOf, entity).
 
entitychild_of ()
 Shortcut for add(ChildOf, entity).
 
entitydepends_on (entity_t second)
 Shortcut for add(DependsOn, entity).
 
entitydepends_on (E second)
 Shortcut for add(DependsOn, entity).
 
entitydepends_on ()
 Shortcut for add(DependsOn, entity).
 
entityslot_of (entity_t second)
 Shortcut for add(SlotOf, entity).
 
entityslot_of ()
 Shortcut for add(SlotOf, entity).
 
entityslot ()
 Shortcut for add(SlotOf, target(ChildOf)).
 
entityremove ()
 Remove a component from an entity.
 
entityremove ()
 Remove pair for enum.
 
entityremove (entity_t entity)
 Remove an entity from an entity.
 
entityremove (entity_t first, entity_t second)
 Remove a pair.
 
entityremove ()
 Removes a pair.
 
entityremove (Second second)
 Remove a pair.
 
entityremove (Second constant)
 Remove a pair.
 
entityremove_second (flecs::entity_t first)
 Removes a pair.
 
entityoverride (flecs::id_t id)
 Mark id for auto-overriding.
 
entityoverride (flecs::entity_t first, flecs::entity_t second)
 Mark pair for auto-overriding.
 
entityoverride ()
 Mark component for auto-overriding.
 
entityoverride (flecs::entity_t second)
 Mark pair for auto-overriding.
 
entityoverride ()
 Mark pair for auto-overriding.
 
entityset_override (const T &val)
 Set component, mark component for auto-overriding.
 
entityset_override (T &&val)
 Set component, mark component for auto-overriding.
 
entityset_override (flecs::entity_t second, const First &val)
 Set pair, mark component for auto-overriding.
 
entityset_override (flecs::entity_t second, First &&val)
 Set pair, mark component for auto-overriding.
 
entityset_override (const A &val)
 Set component, mark component for auto-overriding.
 
entityset_override (A &&val)
 Set component, mark component for auto-overriding.
 
entityemplace_override (Args &&... args)
 Emplace component, mark component for auto-overriding.
 
entityemplace_override (Args &&... args)
 Emplace pair, mark pair for auto-overriding.
 
entityenable ()
 Enable an entity.
 
entityenable (flecs::id_t id, bool toggle=true)
 Enable an id.
 
entityenable ()
 Enable a component.
 
entityenable (flecs::id_t first, flecs::id_t second)
 Enable a pair.
 
entityenable (flecs::id_t second)
 Enable a pair.
 
entityenable ()
 Enable a pair.
 
entitydisable ()
 Disable an entity.
 
entitydisable (flecs::id_t id)
 Disable an id.
 
entitydisable ()
 Disable a component.
 
entitydisable (flecs::id_t first, flecs::id_t second)
 Disable a pair.
 
entitydisable (flecs::id_t second)
 Disable a pair.
 
entitydisable ()
 Disable a pair.
 
entityset_ptr (entity_t comp, size_t size, const void *ptr)
 
entityset_ptr (entity_t comp, const void *ptr)
 
entityset (T &&value)
 
entityset (const T &value)
 
entityset (A &&value)
 
entityset (const A &value)
 
entityset (A &&value)
 Set a pair for an entity.
 
entityset (const A &value)
 Set a pair for an entity.
 
entityset (Second second, const First &value)
 Set a pair for an entity.
 
entityset (Second second, First &&value)
 Set a pair for an entity.
 
entityset (Second constant, const First &value)
 Set a pair for an entity.
 
entityset (const Func &func)
 Set 1..N components.
 
entityset_second (entity_t first, const Second &value)
 Set a pair for an entity.
 
entityset_second (entity_t first, Second &&value)
 Set a pair for an entity.
 
entityset_second (const Second &value)
 
entityemplace (Args &&... args)
 Emplace component.
 
entityemplace (Args &&... args)
 
entityemplace_first (flecs::entity_t second, Args &&... args)
 
entityemplace_second (flecs::entity_t first, Args &&... args)
 
entitywith (const Func &func)
 Entities created in function will have the current entity.
 
entitywith (const Func &func)
 Entities created in function will have (First, this).
 
entitywith (entity_t first, const Func &func)
 Entities created in function will have (first, this).
 
entityscope (const Func &func)
 The function will be ran with the scope set to the current entity.
 
scoped_world scope () const
 Return world scoped to entity.
 
entityset_name (const char *name)
 
entityset_alias (const char *name)
 
entityset_doc_name (const char *name)
 Set human readable name.
 
entityset_doc_brief (const char *brief)
 Set brief description.
 
entityset_doc_detail (const char *detail)
 Set detailed description.
 
entityset_doc_link (const char *link)
 Set link to external documentation.
 
entityset_doc_color (const char *link)
 Set doc color.
 
entityobserve (flecs::entity_t evt, Func &&callback)
 Observe event on entity.
 
entityobserve (Func &&callback)
 Observe event on entity.
 
entityobserve (Func &&callback)
 Observe event on entity.
 
entityset_json (flecs::id_t e, const char *json, flecs::from_json_desc_t *desc=nullptr)
 Set component from JSON.
 
entityset_json (flecs::entity_t r, flecs::entity_t t, const char *json, flecs::from_json_desc_t *desc=nullptr)
 Set pair from JSON.
 
entityset_json (const char *json, flecs::from_json_desc_t *desc=nullptr)
 Set component from JSON.
 
entityset_json (const char *json, flecs::from_json_desc_t *desc=nullptr)
 Set pair from JSON.
 
entityset_json (flecs::entity_t t, const char *json, flecs::from_json_desc_t *desc=nullptr)
 Set pair from JSON.
 
entityset_json_second (flecs::entity_t r, const char *json, flecs::from_json_desc_t *desc=nullptr)
 Set pair from JSON.
 
 entity_view ()
 
 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.
 
- Public Member Functions inherited from flecs::entity_view
 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 * 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 > = 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 T , if_t< is_enum< T >::value > = 0>
const T * get () const
 Get enum constant.
 
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 * 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 > = 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 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 > = 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.
 
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.
 
template<typename E >
to_constant () const
 Convert entity to enum constant.
 
void emit (flecs::entity_t evt)
 Emit event for entity.
 
void emit (flecs::entity evt)
 Emit event for entity.
 
template<typename Evt , if_t< is_empty< Evt >::value > = 0>
void emit ()
 Emit event for entity.
 
template<typename Evt , if_not_t< is_empty< Evt >::value > = 0>
void emit (const Evt &payload)
 Emit event with payload for entity.
 
void enqueue (flecs::entity_t evt)
 Enqueue event for entity.
 
void enqueue (flecs::entity evt)
 Enqueue event for entity.
 
template<typename Evt , if_t< is_empty< Evt >::value > = 0>
void enqueue ()
 Enqueue event for entity.
 
template<typename Evt , if_not_t< is_empty< Evt >::value > = 0>
void enqueue (const Evt &payload)
 Enqueue event with payload for entity.
 
flecs::string to_json (const flecs::entity_to_json_desc_t *desc=nullptr) const
 Serialize entity to JSON.
 
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)
 Make entity a unit.
 
- 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::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
 

Static Public Member Functions

static flecs::entity null (const flecs::world_t *world)
 Entity id 0.
 
static flecs::entity null ()
 

Additional Inherited Members

- Protected Member Functions inherited from flecs::entity_builder< entity >
entityto_base ()
 
- Protected Attributes inherited from flecs::id
flecs::world_t * m_world
 
flecs::id_t m_id
 

Detailed Description

Entity.

Class with read/write operations for entities.

Definition at line 29 of file entity.hpp.

Constructor & Destructor Documentation

◆ entity() [1/5]

flecs::entity::entity ( )
inline

Definition at line 31 of file entity.hpp.

◆ entity() [2/5]

flecs::entity::entity ( world_t * world)
inlineexplicit

Create entity.

Parameters
worldThe world in which to create the entity.

Definition at line 37 of file entity.hpp.

◆ entity() [3/5]

flecs::entity::entity ( const flecs::world_t * world,
flecs::entity_t id )
inlineexplicit

Wrap an existing entity id.

Parameters
worldThe world in which the entity is created.
idThe entity id.

Definition at line 49 of file entity.hpp.

◆ entity() [4/5]

flecs::entity::entity ( world_t * world,
const char * name )
inlineexplicit

Create a named entity.

Named entities can be looked up with the lookup functions. Entity names may be scoped, where each element in the name is separated by "::". For example: "Foo::Bar". If parts of the hierarchy in the scoped name do not yet exist, they will be automatically created.

Parameters
worldThe world in which to create the entity.
nameThe entity name.

Definition at line 63 of file entity.hpp.

◆ entity() [5/5]

flecs::entity::entity ( entity_t id)
inlineexplicit

Conversion from flecs::entity_t to flecs::entity.

Parameters
idThe entity_t value to convert.

Definition at line 79 of file entity.hpp.

Member Function Documentation

◆ clear()

void flecs::entity::clear ( ) const
inline

Clear an entity.

This operation removes all components from an entity without recycling the entity id.

Definition at line 281 of file entity.hpp.

◆ destruct()

void flecs::entity::destruct ( ) const
inline

Delete an entity.

Entities have to be deleted explicitly, and are not deleted when the entity object goes out of scope.

Definition at line 289 of file entity.hpp.

◆ ensure() [1/5]

template<typename T >
T & flecs::entity::ensure ( ) const
inline

Get mutable component value.

This operation returns a mutable pointer to the component. If the entity did not yet have the component, it will be added. If a base entity had the component, it will be overridden, and the value of the base component will be copied to the entity before this function returns.

Template Parameters
TThe component to get.
Returns
Pointer to the component value.

Definition at line 94 of file entity.hpp.

◆ ensure() [2/5]

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::ensure ( ) const
inline

Get mutable pointer for a pair.

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

Template Parameters
FirstThe first part of the pair.
Secondthe second part of the pair.

Definition at line 121 of file entity.hpp.

◆ ensure() [3/5]

void * flecs::entity::ensure ( entity_t comp) const
inline

Get mutable component value (untyped).

This operation returns a mutable pointer to the component. If the entity did not yet have the component, it will be added. If a base entity had the component, it will be overridden, and the value of the base component will be copied to the entity before this function returns.

Parameters
compThe component to get.
Returns
Pointer to the component value.

Definition at line 109 of file entity.hpp.

◆ ensure() [4/5]

void * flecs::entity::ensure ( entity_t first,
entity_t second ) const
inline

Get mutable pointer for a pair (untyped).

This operation gets the value for a pair from the entity. If neither the first nor second element of the pair is a component, the operation will fail.

Parameters
firstThe first element of the pair.
secondThe second element of the pair.

Definition at line 149 of file entity.hpp.

◆ ensure() [5/5]

template<typename First >
First & flecs::entity::ensure ( entity_t second) const
inline

Get mutable pointer for the first element of a pair.

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

Template Parameters
FirstThe first part of the pair.
Parameters
secondThe second element of the pair.

Definition at line 134 of file entity.hpp.

◆ ensure_second()

template<typename Second >
Second & flecs::entity::ensure_second ( entity_t first) const
inline

Get mutable pointer for the second element of a pair.

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

Template Parameters
SecondThe second element of the pair.
Parameters
firstThe first element of the pair.

Definition at line 162 of file entity.hpp.

◆ flatten()

void flecs::entity::flatten ( flecs::entity_t r,
const ecs_flatten_desc_t * desc = nullptr )
inline

Recursively flatten relationship.

See also
ecs_flatten

Definition at line 273 of file entity.hpp.

◆ get_ref() [1/4]

template<typename T , if_t< is_actual< T >::value > = 0>
ref< T > flecs::entity::get_ref ( ) const
inline

Get reference to component.

A reference allows for quick and safe access to a component value, and is a faster alternative to repeatedly calling 'get' for the same component.

Template Parameters
Tcomponent for which to get a reference.
Returns
The reference.

Definition at line 229 of file entity.hpp.

◆ get_ref() [2/4]

template<typename T , typename A = actual_type_t<T>, if_t< flecs::is_pair< T >::value > = 0>
ref< A > flecs::entity::get_ref ( ) const
inline

Get reference to component.

Overload for when T is not the same as the actual type, which happens when using pair types. A reference allows for quick and safe access to a component value, and is a faster alternative to repeatedly calling 'get' for the same component.

Template Parameters
Tcomponent for which to get a reference.
Returns
The reference.

Definition at line 243 of file entity.hpp.

◆ get_ref() [3/4]

template<typename First , typename Second , typename P = flecs::pair<First, Second>, typename A = actual_type_t<P>>
ref< A > flecs::entity::get_ref ( ) const
inline

Definition at line 252 of file entity.hpp.

◆ get_ref() [4/4]

template<typename First >
ref< First > flecs::entity::get_ref ( flecs::entity_t second) const
inline

Definition at line 259 of file entity.hpp.

◆ get_ref_second()

template<typename Second >
ref< Second > flecs::entity::get_ref_second ( flecs::entity_t first) const
inline

Definition at line 265 of file entity.hpp.

◆ modified() [1/5]

template<typename T >
void flecs::entity::modified ( ) const
inline

Signal that component was modified.

Template Parameters
Tcomponent that was modified.

Definition at line 174 of file entity.hpp.

◆ modified() [2/5]

template<typename First , typename Second >
void flecs::entity::modified ( ) const
inline

Signal that the first element of a pair was modified.

Template Parameters
FirstThe first part of the pair.
Secondthe second part of the pair.

Definition at line 186 of file entity.hpp.

◆ modified() [3/5]

void flecs::entity::modified ( entity_t comp) const
inline

Signal that component was modified.

Parameters
compcomponent that was modified.

Definition at line 217 of file entity.hpp.

◆ modified() [4/5]

void flecs::entity::modified ( entity_t first,
entity_t second ) const
inline

Signal that a pair has modified (untyped).

If neither the first or second element of the pair are a component, the operation will fail.

Parameters
firstThe first element of the pair.
secondThe second element of the pair.

Definition at line 209 of file entity.hpp.

◆ modified() [5/5]

template<typename First >
void flecs::entity::modified ( entity_t second) const
inline

Signal that the first part of a pair was modified.

Template Parameters
FirstThe first part of the pair.
Parameters
secondThe second element of the pair.

Definition at line 196 of file entity.hpp.

◆ null() [1/2]

static flecs::entity flecs::entity::null ( )
inlinestatic

Definition at line 320 of file entity.hpp.

◆ null() [2/2]

static flecs::entity flecs::entity::null ( const flecs::world_t * world)
inlinestatic

Entity id 0.

This function is useful when the API must provide an entity that belongs to a world, but the entity id is 0.

Parameters
worldThe world.

Definition at line 313 of file entity.hpp.

◆ view()

flecs::entity_view flecs::entity::view ( ) const
inline

Return entity as entity_view.

This returns an entity_view instance for the entity which is a readonly version of the entity class.

This is similar to a regular upcast, except that this method ensures that the entity_view instance is instantiated with a world vs. a stage, which a regular upcast does not guarantee.

Definition at line 301 of file entity.hpp.


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