Flecs v4.0
A fast entity component system (ECS) for C & C++
Loading...
Searching...
No Matches
entity_view.hpp
Go to the documentation of this file.
1
13#pragma once
14
20namespace flecs
21{
22
28struct entity_view : public id {
29
30 entity_view() : flecs::id() { }
31
37 explicit entity_view(flecs::world_t *world, flecs::id_t id)
38 : flecs::id(world
39 ? const_cast<flecs::world_t*>(ecs_get_world(world))
40 : nullptr
41 , id ) { }
42
44 entity_view(entity_t id)
45 : flecs::id( nullptr, id ) { }
46
50 entity_t id() const {
51 return id_;
52 }
53
63 bool is_valid() const {
64 return world_ && ecs_is_valid(world_, id_);
65 }
66
67 explicit operator bool() const {
68 return is_valid();
69 }
70
76 bool is_alive() const {
77 return world_ && ecs_is_alive(world_, id_);
78 }
79
85 return flecs::string_view(ecs_get_name(world_, id_));
86 }
87
93 return flecs::string_view(ecs_get_symbol(world_, id_));
94 }
95
100 flecs::string path(const char *sep = "::", const char *init_sep = "::") const {
101 return path_from(0, sep, init_sep);
102 }
103
108 flecs::string path_from(flecs::entity_t parent, const char *sep = "::", const char *init_sep = "::") const {
109 char *path = ecs_get_path_w_sep(world_, parent, id_, sep, init_sep);
110 return flecs::string(path);
111 }
112
117 template <typename Parent>
118 flecs::string path_from(const char *sep = "::", const char *init_sep = "::") const {
119 return path_from(_::type<Parent>::id(world_), sep, init_sep);
120 }
121
122 bool enabled() const {
123 return !ecs_has_id(world_, id_, flecs::Disabled);
124 }
125
130 flecs::type type() const;
131
136 flecs::table table() const;
137
146
156 template <typename Func>
157 void each(const Func& func) const;
158
168 template <typename Func>
169 void each(flecs::id_t first, flecs::id_t second, const Func& func) const;
170
181 template <typename Func>
182 void each(const flecs::entity_view& rel, const Func& func) const;
183
194 template <typename First, typename Func>
195 void each(const Func& func) const {
196 return each(_::type<First>::id(world_), func);
197 }
198
209 template <typename Func>
210 void children(flecs::entity_t rel, Func&& func) const {
211 /* When the entity is a wildcard, this would attempt to query for all
212 * entities with (ChildOf, *) or (ChildOf, _) instead of querying for
213 * the children of the wildcard entity. */
214 if (id_ == flecs::Wildcard || id_ == flecs::Any) {
215 /* This is correct, wildcard entities don't have children */
216 return;
217 }
218
219 flecs::world world(world_);
220
221 ecs_iter_t it = ecs_children_w_rel(world_, rel, id_);
222 while (ecs_children_next(&it)) {
223 _::each_delegate<Func>(FLECS_MOV(func)).invoke(&it);
224 }
225 }
226
237 template <typename Rel, typename Func>
238 void children(Func&& func) const {
239 children(_::type<Rel>::id(world_), FLECS_MOV(func));
240 }
241
253 template <typename Func>
254 void children(Func&& func) const {
255 children(flecs::ChildOf, FLECS_MOV(func));
256 }
257
258
259 /* try_get */
260
267 template <typename T, if_t< is_actual<T>::value > = 0>
268 const T* try_get() const {
269 auto comp_id = _::type<T>::id(world_);
270 ecs_assert(_::type<T>::size() != 0, ECS_INVALID_PARAMETER,
271 "operation invalid for empty type");
272 return static_cast<const T*>(ecs_get_id(world_, id_, comp_id));
273 }
274
283 template <typename T, typename A = actual_type_t<T>,
284 if_t< flecs::is_pair<T>::value > = 0>
285 const A* try_get() const {
286 auto comp_id = _::type<T>::id(world_);
287 ecs_assert(_::type<A>::size() != 0, ECS_INVALID_PARAMETER,
288 "operation invalid for empty type");
289 return static_cast<const A*>(ecs_get_id(world_, id_, comp_id));
290 }
291
298 template <typename First, typename Second, typename P = pair<First, Second>,
299 typename A = actual_type_t<P>, if_not_t< flecs::is_pair<First>::value > = 0>
300 const A* try_get() const {
301 return this->try_get<P>();
302 }
303
310 template<typename First, typename Second, if_not_t< is_enum<Second>::value> = 0>
311 const First* try_get(Second second) const {
312 auto first = _::type<First>::id(world_);
313 ecs_assert(_::type<First>::size() != 0, ECS_INVALID_PARAMETER,
314 "operation invalid for empty type");
315 return static_cast<const First*>(
316 ecs_get_id(world_, id_, ecs_pair(first, second)));
317 }
318
325 template<typename First, typename Second, if_t< is_enum<Second>::value && !std::is_same<First, Second>::value > = 0>
326 const First* try_get(Second constant) const {
327 const auto& et = enum_type<Second>(this->world_);
328 flecs::entity_t target = et.entity(constant);
329 return try_get<First>(target);
330 }
331
338 const void* try_get(flecs::id_t comp) const {
339 return ecs_get_id(world_, id_, comp);
340 }
341
350 const void* try_get(flecs::entity_t first, flecs::entity_t second) const {
351 return ecs_get_id(world_, id_, ecs_pair(first, second));
352 }
353
361 template<typename Second>
362 const Second* try_get_second(flecs::entity_t first) const {
363 auto second = _::type<Second>::id(world_);
364 ecs_assert( ecs_get_type_info(world_, ecs_pair(first, second)) != NULL,
365 ECS_INVALID_PARAMETER, "pair is not a component");
366 ecs_assert( ecs_get_type_info(world_, ecs_pair(first, second))->component == second,
367 ECS_INVALID_PARAMETER, "type of pair is not Second");
368 ecs_assert(_::type<Second>::size() != 0, ECS_INVALID_PARAMETER,
369 "operation invalid for empty type");
370 return static_cast<const Second*>(
371 ecs_get_id(world_, id_, ecs_pair(first, second)));
372 }
373
381 template<typename First, typename Second>
382 const Second* try_get_second() const {
383 return try_get<pair_object<First, Second>>();
384 }
385
386
387 /* get */
388
395 template <typename T, if_t< is_actual<T>::value > = 0>
396 const T& get() const {
397 const T *r = try_get<T>();
398 ecs_assert(r != nullptr, ECS_INVALID_OPERATION,
399 "invalid get: entity does not have component (use try_get)");
400 return *r;
401 }
402
411 template <typename T, typename A = actual_type_t<T>,
412 if_t< flecs::is_pair<T>::value > = 0>
413 const A& get() const {
414 const A *r = try_get<T>();
415 ecs_assert(r != nullptr, ECS_INVALID_OPERATION,
416 "invalid get: entity does not have component (use try_get)");
417 return *r;
418 }
419
428 template <typename First, typename Second, typename P = pair<First, Second>,
429 typename A = actual_type_t<P>, if_not_t< flecs::is_pair<First>::value > = 0>
430 const A& get() const {
431 return this->get<P>();
432 }
433
442 template<typename First, typename Second, if_not_t< is_enum<Second>::value> = 0>
443 const First& get(Second second) const {
444 const First *r = try_get<First>(second);
445 ecs_assert(r != nullptr, ECS_INVALID_OPERATION,
446 "invalid get: entity does not have component (use try_get)");
447 return *r;
448 }
449
458 template<typename First, typename Second, if_t< is_enum<Second>::value && !std::is_same<First, Second>::value > = 0>
459 const First& get(Second constant) const {
460 const auto& et = enum_type<Second>(this->world_);
461 flecs::entity_t target = et.entity(constant);
462 return get<First>(target);
463 }
464
471 const void* get(flecs::id_t comp) const {
472 const void *r = ecs_get_id(world_, id_, comp);
473 ecs_assert(r != nullptr, ECS_INVALID_OPERATION,
474 "invalid get: entity does not have component (use try_get)");
475 return r;
476 }
477
488 const void* get(flecs::entity_t first, flecs::entity_t second) const {
489 const void *r = ecs_get_id(world_, id_, ecs_pair(first, second));
490 ecs_assert(r != nullptr, ECS_INVALID_OPERATION,
491 "invalid get: entity does not have component (use try_get)");
492 return r;
493 }
494
529 template <typename Func, if_t< is_callable<Func>::value > = 0>
530 bool get(const Func& func) const;
531
539 template<typename Second>
540 const Second& get_second(flecs::entity_t first) const {
541 const Second *r = try_get_second<Second>(first);
542 ecs_assert(r != nullptr, ECS_INVALID_OPERATION,
543 "invalid get: entity does not have component (use try_get)");
544 return *r;
545 }
546
554 template<typename First, typename Second>
555 const Second& get_second() const {
556 const Second *r = try_get<First, Second>();
557 ecs_assert(r != nullptr, ECS_INVALID_OPERATION,
558 "invalid get: entity does not have component (use try_get)");
559 return *r;
560 }
561
562
563 /* try_get_mut */
564
571 template <typename T, if_t< is_actual<T>::value > = 0>
572 T* try_get_mut() const {
573 auto comp_id = _::type<T>::id(world_);
574 ecs_assert(_::type<T>::size() != 0, ECS_INVALID_PARAMETER,
575 "operation invalid for empty type");
576 return static_cast<T*>(ecs_get_mut_id(world_, id_, comp_id));
577 }
578
587 template <typename T, typename A = actual_type_t<T>,
588 if_t< flecs::is_pair<T>::value > = 0>
589 A* try_get_mut() const {
590 auto comp_id = _::type<T>::id(world_);
591 ecs_assert(_::type<A>::size() != 0, ECS_INVALID_PARAMETER,
592 "operation invalid for empty type");
593 return static_cast<A*>(ecs_get_mut_id(world_, id_, comp_id));
594 }
595
602 template <typename First, typename Second, typename P = pair<First, Second>,
603 typename A = actual_type_t<P>, if_not_t< flecs::is_pair<First>::value > = 0>
604 A* try_get_mut() const {
605 return this->try_get_mut<P>();
606 }
607
614 template<typename First, typename Second, if_not_t< is_enum<Second>::value> = 0>
615 First* try_get_mut(Second second) const {
616 auto first = _::type<First>::id(world_);
617 ecs_assert(_::type<First>::size() != 0, ECS_INVALID_PARAMETER,
618 "operation invalid for empty type");
619 return static_cast<First*>(
620 ecs_get_mut_id(world_, id_, ecs_pair(first, second)));
621 }
622
629 template<typename First, typename Second, if_t< is_enum<Second>::value && !std::is_same<First, Second>::value > = 0>
630 First* try_get_mut(Second constant) const {
631 const auto& et = enum_type<Second>(this->world_);
632 flecs::entity_t target = et.entity(constant);
633 return get_mut<First>(target);
634 }
635
642 void* try_get_mut(flecs::id_t comp) const {
643 return ecs_get_mut_id(world_, id_, comp);
644 }
645
654 void* try_get_mut(flecs::entity_t first, flecs::entity_t second) const {
655 return ecs_get_mut_id(world_, id_, ecs_pair(first, second));
656 }
657
665 template<typename Second>
666 Second* try_get_mut_second(flecs::entity_t first) const {
667 auto second = _::type<Second>::id(world_);
668 ecs_assert( ecs_get_type_info(world_, ecs_pair(first, second)) != NULL,
669 ECS_INVALID_PARAMETER, "pair is not a component");
670 ecs_assert( ecs_get_type_info(world_, ecs_pair(first, second))->component == second,
671 ECS_INVALID_PARAMETER, "type of pair is not Second");
672 ecs_assert(_::type<Second>::size() != 0, ECS_INVALID_PARAMETER,
673 "operation invalid for empty type");
674 return static_cast<Second*>(
675 ecs_get_mut_id(world_, id_, ecs_pair(first, second)));
676 }
677
685 template<typename First, typename Second>
686 Second* try_get_mut_second() const {
687 return get_mut<pair_object<First, Second>>();
688 }
689
690
691 /* get_mut */
692
699 template <typename T, if_t< is_actual<T>::value > = 0>
700 T& get_mut() const {
701 T* r = try_get_mut<T>();
702 ecs_assert(r != nullptr, ECS_INVALID_OPERATION,
703 "invalid get_mut: entity does not have component (use try_get_mut)");
704 return *r;
705 }
706
715 template <typename T, typename A = actual_type_t<T>,
716 if_t< flecs::is_pair<T>::value > = 0>
717 A& get_mut() const {
718 A* r = try_get_mut<T>();
719 ecs_assert(r != nullptr, ECS_INVALID_OPERATION,
720 "invalid get_mut: entity does not have component (use try_get_mut)");
721 return *r;
722 }
723
730 template <typename First, typename Second, typename P = pair<First, Second>,
731 typename A = actual_type_t<P>, if_not_t< flecs::is_pair<First>::value > = 0>
732 A& get_mut() const {
733 A* r = try_get_mut<First, Second>();
734 ecs_assert(r != nullptr, ECS_INVALID_OPERATION,
735 "invalid get_mut: entity does not have component (use try_get_mut)");
736 return *r;
737 }
738
745 template<typename First, typename Second, if_not_t< is_enum<Second>::value> = 0>
746 First& get_mut(Second second) const {
747 First* r = try_get_mut<First>(second);
748 ecs_assert(r != nullptr, ECS_INVALID_OPERATION,
749 "invalid get_mut: entity does not have component (use try_get_mut)");
750 return *r;
751 }
752
759 template<typename First, typename Second, if_t< is_enum<Second>::value && !std::is_same<First, Second>::value > = 0>
760 First& get_mut(Second constant) const {
761 const auto& et = enum_type<Second>(this->world_);
762 flecs::entity_t target = et.entity(constant);
763 return get_mut<First>(target);
764 }
765
772 void* get_mut(flecs::id_t comp) const {
773 void *r = ecs_get_mut_id(world_, id_, comp);
774 ecs_assert(r != nullptr, ECS_INVALID_OPERATION,
775 "invalid get_mut: entity does not have component (use try_get_mut)");
776 return r;
777 }
778
787 void* get_mut(flecs::entity_t first, flecs::entity_t second) const {
788 void *r = ecs_get_mut_id(world_, id_, ecs_pair(first, second));
789 ecs_assert(r != nullptr, ECS_INVALID_OPERATION,
790 "invalid get_mut: entity does not have component (use try_get_mut)");
791 return r;
792 }
793
801 template<typename Second>
802 Second& get_mut_second(flecs::entity_t first) const {
803 Second *r = try_get_mut_second<Second>(first);
804 ecs_assert(r != nullptr, ECS_INVALID_OPERATION,
805 "invalid get_mut: entity does not have component (use try_get_mut)");
806 return *r;
807 }
808
816 template<typename First, typename Second>
817 Second* get_mut_second() const {
818 Second *r = try_get_mut_second<First, Second>();
819 ecs_assert(r != nullptr, ECS_INVALID_OPERATION,
820 "invalid get_mut: entity does not have component (use try_get_mut)");
821 return *r;
822 }
823
825 template<typename Enum>
826 Enum get_constant() const;
827
836 template<typename First>
837 flecs::entity target(int32_t index = 0) const;
838
847 flecs::entity target(flecs::entity_t first, int32_t index = 0) const;
848
867 flecs::entity target_for(flecs::entity_t relationship, flecs::id_t id) const;
868
869 template <typename T>
870 flecs::entity target_for(flecs::entity_t relationship) const;
871
872 template <typename First, typename Second>
873 flecs::entity target_for(flecs::entity_t relationship) const;
874
880 int32_t depth(flecs::entity_t rel) const {
881 return ecs_get_depth(world_, id_, rel);
882 }
883
889 template<typename Rel>
890 int32_t depth() const {
891 return this->depth(_::type<Rel>::id(world_));
892 }
893
899 flecs::entity parent() const;
900
909 flecs::entity lookup(const char *path, bool search_path = false) const;
910
916 bool has(flecs::id_t e) const {
917 return ecs_has_id(world_, id_, e);
918 }
919
925 template <typename T>
926 bool has() const {
927 flecs::id_t cid = _::type<T>::id(world_);
928 bool result = ecs_has_id(world_, id_, cid);
929 if (result) {
930 return result;
931 }
932
933 if (is_enum<T>::value) {
934 return ecs_has_pair(world_, id_, cid, flecs::Wildcard);
935 }
936
937 return false;
938 }
939
946 template <typename E, if_t< is_enum<E>::value > = 0>
947 bool has(E value) const {
948 auto r = _::type<E>::id(world_);
949 auto o = enum_type<E>(world_).entity(value);
950 ecs_assert(o, ECS_INVALID_PARAMETER,
951 "Constant was not found in Enum reflection data."
952 " Did you mean to use has<E>() instead of has(E)?");
953 return ecs_has_pair(world_, id_, r, o);
954 }
955
962 template <typename First, typename Second>
963 bool has() const {
964 return this->has<First>(_::type<Second>::id(world_));
965 }
966
973 template<typename First, typename Second, if_not_t< is_enum<Second>::value > = 0>
974 bool has(Second second) const {
975 auto comp_id = _::type<First>::id(world_);
976 return ecs_has_id(world_, id_, ecs_pair(comp_id, second));
977 }
978
985 template <typename Second>
986 bool has_second(flecs::entity_t first) const {
987 return this->has(first, _::type<Second>::id(world_));
988 }
989
996 template<typename First, typename E, if_t< is_enum<E>::value && !std::is_same<First, E>::value > = 0>
997 bool has(E value) const {
998 const auto& et = enum_type<E>(this->world_);
999 flecs::entity_t second = et.entity(value);
1000 return has<First>(second);
1001 }
1002
1009 bool has(flecs::id_t first, flecs::id_t second) const {
1010 return ecs_has_id(world_, id_, ecs_pair(first, second));
1011 }
1012
1019 bool owns(flecs::id_t e) const {
1020 return ecs_owns_id(world_, id_, e);
1021 }
1022
1029 template <typename First>
1030 bool owns(flecs::id_t second) const {
1031 auto comp_id = _::type<First>::id(world_);
1032 return owns(ecs_pair(comp_id, second));
1033 }
1034
1041 bool owns(flecs::id_t first, flecs::id_t second) const {
1042 return owns(ecs_pair(first, second));
1043 }
1044
1051 template <typename T>
1052 bool owns() const {
1053 return owns(_::type<T>::id(world_));
1054 }
1055
1063 template <typename First, typename Second>
1064 bool owns() const {
1065 return owns(
1066 _::type<First>::id(world_),
1067 _::type<Second>::id(world_));
1068 }
1069
1075 bool enabled(flecs::id_t id) const {
1076 return ecs_is_enabled_id(world_, id_, id);
1077 }
1078
1084 template<typename T>
1085 bool enabled() const {
1086 return this->enabled(_::type<T>::id(world_));
1087 }
1088
1095 bool enabled(flecs::id_t first, flecs::id_t second) const {
1096 return this->enabled(ecs_pair(first, second));
1097 }
1098
1105 template <typename First>
1106 bool enabled(flecs::id_t second) const {
1107 return this->enabled(_::type<First>::id(world_), second);
1108 }
1109
1116 template <typename First, typename Second>
1117 bool enabled() const {
1118 return this->enabled<First>(_::type<Second>::id(world_));
1119 }
1120
1121 flecs::entity clone(bool clone_value = true, flecs::entity_t dst_id = 0) const;
1122
1142 flecs::entity mut(const flecs::world& stage) const;
1143
1151 flecs::entity mut(const flecs::iter& it) const;
1152
1161 flecs::entity mut(const flecs::entity_view& e) const;
1162
1163# ifdef FLECS_JSON
1165# endif
1166# ifdef FLECS_DOC
1168# endif
1169# ifdef FLECS_ALERTS
1171# endif
1172
1175
1176private:
1177 flecs::entity set_stage(world_t *stage);
1178};
1179
1180}
1181
Alerts entity mixin.
component< T > & constant(const char *name, T value)
Add constant.
Definition component.inl:31
Doc entity view mixin.
Enum entity view mixin.
Event entity mixin.
#define ecs_assert(condition, error_code,...)
Assert.
Definition log.h:368
const ecs_type_info_t * ecs_get_type_info(const ecs_world_t *world, ecs_id_t component)
Get the type info for an component.
bool ecs_children_next(ecs_iter_t *it)
Progress an iterator created with ecs_children().
ecs_iter_t ecs_children_w_rel(const ecs_world_t *world, ecs_entity_t relationship, ecs_entity_t parent)
Same as ecs_children() but with custom relationship argument.
bool ecs_is_enabled_id(const ecs_world_t *world, ecs_entity_t entity, ecs_id_t component)
Test if component is enabled.
bool ecs_owns_id(const ecs_world_t *world, ecs_entity_t entity, ecs_id_t component)
Test if an entity owns a component.
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_has_id(const ecs_world_t *world, ecs_entity_t entity, ecs_id_t component)
Test if an entity has a component.
const void * ecs_get_id(const ecs_world_t *world, ecs_entity_t entity, ecs_id_t component)
Get an immutable pointer to a component.
void * ecs_get_mut_id(const ecs_world_t *world, ecs_entity_t entity, ecs_id_t component)
Get a mutable 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.
JSON entity mixin.
Component added to enum type entities.
Definition meta.h:285
Iterator.
Definition flecs.h:1142
Component class.
flecs::type type() const
Get the entity's type.
Definition impl.hpp:94
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.
const Second * try_get_second(flecs::entity_t first) const
Get the second part for a pair.
bool has(flecs::id_t first, flecs::id_t second) const
Check if entity has the provided pair.
First & get_mut(Second constant) const
Get a mutable pair.
T & get_mut() const
Get mutable component value.
A & get_mut() const
Get mutable component value.
flecs::string_view name() const
Return the entity name.
bool owns(flecs::id_t second) const
Check if entity owns the provided pair.
const A * try_get() const
Get 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.
const void * try_get(flecs::entity_t first, flecs::entity_t second) const
Get a pair (untyped).
flecs::string_view symbol() const
Return the entity symbol.
void each(const Func &func) const
Iterate targets for a given relationship.
A & get_mut() const
Get a mutable pair.
flecs::table_range range() const
Get table range for the entity.
Definition impl.hpp:102
void * get_mut(flecs::entity_t first, flecs::entity_t second) const
Get a mutable pair (untyped).
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 owns() const
Check if entity owns the provided pair.
const T & get() const
Get component value.
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.
Definition impl.hpp:50
bool has_second(flecs::entity_t first) const
Check if entity has the provided pair.
const First * try_get(Second constant) const
Get a pair.
Second * try_get_mut_second(flecs::entity_t first) const
Get the second part for a pair.
flecs::entity lookup(const char *path, bool search_path=false) const
Lookup an entity by name.
Definition impl.hpp:172
const First & get(Second second) const
Get a pair.
void children(Func &&func) const
Iterate children for entity.
const void * try_get(flecs::id_t comp) const
Get component value (untyped).
bool owns(flecs::id_t e) const
Check if entity owns the provided entity.
Second & get_mut_second(flecs::entity_t first) const
Get the second part for a pair.
const First & get(Second constant) const
Get a pair.
flecs::table table() const
Get the entity's table.
Definition impl.hpp:98
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.
A * try_get_mut() const
Get mutable component value.
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.
Definition impl.hpp:68
const First * try_get(Second second) const
Get a pair.
void * get_mut(flecs::id_t comp) const
Get mutable component value (untyped).
A * try_get_mut() const
Get a mutable pair.
void each(const Func &func) const
Iterate (component) ids of an entity.
Definition impl.hpp:112
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.
const A & get() const
Get a pair.
bool has() const
Check if entity has the provided component.
T * try_get_mut() const
Get mutable component value.
bool owns(flecs::id_t first, flecs::id_t second) const
Check if entity owns the provided pair.
void * try_get_mut(flecs::id_t comp) const
Get mutable component value (untyped).
void children(Func &&func) const
Iterate children for entity.
const A & get() const
Get component value.
Enum get_constant() const
Get enum constant for enum relationship.
Definition impl.hpp:30
First & get_mut(Second second) const
Get a mutable pair.
Second * try_get_mut_second() const
Get the second part for a pair.
void * try_get_mut(flecs::entity_t first, flecs::entity_t second) const
Get a mutable pair (untyped).
First * try_get_mut(Second second) const
Get a mutable pair.
entity_t id() const
Get entity id.
flecs::entity target(int32_t index=0) const
Get target for a given pair.
Definition impl.hpp:36
const T * try_get() const
Get component value.
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.
First * try_get_mut(Second constant) const
Get a mutable pair.
bool enabled() const
Test if component is enabled.
const Second * try_get_second() const
Get the second part for a pair.
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...
Definition impl.hpp:72
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.
const A * try_get() const
Get component value.
Entity.
Definition entity.hpp:30
Class that wraps around a flecs::id_t.
Definition decl.hpp:27
flecs::entity second() const
Get second element from a pair.
Definition impl.hpp:31
flecs::entity first() const
Get first element from a pair.
Definition impl.hpp:20
Class for iterating over query results.
Definition iter.hpp:68
Type class.
Definition type.hpp:21
The world.
Definition world.hpp:158