Audacity 3.2.0
Classes | Typedefs | Enumerations | Functions | Variables
ClientData Namespace Reference

Utility ClientData::Site to register hooks into a host class that attach client data. More...

Classes

struct  Base
 A convenient default parameter for class template Site. More...
 
struct  Cloneable
 A convenient base class defining abstract virtual Clone() for a given kind of pointer. More...
 
struct  Copyable
 Decorator template injects copy and move operators for container of pointers. More...
 
struct  Copyable< Container, DeepCopying >
 Specialization that clones sub-objects when copying; strong guarantee for assignment. More...
 
struct  Copyable< Container, ShallowCopying >
 Specialization that copies pointers, not sub-objects; strong guarantee for assignment. More...
 
struct  Copyable< Container, SkipCopying >
 Specialization that ignores contents of the source when copying (not when moving). More...
 
struct  Lockable
 Decorator template injects type Lock and method lock() into interface of Object. More...
 
struct  Lockable< Object, NoLocking >
 Specialization for trivial, non-locking policy. More...
 
struct  Lockable< Object, NonrecursiveLocking >
 Specialization for real locking with std::mutex. More...
 
struct  Lockable< Object, RecursiveLocking >
 Specialization for real locking with std::recursive_mutex. More...
 
struct  Locked
 Decorated reference to a ClientData::Lockable, with a current lock on it. More...
 
class  Site
 Utility to register hooks into a host class that attach client data. More...
 

Typedefs

template<typename Object >
using UniquePtr = std::unique_ptr< Object >
 A one-argument alias template for the default template-template parameter of ClientData::Site. More...
 
template<typename Object >
using BarePtr = Object *
 This template-template parameter for ClientData::Site risks dangling pointers, so be careful. More...
 

Enumerations

enum  LockingPolicy { NoLocking , NonrecursiveLocking , RecursiveLocking }
 Statically specify whether there is mutual exclusion (separately for the table of factories, and for the per-host container of client objects). More...
 
enum  CopyingPolicy { SkipCopying , ShallowCopying , DeepCopying }
 Statically specify how the ClientData::Site implements its copy constructor and assignment. More...
 

Functions

template<typename Ptr >
static const Ptr & Dereferenceable (Ptr &p)
 Conversion allowing operator * on any Pointer parameter of ClientData::Site. More...
 
template<typename Obj >
static std::shared_ptr< Obj > Dereferenceable (std::weak_ptr< Obj > &p)
 Overload of ClientData::Dereferenceable returns an rvalue. More...
 

Variables

template struct REGISTRIES_API Cloneable<>
 

Detailed Description

Utility ClientData::Site to register hooks into a host class that attach client data.


Audacity: A Digital Audio Editor

Paul Licameli

Typedef Documentation

◆ BarePtr

template<typename Object >
using ClientData::BarePtr = typedef Object*

This template-template parameter for ClientData::Site risks dangling pointers, so be careful.

Definition at line 37 of file ClientData.h.

◆ UniquePtr

template<typename Object >
using ClientData::UniquePtr = typedef std::unique_ptr< Object >

A one-argument alias template for the default template-template parameter of ClientData::Site.

(std::unique_ptr has two, the second is defaulted)

Definition at line 34 of file ClientData.h.

Enumeration Type Documentation

◆ CopyingPolicy

Statically specify how the ClientData::Site implements its copy constructor and assignment.

(Move construction and assignment always work.) Used as non-type template parameter of ClientData::Site

Enumerator
SkipCopying 

ignore the source and leave empty

ShallowCopying 

copy pointers only; won't compile for std::unique_ptr

DeepCopying 

point to new sub-objects; these must define a Clone() member; won't compile for std::weak_ptr

Definition at line 33 of file ClientDataHelpers.h.

33 {
37};
@ 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, and for the per-host container of client objects).

Used as non-type template parameter of ClientData::Site

Enumerator
NoLocking 
NonrecursiveLocking 

using std::mutex

RecursiveLocking 

using std::recursive_mutex

Definition at line 24 of file ClientDataHelpers.h.

24 {
28};
@ RecursiveLocking
using std::recursive_mutex
@ NonrecursiveLocking
using std::mutex

Function Documentation

◆ Dereferenceable() [1/2]

template<typename Ptr >
static const Ptr & ClientData::Dereferenceable ( Ptr &  p)
inlinestatic

Conversion allowing operator * on any Pointer parameter of ClientData::Site.

Return value should be bound to a const reference

Definition at line 49 of file ClientDataHelpers.h.

50 { return p; }

Referenced by ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::Build(), ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::FindIf(), and ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::ForEach().

Here is the caller graph for this function:

◆ Dereferenceable() [2/2]

template<typename Obj >
static std::shared_ptr< Obj > ClientData::Dereferenceable ( std::weak_ptr< Obj > &  p)
inlinestatic

Overload of ClientData::Dereferenceable returns an rvalue.

Definition at line 53 of file ClientDataHelpers.h.

54 { return p.lock(); }

Variable Documentation

◆ Cloneable<>

template struct REGISTRIES_API ClientData::Cloneable<>
extern