random_access_handle_service.hpp
Go to the documentation of this file.
00001 //
00002 // random_access_handle_service.hpp
00003 // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
00004 //
00005 // Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot com)
00006 //
00007 // Distributed under the Boost Software License, Version 1.0. (See accompanying
00008 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
00009 //
00010 
00011 #ifndef ASIO_WINDOWS_RANDOM_ACCESS_HANDLE_SERVICE_HPP
00012 #define ASIO_WINDOWS_RANDOM_ACCESS_HANDLE_SERVICE_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 <boost/cstdint.hpp>
00024 #include "asio/detail/pop_options.hpp"
00025 
00026 #include "asio/error.hpp"
00027 #include "asio/io_service.hpp"
00028 #include "asio/detail/service_base.hpp"
00029 #include "asio/detail/win_iocp_handle_service.hpp"
00030 
00031 #if !defined(ASIO_DISABLE_WINDOWS_RANDOM_ACCESS_HANDLE)
00032 # if defined(ASIO_HAS_IOCP)
00033 #  define ASIO_HAS_WINDOWS_RANDOM_ACCESS_HANDLE 1
00034 # endif // defined(ASIO_HAS_IOCP)
00035 #endif // !defined(ASIO_DISABLE_WINDOWS_RANDOM_ACCESS_HANDLE)
00036 
00037 #if defined(ASIO_HAS_WINDOWS_RANDOM_ACCESS_HANDLE) \
00038   || defined(GENERATING_DOCUMENTATION)
00039 
00040 namespace asio {
00041 namespace windows {
00042 
00044 class random_access_handle_service
00045 #if defined(GENERATING_DOCUMENTATION)
00046   : public asio::io_service::service
00047 #else
00048   : public asio::detail::service_base<random_access_handle_service>
00049 #endif
00050 {
00051 public:
00052 #if defined(GENERATING_DOCUMENTATION)
00053 
00054   static asio::io_service::id id;
00055 #endif
00056 
00057 private:
00058   // The type of the platform-specific implementation.
00059   typedef detail::win_iocp_handle_service service_impl_type;
00060 
00061 public:
00063 #if defined(GENERATING_DOCUMENTATION)
00064   typedef implementation_defined implementation_type;
00065 #else
00066   typedef service_impl_type::implementation_type implementation_type;
00067 #endif
00068 
00070 #if defined(GENERATING_DOCUMENTATION)
00071   typedef implementation_defined native_type;
00072 #else
00073   typedef service_impl_type::native_type native_type;
00074 #endif
00075 
00077   explicit random_access_handle_service(asio::io_service& io_service)
00078     : asio::detail::service_base<
00079         random_access_handle_service>(io_service),
00080       service_impl_(asio::use_service<service_impl_type>(io_service))
00081   {
00082   }
00083 
00085   void shutdown_service()
00086   {
00087   }
00088 
00090   void construct(implementation_type& impl)
00091   {
00092     service_impl_.construct(impl);
00093   }
00094 
00096   void destroy(implementation_type& impl)
00097   {
00098     service_impl_.destroy(impl);
00099   }
00100 
00102   asio::error_code assign(implementation_type& impl,
00103       const native_type& native_handle, asio::error_code& ec)
00104   {
00105     return service_impl_.assign(impl, native_handle, ec);
00106   }
00107 
00109   bool is_open(const implementation_type& impl) const
00110   {
00111     return service_impl_.is_open(impl);
00112   }
00113 
00115   asio::error_code close(implementation_type& impl,
00116       asio::error_code& ec)
00117   {
00118     return service_impl_.close(impl, ec);
00119   }
00120 
00122   native_type native(implementation_type& impl)
00123   {
00124     return service_impl_.native(impl);
00125   }
00126 
00128   asio::error_code cancel(implementation_type& impl,
00129       asio::error_code& ec)
00130   {
00131     return service_impl_.cancel(impl, ec);
00132   }
00133 
00135   template <typename ConstBufferSequence>
00136   std::size_t write_some_at(implementation_type& impl, boost::uint64_t offset,
00137       const ConstBufferSequence& buffers, asio::error_code& ec)
00138   {
00139     return service_impl_.write_some_at(impl, offset, buffers, ec);
00140   }
00141 
00143   template <typename ConstBufferSequence, typename WriteHandler>
00144   void async_write_some_at(implementation_type& impl, boost::uint64_t offset,
00145       const ConstBufferSequence& buffers, WriteHandler handler)
00146   {
00147     service_impl_.async_write_some_at(impl, offset, buffers, handler);
00148   }
00149 
00151   template <typename MutableBufferSequence>
00152   std::size_t read_some_at(implementation_type& impl, boost::uint64_t offset,
00153       const MutableBufferSequence& buffers, asio::error_code& ec)
00154   {
00155     return service_impl_.read_some_at(impl, offset, buffers, ec);
00156   }
00157 
00159   template <typename MutableBufferSequence, typename ReadHandler>
00160   void async_read_some_at(implementation_type& impl, boost::uint64_t offset,
00161       const MutableBufferSequence& buffers, ReadHandler handler)
00162   {
00163     service_impl_.async_read_some_at(impl, offset, buffers, handler);
00164   }
00165 
00166 private:
00167   // The service that provides the platform-specific implementation.
00168   service_impl_type& service_impl_;
00169 };
00170 
00171 } // namespace windows
00172 } // namespace asio
00173 
00174 #endif // defined(ASIO_HAS_WINDOWS_RANDOM_ACCESS_HANDLE)
00175        //   || defined(GENERATING_DOCUMENTATION)
00176 
00177 #include "asio/detail/pop_options.hpp"
00178 
00179 #endif // ASIO_WINDOWS_RANDOM_ACCESS_HANDLE_SERVICE_HPP
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines


Castor
Author(s): Carpe Noctem
autogenerated on Fri Nov 8 2013 11:05:39