FOUND Coverage Report


src/
File: distance/edge-filters.hpp
Date: 2025-11-20 21:57:26
Lines:
15/15
100.0%
Functions:
6/6
100.0%
Branches:
7/7
100.0%

Line Branch Exec Source
1 #ifndef SRC_DISTANCE_EDGE_FILTERS_HPP_
2 #define SRC_DISTANCE_EDGE_FILTERS_HPP_
3
4 #include <memory>
5 #include <optional>
6 #include <utility>
7
8 #include "command-line/parsing/options.hpp"
9 #include "common/pipeline/pipelines.hpp"
10 #include "distance/edge.hpp"
11 #include "providers/stage-providers.hpp"
12
13 namespace found {
14
15
16 typedef ModifyingPipeline<Points> EdgeFilteringAlgorithms;
17
18 /**
19 * Abstract superclass for edge-filtering algorithms.
20 * modifies Points in-place (ModifyingStage<Points>).
21 */
22 class EdgeFilteringAlgorithm : public ModifyingStage<Points> {
23 public:
24 1 EdgeFilteringAlgorithm() = default;
25 2 virtual ~EdgeFilteringAlgorithm() = default;
26 };
27
28 /**
29 * NoOpEdgeFilter
30 *
31 * A ModifyingStage implementation that performs no modifications
32 * to the Points. This exists to provide a valid stage instance that can be
33 * used by providers when a no-op filter is requested. This will not be needed
34 * once an EdgeFilteringAlgorithm is implemented.
35 */
36 class NoOpEdgeFilter : public ModifyingStage<Points> {
37 public:
38 1 NoOpEdgeFilter() = default;
39 4 ~NoOpEdgeFilter() override = default;
40
41 /**
42 * Run
43 *
44 * No-op filter: intentionally does not modify the provided points.
45 *
46 * @param pts The Points to (not) modify.
47 */
48 1 void Run(Points &pts) override {
49 // intentionally no-op
50 (void)pts;
51 1 }
52 };
53
54 /**
55 * Options-aware provider. Constructs a pipeline containing all filters
56 * that are enabled in options and returns it. If no filter is enabled,
57 * returns nullptr to indicate "no filters".
58 */
59 9 inline std::unique_ptr<EdgeFilteringAlgorithms> ProvideEdgeFilteringAlgorithm(const DistanceOptions &options) {
60
1/1
✓ Branch 2 taken 9 times.
9 std::unique_ptr<EdgeFilteringAlgorithms> pipeline = std::make_unique<EdgeFilteringAlgorithms>();
61 9 bool added = false;
62
63
2/2
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 8 times.
9 if (options.enableNoOpEdgeFilter) {
64
2/2
✓ Branch 4 taken 1 times.
✓ Branch 8 taken 1 times.
1 pipeline->Complete(std::make_unique<NoOpEdgeFilter>());
65 1 added = true;
66 }
67
68
2/2
✓ Branch 0 taken 8 times.
✓ Branch 1 taken 1 times.
9 if (!added) return nullptr;
69 1 return pipeline;
70 9 }
71
72 } // namespace found
73
74 #endif // SRC_DISTANCE_EDGE_FILTERS_HPP_
75