ACE_WIN32_Asynch_Read_Stream_Result Class Reference

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

#include <WIN32_Asynch_IO.h>

Inheritance diagram for ACE_WIN32_Asynch_Read_Stream_Result:

Inheritance graph
[legend]
Collaboration diagram for ACE_WIN32_Asynch_Read_Stream_Result:

Collaboration graph
[legend]
List of all members.

Public Member Functions

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.

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 scatter_enabled (void) const
 Accessor for the scatter read flag.


Protected Member Functions

 ACE_WIN32_Asynch_Read_Stream_Result (const ACE_Handler::Proxy_Ptr &handler_proxy, ACE_HANDLE handle, ACE_Message_Block &message_block, size_t bytes_to_read, const void *act, 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)
 Proactor will call this method when the read completes.

virtual ~ACE_WIN32_Asynch_Read_Stream_Result (void)
 Destructor.


Protected Attributes

size_t bytes_to_read_
 Bytes requested when the asynchronous read was initiated.

ACE_Message_Blockmessage_block_
 Message block for reading the data into.

ACE_HANDLE handle_
 I/O handle used for reading.

int scatter_enabled_
 Flag for scatter read.


Friends

class ACE_WIN32_Asynch_Read_Stream
 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_Stream::Result class.

Definition at line 207 of file WIN32_Asynch_IO.h.


Constructor & Destructor Documentation

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

Definition at line 232 of file WIN32_Asynch_IO.cpp.

References ACE_Handler::Proxy_Ptr.

00242   : ACE_Asynch_Result_Impl (),
00243     ACE_Asynch_Read_Stream_Result_Impl (),
00244     ACE_WIN32_Asynch_Result (handler_proxy,
00245                              act,
00246                              event,
00247                              0,
00248                              0,
00249                              priority,
00250                              signal_number),
00251     bytes_to_read_ (bytes_to_read),
00252     message_block_ (message_block),
00253     handle_ (handle),
00254     scatter_enabled_ (scatter_enabled)
00255 {
00256 }

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

Destructor.

Definition at line 299 of file WIN32_Asynch_IO.cpp.

00300 {
00301 }


Member Function Documentation

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

ACT associated with the operation.

Reimplemented from ACE_WIN32_Asynch_Result.

Reimplemented in ACE_WIN32_Asynch_Read_File_Result.

Definition at line 313 of file WIN32_Asynch_IO.cpp.

References ACE_WIN32_Asynch_Result::act().

00314 {
00315   return ACE_WIN32_Asynch_Result::act ();
00316 }

size_t ACE_WIN32_Asynch_Read_Stream_Result::bytes_to_read void   )  const [virtual]
 

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

Implements ACE_Asynch_Read_Stream_Result_Impl.

Reimplemented in ACE_WIN32_Asynch_Read_File_Result.

Definition at line 215 of file WIN32_Asynch_IO.cpp.

Referenced by ACE_WIN32_Asynch_Read_File_Result::bytes_to_read(), and ACE_WIN32_Asynch_Read_Stream::shared_read().

00216 {
00217   return this->bytes_to_read_;
00218 }

size_t ACE_WIN32_Asynch_Read_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_Read_File_Result.

Definition at line 307 of file WIN32_Asynch_IO.cpp.

References ACE_WIN32_Asynch_Result::bytes_transferred().

00308 {
00309   return ACE_WIN32_Asynch_Result::bytes_transferred ();
00310 }

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

Proactor will call this method when the read completes.

Implements ACE_Asynch_Result_Impl.

Reimplemented in ACE_WIN32_Asynch_Read_File_Result.

Definition at line 259 of file WIN32_Asynch_IO.cpp.

References ACE_Message_Block::cont(), ACE_Refcounted_Auto_Ptr< X, ACE_LOCK >::get(), ACE_Handler::handle_read_stream(), scatter_enabled(), ACE_Message_Block::space(), and ACE_Message_Block::wr_ptr().

00263 {
00264   // Copy the data which was returned by GetQueuedCompletionStatus
00265   this->bytes_transferred_ = bytes_transferred;
00266   this->success_ = success;
00267   this->completion_key_ = completion_key;
00268   this->error_ = error;
00269 
00270   // Appropriately move the pointers in the message block.
00271   if (!this->scatter_enabled ())
00272     this->message_block_.wr_ptr (bytes_transferred);
00273   else
00274   {
00275     for (ACE_Message_Block* mb = &this->message_block_;
00276          (mb != 0) && (bytes_transferred > 0);
00277          mb = mb->cont ())
00278     {
00279       size_t len_part = mb->space ();
00280 
00281       if (len_part > bytes_transferred)
00282         len_part = bytes_transferred;
00283 
00284       mb->wr_ptr (len_part);
00285 
00286       bytes_transferred -= len_part;
00287     }
00288   }
00289 
00290   // Create the interface result class.
00291   ACE_Asynch_Read_Stream::Result result (this);
00292 
00293   // Call the application handler.
00294   ACE_Handler *handler = this->handler_proxy_.get ()->handler ();
00295   if (handler != 0)
00296     handler->handle_read_stream (result);
00297 }

const void * ACE_WIN32_Asynch_Read_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_Read_File_Result.

Definition at line 325 of file WIN32_Asynch_IO.cpp.

References ACE_WIN32_Asynch_Result::completion_key().

00326 {
00327   return ACE_WIN32_Asynch_Result::completion_key ();
00328 }

u_long ACE_WIN32_Asynch_Read_Stream_Result::error void   )  const [virtual]
 

Error value if the operation fail.

Reimplemented from ACE_WIN32_Asynch_Result.

Reimplemented in ACE_WIN32_Asynch_Read_File_Result.

Definition at line 331 of file WIN32_Asynch_IO.cpp.

References ACE_WIN32_Asynch_Result::error().

00332 {
00333   return ACE_WIN32_Asynch_Result::error ();
00334 }

ACE_HANDLE ACE_WIN32_Asynch_Read_Stream_Result::event void   )  const [virtual]
 

Event associated with the OVERLAPPED structure.

Reimplemented from ACE_WIN32_Asynch_Result.

Reimplemented in ACE_WIN32_Asynch_Read_File_Result.

Definition at line 337 of file WIN32_Asynch_IO.cpp.

References ACE_WIN32_Asynch_Result::event().

00338 {
00339   return ACE_WIN32_Asynch_Result::event ();
00340 }

ACE_HANDLE ACE_WIN32_Asynch_Read_Stream_Result::handle void   )  const [virtual]
 

I/O handle used for reading.

Implements ACE_Asynch_Read_Stream_Result_Impl.

Reimplemented in ACE_WIN32_Asynch_Read_File_Result.

Definition at line 227 of file WIN32_Asynch_IO.cpp.

Referenced by ACE_WIN32_Asynch_Read_File_Result::handle(), ACE_WIN32_Asynch_Read_Stream::readv(), and ACE_WIN32_Asynch_Read_Stream::shared_read().

00228 {
00229   return this->handle_;
00230 }

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

Message block which contains the read data.

Implements ACE_Asynch_Read_Stream_Result_Impl.

Reimplemented in ACE_WIN32_Asynch_Read_File_Result.

Definition at line 221 of file WIN32_Asynch_IO.cpp.

Referenced by ACE_WIN32_Asynch_Read_File_Result::message_block(), and ACE_WIN32_Asynch_Read_Stream::shared_read().

00222 {
00223   return this->message_block_;
00224 }

u_long ACE_WIN32_Asynch_Read_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_Read_File_Result.

Definition at line 343 of file WIN32_Asynch_IO.cpp.

References ACE_WIN32_Asynch_Result::offset().

00344 {
00345   return ACE_WIN32_Asynch_Result::offset ();
00346 }

u_long ACE_WIN32_Asynch_Read_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_Read_File_Result.

Definition at line 349 of file WIN32_Asynch_IO.cpp.

References ACE_WIN32_Asynch_Result::offset_high().

00350 {
00351   return ACE_WIN32_Asynch_Result::offset_high ();
00352 }

int ACE_WIN32_Asynch_Read_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_Read_File_Result.

Definition at line 367 of file WIN32_Asynch_IO.cpp.

References ACE_WIN32_Asynch_Result::post_completion().

00368 {
00369   return ACE_WIN32_Asynch_Result::post_completion (proactor);
00370 }

int ACE_WIN32_Asynch_Read_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_Read_File_Result.

Definition at line 355 of file WIN32_Asynch_IO.cpp.

References ACE_WIN32_Asynch_Result::priority().

00356 {
00357   return ACE_WIN32_Asynch_Result::priority ();
00358 }

int ACE_WIN32_Asynch_Read_Stream_Result::scatter_enabled void   )  const
 

Accessor for the scatter read flag.

Definition at line 373 of file WIN32_Asynch_IO.cpp.

References scatter_enabled_.

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

00374 {
00375   return this->scatter_enabled_;
00376 }

int ACE_WIN32_Asynch_Read_Stream_Result::signal_number void   )  const [virtual]
 

No-op. Returns 0.

Reimplemented from ACE_WIN32_Asynch_Result.

Reimplemented in ACE_WIN32_Asynch_Read_File_Result.

Definition at line 361 of file WIN32_Asynch_IO.cpp.

References ACE_WIN32_Asynch_Result::signal_number().

00362 {
00363   return ACE_WIN32_Asynch_Result::signal_number ();
00364 }

int ACE_WIN32_Asynch_Read_Stream_Result::success void   )  const [virtual]
 

Did the operation succeed?

Reimplemented from ACE_WIN32_Asynch_Result.

Reimplemented in ACE_WIN32_Asynch_Read_File_Result.

Definition at line 319 of file WIN32_Asynch_IO.cpp.

References ACE_WIN32_Asynch_Result::success().

00320 {
00321   return ACE_WIN32_Asynch_Result::success ();
00322 }


Friends And Related Function Documentation

friend class ACE_WIN32_Asynch_Read_Stream [friend]
 

Factory class will have special permissions.

Definition at line 211 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_Read_File_Result.

Definition at line 214 of file WIN32_Asynch_IO.h.


Member Data Documentation

size_t ACE_WIN32_Asynch_Read_Stream_Result::bytes_to_read_ [protected]
 

Bytes requested when the asynchronous read was initiated.

Definition at line 294 of file WIN32_Asynch_IO.h.

ACE_HANDLE ACE_WIN32_Asynch_Read_Stream_Result::handle_ [protected]
 

I/O handle used for reading.

Definition at line 300 of file WIN32_Asynch_IO.h.

ACE_Message_Block& ACE_WIN32_Asynch_Read_Stream_Result::message_block_ [protected]
 

Message block for reading the data into.

Definition at line 297 of file WIN32_Asynch_IO.h.

int ACE_WIN32_Asynch_Read_Stream_Result::scatter_enabled_ [protected]
 

Flag for scatter read.

Definition at line 303 of file WIN32_Asynch_IO.h.

Referenced by scatter_enabled().


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