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


C++ NodeMap::end方法代码示例

本文整理汇总了C++中NodeMap::end方法的典型用法代码示例。如果您正苦于以下问题:C++ NodeMap::end方法的具体用法?C++ NodeMap::end怎么用?C++ NodeMap::end使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在NodeMap的用法示例。


在下文中一共展示了NodeMap::end方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: mirrorEdge

HLink MLGDao::mirrorEdge( const HLink& current, Direction dir, const Layer& newLayer, NodeMap& nodeMap )
{
    // Find equivalent in top layer
    Node topSrc;
    auto it = nodeMap.find(current.source());
    if( it != nodeMap.end() ) { // not found
        topSrc = it->second;
    }
    else {
        topSrc = mirrorNode(current.source(), dir, newLayer);
        nodeMap.emplace(current.source(), topSrc);
    }

    Node topTgt;
    it = nodeMap.find(current.target());
    if( it != nodeMap.end() ) { // not found
        topTgt = it->second;
    }
    else {
        topTgt = mirrorNode(current.target(), dir, newLayer);
        // Add to map to retrieve edges
        nodeMap.emplace(current.target(), topTgt);
    }
    // Add new HLink
    return m_link->addHLink(topSrc.id(), topTgt.id(), current.weight());
}
开发者ID:caomw,项目名称:mld,代码行数:26,代码来源:MLGDao.cpp

示例2: addInTree

    static void addInTree(AstNode* nodep, bool linkable) {
#ifndef VL_LEAK_CHECKS
	if (!linkable) return;  // save some time, else the map will get huge!
#endif
	NodeMap::iterator iter = s_nodes.find(nodep);
	if (iter == s_nodes.end()) {
#ifdef VL_LEAK_CHECKS
	    nodep->v3fatalSrc("AstNode is in tree, but not allocated\n");
#endif
	} else {
	    if (!(iter->second & FLAG_ALLOCATED)) {
#ifdef VL_LEAK_CHECKS
		nodep->v3fatalSrc("AstNode is in tree, but not allocated\n");
#endif
	    }
	    if (iter->second & FLAG_IN_TREE) {
		nodep->v3fatalSrc("AstNode is already in tree at another location\n");
	    }
	}
	int or_flags = FLAG_IN_TREE | (linkable?FLAG_LINKABLE:0);
	if (iter == s_nodes.end()) {
	    s_nodes.insert(make_pair(nodep,or_flags));
	} else {
	    iter->second |= or_flags;
	}
    }
开发者ID:mballance,项目名称:verilator,代码行数:26,代码来源:V3Broken.cpp

示例3: deleted

    // METHODS
    static void deleted(const AstNode* nodep) {
	// Called by operator delete on any node - only if VL_LEAK_CHECKS
	if (debug()>=9) cout<<"-nodeDel:  "<<(void*)(nodep)<<endl;
	NodeMap::iterator iter = s_nodes.find(nodep);
	if (iter==s_nodes.end() || !(iter->second & FLAG_ALLOCATED)) {
	    ((AstNode*)(nodep))->v3fatalSrc("Deleting AstNode object that was never tracked or already deleted\n");
	}
	if (iter!=s_nodes.end()) s_nodes.erase(iter);
    }
开发者ID:mballance,项目名称:verilator,代码行数:10,代码来源:V3Broken.cpp

示例4: addNewed

    static void addNewed(const AstNode* nodep) {
	// Called by operator new on any node - only if VL_LEAK_CHECKS
	if (debug()) cout<<"-nodeNew:  "<<(void*)(nodep)<<endl;
	NodeMap::iterator iter = s_nodes.find(nodep);
	if (iter!=s_nodes.end() || (iter->second & FLAG_ALLOCATED)) {
	    ((AstNode*)(nodep))->v3fatalSrc("Newing AstNode object that is already allocated\n");
	}
	if (iter == s_nodes.end()) {
	    s_nodes.insert(make_pair(nodep,FLAG_ALLOCATED));
	}
    }
开发者ID:torc-isi,项目名称:torc,代码行数:11,代码来源:V3Broken.cpp

示例5: HandleNodeReq

void CKadHandler::HandleNodeReq(const CVariant& NodeReq, CKadNode* pNode, CComChannel* pChannel)
{
	if(GetParent<CKademlia>()->Cfg()->GetBool("DebugRT"))
		LogLine(LOG_DEBUG, L"Recived 'Node Resuest' to %s", pNode->GetID().ToHex().c_str());

	CVariant NodeRes;

	uint32 uDesiredCount = NodeReq["RCT"];
	if(uDesiredCount == 0)
		throw CException(LOG_ERROR, L"node requested 0 nodes");

	int iMaxState = NodeReq.Get("MNC", NODE_2ND_CLASS);

	NodeMap Nodes;
	if(!NodeReq.Has("TID"))
		GetParent<CKademlia>()->Root()->GetBootstrapNodes(GetParent<CKademlia>()->Root()->GetID(), Nodes, uDesiredCount, pChannel->GetAddress().GetProtocol(), iMaxState);
	else
		GetParent<CKademlia>()->Root()->GetClosestNodes(NodeReq["TID"], Nodes, uDesiredCount, pChannel->GetAddress().GetProtocol(), iMaxState);
	
	CVariant List;
	for(NodeMap::iterator I = Nodes.begin(); I != Nodes.end(); I++)
		List.Append(I->second->Store());
	NodeRes["LIST"] = List;

	if(GetParent<CKademlia>()->Cfg()->GetBool("DebugRT"))
		LogLine(LOG_DEBUG, L"Sending 'Node Response' to %s", pNode->GetID().ToHex().c_str());
	pChannel->QueuePacket(KAD_NODE_RESPONSE, NodeRes);
}
开发者ID:0vermind,项目名称:NeoLoader,代码行数:28,代码来源:KadHandler.cpp

示例6: MakePowerLine

void UtilOSMVisitor::MakePowerLine()
{
	m_line = m_util_layer->AddNewLine();

	m_line->m_poles.resize(m_refs.size());
	for (uint r = 0; r < m_refs.size(); r++)
	{
		int idx = m_refs[r];

		// Look for that node by id; if we don't find it, then it wasn't a tower;
		// it was probably a start or end point at a non-tower feature.
		NodeMap::iterator it = m_nodes.find(m_id);
		if (it != m_nodes.end())
		{
			// Connect to a known pole.
			m_line->m_poles[r] = m_nodes[idx].pole;
		}
		else
		{
			// We need to make a new pole node.
			OSMNode &node = m_nodes[idx];

			m_pole = m_util_layer->AddNewPole();
			m_pole->m_id = idx;
			m_pole->m_p = node.p;

			node.pole = m_pole;

			// Then we can connect it
			m_line->m_poles[r] = m_pole;
		}
	}
}
开发者ID:kamalsirsa,项目名称:vtp,代码行数:33,代码来源:UtilityMap.cpp

示例7: remove

		void remove(NetNodeIntern* node) {
			NodeMap::iterator f = nodeMap.find(node);
			if(f != nodeMap.end()) {
				updates.erase(f->second);
				nodeMap.erase(f);
			}
		}
开发者ID:iamnilay3,项目名称:openlierox,代码行数:7,代码来源:netstream.cpp

示例8: okIfBelow

    static bool okIfBelow(const AstNode* nodep) {
	// Must be linked to and below current node
	if (!okIfLinkedTo(nodep)) return false;
	NodeMap::iterator iter = s_nodes.find(nodep);
	if (iter == s_nodes.end()) return false;
	if (!(iter->second & FLAG_UNDER_NOW)) return false;
	return true;
    }
开发者ID:mballance,项目名称:verilator,代码行数:8,代码来源:V3Broken.cpp

示例9: prepForTree

    static void prepForTree() {
#ifndef VL_LEAK_CHECKS
	s_nodes.clear();
#endif
	for (NodeMap::iterator it = s_nodes.begin(); it != s_nodes.end(); ++it) {
	    it->second &= ~FLAG_IN_TREE;
	    it->second &= ~FLAG_LINKABLE;
	}
    }
开发者ID:mballance,项目名称:verilator,代码行数:9,代码来源:V3Broken.cpp

示例10: setUnder

    static void setUnder(const AstNode* nodep, bool flag) {
	// Called by BrokenCheckVisitor when each node entered/exited
	if (!okIfLinkedTo(nodep)) return;
	NodeMap::iterator iter = s_nodes.find(nodep);
	if (iter!=s_nodes.end()) {
	    iter->second &= ~FLAG_UNDER_NOW;
	    if (flag) iter->second |=  FLAG_UNDER_NOW;
	}
    }
开发者ID:mballance,项目名称:verilator,代码行数:9,代码来源:V3Broken.cpp

示例11: recursiveTopSort

Status InitializerDependencyGraph::recursiveTopSort(
    const NodeMap& nodeMap,
    const Node& currentNode,
    std::vector<std::string>* inProgressNodeNames,
    stdx::unordered_set<std::string>* visitedNodeNames,
    std::vector<std::string>* sortedNames) {

    /*
     * The top sort is performed by depth-first traversal starting at each node in the
     * dependency graph, short-circuited any time a node is seen that has already been visited
     * in any traversal.  "visitedNodeNames" is the set of nodes that have been successfully
     * visited, while "inProgressNodeNames" are nodes currently in the exploration chain.  This
     * structure is kept explicitly to facilitate cycle detection.
     *
     * This function implements a depth-first traversal, and is called once for each node in the
     * graph by topSort(), above.
     */

    if ((*visitedNodeNames).count(currentNode.first))
        return Status::OK();

    inProgressNodeNames->push_back(currentNode.first);

    auto firstOccurence =
        std::find(inProgressNodeNames->begin(), inProgressNodeNames->end(), currentNode.first);
    if (std::next(firstOccurence) != inProgressNodeNames->end()) {
        sortedNames->clear();
        std::copy(firstOccurence, inProgressNodeNames->end(), std::back_inserter(*sortedNames));
        std::ostringstream os;
        os << "Cycle in dependendcy graph: " << sortedNames->at(0);
        for (size_t i = 1; i < sortedNames->size(); ++i)
            os << " -> " << sortedNames->at(i);
        return Status(ErrorCodes::GraphContainsCycle, os.str());
    }

    for (const auto& prereq : currentNode.second.prerequisites) {
        auto nextNode = nodeMap.find(prereq);
        if (nextNode == nodeMap.end()) {
            std::ostringstream os;
            os << "Initializer " << currentNode.first << " depends on missing initializer "
               << prereq;
            return {ErrorCodes::BadValue, os.str()};
        }

        Status status = recursiveTopSort(
            nodeMap, *nextNode, inProgressNodeNames, visitedNodeNames, sortedNames);
        if (Status::OK() != status)
            return status;
    }
    sortedNames->push_back(currentNode.first);
    if (inProgressNodeNames->back() != currentNode.first)
        return Status(ErrorCodes::InternalError, "inProgressNodeNames stack corrupt");
    inProgressNodeNames->pop_back();
    visitedNodeNames->insert(currentNode.first);
    return Status::OK();
}
开发者ID:EvgeniyPatlan,项目名称:percona-server-mongodb,代码行数:56,代码来源:initializer_dependency_graph.cpp

示例12: pushUpdate

		void pushUpdate(const DataPackage& p) {
			NodeMap::iterator f = nodeMap.find(p.node.get());
			if(f != nodeMap.end()) {
				*f->second = p;
			}
			else {
				updates.push_back(p);
				Updates::iterator& last = nodeMap[p.node.get()] = updates.end(); --last;
			}
		}
开发者ID:iamnilay3,项目名称:openlierox,代码行数:10,代码来源:netstream.cpp

示例13: PMap

 void PMap(const NodeMap& m)
 {
   // print out map
   NodeMap::const_iterator it;
   pout() << "Node map has " << m.size() << " nodes\n";
   for (it=m.begin(); it!=m.end(); it++)
   {
     pout() << "node "; PIV(it->first); pout() << ": " << it->second << "\n";
   }
 }
开发者ID:dtgraves,项目名称:EBAMRCNS,代码行数:10,代码来源:STLUtil.cpp

示例14: AddNodes

void CLookupHistory::AddNodes(const NodeMap& Nodes, const CUInt128& ByID)
{
	for(NodeMap::const_iterator I = Nodes.begin(); I != Nodes.end(); I++)
	{
		LookupNodeMap::iterator J = m_Nodes.find(I->second->GetID());
		if(J == m_Nodes.end())
			J = m_Nodes.insert(LookupNodeMap::value_type(I->second->GetID(), SLookupNode())).first;
		J->second.FoundByIDs.push_back(ByID == 0 ? SELF_NODE : ByID);
	}
}
开发者ID:0vermind,项目名称:NeoLoader,代码行数:10,代码来源:LookupHistory.cpp

示例15: MakeCloseTarget

CUInt128 CKademlia::MakeCloseTarget(int *pDistance)
{
	if(!m_pKadHandler)
	{
		if(pDistance)
			*pDistance = -1;
		return 0;
	}

	CUInt128 uMyID = m_pRootZone->GetID();
	NodeMap Nodes;
	m_pRootZone->GetClosestNodes(uMyID, Nodes, Cfg()->GetInt("BucketSize"));
	if(Nodes.size() < 2)
	{
		if(pDistance)
			*pDistance = -1;
		return 0;
	}
	
	// Find Median distance difference between nodes closest to us
	vector<CUInt128> Diff;
	for(NodeMap::iterator np = Nodes.begin(), n = np++; np != Nodes.end(); n = np++)
		Diff.push_back(np->first - n->first);
	CUInt128 Sep = Median(Diff);

	// generate ID that is closer to us than the closest node by a few difference
	CUInt128 uDistance = Nodes.begin()->first;
	for(int i=0; i < 3 && uDistance > Sep; i++)
		uDistance = uDistance - Sep;
	CUInt128 uCloser = uMyID ^ uDistance;

	// count the matchign bits
	UINT uLevel=0;
	for(; uLevel < uMyID.GetBitSize(); uLevel++)
	{
		if(uCloser.GetBit(uLevel) != uMyID.GetBit(uLevel))
			break;
	}

	// add a few more matching bytes
	for(UINT i=0; i < 4 && uLevel < uMyID.GetBitSize() - 1; i++)
	{
		uCloser.SetBit(uLevel, uMyID.GetBit(uLevel));
		uLevel++;
	}

	if(pDistance)
		*pDistance = (int)uMyID.GetBitSize() - uLevel;

	// create a random ID that we are closest to
	CUInt128 uRandom(uCloser, uLevel);
	//wstring sTest = (uMyID ^ uRandom).ToBin();
	return uRandom;
}
开发者ID:0vermind,项目名称:NeoLoader,代码行数:54,代码来源:Kademlia.cpp


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