neuray API Programmer's Manual

mi::neuraylib::IExpression_list Class Reference

[MDL type system]

Description

An ordered collection of expressions identified by name or index. Expression lists can be created with mi::neuraylib::IExpression_factory::create_expression_list().

Public Member Functions

virtual Sint32 add_expression( const char* name, const IExpression* expression) =0
Adds an expression at the end of the list. More...
virtual const IExpressionget_expression( Size index) const =0
Returns the expression for index, or NULL if there is no such expression. More...
template< class T>const T* get_expression( Size index) const
Returns the expression for index, or NULL if there is no such expression. More...
virtual const IExpressionget_expression( const char* name) const =0
Returns the expression for name, or NULL if there is no such expression. More...
template< class T>const T* get_expression( const char* name) const
Returns the expression for name, or NULL if there is no such expression. More...
virtual Size get_index( const char* name) const =0
Returns the index for the given name, or -1 if there is no such expression.
virtual const char* get_name( Size index) const =0
Returns the name for the given index, or NULL if there is no such expression.
virtual Size get_size() const =0
Returns the number of elements.
virtual Sint32 set_expression( Size index, const IExpression* expression) =0
Sets an expression at a given index. More...
virtual Sint32 set_expression( const char* name, const IExpression* expression) =0
Sets an expression identified by name. More...

Member Functions

virtual Sint32 mi::​neuraylib::​IExpression_list::add_expression( const char* name, const IExpression* expression) [pure virtual]

Adds an expression at the end of the list.

Returns

- 0: Success.

  • -1: Invalid parameter (NULL pointer).
  • -2: There is already an expression mapped to name in the list.

virtual const IExpression* mi::​neuraylib::​IExpression_list::get_expression( Size index) const [pure virtual]

Returns the expression for index, or NULL if there is no such expression. This index-based overload is faster than the name-based overload get_expression( const char*)constand should be preferred if the index is known.

Note:

Expression lists for defaults and enable-if conditions might not contain an expression for every parameter. Therefore, indices in such lists are not guaranteed to match the parameter indices.

template< class T>

const T* mi::​neuraylib::​IExpression_list::get_expression( Size index) const [inline]

Returns the expression for index, or NULL if there is no such expression. This index-based overload is faster than the name-based overload get_expression< T>( const char*)constand should be preferred if the index is known.

Note:

Expression lists for defaults and enable-if conditions might not contain an expression for every parameter. Therefore, indices in such lists are not guaranteed to match the parameter indices.

virtual const IExpression* mi::​neuraylib::​IExpression_list::get_expression( const char* name) const [pure virtual]

Returns the expression for name, or NULL if there is no such expression. The index-based overload get_expression( const char*)constis faster than this name-based overload and should be preferred if the index is known.

template< class T>

const T* mi::​neuraylib::​IExpression_list::get_expression( const char* name) const [inline]

Returns the expression for name, or NULL if there is no such expression. The index-based overload get_expression< T>( const char*)constis faster than this name-based overload and should be preferred if the index is known.

virtual Size mi::​neuraylib::​IExpression_list::get_index( const char* name) const [pure virtual]

Returns the index for the given name, or -1 if there is no such expression.

virtual const char* mi::​neuraylib::​IExpression_list::get_name( Size index) const [pure virtual]

Returns the name for the given index, or NULL if there is no such expression.

virtual Size mi::​neuraylib::​IExpression_list::get_size() const [pure virtual]

Returns the number of elements.

virtual Sint32 mi::​neuraylib::​IExpression_list::set_expression( Size index, const IExpression* expression) [pure virtual]

Sets an expression at a given index. This index-based overload is faster than the name-based overload set_expression( const char*, const IExpression*) and should be preferred if the index is known.

Returns

- 0: Success.

  • -1: Invalid parameter (NULL pointer).
  • -2: index is out of bounds.

virtual Sint32 mi::​neuraylib::​IExpression_list::set_expression( const char* name, const IExpression* expression) [pure virtual]

Sets an expression identified by name. The index-based overload set_expression( const char*, const IExpression*) is faster than this name-based overload and should be preferred if the index is known.

Returns

- 0: Success.

  • -1: Invalid parameter (NULL pointer).
  • -2: There is no expression mapped to name in the list.