ACE_Asynch_Operation Class Reference

This is an interface base class for all asynch operations. The resposiblility of this class is to forward all methods to its delegation/implementation class, e.g., ACE_WIN32_Asynch_Operation or ACE_POSIX_Asynch_Operation. More...

#include <Asynch_IO.h>

Inheritance diagram for ACE_Asynch_Operation:

Inheritance graph
[legend]
List of all members.

Public Member Functions

int open (ACE_Handler &handler, ACE_HANDLE handle, const void *completion_key, ACE_Proactor *proactor)
int cancel (void)
ACE_Proactorproactor (void) const
 Return the underlying proactor.

virtual ~ACE_Asynch_Operation (void)
 Destructor.


Protected Member Functions

 ACE_Asynch_Operation (void)
 Constructor.

virtual ACE_Asynch_Operation_Implimplementation (void) const=0
 Return the underlying implementation class.

ACE_Proactorget_proactor (ACE_Proactor *user_proactor, ACE_Handler &handler) const
 Get a proactor for/from the user.


Detailed Description

This is an interface base class for all asynch operations. The resposiblility of this class is to forward all methods to its delegation/implementation class, e.g., ACE_WIN32_Asynch_Operation or ACE_POSIX_Asynch_Operation.

There are some attributes and functionality which is common to all asychronous operations. The delegation classes of this class will factor out this code.

Definition at line 202 of file Asynch_IO.h.


Constructor & Destructor Documentation

ACE_Asynch_Operation::~ACE_Asynch_Operation void   )  [virtual]
 

Destructor.

Definition at line 123 of file Asynch_IO.cpp.

00124 {
00125 }

ACE_Asynch_Operation::ACE_Asynch_Operation void   )  [protected]
 

Constructor.

Definition at line 119 of file Asynch_IO.cpp.

00120 {
00121 }


Member Function Documentation

int ACE_Asynch_Operation::cancel void   ) 
 

(Attempts to) cancel the asynchronous operation pending against the {handle} registered with this Operation.

All completion notifications for the I/O operations will occur normally.

= Return Values:

-1 : Operation failed. (can get only in POSIX). 0 : All the operations were cancelled. 1 : All the operations were already finished in this handle. Unable to cancel them. 2 : Atleast one of the requested operations cannot be cancelled.

There is slight difference in the semantics between NT and POSIX platforms which is given below.

= Win32 :

cancels all pending accepts operations that were issued by the calling thread. The function does not cancel asynchronous operations issued by other threads. All I/O operations that are canceled will complete with the error ERROR_OPERATION_ABORTED.

= POSIX:

Attempts to cancel one or more asynchronous I/O requests currently outstanding against the {handle} registered in this operation. For requested operations that are successfully canceled, the associated error status is set to ECANCELED.

Definition at line 108 of file Asynch_IO.cpp.

References ACE_Asynch_Operation_Impl::cancel(), and implementation().

Referenced by ACE_Asynch_Connector< HANDLER >::cancel(), and ACE_Asynch_Acceptor< HANDLER >::cancel().

00109 {
00110   return this->implementation ()->cancel ();
00111 }

ACE_Proactor * ACE_Asynch_Operation::get_proactor ACE_Proactor user_proactor,
ACE_Handler handler
const [protected]
 

Get a proactor for/from the user.

Definition at line 128 of file Asynch_IO.cpp.

References ACE_Proactor::instance(), and ACE_Handler::proactor().

Referenced by ACE_Asynch_Write_Dgram::open(), ACE_Asynch_Read_Dgram::open(), ACE_Asynch_Transmit_File::open(), ACE_Asynch_Connect::open(), ACE_Asynch_Accept::open(), ACE_Asynch_Write_File::open(), ACE_Asynch_Read_File::open(), ACE_Asynch_Write_Stream::open(), and ACE_Asynch_Read_Stream::open().

00130 {
00131   if (user_proactor == 0)
00132     {
00133       // Grab the singleton proactor if <handler->proactor> is zero
00134       user_proactor = handler.proactor ();
00135       if (user_proactor == 0)
00136         user_proactor = ACE_Proactor::instance ();
00137     }
00138 
00139   return user_proactor;
00140 }

virtual ACE_Asynch_Operation_Impl* ACE_Asynch_Operation::implementation void   )  const [protected, pure virtual]
 

Return the underlying implementation class.

Implemented in ACE_Asynch_Read_Stream, ACE_Asynch_Write_Stream, ACE_Asynch_Read_File, ACE_Asynch_Write_File, ACE_Asynch_Accept, ACE_Asynch_Connect, ACE_Asynch_Transmit_File, ACE_Asynch_Read_Dgram, and ACE_Asynch_Write_Dgram.

Referenced by cancel(), open(), and proactor().

int ACE_Asynch_Operation::open ACE_Handler handler,
ACE_HANDLE  handle,
const void *  completion_key,
ACE_Proactor proactor
 

Initializes the factory with information which will be used with each asynchronous call. If ({handle} == ACE_INVALID_HANDLE), {ACE_Handler::handle} will be called on the {handler} to get the correct handle.

Reimplemented in ACE_Asynch_Read_Stream, ACE_Asynch_Write_Stream, ACE_Asynch_Read_File, ACE_Asynch_Write_File, ACE_Asynch_Accept, ACE_Asynch_Connect, ACE_Asynch_Transmit_File, ACE_Asynch_Read_Dgram, and ACE_Asynch_Write_Dgram.

Definition at line 96 of file Asynch_IO.cpp.

References implementation(), ACE_Asynch_Operation_Impl::open(), and ACE_Handler::proxy().

Referenced by ACE_Asynch_Write_Dgram::open(), ACE_Asynch_Read_Dgram::open(), ACE_Asynch_Transmit_File::open(), ACE_Asynch_Connect::open(), ACE_Asynch_Accept::open(), ACE_Asynch_Write_File::open(), ACE_Asynch_Read_File::open(), ACE_Asynch_Write_Stream::open(), and ACE_Asynch_Read_Stream::open().

00100 {
00101   return this->implementation ()->open (handler.proxy (),
00102                                         handle,
00103                                         completion_key,
00104                                         proactor);
00105 }

ACE_Proactor * ACE_Asynch_Operation::proactor void   )  const
 

Return the underlying proactor.

Definition at line 114 of file Asynch_IO.cpp.

References implementation(), and ACE_Asynch_Operation_Impl::proactor().

00115 {
00116   return this->implementation ()->proactor ();
00117 }


The documentation for this class was generated from the following files:
Generated on Thu Nov 9 11:19:30 2006 for ACE by doxygen 1.3.6