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


Public Methods | |
| ACE_FIFO_Recv_Msg (void) | |
| Default constructor. More... | |
| ACE_FIFO_Recv_Msg (const ACE_TCHAR *rendezvous, int flags=O_CREAT|O_RDONLY, int perms=ACE_DEFAULT_FILE_PERMS, int persistent=1, LPSECURITY_ATTRIBUTES sa=0) | |
| Open up a record-oriented named pipe for reading. More... | |
| int | open (const ACE_TCHAR *rendezvous, int flags=O_CREAT|O_RDONLY, int perms=ACE_DEFAULT_FILE_PERMS, int persistent=1, LPSECURITY_ATTRIBUTES sa=0) |
| Open up a record-oriented named pipe for reading. More... | |
| ssize_t | recv (ACE_Str_Buf &msg) |
| Receive a message based on attributes in an ACE_Str_Buf. More... | |
| ssize_t | recv (void *buf, size_t len) |
| Receive a message based on buffer pointer and maximum size. More... | |
| void | dump (void) const |
| Dump the state of an object. More... | |
Public Attributes | |
| ACE_ALLOC_HOOK_DECLARE | |
| Declare the dynamic allocation hooks. More... | |
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 40 of file FIFO_Recv_Msg.h.
|
|
Default constructor.
Definition at line 43 of file FIFO_Recv_Msg.cpp. References ACE_TRACE.
00044 {
00045 ACE_TRACE ("ACE_FIFO_Recv_Msg::ACE_FIFO_Recv_Msg");
00046 }
|
|
||||||||||||||||||||||||
|
Open up a record-oriented named pipe for reading.
Definition at line 48 of file FIFO_Recv_Msg.cpp. References ACE_ERROR, ACE_LIB_TEXT, ACE_TCHAR, ACE_TRACE, LM_ERROR, and open.
00053 {
00054 ACE_TRACE ("ACE_FIFO_Recv_Msg::ACE_FIFO_Recv_Msg");
00055
00056 if (this->ACE_FIFO_Recv_Msg::open (fifo_name,
00057 flags,
00058 perms,
00059 persistent,
00060 sa) == -1)
00061 ACE_ERROR ((LM_ERROR, ACE_LIB_TEXT ("%p\n"), ACE_LIB_TEXT ("ACE_FIFO_Recv_Msg")));
00062 }
|
|
|
Dump the state of an object.
Reimplemented from ACE_FIFO_Recv. Definition at line 17 of file FIFO_Recv_Msg.cpp. References ACE_TRACE, and ACE_FIFO_Recv::dump.
00018 {
00019 ACE_TRACE ("ACE_FIFO_Recv_Msg::dump");
00020 ACE_FIFO_Recv::dump ();
00021 }
|
|
||||||||||||||||||||||||
|
Open up a record-oriented named pipe for reading.
Reimplemented from ACE_FIFO_Recv. Definition at line 28 of file FIFO_Recv_Msg.cpp. References ACE_TCHAR, ACE_TRACE, and ACE_FIFO_Recv::open. Referenced by ACE_FIFO_Recv_Msg.
00033 {
00034 ACE_TRACE ("ACE_FIFO_Recv_Msg::open");
00035
00036 return ACE_FIFO_Recv::open (fifo_name,
00037 flags,
00038 perms,
00039 persistent,
00040 sa);
00041 }
|
|
||||||||||||
|
Receive a message based on buffer pointer and maximum size.
Reimplemented from ACE_FIFO_Recv. Definition at line 61 of file FIFO_Recv_Msg.i. References ACE_TRACE, and recv.
00062 {
00063 ACE_TRACE ("ACE_FIFO_Recv_Msg::recv");
00064 ACE_Str_Buf recv_msg ((char *) buf, 0, ACE_static_cast (int, max_len));
00065
00066 return this->recv (recv_msg);
00067 }
|
|
|
Receive a message based on attributes in an ACE_Str_Buf.
Definition at line 7 of file FIFO_Recv_Msg.i. References ACE_MIN, ACE_TRACE, strbuf::buf, ACE_OS::getmsg, strbuf::len, strbuf::maxlen, ACE_OS::read, and ssize_t. Referenced by recv.
00008 {
00009 ACE_TRACE ("ACE_FIFO_Recv_Msg::recv");
00010 #if defined (ACE_HAS_STREAM_PIPES)
00011 int i = 0;
00012 if (ACE_OS::getmsg (this->get_handle (),
00013 (strbuf *) 0,
00014 (strbuf *) &recv_msg,
00015 &i) == -1)
00016 return -1;
00017 else
00018 return recv_msg.len;
00019 #else /* Do the ol' 2-read trick... */
00020 if (ACE_OS::read (this->get_handle (),
00021 (char *) &recv_msg.len,
00022 sizeof recv_msg.len) != sizeof recv_msg.len)
00023 return -1;
00024 else
00025 {
00026 size_t remaining = ACE_static_cast (size_t, recv_msg.len);
00027 size_t requested = ACE_static_cast (size_t, recv_msg.maxlen);
00028 ssize_t recv_len = ACE_OS::read (this->get_handle (),
00029 (char *) recv_msg.buf,
00030 ACE_MIN (remaining, requested));
00031 if (recv_len == -1)
00032 return -1;
00033 // Tell caller what's really in the buffer.
00034 recv_msg.len = ACE_static_cast (int, recv_len);
00035
00036 // If there are more bytes remaining in the message, read them and
00037 // throw them away. Leaving them in the FIFO would make it difficult
00038 // to find the start of the next message in the fifo.
00039 // Since the ACE_HAS_STREAM_PIPES version of this method doesn't
00040 // return getmsg()'s indication of "data remaining", don't worry about
00041 // saving the indication here either to read the remainder later.
00042 size_t total_msg_size = remaining;
00043 remaining -= recv_len;
00044 while (remaining > 0)
00045 {
00046 const size_t throw_away = 1024;
00047 char dev_null[throw_away];
00048 recv_len = ACE_OS::read (this->get_handle (),
00049 dev_null,
00050 ACE_MIN (remaining, throw_away));
00051 if (recv_len == -1)
00052 break;
00053 remaining -= recv_len;
00054 }
00055 return total_msg_size;
00056 }
00057 #endif /* ACE_HAS_STREAM_PIPES */
00058 }
|
|
|
Declare the dynamic allocation hooks.
Reimplemented from ACE_FIFO_Recv. Definition at line 123 of file FIFO_Recv_Msg.h. |
1.2.14 written by Dimitri van Heesch,
© 1997-2002