6#include <icomp/CComponentBase.h>
16template <
typename ObjectInterface>
18 public icomp::CComponentBase,
19 public istd::TIFactory<ObjectInterface>
22 typedef icomp::CComponentBase BaseClass;
23 typedef istd::TIFactory<ObjectInterface> FactoryInterface;
26 I_REGISTER_INTERFACE(FactoryInterface);
27 I_ASSIGN(m_factCompPtr,
"Factory",
"Factory used for creation of the object instance",
true,
"Factory");
28 I_ASSIGN(m_typeIdAttrPtr,
"TypeId",
"Type-ID of the instance to be created",
true,
"TypeId");
32 virtual istd::TUniqueInterfacePtr<ObjectInterface> CreateInstance(
const QByteArray& keyId =
"")
const override;
35 virtual istd::IFactoryInfo::KeyList GetFactoryKeys()
const override;
38 I_TFACT(ObjectInterface, m_factCompPtr);
39 I_ATTR(QByteArray, m_typeIdAttrPtr);
45template<
typename ObjectInterface>
48 auto componentPtr = m_factCompPtr.CreateInstance();
49 istd::TUniqueInterfacePtr<ObjectInterface> retVal;
50 retVal.MoveCastedPtr(std::move(componentPtr));
55template<
typename ObjectInterface>
56istd::IFactoryInfo::KeyList TComponentFactoryComp<ObjectInterface>::GetFactoryKeys()
const
58 istd::IFactoryInfo::KeyList keys;
60 keys.insert(*m_typeIdAttrPtr);