13#ifndef GDALALG_RASTER_PIPELINE_INCLUDED
14#define GDALALG_RASTER_PIPELINE_INCLUDED
16#include "gdalalgorithm.h"
17#include "gdalalg_abstract_pipeline.h"
25class GDALRasterAlgorithmStepRegistry;
27class GDALRasterPipelineStepAlgorithm
28 :
public GDALPipelineStepAlgorithm
31 ~GDALRasterPipelineStepAlgorithm()
override;
34 GDALRasterPipelineStepAlgorithm(
const std::string &name,
35 const std::string &description,
36 const std::string &helpURL,
39 GDALRasterPipelineStepAlgorithm(
const std::string &name,
40 const std::string &description,
41 const std::string &helpURL,
42 const ConstructorOptions &options);
44 friend class GDALRasterPipelineAlgorithm;
45 friend class GDALRasterMosaicStackCommonAlgorithm;
47 int GetInputType()
const override
52 int GetOutputType()
const override
57 void SetOutputVRTCompatible(
bool b);
64class GDALRasterPipelineNonNativelyStreamingAlgorithm
65 :
public GDALRasterPipelineStepAlgorithm
68 GDALRasterPipelineNonNativelyStreamingAlgorithm(
69 const std::string &name,
const std::string &description,
70 const std::string &helpURL,
bool standaloneStep);
72 bool IsNativelyStreamingCompatible()
const override;
74 static std::unique_ptr<GDALDataset>
75 CreateTemporaryDataset(
int nWidth,
int nHeight,
int nBands,
77 GDALDataset *poSrcDSForMetadata,
78 bool bCopyMetadata =
true);
79 static std::unique_ptr<GDALDataset>
80 CreateTemporaryCopy(GDALAlgorithm *poAlg, GDALDataset *poSrcDS,
81 int nSingleBand,
bool bTiledIfPossible,
82 GDALProgressFunc pfnProgress,
void *pProgressData);
92 GDALRasterAlgorithmStepRegistry() =
default;
93 ~GDALRasterAlgorithmStepRegistry()
override;
97 template <
class MyAlgorithm>
98 bool Register(
const std::string &name = std::string())
101 std::is_base_of_v<GDALRasterPipelineStepAlgorithm, MyAlgorithm>,
102 "Algorithm is not a GDALRasterPipelineStepAlgorithm");
105 info.m_name = name.empty() ? MyAlgorithm::NAME : name;
106 info.m_aliases = MyAlgorithm::GetAliasesStatic();
107 info.m_creationFunc = []() -> std::unique_ptr<GDALAlgorithm>
108 {
return std::make_unique<MyAlgorithm>(); };
117class GDALRasterPipelineAlgorithm final :
public GDALAbstractPipelineAlgorithm
120 static constexpr const char *NAME =
"pipeline";
121 static constexpr const char *DESCRIPTION =
122 "Process a raster dataset applying several steps.";
123 static constexpr const char *HELP_URL =
124 "/programs/gdal_raster_pipeline.html";
126 static std::vector<std::string> GetAliasesStatic()
129#ifdef GDAL_PIPELINE_PROJ_NOSTALGIA
137 explicit GDALRasterPipelineAlgorithm(
bool openForMixedRasterVector =
false);
139 std::string GetUsageForCLI(
bool shortUsage,
140 const UsageOptions &usageOptions)
const override;
142 static void RegisterAlgorithms(GDALRasterAlgorithmStepRegistry ®istry,
143 bool forMixedPipeline);
145 int GetInputType()
const override
150 int GetOutputType()
const override
156 GDALRasterAlgorithmStepRegistry m_stepRegistry{};
158 GDALAlgorithmRegistry &GetStepRegistry()
override
160 return m_stepRegistry;
163 const GDALAlgorithmRegistry &GetStepRegistry()
const override
165 return m_stepRegistry;
169 std::unique_ptr<GDALAbstractPipelineAlgorithm>
170 CreateNestedPipeline()
const override
172 auto pipeline = std::make_unique<GDALRasterPipelineAlgorithm>();
173 pipeline->m_bInnerPipeline =
true;
Registry of GDAL algorithms.
Definition gdalalgorithm_cpp.h:2132
static constexpr const char * HIDDEN_ALIAS_SEPARATOR
Special value to put in m_aliases to separate public alias from hidden aliases.
Definition gdalalgorithm_cpp.h:2136
bool Register()
Register the algorithm of type MyAlgorithm.
Definition gdalalgorithm_cpp.h:2159
GDALDataType
Definition gdal.h:48
#define GDAL_OF_RASTER
Allow raster drivers to be used.
Definition gdal.h:1086