--- gvpe/src/iom.h 2003/03/28 05:40:54 1.7 +++ gvpe/src/iom.h 2003/04/02 03:06:22 1.8 @@ -23,13 +23,13 @@ #include +#include "callback.h" #include "slog.h" typedef double tstamp; extern tstamp NOW; -template class callback; struct io_watcher; struct time_watcher; @@ -57,49 +57,6 @@ extern io_manager iom; -template -class callback { - struct object { }; - - void *obj; - R (object::*meth)(A arg); - - // a proxy is a kind of recipe on how to call a specific class method - struct proxy_base { - virtual R call (void *obj, R (object::*meth)(A), A arg) = 0; - }; - template - struct proxy : proxy_base { - virtual R call (void *obj, R (object::*meth)(A), A arg) - { - ((reinterpret_cast(obj)) ->* (reinterpret_cast(meth))) - (arg); - } - }; - - proxy_base *prxy; - -public: - template - callback (O1 *object, R (O2::*method)(A)) - { - static proxy p; - obj = reinterpret_cast(object); - meth = reinterpret_cast(method); - prxy = &p; - } - - R call(A arg) const - { - return prxy->call (obj, meth, arg); - } - - R operator ()(A arg) const - { - return call (arg); - } -}; - struct io_watcher : callback { template io_watcher (O1 *object, void (O2::*method)(short revents))