boat
C++23 geospatial library
Loading...
Searching...
No Matches
meta.hpp
Go to the documentation of this file.
1// Andrew Naplavkov
2
3#ifndef BOAT_DB_META_HPP
4#define BOAT_DB_META_HPP
5
6#include <cstdint>
7#include <ranges>
8#include <string>
9#include <vector>
10
11namespace boat::db {
12
13struct source {
14 std::string source_name;
15 std::string address;
16};
17
18struct layer {
19 std::string schema_name;
20 std::string table_name;
21 std::string column_name;
22 bool raster;
23
24 friend bool operator==(layer const&, layer const&) = default;
25};
26
27struct column {
28 std::string kind;
29 std::string column_name;
30 std::string type_name;
31 int length;
32 int srid;
33 int epsg;
34 std::string wkt;
35 std::string proj4;
36
37 bool has_coord_sys() const
38 {
39 return epsg > 0 || !wkt.empty() || !proj4.empty();
40 }
41};
42
43struct index_key {
44 std::string schema_name;
45 std::string index_name;
46 std::string column_name;
48 bool partial;
49 bool primary;
50 bool unique;
51 int ordinal;
52};
53
54struct table {
55 std::string dbms;
56 std::string schema_name;
57 std::string table_name;
58 std::vector<column> columns;
59 std::vector<index_key> index_keys;
60
61 auto indices() const
62 {
63 return index_keys | std::views::chunk_by([](auto& lhs, auto& rhs) {
64 return lhs.ordinal < rhs.ordinal;
65 });
66 }
67};
68
70struct bbox {
71 std::vector<std::string> select_list;
72 std::string layer_column;
73 double xmin;
74 double ymin;
75 double xmax;
76 double ymax;
77 int limit;
78};
79
80struct order_key {
81 std::string column_name;
83};
84
86struct page {
87 std::vector<std::string> select_list;
88 std::vector<order_key> order_by;
89 size_t offset;
90 int limit;
91};
92
93struct band {
94 std::string color_name;
95 std::string type_name;
96};
97
98struct raster {
99 std::string schema_name;
100 std::string table_name;
101 std::string column_name;
102 std::vector<band> bands;
103 int width;
105 double xorig;
106 double yorig;
107 double xscale;
108 double yscale;
109 double xskew;
110 double yskew;
111 int srid;
112 int epsg;
113 std::string wkt;
114 std::string proj4;
115};
116
117struct rect {
118 int x;
119 int y;
120 int width;
122};
123
124} // namespace boat::db
125
126#endif // BOAT_DB_META_HPP
Definition geometry.hpp:9
Definition meta.hpp:93
std::string color_name
lower case
Definition meta.hpp:94
std::string type_name
lower case
Definition meta.hpp:95
Spatial filter for row selection.
Definition meta.hpp:70
double xmin
Definition meta.hpp:73
double ymax
Definition meta.hpp:76
double ymin
Definition meta.hpp:74
int limit
Definition meta.hpp:77
std::string layer_column
Definition meta.hpp:72
std::vector< std::string > select_list
Definition meta.hpp:71
double xmax
Definition meta.hpp:75
Definition meta.hpp:27
std::string kind
Definition meta.hpp:28
std::string proj4
Definition meta.hpp:35
int srid
Definition meta.hpp:32
std::string wkt
Definition meta.hpp:34
std::string type_name
lower case
Definition meta.hpp:30
int length
Definition meta.hpp:31
std::string column_name
Definition meta.hpp:29
int epsg
Definition meta.hpp:33
bool has_coord_sys() const
Definition meta.hpp:37
Definition meta.hpp:43
int ordinal
one-based
Definition meta.hpp:51
bool partial
Definition meta.hpp:48
bool primary
Definition meta.hpp:49
std::string column_name
Definition meta.hpp:46
std::string index_name
Definition meta.hpp:45
bool descending
Definition meta.hpp:47
std::string schema_name
Definition meta.hpp:44
bool unique
Definition meta.hpp:50
Definition meta.hpp:18
std::string table_name
Definition meta.hpp:20
std::string column_name
Definition meta.hpp:21
friend bool operator==(layer const &, layer const &)=default
std::string schema_name
Definition meta.hpp:19
bool raster
Definition meta.hpp:22
Definition meta.hpp:80
std::string column_name
Definition meta.hpp:81
bool descending
Definition meta.hpp:82
Pagination filter for row selection.
Definition meta.hpp:86
int limit
Definition meta.hpp:90
std::vector< order_key > order_by
Definition meta.hpp:88
size_t offset
Definition meta.hpp:89
std::vector< std::string > select_list
Definition meta.hpp:87
Definition meta.hpp:98
std::string proj4
Definition meta.hpp:114
double xorig
Definition meta.hpp:105
std::string column_name
Definition meta.hpp:101
double yskew
Definition meta.hpp:110
int height
Definition meta.hpp:104
std::vector< band > bands
Definition meta.hpp:102
std::string table_name
Definition meta.hpp:100
double xscale
Definition meta.hpp:107
double yorig
Definition meta.hpp:106
int width
Definition meta.hpp:103
int epsg
Definition meta.hpp:112
int srid
Definition meta.hpp:111
std::string wkt
Definition meta.hpp:113
double yscale
Definition meta.hpp:108
std::string schema_name
Definition meta.hpp:99
double xskew
Definition meta.hpp:109
Definition meta.hpp:117
int width
Definition meta.hpp:120
int x
Definition meta.hpp:118
int y
Definition meta.hpp:119
int height
Definition meta.hpp:121
Definition meta.hpp:13
std::string source_name
Definition meta.hpp:14
std::string address
Definition meta.hpp:15
Definition meta.hpp:54
std::vector< index_key > index_keys
Definition meta.hpp:59
auto indices() const
Definition meta.hpp:61
std::string table_name
Definition meta.hpp:57
std::string schema_name
Definition meta.hpp:56
std::vector< column > columns
Definition meta.hpp:58
std::string dbms
lower case
Definition meta.hpp:55