File indexing completed on 2025-01-18 09:35:29
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015 #ifndef BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_SUBTREE_DESTROYED_HPP
0016 #define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_SUBTREE_DESTROYED_HPP
0017
0018 #include <boost/geometry/index/detail/rtree/visitors/destroy.hpp>
0019
0020 namespace boost { namespace geometry { namespace index {
0021
0022 namespace detail { namespace rtree {
0023
0024 template <typename MembersHolder>
0025 class subtree_destroyer
0026 {
0027 typedef typename MembersHolder::node node;
0028
0029 typedef typename MembersHolder::allocators_type allocators_type;
0030 typedef typename MembersHolder::node_pointer pointer;
0031
0032 subtree_destroyer(subtree_destroyer const&);
0033 subtree_destroyer & operator=(subtree_destroyer const&);
0034
0035 public:
0036 subtree_destroyer(pointer ptr, allocators_type & allocators)
0037 : m_ptr(ptr)
0038 , m_allocators(allocators)
0039 {}
0040
0041 ~subtree_destroyer()
0042 {
0043 reset();
0044 }
0045
0046 void reset(pointer ptr = 0)
0047 {
0048 if ( m_ptr && m_ptr != ptr )
0049 {
0050 detail::rtree::visitors::destroy<MembersHolder>::apply(m_ptr, m_allocators);
0051 }
0052 m_ptr = ptr;
0053 }
0054
0055 void release()
0056 {
0057 m_ptr = 0;
0058 }
0059
0060 pointer get() const
0061 {
0062 return m_ptr;
0063 }
0064
0065 node & operator*() const
0066 {
0067 return *m_ptr;
0068 }
0069
0070 pointer operator->() const
0071 {
0072 return m_ptr;
0073 }
0074
0075 private:
0076 pointer m_ptr;
0077 allocators_type & m_allocators;
0078 };
0079
0080 }}
0081
0082 }}}
0083
0084 #endif