ACE_POSIX_Asynch_Result Class Reference

#include <POSIX_Asynch_IO.h>

Inheritance diagram for ACE_POSIX_Asynch_Result:

Inheritance graph
[legend]
Collaboration diagram for ACE_POSIX_Asynch_Result:

Collaboration graph
[legend]
List of all members.

Public Member Functions

size_t bytes_transferred (void) const
 Number of bytes transferred by the operation.

const void * act (void) const
 ACT associated with the operation.

int success (void) const
 Did the operation succeed?

const void * completion_key (void) const
u_long error (void) const
 Error value if the operation fail.

ACE_HANDLE event (void) const
 This returns ACE_INVALID_HANDLE on POSIX4 platforms.

u_long offset (void) const
u_long offset_high (void) const
int priority (void) const
 Priority of the operation.

int signal_number (void) const
int post_completion (ACE_Proactor_Impl *proactor)
 Post to the Proactor.

virtual ~ACE_POSIX_Asynch_Result (void)
 Destructor.

void set_error (u_long errcode)
 Simulate error value to use in the post_completion ().

void set_bytes_transferred (size_t nbytes)
 Simulate value to use in the post_completion ().


Protected Member Functions

 ACE_POSIX_Asynch_Result (const ACE_Handler::Proxy_Ptr &handler_proxy, const void *act, ACE_HANDLE event, u_long offset, u_long offset_high, int priority, int signal_number)
 Constructor. is not used on POSIX.


Protected Attributes

ACE_Handler::Proxy_Ptr handler_proxy_
 Handler that will be called back.

const void * act_
size_t bytes_transferred_
 Bytes transferred by this operation.

int success_
 Success indicator.

const void * completion_key_
 ACT associated with handle.

u_long error_
 Error if operation failed.


Detailed Description

This class provides concrete implementation for ACE_Asynch_Result for POSIX4 platforms. This class extends aiocb and makes it more useful.

Definition at line 57 of file POSIX_Asynch_IO.h.


Constructor & Destructor Documentation

ACE_POSIX_Asynch_Result::~ACE_POSIX_Asynch_Result void   )  [virtual]
 

Destructor.

Definition at line 111 of file POSIX_Asynch_IO.cpp.

00112 {
00113 }

ACE_POSIX_Asynch_Result::ACE_POSIX_Asynch_Result const ACE_Handler::Proxy_Ptr handler_proxy,
const void *  act,
ACE_HANDLE  event,
u_long  offset,
u_long  offset_high,
int  priority,
int  signal_number
[protected]
 

Constructor. is not used on POSIX.

Definition at line 116 of file POSIX_Asynch_IO.cpp.

References ACE_Handler::Proxy_Ptr.

00123   : handler_proxy_ (handler_proxy),
00124     act_ (act),
00125     bytes_transferred_ (0),
00126     success_ (0),
00127     completion_key_ (0),
00128     error_ (0)
00129 {
00130   aio_offset = offset;
00131   aio_reqprio = priority;
00132   aio_sigevent.sigev_signo = signal_number;
00133 
00134   //
00135   // @@ Support offset_high with aiocb64.
00136   //
00137   ACE_UNUSED_ARG (offset_high);
00138 
00139   // Other fields in the <aiocb> will be initialized by the
00140   // subclasses.
00141 }


Member Function Documentation

const void * ACE_POSIX_Asynch_Result::act void   )  const [virtual]
 

ACT associated with the operation.

Implements ACE_Asynch_Result_Impl.

Definition at line 37 of file POSIX_Asynch_IO.cpp.

References act_.

00038 {
00039   return this->act_;
00040 }

ACE_BEGIN_VERSIONED_NAMESPACE_DECL size_t ACE_POSIX_Asynch_Result::bytes_transferred void   )  const [virtual]
 

Number of bytes transferred by the operation.

Implements ACE_Asynch_Result_Impl.

Definition at line 25 of file POSIX_Asynch_IO.cpp.

Referenced by ACE_POSIX_AIOCB_Proactor::process_result_queue().

00026 {
00027   return this->bytes_transferred_;
00028 }

const void * ACE_POSIX_Asynch_Result::completion_key void   )  const [virtual]
 

This is the ACT associated with the handle on which the Asynch_Operation takes place.

@ This is not implemented for POSIX4 platforms.

Implements ACE_Asynch_Result_Impl.

Definition at line 49 of file POSIX_Asynch_IO.cpp.

References completion_key_.

00050 {
00051   return this->completion_key_;
00052 }

u_long ACE_POSIX_Asynch_Result::error void   )  const [virtual]
 

Error value if the operation fail.

Implements ACE_Asynch_Result_Impl.

Definition at line 55 of file POSIX_Asynch_IO.cpp.

00056 {
00057   return this->error_;
00058 }

ACE_HANDLE ACE_POSIX_Asynch_Result::event void   )  const [virtual]
 

This returns ACE_INVALID_HANDLE on POSIX4 platforms.

Implements ACE_Asynch_Result_Impl.

Definition at line 66 of file POSIX_Asynch_IO.cpp.

00067 {
00068   return ACE_INVALID_HANDLE;
00069 }

u_long ACE_POSIX_Asynch_Result::offset void   )  const [virtual]
 

This really make sense only when doing file I/O.

@ On POSIX4-Unix, offset_high should be supported using aiocb64.

Implements ACE_Asynch_Result_Impl.

Definition at line 72 of file POSIX_Asynch_IO.cpp.

00073 {
00074   return this->aio_offset;
00075 }

u_long ACE_POSIX_Asynch_Result::offset_high void   )  const [virtual]
 

Implements ACE_Asynch_Result_Impl.

Definition at line 78 of file POSIX_Asynch_IO.cpp.

References ACE_NOTSUP_RETURN.

00079 {
00080   //
00081   // @@ Support aiocb64??
00082   //
00083   ACE_NOTSUP_RETURN (0);
00084 }

int ACE_POSIX_Asynch_Result::post_completion ACE_Proactor_Impl proactor  )  [virtual]
 

Post to the Proactor.

Implements ACE_Asynch_Result_Impl.

Definition at line 99 of file POSIX_Asynch_IO.cpp.

References ACE_ERROR_RETURN, LM_ERROR, and ACE_POSIX_Proactor::post_completion().

00100 {
00101   // Get to the platform specific implementation.
00102   ACE_POSIX_Proactor *posix_proactor = dynamic_cast<ACE_POSIX_Proactor *> (proactor_impl);
00103 
00104   if (posix_proactor == 0)
00105     ACE_ERROR_RETURN ((LM_ERROR, "Dynamic cast to POSIX Proactor failed\n"), -1);
00106 
00107   // Post myself.
00108   return posix_proactor->post_completion (this);
00109 }

int ACE_POSIX_Asynch_Result::priority void   )  const [virtual]
 

Priority of the operation.

Implements ACE_Asynch_Result_Impl.

Definition at line 87 of file POSIX_Asynch_IO.cpp.

Referenced by ACE_POSIX_Asynch_Transmit_Handler::handle_read_file(), ACE_POSIX_Asynch_Transmit_Handler::handle_write_stream(), and ACE_POSIX_Asynch_Transmit_Handler::initiate_read_file().

00088 {
00089   return this->aio_reqprio;
00090 }

void ACE_POSIX_Asynch_Result::set_bytes_transferred size_t  nbytes  ) 
 

Simulate value to use in the post_completion ().

Definition at line 31 of file POSIX_Asynch_IO.cpp.

Referenced by ACE_POSIX_AIOCB_Proactor::cancel_aio(), ACE_POSIX_Asynch_Connect::cancel_uncompleted(), ACE_POSIX_Asynch_Accept::cancel_uncompleted(), ACE_POSIX_Asynch_Connect::connect_i(), ACE_POSIX_Asynch_Connect::handle_close(), ACE_POSIX_Asynch_Connect::handle_output(), and ACE_POSIX_AIOCB_Proactor::start_deferred_aio().

00032 {
00033   this->bytes_transferred_= nbytes;
00034 }

void ACE_POSIX_Asynch_Result::set_error u_long  errcode  ) 
 

Simulate error value to use in the post_completion ().

Definition at line 61 of file POSIX_Asynch_IO.cpp.

Referenced by ACE_POSIX_AIOCB_Proactor::cancel_aio(), ACE_POSIX_Asynch_Connect::cancel_uncompleted(), ACE_POSIX_Asynch_Accept::cancel_uncompleted(), ACE_POSIX_Asynch_Connect::connect(), ACE_POSIX_Asynch_Connect::connect_i(), ACE_POSIX_Asynch_Connect::handle_close(), ACE_POSIX_Asynch_Accept::handle_input(), ACE_POSIX_Asynch_Connect::handle_output(), and ACE_POSIX_AIOCB_Proactor::start_deferred_aio().

00062 {
00063   this->error_=errcode;
00064 }

int ACE_POSIX_Asynch_Result::signal_number void   )  const [virtual]
 

POSIX4 realtime signal number to be used for the operation. ranges from SIGRTMIN to SIGRTMAX. By default, SIGRTMIN is used to issue calls.

Implements ACE_Asynch_Result_Impl.

Definition at line 93 of file POSIX_Asynch_IO.cpp.

Referenced by ACE_POSIX_Asynch_Transmit_Handler::handle_read_file(), ACE_POSIX_Asynch_Transmit_Handler::handle_write_stream(), ACE_POSIX_Asynch_Transmit_Handler::initiate_read_file(), and ACE_POSIX_AIOCB_Proactor::putq_result().

00094 {
00095   return this->aio_sigevent.sigev_signo;
00096 }

int ACE_POSIX_Asynch_Result::success void   )  const [virtual]
 

Did the operation succeed?

Implements ACE_Asynch_Result_Impl.

Definition at line 43 of file POSIX_Asynch_IO.cpp.

References success_.

00044 {
00045   return this->success_;
00046 }


Member Data Documentation

const void* ACE_POSIX_Asynch_Result::act_ [protected]
 

ACT for this operation. We could use <aiocb::aio_sigevent.sigev_value.sival_ptr> for this. But it doesnot provide the constness, so this may be better.

Definition at line 136 of file POSIX_Asynch_IO.h.

Referenced by act().

size_t ACE_POSIX_Asynch_Result::bytes_transferred_ [protected]
 

Bytes transferred by this operation.

Definition at line 139 of file POSIX_Asynch_IO.h.

const void* ACE_POSIX_Asynch_Result::completion_key_ [protected]
 

ACT associated with handle.

Definition at line 145 of file POSIX_Asynch_IO.h.

Referenced by completion_key().

u_long ACE_POSIX_Asynch_Result::error_ [protected]
 

Error if operation failed.

Definition at line 148 of file POSIX_Asynch_IO.h.

ACE_Handler::Proxy_Ptr ACE_POSIX_Asynch_Result::handler_proxy_ [protected]
 

Handler that will be called back.

Definition at line 128 of file POSIX_Asynch_IO.h.

int ACE_POSIX_Asynch_Result::success_ [protected]
 

Success indicator.

Definition at line 142 of file POSIX_Asynch_IO.h.

Referenced by success().


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