ACE_WIN32_Asynch_Write_File_Result Class Reference

This class provides implementation for ACE_Asynch_Write_File_Result for WIN32 platforms. More...

#include <WIN32_Asynch_IO.h>

Inheritance diagram for ACE_WIN32_Asynch_Write_File_Result:

Inheritance graph
[legend]
Collaboration diagram for ACE_WIN32_Asynch_Write_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_write (void) const
ACE_Message_Blockmessage_block (void) const
 Message block that contains the data to be written.

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

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


Protected Member Functions

 ACE_WIN32_Asynch_Write_File_Result (const ACE_Handler::Proxy_Ptr &handler_proxy, ACE_HANDLE handle, ACE_Message_Block &message_block, size_t bytes_to_write, const void *act, u_long offset, u_long offset_high, ACE_HANDLE event, int priority, int signal_number=0, int gather_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 write completes.

virtual ~ACE_WIN32_Asynch_Write_File_Result (void)
 Destructor.


Friends

class ACE_WIN32_Asynch_Write_File
 Factory class will have special permission.

class ACE_WIN32_Proactor
 Proactor class has special permission.


Detailed Description

This class provides implementation for ACE_Asynch_Write_File_Result for WIN32 platforms.

This class has all the information necessary for the to uniquiely identify the completion of the asynchronous write.

This class differs slightly from ACE_Asynch_Write_Stream::Result as it calls back <ACE_Handler::handle_write_file> on the instead of <ACE_Handler::handle_write_stream>. No additional state is required by this class as ACE_Asynch_Result can store the .

Definition at line 775 of file WIN32_Asynch_IO.h.


Constructor & Destructor Documentation

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

Constructor is protected since creation is limited to ACE_Asynch_Write_File factory.

Definition at line 1468 of file WIN32_Asynch_IO.cpp.

References ACE_Handler::Proxy_Ptr.

01480   : ACE_Asynch_Result_Impl (),
01481     ACE_Asynch_Write_Stream_Result_Impl (),
01482     ACE_Asynch_Write_File_Result_Impl (),
01483     ACE_WIN32_Asynch_Write_Stream_Result (handler_proxy,
01484                                           handle,
01485                                           message_block,
01486                                           bytes_to_write,
01487                                           act,
01488                                           event,
01489                                           priority,
01490                                           signal_number,
01491                                           gather_enabled)
01492 {
01493   this->Offset = offset;
01494   this->OffsetHigh = offset_high;
01495 }

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

Destructor.

Definition at line 1545 of file WIN32_Asynch_IO.cpp.

01546 {
01547 }


Member Function Documentation

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

ACT associated with the operation.

Reimplemented from ACE_WIN32_Asynch_Write_Stream_Result.

Definition at line 1559 of file WIN32_Asynch_IO.cpp.

References ACE_WIN32_Asynch_Result::act().

01560 {
01561   return ACE_WIN32_Asynch_Result::act ();
01562 }

size_t ACE_WIN32_Asynch_Write_File_Result::bytes_to_write void   )  const [virtual]
 

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

Reimplemented from ACE_WIN32_Asynch_Write_Stream_Result.

Definition at line 1618 of file WIN32_Asynch_IO.cpp.

References ACE_WIN32_Asynch_Write_Stream_Result::bytes_to_write().

size_t ACE_WIN32_Asynch_Write_File_Result::bytes_transferred void   )  const [virtual]
 

Number of bytes transferred by the operation.

Reimplemented from ACE_WIN32_Asynch_Write_Stream_Result.

Definition at line 1553 of file WIN32_Asynch_IO.cpp.

References ACE_WIN32_Asynch_Result::bytes_transferred().

01554 {
01555   return ACE_WIN32_Asynch_Result::bytes_transferred ();
01556 }

void ACE_WIN32_Asynch_Write_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 write completes.

Reimplemented from ACE_WIN32_Asynch_Write_Stream_Result.

Definition at line 1498 of file WIN32_Asynch_IO.cpp.

References ACE_Message_Block::cont(), ACE_WIN32_Asynch_Write_Stream_Result::gather_enabled(), ACE_Refcounted_Auto_Ptr< X, ACE_LOCK >::get(), ACE_OS::getpagesize(), ACE_Handler::handle_write_file(), and ACE_Message_Block::rd_ptr().

01502 {
01503   // Copy the data which was returned by GetQueuedCompletionStatus
01504   this->bytes_transferred_ = bytes_transferred;
01505   this->success_ = success;
01506   this->completion_key_ = completion_key;
01507   this->error_ = error;
01508 
01509   // Appropriately move the pointers in the message block.
01510   if (!this->gather_enabled ())
01511     this->message_block_.rd_ptr (bytes_transferred);
01512   else
01513   {
01514     static const size_t page_size = ACE_OS::getpagesize();
01515 
01516     for (ACE_Message_Block* mb = &this->message_block_;
01517          (mb != 0) && (bytes_transferred > 0);
01518          mb = mb->cont ())
01519     {
01520       // mb->length () is ought to be >= page_size.
01521       // this is verified in the writev method
01522       // ACE_ASSERT (mb->length () >= page_size);
01523 
01524       size_t len_part = page_size;
01525 
01526       if ( len_part > bytes_transferred)
01527         len_part = bytes_transferred;
01528 
01529       mb->rd_ptr (len_part);
01530 
01531       bytes_transferred -= len_part;
01532     }
01533 
01534   }
01535 
01536   // Create the interface result class.
01537   ACE_Asynch_Write_File::Result result (this);
01538 
01539   // Call the application handler.
01540   ACE_Handler *handler = this->handler_proxy_.get ()->handler ();
01541   if (handler != 0)
01542     handler->handle_write_file (result);
01543 }

const void * ACE_WIN32_Asynch_Write_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_Write_Stream_Result.

Definition at line 1571 of file WIN32_Asynch_IO.cpp.

References ACE_WIN32_Asynch_Result::completion_key().

01572 {
01573   return ACE_WIN32_Asynch_Result::completion_key ();
01574 }

u_long ACE_WIN32_Asynch_Write_File_Result::error void   )  const [virtual]
 

Error value if the operation fail.

Reimplemented from ACE_WIN32_Asynch_Write_Stream_Result.

Definition at line 1577 of file WIN32_Asynch_IO.cpp.

References ACE_WIN32_Asynch_Result::error().

01578 {
01579   return ACE_WIN32_Asynch_Result::error ();
01580 }

ACE_HANDLE ACE_WIN32_Asynch_Write_File_Result::event void   )  const [virtual]
 

Event associated with the OVERLAPPED structure.

Reimplemented from ACE_WIN32_Asynch_Write_Stream_Result.

Definition at line 1583 of file WIN32_Asynch_IO.cpp.

References ACE_WIN32_Asynch_Result::event().

01584 {
01585   return ACE_WIN32_Asynch_Result::event ();
01586 }

ACE_HANDLE ACE_WIN32_Asynch_Write_File_Result::handle void   )  const [virtual]
 

I/O handle used for writing.

Reimplemented from ACE_WIN32_Asynch_Write_Stream_Result.

Definition at line 1630 of file WIN32_Asynch_IO.cpp.

References ACE_WIN32_Asynch_Write_Stream_Result::handle().

Referenced by ACE_WIN32_Asynch_Write_File::writev().

01631 {
01632   return ACE_WIN32_Asynch_Write_Stream_Result::handle ();
01633 }

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

Message block that contains the data to be written.

Reimplemented from ACE_WIN32_Asynch_Write_Stream_Result.

Definition at line 1624 of file WIN32_Asynch_IO.cpp.

References ACE_WIN32_Asynch_Write_Stream_Result::message_block().

01625 {
01626   return ACE_WIN32_Asynch_Write_Stream_Result::message_block ();
01627 }

u_long ACE_WIN32_Asynch_Write_File_Result::offset void   )  const [virtual]
 

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

Reimplemented from ACE_WIN32_Asynch_Write_Stream_Result.

Definition at line 1589 of file WIN32_Asynch_IO.cpp.

References ACE_WIN32_Asynch_Result::offset().

01590 {
01591   return ACE_WIN32_Asynch_Result::offset ();
01592 }

u_long ACE_WIN32_Asynch_Write_File_Result::offset_high void   )  const [virtual]
 

Offset_high associated with the OVERLAPPED structure.

Reimplemented from ACE_WIN32_Asynch_Write_Stream_Result.

Definition at line 1595 of file WIN32_Asynch_IO.cpp.

References ACE_WIN32_Asynch_Result::offset_high().

01596 {
01597   return ACE_WIN32_Asynch_Result::offset_high ();
01598 }

int ACE_WIN32_Asynch_Write_File_Result::post_completion ACE_Proactor_Impl proactor  )  [virtual]
 

Post to the Proactor's completion port.

Reimplemented from ACE_WIN32_Asynch_Write_Stream_Result.

Definition at line 1636 of file WIN32_Asynch_IO.cpp.

References ACE_WIN32_Asynch_Result::post_completion().

01637 {
01638   return ACE_WIN32_Asynch_Result::post_completion (proactor);
01639 }

int ACE_WIN32_Asynch_Write_File_Result::priority void   )  const [virtual]
 

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

Reimplemented from ACE_WIN32_Asynch_Write_Stream_Result.

Definition at line 1601 of file WIN32_Asynch_IO.cpp.

References ACE_WIN32_Asynch_Result::priority().

01602 {
01603   return ACE_WIN32_Asynch_Result::priority ();
01604 }

int ACE_WIN32_Asynch_Write_File_Result::signal_number void   )  const [virtual]
 

No-op. Returns 0.

Reimplemented from ACE_WIN32_Asynch_Write_Stream_Result.

Definition at line 1607 of file WIN32_Asynch_IO.cpp.

References ACE_WIN32_Asynch_Result::signal_number().

01608 {
01609   return ACE_WIN32_Asynch_Result::signal_number ();
01610 }

int ACE_WIN32_Asynch_Write_File_Result::success void   )  const [virtual]
 

Did the operation succeed?

Reimplemented from ACE_WIN32_Asynch_Write_Stream_Result.

Definition at line 1565 of file WIN32_Asynch_IO.cpp.

References ACE_WIN32_Asynch_Result::success().

01566 {
01567   return ACE_WIN32_Asynch_Result::success ();
01568 }


Friends And Related Function Documentation

friend class ACE_WIN32_Asynch_Write_File [friend]
 

Factory class will have special permission.

Definition at line 779 of file WIN32_Asynch_IO.h.

friend class ACE_WIN32_Proactor [friend]
 

Proactor class has special permission.

Reimplemented from ACE_WIN32_Asynch_Write_Stream_Result.

Definition at line 782 of file WIN32_Asynch_IO.h.


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