12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- #ifndef BOOST_ASIO_IMPL_EXECUTION_CONTEXT_HPP
- #define BOOST_ASIO_IMPL_EXECUTION_CONTEXT_HPP
- #if defined(_MSC_VER) && (_MSC_VER >= 1200)
- # pragma once
- #endif
- #include <boost/asio/detail/handler_type_requirements.hpp>
- #include <boost/asio/detail/scoped_ptr.hpp>
- #include <boost/asio/detail/service_registry.hpp>
- #include <boost/asio/detail/push_options.hpp>
- namespace boost {
- namespace asio {
- #if !defined(GENERATING_DOCUMENTATION)
- template <typename Service>
- inline Service& use_service(execution_context& e)
- {
-
- (void)static_cast<execution_context::service*>(static_cast<Service*>(0));
- return e.service_registry_->template use_service<Service>();
- }
- template <typename Service, typename... Args>
- Service& make_service(execution_context& e, Args&&... args)
- {
- detail::scoped_ptr<Service> svc(
- new Service(e, static_cast<Args&&>(args)...));
- e.service_registry_->template add_service<Service>(svc.get());
- Service& result = *svc;
- svc.release();
- return result;
- }
- template <typename Service>
- inline void add_service(execution_context& e, Service* svc)
- {
-
- (void)static_cast<execution_context::service*>(static_cast<Service*>(0));
- e.service_registry_->template add_service<Service>(svc);
- }
- template <typename Service>
- inline bool has_service(execution_context& e)
- {
-
- (void)static_cast<execution_context::service*>(static_cast<Service*>(0));
- return e.service_registry_->template has_service<Service>();
- }
- #endif
- inline execution_context& execution_context::service::context()
- {
- return owner_;
- }
- }
- }
- #include <boost/asio/detail/pop_options.hpp>
- #endif
|