Measurement.h
Go to the documentation of this file.
1/*!
2 * \file Measurement.h
3 * \brief Measurement class to store HydroClimate site data
4 *
5 * Changelog:
6 * - 1. 2016-05-30 - lj - Replace mongoc_client_t by MongoClient interface.
7 * - 2. 2022-08-18 - lj - Change float to FLTPT.
8 *
9 * \author Junzhi Liu, LiangJun Zhu
10 * \version 2.1
11 */
12#ifndef SEIMS_MEASUREMENT_H
13#define SEIMS_MEASUREMENT_H
14
15#include <seims.h>
16
17#include "db_mongoc.h"
18
19using namespace ccgl;
20using namespace db_mongoc;
21
22/*!
23 * \ingroup data
24 * \class Measurement
25 * \brief Get HydroClimate measurement data from MongoDB
26 */
28public:
29 /*!
30 * \brief Initialize Measurement instance from MongoDB
31 *
32 * \param[in] conn \a MongoClient, MongoDB client
33 * \param[in] hydroDBName \a string, HydroClimate database name
34 * \param[in] sitesList \a string, sites list
35 * \param[in] siteType \a string, sites type
36 * \param[in] startTime \a time_t, start date time
37 * \param[in] endTime \a time_t, end date time
38 */
39 Measurement(MongoClient* conn, const string& hydroDBName, const string& sitesList, const string& siteType,
40 time_t startTime, time_t endTime);
41
42 //! Destructor
44
45 //! Get site data by time
46 virtual FLTPT* GetSiteDataByTime(time_t t) = 0;
47
48 //! Get Number of site
49 int NumberOfSites() const { return CVT_INT(m_siteIDList.size()); }
50
51 //! Get HydroClimate site type, "M" or "P"
52 string Type() const { return m_type; }
53
54 //! start time
55 time_t StartTime() const { return m_startTime; }
56
57 //! end time
58 time_t EndTime() const { return m_endTime; }
59
60protected:
61 //! MongoDB client object
63 //! HydroClimate database name
65 //! Site IDs list
66 vector<int> m_siteIDList;
67 //! Site type, M means meteorology, and P means precipitation
68 string m_type;
69 //! Start time
71 //! End time
72 time_t m_endTime;
73 //! Measurement data of all sites in given date
74 FLTPT* pData;
75};
76#endif /* SEIMS_MEASUREMENT_H */
#define CVT_INT(param)
A reference to the postfix of executable file for RELWITHDEBINFO mode.
Definition: basic.h:325
Base type of all interfaces.
Definition: basic.h:407
A simple wrapper of the class of MongoDB Client mongoc_client_t.
Definition: db_mongoc.h:46
Simple wrappers of the API of MongoDB C driver mongo-c-driver, see MongoDB C Driver for more informat...
int NumberOfSites() const
Get Number of site.
Definition: Measurement.h:49
Measurement(MongoClient *conn, const string &hydroDBName, const string &sitesList, const string &siteType, time_t startTime, time_t endTime)
Initialize Measurement instance from MongoDB.
time_t m_endTime
End time.
Definition: Measurement.h:72
time_t m_startTime
Start time.
Definition: Measurement.h:70
FLTPT * pData
Measurement data of all sites in given date.
Definition: Measurement.h:74
string Type() const
Get HydroClimate site type, "M" or "P".
Definition: Measurement.h:52
string m_hydroDBName
HydroClimate database name.
Definition: Measurement.h:64
MongoClient * m_conn
MongoDB client object.
Definition: Measurement.h:62
time_t StartTime() const
start time
Definition: Measurement.h:55
virtual FLTPT * GetSiteDataByTime(time_t t)=0
Get site data by time.
~Measurement()
Destructor.
time_t EndTime() const
end time
Definition: Measurement.h:58
vector< int > m_siteIDList
Site IDs list.
Definition: Measurement.h:66
string m_type
Site type, M means meteorology, and P means precipitation.
Definition: Measurement.h:68
Get HydroClimate measurement data from MongoDB.
Definition: Measurement.h:27
Common Cross-platform Geographic Library (CCGL)
The SEIMS related definitions and utilities header.