7#ifndef MI_NEURAYLIB_DEFINITION_WRAPPER_H
8#define MI_NEURAYLIB_DEFINITION_WRAPPER_H
254 if( !ptr_iscene_element)
256 T* ptr_T =
static_cast<T*
>( ptr_iscene_element->
get_interface(
typename T::IID()));
278 const std::string&
get_name()
const;
303 m_type = m_access ? m_access->get_element_type() :
static_cast<Element_type>( 0);
308 return m_access.is_valid_interface();
317 return m_access->is_valid( context);
330 return m_access->get_mdl_name();
338 return m_access->get_module();
346 return m_access->is_exported();
354 return m_access->is_material();
362 return m_access->get_parameter_count();
370 return m_access->get_parameter_name( index);
378 return m_access->get_parameter_index( name);
386 return m_access->get_parameter_types();
394 return m_access->get_return_type();
402 return m_access->get_thumbnail();
410 return m_access->get_defaults();
425 if( !default_constant)
429 return result == 0 ? 0 : -5;
444 if( !default_constant)
448 return result == 0 ? 0 : -5;
456 return m_access->get_annotations();
464 return m_access->get_parameter_annotations();
472 return m_access->get_return_annotations();
480 return m_access->get_enable_if_conditions();
488 return m_access->get_enable_if_users( index);
494 return static_cast<Size>( ~0);
496 return m_access->get_enable_if_user( index, u_index);
506 return m_access->create_function_call( arguments, errors);
522 m_access->get_parameter_annotations());
525 m_mdl_factory->create_expression_factory( m_transaction.get()));
528 Size count = m_access->get_parameter_count();
529 for(
Size i = 0; i < count; ++i) {
530 const char* name = m_access->get_parameter_name( i);
535 parameter_annotations->get_annotation_block( name));
538 local_arguments->add_expression( name, expr.
get());
541 return m_access->create_function_call( local_arguments.
get(), errors);
546 m_transaction->retain();
547 return m_transaction.get();
552 m_mdl_factory->retain();
553 return m_mdl_factory.get();
559 return m_access.get();
Handle class template for interfaces, automatizing the lifetime control via reference counting.
Definition: handle.h:113
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:333
Sint32 get_default(Size index, T &value) const
Returns the default of a non-array parameter.
Definition: definition_wrapper.h:414
const IExpression_list * get_enable_if_conditions() const
Returns the enable_if conditions of all parameters.
Definition: definition_wrapper.h:475
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:293
const IExpression_list * get_defaults() const
Returns the defaults of all parameters.
Definition: definition_wrapper.h:405
const char * get_mdl_definition() const
Returns the MDL name of the material or function definition.
Definition: definition_wrapper.h:325
const IAnnotation_list * get_parameter_annotations() const
Returns the annotations of all parameters.
Definition: definition_wrapper.h:459
const IType * get_return_type() const
Returns the return type.
Definition: definition_wrapper.h:389
const IType_list * get_parameter_types() const
Returns the types of all parameters.
Definition: definition_wrapper.h:381
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:491
bool is_material() const
Indicates whether the definition represents a material.
Definition: definition_wrapper.h:349
bool is_exported() const
Indicates whether the material or function definition is exported by its module.
Definition: definition_wrapper.h:341
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:312
T * create_instance(const IExpression_list *arguments=0, Sint32 *errors=0) const
Creates an instance of the material or function definition.
Definition: definition_wrapper.h:251
IMdl_factory * get_mdl_factory() const
Get the MDL factory.
Definition: definition_wrapper.h:550
ITransaction * get_transaction() const
Get the transaction.
Definition: definition_wrapper.h:544
Element_type get_type() const
Indicates whether the definition wrapper acts on a material definition or on a function definition.
Definition: definition_wrapper.h:320
const char * get_parameter_name(Size index) const
Returns the name of the parameter at index.
Definition: definition_wrapper.h:365
Element_type get_element_type() const
Get the element type.
Definition: definition_wrapper.h:562
const IAnnotation_block * get_return_annotations() const
Returns the annotations of the return type.
Definition: definition_wrapper.h:467
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:483
const std::string & get_name() const
Get the DB name of the MDL function or material definition.
Definition: definition_wrapper.h:567
const IFunction_definition * get_scene_element() const
Get the MDL function or material definition.
Definition: definition_wrapper.h:556
bool is_valid() const
Indicates whether the definition wrapper is in a valid state.
Definition: definition_wrapper.h:306
const IAnnotation_block * get_annotations() const
Returns the annotations for a material or function definition.
Definition: definition_wrapper.h:451
IFunction_call * create_instance(const IExpression_list *arguments=0, Sint32 *errors=0) const
Creates an instance of the material or function definition.
Definition: definition_wrapper.h:499
Size get_parameter_index(const char *name) const
Returns the index position of a parameter.
Definition: definition_wrapper.h:373
const char * get_thumbnail() const
Returns the resolved file name of the thumbnail image for this MDL definition.
Definition: definition_wrapper.h:397
Size get_parameter_count() const
Returns the number of parameters.
Definition: definition_wrapper.h:357
An annotation block is an array of annotations.
Definition: iexpression.h:573
An ordered collection of annotation blocks identified by name or index.
Definition: iexpression.h:601
A constant expression.
Definition: iexpression.h:94
An ordered collection of expressions identified by name or index.
Definition: iexpression.h:315
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:391
@ 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:389
@ DS_ARRAY_INDEX
The array index operator. See Array index operator.
Definition: ifunction_definition.h:89
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:83
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:540
The interface to MDL types.
Definition: itype.h:51
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:439
Handle<New_interface> get_interface() const
Returns a new handle for a possibly different interface type, similar to a dynamic cast,...
Definition: handle.h:353
Interface * get() const
Access to the interface. Returns 0 for an invalid interface.
Definition: handle.h:294
virtual Uint32 release() const =0
Decrements the reference count.
Uint64 Size
Unsigned integral type that is large enough to hold the size of all types.
Definition: types.h:112
signed int Sint32
32-bit signed integer.
Definition: types.h:46
#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:1254
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.