From a1259a4fcf5f1b1c38a7209928a2321cd65daec2 Mon Sep 17 00:00:00 2001 From: Nathan Binkert Date: Fri, 20 Feb 2004 15:24:21 -0500 Subject: [PATCH] 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 --- sim/eventq.hh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/sim/eventq.hh b/sim/eventq.hh index 31bf9d652..60a61fa29 100644 --- a/sim/eventq.hh +++ b/sim/eventq.hh @@ -236,6 +236,20 @@ DelayFunction(Tick when, T *object) new DelayEvent(when, object); } +template +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 */ -- 2.30.2