FIFO_Send_Msg.cpp

Go to the documentation of this file.
00001 // FIFO_Send_Msg.cpp,v 4.24 2006/03/14 21:15:49 sjiang Exp
00002 
00003 #include "ace/FIFO_Send_Msg.h"
00004 
00005 #include "ace/Log_Msg.h"
00006 #include "ace/OS_NS_sys_uio.h"
00007 
00008 #if !defined (__ACE_INLINE__)
00009 #include "ace/FIFO_Send_Msg.inl"
00010 #endif /* __ACE_INLINE__ */
00011 
00012 ACE_RCSID(ace, FIFO_Send_Msg, "FIFO_Send_Msg.cpp,v 4.24 2006/03/14 21:15:49 sjiang Exp")
00013 
00014 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
00015 
00016 ACE_ALLOC_HOOK_DEFINE(ACE_FIFO_Send_Msg)
00017 
00018 void
00019 ACE_FIFO_Send_Msg::dump (void) const
00020 {
00021 #if defined (ACE_HAS_DUMP)
00022   ACE_TRACE ("ACE_FIFO_Send_Msg::dump");
00023   ACE_FIFO_Send::dump ();
00024 #endif /* ACE_HAS_DUMP */
00025 }
00026 
00027 ssize_t
00028 ACE_FIFO_Send_Msg::send (const ACE_Str_Buf &send_msg)
00029 {
00030   // ACE_TRACE ("ACE_FIFO_Send_Msg::send");
00031 #if defined (ACE_HAS_STREAM_PIPES)
00032   if (ACE_OS::putmsg (this->get_handle (),
00033                       (strbuf *) 0,
00034                       (strbuf *) &send_msg,
00035                       0) == -1)
00036     return -1;
00037   else
00038     return send_msg.len;
00039 #else
00040   iovec iov[2];
00041 
00042   iov[0].iov_base = (char *) &send_msg.len;
00043   iov[0].iov_len  = sizeof send_msg.len;
00044 
00045   iov[1].iov_base = (char *) send_msg.buf;
00046   iov[1].iov_len  =  static_cast<u_long> (send_msg.len);
00047 
00048   ssize_t sent = ACE_OS::writev (this->get_handle (), iov, 2);
00049   if (sent > 0)
00050     sent -= iov[0].iov_len;       // Don't count the length we added.
00051   return sent;
00052 #endif /* ACE_HAS_STREAM_PIPES */
00053 }
00054 
00055 ACE_FIFO_Send_Msg::ACE_FIFO_Send_Msg (void)
00056 {
00057 //  ACE_TRACE ("ACE_FIFO_Send_Msg::ACE_FIFO_Send_Msg");
00058 }
00059 
00060 int
00061 ACE_FIFO_Send_Msg::open (const ACE_TCHAR *fifo_name,
00062                          int flags,
00063                          mode_t perms,
00064                          LPSECURITY_ATTRIBUTES sa)
00065 {
00066   ACE_TRACE ("ACE_FIFO_Send_Msg::open");
00067   return ACE_FIFO_Send::open (fifo_name, flags | O_WRONLY, perms, sa);
00068 }
00069 
00070 ACE_FIFO_Send_Msg::ACE_FIFO_Send_Msg (const ACE_TCHAR *fifo_name,
00071                                       int flags,
00072                                       mode_t perms,
00073                                       LPSECURITY_ATTRIBUTES sa)
00074 {
00075   ACE_TRACE ("ACE_FIFO_Send_Msg::ACE_FIFO_Send_Msg");
00076   if (this->ACE_FIFO_Send_Msg::open (fifo_name, flags, perms, sa) == -1)
00077     ACE_ERROR ((LM_ERROR,  ACE_LIB_TEXT ("%p\n"),  ACE_LIB_TEXT ("ACE_FIFO_Send_Msg")));
00078 }
00079 
00080 ACE_END_VERSIONED_NAMESPACE_DECL

Generated on Thu Nov 9 09:41:50 2006 for ACE by doxygen 1.3.6