Ponca  7df32c91629c89b89840c4d7917cb272433f2d2b
Point Cloud Analysis library
Loading...
Searching...
No Matches
knnGraphRangeIterator.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 template <typename Traits>
14 class KnnGraphRangeQuery;
15
30 template <typename Traits>
32 {
33 protected:
34 friend class KnnGraphRangeQuery<Traits>;
35 using Index = typename Traits::IndexType;
36
37 public:
38 // Tagged as an input iterator, because the increment logic is shared between iterators of the same queries.
39 // Which makes the iterator not valid when duplicated (through postfix increment for example).
40 using iterator_category = std::input_iterator_tag;
41 using difference_type = std::ptrdiff_t;
42 using value_type = Index;
43 using pointer = Index*;
44 using reference = const Index&;
45
46 PONCA_MULTIARCH inline KnnGraphRangeIterator(KnnGraphRangeQuery<Traits>* query, Index index = Index(-1))
47 : m_query(query), m_index(index)
48 {
49 }
50
51 public:
53 PONCA_MULTIARCH bool operator!=(const KnnGraphRangeIterator& other) const { return m_index != other.m_index; }
54
56 PONCA_MULTIARCH bool operator==(const KnnGraphRangeIterator& other) const { return m_index == other.m_index; }
57
59 PONCA_MULTIARCH inline KnnGraphRangeIterator& operator++()
60 {
61 m_query->advance(*this);
62 return *this;
63 }
64
66 PONCA_MULTIARCH inline void operator++(value_type) { ++*this; }
67
69 PONCA_MULTIARCH inline reference operator*() const { return const_cast<reference>(m_index); }
70
71 protected:
72 KnnGraphRangeQuery<Traits>* m_query{nullptr};
73 value_type m_index{-1};
74 };
75
76} // namespace Ponca
Aggregator class used to declare specialized structures using CRTP.
Definition basket.h:257
Input iterator to read the KnnGraphRangeQuery object.
bool operator!=(const KnnGraphRangeIterator &other) const
Inequality operand.
KnnGraphRangeIterator & operator++()
Prefix increment.
reference operator*() const
Dereference operator.
void operator++(value_type)
Postfix increment.
bool operator==(const KnnGraphRangeIterator &other) const
Equality operand.
Extension of the Query class that allows to read the result of a range neighbor search on the KnnGrap...
This Source Code Form is subject to the terms of the Mozilla Public License, v.
Definition bitset.h:17