24 #ifndef PXR_BASE_TF_REGISTRY_MANAGER_H
25 #define PXR_BASE_TF_REGISTRY_MANAGER_H
69 _SubscribeTo(
typeid(
T));
78 _UnsubscribeFrom(
typeid(
T));
119 TF_API void _SubscribeTo(
const std::type_info&);
120 TF_API void _UnsubscribeFrom(
const std::type_info&);
127 struct Tf_RegistryStaticInit {
128 Tf_RegistryStaticInit() {
131 ~Tf_RegistryStaticInit() {
142 TF_API static void Add(
const char* libName,
144 const char* typeName);
145 template <
class T,
class U>
146 static void Add(
const char* libName,
147 void (*func)(
T*, U*),
148 const char* typeName)
155 #define TF_REGISTRY_PRIORITY 100
163 #define TF_REGISTRY_DEFINE_WITH_TYPE(KEY_TYPE, TAG) \
164 static void _Tf_RegistryFunction(KEY_TYPE*, TAG*); \
165 ARCH_CONSTRUCTOR(TF_PP_CAT(_Tf_RegistryAdd, __LINE__), \
166 TF_REGISTRY_PRIORITY, KEY_TYPE*, TAG*) \
168 Tf_RegistryInit::Add(TF_PP_STRINGIZE(MFB_ALT_PACKAGE_NAME), \
169 (void(*)(KEY_TYPE*, TAG*))_Tf_RegistryFunction, \
170 TF_PP_STRINGIZE(KEY_TYPE)); \
172 _ARCH_ENSURE_PER_LIB_INIT(Tf_RegistryStaticInit, _tfRegistryInit); \
173 static void _Tf_RegistryFunction(KEY_TYPE*, TAG*)
178 #define TF_REGISTRY_DEFINE(KEY_TYPE, NAME) \
179 static void TF_PP_CAT(_Tf_RegistryFunction, NAME)(KEY_TYPE*, void*); \
180 ARCH_CONSTRUCTOR(TF_PP_CAT(_Tf_RegistryAdd, NAME), \
181 TF_REGISTRY_PRIORITY, KEY_TYPE*) \
183 Tf_RegistryInit::Add(TF_PP_STRINGIZE(MFB_ALT_PACKAGE_NAME), \
184 (void(*)(KEY_TYPE*, void*)) \
185 TF_PP_CAT(_Tf_RegistryFunction, NAME), \
186 TF_PP_STRINGIZE(KEY_TYPE)); \
188 _ARCH_ENSURE_PER_LIB_INIT(Tf_RegistryStaticInit, _tfRegistryInit); \
189 static void TF_PP_CAT(_Tf_RegistryFunction, NAME)(KEY_TYPE*, void*)
219 #define TF_REGISTRY_FUNCTION(KEY_TYPE) \
220 TF_REGISTRY_DEFINE(KEY_TYPE, __LINE__)
260 #define TF_REGISTRY_FUNCTION_WITH_TAG(KEY_TYPE, TAG) \
261 TF_REGISTRY_DEFINE(KEY_TYPE, TF_PP_CAT(TAG, __LINE__))
265 #endif // PXR_BASE_TF_REGISTRY_MANAGER_H
static TF_API void RunUnloadersAtExit()
std::function< void()> UnloadFunctionType
#define TF_PP_STRINGIZE(x)
Expand and convert the argument to a string, using a most minimal macro.
void(* RegistrationFunctionType)(void *, void *)
static void Add(const char *libName, void(*func)(T *, U *), const char *typeName)
static TF_API void Add(const char *libName, TfRegistryManager::RegistrationFunctionType func, const char *typeName)
TF_API void Tf_RegistryInitCtor(char const *name)
static TF_API TfRegistryManager & GetInstance()
Return the singleton TfRegistryManager instance.
TF_API bool AddFunctionForUnload(const UnloadFunctionType &)
GLuint const GLchar * name
TF_API void Tf_RegistryInitDtor(char const *name)
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
#define PXR_NAMESPACE_CLOSE_SCOPE