00001
00002
00003
00004
00005
00006
00007
00008
00009 #ifndef _STATS_H
00010 #define _STATS_H
00011
00012 class Stats
00013 {
00014 public:
00015 Stats();
00016
00018
00020
00021 double getMean() const;
00022 double getSdev() const;
00023 double getSum() const;
00024 unsigned int getNum() const;
00025
00026 double getWmean() const;
00027 double getWsdev() const;
00028 double getWsum() const;
00029 unsigned int getWnum() const;
00030
00031 void setWindowLength( unsigned int len );
00032 unsigned int getWindowLength() const;
00033
00035
00037 void input( double v );
00038
00039 void process( const Eref& e, ProcPtr p );
00040 void reinit( const Eref& e, ProcPtr p );
00041
00043 virtual void vProcess( const Eref& e, ProcPtr p );
00044 virtual void vReinit( const Eref& e, ProcPtr p );
00045
00047
00049 void doWindowCalculation() const;
00050 void innerWindowCalculation();
00051
00053 static const Cinfo* initCinfo();
00054 private:
00055 double mean_;
00056 double sdev_;
00057 double sum_;
00058 unsigned int num_;
00059 double wmean_;
00060 double wsdev_;
00061 double wsum_;
00062 unsigned int wnum_;
00063 double sumsq_;
00064 double lastt_;
00065 vector< double > samples_;
00066 bool isWindowDirty_;
00067 };
00068
00069 #endif // _STATS_H