Material Definition Language API nvidia_logo_transpbg.gif Up
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
mi::IEnum_decl Class Referenceabstract

An enum declaration is used to describe enum types. More...

Inheritance diagram for mi::IEnum_decl:
mi::base::Interface_declare< 0xd15fcacd, 0xe31f, 0x4eb4, 0x80, 0x54, 0x3b, 0xe9, 0x1f, 0xbc, 0x90, 0x7d > mi::base::IInterface

Public Member Functions

virtual Sint32 add_enumerator (const char *name, Sint32 value)=0
 Adds a new enumerator to the enum declaration. More...
 
virtual Sint32 remove_enumerator (const char *name)=0
 Removes an enumerator from the enum declaration. More...
 
virtual Size get_length () const =0
 Returns the number of enumerators. More...
 
virtual const char * get_name (Size index) const =0
 Returns the name of an enumerator. More...
 
virtual Sint32 get_value (Size index) const =0
 Returns the value of an enumerator. More...
 
virtual Size get_index (const char *name) const =0
 Returns the index for an enumerator identified by its name. More...
 
virtual Size get_index (Sint32 value) const =0
 Returns the index for an enumerator identified by its value. More...
 
virtual const char * get_enum_type_name () const =0
 Returns the type name used to register this enum declaration. More...
 

Additional Inherited Members

- Public Types inherited from mi::base::Interface_declare< 0xd15fcacd, 0xe31f, 0x4eb4, 0x80, 0x54, 0x3b, 0xe9, 0x1f, 0xbc, 0x90, 0x7d >
typedef Interface_declare< id1,
id2, id3, id4, id5, id6, id7,
id8, id9, id10, id11,
IInterface
Self
 Own type. More...
 
typedef Uuid_t< id1, id2, id3,
id4, id5, id6, id7, id8, id9,
id10, id11 > 
IID
 Declares the interface ID (IID) of this interface. More...
 
- Static Public Member Functions inherited from mi::base::Interface_declare< 0xd15fcacd, 0xe31f, 0x4eb4, 0x80, 0x54, 0x3b, 0xe9, 0x1f, 0xbc, 0x90, 0x7d >
static bool compare_iid (const Uuid &iid)
 Compares the interface ID iid against the interface ID of this interface and of its ancestors. More...
 

Detailed Description

An enum declaration is used to describe enum types.

An enum type is represented by a map from names (of type const char*) to values (of type mi::Sint32). Such a pair of name and value is also called enumerator. Note that different enumerators can have the same value (but need to have different names).

See Also
mi::IEnum

Member Function Documentation

virtual Sint32 mi::IEnum_decl::add_enumerator ( const char *  name,
Sint32  value 
)
pure virtual

Adds a new enumerator to the enum declaration.

Parameters
nameThe name of the new enumerator.
valueThe value of the new enumerator.
Returns
  • 0: Success.
  • -1: Invalid parameters (NULL pointer).
  • -2: There is already an enumerator with name name.
virtual const char* mi::IEnum_decl::get_enum_type_name ( ) const
pure virtual

Returns the type name used to register this enum declaration.

Note that the type name will only be available after registration, i.e., if the declaration has been obtained from mi::IEnum::get_enum_decl() or mi::neuraylib::IFactory::get_enum_decl().

The 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 the methods on this interface to obtain information about the type itself.

Returns
The type name under which this enum declaration was registered, or NULL in case of failure.
virtual Size mi::IEnum_decl::get_index ( const char *  name) const
pure virtual

Returns the index for an enumerator identified by its name.

Parameters
nameThe name of the requested enumerator.
Returns
The index of the enumerator with name name, or -1 if name is invalid.
virtual Size mi::IEnum_decl::get_index ( Sint32  value) const
pure virtual

Returns the index for an enumerator identified by its value.

Parameters
valueThe value of the requested enumerator.
Returns
The smallest index of an enumerator with value value, or -1 if value is invalid.
virtual Size mi::IEnum_decl::get_length ( ) const
pure virtual

Returns the number of enumerators.

virtual const char* mi::IEnum_decl::get_name ( Size  index) const
pure virtual

Returns the name of an enumerator.

Parameters
indexThe index of the requested enumerator.
Returns
The name of that enumerator, or NULL if index is out of bounds.
virtual Sint32 mi::IEnum_decl::get_value ( Size  index) const
pure virtual

Returns the value of an enumerator.

Parameters
indexThe index of the requested enumerator (invalid indices are treated as index 0).
Returns
The value of that enumerator.
virtual Sint32 mi::IEnum_decl::remove_enumerator ( const char *  name)
pure virtual

Removes an enumerator from the enum declaration.

Parameters
nameThe name of the enumerator to remove.
Returns
  • 0: Success.
  • -1: Invalid parameters (NULL pointer).
  • -2: There is no enumerator with name name.