MDL SDK API nvidia_logo_transpbg.gif Up
mi::neuraylib::IMdl_archive_api Class Referenceabstract

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

#include <imdl_archive_api.h>

Inheritance diagram for mi::neuraylib::IMdl_archive_api:

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...
 
- Public Member Functions inherited from mi::base::IInterface
virtual Uint32 retain () const =0
 Increments the reference count. More...
 
virtual Uint32 release () const =0
 Decrements the reference count. More...
 
virtual const IInterfaceget_interface (const Uuid &interface_id) const =0
 Acquires a const interface from another. More...
 
template<class T>
const T * get_interface () const
 Acquires a const interface from another. More...
 
virtual IInterfaceget_interface (const Uuid &interface_id)=0
 Acquires a mutable interface from another. More...
 
template<class T>
T * get_interface ()
 Acquires a mutable interface from another. More...
 
virtual Uuid get_iid () const =0
 Returns the interface ID of the most derived interface. More...
 

Additional Inherited Members

- Public Types inherited from mi::base::Interface_declare< 0x4b41b483, ... >
typedef Interface_declare< id1, ... > Self
 Own type. More...
 
typedef Uuid_t< id1, ... > IID
 Declares the interface ID (IID) of this interface. More...
 
- Public Types inherited from mi::base::IInterface
typedef Uuid_t<0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0> IID
 Declares the interface ID (IID) of this interface. More...
 
- Static Public Member Functions inherited from mi::base::Interface_declare< 0x4b41b483, ... >
static bool compare_iid (const Uuid &iid)
 Compares the interface ID iid against the interface ID of this interface and of its ancestors. More...
 
- Static Public Member Functions inherited from mi::base::IInterface
static bool compare_iid (const Uuid &iid)
 Compares the interface ID iid against the interface ID of this interface. More...
 

Detailed Description

This API component provides functionality related to MDL archives.

Member Function Documentation

 create_archive()

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.
  • -5: Archive creation is not supported with an external entity resolver (see mi::neuraylib::IMdl_configuration::set_entity_resolver()).

 extract_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.

 get_extensions_for_compression()

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

Returns the file types to be compressed in archives.

 get_file() [1/2]

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.

 get_file() [2/2]

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.

 get_manifest()

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.

 set_extensions_for_compression()

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.