ADTF
Loading...
Searching...
No Matches
a_util::parser::CSVReader Class Reference

#include <csv_reader.h>

Public Member Functions

void readFile (const std::string &filename, char delimiter)
 
std::vector< std::vector< std::string > > getData ()
 
std::vector< std::string > getColumn (size_t column_number)
 
std::vector< std::string > getRow (size_t row_number)
 
std::string getElement (size_t column_number, size_t row_number)
 

Detailed Description

Read, store and retrieve data from a comma separated value file (csv)

Member Function Documentation

◆ getColumn()

std::vector< std::string > a_util::parser::CSVReader::getColumn ( size_t column_number)

Get the contents of the column identified by column_number

Parameters
[in]column_numberNumber of the column, first column being 0
Returns
Data of the entire column.

◆ getData()

std::vector< std::vector< std::string > > a_util::parser::CSVReader::getData ( )

Get data from csv file as a vector of string vectors

Returns
The data, organized in a 2 dimensional vector (first index is the row, second index the column)

◆ getElement()

std::string a_util::parser::CSVReader::getElement ( size_t column_number,
size_t row_number )

Get the content of a cell, identified by column_number and row_number

Parameters
[in]column_numberNumber of the column, first column being 0
[in]row_numberNumber of the row, first row being 0
Returns
Content of the specified cell

◆ getRow()

std::vector< std::string > a_util::parser::CSVReader::getRow ( size_t row_number)

Get the contents of the row identified by row_number

Parameters
[in]row_numberNumber of the row, first row being 0
Returns
Data of the entire row

◆ readFile()

void a_util::parser::CSVReader::readFile ( const std::string & filename,
char delimiter )

Read data from a csv file and internally store it in a vector of string vectors

Parameters
[in]filenameFull path to the file
[in]delimiterThe delimiter separating the data cells (';' or ',' and '
')

The documentation for this class was generated from the following file: