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/* -------------------------------------------------------------------- */
45class GDALMajorObject;
46class GDALDataset;
47class GDALRasterBand;
48class GDALDriver;
50class GDALProxyDataset;
51class GDALProxyRasterBand;
52class GDALAsyncReader;
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
91
92/************************************************************************/
93/* GDALMultiDomainMetadata */
94/************************************************************************/
95
97class 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
137class 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,
149
150 public:
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
192class 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
276class 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
291
296
301
304
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:
320};
321
322/* ******************************************************************** */
323/* GDALDataset */
324/* ******************************************************************** */
325
326class OGRLayer;
327class OGRGeometry;
329class OGRStyleTable;
330class swq_select;
331class swq_select_parse_options;
332class GDALGroup;
333
335typedef 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
345
347class 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 void 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 int nOpenFlags = 0;
379
380 int nRefCount = 1;
381 bool bForceCachedIO = false;
382 bool bShared = false;
383 bool bIsInternal = true;
384 bool bSuppressOnClose = false;
385
386 mutable std::map<std::string, std::unique_ptr<OGRFieldDomain>>
387 m_oMapFieldDomains{};
388
389 GDALDataset(void);
390 explicit GDALDataset(int bForceCachedIO);
391
392 void RasterInitialize(int, int);
393 void SetBand(int, GDALRasterBand *);
394
395 GDALDefaultOverviews oOvManager{};
396
397 virtual CPLErr IBuildOverviews(const char *, int, const int *, int,
398 const int *, GDALProgressFunc, void *,
399 CSLConstList papszOptions);
400
401 virtual CPLErr
402 IRasterIO(GDALRWFlag, int, int, int, int, void *, int, int, GDALDataType,
403 int, int *, GSpacing, GSpacing, GSpacing,
405
406 CPLErr
407 BlockBasedRasterIO(GDALRWFlag, int, int, int, int, void *, int, int,
408 GDALDataType, int, int *, GSpacing, GSpacing, GSpacing,
410 void BlockBasedFlushCache(bool bAtClosing);
411
412 CPLErr
413 BandBasedRasterIO(GDALRWFlag eRWFlag, int nXOff, int nYOff, int nXSize,
414 int nYSize, void *pData, int nBufXSize, int nBufYSize,
415 GDALDataType eBufType, int nBandCount, int *panBandMap,
416 GSpacing nPixelSpace, GSpacing nLineSpace,
417 GSpacing nBandSpace,
419
420 CPLErr
421 RasterIOResampled(GDALRWFlag eRWFlag, int nXOff, int nYOff, int nXSize,
422 int nYSize, void *pData, int nBufXSize, int nBufYSize,
423 GDALDataType eBufType, int nBandCount, int *panBandMap,
424 GSpacing nPixelSpace, GSpacing nLineSpace,
425 GSpacing nBandSpace,
427
428 CPLErr ValidateRasterIOOrAdviseReadParameters(
429 const char *pszCallingFunc, int *pbStopProcessingOnCENone, int nXOff,
430 int nYOff, int nXSize, int nYSize, int nBufXSize, int nBufYSize,
431 int nBandCount, int *panBandMap);
432
433 CPLErr TryOverviewRasterIO(GDALRWFlag eRWFlag, int nXOff, int nYOff,
434 int nXSize, int nYSize, void *pData,
435 int nBufXSize, int nBufYSize,
436 GDALDataType eBufType, int nBandCount,
437 int *panBandMap, GSpacing nPixelSpace,
438 GSpacing nLineSpace, GSpacing nBandSpace,
439 GDALRasterIOExtraArg *psExtraArg, int *pbTried);
440
441 void ShareLockWithParentDataset(GDALDataset *poParentDataset);
442
444
445 void CleanupPostFileClosing();
446
447 virtual int CloseDependentDatasets();
449 int ValidateLayerCreationOptions(const char *const *papszLCO);
450
451 char **papszOpenOptions = nullptr;
452
453 friend class GDALRasterBand;
454
455 // The below methods related to read write mutex are fragile logic, and
456 // should not be used by out-of-tree code if possible.
457 int EnterReadWrite(GDALRWFlag eRWFlag);
458 void LeaveReadWrite();
459 void InitRWLock();
460
461 void TemporarilyDropReadWriteLock();
462 void ReacquireReadWriteLock();
463
464 void DisableReadWriteMutex();
465
466 int AcquireMutex();
467 void ReleaseMutex();
469
470 public:
471 ~GDALDataset() override;
472
473 int GetRasterXSize();
474 int GetRasterYSize();
475 int GetRasterCount();
476 GDALRasterBand *GetRasterBand(int);
477
480 class CPL_DLL Bands
481 {
482 private:
483 friend class GDALDataset;
484 GDALDataset *m_poSelf;
485 CPL_INTERNAL explicit Bands(GDALDataset *poSelf) : m_poSelf(poSelf)
486 {
487 }
488
489 class CPL_DLL Iterator
490 {
491 struct Private;
492 std::unique_ptr<Private> m_poPrivate;
493
494 public:
495 Iterator(GDALDataset *poDS, bool bStart);
496 Iterator(const Iterator &oOther); // declared but not defined.
497 // Needed for gcc 5.4 at least
498 Iterator(Iterator &&oOther) noexcept; // declared but not defined.
499 // Needed for gcc 5.4 at least
500 ~Iterator();
501 GDALRasterBand *operator*();
502 Iterator &operator++();
503 bool operator!=(const Iterator &it) const;
504 };
505
506 public:
507 const Iterator begin() const;
508
509 const Iterator end() const;
510
511 size_t size() const;
512
513 GDALRasterBand *operator[](int iBand);
514 GDALRasterBand *operator[](size_t iBand);
515 };
516
517 Bands GetBands();
518
519 virtual void FlushCache(bool bAtClosing = false);
520
521 virtual const OGRSpatialReference *GetSpatialRef() const;
522 virtual CPLErr SetSpatialRef(const OGRSpatialReference *poSRS);
523
524 // Compatibility layer
525 const char *GetProjectionRef(void) const;
526 CPLErr SetProjection(const char *pszProjection);
527
528 virtual CPLErr GetGeoTransform(double *padfTransform);
529 virtual CPLErr SetGeoTransform(double *padfTransform);
530
531 virtual CPLErr AddBand(GDALDataType eType, char **papszOptions = nullptr);
532
533 virtual void *GetInternalHandle(const char *pszHandleName);
534 virtual GDALDriver *GetDriver(void);
535 virtual char **GetFileList(void);
536
537 virtual const char *GetDriverName();
538
539 virtual const OGRSpatialReference *GetGCPSpatialRef() const;
540 virtual int GetGCPCount();
541 virtual const GDAL_GCP *GetGCPs();
542 virtual CPLErr SetGCPs(int nGCPCount, const GDAL_GCP *pasGCPList,
543 const OGRSpatialReference *poGCP_SRS);
544
545 // Compatibility layer
546 const char *GetGCPProjection();
547 CPLErr SetGCPs(int nGCPCount, const GDAL_GCP *pasGCPList,
548 const char *pszGCPProjection);
549
550 virtual CPLErr AdviseRead(int nXOff, int nYOff, int nXSize, int nYSize,
551 int nBufXSize, int nBufYSize, GDALDataType eDT,
552 int nBandCount, int *panBandList,
553 char **papszOptions);
554
555 virtual CPLErr CreateMaskBand(int nFlagsIn);
556
557 virtual GDALAsyncReader *
558 BeginAsyncReader(int nXOff, int nYOff, int nXSize, int nYSize, void *pBuf,
559 int nBufXSize, int nBufYSize, GDALDataType eBufType,
560 int nBandCount, int *panBandMap, int nPixelSpace,
561 int nLineSpace, int nBandSpace, char **papszOptions);
562 virtual void EndAsyncReader(GDALAsyncReader *);
563
565 struct RawBinaryLayout
566 {
567 enum class Interleaving
568 {
569 UNKNOWN,
570 BIP,
571 BIL,
572 BSQ
573 };
574 std::string osRawFilename{};
575 Interleaving eInterleaving = Interleaving::UNKNOWN;
576 GDALDataType eDataType = GDT_Unknown;
577 bool bLittleEndianOrder = false;
578
579 vsi_l_offset nImageOffset = 0;
580 GIntBig nPixelOffset = 0;
581 GIntBig nLineOffset = 0;
582 GIntBig nBandOffset = 0;
583 };
584
585 virtual bool GetRawBinaryLayout(RawBinaryLayout &);
587
588 CPLErr RasterIO(GDALRWFlag, int, int, int, int, void *, int, int,
589 GDALDataType, int, int *, GSpacing, GSpacing, GSpacing,
590 GDALRasterIOExtraArg *psExtraArg
591#ifndef DOXYGEN_SKIP
592 OPTIONAL_OUTSIDE_GDAL(nullptr)
593#endif
595
596 int Reference();
597 int Dereference();
598 int ReleaseRef();
599
604 {
605 return eAccess;
606 }
607
608 int GetShared() const;
609 void MarkAsShared();
610
611 void MarkSuppressOnClose();
612
617 {
618 return papszOpenOptions;
619 }
620
621 static GDALDataset **GetOpenDatasets(int *pnDatasetCount);
622
623 CPLErr BuildOverviews(const char *, int, const int *, int, const int *,
624 GDALProgressFunc, void *,
625 CSLConstList papszOptions
626#ifndef DOXYGEN_SKIP
627 OPTIONAL_OUTSIDE_GDAL(nullptr)
628#endif
629 );
630
631#ifndef DOXYGEN_XML
632 void ReportError(CPLErr eErrClass, CPLErrorNum err_no, const char *fmt, ...)
634
635 static void ReportError(const char *pszDSName, CPLErr eErrClass,
636 CPLErrorNum err_no, const char *fmt, ...)
638#endif
639
640 char **GetMetadata(const char *pszDomain = "") override;
641
642// Only defined when Doxygen enabled
643#ifdef DOXYGEN_SKIP
644 CPLErr SetMetadata(char **papszMetadata, const char *pszDomain) override;
645 CPLErr SetMetadataItem(const char *pszName, const char *pszValue,
646 const char *pszDomain) override;
647#endif
648
649 char **GetMetadataDomainList() override;
650
651 virtual void ClearStatistics();
652
656 static inline GDALDatasetH ToHandle(GDALDataset *poDS)
657 {
658 return static_cast<GDALDatasetH>(poDS);
659 }
660
665 {
666 return static_cast<GDALDataset *>(hDS);
667 }
668
672 static GDALDataset *Open(const char *pszFilename,
673 unsigned int nOpenFlags = 0,
674 const char *const *papszAllowedDrivers = nullptr,
675 const char *const *papszOpenOptions = nullptr,
676 const char *const *papszSiblingFiles = nullptr)
677 {
678 return FromHandle(GDALOpenEx(pszFilename, nOpenFlags,
679 papszAllowedDrivers, papszOpenOptions,
680 papszSiblingFiles));
681 }
682
685 {
688
690 OGRLayer *layer = nullptr;
691 };
692
694 // SetEnableOverviews() only to be used by GDALOverviewDataset
695 void SetEnableOverviews(bool bEnable);
696
697 // Only to be used by driver's GetOverviewCount() method.
698 bool AreOverviewsEnabled() const;
700
701 private:
702 class Private;
703 Private *m_poPrivate;
704
705 CPL_INTERNAL OGRLayer *BuildLayerFromSelectInfo(
706 swq_select *psSelectInfo, OGRGeometry *poSpatialFilter,
707 const char *pszDialect, swq_select_parse_options *poSelectParseOptions);
708 CPLStringList oDerivedMetadataList{};
709
710 public:
711 virtual int GetLayerCount();
712 virtual OGRLayer *GetLayer(int iLayer);
713
714 virtual bool IsLayerPrivate(int iLayer) const;
715
719 class CPL_DLL Layers
720 {
721 private:
722 friend class GDALDataset;
723 GDALDataset *m_poSelf;
724 CPL_INTERNAL explicit Layers(GDALDataset *poSelf) : m_poSelf(poSelf)
725 {
726 }
727
728 public:
732 class CPL_DLL Iterator
733 {
734 struct Private;
735 std::unique_ptr<Private> m_poPrivate;
736
737 public:
739 using reference = OGRLayer *;
740 using difference_type = void;
741 using pointer = void;
743 std::input_iterator_tag;
745 Iterator();
746 Iterator(GDALDataset *poDS, bool bStart);
747 Iterator(const Iterator &oOther);
748 Iterator(Iterator &&oOther) noexcept;
751 Iterator &
752 operator=(const Iterator &oOther);
753 Iterator &operator=(
754 Iterator &&oOther) noexcept;
756 OGRLayer *operator*() const;
757 Iterator &operator++();
758 Iterator operator++(int);
759 bool operator!=(const Iterator &it)
760 const;
761 };
762
763 Iterator begin() const;
764 Iterator end() const;
765
766 size_t size() const;
767
768 OGRLayer *operator[](int iLayer);
769 OGRLayer *operator[](size_t iLayer);
770 OGRLayer *operator[](const char *pszLayername);
771 };
772
773 Layers GetLayers();
774
775 virtual OGRLayer *GetLayerByName(const char *);
776 virtual OGRErr DeleteLayer(int iLayer);
777
778 virtual void ResetReading();
779 virtual OGRFeature *GetNextFeature(OGRLayer **ppoBelongingLayer,
780 double *pdfProgressPct,
781 GDALProgressFunc pfnProgress,
782 void *pProgressData);
783
786 class CPL_DLL Features
787 {
788 private:
789 friend class GDALDataset;
790 GDALDataset *m_poSelf;
791 CPL_INTERNAL explicit Features(GDALDataset *poSelf) : m_poSelf(poSelf)
792 {
793 }
794
795 class CPL_DLL Iterator
796 {
797 struct Private;
798 std::unique_ptr<Private> m_poPrivate;
799
800 public:
801 Iterator(GDALDataset *poDS, bool bStart);
802 Iterator(const Iterator &oOther); // declared but not defined.
803 // Needed for gcc 5.4 at least
804 Iterator(Iterator &&oOther) noexcept; // declared but not defined.
805 // Needed for gcc 5.4 at least
806 ~Iterator();
807 const FeatureLayerPair &operator*() const;
808 Iterator &operator++();
809 bool operator!=(const Iterator &it) const;
810 };
811
812 public:
813 const Iterator begin() const;
814
815 const Iterator end() const;
816 };
817
818 Features GetFeatures();
819
820 virtual int TestCapability(const char *);
821
822 virtual std::vector<std::string>
823 GetFieldDomainNames(CSLConstList papszOptions = nullptr) const;
824
825 virtual const OGRFieldDomain *GetFieldDomain(const std::string &name) const;
826
827 virtual bool AddFieldDomain(std::unique_ptr<OGRFieldDomain> &&domain,
828 std::string &failureReason);
829
830 virtual bool DeleteFieldDomain(const std::string &name,
831 std::string &failureReason);
832
833 virtual bool UpdateFieldDomain(std::unique_ptr<OGRFieldDomain> &&domain,
834 std::string &failureReason);
835
836 virtual std::vector<std::string>
837 GetRelationshipNames(CSLConstList papszOptions = nullptr) const;
838
839 virtual const GDALRelationship *
840 GetRelationship(const std::string &name) const;
841
842 virtual bool
843 AddRelationship(std::unique_ptr<GDALRelationship> &&relationship,
844 std::string &failureReason);
845
846 virtual bool DeleteRelationship(const std::string &name,
847 std::string &failureReason);
848
849 virtual bool
850 UpdateRelationship(std::unique_ptr<GDALRelationship> &&relationship,
851 std::string &failureReason);
852
853 virtual OGRLayer *CreateLayer(const char *pszName,
854 OGRSpatialReference *poSpatialRef = nullptr,
856 char **papszOptions = nullptr);
857 virtual OGRLayer *CopyLayer(OGRLayer *poSrcLayer, const char *pszNewName,
858 char **papszOptions = nullptr);
859
860 virtual OGRStyleTable *GetStyleTable();
861 virtual void SetStyleTableDirectly(OGRStyleTable *poStyleTable);
862
863 virtual void SetStyleTable(OGRStyleTable *poStyleTable);
864
865 virtual OGRLayer *ExecuteSQL(const char *pszStatement,
866 OGRGeometry *poSpatialFilter,
867 const char *pszDialect);
868 virtual void ReleaseResultSet(OGRLayer *poResultsSet);
869 virtual OGRErr AbortSQL();
870
871 int GetRefCount() const;
872 int GetSummaryRefCount() const;
873 OGRErr Release();
874
875 virtual OGRErr StartTransaction(int bForce = FALSE);
876 virtual OGRErr CommitTransaction();
877 virtual OGRErr RollbackTransaction();
878
879 virtual std::shared_ptr<GDALGroup> GetRootGroup() const;
880
882 static int IsGenericSQLDialect(const char *pszDialect);
883
884 // Semi-public methods. Only to be used by in-tree drivers.
885 GDALSQLParseInfo *
886 BuildParseInfo(swq_select *psSelectInfo,
887 swq_select_parse_options *poSelectParseOptions);
888 static void DestroyParseInfo(GDALSQLParseInfo *psParseInfo);
889 OGRLayer *ExecuteSQL(const char *pszStatement, OGRGeometry *poSpatialFilter,
890 const char *pszDialect,
891 swq_select_parse_options *poSelectParseOptions);
893
894 protected:
895 virtual OGRLayer *ICreateLayer(const char *pszName,
896 OGRSpatialReference *poSpatialRef = nullptr,
898 char **papszOptions = nullptr);
899
901 OGRErr ProcessSQLCreateIndex(const char *);
902 OGRErr ProcessSQLDropIndex(const char *);
903 OGRErr ProcessSQLDropTable(const char *);
904 OGRErr ProcessSQLAlterTableAddColumn(const char *);
905 OGRErr ProcessSQLAlterTableDropColumn(const char *);
906 OGRErr ProcessSQLAlterTableAlterColumn(const char *);
907 OGRErr ProcessSQLAlterTableRenameColumn(const char *);
908
909 OGRStyleTable *m_poStyleTable = nullptr;
910
911 friend class GDALProxyPoolDataset;
913
914 private:
916};
917
919struct CPL_DLL GDALDatasetUniquePtrDeleter
920{
921 void operator()(GDALDataset *poDataset) const
922 {
923 GDALClose(poDataset);
924 }
925};
927
934 std::unique_ptr<GDALDataset, GDALDatasetUniquePtrDeleter>;
935
936/* ******************************************************************** */
937/* GDALRasterBlock */
938/* ******************************************************************** */
939
944class CPL_DLL GDALRasterBlock
945{
946 friend class GDALAbstractBandBlockCache;
947
948 GDALDataType eType;
949
950 bool bDirty;
951 volatile int nLockCount;
952
953 int nXOff;
954 int nYOff;
955
956 int nXSize;
957 int nYSize;
958
959 void *pData;
960
961 GDALRasterBand *poBand;
962
963 GDALRasterBlock *poNext;
964 GDALRasterBlock *poPrevious;
965
966 bool bMustDetach;
967
968 CPL_INTERNAL void Detach_unlocked(void);
969 CPL_INTERNAL void Touch_unlocked(void);
970
971 CPL_INTERNAL void RecycleFor(int nXOffIn, int nYOffIn);
972
973 public:
974 GDALRasterBlock(GDALRasterBand *, int, int);
975 GDALRasterBlock(int nXOffIn, int nYOffIn); /* only for lookup purpose */
976 virtual ~GDALRasterBlock();
977
978 CPLErr Internalize(void);
979 void Touch(void);
980 void MarkDirty(void);
981 void MarkClean(void);
983 int AddLock(void)
984 {
985 return CPLAtomicInc(&nLockCount);
986 }
988 int DropLock(void)
989 {
990 return CPLAtomicDec(&nLockCount);
991 }
992 void Detach();
993
994 CPLErr Write();
995
1000 {
1001 return eType;
1002 }
1006 int GetXOff() const
1007 {
1008 return nXOff;
1009 }
1013 int GetYOff() const
1014 {
1015 return nYOff;
1016 }
1020 int GetXSize() const
1021 {
1022 return nXSize;
1023 }
1027 int GetYSize() const
1028 {
1029 return nYSize;
1030 }
1034 int GetDirty() const
1035 {
1036 return bDirty;
1037 }
1041 void *GetDataRef(void)
1042 {
1043 return pData;
1044 }
1049 {
1050 return static_cast<GPtrDiff_t>(nXSize) * nYSize *
1052 }
1053
1054 int TakeLock();
1055 int DropLockForRemovalFromStorage();
1056
1060 {
1061 return poBand;
1062 }
1063
1064 static void FlushDirtyBlocks();
1065 static int FlushCacheBlock(int bDirtyBlocksOnly = FALSE);
1066 static void Verify();
1067
1068 static void EnterDisableDirtyBlockFlush();
1069 static void LeaveDisableDirtyBlockFlush();
1070
1071#ifdef notdef
1072 static void CheckNonOrphanedBlocks(GDALRasterBand *poBand);
1073 void DumpBlock();
1074 static void DumpAll();
1075#endif
1076
1077 /* Should only be called by GDALDestroyDriverManager() */
1079 CPL_INTERNAL static void DestroyRBMutex();
1081
1082 private:
1084};
1085
1086/* ******************************************************************** */
1087/* GDALColorTable */
1088/* ******************************************************************** */
1089
1092class CPL_DLL GDALColorTable
1093{
1094 GDALPaletteInterp eInterp;
1095
1096 std::vector<GDALColorEntry> aoEntries{};
1097
1098 public:
1101
1102 GDALColorTable *Clone() const;
1103 int IsSame(const GDALColorTable *poOtherCT) const;
1104
1105 GDALPaletteInterp GetPaletteInterpretation() const;
1106
1107 int GetColorEntryCount() const;
1108 const GDALColorEntry *GetColorEntry(int) const;
1109 int GetColorEntryAsRGB(int, GDALColorEntry *) const;
1110 void SetColorEntry(int, const GDALColorEntry *);
1111 int CreateColorRamp(int, const GDALColorEntry *, int,
1112 const GDALColorEntry *);
1113 bool IsIdentity() const;
1114
1119 {
1120 return static_cast<GDALColorTableH>(poCT);
1121 }
1122
1127 {
1128 return static_cast<GDALColorTable *>(hCT);
1129 }
1130};
1131
1132/* ******************************************************************** */
1133/* GDALAbstractBandBlockCache */
1134/* ******************************************************************** */
1135
1137
1139// only used by GDALRasterBand implementation.
1140
1141class GDALAbstractBandBlockCache
1142{
1143 // List of blocks that can be freed or recycled, and its lock
1144 CPLLock *hSpinLock = nullptr;
1145 GDALRasterBlock *psListBlocksToFree = nullptr;
1146
1147 // Band keep alive counter, and its lock & condition
1148 CPLCond *hCond = nullptr;
1149 CPLMutex *hCondMutex = nullptr;
1150 volatile int nKeepAliveCounter = 0;
1151
1152 volatile int m_nDirtyBlocks = 0;
1153
1154 CPL_DISALLOW_COPY_ASSIGN(GDALAbstractBandBlockCache)
1155
1156 protected:
1157 GDALRasterBand *poBand;
1158
1159 int m_nInitialDirtyBlocksInFlushCache = 0;
1160 int m_nLastTick = -1;
1161 bool m_bWriteDirtyBlocks = true;
1162
1163 void FreeDanglingBlocks();
1164 void UnreferenceBlockBase();
1165
1166 void StartDirtyBlockFlushingLog();
1167 void UpdateDirtyBlockFlushingLog();
1168 void EndDirtyBlockFlushingLog();
1169
1170 public:
1171 explicit GDALAbstractBandBlockCache(GDALRasterBand *poBand);
1172 virtual ~GDALAbstractBandBlockCache();
1173
1174 GDALRasterBlock *CreateBlock(int nXBlockOff, int nYBlockOff);
1175 void AddBlockToFreeList(GDALRasterBlock *);
1176 void IncDirtyBlocks(int nInc);
1177 void WaitCompletionPendingTasks();
1178 void DisableDirtyBlockWriting()
1179 {
1180 m_bWriteDirtyBlocks = false;
1181 }
1182
1183 virtual bool Init() = 0;
1184 virtual bool IsInitOK() = 0;
1185 virtual CPLErr FlushCache() = 0;
1186 virtual CPLErr AdoptBlock(GDALRasterBlock *poBlock) = 0;
1187 virtual GDALRasterBlock *TryGetLockedBlockRef(int nXBlockOff,
1188 int nYBlockYOff) = 0;
1189 virtual CPLErr UnreferenceBlock(GDALRasterBlock *poBlock) = 0;
1190 virtual CPLErr FlushBlock(int nXBlockOff, int nYBlockOff,
1191 int bWriteDirtyBlock) = 0;
1192};
1193
1194GDALAbstractBandBlockCache *
1195GDALArrayBandBlockCacheCreate(GDALRasterBand *poBand);
1196GDALAbstractBandBlockCache *
1197GDALHashSetBandBlockCacheCreate(GDALRasterBand *poBand);
1198
1200
1201/* ******************************************************************** */
1202/* GDALRasterBand */
1203/* ******************************************************************** */
1204
1205class GDALMDArray;
1206
1208typedef enum
1209{
1210 GMVR_UNKNOWN,
1215
1218
1221
1224
1227
1230
1234
1237class CPL_DLL GDALRasterBand : public GDALMajorObject
1238{
1239 private:
1240 friend class GDALArrayBandBlockCache;
1241 friend class GDALHashSetBandBlockCache;
1242 friend class GDALRasterBlock;
1243 friend class GDALDataset;
1244
1245 CPLErr eFlushBlockErr = CE_None;
1246 GDALAbstractBandBlockCache *poBandBlockCache = nullptr;
1247
1248 CPL_INTERNAL void SetFlushBlockErr(CPLErr eErr);
1249 CPL_INTERNAL CPLErr UnreferenceBlock(GDALRasterBlock *poBlock);
1250 CPL_INTERNAL void IncDirtyBlocks(int nInc);
1251
1252 protected:
1254 GDALDataset *poDS = nullptr;
1255 int nBand = 0; /* 1 based */
1256
1257 int nRasterXSize = 0;
1258 int nRasterYSize = 0;
1259
1260 GDALDataType eDataType = GDT_Byte;
1261 GDALAccess eAccess = GA_ReadOnly;
1262
1263 /* stuff related to blocking, and raster cache */
1264 int nBlockXSize = -1;
1265 int nBlockYSize = -1;
1266 int nBlocksPerRow = 0;
1267 int nBlocksPerColumn = 0;
1268
1269 int nBlockReads = 0;
1270 int bForceCachedIO = 0;
1271
1272 GDALRasterBand *poMask = nullptr;
1273 bool bOwnMask = false;
1274 int nMaskFlags = 0;
1275
1276 void InvalidateMaskBand();
1277
1278 friend class GDALProxyRasterBand;
1279 friend class GDALDefaultOverviews;
1280
1281 CPLErr
1282 RasterIOResampled(GDALRWFlag, int, int, int, int, void *, int, int,
1285
1286 int EnterReadWrite(GDALRWFlag eRWFlag);
1287 void LeaveReadWrite();
1288 void InitRWLock();
1289 void SetValidPercent(GUIntBig nSampleCount, GUIntBig nValidCount);
1291
1292 protected:
1293 virtual CPLErr IReadBlock(int nBlockXOff, int nBlockYOff, void *pData) = 0;
1294 virtual CPLErr IWriteBlock(int nBlockXOff, int nBlockYOff, void *pData);
1295
1296 virtual CPLErr
1297 IRasterIO(GDALRWFlag, int, int, int, int, void *, int, int, GDALDataType,
1300
1301 virtual int IGetDataCoverageStatus(int nXOff, int nYOff, int nXSize,
1302 int nYSize, int nMaskFlagStop,
1303 double *pdfDataPct);
1305 CPLErr
1306 OverviewRasterIO(GDALRWFlag, int, int, int, int, void *, int, int,
1309
1310 CPLErr TryOverviewRasterIO(GDALRWFlag eRWFlag, int nXOff, int nYOff,
1311 int nXSize, int nYSize, void *pData,
1312 int nBufXSize, int nBufYSize,
1313 GDALDataType eBufType, GSpacing nPixelSpace,
1314 GSpacing nLineSpace,
1315 GDALRasterIOExtraArg *psExtraArg, int *pbTried);
1316
1317 int InitBlockInfo();
1318
1319 void AddBlockToFreeList(GDALRasterBlock *);
1321
1322 public:
1324 explicit GDALRasterBand(int bForceCachedIO);
1325
1326 ~GDALRasterBand() override;
1327
1328 int GetXSize();
1329 int GetYSize();
1330 int GetBand();
1331 GDALDataset *GetDataset();
1332
1333 GDALDataType GetRasterDataType(void);
1334 void GetBlockSize(int *, int *);
1335 CPLErr GetActualBlockSize(int, int, int *, int *);
1336
1338 GetSuggestedBlockAccessPattern() const;
1339
1340 GDALAccess GetAccess();
1341
1342 CPLErr RasterIO(GDALRWFlag, int, int, int, int, void *, int, int,
1344 GDALRasterIOExtraArg *psExtraArg
1345#ifndef DOXYGEN_SKIP
1346 OPTIONAL_OUTSIDE_GDAL(nullptr)
1347#endif
1349 CPLErr ReadBlock(int, int, void *) CPL_WARN_UNUSED_RESULT;
1350
1351 CPLErr WriteBlock(int, int, void *) CPL_WARN_UNUSED_RESULT;
1352
1354 GetLockedBlockRef(int nXBlockOff, int nYBlockOff,
1355 int bJustInitialize = FALSE) CPL_WARN_UNUSED_RESULT;
1356 GDALRasterBlock *TryGetLockedBlockRef(int nXBlockOff, int nYBlockYOff)
1358 CPLErr FlushBlock(int, int, int bWriteDirtyBlock = TRUE);
1359
1360 unsigned char *
1361 GetIndexColorTranslationTo(/* const */ GDALRasterBand *poReferenceBand,
1362 unsigned char *pTranslationTable = nullptr,
1363 int *pApproximateMatching = nullptr);
1364
1365 // New OpengIS CV_SampleDimension stuff.
1366
1367 virtual CPLErr FlushCache(bool bAtClosing = false);
1368 virtual char **GetCategoryNames();
1369 virtual double GetNoDataValue(int *pbSuccess = nullptr);
1370 virtual int64_t GetNoDataValueAsInt64(int *pbSuccess = nullptr);
1371 virtual uint64_t GetNoDataValueAsUInt64(int *pbSuccess = nullptr);
1372 virtual double GetMinimum(int *pbSuccess = nullptr);
1373 virtual double GetMaximum(int *pbSuccess = nullptr);
1374 virtual double GetOffset(int *pbSuccess = nullptr);
1375 virtual double GetScale(int *pbSuccess = nullptr);
1376 virtual const char *GetUnitType();
1377 virtual GDALColorInterp GetColorInterpretation();
1378 virtual GDALColorTable *GetColorTable();
1379 virtual CPLErr Fill(double dfRealValue, double dfImaginaryValue = 0);
1380
1381 virtual CPLErr SetCategoryNames(char **papszNames);
1382 virtual CPLErr SetNoDataValue(double dfNoData);
1383 virtual CPLErr SetNoDataValueAsInt64(int64_t nNoData);
1384 virtual CPLErr SetNoDataValueAsUInt64(uint64_t nNoData);
1385 virtual CPLErr DeleteNoDataValue();
1386 virtual CPLErr SetColorTable(GDALColorTable *poCT);
1387 virtual CPLErr SetColorInterpretation(GDALColorInterp eColorInterp);
1388 virtual CPLErr SetOffset(double dfNewOffset);
1389 virtual CPLErr SetScale(double dfNewScale);
1390 virtual CPLErr SetUnitType(const char *pszNewValue);
1391
1392 virtual CPLErr GetStatistics(int bApproxOK, int bForce, double *pdfMin,
1393 double *pdfMax, double *pdfMean,
1394 double *padfStdDev);
1395 virtual CPLErr ComputeStatistics(int bApproxOK, double *pdfMin,
1396 double *pdfMax, double *pdfMean,
1397 double *pdfStdDev, GDALProgressFunc,
1398 void *pProgressData);
1399 virtual CPLErr SetStatistics(double dfMin, double dfMax, double dfMean,
1400 double dfStdDev);
1401 virtual CPLErr ComputeRasterMinMax(int, double *);
1402
1403// Only defined when Doxygen enabled
1404#ifdef DOXYGEN_SKIP
1405 CPLErr SetMetadata(char **papszMetadata, const char *pszDomain) override;
1406 CPLErr SetMetadataItem(const char *pszName, const char *pszValue,
1407 const char *pszDomain) override;
1408#endif
1409
1410 virtual int HasArbitraryOverviews();
1411 virtual int GetOverviewCount();
1412 virtual GDALRasterBand *GetOverview(int);
1413 virtual GDALRasterBand *GetRasterSampleOverview(GUIntBig);
1414 virtual CPLErr BuildOverviews(const char *pszResampling, int nOverviews,
1415 const int *panOverviewList,
1416 GDALProgressFunc pfnProgress,
1417 void *pProgressData,
1418 CSLConstList papszOptions);
1419
1420 virtual CPLErr AdviseRead(int nXOff, int nYOff, int nXSize, int nYSize,
1421 int nBufXSize, int nBufYSize,
1422 GDALDataType eBufType, char **papszOptions);
1423
1424 virtual CPLErr GetHistogram(double dfMin, double dfMax, int nBuckets,
1425 GUIntBig *panHistogram, int bIncludeOutOfRange,
1426 int bApproxOK, GDALProgressFunc,
1427 void *pProgressData);
1428
1429 virtual CPLErr GetDefaultHistogram(double *pdfMin, double *pdfMax,
1430 int *pnBuckets, GUIntBig **ppanHistogram,
1431 int bForce, GDALProgressFunc,
1432 void *pProgressData);
1433 virtual CPLErr SetDefaultHistogram(double dfMin, double dfMax, int nBuckets,
1434 GUIntBig *panHistogram);
1435
1436 virtual GDALRasterAttributeTable *GetDefaultRAT();
1437 virtual CPLErr SetDefaultRAT(const GDALRasterAttributeTable *poRAT);
1438
1439 virtual GDALRasterBand *GetMaskBand();
1440 virtual int GetMaskFlags();
1441 virtual CPLErr CreateMaskBand(int nFlagsIn);
1442 virtual bool IsMaskBand() const;
1443 virtual GDALMaskValueRange GetMaskValueRange() const;
1444
1445 virtual CPLVirtualMem *
1446 GetVirtualMemAuto(GDALRWFlag eRWFlag, int *pnPixelSpace,
1447 GIntBig *pnLineSpace,
1448 char **papszOptions) CPL_WARN_UNUSED_RESULT;
1449
1450 int GetDataCoverageStatus(int nXOff, int nYOff, int nXSize, int nYSize,
1451 int nMaskFlagStop = 0,
1452 double *pdfDataPct = nullptr);
1453
1454 std::shared_ptr<GDALMDArray> AsMDArray() const;
1455
1456#ifndef DOXYGEN_XML
1457 void ReportError(CPLErr eErrClass, CPLErrorNum err_no, const char *fmt, ...)
1459#endif
1460
1465 {
1466 return static_cast<GDALRasterBandH>(poBand);
1467 }
1468
1473 {
1474 return static_cast<GDALRasterBand *>(hBand);
1475 }
1476
1477 private:
1479};
1480
1482/* ******************************************************************** */
1483/* GDALAllValidMaskBand */
1484/* ******************************************************************** */
1485
1486class CPL_DLL GDALAllValidMaskBand : public GDALRasterBand
1487{
1488 protected:
1489 CPLErr IReadBlock(int, int, void *) override;
1490
1491 CPL_DISALLOW_COPY_ASSIGN(GDALAllValidMaskBand)
1492
1493 public:
1494 explicit GDALAllValidMaskBand(GDALRasterBand *);
1495 ~GDALAllValidMaskBand() override;
1496
1497 GDALRasterBand *GetMaskBand() override;
1498 int GetMaskFlags() override;
1499
1500 bool IsMaskBand() const override
1501 {
1502 return true;
1503 }
1504 GDALMaskValueRange GetMaskValueRange() const override
1505 {
1506 return GMVR_0_AND_255_ONLY;
1507 }
1508
1509 CPLErr ComputeStatistics(int bApproxOK, double *pdfMin, double *pdfMax,
1510 double *pdfMean, double *pdfStdDev,
1511 GDALProgressFunc, void *pProgressData) override;
1512};
1513
1514/* ******************************************************************** */
1515/* GDALNoDataMaskBand */
1516/* ******************************************************************** */
1517
1518class CPL_DLL GDALNoDataMaskBand : public GDALRasterBand
1519{
1520 friend class GDALRasterBand;
1521 double dfNoDataValue = 0;
1522 int64_t nNoDataValueInt64 = 0;
1523 uint64_t nNoDataValueUInt64 = 0;
1524 GDALRasterBand *poParent;
1525
1526 CPL_DISALLOW_COPY_ASSIGN(GDALNoDataMaskBand)
1527
1528 protected:
1529 CPLErr IReadBlock(int, int, void *) override;
1530 CPLErr IRasterIO(GDALRWFlag, int, int, int, int, void *, int, int,
1532 GDALRasterIOExtraArg *psExtraArg) override;
1533
1534 public:
1535 explicit GDALNoDataMaskBand(GDALRasterBand *);
1536 ~GDALNoDataMaskBand() override;
1537
1538 bool IsMaskBand() const override
1539 {
1540 return true;
1541 }
1542 GDALMaskValueRange GetMaskValueRange() const override
1543 {
1544 return GMVR_0_AND_255_ONLY;
1545 }
1546
1547 static bool IsNoDataInRange(double dfNoDataValue, GDALDataType eDataType);
1548};
1549
1550/* ******************************************************************** */
1551/* GDALNoDataValuesMaskBand */
1552/* ******************************************************************** */
1553
1554class CPL_DLL GDALNoDataValuesMaskBand : public GDALRasterBand
1555{
1556 double *padfNodataValues;
1557
1558 CPL_DISALLOW_COPY_ASSIGN(GDALNoDataValuesMaskBand)
1559
1560 protected:
1561 CPLErr IReadBlock(int, int, void *) override;
1562
1563 public:
1564 explicit GDALNoDataValuesMaskBand(GDALDataset *);
1565 ~GDALNoDataValuesMaskBand() override;
1566
1567 bool IsMaskBand() const override
1568 {
1569 return true;
1570 }
1571 GDALMaskValueRange GetMaskValueRange() const override
1572 {
1573 return GMVR_0_AND_255_ONLY;
1574 }
1575};
1576
1577/* ******************************************************************** */
1578/* GDALRescaledAlphaBand */
1579/* ******************************************************************** */
1580
1581class GDALRescaledAlphaBand : public GDALRasterBand
1582{
1583 GDALRasterBand *poParent;
1584 void *pTemp;
1585
1586 CPL_DISALLOW_COPY_ASSIGN(GDALRescaledAlphaBand)
1587
1588 protected:
1589 CPLErr IReadBlock(int, int, void *) override;
1590 CPLErr IRasterIO(GDALRWFlag, int, int, int, int, void *, int, int,
1592 GDALRasterIOExtraArg *psExtraArg) override;
1593
1594 public:
1595 explicit GDALRescaledAlphaBand(GDALRasterBand *);
1596 ~GDALRescaledAlphaBand() override;
1597
1598 bool IsMaskBand() const override
1599 {
1600 return true;
1601 }
1602};
1604
1605/* ******************************************************************** */
1606/* GDALIdentifyEnum */
1607/* ******************************************************************** */
1608
1624
1625/* ******************************************************************** */
1626/* GDALDriver */
1627/* ******************************************************************** */
1628
1640class CPL_DLL GDALDriver : public GDALMajorObject
1641{
1642 public:
1643 GDALDriver();
1644 ~GDALDriver() override;
1645
1646 CPLErr SetMetadataItem(const char *pszName, const char *pszValue,
1647 const char *pszDomain = "") override;
1648
1649 /* -------------------------------------------------------------------- */
1650 /* Public C++ methods. */
1651 /* -------------------------------------------------------------------- */
1652 GDALDataset *Create(const char *pszName, int nXSize, int nYSize, int nBands,
1653 GDALDataType eType,
1655
1656 GDALDataset *
1657 CreateMultiDimensional(const char *pszName,
1658 CSLConstList papszRootGroupOptions,
1660
1661 CPLErr Delete(const char *pszName);
1662 CPLErr Rename(const char *pszNewName, const char *pszOldName);
1663 CPLErr CopyFiles(const char *pszNewName, const char *pszOldName);
1664
1665 GDALDataset *CreateCopy(const char *, GDALDataset *, int,
1666 CSLConstList papszOptions,
1667 GDALProgressFunc pfnProgress,
1668 void *pProgressData) CPL_WARN_UNUSED_RESULT;
1669
1670 /* -------------------------------------------------------------------- */
1671 /* The following are semiprivate, not intended to be accessed */
1672 /* by anyone but the formats instantiating and populating the */
1673 /* drivers. */
1674 /* -------------------------------------------------------------------- */
1676 GDALDataset *(*pfnOpen)(GDALOpenInfo *);
1677
1678 GDALDataset *(*pfnCreate)(const char *pszName, int nXSize, int nYSize,
1679 int nBands, GDALDataType eType,
1680 char **papszOptions);
1681
1682 GDALDataset *(*pfnCreateEx)(GDALDriver *, const char *pszName, int nXSize,
1683 int nYSize, int nBands, GDALDataType eType,
1684 char **papszOptions);
1685
1686 GDALDataset *(*pfnCreateMultiDimensional)(
1687 const char *pszName, CSLConstList papszRootGroupOptions,
1688 CSLConstList papszOptions);
1689
1690 CPLErr (*pfnDelete)(const char *pszName);
1691
1692 GDALDataset *(*pfnCreateCopy)(const char *, GDALDataset *, int, char **,
1693 GDALProgressFunc pfnProgress,
1694 void *pProgressData);
1695
1696 void *pDriverData;
1697
1698 void (*pfnUnloadDriver)(GDALDriver *);
1699
1708 int (*pfnIdentify)(GDALOpenInfo *);
1709 int (*pfnIdentifyEx)(GDALDriver *, GDALOpenInfo *);
1710
1711 CPLErr (*pfnRename)(const char *pszNewName, const char *pszOldName);
1712 CPLErr (*pfnCopyFiles)(const char *pszNewName, const char *pszOldName);
1713
1714 // Used for legacy OGR drivers, and Python drivers
1715 GDALDataset *(*pfnOpenWithDriverArg)(GDALDriver *, GDALOpenInfo *);
1716
1717 /* For legacy OGR drivers */
1718 GDALDataset *(*pfnCreateVectorOnly)(GDALDriver *, const char *pszName,
1719 char **papszOptions);
1720 CPLErr (*pfnDeleteDataSource)(GDALDriver *, const char *pszName);
1722
1723 /* -------------------------------------------------------------------- */
1724 /* Helper methods. */
1725 /* -------------------------------------------------------------------- */
1727 GDALDataset *DefaultCreateCopy(const char *, GDALDataset *, int,
1728 CSLConstList papszOptions,
1729 GDALProgressFunc pfnProgress,
1730 void *pProgressData) CPL_WARN_UNUSED_RESULT;
1731
1732 static CPLErr DefaultCreateCopyMultiDimensional(
1733 GDALDataset *poSrcDS, GDALDataset *poDstDS, bool bStrict,
1734 CSLConstList /*papszOptions*/, GDALProgressFunc pfnProgress,
1735 void *pProgressData);
1736
1737 static CPLErr DefaultCopyMasks(GDALDataset *poSrcDS, GDALDataset *poDstDS,
1738 int bStrict);
1739 static CPLErr DefaultCopyMasks(GDALDataset *poSrcDS, GDALDataset *poDstDS,
1740 int bStrict, CSLConstList papszOptions,
1741 GDALProgressFunc pfnProgress,
1742 void *pProgressData);
1744 static CPLErr QuietDelete(const char *pszName,
1745 CSLConstList papszAllowedDrivers = nullptr);
1746
1748 static CPLErr DefaultRename(const char *pszNewName, const char *pszOldName);
1749 static CPLErr DefaultCopyFiles(const char *pszNewName,
1750 const char *pszOldName);
1752
1756 static inline GDALDriverH ToHandle(GDALDriver *poDriver)
1757 {
1758 return static_cast<GDALDriverH>(poDriver);
1759 }
1760
1764 static inline GDALDriver *FromHandle(GDALDriverH hDriver)
1765 {
1766 return static_cast<GDALDriver *>(hDriver);
1767 }
1768
1769 private:
1771};
1772
1773/* ******************************************************************** */
1774/* GDALDriverManager */
1775/* ******************************************************************** */
1776
1785{
1786 int nDrivers = 0;
1787 GDALDriver **papoDrivers = nullptr;
1788 std::map<CPLString, GDALDriver *> oMapNameToDrivers{};
1789 std::string m_osDriversIniPath{};
1790
1791 GDALDriver *GetDriver_unlocked(int iDriver)
1792 {
1793 return (iDriver >= 0 && iDriver < nDrivers) ? papoDrivers[iDriver]
1794 : nullptr;
1795 }
1796
1797 GDALDriver *GetDriverByName_unlocked(const char *pszName) const
1798 {
1799 auto oIter = oMapNameToDrivers.find(CPLString(pszName).toupper());
1800 return oIter == oMapNameToDrivers.end() ? nullptr : oIter->second;
1801 }
1802
1803 static char **GetSearchPaths(const char *pszGDAL_DRIVER_PATH);
1804
1805 static void CleanupPythonDrivers();
1806
1808
1809 public:
1812
1813 int GetDriverCount(void) const;
1814 GDALDriver *GetDriver(int);
1815 GDALDriver *GetDriverByName(const char *);
1816
1817 int RegisterDriver(GDALDriver *);
1818 void DeregisterDriver(GDALDriver *);
1819
1820 // AutoLoadDrivers is a no-op if compiled with GDAL_NO_AUTOLOAD defined.
1821 void AutoLoadDrivers();
1822 void AutoSkipDrivers();
1823 void ReorderDrivers();
1824
1825 static void AutoLoadPythonDrivers();
1826};
1827
1831
1832/* ******************************************************************** */
1833/* GDALAsyncReader */
1834/* ******************************************************************** */
1835
1841class CPL_DLL GDALAsyncReader
1842{
1843
1845
1846 protected:
1848 GDALDataset *poDS;
1849 int nXOff;
1850 int nYOff;
1851 int nXSize;
1852 int nYSize;
1853 void *pBuf;
1854 int nBufXSize;
1855 int nBufYSize;
1856 GDALDataType eBufType;
1857 int nBandCount;
1858 int *panBandMap;
1859 int nPixelSpace;
1860 int nLineSpace;
1861 int nBandSpace;
1863
1864 public:
1866 virtual ~GDALAsyncReader();
1867
1872 {
1873 return poDS;
1874 }
1878 int GetXOffset() const
1879 {
1880 return nXOff;
1881 }
1885 int GetYOffset() const
1886 {
1887 return nYOff;
1888 }
1892 int GetXSize() const
1893 {
1894 return nXSize;
1895 }
1899 int GetYSize() const
1900 {
1901 return nYSize;
1902 }
1907 {
1908 return pBuf;
1909 }
1913 int GetBufferXSize() const
1914 {
1915 return nBufXSize;
1916 }
1920 int GetBufferYSize() const
1921 {
1922 return nBufYSize;
1923 }
1928 {
1929 return eBufType;
1930 }
1934 int GetBandCount() const
1935 {
1936 return nBandCount;
1937 }
1942 {
1943 return panBandMap;
1944 }
1948 int GetPixelSpace() const
1949 {
1950 return nPixelSpace;
1951 }
1955 int GetLineSpace() const
1956 {
1957 return nLineSpace;
1958 }
1962 int GetBandSpace() const
1963 {
1964 return nBandSpace;
1965 }
1966
1967 virtual GDALAsyncStatusType
1968 GetNextUpdatedRegion(double dfTimeout, int *pnBufXOff, int *pnBufYOff,
1969 int *pnBufXSize, int *pnBufYSize) = 0;
1970 virtual int LockBuffer(double dfTimeout = -1.0);
1971 virtual void UnlockBuffer();
1972};
1973
1974/* ******************************************************************** */
1975/* Multidimensional array API */
1976/* ******************************************************************** */
1977
1978class GDALMDArray;
1979class GDALAttribute;
1980class GDALDimension;
1981class GDALEDTComponent;
1982
1983/* ******************************************************************** */
1984/* GDALExtendedDataType */
1985/* ******************************************************************** */
1986
1995{
1996 public:
1998
2000
2002
2003 static GDALExtendedDataType Create(GDALDataType eType);
2005 Create(const std::string &osName, size_t nTotalSize,
2006 std::vector<std::unique_ptr<GDALEDTComponent>> &&components);
2008 CreateString(size_t nMaxStringLength = 0,
2010
2011 bool operator==(const GDALExtendedDataType &) const;
2013 bool operator!=(const GDALExtendedDataType &other) const
2014 {
2015 return !(operator==(other));
2016 }
2017
2022 const std::string &GetName() const
2023 {
2024 return m_osName;
2025 }
2026
2032 {
2033 return m_eClass;
2034 }
2035
2042 {
2043 return m_eNumericDT;
2044 }
2045
2053 {
2054 return m_eSubType;
2055 }
2056
2062 const std::vector<std::unique_ptr<GDALEDTComponent>> &GetComponents() const
2063 {
2064 return m_aoComponents;
2065 }
2066
2073 size_t GetSize() const
2074 {
2075 return m_nSize;
2076 }
2077
2082 size_t GetMaxStringLength() const
2083 {
2084 return m_nMaxStringLength;
2085 }
2086
2087 bool CanConvertTo(const GDALExtendedDataType &other) const;
2088
2089 bool NeedsFreeDynamicMemory() const;
2090
2091 void FreeDynamicMemory(void *pBuffer) const;
2092
2093 static bool CopyValue(const void *pSrc, const GDALExtendedDataType &srcType,
2094 void *pDst, const GDALExtendedDataType &dstType);
2095
2096 static bool CopyValues(const void *pSrc,
2097 const GDALExtendedDataType &srcType,
2098 GPtrDiff_t nSrcStrideInElts, void *pDst,
2099 const GDALExtendedDataType &dstType,
2100 GPtrDiff_t nDstStrideInElts, size_t nValues);
2101
2102 private:
2103 GDALExtendedDataType(size_t nMaxStringLength,
2105 explicit GDALExtendedDataType(GDALDataType eType);
2107 const std::string &osName, size_t nTotalSize,
2108 std::vector<std::unique_ptr<GDALEDTComponent>> &&components);
2109
2110 std::string m_osName{};
2113 GDALDataType m_eNumericDT = GDT_Unknown;
2114 std::vector<std::unique_ptr<GDALEDTComponent>> m_aoComponents{};
2115 size_t m_nSize = 0;
2116 size_t m_nMaxStringLength = 0;
2117};
2118
2119/* ******************************************************************** */
2120/* GDALEDTComponent */
2121/* ******************************************************************** */
2122
2128class CPL_DLL GDALEDTComponent
2129{
2130 public:
2132 GDALEDTComponent(const std::string &name, size_t offset,
2133 const GDALExtendedDataType &type);
2135
2136 bool operator==(const GDALEDTComponent &) const;
2137
2142 const std::string &GetName() const
2143 {
2144 return m_osName;
2145 }
2146
2151 size_t GetOffset() const
2152 {
2153 return m_nOffset;
2154 }
2155
2161 {
2162 return m_oType;
2163 }
2164
2165 private:
2166 std::string m_osName;
2167 size_t m_nOffset;
2168 GDALExtendedDataType m_oType;
2169};
2170
2171/* ******************************************************************** */
2172/* GDALIHasAttribute */
2173/* ******************************************************************** */
2174
2181{
2182 protected:
2183 std::shared_ptr<GDALAttribute>
2184 GetAttributeFromAttributes(const std::string &osName) const;
2185
2186 public:
2187 virtual ~GDALIHasAttribute();
2188
2189 virtual std::shared_ptr<GDALAttribute>
2190 GetAttribute(const std::string &osName) const;
2191
2192 virtual std::vector<std::shared_ptr<GDALAttribute>>
2193 GetAttributes(CSLConstList papszOptions = nullptr) const;
2194
2195 virtual std::shared_ptr<GDALAttribute>
2196 CreateAttribute(const std::string &osName,
2197 const std::vector<GUInt64> &anDimensions,
2198 const GDALExtendedDataType &oDataType,
2199 CSLConstList papszOptions = nullptr);
2200};
2201
2202/* ******************************************************************** */
2203/* GDALGroup */
2204/* ******************************************************************** */
2205
2206/* clang-format off */
2216/* clang-format on */
2217
2218class CPL_DLL GDALGroup : public GDALIHasAttribute
2219{
2220 protected:
2222 std::string m_osName{};
2223 std::string m_osFullName{};
2224
2225 GDALGroup(const std::string &osParentName, const std::string &osName);
2226
2227 const GDALGroup *
2228 GetInnerMostGroup(const std::string &osPathOrArrayOrDim,
2229 std::shared_ptr<GDALGroup> &curGroupHolder,
2230 std::string &osLastPart) const;
2232
2233 public:
2234 virtual ~GDALGroup();
2235
2240 const std::string &GetName() const
2241 {
2242 return m_osName;
2243 }
2244
2249 const std::string &GetFullName() const
2250 {
2251 return m_osFullName;
2252 }
2253
2254 virtual std::vector<std::string>
2255 GetMDArrayNames(CSLConstList papszOptions = nullptr) const;
2256 virtual std::shared_ptr<GDALMDArray>
2257 OpenMDArray(const std::string &osName,
2258 CSLConstList papszOptions = nullptr) const;
2259
2260 virtual std::vector<std::string>
2261 GetGroupNames(CSLConstList papszOptions = nullptr) const;
2262 virtual std::shared_ptr<GDALGroup>
2263 OpenGroup(const std::string &osName,
2264 CSLConstList papszOptions = nullptr) const;
2265
2266 virtual std::vector<std::string>
2267 GetVectorLayerNames(CSLConstList papszOptions = nullptr) const;
2268 virtual OGRLayer *
2269 OpenVectorLayer(const std::string &osName,
2270 CSLConstList papszOptions = nullptr) const;
2271
2272 virtual std::vector<std::shared_ptr<GDALDimension>>
2273 GetDimensions(CSLConstList papszOptions = nullptr) const;
2274
2275 virtual std::shared_ptr<GDALGroup>
2276 CreateGroup(const std::string &osName, CSLConstList papszOptions = nullptr);
2277
2278 virtual std::shared_ptr<GDALDimension>
2279 CreateDimension(const std::string &osName, const std::string &osType,
2280 const std::string &osDirection, GUInt64 nSize,
2281 CSLConstList papszOptions = nullptr);
2282
2283 virtual std::shared_ptr<GDALMDArray> CreateMDArray(
2284 const std::string &osName,
2285 const std::vector<std::shared_ptr<GDALDimension>> &aoDimensions,
2286 const GDALExtendedDataType &oDataType,
2287 CSLConstList papszOptions = nullptr);
2288
2289 GUInt64 GetTotalCopyCost() const;
2290
2291 virtual bool CopyFrom(const std::shared_ptr<GDALGroup> &poDstRootGroup,
2292 GDALDataset *poSrcDS,
2293 const std::shared_ptr<GDALGroup> &poSrcGroup,
2294 bool bStrict, GUInt64 &nCurCost,
2295 const GUInt64 nTotalCost,
2296 GDALProgressFunc pfnProgress, void *pProgressData,
2297 CSLConstList papszOptions = nullptr);
2298
2299 virtual CSLConstList GetStructuralInfo() const;
2300
2301 std::shared_ptr<GDALMDArray>
2302 OpenMDArrayFromFullname(const std::string &osFullName,
2303 CSLConstList papszOptions = nullptr) const;
2304
2305 std::shared_ptr<GDALMDArray>
2306 ResolveMDArray(const std::string &osName, const std::string &osStartingPath,
2307 CSLConstList papszOptions = nullptr) const;
2308
2309 std::shared_ptr<GDALGroup>
2310 OpenGroupFromFullname(const std::string &osFullName,
2311 CSLConstList papszOptions = nullptr) const;
2312
2313 std::shared_ptr<GDALDimension>
2314 OpenDimensionFromFullname(const std::string &osFullName) const;
2315
2316 virtual void ClearStatistics();
2317
2319 static constexpr GUInt64 COPY_COST = 1000;
2321};
2322
2323/* ******************************************************************** */
2324/* GDALAbstractMDArray */
2325/* ******************************************************************** */
2326
2333{
2334 protected:
2336 std::string m_osName{};
2337 std::string m_osFullName{};
2338 std::weak_ptr<GDALAbstractMDArray> m_pSelf{};
2339
2340 GDALAbstractMDArray(const std::string &osParentName,
2341 const std::string &osName);
2342
2343 void SetSelf(std::weak_ptr<GDALAbstractMDArray> self)
2344 {
2345 m_pSelf = self;
2346 }
2347
2348 bool CheckReadWriteParams(const GUInt64 *arrayStartIdx, const size_t *count,
2349 const GInt64 *&arrayStep,
2350 const GPtrDiff_t *&bufferStride,
2351 const GDALExtendedDataType &bufferDataType,
2352 const void *buffer,
2353 const void *buffer_alloc_start,
2354 size_t buffer_alloc_size,
2355 std::vector<GInt64> &tmp_arrayStep,
2356 std::vector<GPtrDiff_t> &tmp_bufferStride) const;
2357
2358 virtual bool
2359 IRead(const GUInt64 *arrayStartIdx, // array of size GetDimensionCount()
2360 const size_t *count, // array of size GetDimensionCount()
2361 const GInt64 *arrayStep, // step in elements
2362 const GPtrDiff_t *bufferStride, // stride in elements
2363 const GDALExtendedDataType &bufferDataType,
2364 void *pDstBuffer) const = 0;
2365
2366 virtual bool
2367 IWrite(const GUInt64 *arrayStartIdx, // array of size GetDimensionCount()
2368 const size_t *count, // array of size GetDimensionCount()
2369 const GInt64 *arrayStep, // step in elements
2370 const GPtrDiff_t *bufferStride, // stride in elements
2371 const GDALExtendedDataType &bufferDataType, const void *pSrcBuffer);
2373
2374 public:
2375 virtual ~GDALAbstractMDArray();
2376
2382 const std::string &GetName() const
2383 {
2384 return m_osName;
2385 }
2386
2392 const std::string &GetFullName() const
2393 {
2394 return m_osFullName;
2395 }
2396
2397 GUInt64 GetTotalElementsCount() const;
2398
2399 virtual size_t GetDimensionCount() const;
2400
2401 virtual const std::vector<std::shared_ptr<GDALDimension>> &
2402 GetDimensions() const = 0;
2403
2404 virtual const GDALExtendedDataType &GetDataType() const = 0;
2405
2406 virtual std::vector<GUInt64> GetBlockSize() const;
2407
2408 virtual std::vector<size_t>
2409 GetProcessingChunkSize(size_t nMaxChunkMemory) const;
2410
2411 /* clang-format off */
2427 typedef bool (*FuncProcessPerChunkType)(
2428 GDALAbstractMDArray *array,
2429 const GUInt64 *chunkArrayStartIdx,
2430 const size_t *chunkCount,
2431 GUInt64 iCurChunk,
2432 GUInt64 nChunkCount,
2433 void *pUserData);
2434 /* clang-format on */
2435
2436 virtual bool ProcessPerChunk(const GUInt64 *arrayStartIdx,
2437 const GUInt64 *count, const size_t *chunkSize,
2438 FuncProcessPerChunkType pfnFunc,
2439 void *pUserData);
2440
2441 virtual bool
2442 Read(const GUInt64 *arrayStartIdx, // array of size GetDimensionCount()
2443 const size_t *count, // array of size GetDimensionCount()
2444 const GInt64 *arrayStep, // step in elements
2445 const GPtrDiff_t *bufferStride, // stride in elements
2446 const GDALExtendedDataType &bufferDataType, void *pDstBuffer,
2447 const void *pDstBufferAllocStart = nullptr,
2448 size_t nDstBufferAllocSize = 0) const;
2449
2450 bool
2451 Write(const GUInt64 *arrayStartIdx, // array of size GetDimensionCount()
2452 const size_t *count, // array of size GetDimensionCount()
2453 const GInt64 *arrayStep, // step in elements
2454 const GPtrDiff_t *bufferStride, // stride in elements
2455 const GDALExtendedDataType &bufferDataType, const void *pSrcBuffer,
2456 const void *pSrcBufferAllocStart = nullptr,
2457 size_t nSrcBufferAllocSize = 0);
2458};
2459
2460/* ******************************************************************** */
2461/* GDALRawResult */
2462/* ******************************************************************** */
2463
2470class CPL_DLL GDALRawResult
2471{
2472 private:
2474 size_t m_nEltCount;
2475 size_t m_nSize;
2476 GByte *m_raw;
2477
2478 void FreeMe();
2479
2480 GDALRawResult(const GDALRawResult &) = delete;
2481 GDALRawResult &operator=(const GDALRawResult &) = delete;
2482
2483 protected:
2484 friend class GDALAttribute;
2486 GDALRawResult(GByte *raw, const GDALExtendedDataType &dt, size_t nEltCount);
2488
2489 public:
2492 GDALRawResult &operator=(GDALRawResult &&);
2493
2495 const GByte &operator[](size_t idx) const
2496 {
2497 return m_raw[idx];
2498 }
2500 const GByte *data() const
2501 {
2502 return m_raw;
2503 }
2505 size_t size() const
2506 {
2507 return m_nSize;
2508 }
2509
2511 GByte *StealData();
2513};
2514
2515/* ******************************************************************** */
2516/* GDALAttribute */
2517/* ******************************************************************** */
2518
2519/* clang-format off */
2531/* clang-format on */
2532
2533class CPL_DLL GDALAttribute : virtual public GDALAbstractMDArray
2534{
2535 mutable std::string m_osCachedVal{};
2536
2537 protected:
2539 GDALAttribute(const std::string &osParentName, const std::string &osName);
2541
2542 public:
2543 std::vector<GUInt64> GetDimensionsSize() const;
2544
2545 GDALRawResult ReadAsRaw() const;
2546 const char *ReadAsString() const;
2547 int ReadAsInt() const;
2548 double ReadAsDouble() const;
2549 CPLStringList ReadAsStringArray() const;
2550 std::vector<int> ReadAsIntArray() const;
2551 std::vector<double> ReadAsDoubleArray() const;
2552
2554 bool Write(const void *pabyValue, size_t nLen);
2555 bool Write(const char *);
2556 bool WriteInt(int);
2557 bool Write(double);
2558 bool Write(CSLConstList);
2559 bool Write(const double *, size_t);
2560
2562 static constexpr GUInt64 COPY_COST = 100;
2564};
2565
2566/************************************************************************/
2567/* GDALAttributeString */
2568/************************************************************************/
2569
2571class CPL_DLL GDALAttributeString final : public GDALAttribute
2572{
2573 std::vector<std::shared_ptr<GDALDimension>> m_dims{};
2575 std::string m_osValue;
2576
2577 protected:
2578 bool IRead(const GUInt64 *, const size_t *, const GInt64 *,
2579 const GPtrDiff_t *, const GDALExtendedDataType &bufferDataType,
2580 void *pDstBuffer) const override;
2581
2582 public:
2583 GDALAttributeString(const std::string &osParentName,
2584 const std::string &osName, const std::string &osValue,
2586
2587 const std::vector<std::shared_ptr<GDALDimension>> &
2588 GetDimensions() const override;
2589
2590 const GDALExtendedDataType &GetDataType() const override;
2591};
2593
2594/************************************************************************/
2595/* GDALAttributeNumeric */
2596/************************************************************************/
2597
2599class CPL_DLL GDALAttributeNumeric final : public GDALAttribute
2600{
2601 std::vector<std::shared_ptr<GDALDimension>> m_dims{};
2603 int m_nValue = 0;
2604 double m_dfValue = 0;
2605 std::vector<GUInt32> m_anValuesUInt32{};
2606
2607 protected:
2608 bool IRead(const GUInt64 *, const size_t *, const GInt64 *,
2609 const GPtrDiff_t *, const GDALExtendedDataType &bufferDataType,
2610 void *pDstBuffer) const override;
2611
2612 public:
2613 GDALAttributeNumeric(const std::string &osParentName,
2614 const std::string &osName, double dfValue);
2615 GDALAttributeNumeric(const std::string &osParentName,
2616 const std::string &osName, int nValue);
2617 GDALAttributeNumeric(const std::string &osParentName,
2618 const std::string &osName,
2619 const std::vector<GUInt32> &anValues);
2620
2621 const std::vector<std::shared_ptr<GDALDimension>> &
2622 GetDimensions() const override;
2623
2624 const GDALExtendedDataType &GetDataType() const override;
2625};
2627
2628/* ******************************************************************** */
2629/* GDALMDArray */
2630/* ******************************************************************** */
2631
2632/* clang-format off */
2642/* clang-format on */
2643
2644class CPL_DLL GDALMDArray : virtual public GDALAbstractMDArray,
2645 public GDALIHasAttribute
2646{
2647 friend class GDALMDArrayResampled;
2648 std::shared_ptr<GDALMDArray>
2649 GetView(const std::vector<GUInt64> &indices) const;
2650
2651 inline std::shared_ptr<GDALMDArray>
2652 atInternal(std::vector<GUInt64> &indices) const
2653 {
2654 return GetView(indices);
2655 }
2656
2657 template <typename... GUInt64VarArg>
2658 // cppcheck-suppress functionStatic
2659 inline std::shared_ptr<GDALMDArray>
2660 atInternal(std::vector<GUInt64> &indices, GUInt64 idx,
2661 GUInt64VarArg... tail) const
2662 {
2663 indices.push_back(idx);
2664 return atInternal(indices, tail...);
2665 }
2666
2667 mutable bool m_bHasTriedCachedArray = false;
2668 mutable std::shared_ptr<GDALMDArray> m_poCachedArray{};
2669
2670 protected:
2672 GDALMDArray(const std::string &osParentName, const std::string &osName);
2673
2674 virtual bool IAdviseRead(const GUInt64 *arrayStartIdx, const size_t *count,
2675 CSLConstList papszOptions) const;
2676
2677 virtual bool IsCacheable() const
2678 {
2679 return true;
2680 }
2681
2682 virtual bool SetStatistics(bool bApproxStats, double dfMin, double dfMax,
2683 double dfMean, double dfStdDev,
2684 GUInt64 nValidCount);
2685
2686 static std::string MassageName(const std::string &inputName);
2687
2688 std::shared_ptr<GDALGroup>
2689 GetCacheRootGroup(bool bCanCreate, std::string &osCacheFilenameOut) const;
2690
2691 // Returns if bufferStride values express a transposed view of the array
2692 bool IsTransposedRequest(const size_t *count,
2693 const GPtrDiff_t *bufferStride) const;
2694
2695 // Should only be called if IsTransposedRequest() returns true
2696 bool ReadForTransposedRequest(const GUInt64 *arrayStartIdx,
2697 const size_t *count, const GInt64 *arrayStep,
2698 const GPtrDiff_t *bufferStride,
2699 const GDALExtendedDataType &bufferDataType,
2700 void *pDstBuffer) const;
2702
2703 public:
2704 GUInt64 GetTotalCopyCost() const;
2705
2706 virtual bool CopyFrom(GDALDataset *poSrcDS, const GDALMDArray *poSrcArray,
2707 bool bStrict, GUInt64 &nCurCost,
2708 const GUInt64 nTotalCost,
2709 GDALProgressFunc pfnProgress, void *pProgressData);
2710
2712 virtual bool IsWritable() const = 0;
2713
2722 virtual const std::string &GetFilename() const = 0;
2723
2724 virtual CSLConstList GetStructuralInfo() const;
2725
2726 virtual const std::string &GetUnit() const;
2727
2728 virtual bool SetUnit(const std::string &osUnit);
2729
2730 virtual bool SetSpatialRef(const OGRSpatialReference *poSRS);
2731
2732 virtual std::shared_ptr<OGRSpatialReference> GetSpatialRef() const;
2733
2734 virtual const void *GetRawNoDataValue() const;
2735
2736 double GetNoDataValueAsDouble(bool *pbHasNoData = nullptr) const;
2737
2738 int64_t GetNoDataValueAsInt64(bool *pbHasNoData = nullptr) const;
2739
2740 uint64_t GetNoDataValueAsUInt64(bool *pbHasNoData = nullptr) const;
2741
2742 virtual bool SetRawNoDataValue(const void *pRawNoData);
2743
2745 bool SetNoDataValue(int nNoData)
2746 {
2747 return SetNoDataValue(static_cast<int64_t>(nNoData));
2748 }
2750
2751 bool SetNoDataValue(double dfNoData);
2752
2753 bool SetNoDataValue(int64_t nNoData);
2754
2755 bool SetNoDataValue(uint64_t nNoData);
2756
2757 virtual double GetOffset(bool *pbHasOffset = nullptr,
2758 GDALDataType *peStorageType = nullptr) const;
2759
2760 virtual double GetScale(bool *pbHasScale = nullptr,
2761 GDALDataType *peStorageType = nullptr) const;
2762
2763 virtual bool SetOffset(double dfOffset,
2764 GDALDataType eStorageType = GDT_Unknown);
2765
2766 virtual bool SetScale(double dfScale,
2767 GDALDataType eStorageType = GDT_Unknown);
2768
2769 std::shared_ptr<GDALMDArray> GetView(const std::string &viewExpr) const;
2770
2771 std::shared_ptr<GDALMDArray> operator[](const std::string &fieldName) const;
2772
2782 // sphinx 4.1.0 / breathe 4.30.0 don't like typename...
2784 template <typename... GUInt64VarArg>
2786 // cppcheck-suppress functionStatic
2787 std::shared_ptr<GDALMDArray> at(GUInt64 idx, GUInt64VarArg... tail) const
2788 {
2789 std::vector<GUInt64> indices;
2790 indices.push_back(idx);
2791 return atInternal(indices, tail...);
2792 }
2793
2794 virtual std::shared_ptr<GDALMDArray>
2795 Transpose(const std::vector<int> &anMapNewAxisToOldAxis) const;
2796
2797 std::shared_ptr<GDALMDArray> GetUnscaled() const;
2798
2799 virtual std::shared_ptr<GDALMDArray>
2800 GetMask(CSLConstList papszOptions) const;
2801
2802 std::shared_ptr<GDALMDArray>
2803 GetResampled(const std::vector<std::shared_ptr<GDALDimension>> &apoNewDims,
2804 GDALRIOResampleAlg resampleAlg,
2805 const OGRSpatialReference *poTargetSRS,
2806 CSLConstList papszOptions) const;
2807
2808 virtual GDALDataset *AsClassicDataset(size_t iXDim, size_t iYDim) const;
2809
2810 virtual CPLErr GetStatistics(bool bApproxOK, bool bForce, double *pdfMin,
2811 double *pdfMax, double *pdfMean,
2812 double *padfStdDev, GUInt64 *pnValidCount,
2813 GDALProgressFunc pfnProgress,
2814 void *pProgressData);
2815
2816 virtual bool ComputeStatistics(bool bApproxOK, double *pdfMin,
2817 double *pdfMax, double *pdfMean,
2818 double *pdfStdDev, GUInt64 *pnValidCount,
2819 GDALProgressFunc, void *pProgressData);
2820
2821 virtual void ClearStatistics();
2822
2823 virtual std::vector<std::shared_ptr<GDALMDArray>>
2824 GetCoordinateVariables() const;
2825
2826 bool AdviseRead(const GUInt64 *arrayStartIdx, const size_t *count,
2827 CSLConstList papszOptions = nullptr) const;
2828
2829 bool IsRegularlySpaced(double &dfStart, double &dfIncrement) const;
2830
2831 bool GuessGeoTransform(size_t nDimX, size_t nDimY, bool bPixelIsPoint,
2832 double adfGeoTransform[6]) const;
2833
2834 bool Cache(CSLConstList papszOptions = nullptr) const;
2835
2836 bool
2837 Read(const GUInt64 *arrayStartIdx, // array of size GetDimensionCount()
2838 const size_t *count, // array of size GetDimensionCount()
2839 const GInt64 *arrayStep, // step in elements
2840 const GPtrDiff_t *bufferStride, // stride in elements
2841 const GDALExtendedDataType &bufferDataType, void *pDstBuffer,
2842 const void *pDstBufferAllocStart = nullptr,
2843 size_t nDstBufferAllocSize = 0) const override final;
2844
2846 static constexpr GUInt64 COPY_COST = 1000;
2847
2848 bool CopyFromAllExceptValues(const GDALMDArray *poSrcArray, bool bStrict,
2849 GUInt64 &nCurCost, const GUInt64 nTotalCost,
2850 GDALProgressFunc pfnProgress,
2851 void *pProgressData);
2852 struct Range
2853 {
2854 GUInt64 m_nStartIdx;
2855 GInt64 m_nIncr;
2856 explicit Range(GUInt64 nStartIdx = 0, GInt64 nIncr = 0)
2857 : m_nStartIdx(nStartIdx), m_nIncr(nIncr)
2858 {
2859 }
2860 };
2861
2862 struct ViewSpec
2863 {
2864 std::string m_osFieldName{};
2865
2866 // or
2867
2868 std::vector<size_t>
2869 m_mapDimIdxToParentDimIdx{}; // of size m_dims.size()
2870 std::vector<Range>
2871 m_parentRanges{}; // of size m_poParent->GetDimensionCount()
2872 };
2873
2874 virtual std::shared_ptr<GDALMDArray>
2875 GetView(const std::string &viewExpr, bool bRenameDimensions,
2876 std::vector<ViewSpec> &viewSpecs) const;
2878};
2879
2881bool GDALMDRasterIOFromBand(GDALRasterBand *poBand, GDALRWFlag eRWFlag,
2882 size_t iDimX, size_t iDimY,
2883 const GUInt64 *arrayStartIdx, const size_t *count,
2884 const GInt64 *arrayStep,
2885 const GPtrDiff_t *bufferStride,
2886 const GDALExtendedDataType &bufferDataType,
2887 void *pBuffer);
2889
2890/************************************************************************/
2891/* GDALMDArrayRegularlySpaced */
2892/************************************************************************/
2893
2895class CPL_DLL GDALMDArrayRegularlySpaced : public GDALMDArray
2896{
2897 double m_dfStart;
2898 double m_dfIncrement;
2899 double m_dfOffsetInIncrement;
2901 std::vector<std::shared_ptr<GDALDimension>> m_dims;
2902 std::vector<std::shared_ptr<GDALAttribute>> m_attributes{};
2903 std::string m_osEmptyFilename{};
2904
2905 protected:
2906 bool IRead(const GUInt64 *, const size_t *, const GInt64 *,
2907 const GPtrDiff_t *, const GDALExtendedDataType &bufferDataType,
2908 void *pDstBuffer) const override;
2909
2910 public:
2911 GDALMDArrayRegularlySpaced(const std::string &osParentName,
2912 const std::string &osName,
2913 const std::shared_ptr<GDALDimension> &poDim,
2914 double dfStart, double dfIncrement,
2915 double dfOffsetInIncrement);
2916
2917 static std::shared_ptr<GDALMDArrayRegularlySpaced>
2918 Create(const std::string &osParentName, const std::string &osName,
2919 const std::shared_ptr<GDALDimension> &poDim, double dfStart,
2920 double dfIncrement, double dfOffsetInIncrement);
2921
2922 bool IsWritable() const override
2923 {
2924 return false;
2925 }
2926
2927 const std::string &GetFilename() const override
2928 {
2929 return m_osEmptyFilename;
2930 }
2931
2932 const std::vector<std::shared_ptr<GDALDimension>> &
2933 GetDimensions() const override;
2934
2935 const GDALExtendedDataType &GetDataType() const override;
2936
2937 std::vector<std::shared_ptr<GDALAttribute>>
2938 GetAttributes(CSLConstList) const override;
2939
2940 void AddAttribute(const std::shared_ptr<GDALAttribute> &poAttr);
2941};
2943
2944/* ******************************************************************** */
2945/* GDALDimension */
2946/* ******************************************************************** */
2947
2959class CPL_DLL GDALDimension
2960{
2961 public:
2963 GDALDimension(const std::string &osParentName, const std::string &osName,
2964 const std::string &osType, const std::string &osDirection,
2965 GUInt64 nSize);
2967
2968 virtual ~GDALDimension();
2969
2974 const std::string &GetName() const
2975 {
2976 return m_osName;
2977 }
2978
2983 const std::string &GetFullName() const
2984 {
2985 return m_osFullName;
2986 }
2987
2996 const std::string &GetType() const
2997 {
2998 return m_osType;
2999 }
3000
3009 const std::string &GetDirection() const
3010 {
3011 return m_osDirection;
3012 }
3013
3019 {
3020 return m_nSize;
3021 }
3022
3023 virtual std::shared_ptr<GDALMDArray> GetIndexingVariable() const;
3024
3025 virtual bool
3026 SetIndexingVariable(std::shared_ptr<GDALMDArray> poIndexingVariable);
3027
3028 protected:
3030 std::string m_osName;
3031 std::string m_osFullName;
3032 std::string m_osType;
3033 std::string m_osDirection;
3034 GUInt64 m_nSize;
3036};
3037
3038/************************************************************************/
3039/* GDALDimensionWeakIndexingVar() */
3040/************************************************************************/
3041
3043class CPL_DLL GDALDimensionWeakIndexingVar : public GDALDimension
3044{
3045 std::weak_ptr<GDALMDArray> m_poIndexingVariable{};
3046
3047 public:
3048 GDALDimensionWeakIndexingVar(const std::string &osParentName,
3049 const std::string &osName,
3050 const std::string &osType,
3051 const std::string &osDirection, GUInt64 nSize);
3052
3053 std::shared_ptr<GDALMDArray> GetIndexingVariable() const override;
3054
3055 bool SetIndexingVariable(
3056 std::shared_ptr<GDALMDArray> poIndexingVariable) override;
3057};
3059
3060/************************************************************************/
3061/* GDALAntiRecursionGuard */
3062/************************************************************************/
3063
3065struct GDALAntiRecursionStruct;
3066class GDALAntiRecursionGuard
3067{
3068 GDALAntiRecursionStruct *m_psAntiRecursionStruct;
3069 std::string m_osIdentifier;
3070 int m_nDepth;
3071
3072 GDALAntiRecursionGuard(const GDALAntiRecursionGuard &) = delete;
3073 GDALAntiRecursionGuard &operator=(const GDALAntiRecursionGuard &) = delete;
3074
3075 public:
3076 explicit GDALAntiRecursionGuard(const std::string &osIdentifier);
3077 GDALAntiRecursionGuard(const GDALAntiRecursionGuard &other,
3078 const std::string &osIdentifier);
3079 ~GDALAntiRecursionGuard();
3080 int GetCallDepth() const
3081 {
3082 return m_nDepth;
3083 }
3084};
3086
3087/************************************************************************/
3088/* Relationships */
3089/************************************************************************/
3090
3102class CPL_DLL GDALRelationship
3103{
3104 protected:
3106 std::string m_osName{};
3107 std::string m_osLeftTableName{};
3108 std::string m_osRightTableName{};
3109 GDALRelationshipCardinality m_eCardinality =
3111 std::string m_osMappingTableName{};
3112 std::vector<std::string> m_osListLeftTableFields{};
3113 std::vector<std::string> m_osListRightTableFields{};
3114 std::vector<std::string> m_osListLeftMappingTableFields{};
3115 std::vector<std::string> m_osListRightMappingTableFields{};
3117 std::string m_osForwardPathLabel{};
3118 std::string m_osBackwardPathLabel{};
3119 std::string m_osRelatedTableType{};
3120
3123 public:
3131 GDALRelationship(const std::string &osName,
3132 const std::string &osLeftTableName,
3133 const std::string &osRightTableName,
3134 GDALRelationshipCardinality eCardinality =
3136 : m_osName(osName), m_osLeftTableName(osLeftTableName),
3137 m_osRightTableName(osRightTableName), m_eCardinality(eCardinality)
3138 {
3139 }
3140
3142 const std::string &GetName() const
3143 {
3144 return m_osName;
3145 }
3146
3149 {
3150 return m_eCardinality;
3151 }
3152
3157 const std::string &GetLeftTableName() const
3158 {
3159 return m_osLeftTableName;
3160 }
3161
3164 const std::string &GetRightTableName() const
3165 {
3166 return m_osRightTableName;
3167 }
3168
3173 const std::string &GetMappingTableName() const
3174 {
3175 return m_osMappingTableName;
3176 }
3177
3182 void SetMappingTableName(const std::string &osName)
3183 {
3184 m_osMappingTableName = osName;
3185 }
3186
3193 const std::vector<std::string> &GetLeftTableFields() const
3194 {
3195 return m_osListLeftTableFields;
3196 }
3197
3204 const std::vector<std::string> &GetRightTableFields() const
3205 {
3206 return m_osListRightTableFields;
3207 }
3208
3215 void SetLeftTableFields(const std::vector<std::string> &osListFields)
3216 {
3217 m_osListLeftTableFields = osListFields;
3218 }
3219
3226 void SetRightTableFields(const std::vector<std::string> &osListFields)
3227 {
3228 m_osListRightTableFields = osListFields;
3229 }
3230
3237 const std::vector<std::string> &GetLeftMappingTableFields() const
3238 {
3239 return m_osListLeftMappingTableFields;
3240 }
3241
3248 const std::vector<std::string> &GetRightMappingTableFields() const
3249 {
3250 return m_osListRightMappingTableFields;
3251 }
3252
3259 void SetLeftMappingTableFields(const std::vector<std::string> &osListFields)
3260 {
3261 m_osListLeftMappingTableFields = osListFields;
3262 }
3263
3270 void
3271 SetRightMappingTableFields(const std::vector<std::string> &osListFields)
3272 {
3273 m_osListRightMappingTableFields = osListFields;
3274 }
3275
3281 {
3282 return m_eType;
3283 }
3284
3290 {
3291 m_eType = eType;
3292 }
3293
3309 const std::string &GetForwardPathLabel() const
3310 {
3311 return m_osForwardPathLabel;
3312 }
3313
3329 void SetForwardPathLabel(const std::string &osLabel)
3330 {
3331 m_osForwardPathLabel = osLabel;
3332 }
3333
3349 const std::string &GetBackwardPathLabel() const
3350 {
3351 return m_osBackwardPathLabel;
3352 }
3353
3369 void SetBackwardPathLabel(const std::string &osLabel)
3370 {
3371 m_osBackwardPathLabel = osLabel;
3372 }
3373
3384 const std::string &GetRelatedTableType() const
3385 {
3386 return m_osRelatedTableType;
3387 }
3388
3399 void SetRelatedTableType(const std::string &osType)
3400 {
3401 m_osRelatedTableType = osType;
3402 }
3403
3406 static inline GDALRelationshipH ToHandle(GDALRelationship *poRelationship)
3407 {
3408 return static_cast<GDALRelationshipH>(poRelationship);
3409 }
3410
3413 static inline GDALRelationship *FromHandle(GDALRelationshipH hRelationship)
3414 {
3415 return static_cast<GDALRelationship *>(hRelationship);
3416 }
3417};
3418
3419/* ==================================================================== */
3420/* An assortment of overview related stuff. */
3421/* ==================================================================== */
3422
3424/* Only exported for drivers as plugin. Signature may change */
3425CPLErr CPL_DLL GDALRegenerateOverviewsMultiBand(
3426 int nBands, GDALRasterBand *const *papoSrcBands, int nOverviews,
3427 GDALRasterBand *const *const *papapoOverviewBands,
3428 const char *pszResampling, GDALProgressFunc pfnProgress,
3429 void *pProgressData, CSLConstList papszOptions);
3430
3431typedef CPLErr (*GDALResampleFunction)(
3432 double dfXRatioDstToSrc, double dfYRatioDstToSrc, double dfSrcXDelta,
3433 double dfSrcYDelta, GDALDataType eWrkDataType, const void *pChunk,
3434 const GByte *pabyChunkNodataMask, int nChunkXOff, int nChunkXSize,
3435 int nChunkYOff, int nChunkYSize, int nDstXOff, int nDstXOff2, int nDstYOff,
3436 int nDstYOff2, GDALRasterBand *poOverview, void **ppDstBuffer,
3437 GDALDataType *peDstBufferDataType, const char *pszResampling,
3438 int bHasNoData, float fNoDataValue, GDALColorTable *poColorTable,
3439 GDALDataType eSrcDataType, bool bPropagateNoData);
3440
3441GDALResampleFunction GDALGetResampleFunction(const char *pszResampling,
3442 int *pnRadius);
3443
3444GDALDataType GDALGetOvrWorkDataType(const char *pszResampling,
3445 GDALDataType eSrcDataType);
3446
3448
3449CPLErr CPL_DLL
3450HFAAuxBuildOverviews(const char *pszOvrFilename, GDALDataset *poParentDS,
3451 GDALDataset **ppoDS, int nBands, const int *panBandList,
3452 int nNewOverviews, const int *panNewOverviewList,
3453 const char *pszResampling, GDALProgressFunc pfnProgress,
3454 void *pProgressData, CSLConstList papszOptions);
3455
3456CPLErr CPL_DLL GTIFFBuildOverviews(const char *pszFilename, int nBands,
3457 GDALRasterBand *const *papoBandList,
3458 int nOverviews, const int *panOverviewList,
3459 const char *pszResampling,
3460 GDALProgressFunc pfnProgress,
3461 void *pProgressData,
3462 CSLConstList papszOptions);
3463
3464int CPL_DLL GDALBandGetBestOverviewLevel(GDALRasterBand *poBand, int &nXOff,
3465 int &nYOff, int &nXSize, int &nYSize,
3466 int nBufXSize, int nBufYSize)
3467 CPL_WARN_DEPRECATED("Use GDALBandGetBestOverviewLevel2 instead");
3468int CPL_DLL GDALBandGetBestOverviewLevel2(GDALRasterBand *poBand, int &nXOff,
3469 int &nYOff, int &nXSize, int &nYSize,
3470 int nBufXSize, int nBufYSize,
3471 GDALRasterIOExtraArg *psExtraArg);
3472
3473int CPL_DLL GDALOvLevelAdjust(int nOvLevel, int nXSize)
3474 CPL_WARN_DEPRECATED("Use GDALOvLevelAdjust2 instead");
3475int CPL_DLL GDALOvLevelAdjust2(int nOvLevel, int nXSize, int nYSize);
3476int CPL_DLL GDALComputeOvFactor(int nOvrXSize, int nRasterXSize, int nOvrYSize,
3477 int nRasterYSize);
3478
3479GDALDataset CPL_DLL *GDALFindAssociatedAuxFile(const char *pszBasefile,
3480 GDALAccess eAccess,
3481 GDALDataset *poDependentDS);
3482
3483/* ==================================================================== */
3484/* Infrastructure to check that dataset characteristics are valid */
3485/* ==================================================================== */
3486
3487int CPL_DLL GDALCheckDatasetDimensions(int nXSize, int nYSize);
3488int CPL_DLL GDALCheckBandCount(int nBands, int bIsZeroAllowed);
3489
3490/* Internal use only */
3491
3492/* CPL_DLL exported, but only for in-tree drivers that can be built as plugins
3493 */
3494int CPL_DLL GDALReadWorldFile2(const char *pszBaseFilename,
3495 const char *pszExtension,
3496 double *padfGeoTransform,
3497 char **papszSiblingFiles,
3498 char **ppszWorldFileNameOut);
3499int GDALReadTabFile2(const char *pszBaseFilename, double *padfGeoTransform,
3500 char **ppszWKT, int *pnGCPCount, GDAL_GCP **ppasGCPs,
3501 char **papszSiblingFiles, char **ppszTabFileNameOut);
3502
3503void CPL_DLL GDALCopyRasterIOExtraArg(GDALRasterIOExtraArg *psDestArg,
3504 GDALRasterIOExtraArg *psSrcArg);
3505
3507
3508void GDALNullifyOpenDatasetsList();
3509CPLMutex **GDALGetphDMMutex();
3510CPLMutex **GDALGetphDLMutex();
3511void GDALNullifyProxyPoolSingleton();
3512void GDALSetResponsiblePIDForCurrentThread(GIntBig responsiblePID);
3513GIntBig GDALGetResponsiblePIDForCurrentThread();
3514
3515CPLString GDALFindAssociatedFile(const char *pszBasename, const char *pszExt,
3516 CSLConstList papszSiblingFiles, int nFlags);
3517
3518CPLErr CPL_DLL EXIFExtractMetadata(char **&papszMetadata, void *fpL,
3519 int nOffset, int bSwabflag, int nTIFFHEADER,
3520 int &nExifOffset, int &nInterOffset,
3521 int &nGPSOffset);
3522
3523int GDALValidateOpenOptions(GDALDriverH hDriver,
3524 const char *const *papszOptionOptions);
3525int GDALValidateOptions(const char *pszOptionList,
3526 const char *const *papszOptionsToValidate,
3527 const char *pszErrorMessageOptionType,
3528 const char *pszErrorMessageContainerName);
3529
3530GDALRIOResampleAlg GDALRasterIOGetResampleAlg(const char *pszResampling);
3531const char *GDALRasterIOGetResampleAlg(GDALRIOResampleAlg eResampleAlg);
3532
3533void GDALRasterIOExtraArgSetResampleAlg(GDALRasterIOExtraArg *psExtraArg,
3534 int nXSize, int nYSize, int nBufXSize,
3535 int nBufYSize);
3536
3537GDALDataset *GDALCreateOverviewDataset(GDALDataset *poDS, int nOvrLevel,
3538 bool bThisLevelOnly);
3539
3540// Should cover particular cases of #3573, #4183, #4506, #6578
3541// Behavior is undefined if fVal1 or fVal2 are NaN (should be tested before
3542// calling this function)
3543template <class T> inline bool ARE_REAL_EQUAL(T fVal1, T fVal2, int ulp = 2)
3544{
3545 return fVal1 == fVal2 || /* Should cover infinity */
3546 std::abs(fVal1 - fVal2) < std::numeric_limits<float>::epsilon() *
3547 std::abs(fVal1 + fVal2) * ulp;
3548}
3549
3550double GDALAdjustNoDataCloseToFloatMax(double dfVal);
3551
3552#define DIV_ROUND_UP(a, b) (((a) % (b)) == 0 ? ((a) / (b)) : (((a) / (b)) + 1))
3553
3554// Number of data samples that will be used to compute approximate statistics
3555// (minimum value, maximum value, etc.)
3556#define GDALSTAT_APPROX_NUMSAMPLES 2500
3557
3558void GDALSerializeGCPListToXML(CPLXMLNode *psParentNode, GDAL_GCP *pasGCPList,
3559 int nGCPCount,
3560 const OGRSpatialReference *poGCP_SRS);
3561void GDALDeserializeGCPListFromXML(CPLXMLNode *psGCPList,
3562 GDAL_GCP **ppasGCPList, int *pnGCPCount,
3563 OGRSpatialReference **ppoGCP_SRS);
3564
3565void GDALSerializeOpenOptionsToXML(CPLXMLNode *psParentNode,
3566 char **papszOpenOptions);
3567char **GDALDeserializeOpenOptionsFromXML(CPLXMLNode *psParentNode);
3568
3569int GDALCanFileAcceptSidecarFile(const char *pszFilename);
3570
3571bool GDALCanReliablyUseSiblingFileList(const char *pszFilename);
3572
3573bool CPL_DLL GDALIsDriverDeprecatedForGDAL35StillEnabled(
3574 const char *pszDriverName, const char *pszExtraMsg = "");
3575
3576typedef enum
3577{
3578 GSF_UNSIGNED_INT,
3579 GSF_SIGNED_INT,
3580 GSF_FLOATING_POINT,
3581} GDALBufferSampleFormat;
3582
3583bool CPL_DLL GDALBufferHasOnlyNoData(const void *pBuffer, double dfNoDataValue,
3584 size_t nWidth, size_t nHeight,
3585 size_t nLineStride, size_t nComponents,
3586 int nBitsPerSample,
3587 GDALBufferSampleFormat nSampleFormat);
3588
3589void CPL_DLL GDALCopyNoDataValue(GDALRasterBand *poDstBand,
3590 GDALRasterBand *poSrcBand);
3591
3592double CPL_DLL GDALGetNoDataValueCastToDouble(int64_t nVal);
3593double CPL_DLL GDALGetNoDataValueCastToDouble(uint64_t nVal);
3594
3596
3597#endif /* ndef GDAL_PRIV_H_INCLUDED */
String list class designed around our use of C "char**" string lists.
Definition cpl_string.h:438
Convenient string class based on std::string.
Definition cpl_string.h:312
Abstract class, implemented by GDALAttribute and GDALMDArray.
Definition gdal_priv.h:2333
const std::string & GetFullName() const
Return the name of an array or attribute.
Definition gdal_priv.h:2392
virtual const std::vector< std::shared_ptr< GDALDimension > > & GetDimensions() const =0
Return the dimensions of an attribute/array.
virtual const GDALExtendedDataType & GetDataType() const =0
Return the data type of an attribute/array.
const std::string & GetName() const
Return the name of an array or attribute.
Definition gdal_priv.h:2382
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:1985
Class used as a session object for asynchronous requests.
Definition gdal_priv.h:1842
int GetXOffset() const
Return x offset.
Definition gdal_priv.h:1878
int GetYOffset() const
Return y offset.
Definition gdal_priv.h:1885
int GetYSize() const
Return height.
Definition gdal_priv.h:1899
int GetBandCount() const
Return band count.
Definition gdal_priv.h:1934
GDALDataType GetBufferType() const
Return buffer data type.
Definition gdal_priv.h:1927
int GetBandSpace() const
Return band spacing.
Definition gdal_priv.h:1962
int GetBufferYSize() const
Return buffer height.
Definition gdal_priv.h:1920
int GetXSize() const
Return width.
Definition gdal_priv.h:1892
virtual GDALAsyncStatusType GetNextUpdatedRegion(double dfTimeout, int *pnBufXOff, int *pnBufYOff, int *pnBufXSize, int *pnBufYSize)=0
= 0;
void * GetBuffer()
Return buffer.
Definition gdal_priv.h:1906
int GetPixelSpace() const
Return pixel spacing.
Definition gdal_priv.h:1948
int * GetBandMap()
Return band map.
Definition gdal_priv.h:1941
GDALDataset * GetGDALDataset()
Return dataset.
Definition gdal_priv.h:1871
int GetLineSpace() const
Return line spacing.
Definition gdal_priv.h:1955
int GetBufferXSize() const
Return buffer width.
Definition gdal_priv.h:1913
Class modeling an attribute that has a name, a value and a type, and is typically used to describe a ...
Definition gdal_priv.h:2534
A color table / palette.
Definition gdal_priv.h:1093
static GDALColorTableH ToHandle(GDALColorTable *poCT)
Convert a GDALColorTable* to a GDALRasterBandH.
Definition gdal_priv.h:1118
~GDALColorTable()
Destructor.
static GDALColorTable * FromHandle(GDALColorTableH hCT)
Convert a GDALColorTableH to a GDALColorTable*.
Definition gdal_priv.h:1126
Class returned by GetBands() that act as a container for raster bands.
Definition gdal_priv.h:481
Class returned by GetFeatures() that act as a container for vector features.
Definition gdal_priv.h:787
Layer iterator.
Definition gdal_priv.h:733
void pointer
pointer
Definition gdal_priv.h:741
void difference_type
difference_type
Definition gdal_priv.h:740
std::input_iterator_tag iterator_category
iterator_category
Definition gdal_priv.h:743
Class returned by GetLayers() that acts as a range of layers.
Definition gdal_priv.h:720
A set of associated raster bands, usually from one file.
Definition gdal_priv.h:348
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:672
CPLErr SetMetadata(char **papszMetadata, const char *pszDomain) override
Set metadata.
CPLErr SetMetadataItem(const char *pszName, const char *pszValue, const char *pszDomain) override
Set single metadata item.
char ** GetOpenOptions()
Return open options.
Definition gdal_priv.h:616
static GDALDataset * FromHandle(GDALDatasetH hDS)
Convert a GDALDatasetH to a GDALDataset*.
Definition gdal_priv.h:664
static GDALDatasetH ToHandle(GDALDataset *poDS)
Convert a GDALDataset* to a GDALDatasetH.
Definition gdal_priv.h:656
GDALAccess GetAccess() const
Return access mode.
Definition gdal_priv.h:603
Class modeling a a dimension / axis used to index multidimensional arrays.
Definition gdal_priv.h:2960
const std::string & GetName() const
Return the name.
Definition gdal_priv.h:2974
const std::string & GetDirection() const
Return the axis direction.
Definition gdal_priv.h:3009
const std::string & GetFullName() const
Return the full name.
Definition gdal_priv.h:2983
GUInt64 GetSize() const
Return the size, that is the number of values along the dimension.
Definition gdal_priv.h:3018
const std::string & GetType() const
Return the axis type.
Definition gdal_priv.h:2996
Class for managing the registration of file format drivers.
Definition gdal_priv.h:1785
Format specific driver.
Definition gdal_priv.h:1641
static GDALDriver * FromHandle(GDALDriverH hDriver)
Convert a GDALDriverH to a GDALDriver*.
Definition gdal_priv.h:1764
static GDALDriverH ToHandle(GDALDriver *poDriver)
Convert a GDALDriver* to a GDALDriverH.
Definition gdal_priv.h:1756
Class for a component of a compound extended data type.
Definition gdal_priv.h:2129
const GDALExtendedDataType & GetType() const
Return the data type of the component.
Definition gdal_priv.h:2160
size_t GetOffset() const
Return the offset (in bytes) of the component in the compound data type.
Definition gdal_priv.h:2151
const std::string & GetName() const
Return the name.
Definition gdal_priv.h:2142
GDALEDTComponent(const GDALEDTComponent &)
Copy constructor.
Class used to represent potentially complex data types.
Definition gdal_priv.h:1995
bool operator!=(const GDALExtendedDataType &other) const
Non-equality operator.
Definition gdal_priv.h:2013
GDALExtendedDataTypeSubType GetSubType() const
Return subtype.
Definition gdal_priv.h:2052
size_t GetSize() const
Return data type size in bytes.
Definition gdal_priv.h:2073
size_t GetMaxStringLength() const
Return the maximum length of a string in bytes.
Definition gdal_priv.h:2082
static GDALExtendedDataType Create(GDALDataType eType)
Return a new GDALExtendedDataType of class GEDTC_NUMERIC.
Definition gdalmultidim.cpp:8446
static GDALExtendedDataType CreateString(size_t nMaxStringLength=0, GDALExtendedDataTypeSubType eSubType=GEDTST_NONE)
Return a new GDALExtendedDataType of class GEDTC_STRING.
Definition gdalmultidim.cpp:8511
GDALDataType GetNumericDataType() const
Return numeric data type (only valid when GetClass() == GEDTC_NUMERIC)
Definition gdal_priv.h:2041
GDALExtendedDataTypeClass GetClass() const
Return type class.
Definition gdal_priv.h:2031
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:2062
const std::string & GetName() const
Return type name.
Definition gdal_priv.h:2022
Class modeling a named container of GDALAttribute, GDALMDArray, OGRLayer or other GDALGroup.
Definition gdal_priv.h:2219
const std::string & GetName() const
Return the name of the group.
Definition gdal_priv.h:2240
const std::string & GetFullName() const
Return the full name of the group.
Definition gdal_priv.h:2249
Interface used to get a single GDALAttribute or a set of GDALAttribute.
Definition gdal_priv.h:2181
Class modeling a multi-dimensional array.
Definition gdal_priv.h:2646
virtual bool IsWritable() const =0
Return whether an array is writable.
virtual const std::string & GetFilename() const =0
Return the filename that contains that array.
std::shared_ptr< GDALMDArray > at(GUInt64 idx, GUInt64VarArg... tail) const
Return a view of the array using integer indexing.
Definition gdal_priv.h:2787
Object with metadata.
Definition gdal_priv.h:138
static GDALMajorObject * FromHandle(GDALMajorObjectH hMajorObject)
Convert a GDALMajorObjectH to a GDALMajorObject*.
Definition gdal_priv.h:181
static GDALMajorObjectH ToHandle(GDALMajorObject *poMajorObject)
Convert a GDALMajorObject* to a GDALMajorObjectH.
Definition gdal_priv.h:173
Class for dataset open functions.
Definition gdal_priv.h:277
int bStatOK
Whether stat()'ing the file was successful.
Definition gdal_priv.h:298
GByte * pabyHeader
Buffer with first bytes of the file.
Definition gdal_priv.h:308
int bIsDirectory
Whether the file is a directory.
Definition gdal_priv.h:300
char ** papszOpenOptions
Open options.
Definition gdal_priv.h:290
GDALAccess eAccess
Access flag.
Definition gdal_priv.h:293
int nOpenFlags
Open flags.
Definition gdal_priv.h:295
VSILFILE * fpL
Pointer to the file.
Definition gdal_priv.h:303
char * pszFilename
Filename.
Definition gdal_priv.h:288
int nHeaderBytes
Number of bytes in pabyHeader.
Definition gdal_priv.h:306
const char *const * papszAllowedDrivers
Allowed drivers (NULL for all)
Definition gdal_priv.h:311
The GDALRasterAttributeTable (or RAT) class is used to encapsulate a table used to provide attribute ...
Definition gdal_rat.h:48
A single raster band (or channel).
Definition gdal_priv.h:1238
void static GDALRasterBandH ToHandle(GDALRasterBand *poBand)
Convert a GDALRasterBand* to a GDALRasterBandH.
Definition gdal_priv.h:1464
virtual bool IsMaskBand() const
Returns whether a band is a mask band.
Definition gdalrasterband.cpp:7182
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 SetMetadata(char **papszMetadata, const char *pszDomain) override
CAUTION: depending on the format, older values of the updated information might still be found in the...
virtual CPLErr IReadBlock(int nBlockXOff, int nBlockYOff, void *pData)=0
Default internal implementation ... to be overridden by subclasses that support reading.
CPLErr SetMetadataItem(const char *pszName, const char *pszValue, const char *pszDomain) override
CAUTION: depending on the format, older values of the updated information might still be found in the...
static GDALRasterBand * FromHandle(GDALRasterBandH hBand)
Convert a GDALRasterBandH to a GDALRasterBand*.
Definition gdal_priv.h:1472
A single raster block in the block cache.
Definition gdal_priv.h:945
int GetDirty() const
Return the dirty flag.
Definition gdal_priv.h:1034
GDALRasterBand * GetBand()
Accessor to source GDALRasterBand object.
Definition gdal_priv.h:1059
int GetXSize() const
Return the width of the block.
Definition gdal_priv.h:1020
GPtrDiff_t GetBlockSize() const
Return the block size in bytes.
Definition gdal_priv.h:1048
int GetYSize() const
Return the height of the block.
Definition gdal_priv.h:1027
GDALDataType GetDataType() const
Return the data type.
Definition gdal_priv.h:999
int GetXOff() const
Return the x offset of the top-left corner of the block.
Definition gdal_priv.h:1006
int AddLock(void)
Increment the lock count.
Definition gdal_priv.h:983
void * GetDataRef(void)
Return the data buffer.
Definition gdal_priv.h:1041
int GetYOff() const
Return the y offset of the top-left corner of the block.
Definition gdal_priv.h:1013
int DropLock(void)
Decrement the lock count.
Definition gdal_priv.h:988
Store the raw result of an attribute value, which might contain dynamically allocated structures (lik...
Definition gdal_priv.h:2471
size_t size() const
Return the size in bytes of the raw result.
Definition gdal_priv.h:2505
const GByte * data() const
Return pointer to the start of data.
Definition gdal_priv.h:2500
const GByte & operator[](size_t idx) const
Return byte at specified index.
Definition gdal_priv.h:2495
Definition of a table relationship.
Definition gdal_priv.h:3103
const std::string & GetName() const
Get the name of the relationship.
Definition gdal_priv.h:3142
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:3237
void SetType(GDALRelationshipType eType)
Sets the type of the relationship.
Definition gdal_priv.h:3289
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:3259
void SetMappingTableName(const std::string &osName)
Sets the name of the mapping table for many-to-many relationships.
Definition gdal_priv.h:3182
static GDALRelationshipH ToHandle(GDALRelationship *poRelationship)
Convert a GDALRelationship* to a GDALRelationshipH.
Definition gdal_priv.h:3406
const std::string & GetForwardPathLabel() const
Get the label of the forward path for the relationship.
Definition gdal_priv.h:3309
const std::string & GetLeftTableName() const
Get the name of the left (or base/origin) table in the relationship.
Definition gdal_priv.h:3157
const std::string & GetBackwardPathLabel() const
Get the label of the backward path for the relationship.
Definition gdal_priv.h:3349
const std::string & GetRelatedTableType() const
Get the type string of the related table.
Definition gdal_priv.h:3384
const std::string & GetMappingTableName() const
Get the name of the mapping table for many-to-many relationships.
Definition gdal_priv.h:3173
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:3215
GDALRelationshipCardinality GetCardinality() const
Get the cardinality of the relationship.
Definition gdal_priv.h:3148
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:3226
void SetForwardPathLabel(const std::string &osLabel)
Sets the label of the forward path for the relationship.
Definition gdal_priv.h:3329
void SetBackwardPathLabel(const std::string &osLabel)
Sets the label of the backward path for the relationship.
Definition gdal_priv.h:3369
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:3204
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:3271
static GDALRelationship * FromHandle(GDALRelationshipH hRelationship)
Convert a GDALRelationshipH to a GDALRelationship*.
Definition gdal_priv.h:3413
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:3248
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:3131
GDALRelationshipType GetType() const
Get the type of the relationship.
Definition gdal_priv.h:3280
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:3193
const std::string & GetRightTableName() const
Get the name of the right (or related/destination) table in the relationship.
Definition gdal_priv.h:3164
void SetRelatedTableType(const std::string &osType)
Sets the type string of the related table.
Definition gdal_priv.h:3399
A simple feature, including geometry and attributes.
Definition ogr_feature.h:497
Definition of a field domain.
Definition ogr_feature.h:1161
Abstract base class for all geometry classes.
Definition ogr_geometry.h:335
This class represents a layer of simple features, with access methods.
Definition ogrsf_frmts.h:73
This class represents an OpenGIS Spatial Reference System, and contains methods for converting betwee...
Definition ogr_spatialref.h:167
This class represents a style table.
Definition ogr_featurestyle.h:85
Various convenience functions for CPL.
CPLErr
Error category.
Definition cpl_error.h:53
int CPLErrorNum
Error number.
Definition cpl_error.h:95
Definitions for CPL mini XML Parser/Serializer.
int GPtrDiff_t
Integer type large enough to hold the difference between 2 addresses.
Definition cpl_port.h:274
#define CPL_NULL_TERMINATED
Null terminated variadic.
Definition cpl_port.h:945
unsigned long long GUIntBig
Large unsigned integer type (generally 64-bit unsigned integer type).
Definition cpl_port.h:236
#define CPL_C_END
Macro to end a block of C symbols.
Definition cpl_port.h:317
#define CPL_C_START
Macro to start a block of C symbols.
Definition cpl_port.h:313
GIntBig GInt64
Signed 64 bit integer type.
Definition cpl_port.h:254
#define CPL_PRINT_FUNC_FORMAT(format_idx, arg_idx)
Tag a function to have printf() formatting.
Definition cpl_port.h:957
#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:1049
char ** CSLConstList
Type of a constant null-terminated list of nul terminated strings.
Definition cpl_port.h:1190
GUIntBig GUInt64
Unsigned 64 bit integer type.
Definition cpl_port.h:256
#define CPL_WARN_UNUSED_RESULT
Qualifier to warn when the return value of a function is not used.
Definition cpl_port.h:983
unsigned char GByte
Unsigned byte type.
Definition cpl_port.h:205
long long GIntBig
Large signed integer type (generally 64-bit integer type).
Definition cpl_port.h:233
Various convenience functions for working with strings and string lists.
struct CPLVirtualMem CPLVirtualMem
Opaque type that represents a virtual memory mapping.
Definition cpl_virtualmem.h:62
Standard C Covers.
FILE VSILFILE
Opaque type for a FILE that implements the VSIVirtualHandle API.
Definition cpl_vsi.h:162
GUIntBig vsi_l_offset
Type for a file offset.
Definition cpl_vsi.h:146
Public (C callable) GDAL entry points.
GIntBig GSpacing
Type to express pixel, line or band spacing.
Definition gdal.h:314
GDALAccess
Definition gdal.h:124
@ GA_ReadOnly
Definition gdal.h:125
void GDALClose(GDALDatasetH)
Close GDAL dataset.
Definition gdaldataset.cpp:3658
GDALPaletteInterp
Definition gdal.h:252
@ GPI_RGB
Definition gdal.h:254
GDALDataType
Definition gdal.h:64
@ GDT_Byte
Definition gdal.h:66
@ GDT_Float64
Definition gdal.h:74
@ GDT_Unknown
Definition gdal.h:65
void * GDALDatasetH
Opaque type used for the C bindings of the C++ GDALDataset class.
Definition gdal.h:290
GDALExtendedDataTypeClass
Enumeration giving the class of a GDALExtendedDataType.
Definition gdal.h:320
@ GEDTC_NUMERIC
Numeric value.
Definition gdal.h:322
GDALRelationshipCardinality
Cardinality of relationship.
Definition gdal.h:1768
@ GRC_ONE_TO_MANY
One-to-many.
Definition gdal.h:1772
GDALRIOResampleAlg
RasterIO() resampling method.
Definition gdal.h:142
void * GDALRelationshipH
Opaque type used for the C bindings of the C++ GDALRelationship class.
Definition gdal.h:311
int GDALGetDataTypeSizeBytes(GDALDataType)
Get data type size in bytes.
Definition gdal_misc.cpp:329
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:3232
GDALExtendedDataTypeSubType
Enumeration giving the subtype of a GDALExtendedDataType.
Definition gdal.h:333
@ GEDTST_NONE
None.
Definition gdal.h:335
void * GDALMajorObjectH
Opaque type used for the C bindings of the C++ GDALMajorObject class.
Definition gdal.h:287
GDALColorInterp
Definition gdal.h:226
GDALRelationshipType
Type of relationship.
Definition gdal.h:1784
@ GRT_ASSOCIATION
Association relationship.
Definition gdal.h:1788
GDALAsyncStatusType
status of the asynchronous stream
Definition gdal.h:110
void * GDALDriverH
Opaque type used for the C bindings of the C++ GDALDriver class.
Definition gdal.h:296
GDALRWFlag
Definition gdal.h:131
void * GDALRasterBandH
Opaque type used for the C bindings of the C++ GDALRasterBand class.
Definition gdal.h:293
void * GDALColorTableH
Opaque type used for the C bindings of the C++ GDALColorTable class.
Definition gdal.h:299
std::unique_ptr< GDALDataset, GDALDatasetUniquePtrDeleter > GDALDatasetUniquePtr
Unique pointer type for GDALDataset.
Definition gdal_priv.h:934
constexpr GDALSuggestedBlockAccessPattern GSBAP_UNKNOWN
Unknown, or no particular read order is suggested.
Definition gdal_priv.h:1220
int GDALSuggestedBlockAccessPattern
Suggested/most efficient access pattern to blocks.
Definition gdal_priv.h:1217
constexpr GDALSuggestedBlockAccessPattern GSBAP_RANDOM
Random access to blocks is efficient.
Definition gdal_priv.h:1223
GDALDriverManager * GetGDALDriverManager(void)
Fetch the global GDAL driver manager.
Definition gdaldrivermanager.cpp:102
GDALMaskValueRange
Range of values found in a mask band.
Definition gdal_priv.h:1209
@ GMVR_0_AND_1_ONLY
Definition gdal_priv.h:1212
@ GMVR_0_AND_255_ONLY
Definition gdal_priv.h:1213
constexpr GDALSuggestedBlockAccessPattern GSBAP_TOP_TO_BOTTOM
Reading by strips from top to bottom is the most efficient.
Definition gdal_priv.h:1226
GDALIdentifyEnum
Enumeration used by GDALDriver::pfnIdentify().
Definition gdal_priv.h:1615
@ GDAL_IDENTIFY_TRUE
Identify determined the file is recognized by the probed driver.
Definition gdal_priv.h:1622
@ GDAL_IDENTIFY_FALSE
Identify determined the file is not recognized by the probed driver.
Definition gdal_priv.h:1620
@ GDAL_IDENTIFY_UNKNOWN
Identify could not determine if the file is recognized or not by the probed driver.
Definition gdal_priv.h:1618
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:1233
constexpr GDALSuggestedBlockAccessPattern GSBAP_BOTTOM_TO_TOP
Reading by strips from bottom to top is the most efficient.
Definition gdal_priv.h:1229
Core portability services for cross-platform OGR code.
OGRwkbGeometryType
List of well known binary geometry types.
Definition ogr_core.h:407
@ wkbUnknown
unknown type, non-standard
Definition ogr_core.h:408
int OGRErr
Type for a OGR error.
Definition ogr_core.h:378
Simple feature classes.
std::unique_ptr< OGRFeature, OGRFeatureUniquePtrDeleter > OGRFeatureUniquePtr
Unique pointer type for OGRFeature.
Definition ogr_feature.h:1106
OGRLayer::FeatureIterator begin(OGRLayer *poLayer)
Return begin of feature iterator.
Definition ogrsf_frmts.h:345
OGRLayer::FeatureIterator end(OGRLayer *poLayer)
Return end of feature iterator.
Definition ogrsf_frmts.h:353
Document node structure.
Definition cpl_minixml.h:70
Color tuple.
Definition gdal.h:1609
Object returned by GetFeatures() iterators.
Definition gdal_priv.h:685
Structure to pass extra arguments to RasterIO() method, must be initialized with INIT_RASTERIO_EXTRA_...
Definition gdal.h:175
Ground Control Point.
Definition gdal.h:959