24 #ifndef PXR_BASE_TF_STATIC_DATA_H
25 #define PXR_BASE_TF_STATIC_DATA_H
35 #include <type_traits>
112 template <
class T,
class Factory = Tf_StaticDataDefaultFactory<T> >
135 T *_TryToCreateData()
const {
137 T *tmp = Factory::New();
141 if (
ARCH_LIKELY(_data.compare_exchange_strong(n, tmp)))
149 mutable std::atomic<T *> _data;
198 #define TF_MAKE_STATIC_DATA(Type, Name) \
199 static void TF_PP_CAT(Name,_Tf_StaticDataFactoryImpl)( \
200 std::remove_const_t<TF_PP_EAT_PARENS(Type)> *); \
202 struct TF_PP_CAT(Name,_Tf_StaticDataFactory) { \
203 static TF_PP_EAT_PARENS(Type) *New() { \
204 auto *p = new std::remove_const_t<TF_PP_EAT_PARENS(Type)>; \
205 TF_PP_CAT(Name,_Tf_StaticDataFactoryImpl)(p); \
210 static TfStaticData< \
211 TF_PP_EAT_PARENS(Type), TF_PP_CAT(Name,_Tf_StaticDataFactory)> Name; \
212 static void TF_PP_CAT(Name,_Tf_StaticDataFactoryImpl)( \
213 std::remove_const_t<TF_PP_EAT_PARENS(Type)> *Name)
bool IsInitialized() const
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
#define PXR_NAMESPACE_CLOSE_SCOPE