My Project
|
00001 00008 #ifndef MYTOOLS_H 00009 #define MYTOOLS_H 00010 00011 #include <cstdlib> 00012 #include <vector> 00013 #include <limits> 00014 #include <string> 00015 #include <cmath> 00016 #include <set> 00017 #include <map> 00018 #include <iostream> 00019 #include <algorithm> 00020 #include <fstream> 00021 00022 #include "boost/tuple/tuple.hpp" 00023 #include "boost/tuple/tuple_comparison.hpp" 00024 #include "boost/tuple/tuple_io.hpp" 00025 #include "boost/algorithm/string.hpp" 00026 #include "boost/lexical_cast.hpp" 00027 00028 using namespace std; 00029 typedef long unsigned int lui; 00030 typedef short unsigned int sui; 00031 00032 bool openFile(ifstream* fin, string filename); 00033 const std::string trim(const std::string& pString, 00034 const std::string& pWhitespace = " \n\r"); 00035 bool fline_tr(ifstream* fin, vector<string>* fields, string delim = " "); 00036 map < string, vector < string > > getParameters(int argc, char** input); 00037 int lineCount(string filename); 00045 template <typename T, typename R> 00046 00047 void WriteMap(map <T, R>* IDs, string fileOut){ 00048 typename map <T, R>::iterator it_id; 00049 ofstream fout(fileOut.c_str()); 00050 00051 fout << "Original String : ID" << endl; 00052 00053 for (it_id = IDs->begin(); it_id != IDs->end(); it_id++){ 00054 fout << it_id->first << ":" << it_id->second << endl; 00055 } 00056 } 00057 00058 #endif