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