X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Ffunction.h;h=a50b5c1d33252e5bae7159a82eae47f35c416af5;hb=refs%2Fheads%2Fmaster;hp=b76426ec2bf1df3735421f50ed81dd0f27a6bb18;hpb=84073af773c83826eca7525d35d7cd92a3658f75;p=libs%2Ftest.git diff --git a/source/function.h b/source/function.h index b76426e..a50b5c1 100644 --- a/source/function.h +++ b/source/function.h @@ -39,7 +39,7 @@ private: FuncPtr func; public: - TypedFunction(FuncPtr f, const std::string & d): + TypedFunction(FuncPtr f, const std::string &d): Function(d), func(f) { } @@ -50,6 +50,28 @@ public: } }; +template +class TypedFunction1: public Function +{ +private: + typedef void (T::*FuncPtr)(A); + + FuncPtr func; + A arg; + +public: + TypedFunction1(FuncPtr f, const A &a, const std::string &d): + Function(d), + func(f), + arg(a) + { } + + virtual void run(Test &t) const + { + (dynamic_cast(t).*func)(arg); + } +}; + } // namespace Test } // namespace Msp