• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ removeNode函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: removeNodeAllTest

/**
* Runs tests on the removeNode function by removing all the nodes in the list
**/
void removeNodeAllTest(ListPtr list, int count)
{
	int i;
	int testSize = count;
	for(i = 0; i < count; i++)
	{
		testSize--;
		NodePtr node = removeNode(list, search(list, testSize));
		if(node == NULL) {printf("Node is NULL"); continue;}
		//printf("i: %d jobid: %d size: %d testSize: %d tail: %d", i, node->data->jobid, list->size, testSize, list->tail->data->jobid );
		//printf("1: %d 2: %d 3: %d 4: %d", node->data->jobid != testSize, list->size != testSize, (list->head != NULL && list->head->data->jobid != 0), (list->tail != NULL && list->tail->data->jobid != testSize - 1));
		if(node->data->jobid != testSize
			|| list->size != testSize
			|| (list->head != NULL && list->head->data->jobid != 0)
			|| (list->tail != NULL && list->tail->data->jobid != testSize - 1)
		)
		{
			printf("\n%s\n%s\n", sep, "Error: removeNodeAll invalid");
			break;
		}
		freeNode(node);
	}
	if(DEBUG > 0)
		verifyRearAll(list, count);
}
开发者ID:thomascampbelladams,项目名称:dash,代码行数:28,代码来源:TestList.c


示例2: mergeNodes

void mergeNodes(pugi::xml_node toNode, pugi::xml_node& fromNode)
{
  // Base case = both nodes are text nodes
  pugi::xml_text fromNodeText = fromNode.text();
  pugi::xml_text toNodeText = toNode.text();
  if (fromNodeText && toNodeText) {
    SBLog::info() << "Overwriting template value of \"" << toNode.name() << "\" from \"" << toNodeText.get() << "\" to \"" << fromNodeText.get() << "\"." << std::endl;
    toNodeText.set(fromNodeText.get());
    return;
  }

  // Calculate number of children in toNode
  unsigned maxDistance = std::distance(toNode.begin(), toNode.end());

  // Merge children
  for (pugi::xml_node fromNodeChild = fromNode.first_child(); fromNodeChild; fromNodeChild = fromNodeChild.next_sibling()) {
    // Find appropriate merge point
    pugi::xml_node toNodeChild = findSimilarNode(fromNodeChild, toNode, maxDistance);
    if (toNodeChild) {
      mergeNodes(toNodeChild, fromNodeChild);
    } else {
      toNode.append_copy(fromNodeChild);
    }
  }

  // Erase fromNode
  removeNode(fromNode);
}
开发者ID:netroby,项目名称:WinObjC,代码行数:28,代码来源:vshelpers.cpp


示例3: insertSiblingNodeRangeBefore

void DecreaseSelectionListLevelCommand::doApply()
{
    Node* startListChild;
    Node* endListChild;
    if (!canDecreaseListLevel(endingSelection(), startListChild, endListChild))
        return;

    Node* previousItem = startListChild->renderer()->previousSibling() ? startListChild->renderer()->previousSibling()->element() : 0;
    Node* nextItem = endListChild->renderer()->nextSibling() ? endListChild->renderer()->nextSibling()->element() : 0;
    Element* listNode = startListChild->parentElement();

    if (!previousItem) {
        // at start of sublist, move the child(ren) to before the sublist
        insertSiblingNodeRangeBefore(startListChild, endListChild, listNode);
        // if that was the whole sublist we moved, remove the sublist node
        if (!nextItem)
            removeNode(listNode);
    } else if (!nextItem) {
        // at end of list, move the child(ren) to after the sublist
        insertSiblingNodeRangeAfter(startListChild, endListChild, listNode);    
    } else if (listNode) {
        // in the middle of list, split the list and move the children to the divide
        splitElement(listNode, startListChild);
        insertSiblingNodeRangeBefore(startListChild, endListChild, listNode);
    }
}
开发者ID:Fale,项目名称:qtmoko,代码行数:26,代码来源:ModifySelectionListLevel.cpp


示例4: deleteNode

bst deleteNode( bst b, int x,int y , bst father ) {
  if ( b == NULL ) return b;
  if ( is_lower_than(x,y,b->x,b->y ) < 0 ) b->sx = deleteNode( b->sx, x,y, b );
  if ( is_lower_than(x,y,b->x,b->y ) > 0) b->dx = deleteNode( b->dx, x,y, b );
  if ( is_lower_than(x,y,b->x,b->y ) == 0) {
    if ( ( b->sx == NULL ) || ( b->dx == NULL ) ) b = removeNode( b, father );
    else {
      bst m = b->sx, f = b;
      while ( m->dx ) { f = m; m = m->dx; }
      b->x = m->x;
	  b->y = m->y;
      m = removeNode( m, f );
    }
  }
  return b;
}
开发者ID:bimbomix1,项目名称:monnalisaico,代码行数:16,代码来源:base.c


示例5: setlocale

void GVSkeletonGraph::clearNodes(){
    setlocale(LC_NUMERIC,"en_US.UTF-8"); // Débug séparateur de décimales en version française
	QList<QString> keys = _nodes.keys();
	for(int i=0;i<keys.size();++i){
		removeNode(keys.at(i));
	}
}
开发者ID:EmnaBenAbdallah,项目名称:pgrou,代码行数:7,代码来源:GVSkeletonGraph.cpp


示例6: removeNode

/* 
*  Internal function to remove a node from a tree - used by assert() method
*
*  Returns:
*    0 - don't remove the parent node
*    1 - consider removing the parent node (if no value or root)
*    2 - remove the parent node (even if it has a value and/or root)
*/
static int removeNode(nbCELL context,BTree *tree,BTreeNode **nodeP,nbSET *argSetP){
  NB_TreePath path;
  BTreeNode *node=*nodeP;
  nbCELL argCell;
  int code=1;

  argCell=nbListGetCellValue(context,argSetP);
  if(argCell==NULL){
    if(node==NULL) return(3);  // the perfect match - nothing to nothing
    code=2; 
    return(2);                   //
    }
  else{
    if(node==NULL) return(0);  // can't match to empty tree
    if(tree->options&BTREE_OPTION_ORDER) 
      node=(BTreeNode *)nbTreeLocateValue(&path,argCell,(NB_TreeNode **)nodeP,treeCompare,context);
    else node=nbTreeLocate(&path,argCell,(NB_TreeNode **)nodeP);   
    nbCellDrop(context,argCell);
    if(node==NULL) return(0);          // didn't find argument
    switch(removeNode(context,tree,&node->root,argSetP)){
      case 0: return(0);
      case 1:
        if(node->root!=NULL) return(0);  // still need this node
        break;
      // For case 2 we just fall thru to unlink the node
      }
    }
  if(node->root!=NULL) return(0);  
  nbTreeRemove(&path);  // Remove node from binary search tree
  if(node->bnode.key!=NULL) node->bnode.key=nbCellDrop(context,(nbCELL)node->bnode.key);  // release key
  //if(node->root!=NULL) node->root =removeTree(context,tree,node->root);
  nbFree(node,sizeof(BTreeNode));
  return(code);
  }
开发者ID:michaelxu1107,项目名称:nodebrain-nb,代码行数:42,代码来源:nb_baseline.c


示例7: S_removeUnusedVariables

int S_removeUnusedVariables(struct Node *t) {
  if (t == NULL)
    return 0;
  
  if (t->tag == TASSIGN) {
    char *name = t->children->iname;
    if (variableIsUsed(name) == 0) {
      fprintf(warn, "Removing Variable Assignment: %s\n", name);
      if (t->parent != NULL) {
        if (t->parent->children == t) {
          t->parent->children = t->next;
        }
      }
      removeNode(t);
      return 1;
    } else {
      registerAllUsedVariables(t->children->next);
      return 0;
    }
  }else if (t->tag == TCOMBINE) {
    struct Node *pntr = t->children;
    struct Node *tmp = NULL;
    if (pntr == NULL) {
      return 0;
    }
    while (pntr->next != NULL) {
      pntr = pntr->next;
    }
    while (pntr != NULL) {
      tmp = pntr;
      pntr = pntr->previous;
      S_removeUnusedVariables(tmp);
    }
    if (t->children == NULL) {
      removeNode(t);
      return 1;
    }
  } else {
    struct Node *tmp = t->children;
    while (tmp != NULL) {
      registerAllUsedVariables(tmp);
      tmp = tmp->next;
    }
    return 0;
  }
  return 0;
}
开发者ID:pascalaldo,项目名称:PPODESUITE,代码行数:47,代码来源:simplify.c


示例8: main

void main()
{
	cout<<"请输入有向图的节点,以-1,-1结束:"<<endl;
	int i,j;
	while(true)
	{
		cin>>i>>j;
		if(i==-1 && j==-1) break;
		if(i<0  || j<0)
		{
			cout<<"输入错误"<<endl;
			exit(1);
		}
		arc[i][j] = 1;
		cout<<endl;
	}
	cout<<"节点数(1~"<<MAX_NODE<<"):"<<endl;
	cin>>n;
	if(n<1 || n>MAX_NODE)
	{
		cout<<"错误,节点数必须是在1到"<<MAX_NODE<<"之间的数"<<endl;
		exit(1);
	}

	cout<<"输出邻接矩阵如下:"<<endl;
	showMGraph();

	//进行拓扑排序
	while(true)
	{
		//假设所有剩余的节点都没有入度
		bool flag = true;

		for(int i=0; i<n; i++)
		{
			//如果是已被移除或者存在入度的节点
			if((arc[i][i] == -1) || hasInRoad(i)) continue;

			//发现了一个入度,假设不成立
			flag = false;

			//该节点没有入度
			list[index++] = i;
			removeNode(i);

			//所有节点都已经排序
			if(index>=n)
			{
				showList();
				return;
			}
		}
		if(flag)
		{
			cout<<"该有向图含有环."<<endl;
			exit(2);
		}
	}
}
开发者ID:cqiyi,项目名称:kaoshi,代码行数:59,代码来源:test02.cpp


示例9: ASSERT

ScrollingNodeID ScrollingStateTree::attachNode(ScrollingNodeType nodeType, ScrollingNodeID newNodeID, ScrollingNodeID parentID)
{
    ASSERT(newNodeID);

    if (ScrollingStateNode* node = stateNodeForID(newNodeID)) {
        ScrollingStateNode* parent = stateNodeForID(parentID);
        if (!parent)
            return newNodeID;
        if (node->parent() == parent)
            return newNodeID;

        // The node is being re-parented. To do that, we'll remove it, and then re-create a new node.
        removeNode(node);
    }

    ScrollingStateNode* newNode = 0;
    if (!parentID) {
        // If we're resetting the root node, we should clear the HashMap and destroy the current children.
        clear();

        setRootStateNode(ScrollingStateFrameScrollingNode::create(*this, newNodeID));
        newNode = rootStateNode();
        m_hasNewRootStateNode = true;
    } else {
        ScrollingStateNode* parent = stateNodeForID(parentID);
        if (!parent)
            return 0;

        switch (nodeType) {
        case FixedNode: {
            OwnPtr<ScrollingStateFixedNode> fixedNode = ScrollingStateFixedNode::create(*this, newNodeID);
            newNode = fixedNode.get();
            parent->appendChild(fixedNode.release());
            break;
        }
        case StickyNode: {
            OwnPtr<ScrollingStateStickyNode> stickyNode = ScrollingStateStickyNode::create(*this, newNodeID);
            newNode = stickyNode.get();
            parent->appendChild(stickyNode.release());
            break;
        }
        case FrameScrollingNode: {
            OwnPtr<ScrollingStateFrameScrollingNode> scrollingNode = ScrollingStateFrameScrollingNode::create(*this, newNodeID);
            newNode = scrollingNode.get();
            parent->appendChild(scrollingNode.release());
            break;
        }
        case OverflowScrollingNode: {
            OwnPtr<ScrollingStateOverflowScrollingNode> scrollingNode = ScrollingStateOverflowScrollingNode::create(*this, newNodeID);
            newNode = scrollingNode.get();
            parent->appendChild(scrollingNode.release());
            break;
        }
        }
    }

    m_stateNodeMap.set(newNodeID, newNode);
    return newNodeID;
}
开发者ID:Wrichik1999,项目名称:webkit,代码行数:59,代码来源:ScrollingStateTree.cpp


示例10: Cut

static void Cut(PQueue *h, PQueueElement *x, PQueueElement *y)
{
    removeNode(x);
    y->degree--;
    insertrootlist(h, x);
    x->Parent = NULL;
    x->Mark = 0;
}
开发者ID:HunterPlus,项目名称:ccl,代码行数:8,代码来源:priorityqueue.c


示例11: removeEdgeFromVertices

/*
 * updates the vertex list when and edge is removed so that
 * the vertex list contains the proper new edges for the 
 * corresponding vertices
 */
void removeEdgeFromVertices(vertexSet * head, int id)
{
  while(head!=NULL)
  {
    removeNode(&head->edges, id);
    head = head->nextVertex;
  }
}
开发者ID:csgrad,项目名称:crin-paper,代码行数:13,代码来源:hypergraph.c


示例12: while

void CDoubleLinkedList::removeAllNodes()
{	
  while ( NULL != m_pHead ) {
    removeNode( m_pTail );
  }	
  
  Init();
};
开发者ID:davidluca3000,项目名称:vscp_software,代码行数:8,代码来源:node.cpp


示例13: setlocale

void GVSkeletonGraph::clearNodes(){
    	setlocale(LC_NUMERIC,"en_US.UTF-8");
	
	QList<QString> keys = _nodes.keys();
	for(int i=0;i<keys.size();++i){
		removeNode(keys.at(i));
	}
}
开发者ID:AurelienHP,项目名称:pgrou,代码行数:8,代码来源:GVSkeletonGraph.cpp


示例14: while

void SwitchNode::clearNodes() {
	while (nodes->size() > 0) {
		removeNode( nodes->size() - 1 );
	}
	setDefaultNode( NULL );
	clearAnchors();
	clearPorts();
}
开发者ID:jgrande,项目名称:ginga,代码行数:8,代码来源:SwitchNode.cpp


示例15: test__remove_node_not_present

void 
test__remove_node_not_present(void **state)
{   
    initializeHashTable(100);
	int result = removeNode(101);
    assert_true(result == -1);
	cleanUpTable();
}
开发者ID:50wu,项目名称:gpdb,代码行数:8,代码来源:cdb_dump_util_test.c


示例16: removeNode

void ProcessorGraph::removeProcessor(GenericProcessor* processor)
{

    std::cout << "Removing processor with ID " << processor->getNodeId() << std::endl;

    removeNode(processor->getNodeId());

}
开发者ID:aacuevas,项目名称:GUI,代码行数:8,代码来源:ProcessorGraph.cpp


示例17: removeNode

void MythGenericTree::deleteNode(MythGenericTree *child)
{
    if (!child)
        return;

    removeNode(child);
    delete child;
}
开发者ID:tomhughes,项目名称:mythtv,代码行数:8,代码来源:mythgenerictree.cpp


示例18: MyThreadYield

void MyThreadYield(void)
{
	//printf("MyThreadYield: START ... curr_th = %d , parent_th = %d\n", curr_th->tid, curr_th->pid);
		
	/*if(0!=getcontext(&curr_context))l
	{
		//printf("MyThreadYield : getcontext error... \n");
	}*/
	
	if(front==NULL)
	{
		//printf("No pending ready thread, invoking thread = %d , will continue to run \n", curr_th->tid);
		return;
	}
	
	ucontext_t new_cnxt;
	struct node * new_th=pop_q();
	
	if(new_th == NULL)
	{
		//printf("MyThreadYield: ready queue is empty...continue running this thread... \n");
		return;	
	}
	
	new_cnxt=new_th->cnxt;
	
	//printf("Inserting saved context to the queue : GetContext removed... \n");
	struct node * tmp=insert_q(curr_th->cnxt,curr_th->tid,curr_th->pid,curr_th->join_th,curr_th->join_th_rear);

	int old_th=curr_th->tid;
	int old_pr=curr_th->pid;
	ucontext_t old_cnxt=curr_th->cnxt;
	struct join_list *old_jfront=curr_th->join_th;
	struct join_list *old_jrear=curr_th->join_th_rear;
	curr_th->tid=new_th->tid;
	curr_th->pid=new_th->pid;
	curr_th->cnxt=new_th->cnxt;
	curr_th->join_th=new_th->join_th;
	curr_th->join_th_rear=new_th->join_th_rear;
	

	//printf("MyThreadYield: swap context from thread : %d ,to first ready thread : %d ... \n",tmp->tid,curr_th->tid);
	//printf("MyThreadYield: swap context from =%d , to  = %d  which is also same as new_cnxt=%d\n ",tmp->cnxt,curr_th->cnxt,new_cnxt);
	

	if(swapcontext(&(tmp->cnxt),&(new_th->cnxt))==-1)
	{
		curr_th->tid=old_th;
		curr_th->pid=old_pr;
		curr_th->cnxt=old_cnxt;
		curr_th->join_th=old_jfront;
		curr_th->join_th_rear=old_jrear;
		removeNode(curr_th->tid);
		//printf("MyThreadYield: swapcontext error...\n");	
	}

	//printf("MyThreadYield: EXIT... \n\n\n");
}
开发者ID:Ronak6892,项目名称:OS,代码行数:58,代码来源:mythread.c


示例19: main

int main(void)
{
    Node *head = 0;
    head = addNodeAtHead(head, 23);
    head = addNodeAtHead(head, 43);
    head = addNodeAtHead(head, 73);
    head = addNodeAtHead(head, 13);
    head = addNodeAtHead(head, 33);
    dumpList("Completed", head);

    head = removeNode(head, 33);
    dumpList("Remove 33", head);
    head = removeNode(head, 23);
    dumpList("Remove 23", head);
    head = removeNode(head, 13);
    dumpList("Remove 13", head);
    head = removeNode(head, 34);
    dumpList("Remove 34", head);
    head = removeNode(head, 43);
    dumpList("Remove 43", head);
    head = removeNode(head, 73);
    dumpList("Remove 73", head);
    head = removeNode(head, 37);
    dumpList("Remove 37", head);

    return 0;
}
开发者ID:jleffler,项目名称:soq,代码行数:27,代码来源:dl61.c


示例20: Swig_name_object_attach_keys

static void Swig_name_object_attach_keys(const char *keys[], Hash *nameobj) {
  Node *kw = nextSibling(nameobj);
  List *matchlist = 0;
  while (kw) {
    Node *next = nextSibling(kw);
    String *kname = Getattr(kw, "name");
    char *ckey = kname ? Char(kname) : 0;
    if (ckey) {
      const char **rkey;
      int isnotmatch = 0;
      int isregexmatch = 0;
      if ((strncmp(ckey, "match", 5) == 0)
	  || (isnotmatch = (strncmp(ckey, "notmatch", 8) == 0))
	  || (isregexmatch = (strncmp(ckey, "regexmatch", 10) == 0))
	  || (isnotmatch = isregexmatch = (strncmp(ckey, "notregexmatch", 13) == 0))) {
	Hash *mi = NewHash();
	List *attrlist = Swig_make_attrlist(ckey);
	if (!matchlist)
	  matchlist = NewList();
	Setattr(mi, "value", Getattr(kw, "value"));
	Setattr(mi, "attrlist", attrlist);
	if (isnotmatch)
	  SetFlag(mi, "notmatch");
	if (isregexmatch)
	  SetFlag(mi, "regexmatch");
	Delete(attrlist);
	Append(matchlist, mi);
	Delete(mi);
	removeNode(kw);
      } else {
	for (rkey = keys; *rkey != 0; ++rkey) {
	  if (strcmp(ckey, *rkey) == 0) {
	    Setattr(nameobj, *rkey, Getattr(kw, "value"));
	    removeNode(kw);
	  }
	}
      }
    }
    kw = next;
  }
  if (matchlist) {
    Setattr(nameobj, "matchlist", matchlist);
    Delete(matchlist);
  }
}
开发者ID:progranism,项目名称:Allegro-5-SWIG-Wrapper,代码行数:45,代码来源:naming.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ removeObject函数代码示例发布时间:2022-05-30
下一篇:
C++ removeFromScene函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap