]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/geometry/test/test_geometries/all_custom_ring.hpp
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / boost / libs / geometry / test / test_geometries / all_custom_ring.hpp
1 // Boost.Geometry (aka GGL, Generic Geometry Library)
2 // Unit Test
3
4 // Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands.
5
6 // This file was modified by Oracle on 2020.
7 // Modifications copyright (c) 2020 Oracle and/or its affiliates.
8 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
9
10 // Use, modification and distribution is subject to the Boost Software License,
11 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
12 // http://www.boost.org/LICENSE_1_0.txt)
13
14 #ifndef GEOMETRY_TEST_TEST_GEOMETRIES_ALL_CUSTOM_RING_HPP
15 #define GEOMETRY_TEST_TEST_GEOMETRIES_ALL_CUSTOM_RING_HPP
16
17 #include <cstddef>
18
19 #include <boost/geometry/core/mutable_range.hpp>
20 #include <boost/geometry/core/tag.hpp>
21 #include <boost/geometry/core/tags.hpp>
22
23 #include <test_geometries/all_custom_container.hpp>
24
25
26 template <typename P>
27 class all_custom_ring : public all_custom_container<P>
28 {};
29
30
31 // Note that the things below are nearly all identical to implementation
32 // in *linestring, but it seems not possible to re-use this (without macro's)
33 // (the only thing DIFFERENT is the tag)
34
35
36 // 1. Adapt to Boost.Geometry
37 namespace boost { namespace geometry
38 {
39
40 namespace traits
41 {
42 template <typename Point>
43 struct tag<all_custom_ring<Point> >
44 {
45 typedef ring_tag type;
46 };
47
48
49 // Implement traits for mutable actions
50 // These are all optional traits (normally / default they are implemented
51 // conforming std:: functionality)
52
53 template <typename Point>
54 struct clear<all_custom_ring<Point> >
55 {
56 static inline void apply(all_custom_ring<Point>& acr)
57 {
58 acr.custom_clear();
59 }
60 };
61
62 template <typename Point>
63 struct push_back<all_custom_ring<Point> >
64 {
65 static inline void apply(all_custom_ring<Point>& acr, Point const& point)
66 {
67 acr.custom_push_back(point);
68 }
69 };
70
71 template <typename Point>
72 struct resize<all_custom_ring<Point> >
73 {
74 static inline void apply(all_custom_ring<Point>& acr, std::size_t new_size)
75 {
76 acr.custom_resize(new_size);
77 }
78 };
79
80 } // namespace traits
81
82 }} // namespace boost::geometry
83
84
85 // 2a. Adapt to Boost.Range, meta-functions
86 namespace boost
87 {
88 template<typename Point>
89 struct range_mutable_iterator<all_custom_ring<Point> >
90 {
91 typedef typename all_custom_ring<Point>::custom_iterator_type type;
92 };
93
94 template<typename Point>
95 struct range_const_iterator<all_custom_ring<Point> >
96 {
97 typedef typename all_custom_ring<Point>::custom_const_iterator_type type;
98 };
99
100 } // namespace boost
101
102
103 // 2b. Adapt to Boost.Range, part 2, ADP
104
105 template<typename Point>
106 inline typename all_custom_ring<Point>::custom_iterator_type
107 range_begin(all_custom_ring<Point>& acr)
108 {
109 return acr.custom_begin();
110 }
111
112 template<typename Point>
113 inline typename all_custom_ring<Point>::custom_const_iterator_type
114 range_begin(all_custom_ring<Point> const& acr)
115 {
116 return acr.custom_begin();
117 }
118
119 template<typename Point>
120 inline typename all_custom_ring<Point>::custom_iterator_type
121 range_end(all_custom_ring<Point>& acr)
122 {
123 return acr.custom_end();
124 }
125
126 template<typename Point>
127 inline typename all_custom_ring<Point>::custom_const_iterator_type
128 range_end(all_custom_ring<Point> const& acr)
129 {
130 return acr.custom_end();
131 }
132
133 // (Optional)
134 template<typename Point>
135 inline std::size_t range_calculate_size(all_custom_ring<Point> const& acr)
136 {
137 return acr.custom_size();
138 }
139
140
141
142
143 #endif // GEOMETRY_TEST_TEST_GEOMETRIES_ALL_CUSTOM_RING_HPP