comparison DEPENDENCIES/generic/include/boost/geometry/geometries/concepts/check.hpp @ 16:2665513ce2d3

Add boost headers
author Chris Cannam
date Tue, 05 Aug 2014 11:11:38 +0100
parents
children c530137014c0
comparison
equal deleted inserted replaced
15:663ca0da4350 16:2665513ce2d3
1 // Boost.Geometry (aka GGL, Generic Geometry Library)
2
3 // Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
4 // Copyright (c) 2008-2012 Barend Gehrels, Amsterdam, the Netherlands.
5 // Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
6
7 // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
8 // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
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
15 #ifndef BOOST_GEOMETRY_GEOMETRIES_CONCEPTS_CHECK_HPP
16 #define BOOST_GEOMETRY_GEOMETRIES_CONCEPTS_CHECK_HPP
17
18
19 #include <boost/concept_check.hpp>
20 #include <boost/concept/requires.hpp>
21
22 #include <boost/type_traits/is_const.hpp>
23
24 #include <boost/geometry/core/tag.hpp>
25
26 #include <boost/geometry/geometries/concepts/box_concept.hpp>
27 #include <boost/geometry/geometries/concepts/linestring_concept.hpp>
28 #include <boost/geometry/geometries/concepts/point_concept.hpp>
29 #include <boost/geometry/geometries/concepts/polygon_concept.hpp>
30 #include <boost/geometry/geometries/concepts/ring_concept.hpp>
31 #include <boost/geometry/geometries/concepts/segment_concept.hpp>
32
33 #include <boost/geometry/algorithms/not_implemented.hpp>
34
35 #include <boost/variant/variant_fwd.hpp>
36
37 namespace boost { namespace geometry
38 {
39
40
41 #ifndef DOXYGEN_NO_DETAIL
42 namespace detail { namespace concept_check
43 {
44
45 template <typename Concept>
46 class check
47 {
48 BOOST_CONCEPT_ASSERT((Concept ));
49 };
50
51 }} // namespace detail::concept_check
52 #endif // DOXYGEN_NO_DETAIL
53
54
55
56 #ifndef DOXYGEN_NO_DISPATCH
57 namespace dispatch
58 {
59
60 template
61 <
62 typename Geometry,
63 typename GeometryTag = typename geometry::tag<Geometry>::type,
64 bool IsConst = boost::is_const<Geometry>::type::value
65 >
66 struct check : not_implemented<GeometryTag>
67 {};
68
69
70 template <typename Geometry>
71 struct check<Geometry, point_tag, true>
72 : detail::concept_check::check<concept::ConstPoint<Geometry> >
73 {};
74
75
76 template <typename Geometry>
77 struct check<Geometry, point_tag, false>
78 : detail::concept_check::check<concept::Point<Geometry> >
79 {};
80
81
82 template <typename Geometry>
83 struct check<Geometry, linestring_tag, true>
84 : detail::concept_check::check<concept::ConstLinestring<Geometry> >
85 {};
86
87
88 template <typename Geometry>
89 struct check<Geometry, linestring_tag, false>
90 : detail::concept_check::check<concept::Linestring<Geometry> >
91 {};
92
93
94 template <typename Geometry>
95 struct check<Geometry, ring_tag, true>
96 : detail::concept_check::check<concept::ConstRing<Geometry> >
97 {};
98
99
100 template <typename Geometry>
101 struct check<Geometry, ring_tag, false>
102 : detail::concept_check::check<concept::Ring<Geometry> >
103 {};
104
105 template <typename Geometry>
106 struct check<Geometry, polygon_tag, true>
107 : detail::concept_check::check<concept::ConstPolygon<Geometry> >
108 {};
109
110
111 template <typename Geometry>
112 struct check<Geometry, polygon_tag, false>
113 : detail::concept_check::check<concept::Polygon<Geometry> >
114 {};
115
116
117 template <typename Geometry>
118 struct check<Geometry, box_tag, true>
119 : detail::concept_check::check<concept::ConstBox<Geometry> >
120 {};
121
122
123 template <typename Geometry>
124 struct check<Geometry, box_tag, false>
125 : detail::concept_check::check<concept::Box<Geometry> >
126 {};
127
128
129 template <typename Geometry>
130 struct check<Geometry, segment_tag, true>
131 : detail::concept_check::check<concept::ConstSegment<Geometry> >
132 {};
133
134
135 template <typename Geometry>
136 struct check<Geometry, segment_tag, false>
137 : detail::concept_check::check<concept::Segment<Geometry> >
138 {};
139
140
141 } // namespace dispatch
142 #endif
143
144
145
146
147 namespace concept
148 {
149
150
151 #ifndef DOXYGEN_NO_DETAIL
152 namespace detail
153 {
154
155
156 template <typename Geometry>
157 struct checker : dispatch::check<Geometry>
158 {};
159
160 template <BOOST_VARIANT_ENUM_PARAMS(typename T)>
161 struct checker<boost::variant<BOOST_VARIANT_ENUM_PARAMS(T)> >
162 {};
163
164 template <BOOST_VARIANT_ENUM_PARAMS(typename T)>
165 struct checker<boost::variant<BOOST_VARIANT_ENUM_PARAMS(T)> const>
166 {};
167
168
169 }
170 #endif // DOXYGEN_NO_DETAIL
171
172
173 /*!
174 \brief Checks, in compile-time, the concept of any geometry
175 \ingroup concepts
176 */
177 template <typename Geometry>
178 inline void check()
179 {
180 detail::checker<Geometry> c;
181 boost::ignore_unused_variable_warning(c);
182 }
183
184
185 /*!
186 \brief Checks, in compile-time, the concept of two geometries, and if they
187 have equal dimensions
188 \ingroup concepts
189 */
190 template <typename Geometry1, typename Geometry2>
191 inline void check_concepts_and_equal_dimensions()
192 {
193 check<Geometry1>();
194 check<Geometry2>();
195 assert_dimension_equal<Geometry1, Geometry2>();
196 }
197
198
199 } // namespace concept
200
201
202 }} // namespace boost::geometry
203
204
205 #endif // BOOST_GEOMETRY_GEOMETRIES_CONCEPTS_CHECK_HPP