bool readFile(vv::Matrix& matrixToFill) { clearFileStream(); filestream = new std::ifstream(file_path.c_str()); if (not filestream->good() or not filestream->is_open()) { throw vu::ArgError(vle::fmt("vle.reader: fails to topen %1% ") % file_path); } matrixToFill.clear(); //read the first line to get the number of columns std::string line; std::getline(*filestream, line); std::vector<std::string> strs; boost::split(strs,line,boost::is_any_of("\t")); //build parser parameter vle_reader_params p; p.separator.assign("\t"); for (unsigned int i=0; i < strs.size(); i++) { if (not strs[i].empty()) { p.col_types.push_back(vv::Value::DOUBLE); } } TFR_matrix_tofill tofill(p, matrixToFill); matrixToFill.addRow(); for (unsigned int i=0; i < strs.size(); i++) { if (not strs[i].empty()) { boost::replace_all(strs[i], "\"", ""); boost::replace_all(strs[i], "#", ""); matrixToFill.set(i,0, new vv::String(strs[i])); } } TFR_line_grammar g(p, tofill); tofill.nextRow(); do { parseLine(g,line); tofill.nextRow(); } while (not filestream->eof() and filestream->good()); clearFileStream(); return true; }