OpenShot Audio Library | OpenShotAudio 0.4.0

Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
juce::ReferenceCountedObjectPtr< ObjectType > Class Template Reference

`#include <juce_ReferenceCountedObject.h>`

## Public Types
using | ReferencedType = ObjectType

## Public Member Functions
| ReferenceCountedObjectPtr ()=default
| ReferenceCountedObjectPtr (decltype(nullptr)) noexcept
| ReferenceCountedObjectPtr (ReferencedType *refCountedObject) noexcept
| ReferenceCountedObjectPtr (ReferencedType &refCountedObject) noexcept
| ReferenceCountedObjectPtr (const ReferenceCountedObjectPtr &other) noexcept
| ReferenceCountedObjectPtr (ReferenceCountedObjectPtr &&other) noexcept
template<typename Convertible >
| ReferenceCountedObjectPtr (const ReferenceCountedObjectPtr< Convertible > &other) noexcept
ReferenceCountedObjectPtr & | operator= (const ReferenceCountedObjectPtr &other)
template<typename Convertible >
ReferenceCountedObjectPtr & | operator= (const ReferenceCountedObjectPtr< Convertible > &other)
ReferenceCountedObjectPtr & | operator= (ReferencedType *newObject)
ReferenceCountedObjectPtr & | operator= (ReferencedType &newObject)
ReferenceCountedObjectPtr & | operator= (decltype(nullptr))
ReferenceCountedObjectPtr & | operator= (ReferenceCountedObjectPtr &&other) noexcept
| ~ReferenceCountedObjectPtr ()
ReferencedType * | get () const noexcept
void | reset () noexcept
ReferencedType * | operator-> () const noexcept
ReferencedType & | operator* () const noexcept
bool | operator== (decltype(nullptr)) const noexcept
bool | operator!= (decltype(nullptr)) const noexcept
bool | operator== (const ObjectType *other) const noexcept
bool | operator== (const ReferenceCountedObjectPtr &other) const noexcept
bool | operator!= (const ObjectType *other) const noexcept
bool | operator!= (const ReferenceCountedObjectPtr &other) const noexcept
| operator ReferencedType * () const noexcept
ReferencedType * | getObject () const

## Detailed Description

template<class ObjectType>
class juce::ReferenceCountedObjectPtr< ObjectType >

A smart-pointer class which points to a reference-counted object.

The template parameter specifies the class of the object you want to point to - the easiest way to make a class reference-countable is to simply make it inherit from ReferenceCountedObject or SingleThreadedReferenceCountedObject, but if you need to, you can roll your own reference-countable class by implementing a set of methods called incReferenceCount(), decReferenceCount(), and decReferenceCountWithoutDeleting(). See ReferenceCountedObject for examples of how these methods should behave.

When using this class, you'll probably want to create a typedef to abbreviate the full templated name - e.g.

struct MyClass : public ReferenceCountedObject
{
using Ptr = ReferenceCountedObjectPtr<MyClass>;
...
}
juce::ReferenceCountedObjectPtr
Definition juce_ReferenceCountedObject.h:247
juce::ReferenceCountedObject
Definition juce_ReferenceCountedObject.h:66

See also
  ReferenceCountedObject, ReferenceCountedObjectArray

Definition at line 246 of file juce_ReferenceCountedObject.h.

## Member Typedef Documentation

## ◆ ReferencedType

template<class ObjectType >

using juce::ReferenceCountedObjectPtr< ObjectType >::ReferencedType = ObjectType

The class being referenced by this pointer.

Definition at line 250 of file juce_ReferenceCountedObject.h.

## Constructor & Destructor Documentation

## ◆ ReferenceCountedObjectPtr() [1/7]

template<class ObjectType >

juce::ReferenceCountedObjectPtr< ObjectType >::ReferenceCountedObjectPtr | ( |  | ) |
| default

Creates a pointer to a null object.

## ◆ ReferenceCountedObjectPtr() [2/7]

template<class ObjectType >

juce::ReferenceCountedObjectPtr< ObjectType >::ReferenceCountedObjectPtr | ( | decltype(nullptr) |  | ) |
| inline noexcept

Creates a pointer to a null object.

Definition at line 257 of file juce_ReferenceCountedObject.h.

## ◆ ReferenceCountedObjectPtr() [3/7]

template<class ObjectType >

juce::ReferenceCountedObjectPtr< ObjectType >::ReferenceCountedObjectPtr | ( | ReferencedType * | refCountedObject | ) |
| inline noexcept

Creates a pointer to an object. This will increment the object's reference-count.

Definition at line 262 of file juce_ReferenceCountedObject.h.

## ◆ ReferenceCountedObjectPtr() [4/7]

template<class ObjectType >

juce::ReferenceCountedObjectPtr< ObjectType >::ReferenceCountedObjectPtr | ( | ReferencedType & | refCountedObject | ) |
| inline noexcept

Creates a pointer to an object. This will increment the object's reference-count.

Definition at line 271 of file juce_ReferenceCountedObject.h.

## ◆ ReferenceCountedObjectPtr() [5/7]

template<class ObjectType >

juce::ReferenceCountedObjectPtr< ObjectType >::ReferenceCountedObjectPtr | ( | const ReferenceCountedObjectPtr< ObjectType > & | other | ) |
| inline noexcept

Copies another pointer. This will increment the object's reference-count.

Definition at line 280 of file juce_ReferenceCountedObject.h.

## ◆ ReferenceCountedObjectPtr() [6/7]

template<class ObjectType >

juce::ReferenceCountedObjectPtr< ObjectType >::ReferenceCountedObjectPtr | ( | ReferenceCountedObjectPtr< ObjectType > && | other | ) |
| inline noexcept

Takes-over the object from another pointer.

Definition at line 287 of file juce_ReferenceCountedObject.h.

## ◆ ReferenceCountedObjectPtr() [7/7]

template<class ObjectType >
template<typename Convertible >

juce::ReferenceCountedObjectPtr< ObjectType >::ReferenceCountedObjectPtr | ( | const ReferenceCountedObjectPtr< Convertible > & | other | ) |
| inline noexcept

Copies another pointer. This will increment the object's reference-count (if it is non-null).

Definition at line 297 of file juce_ReferenceCountedObject.h.

## ◆ ~ReferenceCountedObjectPtr()

template<class ObjectType >

juce::ReferenceCountedObjectPtr< ObjectType >::~ReferenceCountedObjectPtr | ( |  | ) |
| inline

Destructor. This will decrement the object's reference-count, which will cause the object to be deleted when the ref-count hits zero.

Definition at line 372 of file juce_ReferenceCountedObject.h.

## Member Function Documentation

## ◆ get()

template<class ObjectType >

ReferencedType * juce::ReferenceCountedObjectPtr< ObjectType >::get | ( |  | ) | const
| inline noexcept

Returns the object that this pointer references. The pointer returned may be null, of course.

Definition at line 381 of file juce_ReferenceCountedObject.h.

Referenced by juce::ReferenceCountedArray< ObjectClass, TypeOfCriticalSectionToUse >::add(), juce::ValueTree::addChild(), juce::ReferenceCountedArray< ObjectClass, TypeOfCriticalSectionToUse >::addIfNotAlreadyThere(), juce::WeakReference< ObjectType, ReferenceCountingType >::get(), juce::Thread::getCurrentThread(), juce::WeakReference< ObjectType, ReferenceCountingType >::Master::getSharedPointer(), juce::ReferenceCountedArray< ObjectClass, TypeOfCriticalSectionToUse >::insert(), juce::Expression::parse(), juce::ValueTree::readFromStream(), juce::ReferenceCountedArray< ObjectClass, TypeOfCriticalSectionToUse >::removeObject(), juce::ReferenceCountedArray< ObjectClass, TypeOfCriticalSectionToUse >::set(), and juce::WeakReference< ObjectType, ReferenceCountingType >::wasObjectDeleted().

## ◆ getObject()

template<class ObjectType >

ReferencedType * juce::ReferenceCountedObjectPtr< ObjectType >::getObject | ( |  | ) | const
| inline

Definition at line 433 of file juce_ReferenceCountedObject.h.

## ◆ operator ReferencedType *()

template<class ObjectType >

juce::ReferenceCountedObjectPtr< ObjectType >::operator ReferencedType * | ( |  | ) | const
| inline noexcept

Returns the object that this pointer references. The pointer returned may be null, of course. Note that this methods allows the compiler to be very lenient with what it allows you to do with the pointer, it's safer to disable this by setting JUCE_STRICT_REFCOUNTEDPOINTER=1, which increased type safety and can prevent some common slip-ups.

Definition at line 428 of file juce_ReferenceCountedObject.h.

## ◆ operator!=() [1/3]

template<class ObjectType >

bool juce::ReferenceCountedObjectPtr< ObjectType >::operator!= | ( | const ObjectType * | other | ) | const
| inline noexcept

Compares two ReferenceCountedObjectPtrs.

Definition at line 413 of file juce_ReferenceCountedObject.h.

## ◆ operator!=() [2/3]

template<class ObjectType >

bool juce::ReferenceCountedObjectPtr< ObjectType >::operator!= | ( | const ReferenceCountedObjectPtr< ObjectType > & | other | ) | const
| inline noexcept

Compares two ReferenceCountedObjectPtrs.

Definition at line 415 of file juce_ReferenceCountedObject.h.

## ◆ operator!=() [3/3]

template<class ObjectType >

bool juce::ReferenceCountedObjectPtr< ObjectType >::operator!= | ( | decltype(nullptr) |  | ) | const
| inline noexcept

Checks whether this pointer is null

Definition at line 406 of file juce_ReferenceCountedObject.h.

## ◆ operator*()

template<class ObjectType >

ReferencedType & juce::ReferenceCountedObjectPtr< ObjectType >::operator* | ( |  | ) | const
| inline noexcept

Dereferences the object that this pointer references. The pointer returned may be null, of course.

Definition at line 401 of file juce_ReferenceCountedObject.h.

## ◆ operator->()

template<class ObjectType >

ReferencedType * juce::ReferenceCountedObjectPtr< ObjectType >::operator-> | ( |  | ) | const
| inline noexcept

Definition at line 392 of file juce_ReferenceCountedObject.h.

## ◆ operator=() [1/6]

template<class ObjectType >

ReferenceCountedObjectPtr & juce::ReferenceCountedObjectPtr< ObjectType >::operator= | ( | const ReferenceCountedObjectPtr< ObjectType > & | other | ) |
| inline

Changes this pointer to point at a different object. The reference count of the old object is decremented, and it might be deleted if it hits zero. The new object's count is incremented.

Definition at line 307 of file juce_ReferenceCountedObject.h.

Referenced by juce::ReferenceCountedObjectPtr< ObjectType >::operator=(), juce::ReferenceCountedObjectPtr< ObjectType >::operator=(), and juce::ReferenceCountedObjectPtr< ObjectType >::operator=().

## ◆ operator=() [2/6]

template<class ObjectType >
template<typename Convertible >

ReferenceCountedObjectPtr & juce::ReferenceCountedObjectPtr< ObjectType >::operator= | ( | const ReferenceCountedObjectPtr< Convertible > & | other | ) |
| inline

Changes this pointer to point at a different object. The reference count of the old object is decremented, and it might be deleted if it hits zero. The new object's count is incremented.

Definition at line 317 of file juce_ReferenceCountedObject.h.

## ◆ operator=() [3/6]

template<class ObjectType >

ReferenceCountedObjectPtr & juce::ReferenceCountedObjectPtr< ObjectType >::operator= | ( | decltype(nullptr) |  | ) |
| inline

Resets this pointer to a null pointer.

Definition at line 355 of file juce_ReferenceCountedObject.h.

## ◆ operator=() [4/6]

template<class ObjectType >

ReferenceCountedObjectPtr & juce::ReferenceCountedObjectPtr< ObjectType >::operator= | ( | ReferenceCountedObjectPtr< ObjectType > && | other | ) |
| inline noexcept

Takes-over the object from another pointer.

Definition at line 362 of file juce_ReferenceCountedObject.h.

## ◆ operator=() [5/6]

template<class ObjectType >

ReferenceCountedObjectPtr & juce::ReferenceCountedObjectPtr< ObjectType >::operator= | ( | ReferencedType & | newObject | ) |
| inline

Changes this pointer to point at a different object.

The reference count of the old object is decremented, and it might be deleted if it hits zero. The new object's count is incremented.

Definition at line 341 of file juce_ReferenceCountedObject.h.

## ◆ operator=() [6/6]

template<class ObjectType >

ReferenceCountedObjectPtr & juce::ReferenceCountedObjectPtr< ObjectType >::operator= | ( | ReferencedType * | newObject | ) |
| inline

Changes this pointer to point at a different object.

The reference count of the old object is decremented, and it might be deleted if it hits zero. The new object's count is incremented.

Definition at line 327 of file juce_ReferenceCountedObject.h.

## ◆ operator==() [1/3]

template<class ObjectType >

bool juce::ReferenceCountedObjectPtr< ObjectType >::operator== | ( | const ObjectType * | other | ) | const
| inline noexcept

Compares two ReferenceCountedObjectPtrs.

Definition at line 409 of file juce_ReferenceCountedObject.h.

## ◆ operator==() [2/3]

template<class ObjectType >

bool juce::ReferenceCountedObjectPtr< ObjectType >::operator== | ( | const ReferenceCountedObjectPtr< ObjectType > & | other | ) | const
| inline noexcept

Compares two ReferenceCountedObjectPtrs.

Definition at line 411 of file juce_ReferenceCountedObject.h.

## ◆ operator==() [3/3]

template<class ObjectType >

bool juce::ReferenceCountedObjectPtr< ObjectType >::operator== | ( | decltype(nullptr) |  | ) | const
| inline noexcept

Checks whether this pointer is null

Definition at line 404 of file juce_ReferenceCountedObject.h.

## ◆ reset()

template<class ObjectType >

void juce::ReferenceCountedObjectPtr< ObjectType >::reset | ( |  | ) |
| inline noexcept

Resets this object to a null pointer.

Definition at line 384 of file juce_ReferenceCountedObject.h.

Referenced by juce::ReferenceCountedObjectPtr< ObjectType >::operator=(), and juce::ReferenceCountedObjectPtr< ObjectType >::operator=().

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

- juce_ReferenceCountedObject.h