1#include "gaia/config/config.h"
7 GAIA_NODISCARD
inline const ComponentCache& comp_cache(
const World& world) {
8 return world.comp_cache();
11 GAIA_NODISCARD
inline ComponentCache& comp_cache_mut(World& world) {
12 return world.comp_cache_mut();
16 GAIA_NODISCARD
inline const ComponentCacheItem& comp_cache_add(World& world) {
17 return world.reg_comp<T>();
22 GAIA_NODISCARD
inline const EntityContainer& fetch(
const World& world, Entity entity) {
23 return world.fetch(entity);
26 GAIA_NODISCARD
inline EntityContainer& fetch_mut(World& world, Entity entity) {
27 return world.fetch(entity);
30 inline void del(World& world, Entity entity) {
34 GAIA_NODISCARD
inline Entity entity_from_id(
const World& world, EntityId
id) {
38 GAIA_NODISCARD
inline bool valid(
const World& world, Entity entity) {
39 return world.valid(entity);
42 GAIA_NODISCARD
inline bool is(
const World& world, Entity entity, Entity baseEntity) {
43 return world.is(entity, baseEntity);
46 GAIA_NODISCARD
inline bool is_base(
const World& world, Entity entity) {
47 return world.is_base(entity);
50 GAIA_NODISCARD
inline Archetype* archetype_from_entity(
const World& world, Entity entity) {
51 if (!world.valid(entity))
54 const auto& ec = world.fetch(entity);
61 GAIA_NODISCARD
inline util::str_view entity_name(
const World& world, Entity entity) {
62 const auto name = world.name(entity);
67 const auto display = world.display_name(entity);
75 GAIA_NODISCARD
inline util::str_view entity_name(
const World& world, EntityId entityId) {
76 return entity_name(world, world.get(entityId));
79 GAIA_NODISCARD
inline Entity target(
const World& world, Entity entity, Entity relation) {
80 return world.target(entity, relation);
85 template <
typename Func>
86 inline void as_relations_trav(
const World& world, Entity target, Func func) {
87 world.as_relations_trav(target, func);
90 template <
typename Func>
91 inline bool as_relations_trav_if(
const World& world, Entity target, Func func) {
92 return world.as_relations_trav_if(target, func);
95 template <
typename Func>
96 inline void as_targets_trav(
const World& world, Entity relation, Func func) {
97 world.as_targets_trav(relation, func);
100 template <
typename Func>
101 inline bool as_targets_trav_if(
const World& world, Entity relation, Func func) {
102 return world.as_targets_trav_if(relation, func);
105 template <
typename Func>
106 inline void targets_trav(
const World& world, Entity relation, Entity source, Func func) {
107 world.targets_trav(relation, source, func);
110 template <
typename Func>
111 inline bool targets_trav_if(
const World& world, Entity relation, Entity source, Func func) {
112 return world.targets_trav_if(relation, source, func);
115 GAIA_NODISCARD
inline const cnt::darray<Entity>&
116 targets_trav_cache(
const World& world, Entity relation, Entity source) {
117 return world.targets_trav_cache(relation, source);
120 template <
typename Func>
121 inline void sources(
const World& world, Entity relation, Entity target, Func func) {
122 world.sources(relation, target, func);
125 template <
typename Func>
126 inline void sources_if(
const World& world, Entity relation, Entity target, Func func) {
127 world.sources_if(relation, target, func);
130 GAIA_NODISCARD
inline const cnt::darray<Entity>&
131 sources_bfs_trav_cache(
const World& world, Entity relation, Entity rootTarget) {
132 return world.sources_bfs_trav_cache(relation, rootTarget);
135 template <
typename Func>
136 inline void sources_bfs(
const World& world, Entity relation, Entity rootTarget, Func func) {
137 world.sources_bfs(relation, rootTarget, func);
140 template <
typename Func>
141 inline bool sources_bfs_if(
const World& world, Entity relation, Entity rootTarget, Func func) {
142 return world.sources_bfs_if(relation, rootTarget, func);
145 template <
typename Func>
146 inline void children(
const World& world, Entity parent, Func func) {
147 world.children(parent, func);
150 template <
typename Func>
151 inline void children_if(
const World& world, Entity parent, Func func) {
152 world.children_if(parent, func);
155 template <
typename Func>
156 inline void children_bfs(
const World& world, Entity root, Func func) {
157 world.children_bfs(root, func);
160 template <
typename Func>
161 inline bool children_bfs_if(
const World& world, Entity root, Func func) {
162 return world.children_bfs_if(root, func);
167 GAIA_NODISCARD
inline QuerySerBuffer& query_buffer(World& world, QueryId& serId) {
168 return world.query_buffer(serId);
171 inline void query_buffer_reset(World& world, QueryId& serId) {
172 world.query_buffer_reset(serId);
175 GAIA_NODISCARD
inline Entity expr_to_entity(
const World& world, va_list& args,
std::span<const char> exprRaw) {
176 return world.expr_to_entity(args, exprRaw);
181 inline void lock(World& world) {
184 inline void unlock(World& world) {
187 GAIA_NODISCARD
inline bool locked(
const World& world) {
188 return world.locked();
193 GAIA_NODISCARD
inline CommandBufferST& cmd_buffer_st_get(World& world) {
194 return world.cmd_buffer_st();
197 GAIA_NODISCARD
inline CommandBufferMT& cmd_buffer_mt_get(World& world) {
198 return world.cmd_buffer_mt();
201 inline void commit_cmd_buffer_st(World& world) {
204 cmd_buffer_commit(world.cmd_buffer_st());
207 inline void commit_cmd_buffer_mt(World& world) {
210 cmd_buffer_commit(world.cmd_buffer_mt());
Definition span_impl.h:99
static GAIA_NODISCARD bool is_req_del(const EntityContainer &ec)
Returns whether the record is already in delete-requested state. Covers both explicit per-entity dele...
Definition world.h:2314
Checks if endianess was detected correctly at compile-time.
Definition bitset.h:9