Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

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 Methods

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

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

int success (void) const
 Did the operation succeed? More...

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

ACE_HANDLE event (void) const
 Event associated with the OVERLAPPED structure. More...

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

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

int priority (void) const
 The priority of the asynchronous operation. Currently, this is not supported on Win32. More...

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

size_t bytes_to_write (void) const
 The number of bytes which were requested at the start of the asynchronous write. More...

ACE_Message_Blockmessage_block (void) const
 Message block that contains the data to be written. More...

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

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


Protected Methods

 ACE_WIN32_Asynch_Write_File_Result (ACE_Handler &handler, 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)
 Constructor is protected since creation is limited to ACE_Asynch_Write_File factory. More...

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. More...

virtual ~ACE_WIN32_Asynch_Write_File_Result (void)
 Destructor. More...


Friends

class ACE_WIN32_Asynch_Write_File
 Factory class will have special permission. More...

class ACE_WIN32_Proactor
 Proactor class has special permission. More...


Detailed Description

This class provides implementation for ACE_Asynch_Write_File_Result for WIN32 platforms.

This class has all the information necessary for the <handler> 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 <handler> instead of <ACE_Handler::handle_write_stream>. No additional state is required by this class as ACE_Asynch_Result can store the <offset>.

Definition at line 773 of file WIN32_Asynch_IO.h.


Constructor & Destructor Documentation

ACE_WIN32_Asynch_Write_File_Result::ACE_WIN32_Asynch_Write_File_Result ACE_Handler   handler,
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 1428 of file WIN32_Asynch_IO.cpp.

References offset, and offset_high.

01439   : ACE_Asynch_Result_Impl (),
01440     ACE_Asynch_Write_Stream_Result_Impl (),
01441     ACE_Asynch_Write_File_Result_Impl (),
01442     ACE_WIN32_Asynch_Write_Stream_Result (handler,
01443                                           handle,
01444                                           message_block,
01445                                           bytes_to_write,
01446                                           act,
01447                                           event,
01448                                           priority,
01449                                           signal_number,
01450                                           gather_enabled)
01451 {
01452   this->Offset = offset;
01453   this->OffsetHigh = offset_high;
01454 }

ACE_WIN32_Asynch_Write_File_Result::~ACE_WIN32_Asynch_Write_File_Result void    [protected, virtual]
 

Destructor.

Definition at line 1502 of file WIN32_Asynch_IO.cpp.

01503 {
01504 }


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 1516 of file WIN32_Asynch_IO.cpp.

References ACE_WIN32_Asynch_Result::act.

01517 {
01518   return ACE_WIN32_Asynch_Result::act ();
01519 }

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 1575 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 1510 of file WIN32_Asynch_IO.cpp.

References ACE_WIN32_Asynch_Result::bytes_transferred.

Referenced by complete.

01511 {
01512   return ACE_WIN32_Asynch_Result::bytes_transferred ();
01513 }

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 1457 of file WIN32_Asynch_IO.cpp.

References bytes_transferred, ACE_WIN32_Asynch_Result::bytes_transferred_, completion_key, ACE_WIN32_Asynch_Result::completion_key_, ACE_Message_Block::cont, error, ACE_WIN32_Asynch_Result::error_, ACE_WIN32_Asynch_Write_Stream_Result::gather_enabled, ACE_OS::getpagesize, ACE_Handler::handle_write_file, ACE_WIN32_Asynch_Result::handler_, ACE_WIN32_Asynch_Write_Stream_Result::message_block_, ACE_Message_Block::rd_ptr, success, and ACE_WIN32_Asynch_Result::success_.

01461 {
01462   // Copy the data which was returned by GetQueuedCompletionStatus
01463   this->bytes_transferred_ = bytes_transferred;
01464   this->success_ = success;
01465   this->completion_key_ = completion_key;
01466   this->error_ = error;
01467 
01468   // Appropriately move the pointers in the message block.
01469   if (!this->gather_enabled ())
01470     this->message_block_.rd_ptr (bytes_transferred);
01471   else
01472   {
01473     static const size_t page_size = ACE_OS::getpagesize();
01474 
01475     for (ACE_Message_Block* mb = &this->message_block_;
01476          (mb != 0) && (bytes_transferred > 0);
01477          mb = mb->cont ())
01478     {
01479       // mb->length () is ought to be >= page_size.
01480       // this is verified in the writev method
01481       // ACE_ASSERT (mb->length () >= page_size);
01482 
01483       size_t len_part = page_size;
01484 
01485       if ( len_part > bytes_transferred)
01486         len_part = bytes_transferred;
01487 
01488       mb->rd_ptr (len_part);
01489 
01490       bytes_transferred -= len_part;
01491     }
01492 
01493   }
01494 
01495   // Create the interface result class.
01496   ACE_Asynch_Write_File::Result result (this);
01497 
01498   // Call the application handler.
01499   this->handler_.handle_write_file (result);
01500 }

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 1528 of file WIN32_Asynch_IO.cpp.

References ACE_WIN32_Asynch_Result::completion_key.

Referenced by complete.

01529 {
01530   return ACE_WIN32_Asynch_Result::completion_key ();
01531 }

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 1534 of file WIN32_Asynch_IO.cpp.

References ACE_WIN32_Asynch_Result::error.

Referenced by complete.

01535 {
01536   return ACE_WIN32_Asynch_Result::error ();
01537 }

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 1540 of file WIN32_Asynch_IO.cpp.

References ACE_WIN32_Asynch_Result::event.

01541 {
01542   return ACE_WIN32_Asynch_Result::event ();
01543 }

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 1587 of file WIN32_Asynch_IO.cpp.

References ACE_WIN32_Asynch_Write_Stream_Result::handle.

Referenced by ACE_WIN32_Asynch_Write_File::writev.

01588 {
01589   return ACE_WIN32_Asynch_Write_Stream_Result::handle ();
01590 }

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 1581 of file WIN32_Asynch_IO.cpp.

References ACE_WIN32_Asynch_Write_Stream_Result::message_block.

01582 {
01583   return ACE_WIN32_Asynch_Write_Stream_Result::message_block ();
01584 }

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 1546 of file WIN32_Asynch_IO.cpp.

References ACE_WIN32_Asynch_Result::offset.

Referenced by ACE_WIN32_Asynch_Write_File_Result.

01547 {
01548   return ACE_WIN32_Asynch_Result::offset ();
01549 }

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 1552 of file WIN32_Asynch_IO.cpp.

References ACE_WIN32_Asynch_Result::offset_high.

Referenced by ACE_WIN32_Asynch_Write_File_Result.

01553 {
01554   return ACE_WIN32_Asynch_Result::offset_high ();
01555 }

int ACE_WIN32_Asynch_Write_File_Result::post_completion ACE_Proactor_Impl   proactor [virtual]
 

Post <this> to the Proactor's completion port.

Reimplemented from ACE_WIN32_Asynch_Write_Stream_Result.

Definition at line 1593 of file WIN32_Asynch_IO.cpp.

References ACE_WIN32_Asynch_Result::post_completion.

01594 {
01595   return ACE_WIN32_Asynch_Result::post_completion (proactor);
01596 }

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 1558 of file WIN32_Asynch_IO.cpp.

References ACE_WIN32_Asynch_Result::priority.

01559 {
01560   return ACE_WIN32_Asynch_Result::priority ();
01561 }

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 1564 of file WIN32_Asynch_IO.cpp.

References ACE_WIN32_Asynch_Result::signal_number.

01565 {
01566   return ACE_WIN32_Asynch_Result::signal_number ();
01567 }

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 1522 of file WIN32_Asynch_IO.cpp.

References ACE_WIN32_Asynch_Result::success.

Referenced by complete.

01523 {
01524   return ACE_WIN32_Asynch_Result::success ();
01525 }


Friends And Related Function Documentation

friend class ACE_WIN32_Asynch_Write_File [friend]
 

Factory class will have special permission.

Definition at line 777 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 780 of file WIN32_Asynch_IO.h.


The documentation for this class was generated from the following files:
Generated on Mon Jun 16 13:00:50 2003 for ACE by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002