12#ifndef __AUDACITY_CLIENT_DATA_HELPERS__
13#define __AUDACITY_CLIENT_DATA_HELPERS__
43 template<
typename>
class Owner
48template<
typename Ptr >
static inline
52template<
typename Obj >
static inline
61template<
typename Object, LockingPolicy >
struct Lockable{};
67 Lock
lock()
const {
return {}; }
72 using Lock = std::unique_lock< std::mutex >;
77: Object, std::recursive_mutex {
78 using Lock = std::unique_lock< std::recursive_mutex >;
84template<
typename Lockable >
struct Locked
85 :
private Lockable::Lock
95template<
typename Container, CopyingPolicy >
struct Copyable{};
115 if (
this != &other) {
118 for (
auto &&ptr : other )
119 temp.push_back( ptr );
137 if (
this != &other) {
140 for (
auto &&p : other ) {
141 using Ptr =
decltype( p->Clone() );
142 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.