MeteoIODoc 2.11.0
MySQLIO.h
Go to the documentation of this file.
1// SPDX-License-Identifier: LGPL-3.0-or-later
2/***********************************************************************************/
3/* Copyright 2022 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 MYSQLIO_H
20#define MYSQLIO_H
21
22#include <meteoio/IOInterface.h>
23
24#include <string>
25
26namespace mio {
27
36class MYSQLIO : public IOInterface {
37 public:
38 MYSQLIO(const std::string& configfile);
39 MYSQLIO(const Config& cfgreader);
40
41 virtual void readStationData(const Date& date, std::vector<StationData>& vecStation);
42 virtual void readMeteoData(const Date& dateStart, const Date& dateEnd,
43 std::vector< std::vector<MeteoData> >& vecMeteo);
44
45 private:
46 void readConfig();
47 std::vector<std::string> readStationIDs() const;
48 void readStationMetaData();
49 void readData(const Date& dateStart, const Date& dateEnd, std::vector< std::vector<MeteoData> >& vecMeteo,
50 const size_t& stationindex) const;
51
52 const Config cfg;
53 std::vector<std::string> vecStationIDs;
54 std::vector<StationData> vecStationMetaData;
55 std::string mysqlhost, mysqldb, mysqluser, mysqlpass;
56 std::string coordin, coordinparam, coordout, coordoutparam; //projection parameters
57 double in_dflt_TZ, out_dflt_TZ;
58 unsigned int mysql_options;
59};
60
61} //namespace
62#endif
63
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
A class representing the IO Layer of the software Alpine3D. For each type of IO (File,...
Definition: IOInterface.h:98
Definition: MySQLIO.h:36
virtual void readStationData(const Date &date, std::vector< StationData > &vecStation)
Fill vecStation with StationData objects for a certain date of interest.
Definition: MySQLIO.cc:243
virtual void readMeteoData(const Date &dateStart, const Date &dateEnd, std::vector< std::vector< MeteoData > > &vecMeteo)
Fill vecMeteo with a time series of objects corresponding to the interval indicated by dateStart and ...
Definition: MySQLIO.cc:251
MYSQLIO(const std::string &configfile)
Definition: MySQLIO.cc:133
Definition: Config.cc:31