www.pudn.com > B-spline.zip > intfifo.h, change:2012-03-17,size:831b


#ifndef _H_INTFIFO 
#define _H_INTFIFO 
 
#include <stdio.h> 
 
//#define INTFIFO_LOG 
 
typedef struct _intFIFOADT{ 
	int value; 
	struct _intFIFOADT *next,*prev; 
}intFIFOADT; 
 
class intFIFO 
{ 
public: 
	int pushFIFO(int newValue);			//return the oldest value in the fifo 
	int LoadFromFile(char *filename);	//从指定文件中加载 
	int SaveToFile(char *filename); 
	long getTotal(); 
	long SquareDifference(); 
	int ReadFIFOElement(int index); 
	int WriteFIFOElement(int index,int value);		//对队列中指定索引处的值写入新值value,返回该索引处的原值 
	void clrFIFO(); 
	int ValueExist(int value);			//检索fifo中是否有该数值,如果有,则返回其索引,没有则返回-1 
	intFIFO(int Size=5); 
	~intFIFO(); 
	int Size(); 
private: 
#ifdef INTFIFO_LOG 
	FILE *log; 
#endif 
	int FIFOSize; 
	intFIFOADT *FIFOBuf; 
	intFIFOADT *wrpt; 
}; 
#endif