Coverage Report

Created: 2026-07-25 06:50

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/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
    static constexpr const char *ARG_NAME_REOPEN_AND_DO_NOT_EARLY_DELETE =
37
        "reopen-and-do-not-early-delete";
38
39
    bool IsNativelyStreamingCompatible() const override
40
0
    {
41
0
        return false;
42
0
    }
Unexecuted instantiation: GDALMaterializeStepAlgorithm<GDALRasterPipelineStepAlgorithm, 2>::IsNativelyStreamingCompatible() const
Unexecuted instantiation: GDALMaterializeStepAlgorithm<GDALVectorPipelineStepAlgorithm, 4>::IsNativelyStreamingCompatible() const
43
44
    bool GeneratesFilesFromUserInput() const override
45
0
    {
46
0
        return !this->m_outputDataset.GetName().empty();
47
0
    }
Unexecuted instantiation: GDALMaterializeStepAlgorithm<GDALRasterPipelineStepAlgorithm, 2>::GeneratesFilesFromUserInput() const
Unexecuted instantiation: GDALMaterializeStepAlgorithm<GDALVectorPipelineStepAlgorithm, 4>::GeneratesFilesFromUserInput() const
48
49
  protected:
50
    explicit GDALMaterializeStepAlgorithm(const char *helpURL);
51
52
    int GetInputType() const override
53
0
    {
54
0
        return nDatasetType;
55
0
    }
Unexecuted instantiation: GDALMaterializeStepAlgorithm<GDALRasterPipelineStepAlgorithm, 2>::GetInputType() const
Unexecuted instantiation: GDALMaterializeStepAlgorithm<GDALVectorPipelineStepAlgorithm, 4>::GetInputType() const
56
57
    int GetOutputType() const override
58
0
    {
59
0
        return nDatasetType;
60
0
    }
Unexecuted instantiation: GDALMaterializeStepAlgorithm<GDALRasterPipelineStepAlgorithm, 2>::GetOutputType() const
Unexecuted instantiation: GDALMaterializeStepAlgorithm<GDALVectorPipelineStepAlgorithm, 4>::GetOutputType() const
61
62
    bool m_reopenAndDoNotEarlyDelete = false;
63
};
64
65
/************************************************************************/
66
/*     GDALMaterializeStepAlgorithm::GDALMaterializeStepAlgorithm()     */
67
/************************************************************************/
68
69
template <class BaseStepAlgorithm, int nDatasetType>
70
GDALMaterializeStepAlgorithm<BaseStepAlgorithm, nDatasetType>::
71
    GDALMaterializeStepAlgorithm(const char *helpURL)
72
0
    : BaseStepAlgorithm(NAME, DESCRIPTION, helpURL,
73
0
                        GDALPipelineStepAlgorithm::ConstructorOptions()
74
0
                            .SetAddDefaultArguments(false))
75
0
{
76
0
}
Unexecuted instantiation: GDALMaterializeStepAlgorithm<GDALRasterPipelineStepAlgorithm, 2>::GDALMaterializeStepAlgorithm(char const*)
Unexecuted instantiation: GDALMaterializeStepAlgorithm<GDALVectorPipelineStepAlgorithm, 4>::GDALMaterializeStepAlgorithm(char const*)
77
78
/************************************************************************/
79
/*                    GDALMaterializeRasterAlgorithm                    */
80
/************************************************************************/
81
82
class GDALMaterializeRasterAlgorithm final
83
    : public GDALMaterializeStepAlgorithm<GDALRasterPipelineStepAlgorithm,
84
                                          GDAL_OF_RASTER>
85
{
86
  public:
87
    static constexpr const char *HELP_URL =
88
        "/programs/gdal_raster_materialize.html";
89
90
    GDALMaterializeRasterAlgorithm();
91
92
  private:
93
    bool RunStep(GDALPipelineStepRunContext &ctxt) override;
94
};
95
96
/************************************************************************/
97
/*                    GDALMaterializeVectorAlgorithm                    */
98
/************************************************************************/
99
100
class GDALMaterializeVectorAlgorithm final
101
    : public GDALMaterializeStepAlgorithm<GDALVectorPipelineStepAlgorithm,
102
                                          GDAL_OF_VECTOR>
103
{
104
  public:
105
    static constexpr const char *HELP_URL =
106
        "/programs/gdal_vector_materialize.html";
107
108
    GDALMaterializeVectorAlgorithm();
109
110
  private:
111
    bool RunStep(GDALPipelineStepRunContext &ctxt) override;
112
};
113
114
//! @endcond
115
116
#endif