Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members  

io_handler Class Reference

A handler that receives notifications on events on a file descriptor. More...

Inherited by buffered_handler, io_event_loop::quit_handler, and tcp_server_handler.

List of all members.

Public Methods

void set_loop (io_event_loop &_loop)
 Attaches the handler to an event loop. More...

io_event_loopget_loop ()
 Returns the event loop to which the handler is attached. More...

bool is_owned ()
 Should this handler refrain from deleting itself on connection close? More...

void set_owned (bool o)
 Should this handler refrain from deleting itself on connection close? More...

int get_fd ()
 Returns the file descriptor to which the handler is attached. More...


Protected Methods

 io_handler (int fd=-1)
 Constructor. More...

 io_handler (io_event_loop &loop, int fd=-1, bool owned=false)
 Constructor. More...

virtual ~io_handler ()
 Destructor. More...

void set_fd (int _fd)
 Attaches the handler to a file descriptor. More...

virtual void ravail ()
 Called by the event loop when bytes are available on the file descriptor (if want_read(true) has been called). More...

virtual void wavail ()
 Called by the event loop when bytes may be written on the file descriptor (if want_write(true) has been called). More...

void want_read (bool)
 Invoked by the subclass to signal interest in read availability. More...

void want_write (bool)
 Invoked by the subclass to signal interest in write availability. More...


Friends

class io_event_loop


Detailed Description

A handler that receives notifications on events on a file descriptor.

The subclass may call want_read(bool) to enable/disable read events, and want_write(bool) to enable/disable write events.

Handlers are only active when attached to both an event loop (via the constructor or set_loop) and a file descriptor (via the constructor or set_fd).


Constructor & Destructor Documentation

io_handler::io_handler int    fd = -1 [protected]
 

Constructor.

io_handler::io_handler io_event_loop   loop,
int    fd = -1,
bool    owned = false
[protected]
 

Constructor.

virtual io_handler::~io_handler   [protected, virtual]
 

Destructor.


Member Function Documentation

int io_handler::get_fd  
 

Returns the file descriptor to which the handler is attached.

io_event_loop* io_handler::get_loop  
 

Returns the event loop to which the handler is attached.

bool io_handler::is_owned  
 

Should this handler refrain from deleting itself on connection close?

virtual void io_handler::ravail   [protected, virtual]
 

Called by the event loop when bytes are available on the file descriptor (if want_read(true) has been called).

Reimplemented in buffered_handler.

void io_handler::set_fd int    _fd [protected]
 

Attaches the handler to a file descriptor.

void io_handler::set_loop io_event_loop   _loop
 

Attaches the handler to an event loop.

void io_handler::set_owned bool    o
 

Should this handler refrain from deleting itself on connection close?

void io_handler::want_read bool    [protected]
 

Invoked by the subclass to signal interest in read availability.

void io_handler::want_write bool    [protected]
 

Invoked by the subclass to signal interest in write availability.

virtual void io_handler::wavail   [protected, virtual]
 

Called by the event loop when bytes may be written on the file descriptor (if want_write(true) has been called).

Reimplemented in buffered_handler.


Friends And Related Function Documentation

friend class io_event_loop [friend]
 


The documentation for this class was generated from the following file:
Generated on Fri Sep 20 20:07:30 2002 for NMSTL