BMPPlantMgtFactory.h
Go to the documentation of this file.
1/*!
2 * \file BMPPlantMgtFactory.h
3 * \brief Plant management operations factory
4 * \author Liang-Jun Zhu
5 * \date June 2016
6 */
7#ifndef SEIMS_BMP_PLANTMGT_H
8#define SEIMS_BMP_PLANTMGT_H
9
10#include "BMPFactory.h"
12
13#include <set>
14
15using namespace bmps;
16using namespace plant_management;
17using std::set;
18
19namespace bmps {
20/*!
21 * \class bmps::BMPPlantMgtFactory
22 * \brief Initiate a plant management BMP
23 * Actually, it contains a series BMPs, such as plant, fertilize, harvest, etc.
24 *
25 */
27public:
28 /// Constructor
29 BMPPlantMgtFactory(int scenarioId, int bmpId, int subScenario,
30 int bmpType, int bmpPriority, vector<string>& distribution,
31 const string& collection, const string& location);
32
33 /// Destructor
35
36 /// Load BMP parameters from MongoDB
37 void loadBMP(MongoClient* conn, const string& bmpDBName) OVERRIDE;
38
39 /// Output
40 void Dump(ostream* fs) OVERRIDE;
41
42 /// Set management fields data
43 void setRasterData(map<string, IntRaster *>& sceneRsMap) OVERRIDE;
44
45 /// Get management fields data
47
48 /// Get landuse / landcover ID
49 int GetLUCCID();
50
51 /// Get locations
52 set<int>& GetLocations();
53
54 /// Get operation sequence
55 vector<int>& GetOperationSequence();
56
57 /// Get operations
58 map<int, PltMgtOp *>& GetOperations();
59
60 /// Get operation by ID
61 PltMgtOp* GetOperation(const int ID);
62
63private:
64 /// subSecenario name
65 string m_name;
66 /// management fields name, defined in 'distribution'
67 string m_mgtFieldsName;
68 /// management fields data (1D array raster)
69 int* m_mgtFieldsRs;
70 /// landuse / landcover
71 int m_luccID;
72 /// parameters
73 FLTPT* m_parameters;
74 /// field index for where to apply the subScenario. Using set instead of vector to accelerate find().
75 set<int> m_location;
76 /*!
77 * The first element is the sequence number of plant management operations
78 * and the second is the corresponding unique management code, i.e., index * 1000 + operationCode
79 * m_bmpSequence[0] = 1002 means the first (1001 / 1000 = 1) operation is Irrigation (1002 % 1000 = 2)
80 */
81 vector<int> m_bmpSequence;
82 /*!
83 * Key is the unique management code in m_bmpSequence, e.g., 1002
84 * Value is the corresponding PlantMangementOperation instance
85 */
86 map<int, PltMgtOp *> m_bmpPlantOps;
87};
88}
89#endif /* SEIMS_BMP_PLANTMGT_H */
Base namespace for implementation of BMP configuration.
Plant management operation class.
#define OVERRIDE
A compatible reference to override or blank if not supported by the compiler.
Definition: basic.h:160
Base class of all kind of BMPs Factory.
Definition: BMPFactory.h:33
int bmpType()
Get BMP type 1 - reach BMPs which are attached to specific reaches and will change the character of t...
int bmpPriority()
Get BMP priority.
Initiate a plant management BMP Actually, it contains a series BMPs, such as plant,...
Definition: BMPPlantMgtFactory.h:26
map< int, PltMgtOp * > & GetOperations()
Get operations.
int GetLUCCID()
Get landuse / landcover ID.
set< int > & GetLocations()
Get locations.
void Dump(ostream *fs) OVERRIDE
Output.
PltMgtOp * GetOperation(const int ID)
Get operation by ID.
vector< int > & GetOperationSequence()
Get operation sequence.
~BMPPlantMgtFactory()
Destructor.
int * GetRasterData() OVERRIDE
Get management fields data.
BMPPlantMgtFactory(int scenarioId, int bmpId, int subScenario, int bmpType, int bmpPriority, vector< string > &distribution, const string &collection, const string &location)
Constructor.
void loadBMP(MongoClient *conn, const string &bmpDBName) OVERRIDE
Load BMP parameters from MongoDB.
void setRasterData(map< string, IntRaster * > &sceneRsMap) OVERRIDE
Set management fields data.
Base class of plant management operation.
Definition: PlantManagementOperation.h:27
A simple wrapper of the class of MongoDB Client mongoc_client_t.
Definition: db_mongoc.h:46
All BMPs scenario related data, classes, and functions.
Definition: BMPArealSourceFactory.h:22