Boost.Geometry.Index
/home/travis/build/boostorg/boost/boost/geometry/index/adaptors/query.hpp
00001 // Boost.Geometry Index
00002 //
00003 // Query range adaptor
00004 //
00005 // Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland.
00006 //
00007 // Use, modification and distribution is subject to the Boost Software License,
00008 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
00009 // http://www.boost.org/LICENSE_1_0.txt)
00010 
00011 #ifndef BOOST_GEOMETRY_INDEX_ADAPTORS_QUERY_HPP
00012 #define BOOST_GEOMETRY_INDEX_ADAPTORS_QUERY_HPP
00013 
00018 namespace boost { namespace geometry { namespace index {
00019 
00020 namespace adaptors {
00021 
00022 namespace detail {
00023 
00024 template <typename Index>
00025 class query_range
00026 {
00027     BOOST_MPL_ASSERT_MSG(
00028         (false),
00029         NOT_IMPLEMENTED_FOR_THIS_INDEX,
00030         (query_range));
00031 
00032     typedef int* iterator;
00033     typedef const int* const_iterator;
00034 
00035     template <typename Predicates>
00036     inline query_range(
00037         Index const&,
00038         Predicates const&)
00039     {}
00040 
00041     inline iterator begin() { return 0; }
00042     inline iterator end() { return 0; }
00043     inline const_iterator begin() const { return 0; }
00044     inline const_iterator end() const { return 0; }
00045 };
00046 
00047 // TODO: awulkiew - consider removing reference from predicates
00048 
00049 template<typename Predicates>
00050 struct query
00051 {
00052     inline explicit query(Predicates const& pred)
00053         : predicates(pred)
00054     {}
00055 
00056     Predicates const& predicates;
00057 };
00058 
00059 template<typename Index, typename Predicates>
00060 index::adaptors::detail::query_range<Index>
00061 operator|(
00062     Index const& si,
00063     index::adaptors::detail::query<Predicates> const& f)
00064 {
00065     return index::adaptors::detail::query_range<Index>(si, f.predicates);
00066 }
00067 
00068 } // namespace detail
00069 
00077 template <typename Predicates>
00078 detail::query<Predicates>
00079 queried(Predicates const& pred)
00080 {
00081     return detail::query<Predicates>(pred);
00082 }
00083 
00084 } // namespace adaptors
00085 
00086 }}} // namespace boost::geometry::index
00087 
00088 #endif // BOOST_GEOMETRY_INDEX_ADAPTORS_QUERY_HPP
 All Classes Functions Typedefs