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


C++ remove_child函数代码示例

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


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

示例1: if

void BNode::rebalance(BNode* current_c, size_t pos_c){
    if( !current_c->is_empty())
        return;

    if( pos_c < size_c-1 && !children[pos_c+1]->is_half() ){ //ie children[pos_c+1].size >= d+1
        BNode* sibling = children[pos_c+1];
        
        if( current_c->is_leaf() ){
            Block* tmp = sibling->lost_smallest_block();
            current_c ->win_block( tmp );//no rebalance needed because sibling.size >= d+1
        }else{
            BNode* tmp = sibling->lost_smallest_child();
            current_c->win_child( tmp );
        }
    }else if( pos_c > 0 && !children[pos_c-1]->is_half() ){ //ie children[pos_b-1].size >= d+1
        BNode* sibling = children[pos_c-1];
        if( current_c->is_leaf() ){
            Block* tmp = sibling->lost_greatest_block();
            current_c ->win_block( tmp );
        }else{
            BNode* tmp = sibling->lost_greatest_child();
            current_c->win_child( tmp );
        }
    }else{//merge
        if( pos_c < size_c-1 ){ //right fusion
            current_c->merge( children[pos_c+1] );
            children[pos_c+1]->clear();
            remove_child( pos_c+1 );
        }else if( pos_c > 0){ //left fusion
            children[pos_c-1]->merge( current_c );
            current_c->clear();
            remove_child( pos_c );
        }
    }
}
开发者ID:athena-project,项目名称:Mnemosyne,代码行数:35,代码来源:DynamicIndex.cpp

示例2: check_for_exited_childs

static void check_for_exited_childs()
{
    int status, pid, ret, exit_status;
    exit_status = 0;
     while ((pid = waitpid(-1, &status, WNOHANG)) > 0) {
          ci_debug_printf(5, "Child %d died ...\n", pid);
          if (!WIFEXITED(status)) {
               ci_debug_printf(1, "Child %d did not exit normally.", pid);
               exit_status = 1;
               if (WIFSIGNALED(status))
                    ci_debug_printf(1, "signaled with signal:%d\n",
                                    WTERMSIG(status));
          }
          ret = remove_child(childs_queue, pid, exit_status);
          if (ret == 0 && old_childs_queue) {
               ci_debug_printf(5,
                               "Child %d will be removed from the old list ...\n",
                               pid);
               remove_child(old_childs_queue, pid, exit_status);
               if (childs_queue_is_empty(old_childs_queue)) {
                    ret = destroy_childs_queue(old_childs_queue);
                    /* if(!ret){} */
                    old_childs_queue = NULL;
               }
          }
     }
     if (pid < 0)
          ci_debug_printf(1, "Fatal error waiting for a child to exit .....\n");
}
开发者ID:p1rate5s,项目名称:c-icap,代码行数:29,代码来源:mpmt_server.c

示例3: switch

void MultiGrid::remove_child(GridObject* p, TChild* c)
{
	switch(p->base_object_id()){
	case VERTEX:	remove_child(static_cast<Vertex*>(p), c); break;
	case EDGE:		remove_child(static_cast<Edge*>(p), c); break;
	case FACE:		remove_child(static_cast<Face*>(p), c); break;
	case VOLUME:	remove_child(static_cast<Volume*>(p), c); break;
	}
}
开发者ID:stephanmg,项目名称:ugcore,代码行数:9,代码来源:multi_grid_impl.hpp

示例4: clear_kids

	void clear_kids()
	//{{{
	{
		for (int i=0; i<ITEMS; i++)
		{
			if (isa_child(caption[i]))
			{
				remove_child(caption[i]);
			}
			if (isa_child(input[i]))
			{
				remove_child(input[i]);
			}
		}
	}
开发者ID:pgrawehr,项目名称:golgotha,代码行数:15,代码来源:maxtool__anim_dialog.cpp

示例5: remove_child

void remove_child(Agraph_t * graph, Agnode_t * node)
{
    Agedge_t *edge;
    Agedge_t *nexte;

    /* Avoid cycles */
    if MARKED
	(node) return;
    MARK(node);

    /* Skip nodes with more than one parent */
    edge = agfstin(node);
    if (edge && (agnxtin(edge) != NULL)) {
	UNMARK(node);
	return;
    }

    /* recursively remove children */
    for (edge = agfstout(node); edge; edge = nexte) {
	nexte = agnxtout(edge);
	if (aghead(edge) != node) {
	    if (verbose)
		fprintf(stderr, "Processing descendant: %s\n",
			agnameof(aghead(edge)));
	    remove_child(graph, aghead(edge));
	    agdeledge(edge);
	}
    }

    agdelnode(node);
    return;
}
开发者ID:Goettsch,项目名称:game-editor,代码行数:32,代码来源:prune.c

示例6: remove_attribute

void config::clear_diff_track(const config& diff)
{
	remove_attribute(diff_track_attribute);
	for (const config &i : diff.child_range("delete_child"))
	{
		const size_t index = lexical_cast<size_t>(i["index"].str());
		for (const any_child &item : i.all_children_range()) {
			remove_child(item.key, index);
		}
	}

	for (const config &i : diff.child_range("change_child"))
	{
		const size_t index = lexical_cast<size_t>(i["index"].str());
		for (const any_child &item : i.all_children_range())
		{
			if (item.key.empty()) {
				continue;
			}

			const child_map::iterator itor = children.find(item.key);
			if(itor == children.end() || index >= itor->second.size()) {
				throw error("error in diff: could not find element '" + item.key + "'");
			}

			itor->second[index]->clear_diff_track(item.cfg);
		}
	}
	for (const any_child &value : all_children_range()) {
		const_cast<config *>(&value.cfg)->remove_attribute(diff_track_attribute);
	}
}
开发者ID:PoignardAzur,项目名称:wesnoth,代码行数:32,代码来源:config.cpp

示例7: while

abstract_group::~abstract_group(void)
{
    while (!child_nodes.empty()) {
        server_node & node = child_nodes.front();
        remove_child(&node);
    }
}
开发者ID:mrotondo,项目名称:SuperCollider,代码行数:7,代码来源:node_graph.cpp

示例8: check_dead_children

static void check_dead_children(void)
{
	unsigned spawned, reaped, deleted;

	spawned = children_spawned;
	reaped = children_reaped;
	deleted = children_deleted;

	while (deleted < reaped) {
		pid_t pid = dead_child[deleted % MAX_CHILDREN];
		const char *dead = pid < 0 ? " (with error)" : "";

		if (pid < 0)
			pid = -pid;

		/* XXX: Custom logging, since we don't wanna getpid() */
		if (verbose) {
			if (log_syslog)
				syslog(LOG_INFO, "[%d] Disconnected%s",
						pid, dead);
			else
				fprintf(stderr, "[%d] Disconnected%s\n",
						pid, dead);
		}
		remove_child(pid, deleted, spawned);
		deleted++;
	}
	children_deleted = deleted;
}
开发者ID:Pistos,项目名称:git,代码行数:29,代码来源:daemon.c

示例9: children

void PlaceableObject::remove_children (void)
{
    std::list<PlaceableObject*> c = children();
    
    FOR_EACH (i,c) {
        remove_child(*i);
    }
开发者ID:9heart,项目名称:DT3,代码行数:7,代码来源:PlaceableObject.cpp

示例10: remove_child

void Dictionary::remove_child( letter* child )
{
    if ( child->m_child )
    {
        remove_child( child->m_child );
    }

    letter* next = child->m_next;

    delete child;

    if ( next )
    {
        remove_child( next );
    }
}
开发者ID:fizzup,项目名称:wwf_cheat,代码行数:16,代码来源:dictionary.cpp

示例11: move_container_to

void move_container_to(swayc_t* container, swayc_t* destination) {
	if (container == destination || swayc_is_parent_of(container, destination)) {
		return;
	}
	swayc_t *parent = remove_child(container);
	// reset container geometry
	container->width = container->height = 0;

	// Send to new destination
	if (container->is_floating) {
		add_floating(swayc_active_workspace_for(destination), container);
	} else if (destination->type == C_WORKSPACE) {
		add_child(destination, container);
	} else {
		add_sibling(destination, container);
	}
	// Destroy old container if we need to
	parent = destroy_container(parent);
	// Refocus
	swayc_t *op1 = swayc_parent_by_type(destination, C_OUTPUT);
	swayc_t *op2 = swayc_parent_by_type(parent, C_OUTPUT);
	set_focused_container(get_focused_view(op1));
	arrange_windows(op1, -1, -1);
	update_visibility(op1);
	if (op1 != op2) {
		set_focused_container(get_focused_view(op2));
		arrange_windows(op2, -1, -1);
		update_visibility(op2);
	}
}
开发者ID:punkkeks,项目名称:sway,代码行数:30,代码来源:layout.c

示例12: free_swayc

static void free_swayc(swayc_t *cont) {
	if (!ASSERT_NONNULL(cont)) {
		return;
	}
	// TODO does not properly handle containers with children,
	// TODO but functions that call this usually check for that
	if (cont->children) {
		if (cont->children->length) {
			int i;
			for (i = 0; i < cont->children->length; ++i) {
				free_swayc(cont->children->items[i]);
			}
		}
		list_free(cont->children);
	}
	if (cont->floating) {
		if (cont->floating->length) {
			int i;
			for (i = 0; i < cont->floating->length; ++i) {
				free_swayc(cont->floating->items[i]);
			}
		}
		list_free(cont->floating);
	}
	if (cont->parent) {
		remove_child(cont);
	}
	if (cont->name) {
		free(cont->name);
	}
	free(cont);
}
开发者ID:Half-Shot,项目名称:sway,代码行数:32,代码来源:container.c

示例13: remove_child

void adag::remove_dead_code() {
    for(nodeiter_t ni = nodes.begin(); ni!=nodes.end(); ++ni) {
	adag_node *n = (*ni).second;
	if(n->parents.size() == 0 && !n->is_target)
	    remove_child(NULL, n);
    }
}
开发者ID:Lebuin,项目名称:vtr-verilog-to-routing,代码行数:7,代码来源:adder.cpp

示例14: append_child

void append_child( mxml_node * to, mxml_node * n )
{
	if ( !n )
		return;
	else
	{
		mxml_node * nparent = n->parent;

		if ( nparent )
		{
			remove_child( nparent, n );
		}

		if ( !to->last_child && !to->first_child )
		{
			to->first_child = n;
			to->last_child = n;
			n->prev = NULL;
		}
		else if ( to->last_child )
		{
			to->last_child->next = n;
			n->prev = to->last_child;
			to->last_child = n;
		}

		n->parent = to;
		n->next = NULL;
		if ( !n->document )
			n->document = to->document;
	}		
}
开发者ID:dreamer-dead,项目名称:myxml,代码行数:32,代码来源:node.c

示例15: while

	void DomDocument::clear_all()
	{
		while (!get_first_child().is_null())
		{
			DomNode node = get_first_child();
			remove_child(node);
		}
	}
开发者ID:ArtHome12,项目名称:ClanLib,代码行数:8,代码来源:dom_document.cpp


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