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

C++ PARENT函数代码示例

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

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



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

示例1: tmevtb_delete

void
tmevtb_delete(TMEVTB *p_tmevtb)
{
	uint_t	index = p_tmevtb->index;
	uint_t	parent;
	EVTTIM	event_time = TMEVT_NODE(last_index).time;

	/*
	 *  last_index--
	 *  if last_index == 0
	 *  do nothing.
	 */
	if (--last_index == 0) {
		return;
	}

	/*
	 *
	 *  insert the last time event into the position of deleted time
	 *  event. In fact, the insert does not happened. The position of 
	 *  deleted time will be a empty node in time event heap. Then this
	 *  empty node will be moved to a right position which is the right
	 *  position of the last time event. 
	 * 
	 *  If the event time of the last time event is earlier than deleted
	 *  time event's parent, then search up, or search down.
	 *
	 */
	if (index > 1 && EVTTIM_LT(event_time,
								TMEVT_NODE(parent = PARENT(index)).time)) {
		/*
		 *  if deleted time event's parent is not earlier than last time event
		 *  in heap, change parent's position and update info.
		 * 
		 */
		TMEVT_NODE(index) = TMEVT_NODE(parent);
		TMEVT_NODE(index).p_tmevtb->index = index;

		/*
		 *  then search up to find the right position for the last time event in heap
		 *  from parent's position
		 */
		index = tmevt_up(parent, event_time);
	}
	else {
		/*
		 *  search down to find right position for last time event in heap.
		 */
		index = tmevt_down(index, event_time);
	}

	/*
	 * update the last time event's info
	 */ 
	TMEVT_NODE(index) = TMEVT_NODE(last_index + 1);
	TMEVT_NODE(index).p_tmevtb->index = index;
}
开发者ID:bzchangguopeng,项目名称:toppers-asp,代码行数:57,代码来源:time_event.c


示例2: _sio_timer_adjust_heap

static void _sio_timer_adjust_heap(struct sio_timer_manager *st_mgr, struct sio_timer *timer)
{
    uint64_t parent = PARENT(timer);
    
    if (parent && timer->expire < st_mgr->heap_nodes[parent]->expire) 
        _sio_timer_upheap(st_mgr, timer);
    else
        _sio_timer_downheap(st_mgr, timer);
}
开发者ID:owenliang,项目名称:simple_kit,代码行数:9,代码来源:sio_timer.c


示例3: bookSetup

HWND bookSetup( ULONG idInitialPage )
{
    HWND hwndFrame;

    if( hwndBook )
    {
        hwndFrame = PARENT( hwndBook );

        // For some reason it is necessary to restore the notebook before
        // setting the frame as the active window if the frame is being
        // restored from a minimized state.

        WinSetWindowPos( hwndBook, NULLHANDLE, 0, 0, 0, 0,
                         SWP_SHOW | SWP_RESTORE );
        WinSetWindowPos( hwndFrame, NULLHANDLE, 0, 0, 0, 0,
                         SWP_SHOW | SWP_RESTORE | SWP_ACTIVATE );
    }
    else
    {
        FRAMECDATA fcdata;

        memset( &fcdata, 0, sizeof fcdata );
        fcdata.cb            = sizeof( FRAMECDATA );
        fcdata.flCreateFlags = FRAME_FLAGS;
        fcdata.idResources   = ID_NBFRAME;

        hwndFrame = WinCreateWindow( HWND_DESKTOP, WC_FRAME, NULL, WS_ANIMATE,
                                     0, 0, 0, 0, NULLHANDLE, HWND_TOP,
                                     ID_NBFRAME, &fcdata, NULL );
        if( hwndFrame )
        {
            pfnwpFrame = WinSubclassWindow( hwndFrame, wpNBFrame );
            if( pfnwpFrame )
                if( CreateNotebookWindow( hwndFrame ) )
                    WinSetWindowText( hwndFrame, BOOK_TITLE );
                else
                {
                    WinDestroyWindow( hwndFrame );
                    hwndFrame = NULLHANDLE;
                }
            else
            {
                WinDestroyWindow( hwndFrame );
                Msg( "bookSetup WinSubclassWindow RC(%X)", HWNDERR(hwndFrame) );
                hwndFrame = NULLHANDLE;
            }
        }
        else
            Msg( "bookSetup WinCreateWindow of frame window RC(%X)", HABERR(0));
    }

    if( hwndBook )
        TurnToPage( idInitialPage );

    return hwndFrame;
}
开发者ID:OS2World,项目名称:DEV-SAMPLES-PM-DRGDROP,代码行数:56,代码来源:notebook.c


示例4: heap_build

/*****************************************************************************
 * heap_build
 *
 * Build a heap from an unordered array.
 *****************************************************************************/
void heap_build( heap_t *heap )
{
    GLint	i;

    heap->size = heap->length;

    for ( i = PARENT( heap->length ) ; i >= 0 ; i-- ) {
	heapify( heap, i );
    }
}
开发者ID:OS2World,项目名称:LIB-VIDEO-MGL,代码行数:15,代码来源:tess_heap.c


示例5: priority

void priority(BinHeap *bh, int data, int newPriority){
    long i = 0, k;
    while (i < bh->size){
        if (bh->A[i].data == data){
            printf("sosi%d \n", newPriority);
            if (newPriority < bh->A[i].priority){
                bh->A[i].priority = newPriority;
                k = i;
                while(k && newPriority < bh->A[PARENT(k)].priority) {
                    bh->A[k] = bh->A[PARENT(k)];
                    k = PARENT(k);
                }
                bh->A[k].priority = newPriority;
                bh->A[k].data = data;
            }
        }
        i++;
    }
}
开发者ID:MykolaMedynskyi,项目名称:MyRepository,代码行数:19,代码来源:main.c


示例6: insert_heap

void insert_heap(puzzle b)
{
   puzzle tmp;
   int    index;

   if (heap_size == MAX_HEAP_SIZE) {
      printf ("Heap overflow\n");
      exit(-1);
   }
   heap[heap_size] = b;
   index = heap_size;
   heap_size++;
   while ((index > 0) && superior(index, PARENT(index))) {
      tmp = heap[index];
      heap[index] = heap[PARENT(index)];
      heap[PARENT(index)] = tmp;
      index = PARENT(index);
   }
}
开发者ID:Kartonschachtel,项目名称:public,代码行数:19,代码来源:puzzle15seq.c


示例7: pqueue_enqueue

void
pqueue_enqueue(pqueue_t *queue, const void *data) {
	size_t i;
	void *tmp = NULL;
	if (queue == NULL || queue->size >= queue->capacity)
		return;
	/* adds element last */
	queue->data[queue->size] = (void*)data;
	i = queue->size;
	queue->size++;

	/* the new element is swapped with its parent as long as its precedence is higher */
	while(i > 0 && queue->cmp(queue->data[i], queue->data[PARENT(i)]) > 0) {
		tmp = queue->data[i];
		queue->data[i] = queue->data[PARENT(i)];
		queue->data[PARENT(i)] = tmp;
		i = PARENT(i);
	}
}
开发者ID:patseb,项目名称:scgl,代码行数:19,代码来源:pqueue.c


示例8: PARENT

static void
dvb_flush			(vbi_capture *		cap)
{
	vbi_capture_dvb *dvb = PARENT (cap, vbi_capture_dvb, capture);

	vbi_dvb_demux_reset (dvb->demux);

	dvb->bp = dvb->pes_buffer;
	dvb->b_left = 0;
}
开发者ID:nagyistoce,项目名称:canalplus-r7oss,代码行数:10,代码来源:io-dvb.c


示例9: INFO

void DominatorTree::debugPrint()
{
   for (int i = 0; i < count; ++i) {
      INFO("SEMI(%i) = %i\n", i, SEMI(i));
      INFO("ANCESTOR(%i) = %i\n", i, ANCESTOR(i));
      INFO("PARENT(%i) = %i\n", i, PARENT(i));
      INFO("LABEL(%i) = %i\n", i, LABEL(i));
      INFO("DOM(%i) = %i\n", i, DOM(i));
   }
}
开发者ID:Distrotech,项目名称:Mesa,代码行数:10,代码来源:nv50_ir_ssa.cpp


示例10: up

void up(struct minheap * mh,int index) 
{
	int parent = PARENT(index);
	while(parent >= 1)
	{
		assert(mh->elts[index]);
		assert(mh->elts[parent]);
		if (mh->less(mh->ud,mh->elts[index],mh->elts[parent]))
		{
			swap(mh,index,parent);
			index = parent;
			parent = PARENT(index);
		}
		else 
		{
			break;
		}
	}
}
开发者ID:xvly,项目名称:fish,代码行数:19,代码来源:MiniHeap.cpp


示例11: BSTreeDepth

/* BSTreeDepth
 *  returns number of layers in b-tree
 *
 *  if "exact" is 1, then the maximum
 *  depth is returned. otherwise, the depth of
 *  an arbitrary leaf node is returned
 */
LIB_EXPORT uint32_t CC BSTreeDepth ( const BSTree *bt, bool exact )
{
    BSTNode *p;
    uint32_t depth;

    if ( bt == NULL || bt -> root == NULL )
        return 0;

    depth = 1;

    if ( exact )
    {
        for ( p = FirstNode ( bt ); p != NULL; p = BSTNodeNext ( p ) )
        {
            BSTNode *q;
            unsigned int ndepth;

            if ( p -> child [ 0 ] != NULL || p -> child [ 1 ] != NULL )
                continue;

            for ( ndepth = 1, q = PARENT ( p ); q != NULL; q = PARENT ( q ) )
                ++ ndepth;

            if ( ndepth > depth )
                depth = ndepth;
        }
    }
    else
    {
        for ( p = bt -> root;; ++ depth )
        {
            if ( p -> child [ 0 ] != NULL )
                p = p -> child [ 0 ];
            else if ( p -> child [ 1 ] != NULL )
                p = p -> child [ 1 ];
            else
                break;
        }
    }

    return depth;
}
开发者ID:thelegend6420,项目名称:ncbi-vdb,代码行数:49,代码来源:container.c


示例12: bubble_up

static void
bubble_up(pq q, unsigned int k)
{
    int p;

    if (k == 0) return;
    p = PARENT(k);
    if (cmp(q, p, k) <= 0) return;
    swap(q, k, p);
    bubble_up(q, p);
}
开发者ID:rainly,项目名称:beanstalkd,代码行数:11,代码来源:pq.c


示例13: SEMI

void DominatorTree::buildDFS(Graph::Node *node)
{
   SEMI(node->tag) = node->tag;

   for (Graph::EdgeIterator ei = node->outgoing(); !ei.end(); ei.next()) {
      if (SEMI(ei.getNode()->tag) < 0) {
         buildDFS(ei.getNode());
         PARENT(ei.getNode()->tag) = node->tag;
      }
   }
}
开发者ID:Distrotech,项目名称:Mesa,代码行数:11,代码来源:nv50_ir_ssa.cpp


示例14: BSTreeContains

static
bool CC BSTreeContains ( const BSTNode *root, const BSTNode *n )
{
    while ( n != NULL )
    {
        if ( n == root )
            return true;
        n = PARENT ( n );
    }
    return false;
}
开发者ID:thelegend6420,项目名称:ncbi-vdb,代码行数:11,代码来源:container.c


示例15: TimerAddNode

// Adds a timer to the heap, using timer_node data. Passed
// timer_node is first unused element in timer_heap array.
__forceinline void TimerAddNode(timer_node *t)
{
   if (numActiveTimers == 0 || timer_heap[0]->time > t->time)
   {
      // We're making a new first-timer, so the time main loop should wait might
      // have changed, so have it break out of loop and recalibrate
      MessagePost(main_thread_id, WM_BLAK_MAIN_RECALIBRATE, 0, 0);
   }

   // Start node off at end of heap.
   int i = numActiveTimers++;
   timer_heap[i]->heap_index = i;

   // Push node up if necessary.
   while (i > 0 && timer_heap[i]->time < timer_heap[PARENT(i)]->time)
   {
      TimerSwapIndex(i, PARENT(i));
      i = PARENT(i);
   }
}
开发者ID:MorbusM59,项目名称:Meridian59,代码行数:22,代码来源:timer.c


示例16: TasNoeud_monter

void TasNoeud_monter(TasNoeud *tas, int k) {
    int mincout, parent;
    if (k > 0) { // Condition de terminaison
        parent = PARENT(k);
        mincout = parent;
        if (tas->noeuds[k].cout < tas->noeuds[mincout].cout) { // Autre condition de terminaison
            ECHANGER(tas, k, mincout);
            TasNoeud_monter(tas, mincout); // Continuer tant que le tas n'est pas ordonné
        }
    }
}
开发者ID:cedricfoucault,项目名称:robot_decision,代码行数:11,代码来源:jeu.c


示例17: assert

Node *malloc_node(Interval key)
{
	Node *n = (Node *)malloc(sizeof(Node));
	assert(n);
	KEY(n) = key;
	SET_RED(n);
	PARENT(n) = LEFT(n) = RIGHT(n) = &NIL_NODE;
	n->max = HIGH(key);

	return n;
}
开发者ID:jarfield,项目名称:SolutionToCLR2nd,代码行数:11,代码来源:tree.cpp


示例18: insert

bool
insert(Any_Type a, struct Heap *h)
{
	u_long          i;

	if (is_heap_full(h))
		return false;

	i = ++h->num_elements;

	/*
	 * find the correct place to insert
	 */
	while ((i > 1) && (*h->compare) (h->storage[PARENT(i)], a)) {
		h->storage[i] = h->storage[PARENT(i)];
		i = PARENT(i);
	}
	h->storage[i] = a;
	return true;
}
开发者ID:JosephMalenkov,项目名称:httperf,代码行数:20,代码来源:heap.c


示例19: find_blocks

/* create_block_tree:
 * Construct block tree by peeling nodes from block list in state.
 * When done, return root. The block list is empty
 * FIX: use largest block as root
 */
block_t *createBlocktree(Agraph_t * g, circ_state * state)
{
    block_t *bp;
    block_t *next;
    block_t *root;
    int min;
    /* int        ordercnt; */

    find_blocks(g, state);

    bp = state->bl.first;	/* if root chosen, will be first */
    /* Otherwise, just pick first as root */
    root = bp;

    /* Find node with minimum VAL value to find parent block */
    /* FIX: Should be some way to avoid search below.               */
    /* ordercnt = state->orderCount;  */
    for (bp = bp->next; bp; bp = next) {
	Agnode_t *n;
	Agnode_t *parent;
	Agnode_t *child;
	Agraph_t *subg = bp->sub_graph;

	child = n = agfstnode(subg);
	min = VAL(n);
	parent = PARENT(n);
	for (n = agnxtnode(subg, n); n; n = agnxtnode(subg, n)) {
	    if (VAL(n) < min) {
		child = n;
		min = VAL(n);
		parent = PARENT(n);
	    }
	}
	SET_PARENT(parent);
	CHILD(bp) = child;
	next = bp->next;	/* save next since list insertion destroys it */
	appendBlock(&(BLOCK(parent)->children), bp);
    }
    initBlocklist(&state->bl);	/* zero out list */
    return root;
}
开发者ID:Chaduke,项目名称:bah.mod,代码行数:46,代码来源:blocktree.c


示例20: bstree_right_rotate

int bstree_right_rotate( bstree_t *tree_in, long idx_in )
{
	long x,y;
	x = idx_in;
	y = tree_in->start[idx_in].left;
	if( PARENT(x) != -1 )
	{
		if( PARENT_LEFT(x) == x )
			PARENT_LEFT(x) = y;
		else
			PARENT_RIGHT(x) = y;
	}
	else
		tree_in->root = y;
	PARENT(y) = PARENT(x);
	PARENT(x) = y;
	LEFT(x) = RIGHT(y);
	if( RIGHT(y) != -1 )
		RIGHT_PARENT(y) = x;
	RIGHT(y) = x;
}
开发者ID:mathemaphysics,项目名称:util,代码行数:21,代码来源:trees.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ PARSE函数代码示例发布时间:2022-05-30
下一篇:
C++ PARAM_TIMx函数代码示例发布时间: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