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

ACE_POSIX_Asynch_Read_File Class Reference

This class is a factory for starting off asynchronous reads on a file. This class implements <ACE_Asynch_Read_File> 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 Methods

 ACE_POSIX_Asynch_Read_File (ACE_POSIX_Proactor *posix_proactor)
 Constructor. More...

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


Private Methods

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 <ACE_Asynch_Read_File> for all POSIX implementations of Proactor.

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

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

Definition at line 444 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 515 of file POSIX_Asynch_IO.cpp.

00516   : ACE_Asynch_Operation_Impl (),
00517     ACE_Asynch_Read_Stream_Impl (),
00518     ACE_Asynch_Read_File_Impl (),
00519     ACE_POSIX_Asynch_Read_Stream (posix_proactor)
00520 {
00521 }

ACE_POSIX_Asynch_Read_File::~ACE_POSIX_Asynch_Read_File void    [virtual]
 

Destructor.

Definition at line 565 of file POSIX_Asynch_IO.cpp.

00566 {
00567 }


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 570 of file POSIX_Asynch_IO.cpp.

References ACE_POSIX_Asynch_Read_Stream::read.

00575 {
00576   return ACE_POSIX_Asynch_Read_Stream::read (message_block,
00577                                                    bytes_to_read,
00578                                                    act,
00579                                                    priority,
00580                                                    signal_number);
00581 }

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 <bytes_to_read> will be read and stored in the <message_block>. The read will start at <offset> from the beginning of the file.

Implements ACE_Asynch_Read_File_Impl.

Definition at line 524 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_POSIX_Asynch_Operation::proactor, ACE_POSIX_Proactor::READ, ACE_Message_Block::space, and ACE_POSIX_Proactor::start_aio.

Referenced by ACE_POSIX_Asynch_Transmit_Handler::initiate_read_file.

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


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