Ponca  80e34c4ed3322bafe25349c3ea7523ca4a3aa60d
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{
20 template <typename Derived>
22 protected:
25 Derived& derived() { return static_cast<Derived&>(*this); }
26 public:
27
28#ifdef PONCA_CPU_ARCH
35 template <typename Container>
36 FIT_RESULT compute(const Container& c) {
37 return derived().compute(std::begin(c), std::end(c));
38 }
39#endif
40
45 template <typename IteratorBegin, typename IteratorEnd>
46 PONCA_MULTIARCH inline FIT_RESULT compute(const IteratorBegin& /*begin*/, const IteratorEnd& /*end*/) {
47 return UNDEFINED;
48 };
49
55 template <typename IndexRange, typename PointContainer>
56 PONCA_MULTIARCH inline FIT_RESULT computeWithIds(IndexRange /*ids*/, const PointContainer& /*points*/) {
57 return UNDEFINED;
58 };
59 }; // struct ComputeObject
60
61}
62
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:21
FIT_RESULT computeWithIds(IndexRange, const PointContainer &)
Convenience function to iterate over a subset of samples in a PointContainer.
Definition compute.h:56
FIT_RESULT compute(const Container &c)
Convenience function for STL-like container.
Definition compute.h:36
Derived & derived()
Retrieve the top layer object Returns a reference to the derived class so that we can use its overwri...
Definition compute.h:25
FIT_RESULT compute(const IteratorBegin &, const IteratorEnd &)
Convenience function for STL-like iterators.
Definition compute.h:46