neuray API Programmer's Manual

mi::neuraylib::IExpression_call Class Reference

[MDL type system]

Description

An indirect call expression. This call expression is called indirect since it just references another DB element representing the actual call. This contrasts with mi::neuraylib::IExpression_direct_call for direct call expressions. See below for a more detailed comparison.

Indirect call expressions appear as defaults of material or function definitions, as arguments of material instances or function calls, and as defaults in the module builder.

Indirect vs direct calls

There are two different types of call expressions, indirect calls (represented by this interface mi::neuraylib::IExpression_call) and direct calls (represented by mi::neuraylib::IExpression_direct_call). Both have their disjoint use cases, and they never appear together in the very same expression graph.

Indirect calls are used where the expression graph is frequently changed by the user, in particular for arguments of function calls and material instances. These indirect calls simply reference another DB element by name, which represents the actual call. Note that such an argument might not just be a constant or a single call (with constants as arguments), but can be a rather complex graph (so-called open material graphs). The indirection via DB elements allows to access any such graph node directly (assuming its name is known) in order to modify it, without traversing the entire expression graph first to reach a given node.

Direct calls are used where the expression graph is fixed (bodies of material and function definitions, and compiled materials), or where such a graph is constructed once and not modified later (bodies in the module builder). In these cases the indirection via DB elements is not necessary and would be rather cumbersome.

Note that defaults use indirect calls, even though they are fixed. This exception was made to stress the similarity to arguments, e.g., it allows to pass a default as a new argument to mi::neuraylib::IFunction_call::set_argument().

Public Member Functions

virtual const char* get_call() const =0
Returns the DB name of the referenced function call or material instance.
virtual Sint32 set_call( const char* name) =0
Sets the name of the referenced function call or material instance. More...

Static Public Variables

static const Kind s_kind = EK_CALL
The kind of this subclass.

Member Functions

virtual const char* mi::​neuraylib::​IExpression_call::get_call() const [pure virtual]

Returns the DB name of the referenced function call or material instance.

virtual Sint32 mi::​neuraylib::​IExpression_call::set_call( const char* name) [pure virtual]

Sets the name of the referenced function call or material instance.

Parameters

name
The DB name of the function call or material instance.

Returns

  • 0: Success.
  • -1: Invalid parameter (NULL pointer).
  • -2: There is no DB element with that name.
  • -3: The DB element has not the correct type.
  • -4: The return type of the DB element does not match the type of this expression.
  • -5: The material instance or function call referenced by "name" is a parameter default and therefore cannot be used in a call.
  • -6: The material instance or function call referenced by "name" is invalid and therefore cannot be used in a call.

Variables

const Kind mi::​neuraylib::​IExpression_call::s_kind = EK_CALL [static]

The kind of this subclass.