Describes releasable object.
You can find more information in comments below.
class IReleasable
{
protected:
int m_iRefCount;
IReleasableListener *m_pListener;
public:
int const &RefCount{ m_iRefCount }; // Reference counter
virtual bool RegisterReleaseListener(IReleasableListener *listener) = 0; // Add release listener used to detect final release of the manager
virtual bool UnregisterReleaseListener(IReleasableListener *listener) = 0; // Remove release listener from list
virtual int AddRef() = 0; // Increase reference counter and return its new value
virtual bool Release(const bool force = false) = 0; // Decrease reference counter and destroy object if counter becomes zero. If force is true, destroy object anyway. Return true if object is destroyed and false if not
};
Namespace: | nitisa |
Include: | Nitisa/Interfaces/IReleasable.h |