ICF 3.1.1.10
Technical documentation of ICF Libraries
CInterfaceManipBase.h
Go to the documentation of this file.
1/********************************************************************************
2** This file is part of the ICF Framework. Copyright (C) Witold Gantzke & Kirill Lepskiy
3** ICF Framework may be used under the terms of the LGPL License v. 2.1 by the Free Software Foundation.
4********************************************************************************/
5
6#pragma once
7
8
9// Qt includes
10#include <QtCore/QByteArray>
11
12// ICF includes
13#include <istd/CIdManipBase.h>
14#include <istd/CClassInfo.h>
15
16#include <icomp/IComponent.h>
17
18
19namespace icomp
20{
21
22
24{
25protected:
29 template <class Interface>
30 static Interface* ExtractInterface(IComponent* componentPtr, const QByteArray& subId = "");
31};
32
33
34// protected template methods
35
36template <class Interface>
37Interface* CInterfaceManipBase::ExtractInterface(IComponent* componentPtr, const QByteArray& subId)
38{
40 Q_ASSERT(info.IsValid());
41
42 if (info.IsValid() && (componentPtr != nullptr)){
43 return static_cast<Interface*>(componentPtr->GetInterface(info, subId));
44 }
45 else{
46 return nullptr;
47 }
48}
49
50
51} // namespace icomp
52
53
static Interface * ExtractInterface(IComponent *componentPtr, const QByteArray &subId="")
Extract interface from component.
Main component interface.
Definition IComponent.h:35
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:27
static CClassInfo GetInfo()
Get class name defined as template parameter.
Definition CClassInfo.h:212
bool IsValid() const
Check if this class info object is valid.
Definition CClassInfo.h:144
Base implementation for operations on composed ID objects.
Package with interfaces and class used for components concept.

© Witold Gantzke and Kirill Lepskiy