7#ifndef PXR_BASE_TF_WEAK_BASE_H
8#define PXR_BASE_TF_WEAK_BASE_H
15#include "pxr/base/tf/api.h"
20PXR_NAMESPACE_OPEN_SCOPE
31 TF_API
virtual ~Tf_Remnant();
37 Tf_ExpiryNotifier::Invoke2(
this);
41 bool _IsAlive()
const {
47 TF_API
virtual void const *_GetUniqueIdentifier()
const;
52 Register(std::atomic<Tf_Remnant*> &remnantPtr) {
53 if (Tf_Remnant *remnant = remnantPtr.load()) {
58 return Register(remnantPtr,
new Tf_Remnant);
66 Register(std::atomic<Tf_Remnant*> &remnantPtr, T *candidate) {
67 Tf_Remnant *existing =
nullptr;
68 if (remnantPtr.compare_exchange_strong(
70 static_cast<Tf_Remnant*
>(candidate))) {
83 TF_API
virtual void EnableNotification()
const;
97 mutable bool _notify, _notify2;
148 void EnableNotification2()
const;
150 TF_API
void const* GetUniqueIdentifier()
const;
158 if (Tf_Remnant *remnant = _remnantPtr.load(std::memory_order_relaxed)) {
170 return Tf_Remnant::Register(_remnantPtr);
175 return Tf_Remnant::Register<T>(_remnantPtr, tempRmnt);
178 bool _HasRemnant()
const {
179 return _remnantPtr.load(std::memory_order_relaxed) ? true :
false;
188 mutable std::atomic<Tf_Remnant*> _remnantPtr;
190 friend class Tf_WeakBaseAccess;
193class Tf_WeakBaseAccess {
196 return wb._Register();
202PXR_NAMESPACE_CLOSE_SCOPE
Reference-counted smart pointer utility class.
Enable a concrete base class for use with TfRefPtr that inhibits the "unique changed" facility of TfR...
Enable a concrete base class for use with TfWeakPtr.