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