7#ifndef MI_NEURAYLIB_DEFINITION_WRAPPER_H
8#define MI_NEURAYLIB_DEFINITION_WRAPPER_H
256 if( !ptr_iscene_element)
258 T* ptr_T =
static_cast<T*
>( ptr_iscene_element->
get_interface(
typename T::IID()));
280 const std::string&
get_name()
const;
305 m_type = m_access ? m_access->get_element_type() :
static_cast<Element_type>( 0);
310 return m_access.is_valid_interface();
319 return m_access->is_valid( context);
332 return m_access->get_mdl_name();
340 return m_access->get_module();
348 return m_access->is_exported();
356 return m_access->is_declarative();
364 return m_access->is_material();
372 return m_access->get_parameter_count();
380 return m_access->get_parameter_name( index);
388 return m_access->get_parameter_index( name);
396 return m_access->get_parameter_types();
404 return m_access->get_return_type();
412 return m_access->get_thumbnail();
420 return m_access->get_defaults();
435 if( !default_constant)
439 return result == 0 ? 0 : -5;
454 if( !default_constant)
458 return result == 0 ? 0 : -5;
466 return m_access->get_annotations();
474 return m_access->get_parameter_annotations();
482 return m_access->get_return_annotations();
490 return m_access->get_enable_if_conditions();
498 return m_access->get_enable_if_users( index);
504 return static_cast<Size>( ~0);
506 return m_access->get_enable_if_user( index, u_index);
516 return m_access->create_function_call( arguments, errors);
533 m_access->get_parameter_annotations());
536 m_mdl_factory->create_expression_factory( m_transaction.get()));
539 Size count = m_access->get_parameter_count();
540 for(
Size i = 0; i < count; ++i) {
541 const char* name = m_access->get_parameter_name( i);
546 parameter_annotations->get_annotation_block( name));
549 local_arguments->add_expression( name, expr.
get());
552 return m_access->create_function_call( local_arguments.
get(), errors);
557 m_transaction->retain();
558 return m_transaction.get();
563 m_mdl_factory->retain();
564 return m_mdl_factory.get();
570 return m_access.get();
Handle class template for interfaces, automatizing the lifetime control via reference counting.
Definition: handle.h:112
A wrapper around the interface for MDL function definitions.
Definition: definition_wrapper.h:44
const char * get_module() const
Returns the DB name of the corresponding module.
Definition: definition_wrapper.h:335
Sint32 get_default(Size index, T &value) const
Returns the default of a non-array parameter.
Definition: definition_wrapper.h:424
const IExpression_list * get_enable_if_conditions() const
Returns the enable_if conditions of all parameters.
Definition: definition_wrapper.h:485
Definition_wrapper(ITransaction *transaction, const char *name, IMdl_factory *mdl_factory)
Constructs an MDL definition wrapper for a fixed material or function definition.
Definition: definition_wrapper.h:295
const IExpression_list * get_defaults() const
Returns the defaults of all parameters.
Definition: definition_wrapper.h:415
const char * get_mdl_definition() const
Returns the MDL name of the material or function definition.
Definition: definition_wrapper.h:327
const IAnnotation_list * get_parameter_annotations() const
Returns the annotations of all parameters.
Definition: definition_wrapper.h:469
const IType * get_return_type() const
Returns the return type.
Definition: definition_wrapper.h:399
const IType_list * get_parameter_types() const
Returns the types of all parameters.
Definition: definition_wrapper.h:391
Size get_enable_if_user(Size index, Size u_index) const
Returns the index of a parameter whose enable_if condition might depend on the argument of the given ...
Definition: definition_wrapper.h:501
bool is_material() const
Indicates whether the definition represents a material.
Definition: definition_wrapper.h:359
bool is_exported() const
Indicates whether the material or function definition is exported by its module.
Definition: definition_wrapper.h:343
IFunction_call * create_instance(const IExpression_list *arguments=nullptr, Sint32 *errors=nullptr) const
Creates an instance of the material or function definition.
Definition: definition_wrapper.h:509
bool is_valid_definition(IMdl_execution_context *context) const
Indicates whether the material or function definition referenced by this definition wrapper matches a...
Definition: definition_wrapper.h:314
T * create_instance(const IExpression_list *arguments=nullptr, Sint32 *errors=nullptr) const
Creates an instance of the material or function definition.
Definition: definition_wrapper.h:253
IMdl_factory * get_mdl_factory() const
Get the MDL factory.
Definition: definition_wrapper.h:561
ITransaction * get_transaction() const
Get the transaction.
Definition: definition_wrapper.h:555
Element_type get_type() const
Indicates whether the definition wrapper acts on a material definition or on a function definition.
Definition: definition_wrapper.h:322
bool is_declarative() const
Indicates whether the material or function definition is declarative.
Definition: definition_wrapper.h:351
const char * get_parameter_name(Size index) const
Returns the name of the parameter at index.
Definition: definition_wrapper.h:375
Element_type get_element_type() const
Get the element type.
Definition: definition_wrapper.h:573
const IAnnotation_block * get_return_annotations() const
Returns the annotations of the return type.
Definition: definition_wrapper.h:477
Size get_enable_if_users(Size index) const
Returns the number of other parameters whose enable_if condition might depend on the argument of the ...
Definition: definition_wrapper.h:493
const std::string & get_name() const
Get the DB name of the MDL function or material definition.
Definition: definition_wrapper.h:578
const IFunction_definition * get_scene_element() const
Get the MDL function or material definition.
Definition: definition_wrapper.h:567
bool is_valid() const
Indicates whether the definition wrapper is in a valid state.
Definition: definition_wrapper.h:308
const IAnnotation_block * get_annotations() const
Returns the annotations for a material or function definition.
Definition: definition_wrapper.h:461
Size get_parameter_index(const char *name) const
Returns the index position of a parameter.
Definition: definition_wrapper.h:383
const char * get_thumbnail() const
Returns the resolved file name of the thumbnail image for this MDL definition.
Definition: definition_wrapper.h:407
Size get_parameter_count() const
Returns the number of parameters.
Definition: definition_wrapper.h:367
An annotation block is an array of annotations.
Definition: iexpression.h:580
An ordered collection of annotation blocks identified by name or index.
Definition: iexpression.h:610
A constant expression.
Definition: iexpression.h:97
An ordered collection of expressions identified by name or index.
Definition: iexpression.h:319
This interface represents a function call.
Definition: ifunction_call.h:52
This interface represents a function definition.
Definition: ifunction_definition.h:44
Semantics
All known semantics of functions definitions.
Definition: ifunction_definition.h:54
@ DS_INTRINSIC_DAG_ARRAY_LENGTH
The array length operator. See Array length operator.
Definition: ifunction_definition.h:401
@ DS_TERNARY
The ternary operator (conditional). See Ternary operator.
Definition: ifunction_definition.h:126
@ DS_CAST
The cast operator. See Cast operator.
Definition: ifunction_definition.h:81
@ DS_INTRINSIC_DAG_ARRAY_CONSTRUCTOR
The array constructor. See Array constructor.
Definition: ifunction_definition.h:399
@ DS_ARRAY_INDEX
The array index operator. See Array index operator.
Definition: ifunction_definition.h:89
@ DS_INTRINSIC_DAG_DECL_CAST
The decl_cast operator. See Decl_cast operator.
Definition: ifunction_definition.h:403
The execution context can be used to query status information like error and warning messages concern...
Definition: imdl_execution_context.h:131
Factory for various MDL interfaces and functions.
Definition: imdl_factory.h:53
Common base interface for all scene elements.
Definition: iscene_element.h:75
A transaction provides a consistent view on the database.
Definition: itransaction.h:82
virtual const base::IInterface * access(const char *name)=0
Retrieves an element from the database.
An ordered collection of types identified by name or index.
Definition: itype.h:650
The interface to MDL types.
Definition: itype.h:154
virtual const IInterface * get_interface(const Uuid &interface_id) const =0
Acquires a const interface from another.
Handle<Interface> make_handle_dup(Interface *iptr)
Converts passed-in interface pointer to a handle, without taking interface over.
Definition: handle.h:434
Handle<New_interface> get_interface() const
Returns a new handle for a possibly different interface type, similar to a dynamic cast,...
Definition: handle.h:348
Interface * get() const
Access to the interface. Returns 0 for an invalid interface.
Definition: handle.h:289
virtual Uint32 release() const =0
Decrements the reference count.
int Sint32
32-bit signed integer.
Definition: types.h:46
Uint64 Size
Unsigned integral type that is large enough to hold the size of all types.
Definition: types.h:112
#define mi_neuray_assert(expr)
If expr evaluates to true this macro shall have no effect.
Definition: assert.h:67
mi::Sint32 get_value(const mi::neuraylib::IValue *value, T &v)
Simplifies reading the value of mi::neuraylib::IValue into the corresponding classes from the base an...
Definition: ivalue.h:1255
Element_type
Distinguishes scene elements.
Definition: iscene_element.h:30
Smart-pointer handle class for interfaces, const and non-const version.
Expressions of the MDL type system.
Scene element Function_call.
Scene element Function_definition.
Scene element Material_instance.
API component that gives access to some MDL functionality.
Types of the MDL type system.
Values of the MDL type system.
Common namespace for APIs of NVIDIA Advanced Rendering Center GmbH.
Definition: example_derivatives.dox:5
Assertions and compile-time assertions.