
#ifndef HEADER_PSYCHLOPS_DATA_MISC
#define HEADER_PSYCHLOPS_DATA_MISC

#include <fstream>
#include <string>
#include <map>
#include <vector>

#include "../ApplicationInterfaces/psychlops_app.h"
#include "../Devices/psychlops_io_file.h"
#include "../Graphic/psychlops_graphic.h"


namespace Psychlops {

	class Data;

	class Data_DUMMY2_{};
	void operator >>(std::istream &a, Data_DUMMY2_ &b);

	class Data {

		public:
		static std::map<const char*, double> number;


		private:
		enum DUMMY_ {nullpo};
		static DUMMY_ *_tmp;
		//typedef unsigned short Data_DUMMY2_;
		static Data_DUMMY2_ *dummy2_;
		static const int prohibitedcnt = 11;
		static char * prohibited[prohibitedcnt];

		template <class X0, class X1, class X2, class X3, class X4, class X5, class X6, class X7, class X8, class X9, class X10, class X11, class X12, class X13, class X14, class X15, class X16, class X17, class X18, class X19>
		static void _savearray(char *filename, char *header, int length, X0 arg0, X1 arg1, X2 arg2, X3 arg3, X4 arg4, X5 arg5, X6 arg6, X7 arg7, X8 arg8, X9 arg9, X10 arg10, X11 arg11, X12 arg12, X13 arg13, X14 arg14, X15 arg15, X16 arg16, X17 arg17, X18 arg18, X19 arg19) {
			bool c0=false,c1=false,c2=false,c3=false,c4=false,c5=false,c6=false,c7=false,c8=false,c9=false,c10=false,c11=false,c12=false,c13=false,c14=false,c15=false,c16=false,c17=false,c18=false,c19=false;
			if(typeid(arg0)!=typeid(_tmp)) c0=true;
			if(typeid(arg1)!=typeid(_tmp)) c1=true;
			if(typeid(arg2)!=typeid(_tmp)) c2=true;
			if(typeid(arg3)!=typeid(_tmp)) c3=true;
			if(typeid(arg4)!=typeid(_tmp)) c4=true;
			if(typeid(arg5)!=typeid(_tmp)) c5=true;
			if(typeid(arg6)!=typeid(_tmp)) c6=true;
			if(typeid(arg7)!=typeid(_tmp)) c7=true;
			if(typeid(arg8)!=typeid(_tmp)) c8=true;
			if(typeid(arg9)!=typeid(_tmp)) c9=true;
			if(typeid(arg10)!=typeid(_tmp)) c10=true;
			if(typeid(arg11)!=typeid(_tmp)) c11=true;
			if(typeid(arg12)!=typeid(_tmp)) c12=true;
			if(typeid(arg13)!=typeid(_tmp)) c13=true;
			if(typeid(arg14)!=typeid(_tmp)) c14=true;
			if(typeid(arg15)!=typeid(_tmp)) c15=true;
			if(typeid(arg16)!=typeid(_tmp)) c16=true;
			if(typeid(arg17)!=typeid(_tmp)) c17=true;
			if(typeid(arg18)!=typeid(_tmp)) c18=true;
			if(typeid(arg19)!=typeid(_tmp)) c19=true;
			//	filename
			std::string filenamechacker = File::decodePath(filename);

			//output
			std::ofstream outport;
			outport.open(filenamechacker.c_str());
//			if( outport.fail ) {
//					outport.open(File::decodePath("%USER_HOME%Saved_%TIME_.txt").c_str());
//				} catch(std::exception e) {
//					throw Exception(typeid(Data), "", "Failed to save array(s).");
//				}
//			}
/*			try {
				outport.open(filenamechacker.c_str());
			} catch(std::exception e) {
				try {
					outport.open(File::decodePath("%USER_HOME%Saved_%TIME_.txt").c_str());
				} catch(std::exception e) {
					throw Exception(typeid(Data), "", "Failed to save array(s).");
				}
			}
*/
			outport << AppInfo::expname << std::endl;
			outport << header << std::endl;
			for(int i=0;i<length;i++) {
				if(c0) { outport << arg0[i]; }
				if(c1) { outport << delimiter << arg1[i]; }
				if(c2) { outport << delimiter << arg2[i]; }
				if(c3) { outport << delimiter << arg3[i]; }
				if(c4) { outport << delimiter << arg4[i]; }
				if(c5) { outport << delimiter << arg5[i]; }
				if(c6) { outport << delimiter << arg6[i]; }
				if(c7) { outport << delimiter << arg7[i]; }
				if(c8) { outport << delimiter << arg8[i]; }
				if(c9) { outport << delimiter << arg9[i]; }
				if(c10) { outport << delimiter << arg10[i]; }
				if(c11) { outport << delimiter << arg11[i]; }
				if(c12) { outport << delimiter << arg12[i]; }
				if(c13) { outport << delimiter << arg13[i]; }
				if(c14) { outport << delimiter << arg14[i]; }
				if(c15) { outport << delimiter << arg15[i]; }
				if(c16) { outport << delimiter << arg16[i]; }
				if(c17) { outport << delimiter << arg17[i]; }
				if(c18) { outport << delimiter << arg18[i]; }
				if(c19) { outport << delimiter << arg19[i]; }
				outport << std::endl;
			}
			outport.close();
		}

		public:
		static char *delimiter;

		template <class X0>
		static void savearray(char *filename, char *header, int length, X0 arg0)
		{ _savearray(filename, header, length, arg0,_tmp,_tmp,_tmp,_tmp,_tmp,_tmp,_tmp,_tmp,_tmp,_tmp,_tmp,_tmp,_tmp,_tmp,_tmp,_tmp,_tmp,_tmp,_tmp); }
		template <class X0, class X1>
		static void savearray(char *filename, char *header, int length, X0 arg0, X1 arg1)
		{ _savearray(filename, header, length, arg0,arg1,_tmp,_tmp,_tmp,_tmp,_tmp,_tmp,_tmp,_tmp,_tmp,_tmp,_tmp,_tmp,_tmp,_tmp,_tmp,_tmp,_tmp,_tmp); }
		template <class X0, class X1, class X2>
		static void savearray(char *filename, char *header, int length, X0 arg0, X1 arg1, X2 arg2)
		{ _savearray(filename, header, length, arg0,arg1,arg2,_tmp,_tmp,_tmp,_tmp,_tmp,_tmp,_tmp,_tmp,_tmp,_tmp,_tmp,_tmp,_tmp,_tmp,_tmp,_tmp,_tmp); }
		template <class X0, class X1, class X2, class X3>
		static void savearray(char *filename, char *header, int length, X0 arg0, X1 arg1, X2 arg2, X3 arg3)
		{ _savearray(filename, header, length, arg0,arg1,arg2,arg3,_tmp,_tmp,_tmp,_tmp,_tmp,_tmp,_tmp,_tmp,_tmp,_tmp,_tmp,_tmp,_tmp,_tmp,_tmp,_tmp); }
		template <class X0, class X1, class X2, class X3, class X4>
		static void savearray(char *filename, char *header, int length, X0 arg0, X1 arg1, X2 arg2, X3 arg3, X4 arg4)
		{ _savearray(filename, header, length, arg0,arg1,arg2,arg3,arg4,_tmp,_tmp,_tmp,_tmp,_tmp,_tmp,_tmp,_tmp,_tmp,_tmp,_tmp,_tmp,_tmp,_tmp,_tmp); }
		template <class X0, class X1, class X2, class X3, class X4, class X5>
		static void savearray(char *filename, char *header, int length, X0 arg0, X1 arg1, X2 arg2, X3 arg3, X4 arg4, X5 arg5)
		{ _savearray(filename, header, length, arg0,arg1,arg2,arg3,arg4,arg5,_tmp,_tmp,_tmp,_tmp,_tmp,_tmp,_tmp,_tmp,_tmp,_tmp,_tmp,_tmp,_tmp,_tmp); }
		template <class X0, class X1, class X2, class X3, class X4, class X5, class X6>
		static void savearray(char *filename, char *header, int length, X0 arg0, X1 arg1, X2 arg2, X3 arg3, X4 arg4, X5 arg5, X6 arg6)
		{ _savearray(filename, header, length, arg0,arg1,arg2,arg3,arg4,arg5,arg6,_tmp,_tmp,_tmp,_tmp,_tmp,_tmp,_tmp,_tmp,_tmp,_tmp,_tmp,_tmp,_tmp); }
		template <class X0, class X1, class X2, class X3, class X4, class X5, class X6, class X7>
		static void savearray(char *filename, char *header, int length, X0 arg0, X1 arg1, X2 arg2, X3 arg3, X4 arg4, X5 arg5, X6 arg6, X7 arg7)
		{ _savearray(filename, header, length, arg0,arg1,arg2,arg3,arg4,arg5,arg6,arg7,_tmp,_tmp,_tmp,_tmp,_tmp,_tmp,_tmp,_tmp,_tmp,_tmp,_tmp,_tmp); }
		template <class X0, class X1, class X2, class X3, class X4, class X5, class X6, class X7, class X8>
		static void savearray(char *filename, char *header, int length, X0 arg0, X1 arg1, X2 arg2, X3 arg3, X4 arg4, X5 arg5, X6 arg6, X7 arg7, X8 arg8)
		{ _savearray(filename, header, length, arg0,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,_tmp,_tmp,_tmp,_tmp,_tmp,_tmp,_tmp,_tmp,_tmp,_tmp,_tmp); }
		template <class X0, class X1, class X2, class X3, class X4, class X5, class X6, class X7, class X8, class X9>
		static void savearray(char *filename, char *header, int length, X0 arg0, X1 arg1, X2 arg2, X3 arg3, X4 arg4, X5 arg5, X6 arg6, X7 arg7, X8 arg8, X9 arg9)
		{ _savearray(filename, header, length, arg0,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,_tmp,_tmp,_tmp,_tmp,_tmp,_tmp,_tmp,_tmp,_tmp,_tmp); }

		template <class X0, class X1, class X2, class X3, class X4, class X5, class X6, class X7, class X8, class X9, class X10>
		static void savearray(char *filename, char *header, int length, X0 arg0, X1 arg1, X2 arg2, X3 arg3, X4 arg4, X5 arg5, X6 arg6, X7 arg7, X8 arg8, X9 arg9, X10 arg10)
		{ _savearray(filename, header, length, arg0,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,_tmp,_tmp,_tmp,_tmp,_tmp,_tmp,_tmp,_tmp,_tmp); }
		template <class X0, class X1, class X2, class X3, class X4, class X5, class X6, class X7, class X8, class X9, class X10, class X11>
		static void savearray(char *filename, char *header, int length, X0 arg0, X1 arg1, X2 arg2, X3 arg3, X4 arg4, X5 arg5, X6 arg6, X7 arg7, X8 arg8, X9 arg9, X10 arg10, X11 arg11)
		{ _savearray(filename, header, length, arg0,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11,_tmp,_tmp,_tmp,_tmp,_tmp,_tmp,_tmp,_tmp); }
		template <class X0, class X1, class X2, class X3, class X4, class X5, class X6, class X7, class X8, class X9, class X10, class X11, class X12>
		static void savearray(char *filename, char *header, int length, X0 arg0, X1 arg1, X2 arg2, X3 arg3, X4 arg4, X5 arg5, X6 arg6, X7 arg7, X8 arg8, X9 arg9, X10 arg10, X11 arg11, X12 arg12)
		{ _savearray(filename, header, length, arg0,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11,arg12,_tmp,_tmp,_tmp,_tmp,_tmp,_tmp,_tmp); }
		template <class X0, class X1, class X2, class X3, class X4, class X5, class X6, class X7, class X8, class X9, class X10, class X11, class X12, class X13>
		static void savearray(char *filename, char *header, int length, X0 arg0, X1 arg1, X2 arg2, X3 arg3, X4 arg4, X5 arg5, X6 arg6, X7 arg7, X8 arg8, X9 arg9, X10 arg10, X11 arg11, X12 arg12, X13 arg13)
		{ _savearray(filename, header, length, arg0,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11,arg12,arg13,_tmp,_tmp,_tmp,_tmp,_tmp,_tmp); }
		template <class X0, class X1, class X2, class X3, class X4, class X5, class X6, class X7, class X8, class X9, class X10, class X11, class X12, class X13, class X14>
		static void savearray(char *filename, char *header, int length, X0 arg0, X1 arg1, X2 arg2, X3 arg3, X4 arg4, X5 arg5, X6 arg6, X7 arg7, X8 arg8, X9 arg9, X10 arg10, X11 arg11, X12 arg12, X13 arg13, X14 arg14)
		{ _savearray(filename, header, length, arg0,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11,arg12,arg13,arg14,_tmp,_tmp,_tmp,_tmp,_tmp); }
		template <class X0, class X1, class X2, class X3, class X4, class X5, class X6, class X7, class X8, class X9, class X10, class X11, class X12, class X13, class X14, class X15>
		static void savearray(char *filename, char *header, int length, X0 arg0, X1 arg1, X2 arg2, X3 arg3, X4 arg4, X5 arg5, X6 arg6, X7 arg7, X8 arg8, X9 arg9, X10 arg10, X11 arg11, X12 arg12, X13 arg13, X14 arg14, X15 arg15)
		{ _savearray(filename, header, length, arg0,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11,arg12,arg13,arg14,arg15,_tmp,_tmp,_tmp,_tmp); }
		template <class X0, class X1, class X2, class X3, class X4, class X5, class X6, class X7, class X8, class X9, class X10, class X11, class X12, class X13, class X14, class X15, class X16>
		static void savearray(char *filename, char *header, int length, X0 arg0, X1 arg1, X2 arg2, X3 arg3, X4 arg4, X5 arg5, X6 arg6, X7 arg7, X8 arg8, X9 arg9, X10 arg10, X11 arg11, X12 arg12, X13 arg13, X14 arg14, X15 arg15, X16 arg16)
		{ _savearray(filename, header, length, arg0,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11,arg12,arg13,arg14,arg15,arg16,_tmp,_tmp,_tmp); }
		template <class X0, class X1, class X2, class X3, class X4, class X5, class X6, class X7, class X8, class X9, class X10, class X11, class X12, class X13, class X14, class X15, class X16, class X17>
		static void savearray(char *filename, char *header, int length, X0 arg0, X1 arg1, X2 arg2, X3 arg3, X4 arg4, X5 arg5, X6 arg6, X7 arg7, X8 arg8, X9 arg9, X10 arg10, X11 arg11, X12 arg12, X13 arg13, X14 arg14, X15 arg15, X16 arg16, X17 arg17)
		{ _savearray(filename, header, length, arg0,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11,arg12,arg13,arg14,arg15,arg16,arg17,_tmp,_tmp); }
		template <class X0, class X1, class X2, class X3, class X4, class X5, class X6, class X7, class X8, class X9, class X10, class X11, class X12, class X13, class X14, class X15, class X16, class X17, class X18>
		static void savearray(char *filename, char *header, int length, X0 arg0, X1 arg1, X2 arg2, X3 arg3, X4 arg4, X5 arg5, X6 arg6, X7 arg7, X8 arg8, X9 arg9, X10 arg10, X11 arg11, X12 arg12, X13 arg13, X14 arg14, X15 arg15, X16 arg16, X17 arg17, X18 arg18)
		{ _savearray(filename, header, length, arg0,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11,arg12,arg13,arg14,arg15,arg16,arg17,arg18,_tmp); }
		template <class X0, class X1, class X2, class X3, class X4, class X5, class X6, class X7, class X8, class X9, class X10, class X11, class X12, class X13, class X14, class X15, class X16, class X17, class X18, class X19>
		static void savearray(char *filename, char *header, int length, X0 arg0, X1 arg1, X2 arg2, X3 arg3, X4 arg4, X5 arg5, X6 arg6, X7 arg7, X8 arg8, X9 arg9, X10 arg10, X11 arg11, X12 arg12, X13 arg13, X14 arg14, X15 arg15, X16 arg16, X17 arg17, X18 arg18, X19 arg19)
		{ _savearray(filename, header, length, arg0,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11,arg12,arg13,arg14,arg15,arg16,arg17,arg18,arg19); }

		static std::ofstream output;


		template <class X0, class X1, class X2, class X3, class X4, class X5, class X6, class X7, class X8, class X9, class X10, class X11, class X12, class X13, class X14, class X15, class X16, class X17, class X18, class X19>
		static void _loadarray(char *filename, int skip_lines, int length, X0 arg0, X1 arg1, X2 arg2, X3 arg3, X4 arg4, X5 arg5, X6 arg6, X7 arg7, X8 arg8, X9 arg9, X10 arg10, X11 arg11, X12 arg12, X13 arg13, X14 arg14, X15 arg15, X16 arg16, X17 arg17, X18 arg18, X19 arg19) {
			bool c0=false,c1=false,c2=false,c3=false,c4=false,c5=false,c6=false,c7=false,c8=false,c9=false,c10=false,c11=false,c12=false,c13=false,c14=false,c15=false,c16=false,c17=false,c18=false,c19=false;
			if(typeid(arg0)!=typeid(dummy2_)) c0=true;
			if(typeid(arg1)!=typeid(dummy2_)) c1=true;
			if(typeid(arg2)!=typeid(dummy2_)) c2=true;
			if(typeid(arg3)!=typeid(dummy2_)) c3=true;
			if(typeid(arg4)!=typeid(dummy2_)) c4=true;
			if(typeid(arg5)!=typeid(dummy2_)) c5=true;
			if(typeid(arg6)!=typeid(dummy2_)) c6=true;
			if(typeid(arg7)!=typeid(dummy2_)) c7=true;
			if(typeid(arg8)!=typeid(dummy2_)) c8=true;
			if(typeid(arg9)!=typeid(dummy2_)) c9=true;
			if(typeid(arg10)!=typeid(dummy2_)) c10=true;
			if(typeid(arg11)!=typeid(dummy2_)) c11=true;
			if(typeid(arg12)!=typeid(dummy2_)) c12=true;
			if(typeid(arg13)!=typeid(dummy2_)) c13=true;
			if(typeid(arg14)!=typeid(dummy2_)) c14=true;
			if(typeid(arg15)!=typeid(dummy2_)) c15=true;
			if(typeid(arg16)!=typeid(dummy2_)) c16=true;
			if(typeid(arg17)!=typeid(dummy2_)) c17=true;
			if(typeid(arg18)!=typeid(dummy2_)) c18=true;
			if(typeid(arg19)!=typeid(dummy2_)) c19=true;

			//	filename
			std::string filenamechacker = File::decodePath(filename);

			//input
			char buf[256];
			char delimiter;
			std::ifstream inport(filenamechacker.c_str());
			if( inport.fail() ) {
				throw Exception(typeid(Data), "", "Specified file is not found.");
			}
			for(int i=0; i<skip_lines; i++) inport.getline(buf,256);
			for(int i=0;i<length;i++) {
				if(c0) { inport >> arg0[i]; }
				if(c1) { inport >> arg1[i]; }
				if(c2) { inport >> arg2[i]; }
				if(c3) { inport >> arg3[i]; }
				if(c4) { inport >> arg4[i]; }
				if(c5) { inport >> arg5[i]; }
				if(c6) { inport >> arg6[i]; }
				if(c7) { inport >> arg7[i]; }
				if(c8) { inport >> arg8[i]; }
				if(c9) { inport >> arg9[i]; }
				if(c10) { inport >> arg10[i]; }
				if(c11) { inport >> arg11[i]; }
				if(c12) { inport >> arg12[i]; }
				if(c13) { inport >> arg13[i]; }
				if(c14) { inport >> arg14[i]; }
				if(c15) { inport >> arg15[i]; }
				if(c16) { inport >> arg16[i]; }
				if(c17) { inport >> arg17[i]; }
				if(c18) { inport >> arg18[i]; }
				if(c19) { inport >> arg19[i]; }
			}
			inport.close();
		}

		template <class X0>
		static void loadarray(char *filename, int skip_lines, int length, X0 arg0)
		{ _loadarray(filename, skip_lines, length, arg0,dummy2_,dummy2_,dummy2_,dummy2_,dummy2_,dummy2_,dummy2_,dummy2_,dummy2_,dummy2_,dummy2_,dummy2_,dummy2_,dummy2_,dummy2_,dummy2_,dummy2_,dummy2_,dummy2_); }
		template <class X0, class X1>
		static void loadarray(char *filename, int skip_lines, int length, X0 arg0, X1 arg1)
		{ _loadarray(filename, skip_lines, length, arg0,arg1,dummy2_,dummy2_,dummy2_,dummy2_,dummy2_,dummy2_,dummy2_,dummy2_,dummy2_,dummy2_,dummy2_,dummy2_,dummy2_,dummy2_,dummy2_,dummy2_,dummy2_,dummy2_); }
		template <class X0, class X1, class X2>
		static void loadarray(char *filename, int skip_lines, int length, X0 arg0, X1 arg1, X2 arg2)
		{ _loadarray(filename, skip_lines, length, arg0,arg1,arg2,dummy2_,dummy2_,dummy2_,dummy2_,dummy2_,dummy2_,dummy2_,dummy2_,dummy2_,dummy2_,dummy2_,dummy2_,dummy2_,dummy2_,dummy2_,dummy2_,dummy2_); }
		template <class X0, class X1, class X2, class X3>
		static void loadarray(char *filename, int skip_lines, int length, X0 arg0, X1 arg1, X2 arg2, X3 arg3)
		{ _loadarray(filename, skip_lines, length, arg0,arg1,arg2,arg3,dummy2_,dummy2_,dummy2_,dummy2_,dummy2_,dummy2_,dummy2_,dummy2_,dummy2_,dummy2_,dummy2_,dummy2_,dummy2_,dummy2_,dummy2_,dummy2_); }
		template <class X0, class X1, class X2, class X3, class X4>
		static void loadarray(char *filename, int skip_lines, int length, X0 arg0, X1 arg1, X2 arg2, X3 arg3, X4 arg4)
		{ _loadarray(filename, skip_lines, length, arg0,arg1,arg2,arg3,arg4,dummy2_,dummy2_,dummy2_,dummy2_,dummy2_,dummy2_,dummy2_,dummy2_,dummy2_,dummy2_,dummy2_,dummy2_,dummy2_,dummy2_,dummy2_); }
		template <class X0, class X1, class X2, class X3, class X4, class X5>
		static void loadarray(char *filename, int skip_lines, int length, X0 arg0, X1 arg1, X2 arg2, X3 arg3, X4 arg4, X5 arg5)
		{ _loadarray(filename, skip_lines, length, arg0,arg1,arg2,arg3,arg4,arg5,dummy2_,dummy2_,dummy2_,dummy2_,dummy2_,dummy2_,dummy2_,dummy2_,dummy2_,dummy2_,dummy2_,dummy2_,dummy2_,dummy2_); }
		template <class X0, class X1, class X2, class X3, class X4, class X5, class X6>
		static void loadarray(char *filename, int skip_lines, int length, X0 arg0, X1 arg1, X2 arg2, X3 arg3, X4 arg4, X5 arg5, X6 arg6)
		{ _loadarray(filename, skip_lines, length, arg0,arg1,arg2,arg3,arg4,arg5,arg6,dummy2_,dummy2_,dummy2_,dummy2_,dummy2_,dummy2_,dummy2_,dummy2_,dummy2_,dummy2_,dummy2_,dummy2_,dummy2_); }
		template <class X0, class X1, class X2, class X3, class X4, class X5, class X6, class X7>
		static void loadarray(char *filename, int skip_lines, int length, X0 arg0, X1 arg1, X2 arg2, X3 arg3, X4 arg4, X5 arg5, X6 arg6, X7 arg7)
		{ _loadarray(filename, skip_lines, length, arg0,arg1,arg2,arg3,arg4,arg5,arg6,arg7,dummy2_,dummy2_,dummy2_,dummy2_,dummy2_,dummy2_,dummy2_,dummy2_,dummy2_,dummy2_,dummy2_,dummy2_); }
		template <class X0, class X1, class X2, class X3, class X4, class X5, class X6, class X7, class X8>
		static void loadarray(char *filename, int skip_lines, int length, X0 arg0, X1 arg1, X2 arg2, X3 arg3, X4 arg4, X5 arg5, X6 arg6, X7 arg7, X8 arg8)
		{ _loadarray(filename, skip_lines, length, arg0,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,dummy2_,dummy2_,dummy2_,dummy2_,dummy2_,dummy2_,dummy2_,dummy2_,dummy2_,dummy2_,dummy2_); }
		template <class X0, class X1, class X2, class X3, class X4, class X5, class X6, class X7, class X8, class X9>
		static void loadarray(char *filename, int skip_lines, int length, X0 arg0, X1 arg1, X2 arg2, X3 arg3, X4 arg4, X5 arg5, X6 arg6, X7 arg7, X8 arg8, X9 arg9)
		{ _loadarray(filename, skip_lines, length, arg0,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,dummy2_,dummy2_,dummy2_,dummy2_,dummy2_,dummy2_,dummy2_,dummy2_,dummy2_,dummy2_); }

		template <class X0, class X1, class X2, class X3, class X4, class X5, class X6, class X7, class X8, class X9, class X10>
		static void loadarray(char *filename, int skip_lines, int length, X0 arg0, X1 arg1, X2 arg2, X3 arg3, X4 arg4, X5 arg5, X6 arg6, X7 arg7, X8 arg8, X9 arg9, X10 arg10)
		{ _loadarray(filename, skip_lines, length, arg0,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,dummy2_,dummy2_,dummy2_,dummy2_,dummy2_,dummy2_,dummy2_,dummy2_,dummy2_); }
		template <class X0, class X1, class X2, class X3, class X4, class X5, class X6, class X7, class X8, class X9, class X10, class X11>
		static void loadarray(char *filename, int skip_lines, int length, X0 arg0, X1 arg1, X2 arg2, X3 arg3, X4 arg4, X5 arg5, X6 arg6, X7 arg7, X8 arg8, X9 arg9, X10 arg10, X11 arg11)
		{ _loadarray(filename, skip_lines, length, arg0,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11,dummy2_,dummy2_,dummy2_,dummy2_,dummy2_,dummy2_,dummy2_,dummy2_); }
		template <class X0, class X1, class X2, class X3, class X4, class X5, class X6, class X7, class X8, class X9, class X10, class X11, class X12>
		static void loadarray(char *filename, int skip_lines, int length, X0 arg0, X1 arg1, X2 arg2, X3 arg3, X4 arg4, X5 arg5, X6 arg6, X7 arg7, X8 arg8, X9 arg9, X10 arg10, X11 arg11, X12 arg12)
		{ _loadarray(filename, skip_lines, length, arg0,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11,arg12,dummy2_,dummy2_,dummy2_,dummy2_,dummy2_,dummy2_,dummy2_); }
		template <class X0, class X1, class X2, class X3, class X4, class X5, class X6, class X7, class X8, class X9, class X10, class X11, class X12, class X13>
		static void loadarray(char *filename, int skip_lines, int length, X0 arg0, X1 arg1, X2 arg2, X3 arg3, X4 arg4, X5 arg5, X6 arg6, X7 arg7, X8 arg8, X9 arg9, X10 arg10, X11 arg11, X12 arg12, X13 arg13)
		{ _loadarray(filename, skip_lines, length, arg0,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11,arg12,arg13,dummy2_,dummy2_,dummy2_,dummy2_,dummy2_,dummy2_); }
		template <class X0, class X1, class X2, class X3, class X4, class X5, class X6, class X7, class X8, class X9, class X10, class X11, class X12, class X13, class X14>
		static void loadarray(char *filename, int skip_lines, int length, X0 arg0, X1 arg1, X2 arg2, X3 arg3, X4 arg4, X5 arg5, X6 arg6, X7 arg7, X8 arg8, X9 arg9, X10 arg10, X11 arg11, X12 arg12, X13 arg13, X14 arg14)
		{ _loadarray(filename, skip_lines, length, arg0,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11,arg12,arg13,arg14,dummy2_,dummy2_,dummy2_,dummy2_,dummy2_); }
		template <class X0, class X1, class X2, class X3, class X4, class X5, class X6, class X7, class X8, class X9, class X10, class X11, class X12, class X13, class X14, class X15>
		static void loadarray(char *filename, int skip_lines, int length, X0 arg0, X1 arg1, X2 arg2, X3 arg3, X4 arg4, X5 arg5, X6 arg6, X7 arg7, X8 arg8, X9 arg9, X10 arg10, X11 arg11, X12 arg12, X13 arg13, X14 arg14, X15 arg15)
		{ _loadarray(filename, skip_lines, length, arg0,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11,arg12,arg13,arg14,arg15,dummy2_,dummy2_,dummy2_,dummy2_); }
		template <class X0, class X1, class X2, class X3, class X4, class X5, class X6, class X7, class X8, class X9, class X10, class X11, class X12, class X13, class X14, class X15, class X16>
		static void loadarray(char *filename, int skip_lines, int length, X0 arg0, X1 arg1, X2 arg2, X3 arg3, X4 arg4, X5 arg5, X6 arg6, X7 arg7, X8 arg8, X9 arg9, X10 arg10, X11 arg11, X12 arg12, X13 arg13, X14 arg14, X15 arg15, X16 arg16)
		{ _loadarray(filename, skip_lines, length, arg0,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11,arg12,arg13,arg14,arg15,arg16,dummy2_,dummy2_,dummy2_); }
		template <class X0, class X1, class X2, class X3, class X4, class X5, class X6, class X7, class X8, class X9, class X10, class X11, class X12, class X13, class X14, class X15, class X16, class X17>
		static void loadarray(char *filename, int skip_lines, int length, X0 arg0, X1 arg1, X2 arg2, X3 arg3, X4 arg4, X5 arg5, X6 arg6, X7 arg7, X8 arg8, X9 arg9, X10 arg10, X11 arg11, X12 arg12, X13 arg13, X14 arg14, X15 arg15, X16 arg16, X17 arg17)
		{ _loadarray(filename, skip_lines, length, arg0,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11,arg12,arg13,arg14,arg15,arg16,arg17,dummy2_,dummy2_); }
		template <class X0, class X1, class X2, class X3, class X4, class X5, class X6, class X7, class X8, class X9, class X10, class X11, class X12, class X13, class X14, class X15, class X16, class X17, class X18>
		static void loadarray(char *filename, int skip_lines, int length, X0 arg0, X1 arg1, X2 arg2, X3 arg3, X4 arg4, X5 arg5, X6 arg6, X7 arg7, X8 arg8, X9 arg9, X10 arg10, X11 arg11, X12 arg12, X13 arg13, X14 arg14, X15 arg15, X16 arg16, X17 arg17, X18 arg18)
		{ _loadarray(filename, skip_lines, length, arg0,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11,arg12,arg13,arg14,arg15,arg16,arg17,arg18,dummy2_); }
		template <class X0, class X1, class X2, class X3, class X4, class X5, class X6, class X7, class X8, class X9, class X10, class X11, class X12, class X13, class X14, class X15, class X16, class X17, class X18, class X19>
		static void loadarray(char *filename, int skip_lines, int length, X0 arg0, X1 arg1, X2 arg2, X3 arg3, X4 arg4, X5 arg5, X6 arg6, X7 arg7, X8 arg8, X9 arg9, X10 arg10, X11 arg11, X12 arg12, X13 arg13, X14 arg14, X15 arg15, X16 arg16, X17 arg17, X18 arg18, X19 arg19)
		{ _loadarray(filename, skip_lines, length, arg0,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11,arg12,arg13,arg14,arg15,arg16,arg17,arg18,arg19); }



		static int loadCSVraw(const std::string& filename, std::vector<std::vector<std::string> >& lines);
		static int parseCSV(const std::string& csvSource, std::vector<std::vector<std::string> >& lines);

		static int loadCSV(const std::string& filename, double** data)
		{
			std::vector<std::vector<std::string> > lines;
			loadCSVraw(filename, lines);
			for(int i=0; i<lines.size(); i++) {
				for(int j=0; j<lines[i].size(); j++) {
					data[i][j] = atof( lines[i][j].c_str() );
				}
			}
		}
	};




}	/*	<- namespace Psycholops 	*/


#endif
