/* 
 * Thomas Pantzer: t_floating_avg.h, v0.1b  8.6.99 16:49 
 * 
 * 
 * Copyright 1999 by Thomas Pantzer
 * 
 * Permission to use, copy, modify, and distribute this software for noncommercial 
 * use and without fee is hereby granted, provided that the above copyright notice 
 * appear in all copies and that both that copyright notice and this permission 
 * notice appear in supporting documentation, and that the name of the Author not be 
 * used in advertising or publicity pertaining to distribution of the software 
 * without specific, written prior permission. The Author makes no representations about
 * the suitability of this software for any purpose.  It is provided "as is" 
 * without expressed or implied warranty. 
 * 
 * 
 * pantec@isys2.informatik.uni-leipzig.de   (Thomas Pantzer) 
 * 
 */


#ifndef T_FLOATING_AVG_H
#define T_FLOATING_AVG_H


class t_Range {
public:
	double max,min,size;
	void Reset(void);
	char Update(double d);
};


class t_laverage : public t_Range {
public:
	double AvgV,alen;

	double Range(void);

	virtual void Add(double);	
	virtual void Reset(void);
};


class t_average : public t_laverage {
public:
	void Init(double);
	virtual void Add(double v);	
};


class t_window_stack : public t_average {
public:
	int len,idx,cnt;
	double *V;

	void Init(int length);
	void Done(void);
	void ZeroIt(void);		

	double Get(int i);
	double Get(double I);
	double Value(void);		// return average

	double Info(void);		// shanon
	virtual void Add(double v);		// take the next value into the window
	virtual void Reset(void);
					// and remove the last value
        
};

#endif







/**/
/**/
/**/
/**/
/**/
/**/
/**/
/**/
/*****  End Of File  ****************************/
