DISPLACE  1.0
A spatial model of fisheries to help sustainable fishing and maritime spatial planning
vesselslogliketable.h
Go to the documentation of this file.
1 #ifndef VESSELSLOGLIKETABLE_H
2 #define VESSELSLOGLIKETABLE_H
3 
4 #include "commons_global.h"
5 #include "idtypes.h"
6 
7 #include "sqlitefielddef.h"
8 #include "sqlitetable.h"
9 using namespace sqlite;
10 
11 #include <vector>
12 #include <string>
13 
14 class COMMONSSHARED_EXPORT VesselsLoglikeTable : public SQLiteTable
15 {
16 private:
17  struct Impl;
18  std::unique_ptr<Impl> p;
19 
20 public:
21  const FieldDef<FieldType::Integer> fldRowId = makeFieldDef("RowId", FieldType::Integer()).primaryKey();
22  const FieldDef<FieldType::Integer> fldId = makeFieldDef("Id", FieldType::Integer()).notNull();
23  const FieldDef<FieldType::Integer> fldTStep = makeFieldDef("TStep",FieldType::Integer()).notNull();
24  const FieldDef<FieldType::Integer> fldTStepDep = makeFieldDef("TStepDep",FieldType::Integer()).notNull();
25  const FieldDef<FieldType::Integer> fldNodeId = makeFieldDef("NodeId",FieldType::Integer()).notNull();
26 
27  const FieldDef<FieldType::Integer> fldMetierId = makeFieldDef("metierId",FieldType::Integer()).notNull();
28  const FieldDef<FieldType::Integer> fldLastHarbour = makeFieldDef("lastHarbour",FieldType::Integer()).notNull();
29 
30  const FieldDef<FieldType::Real> fldRevenueAV = makeFieldDef("revenueAV",FieldType::Real()).notNull();
31  const FieldDef<FieldType::Real> revenueExAV = makeFieldDef("revenueExAV",FieldType::Real()).notNull();
32  const FieldDef<FieldType::Real> timeAtSea = makeFieldDef("timeAtSea",FieldType::Real()).notNull();
33 
34  const FieldDef<FieldType::Integer> reasonToGoBack = makeFieldDef("reasonToGoBack",FieldType::Integer()).notNull();
35 
36  const FieldDef<FieldType::Real> cumFuelCons = makeFieldDef("cumFuelCons",FieldType::Real()).notNull();
37  const FieldDef<FieldType::Real> vpuf = makeFieldDef("vpuf",FieldType::Real()).notNull();
38  const FieldDef<FieldType::Real> fuelCost = makeFieldDef("fuelCost",FieldType::Real()).notNull();
39  const FieldDef<FieldType::Real> gav = makeFieldDef("gav",FieldType::Real()).notNull();
40  const FieldDef<FieldType::Real> sweptArea = makeFieldDef("sweptArea",FieldType::Real()).notNull();
41  const FieldDef<FieldType::Real> revenuePerSweptArea = makeFieldDef("revenuePerSweptArea",FieldType::Real()).notNull();
42 
43  const FieldDef<FieldType::Real> GVA = makeFieldDef("GVA",FieldType::Real()).notNull();
44  const FieldDef<FieldType::Real> GVAPerRevenue = makeFieldDef("GVAPerRevenue",FieldType::Real()).notNull();
45  const FieldDef<FieldType::Real> LabourSurplus = makeFieldDef("LabourSurplus",FieldType::Real()).notNull();
46  const FieldDef<FieldType::Real> GrossProfit = makeFieldDef("GrossProfit",FieldType::Real()).notNull();
47  const FieldDef<FieldType::Real> NetProfit = makeFieldDef("NetProfit",FieldType::Real()).notNull();
48  const FieldDef<FieldType::Real> NetProfitMargin = makeFieldDef("NetProfitMargin",FieldType::Real()).notNull();
49  const FieldDef<FieldType::Real> RoFTA = makeFieldDef("RoFTA",FieldType::Real()).notNull();
50  const FieldDef<FieldType::Real> GVAPerFTE = makeFieldDef("GVAPerFTE",FieldType::Real()).notNull();
51  const FieldDef<FieldType::Real> BER = makeFieldDef("BER",FieldType::Real()).notNull();
52  const FieldDef<FieldType::Real> CRBER = makeFieldDef("CRBER",FieldType::Real()).notNull();
53  const FieldDef<FieldType::Real> NetPresentValue = makeFieldDef("NetPresentValue",FieldType::Real()).notNull();
54 
55  const FieldDef<FieldType::Integer> numTrips = makeFieldDef("numTrips",FieldType::Integer()).notNull();
56 
57  VesselsLoglikeTable(std::shared_ptr<sqlite::SQLiteStorage> db, std::string name);
58  ~VesselsLoglikeTable() noexcept;
59 
60  void dropAndCreate();
61 
62  struct Log {
63  int id;
66  int metierId = -1;
67  int lastHarbour = -1;
68  double revenueAV = 0;
69  double revenueExAV = 0;
70  double timeAtSea = 0;
71  int reasonToGoBack = 0;
72  double cumFuelCons = 0;
73  double vpuf = 0;
74  double fuelCost = 0;
75  double gav = 0;
76  double sweptArea = 0;
77  double revenuePerSweptArea = 0;
78  double GVA = 0;
79  double GVAPerRevenue = 0;
80  double LabourSurplus = 0;
81  double GrossProfit = 0;
82  double NetProfit = 0;
83  double NetProfitMargin = 0;
84  double RoFTA = 0;
85  double GVAPerFTE = 0;
86  double BER = 0;
87  double CRBER = 0;
88  double NetPresentValue = 0;
89  int numTrips=0;
90  };
91 
92  size_t insertLog(const Log &log);
93 };
94 
95 #endif // VESSELSLOGLIKETABLE_H
int tstepdep
Definition: vesselslogliketable.h:64
Definition: vesselslogliketable.h:62
Definition: sqliteoutputstorage.h:33
Definition: idtypes.h:52
int tstep
Definition: main.cpp:205
types::NodeId node_id
Definition: vesselslogliketable.h:65
int id
Definition: vesselslogliketable.h:63
Definition: vesselslogliketable.h:14
Definition: vesselslogliketable.cpp:4
#define COMMONSSHARED_EXPORT
Definition: commons_global.h:23