An enum declaration is used to describe enum types. More...
#include <ienum_decl.h>
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... | |
Public Member Functions inherited from mi::base::IInterface | |
virtual Uint32 | retain () const =0 |
Increments the reference count. More... | |
virtual Uint32 | release () const =0 |
Decrements the reference count. More... | |
virtual const IInterface * | get_interface (const Uuid &interface_id) const =0 |
Acquires a const interface from another. More... | |
template<class T> | |
const T * | get_interface () const |
Acquires a const interface from another. More... | |
virtual IInterface * | get_interface (const Uuid &interface_id)=0 |
Acquires a mutable interface from another. More... | |
template<class T> | |
T * | get_interface () |
Acquires a mutable interface from another. More... | |
virtual Uuid | get_iid () const =0 |
Returns the interface ID of the most derived interface. More... | |
Additional Inherited Members | |
Public Types inherited from mi::base::Interface_declare< 0xd15fcacd, ... > | |
typedef Interface_declare< id1, ... > | Self |
Own type. More... | |
typedef Uuid_t< id1, ... > | IID |
Declares the interface ID (IID) of this interface. More... | |
Public Types inherited from mi::base::IInterface | |
typedef Uuid_t<0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0> | IID |
Declares the interface ID (IID) of this interface. More... | |
Static Public Member Functions inherited from mi::base::Interface_declare< 0xd15fcacd, ... > | |
static bool | compare_iid (const Uuid &iid) |
Compares the interface ID iid against the interface ID of this interface and of its ancestors. More... | |
Static Public Member Functions inherited from mi::base::IInterface | |
static bool | compare_iid (const Uuid &iid) |
Compares the interface ID iid against the interface ID of this interface. More... | |
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).
Enum declarations can be used to create new enum types. In this case, they are populated through a sequence of add_enumerator() calls. Finally, such a declaration is registered via mi::neuraylib::IExtension_api::register_enum_decl(). The name used for registration can later be used as a type name to create instances of the type described by the declaration.
Adds a new enumerator to the enum declaration.
name | The name of the new enumerator. |
value | The value of the new enumerator. |
NULL
pointer).name
.
|
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.
NULL
in case of failure.
|
pure virtual |
Returns the index for an enumerator identified by its name.
name | The name of the requested enumerator. |
name
, or -1 if name
is invalid. Returns the index for an enumerator identified by its value.
value | The value of the requested enumerator. |
value
, or -1 if value
is invalid.
|
pure virtual |
Returns the number of enumerators.
|
pure virtual |
Returns the name of an enumerator.
index | The index of the requested enumerator. |
NULL
if index
is out of bounds. Returns the value of an enumerator.
index | The index of the requested enumerator (invalid indices are treated as index 0). |
|
pure virtual |
Removes an enumerator from the enum declaration.
name | The name of the enumerator to remove. |
NULL
pointer).name
.