diff options
author | Nathan Binkert <binkertn@umich.edu> | 2004-02-20 15:24:21 -0500 |
---|---|---|
committer | Nathan Binkert <binkertn@umich.edu> | 2004-02-20 15:24:21 -0500 |
commit | a1259a4fcf5f1b1c38a7209928a2321cd65daec2 (patch) | |
tree | c8ea5f3f38eb17d60d8896a0753a7ff389c06aff /sim | |
parent | ec06c63cc7a63111e9d21936a302901c552ad36b (diff) | |
download | gem5-a1259a4fcf5f1b1c38a7209928a2321cd65daec2.tar.xz |
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
Diffstat (limited to 'sim')
-rw-r--r-- | sim/eventq.hh | 14 |
1 files changed, 14 insertions, 0 deletions
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 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 */ |