neuray API Programmer's Manual

mi::IEnum Class Reference

[Simple Types]

Description

This interface represents enums. Enums are based on an enum declaration which defines the enumerators of the enum (their names and values). The type name of an enum is the name that was used to register its enum declaration. This type name can be used to create instances of a particular enum declaration (note that "Enum" itself is not a valid type name as it does not contain any information about a concrete enum type).

Note:

The value returned by mi::IData::get_type_name() might start with '{' which indicates that it has been automatically generated. In this case the type name should be treated as an opaque string since its format might change unexpectedly. It is perfectly fine to pass it to other methods, e.g., mi::neuraylib::IFactory::create(), but you should not attempt to interpret the value in any way. Use get_enum_decl() to obtain information about the type itself.

See also:

mi::IEnum_decl

Public Member Functions

virtual const IEnum_declget_enum_decl() const =0
Returns the enum declaration for this enum.
virtual void get_value( Sint32& value) const =0
Returns the value of the enum as value of the corresponding enumerator. More...
Sint32 get_value() const
Returns the value of the enum as value of the corresponding enumerator. More...
virtual const char* get_value_by_name() const =0
Returns the value of the enum as name of the enumerator. More...
virtual Sint32 set_value( Sint32 value) =0
Sets the enum via the value of an enumerator. More...
virtual Sint32 set_value_by_name( const char* name) =0
Sets the enum via the name of an enumerator. More...

Member Functions

virtual const IEnum_decl* mi::​IEnum::get_enum_decl() const [pure virtual]

Returns the enum declaration for this enum.

virtual void mi::​IEnum::get_value( Sint32& value) const [pure virtual]

Returns the value of the enum as value of the corresponding enumerator.

See also:

get_value_by_name()

Sint32 mi::​IEnum::get_value() const [inline]

Returns the value of the enum as value of the corresponding enumerator.

See also:

get_value_by_name()

virtual const char* mi::​IEnum::get_value_by_name() const [pure virtual]

Returns the value of the enum as name of the enumerator.

See also:

get_value()

virtual Sint32 mi::​IEnum::set_value( Sint32 value) [pure virtual]

Sets the enum via the value of an enumerator.

See also:

set_value_by_name()

Parameters

value
The new enumerator, specified by its value. If there are multiple enumerators with the same value the one with the smallest index in the corresponding enum declaration is chosen.

Returns

  • 0: Success.
  • -1: This enum type has no enumerator with value value.

virtual Sint32 mi::​IEnum::set_value_by_name( const char* name) [pure virtual]

Sets the enum via the name of an enumerator.

See also:

set_value()

Parameters

name
The new enumerator, specified by its name.

Returns

  • 0: Success.
  • -1: This enum type has no enumerator with name name.