#include <ace/IOStream_T.h>
template<class STREAM> class ACE_IOStream_T : public iostream, public STREAM {
public:
ACE_IOStream_T ( STREAM &stream, u_int streambuf_size = ACE_STREAMBUF_SIZE );
ACE_IOStream_T (u_int streambuf_size = ACE_STREAMBUF_SIZE);
virtual ~ACE_IOStream_T (void);
virtual int close (void);
virtual ACE_IOStream_T<STREAM> &operator>> ( ACE_IOStream_String &v );
virtual ACE_IOStream_T<STREAM> &operator<< ( ACE_IOStream_String &v );
inline GETPUT_FUNC_SET (ACE_IOStream_T<STREAM>);
inline virtual int ipfx (int /* need */ = 0);
inline virtual int ipfx0(void);
inline virtual int ipfx1(void);
inline virtual void isfx (void);
inline virtual int opfx (void);
inline virtual void osfx (void);
inline virtual int ipfx0(void);
inline virtual int ipfx1(void);
inline virtual int ipfx0(void);
inline virtual int ipfx1(void);
inline virtual int ipfx (int need = 0);
inline virtual void isfx (void);
inline virtual int opfx (void);
inline virtual void osfx (void);
ACE_IOStream_T<STREAM> & operator>>(ACE_Time_Value *&tv);
protected:
ACE_Streambuf_T<STREAM> *streambuf_;
private:
ssize_t send (...);
ssize_t recv (...);
ssize_t send_n (...);
ssize_t recv_n (...);
};
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.,
ACE_SOCK_Stream
), feed that class to this template's
STREAM
parameter, e.g.,
typedef ACE_Svc_HandlerACE_SOCK_iostream,
ACE_INET_Addr, ACE_NULL_SYNCH
Service_Handler;
Because the operators in the iostream class are not virtual, you cannot easily provide overloads in your custom ACE_IOStream_T classes. To make these things work correctly, you need to overload ALL operators of the ACE_IOStream_T 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.
inline GETPUT_FUNC_SET (ACE_IOStream_T<STREAM>);
inline virtual int ipfx (int /* need */ = 0);
inline virtual int ipfx0(void);
inline virtual int ipfx1(void);
inline virtual void isfx (void);
inline virtual int opfx (void);
inline virtual void osfx (void);
inline virtual int ipfx0(void);
inline virtual int ipfx1(void);
inline virtual int ipfx0(void);
inline virtual int ipfx1(void);
inline virtual int ipfx (int need = 0);
inline virtual void isfx (void);
inline virtual int opfx (void);
inline virtual void osfx (void);
ACE_IOStream_T<STREAM> & operator>>(ACE_Time_Value *&tv);
ssize_t send (...);
ssize_t recv (...);
ssize_t send_n (...);
ssize_t recv_n (...);
jcej@lads.com
and Jim Crossley jim@lads.com