11 #include "amfnv1a/AMCEFNV1a.h"
15 #if defined(__clang__)
16 #define _D_PRETTY_FUNCTION __PRETTY_FUNCTION__
17 #define _D_PRETTY_FUNCTION_PREFIX "static AMCore::AMCETypeID::_T_string AMCore::AMCETypeID<"
18 #define _D_PRETTY_FUNCTION_SEPARATOR1 ">::stringInit() [with T = "
19 #define _D_PRETTY_FUNCTION_PREFIX_I "static int AMCore::AMCETypeID<"
20 #define _D_PRETTY_FUNCTION_SEPARATOR3 ">::typeLen() [T = "
21 #define _D_PRETTY_FUNCTION_SUFFIX "]"
22 #define _D_PRETTY_FUNCTION_LENGTH ((sizeof(_D_PRETTY_FUNCTION) - sizeof(_D_PRETTY_FUNCTION_PREFIX_I) - sizeof(_D_PRETTY_FUNCTION_SUFFIX) - sizeof(_D_PRETTY_FUNCTION_SEPARATOR3) + 3) / 2 + 1)
24 #elif defined(__GNUC__) && !defined(__clang__)
25 #define _D_PRETTY_FUNCTION __PRETTY_FUNCTION__
26 #define _D_PRETTY_FUNCTION_PREFIX "static constexpr AMCore::AMCETypeID<T>::_T_string AMCore::AMCETypeID<T>::stringInit() [with T = "
27 #define _D_PRETTY_FUNCTION_PREFIX_I "static constexpr int AMCore::AMCETypeID<T>::typeLen() [with T = "
28 #define _D_PRETTY_FUNCTION_SUFFIX "]"
29 #define _D_PRETTY_FUNCTION_LENGTH sizeof(_D_PRETTY_FUNCTION) - sizeof(_D_PRETTY_FUNCTION_PREFIX_I) - sizeof(_D_PRETTY_FUNCTION_SUFFIX) + 2
30 #elif defined(_MSC_VER)
31 #define _D_PRETTY_FUNCTION __FUNCSIG__
32 #define _D_PRETTY_FUNCTION_PREFIX "struct AMCore::AMCETypeID<T>::_T_string __cdecl AMCore::AMCETypeID<T>::stringInit<"
33 #define _D_PRETTY_FUNCTION_PREFIX_I "struct int __cdecl AMCore::AMCETypeID<T>::typeLen<"
34 #define _D_PRETTY_FUNCTION_SUFFIX ">(void)"
37 #error "Andromeda Library do not support this compiler."
45 #ifdef COLLECTING_DATA
48 struct _T_AMTypeId_list_leaf {
49 static _T_AMTypeId_list_leaf* _M_first;
50 _T_AMTypeId_list_leaf* _M_next;
55 constexpr _T_AMTypeId_list_leaf(
const char* name, uint64_t hash):_M_name(name),_M_hash(hash),_M_next(_M_first),_M_id(_M_first ? _M_first->_M_id + 1 : 0) {
60 _T_AMTypeId_list_leaf<b>* _T_AMTypeId_list_leaf<b>::_M_first =
nullptr;
74 static constexpr
int typeLen()
76 return _D_PRETTY_FUNCTION_LENGTH;
82 constexpr _T_string(): _M_array() {};
85 static constexpr _T_string cc(_T_string dst,
int index,
const char* src)
87 dst._M_array[index] = src[0];
88 if (_M_lengthCE-1 <= index) {
91 return cc(dst, index+1, src+1);
93 static constexpr _T_string stringInit()
96 const char* ctype = _D_PRETTY_FUNCTION ;
97 int offset = - 1 +
sizeof(_D_PRETTY_FUNCTION_PREFIX);
98 const int length = _M_lengthCE -1;
99 for(
int i=0; i < length ; i++,offset++) {
100 rv._M_array[i] = ctype[offset];
102 rv._M_array[_M_lengthCE-1] = 0;
105 static const _T_string _M_name;
107 static constexpr
const uint64_t _M_hashCE = AMCEFNV1aAlgorithm::fnv1a64(_M_nameCE._M_array);
108 static constexpr
const uint32_t _M_hashCE32 = AMCEFNV1aAlgorithm::fnv1a32(_M_nameCE._M_array);
110 #ifdef COLLECTING_DATA
112 static _T_AMTypeId_list_leaf<true> _leaf;
119 static constexpr
const char*
name()
121 return _M_name._M_array;
122 #ifdef COLLECTING_DATA
123 const uint64_t static_member_starter = _leaf._M_hash;
134 #ifdef COLLECTING_DATA
135 const uint64_t static_member_starter = _leaf._M_hash;
146 #ifdef COLLECTING_DATA
147 const uint64_t static_member_starter = _leaf._M_hash;
158 #ifdef COLLECTING_DATA
159 const uint64_t static_member_starter = _leaf._M_hash;
175 static constexpr uint64_t
id()
177 #ifdef COLLECTING_DATA
179 const uint64_t static_member_starter = _leaf._M_hash;
188 static constexpr uint32_t
id32()
190 return (uint32_t)id() & 0xFFFFFFFF;
191 #ifdef COLLECTING_DATA
192 const uint64_t static_member_starter = _leaf._M_hash;
197 const typename AMCETypeID<T>::_T_string AMCETypeID<T>::_M_name = AMCETypeID<T>::_M_nameCE;
198 #ifdef COLLECTING_DATA
200 _T_AMTypeId_list_leaf<true> AMCETypeID<T>::_leaf = _T_AMTypeId_list_leaf<true>(AMCETypeID<T>::name(), AMCETypeID<T>::hash_code());
206 #endif //AMCETypeID_H