当前位置: 首页>>代码示例>>C++>>正文


C++ QMultiHash::begin方法代码示例

本文整理汇总了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);
	}
}
开发者ID:league1991,项目名称:CodeView,代码行数:57,代码来源:SymbolModifier.cpp

示例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;
}
开发者ID:Lantame,项目名称:prl-disp-service,代码行数:27,代码来源:CDspVmAutoTaskManagerBase.cpp

示例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

}
开发者ID:EugeneZelenko,项目名称:clazy,代码行数:39,代码来源:main.cpp


注:本文中的QMultiHash::begin方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。