2 // Copyright 2005-2007 Adobe Systems Incorporated
4 // Distributed under the Boost Software License, Version 1.0
5 // See accompanying file LICENSE_1_0.txt or copy at
6 // http://www.boost.org/LICENSE_1_0.txt
8 #ifndef BOOST_GIL_CONCEPTS_POINT_HPP
9 #define BOOST_GIL_CONCEPTS_POINT_HPP
11 #include <boost/gil/concepts/basic.hpp>
12 #include <boost/gil/concepts/concept_check.hpp>
16 #if defined(BOOST_CLANG)
17 #pragma clang diagnostic push
18 #pragma clang diagnostic ignored "-Wunused-local-typedefs"
21 #if defined(BOOST_GCC) && (BOOST_GCC >= 40900)
22 #pragma GCC diagnostic push
23 #pragma GCC diagnostic ignored "-Wunused-local-typedefs"
26 namespace boost { namespace gil {
28 // Forward declarations
32 template <std::size_t K, typename T>
33 T const& axis_value(point<T> const& p);
35 template <std::size_t K, typename T>
36 T& axis_value(point<T>& p);
38 /// \brief N-dimensional point concept
40 /// concept PointNDConcept<typename T> : Regular<T>
42 /// // the type of a coordinate along each axis
43 /// template <size_t K>
44 /// struct axis; where Metafunction<axis>;
46 /// const size_t num_dimensions;
48 /// // accessor/modifier of the value of each axis.
50 /// template <size_t K>
51 /// typename axis<K>::type const& T::axis_value() const;
53 /// template <size_t K>
54 /// typename axis<K>::type& T::axis_value();
57 /// \ingroup PointConcept
64 gil_function_requires<Regular<P>>();
66 using value_type = typename P::value_type;
67 ignore_unused_variable_warning(value_type{});
69 static const std::size_t N = P::num_dimensions;
70 ignore_unused_variable_warning(N);
71 using FT = typename P::template axis<0>::coord_t;
72 using LT = typename P::template axis<N - 1>::coord_t;
73 FT ft = gil::axis_value<0>(point);
74 axis_value<0>(point) = ft;
75 LT lt = axis_value<N - 1>(point);
76 axis_value<N - 1>(point) = lt;
78 //value_type v=point[0];
79 //ignore_unused_variable_warning(v);
84 /// \brief 2-dimensional point concept
86 /// concept Point2DConcept<typename T> : PointNDConcept<T>
88 /// where num_dimensions == 2;
89 /// where SameType<axis<0>::type, axis<1>::type>;
91 /// typename value_type = axis<0>::type;
93 /// value_type const& operator[](T const&, size_t i);
94 /// value_type& operator[](T&, size_t i);
99 /// \ingroup PointConcept
101 template <typename P>
102 struct Point2DConcept
106 gil_function_requires<PointNDConcept<P>>();
107 static_assert(P::num_dimensions == 2, "");
114 }} // namespace boost::gil
116 #if defined(BOOST_CLANG)
117 #pragma clang diagnostic pop
120 #if defined(BOOST_GCC) && (BOOST_GCC >= 40900)
121 #pragma GCC diagnostic pop