EnTT: src/entt/entity/fwd.hpp Source File

EnTT 3.16.0

Loading...
Searching...
No Matches
fwd.hpp
1#ifndef ENTT_ENTITY_FWD_HPP
2#define ENTT_ENTITY_FWD_HPP
3
4#include <cstdint>
5#include <memory>
6#include <type_traits>
7#include "../config/config.h"
8#include "../core/fwd.hpp"
9#include "../core/type_traits.hpp"
10
11namespace entt {
12
14 enum class entity : id_type {};
15
17 enum class deletion_policy : std::uint8_t {
19 swap_and_pop = 0u,
21 in_place = 1u,
23 swap_only = 2u,
25 unspecified = swap_and_pop
26};
27
28template<typename Type, typename Entity = entity, typename = void>
29struct component_traits;
30
31template<typename Entity = entity, typename = std::allocator<Entity>>
32class basic_sparse_set;
33
34template<typename Type, typename = entity, typename = std::allocator<Type>, typename = void>
35class basic_storage;
36
37template<typename, typename>
38class basic_sigh_mixin;
39
40template<typename, typename>
41class basic_reactive_mixin;
42
43template<typename Entity = entity, typename = std::allocator<Entity>>
44class basic_registry;
45
46template<typename, typename, typename = void>
47 class basic_view;
48
49template<typename Type, typename = std::allocator<Type *>>
50class basic_runtime_view;
51
52template<typename, typename, typename>
53 class basic_group;
54
55template<typename>
56class basic_organizer;
57
58template<typename, typename...>
59class basic_handle;
60
61template<typename>
62class basic_snapshot;
63
64template<typename>
65class basic_snapshot_loader;
66
67template<typename>
68class basic_continuous_loader;
69
71 using sparse_set = basic_sparse_set<>;
72
77template<typename Type>
78 using storage = basic_storage<Type>;
79
84template<typename Type>
85 using sigh_mixin = basic_sigh_mixin<Type, basic_registry<typename Type::entity_type, typename Type::base_type::allocator_type>>;
86
91template<typename Type>
92 using reactive_mixin = basic_reactive_mixin<Type, basic_registry<typename Type::entity_type, typename Type::base_type::allocator_type>>;
93
95 using registry = basic_registry<>;
96
98 using organizer = basic_organizer<registry>;
99
101 using handle = basic_handle<registry>;
102
104 using const_handle = basic_handle<const registry>;
105
110template<typename... Args>
111 using handle_view = basic_handle<registry, Args...>;
112
117template<typename... Args>
118 using const_handle_view = basic_handle<const registry, Args...>;
119
121 using snapshot = basic_snapshot<registry>;
122
124 using snapshot_loader = basic_snapshot_loader<registry>;
125
127 using continuous_loader = basic_continuous_loader<registry>;
128
130 using runtime_view = basic_runtime_view<sparse_set>;
131
133 using const_runtime_view = basic_runtime_view<const sparse_set>;
134
139template<typename... Type>
140 struct exclude_t final: type_list<Type...> {
142 explicit constexpr exclude_t() = default;
143};
144
149template<typename... Type>
150 inline constexpr exclude_t<Type...> exclude{};
151
156template<typename... Type>
157 struct get_t final: type_list<Type...> {
159 explicit constexpr get_t() = default;
160};
161
166template<typename... Type>
167 inline constexpr get_t<Type...> get{};
168
173template<typename... Type>
174 struct owned_t final: type_list<Type...> {
176 explicit constexpr owned_t() = default;
177};
178
183template<typename... Type>
184 inline constexpr owned_t<Type...> owned{};
185
191template<typename... Type, template<typename...> class Op>
192 struct type_list_transform<get_t<Type...>, Op> {
194 using type = get_t<typename Op<Type>::type...>;
195};
196
202template<typename... Type, template<typename...> class Op>
203 struct type_list_transform<exclude_t<Type...>, Op> {
205 using type = exclude_t<typename Op<Type>::type...>;
206};
207
213template<typename... Type, template<typename...> class Op>
214 struct type_list_transform<owned_t<Type...>, Op> {
216 using type = owned_t<typename Op<Type>::type...>;
217};
218
225template<typename Type, typename Entity = entity, typename Allocator = std::allocator<Type>, typename = void>
226 struct storage_type {
228 using type = ENTT_STORAGE(sigh_mixin, basic_storage<Type, Entity, Allocator>);
229};
230
232 struct reactive final {};
233
239template<typename Entity, typename Allocator>
240 struct storage_type<reactive, Entity, Allocator> {
242 using type = ENTT_STORAGE(reactive_mixin, basic_storage<reactive, Entity, Allocator>);
243};
244
249template<typename... Args>
250 using storage_type_t = typename storage_type<Args...>::type;
251
258template<typename Type, typename Entity = entity, typename Allocator = std::allocator<std::remove_const_t<Type>>>
259 struct storage_for {
261 using type = constness_as_t<storage_type_t<std::remove_const_t<Type>, Entity, Allocator>, Type>;
262};
263
268template<typename... Args>
269 using storage_for_t = typename storage_for<Args...>::type;
270
276template<typename Get, typename Exclude = exclude_t<>>
277 using view = basic_view<type_list_transform_t<Get, storage_for>, type_list_transform_t<Exclude, storage_for>>;
278
285template<typename Owned, typename Get = get_t<>, typename Exclude = exclude_t<>>
286 using group = basic_group<type_list_transform_t<Owned, storage_for>, type_list_transform_t<Get, storage_for>, type_list_transform_t<Exclude, storage_for>>;
287
288} // namespace entt
289
290#endif
entt::basic_continuous_loader
Utility class for continuous loading.
Definition snapshot.hpp:306
entt::basic_group
Group.
Definition fwd.hpp:53
entt::basic_handle
Non-owning handle to an entity.
Definition handle.hpp:98
entt::basic_organizer
Utility class for creating a static task graph.
Definition organizer.hpp:120
entt::basic_reactive_mixin
Mixin type used to add reactive support to storage types.
Definition mixin.hpp:390
entt::basic_registry<>
entt::basic_runtime_view
Generic runtime view.
Definition runtime_view.hpp:123
entt::basic_sigh_mixin
Mixin type used to add signal support to storage types.
Definition mixin.hpp:57
entt::basic_snapshot_loader
Utility class to restore a snapshot as a whole.
Definition snapshot.hpp:176
entt::basic_snapshot
Utility class to create snapshots from a registry.
Definition snapshot.hpp:47
entt::basic_sparse_set<>
entt::basic_storage
Storage implementation.
Definition storage.hpp:229
entt::basic_view
View implementation.
Definition fwd.hpp:47
entt
EnTT default namespace.
Definition dense_map.hpp:22
entt::const_handle_view
basic_handle< const registry, Args... > const_handle_view
Alias declaration for the most common use case.
Definition fwd.hpp:118
entt::entity
entity
Default entity identifier.
Definition fwd.hpp:14
entt::storage_type_t
typename storage_type< Args... >::type storage_type_t
Helper type.
Definition fwd.hpp:250
entt::constness_as_t
typename constness_as< To, From >::type constness_as_t
Alias template to facilitate the transcription of the constness.
Definition type_traits.hpp:841
entt::organizer
basic_organizer< registry > organizer
Alias declaration for the most common use case.
Definition fwd.hpp:98
entt::type_list_transform_t
typename type_list_transform< List, Op >::type type_list_transform_t
Helper type.
Definition type_traits.hpp:359
entt::view
basic_view< type_list_transform_t< Get, storage_for >, type_list_transform_t< Exclude, storage_for > > view
Alias declaration for the most common use case.
Definition fwd.hpp:277
entt::handle
basic_handle< registry > handle
Alias declaration for the most common use case.
Definition fwd.hpp:101
entt::exclude
constexpr exclude_t< Type... > exclude
Variable template for exclusion lists.
Definition fwd.hpp:150
entt::id_type
std::uint32_t id_type
Alias declaration for type identifiers.
Definition fwd.hpp:29
entt::handle_view
basic_handle< registry, Args... > handle_view
Alias declaration for the most common use case.
Definition fwd.hpp:111
entt::reactive_mixin
basic_reactive_mixin< Type, basic_registry< typename Type::entity_type, typename Type::base_type::allocator_type > > reactive_mixin
Alias declaration for the most common use case.
Definition fwd.hpp:92
entt::group
basic_group< type_list_transform_t< Owned, storage_for >, type_list_transform_t< Get, storage_for >, type_list_transform_t< Exclude, storage_for > > group
Alias declaration for the most common use case.
Definition fwd.hpp:286
entt::get
constexpr get_t< Type... > get
Variable template for lists of observed elements.
Definition fwd.hpp:167
entt::storage_for_t
typename storage_for< Args... >::type storage_for_t
Helper type.
Definition fwd.hpp:269
entt::registry
basic_registry<> registry
Alias declaration for the most common use case.
Definition fwd.hpp:95
entt::deletion_policy
deletion_policy
Storage deletion policy.
Definition fwd.hpp:17
entt::deletion_policy::swap_only
@ swap_only
Swap-only deletion policy.
Definition fwd.hpp:23
entt::deletion_policy::swap_and_pop
@ swap_and_pop
Swap-and-pop deletion policy.
Definition fwd.hpp:19
entt::deletion_policy::in_place
@ in_place
In-place deletion policy.
Definition fwd.hpp:21
entt::deletion_policy::unspecified
@ unspecified
Unspecified deletion policy.
Definition fwd.hpp:25
entt::const_runtime_view
basic_runtime_view< const sparse_set > const_runtime_view
Alias declaration for the most common use case.
Definition fwd.hpp:133
entt::owned
constexpr owned_t< Type... > owned
Variable template for lists of owned elements.
Definition fwd.hpp:184
entt::sigh_mixin
basic_sigh_mixin< Type, basic_registry< typename Type::entity_type, typename Type::base_type::allocator_type > > sigh_mixin
Alias declaration for the most common use case.
Definition fwd.hpp:85
entt::runtime_view
basic_runtime_view< sparse_set > runtime_view
Alias declaration for the most common use case.
Definition fwd.hpp:130
entt::snapshot
basic_snapshot< registry > snapshot
Alias declaration for the most common use case.
Definition fwd.hpp:121
entt::continuous_loader
basic_continuous_loader< registry > continuous_loader
Alias declaration for the most common use case.
Definition fwd.hpp:127
entt::const_handle
basic_handle< const registry > const_handle
Alias declaration for the most common use case.
Definition fwd.hpp:104
entt::sparse_set
basic_sparse_set<> sparse_set
Alias declaration for the most common use case.
Definition fwd.hpp:71
entt::storage
basic_storage< Type > storage
Alias declaration for the most common use case.
Definition fwd.hpp:78
entt::snapshot_loader
basic_snapshot_loader< registry > snapshot_loader
Alias declaration for the most common use case.
Definition fwd.hpp:124
entt::exclude_t
Alias for exclusion lists.
Definition fwd.hpp:140
entt::exclude_t::exclude_t
constexpr exclude_t()=default
Default constructor.
entt::get_t
Alias for lists of observed elements.
Definition fwd.hpp:157
entt::get_t::get_t
constexpr get_t()=default
Default constructor.
entt::owned_t
Alias for lists of owned elements.
Definition fwd.hpp:174
entt::owned_t::owned_t
constexpr owned_t()=default
Default constructor.
entt::reactive
Empty value type for reactive storage types.
Definition fwd.hpp:232
entt::storage_for
Definition fwd.hpp:259
entt::storage_for::type
constness_as_t< storage_type_t< std::remove_const_t< Type >, Entity, Allocator >, Type > type
Type-to-storage conversion result.
Definition fwd.hpp:261
entt::storage_type< reactive, Entity, Allocator >::type
reactive_mixin< basic_storage< reactive, Entity, Allocator > > type
Type-to-storage conversion result.
Definition fwd.hpp:242
entt::storage_type
Provides a common way to define storage types.
Definition fwd.hpp:226
entt::storage_type::type
sigh_mixin< basic_storage< Type, Entity, Allocator > > type
Type-to-storage conversion result.
Definition fwd.hpp:228
entt::type_list_transform< exclude_t< Type... >, Op >::type
exclude_t< typename Op< Type >::type... > type
Resulting exclude list after applying the transform function.
Definition fwd.hpp:205
entt::type_list_transform< get_t< Type... >, Op >::type
get_t< typename Op< Type >::type... > type
Resulting get list after applying the transform function.
Definition fwd.hpp:194
entt::type_list_transform< owned_t< Type... >, Op >::type
owned_t< typename Op< Type >::type... > type
Resulting owned list after applying the transform function.
Definition fwd.hpp:216
entt::type_list_transform
Primary template isn't defined on purpose.
Definition type_traits.hpp:339
entt::type_list
A class to use to push around lists of types, nothing more.
Definition type_traits.hpp:111