11 #ifndef _LIBALCOMMON_ALCOMMON_ALFUNCTOR_H_
12 #define _LIBALCOMMON_ALCOMMON_ALFUNCTOR_H_
16 # include <boost/shared_ptr.hpp>
17 # include <qi/anyobject.hpp>
48 _functor = qi::AnyFunction();
58 return _functor.parametersSignature(
true);
63 return _functor.returnSignature();
72 qiLogError(
"alcommon.ALFunctor") <<
"ALFunctor::call not implemented";
88 template<
typename C,
typename F>
92 qi::AnyFunction::from(fun, obj).dropFirstArgument()));
94 template <
typename C,
typename R>
96 return boost::shared_ptr<ALFunctorBase>(
new ALFunctorBase(qi::AnyFunction::from(f, obj).dropFirstArgument()));
99 template <
typename C,
typename P1,
typename R>
100 boost::shared_ptr<ALFunctorBase>
createFunctor(C *obj, R (C::*f) (
const P1 &)) {
101 return boost::shared_ptr<ALFunctorBase>(
new ALFunctorBase(qi::AnyFunction::from(f, obj).dropFirstArgument()));
104 template <
typename C,
typename P1,
typename P2,
typename R>
105 boost::shared_ptr<ALFunctorBase>
createFunctor(C *obj, R (C::*f) (
const P1 &,
const P2 &)) {
106 return boost::shared_ptr<ALFunctorBase>(
new ALFunctorBase(qi::AnyFunction::from(f, obj).dropFirstArgument()));
109 template <
typename C,
typename P1,
typename P2,
typename P3,
typename R>
110 boost::shared_ptr<ALFunctorBase>
createFunctor(C *obj, R (C::*f) (
const P1 &,
const P2 &,
const P3 &)) {
111 return boost::shared_ptr<ALFunctorBase>(
new ALFunctorBase(qi::AnyFunction::from(f, obj).dropFirstArgument()));
114 template <
typename C,
typename P1,
typename P2,
typename P3,
typename P4,
typename R>
115 boost::shared_ptr<ALFunctorBase>
createFunctor(C *obj, R (C::*f) (
const P1 &,
const P2 &,
const P3 &,
const P4 &)) {
116 return boost::shared_ptr<ALFunctorBase>(
new ALFunctorBase(qi::AnyFunction::from(f, obj).dropFirstArgument()));
119 template <
typename C,
typename P1,
typename P2,
typename P3,
typename P4,
typename P5,
typename R>
120 boost::shared_ptr<ALFunctorBase>
createFunctor(C *obj, R (C::*f) (
const P1 &,
const P2 &,
const P3 &,
const P4 &,
const P5 &)) {
121 return boost::shared_ptr<ALFunctorBase>(
new ALFunctorBase(qi::AnyFunction::from(f, obj).dropFirstArgument()));
124 template <
typename C,
typename P1,
typename P2,
typename P3,
typename P4,
typename P5,
typename P6,
typename R>
125 boost::shared_ptr<ALFunctorBase>
createFunctor(C *obj, R (C::*f) (
const P1 &,
const P2 &,
const P3 &,
const P4 &,
const P5 &,
const P6 &)) {
126 return boost::shared_ptr<ALFunctorBase>(
new ALFunctorBase(qi::AnyFunction::from(f, obj).dropFirstArgument()));
131 #endif // _LIBALCOMMON_ALCOMMON_ALFUNCTOR_H_
virtual void call(const ALValue &pParams, ALValue &pResult)
Generic call to a bound module's method.
boost::shared_ptr< ALFunctorBase > createFunctor(C *obj, F fun)
ALFunctorBase(qi::AnyFunction metaFun)
void ALVoid
Type def to void.
qi::Signature signature() const
qi::AnyFunction genericFunction()
ALFunctorBase is a generic functor class for pointer management.
qi::Signature sigreturn() const
virtual ~ALFunctorBase()
Destructor.