OpenShot Audio Library | OpenShotAudio: juce::SingletonHolder< Type, MutexType, onlyCreateOncePerRun > Struct Template Reference

OpenShot Audio Library | OpenShotAudio 0.4.0

Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
juce::SingletonHolder< Type, MutexType, onlyCreateOncePerRun > Struct Template Reference

`#include <juce_Singleton.h>`

## Public Member Functions
Type * | get ()
Type * | getWithoutChecking ()
void | deleteInstance ()
void | clear (Type *expectedObject) noexcept

## Public Attributes
std::atomic< Type * > | instance { nullptr }

## Detailed Description

template<typename Type, typename MutexType, bool onlyCreateOncePerRun>
struct juce::SingletonHolder< Type, MutexType, onlyCreateOncePerRun >

Used by the JUCE_DECLARE_SINGLETON macros to manage a static pointer to a singleton instance.

You generally won't use this directly, but see the macros JUCE_DECLARE_SINGLETON, JUCE_DECLARE_SINGLETON_SINGLETHREADED, JUCE_DECLARE_SINGLETON_SINGLETHREADED_MINIMAL, and JUCE_IMPLEMENT_SINGLETON for how it is intended to be used.

Definition at line 38 of file juce_Singleton.h.

## Constructor & Destructor Documentation

## ◆ ~SingletonHolder()

template<typename Type , typename MutexType , bool onlyCreateOncePerRun>

juce::SingletonHolder< Type, MutexType, onlyCreateOncePerRun >::~SingletonHolder | ( |  | ) |
| inline

Definition at line 42 of file juce_Singleton.h.

## Member Function Documentation

## ◆ clear()

template<typename Type , typename MutexType , bool onlyCreateOncePerRun>

void juce::SingletonHolder< Type, MutexType, onlyCreateOncePerRun >::clear | ( | Type * | expectedObject | ) |
| inlinenoexcept

Called by the class's destructor to clear the pointer if it is currently set to the given object.

Definition at line 116 of file juce_Singleton.h.

## ◆ deleteInstance()

template<typename Type , typename MutexType , bool onlyCreateOncePerRun>

void juce::SingletonHolder< Type, MutexType, onlyCreateOncePerRun >::deleteInstance | ( |  | ) |
| inline

Deletes and resets the current instance, if there is one.

Definition at line 109 of file juce_Singleton.h.

## ◆ get()

template<typename Type , typename MutexType , bool onlyCreateOncePerRun>

Type * juce::SingletonHolder< Type, MutexType, onlyCreateOncePerRun >::get | ( |  | ) |
| inline

Returns the current instance, or creates a new instance if there isn't one.

Definition at line 54 of file juce_Singleton.h.

## ◆ getWithoutChecking()

template<typename Type , typename MutexType , bool onlyCreateOncePerRun>

Type * juce::SingletonHolder< Type, MutexType, onlyCreateOncePerRun >::getWithoutChecking | ( |  | ) |
| inline

Returns the current instance, or creates a new instance if there isn't one, but doesn't do any locking, or checking for recursion or error conditions.

Definition at line 98 of file juce_Singleton.h.

Referenced by juce::SingletonHolder< Type, MutexType, onlyCreateOncePerRun >::get().

## Member Data Documentation

## ◆ instance

template<typename Type , typename MutexType , bool onlyCreateOncePerRun>

std::atomic<Type*> juce::SingletonHolder< Type, MutexType, onlyCreateOncePerRun >::instance { nullptr }

Definition at line 123 of file juce_Singleton.h.

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

- juce_Singleton.h