CArray Series Container
Symbian's designers, very much like the complex inheritance structure and Paul Vientiane class, CArray series of containers, is the product of this idea. CArray is a sequential container, the equivalent of the STL vector + list, and more.
CArray series containers, at the bottom of the inheritance, that is, the instantiation of the use of classes, are named Carrayxxxyxx, namely: CArray + Object Cell storage Mode + Object segment storage mode. The so-called object cell storage mode, which is to characterize each unit of the container data, is how to store, in the CArray, there are mainly four kinds:
Flat, each of the data in the container is equal in length;
Var, the length of each data in the container, can be different;
Pak, the data in the container is divided into several parts, each of which has a leading-byte representing the length of the paragraph, as the descriptor;
PTR, the container holds the pointer data of the CBase subclass object.
Each container has an important parameter, which is an integer called granularity, that is, the number of elements per group. The group is the CArray container allocates the memory unit, in the granularity category, the element all according to these four kinds of patterns carries on the storage, but, granularity always a finite number, when the container element fills the granularity size, needs the new space to store. Each new space, are granularity units, each group of units between, there are two modes of connection, one is fix, one is seg.
In Symbian OS explained, there is a classic picture, a variety of array storage mode, at a glance, theft came, as shown above. From the storage point of view, the flat way is like an array, one by one existence, PTR looks and Var, the pointer one by one, pointing to the object in the heap, but in essence, the implementation of PTR and flat is similar to the bottom, and Var is to the pointer customization. Pak storage is a bit weird, each tuo element has a leading-byte number of parameters, people are not suspected, this thing is for the descriptor deliberately prepared.
and between segments and segments, fix is like a vector, each expansion of storage capacity, will need to reallocate memory, suitable for use in a fixed-length scene, rather than to become longer. and SEG, similar to the list, the link between the links, if the granularity of a Seg object, is completely reduced to a linked list, no doubt, if you need not to increase storage capacity, SEG Way array should be your favorite ...
At the interface level, CArray supports the interface of data writing such as Appendl,insertl,delete, also supports the data reading interface such as At,operator [], and supports the interface of data lookup and processing such as sort,find,compress. Concrete implementation and the underlying storage-related, specific details have not seen the relevant information, can only unconditionally trust its implementation is not so waste wood ...