ACE_Streambuf_T< STREAM > Class Template Reference

#include <IOStream_T.h>

Inheritance diagram for ACE_Streambuf_T< STREAM >:

Inheritance graph
[legend]
Collaboration diagram for ACE_Streambuf_T< STREAM >:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 ACE_Streambuf_T (STREAM *peer, u_int streambuf_size=ACE_STREAMBUF_SIZE, int io_mode=ios::in|ios::out)
virtual ssize_t send (char *buf, ssize_t len)
virtual ssize_t recv (char *buf, ssize_t len, ACE_Time_Value *tv=0)
virtual ssize_t recv (char *buf, ssize_t len, int flags, ACE_Time_Value *tv=0)
virtual ssize_t recv_n (char *buf, ssize_t len, int flags=0, ACE_Time_Value *tv=0)

Protected Member Functions

virtual ACE_HANDLE get_handle (void)

Protected Attributes

STREAM * peer_
 This will be our ACE_SOCK_Stream or similar object.

template<class STREAM>
class ACE_Streambuf_T< STREAM >


Constructor & Destructor Documentation

template<class STREAM>
ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_Streambuf_T< STREAM >::ACE_Streambuf_T STREAM *  peer,
u_int  streambuf_size = ACE_STREAMBUF_SIZE,
int  io_mode = ios::in|ios::out
 

We will be given a STREAM by the iostream object which creates us. See the ACE_IOStream template for how that works. Like other streambuf objects, we can be input-only, output-only or both.

Definition at line 26 of file IOStream_T.cpp.

00029   : ACE_Streambuf (streambuf_size, io_mode),
00030     peer_ (peer)
00031 {
00032   // A streambuf allows for unbuffered IO where every character is
00033   // read as requested and written as provided.  To me, this seems
00034   // terribly inefficient for socket-type operations, so I've disabled
00035   // it.  All of the work would be done by the underflow/overflow
00036   // functions anyway and I haven't implemented anything there to
00037   // support unbuffered IO.
00038 
00039 #if !defined (ACE_LACKS_UNBUFFERED_STREAMBUF)
00040   this->unbuffered (0);
00041 #endif /* ! ACE_LACKS_UNBUFFERED_STREAMBUF */
00042 
00043   // Linebuffered is similar to unbuffered.  Again, I don't have any
00044   // need for this and I don't see the advantage.  I believe this
00045   // would have to be supported by underflow/overflow to be effective.
00046 #if !defined (ACE_LACKS_LINEBUFFERED_STREAMBUF)
00047   this->linebuffered (0);
00048 #endif /* ! ACE_LACKS_LINEBUFFERED_STREAMBUF */
00049 }


Member Function Documentation

template<class STREAM>
ACE_HANDLE ACE_Streambuf_T< STREAM >::get_handle void   )  [protected, virtual]
 

Reimplemented from ACE_Streambuf.

Definition at line 94 of file IOStream_T.cpp.

References ACE_Streambuf_T< STREAM >::peer_.

00095 {
00096   return peer_ ? peer_->get_handle () : 0;
00097 }

template<class STREAM>
ssize_t ACE_Streambuf_T< STREAM >::recv char *  buf,
ssize_t  len,
int  flags,
ACE_Time_Value tv = 0
[virtual]
 

Implements ACE_Streambuf.

Definition at line 66 of file IOStream_T.cpp.

References ESUCCESS, ETIME, ACE_Streambuf_T< STREAM >::peer_, and ssize_t.

00070 {
00071   this->timeout_ = 0;
00072   errno = ESUCCESS;
00073   ssize_t rval = peer_->recv (buf, len, flags, tv);
00074   if (errno == ETIME)
00075     this->timeout_ = 1;
00076   return rval;
00077 }

template<class STREAM>
ssize_t ACE_Streambuf_T< STREAM >::recv char *  buf,
ssize_t  len,
ACE_Time_Value tv = 0
[virtual]
 

Implements ACE_Streambuf.

Definition at line 58 of file IOStream_T.cpp.

References ssize_t.

00061 {
00062   return this->recv (buf, len, 0, tv);
00063 }

template<class STREAM>
ssize_t ACE_Streambuf_T< STREAM >::recv_n char *  buf,
ssize_t  len,
int  flags = 0,
ACE_Time_Value tv = 0
[virtual]
 

Implements ACE_Streambuf.

Definition at line 80 of file IOStream_T.cpp.

References ESUCCESS, ETIME, ACE_Streambuf_T< STREAM >::peer_, and ssize_t.

00084 {
00085   this->timeout_ = 0;
00086   errno = ESUCCESS;
00087   ssize_t rval = peer_->recv_n (buf, len, flags, tv);
00088   if (errno == ETIME)
00089     this->timeout_ = 1;
00090   return rval;
00091 }

template<class STREAM>
ssize_t ACE_Streambuf_T< STREAM >::send char *  buf,
ssize_t  len
[virtual]
 

Stream connections and "unconnected connections" (ie -- datagrams) need to work just a little differently. We derive custom Streambuf objects for them and provide these functions at that time.

Implements ACE_Streambuf.

Definition at line 52 of file IOStream_T.cpp.

References ACE_Streambuf_T< STREAM >::peer_, and ssize_t.

00053 {
00054   return peer_->send_n (buf,len);
00055 }


Member Data Documentation

template<class STREAM>
STREAM* ACE_Streambuf_T< STREAM >::peer_ [protected]
 

This will be our ACE_SOCK_Stream or similar object.

Definition at line 78 of file IOStream_T.h.

Referenced by ACE_Streambuf_T< STREAM >::get_handle(), ACE_Streambuf_T< STREAM >::recv(), ACE_Streambuf_T< STREAM >::recv_n(), and ACE_Streambuf_T< STREAM >::send().


The documentation for this class was generated from the following files:
Generated on Thu Nov 9 11:30:24 2006 for ACE by doxygen 1.3.6