Исходный код СУБД 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
#pragma once
 
#include <set>
 
#include <mapbox/geometry/point.hpp>
 
#include <mapbox/geometry/wagyu/active_bound_list.hpp>
 
#ifdef DEBUG
#include <iostream>
#endif
 
namespace mapbox {
namespace geometry {
namespace wagyu {
 
template <typename T>
struct intersect_node {
 
    bound_ptr<T> bound1;
    bound_ptr<T> bound2;
    mapbox::geometry::point<double> pt;
 
    intersect_node(intersect_node<T>&& n) noexcept
        : bound1(std::move(n.bound1)), bound2(std::move(n.bound2)), pt(std::move(n.pt)) {
    }
 
    intersect_node& operator=(intersect_node<T>&& n) noexcept {
        bound1 = std::move(n.bound1);
        bound2 = std::move(n.bound2);
        pt = std::move(n.pt);
        return *this;
    }
 
    intersect_node(bound_ptr<T> const& bound1_, bound_ptr<T> const& bound2_, mapbox::geometry::point<double> const& pt_)
        : bound1(bound1_), bound2(bound2_), pt(pt_) {
    }
};
 
template <typename T>
using intersect_list = std::vector<intersect_node<T>>;
 
#ifdef DEBUG
 
template <class charT, class traits, typename T>
inline std::basic_ostream<charT, traits>& operator<<(std::basic_ostream<charT, traits>& out,
                                                     const intersect_node<T>& e) {
    out << " point x: " << e.pt.x << " y: " << e.pt.y << std::endl;
    out << " bound 1: " << std::endl;
    out << *e.bound1 << std::endl;
    out << " bound 2: " << std::endl;
    out << *e.bound2 << std::endl;
    return out;
}
 
template <class charT, class traits, typename T>
inline std::basic_ostream<charT, traits>& operator<<(std::basic_ostream<charT, traits>& out,
                                                     const intersect_list<T>& ints) {
    std::size_t c = 0;
    for (auto const& i : ints) {
        out << "Intersection: " << c++ << std::endl;
        out << i;
    }
    return out;
}
 
#endif
} // namespace wagyu
} // namespace geometry
} // namespace mapbox