-
Notifications
You must be signed in to change notification settings - Fork 0
/
diRoaddata.h
executable file
·114 lines (92 loc) · 3.38 KB
/
diRoaddata.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
/*
Kvalobs - Free Quality Control Software for Meteorological Observations
$Id: kvParam.h,v 1.1.2.2 2007/09/27 09:02:30 paule Exp $
Copyright (C) 2009 smhi.se
Contact information:
Norwegian Meteorological Institute
Box 43 Blindern
0313 OSLO
NORWAY
email: kvalobs-dev@met.no
This file is part of KVALOBS
KVALOBS is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
KVALOBS is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License along
with KVALOBS; if not, write to the Free Software Foundation Inc.,
51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef diRoaddata_h
#define diRoaddata_h
#include <vector>
#include <map>
#include <string>
#include <puTools/miTime.h>
#include <puTools/miStringFunctions.h>
#include "diStation.h"
#include "diParam.h"
#include "diRoaddatathread.h"
#include "rdkESQLTypes.h"
// the class definition here...
using namespace std;
using namespace miutil;
//using namespace pgpool;
namespace road {
/**
* \addtogroup dbinterface
*
* @{
*/
/**
* \brief Interface for getting data from the road database..
*/
class Roaddata {
private:
static string host;
static string port;
static string dbname;
static string user;
static string passwd;
static std::string connect_str;
string databasefile_;
string stationfile_;
string parameterfile_;
miTime obstime_;
vector<diStation> * stations;
vector <diParam> * params;
std::set<int> * roadparams;
public:
static bool initDone;
static int initRoaddata(const string &databasefile);
// getStationList must be called after initRoaddata has been done, if not, there will be no connect information.
// Maybe this should be fixed in the future ?
static int getStationList(string & inquery, vector <diStation> * & stations, const string &station_type);
//static DbConnectionPoolPtr thePool;
// this map maps an obstime to a map from wmo no to a data string.
// the second map contains data strings only if there are rows returned
// from road.
// We must map to stationfile also for ground observations and in the future also aerosond data
static map<std::string, map<miTime, map<int, string > > > road_data_cache;
// depricated
static map<miTime, map<int, string > > road_cache;
// The cache for aerosond data
static map<std::string, map<miTime, map<int, vector<RDKCOMBINEDROW_2 > > > > road_data_multi_cache;
static map<miTime, map<int, vector<RDKCOMBINEDROW_2 > > > road_multi_cache;
//default constructor
Roaddata() {}
// the constructor, it inits the databasesetting, includeing login and password
Roaddata(const string &databasefile, const string &stationfile, const string ¶meterfile, const miTime &obstime);
~Roaddata();
int open();
int getData(const vector<int> & index_stations_to_plot, map<int, string> & lines);
int getData(const vector<diStation> & stations_to_plot, map<int, vector<RDKCOMBINEDROW_2 > > & raw_data_map);
int initData(const vector<string> & parameternames, map<int, string> & lines);
int close();
};
}
#endif