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

ACE_Streambuf_T Class Template Reference

#include <IOStream_T.h>

Inheritance diagram for ACE_Streambuf_T:

Inheritance graph
[legend]
Collaboration diagram for ACE_Streambuf_T:

Collaboration graph
[legend]
List of all members.

Public Methods

 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=NULL)
virtual ssize_t recv (char *buf, ssize_t len, int flags, ACE_Time_Value *tv=NULL)
virtual ssize_t recv_n (char *buf, ssize_t len, int flags=0, ACE_Time_Value *tv=NULL)

Protected Methods

virtual ACE_HANDLE get_handle (void)

Protected Attributes

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

template<class STREAM>
class ACE_Streambuf_T< STREAM >


Constructor & Destructor Documentation

template<class STREAM>
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 39 of file IOStream_T.cpp.

00042   : ACE_Streambuf (streambuf_size, io_mode),
00043     peer_ (peer)
00044 {
00045   // A streambuf allows for unbuffered IO where every character is
00046   // read as requested and written as provided.  To me, this seems
00047   // terribly inefficient for socket-type operations, so I've disabled
00048   // it.  All of the work would be done by the underflow/overflow
00049   // functions anyway and I haven't implemented anything there to
00050   // support unbuffered IO.
00051 
00052 #if !defined (ACE_LACKS_UNBUFFERED_STREAMBUF)
00053   this->unbuffered (0);
00054 #endif /* ! ACE_LACKS_UNBUFFERED_STREAMBUF */
00055 
00056   // Linebuffered is similar to unbuffered.  Again, I don't have any
00057   // need for this and I don't see the advantage.  I believe this
00058   // would have to be supported by underflow/overflow to be effective.
00059 #if !defined (ACE_LACKS_LINEBUFFERED_STREAMBUF)
00060   this->linebuffered (0);
00061 #endif /* ! ACE_LACKS_LINEBUFFERED_STREAMBUF */
00062 }


Member Function Documentation

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

Reimplemented from ACE_Streambuf.

Definition at line 47 of file IOStream_T.i.

References peer_.

00048 {
00049   return peer_ ? peer_->get_handle () : 0;
00050 }

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

Implements ACE_Streambuf.

Definition at line 19 of file IOStream_T.i.

References ESUCCESS, ETIME, peer_, ssize_t, and ACE_Streambuf::timeout_.

00023 {
00024   this->timeout_ = 0;
00025   errno = ESUCCESS;
00026   ssize_t rval = peer_->recv (buf, len, flags, tv);
00027   if (errno == ETIME)
00028     this->timeout_ = 1;
00029   return rval;
00030 }

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

Implements ACE_Streambuf.

Definition at line 11 of file IOStream_T.i.

References ssize_t.

00014 {
00015   return this->recv (buf, len, 0, tv);
00016 }

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

Implements ACE_Streambuf.

Definition at line 33 of file IOStream_T.i.

References ESUCCESS, ETIME, peer_, ssize_t, and ACE_Streambuf::timeout_.

00037 {
00038   this->timeout_ = 0;
00039   errno = ESUCCESS;
00040   ssize_t rval = peer_->recv_n (buf, len, flags, tv);
00041   if (errno == ETIME)
00042     this->timeout_ = 1;
00043   return rval;
00044 }

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 5 of file IOStream_T.i.

References peer_, and ssize_t.

00006 {
00007   return peer_->send_n (buf,len);
00008 }


Member Data Documentation

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

This will be our ACE_SOCK_Stream or similar object.

Definition at line 72 of file IOStream_T.h.

Referenced by get_handle, recv, recv_n, and send.


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