DISPLACE  1.0
A spatial model of fisheries to help sustainable fishing and maritime spatial planning
vesseldeftable.h
Go to the documentation of this file.
1 #ifndef VESSELDEFTABLE_H
2 #define VESSELDEFTABLE_H
3 
4 #include "commons_global.h"
5 
6 #include "idtypes.h"
7 
8 #include <functional>
9 
10 #include "sqlitefielddef.h"
11 #include "sqlitetable.h"
12 using namespace sqlite;
13 
14 #include <vector>
15 #include <string>
16 
17 class Vessel;
18 class Node;
19 
20 class COMMONSSHARED_EXPORT VesselDefTable : public sqlite::SQLiteTable
21 {
22  struct Impl;
23  std::unique_ptr<Impl> p;
24 
25 public:
26  const FieldDef<FieldType::Integer> fldId = makeFieldDef("VesselId", FieldType::Integer()).primaryKey();
27  const FieldDef<FieldType::Integer> fldNode = makeFieldDef("VesselInitialNodeId", FieldType::Integer()).notNull();
28  const FieldDef<FieldType::Text> fldName = makeFieldDef("VesselName",FieldType::Text()).unique().notNull();
29  const FieldDef<FieldType::Text> fldNationality = makeFieldDef("Nationality",FieldType::Text());
30  const FieldDef<FieldType::Real> fldSpeeds = makeFieldDef("IdSpeeds",FieldType::Real());
31  const FieldDef<FieldType::Real> fldFuelcons = makeFieldDef("Fuelcons",FieldType::Real());
32  const FieldDef<FieldType::Real> fldLengths = makeFieldDef("Lengths",FieldType::Real());
33  const FieldDef<FieldType::Real> fldVKWs = makeFieldDef("VKWs",FieldType::Real());
34  const FieldDef<FieldType::Real> fldCarrycapacities = makeFieldDef("Carrycapacities",FieldType::Real());
35  const FieldDef<FieldType::Real> fldTankcapacities = makeFieldDef("Tankcapacities",FieldType::Real());
36  const FieldDef<FieldType::Real> fldNbfpingspertrips = makeFieldDef("Nbfpingspertrips",FieldType::Real());
37  const FieldDef<FieldType::Real> fldResttime_par1s = makeFieldDef("Resttime_par1s",FieldType::Real());
38  const FieldDef<FieldType::Real> fldResttime_par2s = makeFieldDef("Resttime_par2s",FieldType::Real());
39  const FieldDef<FieldType::Real> fldAv_trip_duration = makeFieldDef("Av_trip_duration",FieldType::Real());
40  const FieldDef<FieldType::Real> fldMult_fuelcons_when_steaming = makeFieldDef("Mult_fuelcons_when_steaming",FieldType::Real());
41  const FieldDef<FieldType::Real> fldMult_fuelcons_when_fishing = makeFieldDef("Mult_fuelcons_when_fishing",FieldType::Real());
42  const FieldDef<FieldType::Real> fldMult_fuelcons_when_returning = makeFieldDef("Mult_fuelcons_when_returning",FieldType::Real());
43  const FieldDef<FieldType::Real> fldMult_fuelcons_when_inactive = makeFieldDef("Mult_fuelcons_when_inactive",FieldType::Real());
44  const FieldDef<FieldType::Integer> fldFirm_ids = makeFieldDef("Firm",FieldType::Integer());
45 
46  VesselDefTable(std::shared_ptr<sqlite::SQLiteStorage> db, std::string name);
47  ~VesselDefTable() noexcept;
48  void dropAndCreate();
49 
50  void feedVesselsDefTable(Vessel *vessel); // TODO fill all the rest
51 
52  std::vector<std::string> getNationsList();
53 
61  void queryAllVessels(
62  std::function<Node *(int id)> getnode,
63  std::function<bool(std::shared_ptr<Vessel>)> op);
64 
65  void createIndex();
66 protected:
67 };
68 
69 #endif // VESSELDEFTABLE_H
Definition: Node.h:39
Definition: sqliteoutputstorage.h:33
Definition: pathshop.cpp:8
Definition: vesseldeftable.cpp:15
Definition: vesseldeftable.h:20
Definition: Vessel.h:51
#define COMMONSSHARED_EXPORT
Definition: commons_global.h:23