filter.h

Go to the documentation of this file.
00001 /***************************************************************************/
00020 #ifndef AURESERVOIR_FILTER_H__
00021 #define AURESERVOIR_FILTER_H__
00022 
00023 #include "utilities.h"
00024 #include <vector>
00025 
00026 namespace aureservoir
00027 {
00028 
00052 template <typename T>
00053 class BPFilter
00054 {
00055  public:
00056 
00058   BPFilter() {}
00059 
00061   virtual ~BPFilter() {}
00062 
00064   const BPFilter& operator= (const BPFilter<T>& src)
00065   {
00066     ema1_ = src.ema1_; ema2_ = src.ema2_;
00067     f1_ = src.f1_; f2_ = src.f2_;
00068     scale_ = src.scale_;
00069     return *this;
00070   }
00071 
00073   void setBPCutoff(const typename DEVector<T>::Type &f1,
00074                    const typename DEVector<T>::Type &f2)
00075                    throw(AUExcept);
00076 
00079   void calc(typename DEVector<T>::Type &x);
00080 
00081  protected:
00082 
00084   typename DEVector<T>::Type ema1_;
00086   typename DEVector<T>::Type ema2_;
00088   typename DEVector<T>::Type f1_;
00090   typename DEVector<T>::Type f2_;
00092   typename DEVector<T>::Type scale_;
00093 };
00094 
00109 template <typename T>
00110 class IIRFilter
00111 {
00112  public:
00113 
00115   IIRFilter() {}
00116 
00118   virtual ~IIRFilter() {}
00119 
00121   const IIRFilter& operator= (const IIRFilter<T>& src)
00122   {
00123     B_ = src.B_;
00124     A_ = src.A_;
00125     S_ = src.S_;
00126     y_ = src.y_;
00127     return *this;
00128   }
00129 
00139   void setIIRCoeff(const typename DEMatrix<T>::Type &B,
00140                    const typename DEMatrix<T>::Type &A)
00141                    throw(AUExcept);
00142 
00145   void calc(typename DEVector<T>::Type &x);
00146 
00147  protected:
00148 
00150   typename DEMatrix<T>::Type B_;
00152   typename DEMatrix<T>::Type A_;
00154   typename DEMatrix<T>::Type S_;
00156   typename DEVector<T>::Type y_;
00157 
00158 };
00159 
00169 template <typename T>
00170 class SerialIIRFilter
00171 {
00172  public:
00173 
00175   SerialIIRFilter() {}
00176 
00178   virtual ~SerialIIRFilter() {}
00179 
00181   const SerialIIRFilter& operator= (const IIRFilter<T>& src)
00182   {
00183     filters_ = src.filters_;
00184     return *this;
00185   }
00186 
00199   void setIIRCoeff(const typename DEMatrix<T>::Type &B,
00200                    const typename DEMatrix<T>::Type &A,
00201                    int series=1) throw(AUExcept);
00202 
00205   void calc(typename DEVector<T>::Type &x);
00206 
00207  protected:
00208 
00210    std::vector< IIRFilter<T> > filters_;
00211 };
00212 
00213 } // end of namespace aureservoir
00214 
00215 #include <aureservoir/filter.hpp>
00216 
00217 #endif // AURESERVOIR_FILTER_H__

Generated on Wed Mar 12 21:16:05 2008 for aureservoir by  doxygen 1.5.3