Commit d213594a authored by thomas.forbriger's avatar thomas.forbriger Committed by thomas.forbriger
Browse files

provides filter virtual base

This is a legacy commit from before 2015-03-01.
It may be incomplete as well as inconsistent.
See COPYING.legacy and README.history for details.


SVN Path:     http://gpitrsvn.gpi.uni-karlsruhe.de/repos/TFSoftware/trunk
SVN Revision: 1804
SVN UUID:     67feda4a-a26e-11df-9d6e-31afc202ad0c
parent cde18e9b
# this is <Makefile>
# ----------------------------------------------------------------------------
# $Id: Makefile,v 1.6 2005-07-04 14:16:48 tforb Exp $
# $Id: Makefile,v 1.7 2005-07-04 15:58:37 tforb Exp $
#
# Copyright (c) 2003 by Thomas Forbriger (BFO Schiltach)
#
......@@ -44,7 +44,7 @@ CXXFLAGS=-Wall $(FLAGS)
LDFLAGS=-L$(LOCLIBDIR)
CPPFLAGS=-I$(LOCINCLUDEDIR) $(FLAGS)
all: libtsxx.a doxybrief doxyfull
all: libtsxx.a doxyfull
flist: Makefile $(wildcard *.h *.cc *.cfg)
echo $^ | tr ' ' '\n' | sort > $@
......
......@@ -3,7 +3,7 @@
*
* ----------------------------------------------------------------------------
*
* $Id: filter.cc,v 1.1 2005-06-30 12:47:41 tforb Exp $
* $Id: filter.cc,v 1.2 2005-07-04 15:58:37 tforb Exp $
* \author Thomas Forbriger
* \date 30/06/2005
*
......@@ -19,12 +19,24 @@
#define TF_FILTER_CC_VERSION \
"TF_FILTER_CC V1.0 "
#define TF_FILTER_CC_CVSID \
"$Id: filter.cc,v 1.1 2005-06-30 12:47:41 tforb Exp $"
"$Id: filter.cc,v 1.2 2005-07-04 15:58:37 tforb Exp $"
#include <tsxx/filter.h>
namespace ts {
}
namespace filter {
Ttimeseries FilterCollection::operator()(const Ttimeseries& s) const
{
Tfilterlist::const_iterator i=this->Tfilterlist::begin();
while (i!=this->Tfilterlist::end())
{ (*i)->operator()(s); }
return s;
}
} // namespace filter
} // namespace ts
/* ----- END OF filter.cc ----- */
......@@ -3,7 +3,7 @@
*
* ----------------------------------------------------------------------------
*
* $Id: filter.h,v 1.3 2005-07-04 14:16:48 tforb Exp $
* $Id: filter.h,v 1.4 2005-07-04 15:58:37 tforb Exp $
* \author Thomas Forbriger
* \date 30/06/2005
*
......@@ -23,21 +23,78 @@
#define TF_FILTER_H_VERSION \
"TF_FILTER_H V1.0 "
#define TF_FILTER_H_CVSID \
"$Id: filter.h,v 1.3 2005-07-04 14:16:48 tforb Exp $"
"$Id: filter.h,v 1.4 2005-07-04 15:58:37 tforb Exp $"
#include<list>
#include<tsxx/tsxx.h>
#include<tfxx/handle.h>
namespace ts {
/* base class for any filter */
class BasicFilter {
public:
int i;
}; // class BasicFilter
namespace filter {
//! we always work in double precision
typedef double Tvalue;
/*! simple header
*/
struct DTHeader {
DTHeader(const Tvalue& sdt): dt(sdt) { }
//! sampling interval
Tvalue dt;
}; // DTHeader
//! the way we use time series
typedef ts::TimeSeries<aff::Series<Tvalue>, DTHeader> Ttimeseries;
/*! base class for any filter
*
* Filters derived from that class will have the following properties:
*
* - They will not change the number of samples
* - They will not change the sampling interval
* - They do neither need the time of first sample nor will they alter it
*/
class BasicFilter {
public:
//! type of sample values
typedef double Tvalue;
//! type of series container
typedef Ttimeseries::Tseries Tseries;
typedef Ttimeseries::Theader Theader;
virtual ~BasicFilter();
virtual Ttimeseries operator()(const Ttimeseries& s) const =0;
Ttimeseries operator()(const Tseries& s, const Tvalue& dt) const
{ return this->operator()(Ttimeseries(s, Theader(dt))); }
template <class H>
Ttimeseries operator()(const ts::TimeSeries<Tseries, H>& s) const
{ return this->operator()(Ttimeseries(s, Theader(s.header.dt))); }
private:
//! Do not allow to use the baseclass alone
BasicFilter();
}; // class BasicFilter
/*! filter collection
*/
class FilterCollection: public std::list<tfxx::Handle<BasicFilter> > {
public:
typedef BasicFilter Tfilter;
typedef tfxx::Handle<Tfilter> Tfilterhandle;
typedef std::list<Tfilterhandle> Tfilterlist;
typedef Tfilterlist Tbase;
typedef Ttimeseries::Tseries Tseries;
typedef Ttimeseries::Theader Theader;
Ttimeseries operator()(const Ttimeseries& s) const;
Ttimeseries operator()(const Tseries& s, const Tvalue& dt) const
{ return this->operator()(Ttimeseries(s, Theader(dt))); }
template <class H>
Ttimeseries operator()(const ts::TimeSeries<Tseries, H>& s) const
{ return this->operator()(Ttimeseries(s, Theader(s.header.dt))); }
}; // class FilterCollection
/* function that returns a handle to any filter after parsing the
* parameters
*/
} // namespace filter
}
} // namespace ts
#endif // TF_FILTER_H_VERSION (includeguard)
......
......@@ -3,7 +3,7 @@
*
* ----------------------------------------------------------------------------
*
* $Id: seifexx.cc,v 1.4 2005-07-04 14:16:49 tforb Exp $
* $Id: seifexx.cc,v 1.5 2005-07-04 15:58:38 tforb Exp $
* \author Thomas Forbriger
* \date 14/01/2005
*
......@@ -23,7 +23,7 @@
#define TF_SEIFEXX_CC_VERSION \
"TF_SEIFEXX_CC V1.0 "
#define TF_SEIFEXX_CC_CVSID \
"$Id: seifexx.cc,v 1.4 2005-07-04 14:16:49 tforb Exp $"
"$Id: seifexx.cc,v 1.5 2005-07-04 15:58:38 tforb Exp $"
#include <tsxx/seifexx.h>
extern "C" {
......@@ -35,70 +35,70 @@ namespace ts {
namespace seife {
/*! Butterworth lowpass (period t0, order o) */
void lpb(Tseries s, double dt, double t0, int o)
{ seife_lpb(&s(s.first()), s.size(), dt, t0, o); }
void lpb(const Tseries& s, double dt, double t0, int o)
{ seife_lpb(s.pointer(), s.size(), dt, t0, o); }
/*! Butterworth highpass (period t0, order o) */
void hpb(Tseries s, double dt, double t0, int o)
{ seife_hpb(&s(s.first()), s.size(), dt, t0, o); }
void hpb(const Tseries& s, double dt, double t0, int o)
{ seife_hpb(s.pointer(), s.size(), dt, t0, o); }
/*! 2nd order lowpass (period t0, damping h) */
void lp2(Tseries s, double dt, double t0, double h)
{ seife_lp2(&s(s.first()), s.size(), dt, t0, h); }
void lp2(const Tseries& s, double dt, double t0, double h)
{ seife_lp2(s.pointer(), s.size(), dt, t0, h); }
/*! 2nd order highpass (period t0, damping h) */
void hp2(Tseries s, double dt, double t0, double h)
{ seife_hp2(&s(s.first()), s.size(), dt, t0, h); }
void hp2(const Tseries& s, double dt, double t0, double h)
{ seife_hp2(s.pointer(), s.size(), dt, t0, h); }
/*! 2nd order bandpass (period t0, damping h) */
void bp2(Tseries s, double dt, double t0, double h)
{ seife_bp2(&s(s.first()), s.size(), dt, t0, h); }
void bp2(const Tseries& s, double dt, double t0, double h)
{ seife_bp2(s.pointer(), s.size(), dt, t0, h); }
/*! 1st order lowpass (period t0) */
void lp1(Tseries s, double dt, double t0)
{ seife_lp1(&s(s.first()), s.size(), dt, t0); }
void lp1(const Tseries& s, double dt, double t0)
{ seife_lp1(s.pointer(), s.size(), dt, t0); }
/*! 1st order highpass (period t0) */
void hp1(Tseries s, double dt, double t0)
{ seife_hp1(&s(s.first()), s.size(), dt, t0); }
void hp1(const Tseries& s, double dt, double t0)
{ seife_hp1(s.pointer(), s.size(), dt, t0); }
/*! integration (time constant t0) */
void integrate(Tseries s, double dt, double t0)
{ seife_int(&s(s.first()), s.size(), dt, t0); }
void integrate(const Tseries& s, double dt, double t0)
{ seife_int(s.pointer(), s.size(), dt, t0); }
/*! 1st order highpass equalizer (former period t0s, new period t0) */
void he1(Tseries s, double dt, double t0s, double t0)
{ seife_he1(&s(s.first()), s.size(), dt, t0s, t0); }
void he1(const Tseries& s, double dt, double t0s, double t0)
{ seife_he1(s.pointer(), s.size(), dt, t0s, t0); }
/*! 1st order lowpass equalizer (former period t0s, new period t0) */
void le1(Tseries s, double dt, double t0s, double t0)
{ seife_le1(&s(s.first()), s.size(), dt, t0s, t0); }
void le1(const Tseries& s, double dt, double t0s, double t0)
{ seife_le1(s.pointer(), s.size(), dt, t0s, t0); }
/*! 2nd order highpass equalizer (former: period t0s and damping hs,
* new: period t0 and damping h)
*/
void he2(Tseries s, double dt,
void he2(const Tseries& s, double dt,
double t0s, double hs, double t0, double h)
{ seife_he2(&s(s.first()), s.size(), dt, t0s, hs, t0, h); }
{ seife_he2(s.pointer(), s.size(), dt, t0s, hs, t0, h); }
/*! 2nd order lowpass equalizer (former: period t0s and damping hs,
* new: period t0 and damping h)
*/
void le2(Tseries s, double dt,
void le2(const Tseries& s, double dt,
double t0s, double hs, double t0, double h)
{ seife_le2(&s(s.first()), s.size(), dt, t0s, hs, t0, h); }
{ seife_le2(s.pointer(), s.size(), dt, t0s, hs, t0, h); }
/*! detide with synthetic tides interpolated over ni samples */
void tid(Tseries s, double dt, int ni)
{ seife_tid(&s(s.first()), s.size(), dt, ni); }
void tid(const Tseries& s, double dt, int ni)
{ seife_tid(s.pointer(), s.size(), dt, ni); }
/*! derivative (time constant t0) */
void dif(Tseries s, double dt, double t0)
{ seife_dif(&s(s.first()), s.size(), dt, t0); }
void dif(const Tseries& s, double dt, double t0)
{ seife_dif(s.pointer(), s.size(), dt, t0); }
/*! set baseline to first value */
void first(Tseries s)
{ seife_first(&s(s.first()), s.size()); }
void first(const Tseries& s)
{ seife_first(s.pointer(), s.size()); }
} // namespace seife
......
......@@ -3,7 +3,7 @@
*
* ----------------------------------------------------------------------------
*
* $Id: seifexx.h,v 1.4 2005-07-04 14:16:49 tforb Exp $
* $Id: seifexx.h,v 1.5 2005-07-04 15:58:38 tforb Exp $
* \author Thomas Forbriger
* \date 14/01/2005
*
......@@ -23,7 +23,7 @@
#define TF_SEIFEXX_H_VERSION \
"TF_SEIFEXX_H V1.0 "
#define TF_SEIFEXX_H_CVSID \
"$Id: seifexx.h,v 1.4 2005-07-04 14:16:49 tforb Exp $"
"$Id: seifexx.h,v 1.5 2005-07-04 15:58:38 tforb Exp $"
#include<aff/series.h>
......@@ -37,41 +37,41 @@ namespace ts {
typedef aff::Series<Tvalue> Tseries;
/*! Butterworth lowpass (period t0, order o) */
void lpb(Tseries s, double dt, double t0, int o);
void lpb(const Tseries& s, double dt, double t0, int o);
/*! Butterworth highpass (period t0, order o) */
void hpb(Tseries s, double dt, double t0, int o);
void hpb(const Tseries& s, double dt, double t0, int o);
/*! 2nd order lowpass (period t0, damping h) */
void lp2(Tseries s, double dt, double t0, double h);
void lp2(const Tseries& s, double dt, double t0, double h);
/*! 2nd order highpass (period t0, damping h) */
void hp2(Tseries s, double dt, double t0, double h);
void hp2(const Tseries& s, double dt, double t0, double h);
/*! 2nd order bandpass (period t0, damping h) */
void bp2(Tseries s, double dt, double t0, double h);
void bp2(const Tseries& s, double dt, double t0, double h);
/*! 1st order lowpass (period t0) */
void lp1(Tseries s, double dt, double t0);
void lp1(const Tseries& s, double dt, double t0);
/*! 1st order highpass (period t0) */
void hp1(Tseries s, double dt, double t0);
void hp1(const Tseries& s, double dt, double t0);
/*! integration (time constant t0) */
void integrate(Tseries s, double dt, double t0);
void integrate(const Tseries& s, double dt, double t0);
/*! 1st order highpass equalizer (former period t0s, new period t0) */
void he1(Tseries s, double dt, double t0s, double t0);
void he1(const Tseries& s, double dt, double t0s, double t0);
/*! 1st order lowpass equalizer (former period t0s, new period t0) */
void le1(Tseries s, double dt, double t0s, double t0);
void le1(const Tseries& s, double dt, double t0s, double t0);
/*! 2nd order highpass equalizer (former: period t0s and damping hs,
* new: period t0 and damping h)
*/
void he2(Tseries s, double dt,
void he2(const Tseries& s, double dt,
double t0s, double hs, double t0, double h);
/*! 2nd order lowpass equalizer (former: period t0s and damping hs,
* new: period t0 and damping h)
*/
void le2(Tseries s, double dt,
void le2(const Tseries& s, double dt,
double t0s, double hs, double t0, double h);
/*! detide with synthetic tides interpolated over ni samples */
void tid(Tseries s, double dt, int ni);
void tid(const Tseries& s, double dt, int ni);
/*! derivative (time constant t0) */
void dif(Tseries s, double dt, double t0);
void dif(const Tseries& s, double dt, double t0);
/*! set baseline to first value */
void first(Tseries s);
void first(const Tseries& s);
} // namespace seife
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment