JUCE
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
Public Member Functions | Protected Member Functions | List of all members
SingleThreadedReferenceCountedObject Class Reference

Adds reference-counting to an object. More...

Inherited by PopupMenu::CustomComponent.

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 ()
 Creates the reference-counted object (with an initial ref count of zero).
 
virtual ~SingleThreadedReferenceCountedObject ()
 Destructor.
 

Detailed Description

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.

See Also
ReferenceCountedObject, ReferenceCountedObjectPtr, ReferenceCountedArray

Constructor & Destructor Documentation

SingleThreadedReferenceCountedObject::SingleThreadedReferenceCountedObject ( )
protected

Creates the reference-counted object (with an initial ref count of zero).

virtual SingleThreadedReferenceCountedObject::~SingleThreadedReferenceCountedObject ( )
protectedvirtual

Destructor.

References jassert.

Member Function Documentation

void SingleThreadedReferenceCountedObject::incReferenceCount ( )
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.

void SingleThreadedReferenceCountedObject::decReferenceCount ( )
noexcept

Decreases the object's reference count.

If the count gets to zero, the object will be deleted.

References jassert.

bool SingleThreadedReferenceCountedObject::decReferenceCountWithoutDeleting ( )
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 jassert.

int SingleThreadedReferenceCountedObject::getReferenceCount ( ) const
noexcept

Returns the object's current reference count.


The documentation for this class was generated from the following file: