GDAL

gdal_pam_multidim.h
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
24
25/* ******************************************************************** */
26/* GDALPamMultiDim */
27/* ******************************************************************** */
28
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
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 const std::shared_ptr<GDALPamMultiDim> &GetPAM() const
91 {
92 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
108
109#endif
GDALMDArray
Class modeling a multi-dimensional array.
Definition gdal_multidim.h:852
OGRSpatialReference
This class represents an OpenGIS Spatial Reference System, and contains methods for converting betwee...
Definition ogr_spatialref.h:152
CPLErr
CPLErr
Error category.
Definition cpl_error.h:37
cpl_port.h
Core portability definitions for CPL.
CSLConstList
char ** CSLConstList
Type of a constant null-terminated list of nul terminated strings.
Definition cpl_port.h:1087
GUInt64
GUIntBig GUInt64
Unsigned 64 bit integer type.
Definition cpl_port.h:228