MDL SDK API nvidia_logo_transpbg.gif Up
mi::IArray Class Referenceabstract

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

#include <iarray.h>

Inheritance diagram for mi::IArray:

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...
 
- Public Member Functions inherited from mi::IData_collection
virtual Size get_length () const =0
 Returns the number of values. More...
 
virtual const char * get_key (Size index) const =0
 Returns the key corresponding to index. More...
 
virtual bool has_key (const char *key) const =0
 Indicates whether the key key exists or not. More...
 
virtual const base::IInterfaceget_value (const char *key) const =0
 Returns the value for key key. More...
 
template<class T>
const T * get_value (const char *key) const
 Returns the value for key key. More...
 
virtual base::IInterfaceget_value (const char *key)=0
 Returns the value for key key. More...
 
template<class T>
T * get_value (const char *key)
 Returns the value for key key. More...
 
virtual const base::IInterfaceget_value (Size index) const =0
 Returns the value for index index. More...
 
template<class T>
const T * get_value (Size index) const
 Returns the value for index index. More...
 
virtual base::IInterfaceget_value (Size index)=0
 Returns the value for index index. More...
 
template<class T>
T * get_value (Size index)
 Returns the value for index index. More...
 
virtual Sint32 set_value (const char *key, base::IInterface *value)=0
 Stores the value for key key. More...
 
virtual Sint32 set_value (Size index, base::IInterface *value)=0
 Stores the value for index index. More...
 
- Public Member Functions inherited from mi::IData
virtual const char * get_type_name () const =0
 Returns the type name. 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 IInterfaceget_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 IInterfaceget_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< 0x329db537, ... >
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::Interface_declare< 0x1bb2be0f, ... >
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::Interface_declare< 0x2e5f84bc, ... >
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< 0x329db537, ... >
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::Interface_declare< 0x1bb2be0f, ... >
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::Interface_declare< 0x2e5f84bc, ... >
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...
 

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

 empty()

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

Checks whether the array is empty.

Equivalent to get_length() == 0.

 get_element() [1/4]

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.

 get_element() [2/4]

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.

 get_element() [3/4]

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.

 get_element() [4/4]

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.

 get_length()

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.

 set_element()

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.