service_base.hpp 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. //
  2. // service_base.hpp
  3. // ~~~~~~~~~~~~~~~~
  4. //
  5. // Copyright (c) 2003-2008 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 BOOST_ASIO_DETAIL_SERVICE_BASE_HPP
  11. #define BOOST_ASIO_DETAIL_SERVICE_BASE_HPP
  12. #if defined(_MSC_VER) && (_MSC_VER >= 1200)
  13. # pragma once
  14. #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
  15. #include <boost/asio/detail/push_options.hpp>
  16. #include <boost/asio/io_service.hpp>
  17. #include <boost/asio/detail/service_id.hpp>
  18. namespace boost {
  19. namespace asio {
  20. namespace detail {
  21. // Special service base class to keep classes header-file only.
  22. template <typename Type>
  23. class service_base
  24. : public boost::asio::io_service::service
  25. {
  26. public:
  27. static boost::asio::detail::service_id<Type> id;
  28. // Constructor.
  29. service_base(boost::asio::io_service& io_service)
  30. : boost::asio::io_service::service(io_service)
  31. {
  32. }
  33. };
  34. template <typename Type>
  35. boost::asio::detail::service_id<Type> service_base<Type>::id;
  36. } // namespace detail
  37. } // namespace asio
  38. } // namespace boost
  39. #include <boost/asio/detail/pop_options.hpp>
  40. #endif // BOOST_ASIO_DETAIL_SERVICE_BASE_HPP