00001 #ifndef AEDFUNCTOR1ARG_H
00002 #define AEDFUNCTOR1ARG_H
00003
00004 #include "aedFunctorBase.h"
00005
00006 template < class T = stub, class A = stub > class DLLEXPORT aedFunctor1Arg:public
00007 aedFunctorBase
00008 {
00009 public:
00010 aedFunctor1Arg(T * obj, void (T::*member) (void *, void *, A *), A * arg)
00011 {
00012 m_Object = obj;
00013 m_MemberFunctionPointer = member;
00014 m_Argument = arg;
00015 m_FunctionPointer = NULL;
00016 }
00017
00018 aedFunctor1Arg(void (*function) (void *, void *, A *), A * arg)
00019 {
00020 m_FunctionPointer = function;
00021 m_MemberFunctionPointer = NULL;
00022 m_Object = NULL;
00023 m_Argument = arg;
00024 }
00025
00026 virtual void operator() (void *caller, void *data)
00027 {
00028 this->Call(caller, data);
00029 }
00030
00031 void Call(void *caller, void *data)
00032 {
00033 if(m_Object)
00034 (*m_Object.*m_MemberFunctionPointer) (caller, data, m_Argument);
00035 else
00036 m_FunctionPointer(caller, data, m_Argument);
00037 }
00038
00039 aedFunctorBase *clone(void)
00040 {
00041 aedFunctor1Arg < T, A > *clone;
00042
00043 if(m_Object)
00044 clone =
00045 new aedFunctor1Arg < T, A > (m_Object, m_MemberFunctionPointer,
00046 m_Argument);
00047 else
00048 clone = new aedFunctor1Arg < T, A > (m_FunctionPointer, m_Argument);
00049
00050 return clone;
00051 }
00052
00053 virtual ~ aedFunctor1Arg()
00054 {
00055
00056 }
00057
00058 private:
00059 T * m_Object;
00060 A *m_Argument;
00061 void (T::*m_MemberFunctionPointer) (void *, void *, A *);
00062 void (*m_FunctionPointer) (void *, void *, A *);
00063
00064 };
00065
00066 #endif