2#include <UnCompute/Base/Base.h>
3#include <UnCompute/Memory/IAllocator.h>
42 std::atomic<Int32> m_StrongRefCount;
54 , m_pAllocator(pAllocator)
63 return ++m_StrongRefCount;
78 if (--m_StrongRefCount == 0)
84 return m_StrongRefCount;
90 return m_StrongRefCount;
An interface for memory allocators.
Definition: IAllocator.h:8
virtual void Deallocate(void *pointer)=0
Deallocate memory.
The reference counter that holds the number of references to the object.
Definition: ReferenceCounter.h:41
ReferenceCounter(IAllocator *pAllocator)
Create a new reference counter with specified allocator.
Definition: ReferenceCounter.h:52
UInt32 ReleaseStrongRef(F &&destroyCallback)
Remove a strong reference from the counter.
Definition: ReferenceCounter.h:76
UInt32 AddStrongRef()
Add a strong reference to the counter.
Definition: ReferenceCounter.h:61
UInt32 GetStrongRefCount() const
Get number of strong references.
Definition: ReferenceCounter.h:88