45 : flecs::
id( nullptr,
id ) { }
62 explicit operator bool()
const {
99 bool enabled()
const {
100 return !
ecs_has_id(m_world, m_id, flecs::Disabled);
130 template <
typename Func>
131 void each(
const Func& func)
const;
139 template <
typename Func>
140 void each(flecs::id_t
first, flecs::id_t
second,
const Func& func)
const;
149 template <
typename Func>
159 template <
typename First,
typename Func>
160 void each(
const Func& func)
const {
171 template <
typename Func>
172 void children(flecs::entity_t rel, Func&& func)
const {
181 desc.
terms[0].
id = ecs_pair(rel, m_id);
182 desc.
terms[1].
id = flecs::Prefab;
202 template <
typename Rel,
typename Func>
215 template <
typename Func>
217 children(flecs::ChildOf, FLECS_MOV(func));
226 template <typename T, if_t< is_actual<T>::value > = 0>
230 return static_cast<const T*
>(
ecs_get_id(m_world, m_id, comp_id));
241 template <
typename T,
typename A = actual_type_t<T>,
242 if_t< flecs::is_pair<T>::value > = 0>
246 return static_cast<const A*
>(
ecs_get_id(m_world, m_id, comp_id));
255 template <
typename First,
typename Second,
typename P = pair<First, Second>,
256 typename A = actual_type_t<P>, if_not_t< flecs::is_pair<First>::value > = 0>
258 return this->get<P>();
267 template<typename First, typename Second, if_not_t< is_enum<Second>::value> = 0>
271 return static_cast<const First*
>(
281 template<typename First, typename Second, if_t<is_enum<Second>::value> = 0>
282 const First*
get(Second constant)
const {
283 const auto& et = enum_type<Second>(this->m_world);
284 flecs::entity_t
target = et.entity(constant);
285 return get<First>(
target);
294 const void*
get(flecs::id_t comp)
const {
341 template <typename Func, if_t< is_callable<Func>::value > = 0>
342 bool get(
const Func& func)
const;
349 template <typename T, if_t< is_enum<T>::value > = 0>
359 template<
typename Second>
363 return static_cast<const Second*
>(
374 template<
typename First,
typename Second>
376 return get<pair_object<First, Second>>();
387 template<
typename First>
418 template <
typename T>
421 template <
typename First,
typename Second>
429 int32_t
depth(flecs::entity_t rel)
const {
438 template<
typename Rel>
464 bool has(flecs::id_t e)
const {
473 template <
typename T>
481 if (is_enum<T>::value) {
482 return ecs_has_pair(m_world, m_id, cid, flecs::Wildcard);
494 template <typename E, if_t< is_enum<E>::value > = 0>
497 auto o = enum_type<E>(m_world).entity(value);
498 return ecs_has_pair(m_world, m_id, r, o);
507 template <
typename First,
typename Second>
518 template<typename First, typename Second, if_not_t< is_enum<Second>::value > = 0>
530 template <
typename Second>
541 template<typename First, typename E, if_t< is_enum<E>::value > = 0>
543 const auto& et = enum_type<E>(this->m_world);
544 flecs::entity_t
second = et.entity(value);
545 return has<First>(
second);
564 bool owns(flecs::id_t e)
const {
565 return ecs_owns_id(m_world, m_id, e);
574 template <
typename First>
596 template <
typename T>
608 template <
typename First,
typename Second>
650 template <
typename First>
661 template <
typename First,
typename Second>
677 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 entity.
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 relationship rel.
ecs_filter_t * ecs_filter_init(ecs_world_t *world, const ecs_filter_desc_t *desc)
Initialize filter A filter is a lightweight object that can be used to query for entities in a world.
bool ecs_filter_next(ecs_iter_t *it)
Iterate tables matched by filter.
ecs_iter_t ecs_filter_iter(const ecs_world_t *world, const ecs_filter_t *filter)
Return a filter iterator.
void ecs_filter_fini(ecs_filter_t *filter)
Deinitialize filter.
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.
#define ecs_ftime_t
Customizable precision for scalar time values.
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.
ecs_filter_t ECS_FILTER_INIT
Use this variable to initialize user-allocated filter object.
@ EcsOptional
The term may match.
const ecs_world_info_t * ecs_get_world_info(const ecs_world_t *world)
Get world info.
const ecs_world_t * ecs_get_world(const ecs_poly_t *poly)
Get world from poly.
Used with ecs_filter_init.
ecs_term_t terms[(16)]
Terms of the filter.
ecs_filter_t * storage
External storage to prevent allocation of the filter object.
Filters alllow for ad-hoc quick filtering of entity tables.
ecs_term_t * terms
Array containing terms for filter.
int32_t term_count
Number of elements in terms array.
Type that describes a term (single element in a query)
ecs_id_t id
Component id to be matched by term.
ecs_oper_kind_t oper
Operator of term.
Type that contains information about the world.
float delta_time
Time passed to or computed by ecs_progress.
flecs::type type() const
Get the entity's type.
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.
flecs::entity lookup(const char *path) const
Lookup an entity by name.
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 is 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.
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.
void children(Func &&func) const
Iterate children for entity.
bool owns(flecs::id_t e) const
Check if entity owns the provided entity.
flecs::table table() const
Get the entity's table.
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.
ecs_ftime_t delta_time() const
Get current delta time.
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 is entity is alive.
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.
void children(Func &&func) const
Iterate children for entity.
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.
bool enabled() const
Test if component is enabled.
void children(flecs::entity_t rel, Func &&func) const
Iterate children for entity.
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.