Audacity 3.2.0
Classes | Public Types | Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy > Class Template Reference

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

#include <ClientData.h>

Inheritance diagram for ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >:
[legend]
Collaboration diagram for ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >:
[legend]

Classes

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

Public Types

using DataType = ClientData
 
using DataPointer = Pointer< ClientData >
 
using DataFactory = std::function< DataPointer(Host &) >
 Type of function from which RegisteredFactory is constructed; it builds attachments. More...
 

Public Member Functions

 ~Site ()
 
 Site ()
 
 Site (const Site &other)
 
Siteoperator= (const Site &other)
 
 Site (Site &&other)
 
Siteoperator= (Site &&other)
 
size_t size () const
 How many attachment pointers are in the Site. More...
 
Retrieval and reassignment of attachments
template<typename Subclass = ClientData>
Subclass & Get (const RegisteredFactory &key)
 Get reference to an attachment, creating on demand if not present, down-cast it to Subclass. More...
 
template<typename Subclass = const ClientData>
auto Get (const RegisteredFactory &key) const -> std::enable_if_t< std::is_const< Subclass >::value, Subclass & >
 Get reference to an attachment, creating on demand if not present, down-cast it to Subclass. More...
 
template<typename Subclass = ClientData>
Subclass * Find (const RegisteredFactory &key)
 Get a (bare) pointer to an attachment, or null, down-cast it to Subclass *; will not create on demand. More...
 
template<typename Subclass = const ClientData>
auto Find (const RegisteredFactory &key) const -> std::enable_if_t< std::is_const< Subclass >::value, Subclass * >
 Get a (bare) pointer to an attachment, or null, down-cast it to Subclass *; will not create on demand. More...
 
template<typename ReplacementPointer >
void Assign (const RegisteredFactory &key, ReplacementPointer &&replacement)
 Reassign Site's pointer to ClientData. More...
 

Static Public Member Functions

static size_t numFactories ()
 How many static factories have been registered with this specialization of Site. More...
 

Protected Member Functions

member functions for use by @b Host
template<typename Function >
void ForEach (const Function &function)
 Invoke function on each ClientData object that has been created in this. More...
 
template<typename Function >
void ForEach (const Function &function) const
 Invoke function on each ClientData object that has been created in this. More...
 
template<typename Function >
void ForCorresponding (Site &other, const Function &function, bool create=true)
 
template<typename Function >
ClientData * FindIf (const Function &function)
 Return pointer to first attachment in this that is not null and satisfies a predicate, or nullptr. More...
 
template<typename Function >
const ClientData * FindIf (const Function &function) const
 Return pointer to first attachment in this that is not null and satisfies a predicate, or nullptr. More...
 
template<typename Function >
void EraseIf (const Function &function)
 Erase attached objects satisfying a predicate. More...
 
void BuildAll ()
 For each RegisteredFactory, if the corresponding attachment is absent in this, build and store it. More...
 

Private Types

using DataFactories = Lockable< std::vector< DataFactory >, RegistryLockingPolicy >
 
using DataContainer = Lockable< Copyable< std::vector< DataPointer >, ObjectCopyingPolicy >, ObjectLockingPolicy >
 

Private Member Functions

template<typename Subclass >
Subclass & DoGet (Locked< DataContainer > &data, const RegisteredFactory &key)
 
template<typename Subclass >
Subclass * DoFind (Locked< DataContainer > &data, const RegisteredFactory &key)
 
Locked< DataContainerGetData ()
 
Locked< const DataContainerGetData () const
 
DataPointerBuild (Locked< DataContainer > &, typename DataContainer::iterator iter, size_t index)
 

Static Private Member Functions

static Locked< DataFactoriesGetFactories ()
 
static void EnsureIndex (Locked< DataContainer > &data, size_t index)
 
static DataContainer::iterator GetIterator (Locked< DataContainer > &data, size_t index)
 

Private Attributes

decltype(Dereferenceable(std::declval< DataPointer & >())) Slot (Locked< DataContainer > &data, const RegisteredFactory &key, bool create)
 
DataContainer mData
 Container of pointers returned by factories, per instance of Host class. More...
 

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 >

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

This allows the host object to be the root of an ownership tree of sub-objects at run-time, but inverting the compile-time dependency among implementation files: The host's implementation is in low-level files, and cyclic file dependencies are avoided. The set of client objects attached to each host object is not fixed in the definition of the host class, but instead a system of registration of factories of client objects lets it be open-ended.

Besides mere storage and retrieval, this can also implement the observer pattern, in which the host pushes notifications to some virtual function defined in each attached item.

Host side usage pattern
class Host;
class AbstractClientData // Abstract base class for attached data
{
virtual ~AbstractClientData(); // minimum for memory management
// optional extra observer protocols
virtual void NotificationMethod(
// maybe host passes reference to self, maybe not
// Host &host
) = 0;
};
class Host
: public ClientData::Site< Host, AbstractClientData >
// That inheritance is a case of CRTP
// (the "curiously recurring template pattern")
// in which the base class takes the derived class as a template argument
{
public:
Host()
{
// If using an Observer protocol, force early creation of all client
// data:
}
void NotifyAll()
{
// Visit all non-null objects
ForEach( []( AbstractClientData &data ){
data.NotificationMethod(
// *this
);
} );
}
}
Utility to register hooks into a host class that attach client data.
Definition: ClientData.h:229
void ForEach(const Function &function)
Invoke function on each ClientData object that has been created in this.
Definition: ClientData.h:389
void BuildAll()
For each RegisteredFactory, if the corresponding attachment is absent in this, build and store it.
Definition: ClientData.h:546
Client side usage pattern
class MyClientData : public AbstractClientData
{
public:
MyClientData( Host &host )
{
// ... use host, maybe keep a back pointer to it, maybe not,
// depending how Host declares NotificationMethod ...
// ... Maybe Host too is an abstract class and we invoke some
// virtual function of it ...
}
void NotificationMethod(
// Host &host
) override
{
// ... Observer actions
// (If there is more than one separately compiled module using this
// protocol, beware that the sequence of notifications is unspecified)
}
private:
int mExtraStuff;
};
// Registration of a factory at static initialization time, to be called
// when a Host uses BuildAll, or else lazily when client code uses
// Host::Get()
static const Host::RegisteredFactory key{
[]( Host &host ){ return std::make_unique< MyClientData >( host ); }
};
// Use of that key at other times, not dependent on notifications from
// the core
void DoSomething( Host &host )
{
// This may force lazy construction of MyClientData, always returning
// an object (or else throwing)
auto &data = host.Get< MyClientData >( key );
auto val = pData->mExtraStuff;
// ...
}
void DoAnotherThing( Host &host )
{
// Does not force lazy construction of MyClientData
auto *pData = host.Find< MyClientData >( key );
if ( pData ) {
auto val = data.mExtraStuff;
// ...
}
}
void DoYetAnotherThing( Host &host )
{
// Reassign the pointer in this client's slot
host.Assign( key, MyReplacementObject( host ) );
}
static const AudacityProject::AttachedObjects::RegisteredFactory key
Lazy or eager construction

If the client only needs retrieval, it might need construction of data only on demand. But if the host is meant to push notifications to the clients, then the host class is responsible for forcing early building of all ClientData when host is constructed, as in the example above.

Unusual registration sequences

If registration of a factory happens after some host objects are already in existence, their associated client data fail to be created if you rely only on BuildAll in the @B Host constructor. Early deregistration of factories is permitted, in which case any later constructed host objects will carry null pointers in the associated slot, and a small "leak" in the space of per-host slots will persist until the program exits. All such usage is not recommended.

Template Parameters
HostType that derives from this base class; it supports hooks to invoke attached object factories. This is an example of the curiously recurring template pattern
ClientDataCommon base class of attachments; must have a virtual destructor
CopyingPolicyCopyingPolicy value Chooses deep, shallow, or (default) no-op copying of attachments
PointerThe kind of pointer Host will hold to ClientData; default is std::unique_ptr. You might want to use std::shared_ptr, std::weak_ptr, or wxWeakRef instead
ObjectLockingPolicyLockingPolicy value chooses thread safety policy for array of attachments in each Host, default is unsafe
RegistryLockingPolicyLockingPolicy value chooses thread safety policy for the static table of attachment factory functions, default is unsafe

Definition at line 228 of file ClientData.h.

Member Typedef Documentation

◆ DataContainer

template<typename Host , typename ClientData = Base, CopyingPolicy ObjectCopyingPolicy = SkipCopying, template< typename > class Pointer = UniquePtr, LockingPolicy ObjectLockingPolicy = NoLocking, LockingPolicy RegistryLockingPolicy = NoLocking>
using ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::DataContainer = Lockable< Copyable< std::vector< DataPointer >, ObjectCopyingPolicy >, ObjectLockingPolicy >
private

Definition at line 571 of file ClientData.h.

◆ DataFactories

template<typename Host , typename ClientData = Base, CopyingPolicy ObjectCopyingPolicy = SkipCopying, template< typename > class Pointer = UniquePtr, LockingPolicy ObjectLockingPolicy = NoLocking, LockingPolicy RegistryLockingPolicy = NoLocking>
using ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::DataFactories = Lockable< std::vector< DataFactory >, RegistryLockingPolicy >
private

Definition at line 569 of file ClientData.h.

◆ DataFactory

template<typename Host , typename ClientData = Base, CopyingPolicy ObjectCopyingPolicy = SkipCopying, template< typename > class Pointer = UniquePtr, LockingPolicy ObjectLockingPolicy = NoLocking, LockingPolicy RegistryLockingPolicy = NoLocking>
using ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::DataFactory = std::function< DataPointer( Host& ) >

Type of function from which RegisteredFactory is constructed; it builds attachments.

Definition at line 240 of file ClientData.h.

◆ DataPointer

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

Definition at line 238 of file ClientData.h.

◆ DataType

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

Definition at line 237 of file ClientData.h.

Constructor & Destructor Documentation

◆ ~Site()

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 >::~Site ( )
inline

Definition at line 231 of file ClientData.h.

232 {
233 static_assert( std::has_virtual_destructor<ClientData>::value,
234 "ClientData::Site requires a data class with a virtual destructor" );
235 }

◆ Site() [1/3]

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 >::Site ( )
inline

Definition at line 242 of file ClientData.h.

243 {
244 auto factories = GetFactories();
245 auto size = factories.mObject.size();
246 mData.reserve( size );
247 }
size_t size() const
How many attachment pointers are in the Site.
Definition: ClientData.h:260
static Locked< DataFactories > GetFactories()
Definition: ClientData.h:608
DataContainer mData
Container of pointers returned by factories, per instance of Host class.
Definition: ClientData.h:668

References ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::GetFactories(), ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::mData, and ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::size().

Here is the call graph for this function:

◆ Site() [2/3]

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 >::Site ( const Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy > &  other)
inline

Definition at line 248 of file ClientData.h.

249 : mData( other.mData )
250 { }

◆ Site() [3/3]

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 >::Site ( Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy > &&  other)
inline

Definition at line 253 of file ClientData.h.

254 : mData( std::move(other.mData) )
255 { }

Member Function Documentation

◆ Assign()

template<typename Host , typename ClientData = Base, CopyingPolicy ObjectCopyingPolicy = SkipCopying, template< typename > class Pointer = UniquePtr, LockingPolicy ObjectLockingPolicy = NoLocking, LockingPolicy RegistryLockingPolicy = NoLocking>
template<typename ReplacementPointer >
void ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::Assign ( const RegisteredFactory key,
ReplacementPointer &&  replacement 
)
inline

Reassign Site's pointer to ClientData.

If ObjectLockingPolicy isn't default, then reassignments are serialized.

Template Parameters
ReplacementPointerPointer<Subclass> where Subclass derives ClientData
Parameters
keyReference to static object created in client code
replacementA temporary or std::move'd pointer

Definition at line 364 of file ClientData.h.

368 {
369 auto index = key.mIndex;
370 auto data = GetData();
371 EnsureIndex( data, index );
372 auto iter = GetIterator( data, index );
373 // Copy or move as appropriate:
374 *iter = std::forward< ReplacementPointer >( replacement );
375 }
Locked< DataContainer > GetData()
Definition: ClientData.h:619
static DataContainer::iterator GetIterator(Locked< DataContainer > &data, size_t index)
Definition: ClientData.h:636
static void EnsureIndex(Locked< DataContainer > &data, size_t index)
Definition: ClientData.h:629

References ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::EnsureIndex(), ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::GetData(), ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::GetIterator(), key, and ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::RegisteredFactory::mIndex.

Referenced by AdornedRulerPanel::Destroy(), and TrackPanel::Destroy().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Build()

template<typename Host , typename ClientData = Base, CopyingPolicy ObjectCopyingPolicy = SkipCopying, template< typename > class Pointer = UniquePtr, LockingPolicy ObjectLockingPolicy = NoLocking, LockingPolicy RegistryLockingPolicy = NoLocking>
DataPointer & ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::Build ( Locked< DataContainer > &  ,
typename DataContainer::iterator  iter,
size_t  index 
)
inlineprivate

Definition at line 648 of file ClientData.h.

650 {
651 // If there is no object at index, then invoke the factory, else do
652 // nothing.
653 // The factory may be null or may return null, in which case do nothing.
654 auto &result = *iter;
655 if (!Dereferenceable(result)) {
656 // creation on demand
657 auto factories = GetFactories();
658 auto &factory = factories.mObject[index];
659 result = factory
660 ? factory( static_cast< Host& >( *this ) )
661 : DataPointer{};
662 }
663 return result;
664 }
static RegisteredToolbarFactory factory
Pointer< ClientData > DataPointer
Definition: ClientData.h:238
static const Ptr & Dereferenceable(Ptr &p)
Conversion allowing operator * on any Pointer parameter of ClientData::Site.

References ClientData::Dereferenceable(), factory, ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::GetFactories(), and audacity::network_manager::common_headers::Host.

Referenced by ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::BuildAll().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ BuildAll()

template<typename Host , typename ClientData = Base, CopyingPolicy ObjectCopyingPolicy = SkipCopying, template< typename > class Pointer = UniquePtr, LockingPolicy ObjectLockingPolicy = NoLocking, LockingPolicy RegistryLockingPolicy = NoLocking>
void ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::BuildAll ( )
inlineprotected

For each RegisteredFactory, if the corresponding attachment is absent in this, build and store it.

Definition at line 546 of file ClientData.h.

547 {
548 // Note that we cannot call this function in the Site constructor as we
549 // might wish, because we pass *this to the factories, but this is not yet
550 // fully constructed as the ultimate derived class. So delayed calls to
551 // this function are needed.
552 size_t size;
553 {
554 auto factories = GetFactories();
555 size = factories.mObject.size();
556 // Release lock on factories before getting one on data -- otherwise
557 // there would be a deadlock possibility inside EnsureIndex
558 }
559 auto data = GetData();
560 EnsureIndex( data, size - 1 );
561 auto iter = GetIterator( data, 0 );
562 for ( size_t ii = 0; ii < size; ++ii, ++iter )
563 static_cast< void >( Build( data, iter, ii ) );
564 }
DataPointer & Build(Locked< DataContainer > &, typename DataContainer::iterator iter, size_t index)
Definition: ClientData.h:648

References ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::Build(), ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::EnsureIndex(), ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::GetData(), ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::GetFactories(), ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::GetIterator(), and ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::size().

Referenced by WaveChannelView::BuildSubViews().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ DoFind()

template<typename Host , typename ClientData = Base, CopyingPolicy ObjectCopyingPolicy = SkipCopying, template< typename > class Pointer = UniquePtr, LockingPolicy ObjectLockingPolicy = NoLocking, LockingPolicy RegistryLockingPolicy = NoLocking>
template<typename Subclass >
Subclass * ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::DoFind ( Locked< DataContainer > &  data,
const RegisteredFactory key 
)
inlineprivate

Definition at line 599 of file ClientData.h.

600 {
601 const auto &d = Slot( data, key, false );
602 if (!d)
603 return nullptr;
604 else
605 return static_cast< Subclass* >( &*d );
606 }
decltype(Dereferenceable(std::declval< DataPointer & >())) Slot(Locked< DataContainer > &data, const RegisteredFactory &key, bool create)
Definition: ClientData.h:578

References key, and ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::Slot.

◆ DoGet()

template<typename Host , typename ClientData = Base, CopyingPolicy ObjectCopyingPolicy = SkipCopying, template< typename > class Pointer = UniquePtr, LockingPolicy ObjectLockingPolicy = NoLocking, LockingPolicy RegistryLockingPolicy = NoLocking>
template<typename Subclass >
Subclass & ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::DoGet ( Locked< DataContainer > &  data,
const RegisteredFactory key 
)
inlineprivate

Definition at line 588 of file ClientData.h.

589 {
590 const auto &d = Slot( data, key, true );
591 if (!d)
592 // Oops, a factory was deregistered too soon, or returned a null, or
593 // the pointer was reassigned null
595 return static_cast< Subclass& >( *d );
596 }
#define THROW_INCONSISTENCY_EXCEPTION
Throw InconsistencyException, using C++ preprocessor to identify the source code location.

References key, ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::Slot, and THROW_INCONSISTENCY_EXCEPTION.

◆ EnsureIndex()

template<typename Host , typename ClientData = Base, CopyingPolicy ObjectCopyingPolicy = SkipCopying, template< typename > class Pointer = UniquePtr, LockingPolicy ObjectLockingPolicy = NoLocking, LockingPolicy RegistryLockingPolicy = NoLocking>
static void ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::EnsureIndex ( Locked< DataContainer > &  data,
size_t  index 
)
inlinestaticprivate

Definition at line 629 of file ClientData.h.

630 {
631 if (data.mObject.size() <= index)
632 data.mObject.resize(index + 1);
633 }

References ClientData::Locked< Lockable >::mObject.

Referenced by ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::Assign(), ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::BuildAll(), and ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::ForCorresponding().

Here is the caller graph for this function:

◆ EraseIf()

template<typename Host , typename ClientData = Base, CopyingPolicy ObjectCopyingPolicy = SkipCopying, template< typename > class Pointer = UniquePtr, LockingPolicy ObjectLockingPolicy = NoLocking, LockingPolicy RegistryLockingPolicy = NoLocking>
template<typename Function >
void ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::EraseIf ( const Function &  function)
inlineprotected

Erase attached objects satisfying a predicate.

Beware that the sequence of visitation is not specified.

Template Parameters
Functiontakes reference to ClientData, returns value convertible to bool
Parameters
functionof type Function

Definition at line 532 of file ClientData.h.

533 {
534 auto data = GetData();
535 for (auto &pObject : data.mObject) {
536 const auto &ptr = Dereferenceable(pObject);
537 if (ptr) {
538 auto &ref = *ptr;
539 if (function(ref))
540 pObject = nullptr;
541 }
542 }
543 }

References ClientData::Dereferenceable(), and ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::GetData().

Here is the call graph for this function:

◆ Find() [1/2]

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

Get a (bare) pointer to an attachment, or null, down-cast it to Subclass *; will not create on demand.

(Lifetime of the object may depend on the host's lifetime and also on the client's use of Assign(). Site is not responsible for guarantees.)

Template Parameters
SubclassExpected actual type of attachment, assumed to be correct
Parameters
keyReference to static object created in client code

Definition at line 342 of file ClientData.h.

343 {
344 auto data = GetData();
345 return DoFind< Subclass >( data, key );
346 }

References ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::GetData(), and key.

Referenced by AdornedRulerPanel::Destroy(), TrackPanel::Destroy(), ProjectWindow::Find(), and anonymous_namespace{SyncLock.cpp}::FindSyncLockGroup().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Find() [2/2]

template<typename Host , typename ClientData = Base, CopyingPolicy ObjectCopyingPolicy = SkipCopying, template< typename > class Pointer = UniquePtr, LockingPolicy ObjectLockingPolicy = NoLocking, LockingPolicy RegistryLockingPolicy = NoLocking>
template<typename Subclass = const ClientData>
auto ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::Find ( const RegisteredFactory key) const -> std::enable_if_t< std::is_const< Subclass >::value, Subclass * >
inline

Get a (bare) pointer to an attachment, or null, down-cast it to Subclass *; will not create on demand.

(Lifetime of the object may depend on the host's lifetime and also on the client's use of Assign(). Site is not responsible for guarantees.)

Template Parameters
SubclassExpected actual type of attachment, assumed to be correct
Parameters
keyReference to static object created in client code

const overload returns pointers to const only.

Definition at line 351 of file ClientData.h.

353 {
354 auto data = GetData();
355 return DoFind< Subclass >( data, key );
356 }

References ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::GetData(), and key.

Here is the call graph for this function:

◆ FindIf() [1/2]

template<typename Host , typename ClientData = Base, CopyingPolicy ObjectCopyingPolicy = SkipCopying, template< typename > class Pointer = UniquePtr, LockingPolicy ObjectLockingPolicy = NoLocking, LockingPolicy RegistryLockingPolicy = NoLocking>
template<typename Function >
ClientData * ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::FindIf ( const Function &  function)
inlineprotected

Return pointer to first attachment in this that is not null and satisfies a predicate, or nullptr.

Beware that the sequence of visitation is not specified.

Template Parameters
Functiontakes reference to ClientData, returns value convertible to bool
Parameters
functionof type Function

Definition at line 497 of file ClientData.h.

498 {
499 auto data = GetData();
500 for( auto &pObject : data.mObject ) {
501 const auto &ptr = Dereferenceable(pObject);
502 if ( ptr && function ( *ptr ) )
503 return &*ptr;
504 }
505 return nullptr;
506 }

References ClientData::Dereferenceable(), and ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::GetData().

Referenced by NoteTrack::HandleXMLTag(), and WaveChannelView::ToggleSubView().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ FindIf() [2/2]

template<typename Host , typename ClientData = Base, CopyingPolicy ObjectCopyingPolicy = SkipCopying, template< typename > class Pointer = UniquePtr, LockingPolicy ObjectLockingPolicy = NoLocking, LockingPolicy RegistryLockingPolicy = NoLocking>
template<typename Function >
const ClientData * ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::FindIf ( const Function &  function) const
inlineprotected

Return pointer to first attachment in this that is not null and satisfies a predicate, or nullptr.

Beware that the sequence of visitation is not specified.

Template Parameters
Functiontakes reference to ClientData, returns value convertible to bool
Parameters
functionof type Function

const overload only compiles with a function callable with a const reference to ClientData.

Definition at line 511 of file ClientData.h.

512 {
513 auto data = GetData();
514 for( auto &pObject : data.mObject ) {
515 const auto &ptr = Dereferenceable(pObject);
516 if ( ptr ) {
517 const auto &c_ref = *ptr;
518 if ( function( c_ref ) )
519 return &*c_ref;
520 }
521 }
522 return nullptr;
523 }

References ClientData::Dereferenceable(), and ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::GetData().

Here is the call graph for this function:

◆ ForCorresponding()

template<typename Host , typename ClientData = Base, CopyingPolicy ObjectCopyingPolicy = SkipCopying, template< typename > class Pointer = UniquePtr, LockingPolicy ObjectLockingPolicy = NoLocking, LockingPolicy RegistryLockingPolicy = NoLocking>
template<typename Function >
void ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::ForCorresponding ( Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy > &  other,
const Function &  function,
bool  create = true 
)
inlineprotected

Invoke function on corresponding pairs of ClientData objects that have been created in this and in another Site with the same factories

Beware that the sequence of visitation is not specified.

Template Parameters
Functiontakes two pointers to ClientData, return value is ignored
Parameters
othersupplies the objects to the second argument of function
functionof type Function may assume the precondition, that the arguments are not both null, and if create is true, then neither argument is null. When neither is null, also the objects have come from the same factory.
createwhether to create objects at vacant slots that correspond to non-vacant slots. (Never create where there are corresponding nulls.)

Definition at line 428 of file ClientData.h.

430 {
431 size_t size;
432 {
433 auto factories = GetFactories();
434 size = factories.mObject.size();
435 // Release lock on factories before getting one on data -- otherwise
436 // there would be a deadlock possibility inside EnsureIndex
437 }
438
439 // Lock two containers, carefully avoiding deadlock possibility by
440 // ordering them by address in memory
441 std::optional<decltype(GetData())> oOtherData;
442 if (std::addressof(other) < std::addressof(*this))
443 oOtherData.emplace(other.GetData());
444 auto data = GetData();
445 if (!oOtherData)
446 oOtherData.emplace(other.GetData());
447 auto &otherData = *oOtherData;
448
449 // Like BuildAll but needing correspondence
450 EnsureIndex(data, size - 1);
451 EnsureIndex(otherData, size - 1);
452
453 auto iter = GetIterator(data, 0);
454 auto otherIter = GetIterator(otherData, 0);
455
456 for (size_t ii = 0; ii < size; ++ii, ++iter, ++otherIter) {
457 auto &pObject = *iter;
458 auto &pOtherObject = *otherIter;
459 // These lines might lock weak pointers, depending on template
460 // arguments of the class
461 auto deref = &Dereferenceable(pObject);
462 auto otherDeref = &Dereferenceable(pOtherObject);
463 if (!*deref && !*otherDeref)
464 continue;
465 else if (!*deref && create) {
466 // creation on demand
467 auto factories = GetFactories();
468 auto &factory = factories.mObject[ii];
469 pObject = factory
470 ? factory(static_cast<Host&>(*this))
471 : DataPointer{};
472 deref = &Dereferenceable(pObject);
473 }
474 else if (!*otherDeref && create) {
475 // creation on demand
476 auto factories = GetFactories();
477 auto &factory = factories.mObject[ii];
478 pOtherObject = factory
479 ? factory(static_cast<Host&>(other))
480 : DataPointer{};
481 otherDeref = &Dereferenceable(pOtherObject);
482 }
483
484 function(
485 (*deref ? &**deref : nullptr),
486 (*otherDeref ? &**otherDeref : nullptr));
487 }
488 }

References ClientData::Dereferenceable(), ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::EnsureIndex(), factory, ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::GetData(), ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::GetFactories(), ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::GetIterator(), audacity::network_manager::common_headers::Host, and ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::size().

Referenced by WaveTrack::MergeChannelAttachments().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ForEach() [1/2]

template<typename Host , typename ClientData = Base, CopyingPolicy ObjectCopyingPolicy = SkipCopying, template< typename > class Pointer = UniquePtr, LockingPolicy ObjectLockingPolicy = NoLocking, LockingPolicy RegistryLockingPolicy = NoLocking>
template<typename Function >
void ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::ForEach ( const Function &  function)
inlineprotected

Invoke function on each ClientData object that has been created in this.

Template Parameters
Functiontakes reference to ClientData, return value is ignored
Parameters
functionof type Function

Definition at line 389 of file ClientData.h.

390 {
391 auto data = GetData();
392 for( auto &pObject : data.mObject ) {
393 const auto &ptr = Dereferenceable(pObject);
394 if ( ptr )
395 function( *ptr );
396 }
397 }

References ClientData::Dereferenceable(), and ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::GetData().

Referenced by WaveChannelView::DoSetDisplay(), WaveChannelView::DoSetMinimized(), WaveTrack::EraseChannelAttachments(), WaveChannelView::GetAllSubViews(), WaveChannelView::GetDisplays(), WaveChannelView::GetSubViews(), Track::HandleCommonXMLAttribute(), WaveChannelView::Reparent(), Track::ReparentAllAttachments(), WaveTrack::SwapChannels(), and Track::WriteCommonXMLAttributes().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ForEach() [2/2]

template<typename Host , typename ClientData = Base, CopyingPolicy ObjectCopyingPolicy = SkipCopying, template< typename > class Pointer = UniquePtr, LockingPolicy ObjectLockingPolicy = NoLocking, LockingPolicy RegistryLockingPolicy = NoLocking>
template<typename Function >
void ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::ForEach ( const Function &  function) const
inlineprotected

Invoke function on each ClientData object that has been created in this.

Template Parameters
Functiontakes reference to ClientData, return value is ignored
Parameters
functionof type Function

const overload only compiles with a function that takes reference to const ClientData.

Definition at line 402 of file ClientData.h.

403 {
404 auto data = GetData();
405 for( auto &pObject : data.mObject ) {
406 const auto &ptr = Dereferenceable(pObject);
407 if ( ptr ) {
408 const auto &c_ref = *ptr;
409 function( c_ref );
410 }
411 }
412 }

References ClientData::Dereferenceable(), and ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::GetData().

Here is the call graph for this function:

◆ Get() [1/2]

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

Get reference to an attachment, creating on demand if not present, down-cast it to Subclass.

Uses static_cast. Throws on failure to create it. (Lifetime of the object may depend on the host's lifetime and also on the client's use of Assign(). Site is not responsible for guarantees.)

Template Parameters
SubclassExpected actual type of attachment, assumed to be correct
Parameters
keyReference to static object created in client code

Definition at line 318 of file ClientData.h.

319 {
320 auto data = GetData();
321 return DoGet< Subclass >( data, key );
322 }

References ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::GetData(), and key.

Referenced by SetTrackStatusCommand::ApplyInner(), AdornedRulerPanel::Get(), ProjectWindow::Get(), RealtimeEffectPanel::Get(), TrackPanel::Get(), PitchAndSpeedDialog::Get(), RealtimeEffectStateUI::Get(), TrackPanel::GetFocusedCell(), LabelTrackView::IsValidIndex(), anonymous_namespace{Contrast.cpp}::anonymous_namespace{Contrast.cpp}::OnContrast(), anonymous_namespace{HistoryWindow.cpp}::OnHistory(), NavigationActions::Handler::OnLastTrack(), anonymous_namespace{MixerBoard.cpp}::OnMixerBoard(), anonymous_namespace{FreqWindow.cpp}::OnPlotSpectrum(), NavigationActions::Handler::OnToggle(), anonymous_namespace{TrackMenus.cpp}::OnTrackClose(), anonymous_namespace{TrackMenus.cpp}::OnTrackGain(), anonymous_namespace{TrackMenus.cpp}::OnTrackGainDec(), anonymous_namespace{TrackMenus.cpp}::OnTrackGainInc(), anonymous_namespace{TrackMenus.cpp}::OnTrackMoveBottom(), anonymous_namespace{TrackMenus.cpp}::OnTrackMoveDown(), anonymous_namespace{TrackMenus.cpp}::OnTrackMoveTop(), anonymous_namespace{TrackMenus.cpp}::OnTrackMoveUp(), anonymous_namespace{TrackMenus.cpp}::OnTrackMute(), anonymous_namespace{TrackMenus.cpp}::OnTrackPan(), anonymous_namespace{TrackMenus.cpp}::OnTrackPanLeft(), anonymous_namespace{TrackMenus.cpp}::OnTrackPanRight(), anonymous_namespace{TrackMenus.cpp}::OnTrackSolo(), anonymous_namespace{WaveTrackAffordanceControls.cpp}::SelectedIntervalOfFocusedTrack(), GetInfoCommand::SendTracks(), WhatsNewDialog::Show(), MuteButtonHandle::Tip(), SoloButtonHandle::Tip(), EffectsButtonHandle::Tip(), MenuButtonHandle::Tip(), and CloseButtonHandle::Tip().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Get() [2/2]

template<typename Host , typename ClientData = Base, CopyingPolicy ObjectCopyingPolicy = SkipCopying, template< typename > class Pointer = UniquePtr, LockingPolicy ObjectLockingPolicy = NoLocking, LockingPolicy RegistryLockingPolicy = NoLocking>
template<typename Subclass = const ClientData>
auto ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::Get ( const RegisteredFactory key) const -> std::enable_if_t< std::is_const< Subclass >::value, Subclass & >
inline

Get reference to an attachment, creating on demand if not present, down-cast it to Subclass.

Uses static_cast. Throws on failure to create it. (Lifetime of the object may depend on the host's lifetime and also on the client's use of Assign(). Site is not responsible for guarantees.)

Template Parameters
SubclassExpected actual type of attachment, assumed to be correct
Parameters
keyReference to static object created in client code

const overload returns const references only.

Definition at line 327 of file ClientData.h.

329 {
330 auto data = GetData();
331 return DoGet< Subclass >( data, key );
332 }

References ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::GetData(), and key.

Here is the call graph for this function:

◆ GetData() [1/2]

template<typename Host , typename ClientData = Base, CopyingPolicy ObjectCopyingPolicy = SkipCopying, template< typename > class Pointer = UniquePtr, LockingPolicy ObjectLockingPolicy = NoLocking, LockingPolicy RegistryLockingPolicy = NoLocking>
Locked< DataContainer > ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::GetData ( )
inlineprivate

◆ GetData() [2/2]

template<typename Host , typename ClientData = Base, CopyingPolicy ObjectCopyingPolicy = SkipCopying, template< typename > class Pointer = UniquePtr, LockingPolicy ObjectLockingPolicy = NoLocking, LockingPolicy RegistryLockingPolicy = NoLocking>
Locked< const DataContainer > ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::GetData ( ) const
inlineprivate

Definition at line 624 of file ClientData.h.

625 {
626 return Locked< const DataContainer >{ mData };
627 }

References ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::mData.

◆ GetFactories()

template<typename Host , typename ClientData = Base, CopyingPolicy ObjectCopyingPolicy = SkipCopying, template< typename > class Pointer = UniquePtr, LockingPolicy ObjectLockingPolicy = NoLocking, LockingPolicy RegistryLockingPolicy = NoLocking>
static Locked< DataFactories > ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::GetFactories ( )
inlinestaticprivate

Definition at line 608 of file ClientData.h.

609 {
610 // C++11 does not need extra thread synch for static initialization
611 // Note that linker eliminates duplicates of this function
612 static DataFactories factories;
613
614 // But give back a scoped lock to the user of this function, in case
615 // there is contention to resize the vector
616 return Locked< DataFactories >{ factories };
617 }
Lockable< std::vector< DataFactory >, RegistryLockingPolicy > DataFactories
Definition: ClientData.h:570

Referenced by ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::Build(), ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::BuildAll(), ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::ForCorresponding(), ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::numFactories(), ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::RegisteredFactory::RegisteredFactory(), ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::Site(), and ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::RegisteredFactory::~RegisteredFactory().

Here is the caller graph for this function:

◆ GetIterator()

template<typename Host , typename ClientData = Base, CopyingPolicy ObjectCopyingPolicy = SkipCopying, template< typename > class Pointer = UniquePtr, LockingPolicy ObjectLockingPolicy = NoLocking, LockingPolicy RegistryLockingPolicy = NoLocking>
static DataContainer::iterator ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::GetIterator ( Locked< DataContainer > &  data,
size_t  index 
)
inlinestaticprivate

Definition at line 636 of file ClientData.h.

637 {
638 // This function might help generalize Site with different kinds of
639 // containers for pointers to ClientData that are not random-access.
640 // Perhaps non-relocation of elements will be needed.
641 // Perhaps another template-template parameter could vary the kind of
642 // container.
643 auto result = data.mObject.begin();
644 std::advance( result, index );
645 return result;
646 }

References ClientData::Locked< Lockable >::mObject.

Referenced by ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::Assign(), ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::BuildAll(), and ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::ForCorresponding().

Here is the caller graph for this function:

◆ numFactories()

template<typename Host , typename ClientData = Base, CopyingPolicy ObjectCopyingPolicy = SkipCopying, template< typename > class Pointer = UniquePtr, LockingPolicy ObjectLockingPolicy = NoLocking, LockingPolicy RegistryLockingPolicy = NoLocking>
static size_t ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::numFactories ( )
inlinestatic

How many static factories have been registered with this specialization of Site.

Usually agrees with the size() of each site unless some registrations happened later than some Site's construction.

Definition at line 267 of file ClientData.h.

267{ return GetFactories().mObject.size(); }

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

Referenced by Append().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator=() [1/2]

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

◆ operator=() [2/2]

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

Definition at line 256 of file ClientData.h.

257 { mData = std::move(other.mData); return *this; }

References ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::mData.

◆ size()

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 >::size ( ) const
inline

Member Data Documentation

◆ mData

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

◆ Slot

template<typename Host , typename ClientData = Base, CopyingPolicy ObjectCopyingPolicy = SkipCopying, template< typename > class Pointer = UniquePtr, LockingPolicy ObjectLockingPolicy = NoLocking, LockingPolicy RegistryLockingPolicy = NoLocking>
decltype(Dereferenceable(std::declval< DataPointer & >())) ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::Slot(Locked< DataContainer > &data, const RegisteredFactory &key, bool create)
inlineprivate

Definition at line 578 of file ClientData.h.

579 {
580 auto index = key.mIndex;
581 EnsureIndex( data, index );
582 auto iter = GetIterator( data, index );
583 auto &pointer = create ? Build( data, iter, index ) : *iter;
584 return Dereferenceable( pointer );
585 }

Referenced by ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::DoFind(), and ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::DoGet().


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