Provides POSIX descriptor functionality. More...
#include <basic_descriptor.hpp>
Public Types | |
typedef basic_descriptor < DescriptorService > | lowest_layer_type |
A basic_descriptor is always the lowest layer. | |
typedef DescriptorService::native_type | native_type |
The native representation of a descriptor. | |
Public Member Functions | |
void | assign (const native_type &native_descriptor) |
Assign an existing native descriptor to the descriptor. | |
asio::error_code | assign (const native_type &native_descriptor, asio::error_code &ec) |
Assign an existing native descriptor to the descriptor. | |
basic_descriptor (asio::io_service &io_service) | |
Construct a basic_descriptor without opening it. | |
basic_descriptor (asio::io_service &io_service, const native_type &native_descriptor) | |
Construct a basic_descriptor on an existing native descriptor. | |
void | cancel () |
Cancel all asynchronous operations associated with the descriptor. | |
asio::error_code | cancel (asio::error_code &ec) |
Cancel all asynchronous operations associated with the descriptor. | |
void | close () |
Close the descriptor. | |
asio::error_code | close (asio::error_code &ec) |
Close the descriptor. | |
template<typename IoControlCommand > | |
void | io_control (IoControlCommand &command) |
Perform an IO control command on the descriptor. | |
template<typename IoControlCommand > | |
asio::error_code | io_control (IoControlCommand &command, asio::error_code &ec) |
Perform an IO control command on the descriptor. | |
bool | is_open () const |
Determine whether the descriptor is open. | |
lowest_layer_type & | lowest_layer () |
Get a reference to the lowest layer. | |
native_type | native () |
Get the native descriptor representation. | |
Protected Member Functions | |
~basic_descriptor () | |
Protected destructor to prevent deletion through this type. |
Provides POSIX descriptor functionality.
The posix::basic_descriptor class template provides the ability to wrap a POSIX descriptor.
Definition at line 42 of file basic_descriptor.hpp.
typedef basic_descriptor<DescriptorService> asio::posix::basic_descriptor< DescriptorService >::lowest_layer_type |
A basic_descriptor is always the lowest layer.
Definition at line 51 of file basic_descriptor.hpp.
typedef DescriptorService::native_type asio::posix::basic_descriptor< DescriptorService >::native_type |
The native representation of a descriptor.
Definition at line 48 of file basic_descriptor.hpp.
asio::posix::basic_descriptor< DescriptorService >::basic_descriptor | ( | asio::io_service & | io_service | ) | [inline, explicit] |
Construct a basic_descriptor without opening it.
This constructor creates a descriptor without opening it.
io_service | The io_service object that the descriptor will use to dispatch handlers for any asynchronous operations performed on the descriptor. |
Definition at line 61 of file basic_descriptor.hpp.
asio::posix::basic_descriptor< DescriptorService >::basic_descriptor | ( | asio::io_service & | io_service, |
const native_type & | native_descriptor | ||
) | [inline] |
Construct a basic_descriptor on an existing native descriptor.
This constructor creates a descriptor object to hold an existing native descriptor.
io_service | The io_service object that the descriptor will use to dispatch handlers for any asynchronous operations performed on the descriptor. |
native_descriptor | A native descriptor. |
asio::system_error | Thrown on failure. |
Definition at line 79 of file basic_descriptor.hpp.
asio::posix::basic_descriptor< DescriptorService >::~basic_descriptor | ( | ) | [inline, protected] |
Protected destructor to prevent deletion through this type.
Definition at line 270 of file basic_descriptor.hpp.
void asio::posix::basic_descriptor< DescriptorService >::assign | ( | const native_type & | native_descriptor | ) | [inline] |
Assign an existing native descriptor to the descriptor.
Definition at line 110 of file basic_descriptor.hpp.
asio::error_code asio::posix::basic_descriptor< DescriptorService >::assign | ( | const native_type & | native_descriptor, |
asio::error_code & | ec | ||
) | [inline] |
Assign an existing native descriptor to the descriptor.
Definition at line 125 of file basic_descriptor.hpp.
void asio::posix::basic_descriptor< DescriptorService >::cancel | ( | ) | [inline] |
Cancel all asynchronous operations associated with the descriptor.
This function causes all outstanding asynchronous read or write operations to finish immediately, and the handlers for cancelled operations will be passed the asio::error::operation_aborted error.
asio::system_error | Thrown on failure. |
Definition at line 184 of file basic_descriptor.hpp.
asio::error_code asio::posix::basic_descriptor< DescriptorService >::cancel | ( | asio::error_code & | ec | ) | [inline] |
Cancel all asynchronous operations associated with the descriptor.
This function causes all outstanding asynchronous read or write operations to finish immediately, and the handlers for cancelled operations will be passed the asio::error::operation_aborted error.
ec | Set to indicate what error occurred, if any. |
Definition at line 199 of file basic_descriptor.hpp.
void asio::posix::basic_descriptor< DescriptorService >::close | ( | ) | [inline] |
Close the descriptor.
This function is used to close the descriptor. Any asynchronous read or write operations will be cancelled immediately, and will complete with the asio::error::operation_aborted error.
asio::system_error | Thrown on failure. |
Definition at line 145 of file basic_descriptor.hpp.
asio::error_code asio::posix::basic_descriptor< DescriptorService >::close | ( | asio::error_code & | ec | ) | [inline] |
Close the descriptor.
This function is used to close the descriptor. Any asynchronous read or write operations will be cancelled immediately, and will complete with the asio::error::operation_aborted error.
ec | Set to indicate what error occurred, if any. |
Definition at line 160 of file basic_descriptor.hpp.
void asio::posix::basic_descriptor< DescriptorService >::io_control | ( | IoControlCommand & | command | ) | [inline] |
Perform an IO control command on the descriptor.
This function is used to execute an IO control command on the descriptor.
command | The IO control command to be performed on the descriptor. |
asio::system_error | Thrown on failure. |
asio::posix::stream_descriptor descriptor(io_service); ... asio::posix::stream_descriptor::bytes_readable command; descriptor.io_control(command); std::size_t bytes_readable = command.get();
Definition at line 227 of file basic_descriptor.hpp.
asio::error_code asio::posix::basic_descriptor< DescriptorService >::io_control | ( | IoControlCommand & | command, |
asio::error_code & | ec | ||
) | [inline] |
Perform an IO control command on the descriptor.
This function is used to execute an IO control command on the descriptor.
command | The IO control command to be performed on the descriptor. |
ec | Set to indicate what error occurred, if any. |
asio::posix::stream_descriptor descriptor(io_service); ... asio::posix::stream_descriptor::bytes_readable command; asio::error_code ec; descriptor.io_control(command, ec); if (ec) { // An error occurred. } std::size_t bytes_readable = command.get();
Definition at line 262 of file basic_descriptor.hpp.
bool asio::posix::basic_descriptor< DescriptorService >::is_open | ( | ) | const [inline] |
Determine whether the descriptor is open.
Definition at line 132 of file basic_descriptor.hpp.
lowest_layer_type& asio::posix::basic_descriptor< DescriptorService >::lowest_layer | ( | ) | [inline] |
Get a reference to the lowest layer.
This function returns a reference to the lowest layer in a stack of layers. Since a basic_descriptor cannot contain any further layers, it simply returns a reference to itself.
Definition at line 97 of file basic_descriptor.hpp.
native_type asio::posix::basic_descriptor< DescriptorService >::native | ( | ) | [inline] |
Get the native descriptor representation.
This function may be used to obtain the underlying representation of the descriptor. This is intended to allow access to native descriptor functionality that is not otherwise provided.
Definition at line 171 of file basic_descriptor.hpp.