LCOV - code coverage report
Current view: top level - apps - gdalalg_materialize.h (source / functions) Hit Total Coverage
Test: gdal_filtered.info Lines: 11 11 100.0 %
Date: 2026-06-03 12:46:18 Functions: 10 10 100.0 %

          Line data    Source code
       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          46 :     bool IsNativelyStreamingCompatible() const override
      40             :     {
      41          46 :         return false;
      42             :     }
      43             : 
      44           4 :     bool GeneratesFilesFromUserInput() const override
      45             :     {
      46           4 :         return !this->m_outputDataset.GetName().empty();
      47             :     }
      48             : 
      49             :   protected:
      50             :     explicit GDALMaterializeStepAlgorithm(const char *helpURL);
      51             : 
      52          36 :     int GetInputType() const override
      53             :     {
      54          36 :         return nDatasetType;
      55             :     }
      56             : 
      57          16 :     int GetOutputType() const override
      58             :     {
      59          16 :         return nDatasetType;
      60             :     }
      61             : 
      62             :     bool m_reopenAndDoNotEarlyDelete = false;
      63             : };
      64             : 
      65             : /************************************************************************/
      66             : /*     GDALMaterializeStepAlgorithm::GDALMaterializeStepAlgorithm()     */
      67             : /************************************************************************/
      68             : 
      69             : template <class BaseStepAlgorithm, int nDatasetType>
      70         116 : GDALMaterializeStepAlgorithm<BaseStepAlgorithm, nDatasetType>::
      71             :     GDALMaterializeStepAlgorithm(const char *helpURL)
      72             :     : BaseStepAlgorithm(NAME, DESCRIPTION, helpURL,
      73             :                         GDALPipelineStepAlgorithm::ConstructorOptions()
      74         116 :                             .SetAddDefaultArguments(false))
      75             : {
      76         116 : }
      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

Generated by: LCOV version 1.14