24#ifndef PXR_BASE_TF_REF_BASE_H
25#define PXR_BASE_TF_REF_BASE_H
33#include "pxr/base/tf/api.h"
35PXR_NAMESPACE_OPEN_SCOPE
74 typedef void (*UniqueChangedFuncPtr)(
TfRefBase const *, bool);
75 struct UniqueChangedListener {
77 UniqueChangedFuncPtr func;
81 TfRefBase() : _shouldInvokeUniqueChangedListener(
false) { }
85 return GetRefCount().
Get();
90 return GetRefCount().
Get() == 1;
97 void SetShouldInvokeUniqueChangedListener(
bool shouldCall) {
98 _shouldInvokeUniqueChangedListener = shouldCall;
101 TF_API
static void SetUniqueChangedListener(UniqueChangedListener listener);
111 bool _shouldInvokeUniqueChangedListener;
113 static UniqueChangedListener _uniqueChangedListener;
114 template <
typename T>
friend class TfRefPtr;
115 friend struct Tf_RefPtr_UniqueChangedCounter;
116 friend struct Tf_RefPtr_Counter;
136PXR_NAMESPACE_CLOSE_SCOPE
Enable a concrete base class for use with TfRefPtr.
friend TfRefPtr< T > TfCreateRefPtrFromProtectedWeakPtr(TfWeakPtr< T > const &)
Thread-safe creation of a Tf ref pointer from a Tf weak pointer.
bool IsUnique() const
Return true if only one TfRefPtr points to this object.
size_t GetCurrentCount() const
Return the current reference count of this object.
int Get() const
Returns counter's value.
Reference-counted smart pointer utility class.
Enable a concrete base class for use with TfRefPtr that inhibits the "unique changed" facility of TfR...
Pointer storage with deletion detection.