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


C++ NodeVector类代码示例

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


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

示例1: radiusPoint

void CUniformGrid::GetUnitsInRadius(NodeVector * dstVector, const Vector3 & point, float radius)
{
	const Vector3 radiusPoint(radius, radius, 0);

	int minX, minY;
	CellCoordFromMapPoint(&minX, &minY, point - radiusPoint);
	minX = math::max(0, math::min(minX, (m_Width - 1)));
	minY = math::max(0, math::min(minY, (m_Height - 1)));

	int maxX, maxY;
	CellCoordFromMapPoint(&maxX, &maxY, point + radiusPoint);
	maxX = math::max(0, math::min(maxX, (m_Width - 1)));
	maxY = math::max(0, math::min(maxY, (m_Height - 1)));

	dstVector->clear();

	for (int y = minY; y <= maxY; ++y)
	{
		for (int x = minX; x <= maxX; ++x)
		{
			// FIXME: non optimal - square, refactor me
			NodeVector *  gridVector = GetCell(x, y);
			dstVector->insert(dstVector->end(), gridVector->begin(), gridVector->end());
		}
	}
}
开发者ID:wolves3d,项目名称:PlayrixTest,代码行数:26,代码来源:UniformGrid.cpp

示例2: sortNodes

void sortNodes(NodeVector& all){
	//	int count=0;
	int max=0;
	deque<Node*> sorted;
	for (int i=0; i<all.size(); i++) {
		Node* n=all[i];
		if(n->statementCount>max){
			sorted.push_front(n);
			max=n->statementCount;
		}
		else sorted.push_back(n);
	}
	for (int i=0; i<all.size(); i++) {
		all[i]=sorted[i];
	}
	std::sort(all.begin(), all.end(),sortNodePredicate);
	//	auto x=all.begin();
	//	auto y=all.end();
	//	std::sort(x, y, sortNodePredicate);// [] (Node* a, Node* b){ return a->statementCount > b->statementCount; });
	//	std::sort(all.begin(), all.end(), [] (Node* a, Node* b)->bool { return a->statementCount < b->statementCount; });
	//	showNodes(all,false,false,false);
	//	std::sort(all.begin(), all.end(), [] (Node* a, Node* b) { return a->statementCount < b->statementCount; });
	//	showNodes(all,false,false,false);
	//	std::sort(all.begin(),all.end(),);
	
}
开发者ID:nagyistoce,项目名称:netbase,代码行数:26,代码来源:util.cpp

示例3:

template<class NodeVector> void FileSystem::debugPrintNodes(NodeVector nodes) {
    if( debug) {
        unsigned int ix;
        NodeInfo* node;

        for (ix = 0; ix < nodes.size(); ++ix) {
            node = nodes.at(ix);

            cout << "Node: " << node->getName()
                << "\t\tSize: " << node->getSize()
                << "\tModify: " << node->getModifyTime()
                << "\tPath: " << node->getPath()
                << "\tSimilars: ";
        
            vector<NodeInfo*>::iterator it;
            vector<NodeInfo*> nodes = node->getSimilar();
            for(it=nodes.begin(); it != nodes.end(); ++it) {
                cout << (*it)->getPath() << ", ";
            }

            cout << endl;
        }
    }

}
开发者ID:ruskiyos,项目名称:duplocator,代码行数:25,代码来源:FileSystem.cpp

示例4: Nest_explanation

NodeVector SprFrontend::getDeclsFromNode(Node* n, Node*& baseExp) {
    NodeVector res;
    baseExp = nullptr;

    if (!Nest_computeType(n))
        return {};
    n = Nest_explanation(n);
    ASSERT(n);

    // Check if the node is a DeclExp, pointing to the actual references
    if (n->nodeKind == nkSparrowExpDeclExp) {
        baseExp = at(n->referredNodes, 0);
        res = NodeVector(n->referredNodes.beginPtr + 1, n->referredNodes.endPtr);
        return res;
    }

    // Check if this is a ModuleRef; if so, get the it's referred content (inner most package)
    if (n->nodeKind == nkSparrowExpModuleRef) {
        if (Nest_hasProperty(n, propResultingDecl))
            res = {Nest_getCheckPropertyNode(n, propResultingDecl)};
        return res;
    }

    // If the node represents a type, try to get the declaration associated with the type
    Type t = tryGetTypeValue(n);
    if (t && t.hasStorage()) {
        res.push_back(t.referredNode());
    }

    return res;
}
开发者ID:Sparrow-lang,项目名称:sparrow,代码行数:31,代码来源:DeclsHelpers.cpp

示例5: willRemoveChildren

static void willRemoveChildren(ContainerNode* container)
{
    NodeVector children;
    getChildNodes(container, children);

    container->document()->nodeChildrenWillBeRemoved(container);

#if ENABLE(MUTATION_OBSERVERS)
    ChildListMutationScope mutation(container);
#endif

    for (NodeVector::const_iterator it = children.begin(); it != children.end(); it++) {
        Node* child = it->get();

#if ENABLE(MUTATION_OBSERVERS)
        mutation.willRemoveChild(child);
        child->notifyMutationObserversNodeWillDetach();
#endif
#if ENABLE(UNDO_MANAGER)
        if (UndoManager::isRecordingAutomaticTransaction(container))
            UndoManager::addTransactionStep(NodeRemovingDOMTransactionStep::create(container, child));
#endif

        // fire removed from document mutation events.
        dispatchChildRemovalEvents(child);
    }

    ChildFrameDisconnector(container, ChildFrameDisconnector::DoNotIncludeRoot).disconnect();
}
开发者ID:gobihun,项目名称:webkit,代码行数:29,代码来源:ContainerNode.cpp

示例6:

sure::Scalar sure::keypoints::calculateEntropyWithCrossproducts(const Octree& octree, Node* node, Scalar normalSamplingrate, Scalar radius, Scalar influenceRadius)
{
  FixedPayload mainNormalIntegrate;
  octree.integratePayload(node->fixed().getMeanPosition(), radius, mainNormalIntegrate);
  Normal mainNormal = mainNormalIntegrate.calculateNormal();

  if( mainNormal.isStable() )
  {
    sure::normal::CrossProductHistogram histogram;
    histogram.setInfluenceRadius(influenceRadius);
    NodeVector nodes = octree.getNodes(node->fixed().getMeanPosition(), radius, normalSamplingrate);

    for(unsigned int i=0; i<nodes.size(); ++i)
    {
      Node* currNode = nodes[i];
      NormalPayload* currPayload = static_cast<CrossProductPayload*>(currNode->opt());
      if( currPayload->normal_.isStable())
      {
        histogram.insertCrossProduct(mainNormal.vector(), currPayload->normal_.vector());
      }
    }

    return histogram.calculateEntropy();
  }
  return 0.0;
}
开发者ID:bigjun,项目名称:sure3d,代码行数:26,代码来源:keypoint_calculation.cpp

示例7: ASSERT

void ContainerNode::parserInsertBefore(PassRefPtr<Node> newChild, Node* nextChild)
{
    ASSERT(newChild);
    ASSERT(nextChild);
    ASSERT(nextChild->parentNode() == this);

    NodeVector targets;
    collectTargetNodes(newChild.get(), targets);
    if (targets.isEmpty())
        return;

    if (nextChild->previousSibling() == newChild || nextChild == newChild) // nothing to do
        return;

    RefPtr<Node> next = nextChild;
    RefPtr<Node> nextChildPreviousSibling = nextChild->previousSibling();
    for (NodeVector::const_iterator it = targets.begin(); it != targets.end(); ++it) {
        Node* child = it->get();

        insertBeforeCommon(next.get(), child);

        childrenChanged(true, nextChildPreviousSibling.get(), nextChild, 1);
        ChildNodeInsertionNotifier(this).notify(child);
    }
}
开发者ID:gobihun,项目名称:webkit,代码行数:25,代码来源:ContainerNode.cpp

示例8: InsertTriFaceCentroidNode

int InsertTriFaceCentroidNode(
    int ix0,
    int ix1,
    int ix2,
    NodeVector & vecNodes
) {
    double dX = (vecNodes[ix0].x + vecNodes[ix1].x + vecNodes[ix2].x) / 3.0;
    double dY = (vecNodes[ix0].y + vecNodes[ix1].y + vecNodes[ix2].y) / 3.0;
    double dZ = (vecNodes[ix0].z + vecNodes[ix1].z + vecNodes[ix2].z) / 3.0;

    // Project to sphere
    double dRadius = sqrt(dX*dX + dY*dY + dZ*dZ);

    dX /= dRadius;
    dY /= dRadius;
    dZ /= dRadius;

    // Index
    int ix = vecNodes.size();

    // Insert node
    vecNodes.push_back(Node(dX, dY, dZ));

    return ix;
}
开发者ID:bssrdf,项目名称:tempestremap,代码行数:25,代码来源:GenerateICOMesh.cpp

示例9:

 boost::optional<ParentObject> SetpointManagerFollowOutdoorAirTemperature_Impl::parent() const {
   NodeVector nodes = getObject<ModelObject>().getModelObjectSources<Node>();
   if (nodes.size() == 1u) {
     return nodes[0];
   }
   return boost::none;
 }
开发者ID:Rahjou,项目名称:OpenStudio,代码行数:7,代码来源:SetpointManagerFollowOutdoorAirTemperature.cpp

示例10: ngraph_error

shared_ptr<Node> op::Min::copy_with_new_args(const NodeVector& new_args) const
{
    if (new_args.size() != 1)
    {
        throw ngraph_error("Incorrect number of new arguments");
    }
    return make_shared<Min>(new_args.at(0), m_reduction_axes);
}
开发者ID:okhat,项目名称:ngraph,代码行数:8,代码来源:min.cpp

示例11: ngraph_error

shared_ptr<Node> op::GetOutputElement::copy_with_new_args(const NodeVector& new_args) const
{
    if (new_args.size() != 1)
    {
        throw ngraph_error("Incorrect number of new arguments");
    }
    return make_shared<GetOutputElement>(new_args.at(0), m_n);
}
开发者ID:okhat,项目名称:ngraph,代码行数:8,代码来源:get_output_element.cpp

示例12: ngraph_error

shared_ptr<Node> op::OneHot::copy_with_new_args(const NodeVector& new_args) const
{
    if (new_args.size() != 1)
    {
        throw ngraph_error("Incorrect number of new arguments");
    }
    return make_shared<OneHot>(new_args.at(0), m_shape, m_one_hot_axis);
}
开发者ID:okhat,项目名称:ngraph,代码行数:8,代码来源:one_hot.cpp

示例13: ngraph_error

shared_ptr<Node> op::Cos::copy_with_new_args(const NodeVector& new_args) const
{
    if (new_args.size() != 1)
    {
        throw ngraph_error("Incorrect number of new arguments");
    }
    return make_shared<Cos>(new_args.at(0));
}
开发者ID:okhat,项目名称:ngraph,代码行数:8,代码来源:cos.cpp

示例14: wrapFuncArgs

void InitRootTypes::wrapFuncArgs(NodeVector& args, const NodeVector& funcArgs)
{
	for (NodeVector::const_iterator it = funcArgs.begin(); it != funcArgs.end(); it++) {
		const FuncArg::Ptr& funcArg = FuncArg::from(*it);
		TupleTypeArg::Ptr arg(new TupleTypeArg);
		arg->setName(funcArg->getName());
		arg->setType(funcArg->getPossibleType());
		args.push_back(arg);
	}
}
开发者ID:fabianschuiki,项目名称:Maxwell,代码行数:10,代码来源:InitRootTypes.cpp

示例15: depthFirstMap

vector<Algorithm*> Network::innerVisibleAlgorithms(Algorithm* algo) {
  NetworkNode* visibleNetworkRoot = visibleNetwork<NetworkNode>(algo);

  vector<Algorithm*> algos = depthFirstMap(visibleNetworkRoot, returnAlgorithm);

  NodeVector nodes = depthFirstSearch(visibleNetworkRoot);
  for (int i=0; i<(int)nodes.size(); i++) delete nodes[i];

  return algos;
}
开发者ID:spherepeer,项目名称:essentia,代码行数:10,代码来源:network.cpp


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