1 // Boost.Geometry (aka GGL, Generic Geometry Library)
4 // Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands.
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
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)
14 #ifndef GEOMETRY_TEST_TEST_GEOMETRIES_ALL_CUSTOM_RING_HPP
15 #define GEOMETRY_TEST_TEST_GEOMETRIES_ALL_CUSTOM_RING_HPP
19 #include <boost/geometry/core/mutable_range.hpp>
20 #include <boost/geometry/core/tag.hpp>
21 #include <boost/geometry/core/tags.hpp>
23 #include <test_geometries/all_custom_container.hpp>
27 class all_custom_ring : public all_custom_container<P>
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)
36 // 1. Adapt to Boost.Geometry
37 namespace boost { namespace geometry
42 template <typename Point>
43 struct tag<all_custom_ring<Point> >
45 typedef ring_tag type;
49 // Implement traits for mutable actions
50 // These are all optional traits (normally / default they are implemented
51 // conforming std:: functionality)
53 template <typename Point>
54 struct clear<all_custom_ring<Point> >
56 static inline void apply(all_custom_ring<Point>& acr)
62 template <typename Point>
63 struct push_back<all_custom_ring<Point> >
65 static inline void apply(all_custom_ring<Point>& acr, Point const& point)
67 acr.custom_push_back(point);
71 template <typename Point>
72 struct resize<all_custom_ring<Point> >
74 static inline void apply(all_custom_ring<Point>& acr, std::size_t new_size)
76 acr.custom_resize(new_size);
82 }} // namespace boost::geometry
85 // 2a. Adapt to Boost.Range, meta-functions
88 template<typename Point>
89 struct range_mutable_iterator<all_custom_ring<Point> >
91 typedef typename all_custom_ring<Point>::custom_iterator_type type;
94 template<typename Point>
95 struct range_const_iterator<all_custom_ring<Point> >
97 typedef typename all_custom_ring<Point>::custom_const_iterator_type type;
103 // 2b. Adapt to Boost.Range, part 2, ADP
105 template<typename Point>
106 inline typename all_custom_ring<Point>::custom_iterator_type
107 range_begin(all_custom_ring<Point>& acr)
109 return acr.custom_begin();
112 template<typename Point>
113 inline typename all_custom_ring<Point>::custom_const_iterator_type
114 range_begin(all_custom_ring<Point> const& acr)
116 return acr.custom_begin();
119 template<typename Point>
120 inline typename all_custom_ring<Point>::custom_iterator_type
121 range_end(all_custom_ring<Point>& acr)
123 return acr.custom_end();
126 template<typename Point>
127 inline typename all_custom_ring<Point>::custom_const_iterator_type
128 range_end(all_custom_ring<Point> const& acr)
130 return acr.custom_end();
134 template<typename Point>
135 inline std::size_t range_calculate_size(all_custom_ring<Point> const& acr)
137 return acr.custom_size();
143 #endif // GEOMETRY_TEST_TEST_GEOMETRIES_ALL_CUSTOM_RING_HPP