Gaia-ECS v0.9.3
A simple and powerful entity component system
Loading...
Searching...
No Matches
api.h
1#pragma once
2#include "gaia/config/config.h"
3
4#include <cstdarg>
5
6#include "gaia/core/span.h"
7#include "gaia/ecs/command_buffer_fwd.h"
8#include "gaia/ecs/id_fwd.h"
9#include "gaia/ecs/query_fwd.h"
10
11namespace gaia {
12 namespace ecs {
13 class World;
14 class ComponentCache;
15 class Archetype;
16 struct ComponentCacheItem;
17 struct EntityContainer;
18 struct Entity;
19
20 // Component API
21
22 const ComponentCache& comp_cache(const World& world);
23 ComponentCache& comp_cache_mut(World& world);
24 template <typename T>
25 const ComponentCacheItem& comp_cache_add(World& world);
26
27 // Entity API
28
29 const EntityContainer& fetch(const World& world, Entity entity);
30 EntityContainer& fetch_mut(World& world, Entity entity);
31
32 void del(World& world, Entity entity);
33
34 Entity entity_from_id(const World& world, EntityId id);
35
36 bool valid(const World& world, Entity entity);
37
38 bool is(const World& world, Entity entity, Entity baseEntity);
39 bool is_base(const World& world, Entity entity);
40
41 Archetype* archetype_from_entity(const World& world, Entity entity);
42
43 const char* entity_name(const World& world, Entity entity);
44 const char* entity_name(const World& world, EntityId entityId);
45
46 // Traversal API
47
48 template <typename Func>
49 void as_relations_trav(const World& world, Entity target, Func func);
50 template <typename Func>
51 bool as_relations_trav_if(const World& world, Entity target, Func func);
52 template <typename Func>
53 void as_targets_trav(const World& world, Entity relation, Func func);
54 template <typename Func>
55 bool as_targets_trav_if(const World& world, Entity relation, Func func);
56
57 // Query API
58
59 QuerySerBuffer& query_buffer(World& world, QueryId& serId);
60 void query_buffer_reset(World& world, QueryId& serId);
61
62 Entity expr_to_entity(const World& world, va_list& args, std::span<const char> exprRaw);
63
64 GroupId group_by_func_default(const World& world, const Archetype& archetype, Entity groupBy);
65
66 // Locking API
67
68 void lock(World& world);
69 void unlock(World& world);
70 bool locked(const World& world);
71
72 // CommandBuffer API
73
74 CommandBufferST& cmd_buffer_st_get(World& world);
75 CommandBufferMT& cmd_buffer_mt_get(World& world);
76 void commit_cmd_buffer_st(World& world);
77 void commit_cmd_buffer_mt(World& world);
78 } // namespace ecs
79} // namespace gaia
Definition span_impl.h:99
Checks if endianess was detected correctly at compile-time.
Definition bitset.h:9