#include "tao/Incoming_Message_Queue.h"
#include "tao/debug.h"
#include "ace/Log_Msg.h"
#include "ace/Malloc_Base.h"
Include dependency graph for Incoming_Message_Queue.cpp:
Go to the source code of this file.
Functions | |
ACE_Message_Block * | clone_mb_nocopy_size (ACE_Message_Block *mb, size_t span_size) |
Allocate and return a new empty message block of size span_size mimicking parameters of mb. |
|
Allocate and return a new empty message block of size span_size mimicking parameters of mb. This function allocates a new aligned message block using the same allocators and flags as found in mb. The size of the new message block is at least span_size; the size may be adjusted up in order to accomodate alignment requirements and still fit span_size bytes into the aligned buffer.
Definition at line 131 of file Incoming_Message_Queue.cpp. References ACE_Message_Block::access_allocators(), ACE_Message_Block, ACE_NEW_MALLOC_RETURN, ACE_Message_Block::clr_flags(), ACE_Message_Block::cont(), ACE_CDR::first_size(), ACE_Message_Block::flags(), ACE_Message_Block::locking_strategy(), ACE_Allocator::malloc(), ACE_CDR::mb_align(), ACE_Message_Block::msg_deadline_time(), ACE_Message_Block::msg_execution_time(), ACE_Message_Block::msg_priority(), ACE_Message_Block::msg_type(), and ACE_Message_Block::set_flags(). Referenced by TAO_Queued_Data::consolidate().
00132 { 00133 // Calculate the required size of the cloned block with alignment 00134 size_t const aligned_size = ACE_CDR::first_size (span_size + ACE_CDR::MAX_ALIGNMENT); 00135 00136 // Get the allocators 00137 ACE_Allocator *data_allocator = 0; 00138 ACE_Allocator *data_block_allocator = 0; 00139 ACE_Allocator *message_block_allocator = 0; 00140 mb->access_allocators (data_allocator, 00141 data_block_allocator, 00142 message_block_allocator); 00143 00144 // Create a new Message Block 00145 ACE_Message_Block *nb = 0; 00146 ACE_NEW_MALLOC_RETURN (nb, 00147 static_cast<ACE_Message_Block*> ( 00148 message_block_allocator->malloc ( 00149 sizeof (ACE_Message_Block))), 00150 ACE_Message_Block(aligned_size, 00151 mb->msg_type(), 00152 mb->cont(), 00153 0, //we want the data block created 00154 data_allocator, 00155 mb->locking_strategy(), 00156 mb->msg_priority(), 00157 mb->msg_execution_time (), 00158 mb->msg_deadline_time (), 00159 data_block_allocator, 00160 message_block_allocator), 00161 0); 00162 00163 ACE_CDR::mb_align (nb); 00164 00165 // Copy the flags over, but be SURE to clear the DONT_DELETE flag, since 00166 // we just dynamically allocated the two things. 00167 nb->set_flags (mb->flags()); 00168 nb->clr_flags (ACE_Message_Block::DONT_DELETE); 00169 00170 return nb; 00171 } |