00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef CMETHODEVENTJOB_H
00020 #define CMETHODEVENTJOB_H
00021
00022 #include "IEventJob.h"
00023
00025
00028 template <class T>
00029 class TMethodEventJob : public IEventJob {
00030 public:
00032 TMethodEventJob(T* object,
00033 void (T::*method)(const CEvent&, void*),
00034 void* arg = NULL);
00035 virtual ~TMethodEventJob();
00036
00037
00038 virtual void run(const CEvent&);
00039
00040 private:
00041 T* m_object;
00042 void (T::*m_method)(const CEvent&, void*);
00043 void* m_arg;
00044 };
00045
00046 template <class T>
00047 inline
00048 TMethodEventJob<T>::TMethodEventJob(T* object,
00049 void (T::*method)(const CEvent&, void*), void* arg) :
00050 m_object(object),
00051 m_method(method),
00052 m_arg(arg)
00053 {
00054
00055 }
00056
00057 template <class T>
00058 inline
00059 TMethodEventJob<T>::~TMethodEventJob()
00060 {
00061
00062 }
00063
00064 template <class T>
00065 inline
00066 void
00067 TMethodEventJob<T>::run(const CEvent& event)
00068 {
00069 if (m_object != NULL) {
00070 (m_object->*m_method)(event, m_arg);
00071 }
00072 }
00073
00074 #endif