Initial Patch of Auction House bot rev. 135
[auctionmangos.git] / dep / ACE_wrappers / ace / FIFO_Send_Msg.cpp
blobb3bbae00aedfadcfe6b4ab48ad352f0dc6297b5b
1 // $Id: FIFO_Send_Msg.cpp 80826 2008-03-04 14:51:23Z wotte $
3 #include "ace/FIFO_Send_Msg.h"
5 #include "ace/Log_Msg.h"
6 #include "ace/OS_NS_sys_uio.h"
8 #if !defined (__ACE_INLINE__)
9 #include "ace/FIFO_Send_Msg.inl"
10 #endif /* __ACE_INLINE__ */
12 ACE_RCSID(ace, FIFO_Send_Msg, "$Id: FIFO_Send_Msg.cpp 80826 2008-03-04 14:51:23Z wotte $")
14 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
16 ACE_ALLOC_HOOK_DEFINE(ACE_FIFO_Send_Msg)
18 void
19 ACE_FIFO_Send_Msg::dump (void) const
21 #if defined (ACE_HAS_DUMP)
22 ACE_TRACE ("ACE_FIFO_Send_Msg::dump");
23 ACE_FIFO_Send::dump ();
24 #endif /* ACE_HAS_DUMP */
27 ssize_t
28 ACE_FIFO_Send_Msg::send (const ACE_Str_Buf &send_msg)
30 // ACE_TRACE ("ACE_FIFO_Send_Msg::send");
31 #if defined (ACE_HAS_STREAM_PIPES)
32 if (ACE_OS::putmsg (this->get_handle (),
33 (strbuf *) 0,
34 (strbuf *) &send_msg,
35 0) == -1)
36 return -1;
37 else
38 return send_msg.len;
39 #else
40 iovec iov[2];
42 iov[0].iov_base = (char *) &send_msg.len;
43 iov[0].iov_len = sizeof send_msg.len;
45 iov[1].iov_base = (char *) send_msg.buf;
46 iov[1].iov_len = static_cast<u_long> (send_msg.len);
48 ssize_t sent = ACE_OS::writev (this->get_handle (), iov, 2);
49 if (sent > 0)
50 sent -= iov[0].iov_len; // Don't count the length we added.
51 return sent;
52 #endif /* ACE_HAS_STREAM_PIPES */
55 ACE_FIFO_Send_Msg::ACE_FIFO_Send_Msg (void)
57 // ACE_TRACE ("ACE_FIFO_Send_Msg::ACE_FIFO_Send_Msg");
60 int
61 ACE_FIFO_Send_Msg::open (const ACE_TCHAR *fifo_name,
62 int flags,
63 mode_t perms,
64 LPSECURITY_ATTRIBUTES sa)
66 ACE_TRACE ("ACE_FIFO_Send_Msg::open");
67 return ACE_FIFO_Send::open (fifo_name, flags | O_WRONLY, perms, sa);
70 ACE_FIFO_Send_Msg::ACE_FIFO_Send_Msg (const ACE_TCHAR *fifo_name,
71 int flags,
72 mode_t perms,
73 LPSECURITY_ATTRIBUTES sa)
75 ACE_TRACE ("ACE_FIFO_Send_Msg::ACE_FIFO_Send_Msg");
76 if (this->ACE_FIFO_Send_Msg::open (fifo_name, flags, perms, sa) == -1)
77 ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("ACE_FIFO_Send_Msg")));
80 ACE_END_VERSIONED_NAMESPACE_DECL