• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<html>
2<head>
3<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
4<title>flat_buffer</title>
5<link rel="stylesheet" href="../../../../../../doc/src/boostbook.css" type="text/css">
6<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
7<link rel="home" href="../../index.html" title="Chapter 1. Boost.Beast">
8<link rel="up" href="../ref.html" title="This Page Intentionally Left Blank 2/2">
9<link rel="prev" href="boost__beast__error_condition.html" title="error_condition">
10<link rel="next" href="boost__beast__multi_buffer.html" title="multi_buffer">
11</head>
12<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
13<table cellpadding="2" width="100%"><tr>
14<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
15<td align="center"><a href="../../../../../../index.html">Home</a></td>
16<td align="center"><a href="../../../../../../libs/libraries.htm">Libraries</a></td>
17<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
18<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
19<td align="center"><a href="../../../../../../more/index.htm">More</a></td>
20</tr></table>
21<hr>
22<div class="spirit-nav">
23<a accesskey="p" href="boost__beast__error_condition.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../ref.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="boost__beast__multi_buffer.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
24</div>
25<div class="section">
26<div class="titlepage"><div><div><h4 class="title">
27<a name="beast.ref.boost__beast__flat_buffer"></a><a class="link" href="boost__beast__flat_buffer.html" title="flat_buffer">flat_buffer</a>
28</h4></div></div></div>
29<p>
30        <a class="indexterm" name="idm46057514730848"></a>
31      </p>
32<p>
33        A flat buffer which uses the default allocator.
34      </p>
35<h5>
36<a name="beast.ref.boost__beast__flat_buffer.h0"></a>
37        <span class="phrase"><a name="beast.ref.boost__beast__flat_buffer.synopsis"></a></span><a class="link" href="boost__beast__flat_buffer.html#beast.ref.boost__beast__flat_buffer.synopsis">Synopsis</a>
38      </h5>
39<p>
40        Defined in header <code class="literal">&lt;<a href="../../../../../../boost/beast/core/flat_buffer.hpp" target="_top">boost/beast/core/flat_buffer.hpp</a>&gt;</code>
41      </p>
42<pre class="programlisting"><span class="keyword">using</span> <span class="identifier">flat_buffer</span> <span class="special">=</span> <span class="identifier">basic_flat_buffer</span><span class="special">&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">allocator</span><span class="special">&lt;</span> <span class="keyword">char</span> <span class="special">&gt;</span> <span class="special">&gt;;</span>
43</pre>
44<h5>
45<a name="beast.ref.boost__beast__flat_buffer.h1"></a>
46        <span class="phrase"><a name="beast.ref.boost__beast__flat_buffer.types"></a></span><a class="link" href="boost__beast__flat_buffer.html#beast.ref.boost__beast__flat_buffer.types">Types</a>
47      </h5>
48<div class="informaltable"><table class="table">
49<colgroup>
50<col>
51<col>
52</colgroup>
53<thead><tr>
54<th>
55                <p>
56                  Name
57                </p>
58              </th>
59<th>
60                <p>
61                  Description
62                </p>
63              </th>
64</tr></thead>
65<tbody>
66<tr>
67<td>
68                <p>
69                  <span class="bold"><strong><a class="link" href="boost__beast__basic_flat_buffer/allocator_type.html" title="basic_flat_buffer::allocator_type">allocator_type</a></strong></span>
70                </p>
71              </td>
72<td>
73                <p>
74                  The type of allocator used.
75                </p>
76              </td>
77</tr>
78<tr>
79<td>
80                <p>
81                  <span class="bold"><strong><a class="link" href="boost__beast__basic_flat_buffer/const_buffers_type.html" title="basic_flat_buffer::const_buffers_type">const_buffers_type</a></strong></span>
82                </p>
83              </td>
84<td>
85                <p>
86                  The ConstBufferSequence used to represent the readable bytes.
87                </p>
88              </td>
89</tr>
90<tr>
91<td>
92                <p>
93                  <span class="bold"><strong><a class="link" href="boost__beast__basic_flat_buffer/mutable_buffers_type.html" title="basic_flat_buffer::mutable_buffers_type">mutable_buffers_type</a></strong></span>
94                </p>
95              </td>
96<td>
97                <p>
98                  The MutableBufferSequence used to represent the writable bytes.
99                </p>
100              </td>
101</tr>
102</tbody>
103</table></div>
104<h5>
105<a name="beast.ref.boost__beast__flat_buffer.h2"></a>
106        <span class="phrase"><a name="beast.ref.boost__beast__flat_buffer.member_functions"></a></span><a class="link" href="boost__beast__flat_buffer.html#beast.ref.boost__beast__flat_buffer.member_functions">Member Functions</a>
107      </h5>
108<div class="informaltable"><table class="table">
109<colgroup>
110<col>
111<col>
112</colgroup>
113<thead><tr>
114<th>
115                <p>
116                  Name
117                </p>
118              </th>
119<th>
120                <p>
121                  Description
122                </p>
123              </th>
124</tr></thead>
125<tbody>
126<tr>
127<td>
128                <p>
129                  <span class="bold"><strong><a class="link" href="boost__beast__basic_flat_buffer/basic_flat_buffer.html" title="basic_flat_buffer::basic_flat_buffer">basic_flat_buffer</a></strong></span>
130                </p>
131              </td>
132<td>
133                <p>
134                  Constructor.
135                </p>
136                <p>
137                  Move Constructor.
138                </p>
139                <p>
140                  Copy Constructor.
141                </p>
142              </td>
143</tr>
144<tr>
145<td>
146                <p>
147                  <span class="bold"><strong><a class="link" href="boost__beast__basic_flat_buffer/capacity.html" title="basic_flat_buffer::capacity">capacity</a></strong></span>
148                </p>
149              </td>
150<td>
151                <p>
152                  Return the maximum number of bytes, both readable and writable,
153                  that can be held without requiring an allocation.
154                </p>
155              </td>
156</tr>
157<tr>
158<td>
159                <p>
160                  <span class="bold"><strong><a class="link" href="boost__beast__basic_flat_buffer/cdata.html" title="basic_flat_buffer::cdata">cdata</a></strong></span>
161                </p>
162              </td>
163<td>
164                <p>
165                  Returns a constant buffer sequence representing the readable bytes.
166                </p>
167              </td>
168</tr>
169<tr>
170<td>
171                <p>
172                  <span class="bold"><strong><a class="link" href="boost__beast__basic_flat_buffer/clear.html" title="basic_flat_buffer::clear">clear</a></strong></span>
173                </p>
174              </td>
175<td>
176                <p>
177                  Set the size of the readable and writable bytes to zero.
178                </p>
179              </td>
180</tr>
181<tr>
182<td>
183                <p>
184                  <span class="bold"><strong><a class="link" href="boost__beast__basic_flat_buffer/commit.html" title="basic_flat_buffer::commit">commit</a></strong></span>
185                </p>
186              </td>
187<td>
188                <p>
189                  Append writable bytes to the readable bytes.
190                </p>
191              </td>
192</tr>
193<tr>
194<td>
195                <p>
196                  <span class="bold"><strong><a class="link" href="boost__beast__basic_flat_buffer/consume.html" title="basic_flat_buffer::consume">consume</a></strong></span>
197                </p>
198              </td>
199<td>
200                <p>
201                  Remove bytes from beginning of the readable bytes.
202                </p>
203              </td>
204</tr>
205<tr>
206<td>
207                <p>
208                  <span class="bold"><strong><a class="link" href="boost__beast__basic_flat_buffer/data.html" title="basic_flat_buffer::data">data</a></strong></span>
209                </p>
210              </td>
211<td>
212                <p>
213                  Returns a constant buffer sequence representing the readable bytes.
214                </p>
215                <p>
216                  Returns a mutable buffer sequence representing the readable bytes.
217                </p>
218              </td>
219</tr>
220<tr>
221<td>
222                <p>
223                  <span class="bold"><strong><a class="link" href="boost__beast__basic_flat_buffer/get_allocator.html" title="basic_flat_buffer::get_allocator">get_allocator</a></strong></span>
224                </p>
225              </td>
226<td>
227                <p>
228                  Returns a copy of the allocator used.
229                </p>
230              </td>
231</tr>
232<tr>
233<td>
234                <p>
235                  <span class="bold"><strong><a class="link" href="boost__beast__basic_flat_buffer/max_size.html" title="basic_flat_buffer::max_size">max_size</a></strong></span>
236                </p>
237              </td>
238<td>
239                <p>
240                  Set the maximum allowed capacity.
241                </p>
242                <p>
243                  Return the maximum number of bytes, both readable and writable,
244                  that can ever be held.
245                </p>
246              </td>
247</tr>
248<tr>
249<td>
250                <p>
251                  <span class="bold"><strong><a class="link" href="boost__beast__basic_flat_buffer/operator_eq_.html" title="basic_flat_buffer::operator=">operator=</a></strong></span>
252                </p>
253              </td>
254<td>
255                <p>
256                  Move Assignment.
257                </p>
258                <p>
259                  Copy Assignment.
260                </p>
261                <p>
262                  Copy assignment.
263                </p>
264              </td>
265</tr>
266<tr>
267<td>
268                <p>
269                  <span class="bold"><strong><a class="link" href="boost__beast__basic_flat_buffer/prepare.html" title="basic_flat_buffer::prepare">prepare</a></strong></span>
270                </p>
271              </td>
272<td>
273                <p>
274                  Returns a mutable buffer sequence representing writable bytes.
275                </p>
276              </td>
277</tr>
278<tr>
279<td>
280                <p>
281                  <span class="bold"><strong><a class="link" href="boost__beast__basic_flat_buffer/reserve.html" title="basic_flat_buffer::reserve">reserve</a></strong></span>
282                </p>
283              </td>
284<td>
285                <p>
286                  Guarantee a minimum capacity.
287                </p>
288              </td>
289</tr>
290<tr>
291<td>
292                <p>
293                  <span class="bold"><strong><a class="link" href="boost__beast__basic_flat_buffer/shrink_to_fit.html" title="basic_flat_buffer::shrink_to_fit">shrink_to_fit</a></strong></span>
294                </p>
295              </td>
296<td>
297                <p>
298                  Request the removal of unused capacity.
299                </p>
300              </td>
301</tr>
302<tr>
303<td>
304                <p>
305                  <span class="bold"><strong><a class="link" href="boost__beast__basic_flat_buffer/size.html" title="basic_flat_buffer::size">size</a></strong></span>
306                </p>
307              </td>
308<td>
309                <p>
310                  Returns the number of readable bytes.
311                </p>
312              </td>
313</tr>
314<tr>
315<td>
316                <p>
317                  <span class="bold"><strong><a class="link" href="boost__beast__basic_flat_buffer/_basic_flat_buffer.html" title="basic_flat_buffer::~basic_flat_buffer">~basic_flat_buffer</a></strong></span>
318                </p>
319              </td>
320<td>
321                <p>
322                  Destructor.
323                </p>
324              </td>
325</tr>
326</tbody>
327</table></div>
328<h5>
329<a name="beast.ref.boost__beast__flat_buffer.h3"></a>
330        <span class="phrase"><a name="beast.ref.boost__beast__flat_buffer.friends"></a></span><a class="link" href="boost__beast__flat_buffer.html#beast.ref.boost__beast__flat_buffer.friends">Friends</a>
331      </h5>
332<div class="informaltable"><table class="table">
333<colgroup>
334<col>
335<col>
336</colgroup>
337<thead><tr>
338<th>
339                <p>
340                  Name
341                </p>
342              </th>
343<th>
344                <p>
345                  Description
346                </p>
347              </th>
348</tr></thead>
349<tbody><tr>
350<td>
351                <p>
352                  <span class="bold"><strong><a class="link" href="boost__beast__basic_flat_buffer/swap.html" title="basic_flat_buffer::swap">swap</a></strong></span>
353                </p>
354              </td>
355<td>
356                <p>
357                  Exchange two dynamic buffers.
358                </p>
359              </td>
360</tr></tbody>
361</table></div>
362<p>
363        A dynamic buffer encapsulates memory storage that may be automatically resized
364        as required, where the memory is divided into two regions: readable bytes
365        followed by writable bytes. These memory regions are internal to the dynamic
366        buffer, but direct access to the elements is provided to permit them to be
367        efficiently used with I/O operations. Objects of this type meet the requirements
368        of <span class="emphasis"><em>DynamicBuffer</em></span> and have the following additional properties:
369      </p>
370<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
371<li class="listitem">
372            A mutable buffer sequence representing the readable bytes is returned
373            by <a class="link" href="boost__beast__basic_flat_buffer/data/overload1.html" title="basic_flat_buffer::data (1 of 2 overloads)"><code class="computeroutput"><span class="identifier">data</span></code></a> when <code class="computeroutput"><span class="keyword">this</span></code>
374            is non-const.
375          </li>
376<li class="listitem">
377            A configurable maximum buffer size may be set upon construction. Attempts
378            to exceed the buffer size will throw <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">length_error</span></code>.
379          </li>
380<li class="listitem">
381            Buffer sequences representing the readable and writable bytes, returned
382            by <a class="link" href="boost__beast__basic_flat_buffer/data/overload1.html" title="basic_flat_buffer::data (1 of 2 overloads)"><code class="computeroutput"><span class="identifier">data</span></code></a> and <a class="link" href="boost__beast__basic_flat_buffer/prepare.html" title="basic_flat_buffer::prepare"><code class="computeroutput"><span class="identifier">prepare</span></code></a>, will have length one.
383          </li>
384</ul></div>
385<p>
386        Upon construction, a maximum size for the buffer may be specified. If this
387        limit is exceeded, the <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">length_error</span></code>
388        exception will be thrown.
389      </p>
390<h5>
391<a name="beast.ref.boost__beast__flat_buffer.h4"></a>
392        <span class="phrase"><a name="beast.ref.boost__beast__flat_buffer.remarks"></a></span><a class="link" href="boost__beast__flat_buffer.html#beast.ref.boost__beast__flat_buffer.remarks">Remarks</a>
393      </h5>
394<p>
395        This class is designed for use with algorithms that take dynamic buffers
396        as parameters, and are optimized for the case where the input sequence or
397        output sequence is stored in a single contiguous buffer.
398      </p>
399<h5>
400<a name="beast.ref.boost__beast__flat_buffer.h5"></a>
401        <span class="phrase"><a name="beast.ref.boost__beast__flat_buffer.description"></a></span><a class="link" href="boost__beast__flat_buffer.html#beast.ref.boost__beast__flat_buffer.description">Description</a>
402      </h5>
403</div>
404<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
405<td align="left"></td>
406<td align="right"><div class="copyright-footer">Copyright © 2016-2019 Vinnie
407      Falco<p>
408        Distributed under the Boost Software License, Version 1.0. (See accompanying
409        file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
410      </p>
411</div></td>
412</tr></table>
413<hr>
414<div class="spirit-nav">
415<a accesskey="p" href="boost__beast__error_condition.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../ref.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="boost__beast__multi_buffer.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
416</div>
417</body>
418</html>
419