00001 // -*- C++ -*- 00002 00003 //============================================================================= 00004 /** 00005 * @file Typed_SV_Message_Queue.h 00006 * 00007 * Typed_SV_Message_Queue.h,v 4.17 2005/10/28 23:55:10 ossama Exp 00008 * 00009 * @author Douglas C. Schmidt <schmidt@cs.wustl.edu> 00010 */ 00011 //============================================================================= 00012 00013 #ifndef ACE_TYPED_MESSAGE_QUEUE_H 00014 #define ACE_TYPED_MESSAGE_QUEUE_H 00015 #include /**/ "ace/pre.h" 00016 00017 #include "ace/SV_Message_Queue.h" 00018 00019 #if !defined (ACE_LACKS_PRAGMA_ONCE) 00020 # pragma once 00021 #endif /* ACE_LACKS_PRAGMA_ONCE */ 00022 00023 #include "ace/Typed_SV_Message.h" 00024 00025 ACE_BEGIN_VERSIONED_NAMESPACE_DECL 00026 00027 /** 00028 * @class ACE_Typed_SV_Message_Queue 00029 * 00030 * @brief Defines the header file for the C++ wrapper facade for typed message queues. 00031 */ 00032 template <class T> 00033 class ACE_Typed_SV_Message_Queue 00034 { 00035 public: 00036 enum 00037 { 00038 ACE_CREATE = IPC_CREAT, 00039 ACE_OPEN = 0, 00040 ACE_NOWAIT = IPC_NOWAIT 00041 }; 00042 00043 // = Initialization and termination operations. 00044 ACE_Typed_SV_Message_Queue (void); 00045 ACE_Typed_SV_Message_Queue (key_t external_id, 00046 int create = ACE_OPEN, 00047 int perms = ACE_DEFAULT_FILE_PERMS); 00048 int open (key_t external_id, 00049 int create = ACE_OPEN, 00050 int perms = ACE_DEFAULT_FILE_PERMS); 00051 int close (void); 00052 int remove (void); 00053 ~ACE_Typed_SV_Message_Queue (void); 00054 00055 /// Send method. 00056 int send (const ACE_Typed_SV_Message<T> &mb, int mflags = 0); 00057 00058 /// Recv method. 00059 int recv (ACE_Typed_SV_Message<T> &mb, int mflags = 0); 00060 00061 /// Return the id of the underlying ACE_SV_Message_Queue. 00062 int get_id (void) const; 00063 00064 /// Control the underlying message queue. 00065 int control (int option, void *arg = 0); 00066 00067 /// Dump the state of an object. 00068 void dump (void) const; 00069 00070 /// Declare the dynamic allocation hooks. 00071 ACE_ALLOC_HOOK_DECLARE; 00072 00073 private: 00074 ACE_SV_Message_Queue message_queue_; 00075 }; 00076 00077 ACE_END_VERSIONED_NAMESPACE_DECL 00078 00079 #if defined (__ACE_INLINE__) 00080 #include "ace/Typed_SV_Message_Queue.inl" 00081 #endif /* __ACE_INLINE__ */ 00082 00083 #if defined (ACE_TEMPLATES_REQUIRE_SOURCE) 00084 #include "ace/Typed_SV_Message_Queue.cpp" 00085 #endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ 00086 00087 #if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) 00088 #pragma implementation ("Typed_SV_Message_Queue.cpp") 00089 #endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ 00090 00091 #include /**/ "ace/post.h" 00092 #endif /* ACE_TYPED_MESSAGE_QUEUE_H */