本文整理汇总了C++中ACE_Data_Block::size方法的典型用法代码示例。如果您正苦于以下问题:C++ ACE_Data_Block::size方法的具体用法?C++ ACE_Data_Block::size怎么用?C++ ACE_Data_Block::size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ACE_Data_Block
的用法示例。
在下文中一共展示了ACE_Data_Block::size方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
ACE_Data_Block *
ACE_Data_Block::clone_nocopy (ACE_Message_Block::Message_Flags mask,
size_t max_size) const
{
ACE_FUNCTION_TIMEPROBE(ACE_DATA_BLOCK_CLONE_ENTER);
ACE_TRACE ("ACE_Data_Block::clone_nocopy");
// You always want to clear this one to prevent memory leaks but you
// might add some others later.
const ACE_Message_Block::Message_Flags always_clear =
ACE_Message_Block::DONT_DELETE;
const size_t newsize =
max_size == 0 ? this->max_size_ : max_size;
ACE_Data_Block *nb = 0;
ACE_NEW_MALLOC_RETURN (nb,
static_cast<ACE_Data_Block*> (
this->data_block_allocator_->malloc (sizeof (ACE_Data_Block))),
ACE_Data_Block (newsize, // size
this->type_, // type
0, // data
this->allocator_strategy_, // allocator
this->locking_strategy_, // locking strategy
this->flags_, // flags
this->data_block_allocator_),
0);
// Message block initialization may fail while the construction
// succeds. Since as a matter of policy, ACE may throw no
// exceptions, we have to do a separate check like this.
if (nb != 0 && nb->size () < newsize)
{
nb->ACE_Data_Block::~ACE_Data_Block(); // placement destructor ...
this->data_block_allocator_->free (nb); // free ...
errno = ENOMEM;
return 0;
}
// Set new flags minus the mask...
nb->clr_flags (mask | always_clear);
return nb;
}