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

FILE_IO.h

Go to the documentation of this file.
00001 /* -*- C++ -*- */
00002 
00003 //=============================================================================
00004 /**
00005  *  @file    FILE_IO.h
00006  *
00007  *  $Id: FILE_IO.h,v 1.1.1.4 2003/02/21 18:36:32 chad Exp $
00008  *
00009  *  @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
00010  */
00011 //=============================================================================
00012 
00013 #ifndef ACE_FILE_IO_H
00014 #define ACE_FILE_IO_H
00015 #include "ace/pre.h"
00016 
00017 #include "ace/FILE.h"
00018 
00019 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00020 # pragma once
00021 #endif /* ACE_LACKS_PRAGMA_ONCE */
00022 
00023 #include "ace/FILE_Addr.h"
00024 
00025 // Used in the FILE_IO.h file...
00026 #include "ace/ACE.h"
00027 
00028 // Forward decl.
00029 class ACE_Message_Block;
00030 
00031 /**
00032  * @class ACE_FILE_IO
00033  *
00034  * @brief Read/Write operations on Files
00035  */
00036 class ACE_Export ACE_FILE_IO : public ACE_FILE
00037 {
00038 public:
00039   friend class ACE_FILE_Connector;
00040 
00041   // = Initialization method.
00042   /// Default constructor.
00043   ACE_FILE_IO (void);
00044 
00045   /// send upto <n> bytes in <buf>.
00046   ssize_t send (const void *buf, size_t n) const;
00047 
00048   /// Recv upto <n> bytes in <buf>.
00049   ssize_t recv (void *buf, size_t n) const;
00050 
00051   /// Send n bytes, keep trying until n are sent.
00052   ssize_t send_n (const void *buf, size_t n) const;
00053 
00054   /// Send all the <message_block>s chained through their <next> and
00055   /// <cont> pointers.  This call uses the underlying OS gather-write
00056   /// operation to reduce the domain-crossing penalty.
00057   ssize_t send_n (const ACE_Message_Block *message_block,
00058                   const ACE_Time_Value *timeout = 0,
00059                   size_t *bytes_transferred = 0);
00060 
00061   /// Recv n bytes, keep trying until n are received.
00062   ssize_t recv_n (void *buf, size_t n) const;
00063 
00064 #if defined (ACE_HAS_STREAM_PIPES)
00065   /// Send bytes via STREAM pipes.
00066   ssize_t send (const ACE_Str_Buf *cntl,
00067                 const ACE_Str_Buf *data,
00068                 int flags = 0) const;
00069 
00070   /// Recv bytes via STREAM pipes.
00071   ssize_t recv (ACE_Str_Buf *cntl,
00072                 ACE_Str_Buf *data,
00073                 int *flags) const;
00074 
00075   /// Send bytes via STREAM pipes using "band" mode.
00076   ssize_t send (const ACE_Str_Buf *cntl,
00077                 const ACE_Str_Buf *data,
00078                 int band,
00079                 int flags) const;
00080 
00081   /// Recv bytes via STREAM pipes using "band" mode.
00082   ssize_t recv (ACE_Str_Buf *cntl,
00083                 ACE_Str_Buf *data,
00084                 int *band,
00085                 int *flags) const;
00086 
00087 #endif /* ACE_HAS_STREAM_PIPES */
00088 
00089   /// Send iovecs via <::writev>.
00090   ssize_t send (const iovec iov[], int n) const;
00091 
00092   /// Recv iovecs via <::readv>.
00093   ssize_t recv (iovec iov[], int n) const;
00094 
00095   /**
00096    * Send N char *ptrs and int lengths.  Note that the char *'s
00097    * precede the ints (basically, an varargs version of writev).  The
00098    * count N is the *total* number of trailing arguments, *not* a
00099    * couple of the number of tuple pairs!
00100    */
00101   ssize_t send (size_t n, ...) const;
00102 
00103   /**
00104    * This is an interface to ::readv, that doesn't use the struct
00105    * iovec explicitly.  The ... can be passed as an arbitrary number
00106    * of (char *ptr, int len) tuples.  However, the count N is the
00107    * *total* number of trailing arguments, *not* a couple of the
00108    * number of tuple pairs!
00109    */
00110   ssize_t recv (size_t n, ...) const;
00111 
00112   /// Send <n> bytes via Win32 WriteFile using overlapped I/O.
00113   ssize_t send (const void *buf,
00114                 size_t n,
00115                 ACE_OVERLAPPED *overlapped) const;
00116 
00117   /// Recv <n> bytes via Win32 ReadFile using overlapped I/O.
00118   ssize_t recv (void *buf,
00119                 size_t n,
00120                 ACE_OVERLAPPED *overlapped) const;
00121 
00122   /// Send an <iovec> of size <n> to the file.
00123   ssize_t sendv (const iovec iov[],
00124                  int n) const;
00125 
00126   /**
00127    * Allows a client to read from a file without having to provide a
00128    * buffer to read.  This method determines how much data is in the
00129    * file, allocates a buffer of this size, reads in the data, and
00130    * returns the number of bytes read.  The caller is responsible for
00131    * deleting the member in the <iov_base> field of <io_vec> using
00132    * delete [] io_vec->iov_base.
00133    */
00134   ssize_t recvv (iovec *io_vec);
00135 
00136   /// Send an <iovec> of size <n> to the file.  Will block until all
00137   /// bytes are sent or an error occurs.
00138   ssize_t sendv_n (const iovec iov[],
00139                    int n) const;
00140 
00141   /// Receive an <iovec> of size <n> to the file.
00142   ssize_t recvv_n (iovec iov[],
00143                    int n) const;
00144 
00145   /// Dump the state of an object.
00146   void dump (void) const;
00147 
00148   /// Declare the dynamic allocation hooks.
00149   ACE_ALLOC_HOOK_DECLARE;
00150 
00151   // = Meta-type info
00152   typedef ACE_FILE_Addr PEER_ADDR;
00153 };
00154 
00155 #if !defined (ACE_LACKS_INLINE_FUNCTIONS)
00156 #include "ace/FILE_IO.i"
00157 #endif /* !defined (ACE_LACKS_INLINE_FUNCTIONS) */
00158 
00159 #include "ace/post.h"
00160 #endif /* ACE_FILE_IO_H */

Generated on Mon Jun 16 11:19:41 2003 for ACE by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002