Material Definition Language API nvidia_logo_transpbg.gif Up
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
mi::neuraylib::IMdl_archive_api Class Referenceabstract

This API component provides functionality related to MDL archives. More...

Inheritance diagram for mi::neuraylib::IMdl_archive_api:
mi::base::Interface_declare< 0x4b41b483, 0xdb0b, 0x4658, 0xaf, 0x65, 0x64, 0xb1, 0xd6, 0x9d, 0x26, 0xb0 > mi::base::IInterface

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 IManifestget_manifest (const char *archive)=0
 Returns the manifest for an MDL archive, or NULL in case of failure. More...
 
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 Sint32 set_extensions_for_compression (const char *extensions)=0
 Sets the file types to be compressed in archives. More...
 
virtual const char * get_extensions_for_compression () const =0
 Returns the file types to be compressed in archives. More...
 

Additional Inherited Members

- Public Types inherited from mi::base::Interface_declare< 0x4b41b483, 0xdb0b, 0x4658, 0xaf, 0x65, 0x64, 0xb1, 0xd6, 0x9d, 0x26, 0xb0 >
typedef Interface_declare< id1,
id2, id3, id4, id5, id6, id7,
id8, id9, id10, id11,
IInterface
Self
 Own type. More...
 
typedef Uuid_t< id1, id2, id3,
id4, id5, id6, id7, id8, id9,
id10, id11 > 
IID
 Declares the interface ID (IID) of this interface. More...
 
- Static Public Member Functions inherited from mi::base::Interface_declare< 0x4b41b483, 0xdb0b, 0x4658, 0xaf, 0x65, 0x64, 0xb1, 0xd6, 0x9d, 0x26, 0xb0 >
static bool compare_iid (const Uuid &iid)
 Compares the interface ID iid against the interface ID of this interface and of its ancestors. More...
 

Detailed Description

This API component provides functionality related to MDL archives.

Member Function Documentation

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
directoryThe 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.
archiveThe filename of the MDL archive to be created.
manifest_fieldsA 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.
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
archiveThe filename of the MDL archive to be extracted.
directoryThe 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
archiveThe filename of the MDL archive.
filenameThe 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
filenameThe 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
extensionsA 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.