Chris@16: // Boost.Geometry (aka GGL, Generic Geometry Library) Chris@16: Chris@16: // Copyright (c) 2008-2012 Bruno Lalande, Paris, France. Chris@16: // Copyright (c) 2008-2012 Barend Gehrels, Amsterdam, the Netherlands. Chris@16: // Copyright (c) 2009-2012 Mateusz Loskot, London, UK. Chris@16: Chris@16: // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library Chris@16: // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. Chris@16: Chris@16: // Use, modification and distribution is subject to the Boost Software License, Chris@16: // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at Chris@16: // http://www.boost.org/LICENSE_1_0.txt) Chris@16: Chris@16: Chris@16: #ifndef BOOST_GEOMETRY_GEOMETRIES_CONCEPTS_BOX_CONCEPT_HPP Chris@16: #define BOOST_GEOMETRY_GEOMETRIES_CONCEPTS_BOX_CONCEPT_HPP Chris@16: Chris@16: Chris@16: #include Chris@16: Chris@16: #include Chris@16: Chris@16: Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: Chris@16: Chris@16: namespace boost { namespace geometry { namespace concept Chris@16: { Chris@16: Chris@16: Chris@16: /*! Chris@16: \brief Box concept Chris@16: \ingroup concepts Chris@16: \par Formal definition: Chris@16: The box concept is defined as following: Chris@16: - there must be a specialization of traits::tag defining box_tag as type Chris@16: - there must be a specialization of traits::point_type to define the Chris@16: underlying point type (even if it does not consist of points, it should define Chris@16: this type, to indicate the points it can work with) Chris@16: - there must be a specialization of traits::indexed_access, per index Chris@16: (min_corner, max_corner) and per dimension, with two functions: Chris@16: - get to get a coordinate value Chris@16: - set to set a coordinate value (this one is not checked for ConstBox) Chris@16: */ Chris@16: template Chris@16: class Box Chris@16: { Chris@16: #ifndef DOXYGEN_NO_CONCEPT_MEMBERS Chris@16: typedef typename point_type::type point_type; Chris@16: Chris@16: Chris@16: template Chris@16: < Chris@16: std::size_t Index, Chris@16: std::size_t Dimension, Chris@16: std::size_t DimensionCount Chris@16: > Chris@16: struct dimension_checker Chris@16: { Chris@16: static void apply() Chris@16: { Chris@16: Geometry* b = 0; Chris@16: geometry::set(*b, geometry::get(*b)); Chris@16: dimension_checker::apply(); Chris@16: } Chris@16: }; Chris@16: Chris@16: template Chris@16: struct dimension_checker Chris@16: { Chris@16: static void apply() {} Chris@16: }; Chris@16: Chris@16: public : Chris@16: BOOST_CONCEPT_USAGE(Box) Chris@16: { Chris@16: static const std::size_t n = dimension::type::value; Chris@16: dimension_checker::apply(); Chris@16: dimension_checker::apply(); Chris@16: } Chris@16: #endif Chris@16: }; Chris@16: Chris@16: Chris@16: /*! Chris@16: \brief Box concept (const version) Chris@16: \ingroup const_concepts Chris@16: \details The ConstBox concept apply the same as the Box concept, Chris@16: but does not apply write access. Chris@16: */ Chris@16: template Chris@16: class ConstBox Chris@16: { Chris@16: #ifndef DOXYGEN_NO_CONCEPT_MEMBERS Chris@16: typedef typename point_type::type point_type; Chris@16: typedef typename coordinate_type::type coordinate_type; Chris@16: Chris@16: template Chris@16: < Chris@16: std::size_t Index, Chris@16: std::size_t Dimension, Chris@16: std::size_t DimensionCount Chris@16: > Chris@16: struct dimension_checker Chris@16: { Chris@16: static void apply() Chris@16: { Chris@16: const Geometry* b = 0; Chris@16: coordinate_type coord(geometry::get(*b)); Chris@16: boost::ignore_unused_variable_warning(coord); Chris@16: dimension_checker::apply(); Chris@16: } Chris@16: }; Chris@16: Chris@16: template Chris@16: struct dimension_checker Chris@16: { Chris@16: static void apply() {} Chris@16: }; Chris@16: Chris@16: public : Chris@16: BOOST_CONCEPT_USAGE(ConstBox) Chris@16: { Chris@16: static const std::size_t n = dimension::type::value; Chris@16: dimension_checker::apply(); Chris@16: dimension_checker::apply(); Chris@16: } Chris@16: #endif Chris@16: }; Chris@16: Chris@16: }}} // namespace boost::geometry::concept Chris@16: Chris@16: Chris@16: #endif // BOOST_GEOMETRY_GEOMETRIES_CONCEPTS_BOX_CONCEPT_HPP