24 #ifndef PXR_BASE_TF_TYPE_IMPL_H
25 #define PXR_BASE_TF_TYPE_IMPL_H
27 #include "pxr/base/tf/mallocTag.h"
29 #include <initializer_list>
33 template <
class DERIVED,
class BASE>
38 template <
typename TypeVector>
41 template <
typename... Bases>
46 static std::vector<TfType>
49 return std::vector<TfType> {
56 template <
typename Derived>
62 const std::type_info *typeInfo;
63 TfType::_CastFunction
func;
66 const std::initializer_list<Cast> baseCasts = {
67 { &
typeid(Bases), &Tf_CastToParent<Derived, Bases> }...
70 for (
const Cast &cast : baseCasts) {
71 type->_AddCppCastFunc(*cast.typeInfo, cast.func);
76 template <
class T,
class BaseTypes>
83 const std::type_info &typeInfo =
typeid(
T);
88 template <
typename T,
typename BaseTypes>
92 TfAutoMallocTag2 tag2(
"Tf",
"TfType::Define");
98 const std::type_info &typeInfo =
typeid(
T);
107 newType._DefineCppType(typeInfo, sizeofType, isPodType, isEnumType);
113 template <
typename T>
117 return Define<T, Bases<> >();
122 template <
class DERIVED,
class BASE>
128 DERIVED* derived =
reinterpret_cast<DERIVED*
>(addr);
129 BASE* base = derived;
133 BASE* base =
reinterpret_cast<BASE*
>(addr);
134 DERIVED* derived =
static_cast<DERIVED*
>(base);
141 #endif // PXR_BASE_TF_TYPE_IMPL_H
static void RegisterCasts(TfType const *type)
GLsizei const GLchar *const * string
GLsizei const GLfloat * value
static TF_API std::string GetCanonicalTypeName(const std::type_info &)
static TfType const & Declare()
static TfType const & Define()
Metafunction returning sizeof(T) for a type T (or 0 if T is a void type).
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
PXR_NAMESPACE_OPEN_SCOPE void * Tf_CastToParent(void *addr, bool derivedToBase)
#define PXR_NAMESPACE_CLOSE_SCOPE
static std::vector< TfType > Declare()