neuray API Programmer's Manual

mi::neuraylib::IModule Class Reference

[MDL-related elements]

Description

This interface represents an MDL module.

See also:

mi::neuraylib::IFunction_definition, mi::neuraylib::IFunction_call

Public Member Functions

virtual const IAnnotation_definitionget_annotation_definition( Size index) const =0
Returns the annotation definition at index. More...
virtual const IAnnotation_definitionget_annotation_definition( const char* name) const =0
Returns the annotation definition of the given name. More...
virtual Size get_annotation_definition_count() const =0
Returns the number of annotations defined in the module.
virtual const IAnnotation_blockget_annotations() const =0
Returns the annotations of the module, or NULL if there are no such annotations.
virtual const IValue_listget_constants() const =0
Returns the constants exported by this module.
virtual const char* get_filename() const =0
Returns the name of the MDL source file from which this module was created. More...
virtual const char* get_function( Size index) const =0
Returns the DB name of the function definition at index. More...
virtual Size get_function_count() const =0
Returns the number of function definitions exported by the module.
virtual const IArrayget_function_overloads( const char* name, const IExpression_list* arguments = 0) const =0
Returns overloads of a function or material definition. More...
virtual const IArrayget_function_overloads( const char* name, const IArray* parameter_types) const =0
Returns overloads of a function or material definition. More...
virtual const char* get_import( Size index) const =0
Returns the DB name of the imported module at index. More...
virtual Size get_import_count() const =0
Returns the number of modules imported by the module.
virtual const char* get_material( Size index) const =0
Returns the DB name of the material definition at index. More...
virtual Size get_material_count() const =0
Returns the number of material definitions exported by the module.
virtual const char* get_mdl_name() const =0
Returns the MDL name of the module. More...
virtual Size get_mdl_package_component_count() const =0
Returns the number of package components in the MDL name.
virtual const char* get_mdl_package_component_name( Size index) const =0
Returns the name of a package component in the MDL name. More...
virtual const char* get_mdl_simple_name() const =0
Returns the simple MDL name of the module. More...
virtual Mdl_version get_mdl_version() const =0
Returns the MDL version of this module.
virtual const IValue_resourceget_resource( Size index) const =0
Returns a resource defined in the module. More...
virtual Size get_resources_count() const =0
Returns the number of resources defined in the module. More...
virtual const IType_listget_types() const =0
Returns the types exported by this module.
virtual bool  is_mdle_module() const =0
Indicates whether this module results from an .mdle file.
virtual bool  is_standard_module() const =0
Indicates whether this module is a standard module. More...
virtual bool  is_valid( IMdl_execution_context* context) const =0
Returns true if all imports of the module are valid. More...
virtual Sint32 reload( bool recursive, IMdl_execution_context* context) =0
Reload the module from disk. More...
virtual Sint32 reload_from_string( const char* module_source, bool recursive, IMdl_execution_context* context) =0
Reload the module from string. More...

Member Functions

virtual const IAnnotation_definition* mi::​neuraylib::​IModule::get_annotation_definition( Size index) const [pure virtual]

Returns the annotation definition at index.

Parameters

index
The index of the annotation definition.

Returns

The annotation definition or NULL if index is out of range.

virtual const IAnnotation_definition* mi::​neuraylib::​IModule::get_annotation_definition( const char* name) const [pure virtual]

Returns the annotation definition of the given name.

Parameters

name
The name of the annotation definition.

Returns

The annotation definition or NULL if there is no such definition.

virtual Size mi::​neuraylib::​IModule::get_annotation_definition_count() const [pure virtual]

Returns the number of annotations defined in the module.

virtual const IAnnotation_block* mi::​neuraylib::​IModule::get_annotations() const [pure virtual]

Returns the annotations of the module, or NULL if there are no such annotations.

virtual const IValue_list* mi::​neuraylib::​IModule::get_constants() const [pure virtual]

Returns the constants exported by this module.

virtual const char* mi::​neuraylib::​IModule::get_filename() const [pure virtual]

Returns the name of the MDL source file from which this module was created.

Returns

The full pathname of the source file from which this MDL module was created, or NULL if no such file exists.

virtual const char* mi::​neuraylib::​IModule::get_function( Size index) const [pure virtual]

Returns the DB name of the function definition at index.

Parameters

index
The index of the function definition.

Returns

The DB name of the function definition. The method may return NULL for valid indices if the corresponding function definition has already been removed from the DB.

virtual Size mi::​neuraylib::​IModule::get_function_count() const [pure virtual]

Returns the number of function definitions exported by the module.

virtual const IArray* mi::​neuraylib::​IModule::get_function_overloads( const char* name, const IExpression_list* arguments = 0) const [pure virtual]

Returns overloads of a function or material definition. The method returns overloads of a function or material definition of this module, either all overloads or just the overloads matching a given set of arguments.

Parameters

name
The simple name or the DB name without signature of a function or material definition from this module.
arguments
Optional arguments to select specific overload(s). If present, the method returns only the overloads of name whose signature matches the provided arguments, i.e., a call to mi::neuraylib::IFunction_definition::create_function_call() with these arguments would succeed.

Returns

The DB names of overloads of the given function or material definition, or NULL if name is invalid.

virtual const IArray* mi::​neuraylib::​IModule::get_function_overloads( const char* name, const IArray* parameter_types) const [pure virtual]

Returns overloads of a function or material definition. The method returns the best-matching overloads of a function or material definition of this module, given a list of positional parameter types.

Parameters

name
The simple name or the DB name without signature of a function or material definition from this module.
parameter_types
A static or dynamic array with elements of type mi::IString representing positional parameter type names as returned by mi::neuraylib::IFunction_definition::get_mdl_parameter_type_name().

Returns

The DB names of overloads of the given function or material definition, or NULL if name is invalid.

virtual const char* mi::​neuraylib::​IModule::get_import( Size index) const [pure virtual]

Returns the DB name of the imported module at index.

Parameters

index
The index of the imported module.

Returns

The DB name of the imported module.

virtual Size mi::​neuraylib::​IModule::get_import_count() const [pure virtual]

Returns the number of modules imported by the module.

virtual const char* mi::​neuraylib::​IModule::get_material( Size index) const [pure virtual]

Returns the DB name of the material definition at index.

Parameters

index
The index of the material definition.

Returns

The DB name of the material definition. The method may return NULL for valid indices if the corresponding material definition has already been removed from the DB.

virtual Size mi::​neuraylib::​IModule::get_material_count() const [pure virtual]

Returns the number of material definitions exported by the module.

virtual const char* mi::​neuraylib::​IModule::get_mdl_name() const [pure virtual]

Returns the MDL name of the module.

Note:

The MDL name of the module is different from the name of the DB element. Use mi::neuraylib::ITransaction::name_of() to obtain the name of the DB element.

Returns

The MDL name of the module.

virtual Size mi::​neuraylib::​IModule::get_mdl_package_component_count() const [pure virtual]

Returns the number of package components in the MDL name.

virtual const char* mi::​neuraylib::​IModule::get_mdl_package_component_name( Size index) const [pure virtual]

Returns the name of a package component in the MDL name.

Returns

The index -th package component name, or NULL if index is out of bounds.

virtual const char* mi::​neuraylib::​IModule::get_mdl_simple_name() const [pure virtual]

Returns the simple MDL name of the module. The simple name is the last component of the MDL name, i.e., without any packages and scope qualifiers.

Returns

The simple MDL name of the module.

virtual Mdl_version mi::​neuraylib::​IModule::get_mdl_version() const [pure virtual]

Returns the MDL version of this module.

virtual const IValue_resource* mi::​neuraylib::​IModule::get_resource( Size index) const [pure virtual]

Returns a resource defined in the module. Resources defined in a module that is imported by this module are not included.

virtual Size mi::​neuraylib::​IModule::get_resources_count() const [pure virtual]

Returns the number of resources defined in the module. Resources defined in a module that is imported by this module are not included.

virtual const IType_list* mi::​neuraylib::​IModule::get_types() const [pure virtual]

Returns the types exported by this module.

virtual bool mi::​neuraylib::​IModule::is_mdle_module() const [pure virtual]

Indicates whether this module results from an .mdle file.

virtual bool mi::​neuraylib::​IModule::is_standard_module() const [pure virtual]

Indicates whether this module is a standard module. Examples for standard modules are "limits", "anno", "state", "math", "tex", "noise", and "df".

virtual bool mi::​neuraylib::​IModule::is_valid( IMdl_execution_context* context) const [pure virtual]

Returns true if all imports of the module are valid.

Parameters

context
In case of failure, the execution context can be checked for error messages. Can be NULL.
virtual Sint32 mi::​neuraylib::​IModule::reload( bool recursive, IMdl_execution_context* context) [pure virtual]

Reload the module from disk.

Note:

This function works for file-based modules, only.

Parameters

recursive
If true, all imported file-based modules are reloaded prior to this one.
context
In case of failure, the execution context can be checked for error messages. Can be NULL.

Returns

  • 0: Success
  • -1: Reloading failed, check the context for details.

virtual Sint32 mi::​neuraylib::​IModule::reload_from_string( const char* module_source, bool recursive, IMdl_execution_context* context) [pure virtual]

Reload the module from string.

Note:

This function works for string/memory-based modules, only. Standard modules and the built-in modules mdl::base and mdl::nvidia::distilling_support cannot be reloaded.

Parameters

module_source
The module source code.
recursive
If true, all imported file-based modules are reloaded prior to this one.
context
In case of failure, the execution context can be checked for error messages. Can be NULL.

Returns

  • 0: Success
  • -1: Reloading failed, check the context for details.