Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/boost/geometry/views/closeable_view.hpp was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 // Boost.Geometry (aka GGL, Generic Geometry Library)
0002 
0003 // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
0004 // Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
0005 // Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
0006 
0007 // This file was modified by Oracle on 2020-2023.
0008 // Modifications copyright (c) 2020-2023 Oracle and/or its affiliates.
0009 // Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
0010 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
0011 
0012 // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
0013 // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
0014 
0015 // Use, modification and distribution is subject to the Boost Software License,
0016 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
0017 // http://www.boost.org/LICENSE_1_0.txt)
0018 
0019 #ifndef BOOST_GEOMETRY_VIEWS_CLOSEABLE_VIEW_HPP
0020 #define BOOST_GEOMETRY_VIEWS_CLOSEABLE_VIEW_HPP
0021 
0022 #include <boost/geometry/core/closure.hpp>
0023 #include <boost/geometry/core/point_order.hpp>
0024 #include <boost/geometry/core/ring_type.hpp>
0025 #include <boost/geometry/core/tag.hpp>
0026 #include <boost/geometry/core/tags.hpp>
0027 #include <boost/geometry/iterators/closing_iterator.hpp>
0028 
0029 #include <boost/geometry/views/identity_view.hpp>
0030 
0031 namespace boost { namespace geometry
0032 {
0033 
0034 
0035 #ifndef DOXYGEN_NO_DETAIL
0036 namespace detail
0037 {
0038 
0039 template <typename Range>
0040 struct closing_view
0041 {
0042     using iterator = closing_iterator<Range const>;
0043     using const_iterator = closing_iterator<Range const>;
0044 
0045     // Keep this explicit, important for nested views/ranges
0046     explicit inline closing_view(Range const& r)
0047         : m_begin(r)
0048         , m_end(r, true)
0049     {}
0050 
0051     inline const_iterator begin() const { return m_begin; }
0052     inline const_iterator end() const { return m_end; }
0053 
0054 private:
0055     const_iterator m_begin;
0056     const_iterator m_end;
0057 };
0058 
0059 
0060 template
0061 <
0062     typename Range,
0063     closure_selector Close = geometry::closure<Range>::value
0064 >
0065 struct closed_view
0066     : identity_view<Range>
0067 {
0068     explicit inline closed_view(Range const& r)
0069         : identity_view<Range const>(r)
0070     {}
0071 };
0072 
0073 template <typename Range>
0074 struct closed_view<Range, open>
0075     : closing_view<Range>
0076 {
0077     explicit inline closed_view(Range const& r)
0078         : closing_view<Range const>(r)
0079     {}
0080 };
0081 
0082 
0083 } // namespace detail
0084 #endif // DOXYGEN_NO_DETAIL
0085 
0086 
0087 /*!
0088 \brief View on a range, either closing it or leaving it as it is
0089 \details The closeable_view is used internally by the library to handle all rings,
0090     either closed or open, the same way. The default method is closed, all
0091     algorithms process rings as if they are closed. Therefore, if they are opened,
0092     a view is created which closes them.
0093     The closeable_view might be used by library users, but its main purpose is
0094     internally.
0095 \tparam Range Original range
0096 \tparam Close Specifies if it the range is closed, if so, nothing will happen.
0097     If it is open, it will iterate the first point after the last point.
0098 \ingroup views
0099 */
0100 template <typename Range, closure_selector Close>
0101 struct closeable_view {};
0102 
0103 
0104 #ifndef DOXYGEN_NO_SPECIALIZATIONS
0105 
0106 template <typename Range>
0107 struct closeable_view<Range, closed>
0108 {
0109     using type = identity_view<Range>;
0110 };
0111 
0112 
0113 template <typename Range>
0114 struct closeable_view<Range, open>
0115 {
0116     using type = detail::closing_view<Range>;
0117 };
0118 
0119 #endif // DOXYGEN_NO_SPECIALIZATIONS
0120 
0121 
0122 #ifndef DOXYGEN_NO_TRAITS_SPECIALIZATIONS
0123 namespace traits
0124 {
0125 
0126 
0127 template <typename Range, closure_selector Close>
0128 struct tag<geometry::detail::closed_view<Range, Close> >
0129     : geometry::tag<Range>
0130 {};
0131 
0132 template <typename Range, closure_selector Close>
0133 struct point_order<geometry::detail::closed_view<Range, Close> >
0134     : geometry::point_order<Range>
0135 {};
0136 
0137 template <typename Range, closure_selector Close>
0138 struct closure<geometry::detail::closed_view<Range, Close> >
0139 {
0140     static const closure_selector value = closed;
0141 };
0142 
0143 
0144 } // namespace traits
0145 #endif // DOXYGEN_NO_TRAITS_SPECIALIZATIONS
0146 
0147 
0148 }} // namespace boost::geometry
0149 
0150 
0151 #endif // BOOST_GEOMETRY_VIEWS_CLOSEABLE_VIEW_HPP