Flecs: include/flecs/addons/cpp/entity_view.hpp Source File
Description: A fast entity component system (ECS) for C & C++

| 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
12
13#pragma once
14
16 * @ingroup cpp_entities
17 * @{
18 */
19
20namespace flecs
21{
22
28 struct entity_view : public id {
29
30 entity_view() : flecs::id() { }
31
32
35 * @param id The entity id.
36 */
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
55 *
56 * @return True if the entity is alive, false otherwise.
57 */
58 bool is_valid() const {
59 return world_ && ecs_is_valid(world_, id_);
60 }
61
62 explicit operator bool() const {
63 return is_valid();
64 }
65
67
68 * @return True if the entity is alive, false otherwise.
69 */
70 bool is_alive() const {
71 return world_ && ecs_is_alive(world_, id_);
72 }
73
78 flecs::string_view name() const {
79 return flecs::string_view(ecs_get_name(world_, id_));
80 }
81
84
86 flecs::string_view symbol() const {
87 return flecs::string_view(ecs_get_symbol(world_, id_));
88 }
89
94 flecs::string path(const char *sep = "::", const char *init_sep = "::") const {
95 return path_from(0, sep, init_sep);
96 }
97
101
102 flecs::string path_from(flecs::entity_t parent, const char *sep = "::", const char *init_sep = "::") const {
103 char *path = ecs_get_path_w_sep(world_, parent, id_, sep, init_sep);
104 return flecs::string(path);
105 }
106
111 template <typename Parent>
112 flecs::string path_from(const char *sep = "::", const char *init_sep = "::") const {
113 return path_from(_::type<Parent>::id(world_), sep, init_sep);
114 }
115
116 bool enabled() const {
117 return !ecs_has_id(world_, id_, flecs::Disabled);
118 }
119
124 flecs::type type() const;
125
130 flecs::table table() const;
131
139 flecs::table_range range() const;
140
150 template <typename Func>
151 void each(const Func& func) const;
152
162 template <typename Func>
163 void each(flecs::id_t first, flecs::id_t second, const Func& func) const;
164
175 template <typename Func>
176 void each(const flecs::entity_view& rel, const Func& func) const;
177
188 template <typename First, typename Func>
189 void each(const Func& func) const {
190 return each(_::type<First>::id(world_), func);
191 }
192
203 template <typename Func>
204 void children(flecs::entity_t rel, Func&& func) const {
205 /* When the entity is a wildcard, this would attempt to query for all
206 * entities with (ChildOf, *) or (ChildOf, _) instead of querying for
207 * the children of the wildcard entity. */
208 if (id_ == flecs::Wildcard || id_ == flecs::Any) {
209 /* This is correct, wildcard entities don't have children */
210 return;
211 }
212
213 flecs::world world(world_);
214
215 if (rel == flecs::ChildOf) {
216 ecs_iter_t it = ecs_children(world_, id_);
217 while (ecs_children_next(&it)) {
218 _::each_delegate<Func>(FLECS_MOV(func)).invoke(&it);
219 }
220 } else {
221 ecs_iter_t it = ecs_each_id(world_, ecs_pair(rel, id_));
222 while (ecs_each_next(&it)) {
223 _::each_delegate<Func>(FLECS_MOV(func)).invoke(&it);
224 }
225 }
226 }
227
238 template <typename Rel, typename Func>
239 void children(Func&& func) const {
240 children(_::type<Rel>::id(world_), FLECS_MOV(func));
241 }
242
254 template <typename Func>
255 void children(Func&& func) const {
256 children(flecs::ChildOf, FLECS_MOV(func));
257 }
258
259
260 /* try_get */
261
268 template <typename T, if_t< is_actual<T>::value > = 0>
269 const T* try_get() const {
270 auto comp_id = _::type<T>::id(world_);
271 ecs_assert(_::type<T>::size() != 0, ECS_INVALID_PARAMETER,
272 "operation invalid for empty type");
273 return static_cast<const T*>(ecs_get_id(world_, id_, comp_id));
274 }
275
284 template <typename T, typename A = actual_type_t<T>,
285 if_t< flecs::is_pair<T>::value > = 0>
286 const A* try_get() const {
287 auto comp_id = _::type<T>::id(world_);
288 ecs_assert(_::type<A>::size() != 0, ECS_INVALID_PARAMETER,
289 "operation invalid for empty type");
290 return static_cast<const A*>(ecs_get_id(world_, id_, comp_id));
291 }
292
299 template <typename First, typename Second, typename P = pair<First, Second>,
300 typename A = actual_type_t<P>, if_not_t< flecs::is_pair<First>::value > = 0>
301 const A* try_get() const {
302 return this->try_get<P>();
303 }
304
311 template<typename First, typename Second, if_not_t< is_enum<Second>::value> = 0>
312 const First* try_get(Second second) const {
313 auto first = _::type<First>::id(world_);
314 ecs_assert(_::type<First>::size() != 0, ECS_INVALID_PARAMETER,
315 "operation invalid for empty type");
316 return static_cast<const First*>(
317 ecs_get_id(world_, id_, ecs_pair(first, second)));
318 }
319
326 template<typename First, typename Second, if_t< is_enum<Second>::value && !std::is_same<First, Second>::value > = 0>
327 const First* try_get(Second constant) const {
328 const auto& et = enum_type<Second>(this->world_);
329 flecs::entity_t target = et.entity(constant);
330 return try_get<First>(target);
331 }
332
339 const void* try_get(flecs::id_t comp) const {
340 return ecs_get_id(world_, id_, comp);
341 }
342
351 const void* try_get(flecs::entity_t first, flecs::entity_t second) const {
352 return ecs_get_id(world_, id_, ecs_pair(first, second));
353 }
354
362 template<typename Second>
363 const Second* try_get_second(flecs::entity_t first) const {
364 auto second = _::type<Second>::id(world_);
365 ecs_assert( ecs_get_type_info(world_, ecs_pair(first, second)) != NULL,
366 ECS_INVALID_PARAMETER, "pair is not a component");
367 ecs_assert( ecs_get_type_info(world_, ecs_pair(first, second))->component == second,
368 ECS_INVALID_PARAMETER, "type of pair is not Second");
369 ecs_assert(_::type<Second>::size() != 0, ECS_INVALID_PARAMETER,
370 "operation invalid for empty type");
371 return static_cast<const Second*>(
372 ecs_get_id(world_, id_, ecs_pair(first, second)));
373 }
374
382 template<typename First, typename Second>
383 const Second* try_get_second() const {
384 return try_get<pair_object<First, Second>>();
385 }
386
387
388 /* get */
389
396 template <typename T, if_t< is_actual<T>::value > = 0>
397 const T& get() const {
398 const T *r = try_get<T>();
399 ecs_assert(r != nullptr, ECS_INVALID_OPERATION,
400 "invalid get: entity does not have component (use try_get)");
401 return *r;
402 }
403
412 template <typename T, typename A = actual_type_t<T>,
413 if_t< flecs::is_pair<T>::value > = 0>
414 const A& get() const {
415 const A *r = try_get<T>();
416 ecs_assert(r != nullptr, ECS_INVALID_OPERATION,
417 "invalid get: entity does not have component (use try_get)");
418 return *r;
419 }
420
429 template <typename First, typename Second, typename P = pair<First, Second>,
430 typename A = actual_type_t<P>, if_not_t< flecs::is_pair<First>::value > = 0>
431 const A& get() const {
432 return this->get<P>();
433 }
434
443 template<typename First, typename Second, if_not_t< is_enum<Second>::value> = 0>
444 const First& get(Second second) const {
445 const First *r = try_get<First>(second);
446 ecs_assert(r != nullptr, ECS_INVALID_OPERATION,
447 "invalid get: entity does not have component (use try_get)");
448 return *r;
449 }
450
459 template<typename First, typename Second, if_t< is_enum<Second>::value && !std::is_same<First, Second>::value > = 0>
460 const First& get(Second constant) const {
461 const auto& et = enum_type<Second>(this->world_);
462 flecs::entity_t target = et.entity(constant);
463 return get<First>(target);
464 }
465
472 const void* get(flecs::id_t comp) const {
473 const void *r = ecs_get_id(world_, id_, comp);
474 ecs_assert(r != nullptr, ECS_INVALID_OPERATION,
475 "invalid get: entity does not have component (use try_get)");
476 return r;
477 }
478
489 const void* get(flecs::entity_t first, flecs::entity_t second) const {
490 const void *r = ecs_get_id(world_, id_, ecs_pair(first, second));
491 ecs_assert(r != nullptr, ECS_INVALID_OPERATION,
492 "invalid get: entity does not have component (use try_get)");
493 return r;
494 }
495
530 template <typename Func, if_t< is_callable<Func>::value > = 0>
531 bool get(const Func& func) const;
532
540 template<typename Second>
541 const Second& get_second(flecs::entity_t first) const {
542 const Second *r = try_get_second<Second>(first);
543 ecs_assert(r != nullptr, ECS_INVALID_OPERATION,
544 "invalid get: entity does not have component (use try_get)");
545 return *r;
546 }
547
555 template<typename First, typename Second>
556 const Second& get_second() const {
557 const Second *r = try_get<First, Second>();
558 ecs_assert(r != nullptr, ECS_INVALID_OPERATION,
559 "invalid get: entity does not have component (use try_get)");
560 return *r;
561 }
562
563
564 /* try_get_mut */
565
572 template <typename T, if_t< is_actual<T>::value > = 0>
573 T* try_get_mut() const {
574 auto comp_id = _::type<T>::id(world_);
575 ecs_assert(_::type<T>::size() != 0, ECS_INVALID_PARAMETER,
576 "operation invalid for empty type");
577 return static_cast<T*>(ecs_get_mut_id(world_, id_, comp_id));
578 }
579
588 template <typename T, typename A = actual_type_t<T>,
589 if_t< flecs::is_pair<T>::value > = 0>
590 A* try_get_mut() const {
591 auto comp_id = _::type<T>::id(world_);
592 ecs_assert(_::type<A>::size() != 0, ECS_INVALID_PARAMETER,
593 "operation invalid for empty type");
594 return static_cast<A*>(ecs_get_mut_id(world_, id_, comp_id));
595 }
596
603 template <typename First, typename Second, typename P = pair<First, Second>,
604 typename A = actual_type_t<P>, if_not_t< flecs::is_pair<First>::value > = 0>
605 A* try_get_mut() const {
606 return this->try_get_mut<P>();
607 }
608
615 template<typename First, typename Second, if_not_t< is_enum<Second>::value> = 0>
616 First* try_get_mut(Second second) const {
617 auto first = _::type<First>::id(world_);
618 ecs_assert(_::type<First>::size() != 0, ECS_INVALID_PARAMETER,
619 "operation invalid for empty type");
620 return static_cast<First*>(
621 ecs_get_mut_id(world_, id_, ecs_pair(first, second)));
622 }
623
630 template<typename First, typename Second, if_t< is_enum<Second>::value && !std::is_same<First, Second>::value > = 0>
631 First* try_get_mut(Second constant) const {
632 const auto& et = enum_type<Second>(this->world_);
633 flecs::entity_t target = et.entity(constant);
634 return get_mut<First>(target);
635 }
636
643 void* try_get_mut(flecs::id_t comp) const {
644 return ecs_get_mut_id(world_, id_, comp);
645 }
646
655 void* try_get_mut(flecs::entity_t first, flecs::entity_t second) const {
656 return ecs_get_mut_id(world_, id_, ecs_pair(first, second));
657 }
658
666 template<typename Second>
667 Second* try_get_mut_second(flecs::entity_t first) const {
668 auto second = _::type<Second>::id(world_);
669 ecs_assert( ecs_get_type_info(world_, ecs_pair(first, second)) != NULL,
670 ECS_INVALID_PARAMETER, "pair is not a component");
671 ecs_assert( ecs_get_type_info(world_, ecs_pair(first, second))->component == second,
672 ECS_INVALID_PARAMETER, "type of pair is not Second");
673 ecs_assert(_::type<Second>::size() != 0, ECS_INVALID_PARAMETER,
674 "operation invalid for empty type");
675 return static_cast<Second*>(
676 ecs_get_mut_id(world_, id_, ecs_pair(first, second)));
677 }
678
686 template<typename First, typename Second>
687 Second* try_get_mut_second() const {
688 return get_mut<pair_object<First, Second>>();
689 }
690
691
692 /* get_mut */
693
700 template <typename T, if_t< is_actual<T>::value > = 0>
701 T& get_mut() const {
702 T* r = try_get_mut<T>();
703 ecs_assert(r != nullptr, ECS_INVALID_OPERATION,
704 "invalid get_mut: entity does not have component (use try_get_mut)");
705 return *r;
706 }
707
716 template <typename T, typename A = actual_type_t<T>,
717 if_t< flecs::is_pair<T>::value > = 0>
718 A& get_mut() const {
719 A* r = try_get_mut<T>();
720 ecs_assert(r != nullptr, ECS_INVALID_OPERATION,
721 "invalid get_mut: entity does not have component (use try_get_mut)");
722 return *r;
723 }
724
731 template <typename First, typename Second, typename P = pair<First, Second>,
732 typename A = actual_type_t<P>, if_not_t< flecs::is_pair<First>::value > = 0>
733 A& get_mut() const {
734 A* r = try_get_mut<First, Second>();
735 ecs_assert(r != nullptr, ECS_INVALID_OPERATION,
736 "invalid get_mut: entity does not have component (use try_get_mut)");
737 return *r;
738 }
739
746 template<typename First, typename Second, if_not_t< is_enum<Second>::value> = 0>
747 First& get_mut(Second second) const {
748 First* r = try_get_mut<First>(second);
749 ecs_assert(r != nullptr, ECS_INVALID_OPERATION,
750 "invalid get_mut: entity does not have component (use try_get_mut)");
751 return *r;
752 }
753
760 template<typename First, typename Second, if_t< is_enum<Second>::value && !std::is_same<First, Second>::value > = 0>
761 First& get_mut(Second constant) const {
762 const auto& et = enum_type<Second>(this->world_);
763 flecs::entity_t target = et.entity(constant);
764 return get_mut<First>(target);
765 }
766
773 void* get_mut(flecs::id_t comp) const {
774 void *r = ecs_get_mut_id(world_, id_, comp);
775 ecs_assert(r != nullptr, ECS_INVALID_OPERATION,
776 "invalid get_mut: entity does not have component (use try_get_mut)");
777 return r;
778 }
779
788 void* get_mut(flecs::entity_t first, flecs::entity_t second) const {
789 void *r = ecs_get_mut_id(world_, id_, ecs_pair(first, second));
790 ecs_assert(r != nullptr, ECS_INVALID_OPERATION,
791 "invalid get_mut: entity does not have component (use try_get_mut)");
792 return r;
793 }
794
802 template<typename Second>
803 Second& get_mut_second(flecs::entity_t first) const {
804 Second *r = try_get_mut_second<Second>(first);
805 ecs_assert(r != nullptr, ECS_INVALID_OPERATION,
806 "invalid get_mut: entity does not have component (use try_get_mut)");
807 return *r;
808 }
809
817 template<typename First, typename Second>
818 Second* get_mut_second() const {
819 Second *r = try_get_mut_second<First, Second>();
820 ecs_assert(r != nullptr, ECS_INVALID_OPERATION,
821 "invalid get_mut: entity does not have component (use try_get_mut)");
822 return *r;
823 }
824
826 template<typename Enum>
827 Enum get_constant() const;
828
837 template<typename First>
838 flecs::entity target(int32_t index = 0) const;
839
848 flecs::entity target(flecs::entity_t first, int32_t index = 0) const;
849
868 flecs::entity target_for(flecs::entity_t relationship, flecs::id_t id) const;
869
870 template <typename T>
871 flecs::entity target_for(flecs::entity_t relationship) const;
872
873 template <typename First, typename Second>
874 flecs::entity target_for(flecs::entity_t relationship) const;
875
881 int32_t depth(flecs::entity_t rel) const {
882 return ecs_get_depth(world_, id_, rel);
883 }
884
890 template<typename Rel>
891 int32_t depth() const {
892 return this->depth(_::type<Rel>::id(world_));
893 }
894
900 flecs::entity parent() const;
901
910 flecs::entity lookup(const char *path, bool search_path = false) const;
911
917 bool has(flecs::id_t e) const {
918 return ecs_has_id(world_, id_, e);
919 }
920
926 template <typename T>
927 bool has() const {
928 flecs::id_t cid = _::type<T>::id(world_);
929 bool result = ecs_has_id(world_, id_, cid);
930 if (result) {
931 return result;
932 }
933
934 if (is_enum<T>::value) {
935 return ecs_has_pair(world_, id_, cid, flecs::Wildcard);
936 }
937
938 return false;
939 }
940
947 template <typename E, if_t< is_enum<E>::value > = 0>
948 bool has(E value) const {
949 auto r = _::type<E>::id(world_);
950 auto o = enum_type<E>(world_).entity(value);
951 ecs_assert(o, ECS_INVALID_PARAMETER,
952 "Constant was not found in Enum reflection data."
953 " Did you mean to use has<E>() instead of has(E)?");
954 return ecs_has_pair(world_, id_, r, o);
955 }
956
963 template <typename First, typename Second>
964 bool has() const {
965 return this->has<First>(_::type<Second>::id(world_));
966 }
967
974 template<typename First, typename Second, if_not_t< is_enum<Second>::value > = 0>
975 bool has(Second second) const {
976 auto comp_id = _::type<First>::id(world_);
977 return ecs_has_id(world_, id_, ecs_pair(comp_id, second));
978 }
979
986 template <typename Second>
987 bool has_second(flecs::entity_t first) const {
988 return this->has(first, _::type<Second>::id(world_));
989 }
990
997 template<typename First, typename E, if_t< is_enum<E>::value && !std::is_same<First, E>::value > = 0>
998 bool has(E value) const {
999 const auto& et = enum_type<E>(this->world_);
1000 flecs::entity_t second = et.entity(value);
1001 return has<First>(second);
1002 }
1003
1010 bool has(flecs::id_t first, flecs::id_t second) const {
1011 return ecs_has_id(world_, id_, ecs_pair(first, second));
1012 }
1013
1020 bool owns(flecs::id_t e) const {
1021 return ecs_owns_id(world_, id_, e);
1022 }
1023
1030 template <typename First>
1031 bool owns(flecs::id_t second) const {
1032 auto comp_id = _::type<First>::id(world_);
1033 return owns(ecs_pair(comp_id, second));
1034 }
1035
1042 bool owns(flecs::id_t first, flecs::id_t second) const {
1043 return owns(ecs_pair(first, second));
1044 }
1045
1052 template <typename T>
1053 bool owns() const {
1054 return owns(_::type<T>::id(world_));
1055 }
1056
1064 template <typename First, typename Second>
1065 bool owns() const {
1066 return owns(
1067 _::type<First>::id(world_),
1068 _::type<Second>::id(world_));
1069 }
1070
1076 bool enabled(flecs::id_t id) const {
1077 return ecs_is_enabled_id(world_, id_, id);
1078 }
1079
1085 template<typename T>
1086 bool enabled() const {
1087 return this->enabled(_::type<T>::id(world_));
1088 }
1089
1096 bool enabled(flecs::id_t first, flecs::id_t second) const {
1097 return this->enabled(ecs_pair(first, second));
1098 }
1099
1106 template <typename First>
1107 bool enabled(flecs::id_t second) const {
1108 return this->enabled(_::type<First>::id(world_), second);
1109 }
1110
1117 template <typename First, typename Second>
1118 bool enabled() const {
1119 return this->enabled<First>(_::type<Second>::id(world_));
1120 }
1121
1122 flecs::entity clone(bool clone_value = true, flecs::entity_t dst_id = 0) const;
1123
1143 flecs::entity mut(const flecs::world& stage) const;
1144
1152 flecs::entity mut(const flecs::iter& it) const;
1153
1162 flecs::entity mut(const flecs::entity_view& e) const;
1163
1164# ifdef FLECS_JSON
1165# include "mixins/json/entity_view.inl"
1166# endif
1167# ifdef FLECS_DOC
1168# include "mixins/doc/entity_view.inl"
1169# endif
1170# ifdef FLECS_ALERTS
1171# include "mixins/alerts/entity_view.inl"
1172# endif
1173
1174# include "mixins/enum/entity_view.inl"
1175# include "mixins/event/entity_view.inl"
1176
1177private:
1178 flecs::entity set_stage(world_t *stage);
1179};
1180
1181}
1182
entity_view.inl
Alerts entity mixin.
entity_view.inl
Doc entity view mixin.
entity_view.inl
Enum entity view mixin.
entity_view.inl
Event entity mixin.
ecs_assert
#define ecs_assert(condition, error_code,...)
Assert.
Definition log.h:368
ecs_get_type_info
const ecs_type_info_t * ecs_get_type_info(const ecs_world_t *world, ecs_id_t id)
Get the type for an id.
flecs::component::constant
untyped_component & constant(const char *name, T value)
Add constant.
Definition untyped_component.inl:192
ecs_children_next
bool ecs_children_next(ecs_iter_t *it)
Progress an iterator created with ecs_children().
ecs_each_next
bool ecs_each_next(ecs_iter_t *it)
Progress an iterator created with ecs_each_id().
ecs_children
ecs_iter_t ecs_children(const ecs_world_t *world, ecs_entity_t parent)
Iterate children of parent.
ecs_each_id
ecs_iter_t ecs_each_id(const ecs_world_t *world, ecs_id_t id)
Iterate all entities with specified (component id).
ecs_is_enabled_id
bool ecs_is_enabled_id(const ecs_world_t *world, ecs_entity_t entity, ecs_id_t id)
Test if component is enabled.
ecs_has_id
bool ecs_has_id(const ecs_world_t *world, ecs_entity_t entity, ecs_id_t id)
Test if an entity has an id.
ecs_owns_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.
ecs_get_depth
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.
ecs_get_mut_id
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.
ecs_get_id
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.
ecs_is_valid
bool ecs_is_valid(const ecs_world_t *world, ecs_entity_t e)
Test whether an entity is valid.
ecs_is_alive
bool ecs_is_alive(const ecs_world_t *world, ecs_entity_t e)
Test whether an entity is alive.
ecs_get_path_w_sep
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.
ecs_get_symbol
const char * ecs_get_symbol(const ecs_world_t *world, ecs_entity_t entity)
Get the symbol of an entity.
ecs_get_name
const char * ecs_get_name(const ecs_world_t *world, ecs_entity_t entity)
Get the name of an entity.
ecs_get_world
const ecs_world_t * ecs_get_world(const ecs_poly_t *poly)
Get world from poly.
entity_view.inl
JSON entity mixin.
ecs_iter_t
Iterator.
Definition flecs.h:1135
flecs::_::each_delegate
Definition delegate.hpp:225
flecs::_::type
Definition flecs.hpp:39
flecs::component
Component class.
Definition component.hpp:382
flecs::entity_view
Entity view.
Definition entity_view.hpp:28
flecs::entity_view::type
flecs::type type() const
Get the entity's type.
Definition impl.hpp:94
flecs::entity_view::entity_view
entity_view(entity_t id)
Implicit conversion from flecs::entity_t to flecs::entity_view.
Definition entity_view.hpp:44
flecs::entity_view::depth
int32_t depth(flecs::entity_t rel) const
Get depth for given relationship.
Definition entity_view.hpp:881
flecs::entity_view::enabled
bool enabled() const
Test if pair is enabled.
Definition entity_view.hpp:1118
flecs::entity_view::try_get_second
const Second * try_get_second(flecs::entity_t first) const
Get the second part for a pair.
Definition entity_view.hpp:363
flecs::entity_view::has
bool has(flecs::id_t first, flecs::id_t second) const
Check if entity has the provided pair.
Definition entity_view.hpp:1010
flecs::entity_view::get_mut
First & get_mut(Second constant) const
Get a mutable pair.
Definition entity_view.hpp:761
flecs::entity_view::get_mut
T & get_mut() const
Get mutable component value.
Definition entity_view.hpp:701
flecs::entity_view::get_mut
A & get_mut() const
Get mutable component value.
Definition entity_view.hpp:718
flecs::entity_view::name
flecs::string_view name() const
Return the entity name.
Definition entity_view.hpp:78
flecs::entity_view::owns
bool owns(flecs::id_t second) const
Check if entity owns the provided pair.
Definition entity_view.hpp:1031
flecs::entity_view::try_get
const A * try_get() const
Get a pair.
Definition entity_view.hpp:301
flecs::entity_view::is_valid
bool is_valid() const
Check if entity is valid.
Definition entity_view.hpp:58
flecs::entity_view::path
flecs::string path(const char *sep="::", const char *init_sep="::") const
Return the entity path.
Definition entity_view.hpp:94
flecs::entity_view::try_get
const void * try_get(flecs::entity_t first, flecs::entity_t second) const
Get a pair (untyped).
Definition entity_view.hpp:351
flecs::entity_view::symbol
flecs::string_view symbol() const
Return the entity symbol.
Definition entity_view.hpp:86
flecs::entity_view::each
void each(const Func &func) const
Iterate targets for a given relationship.
Definition entity_view.hpp:189
flecs::entity_view::get_mut
A & get_mut() const
Get a mutable pair.
Definition entity_view.hpp:733
flecs::entity_view::range
flecs::table_range range() const
Get table range for the entity.
Definition impl.hpp:102
flecs::entity_view::get_mut
void * get_mut(flecs::entity_t first, flecs::entity_t second) const
Get a mutable pair (untyped).
Definition entity_view.hpp:788
flecs::entity_view::get_second
const Second & get_second(flecs::entity_t first) const
Get the second part for a pair.
Definition entity_view.hpp:541
flecs::entity_view::get_second
const Second & get_second() const
Get the second part for a pair.
Definition entity_view.hpp:556
flecs::entity_view::owns
bool owns() const
Check if entity owns the provided pair.
Definition entity_view.hpp:1065
flecs::entity_view::get
const T & get() const
Get component value.
Definition entity_view.hpp:397
flecs::entity_view::has
bool has(E value) const
Check if entity has the provided pair.
Definition entity_view.hpp:998
flecs::entity_view::depth
int32_t depth() const
Get depth for given relationship.
Definition entity_view.hpp:891
flecs::entity_view::entity_view
entity_view(flecs::world_t *world, flecs::id_t id)
Wrap an existing entity id.
Definition entity_view.hpp:37
flecs::entity_view::enabled
bool enabled(flecs::id_t id) const
Test if id is enabled.
Definition entity_view.hpp:1076
flecs::entity_view::target_for
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
flecs::entity_view::has_second
bool has_second(flecs::entity_t first) const
Check if entity has the provided pair.
Definition entity_view.hpp:987
flecs::entity_view::try_get
const First * try_get(Second constant) const
Get a pair.
Definition entity_view.hpp:327
flecs::entity_view::try_get_mut_second
Second * try_get_mut_second(flecs::entity_t first) const
Get the second part for a pair.
Definition entity_view.hpp:667
flecs::entity_view::lookup
flecs::entity lookup(const char *path, bool search_path=false) const
Lookup an entity by name.
Definition impl.hpp:172
flecs::entity_view::get
const First & get(Second second) const
Get a pair.
Definition entity_view.hpp:444
flecs::entity_view::children
void children(Func &&func) const
Iterate children for entity.
Definition entity_view.hpp:239
flecs::entity_view::try_get
const void * try_get(flecs::id_t comp) const
Get component value (untyped).
Definition entity_view.hpp:339
flecs::entity_view::owns
bool owns(flecs::id_t e) const
Check if entity owns the provided entity.
Definition entity_view.hpp:1020
flecs::entity_view::get_mut_second
Second & get_mut_second(flecs::entity_t first) const
Get the second part for a pair.
Definition entity_view.hpp:803
flecs::entity_view::get
const First & get(Second constant) const
Get a pair.
Definition entity_view.hpp:460
flecs::entity_view::table
flecs::table table() const
Get the entity's table.
Definition impl.hpp:98
flecs::entity_view::path_from
flecs::string path_from(flecs::entity_t parent, const char *sep="::", const char *init_sep="::") const
Return the entity path relative to a parent.
Definition entity_view.hpp:102
flecs::entity_view::get_mut_second
Second * get_mut_second() const
Get the second part for a pair.
Definition entity_view.hpp:818
flecs::entity_view::enabled
bool enabled(flecs::id_t second) const
Test if pair is enabled.
Definition entity_view.hpp:1107
flecs::entity_view::has
bool has(Second second) const
Check if entity has the provided pair.
Definition entity_view.hpp:975
flecs::entity_view::try_get_mut
A * try_get_mut() const
Get mutable component value.
Definition entity_view.hpp:590
flecs::entity_view::has
bool has(flecs::id_t e) const
Check if entity has the provided entity.
Definition entity_view.hpp:917
flecs::entity_view::owns
bool owns() const
Check if entity owns the provided component.
Definition entity_view.hpp:1053
flecs::entity_view::parent
flecs::entity parent() const
Get parent of entity.
Definition impl.hpp:68
flecs::entity_view::try_get
const First * try_get(Second second) const
Get a pair.
Definition entity_view.hpp:312
flecs::entity_view::get_mut
void * get_mut(flecs::id_t comp) const
Get mutable component value (untyped).
Definition entity_view.hpp:773
flecs::entity_view::try_get_mut
A * try_get_mut() const
Get a mutable pair.
Definition entity_view.hpp:605
flecs::entity_view::each
void each(const Func &func) const
Iterate (component) ids of an entity.
Definition impl.hpp:112
flecs::entity_view::get
const void * get(flecs::entity_t first, flecs::entity_t second) const
Get a pair (untyped).
Definition entity_view.hpp:489
flecs::entity_view::is_alive
bool is_alive() const
Check if entity is alive.
Definition entity_view.hpp:70
flecs::entity_view::get
const A & get() const
Get a pair.
Definition entity_view.hpp:431
flecs::entity_view::has
bool has() const
Check if entity has the provided component.
Definition entity_view.hpp:927
flecs::entity_view::try_get_mut
T * try_get_mut() const
Get mutable component value.
Definition entity_view.hpp:573
flecs::entity_view::owns
bool owns(flecs::id_t first, flecs::id_t second) const
Check if entity owns the provided pair.
Definition entity_view.hpp:1042
flecs::entity_view::try_get_mut
void * try_get_mut(flecs::id_t comp) const
Get mutable component value (untyped).
Definition entity_view.hpp:643
flecs::entity_view::children
void children(Func &&func) const
Iterate children for entity.
Definition entity_view.hpp:255
flecs::entity_view::get
const A & get() const
Get component value.
Definition entity_view.hpp:414
flecs::entity_view::get_constant
Enum get_constant() const
Get enum constant for enum relationship.
Definition impl.hpp:30
flecs::entity_view::get_mut
First & get_mut(Second second) const
Get a mutable pair.
Definition entity_view.hpp:747
flecs::entity_view::try_get_mut_second
Second * try_get_mut_second() const
Get the second part for a pair.
Definition entity_view.hpp:687
flecs::entity_view::try_get_mut
void * try_get_mut(flecs::entity_t first, flecs::entity_t second) const
Get a mutable pair (untyped).
Definition entity_view.hpp:655
flecs::entity_view::try_get_mut
First * try_get_mut(Second second) const
Get a mutable pair.
Definition entity_view.hpp:616
flecs::entity_view::id
entity_t id() const
Get entity id.
Definition entity_view.hpp:50
flecs::entity_view::target
flecs::entity target(int32_t index=0) const
Get target for a given pair.
Definition impl.hpp:36
flecs::entity_view::try_get
const T * try_get() const
Get component value.
Definition entity_view.hpp:269
flecs::entity_view::get
const void * get(flecs::id_t comp) const
Get component value (untyped).
Definition entity_view.hpp:472
flecs::entity_view::has
bool has() const
Check if entity has the provided pair.
Definition entity_view.hpp:964
flecs::entity_view::path_from
flecs::string path_from(const char *sep="::", const char *init_sep="::") const
Return the entity path relative to a parent.
Definition entity_view.hpp:112
flecs::entity_view::try_get_mut
First * try_get_mut(Second constant) const
Get a mutable pair.
Definition entity_view.hpp:631
flecs::entity_view::enabled
bool enabled() const
Test if component is enabled.
Definition entity_view.hpp:1086
flecs::entity_view::try_get_second
const Second * try_get_second() const
Get the second part for a pair.
Definition entity_view.hpp:383
flecs::entity_view::children
void children(flecs::entity_t rel, Func &&func) const
Iterate children for entity.
Definition entity_view.hpp:204
flecs::entity_view::mut
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
flecs::entity_view::has
bool has(E value) const
Check if entity has the provided enum constant.
Definition entity_view.hpp:948
flecs::entity_view::enabled
bool enabled(flecs::id_t first, flecs::id_t second) const
Test if pair is enabled.
Definition entity_view.hpp:1096
flecs::entity_view::try_get
const A * try_get() const
Get component value.
Definition entity_view.hpp:286
flecs::entity
Entity.
Definition entity.hpp:30
flecs::id::second
flecs::entity second() const
Get second element from a pair.
Definition impl.hpp:31
flecs::id::first
flecs::entity first() const
Get first element from a pair.
Definition impl.hpp:20
flecs::iter
Class for iterating over query results.
Definition iter.hpp:68
flecs::string_view
Definition string.hpp:146
flecs::string
Definition string.hpp:13
flecs::table_range
Definition table.hpp:412
flecs::table
Definition table.hpp:18
flecs::type
Type class.
Definition type.hpp:21
flecs::world
The world.
Definition world.hpp:172