Use =default for skeleton copy constructor
[ACE_TAO.git] / ACE / examples / System_V_IPC / SV_Message_Queues / TMQ_Client.cpp
blob86081a2049f16cf2073a158b84639c0df1ee66cf
1 #include "ace/Typed_SV_Message_Queue.h"
3 // FUZZ: disable check_for_streams_include
4 #include "ace/streams.h"
6 #include "ace/Log_Msg.h"
7 #include "test.h"
8 #include "ace/OS_NS_stdio.h"
9 #include "ace/OS_NS_unistd.h"
12 int
13 ACE_TMAIN (int, ACE_TCHAR *[])
15 long pid = long (ACE_OS::getpid ());
17 ACE_Typed_SV_Message_Queue<Message_Data> msgque (key_t (SRV_KEY));
19 #if !defined(ACE_LACKS_CUSERID)
20 Message_Data msg_data (pid,
21 ACE_OS::cuserid (static_cast<char *> (0)),
22 "did you get this?");
23 #else
24 Message_Data msg_data (pid,
25 "",
26 "did you get this?");
27 #endif
29 ACE_Typed_SV_Message<Message_Data> send_msg (msg_data,
30 SRV_ID,
31 msg_data.length ()),
32 recv_msg (pid);
34 if (msgque.send (send_msg) < 0)
35 ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"),
36 ACE_TEXT ("msgque.send")), 1);
38 if (msgque.recv (recv_msg) < 0)
39 ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"),
40 ACE_TEXT ("msgque.recv")), 1);
42 Message_Data &recv_msg_data = recv_msg.data ();
44 ACE_DEBUG ((LM_DEBUG,
45 ACE_TEXT ("a message of length %d")
46 ACE_TEXT (" received from server %d")
47 ACE_TEXT (" (user %C): %C\n"),
48 recv_msg_data.length (),
49 recv_msg_data.pid (),
50 recv_msg_data.user (),
51 recv_msg_data.text ()));
53 return 0;