Pipe.inl

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 //
00003 // Pipe.inl,v 4.6 2006/03/06 15:42:40 jwillemsen Exp
00004 
00005 #include "ace/Global_Macros.h"
00006 #include "ace/ACE.h"
00007 
00008 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
00009 
00010 ACE_INLINE
00011 ACE_Pipe::~ACE_Pipe (void)
00012 {
00013   ACE_TRACE ("ACE_Pipe::~ACE_Pipe");
00014   // Notice that the destructor doesn't close the handles for you.
00015 }
00016 
00017 ACE_INLINE ACE_HANDLE
00018 ACE_Pipe::read_handle (void) const
00019 {
00020   ACE_TRACE ("ACE_Pipe::read_handle");
00021   return this->handles_[0];
00022 }
00023 
00024 ACE_INLINE ACE_HANDLE
00025 ACE_Pipe::write_handle (void) const
00026 {
00027   ACE_TRACE ("ACE_Pipe::write_handle");
00028   return this->handles_[1];
00029 }
00030 
00031 ACE_INLINE ssize_t
00032 ACE_Pipe::sendv_n (const iovec iov[], int n) const
00033 {
00034   ACE_TRACE ("ACE_Pipe::sendv_n");
00035 #if defined (ACE_WIN32)
00036   return ACE::sendv_n (this->write_handle (),
00037                       iov,
00038                       n);
00039 #else
00040   return ACE::writev_n (this->write_handle (),
00041                         iov,
00042                         n);
00043 #endif /* ACE_WIN32 */
00044 }
00045 
00046 ACE_INLINE ssize_t
00047 ACE_Pipe::send_n (const ACE_Message_Block *message_block,
00048                   const ACE_Time_Value *timeout,
00049                   size_t *bytes_transferred)
00050 {
00051   ACE_TRACE ("ACE_Pipe::send_n");
00052 #if defined (ACE_WIN32)
00053   return ACE::send_n (this->write_handle (),
00054                       message_block,
00055                       timeout,
00056                       bytes_transferred);
00057 #else
00058   ACE_UNUSED_ARG (timeout);
00059   return ACE::write_n (this->write_handle (),
00060                       message_block,
00061                       bytes_transferred);
00062 #endif /* ACE_WIN32 */
00063 }
00064 
00065 // Recv an n byte message from the file.
00066 
00067 ACE_INLINE ssize_t
00068 ACE_Pipe::recvv_n (iovec iov[], int n) const
00069 {
00070   ACE_TRACE ("ACE_Pipe::recvv_n");
00071   // @@ Carlos, can you please update this to call the
00072   // new ACE::recvv_n() method that you write?
00073 #if defined (ACE_WIN32)
00074   return ACE_OS::sendv (this->read_handle (),
00075                         iov,
00076                         n);
00077 #else
00078   return ACE_OS::readv (this->read_handle (),
00079                         iov,
00080                         n);
00081 #endif /* ACE_WIN32 */
00082 }
00083 
00084 // Send an <iovec> of size <n> to the file.
00085 
00086 ACE_INLINE ssize_t
00087 ACE_Pipe::sendv (const iovec iov[], int n) const
00088 {
00089   ACE_TRACE ("ACE_Pipe::sendv");
00090 #if defined (ACE_WIN32)
00091   return ACE_OS::sendv (this->write_handle (), iov, n);
00092 #else
00093   return ACE_OS::writev (this->write_handle (), iov, n);
00094 #endif /* ACE_WIN32 */
00095 }
00096 
00097 // Send exactly N bytes from BUF to this file.  Keeping trying until
00098 // this many bytes are sent.
00099 
00100 ACE_INLINE ssize_t
00101 ACE_Pipe::send_n (const void *buf, size_t n) const
00102 {
00103   ACE_TRACE ("ACE_Pipe::send_n");
00104 #if defined (ACE_WIN32)
00105   return ACE::send_n (this->write_handle (), buf, n);
00106 #else
00107   return ACE::write_n (this->write_handle (), buf, n);
00108 #endif /* ACE_WIN32 */
00109 }
00110 
00111 // Receive exactly N bytes from this file into BUF.  Keep trying until
00112 // this many bytes are received.
00113 
00114 ACE_INLINE ssize_t
00115 ACE_Pipe::recv_n (void *buf, size_t n) const
00116 {
00117   ACE_TRACE ("ACE_Pipe::recv_n");
00118 #if defined (ACE_WIN32)
00119   return ACE::recv_n (this->read_handle (), buf, n);
00120 #else
00121   return ACE::read_n (this->read_handle (), buf, n);
00122 #endif /* ACE_WIN32 */
00123 }
00124 
00125 ACE_INLINE ssize_t
00126 ACE_Pipe::send (const void *buf, size_t n) const
00127 {
00128   ACE_TRACE ("ACE_Pipe::send");
00129 #if defined (ACE_WIN32)
00130   return ACE_OS::send (this->write_handle (), static_cast <const char *> (buf), n);
00131 #else
00132   return ACE_OS::write (this->write_handle (), static_cast <const char *> (buf), n);
00133 #endif /* ACE_WIN32 */
00134 }
00135 
00136 ACE_INLINE ssize_t
00137 ACE_Pipe::recv (void *buf, size_t n) const
00138 {
00139   ACE_TRACE ("ACE_Pipe::recv");
00140 #if defined (ACE_WIN32)
00141   return ACE_OS::recv (this->read_handle (), static_cast <char *> (buf), n);
00142 #else
00143   return ACE_OS::read (this->read_handle (), static_cast <char *> (buf), n);
00144 #endif /* ACE_WIN32 */
00145 }
00146 
00147 ACE_INLINE ssize_t
00148 ACE_Pipe::send (const iovec iov[], int n) const
00149 {
00150   ACE_TRACE ("ACE_Pipe::send");
00151 #if defined (ACE_WIN32)
00152   return ACE_OS::sendv (this->write_handle (), iov, n);
00153 #else
00154   return ACE_OS::writev (this->write_handle (), iov, n);
00155 #endif /* ACE_WIN32 */
00156 }
00157 
00158 ACE_INLINE ssize_t
00159 ACE_Pipe::recv (iovec iov[], int n) const
00160 {
00161   ACE_TRACE ("ACE_Pipe::recv");
00162 #if defined (ACE_WIN32)
00163   return ACE_OS::recvv (this->read_handle (), iov, n);
00164 #else
00165   return ACE_OS::readv (this->read_handle (), iov, n);
00166 #endif /* ACE_WIN32 */
00167 }
00168 
00169 ACE_INLINE ssize_t
00170 ACE_Pipe::send (const void *buf, size_t n,
00171                 ACE_OVERLAPPED *overlapped) const
00172 {
00173   ACE_TRACE ("ACE_Pipe::send");
00174   return ACE_OS::write (this->write_handle (),
00175                         static_cast <const char *> (buf), n,
00176                         overlapped);
00177 }
00178 
00179 ACE_INLINE ssize_t
00180 ACE_Pipe::recv (void *buf, size_t n,
00181                 ACE_OVERLAPPED *overlapped) const
00182 {
00183   ACE_TRACE ("ACE_Pipe::recv");
00184   return ACE_OS::read (this->read_handle (), static_cast <char *> (buf), n,
00185                        overlapped);
00186 }
00187 
00188 ACE_END_VERSIONED_NAMESPACE_DECL

Generated on Thu Nov 9 09:41:59 2006 for ACE by doxygen 1.3.6