nsy_heap.h

来自「使用堆排序实现Pop, Push的算法. Push: 最小的元素永远位于堆顶」· C头文件 代码 · 共 53 行

H
53
字号
/* ********************************************************************
**  Project : DataCollector
**
**  FileName: nsy_heap.h
**  Description: The header file for heap queue, which is used for soft
**               timer in the application
**  Author: Jesse Jiang
**  Date  : July 10,2007
**  Versioin: v0.1
**
**  Version History:
**  ------------------------------------------------------------------
**   July 14,2007   v0.1    Jesse Jiang   Initial version
**
** *********************************************************************/
#ifndef __NSY_HEAP_H_
#define __NSY_HEAP_H_

#undef NSY_WIN

#ifndef NSY_WIN	
#include <pthread.h>
#endif

#define HEAP_MAX_SIZE   (100)

typedef struct T_Heap_Node
{
	unsigned int hwnd;
	int   id;
	long  data;
} T_HEAP_NODE;

typedef struct T_Heap
{
	T_HEAP_NODE *heap_node[HEAP_MAX_SIZE];
	int size;
	int count;
#ifndef NSY_WIN	
	pthread_mutex_t  heap_lock;
#endif
} T_HEAP;

extern int heap_init(T_HEAP *heap, int size);
extern void heap_release(T_HEAP *heap);
extern int heap_push(T_HEAP *heap, T_HEAP_NODE *node);
extern T_HEAP_NODE* heap_pop (T_HEAP *heap);
extern T_HEAP_NODE* heap_top (T_HEAP *heap);
extern int heap_count(T_HEAP *heap);

#endif

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?