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


C++ NodeIterator类代码示例

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


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

示例1: n

//------------------------------------------------------------------------------
void TreeDrawer::CalcCoordinates ()
{
	double l = t->GetNumLeaves();
    leafGap = height / (l - 1.0);
	if (rooted)
    	nodeGap = width / l;
    else
    	nodeGap = width / (l - 1.0);
	leafCount = 0;

    if (rooted)
    {
    	// Allow for edge below root
    	left += nodeGap;
        width -= nodeGap;
    }

    NodeIterator <Node> n (t->GetRoot());
    Node *q = n.begin();
    while (q)
    {
    	if (q->IsLeaf ())
        {
        	CalcLeaf (q);
        }
        else
        {
			CalcInternal (q);
        }

        q = n.next();
    }

}
开发者ID:bomeara,项目名称:omearatenure,代码行数:35,代码来源:treedrawer.cpp

示例2: QObject

WordGraph::WordGraph(const WordGraph &o)
    : QObject(o.parent()), m_disabledNodes(o.m_disabledNodes), m_disabledEdges(o.m_disabledEdges),
      m_centralNodeId(o.m_centralNodeId), m_signalsEnabled(false)
{
    ConstNodeIterator nodeIterEnd = o.m_nodes.constEnd();
    ConstNodeIterator nodeIter;
    for (nodeIter = o.m_nodes.constBegin(); nodeIter != nodeIterEnd; ++nodeIter) {
        m_nodes[nodeIter.key()] = nodeIter.value()->clone();
        m_nodes[nodeIter.key()]->m_graph = this;
    }

    ConstEdgeIterator edgeIterEnd = o.m_edges.constEnd();
    ConstEdgeIterator edgeIter;
    for (edgeIter = o.m_edges.constBegin(); edgeIter != edgeIterEnd; ++edgeIter) {
        Edge *cloneEdge = edgeIter.value()->clone();
        cloneEdge->m_graph = this;
        cloneEdge->m_source = m_nodes[cloneEdge->m_source->id()];
        cloneEdge->m_dest = m_nodes[cloneEdge->m_dest->id()];
        m_edges[edgeIter.key()] = cloneEdge;
    }

    // Replace each node edges with this graph edges.
    NodeIterator myNodeIterEnd = m_nodes.end();
    for (NodeIterator iter = m_nodes.begin(); iter != myNodeIterEnd; ++iter) {
        QSet<Edge*> newEdges;
        QSet<Edge*> curEdges = iter.value()->edges();
        foreach (Edge *edge, curEdges)
            newEdges << m_edges[edge->id()];

        iter.value()->m_edges = newEdges;
    }
}
开发者ID:printedheart,项目名称:synonym,代码行数:32,代码来源:wordgraph.cpp

示例3: jsNodeIteratorPointerBeforeReferenceNode

JSValue jsNodeIteratorPointerBeforeReferenceNode(ExecState* exec, const Identifier&, const PropertySlot& slot)
{
    JSNodeIterator* castedThis = static_cast<JSNodeIterator*>(asObject(slot.slotBase()));
    UNUSED_PARAM(exec);
    NodeIterator* imp = static_cast<NodeIterator*>(castedThis->impl());
    return jsBoolean(imp->pointerBeforeReferenceNode());
}
开发者ID:Mr-Kumar-Abhishek,项目名称:qt,代码行数:7,代码来源:JSNodeIterator.cpp

示例4: PullSend

void PullSend::Execute() {
  if (_resched) {
    Action* ps_event = new PullSend(_node, _sched, _net, _resched);
    _sched.after(ps_rate, ps_event);
  }

  LitterNode& lnode = dynamic_cast<LitterNode&>(_node);
  if (lnode.getOnline() == false) return;

  int end = _sched.getCurrentTime();
  int start = lnode.getLastPull();
  lnode.setLastPull(_sched.getCurrentTime());

  int delay = 0;
  NodeIterator* ni = lnode.getNeighborIT();
  while (ni->moveNext()) {
    Node* neighbor = ni->current();
    LitterNode& dest = dynamic_cast<LitterNode&>(*neighbor);
    if (dest.getOnline() == true) {
      Action* pr_event = new PullRcv(*neighbor, _node, _sched, _net, start, 
                                      end);
      LitterNetwork& lnet = dynamic_cast<LitterNetwork&>(_net);
      lnet.send(lnode, dest, *pr_event, _sched, delay++);
      lnode.stats.pulltx++;
    }
  }
}
开发者ID:pstjuste,项目名称:netmodeler,代码行数:27,代码来源:litter.cpp

示例5: jsNodeIteratorReferenceNode

JSValue jsNodeIteratorReferenceNode(ExecState* exec, const Identifier&, const PropertySlot& slot)
{
    JSNodeIterator* castedThis = static_cast<JSNodeIterator*>(asObject(slot.slotBase()));
    UNUSED_PARAM(exec);
    NodeIterator* imp = static_cast<NodeIterator*>(castedThis->impl());
    return toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->referenceNode()));
}
开发者ID:Mr-Kumar-Abhishek,项目名称:qt,代码行数:7,代码来源:JSNodeIterator.cpp

示例6: GapRcv

void CheckGap::send(Node& node, int start, int end) {
  LitterNode& lnode = dynamic_cast<LitterNode&>(_node);
  LitterNode& dnode = dynamic_cast<LitterNode&>(node);

  lnode.stats.gapfound++;

  if (dnode.getOnline() == true) {
    Action* pr_event = new GapRcv(node, _node, _sched, _net,
                                    start, end, node);
    LitterNetwork& lnet = dynamic_cast<LitterNetwork&>(_net);
    lnet.send(lnode, dnode, *pr_event, _sched);
    lnode.stats.gaptx++;
  }
  else {
    NodeIterator* ni = lnode.getNeighborIT();
    while (ni->moveNext()) {
      Node* neighbor = ni->current();
      LitterNode& dest = dynamic_cast<LitterNode&>(*neighbor);
      if (dest.getOnline() == true) {
        LitterNetwork& lnet = dynamic_cast<LitterNetwork&>(_net);
        if ( lnet.isNeighbor(dnode, dest)) {
          Action* pr_event = new GapRcv(*neighbor, _node, _sched, _net,
                                          start, end, node);
          lnet.send(lnode, dest, *pr_event, _sched);
          lnode.stats.gaptx++;
          break;
        }
      }
    }
  }
}
开发者ID:pstjuste,项目名称:netmodeler,代码行数:31,代码来源:litter.cpp

示例7: TEST

//-----------------------------------------------------------------------------
TEST(conduit_blueprint_mcarray_examples, mcarray_xyz)
{
    // we are using one node to hold group of example mcarrays purely out of 
    // convenience
    Node dsets;
    index_t npts = 100;
    
    blueprint::mcarray::examples::xyz("interleaved",
                                  npts,
                                  dsets["interleaved"]);

    blueprint::mcarray::examples::xyz("separate",
                                  npts,
                                  dsets["separate"]);

    blueprint::mcarray::examples::xyz("contiguous",
                                  npts,
                                  dsets["contiguous"]);
    NodeIterator itr = dsets.children();
    
    while(itr.has_next())
    {
        Node info;
        Node &mcarray = itr.next();
        std::string name = itr.name();
        // TODO: tests!
    }
}
开发者ID:LLNL,项目名称:conduit,代码行数:29,代码来源:t_blueprint_mcarray_examples.cpp

示例8: throwError

JSValue* JSNodeIteratorPrototypeFunction::callAsFunction(ExecState* exec, JSObject* thisObj, const List& args)
{
    if (!thisObj->inherits(&JSNodeIterator::info))
      return throwError(exec, TypeError);

    NodeIterator* imp = static_cast<NodeIterator*>(static_cast<JSNodeIterator*>(thisObj)->impl());

    switch (id) {
    case JSNodeIterator::NextNodeFuncNum: {
        ExceptionCode ec = 0;


        KJS::JSValue* result = toJS(exec, WTF::getPtr(imp->nextNode(ec)));
        setDOMException(exec, ec);
        return result;
    }
    case JSNodeIterator::PreviousNodeFuncNum: {
        ExceptionCode ec = 0;


        KJS::JSValue* result = toJS(exec, WTF::getPtr(imp->previousNode(ec)));
        setDOMException(exec, ec);
        return result;
    }
    case JSNodeIterator::DetachFuncNum: {

        imp->detach();
        return jsUndefined();
    }
    }
    return 0;
}
开发者ID:FilipBE,项目名称:qtextended,代码行数:32,代码来源:JSNodeIterator.cpp

示例9:

Node *FEMesh::closestNode(const double x, const double y, const double z=0)
#endif
{
  double min=1.;   // (initial value provided to suppress compiler warnings)
  Node *node, *thenode=0;
  for(NodeIterator ni = node_iterator(); !ni.end(); ++ni) {
    node = ni.node();
    double dx = node->position()(0) - x;
    double dy = node->position()(1) - y;
#if DIM==2
    double dist = dx*dx + dy*dy;
#elif DIM==3
    double dz = node->position()(2) - z;
    double dist = dx*dx + dy*dy + dz*dz;
#endif
    if (ni.begin()) {
      min = dist;
      thenode = node;
    }
    else {
      if (dist <= min) {
	min = dist;
	thenode = node;
      }
    }
  }
  return thenode;
}
开发者ID:anilkunwar,项目名称:OOF2,代码行数:28,代码来源:femesh.C

示例10: while

//------------------------------------------------------------------------------
void RectangleTreeDrawer::CalcCoordinates ()
{
	t->MakeNodeList();
    maxDepth = 0;
    // Clear internal node depths
    for (int i = t->GetNumLeaves(); i < t->GetNumNodes(); i++)
    {
    	(*t)[i]->SetDepth(0);
    }
    for (int i = 0; i < t->GetNumLeaves();  i++)
    {
    	NodePtr p = (*t)[i]->GetAnc();
        int count = 1;
        while (p)
        {
        	if (count > p->GetDepth())
            {
            	p->SetDepth(count);
                if (count > maxDepth)
                	maxDepth = count;
            }
            count++;
            p = p->GetAnc();
        }
    }

 	double l = t->GetNumLeaves();
    leafGap = height / (l - 1.0);
	l = maxDepth + 1.0;
	if (rooted)
    	nodeGap = width / l;
    else
    	nodeGap = width / (l - 1.0);
	leafCount = 0;

    if (rooted)
    {
    	// Allow for edge below root
    	left += nodeGap;
        width -= nodeGap;
    }

    NodeIterator <Node> n (t->GetRoot());
    Node *q = n.begin();
    while (q)
    {
    	if (q->IsLeaf ())
        {
        	CalcLeaf (q);
        }
        else
        {
			CalcInternal (q);
        }

        q = n.next();
    }

}
开发者ID:bomeara,项目名称:omearatenure,代码行数:60,代码来源:treedrawer.cpp

示例11: jsNodeIteratorWhatToShow

JSValue jsNodeIteratorWhatToShow(ExecState* exec, JSValue slotBase, const Identifier&)
{
    JSNodeIterator* castedThis = static_cast<JSNodeIterator*>(asObject(slotBase));
    UNUSED_PARAM(exec);
    NodeIterator* imp = static_cast<NodeIterator*>(castedThis->impl());
    JSValue result = jsNumber(imp->whatToShow());
    return result;
}
开发者ID:Xertz,项目名称:EAWebKit,代码行数:8,代码来源:JSNodeIterator.cpp

示例12: jsNodeIteratorReferenceNode

JSValue jsNodeIteratorReferenceNode(ExecState* exec, JSValue slotBase, const Identifier&)
{
    JSNodeIterator* castedThis = static_cast<JSNodeIterator*>(asObject(slotBase));
    UNUSED_PARAM(exec);
    NodeIterator* imp = static_cast<NodeIterator*>(castedThis->impl());
    JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->referenceNode()));
    return result;
}
开发者ID:Xertz,项目名称:EAWebKit,代码行数:8,代码来源:JSNodeIterator.cpp

示例13: jsNodeIteratorPointerBeforeReferenceNode

JSValue jsNodeIteratorPointerBeforeReferenceNode(ExecState* exec, JSValue slotBase, const Identifier&)
{
    JSNodeIterator* castedThis = static_cast<JSNodeIterator*>(asObject(slotBase));
    UNUSED_PARAM(exec);
    NodeIterator* imp = static_cast<NodeIterator*>(castedThis->impl());
    JSValue result = jsBoolean(imp->pointerBeforeReferenceNode());
    return result;
}
开发者ID:Xertz,项目名称:EAWebKit,代码行数:8,代码来源:JSNodeIterator.cpp

示例14: FirstNode

void PFLCFG::ResetValid(void)
{
	NodeIterator i = FirstNode();
	for (; i != LastNode(); i++)
	{
		BBType *bb = i.current()->NodeInfo;
		bb->Valid = false;
	}
}
开发者ID:AshleyPeterson,项目名称:netbee-lite,代码行数:9,代码来源:pflcfg.cpp

示例15: isNeighbor

bool LitterNetwork::isNeighbor(LitterNode& source, LitterNode& dest) {
  NodeIterator* ni = source.getNeighborIT();
  while (ni->moveNext()) {
    if (ni->current() == &dest) {
      return true;
    }
  }
  return false;
}
开发者ID:pstjuste,项目名称:netmodeler,代码行数:9,代码来源:litter.cpp


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