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 Entity id_entity(
const World& world, Entity
id) {
39 GAIA_ASSERT(!
id.pair());
40 return entity_from_id(world, (EntityId)
id.
id());
43 GAIA_NODISCARD
inline Entity pair_rel(
const World& world, Entity pair) {
44 GAIA_ASSERT(pair.pair());
45 return entity_from_id(world, (EntityId)pair.id());
48 GAIA_NODISCARD
inline Entity pair_tgt(
const World& world, Entity pair) {
49 GAIA_ASSERT(pair.pair());
50 return entity_from_id(world, (EntityId)pair.gen());
53 GAIA_NODISCARD
inline bool valid(
const World& world, Entity entity) {
54 return world.valid(entity);
57 GAIA_NODISCARD
inline bool is(
const World& world, Entity entity, Entity baseEntity) {
58 return world.is(entity, baseEntity);
61 GAIA_NODISCARD
inline bool is_base(
const World& world, Entity entity) {
62 return world.is_base(entity);
65 GAIA_NODISCARD
inline Archetype* archetype_from_entity(
const World& world, Entity entity) {
66 if (!world.valid(entity))
69 const auto& ec = world.fetch(entity);
76 GAIA_NODISCARD
inline util::str_view entity_name(
const World& world, Entity entity) {
77 const auto name = world.name(entity);
82 const auto display = world.display_name(entity);
90 GAIA_NODISCARD
inline util::str_view entity_name(
const World& world, EntityId entityId) {
91 return entity_name(world, world.get(entityId));
94 GAIA_NODISCARD
inline Entity target(
const World& world, Entity entity, Entity relation) {
95 return world.target(entity, relation);
100 template <
typename Func>
101 inline void as_relations_trav(
const World& world, Entity target, Func func) {
102 world.as_relations_trav(target, func);
105 template <
typename Func>
106 inline bool as_relations_trav_if(
const World& world, Entity target, Func func) {
107 return world.as_relations_trav_if(target, func);
110 template <
typename Func>
111 inline void as_targets_trav(
const World& world, Entity relation, Func func) {
112 world.as_targets_trav(relation, func);
115 template <
typename Func>
116 inline bool as_targets_trav_if(
const World& world, Entity relation, Func func) {
117 return world.as_targets_trav_if(relation, func);
120 template <
typename Func>
121 inline void targets_trav(
const World& world, Entity relation, Entity source, Func func) {
122 world.targets_trav(relation, source, func);
125 template <
typename Func>
126 inline bool targets_trav_if(
const World& world, Entity relation, Entity source, Func func) {
127 return world.targets_trav_if(relation, source, func);
130 GAIA_NODISCARD
inline const cnt::darray<Entity>&
131 targets_trav_cache(
const World& world, Entity relation, Entity source) {
132 return world.targets_trav_cache(relation, source);
135 template <
typename Func>
136 inline void sources(
const World& world, Entity relation, Entity target, Func func) {
137 world.sources(relation, target, func);
140 template <
typename Func>
141 inline void sources_if(
const World& world, Entity relation, Entity target, Func func) {
142 world.sources_if(relation, target, func);
145 GAIA_NODISCARD
inline const cnt::darray<Entity>&
146 sources_bfs_trav_cache(
const World& world, Entity relation, Entity rootTarget) {
147 return world.sources_bfs_trav_cache(relation, rootTarget);
150 template <
typename Func>
151 inline void sources_bfs(
const World& world, Entity relation, Entity rootTarget, Func func) {
152 world.sources_bfs(relation, rootTarget, func);
155 template <
typename Func>
156 inline bool sources_bfs_if(
const World& world, Entity relation, Entity rootTarget, Func func) {
157 return world.sources_bfs_if(relation, rootTarget, func);
160 template <
typename Func>
161 inline void children(
const World& world, Entity parent, Func func) {
162 world.children(parent, func);
165 template <
typename Func>
166 inline void children_if(
const World& world, Entity parent, Func func) {
167 world.children_if(parent, func);
170 template <
typename Func>
171 inline void children_bfs(
const World& world, Entity root, Func func) {
172 world.children_bfs(root, func);
175 template <
typename Func>
176 inline bool children_bfs_if(
const World& world, Entity root, Func func) {
177 return world.children_bfs_if(root, func);
182 GAIA_NODISCARD
inline QuerySerBuffer& query_buffer(World& world, QueryId& serId) {
183 return world.query_buffer(serId);
186 inline void query_buffer_reset(World& world, QueryId& serId) {
187 world.query_buffer_reset(serId);
190 GAIA_NODISCARD
inline Entity expr_to_entity(
const World& world, va_list& args,
std::span<const char> exprRaw) {
191 return world.expr_to_entity(args, exprRaw);
196 inline void lock(World& world) {
199 inline void unlock(World& world) {
202 GAIA_NODISCARD
inline bool locked(
const World& world) {
203 return world.locked();
208 GAIA_NODISCARD
inline CommandBufferST& cmd_buffer_st_get(World& world) {
209 return world.cmd_buffer_st();
212 GAIA_NODISCARD
inline CommandBufferMT& cmd_buffer_mt_get(World& world) {
213 return world.cmd_buffer_mt();
216 inline void commit_cmd_buffer_st(World& world) {
219 cmd_buffer_commit(world.cmd_buffer_st());
222 inline void commit_cmd_buffer_mt(World& world) {
225 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:977
Checks if endianess was detected correctly at compile-time.
Definition bitset.h:9