12#ifndef __AUDACITY_CLIENT_DATA_HELPERS__
13#define __AUDACITY_CLIENT_DATA_HELPERS__
42 template<
typename>
class Owner
47template<
typename Ptr >
static inline
51template<
typename Obj >
static inline
60template<
typename Object, LockingPolicy >
struct Lockable{};
66 Lock
lock()
const {
return {}; }
71 using Lock = std::unique_lock< std::mutex >;
76: Object, std::recursive_mutex {
77 using Lock = std::unique_lock< std::recursive_mutex >;
83template<
typename Lockable >
struct Locked
84 :
private Lockable::Lock
94template<
typename Container, CopyingPolicy >
struct Copyable{};
114 if (
this != &other) {
117 for (
auto &&ptr : other )
118 temp.push_back( ptr );
136 if (
this != &other) {
139 for (
auto &&p : other ) {
140 using Ptr =
decltype( p->Clone() );
141 temp.push_back( p ? p->Clone() : Ptr{} );
Utility ClientData::Site to register hooks into a host class that attach client data.
static const Ptr & Dereferenceable(Ptr &p)
Conversion allowing operator * on any Pointer parameter of ClientData::Site.
CopyingPolicy
Statically specify how the ClientData::Site implements its copy constructor and assignment.
@ ShallowCopying
copy pointers only; won't compile for std::unique_ptr
@ SkipCopying
ignore the source and leave empty
@ DeepCopying
point to new sub-objects; these must define a Clone() member; won't compile for std::weak_ptr
LockingPolicy
Statically specify whether there is mutual exclusion (separately for the table of factories,...
@ RecursiveLocking
using std::recursive_mutex
@ NonrecursiveLocking
using std::mutex
void swap(std::unique_ptr< Alg_seq > &a, std::unique_ptr< Alg_seq > &b)
Copyable & operator=(Copyable &&)=default
Copyable(Copyable &&)=default
Copyable & operator=(const Copyable &other)
Copyable(const Copyable &other)
Call through to operator =.
Copyable(const Copyable &other)
Call through to operator =.
Copyable & operator=(const Copyable &other)
Copyable & operator=(Copyable &&)=default
Copyable(Copyable &&)=default
Copyable & operator=(const Copyable &)
Copyable(const Copyable &)
Copyable(Copyable &&)=default
Copyable & operator=(Copyable &&)=default
Decorator template injects copy and move operators for container of pointers.
std::unique_lock< std::mutex > Lock
std::unique_lock< std::recursive_mutex > Lock
Decorator template injects type Lock and method lock() into interface of Object.
Decorated reference to a ClientData::Lockable, with a current lock on it.