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 <inviwo/core/io/datawriter.h>

Inheritance diagram for inviwo::DataWriter:

Public Member Functions

void addExtension (FileExtension ext)
void checkOverwrite (const std::filesystem::path &path) const
virtual DataWriter * clone () const =0
 DataWriter (const DataWriter &rhs)
 DataWriter (DataWriter &&rhs) noexcept=default
const std::vector< FileExtension > & getExtensions () const
virtual std::any getOption (std::string_view key) const
 Query the value of a writer specific option.
Overwrite getOverwrite () const
DataWriter & operator= (const DataWriter &that)
DataWriter & operator= (DataWriter &&that) noexcept=default
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.
void setOverwrite (Overwrite val)
template<typename T>
bool writesType () const

Static Public Member Functions

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

Protected Member Functions

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

Protected Attributes

std::vector< FileExtensionextensions_
Overwrite overwrite_

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]

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:
  • include/inviwo/core/io/datawriter.h