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

This interface represents static arrays, i.e., arrays with a fixed number of elements. More...

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

Public Member Functions

virtual Size  get_length () const =0
  Returns the size of the array. More...
 
virtual const base::IInterface get_element (Size index) const =0
  Returns the index -th element of the array. More...
 
template<class T >
const T *  get_element (Size index) const
  Returns the index -th element of the array. More...
 
virtual base::IInterface get_element (Size index)=0
  Returns the index -th element of the array. More...
 
template<class T >
T *  get_element (Size index)
  Returns the index -th element of the array. More...
 
virtual Sint32  set_element (Size index, base::IInterface *element)=0
  Sets the index -th element of the array. More...
 
virtual bool  empty () const =0
  Checks whether the array is empty. More...
 

Additional Inherited Members

- Public Types inherited from mi::base::Interface_declare< 0x329db537, 0x9892, 0x488c, 0xa2, 0xf4, 0xf5, 0x37, 0x1a, 0x35, 0xcf, 0x39, IData_collection >
typedef Interface_declare< id1,
id2, id3, id4, id5, id6, id7,
id8, id9, id10, id11,
IData_collection
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< 0x329db537, 0x9892, 0x488c, 0xa2, 0xf4, 0xf5, 0x37, 0x1a, 0x35, 0xcf, 0x39, IData_collection >
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

This interface represents static arrays, i.e., arrays with a fixed number of elements.

Arrays are either typed or untyped. Typed arrays enforce all elements to be of the same type. The elements of typed arrays have to be derived from mi::IData. The type name of a typed array is the type name of the element followed by "[", the size of the array (a positive integer), and finally "]", e.g., "Sint32[10]" for an array of 10 mi::Sint32 elements. The elements of a typed array are default-constructed.

Untyped arrays simply store pointers of type mi::base::IInterface. The type name of an untyped array is "Interface[" followed by the size of the array (a positive integer) and finally "]. The elements of an untyped array are default-constructed as instance of mi::IVoid.

The keys of an array (see mi::IData_collection) are the indices converted to strings.

See Also
mi::IDynamic_array

Member Function Documentation

virtual bool mi::IArray::empty ( ) const
pure virtual

Checks whether the array is empty.

Equivalent to get_length() == 0.

virtual const base::IInterface* mi::IArray::get_element ( Size  index) const
pure virtual

Returns the index -th element of the array.

Parameters
index The index of the requested element.
Returns
The requested element, or NULL if index is equal to or larger than the size of the array.
template<class T >
const T* mi::IArray::get_element ( Size  index) const
inline

Returns the index -th element of the array.

Parameters
index The index of the requested element.
Returns
The requested element, or NULL if index is equal to or larger than the size of the array.

This templated member function is a wrapper of the non-template variant for the user's convenience. It eliminates the need to call mi::base::IInterface::get_interface(const Uuid &) on the returned pointer, since the return type already is a pointer to the type T specified as template parameter.

virtual base::IInterface* mi::IArray::get_element ( Size  index)
pure virtual

Returns the index -th element of the array.

Parameters
index The index of the requested element.
Returns
The requested element, or NULL if index is equal to or larger than the size of the array.
template<class T >
T* mi::IArray::get_element ( Size  index)
inline

Returns the index -th element of the array.

Parameters
index The index of the requested element.
Returns
The requested element, or NULL if index is equal to or larger than the size of the array.

This templated member function is a wrapper of the non-template variant for the user's convenience. It eliminates the need to call mi::base::IInterface::get_interface(const Uuid &) on the returned pointer, since the return type already is a pointer to the type T specified as template parameter.

virtual Size mi::IArray::get_length ( ) const
pure virtual

Returns the size of the array.

The size of an array is the number of elements in the array.

Implements mi::IData_collection.

virtual Sint32 mi::IArray::set_element ( Size  index,
base::IInterface element 
)
pure virtual

Sets the index -th element of the array.

The object element is stored as index -th element of the array.

Parameters
index The index where the object should be stored. The method call gets ignored if index is equal to or larger than the size of the array.
element The object to be stored.
Returns
  • 0: Success.
  • -1: index is out of bounds.
  • -2: element is NULL or has the wrong type.