]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/geometry/doc/src/docutils/tools/support_status/support_status.cpp
1 // Boost.Geometry (aka GGL, Generic Geometry Library)
2 // Tool reporting Implementation Support Status in QBK or plain text format
4 // Copyright (c) 2011-2015 Bruno Lalande, Paris, France.
5 // Copyright (c) 2011-2015 Barend Gehrels, Amsterdam, the Netherlands.
7 // Use, modification and distribution is subject to the Boost Software License,
8 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
9 // http://www.boost.org/LICENSE_1_0.txt)
15 #include <boost/mpl/for_each.hpp>
16 #include <boost/mpl/vector.hpp>
17 #include <boost/type_traits/is_base_of.hpp>
19 #define BOOST_GEOMETRY_IMPLEMENTATION_STATUS_BUILD true
20 #include <boost/geometry/core/cs.hpp>
21 #include <boost/geometry/geometries/geometries.hpp>
22 #include <boost/geometry/algorithms/append.hpp>
23 #include <boost/geometry/algorithms/area.hpp>
24 #include <boost/geometry/algorithms/buffer.hpp>
25 #include <boost/geometry/algorithms/centroid.hpp>
26 #include <boost/geometry/algorithms/clear.hpp>
27 #include <boost/geometry/algorithms/convert.hpp>
28 #include <boost/geometry/algorithms/convex_hull.hpp>
29 #include <boost/geometry/algorithms/correct.hpp>
30 #include <boost/geometry/algorithms/covered_by.hpp>
31 #include <boost/geometry/algorithms/disjoint.hpp>
32 #include <boost/geometry/algorithms/distance.hpp>
33 #include <boost/geometry/algorithms/envelope.hpp>
34 #include <boost/geometry/algorithms/equals.hpp>
35 #include <boost/geometry/algorithms/expand.hpp>
36 #include <boost/geometry/algorithms/for_each.hpp>
37 #include <boost/geometry/algorithms/is_empty.hpp>
38 #include <boost/geometry/algorithms/is_simple.hpp>
39 #include <boost/geometry/algorithms/is_valid.hpp>
40 #include <boost/geometry/algorithms/length.hpp>
41 #include <boost/geometry/algorithms/num_geometries.hpp>
42 #include <boost/geometry/algorithms/num_interior_rings.hpp>
43 #include <boost/geometry/algorithms/num_points.hpp>
44 #include <boost/geometry/algorithms/num_segments.hpp>
45 #include <boost/geometry/algorithms/overlaps.hpp>
46 #include <boost/geometry/algorithms/perimeter.hpp>
47 #include <boost/geometry/algorithms/reverse.hpp>
48 #include <boost/geometry/algorithms/simplify.hpp>
49 #include <boost/geometry/algorithms/transform.hpp>
50 #include <boost/geometry/algorithms/unique.hpp>
51 #include <boost/geometry/io/wkt/wkt.hpp>
52 #include <boost/geometry/strategies/strategies.hpp>
54 #include "text_outputter.hpp"
55 #include "qbk_outputter.hpp"
57 typedef boost::geometry::cs::cartesian cartesian
;
59 typedef boost::geometry::model::point
<double, 2, cartesian
> point_type
;
60 typedef boost::geometry::model::linestring
<point_type
> linestring_type
;
61 typedef boost::geometry::model::polygon
<point_type
> polygon_type
;
62 typedef boost::geometry::model::box
<point_type
> box_type
;
63 typedef boost::geometry::model::ring
<point_type
> ring_type
;
64 typedef boost::geometry::model::segment
<point_type
> segment_type
;
66 typedef boost::geometry::model::multi_point
<point_type
> multi_point_type
;
67 typedef boost::geometry::model::multi_linestring
<linestring_type
> multi_linestring_type
;
68 typedef boost::geometry::model::multi_polygon
<polygon_type
> multi_polygon_type
;
70 typedef boost::mpl::vector
<
78 multi_linestring_type
,
82 #define DECLARE_UNARY_ALGORITHM(algorithm) \
83 template <typename G> \
84 struct algorithm: boost::geometry::dispatch::algorithm<G> \
87 #define DECLARE_UNARY_ALGORITHM_WITH_BOOLEAN(algorithm) \
88 template <typename G> \
89 struct algorithm: boost::geometry::dispatch::algorithm<G,false> \
92 #define DECLARE_BINARY_ALGORITHM(algorithm) \
93 template <typename G1, typename G2> \
94 struct algorithm: boost::geometry::dispatch::algorithm<G1, G2> \
97 DECLARE_BINARY_ALGORITHM(append
)
98 DECLARE_UNARY_ALGORITHM(area
)
99 DECLARE_BINARY_ALGORITHM(buffer
)
100 DECLARE_UNARY_ALGORITHM(centroid
)
101 DECLARE_UNARY_ALGORITHM(clear
)
102 DECLARE_BINARY_ALGORITHM(convert
)
103 DECLARE_UNARY_ALGORITHM(convex_hull
)
104 DECLARE_UNARY_ALGORITHM(correct
)
105 DECLARE_BINARY_ALGORITHM(covered_by
)
106 DECLARE_BINARY_ALGORITHM(disjoint
)
107 DECLARE_BINARY_ALGORITHM(distance
)
108 DECLARE_UNARY_ALGORITHM(envelope
)
109 DECLARE_BINARY_ALGORITHM(equals
)
110 DECLARE_BINARY_ALGORITHM(expand
)
111 DECLARE_UNARY_ALGORITHM(for_each_point
)
112 DECLARE_UNARY_ALGORITHM(for_each_segment
)
113 DECLARE_UNARY_ALGORITHM(is_empty
)
114 DECLARE_UNARY_ALGORITHM(is_simple
)
115 DECLARE_UNARY_ALGORITHM(is_valid
)
116 DECLARE_UNARY_ALGORITHM(length
)
117 DECLARE_UNARY_ALGORITHM(num_geometries
)
118 DECLARE_UNARY_ALGORITHM(num_interior_rings
)
119 DECLARE_UNARY_ALGORITHM_WITH_BOOLEAN(num_points
)
120 DECLARE_UNARY_ALGORITHM(num_segments
)
121 DECLARE_BINARY_ALGORITHM(overlaps
)
122 DECLARE_UNARY_ALGORITHM(perimeter
)
123 DECLARE_UNARY_ALGORITHM(reverse
)
124 DECLARE_UNARY_ALGORITHM(simplify
)
125 DECLARE_BINARY_ALGORITHM(transform
)
126 DECLARE_UNARY_ALGORITHM(unique
)
127 DECLARE_BINARY_ALGORITHM(within
)
128 DECLARE_UNARY_ALGORITHM(wkt
)
131 template <template <typename
> class Dispatcher
, typename Outputter
, typename G
>
134 Outputter
& m_outputter
;
135 inline do_unary_test(Outputter
& outputter
)
136 : m_outputter(outputter
)
141 if (boost::is_base_of
<boost::geometry::nyi::not_implemented_tag
, Dispatcher
<G
> >::type::value
)
152 template <template <typename
, typename
> class Dispatcher
, typename Outputter
, typename G2
= void>
153 struct do_binary_test
155 Outputter
& m_outputter
;
156 inline do_binary_test(Outputter
& outputter
)
157 : m_outputter(outputter
)
160 template <typename G1
>
163 if (boost::is_base_of
<boost::geometry::nyi::not_implemented_tag
, Dispatcher
<G1
, G2
> >::type::value
)
174 template <template <typename
> class Dispatcher
, typename Outputter
>
177 Outputter
& m_outputter
;
178 inline unary_test(Outputter
& outputter
)
179 : m_outputter(outputter
)
182 template <typename G
>
185 m_outputter
.template begin_row
<G
>();
186 do_unary_test
<Dispatcher
, Outputter
, G
> test(m_outputter
);
188 m_outputter
.end_row();
192 template <template <typename
, typename
> class Dispatcher
, typename Types
, typename Outputter
>
195 Outputter
& m_outputter
;
196 inline binary_test(Outputter
& outputter
)
197 : m_outputter(outputter
)
200 template <typename G2
>
203 m_outputter
.template begin_row
<G2
>();
204 boost::mpl::for_each
<Types
>(do_binary_test
<Dispatcher
, Outputter
, G2
>(m_outputter
));
205 m_outputter
.end_row();
209 template <template <typename
> class Dispatcher
, typename Types
, typename Outputter
>
210 void test_unary_algorithm(std::string
const& name
)
212 Outputter
outputter(name
);
213 outputter
.header(name
);
215 outputter
.table_header();
216 boost::mpl::for_each
<Types
>(unary_test
<Dispatcher
, Outputter
>(outputter
));
218 outputter
.table_footer();
221 template <template <typename
, typename
> class Dispatcher
, typename Types1
, typename Types2
, typename Outputter
>
222 void test_binary_algorithm(std::string
const& name
)
224 Outputter
outputter(name
);
225 outputter
.header(name
);
227 outputter
.template table_header
<Types2
>();
228 boost::mpl::for_each
<Types1
>(binary_test
<Dispatcher
, Types2
, Outputter
>(outputter
));
230 outputter
.table_footer();
234 template <typename OutputFactory
>
235 void support_status()
237 test_binary_algorithm
<append
, all_types
, boost::mpl::vector
<point_type
, std::vector
<point_type
> >, OutputFactory
>("append");
238 test_unary_algorithm
<area
, all_types
, OutputFactory
>("area");
239 test_binary_algorithm
<buffer
, all_types
, all_types
, OutputFactory
>("buffer");
240 test_unary_algorithm
<centroid
, all_types
, OutputFactory
>("centroid");
241 test_unary_algorithm
<clear
, all_types
, OutputFactory
>("clear");
242 test_binary_algorithm
<convert
, all_types
, all_types
, OutputFactory
>("convert");
243 test_unary_algorithm
<convex_hull
, all_types
, OutputFactory
>("convex_hull");
244 test_unary_algorithm
<correct
, all_types
, OutputFactory
>("correct");
245 test_binary_algorithm
<covered_by
, all_types
, all_types
, OutputFactory
>("covered_by");
246 test_binary_algorithm
<disjoint
, all_types
, all_types
, OutputFactory
>("disjoint");
247 test_binary_algorithm
<distance
, all_types
, all_types
, OutputFactory
>("distance");
248 test_unary_algorithm
<envelope
, all_types
, OutputFactory
>("envelope");
249 test_binary_algorithm
<equals
, all_types
, all_types
, OutputFactory
>("equals");
250 test_binary_algorithm
<expand
, all_types
, all_types
, OutputFactory
>("expand");
251 test_unary_algorithm
<for_each_point
, all_types
, OutputFactory
>("for_each_point");
252 test_unary_algorithm
<for_each_segment
, all_types
, OutputFactory
>("for_each_segment");
253 test_unary_algorithm
<is_empty
, all_types
, OutputFactory
>("is_empty");
254 test_unary_algorithm
<is_simple
, all_types
, OutputFactory
>("is_simple");
255 test_unary_algorithm
<is_valid
, all_types
, OutputFactory
>("is_valid");
256 test_unary_algorithm
<length
, all_types
, OutputFactory
>("length");
257 test_unary_algorithm
<num_geometries
, all_types
, OutputFactory
>("num_geometries");
258 test_unary_algorithm
<num_interior_rings
, all_types
, OutputFactory
>("num_interior_rings");
259 test_unary_algorithm
<num_points
, all_types
, OutputFactory
>("num_points");
260 test_binary_algorithm
<overlaps
, all_types
, all_types
, OutputFactory
>("overlaps");
261 test_unary_algorithm
<perimeter
, all_types
, OutputFactory
>("perimeter");
262 test_unary_algorithm
<reverse
, all_types
, OutputFactory
>("reverse");
263 test_unary_algorithm
<simplify
, all_types
, OutputFactory
>("simplify");
264 test_binary_algorithm
<transform
, all_types
, all_types
, OutputFactory
>("transform");
265 test_unary_algorithm
<unique
, all_types
, OutputFactory
>("unique");
266 test_binary_algorithm
<within
, all_types
, all_types
, OutputFactory
>("within");
267 test_unary_algorithm
<wkt
, all_types
, OutputFactory
>("wkt");
271 int main(int argc
, char** argv
)
273 if (argc
> 1 && ! strcmp(argv
[1], "qbk"))
275 support_status
<qbk_outputter
>();
279 support_status
<text_outputter
>();