Ponca  93eea5457c48839cb5d16642765afa89fc7cfe66
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
28template<typename Index, typename DataPoint, typename QueryT_>
30{
31protected:
32 friend QueryT_;
33
34public:
35 using iterator_category = std::input_iterator_tag;
36 using difference_type = std::ptrdiff_t;
37 using value_type = Index;
38 using pointer = Index*;
39 using reference = const Index&;
40
41 using Scalar = typename DataPoint::Scalar;
42 using QueryType = QueryT_;
43
44 PONCA_MULTIARCH inline KdTreeRangeIterator() = default;
45 PONCA_MULTIARCH inline KdTreeRangeIterator(QueryType* query, Index index = -1) :
46 m_query(query), m_index(index), m_start(0), m_end(0) {}
47
49 PONCA_MULTIARCH inline bool operator !=(const KdTreeRangeIterator& other) const {
50 return m_index != other.m_index;
51 }
52
54 PONCA_MULTIARCH inline bool operator ==(const KdTreeRangeIterator& other) const {
55 return m_index == other.m_index;
56 }
57
60 PONCA_MULTIARCH inline KdTreeRangeIterator& operator++() {
61 m_query->advance(*this);
62 return *this;
63 }
64
67 PONCA_MULTIARCH inline KdTreeRangeIterator operator++(int) {
68 KdTreeRangeIterator tmp = *this;
69 m_query->advance(*this);
70 return tmp;
71 }
72
74 PONCA_MULTIARCH inline reference operator *() const {
75 return const_cast<reference>(m_index);
76 }
77
78protected:
79 QueryType* m_query {nullptr};
80 Index m_index {-1};
81 Index m_start {0};
82 Index m_end {0};
83};
84} // 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.