ACF $AcfVersion:0$
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
icomp::TFactoryMember< Interface > Class Template Reference

Factory of components used as component member. More...

#include <TFactoryMember.h>

Inheritance diagram for icomp::TFactoryMember< Interface >:
icomp::TAttributeMember< CFactoryAttribute > icomp::CInterfaceManipBase istd::TInterfaceFactory< Interface > istd::CIdManipBase istd::IFactoryInfo istd::IPolymorphic

Public Types

typedef TAttributeMember< CFactoryAttributeBaseClass
 
typedef CInterfaceManipBase BaseClass2
 
typedef Interface InterfaceType
 
typedef istd::IFactoryInfo::KeyList KeyList
 
- Public Types inherited from icomp::TAttributeMember< CFactoryAttribute >
typedef CFactoryAttribute AttributeType
 
typedef Attribute::ValueType AttributeValueType
 
typedef void InterfaceType
 
- Public Types inherited from istd::IFactoryInfo
typedef QSet< QByteArray > KeyList
 

Public Member Functions

 TFactoryMember ()
 
void Init (const IComponent *ownerPtr, const IRealAttributeStaticInfo &staticInfo)
 
bool IsValid () const
 Check if this factory can be resolved.
 
IComponentUniquePtr CreateComponent () const
 Create component without extracting any interface.
 
virtual istd::TUniqueInterfacePtr< Interface > CreateInstance (const QByteArray &typeId=QByteArray()) const override
 
virtual KeyList GetFactoryKeys () const override
 Returns all possible keys for this factory.
 
- Public Member Functions inherited from icomp::TAttributeMember< CFactoryAttribute >
 TAttributeMember ()
 
void Init (const IComponent *ownerPtr, const IRealAttributeStaticInfo &staticInfo)
 Initialize this attribute.
 
bool IsValid () const
 Check if this attribute is valid.
 
const CFactoryAttributeGetAttributePtr () const
 Access to internal attribute pointer.
 
const AttributeValueTypeGetOriginalValue () const
 Get value of attribute.
 
const CFactoryAttributeoperator-> () const
 Access to internal attribute pointer.
 
const AttributeValueTypeoperator* () const
 Get value of attribute.
 
- Public Member Functions inherited from istd::IPolymorphic
virtual ~IPolymorphic ()
 

Static Public Member Functions

static Interface * ExtractInterface (istd::IPolymorphic *instancePtr, const QByteArray &subId="")
 Extract interface from some component.
 
- Static Public Member Functions inherited from istd::CIdManipBase
static bool SplitId (const QByteArray &complexId, QByteArray &baseId, QByteArray &subId)
 Split component ID into separated ID's.
 
static QByteArray JoinId (const QByteArray &baseId, const QByteArray &subId)
 Join base component ID and sub ID into composed component ID.
 

Protected Member Functions

 TFactoryMember (const TFactoryMember &ptr)
 
- Protected Member Functions inherited from icomp::TAttributeMember< CFactoryAttribute >
void SetAttribute (const CFactoryAttribute *attributePtr)
 
bool InitInternal (const IComponent *ownerPtr, const IRealAttributeStaticInfo &staticInfo, const IComponent **definitionComponentPtr)
 Internal initialize of attribute.
 

Additional Inherited Members

- Static Protected Member Functions inherited from icomp::CInterfaceManipBase
template<class Interface >
static Interface * ExtractInterface (IComponent *componentPtr, const QByteArray &subId="")
 Extract interface from component.
 

Detailed Description

template<class Interface>
class icomp::TFactoryMember< Interface >

Factory of components used as component member.

Don't use direct this class, use macros I_FACT and I_ASSIGN instead.

Definition at line 23 of file TFactoryMember.h.

Member Typedef Documentation

◆ BaseClass

template<class Interface >
typedef TAttributeMember<CFactoryAttribute> icomp::TFactoryMember< Interface >::BaseClass

Definition at line 29 of file TFactoryMember.h.

◆ BaseClass2

template<class Interface >
typedef CInterfaceManipBase icomp::TFactoryMember< Interface >::BaseClass2

Definition at line 30 of file TFactoryMember.h.

◆ InterfaceType

template<class Interface >
typedef Interface icomp::TFactoryMember< Interface >::InterfaceType

Definition at line 31 of file TFactoryMember.h.

◆ KeyList

template<class Interface >
typedef istd::IFactoryInfo::KeyList icomp::TFactoryMember< Interface >::KeyList

Definition at line 32 of file TFactoryMember.h.

Constructor & Destructor Documentation

◆ TFactoryMember() [1/2]

template<class Interface >
icomp::TFactoryMember< Interface >::TFactoryMember ( )

Definition at line 79 of file TFactoryMember.h.

◆ TFactoryMember() [2/2]

template<class Interface >
icomp::TFactoryMember< Interface >::TFactoryMember ( const TFactoryMember< Interface > &  ptr)
protected

Definition at line 174 of file TFactoryMember.h.

Member Function Documentation

◆ CreateComponent()

template<class Interface >
IComponentUniquePtr icomp::TFactoryMember< Interface >::CreateComponent ( ) const

Create component without extracting any interface.

Definition at line 101 of file TFactoryMember.h.

References icomp::ICompositeComponent::CreateSubcomponent(), and NULL.

◆ CreateInstance()

template<class Interface >
istd::TUniqueInterfacePtr< Interface > icomp::TFactoryMember< Interface >::CreateInstance ( const QByteArray &  typeId = QByteArray()) const
overridevirtual

Implements istd::TInterfaceFactory< Interface >.

Definition at line 125 of file TFactoryMember.h.

References NULL.

◆ ExtractInterface()

template<class Interface >
Interface * icomp::TFactoryMember< Interface >::ExtractInterface ( istd::IPolymorphic instancePtr,
const QByteArray &  subId = "" 
)
static

Extract interface from some component.

Type of extracted interface is specified by template parameter of this class. If you want to force some factory to support more interfaces, you should simply define multiply I_FACT members with the same ID, factorise instances with any of them and extract specified interfaces using this method.

Parameters
instancePtrpointer to component object, typically returned by method CreateComponent(). If it is NULL, this function return also NULL value.
subIdoptionally ID parameter identifing subcomponent.
Returns
pointer to interface or NULL, if such interface could not be extracted.

Definition at line 156 of file TFactoryMember.h.

References NULL.

◆ GetFactoryKeys()

template<class Interface >
istd::IFactoryInfo::KeyList icomp::TFactoryMember< Interface >::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();
IFactoryInfo::KeyList keys = factory->GetFactoryKeys();
// 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;
}
See also
istd::IFactory::CreateInstance()

Implements istd::IFactoryInfo.

Definition at line 142 of file TFactoryMember.h.

◆ Init()

template<class Interface >
void icomp::TFactoryMember< Interface >::Init ( const IComponent ownerPtr,
const IRealAttributeStaticInfo staticInfo 
)

Definition at line 86 of file TFactoryMember.h.

◆ IsValid()

template<class Interface >
bool icomp::TFactoryMember< Interface >::IsValid ( ) const

Check if this factory can be resolved.

Please note, that it gives no guarantee, that objects can be factorised.

Definition at line 93 of file TFactoryMember.h.

References NULL.


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