#include <FILE_IO.h>
Inheritance diagram for ACE_FILE_IO:


Public Types | |
| typedef ACE_FILE_Addr | PEER_ADDR | 
Public Member Functions | |
| ACE_FILE_IO (void) | |
| Default constructor.   | |
| ssize_t | send (const void *buf, size_t n) const | 
| send upto n bytes in buf.   | |
| ssize_t | recv (void *buf, size_t n) const | 
| Recv upto n bytes in buf.   | |
| ssize_t | send_n (const void *buf, size_t n) const | 
| Send n bytes, keep trying until n are sent.   | |
| ssize_t | send_n (const ACE_Message_Block *message_block, const ACE_Time_Value *timeout=0, size_t *bytes_transferred=0) | 
| ssize_t | recv_n (void *buf, size_t n) const | 
| Recv n bytes, keep trying until n are received.   | |
| ssize_t | send (const iovec iov[], int n) const | 
| Send iovecs via <::writev>.   | |
| ssize_t | recv (iovec iov[], int n) const | 
| Recv iovecs via <::readv>.   | |
| ssize_t | send (size_t n,...) const | 
| ssize_t | recv (size_t n,...) const | 
| ssize_t | send (const void *buf, size_t n, ACE_OVERLAPPED *overlapped) const | 
| Send n bytes via Win32 WriteFile using overlapped I/O.   | |
| ssize_t | recv (void *buf, size_t n, ACE_OVERLAPPED *overlapped) const | 
| Recv n bytes via Win32 ReadFile using overlapped I/O.   | |
| ssize_t | sendv (const iovec iov[], int n) const | 
| Send an  of size n to the file.   | |
| ssize_t | recvv (iovec *io_vec) | 
| ssize_t | sendv_n (const iovec iov[], int n) const | 
| ssize_t | recvv_n (iovec iov[], int n) const | 
| Receive an  of size n to the file.   | |
| void | dump (void) const | 
| Dump the state of an object.   | |
Public Attributes | |
| ACE_ALLOC_HOOK_DECLARE | |
| Declare the dynamic allocation hooks.   | |
Friends | |
| class | ACE_FILE_Connector | 
Definition at line 44 of file FILE_IO.h.
      
  | 
  
| 
 
  | 
  
      
  | 
  
| 
 Default constructor. 
 Definition at line 34 of file FILE_IO.cpp. References ACE_TRACE. 
 00035 {
00036   ACE_TRACE ("ACE_FILE_IO::ACE_FILE_IO");
00037 }
 | 
  
      
  | 
  
| 
 Dump the state of an object. 
 Reimplemented from ACE_FILE. Definition at line 21 of file FILE_IO.cpp. References ACE_BEGIN_DUMP, ACE_DEBUG, ACE_END_DUMP, ACE_TRACE, ACE_FILE_Addr::dump(), and LM_DEBUG. 
  | 
  
      
  | 
  ||||||||||||||||
| 
 Recv n bytes via Win32 ReadFile using overlapped I/O. 
  | 
  
      
  | 
  ||||||||||||
| 
 This is an interface to ::readv, that doesn't use the struct iovec explicitly. The ... can be passed as an arbitrary number of (char *ptr, int len) tuples. However, the count N is the *total* number of trailing arguments, *not* a couple of the number of tuple pairs! Definition at line 84 of file FILE_IO.cpp. References ACE_NEW_RETURN, ACE_TRACE, ACE_OS::readv(), and ssize_t. 
 00085 {
00086   ACE_TRACE ("ACE_FILE_IO::recv");
00087   va_list argp;
00088   int total_tuples = ACE_Utils::truncate_cast<int> (n / 2);
00089   iovec *iovp = 0;
00090 #if defined (ACE_HAS_ALLOCA)
00091   iovp = (iovec *) alloca (total_tuples * sizeof (iovec));
00092 #else
00093   ACE_NEW_RETURN (iovp,
00094                   iovec[total_tuples],
00095                   -1);
00096 #endif /* !defined (ACE_HAS_ALLOCA) */
00097 
00098   va_start (argp, n);
00099 
00100   for (int i = 0; i < total_tuples; i++)
00101     {
00102       iovp[i].iov_base = va_arg (argp, char *);
00103       iovp[i].iov_len  = va_arg (argp, int);
00104     }
00105 
00106   ssize_t const result = ACE_OS::readv (this->get_handle (),
00107                                         iovp,
00108                                         total_tuples);
00109 #if !defined (ACE_HAS_ALLOCA)
00110   delete [] iovp;
00111 #endif /* !defined (ACE_HAS_ALLOCA) */
00112   va_end (argp);
00113   return result;
00114 }
 | 
  
      
  | 
  ||||||||||||
| 
 Recv iovecs via <::readv>. 
 Definition at line 96 of file FILE_IO.inl. References ACE_TRACE, and ACE_OS::readv(). 
 00097 {
00098   ACE_TRACE ("ACE_FILE_IO::recv");
00099   return ACE_OS::readv (this->get_handle (), iov, n);
00100 }
 | 
  
      
  | 
  ||||||||||||
| 
 Recv upto n bytes in buf. 
 Definition at line 82 of file FILE_IO.inl. References ACE_TRACE, and ACE_OS::read(). 
 00083 {
00084   ACE_TRACE ("ACE_FILE_IO::recv");
00085   return ACE_OS::read (this->get_handle (), buf, n);
00086 }
 | 
  
      
  | 
  ||||||||||||
| 
 Recv n bytes, keep trying until n are received. 
 Definition at line 68 of file FILE_IO.inl. References ACE_TRACE, and ACE::read_n(). Referenced by recvv(). 
 00069 {
00070   ACE_TRACE ("ACE_FILE_IO::recv_n");
00071   return ACE::read_n (this->get_handle (), buf, n);
00072 }
 | 
  
      
  | 
  
| 
 Allows a client to read from a file without having to provide a buffer to read. This method determines how much data is in the file, allocates a buffer of this size, reads in the data, and returns the number of bytes read. The caller is responsible for deleting the member in the field of using delete [] io_vec->iov_base. Definition at line 122 of file FILE_IO.cpp. References ACE_NEW_RETURN, ACE_TRACE, ACE_OS::filesize(), and recv_n(). 
 00123 {
00124   ACE_TRACE ("ACE_FILE_IO::recvv");
00125 
00126   io_vec->iov_base = 0;
00127   size_t const length = static_cast <size_t> (ACE_OS::filesize (this->get_handle ()));
00128 
00129   if (length > 0)
00130     {
00131       ACE_NEW_RETURN (io_vec->iov_base,
00132                       char[length],
00133                       -1);
00134       io_vec->iov_len = this->recv_n (io_vec->iov_base,
00135                                       length);
00136       return io_vec->iov_len;
00137     }
00138   else
00139     return length;
00140 }
 | 
  
      
  | 
  ||||||||||||
| 
 Receive an of size n to the file. 
 Definition at line 35 of file FILE_IO.inl. References ACE_TRACE, and ACE_OS::readv(). 
 00036 {
00037   ACE_TRACE ("ACE_FILE_IO::recvv_n");
00038   // @@ Carlos, can you please update this to call the
00039   // new ACE::recvv_n() method that you write?
00040   return ACE_OS::readv (this->get_handle (),
00041                         iov,
00042                         n);
00043 }
 | 
  
      
  | 
  ||||||||||||||||
| 
 Send n bytes via Win32 WriteFile using overlapped I/O. 
  | 
  
      
  | 
  ||||||||||||
| 
 Send N char *ptrs and int lengths. Note that the char *'s precede the ints (basically, an varargs version of writev). The count N is the *total* number of trailing arguments, *not* a couple of the number of tuple pairs! Definition at line 45 of file FILE_IO.cpp. References ACE_NEW_RETURN, ACE_TRACE, ssize_t, and ACE_OS::writev(). 
 00046 {
00047   ACE_TRACE ("ACE_FILE_IO::send");
00048   va_list argp;
00049   int total_tuples = ACE_Utils::truncate_cast<int> (n / 2);
00050   iovec *iovp = 0;
00051 #if defined (ACE_HAS_ALLOCA)
00052   iovp = (iovec *) alloca (total_tuples * sizeof (iovec));
00053 #else
00054   ACE_NEW_RETURN (iovp,
00055                   iovec[total_tuples],
00056                   -1);
00057 #endif /* !defined (ACE_HAS_ALLOCA) */
00058 
00059   va_start (argp, n);
00060 
00061   for (int i = 0; i < total_tuples; i++)
00062     {
00063       iovp[i].iov_base = va_arg (argp, char *);
00064       iovp[i].iov_len  = va_arg (argp, int);
00065     }
00066 
00067   ssize_t result = ACE_OS::writev (this->get_handle (),
00068                                    iovp,
00069                                    total_tuples);
00070 #if !defined (ACE_HAS_ALLOCA)
00071   delete [] iovp;
00072 #endif /* !defined (ACE_HAS_ALLOCA) */
00073   va_end (argp);
00074   return result;
00075 }
 | 
  
      
  | 
  ||||||||||||
| 
 Send iovecs via <::writev>. 
 Definition at line 89 of file FILE_IO.inl. References ACE_TRACE, and ACE_OS::writev(). 
 00090 {
00091   ACE_TRACE ("ACE_FILE_IO::send");
00092   return ACE_OS::writev (this->get_handle (), iov, n);
00093 }
 | 
  
      
  | 
  ||||||||||||
| 
 send upto n bytes in buf. 
 Definition at line 75 of file FILE_IO.inl. References ACE_TRACE, and ACE_OS::write(). 
 00076 {
00077   ACE_TRACE ("ACE_FILE_IO::send");
00078   return ACE_OS::write (this->get_handle (), buf, n);
00079 }
 | 
  
      
  | 
  ||||||||||||||||
| 
 Send all the s chained through their and pointers. This call uses the underlying OS gather-write operation to reduce the domain-crossing penalty. Definition at line 21 of file FILE_IO.inl. References ACE_TRACE, and ACE::write_n(). 
 00024 {
00025   ACE_TRACE ("ACE_FILE_IO::send_n");
00026   ACE_UNUSED_ARG (timeout);
00027   return ACE::write_n (this->get_handle (),
00028                       message_block,
00029                       bytes_transferred);
00030 }
 | 
  
      
  | 
  ||||||||||||
| 
 Send n bytes, keep trying until n are sent. 
 Definition at line 58 of file FILE_IO.inl. References ACE_TRACE, and ACE::write_n(). 
 00059 {
00060   ACE_TRACE ("ACE_FILE_IO::send_n");
00061   return ACE::write_n (this->get_handle (), buf, n);
00062 }
 | 
  
      
  | 
  ||||||||||||
| 
 Send an of size n to the file. 
 Definition at line 48 of file FILE_IO.inl. References ACE_TRACE, and ACE_OS::writev(). 
 00049 {
00050   ACE_TRACE ("ACE_FILE_IO::sendv");
00051   return ACE_OS::writev (this->get_handle (), iov, n);
00052 }
 | 
  
      
  | 
  ||||||||||||
| 
 Send an of size n to the file. Will block until all bytes are sent or an error occurs. Definition at line 12 of file FILE_IO.inl. References ACE_TRACE, and ACE::writev_n(). 
 00013 {
00014   ACE_TRACE ("ACE_FILE_IO::sendv_n");
00015   return ACE::writev_n (this->get_handle (),
00016                         iov,
00017                         n);
00018 }
 | 
  
      
  | 
  
| 
 
  | 
  
      
  | 
  
| 
 Declare the dynamic allocation hooks. 
 Reimplemented from ACE_FILE.  | 
  
 
1.3.6