resolver_service.hpp
Go to the documentation of this file.
00001 //
00002 // resolver_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_IP_RESOLVER_SERVICE_HPP
00012 #define ASIO_IP_RESOLVER_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/error.hpp"
00021 #include "asio/io_service.hpp"
00022 #include "asio/detail/resolver_service.hpp"
00023 #include "asio/detail/service_base.hpp"
00024 
00025 namespace asio {
00026 namespace ip {
00027 
00029 template <typename InternetProtocol>
00030 class resolver_service
00031 #if defined(GENERATING_DOCUMENTATION)
00032   : public asio::io_service::service
00033 #else
00034   : public asio::detail::service_base<
00035       resolver_service<InternetProtocol> >
00036 #endif
00037 {
00038 public:
00039 #if defined(GENERATING_DOCUMENTATION)
00040 
00041   static asio::io_service::id id;
00042 #endif
00043 
00045   typedef InternetProtocol protocol_type;
00046 
00048   typedef typename InternetProtocol::endpoint endpoint_type;
00049 
00051   typedef typename InternetProtocol::resolver_query query_type;
00052 
00054   typedef typename InternetProtocol::resolver_iterator iterator_type;
00055 
00056 private:
00057   // The type of the platform-specific implementation.
00058   typedef asio::detail::resolver_service<InternetProtocol>
00059     service_impl_type;
00060 
00061 public:
00063 #if defined(GENERATING_DOCUMENTATION)
00064   typedef implementation_defined implementation_type;
00065 #else
00066   typedef typename service_impl_type::implementation_type implementation_type;
00067 #endif
00068 
00070   explicit resolver_service(asio::io_service& io_service)
00071     : asio::detail::service_base<
00072         resolver_service<InternetProtocol> >(io_service),
00073       service_impl_(asio::use_service<service_impl_type>(io_service))
00074   {
00075   }
00076 
00078   void shutdown_service()
00079   {
00080   }
00081 
00083   void construct(implementation_type& impl)
00084   {
00085     service_impl_.construct(impl);
00086   }
00087 
00089   void destroy(implementation_type& impl)
00090   {
00091     service_impl_.destroy(impl);
00092   }
00093 
00095   void cancel(implementation_type& impl)
00096   {
00097     service_impl_.cancel(impl);
00098   }
00099 
00101   iterator_type resolve(implementation_type& impl, const query_type& query,
00102       asio::error_code& ec)
00103   {
00104     return service_impl_.resolve(impl, query, ec);
00105   }
00106 
00108   template <typename Handler>
00109   void async_resolve(implementation_type& impl, const query_type& query,
00110       Handler handler)
00111   {
00112     service_impl_.async_resolve(impl, query, handler);
00113   }
00114 
00116   iterator_type resolve(implementation_type& impl,
00117       const endpoint_type& endpoint, asio::error_code& ec)
00118   {
00119     return service_impl_.resolve(impl, endpoint, ec);
00120   }
00121 
00123   template <typename ResolveHandler>
00124   void async_resolve(implementation_type& impl, const endpoint_type& endpoint,
00125       ResolveHandler handler)
00126   {
00127     return service_impl_.async_resolve(impl, endpoint, handler);
00128   }
00129 
00130 private:
00131   // The service that provides the platform-specific implementation.
00132   service_impl_type& service_impl_;
00133 };
00134 
00135 } // namespace ip
00136 } // namespace asio
00137 
00138 #include "asio/detail/pop_options.hpp"
00139 
00140 #endif // ASIO_IP_RESOLVER_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