|
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-63C60154-2A50-5A39-A188-515A607F498B" xml:lang="en"><title>Array |
|
13 of same length elements, flat buffer</title><shortdesc>Describes how elements are organised within the array buffer.</shortdesc><prolog><metadata><keywords/></metadata></prolog><conbody> |
|
14 <p>This can be either an <codeph>RArray<class T></codeph> or a <codeph>CArrayFixFlat<class T></codeph> object.</p> |
|
15 <p>In both arrays, all elements:</p> |
|
16 <ul> |
|
17 <li id="GUID-9A6138C3-BBB5-5D8E-B0CB-9E51E1B2C59C"><p>have the same length.</p> </li> |
|
18 <li id="GUID-A68AD60D-1077-5425-869C-619EDC70F4DF"><p>are physically contiguous |
|
19 within a flat array buffer. The length of an element is the size of the template |
|
20 class.</p> </li> |
|
21 </ul> |
|
22 <p>A flat buffer always occupies a single cell allocated from the heap and |
|
23 is always extended by the process of reallocation.</p> |
|
24 <p>The following diagram illustrates how elements are organised within the |
|
25 array buffer:</p> |
|
26 <fig id="GUID-7E9AF455-9CC4-5814-A746-36A94585488F"> |
|
27 <image href="GUID-516D2E22-F5C0-56FE-ABDA-948F01CD50DB_d0e190709_href.png" placement="inline"/> |
|
28 </fig> |
|
29 <p>This kind of array is suitable for a small number of elements or for a |
|
30 moderately large but fixed maximum number of elements. It is not suitable |
|
31 for large arrays with a high turnover of elements.</p> |
|
32 <p>The <codeph>RArray<class T></codeph> array has the simpler and |
|
33 more efficient implementation but the length of an element is limited to 640 |
|
34 bytes. This array can also be constructed on te program stack.</p> |
|
35 <p>The <codeph>CArrayFixFlat<class T></codeph> array is more general |
|
36 and is allocated on the heap. This class is immediately derived from the abstract |
|
37 templated base class <codeph>CArrayFix<class T></codeph> which is |
|
38 itself derived from the abstract non-template base class <codeph>CArrayFixBase</codeph>. |
|
39 Its array buffer is implemented using a <codeph>CBufFlat</codeph> object.</p> |
|
40 <section id="GUID-AED136DE-81CB-4247-ADF7-283C6061D4D9"><title>See also</title> <p><xref href="GUID-112AAFA5-B4C9-5B62-A106-FB5097C13A0E.dita">Using |
|
41 Dynamic Buffers </xref>.</p> </section> |
|
42 </conbody></concept> |