123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151 |
- #ifndef BOOST_GEOMETRY_GEOMETRIES_CONCEPTS_POINT_CONCEPT_HPP
- #define BOOST_GEOMETRY_GEOMETRIES_CONCEPTS_POINT_CONCEPT_HPP
- #include <cstddef>
- #include <boost/concept_check.hpp>
- #include <boost/core/ignore_unused.hpp>
- #include <boost/geometry/core/access.hpp>
- #include <boost/geometry/core/coordinate_dimension.hpp>
- #include <boost/geometry/core/coordinate_system.hpp>
- #include <boost/geometry/geometries/concepts/concept_type.hpp>
- namespace boost { namespace geometry { namespace concepts
- {
- template <typename Geometry>
- class Point
- {
- #ifndef DOXYGEN_NO_CONCEPT_MEMBERS
- typedef typename coordinate_type<Geometry>::type ctype;
- typedef typename coordinate_system<Geometry>::type csystem;
-
-
-
- enum { cs_check = sizeof(csystem) };
- enum { ccount = dimension<Geometry>::value };
- template <typename P, std::size_t Dimension, std::size_t DimensionCount>
- struct dimension_checker
- {
- static void apply()
- {
- P* p = 0;
- geometry::set<Dimension>(*p, geometry::get<Dimension>(*p));
- dimension_checker<P, Dimension+1, DimensionCount>::apply();
- }
- };
- template <typename P, std::size_t DimensionCount>
- struct dimension_checker<P, DimensionCount, DimensionCount>
- {
- static void apply() {}
- };
- public:
-
- BOOST_CONCEPT_USAGE(Point)
- {
- dimension_checker<Geometry, 0, ccount>::apply();
- }
- #endif
- };
- template <typename Geometry>
- class ConstPoint
- {
- #ifndef DOXYGEN_NO_CONCEPT_MEMBERS
- typedef typename coordinate_type<Geometry>::type ctype;
- typedef typename coordinate_system<Geometry>::type csystem;
-
-
-
- enum { cs_check = sizeof(csystem) };
- enum { ccount = dimension<Geometry>::value };
- template <typename P, std::size_t Dimension, std::size_t DimensionCount>
- struct dimension_checker
- {
- static void apply()
- {
- const P* p = 0;
- ctype coord(geometry::get<Dimension>(*p));
- boost::ignore_unused(p, coord);
- dimension_checker<P, Dimension+1, DimensionCount>::apply();
- }
- };
- template <typename P, std::size_t DimensionCount>
- struct dimension_checker<P, DimensionCount, DimensionCount>
- {
- static void apply() {}
- };
- public:
-
- BOOST_CONCEPT_USAGE(ConstPoint)
- {
- dimension_checker<Geometry, 0, ccount>::apply();
- }
- #endif
- };
- template <typename Geometry>
- struct concept_type<Geometry, point_tag>
- {
- using type = Point<Geometry>;
- };
- template <typename Geometry>
- struct concept_type<Geometry const, point_tag>
- {
- using type = ConstPoint<Geometry>;
- };
- }}}
- #endif
|