Dependencies:   mbed

Dependents:   HvZ

Committer:
etherealflaim
Date:
Wed Dec 01 21:41:52 2010 +0000
Revision:
2:2a826741387f
Parent:
0:86ff0a55c978

        

Who changed what in which revision?

UserRevisionLine numberNew 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 };