本文整理汇总了C++中QMultiHash::begin方法的典型用法代码示例。如果您正苦于以下问题:C++ QMultiHash::begin方法的具体用法?C++ QMultiHash::begin怎么用?C++ QMultiHash::begin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QMultiHash
的用法示例。
在下文中一共展示了QMultiHash::begin方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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);
}
}
示例2: Init
void CDspVmAutoTaskManagerBase::Init()
{
WRITE_TRACE( DBG_DEBUG, "Initializing %s manager", getManagerName() );
QMultiHash<QString , SmartPtr<CVmConfiguration> > hashAllVms
= CDspService::instance()->getVmDirHelper().getAllVmList();
QMultiHash<QString , SmartPtr<CVmConfiguration> >::iterator it;
for(it = hashAllVms.begin(); it != hashAllVms.end(); ++it)
{
SmartPtr<CVmConfiguration> pVmConfig = it.value();
PRL_ASSERT(pVmConfig);
if (isEnabled(pVmConfig, true))
{
PRL_RESULT res = tryToRegisterVm(pVmConfig, it.key());
if (PRL_FAILED(res))
WRITE_TRACE(DBG_FATAL,
"Can't register VM %s in Auto-task Manager during starting dispetcher."
"Error: 0x%x, (%s).",
QSTR2UTF8(pVmConfig->getVmIdentification()->getVmUuid()),
res, PRL_RESULT_TO_STRING(res) );
}
}
m_bInitialized = true;
}
示例3: main
int main()
{
QSet<QString *> s;
qDeleteAll(s);
qDeleteAll(s.begin(), s.end());
qDeleteAll(s.values()); // warning
QHash<int, QString *> h;
qDeleteAll(h);
qDeleteAll(h.begin(), h.end());
qDeleteAll(h.values()); // warning
QMap<int*, QString *> m;
qDeleteAll(m);
qDeleteAll(m.begin(), m.end());
qDeleteAll(m.values()); // warning
QMultiHash<int, QString *> mh;
qDeleteAll(mh);
qDeleteAll(mh.begin(), mh.end());
qDeleteAll(mh.values()); // warning
QMultiMap<int, QString *> mm;
qDeleteAll(mm);
qDeleteAll(mm.begin(), mm.end());
qDeleteAll(mm.values()); // warning
qDeleteAll(values()); // ok
Foo foo;
qDeleteAll(foo.values()); // ok
qDeleteAll(foo.doSomethingWithValues(h.values())); // ok
qDeleteAll(m.keys()); // warning
qDeleteAll(keys()); // ok
qDeleteAll(h.values(1)); // warning
}