FuncPtr func;
public:
- TypedFunction(FuncPtr f, const std::string & d):
+ TypedFunction(FuncPtr f, const std::string &d):
Function(d),
func(f)
{ }
}
};
+template<typename T, typename A>
+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 &>(t).*func)(arg);
+ }
+};
+
} // namespace Test
} // namespace Msp
return *functions.back();
}
+ template<typename T, typename A>
+ Function &add(void (T::*f)(A), const A &a, const std::string &d)
+ {
+ functions.push_back(new TypedFunction1<T, A>(f, a, d));
+ return *functions.back();
+ }
+
public:
static void run_single(const std::string &, bool);
static void run_all(bool);