|
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-577F42BA-299E-5071-8C7A-FA0CBADCECAE" xml:lang="en"><title>The |
|
13 types of array</title><shortdesc>Describes the types of array available.</shortdesc><prolog><metadata><keywords/></metadata></prolog><conbody> |
|
14 <section id="GUID-A39A5291-6177-4521-AB8F-65D3F09FC333"><title>General arrays of objects</title> <p>Six general types of |
|
15 array can be constructed:</p> <ul> |
|
16 <li id="GUID-37305910-8E80-5F8B-9511-2354BD66BD38"><p><codeph>CArrayFixFlat<Class |
|
17 T></codeph>: an array of elements, all having the same length. It uses a flat |
|
18 array buffer implemented by a <codeph>CBufFlat</codeph> object. The array |
|
19 object itself is allocated on the heap.</p> </li> |
|
20 <li id="GUID-E0E535CE-F623-57C9-86DC-BC755E00FE3F"><p><codeph>CArrayFixSeg<Class |
|
21 T></codeph>: an array of elements, all having the same length. It uses a segmented |
|
22 array buffer implemented by a <codeph>CBufSeg</codeph> object. The array object |
|
23 itself is allocated on the heap.</p> </li> |
|
24 <li id="GUID-BA0B6BF0-C156-596A-B63F-9A7D262C218E"><p><codeph>CArrayVarFlat<Class |
|
25 T></codeph>: an array of elements having varying lengths. It uses a flat array |
|
26 buffer implemented by a <codeph>CBufFlat</codeph> object. The array object |
|
27 itself is allocated on the heap.</p> </li> |
|
28 <li id="GUID-3E74B298-B832-5404-9002-92E7CE8D3228"><p><codeph>CArrayVarSeg<Class |
|
29 T></codeph>: an array of elements having varying lengths. It uses a segmented |
|
30 array buffer implemented by a <codeph>CBufSeg</codeph> object. The array object |
|
31 itself is allocated on the heap.</p> </li> |
|
32 <li id="GUID-3A949BDB-822A-59EE-8C15-E5FB3EBC8FAE"><p><codeph>CArrayPakFlat<Class |
|
33 T></codeph>: an array of elements having varying lengths. It uses a flat array |
|
34 buffer implemented by a <codeph>CBufFlat</codeph> object. The length value |
|
35 of an element precedes the element itself within the array buffer. The array |
|
36 object itself is allocated on the heap.</p> </li> |
|
37 <li id="GUID-7B30A669-8BF5-5DDC-BDC2-2097C7631257"><p><codeph>RArray<class |
|
38 T></codeph>: a simple array of elements, all having the same length. The array |
|
39 buffer is flat and is implemented by the array class as a simple piece of |
|
40 linear memory. The array object itself can be constructed on the program stack.</p> </li> |
|
41 </ul> </section> |
|
42 <section id="GUID-3A99B95E-EF5D-4E7E-B545-7A9E1FE12C14"><title>General arrays of pointers</title> <p>There are three arrays |
|
43 which can be used when the elements are <i>pointers</i> to <codeph>CBase</codeph> derived |
|
44 objects. They allow type-safe access to <codeph>CBase</codeph> derived objects:</p> <ul> |
|
45 <li id="GUID-F395B716-D47E-5915-834D-8B10C35BAC59"><p><codeph>CArrayPtrFlat<class T></codeph>: |
|
46 an array of pointers using a flat array buffer implemented by a <codeph>CBufFlat</codeph> object. |
|
47 The array object itself is allocated on the heap.</p> </li> |
|
48 <li id="GUID-ECE75F75-0178-5F00-8EE3-1B2BD162B764"><p><codeph>CArrayPtrSeg<class T></codeph>: |
|
49 an array of pointers using a segmented array buffer implemented by a <codeph>CBufSeg</codeph> object. |
|
50 The array object itself is allocated on the heap.</p> </li> |
|
51 <li id="GUID-F4AEDDAE-E8EA-571F-9089-BB736559FCE1"><p><codeph>RPointerArray<class |
|
52 T></codeph>: a simple array of pointers using a flat array buffer implemented |
|
53 by the array class as a simple piece of linear memory. The array object itself |
|
54 can be constructed on the program stack.</p> </li> |
|
55 </ul> </section> |
|
56 <section id="GUID-039B6556-C13A-4DFF-A1A7-D11A3702FE46"><title>Specialised arrays</title> <p>There are two specialised arrays |
|
57 of <i>untyped</i> elements, all having the same length, which can be used |
|
58 as data members of a base class in a thin template class/base class pair. |
|
59 These classes are useful in situations where the type of elements forming |
|
60 the array cannot be known in advance:</p> <ul> |
|
61 <li id="GUID-2D1A46DD-FFA6-56FD-A0E4-9C4655B3B9C2"><p><codeph>CArrayFixFlat<TAny></codeph>. |
|
62 An array of untyped elements all having the same length. It uses a flat array |
|
63 buffer implemented by a <codeph>CBufFlat</codeph> object.</p> </li> |
|
64 <li id="GUID-CBF3264E-DE5C-5FA3-B953-CF6F14208EEB"><p><codeph>CArrayFixSeg<TAny></codeph>. |
|
65 An array of untyped elements all having the same length. It uses a segmented |
|
66 array buffer implemented by a <codeph>CBufSeg</codeph> object.</p> </li> |
|
67 </ul> <p>There are two specialised arrays of <i>untyped</i> elements, having |
|
68 varying lengths, which can be used as data members of a base class in a thin |
|
69 template class/base class pair. These classes are useful in situations where |
|
70 the type of element forming the array is known only at the time the class |
|
71 is created (i.e. at compile time):</p> <ul> |
|
72 <li id="GUID-D689224C-F6F2-5A82-9A90-091663814F86"><p><codeph>CArrayVar<TAny></codeph>. |
|
73 An array of untyped elements with varying lengths.</p> </li> |
|
74 <li id="GUID-5E2E9D37-65E8-5804-BD5B-6A37703C745B"><p><codeph>CArrayPak<TAny></codeph>. |
|
75 An array of packed (variable length) elements.</p> </li> |
|
76 </ul> <p>There are two template specialisations of <codeph>RArray<class |
|
77 T></codeph>.</p> <ul> |
|
78 <li id="GUID-A4F7D38C-7AE6-5E6B-A36F-1D70624C3E45"><p><codeph>RArray<TInt></codeph>. |
|
79 An array of signed integers</p> </li> |
|
80 <li id="GUID-AB865DDB-5522-5A36-9DBB-BB0D535A9B9F"><p><codeph>RArray<TUint></codeph>. |
|
81 An array of signed integers.</p> </li> |
|
82 </ul> </section> |
|
83 </conbody></concept> |