Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // Boost.Geometry Index
0002 //
0003 // Query range adaptor
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_ADAPTORS_QUERY_HPP
0016 #define BOOST_GEOMETRY_INDEX_ADAPTORS_QUERY_HPP
0017 
0018 #include <boost/geometry/core/static_assert.hpp>
0019 
0020 /*!
0021 \defgroup adaptors Adaptors (boost::geometry::index::adaptors::)
0022 */
0023 
0024 namespace boost { namespace geometry { namespace index {
0025 
0026 namespace adaptors {
0027 
0028 namespace detail {
0029 
0030 template <typename Index>
0031 class query_range
0032 {
0033     BOOST_GEOMETRY_STATIC_ASSERT_FALSE(
0034         "Not implemented for this Index type.",
0035         Index);
0036 
0037     typedef int* iterator;
0038     typedef const int* const_iterator;
0039 
0040     template <typename Predicates>
0041     inline query_range(
0042         Index const&,
0043         Predicates const&)
0044     {}
0045 
0046     inline iterator begin() { return 0; }
0047     inline iterator end() { return 0; }
0048     inline const_iterator begin() const { return 0; }
0049     inline const_iterator end() const { return 0; }
0050 };
0051 
0052 // TODO: awulkiew - consider removing reference from predicates
0053 
0054 template<typename Predicates>
0055 struct query
0056 {
0057     inline explicit query(Predicates const& pred)
0058         : predicates(pred)
0059     {}
0060 
0061     Predicates const& predicates;
0062 };
0063 
0064 template<typename Index, typename Predicates>
0065 index::adaptors::detail::query_range<Index>
0066 operator|(
0067     Index const& si,
0068     index::adaptors::detail::query<Predicates> const& f)
0069 {
0070     return index::adaptors::detail::query_range<Index>(si, f.predicates);
0071 }
0072 
0073 } // namespace detail
0074 
0075 /*!
0076 \brief The query index adaptor generator.
0077 
0078 \ingroup adaptors
0079 
0080 \param pred   Predicates.
0081 */
0082 template <typename Predicates>
0083 detail::query<Predicates>
0084 queried(Predicates const& pred)
0085 {
0086     return detail::query<Predicates>(pred);
0087 }
0088 
0089 } // namespace adaptors
0090 
0091 }}} // namespace boost::geometry::index
0092 
0093 #endif // BOOST_GEOMETRY_INDEX_ADAPTORS_QUERY_HPP