Ardour  9.2-79-gba93f2fe52
PBD::Private< T > Class Template Reference

#include <private.h>

Public Types

typedef void(* DestructorFunc) (void *)
 

Public Member Functions

 Private (DestructorFunc destructor_func=&Private< T >::delete_ptr)
 
T * get ()
 
void set (T *data)
 
void replace (T *data)
 

Static Public Member Functions

static void delete_ptr (void *data)
 

Private Member Functions

 Private (Private< T > const &)=delete
 
Private< T > & operator= (Private< T > const &)=delete
 

Private Attributes

GPrivate _gobjext
 

Detailed Description

template<class T>
class PBD::Private< T >

Definition at line 30 of file private.h.

Member Typedef Documentation

◆ DestructorFunc

template<class T >
typedef void(* PBD::Private< T >::DestructorFunc) (void *)

Definition at line 33 of file private.h.

Constructor & Destructor Documentation

◆ Private() [1/2]

template<class T >
PBD::Private< T >::Private ( DestructorFunc  destructor_func = &Private<T>::delete_ptr)
inlineexplicit

Constructor.

Parameters
destructor_funcFunction pointer, or 0. If destructor_func is not 0 and the stored data pointer is not 0, this function is called when replace() is called and when the thread exits.

Definition at line 47 of file private.h.

◆ Private() [2/2]

template<class T >
PBD::Private< T >::Private ( Private< T > const &  )
privatedelete

Member Function Documentation

◆ delete_ptr()

template<class T >
static void PBD::Private< T >::delete_ptr ( void *  data)
inlinestatic

Deletes static_cast<T*>(data)

Definition at line 36 of file private.h.

◆ get()

template<class T >
T* PBD::Private< T >::get ( )
inline

Gets the pointer stored in the calling thread.

Returns
If no value has yet been set in this thread, 0 is returned.

Definition at line 57 of file private.h.

◆ operator=()

template<class T >
Private<T>& PBD::Private< T >::operator= ( Private< T > const &  )
privatedelete

◆ replace()

template<class T >
void PBD::Private< T >::replace ( T *  data)
inline

Sets the pointer in the calling thread and calls destructor_func(). If a function pointer (and not 0) was specified in the constructor, and the stored data pointer before the call to replace() is not 0, then destructor_func() is called with this old pointer value.

@newin{2,32}

Definition at line 76 of file private.h.

◆ set()

template<class T >
void PBD::Private< T >::set ( T *  data)
inline

Sets the pointer in the calling thread without calling destructor_func().

Definition at line 64 of file private.h.

Member Data Documentation

◆ _gobjext

template<class T >
GPrivate PBD::Private< T >::_gobjext
private

Definition at line 85 of file private.h.


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