本文整理汇总了C++中ACE_Message_Block::clr_flags方法的典型用法代码示例。如果您正苦于以下问题:C++ ACE_Message_Block::clr_flags方法的具体用法?C++ ACE_Message_Block::clr_flags怎么用?C++ ACE_Message_Block::clr_flags使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ACE_Message_Block
的用法示例。
在下文中一共展示了ACE_Message_Block::clr_flags方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sizeof
TAO_BEGIN_VERSIONED_NAMESPACE_DECL
/*!
* @brief Allocate and return a new empty message block of size \a span_size
* mimicking parameters of \a mb.
*
* This function allocates a new aligned message block using the same
* allocators and flags as found in \a mb. The size of the new message
* block is at least \a span_size; the size may be adjusted up in order
* to accomodate alignment requirements and still fit \a span_size bytes
* into the aligned buffer.
*
* @param mb message block whose parameters should be mimicked
* @param span_size size of the new message block (will be adjusted for proper
* alignment)
* @return an aligned message block with rd_ptr sitting at correct
* alignment spot, 0 on failure
*/
static ACE_Message_Block*
clone_mb_nocopy_size (ACE_Message_Block *mb, size_t span_size)
{
// Calculate the required size of the cloned block with alignment
size_t const aligned_size = ACE_CDR::first_size (span_size + ACE_CDR::MAX_ALIGNMENT);
// Get the allocators
ACE_Allocator *data_allocator = 0;
ACE_Allocator *data_block_allocator = 0;
ACE_Allocator *message_block_allocator = 0;
mb->access_allocators (data_allocator,
data_block_allocator,
message_block_allocator);
// Create a new Message Block
ACE_Message_Block *nb = 0;
ACE_NEW_MALLOC_RETURN (nb,
static_cast<ACE_Message_Block*> (
message_block_allocator->malloc (
sizeof (ACE_Message_Block))),
ACE_Message_Block(aligned_size,
mb->msg_type(),
mb->cont(),
0, //we want the data block created
data_allocator,
mb->locking_strategy(),
mb->msg_priority(),
mb->msg_execution_time (),
mb->msg_deadline_time (),
data_block_allocator,
message_block_allocator),
0);
ACE_CDR::mb_align (nb);
// Copy the flags over, but be SURE to clear the DONT_DELETE flag, since
// we just dynamically allocated the two things.
nb->set_flags (mb->flags());
nb->clr_flags (ACE_Message_Block::DONT_DELETE);
return nb;
}
示例2: sizeof
// Note: The FooDataWriter gives ownership of the marshalled data
// to the WriteDataContainer.
ACE_Message_Block*
FooDataWriterImpl::marshal(
const Foo& instance_data,
int for_write)
{
ACE_Message_Block* mb;
if (for_write)
{
ACE_NEW_MALLOC_RETURN (mb,
static_cast<ACE_Message_Block*> (
mb_allocator_->malloc (
sizeof (ACE_Message_Block))),
ACE_Message_Block( sizeof (Foo),
ACE_Message_Block::MB_DATA,
0, //cont
0, //data
foo_allocator_, //allocator_strategy
0, //locking_strategy
ACE_DEFAULT_MESSAGE_BLOCK_PRIORITY,
ACE_Time_Value::zero,
ACE_Time_Value::max_time,
db_allocator_,
mb_allocator_),
0);
mb->copy ((const char *)&instance_data, sizeof (Foo));
}
else
{ // Don't use the cached allocator for the registered sample message
// block.
Foo* register_sample = new Foo();
*register_sample = instance_data;
ACE_NEW_RETURN (mb,
ACE_Message_Block ((const char*)register_sample,
sizeof (Foo)),
0);
// Let the PublicationInstance destructor release the Message Block
// and delete this register_sample.
mb->clr_flags(ACE_Message_Block::DONT_DELETE);
}
return mb;
}