Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
handler.hpp
- Committer:
- etherealflaim
- Date:
- 2010-12-01
- Revision:
- 2:2a826741387f
- Parent:
- 0:86ff0a55c978
File content as of revision 2:2a826741387f:
template <class Result>
class handler
{
public:
virtual inline Result operator() () const {};
};
template <class Result>
class function_handler
: public handler <Result>
{
protected:
Result (*pfunc)();
public:
explicit inline function_handler ( Result (*f)() ) : pfunc (f) {}
virtual inline Result operator() () const { return pfunc(); }
};
template <class Type, class Result>
class member_handler
: public handler <Result>
{
protected:
Type *inst;
Result (Type::*pfunc)();
public:
explicit inline member_handler ( Type *i, Result (Type::*f)() ) : inst(i), pfunc (f) {}
virtual inline Result operator() () const { return (inst->*pfunc)(); }
};