1<html> 2<head> 3<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 4<title>multi_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__flat_buffer.html" title="flat_buffer"> 10<link rel="next" href="boost__beast__lowest_layer_type.html" title="lowest_layer_type"> 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__flat_buffer.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__lowest_layer_type.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__multi_buffer"></a><a class="link" href="boost__beast__multi_buffer.html" title="multi_buffer">multi_buffer</a> 28</h4></div></div></div> 29<p> 30 <a class="indexterm" name="idm46057514605840"></a> 31 </p> 32<p> 33 A typical multi buffer. 34 </p> 35<h5> 36<a name="beast.ref.boost__beast__multi_buffer.h0"></a> 37 <span class="phrase"><a name="beast.ref.boost__beast__multi_buffer.synopsis"></a></span><a class="link" href="boost__beast__multi_buffer.html#beast.ref.boost__beast__multi_buffer.synopsis">Synopsis</a> 38 </h5> 39<p> 40 Defined in header <code class="literal"><<a href="../../../../../../boost/beast/core/multi_buffer.hpp" target="_top">boost/beast/core/multi_buffer.hpp</a>></code> 41 </p> 42<pre class="programlisting"><span class="keyword">using</span> <span class="identifier">multi_buffer</span> <span class="special">=</span> <span class="identifier">basic_multi_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</pre> 44<h5> 45<a name="beast.ref.boost__beast__multi_buffer.h1"></a> 46 <span class="phrase"><a name="beast.ref.boost__beast__multi_buffer.types"></a></span><a class="link" href="boost__beast__multi_buffer.html#beast.ref.boost__beast__multi_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_multi_buffer/allocator_type.html" title="basic_multi_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_multi_buffer/const_buffers_type.html" title="basic_multi_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_multi_buffer/mutable_buffers_type.html" title="basic_multi_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__multi_buffer.h2"></a> 106 <span class="phrase"><a name="beast.ref.boost__beast__multi_buffer.member_functions"></a></span><a class="link" href="boost__beast__multi_buffer.html#beast.ref.boost__beast__multi_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_multi_buffer/basic_multi_buffer.html" title="basic_multi_buffer::basic_multi_buffer">basic_multi_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_multi_buffer/capacity.html" title="basic_multi_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_multi_buffer/cdata.html" title="basic_multi_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_multi_buffer/clear.html" title="basic_multi_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_multi_buffer/commit.html" title="basic_multi_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_multi_buffer/consume.html" title="basic_multi_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_multi_buffer/data.html" title="basic_multi_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_multi_buffer/get_allocator.html" title="basic_multi_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_multi_buffer/max_size.html" title="basic_multi_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_multi_buffer/operator_eq_.html" title="basic_multi_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 </td> 262</tr> 263<tr> 264<td> 265 <p> 266 <span class="bold"><strong><a class="link" href="boost__beast__basic_multi_buffer/prepare.html" title="basic_multi_buffer::prepare">prepare</a></strong></span> 267 </p> 268 </td> 269<td> 270 <p> 271 Returns a mutable buffer sequence representing writable bytes. 272 </p> 273 </td> 274</tr> 275<tr> 276<td> 277 <p> 278 <span class="bold"><strong><a class="link" href="boost__beast__basic_multi_buffer/reserve.html" title="basic_multi_buffer::reserve">reserve</a></strong></span> 279 </p> 280 </td> 281<td> 282 <p> 283 Guarantee a minimum capacity. 284 </p> 285 </td> 286</tr> 287<tr> 288<td> 289 <p> 290 <span class="bold"><strong><a class="link" href="boost__beast__basic_multi_buffer/shrink_to_fit.html" title="basic_multi_buffer::shrink_to_fit">shrink_to_fit</a></strong></span> 291 </p> 292 </td> 293<td> 294 <p> 295 Reallocate the buffer to fit the readable bytes exactly. 296 </p> 297 </td> 298</tr> 299<tr> 300<td> 301 <p> 302 <span class="bold"><strong><a class="link" href="boost__beast__basic_multi_buffer/size.html" title="basic_multi_buffer::size">size</a></strong></span> 303 </p> 304 </td> 305<td> 306 <p> 307 Returns the number of readable bytes. 308 </p> 309 </td> 310</tr> 311<tr> 312<td> 313 <p> 314 <span class="bold"><strong><a class="link" href="boost__beast__basic_multi_buffer/_basic_multi_buffer.html" title="basic_multi_buffer::~basic_multi_buffer">~basic_multi_buffer</a></strong></span> 315 </p> 316 </td> 317<td> 318 <p> 319 Destructor. 320 </p> 321 </td> 322</tr> 323</tbody> 324</table></div> 325<h5> 326<a name="beast.ref.boost__beast__multi_buffer.h3"></a> 327 <span class="phrase"><a name="beast.ref.boost__beast__multi_buffer.friends"></a></span><a class="link" href="boost__beast__multi_buffer.html#beast.ref.boost__beast__multi_buffer.friends">Friends</a> 328 </h5> 329<div class="informaltable"><table class="table"> 330<colgroup> 331<col> 332<col> 333</colgroup> 334<thead><tr> 335<th> 336 <p> 337 Name 338 </p> 339 </th> 340<th> 341 <p> 342 Description 343 </p> 344 </th> 345</tr></thead> 346<tbody><tr> 347<td> 348 <p> 349 <span class="bold"><strong><a class="link" href="boost__beast__basic_multi_buffer/swap.html" title="basic_multi_buffer::swap">swap</a></strong></span> 350 </p> 351 </td> 352<td> 353 <p> 354 Exchange two dynamic buffers. 355 </p> 356 </td> 357</tr></tbody> 358</table></div> 359<p> 360 A dynamic buffer encapsulates memory storage that may be automatically resized 361 as required, where the memory is divided into two regions: readable bytes 362 followed by writable bytes. These memory regions are internal to the dynamic 363 buffer, but direct access to the elements is provided to permit them to be 364 efficiently used with I/O operations. The implementation uses a sequence 365 of one or more byte arrays of varying sizes to represent the readable and 366 writable bytes. Additional byte array objects are appended to the sequence 367 to accommodate changes in the desired size. The behavior and implementation 368 of this container is most similar to <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">deque</span></code>. 369 Objects of this type meet the requirements of <span class="emphasis"><em>DynamicBuffer</em></span> 370 and have the following additional properties: 371 </p> 372<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> 373<li class="listitem"> 374 A mutable buffer sequence representing the readable bytes is returned 375 by <a class="link" href="boost__beast__basic_multi_buffer/data/overload1.html" title="basic_multi_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> 376 is non-const. 377 </li> 378<li class="listitem"> 379 Buffer sequences representing the readable and writable bytes, returned 380 by <a class="link" href="boost__beast__basic_multi_buffer/data/overload1.html" title="basic_multi_buffer::data (1 of 2 overloads)"><code class="computeroutput"><span class="identifier">data</span></code></a> and <a class="link" href="boost__beast__basic_multi_buffer/prepare.html" title="basic_multi_buffer::prepare"><code class="computeroutput"><span class="identifier">prepare</span></code></a>, may have length greater 381 than one. 382 </li> 383<li class="listitem"> 384 A configurable maximum size may be set upon construction and adjusted 385 afterwards. Calls to <a class="link" href="boost__beast__basic_multi_buffer/prepare.html" title="basic_multi_buffer::prepare"><code class="computeroutput"><span class="identifier">prepare</span></code></a> that would exceed this 386 size will throw <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">length_error</span></code>. 387 </li> 388<li class="listitem"> 389 Sequences previously obtained using <a class="link" href="boost__beast__basic_multi_buffer/data/overload1.html" title="basic_multi_buffer::data (1 of 2 overloads)"><code class="computeroutput"><span class="identifier">data</span></code></a> remain valid after calls 390 to <a class="link" href="boost__beast__basic_multi_buffer/prepare.html" title="basic_multi_buffer::prepare"><code class="computeroutput"><span class="identifier">prepare</span></code></a> or <a class="link" href="boost__beast__basic_multi_buffer/commit.html" title="basic_multi_buffer::commit"><code class="computeroutput"><span class="identifier">commit</span></code></a>. 391 </li> 392</ul></div> 393<h5> 394<a name="beast.ref.boost__beast__multi_buffer.h4"></a> 395 <span class="phrase"><a name="beast.ref.boost__beast__multi_buffer.template_parameters"></a></span><a class="link" href="boost__beast__multi_buffer.html#beast.ref.boost__beast__multi_buffer.template_parameters">Template 396 Parameters</a> 397 </h5> 398<div class="informaltable"><table class="table"> 399<colgroup> 400<col> 401<col> 402</colgroup> 403<thead><tr> 404<th> 405 <p> 406 Type 407 </p> 408 </th> 409<th> 410 <p> 411 Description 412 </p> 413 </th> 414</tr></thead> 415<tbody><tr> 416<td> 417 <p> 418 <code class="computeroutput"><span class="identifier">Allocator</span></code> 419 </p> 420 </td> 421<td> 422 <p> 423 The allocator to use for managing memory. 424 </p> 425 </td> 426</tr></tbody> 427</table></div> 428<h5> 429<a name="beast.ref.boost__beast__multi_buffer.h5"></a> 430 <span class="phrase"><a name="beast.ref.boost__beast__multi_buffer.description"></a></span><a class="link" href="boost__beast__multi_buffer.html#beast.ref.boost__beast__multi_buffer.description">Description</a> 431 </h5> 432</div> 433<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> 434<td align="left"></td> 435<td align="right"><div class="copyright-footer">Copyright © 2016-2019 Vinnie 436 Falco<p> 437 Distributed under the Boost Software License, Version 1.0. (See accompanying 438 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>) 439 </p> 440</div></td> 441</tr></table> 442<hr> 443<div class="spirit-nav"> 444<a accesskey="p" href="boost__beast__flat_buffer.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__lowest_layer_type.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a> 445</div> 446</body> 447</html> 448