Kyle Lemons
/
XBeeLib
handler.hpp@0:86ff0a55c978, 2010-11-30 (annotated)
- Committer:
- etherealflaim
- Date:
- Tue Nov 30 21:28:18 2010 +0000
- Revision:
- 0:86ff0a55c978
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
etherealflaim | 0:86ff0a55c978 | 1 | template <class Result> |
etherealflaim | 0:86ff0a55c978 | 2 | class handler |
etherealflaim | 0:86ff0a55c978 | 3 | { |
etherealflaim | 0:86ff0a55c978 | 4 | public: |
etherealflaim | 0:86ff0a55c978 | 5 | virtual inline Result operator() () const {}; |
etherealflaim | 0:86ff0a55c978 | 6 | }; |
etherealflaim | 0:86ff0a55c978 | 7 | |
etherealflaim | 0:86ff0a55c978 | 8 | template <class Result> |
etherealflaim | 0:86ff0a55c978 | 9 | class function_handler |
etherealflaim | 0:86ff0a55c978 | 10 | : public handler <Result> |
etherealflaim | 0:86ff0a55c978 | 11 | { |
etherealflaim | 0:86ff0a55c978 | 12 | protected: |
etherealflaim | 0:86ff0a55c978 | 13 | Result (*pfunc)(); |
etherealflaim | 0:86ff0a55c978 | 14 | public: |
etherealflaim | 0:86ff0a55c978 | 15 | explicit inline function_handler ( Result (*f)() ) : pfunc (f) {} |
etherealflaim | 0:86ff0a55c978 | 16 | virtual inline Result operator() () const { return pfunc(); } |
etherealflaim | 0:86ff0a55c978 | 17 | }; |
etherealflaim | 0:86ff0a55c978 | 18 | |
etherealflaim | 0:86ff0a55c978 | 19 | template <class Type, class Result> |
etherealflaim | 0:86ff0a55c978 | 20 | class member_handler |
etherealflaim | 0:86ff0a55c978 | 21 | : public handler <Result> |
etherealflaim | 0:86ff0a55c978 | 22 | { |
etherealflaim | 0:86ff0a55c978 | 23 | protected: |
etherealflaim | 0:86ff0a55c978 | 24 | Type *inst; |
etherealflaim | 0:86ff0a55c978 | 25 | Result (Type::*pfunc)(); |
etherealflaim | 0:86ff0a55c978 | 26 | public: |
etherealflaim | 0:86ff0a55c978 | 27 | explicit inline member_handler ( Type *i, Result (Type::*f)() ) : inst(i), pfunc (f) {} |
etherealflaim | 0:86ff0a55c978 | 28 | virtual inline Result operator() () const { return (inst->*pfunc)(); } |
etherealflaim | 0:86ff0a55c978 | 29 | }; |