Ponca  03745f3c84c0c8d40cec269af63efe7d3cf77f30
Point Cloud Analysis library
Loading...
Searching...
No Matches
neighborGraphRangeIterator.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
9namespace Ponca
10{
11 template <typename Traits>
12 class NeighborGraphRangeQuery;
13
28 template <typename _NeighborGraph>
30 {
31 protected:
32 using NeighborGraph = _NeighborGraph;
33 using Traits = typename NeighborGraph::Traits;
34 friend class NeighborGraphRangeQuery<NeighborGraph>;
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
47 Index index = Index(-1))
48 : m_query(query), m_index(index)
49 {
50 }
51
52 public:
54 PONCA_MULTIARCH bool operator!=(const NeighborGraphRangeIterator& other) const
55 {
56 return m_index != other.m_index;
57 }
58
60 PONCA_MULTIARCH bool operator==(const NeighborGraphRangeIterator& other) const
61 {
62 return m_index == other.m_index;
63 }
64
66 PONCA_MULTIARCH inline NeighborGraphRangeIterator& operator++()
67 {
68 m_query->advance(*this);
69 return *this;
70 }
71
73 PONCA_MULTIARCH inline void operator++(value_type) { ++*this; }
74
76 PONCA_MULTIARCH inline reference operator*() const { return const_cast<reference>(m_index); }
77
78 protected:
80 value_type m_index{-1};
81 };
82
83} // namespace Ponca
Aggregator class used to declare specialized structures using CRTP.
Definition basket.h:283
Input iterator to read the NeighborGraphRangeQuery object.
NeighborGraphRangeIterator & operator++()
Prefix increment.
bool operator==(const NeighborGraphRangeIterator &other) const
Equality operand.
void operator++(value_type)
Postfix increment.
bool operator!=(const NeighborGraphRangeIterator &other) const
Inequality operand.
reference operator*() const
Dereference operator.
Extension of the Query class that allows to read the result of a range neighbor search on the KnnGrap...
void advance(Iterator &iterator)
Helper function for the NeighborGraphRangeIterator that advances the range neighbors search using the...
This Source Code Form is subject to the terms of the Mozilla Public License, v.
Definition concepts.h:11