summaryrefslogtreecommitdiff
path: root/ace/SV_Message_Queue.h
blob: cd9c85f82e8621b8677b2b81f69820cf3ea0081b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
/* -*- C++ -*- */
// $Id$

// ============================================================================
//
// = LIBRARY
//    ace
// 
// = FILENAME
//    SV_Message_Queue.h
//
// = AUTHOR
//    Doug Schmidt 
// 
// ============================================================================

#if !defined (ACE_MESSAGE_QUEUE_H)
#define ACE_MESSAGE_QUEUE_H

#include "ace/ACE.h"
#include "ace/SV_Message.h"

class ACE_Export ACE_SV_Message_Queue
  // = TITLE
  //     Defines the header file for the C++ wrapper for System V IPC
  //     message queues.  
{
public: 
  // = Useful symbolic constants.
  enum 
  {
    ACE_CREATE = IPC_CREAT, 
    ACE_OPEN   = 0, 
    ACE_NOWAIT = IPC_NOWAIT
  };

  // = Initialization and termination methods.
  ACE_SV_Message_Queue (void);
  ACE_SV_Message_Queue (key_t external_id, 
			int create = ACE_SV_Message_Queue::ACE_OPEN,
			int perms = ACE_DEFAULT_PERMS);
  int open (key_t external_id, 
	    int create = ACE_SV_Message_Queue::ACE_OPEN,
	    int perms = ACE_DEFAULT_PERMS);
   // Open a message queue using the <external_id>.

  ~ACE_SV_Message_Queue (void);

  int close (void);
  // Close down this instance of the message queue without removing it
  // from the system.

  int remove (void);
  // Close down and remove the message queue from the system.


  // = Message transfer methods.
  int recv (ACE_SV_Message &mb, 
	    int length, 
	    long mtype = 0, 
	    int mflags = 0);

  int send (const ACE_SV_Message &mb, 
	    int length, 
	    int mflags = 0);

  int control (int option, void *arg = 0);
  // Access the underlying control operations.

  // = Get/set the underly internal id.
  int get_id (void);
  void set_id (int);

  void dump (void) const;
  // Dump the state of an object.

  ACE_ALLOC_HOOK_DECLARE;
  // Declare the dynamic allocation hooks.

protected:
  int internal_id_;
  // Returned from the underlying msgget() system call.
};

#include "ace/SV_Message_Queue.i"
#endif /* ACE_MESSAGE_QUEUE_H */