LCOV - code coverage report
Current view: top level - gcore - gdal_pam_multidim.h (source / functions) Hit Total Coverage
Test: gdal_filtered.info Lines: 2 2 100.0 %
Date: 2025-10-01 17:07:58 Functions: 1 1 100.0 %

          Line data    Source code
       1             : /******************************************************************************
       2             :  *
       3             :  * Project:  GDAL Core
       4             :  * Purpose:  Declaration of GDALPamMDArray class
       5             :  * Author:   Even Rouault <even.rouault at spatialys.com>
       6             :  *
       7             :  ******************************************************************************
       8             :  * Copyright (c) 2019, Even Rouault <even.rouault at spatialys.com>
       9             :  *
      10             :  * SPDX-License-Identifier: MIT
      11             :  ****************************************************************************/
      12             : 
      13             : #ifndef GDAL_PAM_MULTIDIM_H_INCLUDED
      14             : #define GDAL_PAM_MULTIDIM_H_INCLUDED
      15             : 
      16             : #include "cpl_port.h"
      17             : 
      18             : #include "gdal_multidim.h"
      19             : 
      20             : #include <memory>
      21             : #include <string>
      22             : 
      23             : //! @cond Doxygen_Suppress
      24             : 
      25             : /* ******************************************************************** */
      26             : /*                          GDALPamMultiDim                             */
      27             : /* ******************************************************************** */
      28             : 
      29             : /** Class that serializes/deserializes metadata on multidimensional objects.
      30             :  * Currently SRS on GDALMDArray.
      31             :  */
      32             : class CPL_DLL GDALPamMultiDim final
      33             : {
      34             :     struct Private;
      35             :     std::unique_ptr<Private> d;
      36             : 
      37             :     void Load();
      38             :     void Save();
      39             : 
      40             :   public:
      41             :     explicit GDALPamMultiDim(const std::string &osFilename);
      42             :     ~GDALPamMultiDim();
      43             : 
      44             :     std::shared_ptr<OGRSpatialReference>
      45             :     GetSpatialRef(const std::string &osArrayFullName,
      46             :                   const std::string &osContext);
      47             : 
      48             :     void SetSpatialRef(const std::string &osArrayFullName,
      49             :                        const std::string &osContext,
      50             :                        const OGRSpatialReference *poSRS);
      51             : 
      52             :     CPLErr GetStatistics(const std::string &osArrayFullName,
      53             :                          const std::string &osContext, bool bApproxOK,
      54             :                          double *pdfMin, double *pdfMax, double *pdfMean,
      55             :                          double *pdfStdDev, GUInt64 *pnValidCount);
      56             : 
      57             :     void SetStatistics(const std::string &osArrayFullName,
      58             :                        const std::string &osContext, bool bApproxStats,
      59             :                        double dfMin, double dfMax, double dfMean,
      60             :                        double dfStdDev, GUInt64 nValidCount);
      61             : 
      62             :     void ClearStatistics();
      63             : 
      64             :     void ClearStatistics(const std::string &osArrayFullName,
      65             :                          const std::string &osContext);
      66             : 
      67             :     static std::shared_ptr<GDALPamMultiDim>
      68             :     GetPAM(const std::shared_ptr<GDALMDArray> &poParent);
      69             : };
      70             : 
      71             : /* ******************************************************************** */
      72             : /*                          GDALPamMDArray                              */
      73             : /* ******************************************************************** */
      74             : 
      75             : /** Class that relies on GDALPamMultiDim to serializes/deserializes metadata. */
      76             : class CPL_DLL GDALPamMDArray : public GDALMDArray
      77             : {
      78             :     std::shared_ptr<GDALPamMultiDim> m_poPam;
      79             : 
      80             :   protected:
      81             :     GDALPamMDArray(const std::string &osParentName, const std::string &osName,
      82             :                    const std::shared_ptr<GDALPamMultiDim> &poPam,
      83             :                    const std::string &osContext = std::string());
      84             : 
      85             :     bool SetStatistics(bool bApproxStats, double dfMin, double dfMax,
      86             :                        double dfMean, double dfStdDev, GUInt64 nValidCount,
      87             :                        CSLConstList papszOptions) override;
      88             : 
      89             :   public:
      90         571 :     const std::shared_ptr<GDALPamMultiDim> &GetPAM() const
      91             :     {
      92         571 :         return m_poPam;
      93             :     }
      94             : 
      95             :     CPLErr GetStatistics(bool bApproxOK, bool bForce, double *pdfMin,
      96             :                          double *pdfMax, double *pdfMean, double *padfStdDev,
      97             :                          GUInt64 *pnValidCount, GDALProgressFunc pfnProgress,
      98             :                          void *pProgressData) override;
      99             : 
     100             :     void ClearStatistics() override;
     101             : 
     102             :     bool SetSpatialRef(const OGRSpatialReference *poSRS) override;
     103             : 
     104             :     std::shared_ptr<OGRSpatialReference> GetSpatialRef() const override;
     105             : };
     106             : 
     107             : //! @endcond
     108             : 
     109             : #endif

Generated by: LCOV version 1.14