Audacity  3.0.3
Public Member Functions | Private Attributes | List of all members
ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::RegisteredFactory Class Reference

Client code makes static instance from a factory of attachments; passes it to Get or Find as a retrieval key. More...

#include <ClientData.h>

Public Member Functions

 RegisteredFactory (DataFactory factory)
 
 RegisteredFactory (RegisteredFactory &&other)
 
 ~RegisteredFactory ()
 

Private Attributes

friend Site
 
bool mOwner { true }
 
size_t mIndex
 

Detailed Description

template<typename Host, typename ClientData = Base, CopyingPolicy ObjectCopyingPolicy = SkipCopying, template< typename > class Pointer = UniquePtr, LockingPolicy ObjectLockingPolicy = NoLocking, LockingPolicy RegistryLockingPolicy = NoLocking>
class ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::RegisteredFactory

Client code makes static instance from a factory of attachments; passes it to Get or Find as a retrieval key.

It can be destroyed to de-register the factory, but usually not before destruction of statics at program exit.

Definition at line 265 of file ClientData.h.

Constructor & Destructor Documentation

◆ RegisteredFactory() [1/2]

template<typename Host , typename ClientData = Base, CopyingPolicy ObjectCopyingPolicy = SkipCopying, template< typename > class Pointer = UniquePtr, LockingPolicy ObjectLockingPolicy = NoLocking, LockingPolicy RegistryLockingPolicy = NoLocking>
ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::RegisteredFactory::RegisteredFactory ( DataFactory  factory)
inline

Definition at line 268 of file ClientData.h.

271  {
272  auto factories = GetFactories();
273  mIndex = factories.mObject.size();
274  factories.mObject.emplace_back( std::move( factory ) );
275  }

References factory, ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::GetFactories(), and ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::RegisteredFactory::mIndex.

Here is the call graph for this function:

◆ RegisteredFactory() [2/2]

template<typename Host , typename ClientData = Base, CopyingPolicy ObjectCopyingPolicy = SkipCopying, template< typename > class Pointer = UniquePtr, LockingPolicy ObjectLockingPolicy = NoLocking, LockingPolicy RegistryLockingPolicy = NoLocking>
ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::RegisteredFactory::RegisteredFactory ( RegisteredFactory &&  other)
inline

◆ ~RegisteredFactory()

template<typename Host , typename ClientData = Base, CopyingPolicy ObjectCopyingPolicy = SkipCopying, template< typename > class Pointer = UniquePtr, LockingPolicy ObjectLockingPolicy = NoLocking, LockingPolicy RegistryLockingPolicy = NoLocking>
ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::RegisteredFactory::~RegisteredFactory ( )
inline

Definition at line 282 of file ClientData.h.

283  {
284  if (mOwner) {
285  auto factories = GetFactories();
286  // Should always be true, the factory vector never shrinks:
287  if ( mIndex < factories.mObject.size() )
288  factories.mObject[mIndex] = nullptr;
289  }
290  }

References ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::GetFactories(), ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::RegisteredFactory::mIndex, and ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::RegisteredFactory::mOwner.

Here is the call graph for this function:

Member Data Documentation

◆ mIndex

template<typename Host , typename ClientData = Base, CopyingPolicy ObjectCopyingPolicy = SkipCopying, template< typename > class Pointer = UniquePtr, LockingPolicy ObjectLockingPolicy = NoLocking, LockingPolicy RegistryLockingPolicy = NoLocking>
size_t ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::RegisteredFactory::mIndex
private

◆ mOwner

template<typename Host , typename ClientData = Base, CopyingPolicy ObjectCopyingPolicy = SkipCopying, template< typename > class Pointer = UniquePtr, LockingPolicy ObjectLockingPolicy = NoLocking, LockingPolicy RegistryLockingPolicy = NoLocking>
bool ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::RegisteredFactory::mOwner { true }
private

◆ Site

template<typename Host , typename ClientData = Base, CopyingPolicy ObjectCopyingPolicy = SkipCopying, template< typename > class Pointer = UniquePtr, LockingPolicy ObjectLockingPolicy = NoLocking, LockingPolicy RegistryLockingPolicy = NoLocking>
friend ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::RegisteredFactory::Site
private

Definition at line 292 of file ClientData.h.


The documentation for this class was generated from the following file:
ClientData::Site::RegisteredFactory::mOwner
bool mOwner
Definition: ClientData.h:293
ClientData::Site::RegisteredFactory::mIndex
size_t mIndex
Definition: ClientData.h:294
factory
static RegisteredToolbarFactory factory
Definition: ControlToolBar.cpp:807
ClientData::Site::GetFactories
static Locked< DataFactories > GetFactories()
Definition: ClientData.h:503