00001 /* -*- C++ -*- */ 00002 00003 //============================================================================= 00004 /** 00005 * @file Message_Block_T.h 00006 * 00007 * $Id: Message_Block_T.h 73444 2006-07-11 12:02:36Z elliott_c $ 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, 00062 size_t max_size = 0) const; 00063 00064 private: 00065 /// The lock 00066 ACE_LOCK lock_; 00067 00068 // = Disallow these operations. 00069 ACE_UNIMPLEMENTED_FUNC (ACE_Locked_Data_Block<ACE_LOCK> &operator= (const ACE_Locked_Data_Block<ACE_LOCK> &)) 00070 ACE_UNIMPLEMENTED_FUNC (ACE_Locked_Data_Block (const ACE_Locked_Data_Block<ACE_LOCK> &)) 00071 }; 00072 00073 ACE_END_VERSIONED_NAMESPACE_DECL 00074 00075 #if defined (__ACE_INLINE__) 00076 #include "ace/Message_Block_T.inl" 00077 #endif /* __ACE_INLINE__ */ 00078 00079 #if defined (ACE_TEMPLATES_REQUIRE_SOURCE) 00080 #include "ace/Message_Block_T.cpp" 00081 #endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ 00082 00083 #if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) 00084 #pragma implementation ("Message_Block_T.cpp") 00085 #endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ 00086 00087 #include /**/ "ace/post.h" 00088 #endif /* ACE_MESSAGE_BLOCK_T_H */