# ifndef PARSEEXCELPARAM_H
# define PARSEEXCELPARAM_H

#include "../ExcelDoNotEdit/excel_addin_utils.h"
#include "PackAndUnpackOpers.h"
#include <typeinfo>

namespace ParseExcelParameter
{

	void parse(XLOPER12* excelInput, int argnumber, std::string* cppInput);


	void parse(XLOPER12* excelInput, int argnumber, int* cppInput);


	void parse(XLOPER12* excelInput, int argnumber, double* cppInput);


	void parse(XLOPER12* excelInput, int argnumber, excel_adapter::d_vector* cppInput);


	void parse(XLOPER12* excelInput, int argnumber, excel_adapter::d_matrix* cppInput);

  // base case
	template <typename T>
	void parse(std::vector<XLOPER12*>& in_opers, int argnumber, T* argptr)
	{
		parse(in_opers[argnumber], argnumber + 1, argptr);
	}

	template <typename T, typename... ArgTypes>
	void parse(std::vector<XLOPER12*>& in_opers, int argnumber, T* argptr, ArgTypes*... params)
	{
		// unpack this element
		parse(in_opers[argnumber], argnumber + 1, argptr);

		// recursion for the rest of elements
		parse(in_opers, ++argnumber, params...);
	}

	template <typename... ArgTypes>
	void parse(std::vector<XLOPER12*>& in_opers, ArgTypes*... params)
	{
		parse(in_opers, 0, params...);
	}

	void pack(int* cppOutput, XLOPER12* excelOutput);

	void pack(double* cppOutput, XLOPER12* excelOutput);

	void pack(const excel_adapter::d_vector* cppOutput, XLOPER12* excelOutput);

	void pack(const excel_adapter::d_matrix* cppOutput, XLOPER12* excelOutput);

};

#endif
