BMPFactory.h
Go to the documentation of this file.
1/*!
2 * \file BMPFactory.h
3 * \brief Base namespace for implementation of BMP configuration
4 *
5 * Changelog:
6 * - 1. 2018-04-12 - lj - Code reformat.
7 *
8 * \author Liangjun Zhu
9 */
10#ifndef SEIMS_BMP_FACTORY_H
11#define SEIMS_BMP_FACTORY_H
12
13#include "db_mongoc.h"
14#include "data_raster.hpp"
15
16#include "seims.h"
17
18using namespace ccgl;
19using namespace db_mongoc;
20using namespace data_raster;
21
22/*!
23 * \namespace bmps
24 * \brief All BMPs scenario related data, classes, and functions.
25 * \ingroup bmps
26 */
27namespace bmps {
28/*!
29 * \class bmps::BMPFactory
30 * \brief Base class of all kind of BMPs Factory.
31 * Read from BMP_SCENARIOS collection of MongoDB
32 */
34public:
35 /// Constructor
36 BMPFactory(int scenario_id, int bmp_id, int sub_scenario, int bmp_type,
37 int bmp_priority, vector<string>& distribution, const string& collection,
38 const string& location, bool effectivenessChangeable = false,
39 time_t changeFrequency = -1, int variableTimes = -1);
40
41 /// Destructor
43
44 /// Load BMP parameters from MongoDB
45 virtual void loadBMP(MongoClient* conn, const string& bmpDBName) = 0;
46
47 /*!
48 * \brief Set raster data if needed
49 * This function is not required for each BMP, so DO NOT define as pure virtual function.
50 * i.e., DO NOT CHANGE THE DEFINITION!!!
51 */
52 virtual void setRasterData(map<string, IntRaster *>& sceneRsMap);
53
54 /*!
55 * \brief Get raster data if needed
56 * This function is not required for each BMP, so DO NOT define as pure virtual function.
57 */
58 virtual int* GetRasterData();
59
60 /*! Get BMP type
61 1 - reach BMPs which are attached to specific reaches and will change the character of the reach.
62 2 - areal structural BMPs which are corresponding to a specific structure in the watershed and will change the character of subbasins/cells.
63 3 - areal non-structure BMPs which are NOT corresponding to a specific structure in the watershed and will change the character of subbasins/cells.
64 4 - point structural BMPs
65 */
66 int bmpType();
67
68 /// Get BMP priority
70
71 /// Get subScenario ID
73
74 /// Output
75 virtual void Dump(std::ostream* fs) = 0;
76
77 bool IsEffectivenessChangeable();
78
79 time_t GetChangeFrequency();
80
81 int GetChangeTimes();
82
83protected:
84 const int m_scenarioId; ///< Scenario ID
85 const int m_bmpId; ///< BMP ID
86 const int m_subScenarioId; ///< SubScenario ID within one BMP iD
87 const int m_bmpType; ///< BMP Type
88 const int m_bmpPriority; ///< BMP Priority
89 /*! Distribution vector of BMP
90 * Origin format is [distribution data type]|[distribution parameter name]|Collection name|...
91 */
92 vector<string> m_distribution;
93 const string m_bmpCollection; ///< Collection name
94 const string m_location; ///< Define where the BMP will be applied
95 const bool m_effectivenessChangeable;
96 const time_t m_changeFrequency;
97 const int m_changeTimes;
98};
99}
100#endif /* SEIMS_BMP_FACTORY_H */
Base class of all kind of BMPs Factory.
Definition: BMPFactory.h:33
virtual void Dump(std::ostream *fs)=0
Output.
const int m_bmpType
BMP Type.
Definition: BMPFactory.h:87
const string m_bmpCollection
Collection name.
Definition: BMPFactory.h:93
const int m_subScenarioId
SubScenario ID within one BMP iD.
Definition: BMPFactory.h:86
int bmpType()
Get BMP type 1 - reach BMPs which are attached to specific reaches and will change the character of t...
const string m_location
Define where the BMP will be applied.
Definition: BMPFactory.h:94
BMPFactory(int scenario_id, int bmp_id, int sub_scenario, int bmp_type, int bmp_priority, vector< string > &distribution, const string &collection, const string &location, bool effectivenessChangeable=false, time_t changeFrequency=-1, int variableTimes=-1)
Constructor.
const int m_bmpPriority
BMP Priority.
Definition: BMPFactory.h:88
~BMPFactory()
Destructor.
vector< string > m_distribution
Distribution vector of BMP Origin format is [distribution data type]|[distribution parameter name]|Co...
Definition: BMPFactory.h:92
virtual void setRasterData(map< string, IntRaster * > &sceneRsMap)
Set raster data if needed This function is not required for each BMP, so DO NOT define as pure virtua...
int GetSubScenarioId()
Get subScenario ID.
virtual int * GetRasterData()
Get raster data if needed This function is not required for each BMP, so DO NOT define as pure virtua...
const int m_bmpId
BMP ID.
Definition: BMPFactory.h:85
const int m_scenarioId
Scenario ID.
Definition: BMPFactory.h:84
int bmpPriority()
Get BMP priority.
virtual void loadBMP(MongoClient *conn, const string &bmpDBName)=0
Load BMP parameters from MongoDB.
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...
All BMPs scenario related data, classes, and functions.
Definition: BMPArealSourceFactory.h:22
Common Cross-platform Geographic Library (CCGL)
The SEIMS related definitions and utilities header.