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;
49 class GDALRasterAttributeTable;
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 "cpl_vsi.h"
64 #include "cpl_conv.h"
65 #include "cpl_string.h"
66 #include "cpl_minixml.h"
67 #include "cpl_multiproc.h"
68 #include "cpl_atomic_ops.h"
69
70 #include <stdarg.h>
71
72 #include <cmath>
73 #include <cstdint>
74 #include <iterator>
75 #include <limits>
76 #include <map>
77 #include <memory>
78 #include <vector>
79
80 #include "ogr_core.h"
81 #include "ogr_feature.h"
82
84 #define GMO_VALID 0x0001
85 #define GMO_IGNORE_UNIMPLEMENTED 0x0002
86 #define GMO_SUPPORT_MD 0x0004
87 #define GMO_SUPPORT_MDMD 0x0008
88 #define GMO_MD_DIRTY 0x0010
89 #define GMO_PAM_CLASS 0x0020
90
92 /************************************************************************/
93 /* GDALMultiDomainMetadata */
94 /************************************************************************/
95
97 class CPL_DLL GDALMultiDomainMetadata
98 {
99 private:
100 char **papszDomainList;
101 CPLStringList **papoMetadataLists;
102
103 public:
104 GDALMultiDomainMetadata();
105 ~GDALMultiDomainMetadata();
106
107 int XMLInit(CPLXMLNode *psMetadata, int bMerge);
108 CPLXMLNode *Serialize();
109
110 char **GetDomainList()
111 {
112 return papszDomainList;
113 }
114
115 char **GetMetadata(const char *pszDomain = "");
116 CPLErr SetMetadata(char **papszMetadata, const char *pszDomain = "");
117 const char *GetMetadataItem(const char *pszName,
118 const char *pszDomain = "");
119 CPLErr SetMetadataItem(const char *pszName, const char *pszValue,
120 const char *pszDomain = "");
121
122 void Clear();
123
124 private:
125 CPL_DISALLOW_COPY_ASSIGN(GDALMultiDomainMetadata)
126 };
128
129 /* ******************************************************************** */
130 /* GDALMajorObject */
131 /* */
132 /* Base class providing metadata, description and other */
133 /* services shared by major objects. */
134 /* ******************************************************************** */
135
137 class CPL_DLL GDALMajorObject
138 {
139 protected:
141 int nFlags; // GMO_* flags.
142 CPLString sDescription{};
143 GDALMultiDomainMetadata oMDMD{};
144
146
147 char **BuildMetadataDomainList(char **papszList, int bCheckNonEmpty,
148 ...) CPL_NULL_TERMINATED;
149
150 public:
151 GDALMajorObject();
152 virtual ~GDALMajorObject();
153
154 int GetMOFlags() const;
155 void SetMOFlags(int nFlagsIn);
156
157 virtual const char *GetDescription() const;
158 virtual void SetDescription(const char *);
159
160 virtual char **GetMetadataDomainList();
161
162 virtual char **GetMetadata(const char *pszDomain = "");
163 virtual CPLErr SetMetadata(char **papszMetadata,
164 const char *pszDomain = "");
165 virtual const char *GetMetadataItem(const char *pszName,
166 const char *pszDomain = "");
167 virtual CPLErr SetMetadataItem(const char *pszName, const char *pszValue,
168 const char *pszDomain = "");
169
173 static inline GDALMajorObjectH ToHandle(GDALMajorObject *poMajorObject)
174 {
175 return static_cast<GDALMajorObjectH>(poMajorObject);
176 }
177
181 static inline GDALMajorObject *FromHandle(GDALMajorObjectH hMajorObject)
182 {
183 return static_cast<GDALMajorObject *>(hMajorObject);
184 }
185 };
186
187 /* ******************************************************************** */
188 /* GDALDefaultOverviews */
189 /* ******************************************************************** */
190
192 class CPL_DLL GDALDefaultOverviews
193 {
194 friend class GDALDataset;
195
196 GDALDataset *poDS;
197 GDALDataset *poODS;
198
199 CPLString osOvrFilename{};
200
201 bool bOvrIsAux;
202
203 bool bCheckedForMask;
204 bool bOwnMaskDS;
205 GDALDataset *poMaskDS;
206
207 // For "overview datasets" we record base level info so we can
208 // find our way back to get overview masks.
209 GDALDataset *poBaseDS;
210
211 // Stuff for deferred initialize/overviewscans.
212 bool bCheckedForOverviews;
213 void OverviewScan();
214 char *pszInitName;
215 bool bInitNameIsOVR;
216 char **papszInitSiblingFiles;
217
218 public:
219 GDALDefaultOverviews();
220 ~GDALDefaultOverviews();
221
222 void Initialize(GDALDataset *poDSIn, const char *pszName = nullptr,
223 char **papszSiblingFiles = nullptr, int bNameIsOVR = FALSE);
224
225 void TransferSiblingFiles(char **papszSiblingFiles);
226
227 int IsInitialized();
228
229 int CloseDependentDatasets();
230
231 // Overview Related
232
233 int GetOverviewCount(int nBand);
234 GDALRasterBand *GetOverview(int nBand, int iOverview);
235
236 CPLErr BuildOverviews(const char *pszBasename, const char *pszResampling,
237 int nOverviews, const int *panOverviewList,
238 int nBands, const int *panBandList,
239 GDALProgressFunc pfnProgress, void *pProgressData,
240 CSLConstList papszOptions);
241
242 CPLErr BuildOverviewsSubDataset(const char *pszPhysicalFile,
243 const char *pszResampling, int nOverviews,
244 const int *panOverviewList, int nBands,
245 const int *panBandList,
246 GDALProgressFunc pfnProgress,
247 void *pProgressData,
248 CSLConstList papszOptions);
249
250 CPLErr CleanOverviews();
251
252 // Mask Related
253
254 CPLErr CreateMaskBand(int nFlags, int nBand = -1);
255 GDALRasterBand *GetMaskBand(int nBand);
256 int GetMaskFlags(int nBand);
257
258 int HaveMaskFile(char **papszSiblings = nullptr,
259 const char *pszBasename = nullptr);
260
261 char **GetSiblingFiles()
262 {
263 return papszInitSiblingFiles;
264 }
265
266 private:
267 CPL_DISALLOW_COPY_ASSIGN(GDALDefaultOverviews)
268 };
270
271 /* ******************************************************************** */
272 /* GDALOpenInfo */
273 /* ******************************************************************** */
274
276 class CPL_DLL GDALOpenInfo
277 {
278 bool bHasGotSiblingFiles;
279 char **papszSiblingFiles;
280 int nHeaderBytesTried;
281
282 public:
283 GDALOpenInfo(const char *pszFile, int nOpenFlagsIn,
284 const char *const *papszSiblingFiles = nullptr);
285 ~GDALOpenInfo(void);
286
288 char *pszFilename;
290 char **papszOpenOptions;
291
293 GDALAccess eAccess;
295 int nOpenFlags;
296
298 int bStatOK;
300 int bIsDirectory;
301
303 VSILFILE *fpL;
304
306 int nHeaderBytes;
308 GByte *pabyHeader;
309
311 const char *const *papszAllowedDrivers;
312
313 int TryToIngest(int nBytes);
314 char **GetSiblingFiles();
315 char **StealSiblingFiles();
316 bool AreSiblingFilesLoaded() const;
317
318 private:
319 CPL_DISALLOW_COPY_ASSIGN(GDALOpenInfo)
320 };
321
322 /* ******************************************************************** */
323 /* GDALDataset */
324 /* ******************************************************************** */
325
326 class OGRLayer;
327 class OGRGeometry;
328 class OGRSpatialReference;
329 class OGRStyleTable;
330 class swq_select;
331 class swq_select_parse_options;
332 class GDALGroup;
333
335 typedef struct GDALSQLParseInfo GDALSQLParseInfo;
337
339 #ifdef GDAL_COMPILATION
340 #define OPTIONAL_OUTSIDE_GDAL(val)
341 #else
342 #define OPTIONAL_OUTSIDE_GDAL(val) = val
343 #endif
344
347 class CPL_DLL GDALDataset : public GDALMajorObject
348 {
349 friend GDALDatasetH CPL_STDCALL
350 GDALOpenEx(const char *pszFilename, unsigned int nOpenFlags,
351 const char *const *papszAllowedDrivers,
352 const char *const *papszOpenOptions,
353 const char *const *papszSiblingFiles);
354 friend CPLErr CPL_STDCALL GDALClose(GDALDatasetH hDS);
355
356 friend class GDALDriver;
357 friend class GDALDefaultOverviews;
358 friend class GDALProxyDataset;
359 friend class GDALDriverManager;
360
361 CPL_INTERNAL void AddToDatasetOpenList();
362
363 CPL_INTERNAL static void ReportErrorV(const char *pszDSName,
364 CPLErr eErrClass, CPLErrorNum err_no,
365 const char *fmt, va_list args);
366
367 protected:
369 GDALDriver *poDriver = nullptr;
370 GDALAccess eAccess = GA_ReadOnly;
371
372 // Stored raster information.
373 int nRasterXSize = 512;
374 int nRasterYSize = 512;
375 int nBands = 0;
376 GDALRasterBand **papoBands = nullptr;
377
378 static constexpr int OPEN_FLAGS_CLOSED = -1;
379 int nOpenFlags =
380 0; // set to OPEN_FLAGS_CLOSED after Close() has been called
381
382 int nRefCount = 1;
383 bool bForceCachedIO = false;
384 bool bShared = false;
385 bool bIsInternal = true;
386 bool bSuppressOnClose = false;
387
388 mutable std::map<std::string, std::unique_ptr<OGRFieldDomain>>
389 m_oMapFieldDomains{};
390
391 GDALDataset(void);
392 explicit GDALDataset(int bForceCachedIO);
393
394 void RasterInitialize(int, int);
395 void SetBand(int, GDALRasterBand *);
396 void SetBand(int nNewBand, std::unique_ptr<GDALRasterBand> poBand);
397
398 GDALDefaultOverviews oOvManager{};
399
400 virtual CPLErr IBuildOverviews(const char *, int, const int *, int,
401 const int *, GDALProgressFunc, void *,
402 CSLConstList papszOptions);
403
404 virtual CPLErr
405 IRasterIO(GDALRWFlag, int, int, int, int, void *, int, int, GDALDataType,
406 int, int *, GSpacing, GSpacing, GSpacing,
407 GDALRasterIOExtraArg *psExtraArg) CPL_WARN_UNUSED_RESULT;
408
409 CPLErr
410 BlockBasedRasterIO(GDALRWFlag, int, int, int, int, void *, int, int,
411 GDALDataType, int, int *, GSpacing, GSpacing, GSpacing,
412 GDALRasterIOExtraArg *psExtraArg) CPL_WARN_UNUSED_RESULT;
413 CPLErr BlockBasedFlushCache(bool bAtClosing);
414
415 CPLErr
416 BandBasedRasterIO(GDALRWFlag eRWFlag, int nXOff, int nYOff, int nXSize,
417 int nYSize, void *pData, int nBufXSize, int nBufYSize,
418 GDALDataType eBufType, int nBandCount, int *panBandMap,
419 GSpacing nPixelSpace, GSpacing nLineSpace,
420 GSpacing nBandSpace,
421 GDALRasterIOExtraArg *psExtraArg) CPL_WARN_UNUSED_RESULT;
422
423 CPLErr
424 RasterIOResampled(GDALRWFlag eRWFlag, int nXOff, int nYOff, int nXSize,
425 int nYSize, void *pData, int nBufXSize, int nBufYSize,
426 GDALDataType eBufType, int nBandCount, int *panBandMap,
427 GSpacing nPixelSpace, GSpacing nLineSpace,
428 GSpacing nBandSpace,
429 GDALRasterIOExtraArg *psExtraArg) CPL_WARN_UNUSED_RESULT;
430
431 CPLErr ValidateRasterIOOrAdviseReadParameters(
432 const char *pszCallingFunc, int *pbStopProcessingOnCENone, int nXOff,
433 int nYOff, int nXSize, int nYSize, int nBufXSize, int nBufYSize,
434 int nBandCount, int *panBandMap);
435
436 CPLErr TryOverviewRasterIO(GDALRWFlag eRWFlag, int nXOff, int nYOff,
437 int nXSize, int nYSize, void *pData,
438 int nBufXSize, int nBufYSize,
439 GDALDataType eBufType, int nBandCount,
440 int *panBandMap, GSpacing nPixelSpace,
441 GSpacing nLineSpace, GSpacing nBandSpace,
442 GDALRasterIOExtraArg *psExtraArg, int *pbTried);
443
444 void ShareLockWithParentDataset(GDALDataset *poParentDataset);
445
447
448 void CleanupPostFileClosing();
449
450 virtual int CloseDependentDatasets();
452 int ValidateLayerCreationOptions(const char *const *papszLCO);
453
454 char **papszOpenOptions = nullptr;
455
456 friend class GDALRasterBand;
457
458 // The below methods related to read write mutex are fragile logic, and
459 // should not be used by out-of-tree code if possible.
460 int EnterReadWrite(GDALRWFlag eRWFlag);
461 void LeaveReadWrite();
462 void InitRWLock();
463
464 void TemporarilyDropReadWriteLock();
465 void ReacquireReadWriteLock();
466
467 void DisableReadWriteMutex();
468
469 int AcquireMutex();
470 void ReleaseMutex();
471
472 bool IsAllBands(int nBandCount, const int *panBandList) const;
474
475 public:
476 ~GDALDataset() override;
477
478 virtual CPLErr Close();
479
480 int GetRasterXSize();
481 int GetRasterYSize();
482 int GetRasterCount();
483 GDALRasterBand *GetRasterBand(int);
484
491 virtual bool SetQueryLoggerFunc(GDALQueryLoggerFunc pfnQueryLoggerFuncIn,
492 void *poQueryLoggerArgIn);
493
496 class CPL_DLL Bands
497 {
498 private:
499 friend class GDALDataset;
500 GDALDataset *m_poSelf;
501 CPL_INTERNAL explicit Bands(GDALDataset *poSelf) : m_poSelf(poSelf)
502 {
503 }
504
505 class CPL_DLL Iterator
506 {
507 struct Private;
508 std::unique_ptr<Private> m_poPrivate;
509
510 public:
511 Iterator(GDALDataset *poDS, bool bStart);
512 Iterator(const Iterator &oOther); // declared but not defined.
513 // Needed for gcc 5.4 at least
514 Iterator(Iterator &&oOther) noexcept; // declared but not defined.
515 // Needed for gcc 5.4 at least
516 ~Iterator();
517 GDALRasterBand *operator*();
518 Iterator &operator++();
519 bool operator!=(const Iterator &it) const;
520 };
521
522 public:
523 const Iterator begin() const;
524
525 const Iterator end() const;
526
527 size_t size() const;
528
529 GDALRasterBand *operator[](int iBand);
530 GDALRasterBand *operator[](size_t iBand);
531 };
532
533 Bands GetBands();
534
535 virtual CPLErr FlushCache(bool bAtClosing = false);
536
537 virtual GIntBig GetEstimatedRAMUsage();
538
539 virtual const OGRSpatialReference *GetSpatialRef() const;
540 virtual CPLErr SetSpatialRef(const OGRSpatialReference *poSRS);
541
542 // Compatibility layer
543 const char *GetProjectionRef(void) const;
544 CPLErr SetProjection(const char *pszProjection);
545
546 virtual CPLErr GetGeoTransform(double *padfTransform);
547 virtual CPLErr SetGeoTransform(double *padfTransform);
548
549 virtual CPLErr AddBand(GDALDataType eType, char **papszOptions = nullptr);
550
551 virtual void *GetInternalHandle(const char *pszHandleName);
552 virtual GDALDriver *GetDriver(void);
553 virtual char **GetFileList(void);
554
555 virtual const char *GetDriverName();
556
557 virtual const OGRSpatialReference *GetGCPSpatialRef() const;
558 virtual int GetGCPCount();
559 virtual const GDAL_GCP *GetGCPs();
560 virtual CPLErr SetGCPs(int nGCPCount, const GDAL_GCP *pasGCPList,
561 const OGRSpatialReference *poGCP_SRS);
562
563 // Compatibility layer
564 const char *GetGCPProjection();
565 CPLErr SetGCPs(int nGCPCount, const GDAL_GCP *pasGCPList,
566 const char *pszGCPProjection);
567
568 virtual CPLErr AdviseRead(int nXOff, int nYOff, int nXSize, int nYSize,
569 int nBufXSize, int nBufYSize, GDALDataType eDT,
570 int nBandCount, int *panBandList,
571 char **papszOptions);
572
573 virtual CPLErr CreateMaskBand(int nFlagsIn);
574
575 virtual GDALAsyncReader *
576 BeginAsyncReader(int nXOff, int nYOff, int nXSize, int nYSize, void *pBuf,
577 int nBufXSize, int nBufYSize, GDALDataType eBufType,
578 int nBandCount, int *panBandMap, int nPixelSpace,
579 int nLineSpace, int nBandSpace, char **papszOptions);
580 virtual void EndAsyncReader(GDALAsyncReader *);
581
583 struct RawBinaryLayout
584 {
585 enum class Interleaving
586 {
587 UNKNOWN,
588 BIP,
589 BIL,
590 BSQ
591 };
592 std::string osRawFilename{};
593 Interleaving eInterleaving = Interleaving::UNKNOWN;
594 GDALDataType eDataType = GDT_Unknown;
595 bool bLittleEndianOrder = false;
596
597 vsi_l_offset nImageOffset = 0;
598 GIntBig nPixelOffset = 0;
599 GIntBig nLineOffset = 0;
600 GIntBig nBandOffset = 0;
601 };
602
603 virtual bool GetRawBinaryLayout(RawBinaryLayout &);
605
606 CPLErr RasterIO(GDALRWFlag, int, int, int, int, void *, int, int,
607 GDALDataType, int, int *, GSpacing, GSpacing, GSpacing,
608 GDALRasterIOExtraArg *psExtraArg
609 #ifndef DOXYGEN_SKIP
610 OPTIONAL_OUTSIDE_GDAL(nullptr)
611 #endif
612 ) CPL_WARN_UNUSED_RESULT;
613
614 virtual CPLStringList GetCompressionFormats(int nXOff, int nYOff,
615 int nXSize, int nYSize,
616 int nBandCount,
617 const int *panBandList);
618 virtual CPLErr ReadCompressedData(const char *pszFormat, int nXOff,
619 int nYOff, int nXSize, int nYSize,
620 int nBands, const int *panBandList,
621 void **ppBuffer, size_t *pnBufferSize,
622 char **ppszDetailedFormat);
623
624 int Reference();
625 int Dereference();
626 int ReleaseRef();
627
631 GDALAccess GetAccess() const
632 {
633 return eAccess;
634 }
635
636 int GetShared() const;
637 void MarkAsShared();
638
639 void MarkSuppressOnClose();
640
644 char **GetOpenOptions()
645 {
646 return papszOpenOptions;
647 }
648
649 static GDALDataset **GetOpenDatasets(int *pnDatasetCount);
650
651 CPLErr BuildOverviews(const char *, int, const int *, int, const int *,
652 GDALProgressFunc, void *,
653 CSLConstList papszOptions
654 #ifndef DOXYGEN_SKIP
655 OPTIONAL_OUTSIDE_GDAL(nullptr)
656 #endif
657 );
658
659 #ifndef DOXYGEN_XML
660 void ReportError(CPLErr eErrClass, CPLErrorNum err_no, const char *fmt, ...)
661 CPL_PRINT_FUNC_FORMAT(4, 5);
662
663 static void ReportError(const char *pszDSName, CPLErr eErrClass,
664 CPLErrorNum err_no, const char *fmt, ...)
665 CPL_PRINT_FUNC_FORMAT(4, 5);
666 #endif
667
668 char **GetMetadata(const char *pszDomain = "") override;
669
670 // Only defined when Doxygen enabled
671 #ifdef DOXYGEN_SKIP
672 CPLErr SetMetadata(char **papszMetadata, const char *pszDomain) override;
673 CPLErr SetMetadataItem(const char *pszName, const char *pszValue,
674 const char *pszDomain) override;
675 #endif
676
677 char **GetMetadataDomainList() override;
678
679 virtual void ClearStatistics();
680
684 static inline GDALDatasetH ToHandle(GDALDataset *poDS)
685 {
686 return static_cast<GDALDatasetH>(poDS);
687 }
688
692 static inline GDALDataset *FromHandle(GDALDatasetH hDS)
693 {
694 return static_cast<GDALDataset *>(hDS);
695 }
696
700 static GDALDataset *Open(const char *pszFilename,
701 unsigned int nOpenFlags = 0,
702 const char *const *papszAllowedDrivers = nullptr,
703 const char *const *papszOpenOptions = nullptr,
704 const char *const *papszSiblingFiles = nullptr)
705 {
706 return FromHandle(GDALOpenEx(pszFilename, nOpenFlags,
707 papszAllowedDrivers, papszOpenOptions,
708 papszSiblingFiles));
709 }
710
712 struct FeatureLayerPair
713 {
715 OGRFeatureUniquePtr feature{};
716
718 OGRLayer *layer = nullptr;
719 };
720
722 // SetEnableOverviews() only to be used by GDALOverviewDataset
723 void SetEnableOverviews(bool bEnable);
724
725 // Only to be used by driver's GetOverviewCount() method.
726 bool AreOverviewsEnabled() const;
728
729 private:
730 class Private;
731 Private *m_poPrivate;
732
733 CPL_INTERNAL OGRLayer *BuildLayerFromSelectInfo(
734 swq_select *psSelectInfo, OGRGeometry *poSpatialFilter,
735 const char *pszDialect, swq_select_parse_options *poSelectParseOptions);
736 CPLStringList oDerivedMetadataList{};
737
738 public:
739 virtual int GetLayerCount();
740 virtual OGRLayer *GetLayer(int iLayer);
741
742 virtual bool IsLayerPrivate(int iLayer) const;
743
747 class CPL_DLL Layers
748 {
749 private:
750 friend class GDALDataset;
751 GDALDataset *m_poSelf;
752 CPL_INTERNAL explicit Layers(GDALDataset *poSelf) : m_poSelf(poSelf)
753 {
754 }
755
756 public:
760 class CPL_DLL Iterator
761 {
762 struct Private;
763 std::unique_ptr<Private> m_poPrivate;
764
765 public:
766 using value_type = OGRLayer *;
767 using reference = OGRLayer *;
768 using difference_type = void;
769 using pointer = void;
770 using iterator_category =
771 std::input_iterator_tag;
773 Iterator();
774 Iterator(GDALDataset *poDS, bool bStart);
775 Iterator(const Iterator &oOther);
776 Iterator(Iterator &&oOther) noexcept;
777 ~Iterator();
779 Iterator &
780 operator=(const Iterator &oOther);
781 Iterator &operator=(
782 Iterator &&oOther) noexcept;
784 OGRLayer *operator*() const;
785 Iterator &operator++();
786 Iterator operator++(int);
787 bool operator!=(const Iterator &it)
788 const;
789 };
790
791 Iterator begin() const;
792 Iterator end() const;
793
794 size_t size() const;
795
796 OGRLayer *operator[](int iLayer);
797 OGRLayer *operator[](size_t iLayer);
798 OGRLayer *operator[](const char *pszLayername);
799 };
800
801 Layers GetLayers();
802
803 virtual OGRLayer *GetLayerByName(const char *);
804 virtual OGRErr DeleteLayer(int iLayer);
805
806 virtual void ResetReading();
807 virtual OGRFeature *GetNextFeature(OGRLayer **ppoBelongingLayer,
808 double *pdfProgressPct,
809 GDALProgressFunc pfnProgress,
810 void *pProgressData);
811
814 class CPL_DLL Features
815 {
816 private:
817 friend class GDALDataset;
818 GDALDataset *m_poSelf;
819 CPL_INTERNAL explicit Features(GDALDataset *poSelf) : m_poSelf(poSelf)
820 {
821 }
822
823 class CPL_DLL Iterator
824 {
825 struct Private;
826 std::unique_ptr<Private> m_poPrivate;
827
828 public:
829 Iterator(GDALDataset *poDS, bool bStart);
830 Iterator(const Iterator &oOther); // declared but not defined.
831 // Needed for gcc 5.4 at least
832 Iterator(Iterator &&oOther) noexcept; // declared but not defined.
833 // Needed for gcc 5.4 at least
834 ~Iterator();
835 const FeatureLayerPair &operator*() const;
836 Iterator &operator++();
837 bool operator!=(const Iterator &it) const;
838 };
839
840 public:
841 const Iterator begin() const;
842
843 const Iterator end() const;
844 };
845
846 Features GetFeatures();
847
848 virtual int TestCapability(const char *);
849
850 virtual std::vector<std::string>
851 GetFieldDomainNames(CSLConstList papszOptions = nullptr) const;
852
853 virtual const OGRFieldDomain *GetFieldDomain(const std::string &name) const;
854
855 virtual bool AddFieldDomain(std::unique_ptr<OGRFieldDomain> &&domain,
856 std::string &failureReason);
857
858 virtual bool DeleteFieldDomain(const std::string &name,
859 std::string &failureReason);
860
861 virtual bool UpdateFieldDomain(std::unique_ptr<OGRFieldDomain> &&domain,
862 std::string &failureReason);
863
864 virtual std::vector<std::string>
865 GetRelationshipNames(CSLConstList papszOptions = nullptr) const;
866
867 virtual const GDALRelationship *
868 GetRelationship(const std::string &name) const;
869
870 virtual bool
871 AddRelationship(std::unique_ptr<GDALRelationship> &&relationship,
872 std::string &failureReason);
873
874 virtual bool DeleteRelationship(const std::string &name,
875 std::string &failureReason);
876
877 virtual bool
878 UpdateRelationship(std::unique_ptr<GDALRelationship> &&relationship,
879 std::string &failureReason);
880
881 virtual OGRLayer *CreateLayer(const char *pszName,
882 OGRSpatialReference *poSpatialRef = nullptr,
883 OGRwkbGeometryType eGType = wkbUnknown,
884 char **papszOptions = nullptr);
885 virtual OGRLayer *CopyLayer(OGRLayer *poSrcLayer, const char *pszNewName,
886 char **papszOptions = nullptr);
887
888 virtual OGRStyleTable *GetStyleTable();
889 virtual void SetStyleTableDirectly(OGRStyleTable *poStyleTable);
890
891 virtual void SetStyleTable(OGRStyleTable *poStyleTable);
892
893 virtual OGRLayer *ExecuteSQL(const char *pszStatement,
894 OGRGeometry *poSpatialFilter,
895 const char *pszDialect);
896 virtual void ReleaseResultSet(OGRLayer *poResultsSet);
897 virtual OGRErr AbortSQL();
898
899 int GetRefCount() const;
900 int GetSummaryRefCount() const;
901 OGRErr Release();
902
903 virtual OGRErr StartTransaction(int bForce = FALSE);
904 virtual OGRErr CommitTransaction();
905 virtual OGRErr RollbackTransaction();
906
907 virtual std::shared_ptr<GDALGroup> GetRootGroup() const;
908
910 static int IsGenericSQLDialect(const char *pszDialect);
911
912 // Semi-public methods. Only to be used by in-tree drivers.
913 GDALSQLParseInfo *
914 BuildParseInfo(swq_select *psSelectInfo,
915 swq_select_parse_options *poSelectParseOptions);
916 static void DestroyParseInfo(GDALSQLParseInfo *psParseInfo);
917 OGRLayer *ExecuteSQL(const char *pszStatement, OGRGeometry *poSpatialFilter,
918 const char *pszDialect,
919 swq_select_parse_options *poSelectParseOptions);
921
922 protected:
923 virtual OGRLayer *ICreateLayer(const char *pszName,
924 OGRSpatialReference *poSpatialRef = nullptr,
925 OGRwkbGeometryType eGType = wkbUnknown,
926 char **papszOptions = nullptr);
927
929 OGRErr ProcessSQLCreateIndex(const char *);
930 OGRErr ProcessSQLDropIndex(const char *);
931 OGRErr ProcessSQLDropTable(const char *);
932 OGRErr ProcessSQLAlterTableAddColumn(const char *);
933 OGRErr ProcessSQLAlterTableDropColumn(const char *);
934 OGRErr ProcessSQLAlterTableAlterColumn(const char *);
935 OGRErr ProcessSQLAlterTableRenameColumn(const char *);
936
937 OGRStyleTable *m_poStyleTable = nullptr;
938
939 friend class GDALProxyPoolDataset;
941
942 private:
943 CPL_DISALLOW_COPY_ASSIGN(GDALDataset)
944 };
945
947 struct CPL_DLL GDALDatasetUniquePtrDeleter
948 {
949 void operator()(GDALDataset *poDataset) const
950 {
951 GDALClose(poDataset);
952 }
953 };
955
961 using GDALDatasetUniquePtr =
962 std::unique_ptr<GDALDataset, GDALDatasetUniquePtrDeleter>;
963
964 /* ******************************************************************** */
965 /* GDALRasterBlock */
966 /* ******************************************************************** */
967
972 class CPL_DLL GDALRasterBlock
973 {
974 friend class GDALAbstractBandBlockCache;
975
976 GDALDataType eType;
977
978 bool bDirty;
979 volatile int nLockCount;
980
981 int nXOff;
982 int nYOff;
983
984 int nXSize;
985 int nYSize;
986
987 void *pData;
988
989 GDALRasterBand *poBand;
990
991 GDALRasterBlock *poNext;
992 GDALRasterBlock *poPrevious;
993
994 bool bMustDetach;
995
996 CPL_INTERNAL void Detach_unlocked(void);
997 CPL_INTERNAL void Touch_unlocked(void);
998
999 CPL_INTERNAL void RecycleFor(int nXOffIn, int nYOffIn);
1000
1001 public:
1002 GDALRasterBlock(GDALRasterBand *, int, int);
1003 GDALRasterBlock(int nXOffIn, int nYOffIn); /* only for lookup purpose */
1004 virtual ~GDALRasterBlock();
1005
1006 CPLErr Internalize(void);
1007 void Touch(void);
1008 void MarkDirty(void);
1009 void MarkClean(void);
1011 int AddLock(void)
1012 {
1013 return CPLAtomicInc(&nLockCount);
1014 }
1016 int DropLock(void)
1017 {
1018 return CPLAtomicDec(&nLockCount);
1019 }
1020 void Detach();
1021
1022 CPLErr Write();
1023
1027 GDALDataType GetDataType() const
1028 {
1029 return eType;
1030 }
1034 int GetXOff() const
1035 {
1036 return nXOff;
1037 }
1041 int GetYOff() const
1042 {
1043 return nYOff;
1044 }
1048 int GetXSize() const
1049 {
1050 return nXSize;
1051 }
1055 int GetYSize() const
1056 {
1057 return nYSize;
1058 }
1062 int GetDirty() const
1063 {
1064 return bDirty;
1065 }
1069 void *GetDataRef(void)
1070 {
1071 return pData;
1072 }
1076 GPtrDiff_t GetBlockSize() const
1077 {
1078 return static_cast<GPtrDiff_t>(nXSize) * nYSize *
1079 GDALGetDataTypeSizeBytes(eType);
1080 }
1081
1082 int TakeLock();
1083 int DropLockForRemovalFromStorage();
1084
1087 GDALRasterBand *GetBand()
1088 {
1089 return poBand;
1090 }
1091
1092 static void FlushDirtyBlocks();
1093 static int FlushCacheBlock(int bDirtyBlocksOnly = FALSE);
1094 static void Verify();
1095
1096 static void EnterDisableDirtyBlockFlush();
1097 static void LeaveDisableDirtyBlockFlush();
1098
1099 #ifdef notdef
1100 static void CheckNonOrphanedBlocks(GDALRasterBand *poBand);
1101 void DumpBlock();
1102 static void DumpAll();
1103 #endif
1104
1105 /* Should only be called by GDALDestroyDriverManager() */
1107 CPL_INTERNAL static void DestroyRBMutex();
1109
1110 private:
1111 CPL_DISALLOW_COPY_ASSIGN(GDALRasterBlock)
1112 };
1113
1114 /* ******************************************************************** */
1115 /* GDALColorTable */
1116 /* ******************************************************************** */
1117
1120 class CPL_DLL GDALColorTable
1121 {
1122 GDALPaletteInterp eInterp;
1123
1124 std::vector<GDALColorEntry> aoEntries{};
1125
1126 public:
1127 explicit GDALColorTable(GDALPaletteInterp = GPI_RGB);
1128 ~GDALColorTable();
1129
1130 GDALColorTable *Clone() const;
1131 int IsSame(const GDALColorTable *poOtherCT) const;
1132
1133 GDALPaletteInterp GetPaletteInterpretation() const;
1134
1135 int GetColorEntryCount() const;
1136 const GDALColorEntry *GetColorEntry(int) const;
1137 int GetColorEntryAsRGB(int, GDALColorEntry *) const;
1138 void SetColorEntry(int, const GDALColorEntry *);
1139 int CreateColorRamp(int, const GDALColorEntry *, int,
1140 const GDALColorEntry *);
1141 bool IsIdentity() const;
1142
1146 static inline GDALColorTableH ToHandle(GDALColorTable *poCT)
1147 {
1148 return static_cast<GDALColorTableH>(poCT);
1149 }
1150
1154 static inline GDALColorTable *FromHandle(GDALColorTableH hCT)
1155 {
1156 return static_cast<GDALColorTable *>(hCT);
1157 }
1158 };
1159
1160 /* ******************************************************************** */
1161 /* GDALAbstractBandBlockCache */
1162 /* ******************************************************************** */
1163
1165
1167 // only used by GDALRasterBand implementation.
1168
1169 class GDALAbstractBandBlockCache
1170 {
1171 // List of blocks that can be freed or recycled, and its lock
1172 CPLLock *hSpinLock = nullptr;
1173 GDALRasterBlock *psListBlocksToFree = nullptr;
1174
1175 // Band keep alive counter, and its lock & condition
1176 CPLCond *hCond = nullptr;
1177 CPLMutex *hCondMutex = nullptr;
1178 volatile int nKeepAliveCounter = 0;
1179
1180 volatile int m_nDirtyBlocks = 0;
1181
1182 CPL_DISALLOW_COPY_ASSIGN(GDALAbstractBandBlockCache)
1183
1184 protected:
1185 GDALRasterBand *poBand;
1186
1187 int m_nInitialDirtyBlocksInFlushCache = 0;
1188 int m_nLastTick = -1;
1189 bool m_bWriteDirtyBlocks = true;
1190
1191 void FreeDanglingBlocks();
1192 void UnreferenceBlockBase();
1193
1194 void StartDirtyBlockFlushingLog();
1195 void UpdateDirtyBlockFlushingLog();
1196 void EndDirtyBlockFlushingLog();
1197
1198 public:
1199 explicit GDALAbstractBandBlockCache(GDALRasterBand *poBand);
1200 virtual ~GDALAbstractBandBlockCache();
1201
1202 GDALRasterBlock *CreateBlock(int nXBlockOff, int nYBlockOff);
1203 void AddBlockToFreeList(GDALRasterBlock *);
1204 void IncDirtyBlocks(int nInc);
1205 void WaitCompletionPendingTasks();
1206 void DisableDirtyBlockWriting()
1207 {
1208 m_bWriteDirtyBlocks = false;
1209 }
1210 bool HasDirtyBlocks() const
1211 {
1212 return m_nDirtyBlocks > 0;
1213 }
1214
1215 virtual bool Init() = 0;
1216 virtual bool IsInitOK() = 0;
1217 virtual CPLErr FlushCache() = 0;
1218 virtual CPLErr AdoptBlock(GDALRasterBlock *poBlock) = 0;
1219 virtual GDALRasterBlock *TryGetLockedBlockRef(int nXBlockOff,
1220 int nYBlockYOff) = 0;
1221 virtual CPLErr UnreferenceBlock(GDALRasterBlock *poBlock) = 0;
1222 virtual CPLErr FlushBlock(int nXBlockOff, int nYBlockOff,
1223 int bWriteDirtyBlock) = 0;
1224 };
1225
1226 GDALAbstractBandBlockCache *
1227 GDALArrayBandBlockCacheCreate(GDALRasterBand *poBand);
1228 GDALAbstractBandBlockCache *
1229 GDALHashSetBandBlockCacheCreate(GDALRasterBand *poBand);
1230
1232
1233 /* ******************************************************************** */
1234 /* GDALRasterBand */
1235 /* ******************************************************************** */
1236
1237 class GDALMDArray;
1238
1240 typedef enum
1241 {
1242 GMVR_UNKNOWN,
1244 GMVR_0_AND_1_ONLY,
1245 GMVR_0_AND_255_ONLY,
1246 } GDALMaskValueRange;
1247
1249 typedef int GDALSuggestedBlockAccessPattern;
1250
1252 constexpr GDALSuggestedBlockAccessPattern GSBAP_UNKNOWN = 0;
1253
1255 constexpr GDALSuggestedBlockAccessPattern GSBAP_RANDOM = 1;
1256
1258 constexpr GDALSuggestedBlockAccessPattern GSBAP_TOP_TO_BOTTOM = 2;
1259
1261 constexpr GDALSuggestedBlockAccessPattern GSBAP_BOTTOM_TO_TOP = 3;
1262
1265 constexpr GDALSuggestedBlockAccessPattern GSBAP_LARGEST_CHUNK_POSSIBLE = 0x100;
1266
1269 class CPL_DLL GDALRasterBand : public GDALMajorObject
1270 {
1271 private:
1272 friend class GDALArrayBandBlockCache;
1273 friend class GDALHashSetBandBlockCache;
1274 friend class GDALRasterBlock;
1275 friend class GDALDataset;
1276
1277 CPLErr eFlushBlockErr = CE_None;
1278 GDALAbstractBandBlockCache *poBandBlockCache = nullptr;
1279
1280 CPL_INTERNAL void SetFlushBlockErr(CPLErr eErr);
1281 CPL_INTERNAL CPLErr UnreferenceBlock(GDALRasterBlock *poBlock);
1282 CPL_INTERNAL void IncDirtyBlocks(int nInc);
1283
1284 protected:
1286 GDALDataset *poDS = nullptr;
1287 int nBand = 0; /* 1 based */
1288
1289 int nRasterXSize = 0;
1290 int nRasterYSize = 0;
1291
1292 GDALDataType eDataType = GDT_Byte;
1293 GDALAccess eAccess = GA_ReadOnly;
1294
1295 /* stuff related to blocking, and raster cache */
1296 int nBlockXSize = -1;
1297 int nBlockYSize = -1;
1298 int nBlocksPerRow = 0;
1299 int nBlocksPerColumn = 0;
1300
1301 int nBlockReads = 0;
1302 int bForceCachedIO = 0;
1303
1304 GDALRasterBand *poMask = nullptr;
1305 bool bOwnMask = false;
1306 bool m_bEnablePixelTypeSignedByteWarning =
1307 true; // Remove me in GDAL 4.0. See GetMetadataItem() implementation
1308 int nMaskFlags = 0;
1309
1310 void InvalidateMaskBand();
1311
1312 friend class GDALProxyRasterBand;
1313 friend class GDALDefaultOverviews;
1314
1315 CPLErr
1316 RasterIOResampled(GDALRWFlag, int, int, int, int, void *, int, int,
1317 GDALDataType, GSpacing, GSpacing,
1318 GDALRasterIOExtraArg *psExtraArg) CPL_WARN_UNUSED_RESULT;
1319
1320 int EnterReadWrite(GDALRWFlag eRWFlag);
1321 void LeaveReadWrite();
1322 void InitRWLock();
1323 void SetValidPercent(GUIntBig nSampleCount, GUIntBig nValidCount);
1324
1326
1327 protected:
1328 virtual CPLErr IReadBlock(int nBlockXOff, int nBlockYOff, void *pData) = 0;
1329 virtual CPLErr IWriteBlock(int nBlockXOff, int nBlockYOff, void *pData);
1330
1331 virtual CPLErr
1332 IRasterIO(GDALRWFlag, int, int, int, int, void *, int, int, GDALDataType,
1333 GSpacing, GSpacing,
1334 GDALRasterIOExtraArg *psExtraArg) CPL_WARN_UNUSED_RESULT;
1335
1336 virtual int IGetDataCoverageStatus(int nXOff, int nYOff, int nXSize,
1337 int nYSize, int nMaskFlagStop,
1338 double *pdfDataPct);
1340 CPLErr
1341 OverviewRasterIO(GDALRWFlag, int, int, int, int, void *, int, int,
1342 GDALDataType, GSpacing, GSpacing,
1343 GDALRasterIOExtraArg *psExtraArg) CPL_WARN_UNUSED_RESULT;
1344
1345 CPLErr TryOverviewRasterIO(GDALRWFlag eRWFlag, int nXOff, int nYOff,
1346 int nXSize, int nYSize, void *pData,
1347 int nBufXSize, int nBufYSize,
1348 GDALDataType eBufType, GSpacing nPixelSpace,
1349 GSpacing nLineSpace,
1350 GDALRasterIOExtraArg *psExtraArg, int *pbTried);
1351
1352 int InitBlockInfo();
1353
1354 void AddBlockToFreeList(GDALRasterBlock *);
1355
1356 bool HasDirtyBlocks() const
1357 {
1358 return poBandBlockCache && poBandBlockCache->HasDirtyBlocks();
1359 }
1361
1362 public:
1363 GDALRasterBand();
1364 explicit GDALRasterBand(int bForceCachedIO);
1365
1366 ~GDALRasterBand() override;
1367
1368 int GetXSize();
1369 int GetYSize();
1370 int GetBand();
1371 GDALDataset *GetDataset();
1372
1373 GDALDataType GetRasterDataType(void);
1374 void GetBlockSize(int *, int *);
1375 CPLErr GetActualBlockSize(int, int, int *, int *);
1376
1377 virtual GDALSuggestedBlockAccessPattern
1378 GetSuggestedBlockAccessPattern() const;
1379
1380 GDALAccess GetAccess();
1381
1382 CPLErr RasterIO(GDALRWFlag, int, int, int, int, void *, int, int,
1383 GDALDataType, GSpacing, GSpacing,
1384 GDALRasterIOExtraArg *psExtraArg
1385 #ifndef DOXYGEN_SKIP
1386 OPTIONAL_OUTSIDE_GDAL(nullptr)
1387 #endif
1388 ) CPL_WARN_UNUSED_RESULT;
1389 CPLErr ReadBlock(int, int, void *) CPL_WARN_UNUSED_RESULT;
1390
1391 CPLErr WriteBlock(int, int, void *) CPL_WARN_UNUSED_RESULT;
1392
1393 GDALRasterBlock *
1394 GetLockedBlockRef(int nXBlockOff, int nYBlockOff,
1395 int bJustInitialize = FALSE) CPL_WARN_UNUSED_RESULT;
1396 GDALRasterBlock *TryGetLockedBlockRef(int nXBlockOff, int nYBlockYOff)
1397 CPL_WARN_UNUSED_RESULT;
1398 CPLErr FlushBlock(int, int, int bWriteDirtyBlock = TRUE);
1399
1400 unsigned char *
1401 GetIndexColorTranslationTo(/* const */ GDALRasterBand *poReferenceBand,
1402 unsigned char *pTranslationTable = nullptr,
1403 int *pApproximateMatching = nullptr);
1404
1405 // New OpengIS CV_SampleDimension stuff.
1406
1407 virtual CPLErr FlushCache(bool bAtClosing = false);
1408 virtual char **GetCategoryNames();
1409 virtual double GetNoDataValue(int *pbSuccess = nullptr);
1410 virtual int64_t GetNoDataValueAsInt64(int *pbSuccess = nullptr);
1411 virtual uint64_t GetNoDataValueAsUInt64(int *pbSuccess = nullptr);
1412 virtual double GetMinimum(int *pbSuccess = nullptr);
1413 virtual double GetMaximum(int *pbSuccess = nullptr);
1414 virtual double GetOffset(int *pbSuccess = nullptr);
1415 virtual double GetScale(int *pbSuccess = nullptr);
1416 virtual const char *GetUnitType();
1417 virtual GDALColorInterp GetColorInterpretation();
1418 virtual GDALColorTable *GetColorTable();
1419 virtual CPLErr Fill(double dfRealValue, double dfImaginaryValue = 0);
1420
1421 virtual CPLErr SetCategoryNames(char **papszNames);
1422 virtual CPLErr SetNoDataValue(double dfNoData);
1423 virtual CPLErr SetNoDataValueAsInt64(int64_t nNoData);
1424 virtual CPLErr SetNoDataValueAsUInt64(uint64_t nNoData);
1425 virtual CPLErr DeleteNoDataValue();
1426 virtual CPLErr SetColorTable(GDALColorTable *poCT);
1427 virtual CPLErr SetColorInterpretation(GDALColorInterp eColorInterp);
1428 virtual CPLErr SetOffset(double dfNewOffset);
1429 virtual CPLErr SetScale(double dfNewScale);
1430 virtual CPLErr SetUnitType(const char *pszNewValue);
1431
1432 virtual CPLErr GetStatistics(int bApproxOK, int bForce, double *pdfMin,
1433 double *pdfMax, double *pdfMean,
1434 double *padfStdDev);
1435 virtual CPLErr ComputeStatistics(int bApproxOK, double *pdfMin,
1436 double *pdfMax, double *pdfMean,
1437 double *pdfStdDev, GDALProgressFunc,
1438 void *pProgressData);
1439 virtual CPLErr SetStatistics(double dfMin, double dfMax, double dfMean,
1440 double dfStdDev);
1441 virtual CPLErr ComputeRasterMinMax(int, double *);
1442
1443 // Only defined when Doxygen enabled
1444 #ifdef DOXYGEN_SKIP
1445 CPLErr SetMetadata(char **papszMetadata, const char *pszDomain) override;
1446 CPLErr SetMetadataItem(const char *pszName, const char *pszValue,
1447 const char *pszDomain) override;
1448 #endif
1449 virtual const char *GetMetadataItem(const char *pszName,
1450 const char *pszDomain = "") override;
1451
1452 virtual int HasArbitraryOverviews();
1453 virtual int GetOverviewCount();
1454 virtual GDALRasterBand *GetOverview(int);
1455 virtual GDALRasterBand *GetRasterSampleOverview(GUIntBig);
1456 virtual CPLErr BuildOverviews(const char *pszResampling, int nOverviews,
1457 const int *panOverviewList,
1458 GDALProgressFunc pfnProgress,
1459 void *pProgressData,
1460 CSLConstList papszOptions);
1461
1462 virtual CPLErr AdviseRead(int nXOff, int nYOff, int nXSize, int nYSize,
1463 int nBufXSize, int nBufYSize,
1464 GDALDataType eBufType, char **papszOptions);
1465
1466 virtual CPLErr GetHistogram(double dfMin, double dfMax, int nBuckets,
1467 GUIntBig *panHistogram, int bIncludeOutOfRange,
1468 int bApproxOK, GDALProgressFunc,
1469 void *pProgressData);
1470
1471 virtual CPLErr GetDefaultHistogram(double *pdfMin, double *pdfMax,
1472 int *pnBuckets, GUIntBig **ppanHistogram,
1473 int bForce, GDALProgressFunc,
1474 void *pProgressData);
1475 virtual CPLErr SetDefaultHistogram(double dfMin, double dfMax, int nBuckets,
1476 GUIntBig *panHistogram);
1477
1478 virtual GDALRasterAttributeTable *GetDefaultRAT();
1479 virtual CPLErr SetDefaultRAT(const GDALRasterAttributeTable *poRAT);
1480
1481 virtual GDALRasterBand *GetMaskBand();
1482 virtual int GetMaskFlags();
1483 virtual CPLErr CreateMaskBand(int nFlagsIn);
1484 virtual bool IsMaskBand() const;
1485 virtual GDALMaskValueRange GetMaskValueRange() const;
1486
1487 virtual CPLVirtualMem *
1488 GetVirtualMemAuto(GDALRWFlag eRWFlag, int *pnPixelSpace,
1489 GIntBig *pnLineSpace,
1490 char **papszOptions) CPL_WARN_UNUSED_RESULT;
1491
1492 int GetDataCoverageStatus(int nXOff, int nYOff, int nXSize, int nYSize,
1493 int nMaskFlagStop = 0,
1494 double *pdfDataPct = nullptr);
1495
1496 std::shared_ptr<GDALMDArray> AsMDArray() const;
1497
1498 #ifndef DOXYGEN_XML
1499 void ReportError(CPLErr eErrClass, CPLErrorNum err_no, const char *fmt, ...)
1500 CPL_PRINT_FUNC_FORMAT(4, 5);
1501 #endif
1502
1506 static inline GDALRasterBandH ToHandle(GDALRasterBand *poBand)
1507 {
1508 return static_cast<GDALRasterBandH>(poBand);
1509 }
1510
1514 static inline GDALRasterBand *FromHandle(GDALRasterBandH hBand)
1515 {
1516 return static_cast<GDALRasterBand *>(hBand);
1517 }
1518
1520 // Remove me in GDAL 4.0. See GetMetadataItem() implementation
1521 // Internal use in GDAL only !
1522 void EnablePixelTypeSignedByteWarning(bool b)
1523 #ifndef GDAL_COMPILATION
1524 CPL_WARN_DEPRECATED("Do not use that method outside of GDAL!")
1525 #endif
1526 ;
1527
1529
1530 private:
1531 CPL_DISALLOW_COPY_ASSIGN(GDALRasterBand)
1532 };
1533
1535 /* ******************************************************************** */
1536 /* GDALAllValidMaskBand */
1537 /* ******************************************************************** */
1538
1539 class CPL_DLL GDALAllValidMaskBand : public GDALRasterBand
1540 {
1541 protected:
1542 CPLErr IReadBlock(int, int, void *) override;
1543
1544 CPL_DISALLOW_COPY_ASSIGN(GDALAllValidMaskBand)
1545
1546 public:
1547 explicit GDALAllValidMaskBand(GDALRasterBand *);
1548 ~GDALAllValidMaskBand() override;
1549
1550 GDALRasterBand *GetMaskBand() override;
1551 int GetMaskFlags() override;
1552
1553 bool IsMaskBand() const override
1554 {
1555 return true;
1556 }
1557 GDALMaskValueRange GetMaskValueRange() const override
1558 {
1559 return GMVR_0_AND_255_ONLY;
1560 }
1561
1562 CPLErr ComputeStatistics(int bApproxOK, double *pdfMin, double *pdfMax,
1563 double *pdfMean, double *pdfStdDev,
1564 GDALProgressFunc, void *pProgressData) override;
1565 };
1566
1567 /* ******************************************************************** */
1568 /* GDALNoDataMaskBand */
1569 /* ******************************************************************** */
1570
1571 class CPL_DLL GDALNoDataMaskBand : public GDALRasterBand
1572 {
1573 friend class GDALRasterBand;
1574 double dfNoDataValue = 0;
1575 int64_t nNoDataValueInt64 = 0;
1576 uint64_t nNoDataValueUInt64 = 0;
1577 GDALRasterBand *poParent;
1578
1579 CPL_DISALLOW_COPY_ASSIGN(GDALNoDataMaskBand)
1580
1581 protected:
1582 CPLErr IReadBlock(int, int, void *) override;
1583 CPLErr IRasterIO(GDALRWFlag, int, int, int, int, void *, int, int,
1584 GDALDataType, GSpacing, GSpacing,
1585 GDALRasterIOExtraArg *psExtraArg) override;
1586
1587 public:
1588 explicit GDALNoDataMaskBand(GDALRasterBand *);
1589 ~GDALNoDataMaskBand() override;
1590
1591 bool IsMaskBand() const override
1592 {
1593 return true;
1594 }
1595 GDALMaskValueRange GetMaskValueRange() const override
1596 {
1597 return GMVR_0_AND_255_ONLY;
1598 }
1599
1600 static bool IsNoDataInRange(double dfNoDataValue, GDALDataType eDataType);
1601 };
1602
1603 /* ******************************************************************** */
1604 /* GDALNoDataValuesMaskBand */
1605 /* ******************************************************************** */
1606
1607 class CPL_DLL GDALNoDataValuesMaskBand : public GDALRasterBand
1608 {
1609 double *padfNodataValues;
1610
1611 CPL_DISALLOW_COPY_ASSIGN(GDALNoDataValuesMaskBand)
1612
1613 protected:
1614 CPLErr IReadBlock(int, int, void *) override;
1615
1616 public:
1617 explicit GDALNoDataValuesMaskBand(GDALDataset *);
1618 ~GDALNoDataValuesMaskBand() override;
1619
1620 bool IsMaskBand() const override
1621 {
1622 return true;
1623 }
1624 GDALMaskValueRange GetMaskValueRange() const override
1625 {
1626 return GMVR_0_AND_255_ONLY;
1627 }
1628 };
1629
1630 /* ******************************************************************** */
1631 /* GDALRescaledAlphaBand */
1632 /* ******************************************************************** */
1633
1634 class GDALRescaledAlphaBand : public GDALRasterBand
1635 {
1636 GDALRasterBand *poParent;
1637 void *pTemp;
1638
1639 CPL_DISALLOW_COPY_ASSIGN(GDALRescaledAlphaBand)
1640
1641 protected:
1642 CPLErr IReadBlock(int, int, void *) override;
1643 CPLErr IRasterIO(GDALRWFlag, int, int, int, int, void *, int, int,
1644 GDALDataType, GSpacing, GSpacing,
1645 GDALRasterIOExtraArg *psExtraArg) override;
1646
1647 public:
1648 explicit GDALRescaledAlphaBand(GDALRasterBand *);
1649 ~GDALRescaledAlphaBand() override;
1650
1651 bool IsMaskBand() const override
1652 {
1653 return true;
1654 }
1655 };
1657
1658 /* ******************************************************************** */
1659 /* GDALIdentifyEnum */
1660 /* ******************************************************************** */
1661
1667 typedef enum
1668 {
1671 GDAL_IDENTIFY_UNKNOWN = -1,
1673 GDAL_IDENTIFY_FALSE = 0,
1675 GDAL_IDENTIFY_TRUE = 1
1676 } GDALIdentifyEnum;
1677
1678 /* ******************************************************************** */
1679 /* GDALDriver */
1680 /* ******************************************************************** */
1681
1693 class CPL_DLL GDALDriver : public GDALMajorObject
1694 {
1695 public:
1696 GDALDriver();
1697 ~GDALDriver() override;
1698
1699 CPLErr SetMetadataItem(const char *pszName, const char *pszValue,
1700 const char *pszDomain = "") override;
1701
1702 /* -------------------------------------------------------------------- */
1703 /* Public C++ methods. */
1704 /* -------------------------------------------------------------------- */
1705 GDALDataset *Create(const char *pszName, int nXSize, int nYSize, int nBands,
1706 GDALDataType eType,
1707 CSLConstList papszOptions) CPL_WARN_UNUSED_RESULT;
1708
1709 GDALDataset *
1710 CreateMultiDimensional(const char *pszName,
1711 CSLConstList papszRootGroupOptions,
1712 CSLConstList papszOptions) CPL_WARN_UNUSED_RESULT;
1713
1714 CPLErr Delete(const char *pszName);
1715 CPLErr Rename(const char *pszNewName, const char *pszOldName);
1716 CPLErr CopyFiles(const char *pszNewName, const char *pszOldName);
1717
1718 GDALDataset *CreateCopy(const char *, GDALDataset *, int,
1719 CSLConstList papszOptions,
1720 GDALProgressFunc pfnProgress,
1721 void *pProgressData) CPL_WARN_UNUSED_RESULT;
1722
1723 /* -------------------------------------------------------------------- */
1724 /* The following are semiprivate, not intended to be accessed */
1725 /* by anyone but the formats instantiating and populating the */
1726 /* drivers. */
1727 /* -------------------------------------------------------------------- */
1729 GDALDataset *(*pfnOpen)(GDALOpenInfo *);
1730
1731 GDALDataset *(*pfnCreate)(const char *pszName, int nXSize, int nYSize,
1732 int nBands, GDALDataType eType,
1733 char **papszOptions);
1734
1735 GDALDataset *(*pfnCreateEx)(GDALDriver *, const char *pszName, int nXSize,
1736 int nYSize, int nBands, GDALDataType eType,
1737 char **papszOptions);
1738
1739 GDALDataset *(*pfnCreateMultiDimensional)(
1740 const char *pszName, CSLConstList papszRootGroupOptions,
1741 CSLConstList papszOptions);
1742
1743 CPLErr (*pfnDelete)(const char *pszName);
1744
1745 GDALDataset *(*pfnCreateCopy)(const char *, GDALDataset *, int, char **,
1746 GDALProgressFunc pfnProgress,
1747 void *pProgressData);
1748
1749 void *pDriverData;
1750
1751 void (*pfnUnloadDriver)(GDALDriver *);
1752
1761 int (*pfnIdentify)(GDALOpenInfo *);
1762 int (*pfnIdentifyEx)(GDALDriver *, GDALOpenInfo *);
1763
1764 CPLErr (*pfnRename)(const char *pszNewName, const char *pszOldName);
1765 CPLErr (*pfnCopyFiles)(const char *pszNewName, const char *pszOldName);
1766
1767 // Used for legacy OGR drivers, and Python drivers
1768 GDALDataset *(*pfnOpenWithDriverArg)(GDALDriver *, GDALOpenInfo *);
1769
1770 /* For legacy OGR drivers */
1771 GDALDataset *(*pfnCreateVectorOnly)(GDALDriver *, const char *pszName,
1772 char **papszOptions);
1773 CPLErr (*pfnDeleteDataSource)(GDALDriver *, const char *pszName);
1775
1776 /* -------------------------------------------------------------------- */
1777 /* Helper methods. */
1778 /* -------------------------------------------------------------------- */
1780 GDALDataset *DefaultCreateCopy(const char *, GDALDataset *, int,
1781 CSLConstList papszOptions,
1782 GDALProgressFunc pfnProgress,
1783 void *pProgressData) CPL_WARN_UNUSED_RESULT;
1784
1785 static CPLErr DefaultCreateCopyMultiDimensional(
1786 GDALDataset *poSrcDS, GDALDataset *poDstDS, bool bStrict,
1787 CSLConstList /*papszOptions*/, GDALProgressFunc pfnProgress,
1788 void *pProgressData);
1789
1790 static CPLErr DefaultCopyMasks(GDALDataset *poSrcDS, GDALDataset *poDstDS,
1791 int bStrict);
1792 static CPLErr DefaultCopyMasks(GDALDataset *poSrcDS, GDALDataset *poDstDS,
1793 int bStrict, CSLConstList papszOptions,
1794 GDALProgressFunc pfnProgress,
1795 void *pProgressData);
1797 static CPLErr QuietDelete(const char *pszName,
1798 CSLConstList papszAllowedDrivers = nullptr);
1799
1801 static CPLErr DefaultRename(const char *pszNewName, const char *pszOldName);
1802 static CPLErr DefaultCopyFiles(const char *pszNewName,
1803 const char *pszOldName);
1805
1809 static inline GDALDriverH ToHandle(GDALDriver *poDriver)
1810 {
1811 return static_cast<GDALDriverH>(poDriver);
1812 }
1813
1817 static inline GDALDriver *FromHandle(GDALDriverH hDriver)
1818 {
1819 return static_cast<GDALDriver *>(hDriver);
1820 }
1821
1822 private:
1823 CPL_DISALLOW_COPY_ASSIGN(GDALDriver)
1824 };
1825
1826 /* ******************************************************************** */
1827 /* GDALDriverManager */
1828 /* ******************************************************************** */
1829
1837 class CPL_DLL GDALDriverManager : public GDALMajorObject
1838 {
1839 int nDrivers = 0;
1840 GDALDriver **papoDrivers = nullptr;
1841 std::map<CPLString, GDALDriver *> oMapNameToDrivers{};
1842 std::string m_osDriversIniPath{};
1843
1844 GDALDriver *GetDriver_unlocked(int iDriver)
1845 {
1846 return (iDriver >= 0 && iDriver < nDrivers) ? papoDrivers[iDriver]
1847 : nullptr;
1848 }
1849
1850 GDALDriver *GetDriverByName_unlocked(const char *pszName) const
1851 {
1852 auto oIter = oMapNameToDrivers.find(CPLString(pszName).toupper());
1853 return oIter == oMapNameToDrivers.end() ? nullptr : oIter->second;
1854 }
1855
1856 static char **GetSearchPaths(const char *pszGDAL_DRIVER_PATH);
1857
1858 static void CleanupPythonDrivers();
1859
1860 CPL_DISALLOW_COPY_ASSIGN(GDALDriverManager)
1861
1862 public:
1863 GDALDriverManager();
1864 ~GDALDriverManager();
1865
1866 int GetDriverCount(void) const;
1867 GDALDriver *GetDriver(int);
1868 GDALDriver *GetDriverByName(const char *);
1869
1870 int RegisterDriver(GDALDriver *);
1871 void DeregisterDriver(GDALDriver *);
1872
1873 // AutoLoadDrivers is a no-op if compiled with GDAL_NO_AUTOLOAD defined.
1874 void AutoLoadDrivers();
1875 void AutoSkipDrivers();
1876 void ReorderDrivers();
1877
1878 static void AutoLoadPythonDrivers();
1879 };
1880
1881 CPL_C_START
1882 GDALDriverManager CPL_DLL *GetGDALDriverManager(void);
1883 CPL_C_END
1884
1885 /* ******************************************************************** */
1886 /* GDALAsyncReader */
1887 /* ******************************************************************** */
1888
1894 class CPL_DLL GDALAsyncReader
1895 {
1896
1897 CPL_DISALLOW_COPY_ASSIGN(GDALAsyncReader)
1898
1899 protected:
1901 GDALDataset *poDS;
1902 int nXOff;
1903 int nYOff;
1904 int nXSize;
1905 int nYSize;
1906 void *pBuf;
1907 int nBufXSize;
1908 int nBufYSize;
1909 GDALDataType eBufType;
1910 int nBandCount;
1911 int *panBandMap;
1912 int nPixelSpace;
1913 int nLineSpace;
1914 int nBandSpace;
1916
1917 public:
1918 GDALAsyncReader();
1919 virtual ~GDALAsyncReader();
1920
1924 GDALDataset *GetGDALDataset()
1925 {
1926 return poDS;
1927 }
1931 int GetXOffset() const
1932 {
1933 return nXOff;
1934 }
1938 int GetYOffset() const
1939 {
1940 return nYOff;
1941 }
1945 int GetXSize() const
1946 {
1947 return nXSize;
1948 }
1952 int GetYSize() const
1953 {
1954 return nYSize;
1955 }
1959 void *GetBuffer()
1960 {
1961 return pBuf;
1962 }
1966 int GetBufferXSize() const
1967 {
1968 return nBufXSize;
1969 }
1973 int GetBufferYSize() const
1974 {
1975 return nBufYSize;
1976 }
1980 GDALDataType GetBufferType() const
1981 {
1982 return eBufType;
1983 }
1987 int GetBandCount() const
1988 {
1989 return nBandCount;
1990 }
1994 int *GetBandMap()
1995 {
1996 return panBandMap;
1997 }
2001 int GetPixelSpace() const
2002 {
2003 return nPixelSpace;
2004 }
2008 int GetLineSpace() const
2009 {
2010 return nLineSpace;
2011 }
2015 int GetBandSpace() const
2016 {
2017 return nBandSpace;
2018 }
2019
2020 virtual GDALAsyncStatusType
2021 GetNextUpdatedRegion(double dfTimeout, int *pnBufXOff, int *pnBufYOff,
2022 int *pnBufXSize, int *pnBufYSize) = 0;
2023 virtual int LockBuffer(double dfTimeout = -1.0);
2024 virtual void UnlockBuffer();
2025 };
2026
2027 /* ******************************************************************** */
2028 /* Multidimensional array API */
2029 /* ******************************************************************** */
2030
2031 class GDALMDArray;
2032 class GDALAttribute;
2033 class GDALDimension;
2034 class GDALEDTComponent;
2035
2036 /* ******************************************************************** */
2037 /* GDALExtendedDataType */
2038 /* ******************************************************************** */
2039
2047 class CPL_DLL GDALExtendedDataType
2048 {
2049 public:
2050 ~GDALExtendedDataType();
2051
2052 GDALExtendedDataType(const GDALExtendedDataType &);
2053
2054 GDALExtendedDataType &operator=(GDALExtendedDataType &&);
2055
2056 static GDALExtendedDataType Create(GDALDataType eType);
2057 static GDALExtendedDataType
2058 Create(const std::string &osName, size_t nTotalSize,
2059 std::vector<std::unique_ptr<GDALEDTComponent>> &&components);
2060 static GDALExtendedDataType
2061 CreateString(size_t nMaxStringLength = 0,
2062 GDALExtendedDataTypeSubType eSubType = GEDTST_NONE);
2063
2064 bool operator==(const GDALExtendedDataType &) const;
2066 bool operator!=(const GDALExtendedDataType &other) const
2067 {
2068 return !(operator==(other));
2069 }
2070
2075 const std::string &GetName() const
2076 {
2077 return m_osName;
2078 }
2079
2084 GDALExtendedDataTypeClass GetClass() const
2085 {
2086 return m_eClass;
2087 }
2088
2094 GDALDataType GetNumericDataType() const
2095 {
2096 return m_eNumericDT;
2097 }
2098
2105 GDALExtendedDataTypeSubType GetSubType() const
2106 {
2107 return m_eSubType;
2108 }
2109
2115 const std::vector<std::unique_ptr<GDALEDTComponent>> &GetComponents() const
2116 {
2117 return m_aoComponents;
2118 }
2119
2126 size_t GetSize() const
2127 {
2128 return m_nSize;
2129 }
2130
2135 size_t GetMaxStringLength() const
2136 {
2137 return m_nMaxStringLength;
2138 }
2139
2140 bool CanConvertTo(const GDALExtendedDataType &other) const;
2141
2142 bool NeedsFreeDynamicMemory() const;
2143
2144 void FreeDynamicMemory(void *pBuffer) const;
2145
2146 static bool CopyValue(const void *pSrc, const GDALExtendedDataType &srcType,
2147 void *pDst, const GDALExtendedDataType &dstType);
2148
2149 static bool CopyValues(const void *pSrc,
2150 const GDALExtendedDataType &srcType,
2151 GPtrDiff_t nSrcStrideInElts, void *pDst,
2152 const GDALExtendedDataType &dstType,
2153 GPtrDiff_t nDstStrideInElts, size_t nValues);
2154
2155 private:
2156 GDALExtendedDataType(size_t nMaxStringLength,
2157 GDALExtendedDataTypeSubType eSubType);
2158 explicit GDALExtendedDataType(GDALDataType eType);
2159 GDALExtendedDataType(
2160 const std::string &osName, size_t nTotalSize,
2161 std::vector<std::unique_ptr<GDALEDTComponent>> &&components);
2162
2163 std::string m_osName{};
2164 GDALExtendedDataTypeClass m_eClass = GEDTC_NUMERIC;
2165 GDALExtendedDataTypeSubType m_eSubType = GEDTST_NONE;
2166 GDALDataType m_eNumericDT = GDT_Unknown;
2167 std::vector<std::unique_ptr<GDALEDTComponent>> m_aoComponents{};
2168 size_t m_nSize = 0;
2169 size_t m_nMaxStringLength = 0;
2170 };
2171
2172 /* ******************************************************************** */
2173 /* GDALEDTComponent */
2174 /* ******************************************************************** */
2175
2181 class CPL_DLL GDALEDTComponent
2182 {
2183 public:
2184 ~GDALEDTComponent();
2185 GDALEDTComponent(const std::string &name, size_t offset,
2186 const GDALExtendedDataType &type);
2187 GDALEDTComponent(const GDALEDTComponent &);
2188
2189 bool operator==(const GDALEDTComponent &) const;
2190
2195 const std::string &GetName() const
2196 {
2197 return m_osName;
2198 }
2199
2204 size_t GetOffset() const
2205 {
2206 return m_nOffset;
2207 }
2208
2213 const GDALExtendedDataType &GetType() const
2214 {
2215 return m_oType;
2216 }
2217
2218 private:
2219 std::string m_osName;
2220 size_t m_nOffset;
2221 GDALExtendedDataType m_oType;
2222 };
2223
2224 /* ******************************************************************** */
2225 /* GDALIHasAttribute */
2226 /* ******************************************************************** */
2227
2233 class CPL_DLL GDALIHasAttribute
2234 {
2235 protected:
2236 std::shared_ptr<GDALAttribute>
2237 GetAttributeFromAttributes(const std::string &osName) const;
2238
2239 public:
2240 virtual ~GDALIHasAttribute();
2241
2242 virtual std::shared_ptr<GDALAttribute>
2243 GetAttribute(const std::string &osName) const;
2244
2245 virtual std::vector<std::shared_ptr<GDALAttribute>>
2246 GetAttributes(CSLConstList papszOptions = nullptr) const;
2247
2248 virtual std::shared_ptr<GDALAttribute>
2249 CreateAttribute(const std::string &osName,
2250 const std::vector<GUInt64> &anDimensions,
2251 const GDALExtendedDataType &oDataType,
2252 CSLConstList papszOptions = nullptr);
2253 };
2254
2255 /* ******************************************************************** */
2256 /* GDALGroup */
2257 /* ******************************************************************** */
2258
2259 /* clang-format off */
2269 /* clang-format on */
2270
2271 class CPL_DLL GDALGroup : public GDALIHasAttribute
2272 {
2273 protected:
2275 std::string m_osName{};
2276 std::string m_osFullName{};
2277
2278 GDALGroup(const std::string &osParentName, const std::string &osName);
2279
2280 const GDALGroup *
2281 GetInnerMostGroup(const std::string &osPathOrArrayOrDim,
2282 std::shared_ptr<GDALGroup> &curGroupHolder,
2283 std::string &osLastPart) const;
2285
2286 public:
2287 virtual ~GDALGroup();
2288
2293 const std::string &GetName() const
2294 {
2295 return m_osName;
2296 }
2297
2302 const std::string &GetFullName() const
2303 {
2304 return m_osFullName;
2305 }
2306
2307 virtual std::vector<std::string>
2308 GetMDArrayNames(CSLConstList papszOptions = nullptr) const;
2309 virtual std::shared_ptr<GDALMDArray>
2310 OpenMDArray(const std::string &osName,
2311 CSLConstList papszOptions = nullptr) const;
2312
2313 virtual std::vector<std::string>
2314 GetGroupNames(CSLConstList papszOptions = nullptr) const;
2315 virtual std::shared_ptr<GDALGroup>
2316 OpenGroup(const std::string &osName,
2317 CSLConstList papszOptions = nullptr) const;
2318
2319 virtual std::vector<std::string>
2320 GetVectorLayerNames(CSLConstList papszOptions = nullptr) const;
2321 virtual OGRLayer *
2322 OpenVectorLayer(const std::string &osName,
2323 CSLConstList papszOptions = nullptr) const;
2324
2325 virtual std::vector<std::shared_ptr<GDALDimension>>
2326 GetDimensions(CSLConstList papszOptions = nullptr) const;
2327
2328 virtual std::shared_ptr<GDALGroup>
2329 CreateGroup(const std::string &osName, CSLConstList papszOptions = nullptr);
2330
2331 virtual std::shared_ptr<GDALDimension>
2332 CreateDimension(const std::string &osName, const std::string &osType,
2333 const std::string &osDirection, GUInt64 nSize,
2334 CSLConstList papszOptions = nullptr);
2335
2336 virtual std::shared_ptr<GDALMDArray> CreateMDArray(
2337 const std::string &osName,
2338 const std::vector<std::shared_ptr<GDALDimension>> &aoDimensions,
2339 const GDALExtendedDataType &oDataType,
2340 CSLConstList papszOptions = nullptr);
2341
2342 GUInt64 GetTotalCopyCost() const;
2343
2344 virtual bool CopyFrom(const std::shared_ptr<GDALGroup> &poDstRootGroup,
2345 GDALDataset *poSrcDS,
2346 const std::shared_ptr<GDALGroup> &poSrcGroup,
2347 bool bStrict, GUInt64 &nCurCost,
2348 const GUInt64 nTotalCost,
2349 GDALProgressFunc pfnProgress, void *pProgressData,
2350 CSLConstList papszOptions = nullptr);
2351
2352 virtual CSLConstList GetStructuralInfo() const;
2353
2354 std::shared_ptr<GDALMDArray>
2355 OpenMDArrayFromFullname(const std::string &osFullName,
2356 CSLConstList papszOptions = nullptr) const;
2357
2358 std::shared_ptr<GDALMDArray>
2359 ResolveMDArray(const std::string &osName, const std::string &osStartingPath,
2360 CSLConstList papszOptions = nullptr) const;
2361
2362 std::shared_ptr<GDALGroup>
2363 OpenGroupFromFullname(const std::string &osFullName,
2364 CSLConstList papszOptions = nullptr) const;
2365
2366 std::shared_ptr<GDALDimension>
2367 OpenDimensionFromFullname(const std::string &osFullName) const;
2368
2369 virtual void ClearStatistics();
2370
2372 static constexpr GUInt64 COPY_COST = 1000;
2374 };
2375
2376 /* ******************************************************************** */
2377 /* GDALAbstractMDArray */
2378 /* ******************************************************************** */
2379
2385 class CPL_DLL GDALAbstractMDArray
2386 {
2387 protected:
2389 std::string m_osName{};
2390 std::string m_osFullName{};
2391 std::weak_ptr<GDALAbstractMDArray> m_pSelf{};
2392
2393 GDALAbstractMDArray(const std::string &osParentName,
2394 const std::string &osName);
2395
2396 void SetSelf(std::weak_ptr<GDALAbstractMDArray> self)
2397 {
2398 m_pSelf = self;
2399 }
2400
2401 bool CheckReadWriteParams(const GUInt64 *arrayStartIdx, const size_t *count,
2402 const GInt64 *&arrayStep,
2403 const GPtrDiff_t *&bufferStride,
2404 const GDALExtendedDataType &bufferDataType,
2405 const void *buffer,
2406 const void *buffer_alloc_start,
2407 size_t buffer_alloc_size,
2408 std::vector<GInt64> &tmp_arrayStep,
2409 std::vector<GPtrDiff_t> &tmp_bufferStride) const;
2410
2411 virtual bool
2412 IRead(const GUInt64 *arrayStartIdx, // array of size GetDimensionCount()
2413 const size_t *count, // array of size GetDimensionCount()
2414 const GInt64 *arrayStep, // step in elements
2415 const GPtrDiff_t *bufferStride, // stride in elements
2416 const GDALExtendedDataType &bufferDataType,
2417 void *pDstBuffer) const = 0;
2418
2419 virtual bool
2420 IWrite(const GUInt64 *arrayStartIdx, // array of size GetDimensionCount()
2421 const size_t *count, // array of size GetDimensionCount()
2422 const GInt64 *arrayStep, // step in elements
2423 const GPtrDiff_t *bufferStride, // stride in elements
2424 const GDALExtendedDataType &bufferDataType, const void *pSrcBuffer);
2426
2427 public:
2428 virtual ~GDALAbstractMDArray();
2429
2435 const std::string &GetName() const
2436 {
2437 return m_osName;
2438 }
2439
2445 const std::string &GetFullName() const
2446 {
2447 return m_osFullName;
2448 }
2449
2450 GUInt64 GetTotalElementsCount() const;
2451
2452 virtual size_t GetDimensionCount() const;
2453
2454 virtual const std::vector<std::shared_ptr<GDALDimension>> &
2455 GetDimensions() const = 0;
2456
2457 virtual const GDALExtendedDataType &GetDataType() const = 0;
2458
2459 virtual std::vector<GUInt64> GetBlockSize() const;
2460
2461 virtual std::vector<size_t>
2462 GetProcessingChunkSize(size_t nMaxChunkMemory) const;
2463
2464 /* clang-format off */
2480 typedef bool (*FuncProcessPerChunkType)(
2481 GDALAbstractMDArray *array,
2482 const GUInt64 *chunkArrayStartIdx,
2483 const size_t *chunkCount,
2484 GUInt64 iCurChunk,
2485 GUInt64 nChunkCount,
2486 void *pUserData);
2487 /* clang-format on */
2488
2489 virtual bool ProcessPerChunk(const GUInt64 *arrayStartIdx,
2490 const GUInt64 *count, const size_t *chunkSize,
2491 FuncProcessPerChunkType pfnFunc,
2492 void *pUserData);
2493
2494 virtual bool
2495 Read(const GUInt64 *arrayStartIdx, // array of size GetDimensionCount()
2496 const size_t *count, // array of size GetDimensionCount()
2497 const GInt64 *arrayStep, // step in elements
2498 const GPtrDiff_t *bufferStride, // stride in elements
2499 const GDALExtendedDataType &bufferDataType, void *pDstBuffer,
2500 const void *pDstBufferAllocStart = nullptr,
2501 size_t nDstBufferAllocSize = 0) const;
2502
2503 bool
2504 Write(const GUInt64 *arrayStartIdx, // array of size GetDimensionCount()
2505 const size_t *count, // array of size GetDimensionCount()
2506 const GInt64 *arrayStep, // step in elements
2507 const GPtrDiff_t *bufferStride, // stride in elements
2508 const GDALExtendedDataType &bufferDataType, const void *pSrcBuffer,
2509 const void *pSrcBufferAllocStart = nullptr,
2510 size_t nSrcBufferAllocSize = 0);
2511 };
2512
2513 /* ******************************************************************** */
2514 /* GDALRawResult */
2515 /* ******************************************************************** */
2516
2523 class CPL_DLL GDALRawResult
2524 {
2525 private:
2526 GDALExtendedDataType m_dt;
2527 size_t m_nEltCount;
2528 size_t m_nSize;
2529 GByte *m_raw;
2530
2531 void FreeMe();
2532
2533 GDALRawResult(const GDALRawResult &) = delete;
2534 GDALRawResult &operator=(const GDALRawResult &) = delete;
2535
2536 protected:
2537 friend class GDALAttribute;
2539 GDALRawResult(GByte *raw, const GDALExtendedDataType &dt, size_t nEltCount);
2541
2542 public:
2543 ~GDALRawResult();
2544 GDALRawResult(GDALRawResult &&);
2545 GDALRawResult &operator=(GDALRawResult &&);
2546
2548 const GByte &operator[](size_t idx) const
2549 {
2550 return m_raw[idx];
2551 }
2553 const GByte *data() const
2554 {
2555 return m_raw;
2556 }
2558 size_t size() const
2559 {
2560 return m_nSize;
2561 }
2562
2564 GByte *StealData();
2566 };
2567
2568 /* ******************************************************************** */
2569 /* GDALAttribute */
2570 /* ******************************************************************** */
2571
2572 /* clang-format off */
2584 /* clang-format on */
2585
2586 class CPL_DLL GDALAttribute : virtual public GDALAbstractMDArray
2587 {
2588 mutable std::string m_osCachedVal{};
2589
2590 protected:
2592 GDALAttribute(const std::string &osParentName, const std::string &osName);
2594
2595 public:
2596 std::vector<GUInt64> GetDimensionsSize() const;
2597
2598 GDALRawResult ReadAsRaw() const;
2599 const char *ReadAsString() const;
2600 int ReadAsInt() const;
2601 double ReadAsDouble() const;
2602 CPLStringList ReadAsStringArray() const;
2603 std::vector<int> ReadAsIntArray() const;
2604 std::vector<double> ReadAsDoubleArray() const;
2605
2606 using GDALAbstractMDArray::Write;
2607 bool Write(const void *pabyValue, size_t nLen);
2608 bool Write(const char *);
2609 bool WriteInt(int);
2610 bool Write(double);
2611 bool Write(CSLConstList);
2612 bool Write(const double *, size_t);
2613
2615 static constexpr GUInt64 COPY_COST = 100;
2617 };
2618
2619 /************************************************************************/
2620 /* GDALAttributeString */
2621 /************************************************************************/
2622
2624 class CPL_DLL GDALAttributeString final : public GDALAttribute
2625 {
2626 std::vector<std::shared_ptr<GDALDimension>> m_dims{};
2627 GDALExtendedDataType m_dt = GDALExtendedDataType::CreateString();
2628 std::string m_osValue;
2629
2630 protected:
2631 bool IRead(const GUInt64 *, const size_t *, const GInt64 *,
2632 const GPtrDiff_t *, const GDALExtendedDataType &bufferDataType,
2633 void *pDstBuffer) const override;
2634
2635 public:
2636 GDALAttributeString(const std::string &osParentName,
2637 const std::string &osName, const std::string &osValue,
2638 GDALExtendedDataTypeSubType eSubType = GEDTST_NONE);
2639
2640 const std::vector<std::shared_ptr<GDALDimension>> &
2641 GetDimensions() const override;
2642
2643 const GDALExtendedDataType &GetDataType() const override;
2644 };
2646
2647 /************************************************************************/
2648 /* GDALAttributeNumeric */
2649 /************************************************************************/
2650
2652 class CPL_DLL GDALAttributeNumeric final : public GDALAttribute
2653 {
2654 std::vector<std::shared_ptr<GDALDimension>> m_dims{};
2655 GDALExtendedDataType m_dt;
2656 int m_nValue = 0;
2657 double m_dfValue = 0;
2658 std::vector<GUInt32> m_anValuesUInt32{};
2659
2660 protected:
2661 bool IRead(const GUInt64 *, const size_t *, const GInt64 *,
2662 const GPtrDiff_t *, const GDALExtendedDataType &bufferDataType,
2663 void *pDstBuffer) const override;
2664
2665 public:
2666 GDALAttributeNumeric(const std::string &osParentName,
2667 const std::string &osName, double dfValue);
2668 GDALAttributeNumeric(const std::string &osParentName,
2669 const std::string &osName, int nValue);
2670 GDALAttributeNumeric(const std::string &osParentName,
2671 const std::string &osName,
2672 const std::vector<GUInt32> &anValues);
2673
2674 const std::vector<std::shared_ptr<GDALDimension>> &
2675 GetDimensions() const override;
2676
2677 const GDALExtendedDataType &GetDataType() const override;
2678 };
2680
2681 /* ******************************************************************** */
2682 /* GDALMDArray */
2683 /* ******************************************************************** */
2684
2685 /* clang-format off */
2695 /* clang-format on */
2696
2697 class CPL_DLL GDALMDArray : virtual public GDALAbstractMDArray,
2698 public GDALIHasAttribute
2699 {
2700 friend class GDALMDArrayResampled;
2701 std::shared_ptr<GDALMDArray>
2702 GetView(const std::vector<GUInt64> &indices) const;
2703
2704 inline std::shared_ptr<GDALMDArray>
2705 atInternal(std::vector<GUInt64> &indices) const
2706 {
2707 return GetView(indices);
2708 }
2709
2710 template <typename... GUInt64VarArg>
2711 // cppcheck-suppress functionStatic
2712 inline std::shared_ptr<GDALMDArray>
2713 atInternal(std::vector<GUInt64> &indices, GUInt64 idx,
2714 GUInt64VarArg... tail) const
2715 {
2716 indices.push_back(idx);
2717 return atInternal(indices, tail...);
2718 }
2719
2720 mutable bool m_bHasTriedCachedArray = false;
2721 mutable std::shared_ptr<GDALMDArray> m_poCachedArray{};
2722
2723 protected:
2725 GDALMDArray(const std::string &osParentName, const std::string &osName);
2726
2727 virtual bool IAdviseRead(const GUInt64 *arrayStartIdx, const size_t *count,
2728 CSLConstList papszOptions) const;
2729
2730 virtual bool IsCacheable() const
2731 {
2732 return true;
2733 }
2734
2735 virtual bool SetStatistics(bool bApproxStats, double dfMin, double dfMax,
2736 double dfMean, double dfStdDev,
2737 GUInt64 nValidCount);
2738
2739 static std::string MassageName(const std::string &inputName);
2740
2741 std::shared_ptr<GDALGroup>
2742 GetCacheRootGroup(bool bCanCreate, std::string &osCacheFilenameOut) const;
2743
2744 // Returns if bufferStride values express a transposed view of the array
2745 bool IsTransposedRequest(const size_t *count,
2746 const GPtrDiff_t *bufferStride) const;
2747
2748 // Should only be called if IsTransposedRequest() returns true
2749 bool ReadForTransposedRequest(const GUInt64 *arrayStartIdx,
2750 const size_t *count, const GInt64 *arrayStep,
2751 const GPtrDiff_t *bufferStride,
2752 const GDALExtendedDataType &bufferDataType,
2753 void *pDstBuffer) const;
2755
2756 public:
2757 GUInt64 GetTotalCopyCost() const;
2758
2759 virtual bool CopyFrom(GDALDataset *poSrcDS, const GDALMDArray *poSrcArray,
2760 bool bStrict, GUInt64 &nCurCost,
2761 const GUInt64 nTotalCost,
2762 GDALProgressFunc pfnProgress, void *pProgressData);
2763
2765 virtual bool IsWritable() const = 0;
2766
2775 virtual const std::string &GetFilename() const = 0;
2776
2777 virtual CSLConstList GetStructuralInfo() const;
2778
2779 virtual const std::string &GetUnit() const;
2780
2781 virtual bool SetUnit(const std::string &osUnit);
2782
2783 virtual bool SetSpatialRef(const OGRSpatialReference *poSRS);
2784
2785 virtual std::shared_ptr<OGRSpatialReference> GetSpatialRef() const;
2786
2787 virtual const void *GetRawNoDataValue() const;
2788
2789 double GetNoDataValueAsDouble(bool *pbHasNoData = nullptr) const;
2790
2791 int64_t GetNoDataValueAsInt64(bool *pbHasNoData = nullptr) const;
2792
2793 uint64_t GetNoDataValueAsUInt64(bool *pbHasNoData = nullptr) const;
2794
2795 virtual bool SetRawNoDataValue(const void *pRawNoData);
2796
2798 bool SetNoDataValue(int nNoData)
2799 {
2800 return SetNoDataValue(static_cast<int64_t>(nNoData));
2801 }
2803
2804 bool SetNoDataValue(double dfNoData);
2805
2806 bool SetNoDataValue(int64_t nNoData);
2807
2808 bool SetNoDataValue(uint64_t nNoData);
2809
2810 virtual bool Resize(const std::vector<GUInt64> &anNewDimSizes,
2811 CSLConstList papszOptions);
2812
2813 virtual double GetOffset(bool *pbHasOffset = nullptr,
2814 GDALDataType *peStorageType = nullptr) const;
2815
2816 virtual double GetScale(bool *pbHasScale = nullptr,
2817 GDALDataType *peStorageType = nullptr) const;
2818
2819 virtual bool SetOffset(double dfOffset,
2820 GDALDataType eStorageType = GDT_Unknown);
2821
2822 virtual bool SetScale(double dfScale,
2823 GDALDataType eStorageType = GDT_Unknown);
2824
2825 std::shared_ptr<GDALMDArray> GetView(const std::string &viewExpr) const;
2826
2827 std::shared_ptr<GDALMDArray> operator[](const std::string &fieldName) const;
2828
2838 // sphinx 4.1.0 / breathe 4.30.0 don't like typename...
2840 template <typename... GUInt64VarArg>
2842 // cppcheck-suppress functionStatic
2843 std::shared_ptr<GDALMDArray> at(GUInt64 idx, GUInt64VarArg... tail) const
2844 {
2845 std::vector<GUInt64> indices;
2846 indices.push_back(idx);
2847 return atInternal(indices, tail...);
2848 }
2849
2850 virtual std::shared_ptr<GDALMDArray>
2851 Transpose(const std::vector<int> &anMapNewAxisToOldAxis) const;
2852
2853 std::shared_ptr<GDALMDArray> GetUnscaled() const;
2854
2855 virtual std::shared_ptr<GDALMDArray>
2856 GetMask(CSLConstList papszOptions) const;
2857
2858 std::shared_ptr<GDALMDArray>
2859 GetResampled(const std::vector<std::shared_ptr<GDALDimension>> &apoNewDims,
2860 GDALRIOResampleAlg resampleAlg,
2861 const OGRSpatialReference *poTargetSRS,
2862 CSLConstList papszOptions) const;
2863
2864 std::shared_ptr<GDALMDArray>
2865 GetGridded(const std::string &osGridOptions,
2866 const std::shared_ptr<GDALMDArray> &poXArray = nullptr,
2867 const std::shared_ptr<GDALMDArray> &poYArray = nullptr,
2868 CSLConstList papszOptions = nullptr) const;
2869
2870 virtual GDALDataset *AsClassicDataset(size_t iXDim, size_t iYDim) const;
2871
2872 virtual CPLErr GetStatistics(bool bApproxOK, bool bForce, double *pdfMin,
2873 double *pdfMax, double *pdfMean,
2874 double *padfStdDev, GUInt64 *pnValidCount,
2875 GDALProgressFunc pfnProgress,
2876 void *pProgressData);
2877
2878 virtual bool ComputeStatistics(bool bApproxOK, double *pdfMin,
2879 double *pdfMax, double *pdfMean,
2880 double *pdfStdDev, GUInt64 *pnValidCount,
2881 GDALProgressFunc, void *pProgressData);
2882
2883 virtual void ClearStatistics();
2884
2885 virtual std::vector<std::shared_ptr<GDALMDArray>>
2886 GetCoordinateVariables() const;
2887
2888 bool AdviseRead(const GUInt64 *arrayStartIdx, const size_t *count,
2889 CSLConstList papszOptions = nullptr) const;
2890
2891 bool IsRegularlySpaced(double &dfStart, double &dfIncrement) const;
2892
2893 bool GuessGeoTransform(size_t nDimX, size_t nDimY, bool bPixelIsPoint,
2894 double adfGeoTransform[6]) const;
2895
2896 bool Cache(CSLConstList papszOptions = nullptr) const;
2897
2898 bool
2899 Read(const GUInt64 *arrayStartIdx, // array of size GetDimensionCount()
2900 const size_t *count, // array of size GetDimensionCount()
2901 const GInt64 *arrayStep, // step in elements
2902 const GPtrDiff_t *bufferStride, // stride in elements
2903 const GDALExtendedDataType &bufferDataType, void *pDstBuffer,
2904 const void *pDstBufferAllocStart = nullptr,
2905 size_t nDstBufferAllocSize = 0) const override final;
2906
2908 static constexpr GUInt64 COPY_COST = 1000;
2909
2910 bool CopyFromAllExceptValues(const GDALMDArray *poSrcArray, bool bStrict,
2911 GUInt64 &nCurCost, const GUInt64 nTotalCost,
2912 GDALProgressFunc pfnProgress,
2913 void *pProgressData);
2914 struct Range
2915 {
2916 GUInt64 m_nStartIdx;
2917 GInt64 m_nIncr;
2918 explicit Range(GUInt64 nStartIdx = 0, GInt64 nIncr = 0)
2919 : m_nStartIdx(nStartIdx), m_nIncr(nIncr)
2920 {
2921 }
2922 };
2923
2924 struct ViewSpec
2925 {
2926 std::string m_osFieldName{};
2927
2928 // or
2929
2930 std::vector<size_t>
2931 m_mapDimIdxToParentDimIdx{}; // of size m_dims.size()
2932 std::vector<Range>
2933 m_parentRanges{}; // of size m_poParent->GetDimensionCount()
2934 };
2935
2936 virtual std::shared_ptr<GDALMDArray>
2937 GetView(const std::string &viewExpr, bool bRenameDimensions,
2938 std::vector<ViewSpec> &viewSpecs) const;
2940 };
2941
2943 bool GDALMDRasterIOFromBand(GDALRasterBand *poBand, GDALRWFlag eRWFlag,
2944 size_t iDimX, size_t iDimY,
2945 const GUInt64 *arrayStartIdx, const size_t *count,
2946 const GInt64 *arrayStep,
2947 const GPtrDiff_t *bufferStride,
2948 const GDALExtendedDataType &bufferDataType,
2949 void *pBuffer);
2951
2952 /************************************************************************/
2953 /* GDALMDArrayRegularlySpaced */
2954 /************************************************************************/
2955
2957 class CPL_DLL GDALMDArrayRegularlySpaced : public GDALMDArray
2958 {
2959 double m_dfStart;
2960 double m_dfIncrement;
2961 double m_dfOffsetInIncrement;
2962 GDALExtendedDataType m_dt = GDALExtendedDataType::Create(GDT_Float64);
2963 std::vector<std::shared_ptr<GDALDimension>> m_dims;
2964 std::vector<std::shared_ptr<GDALAttribute>> m_attributes{};
2965 std::string m_osEmptyFilename{};
2966
2967 protected:
2968 bool IRead(const GUInt64 *, const size_t *, const GInt64 *,
2969 const GPtrDiff_t *, const GDALExtendedDataType &bufferDataType,
2970 void *pDstBuffer) const override;
2971
2972 public:
2973 GDALMDArrayRegularlySpaced(const std::string &osParentName,
2974 const std::string &osName,
2975 const std::shared_ptr<GDALDimension> &poDim,
2976 double dfStart, double dfIncrement,
2977 double dfOffsetInIncrement);
2978
2979 static std::shared_ptr<GDALMDArrayRegularlySpaced>
2980 Create(const std::string &osParentName, const std::string &osName,
2981 const std::shared_ptr<GDALDimension> &poDim, double dfStart,
2982 double dfIncrement, double dfOffsetInIncrement);
2983
2984 bool IsWritable() const override
2985 {
2986 return false;
2987 }
2988
2989 const std::string &GetFilename() const override
2990 {
2991 return m_osEmptyFilename;
2992 }
2993
2994 const std::vector<std::shared_ptr<GDALDimension>> &
2995 GetDimensions() const override;
2996
2997 const GDALExtendedDataType &GetDataType() const override;
2998
2999 std::vector<std::shared_ptr<GDALAttribute>>
3000 GetAttributes(CSLConstList) const override;
3001
3002 void AddAttribute(const std::shared_ptr<GDALAttribute> &poAttr);
3003 };
3005
3006 /* ******************************************************************** */
3007 /* GDALDimension */
3008 /* ******************************************************************** */
3009
3021 class CPL_DLL GDALDimension
3022 {
3023 public:
3025 GDALDimension(const std::string &osParentName, const std::string &osName,
3026 const std::string &osType, const std::string &osDirection,
3027 GUInt64 nSize);
3029
3030 virtual ~GDALDimension();
3031
3036 const std::string &GetName() const
3037 {
3038 return m_osName;
3039 }
3040
3045 const std::string &GetFullName() const
3046 {
3047 return m_osFullName;
3048 }
3049
3058 const std::string &GetType() const
3059 {
3060 return m_osType;
3061 }
3062
3071 const std::string &GetDirection() const
3072 {
3073 return m_osDirection;
3074 }
3075
3080 GUInt64 GetSize() const
3081 {
3082 return m_nSize;
3083 }
3084
3085 virtual std::shared_ptr<GDALMDArray> GetIndexingVariable() const;
3086
3087 virtual bool
3088 SetIndexingVariable(std::shared_ptr<GDALMDArray> poIndexingVariable);
3089
3090 protected:
3092 std::string m_osName;
3093 std::string m_osFullName;
3094 std::string m_osType;
3095 std::string m_osDirection;
3096 GUInt64 m_nSize;
3098 };
3099
3100 /************************************************************************/
3101 /* GDALDimensionWeakIndexingVar() */
3102 /************************************************************************/
3103
3105 class CPL_DLL GDALDimensionWeakIndexingVar : public GDALDimension
3106 {
3107 std::weak_ptr<GDALMDArray> m_poIndexingVariable{};
3108
3109 public:
3110 GDALDimensionWeakIndexingVar(const std::string &osParentName,
3111 const std::string &osName,
3112 const std::string &osType,
3113 const std::string &osDirection, GUInt64 nSize);
3114
3115 std::shared_ptr<GDALMDArray> GetIndexingVariable() const override;
3116
3117 bool SetIndexingVariable(
3118 std::shared_ptr<GDALMDArray> poIndexingVariable) override;
3119
3120 void SetSize(GUInt64 nNewSize);
3121 };
3123
3124 /************************************************************************/
3125 /* GDALAntiRecursionGuard */
3126 /************************************************************************/
3127
3129 struct GDALAntiRecursionStruct;
3130 class GDALAntiRecursionGuard
3131 {
3132 GDALAntiRecursionStruct *m_psAntiRecursionStruct;
3133 std::string m_osIdentifier;
3134 int m_nDepth;
3135
3136 GDALAntiRecursionGuard(const GDALAntiRecursionGuard &) = delete;
3137 GDALAntiRecursionGuard &operator=(const GDALAntiRecursionGuard &) = delete;
3138
3139 public:
3140 explicit GDALAntiRecursionGuard(const std::string &osIdentifier);
3141 GDALAntiRecursionGuard(const GDALAntiRecursionGuard &other,
3142 const std::string &osIdentifier);
3143 ~GDALAntiRecursionGuard();
3144 int GetCallDepth() const
3145 {
3146 return m_nDepth;
3147 }
3148 };
3150
3151 /************************************************************************/
3152 /* Relationships */
3153 /************************************************************************/
3154
3166 class CPL_DLL GDALRelationship
3167 {
3168 protected:
3170 std::string m_osName{};
3171 std::string m_osLeftTableName{};
3172 std::string m_osRightTableName{};
3173 GDALRelationshipCardinality m_eCardinality =
3174 GDALRelationshipCardinality::GRC_ONE_TO_MANY;
3175 std::string m_osMappingTableName{};
3176 std::vector<std::string> m_osListLeftTableFields{};
3177 std::vector<std::string> m_osListRightTableFields{};
3178 std::vector<std::string> m_osListLeftMappingTableFields{};
3179 std::vector<std::string> m_osListRightMappingTableFields{};
3180 GDALRelationshipType m_eType = GDALRelationshipType::GRT_ASSOCIATION;
3181 std::string m_osForwardPathLabel{};
3182 std::string m_osBackwardPathLabel{};
3183 std::string m_osRelatedTableType{};
3184
3187 public:
3195 GDALRelationship(const std::string &osName,
3196 const std::string &osLeftTableName,
3197 const std::string &osRightTableName,
3198 GDALRelationshipCardinality eCardinality =
3199 GDALRelationshipCardinality::GRC_ONE_TO_MANY)
3200 : m_osName(osName), m_osLeftTableName(osLeftTableName),
3201 m_osRightTableName(osRightTableName), m_eCardinality(eCardinality)
3202 {
3203 }
3204
3206 const std::string &GetName() const
3207 {
3208 return m_osName;
3209 }
3210
3212 GDALRelationshipCardinality GetCardinality() const
3213 {
3214 return m_eCardinality;
3215 }
3216
3221 const std::string &GetLeftTableName() const
3222 {
3223 return m_osLeftTableName;
3224 }
3225
3228 const std::string &GetRightTableName() const
3229 {
3230 return m_osRightTableName;
3231 }
3232
3237 const std::string &GetMappingTableName() const
3238 {
3239 return m_osMappingTableName;
3240 }
3241
3246 void SetMappingTableName(const std::string &osName)
3247 {
3248 m_osMappingTableName = osName;
3249 }
3250
3257 const std::vector<std::string> &GetLeftTableFields() const
3258 {
3259 return m_osListLeftTableFields;
3260 }
3261
3268 const std::vector<std::string> &GetRightTableFields() const
3269 {
3270 return m_osListRightTableFields;
3271 }
3272
3279 void SetLeftTableFields(const std::vector<std::string> &osListFields)
3280 {
3281 m_osListLeftTableFields = osListFields;
3282 }
3283
3290 void SetRightTableFields(const std::vector<std::string> &osListFields)
3291 {
3292 m_osListRightTableFields = osListFields;
3293 }
3294
3301 const std::vector<std::string> &GetLeftMappingTableFields() const
3302 {
3303 return m_osListLeftMappingTableFields;
3304 }
3305
3312 const std::vector<std::string> &GetRightMappingTableFields() const
3313 {
3314 return m_osListRightMappingTableFields;
3315 }
3316
3323 void SetLeftMappingTableFields(const std::vector<std::string> &osListFields)
3324 {
3325 m_osListLeftMappingTableFields = osListFields;
3326 }
3327
3334 void
3335 SetRightMappingTableFields(const std::vector<std::string> &osListFields)
3336 {
3337 m_osListRightMappingTableFields = osListFields;
3338 }
3339
3344 GDALRelationshipType GetType() const
3345 {
3346 return m_eType;
3347 }
3348
3353 void SetType(GDALRelationshipType eType)
3354 {
3355 m_eType = eType;
3356 }
3357
3373 const std::string &GetForwardPathLabel() const
3374 {
3375 return m_osForwardPathLabel;
3376 }
3377
3393 void SetForwardPathLabel(const std::string &osLabel)
3394 {
3395 m_osForwardPathLabel = osLabel;
3396 }
3397
3413 const std::string &GetBackwardPathLabel() const
3414 {
3415 return m_osBackwardPathLabel;
3416 }
3417
3433 void SetBackwardPathLabel(const std::string &osLabel)
3434 {
3435 m_osBackwardPathLabel = osLabel;
3436 }
3437
3448 const std::string &GetRelatedTableType() const
3449 {
3450 return m_osRelatedTableType;
3451 }
3452
3463 void SetRelatedTableType(const std::string &osType)
3464 {
3465 m_osRelatedTableType = osType;
3466 }
3467
3470 static inline GDALRelationshipH ToHandle(GDALRelationship *poRelationship)
3471 {
3472 return static_cast<GDALRelationshipH>(poRelationship);
3473 }
3474
3477 static inline GDALRelationship *FromHandle(GDALRelationshipH hRelationship)
3478 {
3479 return static_cast<GDALRelationship *>(hRelationship);
3480 }
3481 };
3482
3483 /* ==================================================================== */
3484 /* An assortment of overview related stuff. */
3485 /* ==================================================================== */
3486
3488 /* Only exported for drivers as plugin. Signature may change */
3489 CPLErr CPL_DLL GDALRegenerateOverviewsMultiBand(
3490 int nBands, GDALRasterBand *const *papoSrcBands, int nOverviews,
3491 GDALRasterBand *const *const *papapoOverviewBands,
3492 const char *pszResampling, GDALProgressFunc pfnProgress,
3493 void *pProgressData, CSLConstList papszOptions);
3494
3495 typedef CPLErr (*GDALResampleFunction)(
3496 double dfXRatioDstToSrc, double dfYRatioDstToSrc, double dfSrcXDelta,
3497 double dfSrcYDelta, GDALDataType eWrkDataType, const void *pChunk,
3498 const GByte *pabyChunkNodataMask, int nChunkXOff, int nChunkXSize,
3499 int nChunkYOff, int nChunkYSize, int nDstXOff, int nDstXOff2, int nDstYOff,
3500 int nDstYOff2, GDALRasterBand *poOverview, void **ppDstBuffer,
3501 GDALDataType *peDstBufferDataType, const char *pszResampling,
3502 int bHasNoData, float fNoDataValue, GDALColorTable *poColorTable,
3503 GDALDataType eSrcDataType, bool bPropagateNoData);
3504
3505 GDALResampleFunction GDALGetResampleFunction(const char *pszResampling,
3506 int *pnRadius);
3507
3508 GDALDataType GDALGetOvrWorkDataType(const char *pszResampling,
3509 GDALDataType eSrcDataType);
3510
3511 CPL_C_START
3512
3513 CPLErr CPL_DLL
3514 HFAAuxBuildOverviews(const char *pszOvrFilename, GDALDataset *poParentDS,
3515 GDALDataset **ppoDS, int nBands, const int *panBandList,
3516 int nNewOverviews, const int *panNewOverviewList,
3517 const char *pszResampling, GDALProgressFunc pfnProgress,
3518 void *pProgressData, CSLConstList papszOptions);
3519
3520 CPLErr CPL_DLL GTIFFBuildOverviews(const char *pszFilename, int nBands,
3521 GDALRasterBand *const *papoBandList,
3522 int nOverviews, const int *panOverviewList,
3523 const char *pszResampling,
3524 GDALProgressFunc pfnProgress,
3525 void *pProgressData,
3526 CSLConstList papszOptions);
3527
3528 int CPL_DLL GDALBandGetBestOverviewLevel(GDALRasterBand *poBand, int &nXOff,
3529 int &nYOff, int &nXSize, int &nYSize,
3530 int nBufXSize, int nBufYSize)
3531 CPL_WARN_DEPRECATED("Use GDALBandGetBestOverviewLevel2 instead");
3532 int CPL_DLL GDALBandGetBestOverviewLevel2(GDALRasterBand *poBand, int &nXOff,
3533 int &nYOff, int &nXSize, int &nYSize,
3534 int nBufXSize, int nBufYSize,
3535 GDALRasterIOExtraArg *psExtraArg);
3536
3537 int CPL_DLL GDALOvLevelAdjust(int nOvLevel, int nXSize)
3538 CPL_WARN_DEPRECATED("Use GDALOvLevelAdjust2 instead");
3539 int CPL_DLL GDALOvLevelAdjust2(int nOvLevel, int nXSize, int nYSize);
3540 int CPL_DLL GDALComputeOvFactor(int nOvrXSize, int nRasterXSize, int nOvrYSize,
3541 int nRasterYSize);
3542
3543 GDALDataset CPL_DLL *GDALFindAssociatedAuxFile(const char *pszBasefile,
3544 GDALAccess eAccess,
3545 GDALDataset *poDependentDS);
3546
3547 /* ==================================================================== */
3548 /* Infrastructure to check that dataset characteristics are valid */
3549 /* ==================================================================== */
3550
3551 int CPL_DLL GDALCheckDatasetDimensions(int nXSize, int nYSize);
3552 int CPL_DLL GDALCheckBandCount(int nBands, int bIsZeroAllowed);
3553
3554 /* Internal use only */
3555
3556 /* CPL_DLL exported, but only for in-tree drivers that can be built as plugins
3557 */
3558 int CPL_DLL GDALReadWorldFile2(const char *pszBaseFilename,
3559 const char *pszExtension,
3560 double *padfGeoTransform,
3561 char **papszSiblingFiles,
3562 char **ppszWorldFileNameOut);
3563 int GDALReadTabFile2(const char *pszBaseFilename, double *padfGeoTransform,
3564 char **ppszWKT, int *pnGCPCount, GDAL_GCP **ppasGCPs,
3565 char **papszSiblingFiles, char **ppszTabFileNameOut);
3566
3567 void CPL_DLL GDALCopyRasterIOExtraArg(GDALRasterIOExtraArg *psDestArg,
3568 GDALRasterIOExtraArg *psSrcArg);
3569
3570 CPL_C_END
3571
3572 void GDALNullifyOpenDatasetsList();
3573 CPLMutex **GDALGetphDMMutex();
3574 CPLMutex **GDALGetphDLMutex();
3575 void GDALNullifyProxyPoolSingleton();
3576 void GDALSetResponsiblePIDForCurrentThread(GIntBig responsiblePID);
3577 GIntBig GDALGetResponsiblePIDForCurrentThread();
3578
3579 CPLString GDALFindAssociatedFile(const char *pszBasename, const char *pszExt,
3580 CSLConstList papszSiblingFiles, int nFlags);
3581
3582 CPLErr CPL_DLL EXIFExtractMetadata(char **&papszMetadata, void *fpL,
3583 int nOffset, int bSwabflag, int nTIFFHEADER,
3584 int &nExifOffset, int &nInterOffset,
3585 int &nGPSOffset);
3586
3587 int GDALValidateOpenOptions(GDALDriverH hDriver,
3588 const char *const *papszOptionOptions);
3589 int GDALValidateOptions(const char *pszOptionList,
3590 const char *const *papszOptionsToValidate,
3591 const char *pszErrorMessageOptionType,
3592 const char *pszErrorMessageContainerName);
3593
3594 GDALRIOResampleAlg GDALRasterIOGetResampleAlg(const char *pszResampling);
3595 const char *GDALRasterIOGetResampleAlg(GDALRIOResampleAlg eResampleAlg);
3596
3597 void GDALRasterIOExtraArgSetResampleAlg(GDALRasterIOExtraArg *psExtraArg,
3598 int nXSize, int nYSize, int nBufXSize,
3599 int nBufYSize);
3600
3601 GDALDataset *GDALCreateOverviewDataset(GDALDataset *poDS, int nOvrLevel,
3602 bool bThisLevelOnly);
3603
3604 // Should cover particular cases of #3573, #4183, #4506, #6578
3605 // Behavior is undefined if fVal1 or fVal2 are NaN (should be tested before
3606 // calling this function)
3607 template <class T> inline bool ARE_REAL_EQUAL(T fVal1, T fVal2, int ulp = 2)
3608 {
3609 return fVal1 == fVal2 || /* Should cover infinity */
3610 std::abs(fVal1 - fVal2) < std::numeric_limits<float>::epsilon() *
3611 std::abs(fVal1 + fVal2) * ulp;
3612 }
3613
3614 double GDALAdjustNoDataCloseToFloatMax(double dfVal);
3615
3616 #define DIV_ROUND_UP(a, b) (((a) % (b)) == 0 ? ((a) / (b)) : (((a) / (b)) + 1))
3617
3618 // Number of data samples that will be used to compute approximate statistics
3619 // (minimum value, maximum value, etc.)
3620 #define GDALSTAT_APPROX_NUMSAMPLES 2500
3621
3622 void GDALSerializeGCPListToXML(CPLXMLNode *psParentNode, GDAL_GCP *pasGCPList,
3623 int nGCPCount,
3624 const OGRSpatialReference *poGCP_SRS);
3625 void GDALDeserializeGCPListFromXML(CPLXMLNode *psGCPList,
3626 GDAL_GCP **ppasGCPList, int *pnGCPCount,
3627 OGRSpatialReference **ppoGCP_SRS);
3628
3629 void GDALSerializeOpenOptionsToXML(CPLXMLNode *psParentNode,
3630 char **papszOpenOptions);
3631 char **GDALDeserializeOpenOptionsFromXML(CPLXMLNode *psParentNode);
3632
3633 int GDALCanFileAcceptSidecarFile(const char *pszFilename);
3634
3635 bool GDALCanReliablyUseSiblingFileList(const char *pszFilename);
3636
3637 bool CPL_DLL GDALIsDriverDeprecatedForGDAL35StillEnabled(
3638 const char *pszDriverName, const char *pszExtraMsg = "");
3639
3640 typedef enum
3641 {
3642 GSF_UNSIGNED_INT,
3643 GSF_SIGNED_INT,
3644 GSF_FLOATING_POINT,
3645 } GDALBufferSampleFormat;
3646
3647 bool CPL_DLL GDALBufferHasOnlyNoData(const void *pBuffer, double dfNoDataValue,
3648 size_t nWidth, size_t nHeight,
3649 size_t nLineStride, size_t nComponents,
3650 int nBitsPerSample,
3651 GDALBufferSampleFormat nSampleFormat);
3652
3653 void CPL_DLL GDALCopyNoDataValue(GDALRasterBand *poDstBand,
3654 GDALRasterBand *poSrcBand);
3655
3656 double CPL_DLL GDALGetNoDataValueCastToDouble(int64_t nVal);
3657 double CPL_DLL GDALGetNoDataValueCastToDouble(uint64_t nVal);
3658
3659 // Remove me in GDAL 4.0. See GetMetadataItem() implementation
3660 // Internal use in GDAL only !
3661 // Declaration copied in swig/include/gdal.i
3662 void CPL_DLL GDALEnablePixelTypeSignedByteWarning(GDALRasterBandH hBand,
3663 bool b);
3664
3665 std::string CPL_DLL GDALGetCompressionFormatForJPEG(VSILFILE *fp);
3666 std::string CPL_DLL GDALGetCompressionFormatForJPEG(const void *pBuffer,
3667 size_t nBufferSize);
3668
3670
3671 #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:1671
GDALRelationship::SetRelatedTableType
void SetRelatedTableType(const std::string &osType)
Sets the type string of the related table.
Definition: gdal_priv.h:3463
GDALDimension::GetFullName
const std::string & GetFullName() const
Return the full name.
Definition: gdal_priv.h:3045
CPL_PRINT_FUNC_FORMAT
#define CPL_PRINT_FUNC_FORMAT(format_idx, arg_idx)
Tag a function to have printf() formatting.
Definition: cpl_port.h:959
GDAL_IDENTIFY_FALSE
@ GDAL_IDENTIFY_FALSE
Identify determined the file is not recognized by the probed driver.
Definition: gdal_priv.h:1673
GDALOpenInfo::fpL
VSILFILE * fpL
Pointer to the file.
Definition: gdal_priv.h:303
GDALExtendedDataType::GetSize
size_t GetSize() const
Return data type size in bytes.
Definition: gdal_priv.h:2126
GDALDimension::SetIndexingVariable
virtual bool SetIndexingVariable(std::shared_ptr< GDALMDArray > poIndexingVariable)
Set the variable that is used to index the dimension.
Definition: gdalmultidim.cpp:8834
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:2302
GDALRasterBand::GetMaskValueRange
virtual GDALMaskValueRange GetMaskValueRange() const
Returns the range of values that a mask band can take.
Definition: gdalrasterband.cpp:7535
GByte
unsigned char GByte
Unsigned byte type.
Definition: cpl_port.h:205
GDALAsyncReader::GetYOffset
int GetYOffset() const
Return y offset.
Definition: gdal_priv.h:1938
GDALExtendedDataType
Class used to represent potentially complex data types.
Definition: gdal_priv.h:2047
GDALRasterBlock::GetYSize
int GetYSize() const
Return the height of the block.
Definition: gdal_priv.h:1055
GDALDataset::Layers::Iterator::iterator_category
std::input_iterator_tag iterator_category
iterator_category
Definition: gdal_priv.h:771
GUInt64
GUIntBig GUInt64
Unsigned 64 bit integer type.
Definition: cpl_port.h:258
gdal.h
GDALOpenInfo
Class for dataset open functions.
Definition: gdal_priv.h:276
GDALDataset::Layers::Iterator
Layer iterator.
Definition: gdal_priv.h:760
GDALRasterBand::ComputeStatistics
virtual CPLErr ComputeStatistics(int bApproxOK, double *pdfMin, double *pdfMax, double *pdfMean, double *pdfStdDev, GDALProgressFunc, void *pProgressData)
Compute image statistics.
Definition: gdalrasterband.cpp:5578
GDALAsyncReader::GetPixelSpace
int GetPixelSpace() const
Return pixel spacing.
Definition: gdal_priv.h:2001
GDALAbstractMDArray::GetFullName
const std::string & GetFullName() const
Return the name of an array or attribute.
Definition: gdal_priv.h:2445
GDALRasterBlock::GetBlockSize
GPtrDiff_t GetBlockSize() const
Return the block size in bytes.
Definition: gdal_priv.h:1076
GDALEDTComponent
Class for a component of a compound extended data type.
Definition: gdal_priv.h:2181
GSBAP_RANDOM
constexpr GDALSuggestedBlockAccessPattern GSBAP_RANDOM
Random access to blocks is efficient.
Definition: gdal_priv.h:1255
GDALAsyncReader::GetBandCount
int GetBandCount() const
Return band count.
Definition: gdal_priv.h:1987
GDALRasterBand::IsMaskBand
virtual bool IsMaskBand() const
Returns whether a band is a mask band.
Definition: gdalrasterband.cpp:7484
GSBAP_UNKNOWN
constexpr GDALSuggestedBlockAccessPattern GSBAP_UNKNOWN
Unknown, or no particular read order is suggested.
Definition: gdal_priv.h:1252
GDALRelationship::GetLeftTableName
const std::string & GetLeftTableName() const
Get the name of the left (or base/origin) table in the relationship.
Definition: gdal_priv.h:3221
begin
OGRLayer::FeatureIterator begin(OGRLayer *poLayer)
Return begin of feature iterator.
Definition: ogrsf_frmts.h:364
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:3370
GDALDataset::Layers::Iterator::difference_type
void difference_type
difference_type
Definition: gdal_priv.h:768
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:3393
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:1894
GDT_Unknown
@ GDT_Unknown
Definition: gdal.h:65
GDALOpenInfo::papszAllowedDrivers
const char *const * papszAllowedDrivers
Allowed drivers (NULL for all)
Definition: gdal_priv.h:311
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:3195
GMVR_0_AND_255_ONLY
@ GMVR_0_AND_255_ONLY
Definition: gdal_priv.h:1245
GDALExtendedDataType::GetClass
GDALExtendedDataTypeClass GetClass() const
Return type class.
Definition: gdal_priv.h:2084
GRT_ASSOCIATION
@ GRT_ASSOCIATION
Association relationship.
Definition: gdal.h:1909
GDALRelationship::GetRightTableName
const std::string & GetRightTableName() const
Get the name of the right (or related/destination) table in the relationship.
Definition: gdal_priv.h:3228
GDALAsyncReader::GetBufferYSize
int GetBufferYSize() const
Return buffer height.
Definition: gdal_priv.h:1973
cpl_minixml.h
GDALDriver
Format specific driver.
Definition: gdal_priv.h:1693
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:2385
GDALDataset::Bands
Class returned by GetBands() that act as a container for raster bands.
Definition: gdal_priv.h:496
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:2843
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:2008
GDALRasterBlock::GetDataRef
void * GetDataRef(void)
Return the data buffer.
Definition: gdal_priv.h:1069
GDALOpenInfo::nOpenFlags
int nOpenFlags
Open flags.
Definition: gdal_priv.h:295
GDALOpenInfo::papszOpenOptions
char ** papszOpenOptions
Open options.
Definition: gdal_priv.h:290
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:1729
GDALDimension::GetName
const std::string & GetName() const
Return the name.
Definition: gdal_priv.h:3036
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:72
CPLString
Convenient string class based on std::string.
Definition: cpl_string.h:311
GDALRasterBand
A single raster band (or channel).
Definition: gdal_priv.h:1269
GInt64
GIntBig GInt64
Signed 64 bit integer type.
Definition: cpl_port.h:256
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:3268
GDALIdentifyEnum
GDALIdentifyEnum
Enumeration used by GDALDriver::pfnIdentify().
Definition: gdal_priv.h:1667
GDALAsyncReader::GetBandSpace
int GetBandSpace() const
Return band spacing.
Definition: gdal_priv.h:2015
GMVR_0_AND_1_ONLY
@ GMVR_0_AND_1_ONLY
Definition: gdal_priv.h:1244
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:271
GPtrDiff_t
int GPtrDiff_t
Integer type large enough to hold the difference between 2 addresses.
Definition: cpl_port.h:276
GDALDimension::GetDirection
const std::string & GetDirection() const
Return the axis direction.
Definition: gdal_priv.h:3071
GDALRelationship::SetType
void SetType(GDALRelationshipType eType)
Sets the type of the relationship.
Definition: gdal_priv.h:3353
GDALClose
CPLErr GDALClose(GDALDatasetH)
Close GDAL dataset.
Definition: gdaldataset.cpp:3800
GDALAsyncReader::GetBufferType
GDALDataType GetBufferType() const
Return buffer data type.
Definition: gdal_priv.h:1980
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:1240
GDALRawResult::data
const GByte * data() const
Return pointer to the start of data.
Definition: gdal_priv.h:2553
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:1287
GDALRelationship::FromHandle
static GDALRelationship * FromHandle(GDALRelationshipH hRelationship)
Convert a GDALRelationshipH to a GDALRelationship*.
Definition: gdal_priv.h:3477
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:2435
GDALRasterBlock
A single raster block in the block cache.
Definition: gdal_priv.h:972
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:2523
GDALGroup
Class modeling a named container of GDALAttribute, GDALMDArray, OGRLayer or other GDALGroup.
Definition: gdal_priv.h:2271
GDALDataset
A set of associated raster bands, usually from one file.
Definition: gdal_priv.h:347
GDALDataset::GetOpenOptions
char ** GetOpenOptions()
Return open options.
Definition: gdal_priv.h:644
GDALMajorObject::FromHandle
static GDALMajorObject * FromHandle(GDALMajorObjectH hMajorObject)
Convert a GDALMajorObjectH to a GDALMajorObject*.
Definition: gdal_priv.h:181
GDALRawResult::size
size_t size() const
Return the size in bytes of the raw result.
Definition: gdal_priv.h:2558
GDALIHasAttribute
Interface used to get a single GDALAttribute or a set of GDALAttribute.
Definition: gdal_priv.h:2233
GDALRelationship
Definition of a table relationship.
Definition: gdal_priv.h:3166
GDALOpenInfo::bStatOK
int bStatOK
Whether stat()'ing the file was successful.
Definition: gdal_priv.h:298
GDALRelationship::GetType
GDALRelationshipType GetType() const
Get the type of the relationship.
Definition: gdal_priv.h:3344
CPL_C_START
#define CPL_C_START
Macro to start a block of C symbols.
Definition: cpl_port.h:315
GDALDriverManager
Class for managing the registration of file format drivers.
Definition: gdal_priv.h:1837
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:3373
GDALMDArray
Class modeling a multi-dimensional array.
Definition: gdal_priv.h:2697
GDALOpenInfo::pabyHeader
GByte * pabyHeader
Buffer with first bytes of the file.
Definition: gdal_priv.h:308
GDALAsyncReader::GetYSize
int GetYSize() const
Return height.
Definition: gdal_priv.h:1952
GDALOpenInfo::eAccess
GDALAccess eAccess
Access flag.
Definition: gdal_priv.h:293
GDALRasterBand::GetMaskBand
virtual GDALRasterBand * GetMaskBand()
Return the mask band associated with the band.
Definition: gdalrasterband.cpp:7018
GDALExtendedDataType::GetNumericDataType
GDALDataType GetNumericDataType() const
Return numeric data type (only valid when GetClass() == GEDTC_NUMERIC)
Definition: gdal_priv.h:2094
GDALExtendedDataType::CreateString
static GDALExtendedDataType CreateString(size_t nMaxStringLength=0, GDALExtendedDataTypeSubType eSubType=GEDTST_NONE)
Return a new GDALExtendedDataType of class GEDTC_STRING.
Definition: gdalmultidim.cpp:8562
GRC_ONE_TO_MANY
@ GRC_ONE_TO_MANY
One-to-many.
Definition: gdal.h:1893
CSLConstList
char ** CSLConstList
Type of a constant null-terminated list of nul terminated strings.
Definition: cpl_port.h:1195
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:238
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:700
GDT_Float64
@ GDT_Float64
Definition: gdal.h:75
GDALExtendedDataType::GetSubType
GDALExtendedDataTypeSubType GetSubType() const
Return subtype.
Definition: gdal_priv.h:2105
GDALRasterBlock::DropLock
int DropLock(void)
Decrement the lock count.
Definition: gdal_priv.h:1016
GDALRelationship::GetBackwardPathLabel
const std::string & GetBackwardPathLabel() const
Get the label of the backward path for the relationship.
Definition: gdal_priv.h:3413
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:3257
GDALOpenInfo::bIsDirectory
int bIsDirectory
Whether the file is a directory.
Definition: gdal_priv.h:300
GDALDimension::GetType
const std::string & GetType() const
Return the axis type.
Definition: gdal_priv.h:3058
GDAL_GCP
Ground Control Point.
Definition: gdal.h:1036
CPL_C_END
#define CPL_C_END
Macro to end a block of C symbols.
Definition: cpl_port.h:319
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:3021
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:3433
GDALRelationship::GetCardinality
GDALRelationshipCardinality GetCardinality() const
Get the cardinality of the relationship.
Definition: gdal_priv.h:3212
CPL_NULL_TERMINATED
#define CPL_NULL_TERMINATED
Null terminated variadic.
Definition: cpl_port.h:947
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:1261
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:2115
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:1265
ogr_feature.h
GDALDataset::FeatureLayerPair
Object returned by GetFeatures() iterators.
Definition: gdal_priv.h:712
GDALAsyncReader::GetGDALDataset
GDALDataset * GetGDALDataset()
Return dataset.
Definition: gdal_priv.h:1924
cpl_conv.h
GDALDataset::ToHandle
static GDALDatasetH ToHandle(GDALDataset *poDS)
Convert a GDALDataset* to a GDALDatasetH.
Definition: gdal_priv.h:684
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:3290
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:1890
VSIVirtualHandle
Virtual file handle.
Definition: cpl_vsi_virtual.h:61
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:4190
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:1262
GDALColorTable::ToHandle
static GDALColorTableH ToHandle(GDALColorTable *poCT)
Convert a GDALColorTable* to a GDALRasterBandH.
Definition: gdal_priv.h:1146
GDALRasterBlock::AddLock
int AddLock(void)
Increment the lock count.
Definition: gdal_priv.h:1011
GDALDataset::CreateMaskBand
virtual CPLErr CreateMaskBand(int nFlagsIn)
Adds a mask band to the dataset.
Definition: gdaldataset.cpp:3179
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:3279
OGRFieldDomain
Definition of a field domain.
Definition: ogr_feature.h:1341
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:2066
GDALDimension::GetSize
GUInt64 GetSize() const
Return the size, that is the number of values along the dimension.
Definition: gdal_priv.h:3080
GDALAccess
GDALAccess
Definition: gdal.h:124
end
OGRLayer::FeatureIterator end(OGRLayer *poLayer)
Return end of feature iterator.
Definition: ogrsf_frmts.h:372
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:2204
GDALDriver::FromHandle
static GDALDriver * FromHandle(GDALDriverH hDriver)
Convert a GDALDriverH to a GDALDriver*.
Definition: gdal_priv.h:1817
GDALRawResult::operator[]
const GByte & operator[](size_t idx) const
Return byte at specified index.
Definition: gdal_priv.h:2548
GDAL_IDENTIFY_TRUE
@ GDAL_IDENTIFY_TRUE
Identify determined the file is recognized by the probed driver.
Definition: gdal_priv.h:1675
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:3237
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:8813
GDALAsyncReader::GetXSize
int GetXSize() const
Return width.
Definition: gdal_priv.h:1945
GDALRasterBlock::GetDirty
int GetDirty() const
Return the dirty flag.
Definition: gdal_priv.h:1062
GIntBig
long long GIntBig
Large signed integer type (generally 64-bit integer type).
Definition: cpl_port.h:235
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:3301
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:3312
GDALDataset::Layers::Iterator::pointer
void pointer
pointer
Definition: gdal_priv.h:769
GDALAsyncReader::GetBufferXSize
int GetBufferXSize() const
Return buffer width.
Definition: gdal_priv.h:1966
GDALOpenInfo::nHeaderBytes
int nHeaderBytes
Number of bytes in pabyHeader.
Definition: gdal_priv.h:306
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:1809
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:1506
GDALRasterBlock::GetYOff
int GetYOff() const
Return the y offset of the top-left corner of the block.
Definition: gdal_priv.h:1041
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:985
GDALDataset::GetAccess
GDALAccess GetAccess() const
Return access mode.
Definition: gdal_priv.h:631
GDALRelationship::SetMappingTableName
void SetMappingTableName(const std::string &osName)
Sets the name of the mapping table for many-to-many relationships.
Definition: gdal_priv.h:3246
OGRFeature
A simple feature, including geometry and attributes.
Definition: ogr_feature.h:669
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:3206
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:3323
GDALDataset::Features
Class returned by GetFeatures() that act as a container for vector features.
Definition: gdal_priv.h:814
GDALRelationship::ToHandle
static GDALRelationshipH ToHandle(GDALRelationship *poRelationship)
Convert a GDALRelationship* to a GDALRelationshipH.
Definition: gdal_priv.h:3470
GDALSuggestedBlockAccessPattern
int GDALSuggestedBlockAccessPattern
Suggested/most efficient access pattern to blocks.
Definition: gdal_priv.h:1249
GDALDataset::BuildOverviews
CPLErr BuildOverviews(const char *, int, const int *, int, const int *, GDALProgressFunc, void *, CSLConstList papszOptions)
Build raster overview(s)
Definition: gdaldataset.cpp:1977
GDALMajorObject
Object with metadata.
Definition: gdal_priv.h:137
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:1993
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:206
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:2586
GDALEDTComponent::GetType
const GDALExtendedDataType & GetType() const
Return the data type of the component.
Definition: gdal_priv.h:2213
GDALOpenInfo::pszFilename
char * pszFilename
Filename.
Definition: gdal_priv.h:288
GDALColorTable::FromHandle
static GDALColorTable * FromHandle(GDALColorTableH hCT)
Convert a GDALColorTableH to a GDALColorTable*.
Definition: gdal_priv.h:1154
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:962
GDALRasterBand::GetMaskFlags
virtual int GetMaskFlags()
Return the status flags of the mask band associated with the band.
Definition: gdalrasterband.cpp:7343
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:1931
GDALExtendedDataType::GetMaxStringLength
size_t GetMaxStringLength() const
Return the maximum length of a string in bytes.
Definition: gdal_priv.h:2135
GDALRelationshipCardinality
GDALRelationshipCardinality
Cardinality of relationship.
Definition: gdal.h:1888
GDALRasterBlock::GetBand
GDALRasterBand * GetBand()
Accessor to source GDALRasterBand object.
Definition: gdal_priv.h:1087
GDALDataset::Layers
Class returned by GetLayers() that acts as a range of layers.
Definition: gdal_priv.h:747
GDALRasterBlock::GetXOff
int GetXOff() const
Return the x offset of the top-left corner of the block.
Definition: gdal_priv.h:1034
GDALRasterBlock::GetDataType
GDALDataType GetDataType() const
Return the data type.
Definition: gdal_priv.h:1027
GDALDataset::FromHandle
static GDALDataset * FromHandle(GDALDatasetH hDS)
Convert a GDALDatasetH to a GDALDataset*.
Definition: gdal_priv.h:692
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:8497
GDALMajorObject::ToHandle
static GDALMajorObjectH ToHandle(GDALMajorObject *poMajorObject)
Convert a GDALMajorObject* to a GDALMajorObjectH.
Definition: gdal_priv.h:173
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:2293
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:3335
wkbUnknown
@ wkbUnknown
unknown type, non-standard
Definition: ogr_core.h:408
GDALAsyncReader::GetBuffer
void * GetBuffer()
Return buffer.
Definition: gdal_priv.h:1959
GDALExtendedDataType::GetName
const std::string & GetName() const
Return type name.
Definition: gdal_priv.h:2075
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:1051
GDALEDTComponent::GetName
const std::string & GetName() const
Return the name.
Definition: gdal_priv.h:2195
GDALRasterBlock::GetXSize
int GetXSize() const
Return the width of the block.
Definition: gdal_priv.h:1048
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:1514
GDALColorTable
A color table / palette.
Definition: gdal_priv.h:1120
GDALAsyncReader::GetBandMap
int * GetBandMap()
Return band map.
Definition: gdal_priv.h:1994
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:1258
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:3448
GDALRelationshipType
GDALRelationshipType
Type of relationship.
Definition: gdal.h:1904