11 #ifndef ASIO_DETAIL_IMPL_SERVICE_REGISTRY_HPP 12 #define ASIO_DETAIL_IMPL_SERVICE_REGISTRY_HPP 14 #if defined(_MSC_VER) && (_MSC_VER >= 1200) 16 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 23 template <
typename Service,
typename Arg>
27 first_service_(new Service(o, arg))
29 asio::io_service::service::key key;
30 init_key(key, Service::id);
31 first_service_->key_ = key;
32 first_service_->next_ = 0;
35 template <
typename Service>
38 return *
static_cast<Service*
>(first_service_);
41 template <
typename Service>
44 asio::io_service::service::key key;
45 init_key(key, Service::id);
46 factory_type factory = &service_registry::create<Service>;
47 return *
static_cast<Service*
>(do_use_service(key, factory));
50 template <
typename Service>
53 asio::io_service::service::key key;
54 init_key(key, Service::id);
55 return do_add_service(key, new_service);
58 template <
typename Service>
61 asio::io_service::service::key key;
62 init_key(key, Service::id);
63 return do_has_service(key);
66 #if !defined(ASIO_NO_TYPEID) 67 template <
typename Service>
68 void service_registry::init_key(asio::io_service::service::key& key,
74 #endif // !defined(ASIO_NO_TYPEID) 76 template <
typename Service>
80 return new Service(owner);
88 #endif // ASIO_DETAIL_IMPL_SERVICE_REGISTRY_HPP service_registry(asio::io_service &o, Service *initial_service, Arg arg)
Provides core I/O functionality.
void add_service(Service *new_service)
Service & first_service()
Base class for all io_service services.