Inviwo 0.9.12-pre
Inviwo documentation
Loading...
Searching...
No Matches
inviwo::DataWriterFactory Class Reference
+ Inheritance diagram for inviwo::DataWriterFactory:

Public Member Functions

virtual std::unique_ptr< DataWritercreate (const FileExtension &key) const override
 
virtual std::unique_ptr< DataWritercreate (std::string_view key) const override
 
 DataWriterFactory (const DataWriterFactory &)=delete
 
 DataWriterFactory (DataWriterFactory &&)=delete
 
template<typename T >
std::vector< FileExtensiongetExtensionsForType () const
 
template<typename... Ts>
std::vector< FileExtensiongetExtensionsForTypes () const
 
template<typename... Ts>
auto getExtensionsForTypesView () const
 
auto getKeyView () const
 
auto getValueView () const
 
template<typename T >
std::unique_ptr< DataWriterType< T > > getWriterForTypeAndExtension (const FileExtension &ext, const std::filesystem::path &fallbackFilePathOrExtension) const
 
template<typename T >
std::unique_ptr< DataWriterType< T > > getWriterForTypeAndExtension (const FileExtension &extension) const
 
template<typename T >
std::unique_ptr< DataWriterType< T > > getWriterForTypeAndExtension (const LCString &extension) const
 
template<typename T >
std::unique_ptr< DataWriterType< T > > getWriterForTypeAndExtension (const std::filesystem::path &filePathOrExtension) const
 Return a writer matching the file extension of DataWriterType of type T. Does case insensitive comparison between the last part of filePathOrExtension and each registered extension. Does not check for "." before the extension, so it is valid to pass for example "png".
 
virtual bool hasKey (const FileExtension &key) const override
 
virtual bool hasKey (std::string_view key) const override
 
template<typename T >
bool hasWriterForTypeAndExtension (const FileExtension &extension) const
 
template<typename T >
bool hasWriterForTypeAndExtension (const LCString &extension) const
 
template<typename T >
bool hasWriterForTypeAndExtension (const std::filesystem::path &filePathOrExtension) const
 
DataWriterFactoryoperator= (const DataWriterFactory &)=delete
 
DataWriterFactoryoperator= (DataWriterFactory &&)=delete
 
bool registerObject (DataWriter *writer)
 
bool unRegisterObject (DataWriter *writer)
 
template<typename T >
bool writeDataForTypeAndExtension (const T *data, const std::filesystem::path &filePath, std::optional< FileExtension > ext=std::nullopt) const
 
- Public Member Functions inherited from inviwo::Factory< DataWriter, const FileExtension & >
virtual std::unique_ptr< DataWritercreate (const FileExtension & key, Args... args) const=0
 
virtual std::shared_ptr< DataWritercreateShared (const FileExtension & key, Args... args) const
 
 Factory (const Factory &)=delete
 
 Factory (Factory &&)=default
 
Factoryoperator= (const Factory &)=delete
 
Factoryoperator= (Factory &&)=default
 
- Public Member Functions inherited from inviwo::Factory< DataWriter, std::string_view >
virtual std::unique_ptr< DataWritercreate (std::string_view key, Args... args) const=0
 
virtual std::shared_ptr< DataWritercreateShared (std::string_view key, Args... args) const
 
 Factory (const Factory &)=delete
 
 Factory (Factory &&)=default
 
Factoryoperator= (const Factory &)=delete
 
Factoryoperator= (Factory &&)=default
 
- Public Member Functions inherited from inviwo::Observable< T >
void addObserver (T *observer)
 
bool isObservedBy (T *observer) const
 
 Observable (const Observable< T > &other)
 
 Observable (Observable< T > &&other) noexcept
 
Observable< T > & operator= (const Observable< T > &other)
 
Observable< T > & operator= (Observable< T > &&other) noexcept
 
void removeObserver (T *observer)
 
virtual void startBlockingNotifications () override final
 
virtual void stopBlockingNotifications () override final
 

Protected Attributes

std::map< FileExtension, DataWriter * > map_
 

Additional Inherited Members

- Protected Member Functions inherited from inviwo::FactoryObservable< DataWriter >
void notifyObserversOnRegister (DataWriter *p)
 
void notifyObserversOnUnRegister (DataWriter *p)
 
- Protected Member Functions inherited from inviwo::Observable< T >
template<typename C >
void forEachObserver (C callback)
 
- Protected Member Functions inherited from inviwo::ObservableInterface
void addObservationHelper (Observer *observer)
 
void removeObservationHelper (Observer *observer)
 

Member Function Documentation

◆ getWriterForTypeAndExtension() [1/2]

template<typename T >
std::unique_ptr< DataWriterType< T > > inviwo::DataWriterFactory::getWriterForTypeAndExtension ( const FileExtension & ext,
const std::filesystem::path & fallbackFilePathOrExtension ) const

First look for a writer using the FileExtension ext, and if no writer was found look for a writer using the fallbackFilePathOrExtension. This is often used with a file open dialog, where the dialog will have a selectedFileExtension that will be used as ext, and the fallbackFilePathOrExtension is taken from the file to be written. This way any selected writer will have priority over the file extension.

◆ getWriterForTypeAndExtension() [2/2]

template<typename T >
std::unique_ptr< DataWriterType< T > > inviwo::DataWriterFactory::getWriterForTypeAndExtension ( const std::filesystem::path & filePathOrExtension) const

Return a writer matching the file extension of DataWriterType of type T. Does case insensitive comparison between the last part of filePathOrExtension and each registered extension. Does not check for "." before the extension, so it is valid to pass for example "png".

Parameters
filePathOrExtensionPath to file, or simply the extension.
Returns
First available DataWriterType<T> if found, nullptr otherwise.

◆ hasKey() [1/2]

virtual bool inviwo::DataWriterFactory::hasKey ( const FileExtension & key) const
overridevirtual

◆ hasKey() [2/2]

virtual bool inviwo::DataWriterFactory::hasKey ( std::string_view key) const
overridevirtual

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