3 <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
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__file_win32/file_win32_dtor_.html" title="file_win32::~file_win32">
10 <link rel="next" href="boost__beast__flat_static_buffer.html" title="flat_static_buffer">
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>
22 <div class="spirit-nav">
23 <a accesskey="p" href="boost__beast__file_win32/file_win32_dtor_.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__flat_static_buffer.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
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>
30 <a class="indexterm" name="idm45873509342240"></a>
31 A flat buffer which uses the default allocator.
34 <a name="beast.ref.boost__beast__flat_buffer.h0"></a>
35 <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 Defined in header <code class="literal"><<a href="../../../../../../boost/beast/core/flat_buffer.hpp" target="_top">boost/beast/core/flat_buffer.hpp</a>></code>
40 <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"><</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">allocator</span><span class="special"><</span> <span class="keyword">char</span> <span class="special">></span> <span class="special">>;</span>
43 <a name="beast.ref.boost__beast__flat_buffer.h1"></a>
44 <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>
46 <div class="informaltable"><table class="table">
67 <a class="link" href="boost__beast__basic_flat_buffer/allocator_type.html" title="basic_flat_buffer::allocator_type"><span class="bold"><strong>allocator_type</strong></span></a>
72 The type of allocator used.
79 <a class="link" href="boost__beast__basic_flat_buffer/const_buffers_type.html" title="basic_flat_buffer::const_buffers_type"><span class="bold"><strong>const_buffers_type</strong></span></a>
84 The ConstBufferSequence used to represent the readable bytes.
91 <a class="link" href="boost__beast__basic_flat_buffer/mutable_buffers_type.html" title="basic_flat_buffer::mutable_buffers_type"><span class="bold"><strong>mutable_buffers_type</strong></span></a>
96 The MutableBufferSequence used to represent the writable bytes.
103 <a class="link" href="boost__beast__basic_flat_buffer/mutable_data_type.html" title="basic_flat_buffer::mutable_data_type"><span class="bold"><strong>mutable_data_type</strong></span></a>
108 The MutableBufferSequence used to represent the readable bytes.
115 <a name="beast.ref.boost__beast__flat_buffer.h2"></a>
116 <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>
118 <div class="informaltable"><table class="table">
139 <a class="link" href="boost__beast__basic_flat_buffer/basic_flat_buffer.html" title="basic_flat_buffer::basic_flat_buffer"><span class="bold"><strong>basic_flat_buffer</strong></span></a>
157 <a class="link" href="boost__beast__basic_flat_buffer/capacity.html" title="basic_flat_buffer::capacity"><span class="bold"><strong>capacity</strong></span></a>
162 Return the maximum number of bytes, both readable and writable,
163 that can be held without requiring an allocation.
170 <a class="link" href="boost__beast__basic_flat_buffer/cdata.html" title="basic_flat_buffer::cdata"><span class="bold"><strong>cdata</strong></span></a>
175 Returns a constant buffer sequence representing the readable bytes.
182 <a class="link" href="boost__beast__basic_flat_buffer/clear.html" title="basic_flat_buffer::clear"><span class="bold"><strong>clear</strong></span></a>
187 Set the size of the readable and writable bytes to zero.
194 <a class="link" href="boost__beast__basic_flat_buffer/commit.html" title="basic_flat_buffer::commit"><span class="bold"><strong>commit</strong></span></a>
199 Append writable bytes to the readable bytes.
206 <a class="link" href="boost__beast__basic_flat_buffer/consume.html" title="basic_flat_buffer::consume"><span class="bold"><strong>consume</strong></span></a>
211 Remove bytes from beginning of the readable bytes.
218 <a class="link" href="boost__beast__basic_flat_buffer/data.html" title="basic_flat_buffer::data"><span class="bold"><strong>data</strong></span></a>
223 Returns a constant buffer sequence representing the readable bytes.
226 Returns a mutable buffer sequence representing the readable bytes.
233 <a class="link" href="boost__beast__basic_flat_buffer/get_allocator.html" title="basic_flat_buffer::get_allocator"><span class="bold"><strong>get_allocator</strong></span></a>
238 Returns a copy of the allocator used.
245 <a class="link" href="boost__beast__basic_flat_buffer/max_size.html" title="basic_flat_buffer::max_size"><span class="bold"><strong>max_size</strong></span></a>
250 Set the maximum allowed capacity.
253 Return the maximum number of bytes, both readable and writable,
254 that can ever be held.
261 <a class="link" href="boost__beast__basic_flat_buffer/operator_eq_.html" title="basic_flat_buffer::operator="><span class="bold"><strong>operator=</strong></span></a>
279 <a class="link" href="boost__beast__basic_flat_buffer/prepare.html" title="basic_flat_buffer::prepare"><span class="bold"><strong>prepare</strong></span></a>
284 Returns a mutable buffer sequence representing writable bytes.
291 <a class="link" href="boost__beast__basic_flat_buffer/reserve.html" title="basic_flat_buffer::reserve"><span class="bold"><strong>reserve</strong></span></a>
296 Guarantee a minimum capacity.
303 <a class="link" href="boost__beast__basic_flat_buffer/shrink_to_fit.html" title="basic_flat_buffer::shrink_to_fit"><span class="bold"><strong>shrink_to_fit</strong></span></a>
308 Reallocate the buffer to fit the readable bytes exactly.
315 <a class="link" href="boost__beast__basic_flat_buffer/size.html" title="basic_flat_buffer::size"><span class="bold"><strong>size</strong></span></a>
320 Returns the number of readable bytes.
327 <a class="link" href="boost__beast__basic_flat_buffer/basic_flat_buffer_dtor_.html" title="basic_flat_buffer::~basic_flat_buffer"><span class="bold"><strong>~basic_flat_buffer</strong></span></a>
339 <a name="beast.ref.boost__beast__flat_buffer.h3"></a>
340 <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>
342 <div class="informaltable"><table class="table">
362 <a class="link" href="boost__beast__basic_flat_buffer/swap.html" title="basic_flat_buffer::swap"><span class="bold"><strong>swap</strong></span></a>
367 Exchange two dynamic buffers.
373 A dynamic buffer encapsulates memory storage that may be automatically resized
374 as required, where the memory is divided into two regions: readable bytes
375 followed by writable bytes. These memory regions are internal to the dynamic
376 buffer, but direct access to the elements is provided to permit them to be
377 efficiently used with I/O operations. Objects of this type meet the requirements
378 of <span class="emphasis"><em>DynamicBuffer</em></span> and have the following additional properties:
380 <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
381 <li class="listitem">
382 A mutable buffer sequence representing the readable bytes is returned
383 by <a class="link" href="boost__beast__basic_flat_buffer/data.html" title="basic_flat_buffer::data"><code class="computeroutput"><span class="identifier">basic_flat_buffer</span><span class="special">::</span><span class="identifier">data</span></code></a> when <code class="computeroutput"><span class="keyword">this</span></code>
386 <li class="listitem">
387 A configurable maximum buffer size may be set upon construction. Attempts
388 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>.
390 <li class="listitem">
391 Buffer sequences representing the readable and writable bytes, returned
392 by <a class="link" href="boost__beast__basic_flat_buffer/data.html" title="basic_flat_buffer::data"><code class="computeroutput"><span class="identifier">basic_flat_buffer</span><span class="special">::</span><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">basic_flat_buffer</span><span class="special">::</span><span class="identifier">prepare</span></code></a>, will have length one.
396 Upon construction, a maximum size for the buffer may be specified. If this
397 limit is exceeded, the <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">length_error</span></code>
398 exception will be thrown.
401 <a name="beast.ref.boost__beast__flat_buffer.h4"></a>
402 <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>
405 This class is designed for use with algorithms that take dynamic buffers
406 as parameters, and are optimized for the case where the input sequence or
407 output sequence is stored in a single contiguous buffer.
410 <a name="beast.ref.boost__beast__flat_buffer.h5"></a>
411 <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>
414 Convenience header <code class="literal"><<a href="../../../../../../boost/beast/core.hpp" target="_top">boost/beast/core.hpp</a>></code>
417 <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
418 <td align="left"></td>
419 <td align="right"><div class="copyright-footer">Copyright © 2016-2019 Vinnie
421 Distributed under the Boost Software License, Version 1.0. (See accompanying
422 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>)
427 <div class="spirit-nav">
428 <a accesskey="p" href="boost__beast__file_win32/file_win32_dtor_.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__flat_static_buffer.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>