Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #ifndef ASIO_WINDOWS_BASIC_RANDOM_ACCESS_HANDLE_HPP
00012 #define ASIO_WINDOWS_BASIC_RANDOM_ACCESS_HANDLE_HPP
00013
00014 #if defined(_MSC_VER) && (_MSC_VER >= 1200)
00015 # pragma once
00016 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
00017
00018 #include "asio/detail/push_options.hpp"
00019
00020 #include "asio/detail/push_options.hpp"
00021 #include <cstddef>
00022 #include <boost/config.hpp>
00023 #include "asio/detail/pop_options.hpp"
00024
00025 #include "asio/error.hpp"
00026 #include "asio/windows/basic_handle.hpp"
00027 #include "asio/windows/random_access_handle_service.hpp"
00028 #include "asio/detail/throw_error.hpp"
00029
00030 #if defined(ASIO_HAS_WINDOWS_RANDOM_ACCESS_HANDLE) \
00031 || defined(GENERATING_DOCUMENTATION)
00032
00033 namespace asio {
00034 namespace windows {
00035
00037
00045 template <typename RandomAccessHandleService = random_access_handle_service>
00046 class basic_random_access_handle
00047 : public basic_handle<RandomAccessHandleService>
00048 {
00049 public:
00051 typedef typename RandomAccessHandleService::native_type native_type;
00052
00054
00062 explicit basic_random_access_handle(asio::io_service& io_service)
00063 : basic_handle<RandomAccessHandleService>(io_service)
00064 {
00065 }
00066
00068
00080 basic_random_access_handle(asio::io_service& io_service,
00081 const native_type& native_handle)
00082 : basic_handle<RandomAccessHandleService>(io_service, native_handle)
00083 {
00084 }
00085
00087
00115 template <typename ConstBufferSequence>
00116 std::size_t write_some_at(boost::uint64_t offset,
00117 const ConstBufferSequence& buffers)
00118 {
00119 asio::error_code ec;
00120 std::size_t s = this->service.write_some_at(
00121 this->implementation, offset, buffers, ec);
00122 asio::detail::throw_error(ec);
00123 return s;
00124 }
00125
00127
00144 template <typename ConstBufferSequence>
00145 std::size_t write_some_at(boost::uint64_t offset,
00146 const ConstBufferSequence& buffers, asio::error_code& ec)
00147 {
00148 return this->service.write_some_at(
00149 this->implementation, offset, buffers, ec);
00150 }
00151
00153
00189 template <typename ConstBufferSequence, typename WriteHandler>
00190 void async_write_some_at(boost::uint64_t offset,
00191 const ConstBufferSequence& buffers, WriteHandler handler)
00192 {
00193 this->service.async_write_some_at(
00194 this->implementation, offset, buffers, handler);
00195 }
00196
00198
00227 template <typename MutableBufferSequence>
00228 std::size_t read_some_at(boost::uint64_t offset,
00229 const MutableBufferSequence& buffers)
00230 {
00231 asio::error_code ec;
00232 std::size_t s = this->service.read_some_at(
00233 this->implementation, offset, buffers, ec);
00234 asio::detail::throw_error(ec);
00235 return s;
00236 }
00237
00239
00257 template <typename MutableBufferSequence>
00258 std::size_t read_some_at(boost::uint64_t offset,
00259 const MutableBufferSequence& buffers, asio::error_code& ec)
00260 {
00261 return this->service.read_some_at(
00262 this->implementation, offset, buffers, ec);
00263 }
00264
00266
00303 template <typename MutableBufferSequence, typename ReadHandler>
00304 void async_read_some_at(boost::uint64_t offset,
00305 const MutableBufferSequence& buffers, ReadHandler handler)
00306 {
00307 this->service.async_read_some_at(
00308 this->implementation, offset, buffers, handler);
00309 }
00310 };
00311
00312 }
00313 }
00314
00315 #endif // defined(ASIO_HAS_WINDOWS_RANDOM_ACCESS_HANDLE)
00316
00317
00318 #include "asio/detail/pop_options.hpp"
00319
00320 #endif // ASIO_WINDOWS_BASIC_RANDOM_ACCESS_HANDLE_HPP