|
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-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> |
|
13 <p>In flat buffers, all data is contiguous. The <codeph>Ptr()</codeph> function |
|
14 always returns a pointer descriptor from the buffer position specified to |
|
15 the end of the data, and the <codeph>BackPtr()</codeph> function always returns |
|
16 a pointer descriptor from the beginning of the buffer to the buffer position |
|
17 specified.</p> |
|
18 <p>In segmented buffers, data is contained in segments and the maximum length |
|
19 of contiguous data is the granularity of the buffer. The extent of contiguous |
|
20 data contained in a segment may vary between a single byte, and the granularity, |
|
21 if the insertion and deletion pattern is arbitrary.</p> |
|
22 <p>However, the following guarantee is made: if the number of bytes inserted |
|
23 or deleted in <i>all</i> insertion and deletion operations is a multiple of |
|
24 some number <i>n</i>, and the granularity is also a multiple of this number <i>n</i>, |
|
25 then all data extents will be a multiple of <i>n</i> in length. This implies |
|
26 that the <codeph>Ptr()</codeph> function, given a buffer position which is |
|
27 a multiple of <i>n</i>, will always return a pointer descriptor referring |
|
28 to at least <i>n</i> bytes.</p> |
|
29 <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 |
|
30 are always done in terms of the (fixed) length of data stored in the buffer. |
|
31 Therefore, the data for an individual array element is always contiguous.</p> |
|
32 </conbody><related-links> |
|
33 <link> |
|
34 <desc><xref href="GUID-2F64B579-73D3-548A-9104-16483AF77BCB.dita">Dynamic Arrays</xref></desc> |
|
35 </link> |
|
36 </related-links></concept> |