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


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

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


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

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

示例2: handleNodeStatus

    void handleNodeStatus(const ReceivedDataStructure<protocol::NodeStatus>& msg)
    {
        if (!needToQuery(msg.getSrcNodeID()))
        {
            return;
        }

        NodeData* data = node_map_.access(msg.getSrcNodeID());
        if (data == NULL)
        {
            trace(TraceDiscoveryNewNodeFound, msg.getSrcNodeID().get());

            data = node_map_.insert(msg.getSrcNodeID(), NodeData());
            if (data == NULL)
            {
                getNode().registerInternalFailure("NodeDiscoverer OOM");
                return;
            }
        }
        UAVCAN_ASSERT(data != NULL);

        if (msg.uptime_sec < data->last_seen_uptime)
        {
            trace(TraceDiscoveryNodeRestartDetected, msg.getSrcNodeID().get());
            data->num_get_node_info_attempts = 0;
        }
        data->last_seen_uptime = msg.uptime_sec;

        if (!isRunning())
        {
            startPeriodic(MonotonicDuration::fromMSec(TimerPollIntervalMs));
            trace(TraceDiscoveryTimerStart, getPeriod().toUSec());
        }
    }
开发者ID:tstellanova,项目名称:libuavcan,代码行数:34,代码来源:node_discoverer.hpp

示例3: HandleNodeRes

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

	CVariant List = NodeRes["LIST"];
	if(List.Count() > (uint32)GetParent<CKademlia>()->Cfg()->GetInt("NodeReqCount"))
		throw CException(LOG_ERROR, L"Node returned more nodes than requested (spam)");
	
	SKadData* pData = pChannel->GetData<SKadData>();
	// Note: if pData->pLookup is NULL this was just a bootstrap request

	NodeMap Nodes;
	for(uint32 i = 0; i<List.Count(); i++)
	{
		CPointer<CKadNode> pNewNode = new CKadNode(GetParent<CKademlia>()->Root());
		pNewNode->Load(List.At(i));
		if(GetParent<CKademlia>()->Root()->AddNode(pNewNode) && pData->pLookup)
		{
			CUInt128 uDistance = pData->pLookup->GetID() ^ pNewNode->GetID();
			Nodes.insert(NodeMap::value_type(uDistance, pNewNode));
		}
	}

	if(pData->pLookup)
		GetParent<CKademlia>()->Manager()->AddNodes(pData->pLookup, pNode, pChannel, Nodes);
}
开发者ID:0vermind,项目名称:NeoLoader,代码行数:27,代码来源:KadHandler.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: make_pair

std::pair<long, float> AntipoleInternalNode::visitNode(const std::vector<float>& image, float, NodeMap& node_map) const
{
  node_map.insert(std::make_pair(HelperFunctions::distance2(image, left->getCenter()) - left->getRadius(), left));
  node_map.insert(std::make_pair(HelperFunctions::distance2(image, right->getCenter()) - right->getRadius(), right));
  return std::make_pair(-1, std::numeric_limits<float>::max());
}
开发者ID:mbrucher,项目名称:QtMosaic,代码行数:6,代码来源:AntipoleTree.cpp


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