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 // Get smallest value calculated for indexable's dimensions, used 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_SMALLEST_FOR_INDEXABLE_HPP
0016 #define BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_SMALLEST_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 smallest_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 smallest_for_indexable
0042 {
0043     typedef typename smallest_for_indexable_dimension<
0044         Geometry, Indexable, IndexableTag, AlgoTag, N - 1
0045     >::result_type result_type;
0046 
0047     template <typename Data>
0048     inline static result_type apply(Geometry const& g, Indexable const& i, Data const& data)
0049     {
0050         result_type r1 = smallest_for_indexable<
0051             Geometry, Indexable, IndexableTag, AlgoTag, N - 1
0052         >::apply(g, i, data);
0053 
0054         result_type r2 = smallest_for_indexable_dimension<
0055             Geometry, Indexable, IndexableTag, AlgoTag, N - 1
0056         >::apply(g, i, data);
0057 
0058         return r1 < r2 ? r1 : r2;
0059     }
0060 };
0061 
0062 template <
0063     typename Geometry,
0064     typename Indexable,
0065     typename IndexableTag,
0066     typename AlgoTag>
0067 struct smallest_for_indexable<Geometry, Indexable, IndexableTag, AlgoTag, 1>
0068 {
0069     typedef typename smallest_for_indexable_dimension<
0070         Geometry, Indexable, IndexableTag, AlgoTag, 0
0071     >::result_type result_type;
0072 
0073     template <typename Data>
0074     inline static result_type apply(Geometry const& g, Indexable const& i, Data const& data)
0075     {
0076         return
0077             smallest_for_indexable_dimension<
0078                 Geometry, Indexable, IndexableTag, AlgoTag, 0
0079             >::apply(g, i, data);
0080     }
0081 };
0082 
0083 }}}} // namespace boost::geometry::index::detail
0084 
0085 #endif // BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_SMALLEST_FOR_INDEXABLE_HPP