45 : flecs::
id( nullptr,
id ) { }
62 explicit operator bool()
const {
111 template <
typename Parent>
116 bool enabled()
const {
117 return !
ecs_has_id(m_world, m_id, flecs::Disabled);
150 template <
typename Func>
151 void each(
const Func& func)
const;
162 template <
typename Func>
163 void each(flecs::id_t
first, flecs::id_t
second,
const Func& func)
const;
175 template <
typename Func>
188 template <
typename First,
typename Func>
189 void each(
const Func& func)
const {
203 template <
typename Func>
204 void children(flecs::entity_t rel, Func&& func)
const {
208 if (m_id == flecs::Wildcard || m_id == flecs::Any) {
213 ecs_iter_t it = flecs_children(m_world, rel, m_id);
229 template <
typename Rel,
typename Func>
245 template <
typename Func>
247 children(flecs::ChildOf, FLECS_MOV(func));
256 template <typename T, if_t< is_actual<T>::value > = 0>
260 return static_cast<const T*
>(
ecs_get_id(m_world, m_id, comp_id));
271 template <
typename T,
typename A = actual_type_t<T>,
272 if_t< flecs::is_pair<T>::value > = 0>
276 return static_cast<const A*
>(
ecs_get_id(m_world, m_id, comp_id));
285 template <
typename First,
typename Second,
typename P = pair<First, Second>,
286 typename A = actual_type_t<P>, if_not_t< flecs::is_pair<First>::value > = 0>
297 template<typename First, typename Second, if_not_t< is_enum<Second>::value> = 0>
301 return static_cast<const First*
>(
311 template<typename First, typename Second, if_t<is_enum<Second>::value> = 0>
312 const First*
get(Second constant)
const {
313 const auto& et = enum_type<Second>(this->m_world);
314 flecs::entity_t
target = et.entity(constant);
324 const void*
get(flecs::id_t comp)
const {
374 template <typename Func, if_t< is_callable<Func>::value > = 0>
375 bool get(
const Func& func)
const;
382 template <typename T, if_t< is_enum<T>::value > = 0>
392 template<
typename Second>
396 return static_cast<const Second*
>(
407 template<
typename First,
typename Second>
418 template <typename T, if_t< is_actual<T>::value > = 0>
433 template <
typename T,
typename A = actual_type_t<T>,
434 if_t< flecs::is_pair<T>::value > = 0>
447 template <
typename First,
typename Second,
typename P = pair<First, Second>,
448 typename A = actual_type_t<P>, if_not_t< flecs::is_pair<First>::value > = 0>
459 template<typename First, typename Second, if_not_t< is_enum<Second>::value> = 0>
463 return static_cast<First*
>(
473 template<typename First, typename Second, if_t<is_enum<Second>::value> = 0>
475 const auto& et = enum_type<Second>(this->m_world);
476 flecs::entity_t
target = et.entity(constant);
509 template<
typename Second>
513 return static_cast<Second*
>(
524 template<
typename First,
typename Second>
537 template<
typename First>
570 template <
typename T>
573 template <
typename First,
typename Second>
581 int32_t
depth(flecs::entity_t rel)
const {
590 template<
typename Rel>
617 bool has(flecs::id_t e)
const {
626 template <
typename T>
634 if (is_enum<T>::value) {
635 return ecs_has_pair(m_world, m_id, cid, flecs::Wildcard);
647 template <typename E, if_t< is_enum<E>::value > = 0>
650 auto o = enum_type<E>(m_world).entity(value);
652 "Constant was not found in Enum reflection data."
653 " Did you mean to use has<E>() instead of has(E)?");
654 return ecs_has_pair(m_world, m_id, r, o);
663 template <
typename First,
typename Second>
674 template<typename First, typename Second, if_not_t< is_enum<Second>::value > = 0>
686 template <
typename Second>
697 template<typename First, typename E, if_t< is_enum<E>::value > = 0>
699 const auto& et = enum_type<E>(this->m_world);
700 flecs::entity_t
second = et.entity(value);
720 bool owns(flecs::id_t e)
const {
730 template <
typename First>
752 template <
typename T>
764 template <
typename First,
typename Second>
806 template <
typename First>
817 template <
typename First,
typename Second>
822 flecs::entity clone(
bool clone_value =
true, flecs::entity_t dst_id = 0)
const;
#define ecs_assert(condition, error_code,...)
Assert.
bool ecs_is_enabled_id(const ecs_world_t *world, ecs_entity_t entity, ecs_id_t id)
Test if component is enabled.
bool ecs_has_id(const ecs_world_t *world, ecs_entity_t entity, ecs_id_t id)
Test if an entity has an id.
bool ecs_owns_id(const ecs_world_t *world, ecs_entity_t entity, ecs_id_t id)
Test if an entity owns an id.
int32_t ecs_get_depth(const ecs_world_t *world, ecs_entity_t entity, ecs_entity_t rel)
Return depth for entity in tree for the specified relationship.
bool ecs_children_next(ecs_iter_t *it)
Progress a children iterator.
void * ecs_get_mut_id(const ecs_world_t *world, ecs_entity_t entity, ecs_id_t id)
Get a mutable pointer to a component.
const void * ecs_get_id(const ecs_world_t *world, ecs_entity_t entity, ecs_id_t id)
Get an immutable pointer to a component.
bool ecs_is_valid(const ecs_world_t *world, ecs_entity_t e)
Test whether an entity is valid.
bool ecs_is_alive(const ecs_world_t *world, ecs_entity_t e)
Test whether an entity is alive.
char * ecs_get_path_w_sep(const ecs_world_t *world, ecs_entity_t parent, ecs_entity_t child, const char *sep, const char *prefix)
Get a path identifier for an entity.
const char * ecs_get_symbol(const ecs_world_t *world, ecs_entity_t entity)
Get the symbol of an entity.
const char * ecs_get_name(const ecs_world_t *world, ecs_entity_t entity)
Get the name of an entity.
const ecs_world_t * ecs_get_world(const ecs_poly_t *poly)
Get world from poly.
flecs::type type() const
Get the entity's type.
A * get_mut() const
Get mutable component value.
const T * get() const
Get component value.
entity_view(entity_t id)
Implicit conversion from flecs::entity_t to flecs::entity_view.
int32_t depth(flecs::entity_t rel) const
Get depth for given relationship.
bool enabled() const
Test if pair is enabled.
bool has(flecs::id_t first, flecs::id_t second) const
Check if entity has the provided pair.
const First * get(Second second) const
Get a pair.
flecs::string_view name() const
Return the entity name.
bool owns(flecs::id_t second) const
Check if entity owns the provided pair.
const Second * get_second(flecs::entity_t first) const
Get the second part for a pair.
const Second * get_second() const
Get the second part for a pair.
bool is_valid() const
Check if entity is valid.
flecs::string path(const char *sep="::", const char *init_sep="::") const
Return the entity path.
flecs::string_view symbol() const
Return the entity symbol.
void each(const Func &func) const
Iterate targets for a given relationship.
flecs::table_range range() const
Get table range for the entity.
void * get_mut(flecs::entity_t first, flecs::entity_t second) const
Get a mutable pair (untyped).
bool owns() const
Check if entity owns the provided pair.
bool has(E value) const
Check if entity has the provided pair.
int32_t depth() const
Get depth for given relationship.
entity_view(flecs::world_t *world, flecs::id_t id)
Wrap an existing entity id.
bool enabled(flecs::id_t id) const
Test if id is enabled.
flecs::entity target_for(flecs::entity_t relationship, flecs::id_t id) const
Get the target of a pair for a given relationship id.
bool has_second(flecs::entity_t first) const
Check if entity has the provided pair.
const A * get() const
Get component value.
flecs::entity lookup(const char *path, bool search_path=false) const
Lookup an entity by name.
void children(Func &&func) const
Iterate children for entity.
bool owns(flecs::id_t e) const
Check if entity owns the provided entity.
T * get_mut() const
Get mutable component value.
flecs::table table() const
Get the entity's table.
flecs::string path_from(flecs::entity_t parent, const char *sep="::", const char *init_sep="::") const
Return the entity path relative to a parent.
Second * get_mut_second() const
Get the second part for a pair.
bool enabled(flecs::id_t second) const
Test if pair is enabled.
bool has(Second second) const
Check if entity has the provided pair.
bool has(flecs::id_t e) const
Check if entity has the provided entity.
bool owns() const
Check if entity owns the provided component.
flecs::entity parent() const
Get parent of entity.
const First * get(Second constant) const
Get a pair.
void * get_mut(flecs::id_t comp) const
Get mutable component value (untyped).
const A * get() const
Get a pair.
void each(const Func &func) const
Iterate (component) ids of an entity.
const void * get(flecs::entity_t first, flecs::entity_t second) const
Get a pair (untyped).
bool is_alive() const
Check if entity is alive.
First * get_mut(Second constant) const
Get a mutable pair.
bool has() const
Check if entity has the provided component.
bool owns(flecs::id_t first, flecs::id_t second) const
Check if entity owns the provided pair.
First * get_mut(Second second) const
Get a mutable pair.
void children(Func &&func) const
Iterate children for entity.
Second * get_mut_second(flecs::entity_t first) const
Get the second part for a pair.
entity_t id() const
Get entity id.
flecs::entity target(int32_t index=0) const
Get target for a given pair.
const void * get(flecs::id_t comp) const
Get component value (untyped).
bool has() const
Check if entity has the provided pair.
flecs::string path_from(const char *sep="::", const char *init_sep="::") const
Return the entity path relative to a parent.
bool enabled() const
Test if component is enabled.
void children(flecs::entity_t rel, Func &&func) const
Iterate children for entity.
A * get_mut() const
Get a mutable pair.
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 w...
bool has(E value) const
Check if entity has the provided enum constant.
bool enabled(flecs::id_t first, flecs::id_t second) const
Test if pair is enabled.
Class that wraps around a flecs::id_t.
flecs::entity second() const
Get second element from a pair.
flecs::entity first() const
Get first element from a pair.
Class for iterating over query results.