cgv
Loading...
Searching...
No Matches
cgv::utils::csv_matrix_reader Class Reference

csv reader for parsing matrices of a homogenous number type More...

#include <csv_reader.h>

Inheritance diagram for cgv::utils::csv_matrix_reader:
cgv::utils::csv_reader_base

Public Member Functions

 csv_matrix_reader (const std::string &file_name, CSV_Flags _flags=CSV_SPACE)
 construct from csv file with flags defaulting to use of space as separator
 
template<typename T >
bool parse_matrix (std::vector< std::vector< T > > &matrix, T init=T(0))
 parse matrix into nested vector struct and initialize entries to given init value (only rectangular matrices supported)
 
template<typename T , unsigned N>
bool parse_matrix (std::vector< cgv::math::fvec< T, N > > &matrix, T init=T(0))
 parse matrix into nested vector struct and initialize entries to given init value (only rectangular matrices supported)
 
- Public Member Functions inherited from cgv::utils::csv_reader_base
bool fail () const
 

Additional Inherited Members

- Protected Member Functions inherited from cgv::utils::csv_reader_base
const char * get_ws () const
 
const char * get_sep () const
 
bool has_heading () const
 
bool find_column_index (const std::string &col_name, size_t &col_index) const
 
 csv_reader_base (const std::string &file_name, CSV_Flags _flags=CSV_DEFAULT)
 
bool parse_next_line (std::vector< cgv::utils::token > &tokens) const
 
- Protected Attributes inherited from cgv::utils::csv_reader_base
std::string last_error
 
bool failed = false
 
size_t li = 0
 
size_t nr_cols = 0
 
CSV_Flags flags
 
std::string content
 
std::vector< std::string > col_names
 
std::vector< cgv::utils::linelines
 

Detailed Description

csv reader for parsing matrices of a homogenous number type

Definition at line 50 of file csv_reader.h.

Constructor & Destructor Documentation

◆ csv_matrix_reader()

cgv::utils::csv_matrix_reader::csv_matrix_reader ( const std::string &  file_name,
CSV_Flags  _flags = CSV_SPACE 
)
inline

construct from csv file with flags defaulting to use of space as separator

Definition at line 54 of file csv_reader.h.

Member Function Documentation

◆ parse_matrix() [1/2]

template<typename T , unsigned N>
bool cgv::utils::csv_matrix_reader::parse_matrix ( std::vector< cgv::math::fvec< T, N > > &  matrix,
init = T(0) 
)
inline

parse matrix into nested vector struct and initialize entries to given init value (only rectangular matrices supported)

Definition at line 69 of file csv_reader.h.

References cgv::utils::from_string(), and cgv::utils::to_string().

◆ parse_matrix() [2/2]

template<typename T >
bool cgv::utils::csv_matrix_reader::parse_matrix ( std::vector< std::vector< T > > &  matrix,
init = T(0) 
)
inline

parse matrix into nested vector struct and initialize entries to given init value (only rectangular matrices supported)

Definition at line 57 of file csv_reader.h.

References cgv::utils::from_string(), and cgv::utils::to_string().


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