24 #ifndef PXR_BASE_TF_REF_COUNT_H 25 #define PXR_BASE_TF_REF_COUNT_H 33 #include "pxr/base/tf/api.h" 36 PXR_NAMESPACE_OPEN_SCOPE
38 template <
typename T>
class TfRefPtr;
95 bool _DecrementAndTestIfZero()
const {
96 return (--_counter == 0);
100 int _FetchAndAdd(
int amount)
const {
101 return _counter.fetch_add(amount);
105 mutable std::atomic<int> _counter;
106 template <
typename T>
friend class TfRefPtr;
107 friend struct Tf_RefPtr_UniqueChangedCounter;
108 friend struct Tf_RefPtr_Counter;
111 PXR_NAMESPACE_CLOSE_SCOPE
113 #endif // PXR_BASE_TF_REF_COUNT_H
TfRefCount()
Initialize counter to one.
TfRefCount(const TfRefCount &)
Initialize counter to one.
Reference-counted smart pointer utility class.
const TfRefCount & operator=(const TfRefCount &) const
Assignment to a reference counter has no effect.
int Get() const
Returns counter's value.