35static std::vector<std::string>
36split(
const std::string &str,
char delim)
38 std::vector<std::string> result;
39 std::stringstream ss(str);
42 while (getline(ss, item, delim)) {
43 result.emplace_back(item);
52 std::ifstream handle(filename, std::ios::in);
54 throw std::domain_error(
"Can not open file");
58 while (std::getline(handle, line)) {
59 std::vector<std::string> values =
split(line,
'\t');
60 if (values.size() == 0)
68 }
else if (dm.
d != values.size())
69 throw std::length_error(
"Row length mismatch");
70 for (
auto &&value : values)
71 dm.
data.emplace_back(std::stof(value));
76 throw std::domain_error(
"File contained no data!");
Storage of data from loaded input file.
std::vector< std::string > names
Names of the dimensions.
std::vector< float > data
One-dimensional array storing d-dimensional input data in row-major order.
static std::vector< std::string > split(const std::string &str, char delim)
Splits a given string into words by a given delimiter.
void parse_TSV(const std::string &filename, DataModel &dm)
Parses FCS file and fills DataModel data.