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

`#include <juce_ReferenceCountedObject.h>`

## Public Member Functions

void | incReferenceCount () noexcept
void | decReferenceCount () noexcept
bool | decReferenceCountWithoutDeleting () noexcept
int | getReferenceCount () const noexcept

## Protected Member Functions

| SingleThreadedReferenceCountedObject ()=default
| SingleThreadedReferenceCountedObject (const SingleThreadedReferenceCountedObject &)
| SingleThreadedReferenceCountedObject (SingleThreadedReferenceCountedObject &&)
SingleThreadedReferenceCountedObject & | operator= (const SingleThreadedReferenceCountedObject &)
SingleThreadedReferenceCountedObject & | operator= (SingleThreadedReferenceCountedObject &&)
virtual | ~SingleThreadedReferenceCountedObject ()

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

Definition at line 153 of file juce_ReferenceCountedObject.h.

## Constructor & Destructor Documentation

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

Definition at line 198 of file juce_ReferenceCountedObject.h.

## SingleThreadedReferenceCountedObject() [3/3]

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

inline protected

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

Definition at line 200 of file juce_ReferenceCountedObject.h.

## ~SingleThreadedReferenceCountedObject()

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

inline protected virtual

Destructor.

Definition at line 207 of file juce_ReferenceCountedObject.h.

## Member Function Documentation

## decReferenceCount()

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

inline noexcept

Decreases the object's reference count. If the count gets to zero, the object will be deleted.

Definition at line 170 of file juce_ReferenceCountedObject.h.

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

Definition at line 182 of file juce_ReferenceCountedObject.h.

## getReferenceCount()

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

inline noexcept

Returns the object's current reference count.

Definition at line 189 of file juce_ReferenceCountedObject.h.

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

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

Definition at line 162 of file juce_ReferenceCountedObject.h.

## operator=() [1/2]

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

inline protected

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

Definition at line 202 of file juce_ReferenceCountedObject.h.

## operator=() [2/2]

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

inline protected

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

Definition at line 204 of file juce_ReferenceCountedObject.h.

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

- juce_ReferenceCountedObject.h