Reads data from a csv file into an std::vector
and writes the contents of an std::vector
to a file.
More...
#include <csv_parser.h>
|
template<typename T > |
void | parseToVector (std::string filename, std::vector< T > &data) |
| parses the contents of file_name into data . More...
|
|
template<typename T > |
void | write (const std::string &filename, const std::vector< std::vector< T > > &data, unsigned int precision, const std::string &delimiter) |
|
Reads data from a csv file into an std::vector
and writes the contents of an std::vector
to a file.
- Note
- The parser assumes the data is comma delimited when reading data from a file.
template<typename T >
void fea::CSVParser::parseToVector |
( |
std::string |
filename, |
|
|
std::vector< T > & |
data |
|
) |
| |
|
inline |
parses the contents of file_name
into data
.
- Parameters
-
[in] | file_name | std::string . The file specified is opened and the contained information is parsed into data . |
| data | std::vector<T> . Variable updated in place that will fold the data of the specified file. |
template<typename T >
void fea::CSVParser::write |
( |
const std::string & |
filename, |
|
|
const std::vector< std::vector< T > > & |
data, |
|
|
unsigned int |
precision, |
|
|
const std::string & |
delimiter |
|
) |
| |
|
inline |
Writes the 2D vector data
to the file specified by filename
.
- Parameters
-
[in] | filename | std::string . The file to write data to. |
[in] | data | std::vector< std::vector< T > > . Data to write to file. |
[in] | precision | unsigned int . The number of decimal places to use when writing the data to file. |
[in] | demlimiter | std::string . The delimiter to use between data entries. |
The documentation for this class was generated from the following file: