Line data Source code
1 : /****************************************************************************** 2 : * 3 : * Project: GDAL 4 : * Purpose: gdal "mdim 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_MDIM_COMPARE_INCLUDED 14 : #define GDALALG_MDIM_COMPARE_INCLUDED 15 : 16 : #include "gdalmdimpipelinestepalgorithm.h" 17 : #include "gdalalg_compare_common.h" 18 : 19 : //! @cond Doxygen_Suppress 20 : 21 : class GDALMDArray; 22 : 23 : /************************************************************************/ 24 : /* GDALMdimCompareAlgorithm */ 25 : /************************************************************************/ 26 : 27 : class GDALMdimCompareAlgorithm /* non final */ 28 : : public GDALMdimPipelineStepAlgorithm, 29 : public GDALCompareCommon 30 : { 31 : public: 32 : static constexpr const char *NAME = "compare"; 33 : static constexpr const char *DESCRIPTION = 34 : "Compare two multidimensional datasets."; 35 : static constexpr const char *HELP_URL = "/programs/gdal_mdim_compare.html"; 36 : 37 : explicit GDALMdimCompareAlgorithm(bool standaloneStep = false); 38 : 39 2 : bool IsNativelyStreamingCompatible() const override 40 : { 41 2 : return false; 42 : } 43 : 44 1 : bool CanBeLastStep() const override 45 : { 46 1 : return true; 47 : } 48 : 49 9 : int GetOutputType() const override 50 : { 51 9 : return 0; 52 : } 53 : 54 : private: 55 : bool RunStep(GDALPipelineStepRunContext &ctxt) override; 56 : 57 : void CompareArray(std::vector<std::string> &aosReport, 58 : const std::shared_ptr<GDALMDArray> &poRefArray, 59 : const std::shared_ptr<GDALMDArray> &poInputArray, 60 : GDALProgressFunc pfnProgress, void *pProgressData); 61 : }; 62 : 63 : /************************************************************************/ 64 : /* GDALMdimCompareAlgorithmStandalone */ 65 : /************************************************************************/ 66 : 67 102 : class GDALMdimCompareAlgorithmStandalone final : public GDALMdimCompareAlgorithm 68 : { 69 : public: 70 51 : GDALMdimCompareAlgorithmStandalone() 71 51 : : GDALMdimCompareAlgorithm(/* standaloneStep = */ true) 72 : { 73 51 : } 74 : 75 : ~GDALMdimCompareAlgorithmStandalone() override; 76 : }; 77 : 78 : //! @endcond 79 : 80 : #endif