filterbase.cc 2.57 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
/*! \file filterbase.cc
 * \brief base class for all filter classes (implementation)
 * 
 * ----------------------------------------------------------------------------
 * 
 * \author Thomas Forbriger
 * \date 05/07/2005
 * 
 * base class for all filter classes (implementation)
 * 
 * Copyright (c) 2005 by Thomas Forbriger (BFO Schiltach) 
thomas.forbriger's avatar
thomas.forbriger committed
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
 *
 * ----
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version. 
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 * ----
28
29
30
 * 
 * REVISIONS and CHANGES 
 *  - 05/07/2005   V1.0   Thomas Forbriger
31
 *  - 18/12/2007   V1.1   - support debugging
32
33
 *  - 25/02/2019   V1.2   - pass return value to filter, to allow for change
 *                          in number of samples or sampling interval
34
35
36
37
 * 
 * ============================================================================
 */
#define TF_FILTERBASE_CC_VERSION \
38
  "TF_FILTERBASE_CC   V1.2"
39

thomas.forbriger's avatar
thomas.forbriger committed
40
#include <iostream>
thomas.forbriger's avatar
clean    
thomas.forbriger committed
41
#include <tsxx/filterbase.h>
42
#include <tsxx/debug.h>
43
44
45
46
47

namespace ts {

  namespace filter {

thomas.forbriger's avatar
thomas.forbriger committed
48
49
    Ttimeseries FilterCollection::operator()(const Ttimeseries& s,
                                             const bool& debug) const
50
    {
51
      Ttimeseries retval(s);
52
53
      Tfilterlist::const_iterator i=this->Tfilterlist::begin();
      while (i!=this->Tfilterlist::end())
thomas.forbriger's avatar
thomas.forbriger committed
54
      { 
55
        TSXX_debug(debug, "FilterCollection::operator()",
thomas.forbriger's avatar
thomas.forbriger committed
56
                   "apply filter" );
57
        retval=(*i)->operator()(retval, debug); 
thomas.forbriger's avatar
thomas.forbriger committed
58
59
        ++i;
      }
60
      TSXX_debug(debug, "FilterCollection::operator()",
thomas.forbriger's avatar
thomas.forbriger committed
61
                 "applied all filters" );
62
      return retval;
63
64
65
66
67
68
69
70
71
72
73
74
    }

    void Exception::report() const {
      this->Tbase::report();
    }

    void UnknownFilterException::report() const {
      this->Tbase::report();
      std::cerr << "requested filter type: \"" << Mfilter << "\""
        << std::endl;
    }

thomas.forbriger's avatar
thomas.forbriger committed
75
76
77
78
    // place these into the binary library
    BasicFilter::BasicFilter() { }
    BasicFilter::~BasicFilter() { }

79
80
81
82
83
  } // namespace filter

} // namespace ts

/* ----- END OF filterbase.cc ----- */