ACF $AcfVersion:0$
Public Types | Public Member Functions | List of all members
istd::TSingleFactory< Interface, Implementation > Class Template Reference

Template based object factory interface. More...

#include <TSingleFactory.h>

Inheritance diagram for istd::TSingleFactory< Interface, Implementation >:
istd::TIFactory< Interface > istd::IFactoryInfo istd::IPolymorphic

Public Types

typedef Implementation ImplementationType
 
typedef TIFactory< Interface > FactoryInterface
 
- Public Types inherited from istd::TIFactory< Interface >
typedef Interface InterfaceType
 
- Public Types inherited from istd::IFactoryInfo
typedef QSet< QByteArray > KeyList
 

Public Member Functions

 TSingleFactory (const QByteArray &keyId)
 
virtual IFactoryInfo::KeyList GetFactoryKeys () const override
 Returns all possible keys for this factory.
 
virtual istd::TUniqueInterfacePtr< Interface > CreateInstance (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 ()
 

Detailed Description

template<class Interface, class Implementation>
class istd::TSingleFactory< Interface, Implementation >

Template based object factory interface.

Definition at line 20 of file TSingleFactory.h.

Member Typedef Documentation

◆ FactoryInterface

template<class Interface , class Implementation >
typedef TIFactory<Interface> istd::TSingleFactory< Interface, Implementation >::FactoryInterface

Definition at line 24 of file TSingleFactory.h.

◆ ImplementationType

template<class Interface , class Implementation >
typedef Implementation istd::TSingleFactory< Interface, Implementation >::ImplementationType

Definition at line 23 of file TSingleFactory.h.

Constructor & Destructor Documentation

◆ TSingleFactory()

template<class Interface , class Implementation >
istd::TSingleFactory< Interface, Implementation >::TSingleFactory ( const QByteArray &  keyId)
explicit

Definition at line 42 of file TSingleFactory.h.

Member Function Documentation

◆ CreateInstance()

template<class Interface , class Implementation >
istd::TUniqueInterfacePtr< Interface > istd::TSingleFactory< Interface, Implementation >::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< Interface >.

Definition at line 63 of file TSingleFactory.h.

◆ GetFactoryKeys()

template<class Interface , class Implementation >
IFactoryInfo::KeyList istd::TSingleFactory< Interface, Implementation >::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 52 of file TSingleFactory.h.


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