GDAL
gdal_priv.h
Go to the documentation of this file.
1 /******************************************************************************
2  * $Id$
3  *
4  * Name: gdal_priv.h
5  * Project: GDAL Core
6  * Purpose: GDAL Core C++/Private declarations.
7  * Author: Frank Warmerdam, warmerdam@pobox.com
8  *
9  ******************************************************************************
10  * Copyright (c) 1998, Frank Warmerdam
11  * Copyright (c) 2007-2014, Even Rouault <even dot rouault at spatialys.com>
12  *
13  * Permission is hereby granted, free of charge, to any person obtaining a
14  * copy of this software and associated documentation files (the "Software"),
15  * to deal in the Software without restriction, including without limitation
16  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
17  * and/or sell copies of the Software, and to permit persons to whom the
18  * Software is furnished to do so, subject to the following conditions:
19  *
20  * The above copyright notice and this permission notice shall be included
21  * in all copies or substantial portions of the Software.
22  *
23  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
24  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
26  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
28  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
29  * DEALINGS IN THE SOFTWARE.
30  ****************************************************************************/
31 
32 #ifndef GDAL_PRIV_H_INCLUDED
33 #define GDAL_PRIV_H_INCLUDED
34 
41 /* -------------------------------------------------------------------- */
42 /* Predeclare various classes before pulling in gdal.h, the */
43 /* public declarations. */
44 /* -------------------------------------------------------------------- */
45 class GDALMajorObject;
46 class GDALDataset;
47 class GDALRasterBand;
48 class GDALDriver;
50 class GDALProxyDataset;
51 class GDALProxyRasterBand;
52 class GDALAsyncReader;
53 class GDALRelationship;
54 
55 /* -------------------------------------------------------------------- */
56 /* Pull in the public declarations. This gets the C apis, and */
57 /* also various constants. However, we will still get to */
58 /* provide the real class definitions for the GDAL classes. */
59 /* -------------------------------------------------------------------- */
60 
61 #include "gdal.h"
62 #include "gdal_frmts.h"
63 #include "gdalsubdatasetinfo.h"
64 #include "cpl_vsi.h"
65 #include "cpl_conv.h"
66 #include "cpl_string.h"
67 #include "cpl_minixml.h"
68 #include "cpl_multiproc.h"
69 #include "cpl_atomic_ops.h"
70 
71 #include <stdarg.h>
72 
73 #include <cmath>
74 #include <cstdint>
75 #include <iterator>
76 #include <limits>
77 #include <map>
78 #include <memory>
79 #include <vector>
80 
81 #include "ogr_core.h"
82 #include "ogr_feature.h"
83 
85 #define GMO_VALID 0x0001
86 #define GMO_IGNORE_UNIMPLEMENTED 0x0002
87 #define GMO_SUPPORT_MD 0x0004
88 #define GMO_SUPPORT_MDMD 0x0008
89 #define GMO_MD_DIRTY 0x0010
90 #define GMO_PAM_CLASS 0x0020
91 
93 /************************************************************************/
94 /* GDALMultiDomainMetadata */
95 /************************************************************************/
96 
98 class CPL_DLL GDALMultiDomainMetadata
99 {
100  private:
101  char **papszDomainList;
102  CPLStringList **papoMetadataLists;
103 
104  public:
105  GDALMultiDomainMetadata();
106  ~GDALMultiDomainMetadata();
107 
108  int XMLInit(CPLXMLNode *psMetadata, int bMerge);
109  CPLXMLNode *Serialize();
110 
111  char **GetDomainList()
112  {
113  return papszDomainList;
114  }
115 
116  char **GetMetadata(const char *pszDomain = "");
117  CPLErr SetMetadata(char **papszMetadata, const char *pszDomain = "");
118  const char *GetMetadataItem(const char *pszName,
119  const char *pszDomain = "");
120  CPLErr SetMetadataItem(const char *pszName, const char *pszValue,
121  const char *pszDomain = "");
122 
123  void Clear();
124 
125  private:
126  CPL_DISALLOW_COPY_ASSIGN(GDALMultiDomainMetadata)
127 };
129 
130 /* ******************************************************************** */
131 /* GDALMajorObject */
132 /* */
133 /* Base class providing metadata, description and other */
134 /* services shared by major objects. */
135 /* ******************************************************************** */
136 
138 class CPL_DLL GDALMajorObject
139 {
140  protected:
142  int nFlags; // GMO_* flags.
143  CPLString sDescription{};
144  GDALMultiDomainMetadata oMDMD{};
145 
147 
148  char **BuildMetadataDomainList(char **papszList, int bCheckNonEmpty,
149  ...) CPL_NULL_TERMINATED;
150 
151  public:
152  GDALMajorObject();
153  virtual ~GDALMajorObject();
154 
155  int GetMOFlags() const;
156  void SetMOFlags(int nFlagsIn);
157 
158  virtual const char *GetDescription() const;
159  virtual void SetDescription(const char *);
160 
161  virtual char **GetMetadataDomainList();
162 
163  virtual char **GetMetadata(const char *pszDomain = "");
164  virtual CPLErr SetMetadata(char **papszMetadata,
165  const char *pszDomain = "");
166  virtual const char *GetMetadataItem(const char *pszName,
167  const char *pszDomain = "");
168  virtual CPLErr SetMetadataItem(const char *pszName, const char *pszValue,
169  const char *pszDomain = "");
170 
174  static inline GDALMajorObjectH ToHandle(GDALMajorObject *poMajorObject)
175  {
176  return static_cast<GDALMajorObjectH>(poMajorObject);
177  }
178 
182  static inline GDALMajorObject *FromHandle(GDALMajorObjectH hMajorObject)
183  {
184  return static_cast<GDALMajorObject *>(hMajorObject);
185  }
186 };
187 
188 /* ******************************************************************** */
189 /* GDALDefaultOverviews */
190 /* ******************************************************************** */
191 
193 class CPL_DLL GDALDefaultOverviews
194 {
195  friend class GDALDataset;
196 
197  GDALDataset *poDS;
198  GDALDataset *poODS;
199 
200  CPLString osOvrFilename{};
201 
202  bool bOvrIsAux;
203 
204  bool bCheckedForMask;
205  bool bOwnMaskDS;
206  GDALDataset *poMaskDS;
207 
208  // For "overview datasets" we record base level info so we can
209  // find our way back to get overview masks.
210  GDALDataset *poBaseDS;
211 
212  // Stuff for deferred initialize/overviewscans.
213  bool bCheckedForOverviews;
214  void OverviewScan();
215  char *pszInitName;
216  bool bInitNameIsOVR;
217  char **papszInitSiblingFiles;
218 
219  public:
220  GDALDefaultOverviews();
221  ~GDALDefaultOverviews();
222 
223  void Initialize(GDALDataset *poDSIn, const char *pszName = nullptr,
224  char **papszSiblingFiles = nullptr, int bNameIsOVR = FALSE);
225 
226  void TransferSiblingFiles(char **papszSiblingFiles);
227 
228  int IsInitialized();
229 
231 
232  // Overview Related
233 
234  int GetOverviewCount(int nBand);
235  GDALRasterBand *GetOverview(int nBand, int iOverview);
236 
237  CPLErr BuildOverviews(const char *pszBasename, const char *pszResampling,
238  int nOverviews, const int *panOverviewList,
239  int nBands, const int *panBandList,
240  GDALProgressFunc pfnProgress, void *pProgressData,
241  CSLConstList papszOptions);
242 
243  CPLErr BuildOverviewsSubDataset(const char *pszPhysicalFile,
244  const char *pszResampling, int nOverviews,
245  const int *panOverviewList, int nBands,
246  const int *panBandList,
247  GDALProgressFunc pfnProgress,
248  void *pProgressData,
249  CSLConstList papszOptions);
250 
251  CPLErr CleanOverviews();
252 
253  // Mask Related
254 
255  CPLErr CreateMaskBand(int nFlags, int nBand = -1);
256  GDALRasterBand *GetMaskBand(int nBand);
257  int GetMaskFlags(int nBand);
258 
259  int HaveMaskFile(char **papszSiblings = nullptr,
260  const char *pszBasename = nullptr);
261 
262  char **GetSiblingFiles()
263  {
264  return papszInitSiblingFiles;
265  }
266 
267  private:
268  CPL_DISALLOW_COPY_ASSIGN(GDALDefaultOverviews)
269 };
271 
272 /* ******************************************************************** */
273 /* GDALOpenInfo */
274 /* ******************************************************************** */
275 
277 class CPL_DLL GDALOpenInfo
278 {
279  bool bHasGotSiblingFiles;
280  char **papszSiblingFiles;
281  int nHeaderBytesTried;
282 
283  public:
284  GDALOpenInfo(const char *pszFile, int nOpenFlagsIn,
285  const char *const *papszSiblingFiles = nullptr);
286  ~GDALOpenInfo(void);
287 
289  char *pszFilename;
292 
297 
299  int bStatOK;
302 
305 
310 
312  const char *const *papszAllowedDrivers;
313 
314  int TryToIngest(int nBytes);
315  char **GetSiblingFiles();
316  char **StealSiblingFiles();
317  bool AreSiblingFilesLoaded() const;
318 
319  private:
321 };
322 
323 /* ******************************************************************** */
324 /* GDALDataset */
325 /* ******************************************************************** */
326 
327 class OGRLayer;
328 class OGRGeometry;
329 class OGRSpatialReference;
330 class OGRStyleTable;
331 class swq_select;
332 class swq_select_parse_options;
333 class GDALGroup;
334 
336 typedef struct GDALSQLParseInfo GDALSQLParseInfo;
338 
340 #ifdef GDAL_COMPILATION
341 #define OPTIONAL_OUTSIDE_GDAL(val)
342 #else
343 #define OPTIONAL_OUTSIDE_GDAL(val) = val
344 #endif
345 
348 class CPL_DLL GDALDataset : public GDALMajorObject
349 {
350  friend GDALDatasetH CPL_STDCALL
351  GDALOpenEx(const char *pszFilename, unsigned int nOpenFlags,
352  const char *const *papszAllowedDrivers,
353  const char *const *papszOpenOptions,
354  const char *const *papszSiblingFiles);
355  friend CPLErr CPL_STDCALL GDALClose(GDALDatasetH hDS);
356 
357  friend class GDALDriver;
358  friend class GDALDefaultOverviews;
359  friend class GDALProxyDataset;
360  friend class GDALDriverManager;
361 
362  CPL_INTERNAL void AddToDatasetOpenList();
363 
364  CPL_INTERNAL void UnregisterFromSharedDataset();
365 
366  CPL_INTERNAL static void ReportErrorV(const char *pszDSName,
367  CPLErr eErrClass, CPLErrorNum err_no,
368  const char *fmt, va_list args);
369 
370  protected:
372  GDALDriver *poDriver = nullptr;
373  GDALAccess eAccess = GA_ReadOnly;
374 
375  // Stored raster information.
376  int nRasterXSize = 512;
377  int nRasterYSize = 512;
378  int nBands = 0;
379  GDALRasterBand **papoBands = nullptr;
380 
381  static constexpr int OPEN_FLAGS_CLOSED = -1;
382  int nOpenFlags =
383  0; // set to OPEN_FLAGS_CLOSED after Close() has been called
384 
385  int nRefCount = 1;
386  bool bForceCachedIO = false;
387  bool bShared = false;
388  bool bIsInternal = true;
389  bool bSuppressOnClose = false;
390 
391  mutable std::map<std::string, std::unique_ptr<OGRFieldDomain>>
392  m_oMapFieldDomains{};
393 
394  GDALDataset(void);
395  explicit GDALDataset(int bForceCachedIO);
396 
397  void RasterInitialize(int, int);
398  void SetBand(int, GDALRasterBand *);
399  void SetBand(int nNewBand, std::unique_ptr<GDALRasterBand> poBand);
400 
401  GDALDefaultOverviews oOvManager{};
402 
403  virtual CPLErr IBuildOverviews(const char *, int, const int *, int,
404  const int *, GDALProgressFunc, void *,
405  CSLConstList papszOptions);
406 
407  virtual CPLErr
408  IRasterIO(GDALRWFlag, int, int, int, int, void *, int, int, GDALDataType,
409  int, int *, GSpacing, GSpacing, GSpacing,
411 
412  CPLErr
413  BlockBasedRasterIO(GDALRWFlag, int, int, int, int, void *, int, int,
414  GDALDataType, int, int *, GSpacing, GSpacing, GSpacing,
416  CPLErr BlockBasedFlushCache(bool bAtClosing);
417 
418  CPLErr
419  BandBasedRasterIO(GDALRWFlag eRWFlag, int nXOff, int nYOff, int nXSize,
420  int nYSize, void *pData, int nBufXSize, int nBufYSize,
421  GDALDataType eBufType, int nBandCount, int *panBandMap,
422  GSpacing nPixelSpace, GSpacing nLineSpace,
423  GSpacing nBandSpace,
425 
426  CPLErr
427  RasterIOResampled(GDALRWFlag eRWFlag, int nXOff, int nYOff, int nXSize,
428  int nYSize, void *pData, int nBufXSize, int nBufYSize,
429  GDALDataType eBufType, int nBandCount, int *panBandMap,
430  GSpacing nPixelSpace, GSpacing nLineSpace,
431  GSpacing nBandSpace,
433 
434  CPLErr ValidateRasterIOOrAdviseReadParameters(
435  const char *pszCallingFunc, int *pbStopProcessingOnCENone, int nXOff,
436  int nYOff, int nXSize, int nYSize, int nBufXSize, int nBufYSize,
437  int nBandCount, int *panBandMap);
438 
439  CPLErr TryOverviewRasterIO(GDALRWFlag eRWFlag, int nXOff, int nYOff,
440  int nXSize, int nYSize, void *pData,
441  int nBufXSize, int nBufYSize,
442  GDALDataType eBufType, int nBandCount,
443  int *panBandMap, GSpacing nPixelSpace,
444  GSpacing nLineSpace, GSpacing nBandSpace,
445  GDALRasterIOExtraArg *psExtraArg, int *pbTried);
446 
447  void ShareLockWithParentDataset(GDALDataset *poParentDataset);
448 
450 
451  void CleanupPostFileClosing();
452 
453  virtual int CloseDependentDatasets();
455  int ValidateLayerCreationOptions(const char *const *papszLCO);
456 
457  char **papszOpenOptions = nullptr;
458 
459  friend class GDALRasterBand;
460 
461  // The below methods related to read write mutex are fragile logic, and
462  // should not be used by out-of-tree code if possible.
463  int EnterReadWrite(GDALRWFlag eRWFlag);
464  void LeaveReadWrite();
465  void InitRWLock();
466 
467  void TemporarilyDropReadWriteLock();
468  void ReacquireReadWriteLock();
469 
470  void DisableReadWriteMutex();
471 
472  int AcquireMutex();
473  void ReleaseMutex();
474 
475  bool IsAllBands(int nBandCount, const int *panBandList) const;
477 
478  public:
479  ~GDALDataset() override;
480 
481  virtual CPLErr Close();
482 
483  int GetRasterXSize();
484  int GetRasterYSize();
485  int GetRasterCount();
486  GDALRasterBand *GetRasterBand(int);
487 
494  virtual bool SetQueryLoggerFunc(GDALQueryLoggerFunc pfnQueryLoggerFuncIn,
495  void *poQueryLoggerArgIn);
496 
499  class CPL_DLL Bands
500  {
501  private:
502  friend class GDALDataset;
503  GDALDataset *m_poSelf;
504  CPL_INTERNAL explicit Bands(GDALDataset *poSelf) : m_poSelf(poSelf)
505  {
506  }
507 
508  class CPL_DLL Iterator
509  {
510  struct Private;
511  std::unique_ptr<Private> m_poPrivate;
512 
513  public:
514  Iterator(GDALDataset *poDS, bool bStart);
515  Iterator(const Iterator &oOther); // declared but not defined.
516  // Needed for gcc 5.4 at least
517  Iterator(Iterator &&oOther) noexcept; // declared but not defined.
518  // Needed for gcc 5.4 at least
519  ~Iterator();
520  GDALRasterBand *operator*();
521  Iterator &operator++();
522  bool operator!=(const Iterator &it) const;
523  };
524 
525  public:
526  const Iterator begin() const;
527 
528  const Iterator end() const;
529 
530  size_t size() const;
531 
532  GDALRasterBand *operator[](int iBand);
533  GDALRasterBand *operator[](size_t iBand);
534  };
535 
536  Bands GetBands();
537 
538  virtual CPLErr FlushCache(bool bAtClosing = false);
539 
540  virtual GIntBig GetEstimatedRAMUsage();
541 
542  virtual const OGRSpatialReference *GetSpatialRef() const;
543  virtual CPLErr SetSpatialRef(const OGRSpatialReference *poSRS);
544 
545  // Compatibility layer
546  const char *GetProjectionRef(void) const;
547  CPLErr SetProjection(const char *pszProjection);
548 
549  virtual CPLErr GetGeoTransform(double *padfTransform);
550  virtual CPLErr SetGeoTransform(double *padfTransform);
551 
552  virtual CPLErr AddBand(GDALDataType eType, char **papszOptions = nullptr);
553 
554  virtual void *GetInternalHandle(const char *pszHandleName);
555  virtual GDALDriver *GetDriver(void);
556  virtual char **GetFileList(void);
557 
558  virtual const char *GetDriverName();
559 
560  virtual const OGRSpatialReference *GetGCPSpatialRef() const;
561  virtual int GetGCPCount();
562  virtual const GDAL_GCP *GetGCPs();
563  virtual CPLErr SetGCPs(int nGCPCount, const GDAL_GCP *pasGCPList,
564  const OGRSpatialReference *poGCP_SRS);
565 
566  // Compatibility layer
567  const char *GetGCPProjection();
568  CPLErr SetGCPs(int nGCPCount, const GDAL_GCP *pasGCPList,
569  const char *pszGCPProjection);
570 
571  virtual CPLErr AdviseRead(int nXOff, int nYOff, int nXSize, int nYSize,
572  int nBufXSize, int nBufYSize, GDALDataType eDT,
573  int nBandCount, int *panBandList,
574  char **papszOptions);
575 
576  virtual CPLErr CreateMaskBand(int nFlagsIn);
577 
578  virtual GDALAsyncReader *
579  BeginAsyncReader(int nXOff, int nYOff, int nXSize, int nYSize, void *pBuf,
580  int nBufXSize, int nBufYSize, GDALDataType eBufType,
581  int nBandCount, int *panBandMap, int nPixelSpace,
582  int nLineSpace, int nBandSpace, char **papszOptions);
583  virtual void EndAsyncReader(GDALAsyncReader *);
584 
586  struct RawBinaryLayout
587  {
588  enum class Interleaving
589  {
590  UNKNOWN,
591  BIP,
592  BIL,
593  BSQ
594  };
595  std::string osRawFilename{};
596  Interleaving eInterleaving = Interleaving::UNKNOWN;
597  GDALDataType eDataType = GDT_Unknown;
598  bool bLittleEndianOrder = false;
599 
600  vsi_l_offset nImageOffset = 0;
601  GIntBig nPixelOffset = 0;
602  GIntBig nLineOffset = 0;
603  GIntBig nBandOffset = 0;
604  };
605 
606  virtual bool GetRawBinaryLayout(RawBinaryLayout &);
608 
609  CPLErr RasterIO(GDALRWFlag, int, int, int, int, void *, int, int,
610  GDALDataType, int, int *, GSpacing, GSpacing, GSpacing,
611  GDALRasterIOExtraArg *psExtraArg
612 #ifndef DOXYGEN_SKIP
613  OPTIONAL_OUTSIDE_GDAL(nullptr)
614 #endif
616 
617  virtual CPLStringList GetCompressionFormats(int nXOff, int nYOff,
618  int nXSize, int nYSize,
619  int nBandCount,
620  const int *panBandList);
621  virtual CPLErr ReadCompressedData(const char *pszFormat, int nXOff,
622  int nYOff, int nXSize, int nYSize,
623  int nBands, const int *panBandList,
624  void **ppBuffer, size_t *pnBufferSize,
625  char **ppszDetailedFormat);
626 
627  int Reference();
628  int Dereference();
629  int ReleaseRef();
630 
635  {
636  return eAccess;
637  }
638 
639  int GetShared() const;
640  void MarkAsShared();
641 
642  void MarkSuppressOnClose();
643 
647  char **GetOpenOptions()
648  {
649  return papszOpenOptions;
650  }
651 
652  static GDALDataset **GetOpenDatasets(int *pnDatasetCount);
653 
654  CPLErr BuildOverviews(const char *, int, const int *, int, const int *,
655  GDALProgressFunc, void *,
656  CSLConstList papszOptions
657 #ifndef DOXYGEN_SKIP
658  OPTIONAL_OUTSIDE_GDAL(nullptr)
659 #endif
660  );
661 
662 #ifndef DOXYGEN_XML
663  void ReportError(CPLErr eErrClass, CPLErrorNum err_no, const char *fmt, ...)
664  CPL_PRINT_FUNC_FORMAT(4, 5);
665 
666  static void ReportError(const char *pszDSName, CPLErr eErrClass,
667  CPLErrorNum err_no, const char *fmt, ...)
668  CPL_PRINT_FUNC_FORMAT(4, 5);
669 #endif
670 
671  char **GetMetadata(const char *pszDomain = "") override;
672 
673 // Only defined when Doxygen enabled
674 #ifdef DOXYGEN_SKIP
675  CPLErr SetMetadata(char **papszMetadata, const char *pszDomain) override;
676  CPLErr SetMetadataItem(const char *pszName, const char *pszValue,
677  const char *pszDomain) override;
678 #endif
679 
680  char **GetMetadataDomainList() override;
681 
682  virtual void ClearStatistics();
683 
687  static inline GDALDatasetH ToHandle(GDALDataset *poDS)
688  {
689  return static_cast<GDALDatasetH>(poDS);
690  }
691 
695  static inline GDALDataset *FromHandle(GDALDatasetH hDS)
696  {
697  return static_cast<GDALDataset *>(hDS);
698  }
699 
703  static GDALDataset *Open(const char *pszFilename,
704  unsigned int nOpenFlags = 0,
705  const char *const *papszAllowedDrivers = nullptr,
706  const char *const *papszOpenOptions = nullptr,
707  const char *const *papszSiblingFiles = nullptr)
708  {
709  return FromHandle(GDALOpenEx(pszFilename, nOpenFlags,
710  papszAllowedDrivers, papszOpenOptions,
711  papszSiblingFiles));
712  }
713 
716  {
719 
721  OGRLayer *layer = nullptr;
722  };
723 
725  // SetEnableOverviews() only to be used by GDALOverviewDataset
726  void SetEnableOverviews(bool bEnable);
727 
728  // Only to be used by driver's GetOverviewCount() method.
729  bool AreOverviewsEnabled() const;
731 
732  private:
733  class Private;
734  Private *m_poPrivate;
735 
736  CPL_INTERNAL OGRLayer *BuildLayerFromSelectInfo(
737  swq_select *psSelectInfo, OGRGeometry *poSpatialFilter,
738  const char *pszDialect, swq_select_parse_options *poSelectParseOptions);
739  CPLStringList oDerivedMetadataList{};
740 
741  public:
742  virtual int GetLayerCount();
743  virtual OGRLayer *GetLayer(int iLayer);
744 
745  virtual bool IsLayerPrivate(int iLayer) const;
746 
750  class CPL_DLL Layers
751  {
752  private:
753  friend class GDALDataset;
754  GDALDataset *m_poSelf;
755  CPL_INTERNAL explicit Layers(GDALDataset *poSelf) : m_poSelf(poSelf)
756  {
757  }
758 
759  public:
763  class CPL_DLL Iterator
764  {
765  struct Private;
766  std::unique_ptr<Private> m_poPrivate;
767 
768  public:
769  using value_type = OGRLayer *;
770  using reference = OGRLayer *;
771  using difference_type = void;
772  using pointer = void;
773  using iterator_category =
774  std::input_iterator_tag;
776  Iterator();
777  Iterator(GDALDataset *poDS, bool bStart);
778  Iterator(const Iterator &oOther);
779  Iterator(Iterator &&oOther) noexcept;
780  ~Iterator();
782  Iterator &
783  operator=(const Iterator &oOther);
784  Iterator &operator=(
785  Iterator &&oOther) noexcept;
787  OGRLayer *operator*() const;
788  Iterator &operator++();
789  Iterator operator++(int);
790  bool operator!=(const Iterator &it)
791  const;
792  };
793 
794  Iterator begin() const;
795  Iterator end() const;
796 
797  size_t size() const;
798 
799  OGRLayer *operator[](int iLayer);
800  OGRLayer *operator[](size_t iLayer);
801  OGRLayer *operator[](const char *pszLayername);
802  };
803 
804  Layers GetLayers();
805 
806  virtual OGRLayer *GetLayerByName(const char *);
807  virtual OGRErr DeleteLayer(int iLayer);
808 
809  virtual void ResetReading();
810  virtual OGRFeature *GetNextFeature(OGRLayer **ppoBelongingLayer,
811  double *pdfProgressPct,
812  GDALProgressFunc pfnProgress,
813  void *pProgressData);
814 
817  class CPL_DLL Features
818  {
819  private:
820  friend class GDALDataset;
821  GDALDataset *m_poSelf;
822  CPL_INTERNAL explicit Features(GDALDataset *poSelf) : m_poSelf(poSelf)
823  {
824  }
825 
826  class CPL_DLL Iterator
827  {
828  struct Private;
829  std::unique_ptr<Private> m_poPrivate;
830 
831  public:
832  Iterator(GDALDataset *poDS, bool bStart);
833  Iterator(const Iterator &oOther); // declared but not defined.
834  // Needed for gcc 5.4 at least
835  Iterator(Iterator &&oOther) noexcept; // declared but not defined.
836  // Needed for gcc 5.4 at least
837  ~Iterator();
838  const FeatureLayerPair &operator*() const;
839  Iterator &operator++();
840  bool operator!=(const Iterator &it) const;
841  };
842 
843  public:
844  const Iterator begin() const;
845 
846  const Iterator end() const;
847  };
848 
849  Features GetFeatures();
850 
851  virtual int TestCapability(const char *);
852 
853  virtual std::vector<std::string>
854  GetFieldDomainNames(CSLConstList papszOptions = nullptr) const;
855 
856  virtual const OGRFieldDomain *GetFieldDomain(const std::string &name) const;
857 
858  virtual bool AddFieldDomain(std::unique_ptr<OGRFieldDomain> &&domain,
859  std::string &failureReason);
860 
861  virtual bool DeleteFieldDomain(const std::string &name,
862  std::string &failureReason);
863 
864  virtual bool UpdateFieldDomain(std::unique_ptr<OGRFieldDomain> &&domain,
865  std::string &failureReason);
866 
867  virtual std::vector<std::string>
868  GetRelationshipNames(CSLConstList papszOptions = nullptr) const;
869 
870  virtual const GDALRelationship *
871  GetRelationship(const std::string &name) const;
872 
873  virtual bool
874  AddRelationship(std::unique_ptr<GDALRelationship> &&relationship,
875  std::string &failureReason);
876 
877  virtual bool DeleteRelationship(const std::string &name,
878  std::string &failureReason);
879 
880  virtual bool
881  UpdateRelationship(std::unique_ptr<GDALRelationship> &&relationship,
882  std::string &failureReason);
883 
884  virtual OGRLayer *CreateLayer(
885  const char *pszName, const OGRSpatialReference *poSpatialRef = nullptr,
886  OGRwkbGeometryType eGType = wkbUnknown, char **papszOptions = nullptr);
887  virtual OGRLayer *CopyLayer(OGRLayer *poSrcLayer, const char *pszNewName,
888  char **papszOptions = nullptr);
889 
890  virtual OGRStyleTable *GetStyleTable();
891  virtual void SetStyleTableDirectly(OGRStyleTable *poStyleTable);
892 
893  virtual void SetStyleTable(OGRStyleTable *poStyleTable);
894 
895  virtual OGRLayer *ExecuteSQL(const char *pszStatement,
896  OGRGeometry *poSpatialFilter,
897  const char *pszDialect);
898  virtual void ReleaseResultSet(OGRLayer *poResultsSet);
899  virtual OGRErr AbortSQL();
900 
901  int GetRefCount() const;
902  int GetSummaryRefCount() const;
903  OGRErr Release();
904 
905  virtual OGRErr StartTransaction(int bForce = FALSE);
906  virtual OGRErr CommitTransaction();
907  virtual OGRErr RollbackTransaction();
908 
909  virtual std::shared_ptr<GDALGroup> GetRootGroup() const;
910 
912  static int IsGenericSQLDialect(const char *pszDialect);
913 
914  // Semi-public methods. Only to be used by in-tree drivers.
915  GDALSQLParseInfo *
916  BuildParseInfo(swq_select *psSelectInfo,
917  swq_select_parse_options *poSelectParseOptions);
918  static void DestroyParseInfo(GDALSQLParseInfo *psParseInfo);
919  OGRLayer *ExecuteSQL(const char *pszStatement, OGRGeometry *poSpatialFilter,
920  const char *pszDialect,
921  swq_select_parse_options *poSelectParseOptions);
923 
924  protected:
925  virtual OGRLayer *ICreateLayer(
926  const char *pszName, const OGRSpatialReference *poSpatialRef = nullptr,
927  OGRwkbGeometryType eGType = wkbUnknown, char **papszOptions = nullptr);
928 
930  OGRErr ProcessSQLCreateIndex(const char *);
931  OGRErr ProcessSQLDropIndex(const char *);
932  OGRErr ProcessSQLDropTable(const char *);
933  OGRErr ProcessSQLAlterTableAddColumn(const char *);
934  OGRErr ProcessSQLAlterTableDropColumn(const char *);
935  OGRErr ProcessSQLAlterTableAlterColumn(const char *);
936  OGRErr ProcessSQLAlterTableRenameColumn(const char *);
937 
938  OGRStyleTable *m_poStyleTable = nullptr;
939 
940  friend class GDALProxyPoolDataset;
942 
943  private:
945 };
946 
948 struct CPL_DLL GDALDatasetUniquePtrDeleter
949 {
950  void operator()(GDALDataset *poDataset) const
951  {
952  GDALClose(poDataset);
953  }
954 };
956 
962 using GDALDatasetUniquePtr =
963  std::unique_ptr<GDALDataset, GDALDatasetUniquePtrDeleter>;
964 
965 /* ******************************************************************** */
966 /* GDALRasterBlock */
967 /* ******************************************************************** */
968 
973 class CPL_DLL GDALRasterBlock
974 {
975  friend class GDALAbstractBandBlockCache;
976 
977  GDALDataType eType;
978 
979  bool bDirty;
980  volatile int nLockCount;
981 
982  int nXOff;
983  int nYOff;
984 
985  int nXSize;
986  int nYSize;
987 
988  void *pData;
989 
990  GDALRasterBand *poBand;
991 
992  GDALRasterBlock *poNext;
993  GDALRasterBlock *poPrevious;
994 
995  bool bMustDetach;
996 
997  CPL_INTERNAL void Detach_unlocked(void);
998  CPL_INTERNAL void Touch_unlocked(void);
999 
1000  CPL_INTERNAL void RecycleFor(int nXOffIn, int nYOffIn);
1001 
1002  public:
1003  GDALRasterBlock(GDALRasterBand *, int, int);
1004  GDALRasterBlock(int nXOffIn, int nYOffIn); /* only for lookup purpose */
1005  virtual ~GDALRasterBlock();
1006 
1007  CPLErr Internalize(void);
1008  void Touch(void);
1009  void MarkDirty(void);
1010  void MarkClean(void);
1012  int AddLock(void)
1013  {
1014  return CPLAtomicInc(&nLockCount);
1015  }
1017  int DropLock(void)
1018  {
1019  return CPLAtomicDec(&nLockCount);
1020  }
1021  void Detach();
1022 
1023  CPLErr Write();
1024 
1029  {
1030  return eType;
1031  }
1035  int GetXOff() const
1036  {
1037  return nXOff;
1038  }
1042  int GetYOff() const
1043  {
1044  return nYOff;
1045  }
1049  int GetXSize() const
1050  {
1051  return nXSize;
1052  }
1056  int GetYSize() const
1057  {
1058  return nYSize;
1059  }
1063  int GetDirty() const
1064  {
1065  return bDirty;
1066  }
1070  void *GetDataRef(void)
1071  {
1072  return pData;
1073  }
1078  {
1079  return static_cast<GPtrDiff_t>(nXSize) * nYSize *
1080  GDALGetDataTypeSizeBytes(eType);
1081  }
1082 
1083  int TakeLock();
1084  int DropLockForRemovalFromStorage();
1085 
1089  {
1090  return poBand;
1091  }
1092 
1093  static void FlushDirtyBlocks();
1094  static int FlushCacheBlock(int bDirtyBlocksOnly = FALSE);
1095  static void Verify();
1096 
1097  static void EnterDisableDirtyBlockFlush();
1098  static void LeaveDisableDirtyBlockFlush();
1099 
1100 #ifdef notdef
1101  static void CheckNonOrphanedBlocks(GDALRasterBand *poBand);
1102  void DumpBlock();
1103  static void DumpAll();
1104 #endif
1105 
1106  /* Should only be called by GDALDestroyDriverManager() */
1108  CPL_INTERNAL static void DestroyRBMutex();
1110 
1111  private:
1113 };
1114 
1115 /* ******************************************************************** */
1116 /* GDALColorTable */
1117 /* ******************************************************************** */
1118 
1121 class CPL_DLL GDALColorTable
1122 {
1123  GDALPaletteInterp eInterp;
1124 
1125  std::vector<GDALColorEntry> aoEntries{};
1126 
1127  public:
1129  ~GDALColorTable();
1130 
1131  GDALColorTable *Clone() const;
1132  int IsSame(const GDALColorTable *poOtherCT) const;
1133 
1134  GDALPaletteInterp GetPaletteInterpretation() const;
1135 
1136  int GetColorEntryCount() const;
1137  const GDALColorEntry *GetColorEntry(int) const;
1138  int GetColorEntryAsRGB(int, GDALColorEntry *) const;
1139  void SetColorEntry(int, const GDALColorEntry *);
1140  int CreateColorRamp(int, const GDALColorEntry *, int,
1141  const GDALColorEntry *);
1142  bool IsIdentity() const;
1143 
1148  {
1149  return static_cast<GDALColorTableH>(poCT);
1150  }
1151 
1156  {
1157  return static_cast<GDALColorTable *>(hCT);
1158  }
1159 };
1160 
1161 /* ******************************************************************** */
1162 /* GDALAbstractBandBlockCache */
1163 /* ******************************************************************** */
1164 
1166 
1168 // only used by GDALRasterBand implementation.
1169 
1170 class GDALAbstractBandBlockCache
1171 {
1172  // List of blocks that can be freed or recycled, and its lock
1173  CPLLock *hSpinLock = nullptr;
1174  GDALRasterBlock *psListBlocksToFree = nullptr;
1175 
1176  // Band keep alive counter, and its lock & condition
1177  CPLCond *hCond = nullptr;
1178  CPLMutex *hCondMutex = nullptr;
1179  volatile int nKeepAliveCounter = 0;
1180 
1181  volatile int m_nDirtyBlocks = 0;
1182 
1183  CPL_DISALLOW_COPY_ASSIGN(GDALAbstractBandBlockCache)
1184 
1185  protected:
1186  GDALRasterBand *poBand;
1187 
1188  int m_nInitialDirtyBlocksInFlushCache = 0;
1189  int m_nLastTick = -1;
1190  bool m_bWriteDirtyBlocks = true;
1191 
1192  void FreeDanglingBlocks();
1193  void UnreferenceBlockBase();
1194 
1195  void StartDirtyBlockFlushingLog();
1196  void UpdateDirtyBlockFlushingLog();
1197  void EndDirtyBlockFlushingLog();
1198 
1199  public:
1200  explicit GDALAbstractBandBlockCache(GDALRasterBand *poBand);
1201  virtual ~GDALAbstractBandBlockCache();
1202 
1203  GDALRasterBlock *CreateBlock(int nXBlockOff, int nYBlockOff);
1204  void AddBlockToFreeList(GDALRasterBlock *);
1205  void IncDirtyBlocks(int nInc);
1206  void WaitCompletionPendingTasks();
1207  void DisableDirtyBlockWriting()
1208  {
1209  m_bWriteDirtyBlocks = false;
1210  }
1211  bool HasDirtyBlocks() const
1212  {
1213  return m_nDirtyBlocks > 0;
1214  }
1215 
1216  virtual bool Init() = 0;
1217  virtual bool IsInitOK() = 0;
1218  virtual CPLErr FlushCache() = 0;
1219  virtual CPLErr AdoptBlock(GDALRasterBlock *poBlock) = 0;
1220  virtual GDALRasterBlock *TryGetLockedBlockRef(int nXBlockOff,
1221  int nYBlockYOff) = 0;
1222  virtual CPLErr UnreferenceBlock(GDALRasterBlock *poBlock) = 0;
1223  virtual CPLErr FlushBlock(int nXBlockOff, int nYBlockOff,
1224  int bWriteDirtyBlock) = 0;
1225 };
1226 
1227 GDALAbstractBandBlockCache *
1228 GDALArrayBandBlockCacheCreate(GDALRasterBand *poBand);
1229 GDALAbstractBandBlockCache *
1230 GDALHashSetBandBlockCacheCreate(GDALRasterBand *poBand);
1231 
1233 
1234 /* ******************************************************************** */
1235 /* GDALRasterBand */
1236 /* ******************************************************************** */
1237 
1238 class GDALMDArray;
1239 
1241 typedef enum
1242 {
1243  GMVR_UNKNOWN,
1248 
1251 
1254 
1257 
1260 
1263 
1267 
1270 class CPL_DLL GDALRasterBand : public GDALMajorObject
1271 {
1272  private:
1273  friend class GDALArrayBandBlockCache;
1274  friend class GDALHashSetBandBlockCache;
1275  friend class GDALRasterBlock;
1276  friend class GDALDataset;
1277 
1278  CPLErr eFlushBlockErr = CE_None;
1279  GDALAbstractBandBlockCache *poBandBlockCache = nullptr;
1280 
1281  CPL_INTERNAL void SetFlushBlockErr(CPLErr eErr);
1282  CPL_INTERNAL CPLErr UnreferenceBlock(GDALRasterBlock *poBlock);
1283  CPL_INTERNAL void IncDirtyBlocks(int nInc);
1284 
1285  protected:
1287  GDALDataset *poDS = nullptr;
1288  int nBand = 0; /* 1 based */
1289 
1290  int nRasterXSize = 0;
1291  int nRasterYSize = 0;
1292 
1293  GDALDataType eDataType = GDT_Byte;
1294  GDALAccess eAccess = GA_ReadOnly;
1295 
1296  /* stuff related to blocking, and raster cache */
1297  int nBlockXSize = -1;
1298  int nBlockYSize = -1;
1299  int nBlocksPerRow = 0;
1300  int nBlocksPerColumn = 0;
1301 
1302  int nBlockReads = 0;
1303  int bForceCachedIO = 0;
1304 
1305  GDALRasterBand *poMask = nullptr;
1306  bool bOwnMask = false;
1307  bool m_bEnablePixelTypeSignedByteWarning =
1308  true; // Remove me in GDAL 4.0. See GetMetadataItem() implementation
1309  int nMaskFlags = 0;
1310 
1311  void InvalidateMaskBand();
1312 
1313  friend class GDALProxyRasterBand;
1314  friend class GDALDefaultOverviews;
1315 
1316  CPLErr
1317  RasterIOResampled(GDALRWFlag, int, int, int, int, void *, int, int,
1320 
1321  int EnterReadWrite(GDALRWFlag eRWFlag);
1322  void LeaveReadWrite();
1323  void InitRWLock();
1324  void SetValidPercent(GUIntBig nSampleCount, GUIntBig nValidCount);
1325 
1327 
1328  protected:
1329  virtual CPLErr IReadBlock(int nBlockXOff, int nBlockYOff, void *pData) = 0;
1330  virtual CPLErr IWriteBlock(int nBlockXOff, int nBlockYOff, void *pData);
1331 
1332  virtual CPLErr
1333  IRasterIO(GDALRWFlag, int, int, int, int, void *, int, int, GDALDataType,
1334  GSpacing, GSpacing,
1336 
1337  virtual int IGetDataCoverageStatus(int nXOff, int nYOff, int nXSize,
1338  int nYSize, int nMaskFlagStop,
1339  double *pdfDataPct);
1341  CPLErr
1342  OverviewRasterIO(GDALRWFlag, int, int, int, int, void *, int, int,
1345 
1346  CPLErr TryOverviewRasterIO(GDALRWFlag eRWFlag, int nXOff, int nYOff,
1347  int nXSize, int nYSize, void *pData,
1348  int nBufXSize, int nBufYSize,
1349  GDALDataType eBufType, GSpacing nPixelSpace,
1350  GSpacing nLineSpace,
1351  GDALRasterIOExtraArg *psExtraArg, int *pbTried);
1352 
1353  int InitBlockInfo();
1354 
1355  void AddBlockToFreeList(GDALRasterBlock *);
1356 
1357  bool HasBlockCache() const
1358  {
1359  return poBandBlockCache != nullptr;
1360  }
1361 
1362  bool HasDirtyBlocks() const
1363  {
1364  return poBandBlockCache && poBandBlockCache->HasDirtyBlocks();
1365  }
1367 
1368  public:
1369  GDALRasterBand();
1370  explicit GDALRasterBand(int bForceCachedIO);
1371 
1372  ~GDALRasterBand() override;
1373 
1374  int GetXSize();
1375  int GetYSize();
1376  int GetBand();
1377  GDALDataset *GetDataset();
1378 
1379  GDALDataType GetRasterDataType(void);
1380  void GetBlockSize(int *, int *);
1381  CPLErr GetActualBlockSize(int, int, int *, int *);
1382 
1384  GetSuggestedBlockAccessPattern() const;
1385 
1386  GDALAccess GetAccess();
1387 
1388  CPLErr RasterIO(GDALRWFlag, int, int, int, int, void *, int, int,
1390  GDALRasterIOExtraArg *psExtraArg
1391 #ifndef DOXYGEN_SKIP
1392  OPTIONAL_OUTSIDE_GDAL(nullptr)
1393 #endif
1395  CPLErr ReadBlock(int, int, void *) CPL_WARN_UNUSED_RESULT;
1396 
1397  CPLErr WriteBlock(int, int, void *) CPL_WARN_UNUSED_RESULT;
1398 
1399  GDALRasterBlock *
1400  GetLockedBlockRef(int nXBlockOff, int nYBlockOff,
1401  int bJustInitialize = FALSE) CPL_WARN_UNUSED_RESULT;
1402  GDALRasterBlock *TryGetLockedBlockRef(int nXBlockOff, int nYBlockYOff)
1404  CPLErr FlushBlock(int, int, int bWriteDirtyBlock = TRUE);
1405 
1406  unsigned char *
1407  GetIndexColorTranslationTo(/* const */ GDALRasterBand *poReferenceBand,
1408  unsigned char *pTranslationTable = nullptr,
1409  int *pApproximateMatching = nullptr);
1410 
1411  // New OpengIS CV_SampleDimension stuff.
1412 
1413  virtual CPLErr FlushCache(bool bAtClosing = false);
1414  virtual char **GetCategoryNames();
1415  virtual double GetNoDataValue(int *pbSuccess = nullptr);
1416  virtual int64_t GetNoDataValueAsInt64(int *pbSuccess = nullptr);
1417  virtual uint64_t GetNoDataValueAsUInt64(int *pbSuccess = nullptr);
1418  virtual double GetMinimum(int *pbSuccess = nullptr);
1419  virtual double GetMaximum(int *pbSuccess = nullptr);
1420  virtual double GetOffset(int *pbSuccess = nullptr);
1421  virtual double GetScale(int *pbSuccess = nullptr);
1422  virtual const char *GetUnitType();
1423  virtual GDALColorInterp GetColorInterpretation();
1424  virtual GDALColorTable *GetColorTable();
1425  virtual CPLErr Fill(double dfRealValue, double dfImaginaryValue = 0);
1426 
1427  virtual CPLErr SetCategoryNames(char **papszNames);
1428  virtual CPLErr SetNoDataValue(double dfNoData);
1429  virtual CPLErr SetNoDataValueAsInt64(int64_t nNoData);
1430  virtual CPLErr SetNoDataValueAsUInt64(uint64_t nNoData);
1431  virtual CPLErr DeleteNoDataValue();
1432  virtual CPLErr SetColorTable(GDALColorTable *poCT);
1433  virtual CPLErr SetColorInterpretation(GDALColorInterp eColorInterp);
1434  virtual CPLErr SetOffset(double dfNewOffset);
1435  virtual CPLErr SetScale(double dfNewScale);
1436  virtual CPLErr SetUnitType(const char *pszNewValue);
1437 
1438  virtual CPLErr GetStatistics(int bApproxOK, int bForce, double *pdfMin,
1439  double *pdfMax, double *pdfMean,
1440  double *padfStdDev);
1441  virtual CPLErr ComputeStatistics(int bApproxOK, double *pdfMin,
1442  double *pdfMax, double *pdfMean,
1443  double *pdfStdDev, GDALProgressFunc,
1444  void *pProgressData);
1445  virtual CPLErr SetStatistics(double dfMin, double dfMax, double dfMean,
1446  double dfStdDev);
1447  virtual CPLErr ComputeRasterMinMax(int, double *);
1448 
1449 // Only defined when Doxygen enabled
1450 #ifdef DOXYGEN_SKIP
1451  CPLErr SetMetadata(char **papszMetadata, const char *pszDomain) override;
1452  CPLErr SetMetadataItem(const char *pszName, const char *pszValue,
1453  const char *pszDomain) override;
1454 #endif
1455  virtual const char *GetMetadataItem(const char *pszName,
1456  const char *pszDomain = "") override;
1457 
1458  virtual int HasArbitraryOverviews();
1459  virtual int GetOverviewCount();
1460  virtual GDALRasterBand *GetOverview(int);
1461  virtual GDALRasterBand *GetRasterSampleOverview(GUIntBig);
1462  virtual CPLErr BuildOverviews(const char *pszResampling, int nOverviews,
1463  const int *panOverviewList,
1464  GDALProgressFunc pfnProgress,
1465  void *pProgressData,
1466  CSLConstList papszOptions);
1467 
1468  virtual CPLErr AdviseRead(int nXOff, int nYOff, int nXSize, int nYSize,
1469  int nBufXSize, int nBufYSize,
1470  GDALDataType eBufType, char **papszOptions);
1471 
1472  virtual CPLErr GetHistogram(double dfMin, double dfMax, int nBuckets,
1473  GUIntBig *panHistogram, int bIncludeOutOfRange,
1474  int bApproxOK, GDALProgressFunc,
1475  void *pProgressData);
1476 
1477  virtual CPLErr GetDefaultHistogram(double *pdfMin, double *pdfMax,
1478  int *pnBuckets, GUIntBig **ppanHistogram,
1479  int bForce, GDALProgressFunc,
1480  void *pProgressData);
1481  virtual CPLErr SetDefaultHistogram(double dfMin, double dfMax, int nBuckets,
1482  GUIntBig *panHistogram);
1483 
1484  virtual GDALRasterAttributeTable *GetDefaultRAT();
1485  virtual CPLErr SetDefaultRAT(const GDALRasterAttributeTable *poRAT);
1486 
1487  virtual GDALRasterBand *GetMaskBand();
1488  virtual int GetMaskFlags();
1489  virtual CPLErr CreateMaskBand(int nFlagsIn);
1490  virtual bool IsMaskBand() const;
1491  virtual GDALMaskValueRange GetMaskValueRange() const;
1492 
1493  virtual CPLVirtualMem *
1494  GetVirtualMemAuto(GDALRWFlag eRWFlag, int *pnPixelSpace,
1495  GIntBig *pnLineSpace,
1496  char **papszOptions) CPL_WARN_UNUSED_RESULT;
1497 
1498  int GetDataCoverageStatus(int nXOff, int nYOff, int nXSize, int nYSize,
1499  int nMaskFlagStop = 0,
1500  double *pdfDataPct = nullptr);
1501 
1502  std::shared_ptr<GDALMDArray> AsMDArray() const;
1503 
1504 #ifndef DOXYGEN_XML
1505  void ReportError(CPLErr eErrClass, CPLErrorNum err_no, const char *fmt, ...)
1506  CPL_PRINT_FUNC_FORMAT(4, 5);
1507 #endif
1508 
1512  static inline GDALRasterBandH ToHandle(GDALRasterBand *poBand)
1513  {
1514  return static_cast<GDALRasterBandH>(poBand);
1515  }
1516 
1521  {
1522  return static_cast<GDALRasterBand *>(hBand);
1523  }
1524 
1526  // Remove me in GDAL 4.0. See GetMetadataItem() implementation
1527  // Internal use in GDAL only !
1528  void EnablePixelTypeSignedByteWarning(bool b)
1529 #ifndef GDAL_COMPILATION
1530  CPL_WARN_DEPRECATED("Do not use that method outside of GDAL!")
1531 #endif
1532  ;
1533 
1535 
1536  private:
1538 };
1539 
1541 /* ******************************************************************** */
1542 /* GDALAllValidMaskBand */
1543 /* ******************************************************************** */
1544 
1545 class CPL_DLL GDALAllValidMaskBand : public GDALRasterBand
1546 {
1547  protected:
1548  CPLErr IReadBlock(int, int, void *) override;
1549 
1550  CPL_DISALLOW_COPY_ASSIGN(GDALAllValidMaskBand)
1551 
1552  public:
1553  explicit GDALAllValidMaskBand(GDALRasterBand *);
1554  ~GDALAllValidMaskBand() override;
1555 
1556  GDALRasterBand *GetMaskBand() override;
1557  int GetMaskFlags() override;
1558 
1559  bool IsMaskBand() const override
1560  {
1561  return true;
1562  }
1563  GDALMaskValueRange GetMaskValueRange() const override
1564  {
1565  return GMVR_0_AND_255_ONLY;
1566  }
1567 
1568  CPLErr ComputeStatistics(int bApproxOK, double *pdfMin, double *pdfMax,
1569  double *pdfMean, double *pdfStdDev,
1570  GDALProgressFunc, void *pProgressData) override;
1571 };
1572 
1573 /* ******************************************************************** */
1574 /* GDALNoDataMaskBand */
1575 /* ******************************************************************** */
1576 
1577 class CPL_DLL GDALNoDataMaskBand : public GDALRasterBand
1578 {
1579  friend class GDALRasterBand;
1580  double m_dfNoDataValue = 0;
1581  int64_t m_nNoDataValueInt64 = 0;
1582  uint64_t m_nNoDataValueUInt64 = 0;
1583  GDALRasterBand *m_poParent = nullptr;
1584 
1585  CPL_DISALLOW_COPY_ASSIGN(GDALNoDataMaskBand)
1586 
1587  protected:
1588  CPLErr IReadBlock(int, int, void *) override;
1589  CPLErr IRasterIO(GDALRWFlag, int, int, int, int, void *, int, int,
1591  GDALRasterIOExtraArg *psExtraArg) override;
1592 
1593  public:
1594  explicit GDALNoDataMaskBand(GDALRasterBand *);
1595  explicit GDALNoDataMaskBand(GDALRasterBand *, double dfNoDataValue);
1596  ~GDALNoDataMaskBand() override;
1597 
1598  bool IsMaskBand() const override
1599  {
1600  return true;
1601  }
1602  GDALMaskValueRange GetMaskValueRange() const override
1603  {
1604  return GMVR_0_AND_255_ONLY;
1605  }
1606 
1607  static bool IsNoDataInRange(double dfNoDataValue, GDALDataType eDataType);
1608 };
1609 
1610 /* ******************************************************************** */
1611 /* GDALNoDataValuesMaskBand */
1612 /* ******************************************************************** */
1613 
1614 class CPL_DLL GDALNoDataValuesMaskBand : public GDALRasterBand
1615 {
1616  double *padfNodataValues;
1617 
1618  CPL_DISALLOW_COPY_ASSIGN(GDALNoDataValuesMaskBand)
1619 
1620  protected:
1621  CPLErr IReadBlock(int, int, void *) override;
1622 
1623  public:
1624  explicit GDALNoDataValuesMaskBand(GDALDataset *);
1625  ~GDALNoDataValuesMaskBand() override;
1626 
1627  bool IsMaskBand() const override
1628  {
1629  return true;
1630  }
1631  GDALMaskValueRange GetMaskValueRange() const override
1632  {
1633  return GMVR_0_AND_255_ONLY;
1634  }
1635 };
1636 
1637 /* ******************************************************************** */
1638 /* GDALRescaledAlphaBand */
1639 /* ******************************************************************** */
1640 
1641 class GDALRescaledAlphaBand : public GDALRasterBand
1642 {
1643  GDALRasterBand *poParent;
1644  void *pTemp;
1645 
1646  CPL_DISALLOW_COPY_ASSIGN(GDALRescaledAlphaBand)
1647 
1648  protected:
1649  CPLErr IReadBlock(int, int, void *) override;
1650  CPLErr IRasterIO(GDALRWFlag, int, int, int, int, void *, int, int,
1652  GDALRasterIOExtraArg *psExtraArg) override;
1653 
1654  public:
1655  explicit GDALRescaledAlphaBand(GDALRasterBand *);
1656  ~GDALRescaledAlphaBand() override;
1657 
1658  bool IsMaskBand() const override
1659  {
1660  return true;
1661  }
1662 };
1664 
1665 /* ******************************************************************** */
1666 /* GDALIdentifyEnum */
1667 /* ******************************************************************** */
1668 
1674 typedef enum
1675 {
1684 
1685 /* ******************************************************************** */
1686 /* GDALDriver */
1687 /* ******************************************************************** */
1688 
1700 class CPL_DLL GDALDriver : public GDALMajorObject
1701 {
1702  public:
1703  GDALDriver();
1704  ~GDALDriver() override;
1705 
1706  CPLErr SetMetadataItem(const char *pszName, const char *pszValue,
1707  const char *pszDomain = "") override;
1708 
1709  /* -------------------------------------------------------------------- */
1710  /* Public C++ methods. */
1711  /* -------------------------------------------------------------------- */
1712  GDALDataset *Create(const char *pszName, int nXSize, int nYSize, int nBands,
1713  GDALDataType eType,
1714  CSLConstList papszOptions) CPL_WARN_UNUSED_RESULT;
1715 
1716  GDALDataset *
1717  CreateMultiDimensional(const char *pszName,
1718  CSLConstList papszRootGroupOptions,
1719  CSLConstList papszOptions) CPL_WARN_UNUSED_RESULT;
1720 
1721  CPLErr Delete(const char *pszName);
1722  CPLErr Rename(const char *pszNewName, const char *pszOldName);
1723  CPLErr CopyFiles(const char *pszNewName, const char *pszOldName);
1724 
1725  GDALDataset *CreateCopy(const char *, GDALDataset *, int,
1726  CSLConstList papszOptions,
1727  GDALProgressFunc pfnProgress,
1728  void *pProgressData) CPL_WARN_UNUSED_RESULT;
1729 
1730  bool CanVectorTranslateFrom(const char *pszDestName,
1731  GDALDataset *poSourceDS,
1732  CSLConstList papszVectorTranslateArguments,
1733  char ***ppapszFailureReasons);
1734 
1735  GDALDataset *
1736  VectorTranslateFrom(const char *pszDestName, GDALDataset *poSourceDS,
1737  CSLConstList papszVectorTranslateArguments,
1738  GDALProgressFunc pfnProgress,
1739  void *pProgressData) CPL_WARN_UNUSED_RESULT;
1740 
1741  /* -------------------------------------------------------------------- */
1742  /* The following are semiprivate, not intended to be accessed */
1743  /* by anyone but the formats instantiating and populating the */
1744  /* drivers. */
1745  /* -------------------------------------------------------------------- */
1747 
1748  // Not aimed at being used outside of GDAL. Use GDALDataset::Open() instead
1749  GDALDataset *Open(GDALOpenInfo *poOpenInfo, bool bSetOpenOptions);
1750 
1751  GDALDataset *(*pfnOpen)(GDALOpenInfo *) = nullptr;
1752 
1753  GDALDataset *(*pfnCreate)(const char *pszName, int nXSize, int nYSize,
1754  int nBands, GDALDataType eType,
1755  char **papszOptions) = nullptr;
1756 
1757  GDALDataset *(*pfnCreateEx)(GDALDriver *, const char *pszName, int nXSize,
1758  int nYSize, int nBands, GDALDataType eType,
1759  char **papszOptions) = nullptr;
1760 
1761  GDALDataset *(*pfnCreateMultiDimensional)(
1762  const char *pszName, CSLConstList papszRootGroupOptions,
1763  CSLConstList papszOptions) = nullptr;
1764 
1765  CPLErr (*pfnDelete)(const char *pszName) = nullptr;
1766 
1767  GDALDataset *(*pfnCreateCopy)(const char *, GDALDataset *, int, char **,
1768  GDALProgressFunc pfnProgress,
1769  void *pProgressData) = nullptr;
1770 
1771  void *pDriverData = nullptr;
1772 
1773  void (*pfnUnloadDriver)(GDALDriver *) = nullptr;
1774 
1783  int (*pfnIdentify)(GDALOpenInfo *) = nullptr;
1784  int (*pfnIdentifyEx)(GDALDriver *, GDALOpenInfo *) = nullptr;
1785 
1786  CPLErr (*pfnRename)(const char *pszNewName,
1787  const char *pszOldName) = nullptr;
1788  CPLErr (*pfnCopyFiles)(const char *pszNewName,
1789  const char *pszOldName) = nullptr;
1790 
1791  // Used for legacy OGR drivers, and Python drivers
1792  GDALDataset *(*pfnOpenWithDriverArg)(GDALDriver *,
1793  GDALOpenInfo *) = nullptr;
1794 
1795  /* For legacy OGR drivers */
1796  GDALDataset *(*pfnCreateVectorOnly)(GDALDriver *, const char *pszName,
1797  char **papszOptions) = nullptr;
1798  CPLErr (*pfnDeleteDataSource)(GDALDriver *, const char *pszName) = nullptr;
1799 
1804  bool (*pfnCanVectorTranslateFrom)(
1805  const char *pszDestName, GDALDataset *poSourceDS,
1806  CSLConstList papszVectorTranslateArguments,
1807  char ***ppapszFailureReasons) = nullptr;
1808 
1813  GDALDataset *(*pfnVectorTranslateFrom)(
1814  const char *pszDestName, GDALDataset *poSourceDS,
1815  CSLConstList papszVectorTranslateArguments,
1816  GDALProgressFunc pfnProgress, void *pProgressData) = nullptr;
1817 
1822  GDALSubdatasetInfo *(*pfnGetSubdatasetInfoFunc)(const char *pszFileName) =
1823  nullptr;
1824 
1826 
1827  /* -------------------------------------------------------------------- */
1828  /* Helper methods. */
1829  /* -------------------------------------------------------------------- */
1831  GDALDataset *DefaultCreateCopy(const char *, GDALDataset *, int,
1832  CSLConstList papszOptions,
1833  GDALProgressFunc pfnProgress,
1834  void *pProgressData) CPL_WARN_UNUSED_RESULT;
1835 
1836  static CPLErr DefaultCreateCopyMultiDimensional(
1837  GDALDataset *poSrcDS, GDALDataset *poDstDS, bool bStrict,
1838  CSLConstList /*papszOptions*/, GDALProgressFunc pfnProgress,
1839  void *pProgressData);
1840 
1841  static CPLErr DefaultCopyMasks(GDALDataset *poSrcDS, GDALDataset *poDstDS,
1842  int bStrict);
1843  static CPLErr DefaultCopyMasks(GDALDataset *poSrcDS, GDALDataset *poDstDS,
1844  int bStrict, CSLConstList papszOptions,
1845  GDALProgressFunc pfnProgress,
1846  void *pProgressData);
1848  static CPLErr QuietDelete(const char *pszName,
1849  CSLConstList papszAllowedDrivers = nullptr);
1850 
1852  static CPLErr DefaultRename(const char *pszNewName, const char *pszOldName);
1853  static CPLErr DefaultCopyFiles(const char *pszNewName,
1854  const char *pszOldName);
1855  static void DefaultCopyMetadata(GDALDataset *poSrcDS, GDALDataset *poDstDS,
1856  CSLConstList papszOptions,
1857  CSLConstList papszExcludedDomains);
1859 
1863  static inline GDALDriverH ToHandle(GDALDriver *poDriver)
1864  {
1865  return static_cast<GDALDriverH>(poDriver);
1866  }
1867 
1871  static inline GDALDriver *FromHandle(GDALDriverH hDriver)
1872  {
1873  return static_cast<GDALDriver *>(hDriver);
1874  }
1875 
1876  private:
1878 };
1879 
1880 /* ******************************************************************** */
1881 /* GDALDriverManager */
1882 /* ******************************************************************** */
1883 
1891 class CPL_DLL GDALDriverManager : public GDALMajorObject
1892 {
1893  int nDrivers = 0;
1894  GDALDriver **papoDrivers = nullptr;
1895  std::map<CPLString, GDALDriver *> oMapNameToDrivers{};
1896  std::string m_osDriversIniPath{};
1897 
1898  GDALDriver *GetDriver_unlocked(int iDriver)
1899  {
1900  return (iDriver >= 0 && iDriver < nDrivers) ? papoDrivers[iDriver]
1901  : nullptr;
1902  }
1903 
1904  GDALDriver *GetDriverByName_unlocked(const char *pszName) const
1905  {
1906  auto oIter = oMapNameToDrivers.find(CPLString(pszName).toupper());
1907  return oIter == oMapNameToDrivers.end() ? nullptr : oIter->second;
1908  }
1909 
1910  static char **GetSearchPaths(const char *pszGDAL_DRIVER_PATH);
1911 
1912  static void CleanupPythonDrivers();
1913 
1915 
1916  public:
1918  ~GDALDriverManager();
1919 
1920  int GetDriverCount(void) const;
1921  GDALDriver *GetDriver(int);
1922  GDALDriver *GetDriverByName(const char *);
1923 
1924  int RegisterDriver(GDALDriver *);
1925  void DeregisterDriver(GDALDriver *);
1926 
1927  // AutoLoadDrivers is a no-op if compiled with GDAL_NO_AUTOLOAD defined.
1928  void AutoLoadDrivers();
1929  void AutoSkipDrivers();
1930  void ReorderDrivers();
1931  static CPLErr LoadPlugin(const char *name);
1932 
1933  static void AutoLoadPythonDrivers();
1934 };
1935 
1938 CPL_C_END
1939 
1940 /* ******************************************************************** */
1941 /* GDALAsyncReader */
1942 /* ******************************************************************** */
1943 
1949 class CPL_DLL GDALAsyncReader
1950 {
1951 
1953 
1954  protected:
1956  GDALDataset *poDS;
1957  int nXOff;
1958  int nYOff;
1959  int nXSize;
1960  int nYSize;
1961  void *pBuf;
1962  int nBufXSize;
1963  int nBufYSize;
1964  GDALDataType eBufType;
1965  int nBandCount;
1966  int *panBandMap;
1967  int nPixelSpace;
1968  int nLineSpace;
1969  int nBandSpace;
1971 
1972  public:
1973  GDALAsyncReader();
1974  virtual ~GDALAsyncReader();
1975 
1980  {
1981  return poDS;
1982  }
1986  int GetXOffset() const
1987  {
1988  return nXOff;
1989  }
1993  int GetYOffset() const
1994  {
1995  return nYOff;
1996  }
2000  int GetXSize() const
2001  {
2002  return nXSize;
2003  }
2007  int GetYSize() const
2008  {
2009  return nYSize;
2010  }
2014  void *GetBuffer()
2015  {
2016  return pBuf;
2017  }
2021  int GetBufferXSize() const
2022  {
2023  return nBufXSize;
2024  }
2028  int GetBufferYSize() const
2029  {
2030  return nBufYSize;
2031  }
2036  {
2037  return eBufType;
2038  }
2042  int GetBandCount() const
2043  {
2044  return nBandCount;
2045  }
2049  int *GetBandMap()
2050  {
2051  return panBandMap;
2052  }
2056  int GetPixelSpace() const
2057  {
2058  return nPixelSpace;
2059  }
2063  int GetLineSpace() const
2064  {
2065  return nLineSpace;
2066  }
2070  int GetBandSpace() const
2071  {
2072  return nBandSpace;
2073  }
2074 
2075  virtual GDALAsyncStatusType
2076  GetNextUpdatedRegion(double dfTimeout, int *pnBufXOff, int *pnBufYOff,
2077  int *pnBufXSize, int *pnBufYSize) = 0;
2078  virtual int LockBuffer(double dfTimeout = -1.0);
2079  virtual void UnlockBuffer();
2080 };
2081 
2082 /* ******************************************************************** */
2083 /* Multidimensional array API */
2084 /* ******************************************************************** */
2085 
2086 class GDALMDArray;
2087 class GDALAttribute;
2088 class GDALDimension;
2089 class GDALEDTComponent;
2090 
2091 /* ******************************************************************** */
2092 /* GDALExtendedDataType */
2093 /* ******************************************************************** */
2094 
2103 {
2104  public:
2106 
2108 
2109  GDALExtendedDataType &operator=(const GDALExtendedDataType &);
2111 
2112  static GDALExtendedDataType Create(GDALDataType eType);
2113  static GDALExtendedDataType
2114  Create(const std::string &osName, size_t nTotalSize,
2115  std::vector<std::unique_ptr<GDALEDTComponent>> &&components);
2116  static GDALExtendedDataType
2117  CreateString(size_t nMaxStringLength = 0,
2119 
2120  bool operator==(const GDALExtendedDataType &) const;
2122  bool operator!=(const GDALExtendedDataType &other) const
2123  {
2124  return !(operator==(other));
2125  }
2126 
2131  const std::string &GetName() const
2132  {
2133  return m_osName;
2134  }
2135 
2141  {
2142  return m_eClass;
2143  }
2144 
2151  {
2152  return m_eNumericDT;
2153  }
2154 
2162  {
2163  return m_eSubType;
2164  }
2165 
2171  const std::vector<std::unique_ptr<GDALEDTComponent>> &GetComponents() const
2172  {
2173  return m_aoComponents;
2174  }
2175 
2182  size_t GetSize() const
2183  {
2184  return m_nSize;
2185  }
2186 
2191  size_t GetMaxStringLength() const
2192  {
2193  return m_nMaxStringLength;
2194  }
2195 
2196  bool CanConvertTo(const GDALExtendedDataType &other) const;
2197 
2198  bool NeedsFreeDynamicMemory() const;
2199 
2200  void FreeDynamicMemory(void *pBuffer) const;
2201 
2202  static bool CopyValue(const void *pSrc, const GDALExtendedDataType &srcType,
2203  void *pDst, const GDALExtendedDataType &dstType);
2204 
2205  static bool CopyValues(const void *pSrc,
2206  const GDALExtendedDataType &srcType,
2207  GPtrDiff_t nSrcStrideInElts, void *pDst,
2208  const GDALExtendedDataType &dstType,
2209  GPtrDiff_t nDstStrideInElts, size_t nValues);
2210 
2211  private:
2212  GDALExtendedDataType(size_t nMaxStringLength,
2213  GDALExtendedDataTypeSubType eSubType);
2214  explicit GDALExtendedDataType(GDALDataType eType);
2216  const std::string &osName, size_t nTotalSize,
2217  std::vector<std::unique_ptr<GDALEDTComponent>> &&components);
2218 
2219  std::string m_osName{};
2222  GDALDataType m_eNumericDT = GDT_Unknown;
2223  std::vector<std::unique_ptr<GDALEDTComponent>> m_aoComponents{};
2224  size_t m_nSize = 0;
2225  size_t m_nMaxStringLength = 0;
2226 };
2227 
2228 /* ******************************************************************** */
2229 /* GDALEDTComponent */
2230 /* ******************************************************************** */
2231 
2237 class CPL_DLL GDALEDTComponent
2238 {
2239  public:
2240  ~GDALEDTComponent();
2241  GDALEDTComponent(const std::string &name, size_t offset,
2242  const GDALExtendedDataType &type);
2244 
2245  bool operator==(const GDALEDTComponent &) const;
2246 
2251  const std::string &GetName() const
2252  {
2253  return m_osName;
2254  }
2255 
2260  size_t GetOffset() const
2261  {
2262  return m_nOffset;
2263  }
2264 
2270  {
2271  return m_oType;
2272  }
2273 
2274  private:
2275  std::string m_osName;
2276  size_t m_nOffset;
2277  GDALExtendedDataType m_oType;
2278 };
2279 
2280 /* ******************************************************************** */
2281 /* GDALIHasAttribute */
2282 /* ******************************************************************** */
2283 
2289 class CPL_DLL GDALIHasAttribute
2290 {
2291  protected:
2292  std::shared_ptr<GDALAttribute>
2293  GetAttributeFromAttributes(const std::string &osName) const;
2294 
2295  public:
2296  virtual ~GDALIHasAttribute();
2297 
2298  virtual std::shared_ptr<GDALAttribute>
2299  GetAttribute(const std::string &osName) const;
2300 
2301  virtual std::vector<std::shared_ptr<GDALAttribute>>
2302  GetAttributes(CSLConstList papszOptions = nullptr) const;
2303 
2304  virtual std::shared_ptr<GDALAttribute>
2305  CreateAttribute(const std::string &osName,
2306  const std::vector<GUInt64> &anDimensions,
2307  const GDALExtendedDataType &oDataType,
2308  CSLConstList papszOptions = nullptr);
2309 
2310  virtual bool DeleteAttribute(const std::string &osName,
2311  CSLConstList papszOptions = nullptr);
2312 };
2313 
2314 /* ******************************************************************** */
2315 /* GDALGroup */
2316 /* ******************************************************************** */
2317 
2318 /* clang-format off */
2328 /* clang-format on */
2329 
2330 class CPL_DLL GDALGroup : public GDALIHasAttribute
2331 {
2332  protected:
2334  std::string m_osName{};
2335 
2336  // This is actually a path of the form "/parent_path/{m_osName}"
2337  std::string m_osFullName{};
2338 
2339  // Used for example by GDALSubsetGroup to distinguish a derived group
2340  //from its original, without altering its name
2341  const std::string m_osContext{};
2342 
2343  std::weak_ptr<GDALGroup> m_pSelf{};
2344 
2346  bool m_bValid = true;
2347 
2348  GDALGroup(const std::string &osParentName, const std::string &osName,
2349  const std::string &osContext = std::string());
2350 
2351  const GDALGroup *
2352  GetInnerMostGroup(const std::string &osPathOrArrayOrDim,
2353  std::shared_ptr<GDALGroup> &curGroupHolder,
2354  std::string &osLastPart) const;
2355 
2356  void BaseRename(const std::string &osNewName);
2357 
2358  bool CheckValidAndErrorOutIfNot() const;
2359 
2360  void SetSelf(const std::shared_ptr<GDALGroup> &self)
2361  {
2362  m_pSelf = self;
2363  }
2364 
2365  virtual void NotifyChildrenOfRenaming()
2366  {
2367  }
2368 
2369  virtual void NotifyChildrenOfDeletion()
2370  {
2371  }
2373 
2374  public:
2375  virtual ~GDALGroup();
2376 
2381  const std::string &GetName() const
2382  {
2383  return m_osName;
2384  }
2385 
2390  const std::string &GetFullName() const
2391  {
2392  return m_osFullName;
2393  }
2394 
2395  virtual std::vector<std::string>
2396  GetMDArrayNames(CSLConstList papszOptions = nullptr) const;
2397  virtual std::shared_ptr<GDALMDArray>
2398  OpenMDArray(const std::string &osName,
2399  CSLConstList papszOptions = nullptr) const;
2400 
2401  virtual std::vector<std::string>
2402  GetGroupNames(CSLConstList papszOptions = nullptr) const;
2403  virtual std::shared_ptr<GDALGroup>
2404  OpenGroup(const std::string &osName,
2405  CSLConstList papszOptions = nullptr) const;
2406 
2407  virtual std::vector<std::string>
2408  GetVectorLayerNames(CSLConstList papszOptions = nullptr) const;
2409  virtual OGRLayer *
2410  OpenVectorLayer(const std::string &osName,
2411  CSLConstList papszOptions = nullptr) const;
2412 
2413  virtual std::vector<std::shared_ptr<GDALDimension>>
2414  GetDimensions(CSLConstList papszOptions = nullptr) const;
2415 
2416  virtual std::shared_ptr<GDALGroup>
2417  CreateGroup(const std::string &osName, CSLConstList papszOptions = nullptr);
2418 
2419  virtual bool DeleteGroup(const std::string &osName,
2420  CSLConstList papszOptions = nullptr);
2421 
2422  virtual std::shared_ptr<GDALDimension>
2423  CreateDimension(const std::string &osName, const std::string &osType,
2424  const std::string &osDirection, GUInt64 nSize,
2425  CSLConstList papszOptions = nullptr);
2426 
2427  virtual std::shared_ptr<GDALMDArray> CreateMDArray(
2428  const std::string &osName,
2429  const std::vector<std::shared_ptr<GDALDimension>> &aoDimensions,
2430  const GDALExtendedDataType &oDataType,
2431  CSLConstList papszOptions = nullptr);
2432 
2433  virtual bool DeleteMDArray(const std::string &osName,
2434  CSLConstList papszOptions = nullptr);
2435 
2436  GUInt64 GetTotalCopyCost() const;
2437 
2438  virtual bool CopyFrom(const std::shared_ptr<GDALGroup> &poDstRootGroup,
2439  GDALDataset *poSrcDS,
2440  const std::shared_ptr<GDALGroup> &poSrcGroup,
2441  bool bStrict, GUInt64 &nCurCost,
2442  const GUInt64 nTotalCost,
2443  GDALProgressFunc pfnProgress, void *pProgressData,
2444  CSLConstList papszOptions = nullptr);
2445 
2446  virtual CSLConstList GetStructuralInfo() const;
2447 
2448  std::shared_ptr<GDALMDArray>
2449  OpenMDArrayFromFullname(const std::string &osFullName,
2450  CSLConstList papszOptions = nullptr) const;
2451 
2452  std::shared_ptr<GDALMDArray>
2453  ResolveMDArray(const std::string &osName, const std::string &osStartingPath,
2454  CSLConstList papszOptions = nullptr) const;
2455 
2456  std::shared_ptr<GDALGroup>
2457  OpenGroupFromFullname(const std::string &osFullName,
2458  CSLConstList papszOptions = nullptr) const;
2459 
2460  std::shared_ptr<GDALDimension>
2461  OpenDimensionFromFullname(const std::string &osFullName) const;
2462 
2463  virtual void ClearStatistics();
2464 
2465  virtual bool Rename(const std::string &osNewName);
2466 
2467  std::shared_ptr<GDALGroup>
2468  SubsetDimensionFromSelection(const std::string &osSelection) const;
2469 
2471  virtual void ParentRenamed(const std::string &osNewParentFullName);
2472 
2473  virtual void Deleted();
2474 
2475  virtual void ParentDeleted();
2476 
2477  const std::string &GetContext() const
2478  {
2479  return m_osContext;
2480  }
2482 
2484  static constexpr GUInt64 COPY_COST = 1000;
2486 };
2487 
2488 /* ******************************************************************** */
2489 /* GDALAbstractMDArray */
2490 /* ******************************************************************** */
2491 
2497 class CPL_DLL GDALAbstractMDArray
2498 {
2499  protected:
2501  std::string m_osName{};
2502 
2503  // This is actually a path of the form "/parent_path/{m_osName}"
2504  std::string m_osFullName{};
2505  std::weak_ptr<GDALAbstractMDArray> m_pSelf{};
2506 
2508  bool m_bValid = true;
2509 
2510  GDALAbstractMDArray(const std::string &osParentName,
2511  const std::string &osName);
2512 
2513  void SetSelf(const std::shared_ptr<GDALAbstractMDArray> &self)
2514  {
2515  m_pSelf = self;
2516  }
2517 
2518  bool CheckValidAndErrorOutIfNot() const;
2519 
2520  bool CheckReadWriteParams(const GUInt64 *arrayStartIdx, const size_t *count,
2521  const GInt64 *&arrayStep,
2522  const GPtrDiff_t *&bufferStride,
2523  const GDALExtendedDataType &bufferDataType,
2524  const void *buffer,
2525  const void *buffer_alloc_start,
2526  size_t buffer_alloc_size,
2527  std::vector<GInt64> &tmp_arrayStep,
2528  std::vector<GPtrDiff_t> &tmp_bufferStride) const;
2529 
2530  virtual bool
2531  IRead(const GUInt64 *arrayStartIdx, // array of size GetDimensionCount()
2532  const size_t *count, // array of size GetDimensionCount()
2533  const GInt64 *arrayStep, // step in elements
2534  const GPtrDiff_t *bufferStride, // stride in elements
2535  const GDALExtendedDataType &bufferDataType,
2536  void *pDstBuffer) const = 0;
2537 
2538  virtual bool
2539  IWrite(const GUInt64 *arrayStartIdx, // array of size GetDimensionCount()
2540  const size_t *count, // array of size GetDimensionCount()
2541  const GInt64 *arrayStep, // step in elements
2542  const GPtrDiff_t *bufferStride, // stride in elements
2543  const GDALExtendedDataType &bufferDataType, const void *pSrcBuffer);
2544 
2545  void BaseRename(const std::string &osNewName);
2546 
2547  virtual void NotifyChildrenOfRenaming()
2548  {
2549  }
2550 
2551  virtual void NotifyChildrenOfDeletion()
2552  {
2553  }
2555 
2556  public:
2557  virtual ~GDALAbstractMDArray();
2558 
2564  const std::string &GetName() const
2565  {
2566  return m_osName;
2567  }
2568 
2574  const std::string &GetFullName() const
2575  {
2576  return m_osFullName;
2577  }
2578 
2579  GUInt64 GetTotalElementsCount() const;
2580 
2581  virtual size_t GetDimensionCount() const;
2582 
2583  virtual const std::vector<std::shared_ptr<GDALDimension>> &
2584  GetDimensions() const = 0;
2585 
2586  virtual const GDALExtendedDataType &GetDataType() const = 0;
2587 
2588  virtual std::vector<GUInt64> GetBlockSize() const;
2589 
2590  virtual std::vector<size_t>
2591  GetProcessingChunkSize(size_t nMaxChunkMemory) const;
2592 
2593  /* clang-format off */
2609  typedef bool (*FuncProcessPerChunkType)(
2610  GDALAbstractMDArray *array,
2611  const GUInt64 *chunkArrayStartIdx,
2612  const size_t *chunkCount,
2613  GUInt64 iCurChunk,
2614  GUInt64 nChunkCount,
2615  void *pUserData);
2616  /* clang-format on */
2617 
2618  virtual bool ProcessPerChunk(const GUInt64 *arrayStartIdx,
2619  const GUInt64 *count, const size_t *chunkSize,
2620  FuncProcessPerChunkType pfnFunc,
2621  void *pUserData);
2622 
2623  virtual bool
2624  Read(const GUInt64 *arrayStartIdx, // array of size GetDimensionCount()
2625  const size_t *count, // array of size GetDimensionCount()
2626  const GInt64 *arrayStep, // step in elements
2627  const GPtrDiff_t *bufferStride, // stride in elements
2628  const GDALExtendedDataType &bufferDataType, void *pDstBuffer,
2629  const void *pDstBufferAllocStart = nullptr,
2630  size_t nDstBufferAllocSize = 0) const;
2631 
2632  bool
2633  Write(const GUInt64 *arrayStartIdx, // array of size GetDimensionCount()
2634  const size_t *count, // array of size GetDimensionCount()
2635  const GInt64 *arrayStep, // step in elements
2636  const GPtrDiff_t *bufferStride, // stride in elements
2637  const GDALExtendedDataType &bufferDataType, const void *pSrcBuffer,
2638  const void *pSrcBufferAllocStart = nullptr,
2639  size_t nSrcBufferAllocSize = 0);
2640 
2641  virtual bool Rename(const std::string &osNewName);
2642 
2644  virtual void Deleted();
2645 
2646  virtual void ParentDeleted();
2647 
2648  virtual void ParentRenamed(const std::string &osNewParentFullName);
2650 };
2651 
2652 /* ******************************************************************** */
2653 /* GDALRawResult */
2654 /* ******************************************************************** */
2655 
2662 class CPL_DLL GDALRawResult
2663 {
2664  private:
2665  GDALExtendedDataType m_dt;
2666  size_t m_nEltCount;
2667  size_t m_nSize;
2668  GByte *m_raw;
2669 
2670  void FreeMe();
2671 
2672  GDALRawResult(const GDALRawResult &) = delete;
2673  GDALRawResult &operator=(const GDALRawResult &) = delete;
2674 
2675  protected:
2676  friend class GDALAttribute;
2678  GDALRawResult(GByte *raw, const GDALExtendedDataType &dt, size_t nEltCount);
2680 
2681  public:
2682  ~GDALRawResult();
2684  GDALRawResult &operator=(GDALRawResult &&);
2685 
2687  const GByte &operator[](size_t idx) const
2688  {
2689  return m_raw[idx];
2690  }
2692  const GByte *data() const
2693  {
2694  return m_raw;
2695  }
2697  size_t size() const
2698  {
2699  return m_nSize;
2700  }
2701 
2703  GByte *StealData();
2705 };
2706 
2707 /* ******************************************************************** */
2708 /* GDALAttribute */
2709 /* ******************************************************************** */
2710 
2711 /* clang-format off */
2723 /* clang-format on */
2724 
2725 class CPL_DLL GDALAttribute : virtual public GDALAbstractMDArray
2726 {
2727  mutable std::string m_osCachedVal{};
2728 
2729  protected:
2731  GDALAttribute(const std::string &osParentName, const std::string &osName);
2733 
2734  public:
2735  std::vector<GUInt64> GetDimensionsSize() const;
2736 
2737  GDALRawResult ReadAsRaw() const;
2738  const char *ReadAsString() const;
2739  int ReadAsInt() const;
2740  double ReadAsDouble() const;
2741  CPLStringList ReadAsStringArray() const;
2742  std::vector<int> ReadAsIntArray() const;
2743  std::vector<double> ReadAsDoubleArray() const;
2744 
2746  bool Write(const void *pabyValue, size_t nLen);
2747  bool Write(const char *);
2748  bool WriteInt(int);
2749  bool Write(double);
2750  bool Write(CSLConstList);
2751  bool Write(const double *, size_t);
2752 
2754  static constexpr GUInt64 COPY_COST = 100;
2756 };
2757 
2758 /************************************************************************/
2759 /* GDALAttributeString */
2760 /************************************************************************/
2761 
2763 class CPL_DLL GDALAttributeString final : public GDALAttribute
2764 {
2765  std::vector<std::shared_ptr<GDALDimension>> m_dims{};
2767  std::string m_osValue;
2768 
2769  protected:
2770  bool IRead(const GUInt64 *, const size_t *, const GInt64 *,
2771  const GPtrDiff_t *, const GDALExtendedDataType &bufferDataType,
2772  void *pDstBuffer) const override;
2773 
2774  public:
2775  GDALAttributeString(const std::string &osParentName,
2776  const std::string &osName, const std::string &osValue,
2778 
2779  const std::vector<std::shared_ptr<GDALDimension>> &
2780  GetDimensions() const override;
2781 
2782  const GDALExtendedDataType &GetDataType() const override;
2783 };
2785 
2786 /************************************************************************/
2787 /* GDALAttributeNumeric */
2788 /************************************************************************/
2789 
2791 class CPL_DLL GDALAttributeNumeric final : public GDALAttribute
2792 {
2793  std::vector<std::shared_ptr<GDALDimension>> m_dims{};
2794  GDALExtendedDataType m_dt;
2795  int m_nValue = 0;
2796  double m_dfValue = 0;
2797  std::vector<GUInt32> m_anValuesUInt32{};
2798 
2799  protected:
2800  bool IRead(const GUInt64 *, const size_t *, const GInt64 *,
2801  const GPtrDiff_t *, const GDALExtendedDataType &bufferDataType,
2802  void *pDstBuffer) const override;
2803 
2804  public:
2805  GDALAttributeNumeric(const std::string &osParentName,
2806  const std::string &osName, double dfValue);
2807  GDALAttributeNumeric(const std::string &osParentName,
2808  const std::string &osName, int nValue);
2809  GDALAttributeNumeric(const std::string &osParentName,
2810  const std::string &osName,
2811  const std::vector<GUInt32> &anValues);
2812 
2813  const std::vector<std::shared_ptr<GDALDimension>> &
2814  GetDimensions() const override;
2815 
2816  const GDALExtendedDataType &GetDataType() const override;
2817 };
2819 
2820 /* ******************************************************************** */
2821 /* GDALMDArray */
2822 /* ******************************************************************** */
2823 
2824 /* clang-format off */
2834 /* clang-format on */
2835 
2836 class CPL_DLL GDALMDArray : virtual public GDALAbstractMDArray,
2837  public GDALIHasAttribute
2838 {
2839  friend class GDALMDArrayResampled;
2840  std::shared_ptr<GDALMDArray>
2841  GetView(const std::vector<GUInt64> &indices) const;
2842 
2843  inline std::shared_ptr<GDALMDArray>
2844  atInternal(std::vector<GUInt64> &indices) const
2845  {
2846  return GetView(indices);
2847  }
2848 
2849  template <typename... GUInt64VarArg>
2850  // cppcheck-suppress functionStatic
2851  inline std::shared_ptr<GDALMDArray>
2852  atInternal(std::vector<GUInt64> &indices, GUInt64 idx,
2853  GUInt64VarArg... tail) const
2854  {
2855  indices.push_back(idx);
2856  return atInternal(indices, tail...);
2857  }
2858 
2859  // Used for example by GDALSubsetGroup to distinguish a derived group
2860  //from its original, without altering its name
2861  const std::string m_osContext{};
2862 
2863  mutable bool m_bHasTriedCachedArray = false;
2864  mutable std::shared_ptr<GDALMDArray> m_poCachedArray{};
2865 
2866  protected:
2868  GDALMDArray(const std::string &osParentName, const std::string &osName,
2869  const std::string &osContext = std::string());
2870 
2871  virtual bool IAdviseRead(const GUInt64 *arrayStartIdx, const size_t *count,
2872  CSLConstList papszOptions) const;
2873 
2874  virtual bool IsCacheable() const
2875  {
2876  return true;
2877  }
2878 
2879  virtual bool SetStatistics(bool bApproxStats, double dfMin, double dfMax,
2880  double dfMean, double dfStdDev,
2881  GUInt64 nValidCount, CSLConstList papszOptions);
2882 
2883  static std::string MassageName(const std::string &inputName);
2884 
2885  std::shared_ptr<GDALGroup>
2886  GetCacheRootGroup(bool bCanCreate, std::string &osCacheFilenameOut) const;
2887 
2888  // Returns if bufferStride values express a transposed view of the array
2889  bool IsTransposedRequest(const size_t *count,
2890  const GPtrDiff_t *bufferStride) const;
2891 
2892  // Should only be called if IsTransposedRequest() returns true
2893  bool ReadForTransposedRequest(const GUInt64 *arrayStartIdx,
2894  const size_t *count, const GInt64 *arrayStep,
2895  const GPtrDiff_t *bufferStride,
2896  const GDALExtendedDataType &bufferDataType,
2897  void *pDstBuffer) const;
2898 
2899  bool IsStepOneContiguousRowMajorOrderedSameDataType(
2900  const size_t *count, const GInt64 *arrayStep,
2901  const GPtrDiff_t *bufferStride,
2902  const GDALExtendedDataType &bufferDataType) const;
2903 
2904  // Should only be called if IsStepOneContiguousRowMajorOrderedSameDataType()
2905  // returns false
2906  bool ReadUsingContiguousIRead(const GUInt64 *arrayStartIdx,
2907  const size_t *count, const GInt64 *arrayStep,
2908  const GPtrDiff_t *bufferStride,
2909  const GDALExtendedDataType &bufferDataType,
2910  void *pDstBuffer) const;
2911 
2912  static std::shared_ptr<GDALMDArray>
2913  CreateGLTOrthorectified(const std::shared_ptr<GDALMDArray> &poParent,
2914  const std::shared_ptr<GDALMDArray> &poGLTX,
2915  const std::shared_ptr<GDALMDArray> &poGLTY,
2916  int nGLTIndexOffset,
2917  const std::vector<double> &adfGeoTransform);
2918 
2920 
2921  public:
2922  GUInt64 GetTotalCopyCost() const;
2923 
2924  virtual bool CopyFrom(GDALDataset *poSrcDS, const GDALMDArray *poSrcArray,
2925  bool bStrict, GUInt64 &nCurCost,
2926  const GUInt64 nTotalCost,
2927  GDALProgressFunc pfnProgress, void *pProgressData);
2928 
2930  virtual bool IsWritable() const = 0;
2931 
2940  virtual const std::string &GetFilename() const = 0;
2941 
2942  virtual CSLConstList GetStructuralInfo() const;
2943 
2944  virtual const std::string &GetUnit() const;
2945 
2946  virtual bool SetUnit(const std::string &osUnit);
2947 
2948  virtual bool SetSpatialRef(const OGRSpatialReference *poSRS);
2949 
2950  virtual std::shared_ptr<OGRSpatialReference> GetSpatialRef() const;
2951 
2952  virtual const void *GetRawNoDataValue() const;
2953 
2954  double GetNoDataValueAsDouble(bool *pbHasNoData = nullptr) const;
2955 
2956  int64_t GetNoDataValueAsInt64(bool *pbHasNoData = nullptr) const;
2957 
2958  uint64_t GetNoDataValueAsUInt64(bool *pbHasNoData = nullptr) const;
2959 
2960  virtual bool SetRawNoDataValue(const void *pRawNoData);
2961 
2963  bool SetNoDataValue(int nNoData)
2964  {
2965  return SetNoDataValue(static_cast<int64_t>(nNoData));
2966  }
2968 
2969  bool SetNoDataValue(double dfNoData);
2970 
2971  bool SetNoDataValue(int64_t nNoData);
2972 
2973  bool SetNoDataValue(uint64_t nNoData);
2974 
2975  virtual bool Resize(const std::vector<GUInt64> &anNewDimSizes,
2976  CSLConstList papszOptions);
2977 
2978  virtual double GetOffset(bool *pbHasOffset = nullptr,
2979  GDALDataType *peStorageType = nullptr) const;
2980 
2981  virtual double GetScale(bool *pbHasScale = nullptr,
2982  GDALDataType *peStorageType = nullptr) const;
2983 
2984  virtual bool SetOffset(double dfOffset,
2985  GDALDataType eStorageType = GDT_Unknown);
2986 
2987  virtual bool SetScale(double dfScale,
2988  GDALDataType eStorageType = GDT_Unknown);
2989 
2990  std::shared_ptr<GDALMDArray> GetView(const std::string &viewExpr) const;
2991 
2992  std::shared_ptr<GDALMDArray> operator[](const std::string &fieldName) const;
2993 
3003  // sphinx 4.1.0 / breathe 4.30.0 don't like typename...
3005  template <typename... GUInt64VarArg>
3007  // cppcheck-suppress functionStatic
3008  std::shared_ptr<GDALMDArray> at(GUInt64 idx, GUInt64VarArg... tail) const
3009  {
3010  std::vector<GUInt64> indices;
3011  indices.push_back(idx);
3012  return atInternal(indices, tail...);
3013  }
3014 
3015  virtual std::shared_ptr<GDALMDArray>
3016  Transpose(const std::vector<int> &anMapNewAxisToOldAxis) const;
3017 
3018  std::shared_ptr<GDALMDArray> GetUnscaled(
3019  double dfOverriddenScale = std::numeric_limits<double>::quiet_NaN(),
3020  double dfOverriddenOffset = std::numeric_limits<double>::quiet_NaN(),
3021  double dfOverriddenDstNodata =
3022  std::numeric_limits<double>::quiet_NaN()) const;
3023 
3024  virtual std::shared_ptr<GDALMDArray>
3025  GetMask(CSLConstList papszOptions) const;
3026 
3027  virtual std::shared_ptr<GDALMDArray>
3028  GetResampled(const std::vector<std::shared_ptr<GDALDimension>> &apoNewDims,
3029  GDALRIOResampleAlg resampleAlg,
3030  const OGRSpatialReference *poTargetSRS,
3031  CSLConstList papszOptions) const;
3032 
3033  std::shared_ptr<GDALMDArray>
3034  GetGridded(const std::string &osGridOptions,
3035  const std::shared_ptr<GDALMDArray> &poXArray = nullptr,
3036  const std::shared_ptr<GDALMDArray> &poYArray = nullptr,
3037  CSLConstList papszOptions = nullptr) const;
3038 
3039  virtual GDALDataset *
3040  AsClassicDataset(size_t iXDim, size_t iYDim,
3041  const std::shared_ptr<GDALGroup> &poRootGroup = nullptr,
3042  CSLConstList papszOptions = nullptr) const;
3043 
3044  virtual CPLErr GetStatistics(bool bApproxOK, bool bForce, double *pdfMin,
3045  double *pdfMax, double *pdfMean,
3046  double *padfStdDev, GUInt64 *pnValidCount,
3047  GDALProgressFunc pfnProgress,
3048  void *pProgressData);
3049 
3050  virtual bool ComputeStatistics(bool bApproxOK, double *pdfMin,
3051  double *pdfMax, double *pdfMean,
3052  double *pdfStdDev, GUInt64 *pnValidCount,
3053  GDALProgressFunc, void *pProgressData,
3054  CSLConstList papszOptions);
3055 
3056  virtual void ClearStatistics();
3057 
3058  virtual std::vector<std::shared_ptr<GDALMDArray>>
3059  GetCoordinateVariables() const;
3060 
3061  bool AdviseRead(const GUInt64 *arrayStartIdx, const size_t *count,
3062  CSLConstList papszOptions = nullptr) const;
3063 
3064  bool IsRegularlySpaced(double &dfStart, double &dfIncrement) const;
3065 
3066  bool GuessGeoTransform(size_t nDimX, size_t nDimY, bool bPixelIsPoint,
3067  double adfGeoTransform[6]) const;
3068 
3069  bool Cache(CSLConstList papszOptions = nullptr) const;
3070 
3071  bool
3072  Read(const GUInt64 *arrayStartIdx, // array of size GetDimensionCount()
3073  const size_t *count, // array of size GetDimensionCount()
3074  const GInt64 *arrayStep, // step in elements
3075  const GPtrDiff_t *bufferStride, // stride in elements
3076  const GDALExtendedDataType &bufferDataType, void *pDstBuffer,
3077  const void *pDstBufferAllocStart = nullptr,
3078  size_t nDstBufferAllocSize = 0) const override final;
3079 
3080  virtual std::shared_ptr<GDALGroup> GetRootGroup() const;
3081 
3083  static constexpr GUInt64 COPY_COST = 1000;
3084 
3085  bool CopyFromAllExceptValues(const GDALMDArray *poSrcArray, bool bStrict,
3086  GUInt64 &nCurCost, const GUInt64 nTotalCost,
3087  GDALProgressFunc pfnProgress,
3088  void *pProgressData);
3089  struct Range
3090  {
3091  GUInt64 m_nStartIdx;
3092  GInt64 m_nIncr;
3093  explicit Range(GUInt64 nStartIdx = 0, GInt64 nIncr = 0)
3094  : m_nStartIdx(nStartIdx), m_nIncr(nIncr)
3095  {
3096  }
3097  };
3098 
3099  struct ViewSpec
3100  {
3101  std::string m_osFieldName{};
3102 
3103  // or
3104 
3105  std::vector<size_t>
3106  m_mapDimIdxToParentDimIdx{}; // of size m_dims.size()
3107  std::vector<Range>
3108  m_parentRanges{}; // of size m_poParent->GetDimensionCount()
3109  };
3110 
3111  virtual std::shared_ptr<GDALMDArray>
3112  GetView(const std::string &viewExpr, bool bRenameDimensions,
3113  std::vector<ViewSpec> &viewSpecs) const;
3114 
3115  const std::string &GetContext() const
3116  {
3117  return m_osContext;
3118  }
3120 };
3121 
3123 bool GDALMDRasterIOFromBand(GDALRasterBand *poBand, GDALRWFlag eRWFlag,
3124  size_t iDimX, size_t iDimY,
3125  const GUInt64 *arrayStartIdx, const size_t *count,
3126  const GInt64 *arrayStep,
3127  const GPtrDiff_t *bufferStride,
3128  const GDALExtendedDataType &bufferDataType,
3129  void *pBuffer);
3131 
3132 /************************************************************************/
3133 /* GDALMDArrayRegularlySpaced */
3134 /************************************************************************/
3135 
3137 class CPL_DLL GDALMDArrayRegularlySpaced : public GDALMDArray
3138 {
3139  double m_dfStart;
3140  double m_dfIncrement;
3141  double m_dfOffsetInIncrement;
3143  std::vector<std::shared_ptr<GDALDimension>> m_dims;
3144  std::vector<std::shared_ptr<GDALAttribute>> m_attributes{};
3145  std::string m_osEmptyFilename{};
3146 
3147  protected:
3148  bool IRead(const GUInt64 *, const size_t *, const GInt64 *,
3149  const GPtrDiff_t *, const GDALExtendedDataType &bufferDataType,
3150  void *pDstBuffer) const override;
3151 
3152  public:
3153  GDALMDArrayRegularlySpaced(const std::string &osParentName,
3154  const std::string &osName,
3155  const std::shared_ptr<GDALDimension> &poDim,
3156  double dfStart, double dfIncrement,
3157  double dfOffsetInIncrement);
3158 
3159  static std::shared_ptr<GDALMDArrayRegularlySpaced>
3160  Create(const std::string &osParentName, const std::string &osName,
3161  const std::shared_ptr<GDALDimension> &poDim, double dfStart,
3162  double dfIncrement, double dfOffsetInIncrement);
3163 
3164  bool IsWritable() const override
3165  {
3166  return false;
3167  }
3168 
3169  const std::string &GetFilename() const override
3170  {
3171  return m_osEmptyFilename;
3172  }
3173 
3174  const std::vector<std::shared_ptr<GDALDimension>> &
3175  GetDimensions() const override;
3176 
3177  const GDALExtendedDataType &GetDataType() const override;
3178 
3179  std::vector<std::shared_ptr<GDALAttribute>>
3180  GetAttributes(CSLConstList) const override;
3181 
3182  void AddAttribute(const std::shared_ptr<GDALAttribute> &poAttr);
3183 };
3185 
3186 /* ******************************************************************** */
3187 /* GDALDimension */
3188 /* ******************************************************************** */
3189 
3201 class CPL_DLL GDALDimension
3202 {
3203  public:
3205  GDALDimension(const std::string &osParentName, const std::string &osName,
3206  const std::string &osType, const std::string &osDirection,
3207  GUInt64 nSize);
3209 
3210  virtual ~GDALDimension();
3211 
3216  const std::string &GetName() const
3217  {
3218  return m_osName;
3219  }
3220 
3225  const std::string &GetFullName() const
3226  {
3227  return m_osFullName;
3228  }
3229 
3238  const std::string &GetType() const
3239  {
3240  return m_osType;
3241  }
3242 
3251  const std::string &GetDirection() const
3252  {
3253  return m_osDirection;
3254  }
3255 
3261  {
3262  return m_nSize;
3263  }
3264 
3265  virtual std::shared_ptr<GDALMDArray> GetIndexingVariable() const;
3266 
3267  virtual bool
3268  SetIndexingVariable(std::shared_ptr<GDALMDArray> poIndexingVariable);
3269 
3270  virtual bool Rename(const std::string &osNewName);
3271 
3273  virtual void ParentRenamed(const std::string &osNewParentFullName);
3274 
3275  virtual void ParentDeleted();
3277 
3278  protected:
3280  std::string m_osName;
3281  std::string m_osFullName;
3282  std::string m_osType;
3283  std::string m_osDirection;
3284  GUInt64 m_nSize;
3285 
3286  void BaseRename(const std::string &osNewName);
3287 
3289 };
3290 
3291 /************************************************************************/
3292 /* GDALDimensionWeakIndexingVar() */
3293 /************************************************************************/
3294 
3296 class CPL_DLL GDALDimensionWeakIndexingVar : public GDALDimension
3297 {
3298  std::weak_ptr<GDALMDArray> m_poIndexingVariable{};
3299 
3300  public:
3301  GDALDimensionWeakIndexingVar(const std::string &osParentName,
3302  const std::string &osName,
3303  const std::string &osType,
3304  const std::string &osDirection, GUInt64 nSize);
3305 
3306  std::shared_ptr<GDALMDArray> GetIndexingVariable() const override;
3307 
3308  bool SetIndexingVariable(
3309  std::shared_ptr<GDALMDArray> poIndexingVariable) override;
3310 
3311  void SetSize(GUInt64 nNewSize);
3312 };
3314 
3315 /************************************************************************/
3316 /* GDALAntiRecursionGuard */
3317 /************************************************************************/
3318 
3320 struct GDALAntiRecursionStruct;
3321 class GDALAntiRecursionGuard
3322 {
3323  GDALAntiRecursionStruct *m_psAntiRecursionStruct;
3324  std::string m_osIdentifier;
3325  int m_nDepth;
3326 
3327  GDALAntiRecursionGuard(const GDALAntiRecursionGuard &) = delete;
3328  GDALAntiRecursionGuard &operator=(const GDALAntiRecursionGuard &) = delete;
3329 
3330  public:
3331  explicit GDALAntiRecursionGuard(const std::string &osIdentifier);
3332  GDALAntiRecursionGuard(const GDALAntiRecursionGuard &other,
3333  const std::string &osIdentifier);
3334  ~GDALAntiRecursionGuard();
3335  int GetCallDepth() const
3336  {
3337  return m_nDepth;
3338  }
3339 };
3341 
3342 /************************************************************************/
3343 /* Relationships */
3344 /************************************************************************/
3345 
3357 class CPL_DLL GDALRelationship
3358 {
3359  protected:
3361  std::string m_osName{};
3362  std::string m_osLeftTableName{};
3363  std::string m_osRightTableName{};
3364  GDALRelationshipCardinality m_eCardinality =
3366  std::string m_osMappingTableName{};
3367  std::vector<std::string> m_osListLeftTableFields{};
3368  std::vector<std::string> m_osListRightTableFields{};
3369  std::vector<std::string> m_osListLeftMappingTableFields{};
3370  std::vector<std::string> m_osListRightMappingTableFields{};
3372  std::string m_osForwardPathLabel{};
3373  std::string m_osBackwardPathLabel{};
3374  std::string m_osRelatedTableType{};
3375 
3378  public:
3386  GDALRelationship(const std::string &osName,
3387  const std::string &osLeftTableName,
3388  const std::string &osRightTableName,
3389  GDALRelationshipCardinality eCardinality =
3391  : m_osName(osName), m_osLeftTableName(osLeftTableName),
3392  m_osRightTableName(osRightTableName), m_eCardinality(eCardinality)
3393  {
3394  }
3395 
3397  const std::string &GetName() const
3398  {
3399  return m_osName;
3400  }
3401 
3404  {
3405  return m_eCardinality;
3406  }
3407 
3412  const std::string &GetLeftTableName() const
3413  {
3414  return m_osLeftTableName;
3415  }
3416 
3419  const std::string &GetRightTableName() const
3420  {
3421  return m_osRightTableName;
3422  }
3423 
3428  const std::string &GetMappingTableName() const
3429  {
3430  return m_osMappingTableName;
3431  }
3432 
3437  void SetMappingTableName(const std::string &osName)
3438  {
3439  m_osMappingTableName = osName;
3440  }
3441 
3448  const std::vector<std::string> &GetLeftTableFields() const
3449  {
3450  return m_osListLeftTableFields;
3451  }
3452 
3459  const std::vector<std::string> &GetRightTableFields() const
3460  {
3461  return m_osListRightTableFields;
3462  }
3463 
3470  void SetLeftTableFields(const std::vector<std::string> &osListFields)
3471  {
3472  m_osListLeftTableFields = osListFields;
3473  }
3474 
3481  void SetRightTableFields(const std::vector<std::string> &osListFields)
3482  {
3483  m_osListRightTableFields = osListFields;
3484  }
3485 
3492  const std::vector<std::string> &GetLeftMappingTableFields() const
3493  {
3494  return m_osListLeftMappingTableFields;
3495  }
3496 
3503  const std::vector<std::string> &GetRightMappingTableFields() const
3504  {
3505  return m_osListRightMappingTableFields;
3506  }
3507 
3514  void SetLeftMappingTableFields(const std::vector<std::string> &osListFields)
3515  {
3516  m_osListLeftMappingTableFields = osListFields;
3517  }
3518 
3525  void
3526  SetRightMappingTableFields(const std::vector<std::string> &osListFields)
3527  {
3528  m_osListRightMappingTableFields = osListFields;
3529  }
3530 
3536  {
3537  return m_eType;
3538  }
3539 
3545  {
3546  m_eType = eType;
3547  }
3548 
3564  const std::string &GetForwardPathLabel() const
3565  {
3566  return m_osForwardPathLabel;
3567  }
3568 
3584  void SetForwardPathLabel(const std::string &osLabel)
3585  {
3586  m_osForwardPathLabel = osLabel;
3587  }
3588 
3604  const std::string &GetBackwardPathLabel() const
3605  {
3606  return m_osBackwardPathLabel;
3607  }
3608 
3624  void SetBackwardPathLabel(const std::string &osLabel)
3625  {
3626  m_osBackwardPathLabel = osLabel;
3627  }
3628 
3639  const std::string &GetRelatedTableType() const
3640  {
3641  return m_osRelatedTableType;
3642  }
3643 
3654  void SetRelatedTableType(const std::string &osType)
3655  {
3656  m_osRelatedTableType = osType;
3657  }
3658 
3661  static inline GDALRelationshipH ToHandle(GDALRelationship *poRelationship)
3662  {
3663  return static_cast<GDALRelationshipH>(poRelationship);
3664  }
3665 
3668  static inline GDALRelationship *FromHandle(GDALRelationshipH hRelationship)
3669  {
3670  return static_cast<GDALRelationship *>(hRelationship);
3671  }
3672 };
3673 
3674 /* ==================================================================== */
3675 /* An assortment of overview related stuff. */
3676 /* ==================================================================== */
3677 
3679 /* Only exported for drivers as plugin. Signature may change */
3680 CPLErr CPL_DLL GDALRegenerateOverviewsMultiBand(
3681  int nBands, GDALRasterBand *const *papoSrcBands, int nOverviews,
3682  GDALRasterBand *const *const *papapoOverviewBands,
3683  const char *pszResampling, GDALProgressFunc pfnProgress,
3684  void *pProgressData, CSLConstList papszOptions);
3685 
3686 typedef CPLErr (*GDALResampleFunction)(
3687  double dfXRatioDstToSrc, double dfYRatioDstToSrc, double dfSrcXDelta,
3688  double dfSrcYDelta, GDALDataType eWrkDataType, const void *pChunk,
3689  const GByte *pabyChunkNodataMask, int nChunkXOff, int nChunkXSize,
3690  int nChunkYOff, int nChunkYSize, int nDstXOff, int nDstXOff2, int nDstYOff,
3691  int nDstYOff2, GDALRasterBand *poOverview, void **ppDstBuffer,
3692  GDALDataType *peDstBufferDataType, const char *pszResampling,
3693  bool bHasNoData, double dfNoDataValue, GDALColorTable *poColorTable,
3694  GDALDataType eSrcDataType, bool bPropagateNoData);
3695 
3696 GDALResampleFunction GDALGetResampleFunction(const char *pszResampling,
3697  int *pnRadius);
3698 
3699 GDALDataType GDALGetOvrWorkDataType(const char *pszResampling,
3700  GDALDataType eSrcDataType);
3701 
3703 
3704 CPLErr CPL_DLL
3705 HFAAuxBuildOverviews(const char *pszOvrFilename, GDALDataset *poParentDS,
3706  GDALDataset **ppoDS, int nBands, const int *panBandList,
3707  int nNewOverviews, const int *panNewOverviewList,
3708  const char *pszResampling, GDALProgressFunc pfnProgress,
3709  void *pProgressData, CSLConstList papszOptions);
3710 
3711 CPLErr CPL_DLL GTIFFBuildOverviews(const char *pszFilename, int nBands,
3712  GDALRasterBand *const *papoBandList,
3713  int nOverviews, const int *panOverviewList,
3714  const char *pszResampling,
3715  GDALProgressFunc pfnProgress,
3716  void *pProgressData,
3717  CSLConstList papszOptions);
3718 
3719 int CPL_DLL GDALBandGetBestOverviewLevel(GDALRasterBand *poBand, int &nXOff,
3720  int &nYOff, int &nXSize, int &nYSize,
3721  int nBufXSize, int nBufYSize)
3722  CPL_WARN_DEPRECATED("Use GDALBandGetBestOverviewLevel2 instead");
3723 int CPL_DLL GDALBandGetBestOverviewLevel2(GDALRasterBand *poBand, int &nXOff,
3724  int &nYOff, int &nXSize, int &nYSize,
3725  int nBufXSize, int nBufYSize,
3726  GDALRasterIOExtraArg *psExtraArg);
3727 
3728 int CPL_DLL GDALOvLevelAdjust(int nOvLevel, int nXSize)
3729  CPL_WARN_DEPRECATED("Use GDALOvLevelAdjust2 instead");
3730 int CPL_DLL GDALOvLevelAdjust2(int nOvLevel, int nXSize, int nYSize);
3731 int CPL_DLL GDALComputeOvFactor(int nOvrXSize, int nRasterXSize, int nOvrYSize,
3732  int nRasterYSize);
3733 
3734 GDALDataset CPL_DLL *GDALFindAssociatedAuxFile(const char *pszBasefile,
3735  GDALAccess eAccess,
3736  GDALDataset *poDependentDS);
3737 
3738 /* ==================================================================== */
3739 /* Infrastructure to check that dataset characteristics are valid */
3740 /* ==================================================================== */
3741 
3742 int CPL_DLL GDALCheckDatasetDimensions(int nXSize, int nYSize);
3743 int CPL_DLL GDALCheckBandCount(int nBands, int bIsZeroAllowed);
3744 
3745 /* Internal use only */
3746 
3747 /* CPL_DLL exported, but only for in-tree drivers that can be built as plugins
3748  */
3749 int CPL_DLL GDALReadWorldFile2(const char *pszBaseFilename,
3750  const char *pszExtension,
3751  double *padfGeoTransform,
3752  char **papszSiblingFiles,
3753  char **ppszWorldFileNameOut);
3754 int GDALReadTabFile2(const char *pszBaseFilename, double *padfGeoTransform,
3755  char **ppszWKT, int *pnGCPCount, GDAL_GCP **ppasGCPs,
3756  char **papszSiblingFiles, char **ppszTabFileNameOut);
3757 
3758 void CPL_DLL GDALCopyRasterIOExtraArg(GDALRasterIOExtraArg *psDestArg,
3759  GDALRasterIOExtraArg *psSrcArg);
3760 
3761 CPL_C_END
3762 
3763 void GDALNullifyOpenDatasetsList();
3764 CPLMutex **GDALGetphDMMutex();
3765 CPLMutex **GDALGetphDLMutex();
3766 void GDALNullifyProxyPoolSingleton();
3767 void GDALSetResponsiblePIDForCurrentThread(GIntBig responsiblePID);
3768 GIntBig GDALGetResponsiblePIDForCurrentThread();
3769 
3770 CPLString GDALFindAssociatedFile(const char *pszBasename, const char *pszExt,
3771  CSLConstList papszSiblingFiles, int nFlags);
3772 
3773 CPLErr CPL_DLL EXIFExtractMetadata(char **&papszMetadata, void *fpL,
3774  int nOffset, int bSwabflag, int nTIFFHEADER,
3775  int &nExifOffset, int &nInterOffset,
3776  int &nGPSOffset);
3777 
3778 int GDALValidateOpenOptions(GDALDriverH hDriver,
3779  const char *const *papszOptionOptions);
3780 int GDALValidateOptions(const char *pszOptionList,
3781  const char *const *papszOptionsToValidate,
3782  const char *pszErrorMessageOptionType,
3783  const char *pszErrorMessageContainerName);
3784 
3785 GDALRIOResampleAlg GDALRasterIOGetResampleAlg(const char *pszResampling);
3786 const char *GDALRasterIOGetResampleAlg(GDALRIOResampleAlg eResampleAlg);
3787 
3788 void GDALRasterIOExtraArgSetResampleAlg(GDALRasterIOExtraArg *psExtraArg,
3789  int nXSize, int nYSize, int nBufXSize,
3790  int nBufYSize);
3791 
3792 GDALDataset *GDALCreateOverviewDataset(GDALDataset *poDS, int nOvrLevel,
3793  bool bThisLevelOnly);
3794 
3795 // Should cover particular cases of #3573, #4183, #4506, #6578
3796 // Behavior is undefined if fVal1 or fVal2 are NaN (should be tested before
3797 // calling this function)
3798 template <class T> inline bool ARE_REAL_EQUAL(T fVal1, T fVal2, int ulp = 2)
3799 {
3800  return fVal1 == fVal2 || /* Should cover infinity */
3801  std::abs(fVal1 - fVal2) < std::numeric_limits<float>::epsilon() *
3802  std::abs(fVal1 + fVal2) * ulp;
3803 }
3804 
3805 double GDALAdjustNoDataCloseToFloatMax(double dfVal);
3806 
3807 #define DIV_ROUND_UP(a, b) (((a) % (b)) == 0 ? ((a) / (b)) : (((a) / (b)) + 1))
3808 
3809 // Number of data samples that will be used to compute approximate statistics
3810 // (minimum value, maximum value, etc.)
3811 #define GDALSTAT_APPROX_NUMSAMPLES 2500
3812 
3813 void GDALSerializeGCPListToXML(CPLXMLNode *psParentNode, GDAL_GCP *pasGCPList,
3814  int nGCPCount,
3815  const OGRSpatialReference *poGCP_SRS);
3816 void GDALDeserializeGCPListFromXML(CPLXMLNode *psGCPList,
3817  GDAL_GCP **ppasGCPList, int *pnGCPCount,
3818  OGRSpatialReference **ppoGCP_SRS);
3819 
3820 void GDALSerializeOpenOptionsToXML(CPLXMLNode *psParentNode,
3821  char **papszOpenOptions);
3822 char **GDALDeserializeOpenOptionsFromXML(CPLXMLNode *psParentNode);
3823 
3824 int GDALCanFileAcceptSidecarFile(const char *pszFilename);
3825 
3826 bool GDALCanReliablyUseSiblingFileList(const char *pszFilename);
3827 
3828 bool CPL_DLL GDALIsDriverDeprecatedForGDAL39StillEnabled(
3829  const char *pszDriverName, const char *pszExtraMsg = "");
3830 
3831 typedef enum
3832 {
3833  GSF_UNSIGNED_INT,
3834  GSF_SIGNED_INT,
3835  GSF_FLOATING_POINT,
3836 } GDALBufferSampleFormat;
3837 
3838 bool CPL_DLL GDALBufferHasOnlyNoData(const void *pBuffer, double dfNoDataValue,
3839  size_t nWidth, size_t nHeight,
3840  size_t nLineStride, size_t nComponents,
3841  int nBitsPerSample,
3842  GDALBufferSampleFormat nSampleFormat);
3843 
3844 void CPL_DLL GDALCopyNoDataValue(GDALRasterBand *poDstBand,
3845  GDALRasterBand *poSrcBand);
3846 
3847 double CPL_DLL GDALGetNoDataValueCastToDouble(int64_t nVal);
3848 double CPL_DLL GDALGetNoDataValueCastToDouble(uint64_t nVal);
3849 
3850 // Remove me in GDAL 4.0. See GetMetadataItem() implementation
3851 // Internal use in GDAL only !
3852 // Declaration copied in swig/include/gdal.i
3853 void CPL_DLL GDALEnablePixelTypeSignedByteWarning(GDALRasterBandH hBand,
3854  bool b);
3855 
3856 std::string CPL_DLL GDALGetCompressionFormatForJPEG(VSILFILE *fp);
3857 std::string CPL_DLL GDALGetCompressionFormatForJPEG(const void *pBuffer,
3858  size_t nBufferSize);
3859 
3861 
3862 #endif /* ndef GDAL_PRIV_H_INCLUDED */
GDAL_IDENTIFY_UNKNOWN
@ GDAL_IDENTIFY_UNKNOWN
Identify could not determine if the file is recognized or not by the probed driver.
Definition: gdal_priv.h:1678
GDALRelationship::SetRelatedTableType
void SetRelatedTableType(const std::string &osType)
Sets the type string of the related table.
Definition: gdal_priv.h:3654
GDALDimension::GetFullName
const std::string & GetFullName() const
Return the full name.
Definition: gdal_priv.h:3225
CPL_PRINT_FUNC_FORMAT
#define CPL_PRINT_FUNC_FORMAT(format_idx, arg_idx)
Tag a function to have printf() formatting.
Definition: cpl_port.h:950
GDAL_IDENTIFY_FALSE
@ GDAL_IDENTIFY_FALSE
Identify determined the file is not recognized by the probed driver.
Definition: gdal_priv.h:1680
GDALOpenInfo::fpL
VSILFILE * fpL
Pointer to the file.
Definition: gdal_priv.h:304
GDALExtendedDataType::GetSize
size_t GetSize() const
Return data type size in bytes.
Definition: gdal_priv.h:2182
GDALDimension::SetIndexingVariable
virtual bool SetIndexingVariable(std::shared_ptr< GDALMDArray > poIndexingVariable)
Set the variable that is used to index the dimension.
Definition: gdalmultidim.cpp:10163
GDALGetDataTypeSizeBytes
int GDALGetDataTypeSizeBytes(GDALDataType)
Get data type size in bytes.
Definition: gdal_misc.cpp:336
GDALGroup::GetFullName
const std::string & GetFullName() const
Return the full name of the group.
Definition: gdal_priv.h:2390
GDALRasterBand::GetMaskValueRange
virtual GDALMaskValueRange GetMaskValueRange() const
Returns the range of values that a mask band can take.
Definition: gdalrasterband.cpp:7569
GByte
unsigned char GByte
Unsigned byte type.
Definition: cpl_port.h:196
GDALAsyncReader::GetYOffset
int GetYOffset() const
Return y offset.
Definition: gdal_priv.h:1993
GDALExtendedDataType
Class used to represent potentially complex data types.
Definition: gdal_priv.h:2102
GDALRasterBlock::GetYSize
int GetYSize() const
Return the height of the block.
Definition: gdal_priv.h:1056
GDALDataset::Layers::Iterator::iterator_category
std::input_iterator_tag iterator_category
iterator_category
Definition: gdal_priv.h:774
GUInt64
GUIntBig GUInt64
Unsigned 64 bit integer type.
Definition: cpl_port.h:249
gdal.h
GDALOpenInfo
Class for dataset open functions.
Definition: gdal_priv.h:277
GDALDataset::Layers::Iterator
Layer iterator.
Definition: gdal_priv.h:763
GDALRasterBand::ComputeStatistics
virtual CPLErr ComputeStatistics(int bApproxOK, double *pdfMin, double *pdfMax, double *pdfMean, double *pdfStdDev, GDALProgressFunc, void *pProgressData)
Compute image statistics.
Definition: gdalrasterband.cpp:5612
GDALAsyncReader::GetPixelSpace
int GetPixelSpace() const
Return pixel spacing.
Definition: gdal_priv.h:2056
GDALAbstractMDArray::GetFullName
const std::string & GetFullName() const
Return the name of an array or attribute.
Definition: gdal_priv.h:2574
GDALRasterBlock::GetBlockSize
GPtrDiff_t GetBlockSize() const
Return the block size in bytes.
Definition: gdal_priv.h:1077
GDALEDTComponent
Class for a component of a compound extended data type.
Definition: gdal_priv.h:2237
GSBAP_RANDOM
constexpr GDALSuggestedBlockAccessPattern GSBAP_RANDOM
Random access to blocks is efficient.
Definition: gdal_priv.h:1256
GDALAsyncReader::GetBandCount
int GetBandCount() const
Return band count.
Definition: gdal_priv.h:2042
GDALRasterBand::IsMaskBand
virtual bool IsMaskBand() const
Returns whether a band is a mask band.
Definition: gdalrasterband.cpp:7518
GSBAP_UNKNOWN
constexpr GDALSuggestedBlockAccessPattern GSBAP_UNKNOWN
Unknown, or no particular read order is suggested.
Definition: gdal_priv.h:1253
GDALRelationship::GetLeftTableName
const std::string & GetLeftTableName() const
Get the name of the left (or base/origin) table in the relationship.
Definition: gdal_priv.h:3412
begin
OGRLayer::FeatureIterator begin(OGRLayer *poLayer)
Return begin of feature iterator.
Definition: ogrsf_frmts.h:411
GDALOpenEx
GDALDatasetH GDALOpenEx(const char *pszFilename, unsigned int nOpenFlags, const char *const *papszAllowedDrivers, const char *const *papszOpenOptions, const char *const *papszSiblingFiles)
Open a raster or vector file as a GDALDataset.
Definition: gdaldataset.cpp:3467
GDALDataset::Layers::Iterator::difference_type
void difference_type
difference_type
Definition: gdal_priv.h:771
GDALMDArray::IsWritable
virtual bool IsWritable() const =0
Return whether an array is writable.
OGRStyleTable
This class represents a style table.
Definition: ogr_featurestyle.h:84
GDALRelationship::SetForwardPathLabel
void SetForwardPathLabel(const std::string &osLabel)
Sets the label of the forward path for the relationship.
Definition: gdal_priv.h:3584
GEDTC_NUMERIC
@ GEDTC_NUMERIC
Numeric value.
Definition: gdal.h:323
CPLStringList
String list class designed around our use of C "char**" string lists.
Definition: cpl_string.h:437
GDALAsyncReader
Class used as a session object for asynchronous requests.
Definition: gdal_priv.h:1949
GDT_Unknown
@ GDT_Unknown
Definition: gdal.h:65
GDALOpenInfo::papszAllowedDrivers
const char *const * papszAllowedDrivers
Allowed drivers (NULL for all)
Definition: gdal_priv.h:312
GDALRelationship::GDALRelationship
GDALRelationship(const std::string &osName, const std::string &osLeftTableName, const std::string &osRightTableName, GDALRelationshipCardinality eCardinality=GDALRelationshipCardinality::GRC_ONE_TO_MANY)
Constructor for a relationship between two tables.
Definition: gdal_priv.h:3386
GMVR_0_AND_255_ONLY
@ GMVR_0_AND_255_ONLY
Definition: gdal_priv.h:1246
GDALExtendedDataType::GetClass
GDALExtendedDataTypeClass GetClass() const
Return type class.
Definition: gdal_priv.h:2140
GRT_ASSOCIATION
@ GRT_ASSOCIATION
Association relationship.
Definition: gdal.h:1989
GDALRelationship::GetRightTableName
const std::string & GetRightTableName() const
Get the name of the right (or related/destination) table in the relationship.
Definition: gdal_priv.h:3419
GDALAsyncReader::GetBufferYSize
int GetBufferYSize() const
Return buffer height.
Definition: gdal_priv.h:2028
cpl_minixml.h
GDALDriver
Format specific driver.
Definition: gdal_priv.h:1700
cpl_vsi.h
OGRSpatialReference
This class represents an OpenGIS Spatial Reference System, and contains methods for converting betwee...
Definition: ogr_spatialref.h:166
GDALAbstractMDArray
Abstract class, implemented by GDALAttribute and GDALMDArray.
Definition: gdal_priv.h:2497
GDALDataset::Bands
Class returned by GetBands() that act as a container for raster bands.
Definition: gdal_priv.h:499
GDALMDArray::at
std::shared_ptr< GDALMDArray > at(GUInt64 idx, GUInt64VarArg... tail) const
Return a view of the array using integer indexing.
Definition: gdal_priv.h:3008
GDALColorTableH
void * GDALColorTableH
Opaque type used for the C bindings of the C++ GDALColorTable class.
Definition: gdal.h:300
GDALAsyncReader::GetLineSpace
int GetLineSpace() const
Return line spacing.
Definition: gdal_priv.h:2063
GDALRasterBlock::GetDataRef
void * GetDataRef(void)
Return the data buffer.
Definition: gdal_priv.h:1070
GDALOpenInfo::nOpenFlags
int nOpenFlags
Open flags.
Definition: gdal_priv.h:296
GDALOpenInfo::papszOpenOptions
char ** papszOpenOptions
Open options.
Definition: gdal_priv.h:291
GDALMajorObject::SetMetadataItem
virtual CPLErr SetMetadataItem(const char *pszName, const char *pszValue, const char *pszDomain="")
Set single metadata item.
Definition: gdalmajorobject.cpp:385
OGRGeometry
Abstract base class for all geometry classes.
Definition: ogr_geometry.h:334
GDALColorEntry
Color tuple.
Definition: gdal.h:1809
GDALDimension::GetName
const std::string & GetName() const
Return the name.
Definition: gdal_priv.h:3216
GDALAbstractMDArray::GetDimensions
virtual const std::vector< std::shared_ptr< GDALDimension > > & GetDimensions() const =0
Return the dimensions of an attribute/array.
GDALColorInterp
GDALColorInterp
Definition: gdal.h:226
OGRLayer
This class represents a layer of simple features, with access methods.
Definition: ogrsf_frmts.h:73
CPLString
Convenient string class based on std::string.
Definition: cpl_string.h:311
GDALRasterBand
A single raster band (or channel).
Definition: gdal_priv.h:1270
GInt64
GIntBig GInt64
Signed 64 bit integer type.
Definition: cpl_port.h:247
GDALRelationship::GetRightTableFields
const std::vector< std::string > & GetRightTableFields() const
Get the names of the participating fields from the right table in the relationship.
Definition: gdal_priv.h:3459
GDALIdentifyEnum
GDALIdentifyEnum
Enumeration used by GDALDriver::pfnIdentify().
Definition: gdal_priv.h:1674
GDALAsyncReader::GetBandSpace
int GetBandSpace() const
Return band spacing.
Definition: gdal_priv.h:2070
GMVR_0_AND_1_ONLY
@ GMVR_0_AND_1_ONLY
Definition: gdal_priv.h:1245
GDALIHasAttribute::GetAttributes
virtual std::vector< std::shared_ptr< GDALAttribute > > GetAttributes(CSLConstList papszOptions=nullptr) const
Return the list of attributes contained in a GDALMDArray or GDALGroup.
Definition: gdalmultidim.cpp:269
GPtrDiff_t
int GPtrDiff_t
Integer type large enough to hold the difference between 2 addresses.
Definition: cpl_port.h:267
GDALDimension::GetDirection
const std::string & GetDirection() const
Return the axis direction.
Definition: gdal_priv.h:3251
GDALRelationship::SetType
void SetType(GDALRelationshipType eType)
Sets the type of the relationship.
Definition: gdal_priv.h:3544
GDALClose
CPLErr GDALClose(GDALDatasetH)
Close GDAL dataset.
Definition: gdaldataset.cpp:3882
GDALAsyncReader::GetBufferType
GDALDataType GetBufferType() const
Return buffer data type.
Definition: gdal_priv.h:2035
GDALExtendedDataTypeClass
GDALExtendedDataTypeClass
Enumeration giving the class of a GDALExtendedDataType.
Definition: gdal.h:320
GDALMaskValueRange
GDALMaskValueRange
Range of values found in a mask band.
Definition: gdal_priv.h:1241
GDALRawResult::data
const GByte * data() const
Return pointer to the start of data.
Definition: gdal_priv.h:2692
GDALDataType
GDALDataType
Definition: gdal.h:63
CPLXMLNode
Document node structure.
Definition: cpl_minixml.h:69
OGRFeatureUniquePtr
std::unique_ptr< OGRFeature, OGRFeatureUniquePtrDeleter > OGRFeatureUniquePtr
Unique pointer type for OGRFeature.
Definition: ogr_feature.h:1301
GDALRelationship::FromHandle
static GDALRelationship * FromHandle(GDALRelationshipH hRelationship)
Convert a GDALRelationshipH to a GDALRelationship*.
Definition: gdal_priv.h:3668
GDALMajorObject::GetMetadataItem
virtual const char * GetMetadataItem(const char *pszName, const char *pszDomain="")
Fetch single metadata item.
Definition: gdalmajorobject.cpp:341
GDALAbstractMDArray::GetName
const std::string & GetName() const
Return the name of an array or attribute.
Definition: gdal_priv.h:2564
GDALRasterBlock
A single raster block in the block cache.
Definition: gdal_priv.h:973
GDALMajorObjectH
void * GDALMajorObjectH
Opaque type used for the C bindings of the C++ GDALMajorObject class.
Definition: gdal.h:288
GDALRawResult
Store the raw result of an attribute value, which might contain dynamically allocated structures (lik...
Definition: gdal_priv.h:2662
GDALGroup
Class modeling a named container of GDALAttribute, GDALMDArray, OGRLayer or other GDALGroup.
Definition: gdal_priv.h:2330
GDALDataset
A set of associated raster bands, usually from one file.
Definition: gdal_priv.h:348
GDALDataset::GetOpenOptions
char ** GetOpenOptions()
Return open options.
Definition: gdal_priv.h:647
GDALMajorObject::FromHandle
static GDALMajorObject * FromHandle(GDALMajorObjectH hMajorObject)
Convert a GDALMajorObjectH to a GDALMajorObject*.
Definition: gdal_priv.h:182
GDALRawResult::size
size_t size() const
Return the size in bytes of the raw result.
Definition: gdal_priv.h:2697
GDALIHasAttribute
Interface used to get a single GDALAttribute or a set of GDALAttribute.
Definition: gdal_priv.h:2289
GDALRelationship
Definition of a table relationship.
Definition: gdal_priv.h:3357
GDALOpenInfo::bStatOK
int bStatOK
Whether stat()'ing the file was successful.
Definition: gdal_priv.h:299
GDALRelationship::GetType
GDALRelationshipType GetType() const
Get the type of the relationship.
Definition: gdal_priv.h:3535
CPL_C_START
#define CPL_C_START
Macro to start a block of C symbols.
Definition: cpl_port.h:306
GDALDriverManager
Class for managing the registration of file format drivers.
Definition: gdal_priv.h:1891
GDALRelationshipH
void * GDALRelationshipH
Opaque type used for the C bindings of the C++ GDALRelationship class.
Definition: gdal.h:312
GDALRelationship::GetForwardPathLabel
const std::string & GetForwardPathLabel() const
Get the label of the forward path for the relationship.
Definition: gdal_priv.h:3564
GDALMDArray
Class modeling a multi-dimensional array.
Definition: gdal_priv.h:2836
GDALOpenInfo::pabyHeader
GByte * pabyHeader
Buffer with first bytes of the file.
Definition: gdal_priv.h:309
GDALAsyncReader::GetYSize
int GetYSize() const
Return height.
Definition: gdal_priv.h:2007
GDALOpenInfo::eAccess
GDALAccess eAccess
Access flag.
Definition: gdal_priv.h:294
GDALRasterBand::GetMaskBand
virtual GDALRasterBand * GetMaskBand()
Return the mask band associated with the band.
Definition: gdalrasterband.cpp:7052
GDALExtendedDataType::GetNumericDataType
GDALDataType GetNumericDataType() const
Return numeric data type (only valid when GetClass() == GEDTC_NUMERIC)
Definition: gdal_priv.h:2150
GDALExtendedDataType::CreateString
static GDALExtendedDataType CreateString(size_t nMaxStringLength=0, GDALExtendedDataTypeSubType eSubType=GEDTST_NONE)
Return a new GDALExtendedDataType of class GEDTC_STRING.
Definition: gdalmultidim.cpp:9891
GRC_ONE_TO_MANY
@ GRC_ONE_TO_MANY
One-to-many.
Definition: gdal.h:1973
CSLConstList
char ** CSLConstList
Type of a constant null-terminated list of nul terminated strings.
Definition: cpl_port.h:1178
CPLErrorNum
int CPLErrorNum
Error number.
Definition: cpl_error.h:95
GUIntBig
unsigned long long GUIntBig
Large unsigned integer type (generally 64-bit unsigned integer type).
Definition: cpl_port.h:229
GDALDataset::Open
static GDALDataset * Open(const char *pszFilename, unsigned int nOpenFlags=0, const char *const *papszAllowedDrivers=nullptr, const char *const *papszOpenOptions=nullptr, const char *const *papszSiblingFiles=nullptr)
Definition: gdal_priv.h:703
GDT_Float64
@ GDT_Float64
Definition: gdal.h:75
GDALExtendedDataType::GetSubType
GDALExtendedDataTypeSubType GetSubType() const
Return subtype.
Definition: gdal_priv.h:2161
GDALRasterBlock::DropLock
int DropLock(void)
Decrement the lock count.
Definition: gdal_priv.h:1017
GDALRelationship::GetBackwardPathLabel
const std::string & GetBackwardPathLabel() const
Get the label of the backward path for the relationship.
Definition: gdal_priv.h:3604
GDALRelationship::GetLeftTableFields
const std::vector< std::string > & GetLeftTableFields() const
Get the names of the participating fields from the left table in the relationship.
Definition: gdal_priv.h:3448
GDALOpenInfo::bIsDirectory
int bIsDirectory
Whether the file is a directory.
Definition: gdal_priv.h:301
GDALDimension::GetType
const std::string & GetType() const
Return the axis type.
Definition: gdal_priv.h:3238
GDAL_GCP
Ground Control Point.
Definition: gdal.h:1051
CPL_C_END
#define CPL_C_END
Macro to end a block of C symbols.
Definition: cpl_port.h:310
GDALRasterBand::IReadBlock
virtual CPLErr IReadBlock(int nBlockXOff, int nBlockYOff, void *pData)=0
GDALDimension
Class modeling a a dimension / axis used to index multidimensional arrays.
Definition: gdal_priv.h:3201
GEDTST_NONE
@ GEDTST_NONE
None.
Definition: gdal.h:336
GDALRelationship::SetBackwardPathLabel
void SetBackwardPathLabel(const std::string &osLabel)
Sets the label of the backward path for the relationship.
Definition: gdal_priv.h:3624
GDALRelationship::GetCardinality
GDALRelationshipCardinality GetCardinality() const
Get the cardinality of the relationship.
Definition: gdal_priv.h:3403
CPL_NULL_TERMINATED
#define CPL_NULL_TERMINATED
Null terminated variadic.
Definition: cpl_port.h:938
GSBAP_BOTTOM_TO_TOP
constexpr GDALSuggestedBlockAccessPattern GSBAP_BOTTOM_TO_TOP
Reading by strips from bottom to top is the most efficient.
Definition: gdal_priv.h:1262
GDALExtendedDataType::GetComponents
const std::vector< std::unique_ptr< GDALEDTComponent > > & GetComponents() const
Return the components of the data type (only valid when GetClass() == GEDTC_COMPOUND)
Definition: gdal_priv.h:2171
GDALAbstractMDArray::GetDataType
virtual const GDALExtendedDataType & GetDataType() const =0
Return the data type of an attribute/array.
GSBAP_LARGEST_CHUNK_POSSIBLE
constexpr GDALSuggestedBlockAccessPattern GSBAP_LARGEST_CHUNK_POSSIBLE
Reading the largest chunk from the raster is the most efficient (can be combined with above values).
Definition: gdal_priv.h:1266
ogr_feature.h
GDALDataset::FeatureLayerPair
Object returned by GetFeatures() iterators.
Definition: gdal_priv.h:715
GDALAsyncReader::GetGDALDataset
GDALDataset * GetGDALDataset()
Return dataset.
Definition: gdal_priv.h:1979
cpl_conv.h
GDALDataset::ToHandle
static GDALDatasetH ToHandle(GDALDataset *poDS)
Convert a GDALDataset* to a GDALDatasetH.
Definition: gdal_priv.h:687
GDALRelationship::SetRightTableFields
void SetRightTableFields(const std::vector< std::string > &osListFields)
Sets the names of the participating fields from the right table in the relationship.
Definition: gdal_priv.h:3481
CPLVirtualMem
struct CPLVirtualMem CPLVirtualMem
Opaque type that represents a virtual memory mapping.
Definition: cpl_virtualmem.h:62
cpl_string.h
GDALAbstractMDArray::Read
virtual bool Read(const GUInt64 *arrayStartIdx, const size_t *count, const GInt64 *arrayStep, const GPtrDiff_t *bufferStride, const GDALExtendedDataType &bufferDataType, void *pDstBuffer, const void *pDstBufferAllocStart=nullptr, size_t nDstBufferAllocSize=0) const
Read part or totality of a multidimensional array or attribute.
Definition: gdalmultidim.cpp:2132
VSIVirtualHandle
Virtual file handle.
Definition: cpl_vsi_virtual.h:62
GDALMajorObject::SetMetadata
virtual CPLErr SetMetadata(char **papszMetadata, const char *pszDomain="")
Set metadata.
Definition: gdalmajorobject.cpp:290
GDALDataset::CloseDependentDatasets
virtual int CloseDependentDatasets()
Drop references to any other datasets referenced by this dataset.
Definition: gdaldataset.cpp:4272
GDALQueryLoggerFunc
void(* GDALQueryLoggerFunc)(const char *pszSQL, const char *pszError, int64_t lNumRecords, int64_t lExecutionTimeMilliseconds, void *pQueryLoggerArg)
Type of functions to pass to GDALDatasetSetQueryLoggerFunc.
Definition: gdal.h:1277
GDALColorTable::ToHandle
static GDALColorTableH ToHandle(GDALColorTable *poCT)
Convert a GDALColorTable* to a GDALRasterBandH.
Definition: gdal_priv.h:1147
GDALRasterBlock::AddLock
int AddLock(void)
Increment the lock count.
Definition: gdal_priv.h:1012
GDALDataset::CreateMaskBand
virtual CPLErr CreateMaskBand(int nFlagsIn)
Adds a mask band to the dataset.
Definition: gdaldataset.cpp:3238
GDALRelationship::SetLeftTableFields
void SetLeftTableFields(const std::vector< std::string > &osListFields)
Sets the names of the participating fields from the left table in the relationship.
Definition: gdal_priv.h:3470
OGRFieldDomain
Definition of a field domain.
Definition: ogr_feature.h:1355
GSpacing
GIntBig GSpacing
Type to express pixel, line or band spacing.
Definition: gdal.h:315
vsi_l_offset
GUIntBig vsi_l_offset
Type for a file offset.
Definition: cpl_vsi.h:146
GDALExtendedDataType::operator!=
bool operator!=(const GDALExtendedDataType &other) const
Non-equality operator.
Definition: gdal_priv.h:2122
GDALDimension::GetSize
GUInt64 GetSize() const
Return the size, that is the number of values along the dimension.
Definition: gdal_priv.h:3260
GDALAccess
GDALAccess
Definition: gdal.h:124
end
OGRLayer::FeatureIterator end(OGRLayer *poLayer)
Return end of feature iterator.
Definition: ogrsf_frmts.h:419
GDALAsyncStatusType
GDALAsyncStatusType
status of the asynchronous stream
Definition: gdal.h:110
GDALEDTComponent::GetOffset
size_t GetOffset() const
Return the offset (in bytes) of the component in the compound data type.
Definition: gdal_priv.h:2260
GDALDriver::FromHandle
static GDALDriver * FromHandle(GDALDriverH hDriver)
Convert a GDALDriverH to a GDALDriver*.
Definition: gdal_priv.h:1871
GDALRawResult::operator[]
const GByte & operator[](size_t idx) const
Return byte at specified index.
Definition: gdal_priv.h:2687
GDAL_IDENTIFY_TRUE
@ GDAL_IDENTIFY_TRUE
Identify determined the file is recognized by the probed driver.
Definition: gdal_priv.h:1682
OGRErr
int OGRErr
Type for a OGR error.
Definition: ogr_core.h:378
GDALRelationship::GetMappingTableName
const std::string & GetMappingTableName() const
Get the name of the mapping table for many-to-many relationships.
Definition: gdal_priv.h:3428
GA_ReadOnly
@ GA_ReadOnly
Definition: gdal.h:126
GDALDimension::GetIndexingVariable
virtual std::shared_ptr< GDALMDArray > GetIndexingVariable() const
Return the variable that is used to index the dimension (if there is one).
Definition: gdalmultidim.cpp:10142
GDALAsyncReader::GetXSize
int GetXSize() const
Return width.
Definition: gdal_priv.h:2000
GDALRasterBlock::GetDirty
int GetDirty() const
Return the dirty flag.
Definition: gdal_priv.h:1063
GIntBig
long long GIntBig
Large signed integer type (generally 64-bit integer type).
Definition: cpl_port.h:226
GDALRelationship::GetLeftMappingTableFields
const std::vector< std::string > & GetLeftMappingTableFields() const
Get the names of the mapping table fields which correspond to the participating fields from the left ...
Definition: gdal_priv.h:3492
GDALRelationship::GetRightMappingTableFields
const std::vector< std::string > & GetRightMappingTableFields() const
Get the names of the mapping table fields which correspond to the participating fields from the right...
Definition: gdal_priv.h:3503
GDALDataset::Layers::Iterator::pointer
void pointer
pointer
Definition: gdal_priv.h:772
GDALAsyncReader::GetBufferXSize
int GetBufferXSize() const
Return buffer width.
Definition: gdal_priv.h:2021
GDALOpenInfo::nHeaderBytes
int nHeaderBytes
Number of bytes in pabyHeader.
Definition: gdal_priv.h:307
OGRwkbGeometryType
OGRwkbGeometryType
List of well known binary geometry types.
Definition: ogr_core.h:406
GDALDriver::ToHandle
static GDALDriverH ToHandle(GDALDriver *poDriver)
Convert a GDALDriver* to a GDALDriverH.
Definition: gdal_priv.h:1863
GDALRasterIOExtraArg
Structure to pass extra arguments to RasterIO() method, must be initialized with INIT_RASTERIO_EXTRA_...
Definition: gdal.h:175
GDALRasterBand::ToHandle
void static GDALRasterBandH ToHandle(GDALRasterBand *poBand)
Convert a GDALRasterBand* to a GDALRasterBandH.
Definition: gdal_priv.h:1512
GDALRasterBlock::GetYOff
int GetYOff() const
Return the y offset of the top-left corner of the block.
Definition: gdal_priv.h:1042
CPL_WARN_UNUSED_RESULT
#define CPL_WARN_UNUSED_RESULT
Qualifier to warn when the return value of a function is not used.
Definition: cpl_port.h:976
GDALDataset::GetAccess
GDALAccess GetAccess() const
Return access mode.
Definition: gdal_priv.h:634
GDALRelationship::SetMappingTableName
void SetMappingTableName(const std::string &osName)
Sets the name of the mapping table for many-to-many relationships.
Definition: gdal_priv.h:3437
OGRFeature
A simple feature, including geometry and attributes.
Definition: ogr_feature.h:680
GDALMDArray::GetFilename
virtual const std::string & GetFilename() const =0
Return the filename that contains that array.
GDALRWFlag
GDALRWFlag
Definition: gdal.h:131
GDALRelationship::GetName
const std::string & GetName() const
Get the name of the relationship.
Definition: gdal_priv.h:3397
GDALRelationship::SetLeftMappingTableFields
void SetLeftMappingTableFields(const std::vector< std::string > &osListFields)
Sets the names of the mapping table fields which correspond to the participating fields from the left...
Definition: gdal_priv.h:3514
GDALDataset::Features
Class returned by GetFeatures() that act as a container for vector features.
Definition: gdal_priv.h:817
GDALRelationship::ToHandle
static GDALRelationshipH ToHandle(GDALRelationship *poRelationship)
Convert a GDALRelationship* to a GDALRelationshipH.
Definition: gdal_priv.h:3661
GDALSuggestedBlockAccessPattern
int GDALSuggestedBlockAccessPattern
Suggested/most efficient access pattern to blocks.
Definition: gdal_priv.h:1250
GDALDataset::BuildOverviews
CPLErr BuildOverviews(const char *, int, const int *, int, const int *, GDALProgressFunc, void *, CSLConstList papszOptions)
Build raster overview(s)
Definition: gdaldataset.cpp:2017
GDALMajorObject
Object with metadata.
Definition: gdal_priv.h:138
GDALAbstractMDArray::Write
bool Write(const GUInt64 *arrayStartIdx, const size_t *count, const GInt64 *arrayStep, const GPtrDiff_t *bufferStride, const GDALExtendedDataType &bufferDataType, const void *pSrcBuffer, const void *pSrcBufferAllocStart=nullptr, size_t nSrcBufferAllocSize=0)
Write part or totality of a multidimensional array or attribute.
Definition: gdalmultidim.cpp:2235
GDALRasterBand::IRasterIO
virtual CPLErr IRasterIO(GDALRWFlag, int, int, int, int, void *, int, int, GDALDataType, GSpacing, GSpacing, GDALRasterIOExtraArg *psExtraArg)
Read/write a region of image data for this band.
Definition: rasterio.cpp:207
CPLErr
CPLErr
Error category.
Definition: cpl_error.h:52
GDALAttribute
Class modeling an attribute that has a name, a value and a type, and is typically used to describe a ...
Definition: gdal_priv.h:2725
GDALEDTComponent::GetType
const GDALExtendedDataType & GetType() const
Return the data type of the component.
Definition: gdal_priv.h:2269
GDALOpenInfo::pszFilename
char * pszFilename
Filename.
Definition: gdal_priv.h:289
GDALColorTable::FromHandle
static GDALColorTable * FromHandle(GDALColorTableH hCT)
Convert a GDALColorTableH to a GDALColorTable*.
Definition: gdal_priv.h:1155
GDT_Byte
@ GDT_Byte
Definition: gdal.h:66
GPI_RGB
@ GPI_RGB
Definition: gdal.h:255
GDALExtendedDataTypeSubType
GDALExtendedDataTypeSubType
Enumeration giving the subtype of a GDALExtendedDataType.
Definition: gdal.h:333
GDALDatasetUniquePtr
std::unique_ptr< GDALDataset, GDALDatasetUniquePtrDeleter > GDALDatasetUniquePtr
Unique pointer type for GDALDataset.
Definition: gdal_priv.h:963
GDALRasterBand::GetMaskFlags
virtual int GetMaskFlags()
Return the status flags of the mask band associated with the band.
Definition: gdalrasterband.cpp:7377
GDALRIOResampleAlg
GDALRIOResampleAlg
RasterIO() resampling method.
Definition: gdal.h:142
GetGDALDriverManager
GDALDriverManager * GetGDALDriverManager(void)
Fetch the global GDAL driver manager.
Definition: gdaldrivermanager.cpp:102
GDALRasterAttributeTable
Definition: gdal_rat.h:47
GDALAsyncReader::GetXOffset
int GetXOffset() const
Return x offset.
Definition: gdal_priv.h:1986
GDALExtendedDataType::GetMaxStringLength
size_t GetMaxStringLength() const
Return the maximum length of a string in bytes.
Definition: gdal_priv.h:2191
GDALRelationshipCardinality
GDALRelationshipCardinality
Cardinality of relationship.
Definition: gdal.h:1968
GDALRasterBlock::GetBand
GDALRasterBand * GetBand()
Accessor to source GDALRasterBand object.
Definition: gdal_priv.h:1088
GDALDataset::Layers
Class returned by GetLayers() that acts as a range of layers.
Definition: gdal_priv.h:750
GDALRasterBlock::GetXOff
int GetXOff() const
Return the x offset of the top-left corner of the block.
Definition: gdal_priv.h:1035
GDALRasterBlock::GetDataType
GDALDataType GetDataType() const
Return the data type.
Definition: gdal_priv.h:1028
GDALDataset::FromHandle
static GDALDataset * FromHandle(GDALDatasetH hDS)
Convert a GDALDatasetH to a GDALDataset*.
Definition: gdal_priv.h:695
ogr_core.h
GDALPaletteInterp
GDALPaletteInterp
Definition: gdal.h:252
GDALExtendedDataType::Create
static GDALExtendedDataType Create(GDALDataType eType)
Return a new GDALExtendedDataType of class GEDTC_NUMERIC.
Definition: gdalmultidim.cpp:9826
GDALSubdatasetInfo
The GDALSubdatasetInfo abstract class provides methods to extract and manipulate subdataset informati...
Definition: gdalsubdatasetinfo.h:41
GDALMajorObject::ToHandle
static GDALMajorObjectH ToHandle(GDALMajorObject *poMajorObject)
Convert a GDALMajorObject* to a GDALMajorObjectH.
Definition: gdal_priv.h:174
GDALRasterBandH
void * GDALRasterBandH
Opaque type used for the C bindings of the C++ GDALRasterBand class.
Definition: gdal.h:294
GDALGroup::GetName
const std::string & GetName() const
Return the name of the group.
Definition: gdal_priv.h:2381
GDALRelationship::SetRightMappingTableFields
void SetRightMappingTableFields(const std::vector< std::string > &osListFields)
Sets the names of the mapping table fields which correspond to the participating fields from the righ...
Definition: gdal_priv.h:3526
wkbUnknown
@ wkbUnknown
unknown type, non-standard
Definition: ogr_core.h:408
GDALAsyncReader::GetBuffer
void * GetBuffer()
Return buffer.
Definition: gdal_priv.h:2014
GDALExtendedDataType::GetName
const std::string & GetName() const
Return type name.
Definition: gdal_priv.h:2131
CPL_DISALLOW_COPY_ASSIGN
#define CPL_DISALLOW_COPY_ASSIGN(ClassName)
Helper to remove the copy and assignment constructors so that the compiler will not generate the defa...
Definition: cpl_port.h:1042
GDALEDTComponent::GetName
const std::string & GetName() const
Return the name.
Definition: gdal_priv.h:2251
GDALRasterBlock::GetXSize
int GetXSize() const
Return the width of the block.
Definition: gdal_priv.h:1049
GDALDatasetH
void * GDALDatasetH
Opaque type used for the C bindings of the C++ GDALDataset class.
Definition: gdal.h:291
GDALRasterBand::FromHandle
static GDALRasterBand * FromHandle(GDALRasterBandH hBand)
Convert a GDALRasterBandH to a GDALRasterBand*.
Definition: gdal_priv.h:1520
GDALColorTable
A color table / palette.
Definition: gdal_priv.h:1121
GDALAsyncReader::GetBandMap
int * GetBandMap()
Return band map.
Definition: gdal_priv.h:2049
GSBAP_TOP_TO_BOTTOM
constexpr GDALSuggestedBlockAccessPattern GSBAP_TOP_TO_BOTTOM
Reading by strips from top to bottom is the most efficient.
Definition: gdal_priv.h:1259
GDALDriverH
void * GDALDriverH
Opaque type used for the C bindings of the C++ GDALDriver class.
Definition: gdal.h:297
GDALRelationship::GetRelatedTableType
const std::string & GetRelatedTableType() const
Get the type string of the related table.
Definition: gdal_priv.h:3639
GDALRelationshipType
GDALRelationshipType
Type of relationship.
Definition: gdal.h:1984