![]() |
Flecs v4.1
A fast entity component system (ECS) for C & C++
|
Entity view. More...
#include <entity_view.hpp>
Public Member Functions | |
| entity_view () | |
| Default constructor. | |
| 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 | |
| Conversion to bool. | |
| 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 typed parent. | |
| bool | enabled () const |
| Check if entity is enabled (does not have the Disabled tag). | |
| 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 an entity. | |
| template<typename Rel , typename Func > | |
| void | children (Func &&func) const |
| Iterate children for an entity. | |
| template<typename Func > | |
| void | children (Func &&func) const |
| Iterate children for an 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... Ts> | |
| auto | try_get_n () const |
| Get multiple component values as a tuple of const pointers. | |
| 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... Ts> | |
| auto | get_n () const |
| Get multiple component values as a tuple of const references. | |
| 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... Ts> | |
| auto | try_get_mut_n () const |
| Get multiple mutable component values as a tuple of pointers. | |
| 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... Ts> | |
| auto | get_mut_n () const |
| Get multiple mutable component values as a tuple of references. | |
| 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 |
| Get the target of a pair for a given relationship ID. | |
| template<typename First , typename Second > | |
| flecs::entity | target_for (flecs::entity_t relationship) const |
| Get the target of a pair for a given relationship ID. | |
| int32_t | depth (flecs::entity_t rel) const |
| Get the depth for a given relationship. | |
| template<typename Rel > | |
| int32_t | depth () const |
| Get the depth for a 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. | |
| template<typename Second > | |
| bool | owns_second (flecs::entity_t first) 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 |
| Clone an entity. | |
| flecs::entity | mut (const flecs::world &stage) const |
| Return a mutable entity handle for the current stage. | |
| flecs::entity | mut (const flecs::iter &it) const |
| Same as mut(world), but for an iterator. | |
| flecs::entity | mut (const flecs::entity_view &e) const |
| Same as mut(world), but for an entity. | |
| int32_t | alert_count (flecs::entity_t alert=0) const |
| Return the number of alerts for an 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 an entity to an enum constant. | |
| void | emit (flecs::entity_t evt) const |
| Emit an event for an entity. | |
| void | emit (flecs::entity evt) const |
| Emit an event for an entity. | |
| template<typename Evt , if_t< is_empty< Evt >::value > = 0> | |
| void | emit () const |
| Emit an event for an entity. | |
| template<typename Evt , if_not_t< is_empty< Evt >::value > = 0> | |
| void | emit (const Evt &payload) const |
| Emit an event with payload for an entity. | |
| void | enqueue (flecs::entity_t evt) const |
| Enqueue an event for an entity. | |
| void | enqueue (flecs::entity evt) const |
| Enqueue an event for an entity. | |
| template<typename Evt , if_t< is_empty< Evt >::value > = 0> | |
| void | enqueue () const |
| Enqueue an event for an entity. | |
| template<typename Evt , if_not_t< is_empty< Evt >::value > = 0> | |
| void | enqueue (const Evt &payload) const |
| Enqueue an event with payload for an entity. | |
| flecs::string | to_json (const flecs::entity_to_json_desc_t *desc=nullptr) const |
| Serialize an 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 a pair (has first, second). | |
| bool | is_wildcard () const |
| Test if ID is a wildcard. | |
| bool | is_entity () const |
| Test if ID is an entity. | |
| flecs::entity | entity () const |
| Return ID as entity (only allowed when ID is a valid entity). | |
| flecs::entity | add_flags (flecs::id_t flags) const |
| Return ID with flags added. | |
| flecs::entity | remove_flags (flecs::id_t flags) const |
| Return ID with flags removed. | |
| flecs::entity | remove_flags () const |
| Return ID without flags. | |
| flecs::entity | remove_generation () const |
| Return ID without generation. | |
| flecs::entity | type_id () const |
| Return component type of ID. | |
| bool | has_flags (flecs::id_t flags) const |
| Test if ID has specified flags. | |
| bool | has_flags () const |
| Test if ID has any flags. | |
| flecs::entity | flags () const |
| Return ID flags set on ID. | |
| bool | has_relation (flecs::id_t first) const |
| Test if ID has the specified first element. | |
| flecs::entity | first () const |
| Get first element from a pair. | |
| flecs::entity | second () const |
| Get second element from a pair. | |
| flecs::string | str () const |
| Convert ID to string. | |
| flecs::string | flags_str () const |
| Convert flags of ID to string. | |
| flecs::id_t | raw_id () const |
| Return flecs::id_t value. | |
| operator flecs::id_t () const | |
| flecs::world | world () const |
| Get the world. | |
Additional Inherited Members | |
Protected Attributes inherited from flecs::id | |
| flecs::world_t * | world_ |
| World is optional, but guarantees that entity identifiers extracted from the ID are valid. | |
| flecs::id_t | id_ |
| The raw ID value. | |
Entity view.
Class with read operations for entities. Base for flecs::entity.
Definition at line 30 of file entity_view.hpp.
|
inline |
|
inlineexplicit |
Wrap an existing entity ID.
| world | The world in which the entity is created. |
| id | The entity ID. |
Definition at line 40 of file entity_view.hpp.
|
inline |
Implicit conversion from flecs::entity_t to flecs::entity_view.
Definition at line 47 of file entity_view.hpp.
|
inline |
Iterate children for an entity.
The function parameter must match the following signature:
| rel | The relationship to follow. |
| func | The function invoked for each child. |
Definition at line 228 of file entity_view.hpp.
|
inline |
Iterate children for an entity.
The function parameter must match the following signature:
| Rel | The relationship to follow. |
| func | The function invoked for each child. |
Definition at line 256 of file entity_view.hpp.
|
inline |
Iterate children for an entity.
The function parameter must match the following signature:
This operation follows the ChildOf relationship.
| func | The function invoked for each child. |
Definition at line 272 of file entity_view.hpp.
|
inline |
Clone an entity.
Create a copy of the current entity with all of its components.
| clone_value | If true, clone component values. If false, only clone the entity's type. |
| dst_id | If nonzero, clone to this entity ID instead of creating a new one. |
|
inline |
Get the depth for a given relationship.
| Rel | The relationship. |
Definition at line 1006 of file entity_view.hpp.
|
inline |
Get the depth for a given relationship.
| rel | The relationship. |
Definition at line 996 of file entity_view.hpp.
|
inline |
Iterate targets for a given relationship.
The function parameter must match the following signature:
| rel | The relationship for which to iterate the targets. |
| func | The function invoked for each target. |
|
inline |
Iterate (component) IDs of an entity.
The function parameter must match the following signature:
| func | The function invoked for each ID. |
|
inline |
Iterate targets for a given relationship.
The function parameter must match the following signature:
| First | The relationship for which to iterate the targets. |
| func | The function invoked for each target. |
Definition at line 213 of file entity_view.hpp.
|
inline |
Iterate matching pair IDs of an entity.
The function parameter must match the following signature:
| first | The first element of the pair to match. |
| second | The second element of the pair to match. |
| func | The function invoked for each ID. |
| void emit | ( | ) | const |
Emit an event for an entity.
| Evt | The event to emit. |
Definition at line 34 of file entity_view.inl.
| void emit | ( | const Evt & | payload | ) | const |
Emit an event with payload for an entity.
| Evt | The event to emit. |
Definition at line 45 of file entity_view.inl.
|
inline |
| void emit | ( | flecs::entity_t | evt | ) | const |
Emit an event for an entity.
| evt | The event to emit. |
Definition at line 12 of file entity_view.inl.
|
inline |
Check if entity is enabled (does not have the Disabled tag).
Definition at line 138 of file entity_view.hpp.
|
inline |
Test if component is enabled.
| T | The component to test. |
Definition at line 1212 of file entity_view.hpp.
|
inline |
Test if pair is enabled.
| First | The first element of the pair. |
| Second | The second element of the pair. |
Definition at line 1244 of file entity_view.hpp.
|
inline |
Test if pair is enabled.
| first | The first element of the pair. |
| second | The second element of the pair. |
Definition at line 1222 of file entity_view.hpp.
|
inline |
Test if ID is enabled.
| id | The ID to test. |
Definition at line 1202 of file entity_view.hpp.
|
inline |
Test if pair is enabled.
| First | The first element of the pair. |
| second | The second element of the pair. |
Definition at line 1233 of file entity_view.hpp.
| void enqueue | ( | ) | const |
Enqueue an event for an entity.
| Evt | The event to enqueue. |
Definition at line 82 of file entity_view.inl.
| void enqueue | ( | const Evt & | payload | ) | const |
Enqueue an event with payload for an entity.
| Evt | The event to enqueue. |
Definition at line 93 of file entity_view.inl.
|
inline |
| void enqueue | ( | flecs::entity_t | evt | ) | const |
Enqueue an event for an entity.
| evt | The event to enqueue. |
Definition at line 60 of file entity_view.inl.
|
inline |
Get component value.
| T | The component to get. |
Definition at line 432 of file entity_view.hpp.
|
inline |
Get component value.
Overload for when T is not the same as the actual type, which happens when using pair types.
| T | The component to get. |
Definition at line 450 of file entity_view.hpp.
|
inline |
Get a pair.
This operation gets the value for a pair from the entity.
| First | The first element of the pair. |
| Second | The second element of the pair. |
Definition at line 468 of file entity_view.hpp.
|
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:
| func | The callback to invoke. |
|
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 is a component, the operation will fail.
| first | The first element of the pair. |
| second | The second element of the pair. |
Definition at line 526 of file entity_view.hpp.
|
inline |
Get component value (untyped).
| comp | The component to get. |
Definition at line 509 of file entity_view.hpp.
|
inline |
Get a pair.
This operation gets the value for a pair from the entity.
| First | The first element of the pair. |
| constant | The enum constant. |
Definition at line 497 of file entity_view.hpp.
|
inline |
Get a pair.
This operation gets the value for a pair from the entity.
| First | The first element of the pair. |
| second | The second element of the pair. |
Definition at line 481 of file entity_view.hpp.
|
inline |
Get mutable component value.
| T | The component to get. |
Definition at line 772 of file entity_view.hpp.
|
inline |
Get mutable component value.
Overload for when T is not the same as the actual type, which happens when using pair types.
| T | The component to get. |
Definition at line 789 of file entity_view.hpp.
|
inline |
Get a mutable pair.
This operation gets the value for a pair from the entity.
| First | The first element of the pair. |
| Second | The second element of the pair. |
Definition at line 806 of file entity_view.hpp.
|
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 is a component, the operation will fail.
| first | The first element of the pair. |
| second | The second element of the pair. |
Definition at line 867 of file entity_view.hpp.
|
inline |
Get mutable component value (untyped).
| comp | The component to get. |
Definition at line 850 of file entity_view.hpp.
|
inline |
Get a mutable pair.
This operation gets the value for a pair from the entity.
| First | The first element of the pair. |
| constant | The enum constant. |
Definition at line 838 of file entity_view.hpp.
|
inline |
Get a mutable pair.
This operation gets the value for a pair from the entity.
| First | The first element of the pair. |
| second | The second element of the pair. |
Definition at line 822 of file entity_view.hpp.
|
inline |
Get multiple mutable component values as a tuple of references.
| Ts | The component types (must be between 2 and 8). |
Definition at line 880 of file entity_view.hpp.
|
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.
| First | The first element of the pair. |
| Second | The second element of the pair. |
Definition at line 913 of file entity_view.hpp.
|
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.
| Second | The second element of the pair. |
| first | The first part of the pair. |
Definition at line 896 of file entity_view.hpp.
|
inline |
Get multiple component values as a tuple of const references.
| Ts | The component types (must be between 2 and 8). |
Definition at line 576 of file entity_view.hpp.
|
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.
| First | The first element of the pair. |
| Second | The second element of the pair. |
Definition at line 609 of file entity_view.hpp.
|
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.
| Second | The second element of the pair. |
| first | The first part of the pair. |
Definition at line 592 of file entity_view.hpp.
|
inline |
Check if entity has the provided component.
| T | The component to check. |
Definition at line 1042 of file entity_view.hpp.
|
inline |
Check if entity has the provided pair.
| First | The first element of the pair. |
| Second | The second element of the pair. |
Definition at line 1079 of file entity_view.hpp.
|
inline |
Check if entity has the provided enum constant.
| E | The enum type (can be deduced). |
| value | The enum constant to check. |
Definition at line 1063 of file entity_view.hpp.
|
inline |
Check if entity has the provided pair.
| First | The first element of the pair. |
| value | The enum constant. |
Definition at line 1113 of file entity_view.hpp.
|
inline |
Check if entity has the provided entity.
| e | The entity to check. |
Definition at line 1032 of file entity_view.hpp.
|
inline |
Check if entity has the provided pair.
| first | The first element of the pair. |
| second | The second element of the pair. |
Definition at line 1125 of file entity_view.hpp.
|
inline |
Check if entity has the provided pair.
| First | The first element of the pair. |
| second | The second element of the pair. |
Definition at line 1090 of file entity_view.hpp.
|
inline |
Check if entity has the provided pair.
| Second | The second element of the pair. |
| first | The first element of the pair. |
Definition at line 1102 of file entity_view.hpp.
|
inline |
|
inline |
Check if entity is alive.
Definition at line 80 of file entity_view.hpp.
|
inline |
Check if entity is valid.
An entity is valid if:
Definition at line 66 of file entity_view.hpp.
|
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".
| path | The name of the entity to lookup. |
| search_path | When false, only the entity's scope is searched. |
|
inline |
Same as mut(world), but for an 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.
| e | Another mutable entity. |
|
inline |
Same as mut(world), but for an iterator.
This operation allows for the construction of a mutable entity handle from an iterator.
| it | An iterator that contains a reference to the world or stage. |
|
inline |
Return a mutable entity handle for the current stage.
When an entity handle created from the world is used while the world is in staged mode, it will only allow for read-only 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.
| stage | The current stage. |
|
inline |
|
inlineexplicit |
|
inline |
Check if entity owns the provided component.
A component is owned if it is not shared from a base entity.
| T | The component to check. |
Definition at line 1168 of file entity_view.hpp.
|
inline |
Check if entity owns the provided pair.
A pair is owned if it is not shared from a base entity.
| First | The first element of the pair. |
| Second | The second element of the pair. |
Definition at line 1180 of file entity_view.hpp.
|
inline |
Check if entity owns the provided entity.
An entity is owned if it is not shared from a base entity.
| e | The entity to check. |
Definition at line 1135 of file entity_view.hpp.
|
inline |
Check if entity owns the provided pair.
| first | The first element of the pair. |
| second | The second element of the pair. |
Definition at line 1157 of file entity_view.hpp.
|
inline |
Check if entity owns the provided pair.
| First | The first element of the pair. |
| second | The second element of the pair. |
Definition at line 1146 of file entity_view.hpp.
|
inline |
Check if entity owns the provided pair.
| Second | The second element of the pair. |
| first | The first element of the pair. |
Definition at line 1193 of file entity_view.hpp.
|
inline |
|
inline |
Return the entity path.
| sep | The separator used between path elements. |
| init_sep | The initial separator prepended to the path. |
Definition at line 106 of file entity_view.hpp.
|
inline |
Return the entity path relative to a typed parent.
| Parent | The parent type to compute the path relative to. |
| sep | The separator used between path elements. |
| init_sep | The initial separator prepended to the path. |
Definition at line 130 of file entity_view.hpp.
|
inline |
Return the entity path relative to a parent.
| parent | The parent entity to compute the path relative to. |
| sep | The separator used between path elements. |
| init_sep | The initial separator prepended to the path. |
Definition at line 117 of file entity_view.hpp.
|
inline |
|
inline |
|
inline |
|
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.
| first | The first element of the pair for which to retrieve the target. |
| index | The index (0 for the first instance of the relationship). |
|
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.
| First | The first element of the pair. |
| index | The index (0 for the first instance of the relationship). |
|
inline |
|
inline |
Get the target of a pair for a given relationship ID.
| First | The first element of the pair to lookup. |
| Second | The second element of the pair to lookup. |
| relationship | The relationship to follow. |
|
inline |
Get the target of a pair for a given relationship ID.
This operation returns the first entity that has the provided component ID by following the specified relationship. If the entity itself has the component ID, then the entity will be returned. If the component 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:
| relationship | The relationship to follow. |
| id | The component ID to lookup. |
|
inline |
Get component value.
| T | The component to get. |
Definition at line 286 of file entity_view.hpp.
|
inline |
Get component value.
Overload for when T is not the same as the actual type, which happens when using pair types.
| T | The component to get. |
Definition at line 303 of file entity_view.hpp.
|
inline |
Get a pair.
This operation gets the value for a pair from the entity.
| First | The first element of the pair. |
| Second | The second element of the pair. |
Definition at line 319 of file entity_view.hpp.
|
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 is a component, the operation will fail.
| first | The first element of the pair. |
| second | The second element of the pair. |
Definition at line 372 of file entity_view.hpp.
|
inline |
Get component value (untyped).
| comp | The component to get. |
Definition at line 359 of file entity_view.hpp.
|
inline |
Get a pair.
This operation gets the value for a pair from the entity.
| First | The first element of the pair. |
| constant | The enum constant. |
Definition at line 347 of file entity_view.hpp.
|
inline |
Get a pair.
This operation gets the value for a pair from the entity.
| First | The first element of the pair. |
| second | The second element of the pair. |
Definition at line 331 of file entity_view.hpp.
|
inline |
Get mutable component value.
| T | The component to get. |
Definition at line 626 of file entity_view.hpp.
|
inline |
Get mutable component value.
Overload for when T is not the same as the actual type, which happens when using pair types.
| T | The component to get. |
Definition at line 643 of file entity_view.hpp.
|
inline |
Get a mutable pair.
This operation gets the value for a pair from the entity.
| First | The first element of the pair. |
| Second | The second element of the pair. |
Definition at line 659 of file entity_view.hpp.
|
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 is a component, the operation will fail.
| first | The first element of the pair. |
| second | The second element of the pair. |
Definition at line 712 of file entity_view.hpp.
|
inline |
Get mutable component value (untyped).
| comp | The component to get. |
Definition at line 699 of file entity_view.hpp.
|
inline |
Get a mutable pair.
This operation gets the value for a pair from the entity.
| First | The first element of the pair. |
| constant | The enum constant. |
Definition at line 687 of file entity_view.hpp.
|
inline |
Get a mutable pair.
This operation gets the value for a pair from the entity.
| First | The first element of the pair. |
| second | The second element of the pair. |
Definition at line 671 of file entity_view.hpp.
|
inline |
Get multiple mutable component values as a tuple of pointers.
| Ts | The component types (must be between 2 and 8). |
Definition at line 722 of file entity_view.hpp.
|
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.
| First | The first element of the pair. |
| Second | The second element of the pair. |
Definition at line 758 of file entity_view.hpp.
|
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.
| Second | The second element of the pair. |
| first | The first part of the pair. |
Definition at line 737 of file entity_view.hpp.
|
inline |
Get multiple component values as a tuple of const pointers.
| Ts | The component types (must be between 2 and 8). |
Definition at line 382 of file entity_view.hpp.
|
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.
| First | The first element of the pair. |
| Second | The second element of the pair. |
Definition at line 418 of file entity_view.hpp.
|
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.
| Second | The second element of the pair. |
| first | The first part of the pair. |
Definition at line 397 of file entity_view.hpp.
|
inline |