Material Definition Language API nvidia_logo_transpbg.gif 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:
mi::base::Interface_declare< 0x329db537, 0x9892, 0x488c, 0xa2, 0xf4, 0xf5, 0x37, 0x1a, 0x35, 0xcf, 0x39, IData_collection > mi::IData_collection mi::base::Interface_declare< 0x1bb2be0f, 0x0dc6, 0x44b2, 0x93, 0xb9, 0xd1, 0xba, 0x6a, 0x31, 0x88, 0x1c, IData > mi::IData mi::base::Interface_declare< 0x2e5f84bc, 0x783a, 0x4551, 0x9f, 0xca, 0x72, 0x2f, 0xb8, 0x38, 0xc4, 0x7c > mi::base::IInterface mi::base::Interface_declare< 0x575af5ad, 0xc7c8, 0x44a1, 0x92, 0xb2, 0xe5, 0x5d, 0x5b, 0x9a, 0x90, 0xff, IArray > mi::IDynamic_array

Public Member Functions

virtual Size get_length () const =0
 Returns the size of the array. More...
 
virtual const base::IInterfaceget_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::IInterfaceget_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 non-negative 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 non-negative 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
indexThe 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
indexThe 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
indexThe 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
indexThe 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
indexThe 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.
elementThe object to be stored.
Returns
  • 0: Success.
  • -1: index is out of bounds.
  • -2: element is NULL or has the wrong type.