Symbian3/SDK/Source/GUID-E1410365-7254-5326-B3F7-D7100D31E59F.dita
author Dominic Pinkman <dominic.pinkman@nokia.com>
Fri, 13 Aug 2010 16:47:46 +0100
changeset 14 578be2adaf3e
parent 13 48780e181b38
permissions -rw-r--r--
Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582

<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. -->
<!-- This component and the accompanying materials are made available under the terms of the License 
"Eclipse Public License v1.0" which accompanies this distribution, 
and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". -->
<!-- Initial Contributors:
    Nokia Corporation - initial contribution.
Contributors: 
-->
<!DOCTYPE concept
  PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
<concept xml:lang="en" id="GUID-E1410365-7254-5326-B3F7-D7100D31E59F"><title>Array of variable length elements, segmented buffer</title><prolog><metadata><keywords/></metadata></prolog><conbody><p>This is a <codeph>CArrayVarSeg&lt;class T&gt;</codeph> object whose elements can have different lengths. Although each element is a <codeph>class T</codeph> object, the length of that object can vary.</p> <p>In this type of array, each element occupies its own individual cell allocated from the heap. The array buffer contains fixed length data structures, one for each element, which are logically contiguous within the buffer but are physically contiguous only within a segment. Each fixed length data structure contains the length of an element (a <codeph>TInt</codeph> value) and a pointer to it. The structure itself is part of the implementation but occupies no more than eight bytes on 32-bit machines.</p> <p>A segmented buffer is implemented as a doubly linked list of equally sized cells allocated from the heap and is always extended by allocating a new segment and inserting it into the appropriate place in the list. A segmented array buffer is implemented using a <codeph>CBufSeg</codeph> object. </p> <p>The following diagram illustrates how elements are organised within the array buffer:</p> <fig id="GUID-D8FD08B3-2896-56FE-8252-E88A250655C4"><image href="GUID-FCFF0750-0AE9-5F51-B4F7-B1655E1AD244_d0e220758_href.png" placement="inline"/></fig> <p>This kind of array is suitable for large arrays with a high turnover of elements.</p> <p>This class is immediately derived from the abstract templated base class <codeph>CArrayVar&lt;class T&gt;</codeph> which is itself derived from the abstract non-templated base class <codeph>CArrayVarBase</codeph>. </p> <section><title>See also</title> <p><xref href="GUID-112AAFA5-B4C9-5B62-A106-FB5097C13A0E.dita">Dynamic Buffers Guide</xref>.</p> </section> </conbody></concept>