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

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

#include <datawriter.h>

+ Inheritance diagram for inviwo::DataWriter:

Public Member Functions

 DataWriter (const DataWriter &rhs)
 
DataWriteroperator= (const DataWriter &that)
 
 DataWriter (DataWriter &&rhs) noexcept=default
 
DataWriteroperator= (DataWriter &&that) noexcept=default
 
virtual DataWriterclone () const =0
 
const std::vector< FileExtension > & getExtensions () const
 
void addExtension (FileExtension ext)
 
Overwrite getOverwrite () const
 
void setOverwrite (Overwrite val)
 
void checkOverwrite (const std::filesystem::path &path) const
 
virtual bool setOption (std::string_view key, std::any value)
 Set writer specific options See the documentation of the specific writer for the available options.
 
virtual std::any getOption (std::string_view key) const
 Query the value of a writer specific option.
 
template<typename T >
bool writesType () const
 

Static Public Member Functions

static void checkOverwrite (const std::filesystem::path &path, Overwrite overwrite)
 

Protected Member Functions

std::ofstream open (const std::filesystem::path &path, std::ios_base::openmode mode=std::ios_base::out) const
 
virtual bool canWrite (const std::type_index &index) const =0
 

Protected Attributes

Overwrite overwrite_
 
std::vector< FileExtensionextensions_
 

Detailed Description

A abstract base class for all file writers.

See also
DataWriterFactory InviwoApplication::getDataWriterFactory

Member Function Documentation

◆ checkOverwrite() [1/2]

void inviwo::DataWriter::checkOverwrite ( const std::filesystem::path & path) const

Verify that you don't overwrite path unless overwrite is Yes.

Exceptions
DataWriterExceptionif the condition is broken.

◆ checkOverwrite() [2/2]

static void inviwo::DataWriter::checkOverwrite ( const std::filesystem::path & path,
Overwrite overwrite )
static

Verify that you don't overwrite path unless overwrite is Yes.

Exceptions
DataWriterExceptionif the condition is broken.

◆ getOption()

virtual std::any inviwo::DataWriter::getOption ( std::string_view key) const
inlinevirtual

Query the value of a writer 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

◆ open()

std::ofstream inviwo::DataWriter::open ( const std::filesystem::path & path,
std::ios_base::openmode mode = std::ios_base::out ) const
protected

Open path in mode for writing. If the overwrite condition is broken or the file can't be opened an exception is thrown.

Exceptions
DataWriterExceptionif the condition is broken, and FileException if the file can't be opened.

◆ setOption()

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

Set writer specific options See the documentation of the specific writer 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

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