The module builder allows to create new MDL modules. More...
#include <imdl_module_builder.h>
Public Member Functions | |
virtual Sint32 | add_variant (const char *name, const char *prototype_name, const IExpression_list *defaults, const IAnnotation_block *annotations, const IAnnotation_block *return_annotations, bool is_exported, bool is_declarative, IMdl_execution_context *context)=0 |
Adds a variant to the module. More... | |
virtual Sint32 | add_function (const char *name, const IExpression *body, const IExpression_list *temporaries, const IType_list *parameters, const IExpression_list *defaults, const IAnnotation_list *parameter_annotations, const IAnnotation_block *annotations, const IAnnotation_block *return_annotations, bool is_exported, bool is_declarative, IType::Modifier frequency_qualifier, IMdl_execution_context *context)=0 |
Adds a material or function to the module. More... | |
virtual Sint32 | add_annotation (const char *name, const IType_list *parameters, const IExpression_list *defaults, const IAnnotation_list *parameter_annotations, const IAnnotation_block *annotations, bool is_exported, IMdl_execution_context *context)=0 |
Adds an annotation to the module. More... | |
virtual Sint32 | add_struct_category (const char *name, const IAnnotation_block *annotations, bool is_exported, IMdl_execution_context *context)=0 |
Adds a struct category the module. More... | |
virtual Sint32 | add_enum_type (const char *name, const IExpression_list *enumerators, const IAnnotation_list *enumerator_annotations, const IAnnotation_block *annotations, bool is_exported, IMdl_execution_context *context)=0 |
Adds an enum type to the module. More... | |
virtual Sint32 | add_struct_type (const char *name, const IType_list *fields, const IExpression_list *field_defaults, const IAnnotation_list *field_annotations, const IAnnotation_block *annotations, bool is_exported, bool is_declarative, const IStruct_category *struct_category, IMdl_execution_context *context)=0 |
Adds a struct type to the module. More... | |
virtual Sint32 | add_constant (const char *name, const IExpression *expr, const IAnnotation_block *annotations, bool is_exported, IMdl_execution_context *context)=0 |
Adds a constant to the module. More... | |
virtual Sint32 | set_module_annotations (const IAnnotation_block *annotations, IMdl_execution_context *context)=0 |
Sets the annotations of the module itself. More... | |
virtual Sint32 | remove_entity (const char *name, Size index, IMdl_execution_context *context)=0 |
Removes a material, function, enum or struct type from the module. More... | |
virtual Sint32 | clear_module (IMdl_execution_context *context)=0 |
Clears the module, i.e., removes all entities from the module. More... | |
virtual const IArray * | analyze_uniform (const IExpression *root_expr, bool root_expr_uniform, IMdl_execution_context *context)=0 |
Analyzes which parameters need to be uniform. 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 IInterface * | get_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 IInterface * | get_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< 0x2357f2f8, ... > | |
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< 0x2357f2f8, ... > | |
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... | |
The module builder allows to create new MDL modules.
|
pure virtual |
Adds an annotation to the module.
name | The simple name of the annotation. |
parameters | Types and names of the parameters. Can be NULL (treated like an empty parameter list). |
defaults | Default values. Can be NULL or incomplete. Feasible sub-expression kinds: constants, calls, and direct calls. |
parameter_annotations | Parameter annotations. Can be NULL or incomplete. |
annotations | Annotations of the annotation. Can be NULL . |
is_exported | Indicates whether the annotation will have the 'export' keyword. |
context | The execution context can be used to pass options and to retrieve error and/or warning messages. Can be NULL . |
|
pure virtual |
Adds a constant to the module.
name | The simple name of the constant. |
expr | The value of the constant. Feasible sub-expression kinds: constants and direct calls. |
annotations | Annotations of the constant. Can be NULL . |
is_exported | Indicates whether the constant will have the 'export' keyword. |
context | The execution context can be used to pass options and to retrieve error and/or warning messages. Can be NULL . |
|
pure virtual |
Adds an enum type to the module.
name | The simple name of the enum type. |
enumerators | Enumerators of the enum type. Must not be empty. Feasible sub-expression kinds: constants and direct calls. |
enumerator_annotations | Enumerator annotations. Can be NULL or incomplete. |
annotations | Annotations of the enum type. Can be NULL . |
is_exported | Indicates whether the enum type will have the 'export' keyword. |
context | The execution context can be used to pass options and to retrieve error and/or warning messages. Can be NULL . |
|
pure virtual |
Adds a material or function to the module.
name | The simple name of the material or function. |
body | The body of the new material or function (a constant, direct call, or parameter reference). Feasible sub-expression kinds: constants, direct calls, parameter references, and temporary references. |
temporaries | Temporaries referenced by the body. Feasible sub-expression kinds: constants, direct calls, parameter references, and temporary references with smaller index. The names associated with the expressions in the expressions list are not relevant (but need to unique as usual). Can be NULL (treated like an empty expression list). |
parameters | Types and names of the parameters. Can be NULL (treated like an empty parameter list). |
defaults | Default values. Can be NULL or incomplete. Feasible sub-expression kinds: constants, calls, and direct calls. |
parameter_annotations | Parameter annotations. Can be NULL or incomplete. |
annotations | Annotations of the material or function. Can be NULL . |
return_annotations | Return annotations of the function. Can be NULL for functions, must be NULL for materials. |
is_exported | Indicates whether the material or function will have the 'export' keyword. |
is_declarative | Indicates whether the material or function will have the 'declarative' keyword. |
frequency_qualifier | The frequency qualifier for functions, or mi::neuraylib::IType::MK_NONE for materials. |
context | The execution context can be used to pass options and to retrieve error and/or warning messages. Can be NULL . |
|
pure virtual |
Adds a struct category the module.
name | The simple name of the struct category. |
annotations | Annotations of the struct category. Can be NULL . |
is_exported | Indicates whether the struct category will have the 'export' keyword. |
context | The execution context can be used to pass options and to retrieve error and/or warning messages. Can be NULL . |
|
pure virtual |
Adds a struct type to the module.
name | The simple name of the enum type. |
fields | Fields of the struct type. Must not be empty. |
field_defaults | Defaults of the struct fields. Can be NULL or incomplete. Feasible sub-expression kinds: constants and direct calls. |
field_annotations | Field annotations of the struct type. Can be NULL or incomplete. |
annotations | Annotations of the struct type. Can be NULL . |
is_exported | Indicates whether the struct type will have the 'export' keyword. |
is_declarative | Indicates whether the struct type will have the 'declarative' keyword. |
struct_category | The corresponding struct category. Can be NULL . |
context | The execution context can be used to pass options and to retrieve error and/or warning messages. Can be NULL . |
|
pure virtual |
Adds a variant to the module.
name | The simple name of the material or function variant. |
prototype_name | The DB name of the prototype of the new variant. |
defaults | Default values to set. If NULL , the defaults of the original material or function are used. Feasible sub-expression kinds: constants and calls. |
annotations | Annotations to set. If NULL , the annotations of the original material or function are used. Pass an empty block to remove all annotations. |
return_annotations | Return annotations to set. If NULL , the annotations of the original material or function are used. Pass an empty block to remove all annotations. Materials require NULL or an empty annotation block here. |
is_exported | Indicates whether the variant will have the 'export' keyword. |
is_declarative | Indicates whether the variant will have the 'declarative' keyword. |
context | The execution context can be used to pass options and to retrieve error and/or warning messages. Can be NULL . |
|
pure virtual |
Analyzes which parameters need to be uniform.
Note that the method can fail if the graph to be analyzed is invalid and/or never uniform independent of uniform modifiers of parameter types.
root_expr_uniform is false | root_expr_uniform is true | Interpretation |
---|---|---|
failure | failure | The graph is invalid. |
failure | success | This case is not possible. |
success | failure | The graph is never uniform. |
success | success | The graph is uniform if the parameters returned in the true case are made uniform. |
If the graph should be uniform, and you cannot rule out invalid graphs, then you might want to invoke this method first with root_expr_uniform
set to false
to check for validity. If that method succeeds, you can then call it again with root_expr_uniform
set to true
to obtain the constraints on the parameters.
root_expr | Root expression of the graph, i.e., the body of the new material or function. Feasible sub-expression kinds: constants, direct calls, and parameter references. |
root_expr_uniform | Indicates whether the root expression should be uniform. |
context | The execution context can be used to pass options and to retrieve error and/or warning messages. Can be NULL . |
NULL
in case of errors). The array indices match the indices of the parameter references. The array might be shorter than expected if trailing parameters are not referenced by root_expr
.
|
pure virtual |
Clears the module, i.e., removes all entities from the module.
|
pure virtual |
Removes a material, function, enum or struct type from the module.
name | The simple name of material, function, enum or struct type to be removed. |
index | The index of the function with the given name to be removed. Used to distinguish overloads of functions. Zero for materials, enum or struct types. |
context | The execution context can be used to pass options and to retrieve error and/or warning messages. Can be NULL . |
|
pure virtual |
Sets the annotations of the module itself.
annotations | Annotations of the module. Pass NULL to remove existing annotations. |
context | The execution context can be used to pass options and to retrieve error and/or warning messages. Can be NULL . |