本文整理汇总了C++中Items::reserve方法的典型用法代码示例。如果您正苦于以下问题:C++ Items::reserve方法的具体用法?C++ Items::reserve怎么用?C++ Items::reserve使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Items
的用法示例。
在下文中一共展示了Items::reserve方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: assert
void RowCollection<Group,Hash>::getWholeRow(size_t rowId, Items& items, bool separateNull, uint32_t attrId, Items* pNullItems) {
assert(_mode==RowCollectionModeRead);
assert(separateNull || (pNullItems==NULL));
assert(items.empty());
if (pNullItems!=NULL) {
assert(pNullItems->empty());
}
boost::scoped_ptr<MyRowIterator> rowIterator(openRow(rowId));
items.reserve(_counts[rowId]);
TypeId strType = _attributes[attrId].getType();
DoubleFloatOther type = getDoubleFloatOther(strType);
while (!rowIterator->end()) {
vector<Value> item(_attributes.size());
rowIterator->getItem(item);
if (separateNull && isNullOrNan(item[attrId], type)) {
if (pNullItems!=NULL) {
pNullItems->push_back(item);
}
} else {
items.push_back(item);
}
++(*rowIterator);
}
}
示例2: rootname
void FillTreeClass<T>::setTreeInternal1(T& _safelocker, Items& _items, ThreadedItems& _topLevelItems, ::profiler::timestamp_t& _beginTime, const unsigned int _blocksNumber, const ::profiler::thread_blocks_tree_t& _blocksTree, bool _colorizeRows)
{
_items.reserve(_blocksNumber + _blocksTree.size()); // _blocksNumber does not include Thread root blocks
::profiler::timestamp_t finishtime = 0;
for (const auto& threadTree : _blocksTree)
{
const auto node_block = blocksTree(threadTree.second.children.front()).node;
const auto startTime = node_block->begin();
const auto endTime = node_block->end();
if (_beginTime > startTime)
_beginTime = startTime;
if (finishtime < endTime)
finishtime = endTime;
}
//const QSignalBlocker b(this);
const auto u_thread = ::profiler_gui::toUnicode("thread");
int i = 0;
const int total = static_cast<int>(_blocksTree.size());
for (const auto& threadTree : _blocksTree)
{
if (_safelocker.interrupted())
break;
const auto& root = threadTree.second;
auto item = new EasyTreeWidgetItem();
QString threadName;
if (root.got_name())
{
QString rootname(::profiler_gui::toUnicode(root.name()));
if (rootname.contains(u_thread, Qt::CaseInsensitive))
threadName = ::std::move(QString("%1 %2").arg(rootname).arg(root.thread_id));
else
threadName = ::std::move(QString("%1 Thread %2").arg(rootname).arg(root.thread_id));
}
else
{
threadName = ::std::move(QString("Thread %1").arg(root.thread_id));
}
item->setText(COL_NAME, threadName);
::profiler::timestamp_t duration = 0;
if (!root.children.empty())
duration = blocksTree(root.children.back()).node->end() - blocksTree(root.children.front()).node->begin();
item->setTimeSmart(COL_DURATION, duration);
item->setBackgroundColor(::profiler_gui::SELECTED_THREAD_BACKGROUND);
item->setTextColor(::profiler_gui::SELECTED_THREAD_FOREGROUND);
//_items.push_back(item);
item->setTimeSmart(COL_SELF_DURATION, root.active_time);
::profiler::timestamp_t children_duration = 0;
const auto children_items_number = FillTreeClass<T>::setTreeInternal(_safelocker, _items, _beginTime, root.children, item, nullptr, item, _beginTime, finishtime + 1000000000ULL, false, children_duration, _colorizeRows);
if (children_items_number > 0)
{
//total_items += children_items_number + 1;
//addTopLevelItem(item);
//m_roots[threadTree.first] = item;
_topLevelItems.emplace_back(root.thread_id, item);
}
else
{
//_items.pop_back();
delete item;
}
_safelocker.setProgress((100 * ++i) / total);
}
_safelocker.setDone();
//return total_items;
}