MeteoIODoc  MeteoIODoc-2.6.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ProcessingBlock.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 PROCESSINGBLOCK_H
19 #define PROCESSINGBLOCK_H
20 
22 #include <meteoio/Config.h>
23 #include <vector>
24 #include <string>
25 #include <set>
26 
27 #ifdef _MSC_VER
28  #pragma warning(disable:4512) //we don't need any = operator!
29 #endif
30 
31 namespace mio {
32 
34  public:
35  typedef enum PROC_STAGE { none,
39  //once ///< activate at stage one or two, but only once
40  } proc_stage;
41 
44  stage(first) {}
45 
46  const std::string toString() const;
47 
50 
51  size_t points_before;
52  size_t points_after;
53 
55 };
56 
64  public:
65  virtual ~ProcessingBlock();
66 
67  virtual void process(const unsigned int& param, const std::vector<MeteoData>& ivec,
68  std::vector<MeteoData>& ovec) = 0;
69 
70  std::string getName() const;
71  const ProcessingProperties& getProperties() const;
72  const std::string toString() const;
73 
74  protected:
75  ProcessingBlock(const std::string& name);
76 
77  void convert_args(const size_t& min_nargs, const size_t& max_nargs,
78  const std::vector<std::string>& vec_args, std::vector<double>& dbl_args) const;
79  static bool is_soft(std::vector<std::string>& vec_args);
80  static void readCorrections(const std::string& filter, const std::string& filename, const char& c_type, const double& init, std::vector<double> &corrections);
81 
83  const std::string block_name;
84 
85  static const double soil_albedo, snow_albedo, snow_thresh;
86 };
87 
88 class BlockFactory {
89  public:
90  static ProcessingBlock* getBlock(const std::string& blockname, const std::vector<std::string>& vec_args, const Config& cfg);
91 };
92 
93 } //end namespace
94 
95 #endif
Definition: ProcessingBlock.h:33
std::string getName() const
Definition: ProcessingBlock.cc:227
const ProcessingProperties & getProperties() const
Definition: ProcessingBlock.cc:297
ProcessingBlock(const std::string &name)
protected constructor only to be called by children
Definition: ProcessingBlock.cc:199
never activate this block
Definition: ProcessingBlock.h:35
static ProcessingBlock * getBlock(const std::string &blockname, const std::vector< std::string > &vec_args, const Config &cfg)
Definition: ProcessingBlock.cc:124
activate at first stage
Definition: ProcessingBlock.h:36
const std::string block_name
Definition: ProcessingBlock.h:83
activate at second stage
Definition: ProcessingBlock.h:37
size_t points_before
Definition: ProcessingBlock.h:51
virtual void process(const unsigned int &param, const std::vector< MeteoData > &ivec, std::vector< MeteoData > &ovec)=0
const std::string toString() const
Definition: ProcessingBlock.cc:301
proc_stage stage
Definition: ProcessingBlock.h:54
An abstract class.
Definition: ProcessingBlock.h:63
static void readCorrections(const std::string &filter, const std::string &filename, const char &c_type, const double &init, std::vector< double > &corrections)
Definition: ProcessingBlock.cc:231
static const double soil_albedo
Definition: ProcessingBlock.h:85
static const double snow_thresh
parametrize the albedo from HS
Definition: ProcessingBlock.h:85
static const double snow_albedo
Definition: ProcessingBlock.h:85
A class that reads a key/value file. These files (typically named *.ini) follow the INI file format s...
Definition: Config.h:58
Duration time_after
Definition: ProcessingBlock.h:49
Duration time_before
Definition: ProcessingBlock.h:48
activate at both first and second stage
Definition: ProcessingBlock.h:38
void convert_args(const size_t &min_nargs, const size_t &max_nargs, const std::vector< std::string > &vec_args, std::vector< double > &dbl_args) const
Definition: ProcessingBlock.cc:202
Definition: ProcessingBlock.h:88
A class to handle timestamps. This class handles conversion between different time display formats (I...
Definition: Date.h:79
const std::string toString() const
Definition: ProcessingBlock.cc:289
size_t points_after
Definition: ProcessingBlock.h:52
ProcessingProperties()
Definition: ProcessingBlock.h:42
ProcessingProperties properties
Definition: ProcessingBlock.h:82
virtual ~ProcessingBlock()
Definition: ProcessingBlock.cc:287
static bool is_soft(std::vector< std::string > &vec_args)
Definition: ProcessingBlock.cc:216
proc_stage
Definition: ProcessingBlock.h:35