clsInterpolationWeightData.h
Go to the documentation of this file.
1/*!
2 * \file clsInterpolationWeightData.h
3 * \brief Methods for clsITPWeightData class
4 * \author Junzhi Liu, LiangJun Zhu
5 * \version 2.1
6 * \date Aug, 2022
7 */
8#ifndef SEIMS_ITP_WEIGHTDATA_H
9#define SEIMS_ITP_WEIGHTDATA_H
10#include "basic.h"
11#include "db_mongoc.h"
12
13#include <seims.h>
14
15using namespace ccgl;
16using namespace db_mongoc;
17
18/*!
19 * \ingroup data
20 * \class ItpWeightData
21 *
22 * \brief Read weight data of each observe stations from database
23 */
25public:
26 /*!
27 * \brief Overload constructor
28 *
29 * \param[in] gfs MongoGridFs
30 * \param[in] filename file name
31 */
32 ItpWeightData(MongoGridFs* gfs, const string& filename);
33
34 //! Destructor
36
37 /*!
38 * \brief Get the weight data read from mongoDB in form of 2DArray
39 *
40 * \param[out] n Rows
41 * \param[out] n_stations Cols
42 * \param[out] data data
43 */
44 void GetWeightData2D(int* n, int* n_stations, FLTPT*** data);
45 // xdw modify, to support multi-stations itp weight data, we have to get the length of itp weight data array so that initialize it
46 void GetWeightData(int* n, FLTPT** data, int *itp_weight_data_length);
47 /*!
48 * \brief Output the weight data to \a ostream
49 */
50 void Dump(std::ostream* fs);
51
52 /*!
53 * \brief Output the weight data to file
54 * \param[in] filename file name
55 * \sa Dump(std::ostream *fs)
56 */
57 void Dump(const string& filename);
58
59 //! Initialized successful?
60 bool Initialized() { return initialized_; }
61
62private:
63 /*!
64 * \brief Read GridFS from MongoDB
65 * \param[in] gfs MongoGridFs
66 * \param[in] filename file name
67 */
68 bool ReadFromMongoDB(MongoGridFs* gfs, const string& filename);
69
70private:
71 //! file name
72 string filename_;
73 //! interpolation weight data array
74 FLTPT* itp_weight_data_;
75 //! interpolation weight data array (2DArray)
76 FLTPT** itp_weight_data2d_;
77 //! row of weight data
78 int n_rows_;
79 //! column of weight data, i.e., number of stations
80 int n_cols_;
81 //! load data success?
82 bool initialized_;
83};
84#endif /* SEIMS_ITP_WEIGHTDATA_H */
Basic definitions.
Base type of all interfaces.
Definition: basic.h:407
A simple wrapper of the class of MongoDB database mongoc_gridfs_t.
Definition: db_mongoc.h:141
Simple wrappers of the API of MongoDB C driver mongo-c-driver, see MongoDB C Driver for more informat...
bool Initialized()
Initialized successful?
Definition: clsInterpolationWeightData.h:60
ItpWeightData(MongoGridFs *gfs, const string &filename)
Overload constructor.
void Dump(std::ostream *fs)
Output the weight data to ostream.
void Dump(const string &filename)
Output the weight data to file.
void GetWeightData2D(int *n, int *n_stations, FLTPT ***data)
Get the weight data read from mongoDB in form of 2DArray.
~ItpWeightData()
Destructor.
Read weight data of each observe stations from database.
Definition: clsInterpolationWeightData.h:24
Common Cross-platform Geographic Library (CCGL)
The SEIMS related definitions and utilities header.