API Reference | developer.brewmp.com API Reference | developer.brewmp.com


API Reference


Brew Release
Brew MP 1.0.2
See Also
IVectorModel Interface PFNMODEL_NOTIFY
This function specifies the callback function to be used by the vector model when releasing memory occupied by items stored in the vector model. The vector model maintains an array of pointers to the contents of each item, with the items defining their individual structure and storage requirements. The callback function allows a vector model to release "deep storage" -- custom memory allocated and occupied by the fields of the items stored in a vector model.
The figure below illustrates complex items in a vector model that possess "deep storage". A pointer to the contents of item x is stored in the vector model's array of item pointers. The item itself then includes a pointer to additional storage allocated and used by item x. To release this storage, the vector model would provide a PFNMODEL_NOTIFY callback that would free the contents of item x, as well as the custom memory pointed to from within item x.
                                                      |                          |
                                :                     |        Contents of       |
                                :                     |           item x         |
                   |--------------------------|       |                          |       +---------+
       Item x      |                          |       |    Pointer to custom +---------> |         |
                   |          void *      +---------> |          storage         |       |         |
                   |                          |       +--------------------------+       +---------+
                   |                          |
     Item (x + 1)  |          void *      +---------> +--------------------------+
                   |                          |       |                          |
                   |--------------------------|       |        Contents of       |
                                :                     |        item (x + 1)      |
                                :                     |                          |
                                                      |                          |
Pointer to the IVectorModel interface object.
Pointer to the callback function that BREW will call when freeing the memory associated with an item stored in the vector model.
  •    PFNMODEL_NOTIFY IVectorModel_SetPfnFree(IVectorModel *po, PFNMODEL_NOTIFY pfnFree);
  • IVectorModel_SetPfnFree() returns a pointer to the vector model's old PFNMODEL_NOTIFY callback function. A vector model may therefore manage multiple PFNMODEL_NOTIFY callbacks, each capable of managing different item contents.
Side Effect
  • None
Pass VF_RELEASE in 'pfnFree' to indicate that the item pointers stored in the vector model are actually interface pointers. When this is the case, the vector model will release the interfaces by calling IBASE_Release().