Ponca  cb266528645085a12930c827fbb8336cd937ecbb
Point Cloud Analysis library
Loading...
Searching...
No Matches
compute.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 "defines.h"
10#include PONCA_MULTIARCH_INCLUDE_STD(iterator)
11
12namespace Ponca
13{
22 template <typename Derived>
24 {
25 protected:
28 PONCA_MULTIARCH Derived& derived() { return static_cast<Derived&>(*this); }
29
30 public:
31#ifdef PONCA_CPU_ARCH
38 template <typename Container>
39 [[nodiscard]] FIT_RESULT compute(const Container& c)
40 {
41 return derived().compute(std::begin(c), std::end(c));
42 }
43#endif
44
49 template <typename IteratorBegin, typename IteratorEnd>
50 PONCA_MULTIARCH [[nodiscard]] inline FIT_RESULT compute(const IteratorBegin& /*begin*/,
51 const IteratorEnd& /*end*/)
52 {
53 return UNDEFINED;
54 };
55
61 template <typename IndexRange, typename PointContainer>
62 PONCA_MULTIARCH [[nodiscard]] inline FIT_RESULT computeWithIds(IndexRange /*ids*/,
63 const PointContainer& /*points*/)
64 {
65 return UNDEFINED;
66 };
67 }; // struct ComputeObject
68} // namespace Ponca
69
This Source Code Form is subject to the terms of the Mozilla Public License, v.
Definition concepts.h:11
FIT_RESULT
Enum corresponding to the state of a fitting method (and what the finalize function returns).
Definition enums.h:15
@ UNDEFINED
The fitting is undefined, you can't use it for valid results.
Definition enums.h:22
ComputeObject is a virtual object that represents an algorithm which can be used with the compute fun...
Definition compute.h:24
FIT_RESULT computeWithIds(IndexRange, const PointContainer &)
Convenience function to iterate over a subset of samples in a PointContainer.
Definition compute.h:62
FIT_RESULT compute(const Container &c)
Convenience function for STL-like container.
Definition compute.h:39
Derived & derived()
Retrieve the top layer object Returns a reference to the derived class so that we can use its overwri...
Definition compute.h:28
FIT_RESULT compute(const IteratorBegin &, const IteratorEnd &)
Convenience function for STL-like iterators.
Definition compute.h:50