Adds reference-counting to an object. More...
Public Member Functions | |
void | incReferenceCount () noexcept |
Increments the object's reference count. | |
void | decReferenceCount () noexcept |
Decreases the object's reference count. | |
bool | decReferenceCountWithoutDeleting () noexcept |
Decreases the object's reference count. | |
int | getReferenceCount () const noexcept |
Returns the object's current reference count. | |
Protected Member Functions | |
SingleThreadedReferenceCountedObject ()=default | |
Creates the reference-counted object (with an initial ref count of zero). | |
SingleThreadedReferenceCountedObject (const SingleThreadedReferenceCountedObject &) | |
Copying from another object does not affect this one's reference-count. | |
SingleThreadedReferenceCountedObject (SingleThreadedReferenceCountedObject &&) | |
Copying from another object does not affect this one's reference-count. | |
SingleThreadedReferenceCountedObject & | operator= (const SingleThreadedReferenceCountedObject &) |
Copying from another object does not affect this one's reference-count. | |
SingleThreadedReferenceCountedObject & | operator= (SingleThreadedReferenceCountedObject &&) |
Copying from another object does not affect this one's reference-count. | |
virtual | ~SingleThreadedReferenceCountedObject () |
Destructor. | |
Adds reference-counting to an object.
This is effectively a version of the ReferenceCountedObject class, but which uses a non-atomic counter, and so is not thread-safe (but which will be more efficient). For more details on how to use it, see the ReferenceCountedObject class notes.
|
protecteddefault |
Creates the reference-counted object (with an initial ref count of zero).
Referenced by operator=(), operator=(), SingleThreadedReferenceCountedObject(), and SingleThreadedReferenceCountedObject().
|
protected |
Copying from another object does not affect this one's reference-count.
References SingleThreadedReferenceCountedObject().
|
protected |
Copying from another object does not affect this one's reference-count.
References SingleThreadedReferenceCountedObject().
|
protectedvirtual |
Destructor.
References getReferenceCount(), and jassert.
|
noexcept |
Increments the object's reference count.
This is done automatically by the smart pointer, but is public just in case it's needed for nefarious purposes.
|
noexcept |
Decreases the object's reference count.
If the count gets to zero, the object will be deleted.
References getReferenceCount(), and jassert.
|
noexcept |
Decreases the object's reference count.
If the count gets to zero, the object will not be deleted, but this method will return true, allowing the caller to take care of deletion.
References getReferenceCount(), and jassert.
|
noexcept |
Returns the object's current reference count.
Referenced by decReferenceCount(), decReferenceCountWithoutDeleting(), and ~SingleThreadedReferenceCountedObject().
|
protected |
Copying from another object does not affect this one's reference-count.
References SingleThreadedReferenceCountedObject().
|
protected |
Copying from another object does not affect this one's reference-count.
References SingleThreadedReferenceCountedObject().