18 #ifndef LIBCWD_TYPE_INFO_H
19 #define LIBCWD_TYPE_INFO_H
21 #ifndef LIBCWD_PRIVATE_THREADING_H
24 #ifndef LIBCW_TYPEINFO
25 #define LIBCW_TYPEINFO
36 extern char const* make_label(
char const* mangled_name);
65 void init(
char const* type_encoding,
size_t s,
size_t rs)
70 M_dem_name = _private_::make_label(type_encoding);
84 extern char const* extract_exact_name(
char const*,
char const* LIBCWD_COMMA_TSD_PARAM);
93 static type_info_ct S_value;
94 static bool S_initialized;
96 static type_info_ct
const& value(
void);
102 struct type_info<T*> {
104 static type_info_ct S_value;
105 static bool S_initialized;
107 static type_info_ct
const& value(
void);
113 struct type_info<void*> {
115 static type_info_ct S_value;
116 static bool S_initialized;
118 static type_info_ct
const& value(
void);
123 type_info_ct type_info<T>::S_value;
127 bool type_info<T>::S_initialized;
131 type_info_ct
const& type_info<T>::value(
void)
135 S_value.init(
typeid(T).name(),
sizeof(T), 0);
136 S_initialized =
true;
143 type_info_ct type_info<T*>::S_value;
147 bool type_info<T*>::S_initialized;
151 type_info_ct
const& type_info<T*>::value(
void)
155 S_value.init(
typeid(T*).name(),
sizeof(T*),
sizeof(T));
156 S_initialized =
true;
169 struct libcwd_type_info_exact {
171 static ::libcwd::type_info_ct S_value;
172 static bool S_initialized;
174 static ::libcwd::type_info_ct
const& value(
void);
179 struct libcwd_type_info_exact<T*> {
181 static ::libcwd::type_info_ct S_value;
182 static bool S_initialized;
184 static ::libcwd::type_info_ct
const& value(
void);
189 struct libcwd_type_info_exact<void*> {
191 static ::libcwd::type_info_ct S_value;
192 static bool S_initialized;
194 static ::libcwd::type_info_ct
const& value(
void);
201 bool libcwd_type_info_exact<T>::S_initialized;
208 S_value.
init(::libcwd::_private_::extract_exact_name(
typeid(libcwd_type_info_exact<T>).name(),
typeid(T).name() LIBCWD_COMMA_TSD_INSTANCE),
sizeof(T), 0);
209 S_initialized =
true;
218 bool libcwd_type_info_exact<T*>::S_initialized;
225 S_value.
init(::libcwd::_private_::extract_exact_name(
typeid(libcwd_type_info_exact<T*>).name(),
typeid(T*).name() LIBCWD_COMMA_TSD_INSTANCE),
sizeof(T*),
sizeof(T));
226 S_initialized =
true;
236 #ifndef LIBCWD_DOXYGEN
265 return ::libcwd_type_info_exact<T>::value();
281 return _private_::type_info<T>::value();
284 extern type_info_ct
const unknown_type_info_c;
290 #endif // LIBCWD_TYPE_INFO_H
char const * M_name
Encoded type of T (as returned by typeid(T).name()).
Definition: type_info.h:48
size_t ref_size(void) const
sizeof(*T) or 0 when T is not a pointer.
Definition: type_info.h:79
type_info_ct(void)
Default constructor.
Definition: type_info.h:55
type_info_ct(int)
Constructor used for unknown_type_info_c.
Definition: type_info.h:60
Class that holds type information for debugging purposes. Returned by type_info_of().
Definition: type_info.h:44
size_t M_type_size
sizeof(T).
Definition: type_info.h:46
size_t M_type_ref_size
sizeof(*T) or 0 when T is not a pointer.
Definition: type_info.h:47
char const * demangled_name(void) const
The demangled type name.
Definition: type_info.h:73
size_t size(void) const
sizeof(T).
Definition: type_info.h:77
type_info_ct const & type_info_of(void)
Get type information of a given class or type.
Definition: type_info.h:263
char const * name(void) const
The encoded type name (as returned by typeid(T).name()).
Definition: type_info.h:75
void init(char const *type_encoding, size_t s, size_t rs)
Construct a type_info_ct object for a type (T) with encoding type_encoding, size s and size of refere...
Definition: type_info.h:65
char const * M_dem_name
Demangled type name of T.
Definition: type_info.h:49