| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #ifndef SRC_COMMAND_LINE_EXECUTION_EXECUTORS_HPP_ | ||
| 2 | #define SRC_COMMAND_LINE_EXECUTION_EXECUTORS_HPP_ | ||
| 3 | |||
| 4 | #include <memory> | ||
| 5 | |||
| 6 | #include "common/pipeline/pipelines.hpp" | ||
| 7 | #include "command-line/parsing/options.hpp" | ||
| 8 | #include "common/style.hpp" | ||
| 9 | |||
| 10 | #include "calibrate/calibrate.hpp" | ||
| 11 | |||
| 12 | #include "distance/edge.hpp" | ||
| 13 | #include "distance/distance.hpp" | ||
| 14 | #include "distance/vectorize.hpp" | ||
| 15 | #include "distance/edge-filters.hpp" | ||
| 16 | |||
| 17 | #include "orbit/orbit.hpp" | ||
| 18 | |||
| 19 | namespace found { | ||
| 20 | |||
| 21 | /** | ||
| 22 | * PipelineExecutor is an interface for classes | ||
| 23 | * that execute complex pipelines. | ||
| 24 | */ | ||
| 25 | class PipelineExecutor { | ||
| 26 | public: | ||
| 27 | /// Destroys this | ||
| 28 | 48 | virtual ~PipelineExecutor() = default; | |
| 29 | /** | ||
| 30 | * Executes the relavent Pipeline | ||
| 31 | */ | ||
| 32 | virtual void ExecutePipeline() = 0; | ||
| 33 | /** | ||
| 34 | * Outputs the results of the Pipeline | ||
| 35 | * in some format | ||
| 36 | */ | ||
| 37 | virtual void OutputResults() = 0; | ||
| 38 | }; | ||
| 39 | |||
| 40 | /** | ||
| 41 | * CalibrationPipelineExecutor is the pipeline | ||
| 42 | * executor for the calibration pipeline. | ||
| 43 | */ | ||
| 44 | class CalibrationPipelineExecutor : public PipelineExecutor { | ||
| 45 | public: | ||
| 46 | /** | ||
| 47 | * Constructs a CalibrationPipelineExecutor | ||
| 48 | * | ||
| 49 | * @param options The options to create the pipeline | ||
| 50 | * @param calibrationAlgorithm The calibration algorithm to use | ||
| 51 | */ | ||
| 52 | explicit CalibrationPipelineExecutor(CalibrationOptions &&options, | ||
| 53 | std::unique_ptr<CalibrationAlgorithm> calibrationAlgorithm); | ||
| 54 | |||
| 55 | void ExecutePipeline() override; | ||
| 56 | void OutputResults() override; | ||
| 57 | |||
| 58 | private: | ||
| 59 | /// The Calibration options being used | ||
| 60 | const CalibrationOptions options_; | ||
| 61 | /// The Calibration pipeline | ||
| 62 | CalibrationPipeline pipeline_; | ||
| 63 | }; | ||
| 64 | |||
| 65 | /** | ||
| 66 | * DistancePipelineExecutor is the pipeline | ||
| 67 | * executor for the distance determination pipeline. | ||
| 68 | */ | ||
| 69 | class DistancePipelineExecutor : public PipelineExecutor { | ||
| 70 | public: | ||
| 71 | /** | ||
| 72 | * Destroys this and all distance determination pipeline resources | ||
| 73 | */ | ||
| 74 | ~DistancePipelineExecutor(); | ||
| 75 | |||
| 76 | /** | ||
| 77 | * Constructs a DistancePipelineExecutor (no edge-filters) | ||
| 78 | * | ||
| 79 | * @param options The DistanceOptions to configure the pipeline (moved into the executor) | ||
| 80 | * @param edgeDetectionAlgorithm The EdgeDetectionAlgorithm used by the pipeline (moved into the executor) | ||
| 81 | * @param distanceAlgorithm The DistanceDeterminationAlgorithm used by the pipeline (moved into the executor) | ||
| 82 | * @param vectorizationAlgorithm The VectorGenerationAlgorithm used by the pipeline (moved into the executor) | ||
| 83 | * | ||
| 84 | * @pre edgeDetectionAlgorithm, distanceAlgorithm, and vectorizationAlgorithm are non-null and already | ||
| 85 | * configured to operate on (Image -> Points -> PositionVector) in that order. | ||
| 86 | * @pre Each provided stage is already "ready" (e.g., pipelines passed in were Completed) before transfer. | ||
| 87 | */ | ||
| 88 | explicit DistancePipelineExecutor(DistanceOptions &&options, | ||
| 89 | std::unique_ptr<EdgeDetectionAlgorithm> edgeDetectionAlgorithm, | ||
| 90 | std::unique_ptr<DistanceDeterminationAlgorithm> distanceAlgorithm, | ||
| 91 | std::unique_ptr<VectorGenerationAlgorithm> vectorizationAlgorithm); | ||
| 92 | |||
| 93 | /** | ||
| 94 | * Constructs a DistancePipelineExecutor with an edge-filtering pipeline | ||
| 95 | * | ||
| 96 | * @param options The DistanceOptions to configure the pipeline (moved into the executor) | ||
| 97 | * @param edgeDetectionAlgorithm The EdgeDetectionAlgorithm used by the pipeline (moved into the executor) | ||
| 98 | * @param filters A pipeline of edge filtering stages; ownership is transferred to the executor | ||
| 99 | * @param distanceAlgorithm The DistanceDeterminationAlgorithm used by the pipeline (moved into the executor) | ||
| 100 | * @param vectorizationAlgorithm The VectorGenerationAlgorithm used by the pipeline (moved into the executor) | ||
| 101 | * | ||
| 102 | * @pre edgeDetectionAlgorithm, filters, distanceAlgorithm, and vectorizationAlgorithm are non-null. | ||
| 103 | * @pre filters has been completed (ready) prior to being passed in so it can run as a stage. | ||
| 104 | * @pre Stage input/output types align with the Distance pipeline: Image -> Points -> Points -> PositionVector. | ||
| 105 | */ | ||
| 106 | explicit DistancePipelineExecutor(DistanceOptions &&options, | ||
| 107 | std::unique_ptr<EdgeDetectionAlgorithm> edgeDetectionAlgorithm, | ||
| 108 | std::unique_ptr<EdgeFilteringAlgorithms> filters, | ||
| 109 | std::unique_ptr<DistanceDeterminationAlgorithm> distanceAlgorithm, | ||
| 110 | std::unique_ptr<VectorGenerationAlgorithm> vectorizationAlgorithm); | ||
| 111 | |||
| 112 | void ExecutePipeline() override; | ||
| 113 | void OutputResults() override; | ||
| 114 | |||
| 115 | private: | ||
| 116 | /// The DistanceOptions being used | ||
| 117 | const DistanceOptions options_; | ||
| 118 | /// The Distance pipeline being used | ||
| 119 | DistancePipeline pipeline_; | ||
| 120 | }; | ||
| 121 | |||
| 122 | /** | ||
| 123 | * OrbitPipelineExecutor is the pipeline | ||
| 124 | * executor for the orbit determination pipeline. | ||
| 125 | */ | ||
| 126 | class OrbitPipelineExecutor : public PipelineExecutor { | ||
| 127 | public: | ||
| 128 | /** | ||
| 129 | * Constructs a OrbitPipelineExecutor | ||
| 130 | * | ||
| 131 | * @param options The options to create the pipeline | ||
| 132 | * @param orbitPropagationAlgorithm The orbit propagation algorithm to use | ||
| 133 | */ | ||
| 134 | explicit OrbitPipelineExecutor(OrbitOptions &&options, | ||
| 135 | std::unique_ptr<OrbitPropagationAlgorithm> orbitPropagationAlgorithm); | ||
| 136 | |||
| 137 | void ExecutePipeline() override; | ||
| 138 | void OutputResults() override; | ||
| 139 | |||
| 140 | private: | ||
| 141 | /// The Orbit options being used | ||
| 142 | const OrbitOptions options_; | ||
| 143 | /// The Orbit pipeline | ||
| 144 | OrbitPipeline pipeline_; | ||
| 145 | }; | ||
| 146 | |||
| 147 | } // namespace found | ||
| 148 | |||
| 149 | #endif // SRC_COMMAND_LINE_EXECUTION_EXECUTORS_HPP_ | ||
| 150 |