DISPLACE  1.0
A spatial model of fisheries to help sustainable fishing and maritime spatial planning
funcgroupstable.h
Go to the documentation of this file.
1 #ifndef FUNCGROUPSTABLE_H
2 #define FUNCGROUPSTABLE_H
3 
4 #include "commons_global.h"
5 #include "idtypes.h"
6 
7 #include <functional>
8 
9 #include "sqlitefielddef.h"
10 #include "sqlitetable.h"
11 using namespace sqlite;
12 
13 #include <vector>
14 #include <string>
15 #include <map>
16 
17 class Node;
18 
19 class COMMONSSHARED_EXPORT FuncGroupsTable : public SQLiteTable
20 {
21 private:
22  struct Impl;
23  std::unique_ptr<Impl> p;
24 public:
25  const FieldDef<FieldType::Integer> fldTStep = makeFieldDef("TStep",FieldType::Integer()).notNull();
26  const FieldDef<FieldType::Integer> fldFGroup = makeFieldDef("FuncGroup",FieldType::Integer()).notNull();
27  const FieldDef<FieldType::Integer> fldNodeId = makeFieldDef("NodeId",FieldType::Integer()).notNull();
28  const FieldDef<FieldType::Integer> fldBType = makeFieldDef("BenthosType",FieldType::Integer()).notNull();
29 
30  const FieldDef<FieldType::Real> benthosNumTot = makeFieldDef("bNTot",FieldType::Real());
31  const FieldDef<FieldType::Real> benthosBio = makeFieldDef("bB",FieldType::Real());
32  const FieldDef<FieldType::Real> benthosMeanW = makeFieldDef("bMeanW",FieldType::Real());
33  const FieldDef<FieldType::Real> benthosBioK = makeFieldDef("bBK",FieldType::Real());
34  const FieldDef<FieldType::Real> benthosNumK= makeFieldDef("bNK",FieldType::Real());
35 
36  FuncGroupsTable(std::shared_ptr<sqlite::SQLiteStorage> db, std::string name);
37  ~FuncGroupsTable() noexcept;
38 
39  void create();
40  void dropAndCreate();
41  void insert (int tstep, Node *node, int funcgr, int isN);
42 
43  struct Stat {
44  int tstep;
46  int funcId;
47 
48  double numTot, bio, bioMeanW, bioK, numK;
49  };
50  void queryAllNodesAtStep(int tstep, std::function<bool (Stat)> op);
51 };
52 
53 #endif // FUNCGROUPSTABLE_H
Definition: funcgroupstable.h:19
Definition: Node.h:39
Definition: funcgroupstable.cpp:10
Definition: sqliteoutputstorage.h:33
Definition: idtypes.h:52
int tstep
Definition: main.cpp:205
types::NodeId nodeId
Definition: funcgroupstable.h:45
double numTot
Definition: funcgroupstable.h:48
Definition: funcgroupstable.h:43
int funcId
Definition: funcgroupstable.h:46
int tstep
Definition: funcgroupstable.h:44
#define COMMONSSHARED_EXPORT
Definition: commons_global.h:23