CppCMS
Public Member Functions | Static Public Member Functions | Protected Member Functions
booster::aio::basic_io_device Class Reference

This is a basic object that allows execution of asynchronous operations. More...

#include <booster/booster/aio/basic_io_device.h>

Inheritance diagram for booster::aio::basic_io_device:
booster::noncopyable booster::aio::basic_socket booster::aio::acceptor booster::aio::stream_socket

List of all members.

Public Member Functions

 basic_io_device ()
 basic_io_device (io_service &srv)
virtual ~basic_io_device ()
bool has_io_service ()
io_serviceget_io_service ()
void set_io_service (io_service &srv)
void reset_io_service ()
void attach (native_type fd)
void assign (native_type fd)
native_type release ()
native_type native ()
void close ()
void close (system::error_code &e)
void on_readable (event_handler const &r)
void on_writeable (event_handler const &r)
void cancel ()
basic_io_devicelowest_layer ()
void set_non_blocking (bool nonblocking)
void set_non_blocking (bool nonblocking, system::error_code &e)

Static Public Member Functions

static bool would_block (system::error_code const &e)

Protected Member Functions

bool dont_block (event_handler const &c)
bool dont_block (io_handler const &c)

Detailed Description

This is a basic object that allows execution of asynchronous operations.

It represents a generic "select"able file descriptor or SOCKET on Windows platform.

It does following:


Constructor & Destructor Documentation

Create a new device not attached to event loop

Create a new device that is attached to the event loop srv

Destroy the object. If it owns the file descriptor or socket it closes it


Member Function Documentation

Assign existing file descriptor fd to the device. The ownership is transferred to the object

Attach the file descriptor fd to the device. The ownership is not transferred to the object.

If basic_io_device owns other file descriptor, it is closed.

Cancel all asynchronous operations.

Cancels all pending asynchronous events. If the ownership belongs to it closes the file descriptor.

Throws system::system_error if error occurs.

Cancels all pending asynchronous events. If the ownership belongs to it closes the file descriptor.

If a error occurs it is assigned to e.

Set non-blocking mode. If error occurs returns false and the error is reported via callback c

bool booster::aio::basic_io_device::dont_block ( io_handler const &  c) [protected]

Set non-blocking mode. If error occurs returns false and the error is reported via callback c

Returns the connected io_service, throws system::system_error if no io_service connected

Check if the basic_io_device is connected to the io_service

Returns *this

Get the underlying file descriptor. Returns invalid_socket if the file descriptor was not assigned

Start asynchronous polling for readability. The result is reported via callback r.

If io_service is not assigned throws system::system_error, all other errors reported via r.

Start asynchronous polling for writeability. The result is reported via callback r.

If io_service is not assigned throws system::system_error, all other errors reported via r.

Release the ownership on the current file descriptor. The user is responsible to close it.

Note:
it just changes the "ownership" flag in the object, nothing else is done

Detaches the object from io_service. Cancels all pending asynchronous operations.

Sets new io_service. Cancels all pending asynchronous operations on the connected io_service.

Set the object to blocking or non-blocking mode.

Throws system::system_error if error occurs.

Set the object to blocking or non-blocking mode.

If a error occurs it is assigned to e.

Check if a error code e reports that the non-blocking operation would block


The documentation for this class was generated from the following file: