ECSTASY
All in the name
Loading...
Searching...
No Matches
StorageConcepts.hpp
Go to the documentation of this file.
1
11
12#ifndef ECSTASY_STORAGE_STORAGECONCEPTS_HPP_
13#define ECSTASY_STORAGE_STORAGECONCEPTS_HPP_
14
15#include <concepts>
16#include "IStorage.hpp"
17
20#define SET_COMPONENT_STORAGE(ComponentType, StorageType) \
21 template <> \
22 struct GetComponentStorageType<ComponentType> { \
23 using Value = StorageType<ComponentType>; \
24 };
25
27namespace ecstasy
28{
29 template <typename C>
30 class MapStorage;
31}
32
35template <typename C>
38};
39
40namespace ecstasy
41{
50 template <typename C>
51 concept ExplicitComponentStorage = requires() { typename C::StorageType; };
52
63 template <typename C>
66 };
67
69 template <ExplicitComponentStorage C>
71 using type = typename C::StorageType;
72 };
73
75 template <typename C>
76 struct getStorageTypeImpl<const C> {
77 using type = const typename getStorageTypeImpl<C>::type;
78 };
79
93 template <typename C>
95
104 template <typename S>
105 concept IsStorage = std::default_initializable<std::remove_const_t<S>>
106 && std::derived_from<std::remove_const_t<S>, IStorage> && requires { typename S::Component; };
107
117 template <typename S>
118 concept IsContainerStorage = requires() {
119 requires IsStorage<S>;
120 typename S::Component::value_type;
121 };
122} // namespace ecstasy
123#endif /* !ECSTASY_STORAGE_STORAGECONCEPTS_HPP_ */
Abstract class for all components storage.
Associative Map to store entity components Recommended for sparse components.
Concept to check if a storage is a container storage.
Concept to check if a type is a storage.
Namespace containing all symbols specific to ecstasy.
Definition ecstasy.hpp:30
typename getStorageTypeImpl< C >::type getStorageType
Get the storage type to use for a component.
const typename getStorageTypeImpl< C >::type type
typename GetComponentStorageType< C >::Value type