1 #ifndef _HELIOS_FILEMS_DESIGN_MATRIX_READER_H_
2 #define _HELIOS_FILEMS_DESIGN_MATRIX_READER_H_
4 #include <filems/read/comps/BufferedLineFileReader.h>
7 #include <unordered_map>
9 namespace fluxionum {
template <
typename VarType>
class DesignMatrix;}
11 namespace helios {
namespace filems{
14 using std::unordered_map;
43 template <
typename VarType>
74 string const &
sep =
",",
75 string const &
com =
"#",
76 long const maxCharsPerLine = 8192,
77 size_t const bufferSize = 100000
99 unordered_map<string, string> *keyval =
nullptr
118 vector<string> &header,
119 unordered_map<string, string> *keyval
131 size_t const nonEmptyIdx,
132 vector<VarType> &values
167 size_t const colonIdx,
182 #include <filems/read/core/DesignMatrixReader.tpp>
Definition: BufferedLineFileReader.h:9
Class to read design matrices.
Definition: DesignMatrixReader.h:44
virtual void parseComment(string const &str, size_t const comIdx, vector< string > &header, unordered_map< string, string > *keyval)
Parse a comment line.
virtual void parseColumnNames(string const &val, vector< string > &header)
Parse the list of inline column names.
string com
The comment string token . Any line which first non space and non tab substring matches the comment s...
Definition: DesignMatrixReader.h:60
DesignMatrixReader(string const &path, string const &sep=",", string const &com="#", long const maxCharsPerLine=8192, size_t const bufferSize=100000)
Default constructor for DesignMatrixReader.
Definition: DesignMatrixReader.h:72
BufferedLineFileReader br
The buffered line file reader to read the design matrix.
Definition: DesignMatrixReader.h:51
virtual void parseRow(string const &str, size_t const nonEmptyIdx, vector< VarType > &values)
Parse a row.
virtual bool isSpecComment(string const &str, size_t &colonIdx)
Check whether the comment string is a specification comment or not.
string sep
The field separator.
Definition: DesignMatrixReader.h:55
virtual fluxionum::DesignMatrix< VarType > read(unordered_map< string, string > *keyval=nullptr)
Read the design matrix.
virtual void extractSpecCommentKeyValue(string const &str, size_t const comIdx, size_t const colonIdx, string &key, string &val)
Extract the key and value from given string representing a specification comment.