Inviwo
0.9.10.1
Inviwo documentation
|
A reader for comma separated value (CSV) files with customizable delimiters. The default delimiter is ',' and headers are included. More...
#include <csvreader.h>
Public Member Functions | |
CSVReader (const CSVReader &)=default | |
CSVReader (CSVReader &&) noexcept=default | |
CSVReader & | operator= (const CSVReader &)=default |
CSVReader & | operator= (CSVReader &&) noexcept=default |
virtual CSVReader * | clone () const override |
void | setDelimiters (const std::string &delim) |
void | setFirstRowHeader (bool hasHeader) |
virtual std::shared_ptr< DataFrame > | readData (const std::string &fileName) override |
std::shared_ptr< DataFrame > | readData (std::istream &stream) const |
Public Member Functions inherited from inviwo::DataReaderType< DataFrame > | |
DataReaderType (const DataReaderType &rhs)=default | |
DataReaderType (DataReaderType &&rhs) noexcept=default | |
DataReaderType & | operator= (const DataReaderType &that)=default |
DataReaderType & | operator= (DataReaderType &&that) noexcept=default |
virtual std::shared_ptr< DataFrame > | readData (const std::string &filePath, MetaDataOwner *) |
Public Member Functions inherited from inviwo::DataReader | |
DataReader (const DataReader &rhs)=default | |
DataReader (DataReader &&rhs) noexcept=default | |
DataReader & | operator= (const DataReader &that)=default |
DataReader & | operator= (DataReader &&that) noexcept=default |
const std::vector< FileExtension > & | getExtensions () const |
void | addExtension (FileExtension ext) |
A reader for comma separated value (CSV) files with customizable delimiters. The default delimiter is ',' and headers are included.
|
overridevirtual |
read a CSV file from a file
fileName | name of the input CSV file |
FileException | if the file cannot be accessed |
CSVDataReaderException | if the file contains no data, the first row should hold column headers, but they cannot be found, or if there are unmatched quotes at the end of the file |
Implements inviwo::DataReaderType< DataFrame >.
std::shared_ptr< DataFrame > inviwo::CSVReader::readData | ( | std::istream & | stream | ) | const |
read a CSV file from a input stream, e.g. a std::ifstream. In case file streams are used, the file must have be opened prior calling this function.
stream | input stream with the CSV data |
CSVDataReaderException | if the given stream is in a bad state, the stream contains no data, the first row should hold column headers, but they cannot be found, or if there are unmateched quotes at the end of the stream |