www.pudn.com > ActiveH263_V1.00.rar > Queue.h


// Queue.h: interface for the Queue class. 
// 
////////////////////////////////////////////////////////////////////// 
 
#if !defined(AFX_QUEUE_H__2A0641DE_6ED0_4F88_92BE_53A3BF9418EE__INCLUDED_) 
#define AFX_QUEUE_H__2A0641DE_6ED0_4F88_92BE_53A3BF9418EE__INCLUDED_ 
 
#if _MSC_VER > 1000 
#pragma once 
#endif // _MSC_VER > 1000 
 
//用链表实现的队列类 
 
//定义链表节点类型 
typedef struct node 
{ 
	unsigned char data[2049]; 
	struct node *next; 
} QueueDataNode; 
//定义链表类型 
typedef QueueDataNode * QueueData; 
 
 
class Queue   
{ 
	//用class定义链接队列类 
private:  
	int count; //队列元素个数 
	QueueData dataLinkHead, dataLinkTail;//队头、队尾指针 
public: 
	Queue(void); //构造函数 
	~Queue(void); //析构函数 
	//在队尾加入一个新元素 
	void put (unsigned char* newData); 
	//从队头退出一个元素 
	void get (unsigned char * getData); 
	 
	//内联函数 
	bool empty ( ) { return (count == 0); } //检查队列是否空 
	int getCount() { return count; } //取队列元素个数 
	 
	//	friend ostream & operator << (ostream & , Queue &); 
	//	friend istream & operator >> (istream & , Queue &); 
}; 
 
#endif // !defined(AFX_QUEUE_H__2A0641DE_6ED0_4F88_92BE_53A3BF9418EE__INCLUDED_)