LibCT 2.0

Include/TemplateFunctor.h

Go to the documentation of this file.
00001 // ------------------------------------------------------------------
00012 #ifndef _LIBCT_TEMPLATEFUNCTOR_H
00013 #define _LIBCT_TEMPLATEFUNCTOR_H
00014 
00015 #include "Functor.h"
00016 
00017 namespace LibCT
00018 {
00020         template<class T, class U> class TemplateFunctor : public Functor
00021         {
00022         public:
00024                 TemplateFunctor(
00025                         T* pObject,                             
00026                         void(T::*pFunction)(U*) 
00027                         )
00028                         : m_pObject(pObject)
00029                         , m_pFunction(pFunction)
00030                 {
00031                 }
00032                 
00034                 virtual void operator()(
00035                         void* pArg                              
00036                         )
00037                 {
00038                         (*m_pObject.*m_pFunction)((U*)pArg);
00039                 }
00040 
00041         private:
00042                 T*      m_pObject;                              
00043                 void (T::*m_pFunction)(U*);     
00044         };
00045 };
00046 
00047 #endif // _LIBCT_TEMPLATEFUNCTOR_H