本文整理汇总了C++中QMultiHash::size方法的典型用法代码示例。如果您正苦于以下问题:C++ QMultiHash::size方法的具体用法?C++ QMultiHash::size怎么用?C++ QMultiHash::size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QMultiHash
的用法示例。
在下文中一共展示了QMultiHash::size方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: mythfile_open_register_callback
void mythfile_open_register_callback(const char *pathname, void* object,
callback_t func)
{
m_callbackLock.lock();
QString path(pathname);
if (m_fileOpenCallbacks.contains(path))
{
// if we already have a callback registered for this path with this
// object then remove the callback and return (i.e. end callback)
QMutableHashIterator<QString,Callback> it(m_fileOpenCallbacks);
while (it.hasNext())
{
it.next();
if (object == it.value().m_object)
{
it.remove();
VERBOSE(VB_PLAYBACK, LOC +
QString("Removing fileopen callback for %1").arg(path));
VERBOSE(VB_PLAYBACK, LOC + QString("%1 callbacks remaining")
.arg(m_fileOpenCallbacks.size()));
m_callbackLock.unlock();
return;
}
}
}
Callback new_callback(object, func);
m_fileOpenCallbacks.insert(path, new_callback);
VERBOSE(VB_PLAYBACK, LOC +
QString("Added fileopen callback for %1").arg(path));
VERBOSE(VB_PLAYBACK, LOC + QString("%1 callbacks open")
.arg(m_fileOpenCallbacks.size()));
m_callbackLock.unlock();
}
示例2: sizeof
void CodeAtlas::FuzzyDependBuilder::buildChildDepend( QMultiHash<QString, ChildPack>& childList ,
Eigen::SparseMatrix<double>& vtxEdgeMat,
Eigen::VectorXd& edgeWeightVec,
QList<FuzzyDependAttr::DependPair>& dependPair)
{
QStringList codeList;
QVector<ChildPack*> childPackPtr;
for (QMultiHash<QString, ChildPack>::Iterator pChild = childList.begin();
pChild != childList.end(); ++pChild)
{
codeList.push_back(pChild.value().m_code);
childPackPtr.push_back(&pChild.value());
}
std::vector<Triplet> tripletArray;
QVector<double> edgeWeightArray;
// add dependency edges between child nodes
int ithSrc = 0;
for (QMultiHash<QString, ChildPack>::Iterator pChild = childList.begin();
pChild != childList.end(); ++pChild, ++ithSrc)
{
// for each child, find number of occurrences of this child's name
ChildPack& srcChild = pChild.value();
const QString& srcName = pChild.key();
QVector<int> occurence;
WordExtractor::findOccurrence(srcName, codeList, occurence);
for (int ithTar = 0; ithTar < childPackPtr.size(); ++ithTar)
{
int nOccur = occurence[ithTar];
if (nOccur == 0 || ithTar == ithSrc)
continue;
ChildPack& tarChild = *childPackPtr[ithTar];
SymbolEdge::Ptr pEdge = SymbolTree::getOrAddEdge(srcChild.m_pNode, tarChild.m_pNode, SymbolEdge::EDGE_FUZZY_DEPEND);
pEdge->clear();
pEdge->strength() = nOccur;
int nEdge = tripletArray.size()/2;
tripletArray.push_back(Triplet(srcChild.m_index, nEdge ,1.0));
tripletArray.push_back(Triplet(tarChild.m_index, nEdge ,-1.0));
edgeWeightArray.push_back(nOccur);
dependPair.push_back(FuzzyDependAttr::DependPair(srcChild.m_pNode, tarChild.m_pNode, nOccur));
}
}
if (int nEdges = tripletArray.size()/2)
{
vtxEdgeMat.resize(childList.size(),nEdges);
vtxEdgeMat.setFromTriplets(tripletArray.begin(), tripletArray.end());
edgeWeightVec.resize(nEdges);
memcpy(edgeWeightVec.data(), edgeWeightArray.data(), sizeof(double)* nEdges);
}
}