SV_Message_Queue.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 //==========================================================================
00004 /**
00005  *  @file    SV_Message_Queue.h
00006  *
00007  *  SV_Message_Queue.h,v 4.23 2005/10/28 16:14:55 ossama Exp
00008  *
00009  *  @author Douglas C. Schmidt <schmidt@uci.edu>
00010  */
00011 //===========================================================================
00012 
00013 #ifndef ACE_SV_MESSAGE_QUEUE_H
00014 #define ACE_SV_MESSAGE_QUEUE_H
00015 
00016 #include /**/ "ace/pre.h"
00017 
00018 #include "ace/config-all.h"
00019 
00020 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00021 # pragma once
00022 #endif /* ACE_LACKS_PRAGMA_ONCE */
00023 
00024 #include "ace/SV_Message.h"
00025 #include "ace/os_include/sys/os_stat.h"
00026 #include "ace/os_include/sys/os_ipc.h"
00027 #include "ace/Default_Constants.h"
00028 
00029 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
00030 
00031 /**
00032  * @class ACE_SV_Message_Queue
00033  *
00034  * @brief Defines the header file for the C++ wrapper for System V IPC
00035  * message queues.
00036  */
00037 class ACE_Export ACE_SV_Message_Queue
00038 {
00039 public:
00040   // = Useful symbolic constants.
00041   enum
00042   {
00043     ACE_CREATE = IPC_CREAT,
00044     ACE_OPEN   = 0,
00045     ACE_NOWAIT = IPC_NOWAIT
00046   };
00047 
00048   // = Initialization and termination methods.
00049   /// Open a message queue using the <external_id>.
00050   ACE_SV_Message_Queue (void);
00051   ACE_SV_Message_Queue (key_t external_id,
00052                         int create = ACE_SV_Message_Queue::ACE_OPEN,
00053                         int perms = ACE_DEFAULT_FILE_PERMS);
00054   int open (key_t external_id,
00055             int create = ACE_SV_Message_Queue::ACE_OPEN,
00056             int perms = ACE_DEFAULT_FILE_PERMS);
00057 
00058   ~ACE_SV_Message_Queue (void);
00059 
00060   /// Close down this instance of the message queue without removing it
00061   /// from the system.
00062   int close (void);
00063 
00064   /// Close down and remove the message queue from the system.
00065   int remove (void);
00066 
00067   // = Message transfer methods.
00068   ssize_t recv (ACE_SV_Message &mb,
00069                 int length,
00070                 long mtype = 0,
00071                 int mflags = 0);
00072 
00073   int send (const ACE_SV_Message &mb,
00074             int length,
00075             int mflags = 0);
00076 
00077   /// Access the underlying control operations.
00078   int control (int option, void *arg = 0);
00079 
00080   /// Get the underly internal id.
00081   int get_id (void) const;
00082 
00083   /// Set the underly internal id.
00084   void set_id (int);
00085 
00086   /// Dump the state of an object.
00087   void dump (void) const;
00088 
00089   /// Declare the dynamic allocation hooks.
00090   ACE_ALLOC_HOOK_DECLARE;
00091 
00092 protected:
00093   /// Returned from the underlying <msgget> system call.
00094   int internal_id_;
00095 };
00096 
00097 ACE_END_VERSIONED_NAMESPACE_DECL
00098 
00099 #if defined (__ACE_INLINE__)
00100 #include "ace/SV_Message_Queue.inl"
00101 #endif /* __ACE_INLINE__ */
00102 
00103 #include /**/ "ace/post.h"
00104 
00105 #endif /* ACE_SV_MESSAGE_QUEUE_H */

Generated on Thu Nov 9 09:42:05 2006 for ACE by doxygen 1.3.6