Material Definition Language API nvidia_logo_transpbg.gif Up
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
mi::IDynamic_array Class Referenceabstract

This interface represents dynamic arrays, i.e., arrays with a variable number of elements. More...

Inheritance diagram for mi::IDynamic_array:
mi::base::Interface_declare< 0x575af5ad, 0xc7c8, 0x44a1, 0x92, 0xb2, 0xe5, 0x5d, 0x5b, 0x9a, 0x90, 0xff, IArray > 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

Public Member Functions

virtual void set_length (Size size)=0
 Sets the size of the array to size. More...
 
virtual void clear ()=0
 Sets the size of the array to zero. More...
 
virtual Sint32 insert (Size index, base::IInterface *element)=0
 Inserts the given element at the given index. More...
 
virtual Sint32 erase (Size index)=0
 Removes the element stored at the given index. More...
 
virtual Sint32 push_back (base::IInterface *element)=0
 Stores the given element at the end of the array. More...
 
virtual Sint32 pop_back ()=0
 Removes the last element from the array and decreases the array size by one. More...
 
virtual const base::IInterfaceback () const =0
 Returns the last element of the array. More...
 
template<class T >
const T * back () const
 Returns the last element of the array. More...
 
virtual base::IInterfaceback ()=0
 Returns the last element of the array. More...
 
template<class T >
T * back ()
 Returns the last element of the array. More...
 
virtual const base::IInterfacefront () const =0
 Returns the first element of the array. More...
 
template<class T >
const T * front () const
 Returns the first element of the array. More...
 
virtual base::IInterfacefront ()=0
 Returns the first element of the array. More...
 
template<class T >
T * front ()
 Returns the first element of the array. More...
 

Additional Inherited Members

- Public Types inherited from mi::base::Interface_declare< 0x575af5ad, 0xc7c8, 0x44a1, 0x92, 0xb2, 0xe5, 0x5d, 0x5b, 0x9a, 0x90, 0xff, IArray >
typedef Interface_declare< id1,
id2, id3, id4, id5, id6, id7,
id8, id9, id10, id11, IArray
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< 0x575af5ad, 0xc7c8, 0x44a1, 0x92, 0xb2, 0xe5, 0x5d, 0x5b, 0x9a, 0x90, 0xff, IArray >
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 dynamic arrays, i.e., arrays with a variable 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 dynamic array is the type name of the element followed by "[]", e.g., "Sint32[]" for a dynamic array of mi::Sint32 elements. Initially, a dynamic array has size zero, i.e., it is empty.

Untyped arrays simply store pointers of type mi::base::IInterface. The type name of an untyped dynamic array is "Interface[]".

See Also
mi::IArray

Member Function Documentation

virtual const base::IInterface* mi::IDynamic_array::back ( ) const
pure virtual

Returns the last element of the array.

Returns
The last element, or NULL if the array is empty.
template<class T >
const T* mi::IDynamic_array::back ( ) const
inline

Returns the last element of the array.

Returns
The last element, or NULL if the array is empty.

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::IDynamic_array::back ( )
pure virtual

Returns the last element of the array.

Returns
The last element, or NULL if the array is empty.
template<class T >
T* mi::IDynamic_array::back ( )
inline

Returns the last element of the array.

Returns
The last element, or NULL if the array is empty.

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 void mi::IDynamic_array::clear ( )
pure virtual

Sets the size of the array to zero.

Removes all existing elements from the array (if any). Equivalent to calling set_length() with parameter 0.

Note
If the array represents an attribute (or part thereof), you must not call this method while holding other pointers to the attribute (or to that part of the attribute), including pointers to array elements, to struct members of array elements, etc.
virtual Sint32 mi::IDynamic_array::erase ( Size  index)
pure virtual

Removes the element stored at the given index.

Removes the element at index and shifts the remaining elements by one slot.

Note
If the array represents an attribute (or part thereof), you must not call this method while holding other pointers to the attribute (or to that part of the attribute), including pointers to array elements, to struct members of array elements, etc.
Returns
  • 0: Success.
  • -1: index is out of bounds.
virtual const base::IInterface* mi::IDynamic_array::front ( ) const
pure virtual

Returns the first element of the array.

Returns
The first element, or NULL if the array is empty.
template<class T >
const T* mi::IDynamic_array::front ( ) const
inline

Returns the first element of the array.

Returns
The first element, or NULL if the array is empty.

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::IDynamic_array::front ( )
pure virtual

Returns the first element of the array.

Returns
The first element, or NULL if the array is empty.
template<class T >
T* mi::IDynamic_array::front ( )
inline

Returns the first element of the array.

Returns
The first element, or NULL if the array is empty.

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 Sint32 mi::IDynamic_array::insert ( Size  index,
base::IInterface element 
)
pure virtual

Inserts the given element at the given index.

Stores element at slot index and shifts the remaining elements by one slot.

Note
If the array represents an attribute (or part thereof), you must not call this method while holding other pointers to the attribute (or to that part of the attribute), including pointers to array elements, to struct members of array elements, etc.
Returns
  • 0: Success.
  • -1: index is out of bounds.
  • -2: element is NULL or has the wrong type.
virtual Sint32 mi::IDynamic_array::pop_back ( )
pure virtual

Removes the last element from the array and decreases the array size by one.

Note
If the array represents an attribute (or part thereof), you must not call this method while holding other pointers to the attribute (or to that part of the attribute), including pointers to array elements, to struct members of array elements, etc.
Returns
  • 0: Success.
  • -3: The array is empty.
virtual Sint32 mi::IDynamic_array::push_back ( base::IInterface element)
pure virtual

Stores the given element at the end of the array.

Increases the array size by one and stores element at the end of the array.

Note
If the array represents an attribute (or part thereof), you must not call this method while holding other pointers to the attribute (or to that part of the attribute), including pointers to array elements, to struct members of array elements, etc.
Returns
  • 0: Success.
  • -2: element is NULL or has the wrong type.
virtual void mi::IDynamic_array::set_length ( Size  size)
pure virtual

Sets the size of the array to size.

If the array size decreases, the first size elements of the array are maintained and the surplus elements are removed from the array. If the array size increases, the existing elements are maintained, and the additional elements are default-constructed.

Note
If the array represents an attribute (or part thereof), you must not call this method while holding other pointers to the attribute (or to that part of the attribute), including pointers to array elements, to struct members of array elements, etc.