Dynamic Arrays Overview

This document is an overview of dynamic arrays.

Purpose

Provides families of dynamically expandible heap-based arrays.

Description

A large number of concrete classes provide dynamic arrays that are suitable for different circumstances. Unlike standard C++ arrays or the Symbian platform 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 simple dynamic array family is for use in most cases

  • the extended dynamic array family allows advanced properties, such as the organisation of the array storage in memory, to be specified

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
Variable-length element
CBase -pointer elements
Untyped elements (fixed length)
Untyped elements (variable length)
 

CArrayFixFlat

CArrayFixSeg

 

CArrayVarFlat

CArrayVarSeg

CArrayPakFlat

CArrayPtrFlat

CArrayPtrSeg

 

CArrayFixFlat<TAny>

CArrayFixSeg<TAny>

 

CArrayVar<TAny>

 

CArrayPak<TAny>

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