ACE_WIN32_Asynch_Read_File_Result Class Reference

This class provides concrete implementation for ACE_Asynch_Read_File::Result class. More...

#include <WIN32_Asynch_IO.h>

Inheritance diagram for ACE_WIN32_Asynch_Read_File_Result:

Inheritance graph
[legend]
Collaboration diagram for ACE_WIN32_Asynch_Read_File_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
 Event associated with the OVERLAPPED structure.

u_long offset (void) const
 This really make sense only when doing file I/O.

u_long offset_high (void) const
 Offset_high associated with the OVERLAPPED structure.

int priority (void) const
int signal_number (void) const
 No-op. Returns 0.

size_t bytes_to_read (void) const
ACE_Message_Blockmessage_block (void) const
 Message block which contains the read data.

ACE_HANDLE handle (void) const
 I/O handle used for reading.

int post_completion (ACE_Proactor_Impl *proactor)
 Post to the Proactor's completion port.


Protected Member Functions

 ACE_WIN32_Asynch_Read_File_Result (const ACE_Handler::Proxy_Ptr &handler_proxy, ACE_HANDLE handle, ACE_Message_Block &message_block, size_t bytes_to_read, const void *act, u_long offset, u_long offset_high, ACE_HANDLE event, int priority, int signal_number=0, int scatter_enabled=0)
virtual void complete (size_t bytes_transferred, int success, const void *completion_key, u_long error)
 ACE_Proactor will call this method when the read completes.

virtual ~ACE_WIN32_Asynch_Read_File_Result (void)
 Destructor.


Friends

class ACE_WIN32_Asynch_Read_File
 Factory class will have special permissions.

class ACE_WIN32_Proactor
 Proactor class has special permission.


Detailed Description

This class provides concrete implementation for ACE_Asynch_Read_File::Result class.

Definition at line 563 of file WIN32_Asynch_IO.h.


Constructor & Destructor Documentation

ACE_WIN32_Asynch_Read_File_Result::ACE_WIN32_Asynch_Read_File_Result const ACE_Handler::Proxy_Ptr handler_proxy,
ACE_HANDLE  handle,
ACE_Message_Block message_block,
size_t  bytes_to_read,
const void *  act,
u_long  offset,
u_long  offset_high,
ACE_HANDLE  event,
int  priority,
int  signal_number = 0,
int  scatter_enabled = 0
[protected]
 

Constructor is protected since creation is limited to ACE_Asynch_Read_File factory.

Definition at line 1066 of file WIN32_Asynch_IO.cpp.

References ACE_Handler::Proxy_Ptr.

01078   : ACE_Asynch_Result_Impl (),
01079     ACE_Asynch_Read_Stream_Result_Impl (),
01080     ACE_Asynch_Read_File_Result_Impl (),
01081     ACE_WIN32_Asynch_Read_Stream_Result (handler_proxy,
01082                                          handle,
01083                                          message_block,
01084                                          bytes_to_read,
01085                                          act,
01086                                          event,
01087                                          priority,
01088                                          signal_number,
01089                                          scatter_enabled)
01090 {
01091   this->Offset = offset;
01092   this->OffsetHigh = offset_high;
01093 }

ACE_WIN32_Asynch_Read_File_Result::~ACE_WIN32_Asynch_Read_File_Result void   )  [protected, virtual]
 

Destructor.

Definition at line 1142 of file WIN32_Asynch_IO.cpp.

01143 {
01144 }


Member Function Documentation

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

ACT associated with the operation.

Reimplemented from ACE_WIN32_Asynch_Read_Stream_Result.

Definition at line 1156 of file WIN32_Asynch_IO.cpp.

References ACE_WIN32_Asynch_Result::act().

01157 {
01158   return ACE_WIN32_Asynch_Result::act ();
01159 }

size_t ACE_WIN32_Asynch_Read_File_Result::bytes_to_read void   )  const [virtual]
 

The number of bytes which were requested at the start of the asynchronous read.

Reimplemented from ACE_WIN32_Asynch_Read_Stream_Result.

Definition at line 1215 of file WIN32_Asynch_IO.cpp.

References ACE_WIN32_Asynch_Read_Stream_Result::bytes_to_read().

01216 {
01217   return ACE_WIN32_Asynch_Read_Stream_Result::bytes_to_read ();
01218 }

size_t ACE_WIN32_Asynch_Read_File_Result::bytes_transferred void   )  const [virtual]
 

Number of bytes transferred by the operation.

Reimplemented from ACE_WIN32_Asynch_Read_Stream_Result.

Definition at line 1150 of file WIN32_Asynch_IO.cpp.

References ACE_WIN32_Asynch_Result::bytes_transferred().

01151 {
01152   return ACE_WIN32_Asynch_Result::bytes_transferred ();
01153 }

void ACE_WIN32_Asynch_Read_File_Result::complete size_t  bytes_transferred,
int  success,
const void *  completion_key,
u_long  error
[protected, virtual]
 

ACE_Proactor will call this method when the read completes.

Reimplemented from ACE_WIN32_Asynch_Read_Stream_Result.

Definition at line 1096 of file WIN32_Asynch_IO.cpp.

References ACE_Message_Block::cont(), ACE_Refcounted_Auto_Ptr< X, ACE_LOCK >::get(), ACE_OS::getpagesize(), ACE_Handler::handle_read_file(), ACE_WIN32_Asynch_Read_Stream_Result::scatter_enabled(), and ACE_Message_Block::wr_ptr().

01100 {
01101   // Copy the data which was returned by GetQueuedCompletionStatus.
01102   this->bytes_transferred_ = bytes_transferred;
01103   this->success_ = success;
01104   this->completion_key_ = completion_key;
01105   this->error_ = error;
01106 
01107   // Appropriately move the pointers in the message block.
01108   if (!this->scatter_enabled ())
01109     this->message_block_.wr_ptr (bytes_transferred);
01110   else
01111   {
01112     static const size_t page_size = ACE_OS::getpagesize();
01113 
01114     for (ACE_Message_Block* mb = &this->message_block_;
01115          (mb != 0) && (bytes_transferred > 0);
01116          mb = mb->cont ())
01117     {
01118       // mb->space () is ought to be >= page_size.
01119       // this is verified in the readv method
01120       // ACE_ASSERT (mb->space () >= page_size);
01121 
01122       size_t len_part = page_size ;
01123 
01124       if ( len_part > bytes_transferred)
01125         len_part = bytes_transferred;
01126 
01127       mb->wr_ptr (len_part);
01128 
01129       bytes_transferred -= len_part;
01130     }
01131   }
01132 
01133   // Create the interface result class.
01134   ACE_Asynch_Read_File::Result result (this);
01135 
01136   // Call the application handler.
01137   ACE_Handler *handler = this->handler_proxy_.get ()->handler ();
01138   if (handler != 0)
01139     handler->handle_read_file (result);
01140 }

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

This returns the ACT associated with the handle when it was registered with the I/O completion port. This ACT is not the same as the ACT associated with the asynchronous operation.

Reimplemented from ACE_WIN32_Asynch_Read_Stream_Result.

Definition at line 1168 of file WIN32_Asynch_IO.cpp.

References ACE_WIN32_Asynch_Result::completion_key().

01169 {
01170   return ACE_WIN32_Asynch_Result::completion_key ();
01171 }

u_long ACE_WIN32_Asynch_Read_File_Result::error void   )  const [virtual]
 

Error value if the operation fail.

Reimplemented from ACE_WIN32_Asynch_Read_Stream_Result.

Definition at line 1174 of file WIN32_Asynch_IO.cpp.

References ACE_WIN32_Asynch_Result::error().

01175 {
01176   return ACE_WIN32_Asynch_Result::error ();
01177 }

ACE_HANDLE ACE_WIN32_Asynch_Read_File_Result::event void   )  const [virtual]
 

Event associated with the OVERLAPPED structure.

Reimplemented from ACE_WIN32_Asynch_Read_Stream_Result.

Definition at line 1180 of file WIN32_Asynch_IO.cpp.

References ACE_WIN32_Asynch_Result::event().

01181 {
01182   return ACE_WIN32_Asynch_Result::event ();
01183 }

ACE_HANDLE ACE_WIN32_Asynch_Read_File_Result::handle void   )  const [virtual]
 

I/O handle used for reading.

Reimplemented from ACE_WIN32_Asynch_Read_Stream_Result.

Definition at line 1227 of file WIN32_Asynch_IO.cpp.

References ACE_WIN32_Asynch_Read_Stream_Result::handle().

Referenced by ACE_WIN32_Asynch_Read_File::readv().

01228 {
01229   return ACE_WIN32_Asynch_Read_Stream_Result::handle ();
01230 }

ACE_Message_Block & ACE_WIN32_Asynch_Read_File_Result::message_block void   )  const [virtual]
 

Message block which contains the read data.

Reimplemented from ACE_WIN32_Asynch_Read_Stream_Result.

Definition at line 1221 of file WIN32_Asynch_IO.cpp.

References ACE_WIN32_Asynch_Read_Stream_Result::message_block().

01222 {
01223   return ACE_WIN32_Asynch_Read_Stream_Result::message_block ();
01224 }

u_long ACE_WIN32_Asynch_Read_File_Result::offset void   )  const [virtual]
 

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

Reimplemented from ACE_WIN32_Asynch_Read_Stream_Result.

Definition at line 1186 of file WIN32_Asynch_IO.cpp.

References ACE_WIN32_Asynch_Result::offset().

01187 {
01188   return ACE_WIN32_Asynch_Result::offset ();
01189 }

u_long ACE_WIN32_Asynch_Read_File_Result::offset_high void   )  const [virtual]
 

Offset_high associated with the OVERLAPPED structure.

Reimplemented from ACE_WIN32_Asynch_Read_Stream_Result.

Definition at line 1192 of file WIN32_Asynch_IO.cpp.

References ACE_WIN32_Asynch_Result::offset_high().

01193 {
01194   return ACE_WIN32_Asynch_Result::offset_high ();
01195 }

int ACE_WIN32_Asynch_Read_File_Result::post_completion ACE_Proactor_Impl proactor  )  [virtual]
 

Post to the Proactor's completion port.

Reimplemented from ACE_WIN32_Asynch_Read_Stream_Result.

Definition at line 1233 of file WIN32_Asynch_IO.cpp.

References ACE_WIN32_Asynch_Result::post_completion().

01234 {
01235   return ACE_WIN32_Asynch_Result::post_completion (proactor);
01236 }

int ACE_WIN32_Asynch_Read_File_Result::priority void   )  const [virtual]
 

The priority of the asynchronous operation. Currently, this is not supported on Win32.

Reimplemented from ACE_WIN32_Asynch_Read_Stream_Result.

Definition at line 1198 of file WIN32_Asynch_IO.cpp.

References ACE_WIN32_Asynch_Result::priority().

01199 {
01200   return ACE_WIN32_Asynch_Result::priority ();
01201 }

int ACE_WIN32_Asynch_Read_File_Result::signal_number void   )  const [virtual]
 

No-op. Returns 0.

Reimplemented from ACE_WIN32_Asynch_Read_Stream_Result.

Definition at line 1204 of file WIN32_Asynch_IO.cpp.

References ACE_WIN32_Asynch_Result::signal_number().

01205 {
01206   return ACE_WIN32_Asynch_Result::signal_number ();
01207 }

int ACE_WIN32_Asynch_Read_File_Result::success void   )  const [virtual]
 

Did the operation succeed?

Reimplemented from ACE_WIN32_Asynch_Read_Stream_Result.

Definition at line 1162 of file WIN32_Asynch_IO.cpp.

References ACE_WIN32_Asynch_Result::success().

01163 {
01164   return ACE_WIN32_Asynch_Result::success ();
01165 }


Friends And Related Function Documentation

friend class ACE_WIN32_Asynch_Read_File [friend]
 

Factory class will have special permissions.

Definition at line 567 of file WIN32_Asynch_IO.h.

friend class ACE_WIN32_Proactor [friend]
 

Proactor class has special permission.

Reimplemented from ACE_WIN32_Asynch_Read_Stream_Result.

Definition at line 570 of file WIN32_Asynch_IO.h.


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