RandomAccessHandleService.html 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237
  1. <html>
  2. <head>
  3. <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
  4. <title>Random access handle service requirements</title>
  5. <link rel="stylesheet" href="../../boostbook.css" type="text/css">
  6. <meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
  7. <link rel="home" href="../../index.html" title="Asio">
  8. <link rel="up" href="../reference.html" title="Reference">
  9. <link rel="prev" href="Protocol.html" title="Protocol requirements">
  10. <link rel="next" href="RawSocketService.html" title="Raw socket service requirements">
  11. </head>
  12. <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
  13. <table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../asio.png"></td></tr></table>
  14. <hr>
  15. <div class="spirit-nav">
  16. <a accesskey="p" href="Protocol.html"><img src="../../prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../home.png" alt="Home"></a><a accesskey="n" href="RawSocketService.html"><img src="../../next.png" alt="Next"></a>
  17. </div>
  18. <div class="section">
  19. <div class="titlepage"><div><div><h3 class="title">
  20. <a name="asio.reference.RandomAccessHandleService"></a><a class="link" href="RandomAccessHandleService.html" title="Random access handle service requirements">Random access
  21. handle service requirements</a>
  22. </h3></div></div></div>
  23. <p>
  24. A random access handle service must meet the requirements for a <a class="link" href="HandleService.html" title="Handle service requirements">handle
  25. service</a>, as well as the additional requirements listed below.
  26. </p>
  27. <p>
  28. In the table below, <code class="computeroutput"><span class="identifier">X</span></code> denotes
  29. a random access handle service class, <code class="computeroutput"><span class="identifier">a</span></code>
  30. denotes a value of type <code class="computeroutput"><span class="identifier">X</span></code>,
  31. <code class="computeroutput"><span class="identifier">b</span></code> denotes a value of type
  32. <code class="computeroutput"><span class="identifier">X</span><span class="special">::</span><span class="identifier">implementation_type</span></code>, <code class="computeroutput"><span class="identifier">ec</span></code>
  33. denotes a value of type <code class="computeroutput"><span class="identifier">error_code</span></code>,
  34. <code class="computeroutput"><span class="identifier">o</span></code> denotes an offset of type
  35. boost::uint64_t, <code class="computeroutput"><span class="identifier">mb</span></code> denotes
  36. a value satisfying <a class="link" href="MutableBufferSequence.html" title="Mutable buffer sequence requirements">mutable
  37. buffer sequence</a> requirements, <code class="computeroutput"><span class="identifier">rh</span></code>
  38. denotes a value meeting <a class="link" href="ReadHandler.html" title="Read handler requirements"><code class="computeroutput"><span class="identifier">ReadHandler</span></code></a> requirements, <code class="computeroutput"><span class="identifier">cb</span></code> denotes a value satisfying <a class="link" href="ConstBufferSequence.html" title="Constant buffer sequence requirements">constant
  39. buffer sequence</a> requirements, and <code class="computeroutput"><span class="identifier">wh</span></code>
  40. denotes a value meeting <a class="link" href="WriteHandler.html" title="Write handler requirements"><code class="computeroutput"><span class="identifier">WriteHandler</span></code></a> requirements.
  41. </p>
  42. <div class="table">
  43. <a name="asio.reference.RandomAccessHandleService.t0"></a><p class="title"><b>Table&#160;21.&#160;RandomAccessHandleService requirements</b></p>
  44. <div class="table-contents"><table class="table" summary="RandomAccessHandleService requirements">
  45. <colgroup>
  46. <col>
  47. <col>
  48. <col>
  49. </colgroup>
  50. <thead><tr>
  51. <th>
  52. <p>
  53. expression
  54. </p>
  55. </th>
  56. <th>
  57. <p>
  58. return type
  59. </p>
  60. </th>
  61. <th>
  62. <p>
  63. assertion/note<br> pre/post-condition
  64. </p>
  65. </th>
  66. </tr></thead>
  67. <tbody>
  68. <tr>
  69. <td>
  70. <p>
  71. <code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">read_some_at</span><span class="special">(</span><span class="identifier">b</span><span class="special">,</span>
  72. <span class="identifier">o</span><span class="special">,</span>
  73. <span class="identifier">mb</span><span class="special">,</span>
  74. <span class="identifier">ec</span><span class="special">);</span></code>
  75. </p>
  76. </td>
  77. <td>
  78. <p>
  79. <code class="computeroutput"><span class="identifier">size_t</span></code>
  80. </p>
  81. </td>
  82. <td>
  83. <p>
  84. pre: <code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">is_open</span><span class="special">(</span><span class="identifier">b</span><span class="special">)</span></code>.<br>
  85. <br> Reads one or more bytes of data from a handle <code class="computeroutput"><span class="identifier">b</span></code> at offset <code class="computeroutput"><span class="identifier">o</span></code>.<br>
  86. <br> The mutable buffer sequence <code class="computeroutput"><span class="identifier">mb</span></code>
  87. specifies memory where the data should be placed. The operation
  88. shall always fill a buffer in the sequence completely before proceeding
  89. to the next.<br> <br> If successful, returns the number of
  90. bytes read. Otherwise returns <code class="computeroutput"><span class="number">0</span></code>.
  91. If the total size of all buffers in the sequence <code class="computeroutput"><span class="identifier">mb</span></code> is <code class="computeroutput"><span class="number">0</span></code>,
  92. the function shall return <code class="computeroutput"><span class="number">0</span></code>
  93. immediately.
  94. </p>
  95. </td>
  96. </tr>
  97. <tr>
  98. <td>
  99. <p>
  100. <code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">async_read_some_at</span><span class="special">(</span><span class="identifier">b</span><span class="special">,</span>
  101. <span class="identifier">o</span><span class="special">,</span>
  102. <span class="identifier">mb</span><span class="special">,</span>
  103. <span class="identifier">rh</span><span class="special">);</span></code>
  104. </p>
  105. </td>
  106. <td>
  107. <p>
  108. <code class="computeroutput"><span class="keyword">void</span></code>
  109. </p>
  110. </td>
  111. <td>
  112. <p>
  113. pre: <code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">is_open</span><span class="special">(</span><span class="identifier">b</span><span class="special">)</span></code>.<br>
  114. <br> Initiates an asynchronous operation to read one or more
  115. bytes of data from a handle <code class="computeroutput"><span class="identifier">b</span></code>
  116. at offset <code class="computeroutput"><span class="identifier">o</span></code>. The
  117. operation is performed via the <code class="computeroutput"><span class="identifier">io_service</span></code>
  118. object <code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">get_io_service</span><span class="special">()</span></code>
  119. and behaves according to <a class="link" href="asynchronous_operations.html" title="Requirements on asynchronous operations">asynchronous
  120. operation</a> requirements.<br> <br> The mutable buffer
  121. sequence <code class="computeroutput"><span class="identifier">mb</span></code> specifies
  122. memory where the data should be placed. The operation shall always
  123. fill a buffer in the sequence completely before proceeding to the
  124. next.<br> <br> The implementation shall maintain one or more
  125. copies of <code class="computeroutput"><span class="identifier">mb</span></code> until
  126. such time as the read operation no longer requires access to the
  127. memory specified by the buffers in the sequence. The program must
  128. ensure the memory is valid until:<br> <br> &#8212; the last copy of
  129. <code class="computeroutput"><span class="identifier">mb</span></code> is destroyed,
  130. or<br> <br> &#8212; the handler for the asynchronous operation is invoked,<br>
  131. <br> whichever comes first. If the total size of all buffers
  132. in the sequence <code class="computeroutput"><span class="identifier">mb</span></code>
  133. is <code class="computeroutput"><span class="number">0</span></code>, the asynchronous
  134. read operation shall complete immediately and pass <code class="computeroutput"><span class="number">0</span></code> as the argument to the handler
  135. that specifies the number of bytes read.<br> <br> If the operation
  136. completes successfully, the <code class="computeroutput"><span class="identifier">ReadHandler</span></code>
  137. object <code class="computeroutput"><span class="identifier">rh</span></code> is invoked
  138. with the number of bytes transferred. Otherwise it is invoked with
  139. <code class="computeroutput"><span class="number">0</span></code>.
  140. </p>
  141. </td>
  142. </tr>
  143. <tr>
  144. <td>
  145. <p>
  146. <code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">write_some_at</span><span class="special">(</span><span class="identifier">b</span><span class="special">,</span>
  147. <span class="identifier">o</span><span class="special">,</span>
  148. <span class="identifier">cb</span><span class="special">,</span>
  149. <span class="identifier">ec</span><span class="special">);</span></code>
  150. </p>
  151. </td>
  152. <td>
  153. <p>
  154. <code class="computeroutput"><span class="identifier">size_t</span></code>
  155. </p>
  156. </td>
  157. <td>
  158. <p>
  159. pre: <code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">is_open</span><span class="special">(</span><span class="identifier">b</span><span class="special">)</span></code>.<br>
  160. <br> Writes one or more bytes of data to a handle <code class="computeroutput"><span class="identifier">b</span></code> at offset <code class="computeroutput"><span class="identifier">o</span></code>.<br>
  161. <br> The constant buffer sequence <code class="computeroutput"><span class="identifier">cb</span></code>
  162. specifies memory where the data to be written is located. The operation
  163. shall always write a buffer in the sequence completely before proceeding
  164. to the next.<br> <br> If successful, returns the number of
  165. bytes written. Otherwise returns <code class="computeroutput"><span class="number">0</span></code>.
  166. If the total size of all buffers in the sequence <code class="computeroutput"><span class="identifier">cb</span></code> is <code class="computeroutput"><span class="number">0</span></code>,
  167. the function shall return <code class="computeroutput"><span class="number">0</span></code>
  168. immediately.
  169. </p>
  170. </td>
  171. </tr>
  172. <tr>
  173. <td>
  174. <p>
  175. <code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">async_write_some_at</span><span class="special">(</span><span class="identifier">b</span><span class="special">,</span>
  176. <span class="identifier">o</span><span class="special">,</span>
  177. <span class="identifier">cb</span><span class="special">,</span>
  178. <span class="identifier">wh</span><span class="special">);</span></code>
  179. </p>
  180. </td>
  181. <td>
  182. <p>
  183. <code class="computeroutput"><span class="keyword">void</span></code>
  184. </p>
  185. </td>
  186. <td>
  187. <p>
  188. pre: <code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">is_open</span><span class="special">(</span><span class="identifier">b</span><span class="special">)</span></code>.<br>
  189. <br> Initiates an asynchronous operation to write one or more
  190. bytes of data to a handle <code class="computeroutput"><span class="identifier">b</span></code>
  191. at offset <code class="computeroutput"><span class="identifier">o</span></code>. The
  192. operation is performed via the <code class="computeroutput"><span class="identifier">io_service</span></code>
  193. object <code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">get_io_service</span><span class="special">()</span></code>
  194. and behaves according to <a class="link" href="asynchronous_operations.html" title="Requirements on asynchronous operations">asynchronous
  195. operation</a> requirements.<br> <br> The constant buffer
  196. sequence <code class="computeroutput"><span class="identifier">cb</span></code> specifies
  197. memory where the data to be written is located. The operation shall
  198. always write a buffer in the sequence completely before proceeding
  199. to the next.<br> <br> The implementation shall maintain one
  200. or more copies of <code class="computeroutput"><span class="identifier">cb</span></code>
  201. until such time as the write operation no longer requires access
  202. to the memory specified by the buffers in the sequence. The program
  203. must ensure the memory is valid until:<br> <br> &#8212; the last copy
  204. of <code class="computeroutput"><span class="identifier">cb</span></code> is destroyed,
  205. or<br> <br> &#8212; the handler for the asynchronous operation is invoked,<br>
  206. <br> whichever comes first. If the total size of all buffers
  207. in the sequence <code class="computeroutput"><span class="identifier">cb</span></code>
  208. is <code class="computeroutput"><span class="number">0</span></code>, the asynchronous
  209. operation shall complete immediately and pass <code class="computeroutput"><span class="number">0</span></code>
  210. as the argument to the handler that specifies the number of bytes
  211. read.<br> <br> If the operation completes successfully, the
  212. <code class="computeroutput"><span class="identifier">WriteHandler</span></code> object
  213. <code class="computeroutput"><span class="identifier">wh</span></code> is invoked with
  214. the number of bytes transferred. Otherwise it is invoked with
  215. <code class="computeroutput"><span class="number">0</span></code>.
  216. </p>
  217. </td>
  218. </tr>
  219. </tbody>
  220. </table></div>
  221. </div>
  222. <br class="table-break">
  223. </div>
  224. <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
  225. <td align="left"></td>
  226. <td align="right"><div class="copyright-footer">Copyright &#169; 2003-2014 Christopher M. Kohlhoff<p>
  227. Distributed under the Boost Software License, Version 1.0. (See accompanying
  228. 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>)
  229. </p>
  230. </div></td>
  231. </tr></table>
  232. <hr>
  233. <div class="spirit-nav">
  234. <a accesskey="p" href="Protocol.html"><img src="../../prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../home.png" alt="Home"></a><a accesskey="n" href="RawSocketService.html"><img src="../../next.png" alt="Next"></a>
  235. </div>
  236. </body>
  237. </html>