SyncRandomAccessWriteDevice.html 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. <html>
  2. <head>
  3. <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
  4. <title>Buffer-oriented synchronous random-access write device 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="SyncRandomAccessReadDevice.html" title="Buffer-oriented synchronous random-access read device requirements">
  10. <link rel="next" href="SyncReadStream.html" title="Buffer-oriented synchronous read stream 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="SyncRandomAccessReadDevice.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="SyncReadStream.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.SyncRandomAccessWriteDevice"></a><a class="link" href="SyncRandomAccessWriteDevice.html" title="Buffer-oriented synchronous random-access write device requirements">Buffer-oriented
  21. synchronous random-access write device requirements</a>
  22. </h3></div></div></div>
  23. <p>
  24. In the table below, <code class="computeroutput"><span class="identifier">a</span></code> denotes
  25. a synchronous random-access write device object, <code class="computeroutput"><span class="identifier">o</span></code>
  26. denotes an offset of type <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">uint64_t</span></code>,
  27. <code class="computeroutput"><span class="identifier">cb</span></code> denotes an object satisfying
  28. <a class="link" href="ConstBufferSequence.html" title="Constant buffer sequence requirements">constant buffer sequence</a>
  29. requirements, and <code class="computeroutput"><span class="identifier">ec</span></code> denotes
  30. an object of type <code class="computeroutput"><span class="identifier">error_code</span></code>.
  31. </p>
  32. <div class="table">
  33. <a name="asio.reference.SyncRandomAccessWriteDevice.t0"></a><p class="title"><b>Table&#160;35.&#160;Buffer-oriented synchronous random-access write device requirements</b></p>
  34. <div class="table-contents"><table class="table" summary="Buffer-oriented synchronous random-access write device requirements">
  35. <colgroup>
  36. <col>
  37. <col>
  38. <col>
  39. </colgroup>
  40. <thead><tr>
  41. <th>
  42. <p>
  43. operation
  44. </p>
  45. </th>
  46. <th>
  47. <p>
  48. type
  49. </p>
  50. </th>
  51. <th>
  52. <p>
  53. semantics, pre/post-conditions
  54. </p>
  55. </th>
  56. </tr></thead>
  57. <tbody>
  58. <tr>
  59. <td>
  60. <p>
  61. <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">o</span><span class="special">,</span>
  62. <span class="identifier">cb</span><span class="special">);</span></code>
  63. </p>
  64. </td>
  65. <td>
  66. <p>
  67. <code class="computeroutput"><span class="identifier">size_t</span></code>
  68. </p>
  69. </td>
  70. <td>
  71. <p>
  72. Equivalent to:
  73. </p>
  74. <pre class="programlisting"><span class="identifier">error_code</span> <span class="identifier">ec</span><span class="special">;</span>
  75. <span class="identifier">size_t</span> <span class="identifier">s</span> <span class="special">=</span> <span class="identifier">a</span><span class="special">.</span><span class="identifier">write_some</span><span class="special">(</span><span class="identifier">o</span><span class="special">,</span> <span class="identifier">cb</span><span class="special">,</span> <span class="identifier">ec</span><span class="special">);</span>
  76. <span class="keyword">if</span> <span class="special">(</span><span class="identifier">ec</span><span class="special">)</span> <span class="keyword">throw</span> <span class="identifier">system_error</span><span class="special">(</span><span class="identifier">ec</span><span class="special">);</span>
  77. <span class="keyword">return</span> <span class="identifier">s</span><span class="special">;</span>
  78. </pre>
  79. <p>
  80. </p>
  81. </td>
  82. </tr>
  83. <tr>
  84. <td>
  85. <p>
  86. <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">o</span><span class="special">,</span>
  87. <span class="identifier">cb</span><span class="special">,</span>
  88. <span class="identifier">ec</span><span class="special">);</span></code>
  89. </p>
  90. </td>
  91. <td>
  92. <p>
  93. <code class="computeroutput"><span class="identifier">size_t</span></code>
  94. </p>
  95. </td>
  96. <td>
  97. <p>
  98. Writes one or more bytes of data to the device <code class="computeroutput"><span class="identifier">a</span></code>
  99. at offset <code class="computeroutput"><span class="identifier">o</span></code>.<br>
  100. <br> The constant buffer sequence <code class="computeroutput"><span class="identifier">cb</span></code>
  101. specifies memory where the data to be written is located. The
  102. <code class="computeroutput"><span class="identifier">write_some_at</span></code> operation
  103. shall always write a buffer in the sequence completely before proceeding
  104. to the next.<br> <br> If successful, returns the number of
  105. bytes written and sets <code class="computeroutput"><span class="identifier">ec</span></code>
  106. such that <code class="computeroutput"><span class="special">!</span><span class="identifier">ec</span></code>
  107. is true. If an error occurred, returns <code class="computeroutput"><span class="number">0</span></code>
  108. and sets <code class="computeroutput"><span class="identifier">ec</span></code> such
  109. that <code class="computeroutput"><span class="special">!!</span><span class="identifier">ec</span></code>
  110. is true.<br> <br> If the total size of all buffers in the sequence
  111. <code class="computeroutput"><span class="identifier">cb</span></code> is <code class="computeroutput"><span class="number">0</span></code>, the function shall return <code class="computeroutput"><span class="number">0</span></code> immediately.
  112. </p>
  113. </td>
  114. </tr>
  115. </tbody>
  116. </table></div>
  117. </div>
  118. <br class="table-break">
  119. </div>
  120. <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
  121. <td align="left"></td>
  122. <td align="right"><div class="copyright-footer">Copyright &#169; 2003-2014 Christopher M. Kohlhoff<p>
  123. Distributed under the Boost Software License, Version 1.0. (See accompanying
  124. 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>)
  125. </p>
  126. </div></td>
  127. </tr></table>
  128. <hr>
  129. <div class="spirit-nav">
  130. <a accesskey="p" href="SyncRandomAccessReadDevice.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="SyncReadStream.html"><img src="../../next.png" alt="Next"></a>
  131. </div>
  132. </body>
  133. </html>