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

An indirect call expression. More...

#include <iexpression.h>

Inheritance diagram for mi::neuraylib::IExpression_call:

Public Member Functions

virtual const char * get_call () const =0
 Returns the DB name of the referenced function call or material instance. More...
 
virtual Sint32 set_call (const char *name)=0
 Sets the name of the referenced function call or material instance. More...
 
- Public Member Functions inherited from mi::neuraylib::IExpression
virtual Kind get_kind () const =0
 Returns the kind of this expression. More...
 
virtual const ITypeget_type () const =0
 Returns the type of this expression. More...
 
template<class T>
const T * get_type () const
 Returns the type of this expression. 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...
 

Static Public Attributes

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

Additional Inherited Members

- Public Types inherited from mi::base::Interface_declare< 0xcf625aec, ... >
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::neuraylib::IExpression
enum  Kind {
  EK_CONSTANT ,
  EK_CALL ,
  EK_PARAMETER ,
  EK_DIRECT_CALL ,
  EK_TEMPORARY ,
  EK_FORCE_32_BIT = 0xffffffffU
}
 The possible kinds of expressions. More...
 
- Public Types inherited from mi::base::Interface_declare< 0x0f4a7542, ... >
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< 0xcf625aec, ... >
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::Interface_declare< 0x0f4a7542, ... >
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

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().

Member Function Documentation

 get_call()

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

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

 set_call()

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

Member Data Documentation

 s_kind

const Kind mi::neuraylib::IExpression_call::s_kind = EK_CALL
static

The kind of this subclass.