/src/gdal/apps/gdalalg_mdim_pipeline.h
Line | Count | Source |
1 | | /****************************************************************************** |
2 | | * |
3 | | * Project: GDAL |
4 | | * Purpose: gdal "mdim pipeline" subcommand |
5 | | * Author: Even Rouault <even dot rouault at spatialys.com> |
6 | | * |
7 | | ****************************************************************************** |
8 | | * Copyright (c) 2026, Even Rouault <even dot rouault at spatialys.com> |
9 | | * |
10 | | * SPDX-License-Identifier: MIT |
11 | | ****************************************************************************/ |
12 | | |
13 | | #ifndef GDALALG_MDIM_PIPELINE_INCLUDED |
14 | | #define GDALALG_MDIM_PIPELINE_INCLUDED |
15 | | |
16 | | #include "gdalalgorithm.h" |
17 | | #include "gdalalg_abstract_pipeline.h" |
18 | | #include "gdalmdimpipelinestepalgorithm.h" |
19 | | |
20 | | //! @cond Doxygen_Suppress |
21 | | |
22 | | /************************************************************************/ |
23 | | /* GDALMdimAlgorithmStepRegistry */ |
24 | | /************************************************************************/ |
25 | | |
26 | | class GDALMdimAlgorithmStepRegistry : public virtual GDALAlgorithmRegistry |
27 | | { |
28 | | public: |
29 | 0 | GDALMdimAlgorithmStepRegistry() = default; |
30 | | ~GDALMdimAlgorithmStepRegistry() override; |
31 | | |
32 | | /** Register the algorithm of type MyAlgorithm. |
33 | | */ |
34 | | template <class MyAlgorithm> |
35 | | bool Register(const std::string &name = std::string()) |
36 | 0 | { |
37 | 0 | static_assert( |
38 | 0 | std::is_base_of_v<GDALMdimPipelineStepAlgorithm, MyAlgorithm>, |
39 | 0 | "Algorithm is not a GDALMdimPipelineStepAlgorithm"); |
40 | |
|
41 | 0 | AlgInfo info; |
42 | 0 | info.m_name = name.empty() ? MyAlgorithm::NAME : name; |
43 | 0 | info.m_aliases = MyAlgorithm::GetAliasesStatic(); |
44 | 0 | info.m_creationFunc = []() -> std::unique_ptr<GDALAlgorithm> |
45 | 0 | { return std::make_unique<MyAlgorithm>(); };Unexecuted instantiation: GDALMdimAlgorithmStepRegistry::Register<GDALMdimReadAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)::{lambda()#1}::operator()() constUnexecuted instantiation: GDALMdimAlgorithmStepRegistry::Register<GDALMdimMosaicAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)::{lambda()#1}::operator()() constUnexecuted instantiation: GDALMdimAlgorithmStepRegistry::Register<GDALMdimCompareAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)::{lambda()#1}::operator()() constUnexecuted instantiation: GDALMdimAlgorithmStepRegistry::Register<GDALMdimWriteAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)::{lambda()#1}::operator()() constUnexecuted instantiation: GDALMdimAlgorithmStepRegistry::Register<GDALMdimInfoAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)::{lambda()#1}::operator()() constUnexecuted instantiation: GDALMdimAlgorithmStepRegistry::Register<GDALMdimReprojectAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)::{lambda()#1}::operator()() const |
46 | 0 | return GDALAlgorithmRegistry::Register(info); |
47 | 0 | } Unexecuted instantiation: bool GDALMdimAlgorithmStepRegistry::Register<GDALMdimReadAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) Unexecuted instantiation: bool GDALMdimAlgorithmStepRegistry::Register<GDALMdimMosaicAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) Unexecuted instantiation: bool GDALMdimAlgorithmStepRegistry::Register<GDALMdimCompareAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) Unexecuted instantiation: bool GDALMdimAlgorithmStepRegistry::Register<GDALMdimWriteAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) Unexecuted instantiation: bool GDALMdimAlgorithmStepRegistry::Register<GDALMdimInfoAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) Unexecuted instantiation: bool GDALMdimAlgorithmStepRegistry::Register<GDALMdimReprojectAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) |
48 | | }; |
49 | | |
50 | | /************************************************************************/ |
51 | | /* GDALMdimPipelineAlgorithm */ |
52 | | /************************************************************************/ |
53 | | |
54 | | class GDALMdimPipelineAlgorithm final : public GDALAbstractPipelineAlgorithm |
55 | | { |
56 | | public: |
57 | | static constexpr const char *NAME = "pipeline"; |
58 | | static constexpr const char *DESCRIPTION = |
59 | | "Process a multidimensional dataset applying several steps."; |
60 | | static constexpr const char *HELP_URL = "/programs/gdal_mdim_pipeline.html"; |
61 | | |
62 | | explicit GDALMdimPipelineAlgorithm(bool openForMixedMdimVector = false); |
63 | | |
64 | | std::string GetUsageForCLI(bool shortUsage, |
65 | | const UsageOptions &usageOptions) const override; |
66 | | |
67 | | static void RegisterAlgorithms(GDALMdimAlgorithmStepRegistry ®istry, |
68 | | bool forMixedPipeline); |
69 | | |
70 | | int GetInputType() const override |
71 | 0 | { |
72 | 0 | return GDAL_OF_MULTIDIM_RASTER; |
73 | 0 | } |
74 | | |
75 | | int GetOutputType() const override |
76 | 0 | { |
77 | 0 | return GDAL_OF_MULTIDIM_RASTER; |
78 | 0 | } |
79 | | |
80 | | protected: |
81 | | GDALMdimAlgorithmStepRegistry m_stepRegistry{}; |
82 | | |
83 | | GDALAlgorithmRegistry &GetStepRegistry() override |
84 | 0 | { |
85 | 0 | return m_stepRegistry; |
86 | 0 | } |
87 | | |
88 | | const GDALAlgorithmRegistry &GetStepRegistry() const override |
89 | 0 | { |
90 | 0 | return m_stepRegistry; |
91 | 0 | } |
92 | | |
93 | | private: |
94 | | std::unique_ptr<GDALAbstractPipelineAlgorithm> |
95 | | CreateNestedPipeline() const override |
96 | 0 | { |
97 | 0 | auto pipeline = std::make_unique<GDALMdimPipelineAlgorithm>(); |
98 | 0 | pipeline->m_bInnerPipeline = true; |
99 | 0 | return pipeline; |
100 | 0 | } |
101 | | }; |
102 | | |
103 | | //! @endcond |
104 | | |
105 | | #endif |