Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:35:29

0001 // Boost.Geometry Index
0002 //
0003 // Sum values calculated for indexable's dimensions, used e.g. in R-tree k nearest neighbors query
0004 //
0005 // Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland.
0006 //
0007 // This file was modified by Oracle on 2020.
0008 // Modifications copyright (c) 2020 Oracle and/or its affiliates.
0009 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
0010 //
0011 // Use, modification and distribution is subject to the Boost Software License,
0012 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
0013 // http://www.boost.org/LICENSE_1_0.txt)
0014 
0015 #ifndef BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_SUM_FOR_INDEXABLE_HPP
0016 #define BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_SUM_FOR_INDEXABLE_HPP
0017 
0018 #include <boost/geometry/core/static_assert.hpp>
0019 
0020 namespace boost { namespace geometry { namespace index { namespace detail {
0021 
0022 template <
0023     typename Geometry,
0024     typename Indexable,
0025     typename IndexableTag,
0026     typename AlgoTag,
0027     size_t DimensionIndex>
0028 struct sum_for_indexable_dimension
0029 {
0030     BOOST_GEOMETRY_STATIC_ASSERT_FALSE(
0031         "Not implemented for this Indexable type.",
0032         Geometry, Indexable, IndexableTag, AlgoTag);
0033 };
0034 
0035 template <
0036     typename Geometry,
0037     typename Indexable,
0038     typename IndexableTag,
0039     typename AlgoTag,
0040     size_t N>
0041 struct sum_for_indexable
0042 {
0043     typedef typename sum_for_indexable_dimension<
0044         Geometry, Indexable, IndexableTag, AlgoTag, N - 1
0045     >::result_type result_type;
0046 
0047     inline static result_type apply(Geometry const& g, Indexable const& i)
0048     {
0049         return
0050             sum_for_indexable<
0051                 Geometry, Indexable, IndexableTag, AlgoTag, N - 1
0052             >::apply(g, i) +
0053             sum_for_indexable_dimension<
0054                 Geometry, Indexable, IndexableTag, AlgoTag, N - 1
0055             >::apply(g, i);
0056     }
0057 };
0058 
0059 template <
0060     typename Geometry,
0061     typename Indexable,
0062     typename IndexableTag,
0063     typename AlgoTag>
0064 struct sum_for_indexable<Geometry, Indexable, IndexableTag, AlgoTag, 1>
0065 {
0066     typedef typename sum_for_indexable_dimension<
0067         Geometry, Indexable, IndexableTag, AlgoTag, 0
0068     >::result_type result_type;
0069 
0070     inline static result_type apply(Geometry const& g, Indexable const& i)
0071     {
0072         return
0073             sum_for_indexable_dimension<
0074                 Geometry, Indexable, IndexableTag, AlgoTag, 0
0075             >::apply(g, i);
0076     }
0077 };
0078 
0079 }}}} // namespace boost::geometry::index::detail
0080 
0081 #endif // BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_SUM_FOR_INDEXABLE_HPP