NVIDIA Iray API Home  Up
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
mi::IStructure_decl Class Referenceabstract

A structure declaration is used to describe structure types. More...

Inheritance diagram for mi::IStructure_decl:
Inheritance graph
[legend]

Public Member Functions

virtual Sint32  add_member (const char *type_name, const char *name)=0
  Adds a new member to the structure declaration. More...
 
virtual Sint32  remove_member (const char *name)=0
  Removes a member from the structure declaration. More...
 
virtual Size  get_length () const =0
  Returns the number of structure members. More...
 
virtual const char *  get_member_type_name (Size index) const =0
  Returns the type name of a certain structure member. More...
 
virtual const char *  get_member_type_name (const char *name) const =0
  Returns the type name of a certain structure member. More...
 
virtual const char *  get_member_name (Size index) const =0
  Returns the member name of a certain structure member. More...
 
virtual const char *  get_structure_type_name () const =0
  Returns the type name used to register this structure declaration. More...
 

Additional Inherited Members

- Public Types inherited from mi::base::Interface_declare< 0xcd206d33, 0x0906, 0x4e70, 0x82, 0x42, 0x6a, 0x90, 0x8a, 0xf5, 0x82, 0x43 >
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< 0xcd206d33, 0x0906, 0x4e70, 0x82, 0x42, 0x6a, 0x90, 0x8a, 0xf5, 0x82, 0x43 >
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

A structure declaration is used to describe structure types.

It contains all the type information required for structure types: the number of fields, their names and types. In contrast to element of a map structure fields are ordered and do not need to be of the same type.

Structure declarations can be used to create new structure types. In this case, they are populated through a sequence of add_member() calls. Finally, such a declaration is registered via mi::neuraylib::IExtension_api::register_structure_decl(). The name used for registration can later be used as a type name to create instances of the type described by the declaration.

See Also
mi::IStructure, mi::IMap

Member Function Documentation

virtual Sint32 mi::IStructure_decl::add_member ( const char *  type_name,
const char *  name 
)
pure virtual

Adds a new member to the structure declaration.

Parameters
type_name The type name of the new member, see Types for valid type names. Note that this method does not check the type name for validity (since validity at the time of this method call does not imply validity at the time of instantiation).
name The name of the new member.
Returns
  • 0: Success.
  • -1: Invalid parameters (NULL pointer).
  • -2: There is already a member with name name.
virtual Size mi::IStructure_decl::get_length ( ) const
pure virtual

Returns the number of structure members.

virtual const char* mi::IStructure_decl::get_member_name ( Size  index) const
pure virtual

Returns the member name of a certain structure member.

Parameters
index The index of the requested structure member.
Returns
The member name of that structure member, or NULL if index is out of bounds.
virtual const char* mi::IStructure_decl::get_member_type_name ( Size  index) const
pure virtual

Returns the type name of a certain structure member.

Parameters
index The index of the requested structure member.
Returns
The type name of that structure member, or NULL if index is out of bounds.
virtual const char* mi::IStructure_decl::get_member_type_name ( const char *  name) const
pure virtual

Returns the type name of a certain structure member.

Parameters
name The name of the requested structure member.
Returns
The type name of that structure member, or NULL if there is no structure member with name name.
virtual const char* mi::IStructure_decl::get_structure_type_name ( ) const
pure virtual

Returns the type name used to register this structure declaration.

Note that the type name will only be available after registration, i.e., if the declaration has been obtained from mi::IStructure::get_structure_decl() or mi::neuraylib::IFactory::get_structure_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 structure declaration was registered, or NULL in case of failure.
virtual Sint32 mi::IStructure_decl::remove_member ( const char *  name)
pure virtual

Removes a member from the structure declaration.

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