#include <IOStream_T.h>
Public Member Functions | |
ACE_IOStream (STREAM &stream, u_int streambuf_size=ACE_STREAMBUF_SIZE) | |
ACE_IOStream (u_int streambuf_size=ACE_STREAMBUF_SIZE) | |
virtual | ~ACE_IOStream (void) |
virtual int | close (void) |
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) |
Protected Attributes | |
ACE_Streambuf_T< STREAM > * | streambuf_ |
Private Member Functions | |
ssize_t | send (...) |
ssize_t | recv (...) |
ssize_t | send_n (...) |
ssize_t | recv_n (...) |
We inherit all characteristics of iostream and your class. When you create a new class from this template, you can use it anywhere you would have used your original class. To create an iostream for your favorite ACE IPC class (e.g., ), feed that class to this template's 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 111 of file IOStream_T.h.
|
Definition at line 104 of file IOStream_T.cpp. References ACE_NEW, and ACE_IOStream< STREAM >::streambuf_.
00106 : iostream (0), 00107 STREAM (stream) 00108 { 00109 ACE_NEW (streambuf_, 00110 ACE_Streambuf_T<STREAM> ((STREAM *) this, 00111 streambuf_size)); 00112 iostream::init (this->streambuf_); 00113 } |
|
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 116 of file IOStream_T.cpp. References ACE_NEW.
00117 : iostream (0) 00118 { 00119 ACE_NEW (this->streambuf_, 00120 ACE_Streambuf_T<STREAM> ((STREAM *) this, 00121 streambuf_size)); 00122 iostream::init (this->streambuf_); 00123 } |
|
We have to get rid of the ourselves since we gave it to the base class; Definition at line 129 of file IOStream_T.cpp. References ACE_IOStream< STREAM >::streambuf_.
00130 { 00131 delete this->streambuf_; 00132 } |
|
The only ambituity in the multiple inheritance is the function. Definition at line 138 of file IOStream_T.cpp.
00139 {
00140 return STREAM::close ();
00141 }
|
|
Returns 1 if we're at the end of the , i.e., if the connection has closed down or an error has occurred, else 0. Under the covers, calls the streambuf's function which will reset the timeout flag. As as result, you should save the return of and check it instead of calling successively. Definition at line 12 of file IOStream_T.inl. References ACE_IOStream< STREAM >::streambuf_.
00013 { 00014 // Get the timeout value of the streambuf 00015 ACE_Time_Value *timeout = this->streambuf_->recv_timeout (0); 00016 00017 // Reset the timeout value of the streambuf. 00018 (void) this->streambuf_->recv_timeout (timeout); 00019 00020 char c; 00021 int rval = this->streambuf_->recv_n (&c, 00022 sizeof c, 00023 MSG_PEEK, 00024 timeout); 00025 00026 // Timeout, not an eof 00027 if (this->streambuf_->timeout()) 00028 return 0; 00029 00030 // No timeout, got enough data: not eof 00031 if (rval == sizeof(char)) 00032 return 0; 00033 00034 // No timeout, not enough data: definately eof 00035 return 1; 00036 } |
|
Definition at line 214 of file IOStream_T.h.
00214 { return iostream::ipfx (need); }
|
|
Definition at line 211 of file IOStream_T.h.
00211 { return iostream::ipfx (0); }
|
|
Definition at line 212 of file IOStream_T.h.
00212 { return iostream::ipfx (1); }
|
|
Definition at line 215 of file IOStream_T.h.
00215 { iostream::isfx (); } |
|
Allow the programmer to provide a timeout for read operations. Give it a pointer to NULL to block forever. Definition at line 144 of file IOStream_T.cpp. References ACE_IOStream< STREAM >::streambuf_.
00145 { 00146 ACE_Time_Value *old_tv = this->streambuf_->recv_timeout (tv); 00147 tv = old_tv; 00148 return *this; 00149 } |
|
Definition at line 216 of file IOStream_T.h.
00216 { return iostream::opfx (); }
|
|
Definition at line 217 of file IOStream_T.h.
00217 { iostream::osfx (); } |
|
|
|
|
|
|
|
|
|
This is where all of the action takes place. The streambuf_ is the interface to the underlying STREAM. Definition at line 227 of file IOStream_T.h. Referenced by ACE_IOStream< STREAM >::ACE_IOStream(), ACE_IOStream< STREAM >::eof(), ACE_IOStream< STREAM >::operator>>(), and ACE_IOStream< STREAM >::~ACE_IOStream(). |