00001 // $Id: Message_Block_T.cpp 73444 2006-07-11 12:02:36Z elliott_c $ 00002 00003 #ifndef ACE_MESSAGE_BLOCK_T_CPP 00004 #define ACE_MESSAGE_BLOCK_T_CPP 00005 00006 #include "ace/Malloc_Base.h" /* Need ACE_Allocator */ 00007 00008 #if !defined (__ACE_INLINE__) 00009 #include "ace/Message_Block_T.inl" 00010 #endif /* __ACE_INLINE__ */ 00011 00012 #include "ace/os_include/os_errno.h" 00013 00014 ACE_BEGIN_VERSIONED_NAMESPACE_DECL 00015 00016 template<class L> 00017 ACE_Locked_Data_Block<L>::~ACE_Locked_Data_Block (void) 00018 { 00019 } 00020 00021 template<class ACE_LOCK> ACE_Data_Block * 00022 ACE_Locked_Data_Block<ACE_LOCK>::clone_nocopy (ACE_Message_Block::Message_Flags mask, 00023 size_t max_size) const 00024 { 00025 ACE_TRACE ("ACE_Locked_Data_Block::clone_nocopy"); 00026 00027 // You always want to clear this one to prevent memory leaks but you 00028 // might add some others later. 00029 const ACE_Message_Block::Message_Flags always_clear = 00030 ACE_Message_Block::DONT_DELETE; 00031 00032 ACE_Locked_Data_Block<ACE_LOCK> *nb = 0; 00033 00034 ACE_NEW_MALLOC_RETURN (nb, 00035 static_cast<ACE_Locked_Data_Block<ACE_LOCK>*> ( 00036 this->data_block_allocator ()->malloc (sizeof (ACE_Locked_Data_Block<ACE_LOCK>))), 00037 ACE_Locked_Data_Block<ACE_LOCK> ( 00038 max_size == 0 ? 00039 this->size () : max_size, 00040 this->msg_type (), 00041 0, 00042 this->allocator_strategy (), 00043 this->flags (), 00044 this->data_block_allocator ()), 00045 0); 00046 00047 // Set new flags minus the mask... 00048 nb->clr_flags (mask | always_clear); 00049 return nb; 00050 } 00051 00052 ACE_END_VERSIONED_NAMESPACE_DECL 00053 00054 #endif /* ACE_MESSAGE_BLOCK_T_CPP */