ACF $AcfVersion:0$
TComposedFactoryComp.h
Go to the documentation of this file.
1// SPDX-License-Identifier: LGPL-2.1-or-later OR GPL-2.0-or-later OR GPL-3.0-or-later OR LicenseRef-ACF-Commercial
2#pragma once
3
4
5// ACF includes
8
9
10namespace ibase
11{
12
13// TODO: check if this class should be removed from ACF project
14template <class Interface>
16{
17public:
20
21 I_BEGIN_COMPONENT(TComposedFactoryComp);
22 I_REGISTER_INTERFACE(FactoryInterface);
23 I_ASSIGN_MULTI_0(m_slaveFactoriesCompPtr, "SlaveFactories", "Slave factories", true);
24 I_END_COMPONENT;
25
26protected:
27 // reimplemented (icomp::CComponentBase)
28 virtual void OnComponentCreated() override;
29
30private:
31 I_MULTIREF(FactoryInterface, m_slaveFactoriesCompPtr);
32};
33
34
35// protected methods
36
37// reimplemented (icomp::CComponentBase)
38
39template <class Interface>
41{
42 BaseClass::OnComponentCreated();
43
44 int slaveFactoriesCount = m_slaveFactoriesCompPtr.GetCount();
45
46 for (int factoryIndex = 0; factoryIndex < slaveFactoriesCount; ++factoryIndex){
47 Q_ASSERT(m_slaveFactoriesCompPtr.IsValid(factoryIndex)); // isObligatory was set to true
48
49 RegisterFactory(m_slaveFactoriesCompPtr[factoryIndex]);
50 }
51}
52
53
54} // namespace ibase
55
56
istd::TComposedFactory< Interface > BaseClass2
icomp::CComponentBase BaseClass
virtual void OnComponentCreated() override
Base class for component implementation.
Standard generic implementation of the composed factory.
TIFactory< Interface > FactoryInterface
This namespace contains basic implementations of standard primitives on the component level.