Coverage Report

Created: 2026-07-25 06:50

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/gdal/apps/gdalalg_vector_pipeline.h
Line
Count
Source
1
/******************************************************************************
2
 *
3
 * Project:  GDAL
4
 * Purpose:  gdal "vector pipeline" subcommand
5
 * Author:   Even Rouault <even dot rouault at spatialys.com>
6
 *
7
 ******************************************************************************
8
 * Copyright (c) 2024, Even Rouault <even dot rouault at spatialys.com>
9
 *
10
 * SPDX-License-Identifier: MIT
11
 ****************************************************************************/
12
13
#ifndef GDALALG_VECTOR_PIPELINE_INCLUDED
14
#define GDALALG_VECTOR_PIPELINE_INCLUDED
15
16
#include "gdalalg_abstract_pipeline.h"
17
#include "gdalvectorpipelinestepalgorithm.h"
18
19
//! @cond Doxygen_Suppress
20
21
/************************************************************************/
22
/*                   GDALVectorAlgorithmStepRegistry                    */
23
/************************************************************************/
24
25
class GDALVectorAlgorithmStepRegistry : public virtual GDALAlgorithmRegistry
26
{
27
  public:
28
0
    GDALVectorAlgorithmStepRegistry() = default;
Unexecuted instantiation: GDALVectorAlgorithmStepRegistry::GDALVectorAlgorithmStepRegistry()
Unexecuted instantiation: GDALVectorAlgorithmStepRegistry::GDALVectorAlgorithmStepRegistry()
29
    ~GDALVectorAlgorithmStepRegistry() override;
30
31
    /** Register the algorithm of type MyAlgorithm.
32
     */
33
    template <class MyAlgorithm>
34
    bool Register(const std::string &name = std::string())
35
0
    {
36
0
        static_assert(
37
0
            std::is_base_of_v<GDALVectorPipelineStepAlgorithm, MyAlgorithm>,
38
0
            "Algorithm is not a GDALVectorPipelineStepAlgorithm");
39
40
0
        AlgInfo info;
41
0
        info.m_name = name.empty() ? MyAlgorithm::NAME : name;
42
0
        info.m_aliases = MyAlgorithm::GetAliasesStatic();
43
0
        info.m_creationFunc = []() -> std::unique_ptr<GDALAlgorithm>
44
0
        { return std::make_unique<MyAlgorithm>(); };
Unexecuted instantiation: GDALVectorAlgorithmStepRegistry::Register<GDALVectorReadAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)::{lambda()#1}::operator()() const
Unexecuted instantiation: GDALVectorAlgorithmStepRegistry::Register<GDALVectorWriteAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)::{lambda()#1}::operator()() const
Unexecuted instantiation: GDALVectorAlgorithmStepRegistry::Register<GDALVectorInfoAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)::{lambda()#1}::operator()() const
Unexecuted instantiation: GDALVectorAlgorithmStepRegistry::Register<GDALVectorBufferAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)::{lambda()#1}::operator()() const
Unexecuted instantiation: GDALVectorAlgorithmStepRegistry::Register<GDALVectorCheckCoverageAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)::{lambda()#1}::operator()() const
Unexecuted instantiation: GDALVectorAlgorithmStepRegistry::Register<GDALVectorCheckGeometryAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)::{lambda()#1}::operator()() const
Unexecuted instantiation: GDALVectorAlgorithmStepRegistry::Register<GDALVectorCombineAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)::{lambda()#1}::operator()() const
Unexecuted instantiation: GDALVectorAlgorithmStepRegistry::Register<GDALVectorConcatAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)::{lambda()#1}::operator()() const
Unexecuted instantiation: GDALVectorAlgorithmStepRegistry::Register<GDALVectorConcaveHullAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)::{lambda()#1}::operator()() const
Unexecuted instantiation: GDALVectorAlgorithmStepRegistry::Register<GDALVectorConvexHullAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)::{lambda()#1}::operator()() const
Unexecuted instantiation: GDALVectorAlgorithmStepRegistry::Register<GDALVectorCleanCoverageAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)::{lambda()#1}::operator()() const
Unexecuted instantiation: GDALVectorAlgorithmStepRegistry::Register<GDALVectorClipAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)::{lambda()#1}::operator()() const
Unexecuted instantiation: GDALVectorAlgorithmStepRegistry::Register<GDALVectorDissolveAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)::{lambda()#1}::operator()() const
Unexecuted instantiation: GDALVectorAlgorithmStepRegistry::Register<GDALVectorCreateAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)::{lambda()#1}::operator()() const
Unexecuted instantiation: GDALVectorAlgorithmStepRegistry::Register<GDALVectorEditAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)::{lambda()#1}::operator()() const
Unexecuted instantiation: GDALVectorAlgorithmStepRegistry::Register<GDALVectorExplodeAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)::{lambda()#1}::operator()() const
Unexecuted instantiation: GDALVectorAlgorithmStepRegistry::Register<GDALVectorExplodeCollectionsAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)::{lambda()#1}::operator()() const
Unexecuted instantiation: GDALVectorAlgorithmStepRegistry::Register<GDALVectorExportSchemaAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)::{lambda()#1}::operator()() const
Unexecuted instantiation: GDALVectorAlgorithmStepRegistry::Register<GDALMaterializeVectorAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)::{lambda()#1}::operator()() const
Unexecuted instantiation: GDALVectorAlgorithmStepRegistry::Register<GDALVectorReprojectAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)::{lambda()#1}::operator()() const
Unexecuted instantiation: GDALVectorAlgorithmStepRegistry::Register<GDALVectorFilterAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)::{lambda()#1}::operator()() const
Unexecuted instantiation: GDALVectorAlgorithmStepRegistry::Register<GDALVectorLayerAlgebraAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)::{lambda()#1}::operator()() const
Unexecuted instantiation: GDALVectorAlgorithmStepRegistry::Register<GDALVectorLimitAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)::{lambda()#1}::operator()() const
Unexecuted instantiation: GDALVectorAlgorithmStepRegistry::Register<GDALVectorMakePointAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)::{lambda()#1}::operator()() const
Unexecuted instantiation: GDALVectorAlgorithmStepRegistry::Register<GDALVectorMakeValidAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)::{lambda()#1}::operator()() const
Unexecuted instantiation: GDALVectorAlgorithmStepRegistry::Register<GDALVectorPartitionAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)::{lambda()#1}::operator()() const
Unexecuted instantiation: GDALVectorAlgorithmStepRegistry::Register<GDALVectorRenameLayerAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)::{lambda()#1}::operator()() const
Unexecuted instantiation: GDALVectorAlgorithmStepRegistry::Register<GDALVectorSegmentizeAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)::{lambda()#1}::operator()() const
Unexecuted instantiation: GDALVectorAlgorithmStepRegistry::Register<GDALVectorSelectAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)::{lambda()#1}::operator()() const
Unexecuted instantiation: GDALVectorAlgorithmStepRegistry::Register<GDALVectorSetFieldTypeAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)::{lambda()#1}::operator()() const
Unexecuted instantiation: GDALVectorAlgorithmStepRegistry::Register<GDALVectorSetGeomTypeAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)::{lambda()#1}::operator()() const
Unexecuted instantiation: GDALVectorAlgorithmStepRegistry::Register<GDALVectorSimplifyAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)::{lambda()#1}::operator()() const
Unexecuted instantiation: GDALVectorAlgorithmStepRegistry::Register<GDALVectorSimplifyCoverageAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)::{lambda()#1}::operator()() const
Unexecuted instantiation: GDALVectorAlgorithmStepRegistry::Register<GDALVectorSortAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)::{lambda()#1}::operator()() const
Unexecuted instantiation: GDALVectorAlgorithmStepRegistry::Register<GDALVectorSQLAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)::{lambda()#1}::operator()() const
Unexecuted instantiation: GDALVectorAlgorithmStepRegistry::Register<GDALVectorUpdateAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)::{lambda()#1}::operator()() const
Unexecuted instantiation: GDALVectorAlgorithmStepRegistry::Register<GDALVectorSwapXYAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)::{lambda()#1}::operator()() const
Unexecuted instantiation: GDALVectorAlgorithmStepRegistry::Register<GDALTeeVectorAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)::{lambda()#1}::operator()() const
Unexecuted instantiation: GDALVectorAlgorithmStepRegistry::Register<GDALExternalVectorAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)::{lambda()#1}::operator()() const
45
0
        return GDALAlgorithmRegistry::Register(info);
46
0
    }
Unexecuted instantiation: bool GDALVectorAlgorithmStepRegistry::Register<GDALVectorReadAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)
Unexecuted instantiation: bool GDALVectorAlgorithmStepRegistry::Register<GDALVectorWriteAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)
Unexecuted instantiation: bool GDALVectorAlgorithmStepRegistry::Register<GDALVectorInfoAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)
Unexecuted instantiation: bool GDALVectorAlgorithmStepRegistry::Register<GDALVectorBufferAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)
Unexecuted instantiation: bool GDALVectorAlgorithmStepRegistry::Register<GDALVectorCheckCoverageAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)
Unexecuted instantiation: bool GDALVectorAlgorithmStepRegistry::Register<GDALVectorCheckGeometryAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)
Unexecuted instantiation: bool GDALVectorAlgorithmStepRegistry::Register<GDALVectorCombineAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)
Unexecuted instantiation: bool GDALVectorAlgorithmStepRegistry::Register<GDALVectorConcatAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)
Unexecuted instantiation: bool GDALVectorAlgorithmStepRegistry::Register<GDALVectorConcaveHullAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)
Unexecuted instantiation: bool GDALVectorAlgorithmStepRegistry::Register<GDALVectorConvexHullAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)
Unexecuted instantiation: bool GDALVectorAlgorithmStepRegistry::Register<GDALVectorCleanCoverageAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)
Unexecuted instantiation: bool GDALVectorAlgorithmStepRegistry::Register<GDALVectorClipAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)
Unexecuted instantiation: bool GDALVectorAlgorithmStepRegistry::Register<GDALVectorDissolveAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)
Unexecuted instantiation: bool GDALVectorAlgorithmStepRegistry::Register<GDALVectorCreateAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)
Unexecuted instantiation: bool GDALVectorAlgorithmStepRegistry::Register<GDALVectorEditAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)
Unexecuted instantiation: bool GDALVectorAlgorithmStepRegistry::Register<GDALVectorExplodeAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)
Unexecuted instantiation: bool GDALVectorAlgorithmStepRegistry::Register<GDALVectorExplodeCollectionsAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)
Unexecuted instantiation: bool GDALVectorAlgorithmStepRegistry::Register<GDALVectorExportSchemaAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)
Unexecuted instantiation: bool GDALVectorAlgorithmStepRegistry::Register<GDALMaterializeVectorAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)
Unexecuted instantiation: bool GDALVectorAlgorithmStepRegistry::Register<GDALVectorReprojectAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)
Unexecuted instantiation: bool GDALVectorAlgorithmStepRegistry::Register<GDALVectorFilterAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)
Unexecuted instantiation: bool GDALVectorAlgorithmStepRegistry::Register<GDALVectorLayerAlgebraAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)
Unexecuted instantiation: bool GDALVectorAlgorithmStepRegistry::Register<GDALVectorLimitAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)
Unexecuted instantiation: bool GDALVectorAlgorithmStepRegistry::Register<GDALVectorMakePointAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)
Unexecuted instantiation: bool GDALVectorAlgorithmStepRegistry::Register<GDALVectorMakeValidAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)
Unexecuted instantiation: bool GDALVectorAlgorithmStepRegistry::Register<GDALVectorPartitionAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)
Unexecuted instantiation: bool GDALVectorAlgorithmStepRegistry::Register<GDALVectorRenameLayerAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)
Unexecuted instantiation: bool GDALVectorAlgorithmStepRegistry::Register<GDALVectorSegmentizeAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)
Unexecuted instantiation: bool GDALVectorAlgorithmStepRegistry::Register<GDALVectorSelectAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)
Unexecuted instantiation: bool GDALVectorAlgorithmStepRegistry::Register<GDALVectorSetFieldTypeAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)
Unexecuted instantiation: bool GDALVectorAlgorithmStepRegistry::Register<GDALVectorSetGeomTypeAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)
Unexecuted instantiation: bool GDALVectorAlgorithmStepRegistry::Register<GDALVectorSimplifyAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)
Unexecuted instantiation: bool GDALVectorAlgorithmStepRegistry::Register<GDALVectorSimplifyCoverageAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)
Unexecuted instantiation: bool GDALVectorAlgorithmStepRegistry::Register<GDALVectorSortAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)
Unexecuted instantiation: bool GDALVectorAlgorithmStepRegistry::Register<GDALVectorSQLAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)
Unexecuted instantiation: bool GDALVectorAlgorithmStepRegistry::Register<GDALVectorUpdateAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)
Unexecuted instantiation: bool GDALVectorAlgorithmStepRegistry::Register<GDALVectorSwapXYAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)
Unexecuted instantiation: bool GDALVectorAlgorithmStepRegistry::Register<GDALTeeVectorAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)
Unexecuted instantiation: bool GDALVectorAlgorithmStepRegistry::Register<GDALExternalVectorAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)
47
};
48
49
/************************************************************************/
50
/*                     GDALVectorPipelineAlgorithm                      */
51
/************************************************************************/
52
53
class GDALVectorPipelineAlgorithm final : public GDALAbstractPipelineAlgorithm
54
{
55
  public:
56
    static constexpr const char *NAME = "pipeline";
57
    static constexpr const char *DESCRIPTION =
58
        "Process a vector dataset applying several steps.";
59
    static constexpr const char *HELP_URL =
60
        "/programs/gdal_vector_pipeline.html";
61
62
    static std::vector<std::string> GetAliasesStatic()
63
0
    {
64
0
        return {
65
0
#ifdef GDAL_PIPELINE_PROJ_NOSTALGIA
66
0
            GDALAlgorithmRegistry::HIDDEN_ALIAS_SEPARATOR,
67
0
            "+pipeline",
68
0
            "+gdal=pipeline",
69
0
#endif
70
0
        };
71
0
    }
72
73
    GDALVectorPipelineAlgorithm();
74
75
    std::string GetUsageForCLI(bool shortUsage,
76
                               const UsageOptions &usageOptions) const override;
77
78
    static void RegisterAlgorithms(GDALVectorAlgorithmStepRegistry &registry,
79
                                   bool forMixedPipeline);
80
81
    int GetInputType() const override
82
0
    {
83
0
        return GDAL_OF_VECTOR;
84
0
    }
85
86
    int GetOutputType() const override
87
0
    {
88
0
        return GDAL_OF_VECTOR;
89
0
    }
90
91
  protected:
92
    GDALVectorAlgorithmStepRegistry m_stepRegistry{};
93
94
    GDALAlgorithmRegistry &GetStepRegistry() override
95
0
    {
96
0
        return m_stepRegistry;
97
0
    }
98
99
    const GDALAlgorithmRegistry &GetStepRegistry() const override
100
0
    {
101
0
        return m_stepRegistry;
102
0
    }
103
104
  private:
105
    std::unique_ptr<GDALAbstractPipelineAlgorithm>
106
    CreateNestedPipeline() const override
107
0
    {
108
0
        auto pipeline = std::make_unique<GDALVectorPipelineAlgorithm>();
109
0
        pipeline->m_bInnerPipeline = true;
110
0
        return pipeline;
111
0
    }
112
};
113
114
//! @endcond
115
116
#endif