/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 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_TYPEDCONSTRUCTORINFO_
#define OSGINTROSPECTION_TYPEDCONSTRUCTORINFO_

#include <osgIntrospection/ConstructorInfo>
#include <osgIntrospection/InstanceCreator>
#include <osgIntrospection/Utility>

namespace osgIntrospection
{

    template<typename C, typename IC> 
    struct TypedConstructorInfo0: ConstructorInfo
    {
        TypedConstructorInfo0(const ParameterInfoList& plist, std::string briefHelp = std::string(), std::string detailedHelp = std::string())
        :    ConstructorInfo(typeof(C), plist, briefHelp, detailedHelp)
        {
        }

        Value createInstance(ValueList&  /*args*/) const
        {
            return IC::create();
        }

    };


    template<typename C, typename IC, typename P0> 
    struct TypedConstructorInfo1: ConstructorInfo
    {
        TypedConstructorInfo1(const ParameterInfoList& plist, bool isExplicit, std::string briefHelp = std::string(), std::string detailedHelp = std::string())
        :    ConstructorInfo(typeof(C), plist, isExplicit, briefHelp, detailedHelp)
        {
        }

        Value createInstance(ValueList& args) const
        {
            ValueList newargs(1);
            convertArgument<P0>(args, newargs, getParameters(), 0);

            return IC::template create<P0>(newargs[0]);
        }

    };


    template<typename C, typename IC, typename P0, typename P1> 
    struct TypedConstructorInfo2: ConstructorInfo
    {
        TypedConstructorInfo2(const ParameterInfoList& plist, std::string briefHelp = std::string(), std::string detailedHelp = std::string())
        :    ConstructorInfo(typeof(C), plist, briefHelp, detailedHelp)
        {
        }

        Value createInstance(ValueList& args) const
        {
            ValueList newargs(2);
            convertArgument<P0>(args, newargs, getParameters(), 0);
            convertArgument<P1>(args, newargs, getParameters(), 1);

            return IC::template create<P0, P1>(newargs[0], newargs[1]);
        }

    };


    template<typename C, typename IC, typename P0, typename P1, typename P2> 
    struct TypedConstructorInfo3: ConstructorInfo
    {
        TypedConstructorInfo3(const ParameterInfoList& plist, std::string briefHelp = std::string(), std::string detailedHelp = std::string())
        :    ConstructorInfo(typeof(C), plist, briefHelp, detailedHelp)
        {
        }

        Value createInstance(ValueList& args) const
        {
            ValueList newargs(3);
            convertArgument<P0>(args, newargs, getParameters(), 0);
            convertArgument<P1>(args, newargs, getParameters(), 1);
            convertArgument<P2>(args, newargs, getParameters(), 2);

            return IC::template create<P0, P1, P2>(newargs[0], newargs[1], newargs[2]);
        }

    };


    template<typename C, typename IC, typename P0, typename P1, typename P2, typename P3> 
    struct TypedConstructorInfo4: ConstructorInfo
    {
        TypedConstructorInfo4(const ParameterInfoList& plist, std::string briefHelp = std::string(), std::string detailedHelp = std::string())
        :    ConstructorInfo(typeof(C), plist, briefHelp, detailedHelp)
        {
        }

        Value createInstance(ValueList& args) const
        {
            ValueList newargs(4);
            convertArgument<P0>(args, newargs, getParameters(), 0);
            convertArgument<P1>(args, newargs, getParameters(), 1);
            convertArgument<P2>(args, newargs, getParameters(), 2);
            convertArgument<P3>(args, newargs, getParameters(), 3);

            return IC::template create<P0, P1, P2, P3>(newargs[0], newargs[1], newargs[2], newargs[3]);
        }

    };


    template<typename C, typename IC, typename P0, typename P1, typename P2, typename P3, typename P4> 
    struct TypedConstructorInfo5: ConstructorInfo
    {
        TypedConstructorInfo5(const ParameterInfoList& plist, std::string briefHelp = std::string(), std::string detailedHelp = std::string())
        :    ConstructorInfo(typeof(C), plist, briefHelp, detailedHelp)
        {
        }

        Value createInstance(ValueList& args) const
        {
            ValueList newargs(5);
            convertArgument<P0>(args, newargs, getParameters(), 0);
            convertArgument<P1>(args, newargs, getParameters(), 1);
            convertArgument<P2>(args, newargs, getParameters(), 2);
            convertArgument<P3>(args, newargs, getParameters(), 3);
            convertArgument<P4>(args, newargs, getParameters(), 4);

            return IC::template create<P0, P1, P2, P3, P4>(newargs[0], newargs[1], newargs[2], newargs[3], newargs[4]);
        }

    };


    template<typename C, typename IC, typename P0, typename P1, typename P2, typename P3, typename P4, typename P5> 
    struct TypedConstructorInfo6: ConstructorInfo
    {
        TypedConstructorInfo6(const ParameterInfoList& plist, std::string briefHelp = std::string(), std::string detailedHelp = std::string())
        :    ConstructorInfo(typeof(C), plist, briefHelp, detailedHelp)
        {
        }

        Value createInstance(ValueList& args) const
        {
            ValueList newargs(6);
            convertArgument<P0>(args, newargs, getParameters(), 0);
            convertArgument<P1>(args, newargs, getParameters(), 1);
            convertArgument<P2>(args, newargs, getParameters(), 2);
            convertArgument<P3>(args, newargs, getParameters(), 3);
            convertArgument<P4>(args, newargs, getParameters(), 4);
            convertArgument<P5>(args, newargs, getParameters(), 5);

            return IC::template create<P0, P1, P2, P3, P4, P5>(newargs[0], newargs[1], newargs[2], newargs[3], newargs[4], newargs[5]);
        }

    };


    template<typename C, typename IC, typename P0, typename P1, typename P2, typename P3, typename P4, typename P5, typename P6> 
    struct TypedConstructorInfo7: ConstructorInfo
    {
        TypedConstructorInfo7(const ParameterInfoList& plist, std::string briefHelp = std::string(), std::string detailedHelp = std::string())
        :    ConstructorInfo(typeof(C), plist, briefHelp, detailedHelp)
        {
        }

        Value createInstance(ValueList& args) const
        {
            ValueList newargs(7);
            convertArgument<P0>(args, newargs, getParameters(), 0);
            convertArgument<P1>(args, newargs, getParameters(), 1);
            convertArgument<P2>(args, newargs, getParameters(), 2);
            convertArgument<P3>(args, newargs, getParameters(), 3);
            convertArgument<P4>(args, newargs, getParameters(), 4);
            convertArgument<P5>(args, newargs, getParameters(), 5);
            convertArgument<P6>(args, newargs, getParameters(), 6);

            return IC::template create<P0, P1, P2, P3, P4, P5, P6>(newargs[0], newargs[1], newargs[2], newargs[3], newargs[4], newargs[5], newargs[6]);
        }

    };


    template<typename C, typename IC, typename P0, typename P1, typename P2, typename P3, typename P4, typename P5, typename P6, typename P7> 
    struct TypedConstructorInfo8: ConstructorInfo
    {
        TypedConstructorInfo8(const ParameterInfoList& plist, std::string briefHelp = std::string(), std::string detailedHelp = std::string())
        :    ConstructorInfo(typeof(C), plist, briefHelp, detailedHelp)
        {
        }

        Value createInstance(ValueList& args) const
        {
            ValueList newargs(8);
            convertArgument<P0>(args, newargs, getParameters(), 0);
            convertArgument<P1>(args, newargs, getParameters(), 1);
            convertArgument<P2>(args, newargs, getParameters(), 2);
            convertArgument<P3>(args, newargs, getParameters(), 3);
            convertArgument<P4>(args, newargs, getParameters(), 4);
            convertArgument<P5>(args, newargs, getParameters(), 5);
            convertArgument<P6>(args, newargs, getParameters(), 6);
            convertArgument<P7>(args, newargs, getParameters(), 7);

            return IC::template create<P0, P1, P2, P3, P4, P5, P6, P7>(newargs[0], newargs[1], newargs[2], newargs[3], newargs[4], newargs[5], newargs[6], newargs[7]);
        }

    };


    template<typename C, typename IC, typename P0, typename P1, typename P2, typename P3, typename P4, typename P5, typename P6, typename P7, typename P8> 
    struct TypedConstructorInfo9: ConstructorInfo
    {
        TypedConstructorInfo9(const ParameterInfoList& plist, std::string briefHelp = std::string(), std::string detailedHelp = std::string())
        :    ConstructorInfo(typeof(C), plist, briefHelp, detailedHelp)
        {
        }

        Value createInstance(ValueList& args) const
        {
            ValueList newargs(9);
            convertArgument<P0>(args, newargs, getParameters(), 0);
            convertArgument<P1>(args, newargs, getParameters(), 1);
            convertArgument<P2>(args, newargs, getParameters(), 2);
            convertArgument<P3>(args, newargs, getParameters(), 3);
            convertArgument<P4>(args, newargs, getParameters(), 4);
            convertArgument<P5>(args, newargs, getParameters(), 5);
            convertArgument<P6>(args, newargs, getParameters(), 6);
            convertArgument<P7>(args, newargs, getParameters(), 7);
            convertArgument<P8>(args, newargs, getParameters(), 8);

            return IC::template create<P0, P1, P2, P3, P4, P5, P6, P7, P8>(newargs[0], newargs[1], newargs[2], newargs[3], newargs[4], newargs[5], newargs[6], newargs[7], newargs[8]);
        }

    };


    template<typename C, typename IC, typename P0, typename P1, typename P2, typename P3, typename P4, typename P5, typename P6, typename P7, typename P8, typename P9> 
    struct TypedConstructorInfo10: ConstructorInfo
    {
        TypedConstructorInfo10(const ParameterInfoList& plist, std::string briefHelp = std::string(), std::string detailedHelp = std::string())
        :    ConstructorInfo(typeof(C), plist, briefHelp, detailedHelp)
        {
        }

        Value createInstance(ValueList& args) const
        {
            ValueList newargs(10);
            convertArgument<P0>(args, newargs, getParameters(), 0);
            convertArgument<P1>(args, newargs, getParameters(), 1);
            convertArgument<P2>(args, newargs, getParameters(), 2);
            convertArgument<P3>(args, newargs, getParameters(), 3);
            convertArgument<P4>(args, newargs, getParameters(), 4);
            convertArgument<P5>(args, newargs, getParameters(), 5);
            convertArgument<P6>(args, newargs, getParameters(), 6);
            convertArgument<P7>(args, newargs, getParameters(), 7);
            convertArgument<P8>(args, newargs, getParameters(), 8);
            convertArgument<P9>(args, newargs, getParameters(), 9);

            return IC::template create<P0, P1, P2, P3, P4, P5, P6, P7, P8, P9>(newargs[0], newargs[1], newargs[2], newargs[3], newargs[4], newargs[5], newargs[6], newargs[7], newargs[8], newargs[9]);
        }

    };


    template<typename C, typename IC, typename P0, typename P1, typename P2, typename P3, typename P4, typename P5, typename P6, typename P7, typename P8, typename P9, typename P10> 
    struct TypedConstructorInfo11: ConstructorInfo
    {
        TypedConstructorInfo11(const ParameterInfoList& plist, std::string briefHelp = std::string(), std::string detailedHelp = std::string())
        :    ConstructorInfo(typeof(C), plist, briefHelp, detailedHelp)
        {
        }

        Value createInstance(ValueList& args) const
        {
            ValueList newargs(11);
            convertArgument<P0>(args, newargs, getParameters(), 0);
            convertArgument<P1>(args, newargs, getParameters(), 1);
            convertArgument<P2>(args, newargs, getParameters(), 2);
            convertArgument<P3>(args, newargs, getParameters(), 3);
            convertArgument<P4>(args, newargs, getParameters(), 4);
            convertArgument<P5>(args, newargs, getParameters(), 5);
            convertArgument<P6>(args, newargs, getParameters(), 6);
            convertArgument<P7>(args, newargs, getParameters(), 7);
            convertArgument<P8>(args, newargs, getParameters(), 8);
            convertArgument<P9>(args, newargs, getParameters(), 9);
            convertArgument<P10>(args, newargs, getParameters(), 10);

            return IC::template create<P0, P1, P2, P3, P4, P5, P6, P7, P8, P9, P10>(newargs[0], newargs[1], newargs[2], newargs[3], newargs[4], newargs[5], newargs[6], newargs[7], newargs[8], newargs[9], newargs[10]);
        }

    };


    template<typename C, typename IC, typename P0, typename P1, typename P2, typename P3, typename P4, typename P5, typename P6, typename P7, typename P8, typename P9, typename P10, typename P11> 
    struct TypedConstructorInfo12: ConstructorInfo
    {
        TypedConstructorInfo12(const ParameterInfoList& plist, std::string briefHelp = std::string(), std::string detailedHelp = std::string())
        :    ConstructorInfo(typeof(C), plist, briefHelp, detailedHelp)
        {
        }

        Value createInstance(ValueList& args) const
        {
            ValueList newargs(12);
            convertArgument<P0>(args, newargs, getParameters(), 0);
            convertArgument<P1>(args, newargs, getParameters(), 1);
            convertArgument<P2>(args, newargs, getParameters(), 2);
            convertArgument<P3>(args, newargs, getParameters(), 3);
            convertArgument<P4>(args, newargs, getParameters(), 4);
            convertArgument<P5>(args, newargs, getParameters(), 5);
            convertArgument<P6>(args, newargs, getParameters(), 6);
            convertArgument<P7>(args, newargs, getParameters(), 7);
            convertArgument<P8>(args, newargs, getParameters(), 8);
            convertArgument<P9>(args, newargs, getParameters(), 9);
            convertArgument<P10>(args, newargs, getParameters(), 10);
            convertArgument<P11>(args, newargs, getParameters(), 11);

            return IC::template create<P0, P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11>(newargs[0], newargs[1], newargs[2], newargs[3], newargs[4], newargs[5], newargs[6], newargs[7], newargs[8], newargs[9], newargs[10], newargs[11]);
        }

    };


    template<typename C, typename IC, typename P0, typename P1, typename P2, typename P3, typename P4, typename P5, typename P6, typename P7, typename P8, typename P9, typename P10, typename P11, typename P12> 
    struct TypedConstructorInfo13: ConstructorInfo
    {
        TypedConstructorInfo13(const ParameterInfoList& plist, std::string briefHelp = std::string(), std::string detailedHelp = std::string())
        :    ConstructorInfo(typeof(C), plist, briefHelp, detailedHelp)
        {
        }

        Value createInstance(ValueList& args) const
        {
            ValueList newargs(13);
            convertArgument<P0>(args, newargs, getParameters(), 0);
            convertArgument<P1>(args, newargs, getParameters(), 1);
            convertArgument<P2>(args, newargs, getParameters(), 2);
            convertArgument<P3>(args, newargs, getParameters(), 3);
            convertArgument<P4>(args, newargs, getParameters(), 4);
            convertArgument<P5>(args, newargs, getParameters(), 5);
            convertArgument<P6>(args, newargs, getParameters(), 6);
            convertArgument<P7>(args, newargs, getParameters(), 7);
            convertArgument<P8>(args, newargs, getParameters(), 8);
            convertArgument<P9>(args, newargs, getParameters(), 9);
            convertArgument<P10>(args, newargs, getParameters(), 10);
            convertArgument<P11>(args, newargs, getParameters(), 11);
            convertArgument<P12>(args, newargs, getParameters(), 12);

            return IC::template create<P0, P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12>(newargs[0], newargs[1], newargs[2], newargs[3], newargs[4], newargs[5], newargs[6], newargs[7], newargs[8], newargs[9], newargs[10], newargs[11], newargs[12]);
        }

    };


    template<typename C, typename IC, typename P0, typename P1, typename P2, typename P3, typename P4, typename P5, typename P6, typename P7, typename P8, typename P9, typename P10, typename P11, typename P12, typename P13> 
    struct TypedConstructorInfo14: ConstructorInfo
    {
        TypedConstructorInfo14(const ParameterInfoList& plist, std::string briefHelp = std::string(), std::string detailedHelp = std::string())
        :    ConstructorInfo(typeof(C), plist, briefHelp, detailedHelp)
        {
        }

        Value createInstance(ValueList& args) const
        {
            ValueList newargs(14);
            convertArgument<P0>(args, newargs, getParameters(), 0);
            convertArgument<P1>(args, newargs, getParameters(), 1);
            convertArgument<P2>(args, newargs, getParameters(), 2);
            convertArgument<P3>(args, newargs, getParameters(), 3);
            convertArgument<P4>(args, newargs, getParameters(), 4);
            convertArgument<P5>(args, newargs, getParameters(), 5);
            convertArgument<P6>(args, newargs, getParameters(), 6);
            convertArgument<P7>(args, newargs, getParameters(), 7);
            convertArgument<P8>(args, newargs, getParameters(), 8);
            convertArgument<P9>(args, newargs, getParameters(), 9);
            convertArgument<P10>(args, newargs, getParameters(), 10);
            convertArgument<P11>(args, newargs, getParameters(), 11);
            convertArgument<P12>(args, newargs, getParameters(), 12);
            convertArgument<P13>(args, newargs, getParameters(), 13);

            return IC::template create<P0, P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13>(newargs[0], newargs[1], newargs[2], newargs[3], newargs[4], newargs[5], newargs[6], newargs[7], newargs[8], newargs[9], newargs[10], newargs[11], newargs[12], newargs[13]);
        }

    };


    template<typename C, typename IC, typename P0, typename P1, typename P2, typename P3, typename P4, typename P5, typename P6, typename P7, typename P8, typename P9, typename P10, typename P11, typename P12, typename P13, typename P14> 
    struct TypedConstructorInfo15: ConstructorInfo
    {
        TypedConstructorInfo15(const ParameterInfoList& plist, std::string briefHelp = std::string(), std::string detailedHelp = std::string())
        :    ConstructorInfo(typeof(C), plist, briefHelp, detailedHelp)
        {
        }

        Value createInstance(ValueList& args) const
        {
            ValueList newargs(15);
            convertArgument<P0>(args, newargs, getParameters(), 0);
            convertArgument<P1>(args, newargs, getParameters(), 1);
            convertArgument<P2>(args, newargs, getParameters(), 2);
            convertArgument<P3>(args, newargs, getParameters(), 3);
            convertArgument<P4>(args, newargs, getParameters(), 4);
            convertArgument<P5>(args, newargs, getParameters(), 5);
            convertArgument<P6>(args, newargs, getParameters(), 6);
            convertArgument<P7>(args, newargs, getParameters(), 7);
            convertArgument<P8>(args, newargs, getParameters(), 8);
            convertArgument<P9>(args, newargs, getParameters(), 9);
            convertArgument<P10>(args, newargs, getParameters(), 10);
            convertArgument<P11>(args, newargs, getParameters(), 11);
            convertArgument<P12>(args, newargs, getParameters(), 12);
            convertArgument<P13>(args, newargs, getParameters(), 13);
            convertArgument<P14>(args, newargs, getParameters(), 14);

            return IC::template create<P0, P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14>(newargs[0], newargs[1], newargs[2], newargs[3], newargs[4], newargs[5], newargs[6], newargs[7], newargs[8], newargs[9], newargs[10], newargs[11], newargs[12], newargs[13], newargs[14]);
        }

    };


    template<typename C, typename IC, typename P0, typename P1, typename P2, typename P3, typename P4, typename P5, typename P6, typename P7, typename P8, typename P9, typename P10, typename P11, typename P12, typename P13, typename P14, typename P15> 
    struct TypedConstructorInfo16: ConstructorInfo
    {
        TypedConstructorInfo16(const ParameterInfoList& plist, std::string briefHelp = std::string(), std::string detailedHelp = std::string())
        :    ConstructorInfo(typeof(C), plist, briefHelp, detailedHelp)
        {
        }

        Value createInstance(ValueList& args) const
        {
            ValueList newargs(16);
            convertArgument<P0>(args, newargs, getParameters(), 0);
            convertArgument<P1>(args, newargs, getParameters(), 1);
            convertArgument<P2>(args, newargs, getParameters(), 2);
            convertArgument<P3>(args, newargs, getParameters(), 3);
            convertArgument<P4>(args, newargs, getParameters(), 4);
            convertArgument<P5>(args, newargs, getParameters(), 5);
            convertArgument<P6>(args, newargs, getParameters(), 6);
            convertArgument<P7>(args, newargs, getParameters(), 7);
            convertArgument<P8>(args, newargs, getParameters(), 8);
            convertArgument<P9>(args, newargs, getParameters(), 9);
            convertArgument<P10>(args, newargs, getParameters(), 10);
            convertArgument<P11>(args, newargs, getParameters(), 11);
            convertArgument<P12>(args, newargs, getParameters(), 12);
            convertArgument<P13>(args, newargs, getParameters(), 13);
            convertArgument<P14>(args, newargs, getParameters(), 14);
            convertArgument<P15>(args, newargs, getParameters(), 15);

            return IC::template create<P0, P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15>(newargs[0], newargs[1], newargs[2], newargs[3], newargs[4], newargs[5], newargs[6], newargs[7], newargs[8], newargs[9], newargs[10], newargs[11], newargs[12], newargs[13], newargs[14], newargs[15]);
        }

    };

}

#endif

