A wrapper around the interfaces for MDL annotations.
More...
#include <annotation_wrapper.h>
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.
◆ Annotation_wrapper()
Constructs a helper that provides convenience methods for annotations.
- Parameters
-
anno_block | Block of annotations attached to a module, function, etc.
|
◆ get_annotation_count()
mi::Size mi::neuraylib::Annotation_wrapper::get_annotation_count |
( |
| ) |
const |
|
inline |
Get the number of the annotations.
- Returns
- The number of annotations
◆ get_annotation_index()
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.
◆ get_annotation_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
◆ get_annotation_param_count()
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.
◆ get_annotation_param_name()
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
◆ get_annotation_param_type()
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
◆ get_annotation_param_value() [1/2]
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
◆ get_annotation_param_value() [2/2]
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.
◆ get_annotation_param_value_by_name() [1/2]
const mi::neuraylib::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
◆ get_annotation_param_value_by_name() [2/2]
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.