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