Исходный код СУБД RuDB — свободной СУБД с открытым исходным кодом на базе PostgreSQL
rudb
2026-04-30 9f2ef60949ced4fab4d077a7e1c6d913f3620c9b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
#pragma once
 
#include <mapbox/geometry/point.hpp>
 
#ifdef DEBUG
#include <iostream>
#endif
 
namespace mapbox {
namespace geometry {
namespace wagyu {
 
template <typename T>
struct point;
 
template <typename T>
using point_ptr = point<T>*;
 
template <typename T>
using const_point_ptr = point<T>* const;
 
template <typename T>
struct ring;
 
template <typename T>
using ring_ptr = ring<T>*;
 
template <typename T>
using const_ring_ptr = ring<T>* const;
 
template <typename T>
struct point {
    using coordinate_type = T;
    ring_ptr<T> ring;
    T x;
    T y;
    point_ptr<T> next;
    point_ptr<T> prev;
 
    point() : ring(nullptr), x(0), y(0), prev(this), next(this) {
    }
 
    point(T x_, T y_) : ring(nullptr), x(x_), y(y_), next(this), prev(this) {
    }
 
    point(ring_ptr<T> ring_, mapbox::geometry::point<T> const& pt)
        : ring(ring_), x(pt.x), y(pt.y), next(this), prev(this) {
    }
 
    point(ring_ptr<T> ring_, mapbox::geometry::point<T> const& pt, point_ptr<T> before_this_point)
        : ring(ring_), x(pt.x), y(pt.y), next(before_this_point), prev(before_this_point->prev) {
        before_this_point->prev = this;
        prev->next = this;
    }
};
 
template <typename T>
using point_vector = std::vector<point_ptr<T>>;
 
template <typename T>
using point_vector_itr = typename point_vector<T>::iterator;
 
template <typename T>
bool operator==(point<T> const& lhs, point<T> const& rhs) {
    return lhs.x == rhs.x && lhs.y == rhs.y;
}
 
template <typename T>
bool operator==(mapbox::geometry::point<T> const& lhs, point<T> const& rhs) {
    return lhs.x == rhs.x && lhs.y == rhs.y;
}
 
template <typename T>
bool operator==(point<T> const& lhs, mapbox::geometry::point<T> const& rhs) {
    return lhs.x == rhs.x && lhs.y == rhs.y;
}
 
template <typename T>
bool operator!=(point<T> const& lhs, point<T> const& rhs) {
    return lhs.x != rhs.x || lhs.y != rhs.y;
}
 
template <typename T>
bool operator!=(mapbox::geometry::point<T> const& lhs, point<T> const& rhs) {
    return lhs.x != rhs.x || lhs.y != rhs.y;
}
 
template <typename T>
bool operator!=(point<T> const& lhs, mapbox::geometry::point<T> const& rhs) {
    return lhs.x != rhs.x || lhs.y != rhs.y;
}
 
#ifdef DEBUG
 
template <class charT, class traits, typename T>
inline std::basic_ostream<charT, traits>& operator<<(std::basic_ostream<charT, traits>& out, const point<T>& p) {
    out << "  point at: " << p.x << ", " << p.y;
    return out;
}
 
template <class charT, class traits, typename T>
inline std::basic_ostream<charT, traits>& operator<<(std::basic_ostream<charT, traits>& out,
                                                     const mapbox::geometry::point<T>& p) {
    out << "  point at: " << p.x << ", " << p.y;
    return out;
}
#endif
} // namespace wagyu
} // namespace geometry
} // namespace mapbox