neuray API Programmer's Manual

mi::neuraylib::IMdl_archive_api Class Reference

[Miscellaneous MDL-related Interfaces]

Description

This API component provides functionality related to MDL archives.

Public Member Functions

virtual Sint32 create_archive( const char* directory, const char* archive, const IArray* manifest_fields) =0
Creates an MDL archive given a directory. More...
virtual Sint32 extract_archive( const char* archive, const char* directory) =0
Unpacks an MDL archive into a given directory. More...
virtual const char* get_extensions_for_compression() const =0
Returns the file types to be compressed in archives.
virtual IReaderget_file( const char* archive, const char* filename) =0
Returns an arbitrary file from an MDL archive. More...
virtual IReaderget_file( const char* filename) =0
Returns an arbitrary file from an MDL archive. More...
virtual const IManifestget_manifest( const char* archive) =0
Returns the manifest for an MDL archive, or NULL in case of failure.
virtual Sint32 set_extensions_for_compression( const char* extensions) =0
Sets the file types to be compressed in archives. More...

Member Functions

virtual Sint32 mi::​neuraylib::​IMdl_archive_api::create_archive( const char* directory, const char* archive, const IArray* manifest_fields) [pure virtual]

Creates an MDL archive given a directory.

Parameters

directory
The contents of this directory will be packed into the archive. Logically, the directory needs to be on the same level as a directory of the search path, i.e., packages in the MDL archive name are represented as empty sub-directories of the given directory.
archive
The filename of the MDL archive to be created.
manifest_fields
A static or dynamic array of structs of type "Manifest_field" which holds fields with optional or user-defined keys to be added to the manifest. The struct has two members, "key" and "value", both of type "String". NULL is treated like an empty array.

Returns

  • 0: Success.
  • -1: Invalid parameters (NULL pointer).
  • -2: archive does not end in ".mdr".
  • -3: An array element of manifest_fields or a struct member of one of the array elements has an incorrect type.
  • -4: Failed to create the archive.
  • -5: Archive creation is not supported with an external entity resolver (see mi::neuraylib::IMdl_configuration::set_entity_resolver()).

virtual Sint32 mi::​neuraylib::​IMdl_archive_api::extract_archive( const char* archive, const char* directory) [pure virtual]

Unpacks an MDL archive into a given directory.

Parameters

archive
The filename of the MDL archive to be extracted.
directory
The directory into which the contents of the MDL archive will be extracted.

Returns

  • 0: Success.
  • -1: Invalid parameters (NULL pointer).
  • -2: Failure.

virtual const char* mi::​neuraylib::​IMdl_archive_api::get_extensions_for_compression() const [pure virtual]

Returns the file types to be compressed in archives.

virtual IReader* mi::​neuraylib::​IMdl_archive_api::get_file( const char* archive, const char* filename) [pure virtual]

Returns an arbitrary file from an MDL archive.

Note:
  • This method can not be used to obtain the manifest, use get_manifest() instead.

  • Although the returned reader supports random access this operation is slow in compressed files. If you need a lot of fast random access operations it might be beneficial to buffer the entire file content.

Parameters

archive
The filename of the MDL archive.
filename
The name of the file inside the MDL archive.

Returns

A reader to the file, or NULL in case of failures.

virtual IReader* mi::​neuraylib::​IMdl_archive_api::get_file( const char* filename) [pure virtual]

Returns an arbitrary file from an MDL archive.

Note:
  • This method can not be used to obtain the manifest, use get_manifest() instead.

  • Although the returned reader supports random access this operation is slow in compressed files. If you need a lot of fast random access operations it might be beneficial to buffer the entire file content.

Parameters

filename
The name of the archive followed by a colon followed by the name of the file inside the archive (e. g. my_archive.mdr:my_package/my_file.mdl).

Returns

A reader to the file, or NULL in case of failures.

virtual const IManifest* mi::​neuraylib::​IMdl_archive_api::get_manifest( const char* archive) [pure virtual]

Returns the manifest for an MDL archive, or NULL in case of failure.

virtual Sint32 mi::​neuraylib::​IMdl_archive_api::set_extensions_for_compression( const char* extensions) [pure virtual]

Sets the file types to be compressed in archives.

Parameters

extensions
A comma-separated list of file name extensions. Files with a matching extension will be compressed when archives are created. Independent of this setting here, .mdl files will always be compressed, and textures as defined in [MDLLS] will never be compressed.