CInterfaceManipBase.h
Go to the documentation of this file.
1 #ifndef icomp_CInterfaceManipBase_included
2 #define icomp_CInterfaceManipBase_included
3 
4 
5 // Qt includes
6 #include <QtCore/QByteArray>
7 
8 // ACF includes
9 #include <istd/CIdManipBase.h>
10 #include <istd/CClassInfo.h>
11 
12 #include <icomp/IComponent.h>
13 
14 
15 namespace icomp
16 {
17 
18 
20 {
21 protected:
25  template <class Interface>
26  static Interface* ExtractInterface(IComponent* componentPtr, const QByteArray& subId = "");
27 };
28 
29 
30 // protected template methods
31 
32 template <class Interface>
33 Interface* CInterfaceManipBase::ExtractInterface(IComponent* componentPtr, const QByteArray& subId)
34 {
35  if (componentPtr != NULL){
36  static istd::CClassInfo info = istd::CClassInfo::GetInfo<Interface>();
37 
38  return static_cast<Interface*>(componentPtr->GetInterface(info, subId));
39  }
40  else{
41  return NULL;
42  }
43 }
44 
45 
46 } // namespace icomp
47 
48 
49 #endif // !icomp_CInterfaceManipBase_included
50 
51 
Main component interface.
Definition: IComponent.h:31
static Interface * ExtractInterface(IComponent *componentPtr, const QByteArray &subId="")
Extract interface from component.
virtual void * GetInterface(const istd::CClassInfo &interfaceType, const QByteArray &subId="")=0
Get access to specified component interface.
#define NULL
Definition: istd.h:64
Base implementation for operations on composed ID objects.
Definition: CIdManipBase.h:19
Represents platform independent type info and provide set of static class manipulation functions...
Definition: CClassInfo.h:22

© 2007-2017 Witold Gantzke and Kirill Lepskiy