ACE_POSIX_Asynch_Read_File Class Reference

This class is a factory for starting off asynchronous reads on a file. This class implements for all POSIX implementations of Proactor. More...

#include <POSIX_Asynch_IO.h>

Inheritance diagram for ACE_POSIX_Asynch_Read_File:

Inheritance graph
[legend]
Collaboration diagram for ACE_POSIX_Asynch_Read_File:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 ACE_POSIX_Asynch_Read_File (ACE_POSIX_Proactor *posix_proactor)
 Constructor.

int read (ACE_Message_Block &message_block, size_t bytes_to_read, u_long offset, u_long offset_high, const void *act, int priority, int signal_number=0)
virtual ~ACE_POSIX_Asynch_Read_File (void)
 Destructor.


Private Member Functions

int read (ACE_Message_Block &message_block, size_t bytes_to_read, const void *act, int priority, int signal_number=0)

Detailed Description

This class is a factory for starting off asynchronous reads on a file. This class implements for all POSIX implementations of Proactor.

Once is called, multiple asynchronous s can started using this class. A <ACE_Asynch_Read_File::Result> will be passed back to the when the asynchronous reads completes through the <ACE_Handler::handle_read_file> callback.

This class differs slightly from as it allows the user to specify an offset for the read.

Definition at line 451 of file POSIX_Asynch_IO.h.


Constructor & Destructor Documentation

ACE_POSIX_Asynch_Read_File::ACE_POSIX_Asynch_Read_File ACE_POSIX_Proactor posix_proactor  ) 
 

Constructor.

Definition at line 511 of file POSIX_Asynch_IO.cpp.

00512   : ACE_POSIX_Asynch_Read_Stream (posix_proactor)
00513 {
00514 }

ACE_POSIX_Asynch_Read_File::~ACE_POSIX_Asynch_Read_File void   )  [virtual]
 

Destructor.

Definition at line 558 of file POSIX_Asynch_IO.cpp.

00559 {
00560 }


Member Function Documentation

int ACE_POSIX_Asynch_Read_File::read ACE_Message_Block message_block,
size_t  bytes_to_read,
const void *  act,
int  priority,
int  signal_number = 0
[private, virtual]
 

This belongs to ACE_POSIX_Asynch_Read_Stream. We have defined this here to avoid compiler warnings and forward the method to <ACE_POSIX_Asynch_Read_Stream::read>.

Implements ACE_Asynch_Read_File_Impl.

Definition at line 563 of file POSIX_Asynch_IO.cpp.

References ACE_POSIX_Asynch_Read_Stream::read().

00568 {
00569   return ACE_POSIX_Asynch_Read_Stream::read (message_block,
00570                                              bytes_to_read,
00571                                              act,
00572                                              priority,
00573                                              signal_number);
00574 }

int ACE_POSIX_Asynch_Read_File::read ACE_Message_Block message_block,
size_t  bytes_to_read,
u_long  offset,
u_long  offset_high,
const void *  act,
int  priority,
int  signal_number = 0
[virtual]
 

This starts off an asynchronous read. Upto will be read and stored in the . The read will start at from the beginning of the file.

Implements ACE_Asynch_Read_File_Impl.

Definition at line 517 of file POSIX_Asynch_IO.cpp.

References ACE_ERROR_RETURN, ACE_LIB_TEXT, ACE_NEW_RETURN, LM_ERROR, ACE_POSIX_Asynch_Operation::posix_proactor(), ACE_Message_Block::space(), and ACE_POSIX_Proactor::start_aio().

Referenced by ACE_POSIX_Asynch_Transmit_Handler::initiate_read_file().

00524 {
00525   size_t space = message_block.space ();
00526   if ( bytes_to_read > space )
00527      bytes_to_read=space;
00528 
00529   if ( bytes_to_read == 0 )
00530     ACE_ERROR_RETURN
00531       ((LM_ERROR,
00532         ACE_LIB_TEXT ("ACE_POSIX_Asynch_Read_File::read:")
00533         ACE_LIB_TEXT ("Attempt to read 0 bytes or no space in the message block\n")),
00534        -1);
00535 
00536   ACE_POSIX_Asynch_Read_File_Result *result = 0;
00537   ACE_POSIX_Proactor *proactor = this->posix_proactor ();
00538   ACE_NEW_RETURN (result,
00539                   ACE_POSIX_Asynch_Read_File_Result (this->handler_proxy_,
00540                                                      this->handle_,
00541                                                      message_block,
00542                                                      bytes_to_read,
00543                                                      act,
00544                                                      offset,
00545                                                      offset_high,
00546                                                      posix_proactor ()->get_handle (),
00547                                                      priority,
00548                                                      signal_number),
00549                   -1);
00550 
00551   int return_val = proactor->start_aio (result, ACE_POSIX_Proactor::ACE_OPCODE_READ);
00552   if (return_val == -1)
00553     delete result;
00554 
00555   return return_val;
00556 }


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