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


API Reference


Brew Release
Brew MP 1.0.2
See Also
- IModel Interface
IVectorModel is derived from the IListModel interface and is used to model a collection of objects that may be of some variable size. Vector models benefit from APIs that provide the ability to add, insert, delete and replace items stored in the model and allow each item to vary in size and structure. Each item in a vector model is referenced by a pointer, with all the item pointers collected together in one contiguous block of memory. Basically, the vector model is stored as an array of pointers, like so.
           Item 0  |                          |
                   |          void *      +---------> Points to the contents of item 0
                   |                          |
           Item 1  |                          |
                   |          void *      +---------> Points to the contents of item 1
                   |                          |
           Item 2  |                          |
                   |          void *      +---------> Points to the contents of item 2
                   |                          |
        Item n - 1 |                          | 
                   |          void *      +---------> Points to the contents of item n - 1
                   |                          |

The block of item pointers is actually accessed by the vector model through a second pointer.
The contents of each item in the vector could be of a different size and structure, however this distinction is opaque to the vector model itself, which instead sets its focus on managing the pointers to each item. From the standpoint of the vector model, the items themselves are simply blobs of data. The vector model, when queried to retrieve a particular item, returns a pointer to the location where that item's contents are stored.
The IVectorModel interface provides APIs for manipulating the data stored in the vector model, as well as routines for managing reference counting of the interface object, and functions that allow widgets and UI controls to register for a listener with the vector model.
See IModel usage.