IArray Interface
- GetCount
- GetAt
- InsertAt
- RemoveAt
- Add
- Find
- RemoveAll
IArray manages access to arrays of different types of objects present during
the software execution. Type of object is determined by the way the IArray is
obtained. For example IArray representing the array of object textures is
obtained with a call to GetProperty("TextureArray", (IUnknown**)&pIArray)
method of IPropertyArray interface.
Some arrays like arrays of object property are constant arrays, meaning
that only GetCount() and GetAt() methods are available. All other methods will
return DISP_E_PARAMNOTOPTIONAL error code.
Note: Obtaining IArray managing Axial Base knots of a 3DS object via
ISection->IAxiBase->IArray is a context-dependent query. It means that
between two steps ISection->IAxiBase and IAxiBase->IArray there must not
be any other queries from the ISection interface.
See also
Object Array Sample,
Interface List
HRESULT GetCount(int * pnCount)
Parameters
pnCount- [out, retval] Pointer to an integer
variable which will be set to number of valid members in the array
Returns
- S_OK in case of
success.
HRESULT GetAt(int index, IUnknown **ppIUnkn)
Parameters
index - [in] index of the object to retrieve.
ppIUnkn - [out, retval] pointer to a IUnknown* variable,
which will be assigned an appropriate interface pointer, implemented by index-th
object in the array.
Return Values
- S_OK in case of
success.
DISP_E_BADINDEX - if the index is out of the range
DISP_E_PARAMNOTOPTIONAL - if the object is not available.
- Remarks:
-
- This method gives access to index-th object in
the array. Most often actual type of the interface is different from IUnknown
and can be cast to the specific type, which is described for each specific use
of the IArray interface.
HRESULT InsertAt(int index, IUnknown * pIUnkn)
Parameters
index - [in] index of the newly
added object.
pIUnkn - [in] Pointer to an IUnknown
interface to be inserted in the array. Depending on the specific type of objects
in the array if pIUnkn is NULL a new default object is
inserted at the position.
Returns
S_OK in case of
success.
Remarks:
This method will insert pIUnkn at position index. All other
members will be shifted up. Size of the array will be incremented by 1.
HRESULT RemoveAt(int index)
Parameters
index - [in] index of the object to
be removed..
Returns
S_OK in case of
success.
Remarks:
Will remove the object at index position.
HRESULT Add(IUnknown * pIUnkn)
Parameters
pIUnkn - [in] Pointer to an IUnknown
interface to be added to the array. Depending on the specific type of objects in
the array if pIUnkn is NULL a new default object added
in the end of array.
Returns
S_OK in case of
success.
The method will insert pIUnkn at the end of the array
HRESULT Find(IUnknown * pIUnkn, int* pnIndex)
Parameters
pIUnkn - [in] Pointer to an
interface to be found in the array. Note that any interface of any type can be
supplied for this parameter.
pnIndex - [out] Pointer to an integer variable,
which will receive 0-based index of the object in the array or -1 if not found.
Returns
S_OK. - Always.
If the array contains the object implementing the pIUnkn its
0- based index will be returned in pnIndex. Otherwise pnIndex
will be set to -1.
HRESULT RemoveAll()
Returns
S_OK. - Always.
Empties the array by removing all elements
|