Add a simple event wrapper class that takes a class pointer

and member function and will schedule it for the future.

--HG--
extra : convert_revision : f5c5a8df0839e1e10716850c2086862c4a5bc499
This commit is contained in:
Nathan Binkert 2004-02-20 15:24:21 -05:00
parent ec06c63cc7
commit a1259a4fcf

View file

@ -236,6 +236,20 @@ DelayFunction(Tick when, T *object)
new DelayEvent(when, object);
}
template <class T, void (T::* F)()>
class EventWrapper : public Event
{
private:
T *object;
public:
EventWrapper(T *obj, EventQueue *q = &mainEventQueue,
Priority p = Default_Pri)
: Event(q, p), object(obj)
{}
void process() { (object->*F)(); }
};
/*
* Queue of events sorted in time order
*/