1<html> 2<head> 3<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 4<title>Completion condition requirements</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="BufferedHandshakeHandler.html" title="Buffered handshake handler requirements"> 10<link rel="next" href="CompletionHandler.html" title="Completion handler 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="BufferedHandshakeHandler.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="CompletionHandler.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.CompletionCondition"></a><a class="link" href="CompletionCondition.html" title="Completion condition requirements">Completion 28 condition requirements</a> 29</h3></div></div></div> 30<p> 31 A <span class="emphasis"><em>completion condition</em></span> is a function object that is 32 used with the algorithms <a class="link" href="read.html" title="read"><code class="computeroutput">read</code></a>, 33 <a class="link" href="async_read.html" title="async_read"><code class="computeroutput">async_read</code></a>, 34 <a class="link" href="write.html" title="write"><code class="computeroutput">write</code></a>, and 35 <a class="link" href="async_write.html" title="async_write"><code class="computeroutput">async_write</code></a> 36 to determine when the algorithm has completed transferring data. 37 </p> 38<p> 39 A type <code class="computeroutput">X</code> meets the <code class="computeroutput">CompletionCondition</code> requirements 40 if it satisfies the requirements of <code class="computeroutput">Destructible</code> (C++Std [destructible]) 41 and <code class="computeroutput">MoveConstructible</code> (C++Std [moveconstructible]), as well 42 as the additional requirements listed below. 43 </p> 44<p> 45 In the table below, <code class="computeroutput">x</code> denotes a value of type <code class="computeroutput">X</code>, 46 <code class="computeroutput">ec</code> denotes a (possibly const) value of type <code class="computeroutput">error_code</code>, 47 and <code class="computeroutput">n</code> denotes a (possibly const) value of type <code class="computeroutput">size_t</code>. 48 </p> 49<div class="table"> 50<a name="boost_asio.reference.CompletionCondition.t0"></a><p class="title"><b>Table 6. CompletionCondition requirements</b></p> 51<div class="table-contents"><table class="table" summary="CompletionCondition requirements"> 52<colgroup> 53<col> 54<col> 55<col> 56</colgroup> 57<thead><tr> 58<th> 59 <p> 60 expression 61 </p> 62 </th> 63<th> 64 <p> 65 return type 66 </p> 67 </th> 68<th> 69 <p> 70 assertion/note<br> pre/post-condition 71 </p> 72 </th> 73</tr></thead> 74<tbody><tr> 75<td> 76 <p> 77 <code class="computeroutput">x(ec, n)</code> 78 </p> 79 </td> 80<td> 81 <p> 82 <code class="computeroutput">size_t</code> 83 </p> 84 </td> 85<td> 86 <p> 87 Let <code class="computeroutput">n</code> be the total number of bytes transferred by 88 the read or write algorithm so far.<br> <br> Returns the maximum 89 number of bytes to be transferred on the next <code class="computeroutput">read_some</code>, 90 <code class="computeroutput">async_read_some</code>, <code class="computeroutput">write_some</code>, or <code class="computeroutput">async_write_some</code> 91 operation performed by the algorithm. Returns <code class="computeroutput">0</code> to 92 indicate that the algorithm is complete. 93 </p> 94 </td> 95</tr></tbody> 96</table></div> 97</div> 98<br class="table-break"> 99</div> 100<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> 101<td align="left"></td> 102<td align="right"><div class="copyright-footer">Copyright © 2003-2020 Christopher M. 103 Kohlhoff<p> 104 Distributed under the Boost Software License, Version 1.0. (See accompanying 105 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>) 106 </p> 107</div></td> 108</tr></table> 109<hr> 110<div class="spirit-nav"> 111<a accesskey="p" href="BufferedHandshakeHandler.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="CompletionHandler.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a> 112</div> 113</body> 114</html> 115