ACF $AcfVersion:0$
TInterfaceRegistrator.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
6#include <istd/CClassInfo.h>
7
9
10
11namespace icomp
12{
13
14
18template <class Interface>
20{
21public:
23
24protected:
25 static void* InterfaceExtractor(IComponent& component);
26};
27
28
29// public methods
30
31template <class Interface>
33{
34 istd::CClassInfo info = istd::CClassInfo::GetInfo<Interface>();
35
36 if (!info.IsVoid()){
38 }
39}
40
41
42template <>
46
47
48// protected methods
49
50template <class Interface>
52{
53 void* retVal = dynamic_cast<Interface*>(&component);
54
55 return retVal;
56}
57
58
59template <>
61{
62 return NULL;
63}
64
65
66} // namespace icomp
67
68
69
70
Standard implementation of static info for base component classes.
virtual void RegisterInterfaceExtractor(const QByteArray &interfaceName, InterfaceExtractorPtr extractorPtr)
Register interface ID for this static component info.
Main component interface.
Definition IComponent.h:32
Simple helper class providing registration of template-specified interface.
TInterfaceRegistrator(CBaseComponentStaticInfo &staticInfo)
static void * InterfaceExtractor(IComponent &component)
Represents platform independent type info and provide set of static class manipulation functions.
Definition CClassInfo.h:23
const QByteArray & GetName() const
Get undecorated and platform undependent class name.
Definition CClassInfo.h:154
bool IsVoid() const
Check if this class information represents void type.
Definition CClassInfo.h:160
#define NULL
Definition istd.h:74
Package with interfaces and class used for components concept.