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

ACE_IOStream Class Template Reference

A template adapter for creating an iostream-like object using an ACE IPC Stream for the actual I/O. Iostreams use an underlying streambuf object for the IO interface. The iostream class and derivatives provide you with a host of convenient operators that access the streambuf. More...

#include <IOStream_T.h>

Inheritance diagram for ACE_IOStream

Inheritance graph
[legend]
Collaboration diagram for ACE_IOStream:

Collaboration graph
[legend]
List of all members.

Public Methods

 ACE_IOStream (STREAM &stream, u_int streambuf_size = ACE_STREAMBUF_SIZE)
 ACE_IOStream (u_int streambuf_size = ACE_STREAMBUF_SIZE)
virtual ~ACE_IOStream (void)
 We have to get rid of the <streambuf_> ourselves since we gave it to the <iostream> base class;.

virtual int close (void)
 The only ambituity in the multiple inheritance is the <close> function.

int eof (void) const
 GETPUT_FUNC_SET (ACE_IOStream<STREAM>) virtual int ipfx0 (void)
virtual int ipfx1 (void)
virtual int ipfx (int need = 0)
virtual void isfx (void)
virtual int opfx (void)
virtual void osfx (void)
ACE_IOStream<STREAM>& operator>> (ACE_Time_Value *&tv)
 Allow the programmer to provide a timeout for read operations. Give it a pointer to NULL to block forever.


Protected Attributes

ACE_Streambuf_T<STREAM>* streambuf_
 This is where all of the action takes place. The streambuf_ is the interface to the underlying STREAM.


Private Methods

ssize_t send (...)
ssize_t recv (...)
ssize_t send_n (...)
ssize_t recv_n (...)

Detailed Description

template<class STREAM> template class ACE_IOStream

A template adapter for creating an iostream-like object using an ACE IPC Stream for the actual I/O. Iostreams use an underlying streambuf object for the IO interface. The iostream class and derivatives provide you with a host of convenient operators that access the streambuf.

We inherit all characteristics of iostream and your <STREAM> class. When you create a new class from this template, you can use it anywhere you would have used your original <STREAM> class. To create an iostream for your favorite ACE IPC class (e.g., ), feed that class to this template's <STREAM> parameter, e.g., typedef ACE_Svc_Handler Service_Handler; Because the operators in the iostream class are not virtual, you cannot easily provide overloads in your custom ACE_IOStream classes. To make these things work correctly, you need to overload ALL operators of the ACE_IOStream you create. I've attempted to do that here to make things easier for you but there are no guarantees. In the iostream.cpp file is an example of why it is necessary to overload all of the get/put operators when you want to customize only one or two.


Constructor & Destructor Documentation

template<classSTREAM>
ACE_IOStream< STREAM >::ACE_IOStream<STREAM> ( STREAM & stream,
u_int streambuf_size = ACE_STREAMBUF_SIZE )
 

template<classSTREAM>
ACE_IOStream<STREAM>::ACE_IOStream<STREAM> ( u_int streambuf_size = ACE_STREAMBUF_SIZE )
 

The default constructor. This will initiailze your STREAM and then setup the iostream baseclass to use a custom streambuf based on STREAM.

template<classSTREAM>
ACE_IOStream<STREAM>::~ACE_IOStream<STREAM> ( void ) [virtual]
 

We have to get rid of the <streambuf_> ourselves since we gave it to the <iostream> base class;.


Member Function Documentation

template<classSTREAM>
ACE_IOStream<STREAM>::GETPUT_FUNC_SET ( ACE_IOStream< STREAM > ) [inline]
 

template<classSTREAM>
int ACE_IOStream<STREAM>::close ( void ) [virtual]
 

The only ambituity in the multiple inheritance is the <close> function.

template<classSTREAM>
ACE_INLINE int ACE_IOStream< STREAM >::eof ( void ) const
 

Returns 1 if we're at the end of the <STREAM>, i.e., if the connection has closed down or an error has occurred, else 0. Under the covers, <eof> calls the streambuf's <timeout> function which will reset the timeout flag. As as result, you should save the return of <eof> and check it instead of calling <eof> successively.

template<classSTREAM>
int ACE_IOStream<STREAM>::ipfx ( int need = 0 ) [inline, virtual]
 

template<classSTREAM>
int ACE_IOStream<STREAM>::ipfx1 ( void ) [inline, virtual]
 

template<classSTREAM>
void ACE_IOStream<STREAM>::isfx ( void ) [inline, virtual]
 

template<classSTREAM>
ACE_IOStream< STREAM >& ACE_IOStream<STREAM>::operator>> ( ACE_Time_Value *& tv )
 

Allow the programmer to provide a timeout for read operations. Give it a pointer to NULL to block forever.

template<classSTREAM>
int ACE_IOStream<STREAM>::opfx ( void ) [inline, virtual]
 

template<classSTREAM>
void ACE_IOStream<STREAM>::osfx ( void ) [inline, virtual]
 

template<classSTREAM>
ssize_t ACE_IOStream<STREAM>::recv ( ... ) [private]
 

template<classSTREAM>
ssize_t ACE_IOStream<STREAM>::recv_n ( ... ) [private]
 

template<classSTREAM>
ssize_t ACE_IOStream<STREAM>::send ( ... ) [private]
 

template<classSTREAM>
ssize_t ACE_IOStream<STREAM>::send_n ( ... ) [private]
 


Member Data Documentation

template<classSTREAM>
ACE_Streambuf_T< STREAM >* ACE_IOStream<STREAM>::streambuf_ [protected]
 

This is where all of the action takes place. The streambuf_ is the interface to the underlying STREAM.


The documentation for this class was generated from the following files:
Generated at Fri Oct 5 07:02:29 2001 for ACE by doxygen1.2.3 written by Dimitri van Heesch, © 1997-2000