24 #ifndef PXR_BASE_TF_WEAK_PTR_FACADE_H
25 #define PXR_BASE_TF_WEAK_PTR_FACADE_H
36 #include <type_traits>
42 template <
template <
class>
class PtrTemplate,
class DataType>
52 template <
template <
class>
class PtrTemplate,
class DataType>
55 template <
class Facade>
57 return f._FetchPointer();
60 template <
class Facade>
62 return f._GetUniqueIdentifier();
65 template <
class Facade>
67 return f._EnableExtraNotification();
70 template <
class Facade>
72 return f._IsInvalid();
82 template <
template <
class>
class X,
class Y>
100 template <
template <
class>
class PtrTemplate,
class Type>
113 template <
class Other>
120 template <
class Other>
122 return !(*
this == p);
135 return !(*
this == p);
148 template <
class Other>
149 bool operator < (PtrTemplate<Other>
const &p)
const {
155 template <
class Other>
157 return !(*
this < p) && !(*
this == p);
160 template <
class Other>
161 bool operator <= (PtrTemplate<Other>
const &p)
const {
162 return (*
this < p) || (*
this == p);
165 template <
class Other>
173 return _FetchPointer() ? &TfWeakPtrFacade::_FetchPointer :
nullptr;
177 return !(bool(*
this));
182 return _FetchPointer() == &obj;
190 return dynamic_cast<T *
>(_FetchPointer());
202 return &_Derived()->__GetTfWeakBase__();
242 return static_cast<Derived &
>(*this);
245 Derived const &_Derived()
const {
246 return static_cast<Derived const &
>(*this);
261 template <
template <
class>
class X,
class Y>
266 template <
template <
class>
class X,
class Y>
272 template <
template <
class>
class X,
class Y>
275 return !(p ==
nullptr);
277 template <
template <
class>
class X,
class Y>
280 return !(
nullptr == p);
283 template <
template <
class>
class X,
class Y>
284 inline bool operator< (TfWeakPtrFacade<X, Y>
const &p, std::nullptr_t)
286 return std::less<void const *>()(p.GetUniqueIdentifier(),
nullptr);
288 template <
template <
class>
class X,
class Y>
289 inline bool operator< (std::nullptr_t, TfWeakPtrFacade<X, Y>
const &p)
291 return std::less<void const *>()(
nullptr, p.GetUniqueIdentifier());
294 template <
template <
class>
class X,
class Y>
295 inline bool operator<= (TfWeakPtrFacade<X, Y>
const &p, std::nullptr_t)
297 return !(
nullptr < p);
299 template <
template <
class>
class X,
class Y>
300 inline bool operator<= (std::nullptr_t, TfWeakPtrFacade<X, Y>
const &p)
302 return !(p <
nullptr);
305 template <
template <
class>
class X,
class Y>
310 template <
template <
class>
class X,
class Y>
316 template <
template <
class>
class X,
class Y>
319 return !(p <
nullptr);
321 template <
template <
class>
class X,
class Y>
324 return !(
nullptr < p);
329 template <
class ToPtr,
template <
class>
class X,
class Y>
331 return ToPtr(dynamic_cast<typename ToPtr::DataType *>
335 template <
class ToPtr,
template <
class>
class X,
class Y>
337 return ToPtr(TfSafeDynamic_cast<typename ToPtr::DataType *>
341 template <
class ToPtr,
template <
class>
class X,
class Y>
343 return ToPtr(static_cast<typename ToPtr::DataType *>
347 template <
class ToPtr,
template <
class>
class X,
class Y>
349 return ToPtr(const_cast<typename ToPtr::DataType *>
361 template <
template <
class>
class X,
class U>
363 typename std::enable_if<
375 template <
template <
class>
class Ptr,
class T>
378 std::is_base_of<TfWeakPtrFacadeBase, Ptr<T>>::value
397 template <
template <
class>
class Ptr,
class T>
400 std::is_base_of<TfWeakPtrFacadeBase, Ptr<const T>>::value
408 return Ptr<const T>(
ptr);
419 template <
class HashState,
template <
class>
class X,
class T>
427 template <
template <
class>
class X,
class T>
436 #endif // PXR_BASE_TF_WEAK_PTR_FACADE_H
DataType & operator*() const
typename std::enable_if< B, T >::type enable_if_t
Define Imath::enable_if_t to be std for C++14, equivalent for C++11.
void const * GetUniqueIdentifier() const
void EnableExtraNotification() const
bool operator==(PtrTemplate< Other > const &p) const
bool operator!=(PtrTemplate< Other > const &p) const
bool operator>(PtrTemplate< Other > const &p) const
GLsizei const GLfloat * value
ToPtr TfStatic_cast(TfWeakPtrFacade< X, Y > const &p)
TF_API const TfNullPtrType TfNullPtr
ARCH_API std::string ArchGetDemangled(const std::string &typeName)
size_t hash_value(TfWeakPtrFacade< X, T > const &ptr)
static T * GetRawPtr(const Ptr< T > &t)
static void Class_Object_MUST_Not_Be_Const()
static Facade::DataType * FetchPointer(Facade const &f)
Y * get_pointer(TfWeakPtrFacade< X, Y > const &p)
static Ptr< const T > ConstructFromRawPtr(const T *ptr)
DataType *(TfWeakPtrFacade::*)(void) const UnspecifiedBoolType
bool operator>(TfWeakPtrFacade< X, Y > const &p, std::nullptr_t)
TF_API void Tf_PostNullSmartPtrDereferenceFatalError(const TfCallContext &, const char *)
static void Class_Object_MUST_Be_Passed_By_Address()
bool operator!=(const Mat3< T0 > &m0, const Mat3< T1 > &m1)
Inequality operator, does exact floating point comparisons.
static void Class_Object_MUST_Be_Passed_By_Address()
static bool IsNull(const Ptr< T > &t)
ToPtr TfSafeDynamic_cast(TfWeakPtrFacade< X, Y > const &p)
void Tf_RefPtrTracker_New(const void *, const void *)
bool PointsTo(T const &obj) const
void TfHashAppend(HashState &h, TfWeakPtrFacade< X, T > const &ptr)
PtrTemplate< DataType > Derived
GLfloat GLfloat GLfloat GLfloat h
ToPtr TfDynamic_cast(TfWeakPtrFacade< X, Y > const &p)
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
static void const * GetUniqueIdentifier(Facade const &f)
static bool IsNull(const Ptr< const T > &t)
bool operator>=(TfWeakPtrFacade< X, Y > const &p, std::nullptr_t)
static const T * GetRawPtr(const Ptr< const T > &t)
#define PXR_NAMESPACE_CLOSE_SCOPE
DataType * operator->() const
friend std::type_info const & TfTypeid(Derived const &p)
static bool IsInvalid(Facade const &f)
static Ptr< T > ConstructFromRawPtr(T *ptr)
ToPtr TfConst_cast(TfWeakPtrFacade< X, Y > const &p)
bool operator>=(PtrTemplate< Other > const &p) const
static void EnableExtraNotification(Facade const &f)
friend class TfWeakPtrFacadeAccess
TfWeakBase const * GetWeakBase() const
bool operator==(const Mat3< T0 > &m0, const Mat3< T1 > &m1)
Equality operator, does exact floating point comparisons.
TfWeakPtrFacadeAccess Access