Inviwo 0.9.12-pre
Inviwo documentation
Loading...
Searching...
No Matches
inviwo::DataReader Class Referenceabstract

A abstract base class for all file readers. More...

#include <datareader.h>

+ Inheritance diagram for inviwo::DataReader:

Public Member Functions

 DataReader (const DataReader &rhs)=default
 
 DataReader (DataReader &&rhs) noexcept=default
 
DataReaderoperator= (const DataReader &that)=default
 
DataReaderoperator= (DataReader &&that) noexcept=default
 
virtual DataReaderclone () const =0
 
const std::vector< FileExtension > & getExtensions () const
 
void addExtension (FileExtension ext)
 
virtual bool setOption (std::string_view key, std::any value)
 Set reader specific options See the documentation of the specific reader for the available options.
 
virtual std::any getOption (std::string_view key)
 Query the value of an reader specific option.
 

Protected Member Functions

void checkExists (const std::filesystem::path &path) const
 
std::ifstream open (const std::filesystem::path &path, std::ios_base::openmode mode=std::ios_base::in) const
 

Protected Attributes

std::vector< FileExtensionextensions_
 

Detailed Description

A abstract base class for all file readers.

See also
DataReaderFactory InviwoApplication::getDataReaderFactory

Member Function Documentation

◆ checkExists()

void inviwo::DataReader::checkExists ( const std::filesystem::path & path) const
protected

Verify that path exists, and throw DataReaderException if not.

Exceptions
DataReaderExceptionif the file is not found

◆ getOption()

virtual std::any inviwo::DataReader::getOption ( std::string_view key)
inlinevirtual

Query the value of an reader specific option.

Parameters
keythe option to query
Returns
an std::any with the requested option or an empty std::any if the option was not found

Reimplemented in inviwo::AssimpReader, and inviwo::CSVReader.

◆ open()

std::ifstream inviwo::DataReader::open ( const std::filesystem::path & path,
std::ios_base::openmode mode = std::ios_base::in ) const
protected

Open path in mode for reading. If the file is not found or the file can't be opened an exception is thrown.

Exceptions
DataReaderExceptionif the file is not found, and FileException if the file can't be opened.

◆ setOption()

virtual bool inviwo::DataReader::setOption ( std::string_view key,
std::any value )
inlinevirtual

Set reader specific options See the documentation of the specific reader for the available options.

Parameters
keythe option to set
valuethe new value for the option
Returns
true if the option was recognized and set, otherwise false

Reimplemented in inviwo::AssimpReader, and inviwo::CSVReader.


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