ACF $AcfVersion:0$
CInterfaceManipBase.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// Qt includes
6#include <QtCore/QByteArray>
7
8// ACF includes
9#include <istd/CIdManipBase.h>
10#include <istd/CClassInfo.h>
11#include <icomp/IComponent.h>
12
13
14namespace icomp
15{
16
17
19{
20protected:
24 template <class Interface>
25 static Interface* ExtractInterface(IComponent* componentPtr, const QByteArray& subId = "");
26};
27
28
29// protected template methods
30
31template <class Interface>
32Interface* CInterfaceManipBase::ExtractInterface(IComponent* componentPtr, const QByteArray& subId)
33{
34 if (componentPtr != NULL){
35 istd::CClassInfo info = istd::CClassInfo::GetInfo<Interface>();
36
37 return static_cast<Interface*>(componentPtr->GetInterface(info, subId));
38 }
39 else{
40 return NULL;
41 }
42}
43
44
45} // namespace icomp
46
47
static Interface * ExtractInterface(IComponent *componentPtr, const QByteArray &subId="")
Extract interface from component.
Main component interface.
Definition IComponent.h:32
virtual void * GetInterface(const istd::CClassInfo &interfaceType, const QByteArray &subId="")=0
Get access to specified component interface.
Represents platform independent type info and provide set of static class manipulation functions.
Definition CClassInfo.h:23
Base implementation for operations on composed ID objects.
#define NULL
Definition istd.h:74
Package with interfaces and class used for components concept.