LCOV - code coverage report
Current view: top level - apps - gdalalg_vector_compare.h (source / functions) Hit Total Coverage
Test: gdal_filtered.info Lines: 10 10 100.0 %
Date: 2026-09-11 05:09:32 Functions: 6 6 100.0 %

          Line data    Source code
       1             : /******************************************************************************
       2             :  *
       3             :  * Project:  GDAL
       4             :  * Purpose:  gdal "vector compare" subcommand
       5             :  * Author:   Even Rouault <even dot rouault at spatialys.com>
       6             :  *
       7             :  ******************************************************************************
       8             :  * Copyright (c) 2026, Even Rouault <even dot rouault at spatialys.com>
       9             :  *
      10             :  * SPDX-License-Identifier: MIT
      11             :  ****************************************************************************/
      12             : 
      13             : #ifndef GDALALG_VECTOR_COMPARE_INCLUDED
      14             : #define GDALALG_VECTOR_COMPARE_INCLUDED
      15             : 
      16             : #include "gdalvectorpipelinestepalgorithm.h"
      17             : #include "gdalalg_compare_common.h"
      18             : 
      19             : //! @cond Doxygen_Suppress
      20             : 
      21             : class GDALDataset;
      22             : class OGRLayer;
      23             : 
      24             : /************************************************************************/
      25             : /*                      GDALVectorCompareAlgorithm                      */
      26             : /************************************************************************/
      27             : 
      28             : class GDALVectorCompareAlgorithm /* non final */
      29             :     : public GDALVectorPipelineStepAlgorithm,
      30             :       public GDALCompareCommon
      31             : {
      32             :   public:
      33             :     static constexpr const char *NAME = "compare";
      34             :     static constexpr const char *DESCRIPTION = "Compare two vector datasets.";
      35             :     static constexpr const char *HELP_URL =
      36             :         "/programs/gdal_vector_compare.html";
      37             : 
      38             :     explicit GDALVectorCompareAlgorithm(bool standaloneStep = false);
      39             : 
      40           2 :     bool IsNativelyStreamingCompatible() const override
      41             :     {
      42           2 :         return false;
      43             :     }
      44             : 
      45          14 :     bool CanBeLastStep() const override
      46             :     {
      47          14 :         return true;
      48             :     }
      49             : 
      50         127 :     int GetOutputType() const override
      51             :     {
      52         127 :         return 0;
      53             :     }
      54             : 
      55             :   private:
      56             :     bool RunStep(GDALPipelineStepRunContext &ctxt) override;
      57             : 
      58             :     bool CompareLayer(std::vector<std::string> &aosReport, OGRLayer *poRefLayer,
      59             :                       OGRLayer *poInputLayer, GDALProgressFunc,
      60             :                       void *pProgressData);
      61             : 
      62             :     bool m_laxGeometryComparison = false;
      63             : 
      64             :     bool m_skipAllOptional = false;
      65             :     bool m_skipCRS = false;
      66             :     bool m_skipMetadata = false;
      67             :     bool m_skipFID = false;
      68             :     // If adding a new skip flag, make sure that m_skipAll takes it into account
      69             : };
      70             : 
      71             : /************************************************************************/
      72             : /*                 GDALVectorCompareAlgorithmStandalone                 */
      73             : /************************************************************************/
      74             : 
      75         212 : class GDALVectorCompareAlgorithmStandalone final
      76             :     : public GDALVectorCompareAlgorithm
      77             : {
      78             :   public:
      79         106 :     GDALVectorCompareAlgorithmStandalone()
      80         106 :         : GDALVectorCompareAlgorithm(/* standaloneStep = */ true)
      81             :     {
      82         106 :     }
      83             : 
      84             :     ~GDALVectorCompareAlgorithmStandalone() override;
      85             : };
      86             : 
      87             : //! @endcond
      88             : 
      89             : #endif

Generated by: LCOV version 1.14