Symbian
Symbian Developer Library

SYMBIAN OS V9.4

Feedback

[Index] [Previous] [Next]


Dynamic Arrays Overview

[Top]


Purpose

Provides families of dynamically expandable heap-based arrays.

[Top]


Description

A large number of concrete classes provide dynamic arrays that are suitable for different circumstances. Unlike standard C++ arrays or the Symbian OS Fixed Size Arrays, the number of elements in a dynamic array can be altered at run-time.

The arrays are divided into two families:

The array classes are all templated. The template parameter defines the type of object which is to form an array element.


Simple dynamic array family

The simple dynamic array family offers arrays of objects, integers, and pointers. The array is always stored in a single memory area.

Object arrays are provided by RArray.

Integer arrays are provided by RArray<TInt> and RArray<TUint>.

Pointer arrays are provided by RPointerArray.


Extended dynamic array family

The extended dynamic array family, derived from CBase, allows the client to specify explicitly combinations of element properties and storage type. These terms are explained below.


Element properties

Options for element properties are:

Fixed length

All elements are of the same size (CArrayFixBase).

Variable length

Elements can be of different sizes (CArrayVarBase).

Pointer

Elements are pointers to CBase-derived objects.

Untyped

Elements are TAny objects.


Storage type

Options for storage type are:

Flat buffer

The elements are stored in a single memory area, and are of fixed length.

Segmented

The elements are stored in multiple memory areas.

Packed

The elements are stored in a single memory area, but can be of variable length.

Different storage types present trade-offs between efficiency of memory usage and speed.


Class summary

The following matrix demonstrates the concrete classes that are available. Storage type is shown horizontally, element properties vertically.

Flat Segmented Packed
Fixed-length element

CArrayFixFlat

CArrayFixSeg

Variable-length element

CArrayVarFlat

CArrayVarSeg

CArrayPakFlat

CBase-pointer elements

CArrayPtrFlat

CArrayPtrSeg

Untyped elements (fixed length)

CArrayFixFlat<TAny>

CArrayFixSeg<TAny>

Untyped elements (variable length)

CArrayVar<TAny>

CArrayPak<TAny>

Base classes are not shown on the above table. The inheritance hierarchies are based on the flat, segmented, packed divisions.

See also