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

ACE_Asynch_Transmit_File Class Reference

This class is a factory for starting off asynchronous transmit files on a stream. More...

#include <Asynch_IO.h>

Inheritance diagram for ACE_Asynch_Transmit_File:

Inheritance graph
[legend]
Collaboration diagram for ACE_Asynch_Transmit_File:

Collaboration graph
[legend]
List of all members.

Public Methods

 ACE_Asynch_Transmit_File (void)
 A do nothing constructor. More...

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

int open (ACE_Handler &handler, ACE_HANDLE handle=ACE_INVALID_HANDLE, const void *completion_key=0, ACE_Proactor *proactor=0)
int transmit_file (ACE_HANDLE file, Header_And_Trailer *header_and_trailer=0, size_t bytes_to_write=0, u_long offset=0, u_long offset_high=0, size_t bytes_per_send=0, u_long flags=0, const void *act=0, int priority=0, int signal_number=ACE_SIGRTMIN)
ACE_Asynch_Transmit_File_Implimplementation (void) const
 Return the underlying implementation class. More...


Protected Methods

void implementation (ACE_Asynch_Transmit_File_Impl *)
 Set the implementation. More...


Protected Attributes

ACE_Asynch_Transmit_File_Implimplementation_
 The implementation class. More...


Detailed Description

This class is a factory for starting off asynchronous transmit files on a stream.

Once <open> is called, multiple asynchronous <transmit_file>s can started using this class. A ACE_Asynch_Transmit_File::Result will be passed back to the <handler> when the asynchronous transmit file completes through the <ACE_Handler::handle_transmit_file> callback. The transmit_file function transmits file data over a connected network connection. The function uses the operating system's cache manager to retrieve the file data. This function provides high-performance file data transfer over network connections. This function would be of great use in a Web Server, Image Server, etc.

Definition at line 1002 of file Asynch_IO.h.


Constructor & Destructor Documentation

ACE_Asynch_Transmit_File::ACE_Asynch_Transmit_File void   
 

A do nothing constructor.

Definition at line 839 of file Asynch_IO.cpp.

References ACE_Asynch_Connect::implementation_.

00840   : implementation_ (0)
00841 {
00842 }

ACE_Asynch_Transmit_File::~ACE_Asynch_Transmit_File void    [virtual]
 

Destructor.

Definition at line 844 of file Asynch_IO.cpp.

00845 {
00846 }


Member Function Documentation

void ACE_Asynch_Transmit_File::implementation ACE_Asynch_Transmit_File_Impl   [protected]
 

Set the implementation.

Definition at line 907 of file Asynch_IO.cpp.

References ACE_Asynch_Operation::implementation, and implementation_.

00908 {
00909   this->implementation_ = implementation;
00910   // Set the base class' implementation also.
00911   ACE_Asynch_Operation::implementation (this->implementation_);
00912 }

ACE_Asynch_Transmit_File_Impl * ACE_Asynch_Transmit_File::implementation void    const
 

Return the underlying implementation class.

Reimplemented from ACE_Asynch_Operation.

Definition at line 901 of file Asynch_IO.cpp.

References implementation_.

Referenced by open, ACE_Asynch_Transmit_File::Result::Result, and transmit_file.

00902 {
00903   return this->implementation_;
00904 }

int ACE_Asynch_Transmit_File::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.

Reimplemented from ACE_Asynch_Operation.

Definition at line 849 of file Asynch_IO.cpp.

References ACE_Proactor::create_asynch_transmit_file, ACE_Asynch_Operation::get_proactor, implementation, implementation_, and ACE_Asynch_Operation::open.

00853 {
00854   // Get a proactor for/from the user.
00855   proactor = this->get_proactor (proactor, handler);
00856 
00857   // Delete the old implementation.
00858   delete this->implementation_;
00859   this->implementation_ = 0;
00860 
00861   // Now let us get the implementation initialized.
00862   ACE_Asynch_Transmit_File_Impl *implementation = proactor->create_asynch_transmit_file ();
00863   if (implementation == 0)
00864     return -1;
00865   
00866   // Set the implementation class
00867   this->implementation (implementation);
00868   
00869   // Call the <open> method of the base class.
00870   return ACE_Asynch_Operation::open (handler,
00871                                      handle,
00872                                      completion_key,
00873                                      proactor);
00874 }

int ACE_Asynch_Transmit_File::transmit_file ACE_HANDLE    file,
Header_And_Trailer   header_and_trailer = 0,
size_t    bytes_to_write = 0,
u_long    offset = 0,
u_long    offset_high = 0,
size_t    bytes_per_send = 0,
u_long    flags = 0,
const void *    act = 0,
int    priority = 0,
int    signal_number = ACE_SIGRTMIN
 

This starts off an asynchronous transmit file. The <file> is a handle to an open file. <header_and_trailer> is a pointer to a data structure that contains pointers to data to send before and after the file data is sent. Set this parameter to 0 if you only want to transmit the file data. Upto <bytes_to_write> will be written to the <socket>. If you want to send the entire file, let <bytes_to_write> = 0. <bytes_per_send> is the size of each block of data sent per send operation. Please read the Win32 documentation on what the flags should be. 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 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.

Definition at line 877 of file Asynch_IO.cpp.

References implementation, and ACE_Asynch_Transmit_File_Impl::transmit_file.

00887 {
00888   return this->implementation ()->transmit_file (file,
00889                                                  header_and_trailer,
00890                                                  bytes_to_write,
00891                                                  offset,
00892                                                  offset_high,
00893                                                  bytes_per_send,
00894                                                  flags,
00895                                                  act,
00896                                                  priority,
00897                                                  signal_number);
00898 }


Member Data Documentation

ACE_Asynch_Transmit_File_Impl* ACE_Asynch_Transmit_File::implementation_ [protected]
 

The implementation class.

Reimplemented from ACE_Asynch_Operation.

Definition at line 1064 of file Asynch_IO.h.

Referenced by implementation, open, and ACE_Asynch_Transmit_File::Result::Result.


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