Ponca  84886bac0b52a686e88046a375da13f12f2b87d2
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 <iterator>
10#include <cstddef>
11
12namespace Ponca {
13
29template<typename Index, typename DataPoint, typename QueryT_>
31{
32protected:
33 friend QueryT_;
34
35public:
36 using iterator_category = PONCA_MULTIARCH_CU_STD_NAMESPACE(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 inline KdTreeRangeIterator() = default;
46 inline KdTreeRangeIterator(QueryType* query, Index index = -1) :
47 m_query(query), m_index(index), m_start(0), m_end(0) {}
48
50 inline bool operator !=(const KdTreeRangeIterator& other) const {
51 return m_index != other.m_index;
52 }
53
55 inline bool operator ==(const KdTreeRangeIterator& other) const {
56 return m_index == other.m_index;
57 }
58
62 m_query->advance(*this);
63 return *this;
64 }
65
69 KdTreeRangeIterator tmp = *this;
70 m_query->advance(*this);
71 return tmp;
72 }
73
75 inline reference operator *() const {
76 return const_cast<reference>(m_index);
77 }
78
79protected:
80 QueryType* m_query {nullptr};
81 Index m_index {-1};
82 Index m_start {0};
83 Index m_end {0};
84};
85} // 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.