|
1 <?xml version="1.0" encoding="utf-8"?> |
|
2 <!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. --> |
|
3 <!-- This component and the accompanying materials are made available under the terms of the License |
|
4 "Eclipse Public License v1.0" which accompanies this distribution, |
|
5 and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". --> |
|
6 <!-- Initial Contributors: |
|
7 Nokia Corporation - initial contribution. |
|
8 Contributors: |
|
9 --> |
|
10 <!DOCTYPE concept |
|
11 PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd"> |
|
12 <concept id="GUID-DE17BEA2-C821-50B8-9128-9C4D35D95599" xml:lang="en"><title>Array |
|
13 Implementation</title><shortdesc>Describes the features of arrays and the ways in which they are |
|
14 implemented.</shortdesc><prolog><metadata><keywords/></metadata></prolog><conbody> |
|
15 <p>All arrays have an array buffer allocated from the heap. The implementation |
|
16 of this buffer and the way it is used depends on the specific type of array.</p> |
|
17 <p>In arrays of elements which all have the same length, the elements are |
|
18 contained within the array buffer itself.</p> |
|
19 <p>In arrays of elements with varying length, each element is contained within |
|
20 its own heap cell and the array buffer contains <i>pointers</i> to the elements.</p> |
|
21 <p>In packed arrays, the elements are contained within the array buffer. A |
|
22 packed array is an array of elements of varying length where the length information |
|
23 for an element precedes that element within the array buffer.</p> |
|
24 <p>Logically, an array buffer is linear but, physically, it can be organised |
|
25 either as a flat buffer or a segmented buffer.</p> |
|
26 <p>In general, you can choose between array classes which use a flat buffer |
|
27 and array classes which use a segmented buffer. The choice depends on how |
|
28 the array is to be used.</p> |
|
29 <p>A segmented array buffer is implemented using a <codeph>CBufSeg</codeph> object.</p> |
|
30 <p>A flat array buffer is implemented either:</p> |
|
31 <ul> |
|
32 <li id="GUID-56BE93C2-0A0A-50DD-807C-4F25A2B6981D"><p>directly by the array |
|
33 as a piece of linear memory.</p> </li> |
|
34 </ul> |
|
35 <p>or</p> |
|
36 <ul> |
|
37 <li id="GUID-2165BEC5-BF75-5E0D-8ED0-074FF23A390A"><p>using a <codeph>CBufFlat</codeph> object.</p> </li> |
|
38 </ul> |
|
39 <p>The first type is a simple and efficient implementation but has some restrictions |
|
40 on the size of an array element and is limited to holding elements which have |
|
41 the same length. The second is a more general implementation and is only limited |
|
42 by the available memory.</p> |
|
43 <section id="GUID-1A671F26-FA1C-4943-B6FD-43F3FD831464"><title>See also</title> <p><xref href="GUID-112AAFA5-B4C9-5B62-A106-FB5097C13A0E.dita">Using |
|
44 Dynamic Buffers</xref>.</p> </section> |
|
45 </conbody></concept> |