NDEVR
API Documentation
IOFactoryabstract

A service that provides Import/Export functionality for a model hierarchy. More...

Inheritance diagram for IOFactory:
[legend]
Collaboration diagram for IOFactory:
[legend]

Public Member Functions

 IOFactory (const StringView &factory_name)
 Constructs an IOFactory with the given factory name.
virtual ~IOFactory ()
 Virtual destructor.
virtual bool canRead (const FactoryParameters &file)
 Checks whether this factory can read using the given FactoryParameters.
virtual bool canRead (const File &file)
 Checks whether this factory can read the given file.
virtual bool canRead (const FileFormat &file)
 Checks whether this factory can read the given file format.
virtual bool canWrite (const FactoryParameters &file)
 Checks whether this factory can write using the given FactoryParameters.
virtual bool canWrite (const File &file)
 Checks whether this factory can write the given file.
virtual bool canWrite (const FileFormat &file)
 Checks whether this factory can write the given file format.
virtual FactoryOptions defaultReadOptions (const FactoryParameters &file) const
 Returns the default read options for the given factory parameters.
virtual FactoryOptions defaultWriteOptions (const FactoryParameters &file) const
 Returns the default write options for the given factory parameters.
virtual bool determineExtension (const File &file, String &extension)
 Attempts to determine the file extension for the given file.
virtual FactoryFeatures factoryFeatures (const FactoryParameters &file, bool is_import) const =0
 Returns the features and configurable options for this factory given the parameters.
String factoryReadAppFeature () const
 Returns the application feature string required for read operations.
String factoryWriteAppFeature () const
 Returns the application feature string required for write operations.
virtual Buffer< UUIDfilterModelsToExport (Buffer< UUID > models_to_check, const DesignObjectLookup *lookup, const FileFormat &export_format) const
 Filters a list of model UUIDs to only those that can be exported in the given format.
virtual String getIcon (const File &file)
 Returns the icon name associated with the given file type.
void getSupportedFormats (Buffer< FileFormat > &formats)
 Populates the given buffer with all supported file formats (both read and write).
virtual void getSupportedFormats (Buffer< FileFormat > &formats, bool is_read)=0
 Populates the given buffer with supported file formats for reading or writing.
virtual void getSupportedFormats (Buffer< FileFormat > &formats, const File &file)
 Populates the given buffer with formats supported for the specified file.
virtual void getSupportedFormats (Buffer< FileFormat > &formats, DesignObjectLookup *lookup, const Buffer< UUID > &models)
 Populates the given buffer with formats supported for writing the specified models.
virtual void getSupportedFormatsByModelType (Buffer< FileFormat > &formats, bool is_read, const StringView &model_type)
 Populates the given buffer with formats matching a specific model type.
virtual void getSupportedFormatsForExtension (Buffer< FileFormat > &formats, bool is_read, const StringView &extension)
 Populates the given buffer with formats matching a specific file extension.
virtual bool isAutoEnabled () const
 Checks whether this factory is automatically enabled without requiring a password.
virtual bool isFactoryEnabled (bool is_read) const
 Checks whether this factory is enabled for reading or writing.
const Stringname () const
 Returns the name of this factory.
Buffer< UUIDreadFileWithDefaultSettings (const File &file, DesignObjectLookup *lookup)
 Reads a file using default settings and returns the UUIDs of the created models.
Buffer< ScenereadScenesFromFile (const File &file)
 Reads scenes from a file and returns them as a buffer of Scene objects.
void throwIfNotEnabled (bool is_read)
 Throws an exception if the factory is not enabled for the given operation direction.
virtual bool updateFromFile (const FactoryParameters &file, const FactoryOptions &old_options)
 Updates the factory parameters from a file, comparing against old options.
bool writeScenesToFile (const File &file, const Buffer< Scene > &scene)
 Writes a buffer of scenes to a file.

Static Public Member Functions

static void EnableExtension (const StringView &extension, const StringView &read_password, const StringView &write_password)
 Enables a specific file extension with the given read and write passwords.
static void EnableFactory (const StringView &factory, const StringView &read_password, const StringView &write_password)
 Enables a factory by name with the given read and write passwords.
static void EnableFactory (IOFactory *factory, const StringView &read_password, const StringView &write_password)
 Registers an IOFactory instance with the system, enabling it for read and/or write.

Private Member Functions

virtual bool readFile (FactoryParameters &file)=0
 Reads data from a file into the design object hierarchy.
virtual bool writeFile (FactoryParameters &file)=0
 Writes data from the design object hierarchy to a file.

Detailed Description

A service that provides Import/Export functionality for a model hierarchy.


These can be registered with EnableFactory to allow the user to export/import to certain file formats. In order to provide support for new file formats, classes should override this class and then add themselves using EnableFactory.

For write operations we will first send which data structures the user wishes to export, if it is possible for a certain implementation to write those data structures, it will then be asked to provide available write formats. If the user chooses the provided format FactoryFeatures will be requested to see what options to show the user. The factory can then write this data.

For read operations we will first ask which extensions are supported. If the user chooses a file with the supported extension, FactoryFeatures will be requested to see what options to show the user. The factory can then read this data.

See also
ModelFactory, FactoryOptions, FactoryFeatures, FactoryParameters

Definition at line 247 of file IOFactory.h.

Constructor & Destructor Documentation

◆ IOFactory()

IOFactory::IOFactory ( const StringView & factory_name)

Constructs an IOFactory with the given factory name.


Parameters
[in]factory_nameThe unique name identifying this factory.

Referenced by ModelFactory::addFactory(), ModelFactory::addFactory(), EnableFactory(), and ModelFactory::enableFactory().

◆ ~IOFactory()

virtual IOFactory::~IOFactory ( )
virtual

Virtual destructor.


Member Function Documentation

◆ canRead() [1/3]

virtual bool IOFactory::canRead ( const FactoryParameters & file)
virtual

Checks whether this factory can read using the given FactoryParameters.


Parameters
[in]fileThe FactoryParameters describing the read operation.
Returns
True if this factory supports the read operation.

Reimplemented in AsciiFactory, GeoSlamFactory, GeoTiffFactory, KMLFactory, LASFactory, LASPerformanceFactory, ModelFactory, NDVFactory, OMFFactory, PDFFactory, and QuickbooksFactory.

◆ canRead() [2/3]

virtual bool IOFactory::canRead ( const File & file)
virtual

Checks whether this factory can read the given file.


Parameters
[in]fileThe file to check.
Returns
True if this factory supports reading the file.

Reimplemented in CommandJSON, DNBJSONFactory, GeoTiffFactory, IredesPatternFactory, LandXMLFactory, ModelFactory, OWLFactory, SceneDump, UnityAssetFactory, and ZippedOffset.

◆ canRead() [3/3]

virtual bool IOFactory::canRead ( const FileFormat & file)
virtual

Checks whether this factory can read the given file format.


Parameters
[in]fileThe FileFormat to check.
Returns
True if this factory supports reading the format.

◆ canWrite() [1/3]

virtual bool IOFactory::canWrite ( const FactoryParameters & file)
virtual

Checks whether this factory can write using the given FactoryParameters.


Parameters
[in]fileThe FactoryParameters describing the write operation.
Returns
True if this factory supports the write operation.

Reimplemented in ModelFactory, NDVFactory, OMFFactory, PDFFactory, and QuickbooksFactory.

◆ canWrite() [2/3]

virtual bool IOFactory::canWrite ( const File & file)
virtual

Checks whether this factory can write the given file.


Parameters
[in]fileThe file to check.
Returns
True if this factory supports writing the file.

Reimplemented in CommandJSON, DNBJSONFactory, ModelFactory, OWLFactory, PDFFactory, SceneDump, UnityAssetFactory, and ZippedOffset.

◆ canWrite() [3/3]

virtual bool IOFactory::canWrite ( const FileFormat & file)
virtual

Checks whether this factory can write the given file format.


Parameters
[in]fileThe FileFormat to check.
Returns
True if this factory supports writing the format.

Reimplemented in NDVFactory, and PDFFactory.

◆ defaultReadOptions()

virtual FactoryOptions IOFactory::defaultReadOptions ( const FactoryParameters & file) const
virtual

Returns the default read options for the given factory parameters.


Parameters
[in]fileThe FactoryParameters describing the read operation.
Returns
The default FactoryOptions for reading.

Reimplemented in AsciiFactory, AssimpFactory, CommandJSON, DNBJSONFactory, DVI3DSpreadsheetFactory, DXFFactory, E57Factory, GeoSlamFactory, GeoTiffFactory, KMLFactory, LandXMLFactory, LASFactory, LASPerformanceFactory, ModelFactory, NDVFactory, OWLFactory, SceneDump, SHPFactory, UnityAssetFactory, XLXSFactory, and ZippedOffset.

◆ defaultWriteOptions()

virtual FactoryOptions IOFactory::defaultWriteOptions ( const FactoryParameters & file) const
virtual

Returns the default write options for the given factory parameters.


Parameters
[in]fileThe FactoryParameters describing the write operation.
Returns
The default FactoryOptions for writing.

Reimplemented in AsciiFactory, AssimpFactory, CommandJSON, DNBJSONFactory, DXFFactory, E57Factory, GeoSlamFactory, KMLFactory, LASFactory, LASPerformanceFactory, ModelFactory, NDVFactory, OWLFactory, PDFFactory, SceneDump, SHPFactory, UnityAssetFactory, and ZippedOffset.

◆ determineExtension()

virtual bool IOFactory::determineExtension ( const File & file,
String & extension )
virtual

Attempts to determine the file extension for the given file.


Parameters
[in]fileThe file to inspect.
[in]extensionOutput parameter populated with the determined extension.
Returns
True if the extension was successfully determined.

Reimplemented in CommandJSON, DNBJSONFactory, DXFFactory, LASFactory, LASPerformanceFactory, ModelFactory, NDVFactory, OWLFactory, SceneDump, UnityAssetFactory, and ZippedOffset.

◆ EnableExtension()

void IOFactory::EnableExtension ( const StringView & extension,
const StringView & read_password,
const StringView & write_password )
static

Enables a specific file extension with the given read and write passwords.


Parameters
[in]extensionThe file extension to enable (e.g., "obj", "csv").
[in]read_passwordThe password or license key enabling read operations.
[in]write_passwordThe password or license key enabling write operations.

◆ EnableFactory() [1/2]

void IOFactory::EnableFactory ( const StringView & factory,
const StringView & read_password,
const StringView & write_password )
static

Enables a factory by name with the given read and write passwords.


Parameters
[in]factoryThe name of the factory to enable.
[in]read_passwordThe password or license key enabling read operations.
[in]write_passwordThe password or license key enabling write operations.

◆ EnableFactory() [2/2]

void IOFactory::EnableFactory ( IOFactory * factory,
const StringView & read_password,
const StringView & write_password )
static

Registers an IOFactory instance with the system, enabling it for read and/or write.


Parameters
[in]factoryThe IOFactory instance to register.
[in]read_passwordThe password or license key enabling read operations.
[in]write_passwordThe password or license key enabling write operations.

References IOFactory().

◆ factoryFeatures()

virtual FactoryFeatures IOFactory::factoryFeatures ( const FactoryParameters & file,
bool is_import ) const
pure virtual

Returns the features and configurable options for this factory given the parameters.


Parameters
[in]fileThe FactoryParameters describing the operation.
[in]is_importTrue for import operations, false for export operations.
Returns
A FactoryFeatures object describing available options and capabilities.

Implemented in AsciiFactory, AssimpFactory, CommandJSON, DNBJSONFactory, DVI3DSpreadsheetFactory, DXFFactory, E57Factory, GeoSlamFactory, GeoTiffFactory, KMLFactory, LandXMLFactory, LASFactory, LASPerformanceFactory, MagneticCalibrationFactory, ModelFactory, NDVFactory, OWLFactory, PDFFactory, QuickbooksFactory, RockWorksFactory, SceneDump, SHPFactory, SketchupFactory, UnityAssetFactory, XLXSFactory, and ZippedOffset.

◆ factoryReadAppFeature()

String IOFactory::factoryReadAppFeature ( ) const

Returns the application feature string required for read operations.


Returns
A String identifying the read feature for licensing purposes.

◆ factoryWriteAppFeature()

String IOFactory::factoryWriteAppFeature ( ) const

Returns the application feature string required for write operations.


Returns
A String identifying the write feature for licensing purposes.

◆ filterModelsToExport()

virtual Buffer< UUID > IOFactory::filterModelsToExport ( Buffer< UUID > models_to_check,
const DesignObjectLookup * lookup,
const FileFormat & export_format ) const
virtual

Filters a list of model UUIDs to only those that can be exported in the given format.


Parameters
[in]models_to_checkThe candidate model UUIDs to filter.
[in]lookupThe DesignObjectLookup used to resolve the models.
[in]export_formatThe target export format.
Returns
A buffer containing only the UUIDs of models that can be exported.

Reimplemented in AsciiFactory, AssimpFactory, CommandJSON, DNBJSONFactory, E57Factory, GeoSlamFactory, KMLFactory, LASFactory, LASPerformanceFactory, MagneticCalibrationFactory, ModelFactory, OWLFactory, RockWorksFactory, SceneDump, SHPFactory, UnityAssetFactory, and ZippedOffset.

◆ getIcon()

virtual String IOFactory::getIcon ( const File & file)
virtual

Returns the icon name associated with the given file type.


Parameters
[in]fileThe file to get the icon for.
Returns
A String containing the icon name.

Reimplemented in AsciiFactory, AssimpFactory, CommandJSON, DNBJSONFactory, LandXMLFactory, ModelFactory, NDVFactory, OWLFactory, SceneDump, UnityAssetFactory, and ZippedOffset.

◆ getSupportedFormats() [1/4]

void IOFactory::getSupportedFormats ( Buffer< FileFormat > & formats)

Populates the given buffer with all supported file formats (both read and write).


Parameters
[in]formatsThe buffer to populate with supported FileFormat entries.

◆ getSupportedFormats() [2/4]

virtual void IOFactory::getSupportedFormats ( Buffer< FileFormat > & formats,
bool is_read )
pure virtual

Populates the given buffer with supported file formats for reading or writing.


Parameters
[in]formatsThe buffer to populate with supported FileFormat entries.
[in]is_readTrue to get read formats, false to get write formats.

Implemented in AsciiFactory, AssimpFactory, CommandJSON, DNBJSONFactory, DVI3DSpreadsheetFactory, DXFFactory, E57Factory, GeoSlamFactory, GeoTiffFactory, IredesPatternFactory, KMLFactory, LandXMLFactory, LASFactory, LASPerformanceFactory, MagneticCalibrationFactory, ModelFactory, NDVFactory, OWLFactory, PDFFactory, QuickbooksFactory, RockWorksFactory, SceneDump, SHPFactory, SketchupFactory, UnityAssetFactory, XLXSFactory, and ZippedOffset.

◆ getSupportedFormats() [3/4]

virtual void IOFactory::getSupportedFormats ( Buffer< FileFormat > & formats,
const File & file )
virtual

Populates the given buffer with formats supported for the specified file.


Parameters
[in]formatsThe buffer to populate with supported FileFormat entries.
[in]fileThe file to check for supported formats.

Reimplemented in ModelFactory.

◆ getSupportedFormats() [4/4]

virtual void IOFactory::getSupportedFormats ( Buffer< FileFormat > & formats,
DesignObjectLookup * lookup,
const Buffer< UUID > & models )
virtual

Populates the given buffer with formats supported for writing the specified models.


Parameters
[in]formatsThe buffer to populate with supported FileFormat entries.
[in]lookupThe DesignObjectLookup used to resolve the models.
[in]modelsThe UUIDs of the models to check for export support.

Reimplemented in AsciiFactory, AssimpFactory, ModelFactory, and PDFFactory.

◆ getSupportedFormatsByModelType()

virtual void IOFactory::getSupportedFormatsByModelType ( Buffer< FileFormat > & formats,
bool is_read,
const StringView & model_type )
virtual

Populates the given buffer with formats matching a specific model type.


Parameters
[in]formatsThe buffer to populate with matching FileFormat entries.
[in]is_readTrue to get read formats, false to get write formats.
[in]model_typeThe model type string to filter by.

Reimplemented in AsciiFactory, DNBJSONFactory, IredesPatternFactory, and ModelFactory.

◆ getSupportedFormatsForExtension()

virtual void IOFactory::getSupportedFormatsForExtension ( Buffer< FileFormat > & formats,
bool is_read,
const StringView & extension )
virtual

Populates the given buffer with formats matching a specific file extension.


Parameters
[in]formatsThe buffer to populate with matching FileFormat entries.
[in]is_readTrue to get read formats, false to get write formats.
[in]extensionThe file extension to filter by (e.g., "obj", "csv").

◆ isAutoEnabled()

virtual bool IOFactory::isAutoEnabled ( ) const
virtual

Checks whether this factory is automatically enabled without requiring a password.


Returns
True if the factory is auto-enabled, false if a password/license is required.

Reimplemented in CommandJSON, DNBJSONFactory, GeoTiffFactory, OWLFactory, SceneDump, UnityAssetFactory, and ZippedOffset.

◆ isFactoryEnabled()

virtual bool IOFactory::isFactoryEnabled ( bool is_read) const
virtual

Checks whether this factory is enabled for reading or writing.


Parameters
[in]is_readTrue to check read capability, false to check write capability.
Returns
True if the factory is enabled for the requested direction.

◆ name()

const String & IOFactory::name ( ) const
inline

Returns the name of this factory.


Returns
A const reference to the factory name string.

Definition at line 262 of file IOFactory.h.

Referenced by AsciiFactory::AsciiFactory().

◆ readFile()

virtual bool IOFactory::readFile ( FactoryParameters & file)
privatepure virtual

◆ readFileWithDefaultSettings()

Buffer< UUID > IOFactory::readFileWithDefaultSettings ( const File & file,
DesignObjectLookup * lookup )

Reads a file using default settings and returns the UUIDs of the created models.


Parameters
[in]fileThe file to read from.
[in]lookupThe DesignObjectLookup used to create and resolve design objects.
Returns
A buffer of UUIDs for the models created from the file.

◆ readScenesFromFile()

Buffer< Scene > IOFactory::readScenesFromFile ( const File & file)

Reads scenes from a file and returns them as a buffer of Scene objects.


Parameters
[in]fileThe file to read scenes from.
Returns
A buffer of Scene objects read from the file.

◆ throwIfNotEnabled()

void IOFactory::throwIfNotEnabled ( bool is_read)

Throws an exception if the factory is not enabled for the given operation direction.


If isAutoEnabled() returns false and the system does not detect a valid password for the operation, an exception will be thrown.

Parameters
[in]is_readTrue to check read enablement, false to check write enablement.

◆ updateFromFile()

virtual bool IOFactory::updateFromFile ( const FactoryParameters & file,
const FactoryOptions & old_options )
virtual

Updates the factory parameters from a file, comparing against old options.


Parameters
[in]fileThe FactoryParameters to update.
[in]old_optionsThe previous FactoryOptions to compare against.
Returns
True if the update was performed, false otherwise.

Reimplemented in ModelFactory.

◆ writeFile()

virtual bool IOFactory::writeFile ( FactoryParameters & file)
privatepure virtual

◆ writeScenesToFile()

bool IOFactory::writeScenesToFile ( const File & file,
const Buffer< Scene > & scene )

Writes a buffer of scenes to a file.


Parameters
[in]fileThe file to write to.
[in]sceneThe buffer of Scene objects to write.
Returns
True if the write operation succeeded, false otherwise.

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