TInterfaceRegistrator.h
Go to the documentation of this file.
1 #ifndef icomp_TInterfaceRegistrator_included
2 #define icomp_TInterfaceRegistrator_included
3 
4 
5 // ACF includes
6 #include <istd/CClassInfo.h>
7 
9 
10 
11 namespace icomp
12 {
13 
14 
18 template <class Interface>
20 {
21 public:
22  explicit TInterfaceRegistrator(CBaseComponentStaticInfo& staticInfo);
23 
24 protected:
25  static void* InterfaceExtractor(IComponent& component);
26 };
27 
28 
29 // public methods
30 
31 template <class Interface>
33 {
34  istd::CClassInfo info = istd::CClassInfo::GetInfo<Interface>();
35 
36  if (!info.IsVoid()){
38  }
39 }
40 
41 
42 template <>
44 {
45 }
46 
47 
48 // protected methods
49 
50 template <class Interface>
52 {
53  void* retVal = dynamic_cast<Interface*>(&component);
54 
55  return retVal;
56 }
57 
58 
59 template <>
61 {
62  return NULL;
63 }
64 
65 
66 } // namespace icomp
67 
68 
69 #endif // !icomp_TInterfaceRegistrator_included
70 
71 
Simple helper class providing registration of template-specified interface.
Main component interface.
Definition: IComponent.h:31
static void * InterfaceExtractor(IComponent &component)
const QByteArray & GetName() const
Get undecorated and platform undependent class name.
Definition: CClassInfo.h:146
Standard implementation of static info for base component classes.
#define NULL
Definition: istd.h:64
bool IsVoid() const
Check if this class information represents void type.
Definition: CClassInfo.h:152
virtual void RegisterInterfaceExtractor(const QByteArray &interfaceName, InterfaceExtractorPtr extractorPtr)
Register interface ID for this static component info.
Represents platform independent type info and provide set of static class manipulation functions...
Definition: CClassInfo.h:22
TInterfaceRegistrator(CBaseComponentStaticInfo &staticInfo)

© 2007-2017 Witold Gantzke and Kirill Lepskiy