//
// Event handler for a callback that takes no parameters
//
class EventHandlerBase
{
virtual void HandleEvent() = 0;
};
//
// T is the class that will receive callbacks
// U is the method signature or something
//
template <class T, class U >
class EventHandler
{
T _obj;
U _func;
public:
EventHandler( T * obj, U * func )
: _obj( obj ),
_func( func )
{
;
}
void Register( T * obj, U * func )
{
_obj = obj; // param checking?
_func = func;
}
void HandleEvent()
{
_func->obj();
}
};
This entry was posted
on Wednesday, September 3rd, 2008 at 1:52 pm and is filed under Misc.
You can follow any responses to this entry through the RSS 2.0 feed.
You can leave a response, or trackback from your own site.