00001 /* -*- C++ -*- */ 00002 00003 //============================================================================= 00004 /** 00005 * @file Message_Block_T.h 00006 * 00007 * Message_Block_T.h,v 4.17 2005/10/28 16:14:53 ossama Exp 00008 * 00009 * @author Douglas C. Schmidt <schmidt@cs.wustl.edu> 00010 * @author Carlos O'Ryan <coryan@atdesk.com> 00011 */ 00012 //============================================================================= 00013 00014 #ifndef ACE_MESSAGE_BLOCK_T_H 00015 #define ACE_MESSAGE_BLOCK_T_H 00016 #include /**/ "ace/pre.h" 00017 00018 #include "ace/Message_Block.h" 00019 00020 #if !defined (ACE_LACKS_PRAGMA_ONCE) 00021 # pragma once 00022 #endif /* ACE_LACKS_PRAGMA_ONCE */ 00023 00024 ACE_BEGIN_VERSIONED_NAMESPACE_DECL 00025 00026 /** 00027 * @class ACE_Locked_Data_Block 00028 * 00029 * @brief A Data_Block with a concrete locking strategy. 00030 * 00031 * Data_Blocks can be parametric on the kind of lock they use; in 00032 * many cases the lifetime of the lock is tied to the lifetime of 00033 * the Data_Block itself. But since Data_Blocks are reference 00034 * counted it is hard for users to control the lock lifetime. 00035 * This class is parametric over the kind of lock used. 00036 */ 00037 template <class ACE_LOCK> 00038 class ACE_Locked_Data_Block : public ACE_Data_Block 00039 { 00040 public: 00041 // = Initialization and termination methods. 00042 /// Default "do-nothing" constructor. 00043 ACE_Locked_Data_Block (void); 00044 00045 /// Initialize. 00046 ACE_Locked_Data_Block (size_t size, 00047 ACE_Message_Block::ACE_Message_Type msg_type, 00048 const char *msg_data, 00049 ACE_Allocator *allocator_strategy, 00050 ACE_Message_Block::Message_Flags flags, 00051 ACE_Allocator *data_block_allocator); 00052 00053 /// Delete all the resources held in the message. 00054 virtual ~ACE_Locked_Data_Block (void); 00055 00056 /** 00057 * Return an exact "deep copy" of the message, the dynamic type is 00058 * ACE_Locked_Data_Block<> 00059 * See the documentation in Message_Block.h for details. 00060 */ 00061 virtual ACE_Data_Block *clone_nocopy (ACE_Message_Block::Message_Flags mask = 0) const; 00062 00063 private: 00064 /// The lock 00065 ACE_LOCK lock_; 00066 00067 // = Disallow these operations. 00068 ACE_UNIMPLEMENTED_FUNC (ACE_Locked_Data_Block<ACE_LOCK> &operator= (const ACE_Locked_Data_Block<ACE_LOCK> &)) 00069 ACE_UNIMPLEMENTED_FUNC (ACE_Locked_Data_Block (const ACE_Locked_Data_Block<ACE_LOCK> &)) 00070 }; 00071 00072 ACE_END_VERSIONED_NAMESPACE_DECL 00073 00074 #if defined (__ACE_INLINE__) 00075 #include "ace/Message_Block_T.inl" 00076 #endif /* __ACE_INLINE__ */ 00077 00078 #if defined (ACE_TEMPLATES_REQUIRE_SOURCE) 00079 #include "ace/Message_Block_T.cpp" 00080 #endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ 00081 00082 #if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) 00083 #pragma implementation ("Message_Block_T.cpp") 00084 #endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ 00085 00086 #include /**/ "ace/post.h" 00087 #endif /* ACE_MESSAGE_BLOCK_T_H */