60template <
class T,
class Disposer = DefaultPtrDisposer<T>>
68 SSharedCount(T *ptr) : _ptr(ptr), _refCount(1), _cs(), _disposer(new Disposer())
78 _disposer->dispose(_ptr);
97 bool shouldDelete =
false;
121 unsigned int _refCount;
133template <
class T,
class Disposer = DefaultPtrDisposer<T>>
160 obj._sc->incRefCount();
182 obj._sc->incRefCount();
262 return _ptr == obj._ptr;
Header file for SCriticalSection and SAutoLock classes.
Default implementation of PtrDisposer.
virtual void dispose(T *ptr)
Deletes the pointer.
Base class for disposing of a pointer.
virtual void dispose(T *ptr)=0
Deletes the pointer.
virtual ~PtrDisposer()
Virtual destructor.
Auto-lock class for managing critical sections.
Wrapper class for a critical section.
Manages the reference count for a shared pointer.
~SSharedCount()
Destructor.
void incRefCount()
Increments the reference count.
SSharedCount(T *ptr)
Constructor.
void decRefCount()
Decrements the reference count.
SSharedPtr()
Default constructor.
SSharedPtr(const SSharedPtr< T, Disposer > &obj)
Copy constructor.
T * ptr()
Returns the object pointer.
const T & operator*() const
Returns the object reference.
SSharedPtr & operator=(const SSharedPtr< T, Disposer > &obj)
Assignment operator.
bool operator==(const SSharedPtr< T, Disposer > &obj) const
Compares the pointer with another SSharedPtr object.
T & operator*()
Returns the object reference.
bool operator==(T *ptr) const
Compares the pointer with another pointer.
T * operator->()
Returns the object pointer.
const T * ptr() const
Returns the object pointer.
SSharedPtr(T *ptr)
Constructor.
const T * operator->() const
Returns the object pointer.