Loading...
Searching...
No Matches
juce::SingleThreadedReferenceCountedObject Class Reference

## 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

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

- juce_core/memory/juce_ReferenceCountedObject.h

Inheritance diagram for juce::SingleThreadedReferenceCountedObject:

## 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.

## Constructors and Destructors

## SingleThreadedReferenceCountedObject() [1/3]

juce::SingleThreadedReferenceCountedObject::SingleThreadedReferenceCountedObject | ( |  | ) |

protected default

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

Referenced by operator=(), operator=(), SingleThreadedReferenceCountedObject(), and SingleThreadedReferenceCountedObject().

## SingleThreadedReferenceCountedObject() [2/3]

juce::SingleThreadedReferenceCountedObject::SingleThreadedReferenceCountedObject | ( | const SingleThreadedReferenceCountedObject & |  | ) |

inline protected

Copying from another object does not affect this one's reference-count.

References SingleThreadedReferenceCountedObject().

## SingleThreadedReferenceCountedObject() [3/3]

juce::SingleThreadedReferenceCountedObject::SingleThreadedReferenceCountedObject | ( | SingleThreadedReferenceCountedObject && |  | ) |

inline protected

Copying from another object does not affect this one's reference-count.

References SingleThreadedReferenceCountedObject().

## ~SingleThreadedReferenceCountedObject()

virtual juce::SingleThreadedReferenceCountedObject::~SingleThreadedReferenceCountedObject | ( |  | ) |

inline protected virtual

Destructor.

References getReferenceCount(), and jassert.

## Member Functions

## incReferenceCount()

void juce::SingleThreadedReferenceCountedObject::incReferenceCount | ( |  | ) |

inline 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.

## decReferenceCount()

void juce::SingleThreadedReferenceCountedObject::decReferenceCount | ( |  | ) |

inline noexcept

Decreases the object's reference count.

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

References getReferenceCount(), and jassert.

## decReferenceCountWithoutDeleting()

bool juce::SingleThreadedReferenceCountedObject::decReferenceCountWithoutDeleting | ( |  | ) |

inline 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.

## getReferenceCount()

int juce::SingleThreadedReferenceCountedObject::getReferenceCount | ( |  | ) | const

inline noexcept

Returns the object's current reference count.

Referenced by decReferenceCount(), decReferenceCountWithoutDeleting(), and ~SingleThreadedReferenceCountedObject().

## operator=() [1/2]

SingleThreadedReferenceCountedObject & juce::SingleThreadedReferenceCountedObject::operator= | ( | const SingleThreadedReferenceCountedObject & |  | ) |

inline protected

Copying from another object does not affect this one's reference-count.

References SingleThreadedReferenceCountedObject().

## operator=() [2/2]

SingleThreadedReferenceCountedObject & juce::SingleThreadedReferenceCountedObject::operator= | ( | SingleThreadedReferenceCountedObject && |  | ) |

inline protected

Copying from another object does not affect this one's reference-count.

References SingleThreadedReferenceCountedObject().

### Purchase

Get JUCE

### Discover

What's New in JUCE Features

### Learn

Documentaion Tutorials Made with JUCE Resources

### Support

JUCE Forum Newsletter Archive

### About

Contact Us JUCE Legal JUCE Licensing FAQ

### Events

Audio Developer Conference
© Raw Material Software Limited