Developer

API Reference

IVectorModel_DeleteAt()

Brew Release
Brew MP 1.0.2
See Also
- Model Events
- ListModelEvent
- IVectorModel_InsertAt
- IVectorModel Interface
Description
This function deletes an existing item from a vector model, releasing the memory referenced by the item pointer and removing that pointer from the model's array of item pointers.
Parameters
  • po
    []:
    [in] Pointer to the IVectorModel interface object.
  • nIndex
    []:
    [in] Indicates the zero-based index of the item to be removed from the vector model. The first item in the model is indexed by 0, the second is indexed by 1, and so on. So, if IVectorModel_DeleteAt is called with nIndex equal to 2, item 2 will be removed from the vector model, with items 3, 4, 5, etc all shifting one position lower.
Interface
Prototype
   int IVectorModel_DeleteAt(IVectorModel *po, uint32 nIndex);
Return
   AEE_SUCCESS   - The model was able to successfully delete the desired item.
   AEE_EBADPARM  - The requested index is not within the range of items stored in the model.
Side Effect
Deleting an item in a vector model by calling IVectorModel_DeleteAt() will cause BREW to send an EVT_MDL_LIST_CHANGE ListModelEvent to any object that has registered as a listener with the model.
The fields of the ListModelEvent will contain the following information:
       pos:      The index of the item that has been deleted from the vector model
       oldSize:  The number of items in the vector model before calling IVectorModel_DeleteAt().
       newSize:  The number of items in the vector model after calling IVectorModel_DeleteAt().
Comment
Following a successful call to IVectorModel_DeleteAt(), the number of items in the model is reduced by one. The array of item pointers in the vector model is also reduced by one pointer, with the 'nIndex' pointer being removed and all pointers above being moved down by one position.
The vector model may define a custom free memory routine to release the memory consumed by complex items. The custom free memory routine is registered with the vector model by calling IVectorModel_SetPfnFree().
  • Follow