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) 2007-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: #ifndef BOOST_GEOMETRY_GEOMETRIES_ADAPTED_C_ARRAY_HPP Chris@16: #define BOOST_GEOMETRY_GEOMETRIES_ADAPTED_C_ARRAY_HPP Chris@16: Chris@16: #include Chris@16: Chris@16: #include Chris@16: Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: Chris@16: namespace boost { namespace geometry Chris@16: { Chris@16: Chris@16: Chris@16: #ifndef DOXYGEN_NO_TRAITS_SPECIALIZATIONS Chris@16: namespace traits Chris@16: { Chris@16: Chris@16: Chris@16: #ifndef DOXYGEN_NO_DETAIL Chris@16: namespace detail Chris@16: { Chris@16: Chris@16: Chris@16: // Create class and specialization to indicate the tag Chris@16: // for normal cases and the case that the type of the c-array is arithmetic Chris@16: template Chris@16: struct c_array_tag Chris@16: { Chris@16: typedef geometry_not_recognized_tag type; Chris@16: }; Chris@16: Chris@16: Chris@16: template <> Chris@16: struct c_array_tag Chris@16: { Chris@16: typedef point_tag type; Chris@16: }; Chris@16: Chris@16: Chris@16: } // namespace detail Chris@16: #endif // DOXYGEN_NO_DETAIL Chris@16: Chris@16: Chris@16: // Assign the point-tag, preventing arrays of points getting a point-tag Chris@16: template Chris@16: struct tag Chris@16: : detail::c_array_tag::value> {}; Chris@16: Chris@16: Chris@16: template Chris@16: struct coordinate_type Chris@16: { Chris@16: typedef CoordinateType type; Chris@16: }; Chris@16: Chris@16: Chris@16: template Chris@16: struct dimension: boost::mpl::int_ {}; Chris@16: Chris@16: Chris@16: template Chris@16: struct access Chris@16: { Chris@16: static inline CoordinateType get(CoordinateType const p[DimensionCount]) Chris@16: { Chris@16: return p[Dimension]; Chris@16: } Chris@16: Chris@16: static inline void set(CoordinateType p[DimensionCount], Chris@16: CoordinateType const& value) Chris@16: { Chris@16: p[Dimension] = value; Chris@16: } Chris@16: }; Chris@16: Chris@16: Chris@16: } // namespace traits Chris@16: #endif // DOXYGEN_NO_TRAITS_SPECIALIZATIONS Chris@16: Chris@16: Chris@16: }} // namespace boost::geometry Chris@16: Chris@16: Chris@16: #define BOOST_GEOMETRY_REGISTER_C_ARRAY_CS(CoordinateSystem) \ Chris@16: namespace boost { namespace geometry { namespace traits { \ Chris@16: template \ Chris@16: struct coordinate_system \ Chris@16: { \ Chris@16: typedef CoordinateSystem type; \ Chris@16: }; \ Chris@16: }}} Chris@16: Chris@16: Chris@16: #endif // BOOST_GEOMETRY_GEOMETRIES_ADAPTED_C_ARRAY_HPP