SDEngine
Game Engine
Loading...
Searching...
No Matches
component_registration.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <meta>
4
5#include "SD/core/types.hpp"
8// TODO: REMOVE< just for test
9
10namespace sd {
11template<typename... Ts>
13
14
15template<typename>
16inline constexpr bool k_always_false = false;
17
18template<typename T, typename Group>
20
21template<typename A, typename B>
23
24template<typename... As, typename... Bs>
28
29template<typename A, typename B>
31
32template<typename Group>
34
35template<>
36struct IsUniqueComponentGroup<ComponentGroup<>> : std::true_type {};
37
38template<typename T, typename... Ts>
40 : std::bool_constant<(!(std::same_as<T, Ts> || ...)) &&
41 IsUniqueComponentGroup<ComponentGroup<Ts...>>::value> {};
42
43
44template<typename T, typename... Ts>
46 static constexpr bool is_registered = (std::same_as<T, Ts> || ...);
47
48 static constexpr USize id() {
49 constexpr bool matches[] = {std::same_as<T, Ts>...};
50 for (USize i = 0; i < sizeof...(Ts); ++i) {
51 if (matches[i])
52 return i;
53 }
54 return static_cast<USize>(-1);
55 }
56
57 static constexpr auto name = std::meta::identifier_of(^^T);
58};
59
60// TODO: REFLECATION SERIALIZATION
61template<typename T>
63 static void serialize(const T& component, Serializer& s) = delete;
64 static void deserialize(T& component, Serializer& s) = delete;
65};
66
67template<typename T>
72
73} // namespace sd
Definition component_registration.hpp:68
Definition Application.hpp:22
typename ConcatComponentGroups< A, B >::type ConcatComponentGroups_t
Definition component_registration.hpp:30
constexpr bool k_always_false
Definition component_registration.hpp:16
Definition component_registration.hpp:12
Definition component_registration.hpp:62
static void deserialize(T &component, Serializer &s)=delete
static void serialize(const T &component, Serializer &s)=delete
static constexpr USize id()
Definition component_registration.hpp:48
Definition component_registration.hpp:19
Definition component_registration.hpp:22
Definition component_registration.hpp:33
Definition serialization.hpp:38
consteval U64 type_id_of()
Definition type_id.hpp:6
std::size_t USize
Definition types.hpp:18