⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 nsy_heap.h

📁 使用堆排序实现Pop, Push的算法. Push: 最小的元素永远位于堆顶
💻 H
字号:
/* ********************************************************************
**  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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -