26 #include <boost/regex.hpp>
27 #include <boost/algorithm/string.hpp>
32 #include "boost/lexical_cast.hpp"
40 using boost::regex_match;
60 while (line.empty() && sfile.
good()) {
65 boost::smatch s_match;
66 if (boost::regex_match(line, s_match, expression)) {
67 dataset_name = s_match[1].str();
89 std::string reg_ex_str =
"^\\s*#\\s*" + key_word +
"\\s+(\\w+)\\s*$";
90 boost::regex expression(reg_ex_str);
92 while (sfile.
good()) {
94 boost::smatch s_match;
95 if (!line.empty() && boost::regex_match(line, s_match, expression)) {
97 size_t start_position = line.find(key_word)+key_word.
length();
98 value = line.substr (start_position);
116 auto table =
Table::AsciiReader{sfile}.fixColumnTypes({
typeid(double),
typeid(
double)}).read();
119 for (
auto row : table) {
129 bool is_a_dataset_file =
false;
136 boost::regex expression(
"\\s*#.*");
137 boost::smatch s_match;
138 while ((line.empty() || boost::regex_match(line, s_match, expression)) && sfile.
good()) {
147 ss >> d1 >> d2 >> empty_string;
148 boost::lexical_cast<
double>(d1);
149 boost::lexical_cast<
double>(d2);
150 if (!empty_string.empty()){
151 is_a_dataset_file =
false;
154 is_a_dataset_file =
true;
158 is_a_dataset_file =
false;
162 return is_a_dataset_file;
bool isDatasetFile(const std::string &file) override
Check that the ASCII file is a dataset file(with at least one line with 2 double values) ...
std::string removeAllBeforeLastSlash(const std::string &input_str)
std::string getName(const std::string &file) override
Get the dataset name of a ASCII file.
std::unique_ptr< XYDataset > getDataset(const std::string &file) override
Get a XYDataset object reading data from an ASCII file.
TableReader implementation for reading ASCII tables from streams.
std::string getParameter(const std::string &file, const std::string &key_word) override
Get the parameter identified by a given key_word value from a file.
std::string removeExtension(const std::string &input_str)
This module provides an interface for accessing two dimensional datasets (pairs of (X...