26 #include <boost/algorithm/string.hpp>
27 #include <boost/regex.hpp>
32 #include "boost/lexical_cast.hpp"
40 using boost::regex_match;
52 if (dataset_name ==
"") {
58 while (line.empty() && sfile.
good()) {
63 boost::smatch s_match;
64 if (boost::regex_match(line, s_match, expression)) {
65 dataset_name = s_match[1].str();
86 std::string reg_ex_str =
"^\\s*#\\s*" + key_word +
"\\s*:\\s*(.+)\\s*$";
87 boost::regex expression(reg_ex_str);
89 while (sfile.
good()) {
91 boost::smatch s_match;
92 if (!line.empty() && boost::regex_match(line, s_match, expression)) {
115 auto table =
Table::AsciiReader{sfile}.fixColumnTypes({
typeid(double),
typeid(
double)}).read();
118 for (
auto row : table) {
128 bool is_a_dataset_file =
false;
135 boost::regex expression(
"\\s*#.*");
136 boost::smatch s_match;
137 while ((line.empty() || boost::regex_match(line, s_match, expression)) && sfile.
good()) {
146 ss >> d1 >> d2 >> empty_string;
147 boost::lexical_cast<
double>(d1);
148 boost::lexical_cast<
double>(d2);
149 if (!empty_string.empty()) {
150 is_a_dataset_file =
false;
152 is_a_dataset_file =
true;
155 is_a_dataset_file =
false;
159 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...