ACF $AcfVersion:0$
Public Types | Public Member Functions | Protected Types | Protected Attributes | List of all members
istd::TComposedFactory< InterfaceType > Class Template Reference

Standard generic implementation of the composed factory. More...

#include <TComposedFactory.h>

Inheritance diagram for istd::TComposedFactory< InterfaceType >:
istd::TIFactory< InterfaceType > istd::IFactoryInfo istd::IPolymorphic

Public Types

typedef TIFactory< InterfaceTypeFactoryInterface
 
- Public Types inherited from istd::TIFactory< InterfaceType >
typedef InterfaceType InterfaceType
 
- Public Types inherited from istd::IFactoryInfo
typedef QSet< QByteArray > KeyList
 

Public Member Functions

template<class FactoryImpl >
bool RegisterFactory (const QByteArray &typeId)
 
virtual IFactoryInfo::KeyList GetFactoryKeys () const override
 Returns all possible keys for this factory.
 
virtual istd::TUniqueInterfacePtr< InterfaceTypeCreateInstance (const QByteArray &keyId="") const override
 Create an instance of the object, mapped to the keyId keyId.
 
- Public Member Functions inherited from istd::IPolymorphic
virtual ~IPolymorphic ()
 

Protected Types

typedef istd::TSmartPtr< FactoryInterfaceFactoryPtr
 
typedef QList< FactoryPtrFactoryList
 

Protected Attributes

FactoryList m_factoryList
 

Detailed Description

template<class InterfaceType>
class istd::TComposedFactory< InterfaceType >

Standard generic implementation of the composed factory.

Definition at line 21 of file TComposedFactory.h.

Member Typedef Documentation

◆ FactoryInterface

template<class InterfaceType >
typedef TIFactory<InterfaceType> istd::TComposedFactory< InterfaceType >::FactoryInterface

Definition at line 24 of file TComposedFactory.h.

◆ FactoryList

template<class InterfaceType >
typedef QList<FactoryPtr> istd::TComposedFactory< InterfaceType >::FactoryList
protected

Definition at line 48 of file TComposedFactory.h.

◆ FactoryPtr

template<class InterfaceType >
typedef istd::TSmartPtr<FactoryInterface> istd::TComposedFactory< InterfaceType >::FactoryPtr
protected

Definition at line 47 of file TComposedFactory.h.

Member Function Documentation

◆ CreateInstance()

template<class InterfaceType >
istd::TUniqueInterfacePtr< InterfaceType > istd::TComposedFactory< InterfaceType >::CreateInstance ( const QByteArray &  keyId = "") const
overridevirtual

Create an instance of the object, mapped to the keyId keyId.

Parameters
keyId
Returns
unique pointer to created object or empty pointer if it was not possible to create it or keyId does not exist.

Implements istd::TIFactory< InterfaceType >.

Definition at line 78 of file TComposedFactory.h.

References istd::TInterfacePtr< InterfaceType, PolymorphicPointerImpl >::IsValid().

◆ GetFactoryKeys()

template<class InterfaceType >
IFactoryInfo::KeyList istd::TComposedFactory< InterfaceType >::GetFactoryKeys ( ) const
overridevirtual

Returns all possible keys for this factory.

Retrieves the complete set of keys (identifiers) that this factory can use to create objects. Each key corresponds to a specific object type or variant that the factory knows how to instantiate.

Returns
A QSet containing all valid factory keys. The set may be empty if the factory cannot currently create any objects, but typically contains at least one key for factories that are properly configured.
Note
The returned set represents a snapshot of available keys at the time of the call. For dynamic factories, the available keys may change over time (e.g., through plugin loading).
Keys are typically case-sensitive QByteArray values. Clients should use exact string matching when working with factory keys.
// Example usage
IFactoryInfo* factory = GetFactory();
// Check if a specific type is available
if (keys.contains("mytype")) {
// Create object using "mytype" key
}
// List all available types
for (const QByteArray& key : keys) {
qDebug() << "Available type:" << key;
}
Base interface providing information about factory-producible objects.
virtual KeyList GetFactoryKeys() const =0
Returns all possible keys for this factory.
QSet< QByteArray > KeyList
See also
istd::IFactory::CreateInstance()

Implements istd::IFactoryInfo.

Definition at line 57 of file TComposedFactory.h.

◆ RegisterFactory()

template<class InterfaceType >
template<class FactoryImpl >
bool istd::TComposedFactory< InterfaceType >::RegisterFactory ( const QByteArray &  typeId)
inline

Member Data Documentation

◆ m_factoryList

template<class InterfaceType >
FactoryList istd::TComposedFactory< InterfaceType >::m_factoryList
protected

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