diff options
author | chatty | 1995-02-08 14:43:51 +0000 |
---|---|---|
committer | chatty | 1995-02-08 14:43:51 +0000 |
commit | b896b2810287f6e0f7c09c837930e2da823e47aa (patch) | |
tree | eff6cbf83b39d4c5cb152340d7d6ba7faddfc1d3 /comm | |
parent | ca81e398b713d4afe46788d880073d2751c786ff (diff) | |
download | ivy-league-b896b2810287f6e0f7c09c837930e2da823e47aa.zip ivy-league-b896b2810287f6e0f7c09c837930e2da823e47aa.tar.gz ivy-league-b896b2810287f6e0f7c09c837930e2da823e47aa.tar.bz2 ivy-league-b896b2810287f6e0f7c09c837930e2da823e47aa.tar.xz |
Added UchTimeOutFor and SetHandler
Diffstat (limited to 'comm')
-rw-r--r-- | comm/TimeOut.h | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/comm/TimeOut.h b/comm/TimeOut.h index 8364713..070e8af 100644 --- a/comm/TimeOut.h +++ b/comm/TimeOut.h @@ -39,6 +39,32 @@ protected: public: UchTimeOut (UchBaseMultiplexer&, Millisecond, void (*) (Millisecond), int = -1); ~UchTimeOut (); +inline void SetHandler (void (*h) (Millisecond)) { Handler = h; } }; -#endif /* UchBaseOut_H_ */ +#define SpecializedTimeOut(R,S) \ +class R : public UchBaseTimeOut { \ +protected: \ + S& Object; \ + void (S::*Handler) (Millisecond); \ +public: \ + R (UchBaseMultiplexer& m, Millisecond t, S& s, void (S::*sc) (Millisecond), int nb = -1) : UchBaseTimeOut (m, t, nb), Object (s), Handler (sc) {} \ + ~R () {} \ + void Handle (Millisecond t) { (Object.*Handler) (t); } \ +inline void SetHandler (void (S::*h) (Millisecond)) { Handler = h; } \ +}; + +template <class T> class UchTimeOutFor : public UchBaseTimeOut { +protected: + T& Object; + void (T::*Handler) (Millisecond); + + void Handle (Millisecond ref) { (Object.*Handler) (ref); } + +public: + UchTimeOutFor (UchBaseMultiplexer& m, Millisecond t, T& o, void (T::*h) (Millisecond), int nb = -1) : UchBaseTimeOut (m, t, nb), Object (o), Handler (h) {} + ~UchTimeOutFor () {} +inline void SetHandler (void(T::*h)(Millisecond)) { Handler = h; } +}; + +#endif /* UchTimeOut_H_ */ |