#include <FIFO_Recv_Msg.h>
Inheritance diagram for ACE_FIFO_Recv_Msg:


Public Member Functions | |
| ACE_FIFO_Recv_Msg (void) | |
| Default constructor. | |
| ACE_FIFO_Recv_Msg (const ACE_TCHAR *rendezvous, int flags=O_CREAT|O_RDONLY, mode_t perms=ACE_DEFAULT_FILE_PERMS, int persistent=1, LPSECURITY_ATTRIBUTES sa=0) | |
| Open up a record-oriented named pipe for reading. | |
| int | open (const ACE_TCHAR *rendezvous, int flags=O_CREAT|O_RDONLY, mode_t perms=ACE_DEFAULT_FILE_PERMS, int persistent=1, LPSECURITY_ATTRIBUTES sa=0) |
| Open up a record-oriented named pipe for reading. | |
| ssize_t | recv (ACE_Str_Buf &msg) |
| Receive a message based on attributes in an ACE_Str_Buf. | |
| ssize_t | recv (void *buf, size_t len) |
| Receive a message based on buffer pointer and maximum size. | |
| void | dump (void) const |
| Dump the state of an object. | |
Public Attributes | |
| ACE_ALLOC_HOOK_DECLARE | |
| Declare the dynamic allocation hooks. | |
This method works slightly differently on platforms with the ACE_HAS_STREAM_PIPES configuration setting than those without. With ACE_HAS_STREAM_PIPES, the getmsg() system function is used and it preserves message boundaries internally. Without ACE_HAS_STREAM_PIPES, the message boundaries are emulated by this class and ACE_FIFO_Send_Msg cooperating. The sending class first writes an integer number of bytes in the message, then the message. ACE_FIFO_Recv_Msg reads the count, then the data. The operational differences occur primarily when a message is larger than what a caller of this class requests. See recv() for details.
Definition at line 45 of file FIFO_Recv_Msg.h.
|
|
Default constructor.
Definition at line 46 of file FIFO_Recv_Msg.cpp. References ACE_TRACE.
00047 {
00048 ACE_TRACE ("ACE_FIFO_Recv_Msg::ACE_FIFO_Recv_Msg");
00049 }
|
|
||||||||||||||||||||||||
|
Open up a record-oriented named pipe for reading.
Definition at line 51 of file FIFO_Recv_Msg.cpp. References ACE_ERROR, ACE_LIB_TEXT, ACE_TCHAR, ACE_TRACE, LM_ERROR, mode_t, and open().
00056 {
00057 ACE_TRACE ("ACE_FIFO_Recv_Msg::ACE_FIFO_Recv_Msg");
00058
00059 if (this->ACE_FIFO_Recv_Msg::open (fifo_name,
00060 flags,
00061 perms,
00062 persistent,
00063 sa) == -1)
00064 ACE_ERROR ((LM_ERROR, ACE_LIB_TEXT ("%p\n"), ACE_LIB_TEXT ("ACE_FIFO_Recv_Msg")));
00065 }
|
|
|
Dump the state of an object.
Reimplemented from ACE_FIFO_Recv. Definition at line 18 of file FIFO_Recv_Msg.cpp. References ACE_TRACE, and ACE_FIFO_Recv::dump().
00019 {
00020 #if defined (ACE_HAS_DUMP)
00021 ACE_TRACE ("ACE_FIFO_Recv_Msg::dump");
00022 ACE_FIFO_Recv::dump ();
00023 #endif /* ACE_HAS_DUMP */
00024 }
|
|
||||||||||||||||||||||||
|
Open up a record-oriented named pipe for reading.
Reimplemented from ACE_FIFO_Recv. Definition at line 31 of file FIFO_Recv_Msg.cpp. References ACE_TCHAR, ACE_TRACE, mode_t, and ACE_FIFO_Recv::open(). Referenced by ACE_FIFO_Recv_Msg().
00036 {
00037 ACE_TRACE ("ACE_FIFO_Recv_Msg::open");
00038
00039 return ACE_FIFO_Recv::open (fifo_name,
00040 flags,
00041 perms,
00042 persistent,
00043 sa);
00044 }
|
|
||||||||||||
|
Receive a message based on buffer pointer and maximum size.
Reimplemented from ACE_FIFO_Recv. Definition at line 69 of file FIFO_Recv_Msg.inl. References ACE_TRACE, and recv().
00070 {
00071 ACE_TRACE ("ACE_FIFO_Recv_Msg::recv");
00072 ACE_Str_Buf recv_msg ((char *) buf, 0, static_cast<int> (max_len));
00073
00074 return this->recv (recv_msg);
00075 }
|
|
|
Receive a message based on attributes in an ACE_Str_Buf.
Definition at line 15 of file FIFO_Recv_Msg.inl. References ACE_MIN, ACE_TRACE, strbuf::buf, ACE_OS::getmsg(), strbuf::len, strbuf::maxlen, ACE_OS::read(), and ssize_t. Referenced by recv().
00016 {
00017 ACE_TRACE ("ACE_FIFO_Recv_Msg::recv");
00018 #if defined (ACE_HAS_STREAM_PIPES)
00019 int i = 0;
00020 if (ACE_OS::getmsg (this->get_handle (),
00021 (strbuf *) 0,
00022 (strbuf *) &recv_msg,
00023 &i) == -1)
00024 return -1;
00025 else
00026 return recv_msg.len;
00027 #else /* Do the ol' 2-read trick... */
00028 if (ACE_OS::read (this->get_handle (),
00029 (char *) &recv_msg.len,
00030 sizeof recv_msg.len) != sizeof recv_msg.len)
00031 return -1;
00032 else
00033 {
00034 size_t remaining = static_cast<size_t> (recv_msg.len);
00035 size_t requested = static_cast<size_t> (recv_msg.maxlen);
00036 ssize_t recv_len = ACE_OS::read (this->get_handle (),
00037 (char *) recv_msg.buf,
00038 ACE_MIN (remaining, requested));
00039 if (recv_len == -1)
00040 return -1;
00041 // Tell caller what's really in the buffer.
00042 recv_msg.len = static_cast<int> (recv_len);
00043
00044 // If there are more bytes remaining in the message, read them and
00045 // throw them away. Leaving them in the FIFO would make it difficult
00046 // to find the start of the next message in the fifo.
00047 // Since the ACE_HAS_STREAM_PIPES version of this method doesn't
00048 // return getmsg()'s indication of "data remaining", don't worry about
00049 // saving the indication here either to read the remainder later.
00050 size_t total_msg_size = remaining;
00051 remaining -= recv_len;
00052 while (remaining > 0)
00053 {
00054 const size_t throw_away = 1024;
00055 char dev_null[throw_away];
00056 recv_len = ACE_OS::read (this->get_handle (),
00057 dev_null,
00058 ACE_MIN (remaining, throw_away));
00059 if (recv_len == -1)
00060 break;
00061 remaining -= recv_len;
00062 }
00063 return total_msg_size;
00064 }
00065 #endif /* ACE_HAS_STREAM_PIPES */
00066 }
|
|
|
Declare the dynamic allocation hooks.
Reimplemented from ACE_FIFO_Recv. Definition at line 128 of file FIFO_Recv_Msg.h. |
1.3.6