API Reference


Brew Release
Brew MP 1.0.2
See Also
-IModel Interface
-IListModel Interface
-IVectorModel Interface
IArrayModel is derived from the IListModel interface and is used to model a collection of objects, all of an equal fixed size. The data of an array model is stored as one contiguous block of memory, each item being stored one after the other in equal sized blocks, like the following.
         |                          |  Location 0
         |          Item 0          |
         |                          |
         |                          |  Location (1 x item_size)
         |          Item 1          |
         |                          |
         |                          |  Location (2 x item_size)
         |          Item 2          |
         |                          |
         |                          |  Location ((numItems - 1) x item_size)
         |        Item n - 1        |
         |                          |

The data stored within each item of the array model is -- from the standpoint of the array model -- opaque. It's just a block of data that happens to be the same size as every other blob of data stored within the collection. The array model, when queried to retrieve a particular item, merely returns a pointer to the location within the array where the requested item is stored.
The array model operates on whole array structures and lacks facilities for adding, inserting, deleting or replacing individual items. Changes require that the entire existing array structure be replaced with a new array. The array model is best suited for small lists of items, or lists that will not be changing. For more complex data collections the vector model may be used.
The IArrayModel interface provides APIs for manipulating the data stored in the array 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 array model.
After getting an IArrayModel interface you typically set its items from an array using IArrayModel_SetItems() then set it on a widget that support IArrayModel as its IModel. For more details please refer to the IModel interface
  • Follow