LCOV - code coverage report
Current view: top level - apps - gdalalg_pipeline.cpp (source / functions) Hit Total Coverage
Test: gdal_filtered.info Lines: 10 10 100.0 %
Date: 2025-05-15 13:16:46 Functions: 2 2 100.0 %

          Line data    Source code
       1             : /******************************************************************************
       2             :  *
       3             :  * Project:  GDAL
       4             :  * Purpose:  gdal "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             : #include "cpl_error.h"
      14             : #include "gdalalgorithm.h"
      15             : #include "gdalalg_raster_pipeline.h"
      16             : #include "gdalalg_vector_pipeline.h"
      17             : #include "gdalalg_dispatcher.h"
      18             : #include "gdal_priv.h"
      19             : 
      20             : /************************************************************************/
      21             : /*                       GDALPipelineAlgorithm                          */
      22             : /************************************************************************/
      23             : 
      24             : class GDALPipelineAlgorithm final
      25             :     : public GDALDispatcherAlgorithm<GDALRasterPipelineAlgorithm,
      26             :                                      GDALVectorPipelineAlgorithm>
      27             : {
      28             :   public:
      29             :     static constexpr const char *NAME = "pipeline";
      30             :     static constexpr const char *DESCRIPTION =
      31             :         "Execute a pipeline (shortcut for 'gdal raster pipeline' or 'gdal "
      32             :         "vector pipeline').";
      33             :     static constexpr const char *HELP_URL = "/programs/gdal_pipeline.html";
      34             : 
      35           6 :     GDALPipelineAlgorithm()
      36           6 :         : GDALDispatcherAlgorithm(NAME, DESCRIPTION, HELP_URL)
      37             :     {
      38             :         // only for the help message
      39           6 :         AddOutputFormatArg(&m_format).SetDefault("json").SetChoices("json",
      40           6 :                                                                     "text");
      41           6 :         AddInputDatasetArg(&m_dataset);
      42             : 
      43             :         m_longDescription =
      44             :             "For all options, run 'gdal raster pipeline --help' or "
      45           6 :             "'gdal vector pipeline --help'";
      46           6 :     }
      47             : 
      48             :   private:
      49             :     std::unique_ptr<GDALRasterPipelineAlgorithm> m_rasterPipeline{};
      50             :     std::unique_ptr<GDALVectorPipelineAlgorithm> m_vectorPipeline{};
      51             : 
      52             :     std::string m_format{};
      53             :     GDALArgDatasetValue m_dataset{};
      54             : 
      55           1 :     bool RunImpl(GDALProgressFunc, void *) override
      56             :     {
      57           1 :         CPLError(CE_Failure, CPLE_AppDefined,
      58             :                  "The Run() method should not be called directly on the \"gdal "
      59             :                  "pipeline\" program.");
      60           1 :         return false;
      61             :     }
      62             : };
      63             : 
      64             : GDAL_STATIC_REGISTER_ALG(GDALPipelineAlgorithm);

Generated by: LCOV version 1.14