29 #ifdef PXR_BASE_TF_INSTANTIATE_TYPE_H 30 #error This file should only be included once in any given source (.cpp) file. 33 #define PXR_BASE_TF_INSTANTIATE_TYPE_H 37 #include "pxr/base/tf/type.h" 40 PXR_NAMESPACE_OPEN_SCOPE
42 template <
typename T,
bool AS_REF_PTR>
43 struct Tf_TypeFactoryType {
49 struct TfTest_RefPtrFactory {
53 struct Tf_TypeFactoryType<T, false> {
55 T* New() {
return new T; }
60 template <
typename T,
bool MANUFACTURABLE>
61 struct Tf_MakeTypeManufacturable {
62 static void Doit(
TfType t) {
63 typedef typename Tf_TypeFactoryType<T, TF_SUPPORTS_REFPTR(T)>::FactoryType FT;
70 struct Tf_MakeTypeManufacturable<T, false> {
75 #define _TF_REMOVE_PARENS_HELPER(...) __VA_ARGS__ 76 #define _TF_REMOVE_PARENS(parens) _TF_REMOVE_PARENS_HELPER parens 78 #define TF_NO_PARENT() (TfType::Bases<>) 79 #define TF_1_PARENT(p1) (TfType::Bases<p1 >) 80 #define TF_2_PARENT(p1,p2) (TfType::Bases<p1, p2 >) 81 #define TF_INSTANTIATE_TYPE(Type, flags, Bases) \ 82 TF_REGISTRY_DEFINE_WITH_TYPE(TfType, Type) { \ 83 TfType t1 = TfType::Define<Type, _TF_REMOVE_PARENS(Bases) >(); \ 84 Tf_MakeTypeManufacturable<Type, (flags&TfType::MANUFACTURABLE)!=0 >::Doit(t1); \ 87 PXR_NAMESPACE_CLOSE_SCOPE
Define function attributes.
Base class of all factory types.
TF_API void SetFactory(std::unique_ptr< FactoryBase > factory) const
Sets the factory object for this type.
TfType represents a dynamic runtime type.
Reference-counted smart pointer utility class.