IReleasable



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 
    IReleasableListener* const &Listener{ m_pListener }; // Listener 
        
    virtual void setListener(IReleasableListener *value) = 0; // Assign new listener 

    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