Ponca  7d8ac87a7de01d881c9fde3c42e397b44bffb901
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>
40 {
41 return derived().compute(std::begin(c), std::end(c));
42 }
43#endif
44
49 template <typename IteratorBegin, typename IteratorEnd>
50 PONCA_MULTIARCH inline FIT_RESULT compute(const IteratorBegin& /*begin*/, const IteratorEnd& /*end*/)
51 {
52 return UNDEFINED;
53 };
54
60 template <typename IndexRange, typename PointContainer>
61 PONCA_MULTIARCH inline FIT_RESULT computeWithIds(IndexRange /*ids*/, const PointContainer& /*points*/)
62 {
63 return UNDEFINED;
64 };
65 }; // struct ComputeObject
66
67} // namespace Ponca
68
Aggregator class used to declare specialized structures using CRTP.
Definition basket.h:318
This Source Code Form is subject to the terms of the Mozilla Public License, v.
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:61
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