Ponca  bab7704293a2c36e5bed9dea40def7ba839bfe08
Point Cloud Analysis library
Loading...
Searching...
No Matches
kdTreeRangeIterator.h
1/*
2 This Source Code Form is subject to the terms of the Mozilla Public
3 License, v. 2.0. If a copy of the MPL was not distributed with this
4 file, You can obtain one at http://mozilla.org/MPL/2.0/.
5*/
6
7#pragma once
8
9#include <cstddef>
10
11namespace Ponca
12{
13
29 template <typename Index, typename DataPoint, typename QueryT_>
31 {
32 protected:
33 friend QueryT_;
34
35 public:
36 using iterator_category = std::input_iterator_tag;
37 using difference_type = std::ptrdiff_t;
38 using value_type = Index;
39 using pointer = Index*;
40 using reference = const Index&;
41
42 using Scalar = typename DataPoint::Scalar;
43 using QueryType = QueryT_;
44
45 PONCA_MULTIARCH inline KdTreeRangeIterator() = default;
46 PONCA_MULTIARCH inline KdTreeRangeIterator(QueryType* query, Index index = -1)
47 : m_query(query), m_index(index), m_start(0), m_end(0)
48 {
49 }
50
52 PONCA_MULTIARCH inline bool operator!=(const KdTreeRangeIterator& other) const
53 {
54 return m_index != other.m_index;
55 }
56
58 PONCA_MULTIARCH inline bool operator==(const KdTreeRangeIterator& other) const
59 {
60 return m_index == other.m_index;
61 }
62
65 PONCA_MULTIARCH inline KdTreeRangeIterator& operator++()
66 {
67 m_query->advance(*this);
68 return *this;
69 }
70
73 PONCA_MULTIARCH inline KdTreeRangeIterator operator++(int)
74 {
75 KdTreeRangeIterator tmp = *this;
76 m_query->advance(*this);
77 return tmp;
78 }
79
81 PONCA_MULTIARCH inline reference operator*() const { return const_cast<reference>(m_index); }
82
83 protected:
84 QueryType* m_query{nullptr};
85 Index m_index{-1};
86 Index m_start{0};
87 Index m_end{0};
88 };
89} // namespace Ponca
Input iterator to read the KdTreeRangeQueryBase object.
bool operator!=(const KdTreeRangeIterator &other) const
Inequality operand.
reference operator*() const
Dereference operator.
KdTreeRangeIterator operator++(int)
Postfix increment.
bool operator==(const KdTreeRangeIterator &other) const
Equality operand.
KdTreeRangeIterator & operator++()
Prefix increment.
This Source Code Form is subject to the terms of the Mozilla Public License, v.