MeteoIODoc  MeteoIODoc-2.6.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
WindowedFilter.h
Go to the documentation of this file.
1 /***********************************************************************************/
2 /* Copyright 2009 WSL Institute for Snow and Avalanche Research SLF-DAVOS */
3 /***********************************************************************************/
4 /* This file is part of MeteoIO.
5  MeteoIO is free software: you can redistribute it and/or modify
6  it under the terms of the GNU Lesser General Public License as published by
7  the Free Software Foundation, either version 3 of the License, or
8  (at your option) any later version.
9 
10  MeteoIO is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public License
16  along with MeteoIO. If not, see <http://www.gnu.org/licenses/>.
17 */
18 #ifndef WINDOWEDFILTER_H
19 #define WINDOWEDFILTER_H
20 
22 #include <vector>
23 #include <string>
24 
25 namespace mio {
26 
34 class WindowedFilter : public FilterBlock {
35  public:
36  enum Centering {
37  left,
40  };
41 
42  WindowedFilter(const std::string& name);
43 
44  virtual void process(const unsigned int& param, const std::vector<MeteoData>& ivec,
45  std::vector<MeteoData>& ovec) = 0;
46 
47  protected:
48  static unsigned int get_centering(std::vector<std::string>& vec_args);
49  const std::vector<const MeteoData*>& get_window(const size_t& index,
50  const std::vector<MeteoData>& ivec);
51  bool get_window_specs(const size_t& index, const std::vector<MeteoData>& ivec,
52  size_t& start, size_t& end) const;
53 
58 
59  private:
60  std::vector<const MeteoData*> vec_window;
61 
62  protected:
63  bool is_soft; //placed here for alignement
64 };
65 
66 } //end namespace
67 
68 #endif
Duration min_time_span
Definition: WindowedFilter.h:54
bool is_soft
Definition: WindowedFilter.h:63
Centering
Definition: WindowedFilter.h:36
centered window
Definition: WindowedFilter.h:38
left centered window
Definition: WindowedFilter.h:37
size_t min_data_points
Definition: WindowedFilter.h:57
size_t last_end
Definition: WindowedFilter.h:56
right centered window
Definition: WindowedFilter.h:39
WindowedFilter(const std::string &name)
Definition: WindowedFilter.cc:26
Centering centering
Definition: WindowedFilter.h:55
const std::vector< const MeteoData * > & get_window(const size_t &index, const std::vector< MeteoData > &ivec)
A function that cuts out the desired window for the 'index' element within ivec, the window elements ...
Definition: WindowedFilter.cc:57
A class to handle timestamps. This class handles conversion between different time display formats (I...
Definition: Date.h:79
bool get_window_specs(const size_t &index, const std::vector< MeteoData > &ivec, size_t &start, size_t &end) const
A function that computes the start and end for a window for the 'index' element from ivec The princip...
Definition: WindowedFilter.cc:108
size_t last_start
Definition: WindowedFilter.h:56
An abstract class.
Definition: FilterBlock.h:35
virtual void process(const unsigned int &param, const std::vector< MeteoData > &ivec, std::vector< MeteoData > &ovec)=0
Definition: WindowedFilter.h:34
static unsigned int get_centering(std::vector< std::string > &vec_args)
Definition: WindowedFilter.cc:31