• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<html>
2<head>
3<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
4<title>Dynamic buffer requirements (version 2)</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="../../boost_asio.html" title="Boost.Asio">
8<link rel="up" href="../reference.html" title="Reference">
9<link rel="prev" href="DynamicBuffer_v1.html" title="Dynamic buffer requirements (version 1)">
10<link rel="next" href="Endpoint.html" title="Endpoint requirements">
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="DynamicBuffer_v1.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../boost_asio.html"><img src="../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="Endpoint.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
24</div>
25<div class="section">
26<div class="titlepage"><div><div><h3 class="title">
27<a name="boost_asio.reference.DynamicBuffer_v2"></a><a class="link" href="DynamicBuffer_v2.html" title="Dynamic buffer requirements (version 2)">Dynamic buffer
28      requirements (version 2)</a>
29</h3></div></div></div>
30<p>
31        A dynamic buffer encapsulates memory storage that may be automatically resized
32        as required.
33      </p>
34<p>
35        A dynamic buffer type <code class="computeroutput">X</code> shall satisfy the requirements of <code class="computeroutput">CopyConstructible</code>
36        (C++ Std, [copyconstructible]) types in addition to those listed below.
37      </p>
38<p>
39        In the table below, <code class="computeroutput">X</code> denotes a dynamic buffer class, <code class="computeroutput">x</code>
40        denotes a value of type <code class="computeroutput">X&amp;</code>, <code class="computeroutput">x1</code> denotes values
41        of type <code class="computeroutput">const X&amp;</code>, <code class="computeroutput">pos</code> and <code class="computeroutput">n</code> denote
42        values of type <code class="computeroutput">size_t</code>, and <code class="computeroutput">u</code> denotes an identifier.
43      </p>
44<div class="table">
45<a name="boost_asio.reference.DynamicBuffer_v2.t0"></a><p class="title"><b>Table 10. DynamicBuffer_v2 requirements</b></p>
46<div class="table-contents"><table class="table" summary="DynamicBuffer_v2 requirements">
47<colgroup>
48<col>
49<col>
50<col>
51</colgroup>
52<thead><tr>
53<th>
54                <p>
55                  expression
56                </p>
57              </th>
58<th>
59                <p>
60                  type
61                </p>
62              </th>
63<th>
64                <p>
65                  assertion/note<br> pre/post-conditions
66                </p>
67              </th>
68</tr></thead>
69<tbody>
70<tr>
71<td>
72                <p>
73                  <code class="computeroutput">X::const_buffers_type</code>
74                </p>
75              </td>
76<td>
77                <p>
78                  type meeting <a class="link" href="ConstBufferSequence.html" title="Constant buffer sequence requirements">ConstBufferSequence</a>
79                  requirements.
80                </p>
81              </td>
82<td>
83                <p>
84                  This type represents the underlying memory as a sequence of @c
85                  const_buffer objects.
86                </p>
87              </td>
88</tr>
89<tr>
90<td>
91                <p>
92                  <code class="computeroutput">X::mutable_buffers_type</code>
93                </p>
94              </td>
95<td>
96                <p>
97                  type meeting <a class="link" href="MutableBufferSequence.html" title="Mutable buffer sequence requirements">MutableBufferSequence</a>
98                  requirements.
99                </p>
100              </td>
101<td>
102                <p>
103                  This type represents the underlying memory as a sequence of @c
104                  mutable_buffer objects.
105                </p>
106              </td>
107</tr>
108<tr>
109<td>
110                <p>
111                  <code class="computeroutput">x1.size()</code>
112                </p>
113              </td>
114<td>
115                <p>
116                  <code class="computeroutput">size_t</code>
117                </p>
118              </td>
119<td>
120                <p>
121                  Returns the size, in bytes, of the underlying memory.
122                </p>
123              </td>
124</tr>
125<tr>
126<td>
127                <p>
128                  <code class="computeroutput">x1.max_size()</code>
129                </p>
130              </td>
131<td>
132                <p>
133                  <code class="computeroutput">size_t</code>
134                </p>
135              </td>
136<td>
137                <p>
138                  Returns the permitted maximum size of the underlying memory.
139                </p>
140              </td>
141</tr>
142<tr>
143<td>
144                <p>
145                  <code class="computeroutput">x1.capacity()</code>
146                </p>
147              </td>
148<td>
149                <p>
150                  <code class="computeroutput">size_t</code>
151                </p>
152              </td>
153<td>
154                <p>
155                  Returns the maximum size to which the underlying memory can grow
156                  without requiring reallocation.
157                </p>
158              </td>
159</tr>
160<tr>
161<td>
162                <p>
163                  <code class="computeroutput">x1.data(pos, n)</code>
164                </p>
165              </td>
166<td>
167                <p>
168                  <code class="computeroutput">X::const_buffers_type</code>
169                </p>
170              </td>
171<td>
172                <p>
173                  Returns a constant buffer sequence <code class="computeroutput">u</code> that represents
174                  the underlying memory beginning at offset <code class="computeroutput">pos</code>, and
175                  where <code class="computeroutput">buffer_size(u) &lt;= n</code>.
176                </p>
177              </td>
178</tr>
179<tr>
180<td>
181                <p>
182                  <code class="computeroutput">x.data(pos, n)</code>
183                </p>
184              </td>
185<td>
186                <p>
187                  <code class="computeroutput">X::mutable_buffers_type</code>
188                </p>
189              </td>
190<td>
191                <p>
192                  Returns a mutable buffer sequence <code class="computeroutput">u</code> that represents
193                  the underlying memory beginning at offset <code class="computeroutput">pos</code>, and
194                  where <code class="computeroutput">buffer_size(u) &lt;= n</code>.
195                </p>
196              </td>
197</tr>
198<tr>
199<td>
200                <p>
201                  <code class="computeroutput">x.grow(n)</code>
202                </p>
203              </td>
204<td>
205              </td>
206<td>
207                <p>
208                  Requires: <code class="computeroutput">size() + n &lt;= max_size()</code>.<br> <br>
209                  Extends the underlying memory to accommodate <code class="computeroutput">n</code> additional
210                  bytes at the end. The dynamic buffer reallocates memory as required.
211                  All constant or mutable buffer sequences previously obtained using
212                  <code class="computeroutput">data()</code> are invalidated.<br> <br> Throws: <code class="computeroutput">length_error</code>
213                  if <code class="computeroutput">size() + n &gt; max_size()</code>.
214                </p>
215              </td>
216</tr>
217<tr>
218<td>
219                <p>
220                  <code class="computeroutput">x.shrink(n)</code>
221                </p>
222              </td>
223<td>
224              </td>
225<td>
226                <p>
227                  Removes <code class="computeroutput">n</code> bytes from the end of the underlying memory.
228                  If <code class="computeroutput">n</code> is greater than the size of the underlying memory,
229                  the entire underlying memory is emptied. All constant or mutable
230                  buffer sequences previously obtained using <code class="computeroutput">data()</code>
231                  are invalidated.
232                </p>
233              </td>
234</tr>
235<tr>
236<td>
237                <p>
238                  <code class="computeroutput">x.consume(n)</code>
239                </p>
240              </td>
241<td>
242              </td>
243<td>
244                <p>
245                  Removes <code class="computeroutput">n</code> bytes from the beginning of the underlying
246                  memory. If <code class="computeroutput">n</code> is greater than the size of the underlying
247                  memory, the entire underlying memory is emptied. All constant or
248                  mutable buffer sequences previously obtained using <code class="computeroutput">data()</code>
249                  are invalidated.
250                </p>
251              </td>
252</tr>
253</tbody>
254</table></div>
255</div>
256<br class="table-break">
257</div>
258<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
259<td align="left"></td>
260<td align="right"><div class="copyright-footer">Copyright © 2003-2020 Christopher M.
261      Kohlhoff<p>
262        Distributed under the Boost Software License, Version 1.0. (See accompanying
263        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>)
264      </p>
265</div></td>
266</tr></table>
267<hr>
268<div class="spirit-nav">
269<a accesskey="p" href="DynamicBuffer_v1.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../boost_asio.html"><img src="../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="Endpoint.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
270</div>
271</body>
272</html>
273