Symbian Developer Library

SYMBIAN OS V6.1 EDITION FOR C++

[Index] [Glossary] [Previous] [Next]



Array of variable length elements, segmented buffer

This is a CArrayVarSeg<class T> object whose elements can have different lengths. Although each element is a class T object, the length of that object can vary.

In this type of array, each element occupies its own individual cell allocated from the heap. The array buffer contains fixed length data structures, one for each element, which are logically contiguous within the buffer but are physically contiguous only within a segment. Each fixed length data structure contains the length of an element (a TInt value) and a pointer to it. The structure itself is part of the implementation but occupies no more than eight bytes on 32-bit machines.

A segmented buffer is implemented as a doubly linked list of equally sized cells allocated from the heap and is always extended by allocating a new segment and inserting it into the appropriate place in the list. A segmented array buffer is implemented using a CBufSeg object.

The following diagram illustrates how elements are organised within the array buffer:

This kind of array is suitable for large arrays with a high turnover of elements.

This class is immediately derived from the abstract templated base class CArrayVar<class T> which is itself derived from the abstract non-templated base class CArrayVarBase.


See also

Dynamic Buffers Guide.