Use =default for skeleton copy constructor
[ACE_TAO.git] / ACE / examples / System_V_IPC / SV_Message_Queues / test.h
blob1355d51ddff41751827582f388262ce173ef3118
1 /* -*- C++ -*- */
2 #include "ace/OS_NS_string.h"
4 #if !defined (ACE_LACKS_PRAGMA_ONCE)
5 # pragma once
6 #endif /* ACE_LACKS_PRAGMA_ONCE */
8 #include "ace/SV_Message.h"
10 #define MSGSZ 128
11 #define SRV_KEY ACE_DEFAULT_SHM_KEY
12 #define SRV_ID 1
14 class Message_Data
16 public:
17 Message_Data (long p = -1,
18 const char user[] = "",
19 const char text[] = ""): pid_ (p)
21 ACE_OS::strncpy (this->username_, user, 9);
22 ACE_OS::strncpy (this->mtext_, text, MSGSZ);
25 long pid () { return this->pid_; }
26 void pid (long p) { this->pid_ = p; }
27 char *user () { return this->username_; }
28 void user (char user[]) { ACE_OS::strncpy (this->username_, user, 9); }
29 char *text () { return this->mtext_; }
30 void text (char text[]) { ACE_OS::strncpy (this->mtext_, text, MSGSZ); }
31 int length () { return sizeof *this - sizeof this->mtext_ + ACE_OS::strlen (this->mtext_) + 1; }
33 protected:
34 long pid_;
35 char username_[9];
36 char mtext_[MSGSZ];
39 class Message_Block : public ACE_SV_Message, public Message_Data
41 // = TITLE
42 // Stores message content.
43 // = DESCRIPTION
44 // This may not be 100 percent portable on all C++ compilers since
45 // it relies on inheritance to be "concatenation."
47 public:
48 Message_Block (long t,
49 long p = 0,
50 const char login[] = "",
51 const char message[] = "")
52 : ACE_SV_Message (t),
53 Message_Data (p, login, message)