ACE_WIN32_Asynch_Write_Stream_Result Class Reference

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

#include <WIN32_Asynch_IO.h>

Inheritance diagram for ACE_WIN32_Asynch_Write_Stream_Result:

Inheritance graph
[legend]
Collaboration diagram for ACE_WIN32_Asynch_Write_Stream_Result:

Collaboration graph
[legend]
List of all members.

Public Member Functions

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.

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.

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

int gather_enabled (void) const
 Accessor for the gather write flag.


Protected Member Functions

 ACE_WIN32_Asynch_Write_Stream_Result (const ACE_Handler::Proxy_Ptr &handler_proxy, ACE_HANDLE handle, ACE_Message_Block &message_block, size_t bytes_to_write, const void *act, 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_Stream_Result (void)
 Destructor.


Protected Attributes

size_t bytes_to_write_
ACE_Message_Blockmessage_block_
 Message block that contains the data to be written.

ACE_HANDLE handle_
 I/O handle used for writing.

int gather_enabled_
 Flag for gather write.


Friends

class ACE_WIN32_Asynch_Write_Stream
 Factory class willl have special permissions.

class ACE_WIN32_Proactor
 Proactor class has special permission.


Detailed Description

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

Definition at line 384 of file WIN32_Asynch_IO.h.


Constructor & Destructor Documentation

ACE_WIN32_Asynch_Write_Stream_Result::ACE_WIN32_Asynch_Write_Stream_Result const ACE_Handler::Proxy_Ptr handler_proxy,
ACE_HANDLE  handle,
ACE_Message_Block message_block,
size_t  bytes_to_write,
const void *  act,
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_Stream factory.

Definition at line 666 of file WIN32_Asynch_IO.cpp.

References ACE_Handler::Proxy_Ptr.

00676   : ACE_Asynch_Result_Impl (),
00677     ACE_Asynch_Write_Stream_Result_Impl (),
00678     ACE_WIN32_Asynch_Result
00679       (handler_proxy, act, event, 0, 0, priority, signal_number),
00680     bytes_to_write_ (bytes_to_write),
00681     message_block_ (message_block),
00682     handle_ (handle),
00683     gather_enabled_ (gather_enabled)
00684 {
00685 }

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

Destructor.

Definition at line 728 of file WIN32_Asynch_IO.cpp.

00729 {
00730 }


Member Function Documentation

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

ACT associated with the operation.

Reimplemented from ACE_WIN32_Asynch_Result.

Reimplemented in ACE_WIN32_Asynch_Write_File_Result.

Definition at line 742 of file WIN32_Asynch_IO.cpp.

References ACE_WIN32_Asynch_Result::act().

00743 {
00744   return ACE_WIN32_Asynch_Result::act ();
00745 }

size_t ACE_WIN32_Asynch_Write_Stream_Result::bytes_to_write void   )  const [virtual]
 

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

Implements ACE_Asynch_Write_Stream_Result_Impl.

Reimplemented in ACE_WIN32_Asynch_Write_File_Result.

Definition at line 649 of file WIN32_Asynch_IO.cpp.

Referenced by ACE_WIN32_Asynch_Write_File_Result::bytes_to_write(), and ACE_WIN32_Asynch_Write_Stream::shared_write().

00650 {
00651   return this->bytes_to_write_;
00652 }

size_t ACE_WIN32_Asynch_Write_Stream_Result::bytes_transferred void   )  const [virtual]
 

Number of bytes transferred by the operation.

Reimplemented from ACE_WIN32_Asynch_Result.

Reimplemented in ACE_WIN32_Asynch_Write_File_Result.

Definition at line 736 of file WIN32_Asynch_IO.cpp.

References ACE_WIN32_Asynch_Result::bytes_transferred().

00737 {
00738   return ACE_WIN32_Asynch_Result::bytes_transferred ();
00739 }

void ACE_WIN32_Asynch_Write_Stream_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.

Implements ACE_Asynch_Result_Impl.

Reimplemented in ACE_WIN32_Asynch_Write_File_Result.

Definition at line 688 of file WIN32_Asynch_IO.cpp.

References ACE_Message_Block::cont(), gather_enabled(), ACE_Refcounted_Auto_Ptr< X, ACE_LOCK >::get(), ACE_Handler::handle_write_stream(), ACE_Message_Block::length(), and ACE_Message_Block::rd_ptr().

00692 {
00693   // Copy the data which was returned by <GetQueuedCompletionStatus>.
00694   this->bytes_transferred_ = bytes_transferred;
00695   this->success_ = success;
00696   this->completion_key_ = completion_key;
00697   this->error_ = error;
00698 
00699   // Appropriately move the pointers in the message block.
00700   if (!this->gather_enabled ())
00701     this->message_block_.rd_ptr (bytes_transferred);
00702   else
00703   {
00704     for (ACE_Message_Block* mb = &this->message_block_;
00705          (mb != 0) && (bytes_transferred > 0);
00706          mb = mb->cont ())
00707     {
00708       size_t len_part = mb->length ();
00709 
00710       if ( len_part > bytes_transferred)
00711         len_part = bytes_transferred;
00712 
00713       mb->rd_ptr (len_part);
00714 
00715       bytes_transferred -= len_part;
00716     }
00717   }
00718 
00719   // Create the interface result class.
00720   ACE_Asynch_Write_Stream::Result result (this);
00721 
00722   // Call the application handler.
00723   ACE_Handler *handler = this->handler_proxy_.get ()->handler ();
00724   if (handler != 0)
00725     handler->handle_write_stream (result);
00726 }

const void * ACE_WIN32_Asynch_Write_Stream_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_Result.

Reimplemented in ACE_WIN32_Asynch_Write_File_Result.

Definition at line 754 of file WIN32_Asynch_IO.cpp.

References ACE_WIN32_Asynch_Result::completion_key().

00755 {
00756   return ACE_WIN32_Asynch_Result::completion_key ();
00757 }

u_long ACE_WIN32_Asynch_Write_Stream_Result::error void   )  const [virtual]
 

Error value if the operation fail.

Reimplemented from ACE_WIN32_Asynch_Result.

Reimplemented in ACE_WIN32_Asynch_Write_File_Result.

Definition at line 760 of file WIN32_Asynch_IO.cpp.

References ACE_WIN32_Asynch_Result::error().

00761 {
00762   return ACE_WIN32_Asynch_Result::error ();
00763 }

ACE_HANDLE ACE_WIN32_Asynch_Write_Stream_Result::event void   )  const [virtual]
 

Event associated with the OVERLAPPED structure.

Reimplemented from ACE_WIN32_Asynch_Result.

Reimplemented in ACE_WIN32_Asynch_Write_File_Result.

Definition at line 766 of file WIN32_Asynch_IO.cpp.

References ACE_WIN32_Asynch_Result::event().

00767 {
00768   return ACE_WIN32_Asynch_Result::event ();
00769 }

int ACE_WIN32_Asynch_Write_Stream_Result::gather_enabled void   )  const
 

Accessor for the gather write flag.

Definition at line 802 of file WIN32_Asynch_IO.cpp.

References gather_enabled_.

Referenced by ACE_WIN32_Asynch_Write_File_Result::complete(), and complete().

00803 {
00804   return this->gather_enabled_;
00805 }

ACE_HANDLE ACE_WIN32_Asynch_Write_Stream_Result::handle void   )  const [virtual]
 

I/O handle used for writing.

Implements ACE_Asynch_Write_Stream_Result_Impl.

Reimplemented in ACE_WIN32_Asynch_Write_File_Result.

Definition at line 661 of file WIN32_Asynch_IO.cpp.

Referenced by ACE_WIN32_Asynch_Write_File_Result::handle(), ACE_WIN32_Asynch_Write_Stream::shared_write(), and ACE_WIN32_Asynch_Write_Stream::writev().

00662 {
00663   return this->handle_;
00664 }

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

Message block that contains the data to be written.

Implements ACE_Asynch_Write_Stream_Result_Impl.

Reimplemented in ACE_WIN32_Asynch_Write_File_Result.

Definition at line 655 of file WIN32_Asynch_IO.cpp.

Referenced by ACE_WIN32_Asynch_Write_File_Result::message_block(), and ACE_WIN32_Asynch_Write_Stream::shared_write().

00656 {
00657   return this->message_block_;
00658 }

u_long ACE_WIN32_Asynch_Write_Stream_Result::offset void   )  const [virtual]
 

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

Reimplemented from ACE_WIN32_Asynch_Result.

Reimplemented in ACE_WIN32_Asynch_Write_File_Result.

Definition at line 772 of file WIN32_Asynch_IO.cpp.

References ACE_WIN32_Asynch_Result::offset().

00773 {
00774   return ACE_WIN32_Asynch_Result::offset ();
00775 }

u_long ACE_WIN32_Asynch_Write_Stream_Result::offset_high void   )  const [virtual]
 

Offset_high associated with the OVERLAPPED structure.

Reimplemented from ACE_WIN32_Asynch_Result.

Reimplemented in ACE_WIN32_Asynch_Write_File_Result.

Definition at line 778 of file WIN32_Asynch_IO.cpp.

References ACE_WIN32_Asynch_Result::offset_high().

00779 {
00780   return ACE_WIN32_Asynch_Result::offset_high ();
00781 }

int ACE_WIN32_Asynch_Write_Stream_Result::post_completion ACE_Proactor_Impl proactor  )  [virtual]
 

Post to the Proactor's completion port.

Reimplemented from ACE_WIN32_Asynch_Result.

Reimplemented in ACE_WIN32_Asynch_Write_File_Result.

Definition at line 796 of file WIN32_Asynch_IO.cpp.

References ACE_WIN32_Asynch_Result::post_completion().

00797 {
00798   return ACE_WIN32_Asynch_Result::post_completion (proactor);
00799 }

int ACE_WIN32_Asynch_Write_Stream_Result::priority void   )  const [virtual]
 

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

Reimplemented from ACE_WIN32_Asynch_Result.

Reimplemented in ACE_WIN32_Asynch_Write_File_Result.

Definition at line 784 of file WIN32_Asynch_IO.cpp.

References ACE_WIN32_Asynch_Result::priority().

00785 {
00786   return ACE_WIN32_Asynch_Result::priority ();
00787 }

int ACE_WIN32_Asynch_Write_Stream_Result::signal_number void   )  const [virtual]
 

No-op. Returns 0.

Reimplemented from ACE_WIN32_Asynch_Result.

Reimplemented in ACE_WIN32_Asynch_Write_File_Result.

Definition at line 790 of file WIN32_Asynch_IO.cpp.

References ACE_WIN32_Asynch_Result::signal_number().

00791 {
00792   return ACE_WIN32_Asynch_Result::signal_number ();
00793 }

int ACE_WIN32_Asynch_Write_Stream_Result::success void   )  const [virtual]
 

Did the operation succeed?

Reimplemented from ACE_WIN32_Asynch_Result.

Reimplemented in ACE_WIN32_Asynch_Write_File_Result.

Definition at line 748 of file WIN32_Asynch_IO.cpp.

References ACE_WIN32_Asynch_Result::success().

00749 {
00750   return ACE_WIN32_Asynch_Result::success ();
00751 }


Friends And Related Function Documentation

friend class ACE_WIN32_Asynch_Write_Stream [friend]
 

Factory class willl have special permissions.

Definition at line 388 of file WIN32_Asynch_IO.h.

friend class ACE_WIN32_Proactor [friend]
 

Proactor class has special permission.

Reimplemented from ACE_WIN32_Asynch_Result.

Reimplemented in ACE_WIN32_Asynch_Write_File_Result.

Definition at line 391 of file WIN32_Asynch_IO.h.


Member Data Documentation

size_t ACE_WIN32_Asynch_Write_Stream_Result::bytes_to_write_ [protected]
 

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

Definition at line 472 of file WIN32_Asynch_IO.h.

int ACE_WIN32_Asynch_Write_Stream_Result::gather_enabled_ [protected]
 

Flag for gather write.

Definition at line 481 of file WIN32_Asynch_IO.h.

Referenced by gather_enabled().

ACE_HANDLE ACE_WIN32_Asynch_Write_Stream_Result::handle_ [protected]
 

I/O handle used for writing.

Definition at line 478 of file WIN32_Asynch_IO.h.

ACE_Message_Block& ACE_WIN32_Asynch_Write_Stream_Result::message_block_ [protected]
 

Message block that contains the data to be written.

Definition at line 475 of file WIN32_Asynch_IO.h.


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