mi::neuraylib::IExpression_temporary Class Reference
[MDL type system]
Description
A temporary reference expression. Temporary reference expressions are used to make the structure of DAGs (directed acyclic graphs) more explicit. Consider a diamond-shaped graph with four nodes A, B, C, and D. Node A references nodes B and C, and both nodes B and C reference node D.
Note that in this example we use letters to identify the nodes. But expressions themselves do not have names. And the neuray API does not guarantee identical pointer addresses for repeated accesses to the (logically) same object. For example, repeated calls of mi::neuraylib::IExpression_direct_call::get_arguments() followed by mi::neuraylib::IExpression_list::get_expression() result in different pointers, although logically the result is always the same (for the same input). Therefore, a different mechanism is needed to recognize nodes that can be visited several times in a traversal.
This is where temporary references come into play. In an expression graph for the example above, the nodes B and C do not point directly to node D, but to two temporary reference expressions, both with the same index. The node D can then be retrieved by passing that index to mi::neuraylib::IFunction_definition::get_temporary() or mi::neuraylib::ICompiled_material::get_temporary().
Note that, despite the name mi::neuraylib::IExpression_temporary, expressions of this type are not the temporaries themselves, but references to temporaries. Temporaries can be nested, i.e., a temporary with index i might contain temporary references for other temporaries with indices up to i-1.
Temporary reference expressions appear in fields (and temporaries) of compiled materials, and in the bodies (and temporaries) of function and material definitions.
Public Member Functions
- virtual Size get_index() const =0
- Returns the index of the referenced temporary.
- virtual void set_index( Size index) =0
- Sets the index of the referenced temporary.
Static Public Variables
Member Functions
- virtual Size mi::neuraylib::IExpression_temporary::get_index() const [pure virtual]
-
Returns the index of the referenced temporary.
- virtual void mi::neuraylib::IExpression_temporary::set_index( Size index) [pure virtual]
-
Sets the index of the referenced temporary.
Variables
- const Kind mi::neuraylib::IExpression_temporary::s_kind = EK_TEMPORARY [static]
-
The kind of this subclass.