7 #ifndef _QI_ANYFUNCTION_HPP_
8 #define _QI_ANYFUNCTION_HPP_
11 #include <boost/function.hpp>
16 class AutoAnyReference;
18 template <
typename T = AnyValue>
57 # pragma warning( push )
58 # pragma warning( disable: 4251 )
79 const std::vector<TypeInterface*>& argumentsType();
94 virtual void* call(
void* storage,
void** args,
unsigned int argc) = 0;
118 template <
typename T = AnyValue>
169 template <
typename R>
193 #define pushi(z, n, _) params.push_back(p ## n);
194 #define genCall(n, ATYPEDECL, ATYPES, ADECL, AUSE, comma) \
195 template <typename R> R call( \
196 QI_GEN_ARGSDECLSAMETYPE(n, qi::AutoAnyReference)) \
198 AnyValue ret(this->operator()(AUSE), false, true); \
199 return ret.to<R>(); \
201 AnyReference operator()( \
202 QI_GEN_ARGSDECLSAMETYPE(n, qi::AutoAnyReference)) \
204 std::vector<qi::AnyReference> params; \
206 BOOST_PP_REPEAT(n, pushi, _) \
207 return call(params); \
217 const AnyFunction& replaceFirstArgument(
void* value)
const;
219 const AnyFunction& prependArgument(
void* value)
const;
222 std::vector<TypeInterface*> argumentsType()
const;
225 Signature parametersSignature(
bool dropFirst=
false)
const;
230 operator bool()
const;
244 template<
typename F,
typename C>
276 void destroy(
bool notFirst =
false);
298 # pragma warning( pop )
301 #endif // _QITYPE_ANYFUNCTION_HPP_
boost::function< AnyReference(const AnyReferenceVector &)> DynamicFunction
void destroy()
Stop and flush the logging system.
std::map< std::string, T > values
std::vector< AnyValue > VectorType
dll import/export and compiler message
std::vector< T > VectorType
const std::size_t maxAnyFunctionArgsCountHint
VarArguments & operator()(const T &t)
#define genCall(n, ATYPEDECL, ATYPES, ADECL, AUSE, comma)
FunctionTypeInterface * dynamicFunctionTypeInterface()
A function with AnyArguments as its sole argument will behave as if AnyFunction::fromDynamicFunction ...
std::vector< AnyReference > AnyReferenceVector
void swap(::qi::AnyFunction &a,::qi::AnyFunction &b)
const VectorType & args() const
AnyArguments(const AnyValueVector &args)
TypeInterface * _resultType
Signature information for both callable types FunctionTypeInterface and MethodType.
const AnyValueVector & args() const
const VectorType & args() const
FunctionTypeInterface * makeFunctionTypeInterface()
std::vector< TypeInterface * > _argumentsType
std::vector< AnyValue > AnyValueVector
KeywordArguments & operator()(const std::string &name, const T &t)