Ponca  a6685bea814e743eaa6c9284aa218d7d97a6527c
Point Cloud Analysis library
Loading...
Searching...
No Matches
neighborGraphOneConnectedIterator.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
11namespace Ponca
12{
13
25 template <typename ContainerPtr, typename Index>
27 {
28 public:
29 using iterator_category = std::input_iterator_tag;
30 using difference_type = std::ptrdiff_t;
31 using value_type = Index;
32 using pointer = ContainerPtr;
33 using reference = const Index&;
35
36 PONCA_MULTIARCH NeighborGraphOneConnectedIterator(ContainerPtr data) : m_data(data) {}
37
38 PONCA_MULTIARCH NeighborGraphOneConnectedIterator(ContainerPtr data, Index i) : m_data(data), m_i(i) {}
39
41 PONCA_MULTIARCH bool operator!=(const NeighborGraphOneConnectedIterator& other) const
42 {
43 return m_i != other.m_i;
44 }
45
47 PONCA_MULTIARCH bool operator==(const NeighborGraphOneConnectedIterator& other) const
48 {
49 return m_i == other.m_i;
50 }
51
54 {
55 ++m_i;
56 return *this;
57 }
58
60 PONCA_MULTIARCH reference operator*() const { return m_data[m_i]; }
61
63 PONCA_MULTIARCH inline Self operator++(Index)
64 {
65 Self tmp = *this;
66 ++m_i;
67 return tmp;
68 }
69
71 PONCA_MULTIARCH inline void operator+=(const Index i) { m_i += i; }
72
74 PONCA_MULTIARCH inline Self operator+(const Index i) { return Self(m_data, m_i + i); }
75
76 protected:
77 ContainerPtr m_data;
78 Index m_i{0};
79 };
80} // namespace Ponca
Aggregator class used to declare specialized structures using CRTP.
Definition basket.h:283
Base iterator class for NeighborGraphOneConnectedQuery.
bool operator==(const NeighborGraphOneConnectedIterator &other) const
Equality operand.
bool operator!=(const NeighborGraphOneConnectedIterator &other) const
Inequality operand.
NeighborGraphOneConnectedIterator & operator++()
Equality operand.
This Source Code Form is subject to the terms of the Mozilla Public License, v.
Definition concepts.h:11