JUCE: WeakReference< ObjectType, ReferenceCountingType >::Master Class Reference

JUCE

Public Member Functions | List of all members
WeakReference< ObjectType, ReferenceCountingType >::Master Class Reference
juce_core » memory

This class is embedded inside an object to which you want to attach WeakReference pointers. More...

`#include <juce_WeakReference.h>`

## Public Member Functions
| Master ()=default
| ~Master () noexcept
SharedRef | getSharedPointer (ObjectType *object)
| The first call to this method will create an internal object that is shared by all weak references to the object. More...
void | clear () noexcept
| The object that owns this master pointer should call this before it gets destroyed, to zero all the references to this object that may be out there. More...
int | getNumActiveWeakReferences () const noexcept
| Returns the number of WeakReferences that are out there pointing to this object. More...

## Detailed Description

template<class ObjectType, class ReferenceCountingType = ReferenceCountedObject>
class WeakReference< ObjectType, ReferenceCountingType >::Master

This class is embedded inside an object to which you want to attach WeakReference pointers.

See the WeakReference class notes for an example of how to use this class.

See also
  WeakReference

## Constructor & Destructor Documentation

## ◆ Master()

template<class ObjectType , class ReferenceCountingType = ReferenceCountedObject>

WeakReference< ObjectType, ReferenceCountingType >::Master::Master | ( |  | ) |
| default

## ◆ ~Master()

template<class ObjectType , class ReferenceCountingType = ReferenceCountedObject>

WeakReference< ObjectType, ReferenceCountingType >::Master::~Master | ( |  | ) |
| noexcept

References ReferenceCountedObjectPtr< ObjectType >::get(), and jassert.

## Member Function Documentation

## ◆ getSharedPointer()

template<class ObjectType , class ReferenceCountingType = ReferenceCountedObject>

SharedRef WeakReference< ObjectType, ReferenceCountingType >::Master::getSharedPointer | ( | ObjectType * | object | ) |

The first call to this method will create an internal object that is shared by all weak references to the object.

References ReferenceCountedObjectPtr< ObjectType >::get(), and jassert.

## ◆ clear()

template<class ObjectType , class ReferenceCountingType = ReferenceCountedObject>

void WeakReference< ObjectType, ReferenceCountingType >::Master::clear | ( |  | ) |
| noexcept

The object that owns this master pointer should call this before it gets destroyed, to zero all the references to this object that may be out there.

See the WeakReference class notes for an example of how to do this.

## ◆ getNumActiveWeakReferences()

template<class ObjectType , class ReferenceCountingType = ReferenceCountedObject>

int WeakReference< ObjectType, ReferenceCountingType >::Master::getNumActiveWeakReferences | ( |  | ) | const
| noexcept

Returns the number of WeakReferences that are out there pointing to this object.

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

- juce_WeakReference.h