/******************************************************************************************
> [KAZOE]                                                                                 <
> Initial Sofware by [Yannick Verdie, Florent Lafarge], Copyright (C) Inria (GEOMETRICA)  <
> All Rights Reserved, 2012, [Version 1.0].                                               <
******************************************************************************************/
#include "CPU_common_header.h"


void Tokenize(const string& mystring, vector<string>& tok, const string& sep, int lp, int p)
{
		lp = mystring.find_first_not_of(sep, p);
		p = mystring.find_first_of(sep, lp);
		if (string::npos != p || string::npos != lp) 
		{
			tok.push_back(mystring.substr(lp, p - lp));
			Tokenize(mystring, tok, sep, lp, p);
		}
}

 template <class T> T sToT(string text)
{
	stringstream temp_ss (stringstream::in | stringstream::out);
	temp_ss.setf(ios::fixed, ios::floatfield);
	T temp;
	temp_ss<<text;
	temp_ss>>temp;

	return temp;
}

  string delSpaces(string &str) 
{
   stringstream trim;
   trim << str;
   trim >> str;

   return str;
}


  // explicit instantiations
 template int sToT<int>(string text);
 template float sToT<float>(string text);
 template unsigned char sToT<unsigned char>(string text);
 template string sToT<string>(string text);

