Reference

ACE_Asynch_Read_File(3)

This class is a factory for starting off asynchronous reads on a file. This class forwards all methods to its implementation class.

NAME

ACE_Asynch_Read_File -

This class is a factory for starting off asynchronous reads on a file. This class forwards all methods to its implementation class.

SYNOPSIS

class ACE_Asynch_Read_File : public ACE_Asynch_Read_Stream
{
  public:
    ACE_Asynch_Read_File (void);
    virtual ~ACE_Asynch_Read_File (void);
    int open (
        ACE_Handler &handler,
        ACE_HANDLE handle = ACE_INVALID_HANDLE,
        const void *completion_key = 0,
        ACE_Proactor *proactor = 0
        );
    int read (
        ACE_Message_Block &message_block,
        u_long bytes_to_read,
        u_long offset = 0,
        u_long offset_high = 0,
        const void *act = 0,
        int priority = 0,
        int signal_number = ACE_SIGRTMIN
        );
    ACE_Asynch_Read_File_Impl *implementation (void) const;
    class Result : public ACE_Asynch_Read_Stream::Result
    {
      public:
        friend class ACE_POSIX_Asynch_Read_Stream_Result;
        friend class ACE_WIN32_Asynch_Read_Stream_Result;
        u_long bytes_to_read (void) const;
        ACE_Message_Block &message_block (void) const;
        ACE_HANDLE handle (void) const;
        ACE_Asynch_Read_Stream_Result_Impl *implementation (
            void
            ) const;
        friend class ACE_POSIX_Asynch_Write_Stream_Result;
        friend class ACE_WIN32_Asynch_Write_Stream_Result;
        u_long bytes_to_write (void) const;
        ACE_Message_Block &message_block (void) const;
        ACE_HANDLE handle (void) const;
        ACE_Asynch_Write_Stream_Result_Impl *implementation (
            void
            ) const;
        friend class ACE_POSIX_Asynch_Read_File_Result;
        friend class ACE_WIN32_Asynch_Read_File_Result;
        ACE_Asynch_Read_File_Result_Impl *implementation (void) const;
        friend class ACE_POSIX_Asynch_Write_File_Result;
        friend class ACE_WIN32_Asynch_Write_File_Result;
        ACE_Asynch_Write_File_Result_Impl *implementation (
            void
            ) const;
        friend class ACE_POSIX_Asynch_Accept_Result;
        friend class ACE_WIN32_Asynch_Accept_Result;
        u_long bytes_to_read (void) const;
        ACE_Message_Block &message_block (void) const;
        ACE_HANDLE listen_handle (void) const;
        ACE_HANDLE accept_handle (void) const;
        ACE_Asynch_Accept_Result_Impl *implementation (void) const;
        friend class ACE_POSIX_Asynch_Transmit_File_Result;
        friend class ACE_WIN32_Asynch_Transmit_File_Result;
        ACE_HANDLE socket (void) const;
        ACE_HANDLE file (void) const;
        Header_And_Trailer *header_and_trailer (void) const;
        u_long bytes_to_write (void) const;
        u_long bytes_per_send (void) const;
        u_long flags (void) const;
        ACE_Asynch_Transmit_File_Result_Impl *implementation (
            void
            ) const;
      protected:
        Result (ACE_Asynch_Read_Stream_Result_Impl *implementation);
        virtual ~Result (void);
        ACE_Asynch_Read_Stream_Result_Impl *implementation_;
        Result (ACE_Asynch_Write_Stream_Result_Impl *implementation);
        virtual ~Result (void);
        ACE_Asynch_Write_Stream_Result_Impl *implementation_;
        Result (ACE_Asynch_Read_File_Result_Impl *implementation);
        virtual ~Result (void);
        ACE_Asynch_Read_File_Result_Impl *implementation_;
        Result (ACE_Asynch_Write_File_Result_Impl *implementation);
        virtual ~Result (void);
        ACE_Asynch_Write_File_Result_Impl *implementation_;
        Result (ACE_Asynch_Accept_Result_Impl *implementation);
        virtual ~Result (void);
        ACE_Asynch_Accept_Result_Impl *implementation_;
        Result (ACE_Asynch_Transmit_File_Result_Impl *implementation);
        virtual ~Result (void);
        ACE_Asynch_Transmit_File_Result_Impl *implementation_;
    };

protected: void implementation (ACE_Asynch_Read_File_Impl *implementation); ACE_Asynch_Read_File_Impl *implementation_; };

DESCRIPTION

This works on Win32 (#if defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)) platforms and on POSIX4 platforms with aio_* routines (#if defined (ACE_HAS_AIO_CALLS))

On Win32 platforms, the implementation of ACE_Asynch_Transmit_File and ACE_Asynch_Accept are only supported if ACE_HAS_WINSOCK2 is defined or you are on WinNT 4.0 or higher.

PUBLIC MEMBERS

ACE_Asynch_Read_File (void);

A do nothing constructor.

virtual ~ACE_Asynch_Read_File (void);

Destructor.

int open (
    ACE_Handler &handler,
    ACE_HANDLE handle = ACE_INVALID_HANDLE,
    const void *completion_key = 0,
    ACE_Proactor *proactor = 0
    );

Initializes the factory with information which will be used with each asynchronous call. If (handle == ACE_INVALID_HANDLE), ACE_Handler::handle will be called on the handler to get the correct handle.

int read (
    ACE_Message_Block &message_block,
    u_long bytes_to_read,
    u_long offset = 0,
    u_long offset_high = 0,
    const void *act = 0,
    int priority = 0,
    int signal_number = ACE_SIGRTMIN
    );

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. Priority of the operation is specified by priority. On POSIX4-Unix, this is supported. Works like nice in Unix. Negative values are not allowed. 0 means priority of the operation same as the process priority. 1 means priority of the operation is one less than process. And so forth. On Win32, this argument is a no-op. signal_number is the POSIX4 real-time signal number to be used for the operation. signal_number ranges from ACE_SIGRTMIN to ACE_SIGRTMAX. This argument is a no-op on non-POSIX4 systems.

ACE_Asynch_Read_File_Impl *implementation (void) const;

Return the underlying implementation class.

PROTECTED MEMBERS

void implementation (ACE_Asynch_Read_File_Impl *implementation);

Set the implementation class.

ACE_Asynch_Read_File_Impl *implementation_;

Delegation/implementation class that all methods will be forwarded to.

AUTHOR

Irfan Pyarali [email protected], Tim Harrison [email protected] and Alexander Babu Arulanthu [email protected]

LIBRARY

ace