00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef __CALLBACK_H
00025 #define __CALLBACK_H
00026
00027 #include <stlib/Object.h>
00028
00029 namespace Core {
00030
00039 template <typename ReturnT>
00040 class Callback : public Object
00041 {
00042 public:
00043
00044 virtual int argumentsNumber(void) abstract;
00045
00046
00047 virtual ReturnT execute(void)
00048 {
00049 shouldNotImplement(__PRETTY_FUNCTION__);
00050 return nil;
00051 }
00052
00053 virtual ReturnT executeWith(Object *)
00054 {
00055 return execute();
00056 }
00057 };
00058
00059 template <>
00060 class Callback <void> : public Object
00061 {
00062 public:
00063
00064 virtual int argumentsNumber(void) abstract;
00065
00066
00067 virtual void execute(void)
00068 {
00069 shouldNotImplement(__PRETTY_FUNCTION__);
00070 }
00071
00072 virtual void executeWith(Object *)
00073 {
00074 execute();
00075 }
00076 };
00077
00078 };
00079
00080 #endif