Ponca  7df32c91629c89b89840c4d7917cb272433f2d2b
Point Cloud Analysis library
Loading...
Searching...
No Matches
knnGraphKNearestIterator.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 "../../indexSquaredDistance.h"
10#include <cstddef>
11
12namespace Ponca
13{
14
29 template <typename ContainerPtr, typename Index>
31 {
32 public:
33 using iterator_category = std::input_iterator_tag;
34 using difference_type = std::ptrdiff_t;
35 using value_type = Index;
36 using pointer = ContainerPtr;
37 using reference = const Index&;
39
40 PONCA_MULTIARCH KnnGraphKNearestIterator(ContainerPtr data) : m_data(data) {}
41
42 PONCA_MULTIARCH KnnGraphKNearestIterator(ContainerPtr data, Index i) : m_data(data), m_i(i) {}
43
45 PONCA_MULTIARCH bool operator!=(const KnnGraphKNearestIterator& other) const { return m_i != other.m_i; }
46
48 PONCA_MULTIARCH bool operator==(const KnnGraphKNearestIterator& other) const { return m_i == other.m_i; }
49
52 {
53 ++m_i;
54 return *this;
55 }
56
58 PONCA_MULTIARCH reference operator*() const { return m_data[m_i]; }
59
61 PONCA_MULTIARCH inline Self operator++(Index)
62 {
63 Self tmp = *this;
64 ++m_i;
65 return tmp;
66 }
67
69 PONCA_MULTIARCH inline void operator+=(const Index i) { m_i += i; }
70
72 PONCA_MULTIARCH inline Self operator+(const Index i) { return Self(m_data, m_i + i); }
73
74 protected:
75 ContainerPtr m_data;
76 Index m_i{0};
77 };
78} // namespace Ponca
Aggregator class used to declare specialized structures using CRTP.
Definition basket.h:257
Input iterator to read the KnnGraphKNearestQueryBase object.
void operator+=(const Index i)
Value increment.
KnnGraphKNearestIterator & operator++()
Equality operand.
Self operator+(const Index i)
Plus operator.
Self operator++(Index)
Postfix increment.
reference operator*() const
Dereference operator.
bool operator!=(const KnnGraphKNearestIterator &other) const
Inequality operand.
bool operator==(const KnnGraphKNearestIterator &other) const
Equality operand.
This Source Code Form is subject to the terms of the Mozilla Public License, v.
Definition bitset.h:17