11 #ifndef ASIO_BASIC_IO_OBJECT_HPP 12 #define ASIO_BASIC_IO_OBJECT_HPP 14 #if defined(_MSC_VER) && (_MSC_VER >= 1200) 16 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 25 #if defined(ASIO_HAS_MOVE) 29 template <
typename IoObjectService>
30 class service_has_move
33 typedef IoObjectService service_type;
34 typedef typename service_type::implementation_type implementation_type;
36 template <
typename T,
typename U>
37 static auto eval(T* t, U* u) -> decltype(t->move_construct(*u, *u), char());
38 static char (&eval(...))[2];
41 static const bool value =
42 sizeof(service_has_move::eval(
43 static_cast<service_type*>(0),
44 static_cast<implementation_type*>(0))) == 1;
47 #endif // defined(ASIO_HAS_MOVE) 54 #if !defined(ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) 55 template <
typename IoObjectService>
57 template <
typename IoObjectService,
58 bool Movable = detail::service_has_move<IoObjectService>::value>
79 return service.get_io_service();
91 service.construct(implementation);
94 #if defined(GENERATING_DOCUMENTATION) 114 #endif // defined(GENERATING_DOCUMENTATION) 123 service.destroy(implementation);
148 return implementation;
154 return implementation;
166 #if defined(ASIO_HAS_MOVE) 168 template <
typename IoObjectService>
172 typedef IoObjectService service_type;
173 typedef typename service_type::implementation_type implementation_type;
177 return service_->get_io_service();
184 service_->construct(implementation);
188 : service_(&other.get_service())
190 service_->move_construct(implementation, other.implementation);
195 service_->destroy(implementation);
200 service_->move_assign(implementation,
201 *other.service_, other.implementation);
202 service_ = other.service_;
206 service_type& get_service()
211 const service_type& get_service()
const 216 implementation_type& get_implementation()
218 return implementation;
221 const implementation_type& get_implementation()
const 223 return implementation;
226 implementation_type implementation;
232 IoObjectService* service_;
234 #endif // defined(ASIO_HAS_MOVE) 240 #endif // ASIO_BASIC_IO_OBJECT_HPP basic_io_object(asio::io_service &io_service)
Construct a basic_io_object.
Provides core I/O functionality.
service_type & get_service()
Get the service associated with the I/O object.
~basic_io_object()
Protected destructor to prevent deletion through this type.
Base class for all I/O objects.
IoObjectService service_type
The type of the service that will be used to provide I/O operations.
Service & use_service(io_service &ios)
const implementation_type & get_implementation() const
Get the underlying implementation of the I/O object.
implementation_type & get_implementation()
Get the underlying implementation of the I/O object.
service_type::implementation_type implementation_type
The underlying implementation type of I/O object.
implementation_type implementation
asio::io_service & get_io_service()
Get the io_service associated with the object.
const service_type & get_service() const
Get the service associated with the I/O object.