Audio plugin host https://kx.studio/carla
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

665 lines
25KB

  1. //
  2. // read_at.hpp
  3. // ~~~~~~~~~~~
  4. //
  5. // Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com)
  6. //
  7. // Distributed under the Boost Software License, Version 1.0. (See accompanying
  8. // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  9. //
  10. #ifndef ASIO_READ_AT_HPP
  11. #define ASIO_READ_AT_HPP
  12. #if defined(_MSC_VER) && (_MSC_VER >= 1200)
  13. # pragma once
  14. #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
  15. #include "asio/detail/config.hpp"
  16. #include <cstddef>
  17. #include "asio/async_result.hpp"
  18. #include "asio/basic_streambuf_fwd.hpp"
  19. #include "asio/detail/cstdint.hpp"
  20. #include "asio/error.hpp"
  21. #include "asio/detail/push_options.hpp"
  22. namespace asio {
  23. /**
  24. * @defgroup read_at asio::read_at
  25. *
  26. * @brief Attempt to read a certain amount of data at the specified offset
  27. * before returning.
  28. */
  29. /*@{*/
  30. /// Attempt to read a certain amount of data at the specified offset before
  31. /// returning.
  32. /**
  33. * This function is used to read a certain number of bytes of data from a
  34. * random access device at the specified offset. The call will block until one
  35. * of the following conditions is true:
  36. *
  37. * @li The supplied buffers are full. That is, the bytes transferred is equal to
  38. * the sum of the buffer sizes.
  39. *
  40. * @li An error occurred.
  41. *
  42. * This operation is implemented in terms of zero or more calls to the device's
  43. * read_some_at function.
  44. *
  45. * @param d The device from which the data is to be read. The type must support
  46. * the SyncRandomAccessReadDevice concept.
  47. *
  48. * @param offset The offset at which the data will be read.
  49. *
  50. * @param buffers One or more buffers into which the data will be read. The sum
  51. * of the buffer sizes indicates the maximum number of bytes to read from the
  52. * device.
  53. *
  54. * @returns The number of bytes transferred.
  55. *
  56. * @throws asio::system_error Thrown on failure.
  57. *
  58. * @par Example
  59. * To read into a single data buffer use the @ref buffer function as follows:
  60. * @code asio::read_at(d, 42, asio::buffer(data, size)); @endcode
  61. * See the @ref buffer documentation for information on reading into multiple
  62. * buffers in one go, and how to use it with arrays, boost::array or
  63. * std::vector.
  64. *
  65. * @note This overload is equivalent to calling:
  66. * @code asio::read_at(
  67. * d, 42, buffers,
  68. * asio::transfer_all()); @endcode
  69. */
  70. template <typename SyncRandomAccessReadDevice, typename MutableBufferSequence>
  71. std::size_t read_at(SyncRandomAccessReadDevice& d,
  72. uint64_t offset, const MutableBufferSequence& buffers);
  73. /// Attempt to read a certain amount of data at the specified offset before
  74. /// returning.
  75. /**
  76. * This function is used to read a certain number of bytes of data from a
  77. * random access device at the specified offset. The call will block until one
  78. * of the following conditions is true:
  79. *
  80. * @li The supplied buffers are full. That is, the bytes transferred is equal to
  81. * the sum of the buffer sizes.
  82. *
  83. * @li An error occurred.
  84. *
  85. * This operation is implemented in terms of zero or more calls to the device's
  86. * read_some_at function.
  87. *
  88. * @param d The device from which the data is to be read. The type must support
  89. * the SyncRandomAccessReadDevice concept.
  90. *
  91. * @param offset The offset at which the data will be read.
  92. *
  93. * @param buffers One or more buffers into which the data will be read. The sum
  94. * of the buffer sizes indicates the maximum number of bytes to read from the
  95. * device.
  96. *
  97. * @param ec Set to indicate what error occurred, if any.
  98. *
  99. * @returns The number of bytes transferred.
  100. *
  101. * @par Example
  102. * To read into a single data buffer use the @ref buffer function as follows:
  103. * @code asio::read_at(d, 42,
  104. * asio::buffer(data, size), ec); @endcode
  105. * See the @ref buffer documentation for information on reading into multiple
  106. * buffers in one go, and how to use it with arrays, boost::array or
  107. * std::vector.
  108. *
  109. * @note This overload is equivalent to calling:
  110. * @code asio::read_at(
  111. * d, 42, buffers,
  112. * asio::transfer_all(), ec); @endcode
  113. */
  114. template <typename SyncRandomAccessReadDevice, typename MutableBufferSequence>
  115. std::size_t read_at(SyncRandomAccessReadDevice& d,
  116. uint64_t offset, const MutableBufferSequence& buffers,
  117. asio::error_code& ec);
  118. /// Attempt to read a certain amount of data at the specified offset before
  119. /// returning.
  120. /**
  121. * This function is used to read a certain number of bytes of data from a
  122. * random access device at the specified offset. The call will block until one
  123. * of the following conditions is true:
  124. *
  125. * @li The supplied buffers are full. That is, the bytes transferred is equal to
  126. * the sum of the buffer sizes.
  127. *
  128. * @li The completion_condition function object returns 0.
  129. *
  130. * This operation is implemented in terms of zero or more calls to the device's
  131. * read_some_at function.
  132. *
  133. * @param d The device from which the data is to be read. The type must support
  134. * the SyncRandomAccessReadDevice concept.
  135. *
  136. * @param offset The offset at which the data will be read.
  137. *
  138. * @param buffers One or more buffers into which the data will be read. The sum
  139. * of the buffer sizes indicates the maximum number of bytes to read from the
  140. * device.
  141. *
  142. * @param completion_condition The function object to be called to determine
  143. * whether the read operation is complete. The signature of the function object
  144. * must be:
  145. * @code std::size_t completion_condition(
  146. * // Result of latest read_some_at operation.
  147. * const asio::error_code& error,
  148. *
  149. * // Number of bytes transferred so far.
  150. * std::size_t bytes_transferred
  151. * ); @endcode
  152. * A return value of 0 indicates that the read operation is complete. A non-zero
  153. * return value indicates the maximum number of bytes to be read on the next
  154. * call to the device's read_some_at function.
  155. *
  156. * @returns The number of bytes transferred.
  157. *
  158. * @throws asio::system_error Thrown on failure.
  159. *
  160. * @par Example
  161. * To read into a single data buffer use the @ref buffer function as follows:
  162. * @code asio::read_at(d, 42, asio::buffer(data, size),
  163. * asio::transfer_at_least(32)); @endcode
  164. * See the @ref buffer documentation for information on reading into multiple
  165. * buffers in one go, and how to use it with arrays, boost::array or
  166. * std::vector.
  167. */
  168. template <typename SyncRandomAccessReadDevice, typename MutableBufferSequence,
  169. typename CompletionCondition>
  170. std::size_t read_at(SyncRandomAccessReadDevice& d,
  171. uint64_t offset, const MutableBufferSequence& buffers,
  172. CompletionCondition completion_condition);
  173. /// Attempt to read a certain amount of data at the specified offset before
  174. /// returning.
  175. /**
  176. * This function is used to read a certain number of bytes of data from a
  177. * random access device at the specified offset. The call will block until one
  178. * of the following conditions is true:
  179. *
  180. * @li The supplied buffers are full. That is, the bytes transferred is equal to
  181. * the sum of the buffer sizes.
  182. *
  183. * @li The completion_condition function object returns 0.
  184. *
  185. * This operation is implemented in terms of zero or more calls to the device's
  186. * read_some_at function.
  187. *
  188. * @param d The device from which the data is to be read. The type must support
  189. * the SyncRandomAccessReadDevice concept.
  190. *
  191. * @param offset The offset at which the data will be read.
  192. *
  193. * @param buffers One or more buffers into which the data will be read. The sum
  194. * of the buffer sizes indicates the maximum number of bytes to read from the
  195. * device.
  196. *
  197. * @param completion_condition The function object to be called to determine
  198. * whether the read operation is complete. The signature of the function object
  199. * must be:
  200. * @code std::size_t completion_condition(
  201. * // Result of latest read_some_at operation.
  202. * const asio::error_code& error,
  203. *
  204. * // Number of bytes transferred so far.
  205. * std::size_t bytes_transferred
  206. * ); @endcode
  207. * A return value of 0 indicates that the read operation is complete. A non-zero
  208. * return value indicates the maximum number of bytes to be read on the next
  209. * call to the device's read_some_at function.
  210. *
  211. * @param ec Set to indicate what error occurred, if any.
  212. *
  213. * @returns The number of bytes read. If an error occurs, returns the total
  214. * number of bytes successfully transferred prior to the error.
  215. */
  216. template <typename SyncRandomAccessReadDevice, typename MutableBufferSequence,
  217. typename CompletionCondition>
  218. std::size_t read_at(SyncRandomAccessReadDevice& d,
  219. uint64_t offset, const MutableBufferSequence& buffers,
  220. CompletionCondition completion_condition, asio::error_code& ec);
  221. #if !defined(ASIO_NO_IOSTREAM)
  222. /// Attempt to read a certain amount of data at the specified offset before
  223. /// returning.
  224. /**
  225. * This function is used to read a certain number of bytes of data from a
  226. * random access device at the specified offset. The call will block until one
  227. * of the following conditions is true:
  228. *
  229. * @li An error occurred.
  230. *
  231. * This operation is implemented in terms of zero or more calls to the device's
  232. * read_some_at function.
  233. *
  234. * @param d The device from which the data is to be read. The type must support
  235. * the SyncRandomAccessReadDevice concept.
  236. *
  237. * @param offset The offset at which the data will be read.
  238. *
  239. * @param b The basic_streambuf object into which the data will be read.
  240. *
  241. * @returns The number of bytes transferred.
  242. *
  243. * @throws asio::system_error Thrown on failure.
  244. *
  245. * @note This overload is equivalent to calling:
  246. * @code asio::read_at(
  247. * d, 42, b,
  248. * asio::transfer_all()); @endcode
  249. */
  250. template <typename SyncRandomAccessReadDevice, typename Allocator>
  251. std::size_t read_at(SyncRandomAccessReadDevice& d,
  252. uint64_t offset, basic_streambuf<Allocator>& b);
  253. /// Attempt to read a certain amount of data at the specified offset before
  254. /// returning.
  255. /**
  256. * This function is used to read a certain number of bytes of data from a
  257. * random access device at the specified offset. The call will block until one
  258. * of the following conditions is true:
  259. *
  260. * @li An error occurred.
  261. *
  262. * This operation is implemented in terms of zero or more calls to the device's
  263. * read_some_at function.
  264. *
  265. * @param d The device from which the data is to be read. The type must support
  266. * the SyncRandomAccessReadDevice concept.
  267. *
  268. * @param offset The offset at which the data will be read.
  269. *
  270. * @param b The basic_streambuf object into which the data will be read.
  271. *
  272. * @param ec Set to indicate what error occurred, if any.
  273. *
  274. * @returns The number of bytes transferred.
  275. *
  276. * @note This overload is equivalent to calling:
  277. * @code asio::read_at(
  278. * d, 42, b,
  279. * asio::transfer_all(), ec); @endcode
  280. */
  281. template <typename SyncRandomAccessReadDevice, typename Allocator>
  282. std::size_t read_at(SyncRandomAccessReadDevice& d,
  283. uint64_t offset, basic_streambuf<Allocator>& b,
  284. asio::error_code& ec);
  285. /// Attempt to read a certain amount of data at the specified offset before
  286. /// returning.
  287. /**
  288. * This function is used to read a certain number of bytes of data from a
  289. * random access device at the specified offset. The call will block until one
  290. * of the following conditions is true:
  291. *
  292. * @li The completion_condition function object returns 0.
  293. *
  294. * This operation is implemented in terms of zero or more calls to the device's
  295. * read_some_at function.
  296. *
  297. * @param d The device from which the data is to be read. The type must support
  298. * the SyncRandomAccessReadDevice concept.
  299. *
  300. * @param offset The offset at which the data will be read.
  301. *
  302. * @param b The basic_streambuf object into which the data will be read.
  303. *
  304. * @param completion_condition The function object to be called to determine
  305. * whether the read operation is complete. The signature of the function object
  306. * must be:
  307. * @code std::size_t completion_condition(
  308. * // Result of latest read_some_at operation.
  309. * const asio::error_code& error,
  310. *
  311. * // Number of bytes transferred so far.
  312. * std::size_t bytes_transferred
  313. * ); @endcode
  314. * A return value of 0 indicates that the read operation is complete. A non-zero
  315. * return value indicates the maximum number of bytes to be read on the next
  316. * call to the device's read_some_at function.
  317. *
  318. * @returns The number of bytes transferred.
  319. *
  320. * @throws asio::system_error Thrown on failure.
  321. */
  322. template <typename SyncRandomAccessReadDevice, typename Allocator,
  323. typename CompletionCondition>
  324. std::size_t read_at(SyncRandomAccessReadDevice& d,
  325. uint64_t offset, basic_streambuf<Allocator>& b,
  326. CompletionCondition completion_condition);
  327. /// Attempt to read a certain amount of data at the specified offset before
  328. /// returning.
  329. /**
  330. * This function is used to read a certain number of bytes of data from a
  331. * random access device at the specified offset. The call will block until one
  332. * of the following conditions is true:
  333. *
  334. * @li The completion_condition function object returns 0.
  335. *
  336. * This operation is implemented in terms of zero or more calls to the device's
  337. * read_some_at function.
  338. *
  339. * @param d The device from which the data is to be read. The type must support
  340. * the SyncRandomAccessReadDevice concept.
  341. *
  342. * @param offset The offset at which the data will be read.
  343. *
  344. * @param b The basic_streambuf object into which the data will be read.
  345. *
  346. * @param completion_condition The function object to be called to determine
  347. * whether the read operation is complete. The signature of the function object
  348. * must be:
  349. * @code std::size_t completion_condition(
  350. * // Result of latest read_some_at operation.
  351. * const asio::error_code& error,
  352. *
  353. * // Number of bytes transferred so far.
  354. * std::size_t bytes_transferred
  355. * ); @endcode
  356. * A return value of 0 indicates that the read operation is complete. A non-zero
  357. * return value indicates the maximum number of bytes to be read on the next
  358. * call to the device's read_some_at function.
  359. *
  360. * @param ec Set to indicate what error occurred, if any.
  361. *
  362. * @returns The number of bytes read. If an error occurs, returns the total
  363. * number of bytes successfully transferred prior to the error.
  364. */
  365. template <typename SyncRandomAccessReadDevice, typename Allocator,
  366. typename CompletionCondition>
  367. std::size_t read_at(SyncRandomAccessReadDevice& d,
  368. uint64_t offset, basic_streambuf<Allocator>& b,
  369. CompletionCondition completion_condition, asio::error_code& ec);
  370. #endif // !defined(ASIO_NO_IOSTREAM)
  371. /*@}*/
  372. /**
  373. * @defgroup async_read_at asio::async_read_at
  374. *
  375. * @brief Start an asynchronous operation to read a certain amount of data at
  376. * the specified offset.
  377. */
  378. /*@{*/
  379. /// Start an asynchronous operation to read a certain amount of data at the
  380. /// specified offset.
  381. /**
  382. * This function is used to asynchronously read a certain number of bytes of
  383. * data from a random access device at the specified offset. The function call
  384. * always returns immediately. The asynchronous operation will continue until
  385. * one of the following conditions is true:
  386. *
  387. * @li The supplied buffers are full. That is, the bytes transferred is equal to
  388. * the sum of the buffer sizes.
  389. *
  390. * @li An error occurred.
  391. *
  392. * This operation is implemented in terms of zero or more calls to the device's
  393. * async_read_some_at function.
  394. *
  395. * @param d The device from which the data is to be read. The type must support
  396. * the AsyncRandomAccessReadDevice concept.
  397. *
  398. * @param offset The offset at which the data will be read.
  399. *
  400. * @param buffers One or more buffers into which the data will be read. The sum
  401. * of the buffer sizes indicates the maximum number of bytes to read from the
  402. * device. Although the buffers object may be copied as necessary, ownership of
  403. * the underlying memory blocks is retained by the caller, which must guarantee
  404. * that they remain valid until the handler is called.
  405. *
  406. * @param handler The handler to be called when the read operation completes.
  407. * Copies will be made of the handler as required. The function signature of the
  408. * handler must be:
  409. * @code void handler(
  410. * // Result of operation.
  411. * const asio::error_code& error,
  412. *
  413. * // Number of bytes copied into the buffers. If an error
  414. * // occurred, this will be the number of bytes successfully
  415. * // transferred prior to the error.
  416. * std::size_t bytes_transferred
  417. * ); @endcode
  418. * Regardless of whether the asynchronous operation completes immediately or
  419. * not, the handler will not be invoked from within this function. Invocation of
  420. * the handler will be performed in a manner equivalent to using
  421. * asio::io_context::post().
  422. *
  423. * @par Example
  424. * To read into a single data buffer use the @ref buffer function as follows:
  425. * @code
  426. * asio::async_read_at(d, 42, asio::buffer(data, size), handler);
  427. * @endcode
  428. * See the @ref buffer documentation for information on reading into multiple
  429. * buffers in one go, and how to use it with arrays, boost::array or
  430. * std::vector.
  431. *
  432. * @note This overload is equivalent to calling:
  433. * @code asio::async_read_at(
  434. * d, 42, buffers,
  435. * asio::transfer_all(),
  436. * handler); @endcode
  437. */
  438. template <typename AsyncRandomAccessReadDevice, typename MutableBufferSequence,
  439. typename ReadHandler>
  440. ASIO_INITFN_RESULT_TYPE(ReadHandler,
  441. void (asio::error_code, std::size_t))
  442. async_read_at(AsyncRandomAccessReadDevice& d, uint64_t offset,
  443. const MutableBufferSequence& buffers,
  444. ASIO_MOVE_ARG(ReadHandler) handler);
  445. /// Start an asynchronous operation to read a certain amount of data at the
  446. /// specified offset.
  447. /**
  448. * This function is used to asynchronously read a certain number of bytes of
  449. * data from a random access device at the specified offset. The function call
  450. * always returns immediately. The asynchronous operation will continue until
  451. * one of the following conditions is true:
  452. *
  453. * @li The supplied buffers are full. That is, the bytes transferred is equal to
  454. * the sum of the buffer sizes.
  455. *
  456. * @li The completion_condition function object returns 0.
  457. *
  458. * @param d The device from which the data is to be read. The type must support
  459. * the AsyncRandomAccessReadDevice concept.
  460. *
  461. * @param offset The offset at which the data will be read.
  462. *
  463. * @param buffers One or more buffers into which the data will be read. The sum
  464. * of the buffer sizes indicates the maximum number of bytes to read from the
  465. * device. Although the buffers object may be copied as necessary, ownership of
  466. * the underlying memory blocks is retained by the caller, which must guarantee
  467. * that they remain valid until the handler is called.
  468. *
  469. * @param completion_condition The function object to be called to determine
  470. * whether the read operation is complete. The signature of the function object
  471. * must be:
  472. * @code std::size_t completion_condition(
  473. * // Result of latest async_read_some_at operation.
  474. * const asio::error_code& error,
  475. *
  476. * // Number of bytes transferred so far.
  477. * std::size_t bytes_transferred
  478. * ); @endcode
  479. * A return value of 0 indicates that the read operation is complete. A non-zero
  480. * return value indicates the maximum number of bytes to be read on the next
  481. * call to the device's async_read_some_at function.
  482. *
  483. * @param handler The handler to be called when the read operation completes.
  484. * Copies will be made of the handler as required. The function signature of the
  485. * handler must be:
  486. * @code void handler(
  487. * // Result of operation.
  488. * const asio::error_code& error,
  489. *
  490. * // Number of bytes copied into the buffers. If an error
  491. * // occurred, this will be the number of bytes successfully
  492. * // transferred prior to the error.
  493. * std::size_t bytes_transferred
  494. * ); @endcode
  495. * Regardless of whether the asynchronous operation completes immediately or
  496. * not, the handler will not be invoked from within this function. Invocation of
  497. * the handler will be performed in a manner equivalent to using
  498. * asio::io_context::post().
  499. *
  500. * @par Example
  501. * To read into a single data buffer use the @ref buffer function as follows:
  502. * @code asio::async_read_at(d, 42,
  503. * asio::buffer(data, size),
  504. * asio::transfer_at_least(32),
  505. * handler); @endcode
  506. * See the @ref buffer documentation for information on reading into multiple
  507. * buffers in one go, and how to use it with arrays, boost::array or
  508. * std::vector.
  509. */
  510. template <typename AsyncRandomAccessReadDevice, typename MutableBufferSequence,
  511. typename CompletionCondition, typename ReadHandler>
  512. ASIO_INITFN_RESULT_TYPE(ReadHandler,
  513. void (asio::error_code, std::size_t))
  514. async_read_at(AsyncRandomAccessReadDevice& d,
  515. uint64_t offset, const MutableBufferSequence& buffers,
  516. CompletionCondition completion_condition,
  517. ASIO_MOVE_ARG(ReadHandler) handler);
  518. #if !defined(ASIO_NO_IOSTREAM)
  519. /// Start an asynchronous operation to read a certain amount of data at the
  520. /// specified offset.
  521. /**
  522. * This function is used to asynchronously read a certain number of bytes of
  523. * data from a random access device at the specified offset. The function call
  524. * always returns immediately. The asynchronous operation will continue until
  525. * one of the following conditions is true:
  526. *
  527. * @li An error occurred.
  528. *
  529. * This operation is implemented in terms of zero or more calls to the device's
  530. * async_read_some_at function.
  531. *
  532. * @param d The device from which the data is to be read. The type must support
  533. * the AsyncRandomAccessReadDevice concept.
  534. *
  535. * @param offset The offset at which the data will be read.
  536. *
  537. * @param b A basic_streambuf object into which the data will be read. Ownership
  538. * of the streambuf is retained by the caller, which must guarantee that it
  539. * remains valid until the handler is called.
  540. *
  541. * @param handler The handler to be called when the read operation completes.
  542. * Copies will be made of the handler as required. The function signature of the
  543. * handler must be:
  544. * @code void handler(
  545. * // Result of operation.
  546. * const asio::error_code& error,
  547. *
  548. * // Number of bytes copied into the buffers. If an error
  549. * // occurred, this will be the number of bytes successfully
  550. * // transferred prior to the error.
  551. * std::size_t bytes_transferred
  552. * ); @endcode
  553. * Regardless of whether the asynchronous operation completes immediately or
  554. * not, the handler will not be invoked from within this function. Invocation of
  555. * the handler will be performed in a manner equivalent to using
  556. * asio::io_context::post().
  557. *
  558. * @note This overload is equivalent to calling:
  559. * @code asio::async_read_at(
  560. * d, 42, b,
  561. * asio::transfer_all(),
  562. * handler); @endcode
  563. */
  564. template <typename AsyncRandomAccessReadDevice, typename Allocator,
  565. typename ReadHandler>
  566. ASIO_INITFN_RESULT_TYPE(ReadHandler,
  567. void (asio::error_code, std::size_t))
  568. async_read_at(AsyncRandomAccessReadDevice& d, uint64_t offset,
  569. basic_streambuf<Allocator>& b, ASIO_MOVE_ARG(ReadHandler) handler);
  570. /// Start an asynchronous operation to read a certain amount of data at the
  571. /// specified offset.
  572. /**
  573. * This function is used to asynchronously read a certain number of bytes of
  574. * data from a random access device at the specified offset. The function call
  575. * always returns immediately. The asynchronous operation will continue until
  576. * one of the following conditions is true:
  577. *
  578. * @li The completion_condition function object returns 0.
  579. *
  580. * This operation is implemented in terms of zero or more calls to the device's
  581. * async_read_some_at function.
  582. *
  583. * @param d The device from which the data is to be read. The type must support
  584. * the AsyncRandomAccessReadDevice concept.
  585. *
  586. * @param offset The offset at which the data will be read.
  587. *
  588. * @param b A basic_streambuf object into which the data will be read. Ownership
  589. * of the streambuf is retained by the caller, which must guarantee that it
  590. * remains valid until the handler is called.
  591. *
  592. * @param completion_condition The function object to be called to determine
  593. * whether the read operation is complete. The signature of the function object
  594. * must be:
  595. * @code std::size_t completion_condition(
  596. * // Result of latest async_read_some_at operation.
  597. * const asio::error_code& error,
  598. *
  599. * // Number of bytes transferred so far.
  600. * std::size_t bytes_transferred
  601. * ); @endcode
  602. * A return value of 0 indicates that the read operation is complete. A non-zero
  603. * return value indicates the maximum number of bytes to be read on the next
  604. * call to the device's async_read_some_at function.
  605. *
  606. * @param handler The handler to be called when the read operation completes.
  607. * Copies will be made of the handler as required. The function signature of the
  608. * handler must be:
  609. * @code void handler(
  610. * // Result of operation.
  611. * const asio::error_code& error,
  612. *
  613. * // Number of bytes copied into the buffers. If an error
  614. * // occurred, this will be the number of bytes successfully
  615. * // transferred prior to the error.
  616. * std::size_t bytes_transferred
  617. * ); @endcode
  618. * Regardless of whether the asynchronous operation completes immediately or
  619. * not, the handler will not be invoked from within this function. Invocation of
  620. * the handler will be performed in a manner equivalent to using
  621. * asio::io_context::post().
  622. */
  623. template <typename AsyncRandomAccessReadDevice, typename Allocator,
  624. typename CompletionCondition, typename ReadHandler>
  625. ASIO_INITFN_RESULT_TYPE(ReadHandler,
  626. void (asio::error_code, std::size_t))
  627. async_read_at(AsyncRandomAccessReadDevice& d,
  628. uint64_t offset, basic_streambuf<Allocator>& b,
  629. CompletionCondition completion_condition,
  630. ASIO_MOVE_ARG(ReadHandler) handler);
  631. #endif // !defined(ASIO_NO_IOSTREAM)
  632. /*@}*/
  633. } // namespace asio
  634. #include "asio/detail/pop_options.hpp"
  635. #include "asio/impl/read_at.hpp"
  636. #endif // ASIO_READ_AT_HPP