31#ifndef FENNEC_RTTI_TYPE_DATA_H
32#define FENNEC_RTTI_TYPE_DATA_H
36#include <fennec/string/string.h>
37#include <fennec/memory/pointers.h>
38#include <fennec/rtti/typeid.h>
40#include <fennec/rtti/detail/_type_name.h>
47 property_complete = 0,
55 using properties_t = bitfield<property_count>;
61 dynarray<type_data*> supers;
62 dynarray<type_data*> subs;
64 properties_t properties;
71 template<
typename ClassT>
using _super_class_list =
typename ClassT::super_class_list;
72 template<
typename ClassT>
using _key_t =
typename ClassT::key_t;
74 static dynarray<unique_ptr<type_data>>& _typelist() {
75 static dynarray<unique_ptr<type_data>> typelist;
80 static unique_ptr<type_data> _make_data() {
81 using raw_t = remove_cvrefptr_t<T>;
82 using supers_t = detect_t<typelist<>, _super_class_list, T>;
85 .uuid = typeuuid<T>(),
86 .name = detail::type_name<T>(),
88 .raw_type = typeuuid<raw_t>() == typeuuid<T>() ? nullptr : type_storage::get_data<raw_t>(),
89 .supers = type_storage::get_data(supers_t{}),
92 .properties = { is_complete_v<T>, is_iterable_v<T>, is_indexable_v<T>, is_mappable_v<T> },
94 .key_type = type_storage::get_data<detect_t<void, _key_t, T>>(),
97 for (type_data* t : res->supers) {
98 t->subs.push_back(res.get());
106 static type_data* get_data()
requires(not is_void_v<T>) {
107 auto& typelist = _typelist();
110 if (typelist.size() <= uuid) {
111 typelist.resize(uuid * 2);
114 if (typelist[uuid].empty()) {
115 typelist[uuid] = fennec::forward<unique_ptr<type_data>>(_make_data<T>());
118 return typelist[uuid].get();
122 static type_data* get_data() {
126 template<
typename...Ts>
127 static dynarray<type_data*> get_data(typelist<Ts...>) {
A header containing the definition for a dynamically allocated array.
::uint64_t uint64_t
Unsigned 64-bit integer.
Definition types.h:275