All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ChronFileInterpolator.hpp
Go to the documentation of this file.
1 /*
2 
3  This file is part of OpenFLUID software
4  Copyright(c) 2007, INRA - Montpellier SupAgro
5 
6 
7  == GNU General Public License Usage ==
8 
9  OpenFLUID is free software: you can redistribute it and/or modify
10  it under the terms of the GNU General Public License as published by
11  the Free Software Foundation, either version 3 of the License, or
12  (at your option) any later version.
13 
14  OpenFLUID is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  GNU General Public License for more details.
18 
19  You should have received a copy of the GNU General Public License
20  along with OpenFLUID. If not, see <http://www.gnu.org/licenses/>.
21 
22 
23  == Other Usage ==
24 
25  Other Usage means a use of OpenFLUID that is inconsistent with the GPL
26  license, and requires a written agreement between You and INRA.
27  Licensees for Other Usage of OpenFLUID may use this file in accordance
28  with the terms contained in the written agreement between You and INRA.
29 
30 */
31 
32 
33 /**
34  \file ChronFileInterpolator.hpp
35  \brief Header of ...
36 
37  \author Jean-Christophe FABRE <fabrejc@supagro.inra.fr>
38  */
39 
40 
41 #ifndef __CHRONFILEINTERPOLATOR_HPP__
42 #define __CHRONFILEINTERPOLATOR_HPP__
43 
44 #include <list>
45 #include <iostream>
48 #include <openfluid/dllexport.hpp>
49 
50 namespace openfluid { namespace tools {
51 
52 
54 {
55  public:
56 
57  enum PreProcess { PREPROCESS_NONE, PREPROCESS_CUMULATE };
58 
59  private:
60 
61  void checkPreload();
62 
63  void checkPostload();
64 
65  protected:
66 
67  std::string m_InFilePath;
68 
69  std::string m_InDateFormat;
70 
71  std::string m_InColumnSeparators;
72 
73  std::string m_InCommentChar;
74 
75  std::string m_OutFilePath;
76 
77  std::string m_OutDateFormat;
78 
79  std::string m_OutColumnSeparator;
80 
81  std::string m_OutCommentChar;
82 
84 
86 
88 
90 
91  void loadInFile(ChronologicalSerie& Data);
92 
94  {
95  ChronologicalSerie::iterator it;
96  ChronologicalSerie::iterator itb = Data.begin();
97  ChronologicalSerie::iterator ite = Data.end();
98 
99  std::cout << "--------------------------------" << std::endl;
100  for (it=itb;it!=ite;++it)
101  {
102  std::cout << (*it).first.getAsISOString() << " -> " << (*it).second << std::endl;
103  }
104  std::cout << "--------------------------------" << std::endl;
105  }
106 
107  public:
108 
109 
110  ChronFileInterpolator(const std::string& InFilePath, const std::string& OutFilePath,
111  const openfluid::core::DateTime& BeginDate, const openfluid::core::DateTime& EndDate,
112  const openfluid::core::Duration_t& DeltaT, PreProcess PrePcs = PREPROCESS_NONE);
113 
114  virtual ~ChronFileInterpolator();
115 
116 
117  virtual void runInterpolation() = 0;
118 
119 
120  std::string getInColumnSeparators() const
121  {
122  return m_InColumnSeparators;
123  }
124 
125  void setInColumnSeparators(const std::string& InColumnSeparators)
126  {
127  m_InColumnSeparators = InColumnSeparators;
128  }
129 
130  std::string getInCommentChar() const
131  {
132  return m_InCommentChar;
133  }
134 
135  void setInCommentChar(const std::string& InCommentChar)
136  {
137  m_InCommentChar = InCommentChar;
138  }
139 
140  std::string getInDateFormat() const
141  {
142  return m_InDateFormat;
143  }
144 
145  void setInDateFormat(const std::string& InDateFormat)
146  {
147  m_InDateFormat = InDateFormat;
148  }
149 
150  std::string getInFilePath() const
151  {
152  return m_InFilePath;
153  }
154 
155  std::string getOutColumnSeparator() const
156  {
157  return m_OutColumnSeparator;
158  }
159 
160  void setOutColumnSeparator(const std::string& OutColumnSeparator)
161  {
162  m_OutColumnSeparator = OutColumnSeparator;
163  }
164 
165  std::string getOutCommentChar() const
166  {
167  return m_OutCommentChar;
168  }
169 
170  void setOutCommentChar(const std::string& OutCommentChar)
171  {
172  m_OutCommentChar = OutCommentChar;
173  }
174 
175  std::string getOutDateFormat() const
176  {
177  return m_OutDateFormat;
178  }
179 
180  void setOutDateFormat(const std::string& OutDateFormat)
181  {
182  m_OutDateFormat = OutDateFormat;
183  }
184 
185  std::string getOutFilePath() const
186  {
187  return m_OutFilePath;
188  }
189 
191  {
192  return m_BeginDate;
193  }
194 
196  {
197  return m_DeltaT;
198  }
199 
201  {
202  return m_EndDate;
203  }
204 
206  {
207  return m_PreProcess;
208  }
209 };
210 
211 
212 } } // namespaces
213 
214 
215 #endif /* __CHRONFILEINTERPOLATOR_HPP__ */
std::string getOutCommentChar() const
Definition: ChronFileInterpolator.hpp:165
Definition: ChronFileInterpolator.hpp:57
void displayChronSerie(ChronologicalSerie &Data)
Definition: ChronFileInterpolator.hpp:93
std::string m_OutColumnSeparator
Definition: ChronFileInterpolator.hpp:79
openfluid::core::DateTime getBeginDate() const
Definition: ChronFileInterpolator.hpp:190
Class for management of date and time information.
Definition: DateTime.hpp:131
std::string getOutColumnSeparator() const
Definition: ChronFileInterpolator.hpp:155
std::string m_OutCommentChar
Definition: ChronFileInterpolator.hpp:81
std::string getInFilePath() const
Definition: ChronFileInterpolator.hpp:150
std::string m_InColumnSeparators
Definition: ChronFileInterpolator.hpp:71
std::string getInDateFormat() const
Definition: ChronFileInterpolator.hpp:140
std::string m_InDateFormat
Definition: ChronFileInterpolator.hpp:69
PreProcess m_PreProcess
Definition: ChronFileInterpolator.hpp:89
void setInColumnSeparators(const std::string &InColumnSeparators)
Definition: ChronFileInterpolator.hpp:125
PreProcess
Definition: ChronFileInterpolator.hpp:57
openfluid::core::DateTime m_EndDate
Definition: ChronFileInterpolator.hpp:85
std::string m_InCommentChar
Definition: ChronFileInterpolator.hpp:73
openfluid::core::Duration_t getDeltaT() const
Definition: ChronFileInterpolator.hpp:195
void setInCommentChar(const std::string &InCommentChar)
Definition: ChronFileInterpolator.hpp:135
std::string getOutDateFormat() const
Definition: ChronFileInterpolator.hpp:175
std::string m_OutDateFormat
Definition: ChronFileInterpolator.hpp:77
void setInDateFormat(const std::string &InDateFormat)
Definition: ChronFileInterpolator.hpp:145
openfluid::core::DateTime getEndDate() const
Definition: ChronFileInterpolator.hpp:200
void setOutColumnSeparator(const std::string &OutColumnSeparator)
Definition: ChronFileInterpolator.hpp:160
openfluid::core::Duration_t m_DeltaT
Definition: ChronFileInterpolator.hpp:87
std::string m_OutFilePath
Definition: ChronFileInterpolator.hpp:75
std::string m_InFilePath
Definition: ChronFileInterpolator.hpp:67
std::string getInCommentChar() const
Definition: ChronFileInterpolator.hpp:130
openfluid::core::DateTime m_BeginDate
Definition: ChronFileInterpolator.hpp:83
unsigned long long Duration_t
Definition: DateTime.hpp:68
Definition: ChronologicalSerie.hpp:60
Definition: ChronFileInterpolator.hpp:53
void setOutDateFormat(const std::string &OutDateFormat)
Definition: ChronFileInterpolator.hpp:180
std::string getInColumnSeparators() const
Definition: ChronFileInterpolator.hpp:120
std::string getOutFilePath() const
Definition: ChronFileInterpolator.hpp:185
void setOutCommentChar(const std::string &OutCommentChar)
Definition: ChronFileInterpolator.hpp:170
PreProcess getPreProcess() const
Definition: ChronFileInterpolator.hpp:205
#define DLLEXPORT
Definition: dllexport.hpp:51