MeteoIODoc 20240503.aefd3c94
WindowedFilter.h
Go to the documentation of this file.
1// SPDX-License-Identifier: LGPL-3.0-or-later
2/***********************************************************************************/
3/* Copyright 2009 WSL Institute for Snow and Avalanche Research SLF-DAVOS */
4/***********************************************************************************/
5/* This file is part of MeteoIO.
6 MeteoIO is free software: you can redistribute it and/or modify
7 it under the terms of the GNU Lesser General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
10
11 MeteoIO is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU Lesser General Public License for more details.
15
16 You should have received a copy of the GNU Lesser General Public License
17 along with MeteoIO. If not, see <http://www.gnu.org/licenses/>.
18*/
19#ifndef WINDOWEDFILTER_H
20#define WINDOWEDFILTER_H
21
23#include <vector>
24#include <string>
25
26namespace mio {
27
36 public:
37 enum Centering {
40 right
41 };
42
43 virtual void process(const unsigned int& param, const std::vector<MeteoData>& ivec,
44 std::vector<MeteoData>& ovec) = 0;
45
46 protected:
47 WindowedFilter(const std::vector< std::pair<std::string, std::string> >& vecArgs, const std::string& name, const Config& cfg, const bool& skipWindowParams=false);
48
49 void setWindowFParams(const std::vector< std::pair<std::string, std::string> >& vecArgs);
50 const std::vector<const MeteoData*>& get_window(const size_t& index,
51 const std::vector<MeteoData>& ivec);
52 bool get_window_specs(const size_t& index, const std::vector<MeteoData>& ivec,
53 size_t& start, size_t& end) const;
54
59
60 private:
61 std::vector<const MeteoData*> vec_window;
62
63 protected:
64 bool is_soft; //placed here for alignement
65};
66
67} //end namespace
68
69#endif
A class that reads a key/value file. These files (typically named *.ini) follow the INI file format s...
Definition: Config.h:79
A class to handle timestamps. This class handles conversion between different time display formats (I...
Definition: Date.h:87
The base class for all filters that provides the interface and a few helper methods.
Definition: ProcessingBlock.h:67
Definition: WindowedFilter.h:35
bool is_soft
Definition: WindowedFilter.h:64
WindowedFilter(const std::vector< std::pair< std::string, std::string > > &vecArgs, const std::string &name, const Config &cfg, const bool &skipWindowParams=false)
Construct a WindowedFilter Object. This is for filters that require a certain window of data.
Definition: WindowedFilter.cc:34
Centering
Definition: WindowedFilter.h:37
@ left
left centered window
Definition: WindowedFilter.h:38
@ center
centered window
Definition: WindowedFilter.h:39
@ right
right centered window
Definition: WindowedFilter.h:40
virtual void process(const unsigned int &param, const std::vector< MeteoData > &ivec, std::vector< MeteoData > &ovec)=0
void setWindowFParams(const std::vector< std::pair< std::string, std::string > > &vecArgs)
Parse the arguments in order to retrieve the user parameters for the data window. The following param...
Definition: WindowedFilter.cc:51
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:142
size_t last_start
Definition: WindowedFilter.h:58
Centering centering
This is filled in the constructor by calling setWindowFParams.
Definition: WindowedFilter.h:56
size_t last_end
Definition: WindowedFilter.h:58
size_t min_data_points
This is filled in the constructor by calling setWindowFParams.
Definition: WindowedFilter.h:57
Duration min_time_span
This is filled in the constructor by calling setWindowFParams.
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:92
Definition: Config.cc:31