DISPLACE  1.0
A spatial model of fisheries to help sustainable fishing and maritime spatial planning
nodesdeftable.h
Go to the documentation of this file.
1 #ifndef POPNODESTABLE_H
2 #define POPNODESTABLE_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 class Harbour;
19 
20 class COMMONSSHARED_EXPORT NodesDefTable : public SQLiteTable
21 {
22 private:
23  struct Impl;
24  std::unique_ptr<Impl> p;
25 
26  const FieldDef<FieldType::Integer> fldNodeId = makeFieldDef("NodeId",FieldType::Integer()).primaryKey();
27  const FieldDef<FieldType::Integer> fldHarbourId = makeFieldDef("HarbourId",FieldType::Integer());
28  const FieldDef<FieldType::Text> fldNodeName = makeFieldDef("NodeName",FieldType::Text());
29  const FieldDef<FieldType::Real> fldLong = makeFieldDef("Long",FieldType::Real()).notNull();
30  const FieldDef<FieldType::Real> fldLat = makeFieldDef("Lat",FieldType::Real()).notNull();
31  const FieldDef<FieldType::Integer> marineLandscape = makeFieldDef("marineLandscape",FieldType::Integer()).notNull();
32  const FieldDef<FieldType::Real> bathymetry = makeFieldDef("bathymetry",FieldType::Real()).notNull();
33  const FieldDef<FieldType::Real> shippingdensity = makeFieldDef("shippingdensity",FieldType::Real()).notNull();
34  const FieldDef<FieldType::Real> siltfraction = makeFieldDef("siltfraction",FieldType::Real()).notNull();
35 public:
36  NodesDefTable(std::shared_ptr<sqlite::SQLiteStorage> db, std::string name);
37  ~NodesDefTable() noexcept;
38 
39  void dropAndCreate();
40 
41  void insert(Node* node);
42  void queryAllNodes(std::function<void (std::shared_ptr<Node>, std::shared_ptr<Harbour>)> operation);
43 };
44 
45 #endif // POPNODESTABLE_H
Definition: Harbour.h:36
Definition: Node.h:39
Definition: sqliteoutputstorage.h:33
Definition: nodesdeftable.cpp:10
Definition: nodesdeftable.h:20
#define COMMONSSHARED_EXPORT
Definition: commons_global.h:23