00001 /************************************************************************** 00002 * Copyright (c) 2006-2011 T. M. Murali * 00003 * * 00004 * This file is part of Biorithm. * 00005 * * 00006 * Biorithm is free software: you can redistribute it and/or modify * 00007 * it under the terms of the GNU General Public License as published by * 00008 * the Free Software Foundation, either version 3 of the License, or * 00009 * (at your option) any later version. * 00010 * * 00011 * Biorithm is distributed in the hope that it will be useful, * 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00014 * GNU General Public License for more details. * 00015 * * 00016 * You should have received a copy of the GNU General Public License * 00017 * along with Biorithm. If not, see <http://www.gnu.org/licenses/>. * 00018 * * 00019 **************************************************************************/ 00020 00028 #ifndef _GLOBAL_H 00029 # define _GLOBAL_H 1 00030 00031 #include<sstream> 00032 #include<string> 00033 using namespace std; 00034 00035 //functions for converting integers to strings or the reverse 00036 //simple, useful 00037 string itoa(int in) 00038 { 00039 stringstream ss; 00040 ss<<in; 00041 return ss.str(); 00042 } 00043 template <class T> string toa(T in) 00044 { 00045 stringstream ss; 00046 ss<<in; 00047 return ss.str(); 00048 } 00049 int atoi(string in) 00050 { 00051 stringstream ss; 00052 ss<<in; 00053 int out; 00054 ss>>out; 00055 return out; 00056 } 00057 00058 #endif