neuray API Programmer's Manual

mi::neuraylib::Annotation_wrapper Class Reference

[MDL-related elements]

Description

A wrapper around the interfaces for MDL annotations. The purpose of the MDL helper is to simplify working with MDL annotations. It is wrapping API call sequences occurring in typical tasks into one single method call.

See mi::neuraylib::IAnnotation_block and mi::neuraylib::IAnnotation for the underlying interfaces. See also mi::neuraylib::Definition_wrapper for a similar wrapper for MDL material and function definitions.

General methods

 Annotation_wrapper( const mi::​neuraylib::​IAnnotation_block* anno_block)
Constructs a helper that provides convenience methods for annotations. More...
mi::​Size get_annotation_count() const
Get the number of the annotations. More...
mi::​Size get_annotation_index( const char* anno_name, mi::​Size offset = 0) const
Get the index of an annotation based on its name for one of the annotations. More...
const char* get_annotation_name( mi::​Size anno_index) const
Get the name of the annotation for one of the annotations. More...
mi::​Size get_annotation_param_count( mi::​Size anno_index) const
Get the number of parameters of an annotation. More...
const char* get_annotation_param_name( mi::​Size anno_index, mi::​Size param_index) const
Get the name of one of the parameters of one of the annotations. More...
const ITypeget_annotation_param_type( mi::​Size anno_index, mi::​Size param_index) const
Get the type of one of the parameters of one of the annotations. More...
const IValueget_annotation_param_value( mi::​Size anno_index, mi::​Size param_index) const
Get the value of one of the parameters of one of the annotations. More...
template< class T>mi::​Sint32 get_annotation_param_value( mi::​Size anno_index, mi::​Size param_index, T& value) const
Get the value of one of the parameters of one of the annotations. More...
const IValueget_annotation_param_value_by_name( const char* anno_name, mi::​Size param_index) const
Get the value of one of the parameters of one of the annotations. More...
template< class T>mi::​Sint32 get_annotation_param_value_by_name( const char* anno_name, mi::​Size param_index, T& value) const
Get the value of one of the parameters of one of the annotations. More...

Constructors

mi::​neuraylib::​Annotation_wrapper::Annotation_wrapper( const mi::​neuraylib::​IAnnotation_block* anno_block) [inline]

Constructs a helper that provides convenience methods for annotations.

Parameters

anno_block
Block of annotations attached to a module, function, etc.

Member Functions

mi::​Size mi::​neuraylib::​Annotation_wrapper::get_annotation_count() const [inline]

Get the number of the annotations.

Returns

The number of annotations

mi::​Size mi::​neuraylib::​Annotation_wrapper::get_annotation_index( const char* anno_name, mi::​Size offset = 0) const [inline]

Get the index of an annotation based on its name for one of the annotations.

Parameters

anno_name
The name of the annotation
offset
The first index to be considered in the search. If zero, the entire annotation block is searched.

Returns

  • index: of the annotation in case of success.
  • -1: If there is none with that name.

const char* mi::​neuraylib::​Annotation_wrapper::get_annotation_name( mi::​Size anno_index) const [inline]

Get the name of the annotation for one of the annotations.

Parameters

anno_index
The index of the annotation

Returns

The name of the annotation

mi::​Size mi::​neuraylib::​Annotation_wrapper::get_annotation_param_count( mi::​Size anno_index) const [inline]

Get the number of parameters of an annotation.

Parameters

anno_index
The index of the annotation

Returns

The number of parameters of an annotation.

const char* mi::​neuraylib::​Annotation_wrapper::get_annotation_param_name( mi::​Size anno_index, mi::​Size param_index) const [inline]

Get the name of one of the parameters of one of the annotations.

Parameters

anno_index
The index of the annotation
param_index
The index of the parameter value to query

Returns

The name, or NULL if it does not exist

const IType* mi::​neuraylib::​Annotation_wrapper::get_annotation_param_type( mi::​Size anno_index, mi::​Size param_index) const [inline]

Get the type of one of the parameters of one of the annotations.

Parameters

anno_index
The index of the annotation
param_index
The index of the parameter value to query

Returns

The type, or NULL if it does not exist

const IValue* mi::​neuraylib::​Annotation_wrapper::get_annotation_param_value( mi::​Size anno_index, mi::​Size param_index) const [inline]

Get the value of one of the parameters of one of the annotations.

Parameters

anno_index
The index of the annotation
param_index
The index of the parameter value to query

Returns

The value, or NULL if it does not exist

template< class T>

mi::​Sint32 mi::​neuraylib::​Annotation_wrapper::get_annotation_param_value( mi::​Size anno_index, mi::​Size param_index, T& value) const [inline]

Get the value of one of the parameters of one of the annotations.

Parameters

anno_index
The index of the annotation
param_index
The index of the parameter value to query
value
The value returned

Returns

  • 0: Success.
  • -1: The type of the parameter does not match the template type of T.
  • -3: The index parameter is not valid for the provided annotation block.

const IValue* mi::​neuraylib::​Annotation_wrapper::get_annotation_param_value_by_name( const char* anno_name, mi::​Size param_index) const [inline]

Get the value of one of the parameters of one of the annotations.

Parameters

anno_name
The name of the annotation
param_index
The index of the parameter value to query

Returns

The value, or NULL if it does not exist

template< class T>

mi::​Sint32 mi::​neuraylib::​Annotation_wrapper::get_annotation_param_value_by_name( const char* anno_name, mi::​Size param_index, T& value) const [inline]

Get the value of one of the parameters of one of the annotations.

Parameters

anno_name
The name of the annotation
param_index
The index of the parameter value to query
value
The value returned

Returns

  • 0: Success.
  • -1: The type of the parameter does not match the template type of T.
  • -3: The name parameter is not valid for the provided annotation block.