BioDynaMo  v1.03.58-27764645
Public Member Functions | Private Attributes | List of all members
bdm::CSVReader Class Reference

Reads in a CSV file using rapidcsv. More...

#include <csv_reader.h>

Collaboration diagram for bdm::CSVReader:
[legend]

Public Member Functions

 CSVReader (const std::string &file, int skip=0)
 
template<typename T >
std::vector< T > GetColumn (const std::string &column_name)
 
template<typename T >
GetCell (size_t col, size_t row)
 
std::string GetColumnName (size_t idx)
 
std::vector< std::string > GetColumnNames ()
 
size_t GetColumnCount ()
 
size_t GetRowCount ()
 
size_t GetNumEntries (const std::string &column_name)
 
template<typename T = float, typename Lambda >
void ForEachEntryInColumn (const std::string &column_name, Lambda lambda)
 
void Print ()
 

Private Attributes

std::string filename_
 
size_t num_rows_ = 0
 
size_t num_cols_ = 0
 
rapidcsv::Document doc_
 
std::vector< bool > bad_entries_
 

Detailed Description

Reads in a CSV file using rapidcsv.

Definition at line 31 of file csv_reader.h.

Constructor & Destructor Documentation

◆ CSVReader()

bdm::CSVReader::CSVReader ( const std::string &  file,
int  skip = 0 
)
inlineexplicit

Definition at line 33 of file csv_reader.h.

Member Function Documentation

◆ ForEachEntryInColumn()

template<typename T = float, typename Lambda >
void bdm::CSVReader::ForEachEntryInColumn ( const std::string &  column_name,
Lambda  lambda 
)
inline

Definition at line 71 of file csv_reader.h.

◆ GetCell()

template<typename T >
T bdm::CSVReader::GetCell ( size_t  col,
size_t  row 
)
inline

Definition at line 53 of file csv_reader.h.

◆ GetColumn()

template<typename T >
std::vector<T> bdm::CSVReader::GetColumn ( const std::string &  column_name)
inline

Definition at line 48 of file csv_reader.h.

◆ GetColumnCount()

size_t bdm::CSVReader::GetColumnCount ( )
inline

Definition at line 60 of file csv_reader.h.

◆ GetColumnName()

std::string bdm::CSVReader::GetColumnName ( size_t  idx)
inline

Definition at line 57 of file csv_reader.h.

◆ GetColumnNames()

std::vector<std::string> bdm::CSVReader::GetColumnNames ( )
inline

Definition at line 58 of file csv_reader.h.

◆ GetNumEntries()

size_t bdm::CSVReader::GetNumEntries ( const std::string &  column_name)
inline

Definition at line 64 of file csv_reader.h.

◆ GetRowCount()

size_t bdm::CSVReader::GetRowCount ( )
inline

Definition at line 62 of file csv_reader.h.

◆ Print()

void bdm::CSVReader::Print ( )
inline

Definition at line 79 of file csv_reader.h.

Member Data Documentation

◆ bad_entries_

std::vector<bool> bdm::CSVReader::bad_entries_
private

Definition at line 94 of file csv_reader.h.

◆ doc_

rapidcsv::Document bdm::CSVReader::doc_
private

Definition at line 92 of file csv_reader.h.

◆ filename_

std::string bdm::CSVReader::filename_
private

Definition at line 89 of file csv_reader.h.

◆ num_cols_

size_t bdm::CSVReader::num_cols_ = 0
private

Definition at line 91 of file csv_reader.h.

◆ num_rows_

size_t bdm::CSVReader::num_rows_ = 0
private

Definition at line 90 of file csv_reader.h.


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