25 std::ifstream in(filename.c_str(), std::ios::binary);
28 std::ostringstream errmsg;
29 errmsg <<
"Failed to read file '"<< filename <<
"'. Check if file exists.";
33 while(std::getline(in, line))
35 if (line[0] ==
'#')
continue;
36 std::stringstream ss(line);
42 if ( i+1 >
data.size() )
data.resize(i+1);
43 data[i].push_back(tmp);
54 if ( (
int) names.size() ==
ncol )
57 for (
auto it = names.begin(); it != names.end(); it++)
65 std::cout <<
"Warning in ASCIItableReader: Column number incompatible." << std::endl;
EXPORT_SYMBOLS error & utils_error()
Utility errors.
void setcolnames(std::vector< std::string > names)
Simple reader for ASCII tables.
std::map< std::string, int > colnames
std::vector< std::vector< double > > data
int read(std::string filename)
TODO: see if we can use this one: