/src/gdal/apps/gdalalg_materialize.h
Line | Count | Source |
1 | | /****************************************************************************** |
2 | | * |
3 | | * Project: GDAL |
4 | | * Purpose: gdal "materialize" pipeline step |
5 | | * Author: Even Rouault <even dot rouault at spatialys.com> |
6 | | * |
7 | | ****************************************************************************** |
8 | | * Copyright (c) 2025, Even Rouault <even dot rouault at spatialys.com> |
9 | | * |
10 | | * SPDX-License-Identifier: MIT |
11 | | ****************************************************************************/ |
12 | | |
13 | | #ifndef GDALALG_MATERIALIZE_INCLUDED |
14 | | #define GDALALG_MATERIALIZE_INCLUDED |
15 | | |
16 | | #include "gdalalg_abstract_pipeline.h" |
17 | | #include "gdalalg_raster_pipeline.h" |
18 | | #include "gdalalg_vector_pipeline.h" |
19 | | |
20 | | //! @cond Doxygen_Suppress |
21 | | |
22 | | /************************************************************************/ |
23 | | /* GDALMaterializeStepAlgorithm */ |
24 | | /************************************************************************/ |
25 | | |
26 | | template <class BaseStepAlgorithm, int nDatasetType> |
27 | | class GDALMaterializeStepAlgorithm /* non final */ |
28 | | : public BaseStepAlgorithm |
29 | | { |
30 | | public: |
31 | | static constexpr const char *NAME = "materialize"; |
32 | | static constexpr const char *DESCRIPTION = |
33 | | "Materialize a piped dataset on disk to increase the efficiency of the " |
34 | | "following steps."; |
35 | | |
36 | | bool IsNativelyStreamingCompatible() const override |
37 | 0 | { |
38 | 0 | return false; |
39 | 0 | } Unexecuted instantiation: GDALMaterializeStepAlgorithm<GDALRasterPipelineStepAlgorithm, 2>::IsNativelyStreamingCompatible() const Unexecuted instantiation: GDALMaterializeStepAlgorithm<GDALVectorPipelineStepAlgorithm, 4>::IsNativelyStreamingCompatible() const |
40 | | |
41 | | bool GeneratesFilesFromUserInput() const override |
42 | 0 | { |
43 | 0 | return !this->m_outputDataset.GetName().empty(); |
44 | 0 | } Unexecuted instantiation: GDALMaterializeStepAlgorithm<GDALRasterPipelineStepAlgorithm, 2>::GeneratesFilesFromUserInput() const Unexecuted instantiation: GDALMaterializeStepAlgorithm<GDALVectorPipelineStepAlgorithm, 4>::GeneratesFilesFromUserInput() const |
45 | | |
46 | | protected: |
47 | | explicit GDALMaterializeStepAlgorithm(const char *helpURL); |
48 | | |
49 | | int GetInputType() const override |
50 | 0 | { |
51 | 0 | return nDatasetType; |
52 | 0 | } Unexecuted instantiation: GDALMaterializeStepAlgorithm<GDALRasterPipelineStepAlgorithm, 2>::GetInputType() const Unexecuted instantiation: GDALMaterializeStepAlgorithm<GDALVectorPipelineStepAlgorithm, 4>::GetInputType() const |
53 | | |
54 | | int GetOutputType() const override |
55 | 0 | { |
56 | 0 | return nDatasetType; |
57 | 0 | } Unexecuted instantiation: GDALMaterializeStepAlgorithm<GDALRasterPipelineStepAlgorithm, 2>::GetOutputType() const Unexecuted instantiation: GDALMaterializeStepAlgorithm<GDALVectorPipelineStepAlgorithm, 4>::GetOutputType() const |
58 | | }; |
59 | | |
60 | | /************************************************************************/ |
61 | | /* GDALMaterializeStepAlgorithm::GDALMaterializeStepAlgorithm() */ |
62 | | /************************************************************************/ |
63 | | |
64 | | template <class BaseStepAlgorithm, int nDatasetType> |
65 | | GDALMaterializeStepAlgorithm<BaseStepAlgorithm, nDatasetType>:: |
66 | | GDALMaterializeStepAlgorithm(const char *helpURL) |
67 | 0 | : BaseStepAlgorithm(NAME, DESCRIPTION, helpURL, |
68 | 0 | GDALPipelineStepAlgorithm::ConstructorOptions() |
69 | 0 | .SetAddDefaultArguments(false)) |
70 | 0 | { |
71 | 0 | } Unexecuted instantiation: GDALMaterializeStepAlgorithm<GDALRasterPipelineStepAlgorithm, 2>::GDALMaterializeStepAlgorithm(char const*) Unexecuted instantiation: GDALMaterializeStepAlgorithm<GDALVectorPipelineStepAlgorithm, 4>::GDALMaterializeStepAlgorithm(char const*) |
72 | | |
73 | | /************************************************************************/ |
74 | | /* GDALMaterializeRasterAlgorithm */ |
75 | | /************************************************************************/ |
76 | | |
77 | | class GDALMaterializeRasterAlgorithm final |
78 | | : public GDALMaterializeStepAlgorithm<GDALRasterPipelineStepAlgorithm, |
79 | | GDAL_OF_RASTER> |
80 | | { |
81 | | public: |
82 | | static constexpr const char *HELP_URL = |
83 | | "/programs/gdal_raster_materialize.html"; |
84 | | |
85 | | GDALMaterializeRasterAlgorithm(); |
86 | | |
87 | | private: |
88 | | bool RunStep(GDALPipelineStepRunContext &ctxt) override; |
89 | | }; |
90 | | |
91 | | /************************************************************************/ |
92 | | /* GDALMaterializeVectorAlgorithm */ |
93 | | /************************************************************************/ |
94 | | |
95 | | class GDALMaterializeVectorAlgorithm final |
96 | | : public GDALMaterializeStepAlgorithm<GDALVectorPipelineStepAlgorithm, |
97 | | GDAL_OF_VECTOR> |
98 | | { |
99 | | public: |
100 | | static constexpr const char *HELP_URL = |
101 | | "/programs/gdal_vector_materialize.html"; |
102 | | |
103 | | GDALMaterializeVectorAlgorithm(); |
104 | | |
105 | | private: |
106 | | bool RunStep(GDALPipelineStepRunContext &ctxt) override; |
107 | | }; |
108 | | |
109 | | //! @endcond |
110 | | |
111 | | #endif |