Symbian3/SDK/Source/GUID-82862A69-5E86-5924-BFF0-F7655FCBFAF0.dita
author Graeme Price <GRAEME.PRICE@NOKIA.COM>
Fri, 15 Oct 2010 14:32:18 +0100
changeset 15 307f4279f433
parent 13 48780e181b38
permissions -rw-r--r--
Initial contribution of the Adaptation Documentation.

<?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 id="GUID-82862A69-5E86-5924-BFF0-F7655FCBFAF0" xml:lang="en"><title>Contiguousness</title><shortdesc>Description of contiguous data in flat and segmented buffers.</shortdesc><prolog><metadata><keywords/></metadata></prolog><conbody>
<p>In flat buffers, all data is contiguous. The <codeph>Ptr()</codeph> function always returns a pointer descriptor from the buffer position
specified to the end of the data, and the <codeph>BackPtr()</codeph> function always returns a pointer descriptor from the beginning
of the buffer to the buffer position specified.</p>
<p>In segmented buffers, data is contained in segments and the maximum
length of contiguous data is the granularity of the buffer. The extent
of contiguous data contained in a segment may vary between a single
byte, and the granularity, if the insertion and deletion pattern is
arbitrary.</p>
<p>However, the following guarantee is made: if the number of bytes
inserted or deleted in <i>all</i> insertion and deletion operations
is a multiple of some number <i>n</i>, and the granularity is also
a multiple of this number <i>n</i>, then all data extents will be
a multiple of <i>n</i> in length. This implies that the <codeph>Ptr()</codeph> function, given a buffer position which is a multiple of <i>n</i>, will always return a pointer descriptor referring to at least <i>n</i> bytes.</p>
<p>This property of segmented descriptors is exploited by the <codeph>CArrayFixBase</codeph>, <codeph>CArrayVarBase</codeph> and <codeph>CArrayPakBase</codeph> derived array classes. In these classes, all
insertion or deletion operations are always done in terms of the (fixed)
length of data stored in the buffer. Therefore, the data for an individual
array element is always contiguous.</p>
</conbody><related-links>
<link href="GUID-2F64B579-73D3-548A-9104-16483AF77BCB.dita">
<linktext>Dynamic Arrays</linktext></link>
</related-links></concept>