From: Nathan Binkert Date: Fri, 20 Feb 2004 20:24:21 +0000 (-0500) Subject: Add a simple event wrapper class that takes a class pointer X-Git-Tag: m5_1.0_beta2~140 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=a1259a4fcf5f1b1c38a7209928a2321cd65daec2;p=gem5.git 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 --- 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 */