/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2005 Robert Osfield * * This library is open source and may be redistributed and/or modified under * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ //osgIntrospection - Copyright (C) 2005 Marco Jez #ifndef OSGINTROSPECTION_STATICMETHODINFO_ #define OSGINTROSPECTION_STATICMETHODINFO_ #include #include #include namespace osgIntrospection { /// Class templates StaticMethodInfoN (where 0 <= N <= 16) are concrete /// implementations of MethodInfo. They are used to keep information /// about static class methods and to provide the means for calling them /// dynamically. Each class template can handle methods with N arguments /// and is parametrized by the class that declares the method and by the /// return type. Both const and non-const methods are supported. /// The invoke() methods allow to call the reflected method dynamically, /// passing it the arguments as a list of Value objects. /// template class StaticMethodInfo0: public MethodInfo { public: typedef R (*FunctionType)(); StaticMethodInfo0(const std::string& qname, FunctionType f, const ParameterInfoList& plist) : MethodInfo(qname, typeof(C), typeof(R), plist), f_(f) { } bool isConst() const { return false; } bool isStatic() const { return true; } Value invoke(ValueList& /*args*/) const { if (f_) return (*f_)(); throw InvalidFunctionPointerException(); } private: FunctionType f_; }; template class StaticMethodInfo1: public MethodInfo { public: typedef R (*FunctionType)(P0); StaticMethodInfo1(const std::string& qname, FunctionType f, const ParameterInfoList& plist) : MethodInfo(qname, typeof(C), typeof(R), plist), f_(f) { } bool isConst() const { return false; } bool isStatic() const { return true; } Value invoke(ValueList& args) const { ValueList newargs(1); convertArgument(args, newargs, getParameters(), 0); if (f_) return (*f_)(variant_cast(newargs[0])); throw InvalidFunctionPointerException(); } private: FunctionType f_; }; template class StaticMethodInfo2: public MethodInfo { public: typedef R (*FunctionType)(P0, P1); StaticMethodInfo2(const std::string& qname, FunctionType f, const ParameterInfoList& plist) : MethodInfo(qname, typeof(C), typeof(R), plist), f_(f) { } bool isConst() const { return false; } bool isStatic() const { return true; } Value invoke(ValueList& args) const { ValueList newargs(2); convertArgument(args, newargs, getParameters(), 0); convertArgument(args, newargs, getParameters(), 1); if (f_) return (*f_)(variant_cast(newargs[0]), variant_cast(newargs[1])); throw InvalidFunctionPointerException(); } private: FunctionType f_; }; template class StaticMethodInfo3: public MethodInfo { public: typedef R (*FunctionType)(P0, P1, P2); StaticMethodInfo3(const std::string& qname, FunctionType f, const ParameterInfoList& plist) : MethodInfo(qname, typeof(C), typeof(R), plist), f_(f) { } bool isConst() const { return false; } bool isStatic() const { return true; } Value invoke(ValueList& args) const { ValueList newargs(3); convertArgument(args, newargs, getParameters(), 0); convertArgument(args, newargs, getParameters(), 1); convertArgument(args, newargs, getParameters(), 2); if (f_) return (*f_)(variant_cast(newargs[0]), variant_cast(newargs[1]), variant_cast(newargs[2])); throw InvalidFunctionPointerException(); } private: FunctionType f_; }; template class StaticMethodInfo4: public MethodInfo { public: typedef R (*FunctionType)(P0, P1, P2, P3); StaticMethodInfo4(const std::string& qname, FunctionType f, const ParameterInfoList& plist) : MethodInfo(qname, typeof(C), typeof(R), plist), f_(f) { } bool isConst() const { return false; } bool isStatic() const { return true; } Value invoke(ValueList& args) const { ValueList newargs(4); convertArgument(args, newargs, getParameters(), 0); convertArgument(args, newargs, getParameters(), 1); convertArgument(args, newargs, getParameters(), 2); convertArgument(args, newargs, getParameters(), 3); if (f_) return (*f_)(variant_cast(newargs[0]), variant_cast(newargs[1]), variant_cast(newargs[2]), variant_cast(newargs[3])); throw InvalidFunctionPointerException(); } private: FunctionType f_; }; template class StaticMethodInfo5: public MethodInfo { public: typedef R (*FunctionType)(P0, P1, P2, P3, P4); StaticMethodInfo5(const std::string& qname, FunctionType f, const ParameterInfoList& plist) : MethodInfo(qname, typeof(C), typeof(R), plist), f_(f) { } bool isConst() const { return false; } bool isStatic() const { return true; } Value invoke(ValueList& args) const { ValueList newargs(5); convertArgument(args, newargs, getParameters(), 0); convertArgument(args, newargs, getParameters(), 1); convertArgument(args, newargs, getParameters(), 2); convertArgument(args, newargs, getParameters(), 3); convertArgument(args, newargs, getParameters(), 4); if (f_) return (*f_)(variant_cast(newargs[0]), variant_cast(newargs[1]), variant_cast(newargs[2]), variant_cast(newargs[3]), variant_cast(newargs[4])); throw InvalidFunctionPointerException(); } private: FunctionType f_; }; template class StaticMethodInfo6: public MethodInfo { public: typedef R (*FunctionType)(P0, P1, P2, P3, P4, P5); StaticMethodInfo6(const std::string& qname, FunctionType f, const ParameterInfoList& plist) : MethodInfo(qname, typeof(C), typeof(R), plist), f_(f) { } bool isConst() const { return false; } bool isStatic() const { return true; } Value invoke(ValueList& args) const { ValueList newargs(6); convertArgument(args, newargs, getParameters(), 0); convertArgument(args, newargs, getParameters(), 1); convertArgument(args, newargs, getParameters(), 2); convertArgument(args, newargs, getParameters(), 3); convertArgument(args, newargs, getParameters(), 4); convertArgument(args, newargs, getParameters(), 5); if (f_) return (*f_)(variant_cast(newargs[0]), variant_cast(newargs[1]), variant_cast(newargs[2]), variant_cast(newargs[3]), variant_cast(newargs[4]), variant_cast(newargs[5])); throw InvalidFunctionPointerException(); } private: FunctionType f_; }; template class StaticMethodInfo7: public MethodInfo { public: typedef R (*FunctionType)(P0, P1, P2, P3, P4, P5, P6); StaticMethodInfo7(const std::string& qname, FunctionType f, const ParameterInfoList& plist) : MethodInfo(qname, typeof(C), typeof(R), plist), f_(f) { } bool isConst() const { return false; } bool isStatic() const { return true; } Value invoke(ValueList& args) const { ValueList newargs(7); convertArgument(args, newargs, getParameters(), 0); convertArgument(args, newargs, getParameters(), 1); convertArgument(args, newargs, getParameters(), 2); convertArgument(args, newargs, getParameters(), 3); convertArgument(args, newargs, getParameters(), 4); convertArgument(args, newargs, getParameters(), 5); convertArgument(args, newargs, getParameters(), 6); if (f_) return (*f_)(variant_cast(newargs[0]), variant_cast(newargs[1]), variant_cast(newargs[2]), variant_cast(newargs[3]), variant_cast(newargs[4]), variant_cast(newargs[5]), variant_cast(newargs[6])); throw InvalidFunctionPointerException(); } private: FunctionType f_; }; template class StaticMethodInfo8: public MethodInfo { public: typedef R (*FunctionType)(P0, P1, P2, P3, P4, P5, P6, P7); StaticMethodInfo8(const std::string& qname, FunctionType f, const ParameterInfoList& plist) : MethodInfo(qname, typeof(C), typeof(R), plist), f_(f) { } bool isConst() const { return false; } bool isStatic() const { return true; } Value invoke(ValueList& args) const { ValueList newargs(8); convertArgument(args, newargs, getParameters(), 0); convertArgument(args, newargs, getParameters(), 1); convertArgument(args, newargs, getParameters(), 2); convertArgument(args, newargs, getParameters(), 3); convertArgument(args, newargs, getParameters(), 4); convertArgument(args, newargs, getParameters(), 5); convertArgument(args, newargs, getParameters(), 6); convertArgument(args, newargs, getParameters(), 7); if (f_) return (*f_)(variant_cast(newargs[0]), variant_cast(newargs[1]), variant_cast(newargs[2]), variant_cast(newargs[3]), variant_cast(newargs[4]), variant_cast(newargs[5]), variant_cast(newargs[6]), variant_cast(newargs[7])); throw InvalidFunctionPointerException(); } private: FunctionType f_; }; template class StaticMethodInfo9: public MethodInfo { public: typedef R (*FunctionType)(P0, P1, P2, P3, P4, P5, P6, P7, P8); StaticMethodInfo9(const std::string& qname, FunctionType f, const ParameterInfoList& plist) : MethodInfo(qname, typeof(C), typeof(R), plist), f_(f) { } bool isConst() const { return false; } bool isStatic() const { return true; } Value invoke(ValueList& args) const { ValueList newargs(9); convertArgument(args, newargs, getParameters(), 0); convertArgument(args, newargs, getParameters(), 1); convertArgument(args, newargs, getParameters(), 2); convertArgument(args, newargs, getParameters(), 3); convertArgument(args, newargs, getParameters(), 4); convertArgument(args, newargs, getParameters(), 5); convertArgument(args, newargs, getParameters(), 6); convertArgument(args, newargs, getParameters(), 7); convertArgument(args, newargs, getParameters(), 8); if (f_) return (*f_)(variant_cast(newargs[0]), variant_cast(newargs[1]), variant_cast(newargs[2]), variant_cast(newargs[3]), variant_cast(newargs[4]), variant_cast(newargs[5]), variant_cast(newargs[6]), variant_cast(newargs[7]), variant_cast(newargs[8])); throw InvalidFunctionPointerException(); } private: FunctionType f_; }; template class StaticMethodInfo10: public MethodInfo { public: typedef R (*FunctionType)(P0, P1, P2, P3, P4, P5, P6, P7, P8, P9); StaticMethodInfo10(const std::string& qname, FunctionType f, const ParameterInfoList& plist) : MethodInfo(qname, typeof(C), typeof(R), plist), f_(f) { } bool isConst() const { return false; } bool isStatic() const { return true; } Value invoke(ValueList& args) const { ValueList newargs(10); convertArgument(args, newargs, getParameters(), 0); convertArgument(args, newargs, getParameters(), 1); convertArgument(args, newargs, getParameters(), 2); convertArgument(args, newargs, getParameters(), 3); convertArgument(args, newargs, getParameters(), 4); convertArgument(args, newargs, getParameters(), 5); convertArgument(args, newargs, getParameters(), 6); convertArgument(args, newargs, getParameters(), 7); convertArgument(args, newargs, getParameters(), 8); convertArgument(args, newargs, getParameters(), 9); if (f_) return (*f_)(variant_cast(newargs[0]), variant_cast(newargs[1]), variant_cast(newargs[2]), variant_cast(newargs[3]), variant_cast(newargs[4]), variant_cast(newargs[5]), variant_cast(newargs[6]), variant_cast(newargs[7]), variant_cast(newargs[8]), variant_cast(newargs[9])); throw InvalidFunctionPointerException(); } private: FunctionType f_; }; template class StaticMethodInfo11: public MethodInfo { public: typedef R (*FunctionType)(P0, P1, P2, P3, P4, P5, P6, P7, P8, P9, P10); StaticMethodInfo11(const std::string& qname, FunctionType f, const ParameterInfoList& plist) : MethodInfo(qname, typeof(C), typeof(R), plist), f_(f) { } bool isConst() const { return false; } bool isStatic() const { return true; } Value invoke(ValueList& args) const { ValueList newargs(11); convertArgument(args, newargs, getParameters(), 0); convertArgument(args, newargs, getParameters(), 1); convertArgument(args, newargs, getParameters(), 2); convertArgument(args, newargs, getParameters(), 3); convertArgument(args, newargs, getParameters(), 4); convertArgument(args, newargs, getParameters(), 5); convertArgument(args, newargs, getParameters(), 6); convertArgument(args, newargs, getParameters(), 7); convertArgument(args, newargs, getParameters(), 8); convertArgument(args, newargs, getParameters(), 9); convertArgument(args, newargs, getParameters(), 10); if (f_) return (*f_)(variant_cast(newargs[0]), variant_cast(newargs[1]), variant_cast(newargs[2]), variant_cast(newargs[3]), variant_cast(newargs[4]), variant_cast(newargs[5]), variant_cast(newargs[6]), variant_cast(newargs[7]), variant_cast(newargs[8]), variant_cast(newargs[9]), variant_cast(newargs[10])); throw InvalidFunctionPointerException(); } private: FunctionType f_; }; template class StaticMethodInfo12: public MethodInfo { public: typedef R (*FunctionType)(P0, P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11); StaticMethodInfo12(const std::string& qname, FunctionType f, const ParameterInfoList& plist) : MethodInfo(qname, typeof(C), typeof(R), plist), f_(f) { } bool isConst() const { return false; } bool isStatic() const { return true; } Value invoke(ValueList& args) const { ValueList newargs(12); convertArgument(args, newargs, getParameters(), 0); convertArgument(args, newargs, getParameters(), 1); convertArgument(args, newargs, getParameters(), 2); convertArgument(args, newargs, getParameters(), 3); convertArgument(args, newargs, getParameters(), 4); convertArgument(args, newargs, getParameters(), 5); convertArgument(args, newargs, getParameters(), 6); convertArgument(args, newargs, getParameters(), 7); convertArgument(args, newargs, getParameters(), 8); convertArgument(args, newargs, getParameters(), 9); convertArgument(args, newargs, getParameters(), 10); convertArgument(args, newargs, getParameters(), 11); if (f_) return (*f_)(variant_cast(newargs[0]), variant_cast(newargs[1]), variant_cast(newargs[2]), variant_cast(newargs[3]), variant_cast(newargs[4]), variant_cast(newargs[5]), variant_cast(newargs[6]), variant_cast(newargs[7]), variant_cast(newargs[8]), variant_cast(newargs[9]), variant_cast(newargs[10]), variant_cast(newargs[11])); throw InvalidFunctionPointerException(); } private: FunctionType f_; }; template class StaticMethodInfo13: public MethodInfo { public: typedef R (*FunctionType)(P0, P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12); StaticMethodInfo13(const std::string& qname, FunctionType f, const ParameterInfoList& plist) : MethodInfo(qname, typeof(C), typeof(R), plist), f_(f) { } bool isConst() const { return false; } bool isStatic() const { return true; } Value invoke(ValueList& args) const { ValueList newargs(13); convertArgument(args, newargs, getParameters(), 0); convertArgument(args, newargs, getParameters(), 1); convertArgument(args, newargs, getParameters(), 2); convertArgument(args, newargs, getParameters(), 3); convertArgument(args, newargs, getParameters(), 4); convertArgument(args, newargs, getParameters(), 5); convertArgument(args, newargs, getParameters(), 6); convertArgument(args, newargs, getParameters(), 7); convertArgument(args, newargs, getParameters(), 8); convertArgument(args, newargs, getParameters(), 9); convertArgument(args, newargs, getParameters(), 10); convertArgument(args, newargs, getParameters(), 11); convertArgument(args, newargs, getParameters(), 12); if (f_) return (*f_)(variant_cast(newargs[0]), variant_cast(newargs[1]), variant_cast(newargs[2]), variant_cast(newargs[3]), variant_cast(newargs[4]), variant_cast(newargs[5]), variant_cast(newargs[6]), variant_cast(newargs[7]), variant_cast(newargs[8]), variant_cast(newargs[9]), variant_cast(newargs[10]), variant_cast(newargs[11]), variant_cast(newargs[12])); throw InvalidFunctionPointerException(); } private: FunctionType f_; }; template class StaticMethodInfo14: public MethodInfo { public: typedef R (*FunctionType)(P0, P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13); StaticMethodInfo14(const std::string& qname, FunctionType f, const ParameterInfoList& plist) : MethodInfo(qname, typeof(C), typeof(R), plist), f_(f) { } bool isConst() const { return false; } bool isStatic() const { return true; } Value invoke(ValueList& args) const { ValueList newargs(14); convertArgument(args, newargs, getParameters(), 0); convertArgument(args, newargs, getParameters(), 1); convertArgument(args, newargs, getParameters(), 2); convertArgument(args, newargs, getParameters(), 3); convertArgument(args, newargs, getParameters(), 4); convertArgument(args, newargs, getParameters(), 5); convertArgument(args, newargs, getParameters(), 6); convertArgument(args, newargs, getParameters(), 7); convertArgument(args, newargs, getParameters(), 8); convertArgument(args, newargs, getParameters(), 9); convertArgument(args, newargs, getParameters(), 10); convertArgument(args, newargs, getParameters(), 11); convertArgument(args, newargs, getParameters(), 12); convertArgument(args, newargs, getParameters(), 13); if (f_) return (*f_)(variant_cast(newargs[0]), variant_cast(newargs[1]), variant_cast(newargs[2]), variant_cast(newargs[3]), variant_cast(newargs[4]), variant_cast(newargs[5]), variant_cast(newargs[6]), variant_cast(newargs[7]), variant_cast(newargs[8]), variant_cast(newargs[9]), variant_cast(newargs[10]), variant_cast(newargs[11]), variant_cast(newargs[12]), variant_cast(newargs[13])); throw InvalidFunctionPointerException(); } private: FunctionType f_; }; template class StaticMethodInfo15: public MethodInfo { public: typedef R (*FunctionType)(P0, P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14); StaticMethodInfo15(const std::string& qname, FunctionType f, const ParameterInfoList& plist) : MethodInfo(qname, typeof(C), typeof(R), plist), f_(f) { } bool isConst() const { return false; } bool isStatic() const { return true; } Value invoke(ValueList& args) const { ValueList newargs(15); convertArgument(args, newargs, getParameters(), 0); convertArgument(args, newargs, getParameters(), 1); convertArgument(args, newargs, getParameters(), 2); convertArgument(args, newargs, getParameters(), 3); convertArgument(args, newargs, getParameters(), 4); convertArgument(args, newargs, getParameters(), 5); convertArgument(args, newargs, getParameters(), 6); convertArgument(args, newargs, getParameters(), 7); convertArgument(args, newargs, getParameters(), 8); convertArgument(args, newargs, getParameters(), 9); convertArgument(args, newargs, getParameters(), 10); convertArgument(args, newargs, getParameters(), 11); convertArgument(args, newargs, getParameters(), 12); convertArgument(args, newargs, getParameters(), 13); convertArgument(args, newargs, getParameters(), 14); if (f_) return (*f_)(variant_cast(newargs[0]), variant_cast(newargs[1]), variant_cast(newargs[2]), variant_cast(newargs[3]), variant_cast(newargs[4]), variant_cast(newargs[5]), variant_cast(newargs[6]), variant_cast(newargs[7]), variant_cast(newargs[8]), variant_cast(newargs[9]), variant_cast(newargs[10]), variant_cast(newargs[11]), variant_cast(newargs[12]), variant_cast(newargs[13]), variant_cast(newargs[14])); throw InvalidFunctionPointerException(); } private: FunctionType f_; }; template class StaticMethodInfo16: public MethodInfo { public: typedef R (*FunctionType)(P0, P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15); StaticMethodInfo16(const std::string& qname, FunctionType f, const ParameterInfoList& plist) : MethodInfo(qname, typeof(C), typeof(R), plist), f_(f) { } bool isConst() const { return false; } bool isStatic() const { return true; } Value invoke(ValueList& args) const { ValueList newargs(16); convertArgument(args, newargs, getParameters(), 0); convertArgument(args, newargs, getParameters(), 1); convertArgument(args, newargs, getParameters(), 2); convertArgument(args, newargs, getParameters(), 3); convertArgument(args, newargs, getParameters(), 4); convertArgument(args, newargs, getParameters(), 5); convertArgument(args, newargs, getParameters(), 6); convertArgument(args, newargs, getParameters(), 7); convertArgument(args, newargs, getParameters(), 8); convertArgument(args, newargs, getParameters(), 9); convertArgument(args, newargs, getParameters(), 10); convertArgument(args, newargs, getParameters(), 11); convertArgument(args, newargs, getParameters(), 12); convertArgument(args, newargs, getParameters(), 13); convertArgument(args, newargs, getParameters(), 14); convertArgument(args, newargs, getParameters(), 15); if (f_) return (*f_)(variant_cast(newargs[0]), variant_cast(newargs[1]), variant_cast(newargs[2]), variant_cast(newargs[3]), variant_cast(newargs[4]), variant_cast(newargs[5]), variant_cast(newargs[6]), variant_cast(newargs[7]), variant_cast(newargs[8]), variant_cast(newargs[9]), variant_cast(newargs[10]), variant_cast(newargs[11]), variant_cast(newargs[12]), variant_cast(newargs[13]), variant_cast(newargs[14]), variant_cast(newargs[15])); throw InvalidFunctionPointerException(); } private: FunctionType f_; }; template class StaticMethodInfo0: public MethodInfo { public: typedef void (*FunctionType)(); StaticMethodInfo0(const std::string& qname, FunctionType f, const ParameterInfoList& plist) : MethodInfo(qname, typeof(C), typeof(void), plist), f_(f) { } bool isConst() const { return false; } bool isStatic() const { return true; } Value invoke(ValueList& /*args*/) const { if (f_) return (*f_)(), Value(); throw InvalidFunctionPointerException(); } private: FunctionType f_; }; template class StaticMethodInfo1: public MethodInfo { public: typedef void (*FunctionType)(P0); StaticMethodInfo1(const std::string& qname, FunctionType f, const ParameterInfoList& plist) : MethodInfo(qname, typeof(C), typeof(void), plist), f_(f) { } bool isConst() const { return false; } bool isStatic() const { return true; } Value invoke(ValueList& args) const { ValueList newargs(1); convertArgument(args, newargs, getParameters(), 0); if (f_) return (*f_)(variant_cast(newargs[0])), Value(); throw InvalidFunctionPointerException(); } private: FunctionType f_; }; template class StaticMethodInfo2: public MethodInfo { public: typedef void (*FunctionType)(P0, P1); StaticMethodInfo2(const std::string& qname, FunctionType f, const ParameterInfoList& plist) : MethodInfo(qname, typeof(C), typeof(void), plist), f_(f) { } bool isConst() const { return false; } bool isStatic() const { return true; } Value invoke(ValueList& args) const { ValueList newargs(2); convertArgument(args, newargs, getParameters(), 0); convertArgument(args, newargs, getParameters(), 1); if (f_) return (*f_)(variant_cast(newargs[0]), variant_cast(newargs[1])), Value(); throw InvalidFunctionPointerException(); } private: FunctionType f_; }; template class StaticMethodInfo3: public MethodInfo { public: typedef void (*FunctionType)(P0, P1, P2); StaticMethodInfo3(const std::string& qname, FunctionType f, const ParameterInfoList& plist) : MethodInfo(qname, typeof(C), typeof(void), plist), f_(f) { } bool isConst() const { return false; } bool isStatic() const { return true; } Value invoke(ValueList& args) const { ValueList newargs(3); convertArgument(args, newargs, getParameters(), 0); convertArgument(args, newargs, getParameters(), 1); convertArgument(args, newargs, getParameters(), 2); if (f_) return (*f_)(variant_cast(newargs[0]), variant_cast(newargs[1]), variant_cast(newargs[2])), Value(); throw InvalidFunctionPointerException(); } private: FunctionType f_; }; template class StaticMethodInfo4: public MethodInfo { public: typedef void (*FunctionType)(P0, P1, P2, P3); StaticMethodInfo4(const std::string& qname, FunctionType f, const ParameterInfoList& plist) : MethodInfo(qname, typeof(C), typeof(void), plist), f_(f) { } bool isConst() const { return false; } bool isStatic() const { return true; } Value invoke(ValueList& args) const { ValueList newargs(4); convertArgument(args, newargs, getParameters(), 0); convertArgument(args, newargs, getParameters(), 1); convertArgument(args, newargs, getParameters(), 2); convertArgument(args, newargs, getParameters(), 3); if (f_) return (*f_)(variant_cast(newargs[0]), variant_cast(newargs[1]), variant_cast(newargs[2]), variant_cast(newargs[3])), Value(); throw InvalidFunctionPointerException(); } private: FunctionType f_; }; template class StaticMethodInfo5: public MethodInfo { public: typedef void (*FunctionType)(P0, P1, P2, P3, P4); StaticMethodInfo5(const std::string& qname, FunctionType f, const ParameterInfoList& plist) : MethodInfo(qname, typeof(C), typeof(void), plist), f_(f) { } bool isConst() const { return false; } bool isStatic() const { return true; } Value invoke(ValueList& args) const { ValueList newargs(5); convertArgument(args, newargs, getParameters(), 0); convertArgument(args, newargs, getParameters(), 1); convertArgument(args, newargs, getParameters(), 2); convertArgument(args, newargs, getParameters(), 3); convertArgument(args, newargs, getParameters(), 4); if (f_) return (*f_)(variant_cast(newargs[0]), variant_cast(newargs[1]), variant_cast(newargs[2]), variant_cast(newargs[3]), variant_cast(newargs[4])), Value(); throw InvalidFunctionPointerException(); } private: FunctionType f_; }; template class StaticMethodInfo6: public MethodInfo { public: typedef void (*FunctionType)(P0, P1, P2, P3, P4, P5); StaticMethodInfo6(const std::string& qname, FunctionType f, const ParameterInfoList& plist) : MethodInfo(qname, typeof(C), typeof(void), plist), f_(f) { } bool isConst() const { return false; } bool isStatic() const { return true; } Value invoke(ValueList& args) const { ValueList newargs(6); convertArgument(args, newargs, getParameters(), 0); convertArgument(args, newargs, getParameters(), 1); convertArgument(args, newargs, getParameters(), 2); convertArgument(args, newargs, getParameters(), 3); convertArgument(args, newargs, getParameters(), 4); convertArgument(args, newargs, getParameters(), 5); if (f_) return (*f_)(variant_cast(newargs[0]), variant_cast(newargs[1]), variant_cast(newargs[2]), variant_cast(newargs[3]), variant_cast(newargs[4]), variant_cast(newargs[5])), Value(); throw InvalidFunctionPointerException(); } private: FunctionType f_; }; template class StaticMethodInfo7: public MethodInfo { public: typedef void (*FunctionType)(P0, P1, P2, P3, P4, P5, P6); StaticMethodInfo7(const std::string& qname, FunctionType f, const ParameterInfoList& plist) : MethodInfo(qname, typeof(C), typeof(void), plist), f_(f) { } bool isConst() const { return false; } bool isStatic() const { return true; } Value invoke(ValueList& args) const { ValueList newargs(7); convertArgument(args, newargs, getParameters(), 0); convertArgument(args, newargs, getParameters(), 1); convertArgument(args, newargs, getParameters(), 2); convertArgument(args, newargs, getParameters(), 3); convertArgument(args, newargs, getParameters(), 4); convertArgument(args, newargs, getParameters(), 5); convertArgument(args, newargs, getParameters(), 6); if (f_) return (*f_)(variant_cast(newargs[0]), variant_cast(newargs[1]), variant_cast(newargs[2]), variant_cast(newargs[3]), variant_cast(newargs[4]), variant_cast(newargs[5]), variant_cast(newargs[6])), Value(); throw InvalidFunctionPointerException(); } private: FunctionType f_; }; template class StaticMethodInfo8: public MethodInfo { public: typedef void (*FunctionType)(P0, P1, P2, P3, P4, P5, P6, P7); StaticMethodInfo8(const std::string& qname, FunctionType f, const ParameterInfoList& plist) : MethodInfo(qname, typeof(C), typeof(void), plist), f_(f) { } bool isConst() const { return false; } bool isStatic() const { return true; } Value invoke(ValueList& args) const { ValueList newargs(8); convertArgument(args, newargs, getParameters(), 0); convertArgument(args, newargs, getParameters(), 1); convertArgument(args, newargs, getParameters(), 2); convertArgument(args, newargs, getParameters(), 3); convertArgument(args, newargs, getParameters(), 4); convertArgument(args, newargs, getParameters(), 5); convertArgument(args, newargs, getParameters(), 6); convertArgument(args, newargs, getParameters(), 7); if (f_) return (*f_)(variant_cast(newargs[0]), variant_cast(newargs[1]), variant_cast(newargs[2]), variant_cast(newargs[3]), variant_cast(newargs[4]), variant_cast(newargs[5]), variant_cast(newargs[6]), variant_cast(newargs[7])), Value(); throw InvalidFunctionPointerException(); } private: FunctionType f_; }; template class StaticMethodInfo9: public MethodInfo { public: typedef void (*FunctionType)(P0, P1, P2, P3, P4, P5, P6, P7, P8); StaticMethodInfo9(const std::string& qname, FunctionType f, const ParameterInfoList& plist) : MethodInfo(qname, typeof(C), typeof(void), plist), f_(f) { } bool isConst() const { return false; } bool isStatic() const { return true; } Value invoke(ValueList& args) const { ValueList newargs(9); convertArgument(args, newargs, getParameters(), 0); convertArgument(args, newargs, getParameters(), 1); convertArgument(args, newargs, getParameters(), 2); convertArgument(args, newargs, getParameters(), 3); convertArgument(args, newargs, getParameters(), 4); convertArgument(args, newargs, getParameters(), 5); convertArgument(args, newargs, getParameters(), 6); convertArgument(args, newargs, getParameters(), 7); convertArgument(args, newargs, getParameters(), 8); if (f_) return (*f_)(variant_cast(newargs[0]), variant_cast(newargs[1]), variant_cast(newargs[2]), variant_cast(newargs[3]), variant_cast(newargs[4]), variant_cast(newargs[5]), variant_cast(newargs[6]), variant_cast(newargs[7]), variant_cast(newargs[8])), Value(); throw InvalidFunctionPointerException(); } private: FunctionType f_; }; template class StaticMethodInfo10: public MethodInfo { public: typedef void (*FunctionType)(P0, P1, P2, P3, P4, P5, P6, P7, P8, P9); StaticMethodInfo10(const std::string& qname, FunctionType f, const ParameterInfoList& plist) : MethodInfo(qname, typeof(C), typeof(void), plist), f_(f) { } bool isConst() const { return false; } bool isStatic() const { return true; } Value invoke(ValueList& args) const { ValueList newargs(10); convertArgument(args, newargs, getParameters(), 0); convertArgument(args, newargs, getParameters(), 1); convertArgument(args, newargs, getParameters(), 2); convertArgument(args, newargs, getParameters(), 3); convertArgument(args, newargs, getParameters(), 4); convertArgument(args, newargs, getParameters(), 5); convertArgument(args, newargs, getParameters(), 6); convertArgument(args, newargs, getParameters(), 7); convertArgument(args, newargs, getParameters(), 8); convertArgument(args, newargs, getParameters(), 9); if (f_) return (*f_)(variant_cast(newargs[0]), variant_cast(newargs[1]), variant_cast(newargs[2]), variant_cast(newargs[3]), variant_cast(newargs[4]), variant_cast(newargs[5]), variant_cast(newargs[6]), variant_cast(newargs[7]), variant_cast(newargs[8]), variant_cast(newargs[9])), Value(); throw InvalidFunctionPointerException(); } private: FunctionType f_; }; template class StaticMethodInfo11: public MethodInfo { public: typedef void (*FunctionType)(P0, P1, P2, P3, P4, P5, P6, P7, P8, P9, P10); StaticMethodInfo11(const std::string& qname, FunctionType f, const ParameterInfoList& plist) : MethodInfo(qname, typeof(C), typeof(void), plist), f_(f) { } bool isConst() const { return false; } bool isStatic() const { return true; } Value invoke(ValueList& args) const { ValueList newargs(11); convertArgument(args, newargs, getParameters(), 0); convertArgument(args, newargs, getParameters(), 1); convertArgument(args, newargs, getParameters(), 2); convertArgument(args, newargs, getParameters(), 3); convertArgument(args, newargs, getParameters(), 4); convertArgument(args, newargs, getParameters(), 5); convertArgument(args, newargs, getParameters(), 6); convertArgument(args, newargs, getParameters(), 7); convertArgument(args, newargs, getParameters(), 8); convertArgument(args, newargs, getParameters(), 9); convertArgument(args, newargs, getParameters(), 10); if (f_) return (*f_)(variant_cast(newargs[0]), variant_cast(newargs[1]), variant_cast(newargs[2]), variant_cast(newargs[3]), variant_cast(newargs[4]), variant_cast(newargs[5]), variant_cast(newargs[6]), variant_cast(newargs[7]), variant_cast(newargs[8]), variant_cast(newargs[9]), variant_cast(newargs[10])), Value(); throw InvalidFunctionPointerException(); } private: FunctionType f_; }; template class StaticMethodInfo12: public MethodInfo { public: typedef void (*FunctionType)(P0, P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11); StaticMethodInfo12(const std::string& qname, FunctionType f, const ParameterInfoList& plist) : MethodInfo(qname, typeof(C), typeof(void), plist), f_(f) { } bool isConst() const { return false; } bool isStatic() const { return true; } Value invoke(ValueList& args) const { ValueList newargs(12); convertArgument(args, newargs, getParameters(), 0); convertArgument(args, newargs, getParameters(), 1); convertArgument(args, newargs, getParameters(), 2); convertArgument(args, newargs, getParameters(), 3); convertArgument(args, newargs, getParameters(), 4); convertArgument(args, newargs, getParameters(), 5); convertArgument(args, newargs, getParameters(), 6); convertArgument(args, newargs, getParameters(), 7); convertArgument(args, newargs, getParameters(), 8); convertArgument(args, newargs, getParameters(), 9); convertArgument(args, newargs, getParameters(), 10); convertArgument(args, newargs, getParameters(), 11); if (f_) return (*f_)(variant_cast(newargs[0]), variant_cast(newargs[1]), variant_cast(newargs[2]), variant_cast(newargs[3]), variant_cast(newargs[4]), variant_cast(newargs[5]), variant_cast(newargs[6]), variant_cast(newargs[7]), variant_cast(newargs[8]), variant_cast(newargs[9]), variant_cast(newargs[10]), variant_cast(newargs[11])), Value(); throw InvalidFunctionPointerException(); } private: FunctionType f_; }; template class StaticMethodInfo13: public MethodInfo { public: typedef void (*FunctionType)(P0, P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12); StaticMethodInfo13(const std::string& qname, FunctionType f, const ParameterInfoList& plist) : MethodInfo(qname, typeof(C), typeof(void), plist), f_(f) { } bool isConst() const { return false; } bool isStatic() const { return true; } Value invoke(ValueList& args) const { ValueList newargs(13); convertArgument(args, newargs, getParameters(), 0); convertArgument(args, newargs, getParameters(), 1); convertArgument(args, newargs, getParameters(), 2); convertArgument(args, newargs, getParameters(), 3); convertArgument(args, newargs, getParameters(), 4); convertArgument(args, newargs, getParameters(), 5); convertArgument(args, newargs, getParameters(), 6); convertArgument(args, newargs, getParameters(), 7); convertArgument(args, newargs, getParameters(), 8); convertArgument(args, newargs, getParameters(), 9); convertArgument(args, newargs, getParameters(), 10); convertArgument(args, newargs, getParameters(), 11); convertArgument(args, newargs, getParameters(), 12); if (f_) return (*f_)(variant_cast(newargs[0]), variant_cast(newargs[1]), variant_cast(newargs[2]), variant_cast(newargs[3]), variant_cast(newargs[4]), variant_cast(newargs[5]), variant_cast(newargs[6]), variant_cast(newargs[7]), variant_cast(newargs[8]), variant_cast(newargs[9]), variant_cast(newargs[10]), variant_cast(newargs[11]), variant_cast(newargs[12])), Value(); throw InvalidFunctionPointerException(); } private: FunctionType f_; }; template class StaticMethodInfo14: public MethodInfo { public: typedef void (*FunctionType)(P0, P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13); StaticMethodInfo14(const std::string& qname, FunctionType f, const ParameterInfoList& plist) : MethodInfo(qname, typeof(C), typeof(void), plist), f_(f) { } bool isConst() const { return false; } bool isStatic() const { return true; } Value invoke(ValueList& args) const { ValueList newargs(14); convertArgument(args, newargs, getParameters(), 0); convertArgument(args, newargs, getParameters(), 1); convertArgument(args, newargs, getParameters(), 2); convertArgument(args, newargs, getParameters(), 3); convertArgument(args, newargs, getParameters(), 4); convertArgument(args, newargs, getParameters(), 5); convertArgument(args, newargs, getParameters(), 6); convertArgument(args, newargs, getParameters(), 7); convertArgument(args, newargs, getParameters(), 8); convertArgument(args, newargs, getParameters(), 9); convertArgument(args, newargs, getParameters(), 10); convertArgument(args, newargs, getParameters(), 11); convertArgument(args, newargs, getParameters(), 12); convertArgument(args, newargs, getParameters(), 13); if (f_) return (*f_)(variant_cast(newargs[0]), variant_cast(newargs[1]), variant_cast(newargs[2]), variant_cast(newargs[3]), variant_cast(newargs[4]), variant_cast(newargs[5]), variant_cast(newargs[6]), variant_cast(newargs[7]), variant_cast(newargs[8]), variant_cast(newargs[9]), variant_cast(newargs[10]), variant_cast(newargs[11]), variant_cast(newargs[12]), variant_cast(newargs[13])), Value(); throw InvalidFunctionPointerException(); } private: FunctionType f_; }; template class StaticMethodInfo15: public MethodInfo { public: typedef void (*FunctionType)(P0, P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14); StaticMethodInfo15(const std::string& qname, FunctionType f, const ParameterInfoList& plist) : MethodInfo(qname, typeof(C), typeof(void), plist), f_(f) { } bool isConst() const { return false; } bool isStatic() const { return true; } Value invoke(ValueList& args) const { ValueList newargs(15); convertArgument(args, newargs, getParameters(), 0); convertArgument(args, newargs, getParameters(), 1); convertArgument(args, newargs, getParameters(), 2); convertArgument(args, newargs, getParameters(), 3); convertArgument(args, newargs, getParameters(), 4); convertArgument(args, newargs, getParameters(), 5); convertArgument(args, newargs, getParameters(), 6); convertArgument(args, newargs, getParameters(), 7); convertArgument(args, newargs, getParameters(), 8); convertArgument(args, newargs, getParameters(), 9); convertArgument(args, newargs, getParameters(), 10); convertArgument(args, newargs, getParameters(), 11); convertArgument(args, newargs, getParameters(), 12); convertArgument(args, newargs, getParameters(), 13); convertArgument(args, newargs, getParameters(), 14); if (f_) return (*f_)(variant_cast(newargs[0]), variant_cast(newargs[1]), variant_cast(newargs[2]), variant_cast(newargs[3]), variant_cast(newargs[4]), variant_cast(newargs[5]), variant_cast(newargs[6]), variant_cast(newargs[7]), variant_cast(newargs[8]), variant_cast(newargs[9]), variant_cast(newargs[10]), variant_cast(newargs[11]), variant_cast(newargs[12]), variant_cast(newargs[13]), variant_cast(newargs[14])), Value(); throw InvalidFunctionPointerException(); } private: FunctionType f_; }; template class StaticMethodInfo16: public MethodInfo { public: typedef void (*FunctionType)(P0, P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15); StaticMethodInfo16(const std::string& qname, FunctionType f, const ParameterInfoList& plist) : MethodInfo(qname, typeof(C), typeof(void), plist), f_(f) { } bool isConst() const { return false; } bool isStatic() const { return true; } Value invoke(ValueList& args) const { ValueList newargs(16); convertArgument(args, newargs, getParameters(), 0); convertArgument(args, newargs, getParameters(), 1); convertArgument(args, newargs, getParameters(), 2); convertArgument(args, newargs, getParameters(), 3); convertArgument(args, newargs, getParameters(), 4); convertArgument(args, newargs, getParameters(), 5); convertArgument(args, newargs, getParameters(), 6); convertArgument(args, newargs, getParameters(), 7); convertArgument(args, newargs, getParameters(), 8); convertArgument(args, newargs, getParameters(), 9); convertArgument(args, newargs, getParameters(), 10); convertArgument(args, newargs, getParameters(), 11); convertArgument(args, newargs, getParameters(), 12); convertArgument(args, newargs, getParameters(), 13); convertArgument(args, newargs, getParameters(), 14); convertArgument(args, newargs, getParameters(), 15); if (f_) return (*f_)(variant_cast(newargs[0]), variant_cast(newargs[1]), variant_cast(newargs[2]), variant_cast(newargs[3]), variant_cast(newargs[4]), variant_cast(newargs[5]), variant_cast(newargs[6]), variant_cast(newargs[7]), variant_cast(newargs[8]), variant_cast(newargs[9]), variant_cast(newargs[10]), variant_cast(newargs[11]), variant_cast(newargs[12]), variant_cast(newargs[13]), variant_cast(newargs[14]), variant_cast(newargs[15])), Value(); throw InvalidFunctionPointerException(); } private: FunctionType f_; }; } #endif