#include <IOStream_T.h>
Collaboration diagram for ACE_IOStream:

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;. More... | |
| virtual int | close (void) |
| The only ambituity in the multiple inheritance is the <close> function. More... | |
| int | eof (void) const |
| 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. More... | |
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. More... | |
Private Methods | |
| ssize_t | send (...) |
| ssize_t | recv (...) |
| ssize_t | send_n (...) |
| ssize_t | recv_n (...) |
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., <ACE_SOCK_Stream>), feed that class to this template's <STREAM> parameter, e.g., typedef ACE_Svc_Handler<ACE_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 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.
Definition at line 105 of file IOStream_T.h.
|
||||||||||||||||
|
Definition at line 69 of file IOStream_T.cpp. References ACE_NEW, and streambuf_.
00071 : iostream (0),
00072 STREAM (stream)
00073 {
00074 ACE_NEW (streambuf_,
00075 ACE_Streambuf_T<STREAM> ((STREAM *) this,
00076 streambuf_size));
00077 iostream::init (this->streambuf_);
00078 }
|
|
||||||||||
|
The default constructor. This will initiailze your STREAM and then setup the iostream baseclass to use a custom streambuf based on STREAM. Definition at line 81 of file IOStream_T.cpp. References ACE_NEW.
00082 : iostream (0)
00083 {
00084 ACE_NEW (this->streambuf_,
00085 ACE_Streambuf_T<STREAM> ((STREAM *) this,
00086 streambuf_size));
00087 iostream::init (this->streambuf_);
00088 }
|
|
||||||||||
|
We have to get rid of the <streambuf_> ourselves since we gave it to the <iostream> base class;.
Definition at line 94 of file IOStream_T.cpp. References streambuf_.
00095 {
00096 delete this->streambuf_;
00097 }
|
|
||||||||||
|
The only ambituity in the multiple inheritance is the <close> function.
Definition at line 103 of file IOStream_T.cpp.
00104 {
00105 return STREAM::close ();
00106 }
|
|
||||||||||
|
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. Definition at line 53 of file IOStream_T.i. References streambuf_.
00054 {
00055 // Get the timeout value of the streambuf
00056 ACE_Time_Value *timeout = this->streambuf_->recv_timeout (0);
00057
00058 // Reset the timeout value of the streambuf.
00059 (void) this->streambuf_->recv_timeout (timeout);
00060
00061 char c;
00062 int rval = this->streambuf_->recv_n (&c,
00063 sizeof c,
00064 MSG_PEEK,
00065 timeout);
00066
00067 // Timeout, not an eof
00068 if (this->streambuf_->timeout())
00069 return 0;
00070
00071 // No timeout, got enough data: not eof
00072 if (rval == sizeof(char))
00073 return 0;
00074
00075 // No timeout, not enough data: definately eof
00076 return 1;
00077 }
|
|
||||||||||
|
Definition at line 208 of file IOStream_T.h.
00208 { return iostream::ipfx (need); }
|
|
||||||||||
|
Definition at line 205 of file IOStream_T.h.
00205 { return iostream::ipfx (0); }
|
|
||||||||||
|
Definition at line 206 of file IOStream_T.h.
00206 { return iostream::ipfx (1); }
|
|
||||||||||
|
Definition at line 209 of file IOStream_T.h.
00209 { iostream::isfx (); }
|
|
||||||||||
|
Allow the programmer to provide a timeout for read operations. Give it a pointer to NULL to block forever.
Definition at line 109 of file IOStream_T.cpp. References streambuf_.
00110 {
00111 ACE_Time_Value *old_tv = this->streambuf_->recv_timeout (tv);
00112 tv = old_tv;
00113 return *this;
00114 }
|
|
||||||||||
|
Definition at line 210 of file IOStream_T.h.
00210 { return iostream::opfx (); }
|
|
||||||||||
|
Definition at line 211 of file IOStream_T.h.
00211 { iostream::osfx (); }
|
|
||||||||||
|
|
|
||||||||||
|
|
|
||||||||||
|
|
|
||||||||||
|
|
|
|||||
|
This is where all of the action takes place. The streambuf_ is the interface to the underlying STREAM.
Definition at line 221 of file IOStream_T.h. Referenced by ACE_IOStream, eof, operator>>, and ~ACE_IOStream. |
1.2.14 written by Dimitri van Heesch,
© 1997-2002