Merge pull request #2301 from sonndinh/remove-dup-reactor-functions
[ACE_TAO.git] / ACE / ace / Message_Block_T.cpp
blob57a9923a257bd7e4dcd59692bfba7c6550a06347
1 #ifndef ACE_MESSAGE_BLOCK_T_CPP
2 #define ACE_MESSAGE_BLOCK_T_CPP
4 #include "ace/Malloc_Base.h" /* Need ACE_Allocator */
6 #if !defined (__ACE_INLINE__)
7 #include "ace/Message_Block_T.inl"
8 #endif /* __ACE_INLINE__ */
10 #include "ace/os_include/os_errno.h"
12 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
14 template<class L>
15 ACE_Locked_Data_Block<L>::~ACE_Locked_Data_Block ()
19 template<class ACE_LOCK> ACE_Data_Block *
20 ACE_Locked_Data_Block<ACE_LOCK>::clone_nocopy (ACE_Message_Block::Message_Flags mask,
21 size_t max_size) const
23 ACE_TRACE ("ACE_Locked_Data_Block::clone_nocopy");
25 // You always want to clear this one to prevent memory leaks but you
26 // might add some others later.
27 const ACE_Message_Block::Message_Flags always_clear =
28 ACE_Message_Block::DONT_DELETE;
30 ACE_Locked_Data_Block<ACE_LOCK> *nb = 0;
32 ACE_NEW_MALLOC_RETURN (nb,
33 static_cast<ACE_Locked_Data_Block<ACE_LOCK>*> (
34 this->data_block_allocator ()->malloc (sizeof (ACE_Locked_Data_Block<ACE_LOCK>))),
35 ACE_Locked_Data_Block<ACE_LOCK> (
36 max_size == 0 ?
37 this->size () : max_size,
38 this->msg_type (),
40 this->allocator_strategy (),
41 this->flags (),
42 this->data_block_allocator ()),
43 0);
45 // Set new flags minus the mask...
46 nb->clr_flags (mask | always_clear);
47 return nb;
50 ACE_END_VERSIONED_NAMESPACE_DECL
52 #endif /* ACE_MESSAGE_BLOCK_T_CPP */