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 "gdalsubdatasetinfo.h"
64#include "cpl_vsi.h"
65#include "cpl_conv.h"
66#include "cpl_string.h"
67#include "cpl_minixml.h"
68#include "cpl_multiproc.h"
69#include "cpl_atomic_ops.h"
70
71#include <stdarg.h>
72
73#include <cmath>
74#include <cstdint>
75#include <iterator>
76#include <limits>
77#include <map>
78#include <memory>
79#include <set>
80#include <vector>
81
82#include "ogr_core.h"
83#include "ogr_feature.h"
84
86#define GMO_VALID 0x0001
87#define GMO_IGNORE_UNIMPLEMENTED 0x0002
88#define GMO_SUPPORT_MD 0x0004
89#define GMO_SUPPORT_MDMD 0x0008
90#define GMO_MD_DIRTY 0x0010
91#define GMO_PAM_CLASS 0x0020
92
94
95/************************************************************************/
96/* GDALMultiDomainMetadata */
97/************************************************************************/
98
100class CPL_DLL GDALMultiDomainMetadata
101{
102 private:
103 CPLStringList aosDomainList{};
104
105 struct Comparator
106 {
107 bool operator()(const char *a, const char *b) const
108 {
109 return STRCASECMP(a, b) < 0;
110 }
111 };
112
113 std::map<const char *, CPLStringList, Comparator> oMetadata{};
114
115 public:
116 GDALMultiDomainMetadata();
117 ~GDALMultiDomainMetadata();
118
119 int XMLInit(const CPLXMLNode *psMetadata, int bMerge);
120 CPLXMLNode *Serialize() const;
121
122 CSLConstList GetDomainList() const
123 {
124 return aosDomainList.List();
125 }
126
127 char **GetMetadata(const char *pszDomain = "");
128 CPLErr SetMetadata(CSLConstList papszMetadata, const char *pszDomain = "");
129 const char *GetMetadataItem(const char *pszName,
130 const char *pszDomain = "");
131 CPLErr SetMetadataItem(const char *pszName, const char *pszValue,
132 const char *pszDomain = "");
133
134 void Clear();
135
136 inline void clear()
137 {
138 Clear();
139 }
140
141 private:
142 CPL_DISALLOW_COPY_ASSIGN(GDALMultiDomainMetadata)
143};
144
146
147/* ******************************************************************** */
148/* GDALMajorObject */
149/* */
150/* Base class providing metadata, description and other */
151/* services shared by major objects. */
152/* ******************************************************************** */
153
155class CPL_DLL GDALMajorObject
156{
157 protected:
159 int nFlags; // GMO_* flags.
160 CPLString sDescription{};
161 GDALMultiDomainMetadata oMDMD{};
162
164
165 char **BuildMetadataDomainList(char **papszList, int bCheckNonEmpty,
167
168 public:
170 virtual ~GDALMajorObject();
171
172 int GetMOFlags() const;
173 void SetMOFlags(int nFlagsIn);
174
175 virtual const char *GetDescription() const;
176 virtual void SetDescription(const char *);
177
178 virtual char **GetMetadataDomainList();
179
180 virtual char **GetMetadata(const char *pszDomain = "");
181 virtual CPLErr SetMetadata(char **papszMetadata,
182 const char *pszDomain = "");
183 virtual const char *GetMetadataItem(const char *pszName,
184 const char *pszDomain = "");
185 virtual CPLErr SetMetadataItem(const char *pszName, const char *pszValue,
186 const char *pszDomain = "");
187
191 static inline GDALMajorObjectH ToHandle(GDALMajorObject *poMajorObject)
192 {
193 return static_cast<GDALMajorObjectH>(poMajorObject);
194 }
195
199 static inline GDALMajorObject *FromHandle(GDALMajorObjectH hMajorObject)
200 {
201 return static_cast<GDALMajorObject *>(hMajorObject);
202 }
203};
204
205/* ******************************************************************** */
206/* GDALDefaultOverviews */
207/* ******************************************************************** */
208
210class CPL_DLL GDALDefaultOverviews
211{
212 friend class GDALDataset;
213
214 GDALDataset *poDS;
215 GDALDataset *poODS;
216
217 CPLString osOvrFilename{};
218
219 bool bOvrIsAux;
220
221 bool bCheckedForMask;
222 bool bOwnMaskDS;
223 GDALDataset *poMaskDS;
224
225 // For "overview datasets" we record base level info so we can
226 // find our way back to get overview masks.
227 GDALDataset *poBaseDS;
228
229 // Stuff for deferred initialize/overviewscans.
230 bool bCheckedForOverviews;
231 void OverviewScan();
232 char *pszInitName;
233 bool bInitNameIsOVR;
234 char **papszInitSiblingFiles;
235
236 public:
237 GDALDefaultOverviews();
238 ~GDALDefaultOverviews();
239
240 void Initialize(GDALDataset *poDSIn, const char *pszName = nullptr,
241 char **papszSiblingFiles = nullptr, int bNameIsOVR = FALSE);
242
243 void TransferSiblingFiles(char **papszSiblingFiles);
244
245 int IsInitialized();
246
247 int CloseDependentDatasets();
248
249 // Overview Related
250
251 int GetOverviewCount(int nBand);
252 GDALRasterBand *GetOverview(int nBand, int iOverview);
253
254 CPLErr BuildOverviews(const char *pszBasename, const char *pszResampling,
255 int nOverviews, const int *panOverviewList,
256 int nBands, const int *panBandList,
257 GDALProgressFunc pfnProgress, void *pProgressData,
258 CSLConstList papszOptions);
259
260 CPLErr BuildOverviewsSubDataset(const char *pszPhysicalFile,
261 const char *pszResampling, int nOverviews,
262 const int *panOverviewList, int nBands,
263 const int *panBandList,
264 GDALProgressFunc pfnProgress,
265 void *pProgressData,
266 CSLConstList papszOptions);
267
268 CPLErr CleanOverviews();
269
270 // Mask Related
271
272 CPLErr CreateMaskBand(int nFlags, int nBand = -1);
273 GDALRasterBand *GetMaskBand(int nBand);
274 int GetMaskFlags(int nBand);
275
276 int HaveMaskFile(char **papszSiblings = nullptr,
277 const char *pszBasename = nullptr);
278
279 char **GetSiblingFiles()
280 {
281 return papszInitSiblingFiles;
282 }
283
284 private:
285 CPL_DISALLOW_COPY_ASSIGN(GDALDefaultOverviews)
286};
287
289
290/* ******************************************************************** */
291/* GDALOpenInfo */
292/* ******************************************************************** */
293
295class CPL_DLL GDALOpenInfo
296{
297 bool bHasGotSiblingFiles;
298 char **papszSiblingFiles;
299 int nHeaderBytesTried;
300
301 public:
302 GDALOpenInfo(const char *pszFile, int nOpenFlagsIn,
303 const char *const *papszSiblingFiles = nullptr);
304 ~GDALOpenInfo(void);
305
310
315
320
323
328
330 const char *const *papszAllowedDrivers;
331
332 int TryToIngest(int nBytes);
333 char **GetSiblingFiles();
334 char **StealSiblingFiles();
335 bool AreSiblingFilesLoaded() const;
336
337 private:
339};
340
341/* ******************************************************************** */
342/* gdal::GCP */
343/* ******************************************************************** */
344
345namespace gdal
346{
354class CPL_DLL GCP
355{
356 public:
357 explicit GCP(const char *pszId = "", const char *pszInfo = "",
358 double dfPixel = 0, double dfLine = 0, double dfX = 0,
359 double dfY = 0, double dfZ = 0);
360 ~GCP();
361 GCP(const GCP &);
362 explicit GCP(const GDAL_GCP &other);
363 GCP &operator=(const GCP &);
364 GCP(GCP &&);
365 GCP &operator=(GCP &&);
366
368 inline const char *Id() const
369 {
370 return gcp.pszId;
371 }
372
373 void SetId(const char *pszId);
374
376 inline const char *Info() const
377 {
378 return gcp.pszInfo;
379 }
380
381 void SetInfo(const char *pszInfo);
382
384 inline double Pixel() const
385 {
386 return gcp.dfGCPPixel;
387 }
388
390 inline double &Pixel()
391 {
392 return gcp.dfGCPPixel;
393 }
394
396 inline double Line() const
397 {
398 return gcp.dfGCPLine;
399 }
400
402 inline double &Line()
403 {
404 return gcp.dfGCPLine;
405 }
406
408 inline double X() const
409 {
410 return gcp.dfGCPX;
411 }
412
414 inline double &X()
415 {
416 return gcp.dfGCPX;
417 }
418
420 inline double Y() const
421 {
422 return gcp.dfGCPY;
423 }
424
426 inline double &Y()
427 {
428 return gcp.dfGCPY;
429 }
430
432 inline double Z() const
433 {
434 return gcp.dfGCPZ;
435 }
436
438 inline double &Z()
439 {
440 return gcp.dfGCPZ;
441 }
442
444 inline const GDAL_GCP *c_ptr() const
445 {
446 return &gcp;
447 }
448
449 static const GDAL_GCP *c_ptr(const std::vector<GCP> &asGCPs);
450
451 static std::vector<GCP> fromC(const GDAL_GCP *pasGCPList, int nGCPCount);
452
453 private:
454 GDAL_GCP gcp;
455};
456
457} /* namespace gdal */
458
459/* ******************************************************************** */
460/* GDALDataset */
461/* ******************************************************************** */
462
463class OGRLayer;
464class OGRGeometry;
466class OGRStyleTable;
467class swq_select;
468class swq_select_parse_options;
469class GDALGroup;
470
472typedef struct GDALSQLParseInfo GDALSQLParseInfo;
474
476#ifdef GDAL_COMPILATION
477#define OPTIONAL_OUTSIDE_GDAL(val)
478#else
479#define OPTIONAL_OUTSIDE_GDAL(val) = val
480#endif
482
484class CPL_DLL GDALDataset : public GDALMajorObject
485{
486 friend GDALDatasetH CPL_STDCALL
487 GDALOpenEx(const char *pszFilename, unsigned int nOpenFlags,
488 const char *const *papszAllowedDrivers,
489 const char *const *papszOpenOptions,
490 const char *const *papszSiblingFiles);
491 friend CPLErr CPL_STDCALL GDALClose(GDALDatasetH hDS);
492
493 friend class GDALDriver;
494 friend class GDALDefaultOverviews;
495 friend class GDALProxyDataset;
496 friend class GDALDriverManager;
497
498 CPL_INTERNAL void AddToDatasetOpenList();
499
500 CPL_INTERNAL void UnregisterFromSharedDataset();
501
502 CPL_INTERNAL static void ReportErrorV(const char *pszDSName,
503 CPLErr eErrClass, CPLErrorNum err_no,
504 const char *fmt, va_list args);
505
506 protected:
508 GDALDriver *poDriver = nullptr;
509 GDALAccess eAccess = GA_ReadOnly;
510
511 // Stored raster information.
512 int nRasterXSize = 512;
513 int nRasterYSize = 512;
514 int nBands = 0;
515 GDALRasterBand **papoBands = nullptr;
516
517 static constexpr int OPEN_FLAGS_CLOSED = -1;
518 int nOpenFlags =
519 0; // set to OPEN_FLAGS_CLOSED after Close() has been called
520
521 int nRefCount = 1;
522 bool bForceCachedIO = false;
523 bool bShared = false;
524 bool bIsInternal = true;
525 bool bSuppressOnClose = false;
526
527 mutable std::map<std::string, std::unique_ptr<OGRFieldDomain>>
528 m_oMapFieldDomains{};
529
530 GDALDataset(void);
531 explicit GDALDataset(int bForceCachedIO);
532
533 void RasterInitialize(int, int);
534 void SetBand(int, GDALRasterBand *);
535 void SetBand(int nNewBand, std::unique_ptr<GDALRasterBand> poBand);
536
537 GDALDefaultOverviews oOvManager{};
538
539 virtual CPLErr IBuildOverviews(const char *, int, const int *, int,
540 const int *, GDALProgressFunc, void *,
541 CSLConstList papszOptions);
542
543 virtual CPLErr
544 IRasterIO(GDALRWFlag, int, int, int, int, void *, int, int, GDALDataType,
545 int, int *, GSpacing, GSpacing, GSpacing,
547
548 CPLErr
549 BlockBasedRasterIO(GDALRWFlag, int, int, int, int, void *, int, int,
550 GDALDataType, int, int *, GSpacing, GSpacing, GSpacing,
552 CPLErr BlockBasedFlushCache(bool bAtClosing);
553
554 CPLErr
555 BandBasedRasterIO(GDALRWFlag eRWFlag, int nXOff, int nYOff, int nXSize,
556 int nYSize, void *pData, int nBufXSize, int nBufYSize,
557 GDALDataType eBufType, int nBandCount, int *panBandMap,
558 GSpacing nPixelSpace, GSpacing nLineSpace,
559 GSpacing nBandSpace,
561
562 CPLErr
563 RasterIOResampled(GDALRWFlag eRWFlag, int nXOff, int nYOff, int nXSize,
564 int nYSize, void *pData, int nBufXSize, int nBufYSize,
565 GDALDataType eBufType, int nBandCount, int *panBandMap,
566 GSpacing nPixelSpace, GSpacing nLineSpace,
567 GSpacing nBandSpace,
569
570 CPLErr ValidateRasterIOOrAdviseReadParameters(
571 const char *pszCallingFunc, int *pbStopProcessingOnCENone, int nXOff,
572 int nYOff, int nXSize, int nYSize, int nBufXSize, int nBufYSize,
573 int nBandCount, int *panBandMap);
574
575 CPLErr TryOverviewRasterIO(GDALRWFlag eRWFlag, int nXOff, int nYOff,
576 int nXSize, int nYSize, void *pData,
577 int nBufXSize, int nBufYSize,
578 GDALDataType eBufType, int nBandCount,
579 int *panBandMap, GSpacing nPixelSpace,
580 GSpacing nLineSpace, GSpacing nBandSpace,
581 GDALRasterIOExtraArg *psExtraArg, int *pbTried);
582
583 void ShareLockWithParentDataset(GDALDataset *poParentDataset);
584
586
587 void CleanupPostFileClosing();
588
589 virtual int CloseDependentDatasets();
591 int ValidateLayerCreationOptions(const char *const *papszLCO);
592
593 char **papszOpenOptions = nullptr;
594
595 friend class GDALRasterBand;
596
597 // The below methods related to read write mutex are fragile logic, and
598 // should not be used by out-of-tree code if possible.
599 int EnterReadWrite(GDALRWFlag eRWFlag);
600 void LeaveReadWrite();
601 void InitRWLock();
602
603 void TemporarilyDropReadWriteLock();
604 void ReacquireReadWriteLock();
605
606 void DisableReadWriteMutex();
607
608 int AcquireMutex();
609 void ReleaseMutex();
610
611 bool IsAllBands(int nBandCount, const int *panBandList) const;
613
614 public:
615 ~GDALDataset() override;
616
617 virtual CPLErr Close();
618
619 int GetRasterXSize();
620 int GetRasterYSize();
621 int GetRasterCount();
622 GDALRasterBand *GetRasterBand(int);
623
630 virtual bool SetQueryLoggerFunc(GDALQueryLoggerFunc pfnQueryLoggerFuncIn,
631 void *poQueryLoggerArgIn);
632
635 class CPL_DLL Bands
636 {
637 private:
638 friend class GDALDataset;
639 GDALDataset *m_poSelf;
640
641 CPL_INTERNAL explicit Bands(GDALDataset *poSelf) : m_poSelf(poSelf)
642 {
643 }
644
645 class CPL_DLL Iterator
646 {
647 struct Private;
648 std::unique_ptr<Private> m_poPrivate;
649
650 public:
651 Iterator(GDALDataset *poDS, bool bStart);
652 Iterator(const Iterator &oOther); // declared but not defined.
653 // Needed for gcc 5.4 at least
654 Iterator(Iterator &&oOther) noexcept; // declared but not defined.
655 // Needed for gcc 5.4 at least
656 ~Iterator();
657 GDALRasterBand *operator*();
658 Iterator &operator++();
659 bool operator!=(const Iterator &it) const;
660 };
661
662 public:
663 const Iterator begin() const;
664
665 const Iterator end() const;
666
667 size_t size() const;
668
669 GDALRasterBand *operator[](int iBand);
670 GDALRasterBand *operator[](size_t iBand);
671 };
672
673 Bands GetBands();
674
675 virtual CPLErr FlushCache(bool bAtClosing = false);
676 virtual CPLErr DropCache();
677
678 virtual GIntBig GetEstimatedRAMUsage();
679
680 virtual const OGRSpatialReference *GetSpatialRef() const;
681 virtual CPLErr SetSpatialRef(const OGRSpatialReference *poSRS);
682
683 // Compatibility layer
684 const char *GetProjectionRef(void) const;
685 CPLErr SetProjection(const char *pszProjection);
686
687 virtual CPLErr GetGeoTransform(double *padfTransform);
688 virtual CPLErr SetGeoTransform(double *padfTransform);
689
690 virtual CPLErr AddBand(GDALDataType eType, char **papszOptions = nullptr);
691
692 virtual void *GetInternalHandle(const char *pszHandleName);
693 virtual GDALDriver *GetDriver(void);
694 virtual char **GetFileList(void);
695
696 virtual const char *GetDriverName();
697
698 virtual const OGRSpatialReference *GetGCPSpatialRef() const;
699 virtual int GetGCPCount();
700 virtual const GDAL_GCP *GetGCPs();
701 virtual CPLErr SetGCPs(int nGCPCount, const GDAL_GCP *pasGCPList,
702 const OGRSpatialReference *poGCP_SRS);
703
704 // Compatibility layer
705 const char *GetGCPProjection();
706 CPLErr SetGCPs(int nGCPCount, const GDAL_GCP *pasGCPList,
707 const char *pszGCPProjection);
708
709 virtual CPLErr AdviseRead(int nXOff, int nYOff, int nXSize, int nYSize,
710 int nBufXSize, int nBufYSize, GDALDataType eDT,
711 int nBandCount, int *panBandList,
712 char **papszOptions);
713
714 virtual CPLErr CreateMaskBand(int nFlagsIn);
715
716 virtual GDALAsyncReader *
717 BeginAsyncReader(int nXOff, int nYOff, int nXSize, int nYSize, void *pBuf,
718 int nBufXSize, int nBufYSize, GDALDataType eBufType,
719 int nBandCount, int *panBandMap, int nPixelSpace,
720 int nLineSpace, int nBandSpace, char **papszOptions);
721 virtual void EndAsyncReader(GDALAsyncReader *);
722
724 struct RawBinaryLayout
725 {
726 enum class Interleaving
727 {
728 UNKNOWN,
729 BIP,
730 BIL,
731 BSQ
732 };
733 std::string osRawFilename{};
734 Interleaving eInterleaving = Interleaving::UNKNOWN;
735 GDALDataType eDataType = GDT_Unknown;
736 bool bLittleEndianOrder = false;
737
738 vsi_l_offset nImageOffset = 0;
739 GIntBig nPixelOffset = 0;
740 GIntBig nLineOffset = 0;
741 GIntBig nBandOffset = 0;
742 };
743
744 virtual bool GetRawBinaryLayout(RawBinaryLayout &);
746
747 CPLErr RasterIO(GDALRWFlag, int, int, int, int, void *, int, int,
748 GDALDataType, int, int *, GSpacing, GSpacing, GSpacing,
749 GDALRasterIOExtraArg *psExtraArg
750#ifndef DOXYGEN_SKIP
751 OPTIONAL_OUTSIDE_GDAL(nullptr)
752#endif
754
755 virtual CPLStringList GetCompressionFormats(int nXOff, int nYOff,
756 int nXSize, int nYSize,
757 int nBandCount,
758 const int *panBandList);
759 virtual CPLErr ReadCompressedData(const char *pszFormat, int nXOff,
760 int nYOff, int nXSize, int nYSize,
761 int nBands, const int *panBandList,
762 void **ppBuffer, size_t *pnBufferSize,
763 char **ppszDetailedFormat);
764
765 int Reference();
766 int Dereference();
767 int ReleaseRef();
768
773 {
774 return eAccess;
775 }
776
777 int GetShared() const;
778 void MarkAsShared();
779
780 void MarkSuppressOnClose();
781 void UnMarkSuppressOnClose();
782
787 {
788 return bSuppressOnClose;
789 }
790
795 {
796 return papszOpenOptions;
797 }
798
799 static GDALDataset **GetOpenDatasets(int *pnDatasetCount);
800
801 CPLErr BuildOverviews(const char *, int, const int *, int, const int *,
802 GDALProgressFunc, void *,
803 CSLConstList papszOptions
804#ifndef DOXYGEN_SKIP
805 OPTIONAL_OUTSIDE_GDAL(nullptr)
806#endif
807 );
808
809#ifndef DOXYGEN_XML
810 void ReportError(CPLErr eErrClass, CPLErrorNum err_no, const char *fmt, ...)
812
813 static void ReportError(const char *pszDSName, CPLErr eErrClass,
814 CPLErrorNum err_no, const char *fmt, ...)
816#endif
817
818 char **GetMetadata(const char *pszDomain = "") override;
819
820// Only defined when Doxygen enabled
821#ifdef DOXYGEN_SKIP
822 CPLErr SetMetadata(char **papszMetadata, const char *pszDomain) override;
823 CPLErr SetMetadataItem(const char *pszName, const char *pszValue,
824 const char *pszDomain) override;
825#endif
826
827 char **GetMetadataDomainList() override;
828
829 virtual void ClearStatistics();
830
834 static inline GDALDatasetH ToHandle(GDALDataset *poDS)
835 {
836 return static_cast<GDALDatasetH>(poDS);
837 }
838
843 {
844 return static_cast<GDALDataset *>(hDS);
845 }
846
850 static GDALDataset *Open(const char *pszFilename,
851 unsigned int nOpenFlags = 0,
852 const char *const *papszAllowedDrivers = nullptr,
853 const char *const *papszOpenOptions = nullptr,
854 const char *const *papszSiblingFiles = nullptr)
855 {
856 return FromHandle(GDALOpenEx(pszFilename, nOpenFlags,
857 papszAllowedDrivers, papszOpenOptions,
858 papszSiblingFiles));
859 }
860
863 {
866
868 OGRLayer *layer = nullptr;
869 };
870
872 // SetEnableOverviews() only to be used by GDALOverviewDataset
873 void SetEnableOverviews(bool bEnable);
874
875 // Only to be used by driver's GetOverviewCount() method.
876 bool AreOverviewsEnabled() const;
878
879 private:
880 class Private;
881 Private *m_poPrivate;
882
883 CPL_INTERNAL OGRLayer *BuildLayerFromSelectInfo(
884 swq_select *psSelectInfo, OGRGeometry *poSpatialFilter,
885 const char *pszDialect, swq_select_parse_options *poSelectParseOptions);
886 CPLStringList oDerivedMetadataList{};
887
888 public:
889 virtual int GetLayerCount();
890 virtual OGRLayer *GetLayer(int iLayer);
891
892 virtual bool IsLayerPrivate(int iLayer) const;
893
897 class CPL_DLL Layers
898 {
899 private:
900 friend class GDALDataset;
901 GDALDataset *m_poSelf;
902
903 CPL_INTERNAL explicit Layers(GDALDataset *poSelf) : m_poSelf(poSelf)
904 {
905 }
906
907 public:
911 class CPL_DLL Iterator
912 {
913 struct Private;
914 std::unique_ptr<Private> m_poPrivate;
915
916 public:
918 using reference = OGRLayer *;
919 using difference_type = void;
920 using pointer = void;
922 std::input_iterator_tag;
924 Iterator();
925 Iterator(GDALDataset *poDS, bool bStart);
926 Iterator(const Iterator &oOther);
927 Iterator(Iterator &&oOther) noexcept;
930 Iterator &
931 operator=(const Iterator &oOther);
932 Iterator &operator=(
933 Iterator &&oOther) noexcept;
935 OGRLayer *operator*() const;
936 Iterator &operator++();
937 Iterator operator++(int);
938 bool operator!=(const Iterator &it)
939 const;
940 };
941
942 Iterator begin() const;
943 Iterator end() const;
944
945 size_t size() const;
946
947 OGRLayer *operator[](int iLayer);
948 OGRLayer *operator[](size_t iLayer);
949 OGRLayer *operator[](const char *pszLayername);
950 };
951
952 Layers GetLayers();
953
954 virtual OGRLayer *GetLayerByName(const char *);
955 virtual OGRErr DeleteLayer(int iLayer);
956
957 virtual void ResetReading();
958 virtual OGRFeature *GetNextFeature(OGRLayer **ppoBelongingLayer,
959 double *pdfProgressPct,
960 GDALProgressFunc pfnProgress,
961 void *pProgressData);
962
965 class CPL_DLL Features
966 {
967 private:
968 friend class GDALDataset;
969 GDALDataset *m_poSelf;
970
971 CPL_INTERNAL explicit Features(GDALDataset *poSelf) : m_poSelf(poSelf)
972 {
973 }
974
975 class CPL_DLL Iterator
976 {
977 struct Private;
978 std::unique_ptr<Private> m_poPrivate;
979
980 public:
981 Iterator(GDALDataset *poDS, bool bStart);
982 Iterator(const Iterator &oOther); // declared but not defined.
983 // Needed for gcc 5.4 at least
984 Iterator(Iterator &&oOther) noexcept; // declared but not defined.
985 // Needed for gcc 5.4 at least
986 ~Iterator();
987 const FeatureLayerPair &operator*() const;
988 Iterator &operator++();
989 bool operator!=(const Iterator &it) const;
990 };
991
992 public:
993 const Iterator begin() const;
994
995 const Iterator end() const;
996 };
997
998 Features GetFeatures();
999
1000 virtual int TestCapability(const char *);
1001
1002 virtual std::vector<std::string>
1003 GetFieldDomainNames(CSLConstList papszOptions = nullptr) const;
1004
1005 virtual const OGRFieldDomain *GetFieldDomain(const std::string &name) const;
1006
1007 virtual bool AddFieldDomain(std::unique_ptr<OGRFieldDomain> &&domain,
1008 std::string &failureReason);
1009
1010 virtual bool DeleteFieldDomain(const std::string &name,
1011 std::string &failureReason);
1012
1013 virtual bool UpdateFieldDomain(std::unique_ptr<OGRFieldDomain> &&domain,
1014 std::string &failureReason);
1015
1016 virtual std::vector<std::string>
1017 GetRelationshipNames(CSLConstList papszOptions = nullptr) const;
1018
1019 virtual const GDALRelationship *
1020 GetRelationship(const std::string &name) const;
1021
1022 virtual bool
1023 AddRelationship(std::unique_ptr<GDALRelationship> &&relationship,
1024 std::string &failureReason);
1025
1026 virtual bool DeleteRelationship(const std::string &name,
1027 std::string &failureReason);
1028
1029 virtual bool
1030 UpdateRelationship(std::unique_ptr<GDALRelationship> &&relationship,
1031 std::string &failureReason);
1032
1034 OGRLayer *CreateLayer(const char *pszName);
1035
1036 OGRLayer *CreateLayer(const char *pszName, std::nullptr_t);
1038
1039 OGRLayer *CreateLayer(const char *pszName,
1040 const OGRSpatialReference *poSpatialRef,
1042 CSLConstList papszOptions = nullptr);
1043
1044 OGRLayer *CreateLayer(const char *pszName,
1045 const OGRGeomFieldDefn *poGeomFieldDefn,
1046 CSLConstList papszOptions = nullptr);
1047
1048 virtual OGRLayer *CopyLayer(OGRLayer *poSrcLayer, const char *pszNewName,
1049 char **papszOptions = nullptr);
1050
1051 virtual OGRStyleTable *GetStyleTable();
1052 virtual void SetStyleTableDirectly(OGRStyleTable *poStyleTable);
1053
1054 virtual void SetStyleTable(OGRStyleTable *poStyleTable);
1055
1056 virtual OGRLayer *ExecuteSQL(const char *pszStatement,
1057 OGRGeometry *poSpatialFilter,
1058 const char *pszDialect);
1059 virtual void ReleaseResultSet(OGRLayer *poResultsSet);
1060 virtual OGRErr AbortSQL();
1061
1062 int GetRefCount() const;
1063 int GetSummaryRefCount() const;
1064 OGRErr Release();
1065
1066 virtual OGRErr StartTransaction(int bForce = FALSE);
1067 virtual OGRErr CommitTransaction();
1068 virtual OGRErr RollbackTransaction();
1069
1070 virtual std::shared_ptr<GDALGroup> GetRootGroup() const;
1071
1073 static int IsGenericSQLDialect(const char *pszDialect);
1074
1075 // Semi-public methods. Only to be used by in-tree drivers.
1076 GDALSQLParseInfo *
1077 BuildParseInfo(swq_select *psSelectInfo,
1078 swq_select_parse_options *poSelectParseOptions);
1079 static void DestroyParseInfo(GDALSQLParseInfo *psParseInfo);
1080 OGRLayer *ExecuteSQL(const char *pszStatement, OGRGeometry *poSpatialFilter,
1081 const char *pszDialect,
1082 swq_select_parse_options *poSelectParseOptions);
1084
1085 protected:
1086 virtual OGRLayer *ICreateLayer(const char *pszName,
1087 const OGRGeomFieldDefn *poGeomFieldDefn,
1088 CSLConstList papszOptions);
1089
1091 OGRErr ProcessSQLCreateIndex(const char *);
1092 OGRErr ProcessSQLDropIndex(const char *);
1093 OGRErr ProcessSQLDropTable(const char *);
1094 OGRErr ProcessSQLAlterTableAddColumn(const char *);
1095 OGRErr ProcessSQLAlterTableDropColumn(const char *);
1096 OGRErr ProcessSQLAlterTableAlterColumn(const char *);
1097 OGRErr ProcessSQLAlterTableRenameColumn(const char *);
1098
1099 OGRStyleTable *m_poStyleTable = nullptr;
1100
1101 friend class GDALProxyPoolDataset;
1103
1104 private:
1106};
1107
1109struct CPL_DLL GDALDatasetUniquePtrDeleter
1110{
1111 void operator()(GDALDataset *poDataset) const
1112 {
1113 GDALClose(poDataset);
1114 }
1115};
1116
1118
1120struct CPL_DLL GDALDatasetUniquePtrReleaser
1121{
1122 void operator()(GDALDataset *poDataset) const
1123 {
1124 if (poDataset)
1125 poDataset->Release();
1126 }
1127};
1128
1130
1137 std::unique_ptr<GDALDataset, GDALDatasetUniquePtrDeleter>;
1138
1139/* ******************************************************************** */
1140/* GDALRasterBlock */
1141/* ******************************************************************** */
1142
1147class CPL_DLL GDALRasterBlock
1148{
1149 friend class GDALAbstractBandBlockCache;
1150
1151 GDALDataType eType;
1152
1153 bool bDirty;
1154 volatile int nLockCount;
1155
1156 int nXOff;
1157 int nYOff;
1158
1159 int nXSize;
1160 int nYSize;
1161
1162 void *pData;
1163
1164 GDALRasterBand *poBand;
1165
1166 GDALRasterBlock *poNext;
1167 GDALRasterBlock *poPrevious;
1168
1169 bool bMustDetach;
1170
1171 CPL_INTERNAL void Detach_unlocked(void);
1172 CPL_INTERNAL void Touch_unlocked(void);
1173
1174 CPL_INTERNAL void RecycleFor(int nXOffIn, int nYOffIn);
1175
1176 public:
1177 GDALRasterBlock(GDALRasterBand *, int, int);
1178 GDALRasterBlock(int nXOffIn, int nYOffIn); /* only for lookup purpose */
1179 virtual ~GDALRasterBlock();
1180
1181 CPLErr Internalize(void);
1182 void Touch(void);
1183 void MarkDirty(void);
1184 void MarkClean(void);
1185
1187 int AddLock(void)
1188 {
1189 return CPLAtomicInc(&nLockCount);
1190 }
1191
1193 int DropLock(void)
1194 {
1195 return CPLAtomicDec(&nLockCount);
1196 }
1197
1198 void Detach();
1199
1200 CPLErr Write();
1201
1206 {
1207 return eType;
1208 }
1209
1213 int GetXOff() const
1214 {
1215 return nXOff;
1216 }
1217
1221 int GetYOff() const
1222 {
1223 return nYOff;
1224 }
1225
1229 int GetXSize() const
1230 {
1231 return nXSize;
1232 }
1233
1237 int GetYSize() const
1238 {
1239 return nYSize;
1240 }
1241
1245 int GetDirty() const
1246 {
1247 return bDirty;
1248 }
1249
1253 void *GetDataRef(void)
1254 {
1255 return pData;
1256 }
1257
1262 {
1263 return static_cast<GPtrDiff_t>(nXSize) * nYSize *
1265 }
1266
1267 int TakeLock();
1268 int DropLockForRemovalFromStorage();
1269
1273 {
1274 return poBand;
1275 }
1276
1277 static void FlushDirtyBlocks();
1278 static int FlushCacheBlock(int bDirtyBlocksOnly = FALSE);
1279 static void Verify();
1280
1281 static void EnterDisableDirtyBlockFlush();
1282 static void LeaveDisableDirtyBlockFlush();
1283
1284#ifdef notdef
1285 static void CheckNonOrphanedBlocks(GDALRasterBand *poBand);
1286 void DumpBlock();
1287 static void DumpAll();
1288#endif
1289
1290 /* Should only be called by GDALDestroyDriverManager() */
1292 CPL_INTERNAL static void DestroyRBMutex();
1294
1295 private:
1297};
1298
1299/* ******************************************************************** */
1300/* GDALColorTable */
1301/* ******************************************************************** */
1302
1305class CPL_DLL GDALColorTable
1306{
1307 GDALPaletteInterp eInterp;
1308
1309 std::vector<GDALColorEntry> aoEntries{};
1310
1311 public:
1314
1315 GDALColorTable *Clone() const;
1316 int IsSame(const GDALColorTable *poOtherCT) const;
1317
1318 GDALPaletteInterp GetPaletteInterpretation() const;
1319
1320 int GetColorEntryCount() const;
1321 const GDALColorEntry *GetColorEntry(int) const;
1322 int GetColorEntryAsRGB(int, GDALColorEntry *) const;
1323 void SetColorEntry(int, const GDALColorEntry *);
1324 int CreateColorRamp(int, const GDALColorEntry *, int,
1325 const GDALColorEntry *);
1326 bool IsIdentity() const;
1327
1332 {
1333 return static_cast<GDALColorTableH>(poCT);
1334 }
1335
1340 {
1341 return static_cast<GDALColorTable *>(hCT);
1342 }
1343};
1344
1345/* ******************************************************************** */
1346/* GDALAbstractBandBlockCache */
1347/* ******************************************************************** */
1348
1350
1352// only used by GDALRasterBand implementation.
1353
1354class GDALAbstractBandBlockCache
1355{
1356 // List of blocks that can be freed or recycled, and its lock
1357 CPLLock *hSpinLock = nullptr;
1358 GDALRasterBlock *psListBlocksToFree = nullptr;
1359
1360 // Band keep alive counter, and its lock & condition
1361 CPLCond *hCond = nullptr;
1362 CPLMutex *hCondMutex = nullptr;
1363 volatile int nKeepAliveCounter = 0;
1364
1365 volatile int m_nDirtyBlocks = 0;
1366
1367 CPL_DISALLOW_COPY_ASSIGN(GDALAbstractBandBlockCache)
1368
1369 protected:
1370 GDALRasterBand *poBand;
1371
1372 int m_nInitialDirtyBlocksInFlushCache = 0;
1373 int m_nLastTick = -1;
1374 size_t m_nWriteDirtyBlocksDisabled = 0;
1375
1376 void FreeDanglingBlocks();
1377 void UnreferenceBlockBase();
1378
1379 void StartDirtyBlockFlushingLog();
1380 void UpdateDirtyBlockFlushingLog();
1381 void EndDirtyBlockFlushingLog();
1382
1383 public:
1384 explicit GDALAbstractBandBlockCache(GDALRasterBand *poBand);
1385 virtual ~GDALAbstractBandBlockCache();
1386
1387 GDALRasterBlock *CreateBlock(int nXBlockOff, int nYBlockOff);
1388 void AddBlockToFreeList(GDALRasterBlock *);
1389 void IncDirtyBlocks(int nInc);
1390 void WaitCompletionPendingTasks();
1391
1392 void EnableDirtyBlockWriting()
1393 {
1394 --m_nWriteDirtyBlocksDisabled;
1395 }
1396
1397 void DisableDirtyBlockWriting()
1398 {
1399 ++m_nWriteDirtyBlocksDisabled;
1400 }
1401
1402 bool HasDirtyBlocks() const
1403 {
1404 return m_nDirtyBlocks > 0;
1405 }
1406
1407 virtual bool Init() = 0;
1408 virtual bool IsInitOK() = 0;
1409 virtual CPLErr FlushCache() = 0;
1410 virtual CPLErr AdoptBlock(GDALRasterBlock *poBlock) = 0;
1411 virtual GDALRasterBlock *TryGetLockedBlockRef(int nXBlockOff,
1412 int nYBlockYOff) = 0;
1413 virtual CPLErr UnreferenceBlock(GDALRasterBlock *poBlock) = 0;
1414 virtual CPLErr FlushBlock(int nXBlockOff, int nYBlockOff,
1415 int bWriteDirtyBlock) = 0;
1416};
1417
1418GDALAbstractBandBlockCache *
1419GDALArrayBandBlockCacheCreate(GDALRasterBand *poBand);
1420GDALAbstractBandBlockCache *
1421GDALHashSetBandBlockCacheCreate(GDALRasterBand *poBand);
1422
1424
1425/* ******************************************************************** */
1426/* GDALRasterBand */
1427/* ******************************************************************** */
1428
1429class GDALMDArray;
1430
1432typedef enum
1433{
1434 GMVR_UNKNOWN,
1439
1442
1445
1448
1451
1454
1458
1461class CPL_DLL GDALRasterBand : public GDALMajorObject
1462{
1463 private:
1464 friend class GDALArrayBandBlockCache;
1465 friend class GDALHashSetBandBlockCache;
1466 friend class GDALRasterBlock;
1467 friend class GDALDataset;
1468
1469 CPLErr eFlushBlockErr = CE_None;
1470 GDALAbstractBandBlockCache *poBandBlockCache = nullptr;
1471
1472 CPL_INTERNAL void SetFlushBlockErr(CPLErr eErr);
1473 CPL_INTERNAL CPLErr UnreferenceBlock(GDALRasterBlock *poBlock);
1474 CPL_INTERNAL void IncDirtyBlocks(int nInc);
1475
1476 protected:
1478 GDALDataset *poDS = nullptr;
1479 int nBand = 0; /* 1 based */
1480
1481 int nRasterXSize = 0;
1482 int nRasterYSize = 0;
1483
1484 GDALDataType eDataType = GDT_Byte;
1485 GDALAccess eAccess = GA_ReadOnly;
1486
1487 /* stuff related to blocking, and raster cache */
1488 int nBlockXSize = -1;
1489 int nBlockYSize = -1;
1490 int nBlocksPerRow = 0;
1491 int nBlocksPerColumn = 0;
1492
1493 int nBlockReads = 0;
1494 int bForceCachedIO = 0;
1495
1496 class GDALRasterBandOwnedOrNot
1497 {
1498 public:
1499 GDALRasterBandOwnedOrNot()
1500 {
1501 }
1502
1503 GDALRasterBandOwnedOrNot(GDALRasterBand *poBand, bool bOwned)
1504 : m_poBandOwned(bOwned ? poBand : nullptr),
1505 m_poBandRef(bOwned ? nullptr : poBand)
1506 {
1507 }
1508
1509 void reset()
1510 {
1511 m_poBandOwned.reset();
1512 m_poBandRef = nullptr;
1513 }
1514
1515 void reset(GDALRasterBand *poBand, bool bOwned)
1516 {
1517 m_poBandOwned.reset(bOwned ? poBand : nullptr);
1518 m_poBandRef = bOwned ? nullptr : poBand;
1519 }
1520
1521 GDALRasterBand *get()
1522 {
1523 return static_cast<GDALRasterBand *>(*this);
1524 }
1525
1526 bool IsOwned() const
1527 {
1528 return m_poBandOwned != nullptr;
1529 }
1530
1531 operator GDALRasterBand *()
1532 {
1533 return m_poBandOwned ? m_poBandOwned.get() : m_poBandRef;
1534 }
1535
1536 private:
1537 CPL_DISALLOW_COPY_ASSIGN(GDALRasterBandOwnedOrNot)
1538 std::unique_ptr<GDALRasterBand> m_poBandOwned{};
1539 GDALRasterBand *m_poBandRef = nullptr;
1540 };
1541
1542 GDALRasterBandOwnedOrNot poMask{};
1543 bool m_bEnablePixelTypeSignedByteWarning =
1544 true; // Remove me in GDAL 4.0. See GetMetadataItem() implementation
1545 int nMaskFlags = 0;
1546
1547 void InvalidateMaskBand();
1548
1549 friend class GDALProxyRasterBand;
1550 friend class GDALDefaultOverviews;
1551
1552 CPLErr
1553 RasterIOResampled(GDALRWFlag, int, int, int, int, void *, int, int,
1556
1557 int EnterReadWrite(GDALRWFlag eRWFlag);
1558 void LeaveReadWrite();
1559 void InitRWLock();
1560 void SetValidPercent(GUIntBig nSampleCount, GUIntBig nValidCount);
1561
1563
1564 protected:
1565 virtual CPLErr IReadBlock(int nBlockXOff, int nBlockYOff, void *pData) = 0;
1566 virtual CPLErr IWriteBlock(int nBlockXOff, int nBlockYOff, void *pData);
1567
1568 virtual CPLErr
1569 IRasterIO(GDALRWFlag, int, int, int, int, void *, int, int, GDALDataType,
1572
1573 virtual int IGetDataCoverageStatus(int nXOff, int nYOff, int nXSize,
1574 int nYSize, int nMaskFlagStop,
1575 double *pdfDataPct);
1577 CPLErr
1578 OverviewRasterIO(GDALRWFlag, int, int, int, int, void *, int, int,
1581
1582 CPLErr TryOverviewRasterIO(GDALRWFlag eRWFlag, int nXOff, int nYOff,
1583 int nXSize, int nYSize, void *pData,
1584 int nBufXSize, int nBufYSize,
1585 GDALDataType eBufType, GSpacing nPixelSpace,
1586 GSpacing nLineSpace,
1587 GDALRasterIOExtraArg *psExtraArg, int *pbTried);
1588
1589 int InitBlockInfo();
1590
1591 void AddBlockToFreeList(GDALRasterBlock *);
1592
1593 bool HasBlockCache() const
1594 {
1595 return poBandBlockCache != nullptr;
1596 }
1597
1598 bool HasDirtyBlocks() const
1599 {
1600 return poBandBlockCache && poBandBlockCache->HasDirtyBlocks();
1601 }
1602
1604
1605 public:
1607 explicit GDALRasterBand(int bForceCachedIO);
1608
1609 ~GDALRasterBand() override;
1610
1611 int GetXSize();
1612 int GetYSize();
1613 int GetBand();
1614 GDALDataset *GetDataset();
1615
1616 GDALDataType GetRasterDataType(void);
1617 void GetBlockSize(int *, int *);
1618 CPLErr GetActualBlockSize(int, int, int *, int *);
1619
1621 GetSuggestedBlockAccessPattern() const;
1622
1623 GDALAccess GetAccess();
1624
1625 CPLErr RasterIO(GDALRWFlag, int, int, int, int, void *, int, int,
1627 GDALRasterIOExtraArg *psExtraArg
1628#ifndef DOXYGEN_SKIP
1629 OPTIONAL_OUTSIDE_GDAL(nullptr)
1630#endif
1632 CPLErr ReadBlock(int, int, void *) CPL_WARN_UNUSED_RESULT;
1633
1634 CPLErr WriteBlock(int, int, void *) CPL_WARN_UNUSED_RESULT;
1635
1637 GetLockedBlockRef(int nXBlockOff, int nYBlockOff,
1638 int bJustInitialize = FALSE) CPL_WARN_UNUSED_RESULT;
1639 GDALRasterBlock *TryGetLockedBlockRef(int nXBlockOff, int nYBlockYOff)
1641 CPLErr FlushBlock(int, int, int bWriteDirtyBlock = TRUE);
1642
1643 unsigned char *
1644 GetIndexColorTranslationTo(/* const */ GDALRasterBand *poReferenceBand,
1645 unsigned char *pTranslationTable = nullptr,
1646 int *pApproximateMatching = nullptr);
1647
1648 // New OpengIS CV_SampleDimension stuff.
1649
1650 virtual CPLErr FlushCache(bool bAtClosing = false);
1651 virtual CPLErr DropCache();
1652 virtual char **GetCategoryNames();
1653 virtual double GetNoDataValue(int *pbSuccess = nullptr);
1654 virtual int64_t GetNoDataValueAsInt64(int *pbSuccess = nullptr);
1655 virtual uint64_t GetNoDataValueAsUInt64(int *pbSuccess = nullptr);
1656 virtual double GetMinimum(int *pbSuccess = nullptr);
1657 virtual double GetMaximum(int *pbSuccess = nullptr);
1658 virtual double GetOffset(int *pbSuccess = nullptr);
1659 virtual double GetScale(int *pbSuccess = nullptr);
1660 virtual const char *GetUnitType();
1661 virtual GDALColorInterp GetColorInterpretation();
1662 virtual GDALColorTable *GetColorTable();
1663 virtual CPLErr Fill(double dfRealValue, double dfImaginaryValue = 0);
1664
1665 virtual CPLErr SetCategoryNames(char **papszNames);
1666 virtual CPLErr SetNoDataValue(double dfNoData);
1667 virtual CPLErr SetNoDataValueAsInt64(int64_t nNoData);
1668 virtual CPLErr SetNoDataValueAsUInt64(uint64_t nNoData);
1669 virtual CPLErr DeleteNoDataValue();
1670 virtual CPLErr SetColorTable(GDALColorTable *poCT);
1671 virtual CPLErr SetColorInterpretation(GDALColorInterp eColorInterp);
1672 virtual CPLErr SetOffset(double dfNewOffset);
1673 virtual CPLErr SetScale(double dfNewScale);
1674 virtual CPLErr SetUnitType(const char *pszNewValue);
1675
1676 virtual CPLErr GetStatistics(int bApproxOK, int bForce, double *pdfMin,
1677 double *pdfMax, double *pdfMean,
1678 double *padfStdDev);
1679 virtual CPLErr ComputeStatistics(int bApproxOK, double *pdfMin,
1680 double *pdfMax, double *pdfMean,
1681 double *pdfStdDev, GDALProgressFunc,
1682 void *pProgressData);
1683 virtual CPLErr SetStatistics(double dfMin, double dfMax, double dfMean,
1684 double dfStdDev);
1685 virtual CPLErr ComputeRasterMinMax(int, double *);
1686
1687// Only defined when Doxygen enabled
1688#ifdef DOXYGEN_SKIP
1689 CPLErr SetMetadata(char **papszMetadata, const char *pszDomain) override;
1690 CPLErr SetMetadataItem(const char *pszName, const char *pszValue,
1691 const char *pszDomain) override;
1692#endif
1693 virtual const char *GetMetadataItem(const char *pszName,
1694 const char *pszDomain = "") override;
1695
1696 virtual int HasArbitraryOverviews();
1697 virtual int GetOverviewCount();
1698 virtual GDALRasterBand *GetOverview(int);
1699 virtual GDALRasterBand *GetRasterSampleOverview(GUIntBig);
1700 virtual CPLErr BuildOverviews(const char *pszResampling, int nOverviews,
1701 const int *panOverviewList,
1702 GDALProgressFunc pfnProgress,
1703 void *pProgressData,
1704 CSLConstList papszOptions);
1705
1706 virtual CPLErr AdviseRead(int nXOff, int nYOff, int nXSize, int nYSize,
1707 int nBufXSize, int nBufYSize,
1708 GDALDataType eBufType, char **papszOptions);
1709
1710 virtual CPLErr GetHistogram(double dfMin, double dfMax, int nBuckets,
1711 GUIntBig *panHistogram, int bIncludeOutOfRange,
1712 int bApproxOK, GDALProgressFunc,
1713 void *pProgressData);
1714
1715 virtual CPLErr GetDefaultHistogram(double *pdfMin, double *pdfMax,
1716 int *pnBuckets, GUIntBig **ppanHistogram,
1717 int bForce, GDALProgressFunc,
1718 void *pProgressData);
1719 virtual CPLErr SetDefaultHistogram(double dfMin, double dfMax, int nBuckets,
1720 GUIntBig *panHistogram);
1721
1722 virtual GDALRasterAttributeTable *GetDefaultRAT();
1723 virtual CPLErr SetDefaultRAT(const GDALRasterAttributeTable *poRAT);
1724
1725 virtual GDALRasterBand *GetMaskBand();
1726 virtual int GetMaskFlags();
1727 virtual CPLErr CreateMaskBand(int nFlagsIn);
1728 virtual bool IsMaskBand() const;
1729 virtual GDALMaskValueRange GetMaskValueRange() const;
1730
1731 virtual CPLVirtualMem *
1732 GetVirtualMemAuto(GDALRWFlag eRWFlag, int *pnPixelSpace,
1733 GIntBig *pnLineSpace,
1734 char **papszOptions) CPL_WARN_UNUSED_RESULT;
1735
1736 int GetDataCoverageStatus(int nXOff, int nYOff, int nXSize, int nYSize,
1737 int nMaskFlagStop = 0,
1738 double *pdfDataPct = nullptr);
1739
1740 std::shared_ptr<GDALMDArray> AsMDArray() const;
1741
1742#ifndef DOXYGEN_XML
1743 void ReportError(CPLErr eErrClass, CPLErrorNum err_no, const char *fmt, ...)
1745#endif
1746
1751 {
1752 return static_cast<GDALRasterBandH>(poBand);
1753 }
1754
1759 {
1760 return static_cast<GDALRasterBand *>(hBand);
1761 }
1762
1764 // Remove me in GDAL 4.0. See GetMetadataItem() implementation
1765 // Internal use in GDAL only !
1766 void EnablePixelTypeSignedByteWarning(bool b)
1767#ifndef GDAL_COMPILATION
1768 CPL_WARN_DEPRECATED("Do not use that method outside of GDAL!")
1769#endif
1770 ;
1771
1773
1774 private:
1776};
1777
1779/* ******************************************************************** */
1780/* GDALAllValidMaskBand */
1781/* ******************************************************************** */
1782
1783class CPL_DLL GDALAllValidMaskBand : public GDALRasterBand
1784{
1785 protected:
1786 CPLErr IReadBlock(int, int, void *) override;
1787
1788 CPL_DISALLOW_COPY_ASSIGN(GDALAllValidMaskBand)
1789
1790 public:
1791 explicit GDALAllValidMaskBand(GDALRasterBand *);
1792 ~GDALAllValidMaskBand() override;
1793
1794 GDALRasterBand *GetMaskBand() override;
1795 int GetMaskFlags() override;
1796
1797 bool IsMaskBand() const override
1798 {
1799 return true;
1800 }
1801
1802 GDALMaskValueRange GetMaskValueRange() const override
1803 {
1804 return GMVR_0_AND_255_ONLY;
1805 }
1806
1807 CPLErr ComputeStatistics(int bApproxOK, double *pdfMin, double *pdfMax,
1808 double *pdfMean, double *pdfStdDev,
1809 GDALProgressFunc, void *pProgressData) override;
1810};
1811
1812/* ******************************************************************** */
1813/* GDALNoDataMaskBand */
1814/* ******************************************************************** */
1815
1816class CPL_DLL GDALNoDataMaskBand : public GDALRasterBand
1817{
1818 friend class GDALRasterBand;
1819 double m_dfNoDataValue = 0;
1820 int64_t m_nNoDataValueInt64 = 0;
1821 uint64_t m_nNoDataValueUInt64 = 0;
1822 GDALRasterBand *m_poParent = nullptr;
1823
1824 CPL_DISALLOW_COPY_ASSIGN(GDALNoDataMaskBand)
1825
1826 protected:
1827 CPLErr IReadBlock(int, int, void *) override;
1828 CPLErr IRasterIO(GDALRWFlag, int, int, int, int, void *, int, int,
1830 GDALRasterIOExtraArg *psExtraArg) override;
1831
1832 public:
1833 explicit GDALNoDataMaskBand(GDALRasterBand *);
1834 explicit GDALNoDataMaskBand(GDALRasterBand *, double dfNoDataValue);
1835 ~GDALNoDataMaskBand() override;
1836
1837 bool IsMaskBand() const override
1838 {
1839 return true;
1840 }
1841
1842 GDALMaskValueRange GetMaskValueRange() const override
1843 {
1844 return GMVR_0_AND_255_ONLY;
1845 }
1846
1847 static bool IsNoDataInRange(double dfNoDataValue, GDALDataType eDataType);
1848};
1849
1850/* ******************************************************************** */
1851/* GDALNoDataValuesMaskBand */
1852/* ******************************************************************** */
1853
1854class CPL_DLL GDALNoDataValuesMaskBand : public GDALRasterBand
1855{
1856 double *padfNodataValues;
1857
1858 CPL_DISALLOW_COPY_ASSIGN(GDALNoDataValuesMaskBand)
1859
1860 protected:
1861 CPLErr IReadBlock(int, int, void *) override;
1862
1863 public:
1864 explicit GDALNoDataValuesMaskBand(GDALDataset *);
1865 ~GDALNoDataValuesMaskBand() override;
1866
1867 bool IsMaskBand() const override
1868 {
1869 return true;
1870 }
1871
1872 GDALMaskValueRange GetMaskValueRange() const override
1873 {
1874 return GMVR_0_AND_255_ONLY;
1875 }
1876};
1877
1878/* ******************************************************************** */
1879/* GDALRescaledAlphaBand */
1880/* ******************************************************************** */
1881
1882class GDALRescaledAlphaBand : public GDALRasterBand
1883{
1884 GDALRasterBand *poParent;
1885 void *pTemp;
1886
1887 CPL_DISALLOW_COPY_ASSIGN(GDALRescaledAlphaBand)
1888
1889 protected:
1890 CPLErr IReadBlock(int, int, void *) override;
1891 CPLErr IRasterIO(GDALRWFlag, int, int, int, int, void *, int, int,
1893 GDALRasterIOExtraArg *psExtraArg) override;
1894
1895 public:
1896 explicit GDALRescaledAlphaBand(GDALRasterBand *);
1897 ~GDALRescaledAlphaBand() override;
1898
1899 bool IsMaskBand() const override
1900 {
1901 return true;
1902 }
1903};
1904
1906
1907/* ******************************************************************** */
1908/* GDALIdentifyEnum */
1909/* ******************************************************************** */
1910
1916typedef enum
1917{
1926
1927/* ******************************************************************** */
1928/* GDALDriver */
1929/* ******************************************************************** */
1930
1942class CPL_DLL GDALDriver : public GDALMajorObject
1943{
1944 public:
1945 GDALDriver();
1946 ~GDALDriver() override;
1947
1948 CPLErr SetMetadataItem(const char *pszName, const char *pszValue,
1949 const char *pszDomain = "") override;
1950
1951 /* -------------------------------------------------------------------- */
1952 /* Public C++ methods. */
1953 /* -------------------------------------------------------------------- */
1954 GDALDataset *Create(const char *pszName, int nXSize, int nYSize, int nBands,
1955 GDALDataType eType,
1957
1958 GDALDataset *
1959 CreateMultiDimensional(const char *pszName,
1960 CSLConstList papszRootGroupOptions,
1962
1963 CPLErr Delete(const char *pszName);
1964 CPLErr Rename(const char *pszNewName, const char *pszOldName);
1965 CPLErr CopyFiles(const char *pszNewName, const char *pszOldName);
1966
1967 GDALDataset *CreateCopy(const char *, GDALDataset *, int,
1968 CSLConstList papszOptions,
1969 GDALProgressFunc pfnProgress,
1970 void *pProgressData) CPL_WARN_UNUSED_RESULT;
1971
1972 bool CanVectorTranslateFrom(const char *pszDestName,
1973 GDALDataset *poSourceDS,
1974 CSLConstList papszVectorTranslateArguments,
1975 char ***ppapszFailureReasons);
1976
1977 GDALDataset *
1978 VectorTranslateFrom(const char *pszDestName, GDALDataset *poSourceDS,
1979 CSLConstList papszVectorTranslateArguments,
1980 GDALProgressFunc pfnProgress,
1981 void *pProgressData) CPL_WARN_UNUSED_RESULT;
1982
1983 /* -------------------------------------------------------------------- */
1984 /* The following are semiprivate, not intended to be accessed */
1985 /* by anyone but the formats instantiating and populating the */
1986 /* drivers. */
1987 /* -------------------------------------------------------------------- */
1989
1990 // Not aimed at being used outside of GDAL. Use GDALDataset::Open() instead
1991 GDALDataset *Open(GDALOpenInfo *poOpenInfo, bool bSetOpenOptions);
1992
1993 typedef GDALDataset *(*OpenCallback)(GDALOpenInfo *);
1994
1995 OpenCallback pfnOpen = nullptr;
1996
1997 virtual OpenCallback GetOpenCallback()
1998 {
1999 return pfnOpen;
2000 }
2001
2002 typedef GDALDataset *(*CreateCallback)(const char *pszName, int nXSize,
2003 int nYSize, int nBands,
2004 GDALDataType eType,
2005 char **papszOptions);
2006
2007 CreateCallback pfnCreate = nullptr;
2008
2009 virtual CreateCallback GetCreateCallback()
2010 {
2011 return pfnCreate;
2012 }
2013
2014 GDALDataset *(*pfnCreateEx)(GDALDriver *, const char *pszName, int nXSize,
2015 int nYSize, int nBands, GDALDataType eType,
2016 char **papszOptions) = nullptr;
2017
2018 typedef GDALDataset *(*CreateMultiDimensionalCallback)(
2019 const char *pszName, CSLConstList papszRootGroupOptions,
2020 CSLConstList papszOptions);
2021
2022 CreateMultiDimensionalCallback pfnCreateMultiDimensional = nullptr;
2023
2024 virtual CreateMultiDimensionalCallback GetCreateMultiDimensionalCallback()
2025 {
2026 return pfnCreateMultiDimensional;
2027 }
2028
2029 typedef CPLErr (*DeleteCallback)(const char *pszName);
2030 DeleteCallback pfnDelete = nullptr;
2031
2032 virtual DeleteCallback GetDeleteCallback()
2033 {
2034 return pfnDelete;
2035 }
2036
2037 typedef GDALDataset *(*CreateCopyCallback)(const char *, GDALDataset *, int,
2038 char **,
2039 GDALProgressFunc pfnProgress,
2040 void *pProgressData);
2041
2042 CreateCopyCallback pfnCreateCopy = nullptr;
2043
2044 virtual CreateCopyCallback GetCreateCopyCallback()
2045 {
2046 return pfnCreateCopy;
2047 }
2048
2049 void *pDriverData = nullptr;
2050
2051 void (*pfnUnloadDriver)(GDALDriver *) = nullptr;
2052
2061 int (*pfnIdentify)(GDALOpenInfo *) = nullptr;
2062 int (*pfnIdentifyEx)(GDALDriver *, GDALOpenInfo *) = nullptr;
2063
2064 typedef CPLErr (*RenameCallback)(const char *pszNewName,
2065 const char *pszOldName);
2066 RenameCallback pfnRename = nullptr;
2067
2068 virtual RenameCallback GetRenameCallback()
2069 {
2070 return pfnRename;
2071 }
2072
2073 typedef CPLErr (*CopyFilesCallback)(const char *pszNewName,
2074 const char *pszOldName);
2075 CopyFilesCallback pfnCopyFiles = nullptr;
2076
2077 virtual CopyFilesCallback GetCopyFilesCallback()
2078 {
2079 return pfnCopyFiles;
2080 }
2081
2082 // Used for legacy OGR drivers, and Python drivers
2083 GDALDataset *(*pfnOpenWithDriverArg)(GDALDriver *,
2084 GDALOpenInfo *) = nullptr;
2085
2086 /* For legacy OGR drivers */
2087 GDALDataset *(*pfnCreateVectorOnly)(GDALDriver *, const char *pszName,
2088 char **papszOptions) = nullptr;
2089 CPLErr (*pfnDeleteDataSource)(GDALDriver *, const char *pszName) = nullptr;
2090
2095 bool (*pfnCanVectorTranslateFrom)(
2096 const char *pszDestName, GDALDataset *poSourceDS,
2097 CSLConstList papszVectorTranslateArguments,
2098 char ***ppapszFailureReasons) = nullptr;
2099
2104 GDALDataset *(*pfnVectorTranslateFrom)(
2105 const char *pszDestName, GDALDataset *poSourceDS,
2106 CSLConstList papszVectorTranslateArguments,
2107 GDALProgressFunc pfnProgress, void *pProgressData) = nullptr;
2108
2113 GDALSubdatasetInfo *(*pfnGetSubdatasetInfoFunc)(const char *pszFileName) =
2114 nullptr;
2115
2117
2118 /* -------------------------------------------------------------------- */
2119 /* Helper methods. */
2120 /* -------------------------------------------------------------------- */
2122 GDALDataset *DefaultCreateCopy(const char *, GDALDataset *, int,
2123 CSLConstList papszOptions,
2124 GDALProgressFunc pfnProgress,
2125 void *pProgressData) CPL_WARN_UNUSED_RESULT;
2126
2127 static CPLErr DefaultCreateCopyMultiDimensional(
2128 GDALDataset *poSrcDS, GDALDataset *poDstDS, bool bStrict,
2129 CSLConstList /*papszOptions*/, GDALProgressFunc pfnProgress,
2130 void *pProgressData);
2131
2132 static CPLErr DefaultCopyMasks(GDALDataset *poSrcDS, GDALDataset *poDstDS,
2133 int bStrict);
2134 static CPLErr DefaultCopyMasks(GDALDataset *poSrcDS, GDALDataset *poDstDS,
2135 int bStrict, CSLConstList papszOptions,
2136 GDALProgressFunc pfnProgress,
2137 void *pProgressData);
2138
2139 CPLErr QuietDeleteForCreateCopy(const char *pszFilename,
2140 GDALDataset *poSrcDS);
2141
2143 static CPLErr QuietDelete(const char *pszName,
2144 CSLConstList papszAllowedDrivers = nullptr);
2145
2147 static CPLErr DefaultRename(const char *pszNewName, const char *pszOldName);
2148 static CPLErr DefaultCopyFiles(const char *pszNewName,
2149 const char *pszOldName);
2150 static void DefaultCopyMetadata(GDALDataset *poSrcDS, GDALDataset *poDstDS,
2151 CSLConstList papszOptions,
2152 CSLConstList papszExcludedDomains);
2153
2155
2159 static inline GDALDriverH ToHandle(GDALDriver *poDriver)
2160 {
2161 return static_cast<GDALDriverH>(poDriver);
2162 }
2163
2167 static inline GDALDriver *FromHandle(GDALDriverH hDriver)
2168 {
2169 return static_cast<GDALDriver *>(hDriver);
2170 }
2171
2172 private:
2174};
2175
2176/************************************************************************/
2177/* GDALPluginDriverProxy */
2178/************************************************************************/
2179
2180// clang-format off
2218// clang-format on
2220{
2221 const std::string m_osPluginFileName;
2222 std::string m_osPluginFullPath{};
2223 std::unique_ptr<GDALDriver> m_poRealDriver{};
2224 std::set<std::string> m_oSetMetadataItems{};
2225
2226 GDALDriver *GetRealDriver();
2227
2229
2230 protected:
2231 friend class GDALDriverManager;
2232
2234 void SetPluginFullPath(const std::string &osFullPath)
2235 {
2236 m_osPluginFullPath = osFullPath;
2237 }
2238
2240
2241 public:
2242 explicit GDALPluginDriverProxy(const std::string &osPluginFileName);
2243
2245 const std::string &GetPluginFileName() const
2246 {
2247 return m_osPluginFileName;
2248 }
2249
2251 OpenCallback GetOpenCallback() override;
2252
2253 CreateCallback GetCreateCallback() override;
2254
2255 CreateMultiDimensionalCallback GetCreateMultiDimensionalCallback() override;
2256
2257 CreateCopyCallback GetCreateCopyCallback() override;
2258
2259 DeleteCallback GetDeleteCallback() override;
2260
2261 RenameCallback GetRenameCallback() override;
2262
2263 CopyFilesCallback GetCopyFilesCallback() override;
2265
2266 CPLErr SetMetadataItem(const char *pszName, const char *pszValue,
2267 const char *pszDomain = "") override;
2268
2269 char **GetMetadata(const char *pszDomain) override;
2270
2271 const char *GetMetadataItem(const char *pszName,
2272 const char *pszDomain = "") override;
2273};
2274
2275/* ******************************************************************** */
2276/* GDALDriverManager */
2277/* ******************************************************************** */
2278
2287{
2288 int nDrivers = 0;
2289 GDALDriver **papoDrivers = nullptr;
2290 std::map<CPLString, GDALDriver *> oMapNameToDrivers{};
2291 std::string m_osPluginPath{};
2292 std::string m_osDriversIniPath{};
2293 mutable std::string m_osLastTriedDirectory{};
2294 std::set<std::string> m_oSetPluginFileNames{};
2295 bool m_bInDeferredDriverLoading = false;
2296 std::map<std::string, std::unique_ptr<GDALDriver>> m_oMapRealDrivers{};
2297 std::vector<std::unique_ptr<GDALDriver>> m_aoHiddenDrivers{};
2298
2299 GDALDriver *GetDriver_unlocked(int iDriver)
2300 {
2301 return (iDriver >= 0 && iDriver < nDrivers) ? papoDrivers[iDriver]
2302 : nullptr;
2303 }
2304
2305 GDALDriver *GetDriverByName_unlocked(const char *pszName) const
2306 {
2307 auto oIter = oMapNameToDrivers.find(CPLString(pszName).toupper());
2308 return oIter == oMapNameToDrivers.end() ? nullptr : oIter->second;
2309 }
2310
2311 static void CleanupPythonDrivers();
2312
2313 std::string GetPluginFullPath(const char *pszFilename) const;
2314
2315 int RegisterDriver(GDALDriver *, bool bHidden);
2316
2318
2319 protected:
2320 friend class GDALPluginDriverProxy;
2321 friend GDALDatasetH CPL_STDCALL
2322 GDALOpenEx(const char *pszFilename, unsigned int nOpenFlags,
2323 const char *const *papszAllowedDrivers,
2324 const char *const *papszOpenOptions,
2325 const char *const *papszSiblingFiles);
2326
2328 static char **GetSearchPaths(const char *pszGDAL_DRIVER_PATH);
2329 int GetDriverCount(bool bIncludeHidden) const;
2330 GDALDriver *GetDriver(int iDriver, bool bIncludeHidden);
2332
2333 public:
2336
2337 int GetDriverCount(void) const;
2338 GDALDriver *GetDriver(int);
2339 GDALDriver *GetDriverByName(const char *);
2340
2341 int RegisterDriver(GDALDriver *);
2342 void DeregisterDriver(GDALDriver *);
2343
2344 // AutoLoadDrivers is a no-op if compiled with GDAL_NO_AUTOLOAD defined.
2345 void AutoLoadDrivers();
2346 void AutoSkipDrivers();
2347 void ReorderDrivers();
2348 static CPLErr LoadPlugin(const char *name);
2349
2350 static void AutoLoadPythonDrivers();
2351
2352 void DeclareDeferredPluginDriver(GDALPluginDriverProxy *poProxyDriver);
2353};
2354
2358
2359/* ******************************************************************** */
2360/* GDALAsyncReader */
2361/* ******************************************************************** */
2362
2368class CPL_DLL GDALAsyncReader
2369{
2370
2372
2373 protected:
2375 GDALDataset *poDS;
2376 int nXOff;
2377 int nYOff;
2378 int nXSize;
2379 int nYSize;
2380 void *pBuf;
2381 int nBufXSize;
2382 int nBufYSize;
2383 GDALDataType eBufType;
2384 int nBandCount;
2385 int *panBandMap;
2386 int nPixelSpace;
2387 int nLineSpace;
2388 int nBandSpace;
2390
2391 public:
2393 virtual ~GDALAsyncReader();
2394
2399 {
2400 return poDS;
2401 }
2402
2406 int GetXOffset() const
2407 {
2408 return nXOff;
2409 }
2410
2414 int GetYOffset() const
2415 {
2416 return nYOff;
2417 }
2418
2422 int GetXSize() const
2423 {
2424 return nXSize;
2425 }
2426
2430 int GetYSize() const
2431 {
2432 return nYSize;
2433 }
2434
2439 {
2440 return pBuf;
2441 }
2442
2446 int GetBufferXSize() const
2447 {
2448 return nBufXSize;
2449 }
2450
2454 int GetBufferYSize() const
2455 {
2456 return nBufYSize;
2457 }
2458
2463 {
2464 return eBufType;
2465 }
2466
2470 int GetBandCount() const
2471 {
2472 return nBandCount;
2473 }
2474
2479 {
2480 return panBandMap;
2481 }
2482
2486 int GetPixelSpace() const
2487 {
2488 return nPixelSpace;
2489 }
2490
2494 int GetLineSpace() const
2495 {
2496 return nLineSpace;
2497 }
2498
2502 int GetBandSpace() const
2503 {
2504 return nBandSpace;
2505 }
2506
2507 virtual GDALAsyncStatusType
2508 GetNextUpdatedRegion(double dfTimeout, int *pnBufXOff, int *pnBufYOff,
2509 int *pnBufXSize, int *pnBufYSize) = 0;
2510 virtual int LockBuffer(double dfTimeout = -1.0);
2511 virtual void UnlockBuffer();
2512};
2513
2514/* ******************************************************************** */
2515/* Multidimensional array API */
2516/* ******************************************************************** */
2517
2518class GDALMDArray;
2519class GDALAttribute;
2520class GDALDimension;
2521class GDALEDTComponent;
2522
2523/* ******************************************************************** */
2524/* GDALExtendedDataType */
2525/* ******************************************************************** */
2526
2535{
2536 public:
2538
2540
2541 GDALExtendedDataType &operator=(const GDALExtendedDataType &);
2543
2544 static GDALExtendedDataType Create(GDALDataType eType);
2546 Create(const std::string &osName, size_t nTotalSize,
2547 std::vector<std::unique_ptr<GDALEDTComponent>> &&components);
2549 CreateString(size_t nMaxStringLength = 0,
2551
2552 bool operator==(const GDALExtendedDataType &) const;
2553
2555 bool operator!=(const GDALExtendedDataType &other) const
2556 {
2557 return !(operator==(other));
2558 }
2559
2564 const std::string &GetName() const
2565 {
2566 return m_osName;
2567 }
2568
2574 {
2575 return m_eClass;
2576 }
2577
2584 {
2585 return m_eNumericDT;
2586 }
2587
2595 {
2596 return m_eSubType;
2597 }
2598
2604 const std::vector<std::unique_ptr<GDALEDTComponent>> &GetComponents() const
2605 {
2606 return m_aoComponents;
2607 }
2608
2615 size_t GetSize() const
2616 {
2617 return m_nSize;
2618 }
2619
2624 size_t GetMaxStringLength() const
2625 {
2626 return m_nMaxStringLength;
2627 }
2628
2629 bool CanConvertTo(const GDALExtendedDataType &other) const;
2630
2631 bool NeedsFreeDynamicMemory() const;
2632
2633 void FreeDynamicMemory(void *pBuffer) const;
2634
2635 static bool CopyValue(const void *pSrc, const GDALExtendedDataType &srcType,
2636 void *pDst, const GDALExtendedDataType &dstType);
2637
2638 static bool CopyValues(const void *pSrc,
2639 const GDALExtendedDataType &srcType,
2640 GPtrDiff_t nSrcStrideInElts, void *pDst,
2641 const GDALExtendedDataType &dstType,
2642 GPtrDiff_t nDstStrideInElts, size_t nValues);
2643
2644 private:
2645 GDALExtendedDataType(size_t nMaxStringLength,
2647 explicit GDALExtendedDataType(GDALDataType eType);
2649 const std::string &osName, size_t nTotalSize,
2650 std::vector<std::unique_ptr<GDALEDTComponent>> &&components);
2651
2652 std::string m_osName{};
2655 GDALDataType m_eNumericDT = GDT_Unknown;
2656 std::vector<std::unique_ptr<GDALEDTComponent>> m_aoComponents{};
2657 size_t m_nSize = 0;
2658 size_t m_nMaxStringLength = 0;
2659};
2660
2661/* ******************************************************************** */
2662/* GDALEDTComponent */
2663/* ******************************************************************** */
2664
2670class CPL_DLL GDALEDTComponent
2671{
2672 public:
2674 GDALEDTComponent(const std::string &name, size_t offset,
2675 const GDALExtendedDataType &type);
2677
2678 bool operator==(const GDALEDTComponent &) const;
2679
2684 const std::string &GetName() const
2685 {
2686 return m_osName;
2687 }
2688
2693 size_t GetOffset() const
2694 {
2695 return m_nOffset;
2696 }
2697
2703 {
2704 return m_oType;
2705 }
2706
2707 private:
2708 std::string m_osName;
2709 size_t m_nOffset;
2710 GDALExtendedDataType m_oType;
2711};
2712
2713/* ******************************************************************** */
2714/* GDALIHasAttribute */
2715/* ******************************************************************** */
2716
2723{
2724 protected:
2725 std::shared_ptr<GDALAttribute>
2726 GetAttributeFromAttributes(const std::string &osName) const;
2727
2728 public:
2729 virtual ~GDALIHasAttribute();
2730
2731 virtual std::shared_ptr<GDALAttribute>
2732 GetAttribute(const std::string &osName) const;
2733
2734 virtual std::vector<std::shared_ptr<GDALAttribute>>
2735 GetAttributes(CSLConstList papszOptions = nullptr) const;
2736
2737 virtual std::shared_ptr<GDALAttribute>
2738 CreateAttribute(const std::string &osName,
2739 const std::vector<GUInt64> &anDimensions,
2740 const GDALExtendedDataType &oDataType,
2741 CSLConstList papszOptions = nullptr);
2742
2743 virtual bool DeleteAttribute(const std::string &osName,
2744 CSLConstList papszOptions = nullptr);
2745};
2746
2747/* ******************************************************************** */
2748/* GDALGroup */
2749/* ******************************************************************** */
2750
2751/* clang-format off */
2761/* clang-format on */
2762
2763class CPL_DLL GDALGroup : public GDALIHasAttribute
2764{
2765 protected:
2767 std::string m_osName{};
2768
2769 // This is actually a path of the form "/parent_path/{m_osName}"
2770 std::string m_osFullName{};
2771
2772 // Used for example by GDALSubsetGroup to distinguish a derived group
2773 //from its original, without altering its name
2774 const std::string m_osContext{};
2775
2776 std::weak_ptr<GDALGroup> m_pSelf{};
2777
2779 bool m_bValid = true;
2780
2781 GDALGroup(const std::string &osParentName, const std::string &osName,
2782 const std::string &osContext = std::string());
2783
2784 const GDALGroup *
2785 GetInnerMostGroup(const std::string &osPathOrArrayOrDim,
2786 std::shared_ptr<GDALGroup> &curGroupHolder,
2787 std::string &osLastPart) const;
2788
2789 void BaseRename(const std::string &osNewName);
2790
2791 bool CheckValidAndErrorOutIfNot() const;
2792
2793 void SetSelf(const std::shared_ptr<GDALGroup> &self)
2794 {
2795 m_pSelf = self;
2796 }
2797
2798 virtual void NotifyChildrenOfRenaming()
2799 {
2800 }
2801
2802 virtual void NotifyChildrenOfDeletion()
2803 {
2804 }
2805
2807
2808 public:
2809 virtual ~GDALGroup();
2810
2815 const std::string &GetName() const
2816 {
2817 return m_osName;
2818 }
2819
2824 const std::string &GetFullName() const
2825 {
2826 return m_osFullName;
2827 }
2828
2829 virtual std::vector<std::string>
2830 GetMDArrayNames(CSLConstList papszOptions = nullptr) const;
2831 virtual std::shared_ptr<GDALMDArray>
2832 OpenMDArray(const std::string &osName,
2833 CSLConstList papszOptions = nullptr) const;
2834
2835 virtual std::vector<std::string>
2836 GetGroupNames(CSLConstList papszOptions = nullptr) const;
2837 virtual std::shared_ptr<GDALGroup>
2838 OpenGroup(const std::string &osName,
2839 CSLConstList papszOptions = nullptr) const;
2840
2841 virtual std::vector<std::string>
2842 GetVectorLayerNames(CSLConstList papszOptions = nullptr) const;
2843 virtual OGRLayer *
2844 OpenVectorLayer(const std::string &osName,
2845 CSLConstList papszOptions = nullptr) const;
2846
2847 virtual std::vector<std::shared_ptr<GDALDimension>>
2848 GetDimensions(CSLConstList papszOptions = nullptr) const;
2849
2850 virtual std::shared_ptr<GDALGroup>
2851 CreateGroup(const std::string &osName, CSLConstList papszOptions = nullptr);
2852
2853 virtual bool DeleteGroup(const std::string &osName,
2854 CSLConstList papszOptions = nullptr);
2855
2856 virtual std::shared_ptr<GDALDimension>
2857 CreateDimension(const std::string &osName, const std::string &osType,
2858 const std::string &osDirection, GUInt64 nSize,
2859 CSLConstList papszOptions = nullptr);
2860
2861 virtual std::shared_ptr<GDALMDArray> CreateMDArray(
2862 const std::string &osName,
2863 const std::vector<std::shared_ptr<GDALDimension>> &aoDimensions,
2864 const GDALExtendedDataType &oDataType,
2865 CSLConstList papszOptions = nullptr);
2866
2867 virtual bool DeleteMDArray(const std::string &osName,
2868 CSLConstList papszOptions = nullptr);
2869
2870 GUInt64 GetTotalCopyCost() const;
2871
2872 virtual bool CopyFrom(const std::shared_ptr<GDALGroup> &poDstRootGroup,
2873 GDALDataset *poSrcDS,
2874 const std::shared_ptr<GDALGroup> &poSrcGroup,
2875 bool bStrict, GUInt64 &nCurCost,
2876 const GUInt64 nTotalCost,
2877 GDALProgressFunc pfnProgress, void *pProgressData,
2878 CSLConstList papszOptions = nullptr);
2879
2880 virtual CSLConstList GetStructuralInfo() const;
2881
2882 std::shared_ptr<GDALMDArray>
2883 OpenMDArrayFromFullname(const std::string &osFullName,
2884 CSLConstList papszOptions = nullptr) const;
2885
2886 std::shared_ptr<GDALMDArray>
2887 ResolveMDArray(const std::string &osName, const std::string &osStartingPath,
2888 CSLConstList papszOptions = nullptr) const;
2889
2890 std::shared_ptr<GDALGroup>
2891 OpenGroupFromFullname(const std::string &osFullName,
2892 CSLConstList papszOptions = nullptr) const;
2893
2894 std::shared_ptr<GDALDimension>
2895 OpenDimensionFromFullname(const std::string &osFullName) const;
2896
2897 virtual void ClearStatistics();
2898
2899 virtual bool Rename(const std::string &osNewName);
2900
2901 std::shared_ptr<GDALGroup>
2902 SubsetDimensionFromSelection(const std::string &osSelection) const;
2903
2905 virtual void ParentRenamed(const std::string &osNewParentFullName);
2906
2907 virtual void Deleted();
2908
2909 virtual void ParentDeleted();
2910
2911 const std::string &GetContext() const
2912 {
2913 return m_osContext;
2914 }
2915
2917
2919 static constexpr GUInt64 COPY_COST = 1000;
2921};
2922
2923/* ******************************************************************** */
2924/* GDALAbstractMDArray */
2925/* ******************************************************************** */
2926
2933{
2934 protected:
2936 std::string m_osName{};
2937
2938 // This is actually a path of the form "/parent_path/{m_osName}"
2939 std::string m_osFullName{};
2940 std::weak_ptr<GDALAbstractMDArray> m_pSelf{};
2941
2943 bool m_bValid = true;
2944
2945 GDALAbstractMDArray(const std::string &osParentName,
2946 const std::string &osName);
2947
2948 void SetSelf(const std::shared_ptr<GDALAbstractMDArray> &self)
2949 {
2950 m_pSelf = self;
2951 }
2952
2953 bool CheckValidAndErrorOutIfNot() const;
2954
2955 bool CheckReadWriteParams(const GUInt64 *arrayStartIdx, const size_t *count,
2956 const GInt64 *&arrayStep,
2957 const GPtrDiff_t *&bufferStride,
2958 const GDALExtendedDataType &bufferDataType,
2959 const void *buffer,
2960 const void *buffer_alloc_start,
2961 size_t buffer_alloc_size,
2962 std::vector<GInt64> &tmp_arrayStep,
2963 std::vector<GPtrDiff_t> &tmp_bufferStride) const;
2964
2965 virtual bool
2966 IRead(const GUInt64 *arrayStartIdx, // array of size GetDimensionCount()
2967 const size_t *count, // array of size GetDimensionCount()
2968 const GInt64 *arrayStep, // step in elements
2969 const GPtrDiff_t *bufferStride, // stride in elements
2970 const GDALExtendedDataType &bufferDataType,
2971 void *pDstBuffer) const = 0;
2972
2973 virtual bool
2974 IWrite(const GUInt64 *arrayStartIdx, // array of size GetDimensionCount()
2975 const size_t *count, // array of size GetDimensionCount()
2976 const GInt64 *arrayStep, // step in elements
2977 const GPtrDiff_t *bufferStride, // stride in elements
2978 const GDALExtendedDataType &bufferDataType, const void *pSrcBuffer);
2979
2980 void BaseRename(const std::string &osNewName);
2981
2982 virtual void NotifyChildrenOfRenaming()
2983 {
2984 }
2985
2986 virtual void NotifyChildrenOfDeletion()
2987 {
2988 }
2989
2991
2992 public:
2993 virtual ~GDALAbstractMDArray();
2994
3000 const std::string &GetName() const
3001 {
3002 return m_osName;
3003 }
3004
3010 const std::string &GetFullName() const
3011 {
3012 return m_osFullName;
3013 }
3014
3015 GUInt64 GetTotalElementsCount() const;
3016
3017 virtual size_t GetDimensionCount() const;
3018
3019 virtual const std::vector<std::shared_ptr<GDALDimension>> &
3020 GetDimensions() const = 0;
3021
3022 virtual const GDALExtendedDataType &GetDataType() const = 0;
3023
3024 virtual std::vector<GUInt64> GetBlockSize() const;
3025
3026 virtual std::vector<size_t>
3027 GetProcessingChunkSize(size_t nMaxChunkMemory) const;
3028
3029 /* clang-format off */
3045 typedef bool (*FuncProcessPerChunkType)(
3046 GDALAbstractMDArray *array,
3047 const GUInt64 *chunkArrayStartIdx,
3048 const size_t *chunkCount,
3049 GUInt64 iCurChunk,
3050 GUInt64 nChunkCount,
3051 void *pUserData);
3052 /* clang-format on */
3053
3054 virtual bool ProcessPerChunk(const GUInt64 *arrayStartIdx,
3055 const GUInt64 *count, const size_t *chunkSize,
3056 FuncProcessPerChunkType pfnFunc,
3057 void *pUserData);
3058
3059 virtual bool
3060 Read(const GUInt64 *arrayStartIdx, // array of size GetDimensionCount()
3061 const size_t *count, // array of size GetDimensionCount()
3062 const GInt64 *arrayStep, // step in elements
3063 const GPtrDiff_t *bufferStride, // stride in elements
3064 const GDALExtendedDataType &bufferDataType, void *pDstBuffer,
3065 const void *pDstBufferAllocStart = nullptr,
3066 size_t nDstBufferAllocSize = 0) const;
3067
3068 bool
3069 Write(const GUInt64 *arrayStartIdx, // array of size GetDimensionCount()
3070 const size_t *count, // array of size GetDimensionCount()
3071 const GInt64 *arrayStep, // step in elements
3072 const GPtrDiff_t *bufferStride, // stride in elements
3073 const GDALExtendedDataType &bufferDataType, const void *pSrcBuffer,
3074 const void *pSrcBufferAllocStart = nullptr,
3075 size_t nSrcBufferAllocSize = 0);
3076
3077 virtual bool Rename(const std::string &osNewName);
3078
3080 virtual void Deleted();
3081
3082 virtual void ParentDeleted();
3083
3084 virtual void ParentRenamed(const std::string &osNewParentFullName);
3086};
3087
3088/* ******************************************************************** */
3089/* GDALRawResult */
3090/* ******************************************************************** */
3091
3098class CPL_DLL GDALRawResult
3099{
3100 private:
3102 size_t m_nEltCount;
3103 size_t m_nSize;
3104 GByte *m_raw;
3105
3106 void FreeMe();
3107
3108 GDALRawResult(const GDALRawResult &) = delete;
3109 GDALRawResult &operator=(const GDALRawResult &) = delete;
3110
3111 protected:
3112 friend class GDALAttribute;
3114 GDALRawResult(GByte *raw, const GDALExtendedDataType &dt, size_t nEltCount);
3116
3117 public:
3120 GDALRawResult &operator=(GDALRawResult &&);
3121
3123 const GByte &operator[](size_t idx) const
3124 {
3125 return m_raw[idx];
3126 }
3127
3129 const GByte *data() const
3130 {
3131 return m_raw;
3132 }
3133
3135 size_t size() const
3136 {
3137 return m_nSize;
3138 }
3139
3141 GByte *StealData();
3143};
3144
3145/* ******************************************************************** */
3146/* GDALAttribute */
3147/* ******************************************************************** */
3148
3149/* clang-format off */
3161/* clang-format on */
3162
3163class CPL_DLL GDALAttribute : virtual public GDALAbstractMDArray
3164{
3165 mutable std::string m_osCachedVal{};
3166
3167 protected:
3169 GDALAttribute(const std::string &osParentName, const std::string &osName);
3171
3172 public:
3173 std::vector<GUInt64> GetDimensionsSize() const;
3174
3175 GDALRawResult ReadAsRaw() const;
3176 const char *ReadAsString() const;
3177 int ReadAsInt() const;
3178 double ReadAsDouble() const;
3179 CPLStringList ReadAsStringArray() const;
3180 std::vector<int> ReadAsIntArray() const;
3181 std::vector<double> ReadAsDoubleArray() const;
3182
3184 bool Write(const void *pabyValue, size_t nLen);
3185 bool Write(const char *);
3186 bool WriteInt(int);
3187 bool Write(double);
3188 bool Write(CSLConstList);
3189 bool Write(const double *, size_t);
3190
3192 static constexpr GUInt64 COPY_COST = 100;
3194};
3195
3196/************************************************************************/
3197/* GDALAttributeString */
3198/************************************************************************/
3199
3201class CPL_DLL GDALAttributeString final : public GDALAttribute
3202{
3203 std::vector<std::shared_ptr<GDALDimension>> m_dims{};
3205 std::string m_osValue;
3206
3207 protected:
3208 bool IRead(const GUInt64 *, const size_t *, const GInt64 *,
3209 const GPtrDiff_t *, const GDALExtendedDataType &bufferDataType,
3210 void *pDstBuffer) const override;
3211
3212 public:
3213 GDALAttributeString(const std::string &osParentName,
3214 const std::string &osName, const std::string &osValue,
3216
3217 const std::vector<std::shared_ptr<GDALDimension>> &
3218 GetDimensions() const override;
3219
3220 const GDALExtendedDataType &GetDataType() const override;
3221};
3222
3224
3225/************************************************************************/
3226/* GDALAttributeNumeric */
3227/************************************************************************/
3228
3230class CPL_DLL GDALAttributeNumeric final : public GDALAttribute
3231{
3232 std::vector<std::shared_ptr<GDALDimension>> m_dims{};
3234 int m_nValue = 0;
3235 double m_dfValue = 0;
3236 std::vector<GUInt32> m_anValuesUInt32{};
3237
3238 protected:
3239 bool IRead(const GUInt64 *, const size_t *, const GInt64 *,
3240 const GPtrDiff_t *, const GDALExtendedDataType &bufferDataType,
3241 void *pDstBuffer) const override;
3242
3243 public:
3244 GDALAttributeNumeric(const std::string &osParentName,
3245 const std::string &osName, double dfValue);
3246 GDALAttributeNumeric(const std::string &osParentName,
3247 const std::string &osName, int nValue);
3248 GDALAttributeNumeric(const std::string &osParentName,
3249 const std::string &osName,
3250 const std::vector<GUInt32> &anValues);
3251
3252 const std::vector<std::shared_ptr<GDALDimension>> &
3253 GetDimensions() const override;
3254
3255 const GDALExtendedDataType &GetDataType() const override;
3256};
3257
3259
3260/* ******************************************************************** */
3261/* GDALMDArray */
3262/* ******************************************************************** */
3263
3264/* clang-format off */
3274/* clang-format on */
3275
3276class CPL_DLL GDALMDArray : virtual public GDALAbstractMDArray,
3277 public GDALIHasAttribute
3278{
3279 friend class GDALMDArrayResampled;
3280 std::shared_ptr<GDALMDArray>
3281 GetView(const std::vector<GUInt64> &indices) const;
3282
3283 inline std::shared_ptr<GDALMDArray>
3284 atInternal(const std::vector<GUInt64> &indices) const
3285 {
3286 return GetView(indices);
3287 }
3288
3289 template <typename... GUInt64VarArg>
3290 // cppcheck-suppress functionStatic
3291 inline std::shared_ptr<GDALMDArray>
3292 atInternal(std::vector<GUInt64> &indices, GUInt64 idx,
3293 GUInt64VarArg... tail) const
3294 {
3295 indices.push_back(idx);
3296 return atInternal(indices, tail...);
3297 }
3298
3299 // Used for example by GDALSubsetGroup to distinguish a derived group
3300 //from its original, without altering its name
3301 const std::string m_osContext{};
3302
3303 mutable bool m_bHasTriedCachedArray = false;
3304 mutable std::shared_ptr<GDALMDArray> m_poCachedArray{};
3305
3306 protected:
3308 GDALMDArray(const std::string &osParentName, const std::string &osName,
3309 const std::string &osContext = std::string());
3310
3311 virtual bool IAdviseRead(const GUInt64 *arrayStartIdx, const size_t *count,
3312 CSLConstList papszOptions) const;
3313
3314 virtual bool IsCacheable() const
3315 {
3316 return true;
3317 }
3318
3319 virtual bool SetStatistics(bool bApproxStats, double dfMin, double dfMax,
3320 double dfMean, double dfStdDev,
3321 GUInt64 nValidCount, CSLConstList papszOptions);
3322
3323 static std::string MassageName(const std::string &inputName);
3324
3325 std::shared_ptr<GDALGroup>
3326 GetCacheRootGroup(bool bCanCreate, std::string &osCacheFilenameOut) const;
3327
3328 // Returns if bufferStride values express a transposed view of the array
3329 bool IsTransposedRequest(const size_t *count,
3330 const GPtrDiff_t *bufferStride) const;
3331
3332 // Should only be called if IsTransposedRequest() returns true
3333 bool ReadForTransposedRequest(const GUInt64 *arrayStartIdx,
3334 const size_t *count, const GInt64 *arrayStep,
3335 const GPtrDiff_t *bufferStride,
3336 const GDALExtendedDataType &bufferDataType,
3337 void *pDstBuffer) const;
3338
3339 bool IsStepOneContiguousRowMajorOrderedSameDataType(
3340 const size_t *count, const GInt64 *arrayStep,
3341 const GPtrDiff_t *bufferStride,
3342 const GDALExtendedDataType &bufferDataType) const;
3343
3344 // Should only be called if IsStepOneContiguousRowMajorOrderedSameDataType()
3345 // returns false
3346 bool ReadUsingContiguousIRead(const GUInt64 *arrayStartIdx,
3347 const size_t *count, const GInt64 *arrayStep,
3348 const GPtrDiff_t *bufferStride,
3349 const GDALExtendedDataType &bufferDataType,
3350 void *pDstBuffer) const;
3351
3352 static std::shared_ptr<GDALMDArray>
3353 CreateGLTOrthorectified(const std::shared_ptr<GDALMDArray> &poParent,
3354 const std::shared_ptr<GDALMDArray> &poGLTX,
3355 const std::shared_ptr<GDALMDArray> &poGLTY,
3356 int nGLTIndexOffset,
3357 const std::vector<double> &adfGeoTransform);
3358
3360
3361 public:
3362 GUInt64 GetTotalCopyCost() const;
3363
3364 virtual bool CopyFrom(GDALDataset *poSrcDS, const GDALMDArray *poSrcArray,
3365 bool bStrict, GUInt64 &nCurCost,
3366 const GUInt64 nTotalCost,
3367 GDALProgressFunc pfnProgress, void *pProgressData);
3368
3370 virtual bool IsWritable() const = 0;
3371
3380 virtual const std::string &GetFilename() const = 0;
3381
3382 virtual CSLConstList GetStructuralInfo() const;
3383
3384 virtual const std::string &GetUnit() const;
3385
3386 virtual bool SetUnit(const std::string &osUnit);
3387
3388 virtual bool SetSpatialRef(const OGRSpatialReference *poSRS);
3389
3390 virtual std::shared_ptr<OGRSpatialReference> GetSpatialRef() const;
3391
3392 virtual const void *GetRawNoDataValue() const;
3393
3394 double GetNoDataValueAsDouble(bool *pbHasNoData = nullptr) const;
3395
3396 int64_t GetNoDataValueAsInt64(bool *pbHasNoData = nullptr) const;
3397
3398 uint64_t GetNoDataValueAsUInt64(bool *pbHasNoData = nullptr) const;
3399
3400 virtual bool SetRawNoDataValue(const void *pRawNoData);
3401
3403 bool SetNoDataValue(int nNoData)
3404 {
3405 return SetNoDataValue(static_cast<int64_t>(nNoData));
3406 }
3407
3409
3410 bool SetNoDataValue(double dfNoData);
3411
3412 bool SetNoDataValue(int64_t nNoData);
3413
3414 bool SetNoDataValue(uint64_t nNoData);
3415
3416 virtual bool Resize(const std::vector<GUInt64> &anNewDimSizes,
3417 CSLConstList papszOptions);
3418
3419 virtual double GetOffset(bool *pbHasOffset = nullptr,
3420 GDALDataType *peStorageType = nullptr) const;
3421
3422 virtual double GetScale(bool *pbHasScale = nullptr,
3423 GDALDataType *peStorageType = nullptr) const;
3424
3425 virtual bool SetOffset(double dfOffset,
3426 GDALDataType eStorageType = GDT_Unknown);
3427
3428 virtual bool SetScale(double dfScale,
3429 GDALDataType eStorageType = GDT_Unknown);
3430
3431 std::shared_ptr<GDALMDArray> GetView(const std::string &viewExpr) const;
3432
3433 std::shared_ptr<GDALMDArray> operator[](const std::string &fieldName) const;
3434
3444 // sphinx 4.1.0 / breathe 4.30.0 don't like typename...
3446 template <typename... GUInt64VarArg>
3448 // cppcheck-suppress functionStatic
3449 std::shared_ptr<GDALMDArray> at(GUInt64 idx, GUInt64VarArg... tail) const
3450 {
3451 std::vector<GUInt64> indices;
3452 indices.push_back(idx);
3453 return atInternal(indices, tail...);
3454 }
3455
3456 virtual std::shared_ptr<GDALMDArray>
3457 Transpose(const std::vector<int> &anMapNewAxisToOldAxis) const;
3458
3459 std::shared_ptr<GDALMDArray> GetUnscaled(
3460 double dfOverriddenScale = std::numeric_limits<double>::quiet_NaN(),
3461 double dfOverriddenOffset = std::numeric_limits<double>::quiet_NaN(),
3462 double dfOverriddenDstNodata =
3463 std::numeric_limits<double>::quiet_NaN()) const;
3464
3465 virtual std::shared_ptr<GDALMDArray>
3466 GetMask(CSLConstList papszOptions) const;
3467
3468 virtual std::shared_ptr<GDALMDArray>
3469 GetResampled(const std::vector<std::shared_ptr<GDALDimension>> &apoNewDims,
3470 GDALRIOResampleAlg resampleAlg,
3471 const OGRSpatialReference *poTargetSRS,
3472 CSLConstList papszOptions) const;
3473
3474 std::shared_ptr<GDALMDArray>
3475 GetGridded(const std::string &osGridOptions,
3476 const std::shared_ptr<GDALMDArray> &poXArray = nullptr,
3477 const std::shared_ptr<GDALMDArray> &poYArray = nullptr,
3478 CSLConstList papszOptions = nullptr) const;
3479
3480 virtual GDALDataset *
3481 AsClassicDataset(size_t iXDim, size_t iYDim,
3482 const std::shared_ptr<GDALGroup> &poRootGroup = nullptr,
3483 CSLConstList papszOptions = nullptr) const;
3484
3485 virtual CPLErr GetStatistics(bool bApproxOK, bool bForce, double *pdfMin,
3486 double *pdfMax, double *pdfMean,
3487 double *padfStdDev, GUInt64 *pnValidCount,
3488 GDALProgressFunc pfnProgress,
3489 void *pProgressData);
3490
3491 virtual bool ComputeStatistics(bool bApproxOK, double *pdfMin,
3492 double *pdfMax, double *pdfMean,
3493 double *pdfStdDev, GUInt64 *pnValidCount,
3494 GDALProgressFunc, void *pProgressData,
3495 CSLConstList papszOptions);
3496
3497 virtual void ClearStatistics();
3498
3499 virtual std::vector<std::shared_ptr<GDALMDArray>>
3500 GetCoordinateVariables() const;
3501
3502 bool AdviseRead(const GUInt64 *arrayStartIdx, const size_t *count,
3503 CSLConstList papszOptions = nullptr) const;
3504
3505 bool IsRegularlySpaced(double &dfStart, double &dfIncrement) const;
3506
3507 bool GuessGeoTransform(size_t nDimX, size_t nDimY, bool bPixelIsPoint,
3508 double adfGeoTransform[6]) const;
3509
3510 bool Cache(CSLConstList papszOptions = nullptr) const;
3511
3512 bool
3513 Read(const GUInt64 *arrayStartIdx, // array of size GetDimensionCount()
3514 const size_t *count, // array of size GetDimensionCount()
3515 const GInt64 *arrayStep, // step in elements
3516 const GPtrDiff_t *bufferStride, // stride in elements
3517 const GDALExtendedDataType &bufferDataType, void *pDstBuffer,
3518 const void *pDstBufferAllocStart = nullptr,
3519 size_t nDstBufferAllocSize = 0) const override final;
3520
3521 virtual std::shared_ptr<GDALGroup> GetRootGroup() const;
3522
3524 static constexpr GUInt64 COPY_COST = 1000;
3525
3526 bool CopyFromAllExceptValues(const GDALMDArray *poSrcArray, bool bStrict,
3527 GUInt64 &nCurCost, const GUInt64 nTotalCost,
3528 GDALProgressFunc pfnProgress,
3529 void *pProgressData);
3530
3531 struct Range
3532 {
3533 GUInt64 m_nStartIdx;
3534 GInt64 m_nIncr;
3535
3536 explicit Range(GUInt64 nStartIdx = 0, GInt64 nIncr = 0)
3537 : m_nStartIdx(nStartIdx), m_nIncr(nIncr)
3538 {
3539 }
3540 };
3541
3542 struct ViewSpec
3543 {
3544 std::string m_osFieldName{};
3545
3546 // or
3547
3548 std::vector<size_t>
3549 m_mapDimIdxToParentDimIdx{}; // of size m_dims.size()
3550 std::vector<Range>
3551 m_parentRanges{}; // of size m_poParent->GetDimensionCount()
3552 };
3553
3554 virtual std::shared_ptr<GDALMDArray>
3555 GetView(const std::string &viewExpr, bool bRenameDimensions,
3556 std::vector<ViewSpec> &viewSpecs) const;
3557
3558 const std::string &GetContext() const
3559 {
3560 return m_osContext;
3561 }
3562
3564};
3565
3567bool GDALMDRasterIOFromBand(GDALRasterBand *poBand, GDALRWFlag eRWFlag,
3568 size_t iDimX, size_t iDimY,
3569 const GUInt64 *arrayStartIdx, const size_t *count,
3570 const GInt64 *arrayStep,
3571 const GPtrDiff_t *bufferStride,
3572 const GDALExtendedDataType &bufferDataType,
3573 void *pBuffer);
3574
3576
3577/************************************************************************/
3578/* GDALMDArrayRegularlySpaced */
3579/************************************************************************/
3580
3582class CPL_DLL GDALMDArrayRegularlySpaced : public GDALMDArray
3583{
3584 double m_dfStart;
3585 double m_dfIncrement;
3586 double m_dfOffsetInIncrement;
3588 std::vector<std::shared_ptr<GDALDimension>> m_dims;
3589 std::vector<std::shared_ptr<GDALAttribute>> m_attributes{};
3590 std::string m_osEmptyFilename{};
3591
3592 protected:
3593 bool IRead(const GUInt64 *, const size_t *, const GInt64 *,
3594 const GPtrDiff_t *, const GDALExtendedDataType &bufferDataType,
3595 void *pDstBuffer) const override;
3596
3597 public:
3598 GDALMDArrayRegularlySpaced(const std::string &osParentName,
3599 const std::string &osName,
3600 const std::shared_ptr<GDALDimension> &poDim,
3601 double dfStart, double dfIncrement,
3602 double dfOffsetInIncrement);
3603
3604 static std::shared_ptr<GDALMDArrayRegularlySpaced>
3605 Create(const std::string &osParentName, const std::string &osName,
3606 const std::shared_ptr<GDALDimension> &poDim, double dfStart,
3607 double dfIncrement, double dfOffsetInIncrement);
3608
3609 bool IsWritable() const override
3610 {
3611 return false;
3612 }
3613
3614 const std::string &GetFilename() const override
3615 {
3616 return m_osEmptyFilename;
3617 }
3618
3619 const std::vector<std::shared_ptr<GDALDimension>> &
3620 GetDimensions() const override;
3621
3622 const GDALExtendedDataType &GetDataType() const override;
3623
3624 std::vector<std::shared_ptr<GDALAttribute>>
3625 GetAttributes(CSLConstList) const override;
3626
3627 void AddAttribute(const std::shared_ptr<GDALAttribute> &poAttr);
3628};
3629
3631
3632/* ******************************************************************** */
3633/* GDALDimension */
3634/* ******************************************************************** */
3635
3647class CPL_DLL GDALDimension
3648{
3649 public:
3651 GDALDimension(const std::string &osParentName, const std::string &osName,
3652 const std::string &osType, const std::string &osDirection,
3653 GUInt64 nSize);
3655
3656 virtual ~GDALDimension();
3657
3662 const std::string &GetName() const
3663 {
3664 return m_osName;
3665 }
3666
3671 const std::string &GetFullName() const
3672 {
3673 return m_osFullName;
3674 }
3675
3684 const std::string &GetType() const
3685 {
3686 return m_osType;
3687 }
3688
3697 const std::string &GetDirection() const
3698 {
3699 return m_osDirection;
3700 }
3701
3707 {
3708 return m_nSize;
3709 }
3710
3711 virtual std::shared_ptr<GDALMDArray> GetIndexingVariable() const;
3712
3713 virtual bool
3714 SetIndexingVariable(std::shared_ptr<GDALMDArray> poIndexingVariable);
3715
3716 virtual bool Rename(const std::string &osNewName);
3717
3719 virtual void ParentRenamed(const std::string &osNewParentFullName);
3720
3721 virtual void ParentDeleted();
3723
3724 protected:
3726 std::string m_osName;
3727 std::string m_osFullName;
3728 std::string m_osType;
3729 std::string m_osDirection;
3730 GUInt64 m_nSize;
3731
3732 void BaseRename(const std::string &osNewName);
3733
3735};
3736
3737/************************************************************************/
3738/* GDALDimensionWeakIndexingVar() */
3739/************************************************************************/
3740
3742class CPL_DLL GDALDimensionWeakIndexingVar : public GDALDimension
3743{
3744 std::weak_ptr<GDALMDArray> m_poIndexingVariable{};
3745
3746 public:
3747 GDALDimensionWeakIndexingVar(const std::string &osParentName,
3748 const std::string &osName,
3749 const std::string &osType,
3750 const std::string &osDirection, GUInt64 nSize);
3751
3752 std::shared_ptr<GDALMDArray> GetIndexingVariable() const override;
3753
3754 bool SetIndexingVariable(
3755 std::shared_ptr<GDALMDArray> poIndexingVariable) override;
3756
3757 void SetSize(GUInt64 nNewSize);
3758};
3760
3761/************************************************************************/
3762/* GDALAntiRecursionGuard */
3763/************************************************************************/
3764
3766struct GDALAntiRecursionStruct;
3767
3768class GDALAntiRecursionGuard
3769{
3770 GDALAntiRecursionStruct *m_psAntiRecursionStruct;
3771 std::string m_osIdentifier;
3772 int m_nDepth;
3773
3774 GDALAntiRecursionGuard(const GDALAntiRecursionGuard &) = delete;
3775 GDALAntiRecursionGuard &operator=(const GDALAntiRecursionGuard &) = delete;
3776
3777 public:
3778 explicit GDALAntiRecursionGuard(const std::string &osIdentifier);
3779 GDALAntiRecursionGuard(const GDALAntiRecursionGuard &other,
3780 const std::string &osIdentifier);
3781 ~GDALAntiRecursionGuard();
3782
3783 int GetCallDepth() const
3784 {
3785 return m_nDepth;
3786 }
3787};
3788
3790
3791/************************************************************************/
3792/* Relationships */
3793/************************************************************************/
3794
3806class CPL_DLL GDALRelationship
3807{
3808 protected:
3810 std::string m_osName{};
3811 std::string m_osLeftTableName{};
3812 std::string m_osRightTableName{};
3813 GDALRelationshipCardinality m_eCardinality =
3814 GDALRelationshipCardinality::GRC_ONE_TO_MANY;
3815 std::string m_osMappingTableName{};
3816 std::vector<std::string> m_osListLeftTableFields{};
3817 std::vector<std::string> m_osListRightTableFields{};
3818 std::vector<std::string> m_osListLeftMappingTableFields{};
3819 std::vector<std::string> m_osListRightMappingTableFields{};
3820 GDALRelationshipType m_eType = GDALRelationshipType::GRT_ASSOCIATION;
3821 std::string m_osForwardPathLabel{};
3822 std::string m_osBackwardPathLabel{};
3823 std::string m_osRelatedTableType{};
3824
3827 public:
3835 GDALRelationship(const std::string &osName,
3836 const std::string &osLeftTableName,
3837 const std::string &osRightTableName,
3838 GDALRelationshipCardinality eCardinality =
3839 GDALRelationshipCardinality::GRC_ONE_TO_MANY)
3840 : m_osName(osName), m_osLeftTableName(osLeftTableName),
3841 m_osRightTableName(osRightTableName), m_eCardinality(eCardinality)
3842 {
3843 }
3844
3846 const std::string &GetName() const
3847 {
3848 return m_osName;
3849 }
3850
3853 {
3854 return m_eCardinality;
3855 }
3856
3861 const std::string &GetLeftTableName() const
3862 {
3863 return m_osLeftTableName;
3864 }
3865
3868 const std::string &GetRightTableName() const
3869 {
3870 return m_osRightTableName;
3871 }
3872
3877 const std::string &GetMappingTableName() const
3878 {
3879 return m_osMappingTableName;
3880 }
3881
3886 void SetMappingTableName(const std::string &osName)
3887 {
3888 m_osMappingTableName = osName;
3889 }
3890
3897 const std::vector<std::string> &GetLeftTableFields() const
3898 {
3899 return m_osListLeftTableFields;
3900 }
3901
3908 const std::vector<std::string> &GetRightTableFields() const
3909 {
3910 return m_osListRightTableFields;
3911 }
3912
3919 void SetLeftTableFields(const std::vector<std::string> &osListFields)
3920 {
3921 m_osListLeftTableFields = osListFields;
3922 }
3923
3930 void SetRightTableFields(const std::vector<std::string> &osListFields)
3931 {
3932 m_osListRightTableFields = osListFields;
3933 }
3934
3941 const std::vector<std::string> &GetLeftMappingTableFields() const
3942 {
3943 return m_osListLeftMappingTableFields;
3944 }
3945
3952 const std::vector<std::string> &GetRightMappingTableFields() const
3953 {
3954 return m_osListRightMappingTableFields;
3955 }
3956
3963 void SetLeftMappingTableFields(const std::vector<std::string> &osListFields)
3964 {
3965 m_osListLeftMappingTableFields = osListFields;
3966 }
3967
3974 void
3975 SetRightMappingTableFields(const std::vector<std::string> &osListFields)
3976 {
3977 m_osListRightMappingTableFields = osListFields;
3978 }
3979
3985 {
3986 return m_eType;
3987 }
3988
3994 {
3995 m_eType = eType;
3996 }
3997
4013 const std::string &GetForwardPathLabel() const
4014 {
4015 return m_osForwardPathLabel;
4016 }
4017
4033 void SetForwardPathLabel(const std::string &osLabel)
4034 {
4035 m_osForwardPathLabel = osLabel;
4036 }
4037
4053 const std::string &GetBackwardPathLabel() const
4054 {
4055 return m_osBackwardPathLabel;
4056 }
4057
4073 void SetBackwardPathLabel(const std::string &osLabel)
4074 {
4075 m_osBackwardPathLabel = osLabel;
4076 }
4077
4088 const std::string &GetRelatedTableType() const
4089 {
4090 return m_osRelatedTableType;
4091 }
4092
4103 void SetRelatedTableType(const std::string &osType)
4104 {
4105 m_osRelatedTableType = osType;
4106 }
4107
4110 static inline GDALRelationshipH ToHandle(GDALRelationship *poRelationship)
4111 {
4112 return static_cast<GDALRelationshipH>(poRelationship);
4113 }
4114
4117 static inline GDALRelationship *FromHandle(GDALRelationshipH hRelationship)
4118 {
4119 return static_cast<GDALRelationship *>(hRelationship);
4120 }
4121};
4122
4123/* ==================================================================== */
4124/* An assortment of overview related stuff. */
4125/* ==================================================================== */
4126
4128/* Only exported for drivers as plugin. Signature may change */
4129CPLErr CPL_DLL GDALRegenerateOverviewsMultiBand(
4130 int nBands, GDALRasterBand *const *papoSrcBands, int nOverviews,
4131 GDALRasterBand *const *const *papapoOverviewBands,
4132 const char *pszResampling, GDALProgressFunc pfnProgress,
4133 void *pProgressData, CSLConstList papszOptions);
4134
4135typedef CPLErr (*GDALResampleFunction)(
4136 double dfXRatioDstToSrc, double dfYRatioDstToSrc, double dfSrcXDelta,
4137 double dfSrcYDelta, GDALDataType eWrkDataType, const void *pChunk,
4138 const GByte *pabyChunkNodataMask, int nChunkXOff, int nChunkXSize,
4139 int nChunkYOff, int nChunkYSize, int nDstXOff, int nDstXOff2, int nDstYOff,
4140 int nDstYOff2, GDALRasterBand *poOverview, void **ppDstBuffer,
4141 GDALDataType *peDstBufferDataType, const char *pszResampling,
4142 bool bHasNoData, double dfNoDataValue, GDALColorTable *poColorTable,
4143 GDALDataType eSrcDataType, bool bPropagateNoData);
4144
4145GDALResampleFunction GDALGetResampleFunction(const char *pszResampling,
4146 int *pnRadius);
4147
4148std::string GDALGetNormalizedOvrResampling(const char *pszResampling);
4149
4150GDALDataType GDALGetOvrWorkDataType(const char *pszResampling,
4151 GDALDataType eSrcDataType);
4152
4154
4155CPLErr CPL_DLL
4156HFAAuxBuildOverviews(const char *pszOvrFilename, GDALDataset *poParentDS,
4157 GDALDataset **ppoDS, int nBands, const int *panBandList,
4158 int nNewOverviews, const int *panNewOverviewList,
4159 const char *pszResampling, GDALProgressFunc pfnProgress,
4160 void *pProgressData, CSLConstList papszOptions);
4161
4162CPLErr CPL_DLL GTIFFBuildOverviews(const char *pszFilename, int nBands,
4163 GDALRasterBand *const *papoBandList,
4164 int nOverviews, const int *panOverviewList,
4165 const char *pszResampling,
4166 GDALProgressFunc pfnProgress,
4167 void *pProgressData,
4168 CSLConstList papszOptions);
4169
4170int CPL_DLL GDALBandGetBestOverviewLevel(GDALRasterBand *poBand, int &nXOff,
4171 int &nYOff, int &nXSize, int &nYSize,
4172 int nBufXSize, int nBufYSize)
4173 CPL_WARN_DEPRECATED("Use GDALBandGetBestOverviewLevel2 instead");
4174int CPL_DLL GDALBandGetBestOverviewLevel2(GDALRasterBand *poBand, int &nXOff,
4175 int &nYOff, int &nXSize, int &nYSize,
4176 int nBufXSize, int nBufYSize,
4177 GDALRasterIOExtraArg *psExtraArg);
4178
4179int CPL_DLL GDALOvLevelAdjust(int nOvLevel, int nXSize)
4180 CPL_WARN_DEPRECATED("Use GDALOvLevelAdjust2 instead");
4181int CPL_DLL GDALOvLevelAdjust2(int nOvLevel, int nXSize, int nYSize);
4182int CPL_DLL GDALComputeOvFactor(int nOvrXSize, int nRasterXSize, int nOvrYSize,
4183 int nRasterYSize);
4184
4185GDALDataset CPL_DLL *GDALFindAssociatedAuxFile(const char *pszBasefile,
4186 GDALAccess eAccess,
4187 GDALDataset *poDependentDS);
4188
4189/* ==================================================================== */
4190/* Infrastructure to check that dataset characteristics are valid */
4191/* ==================================================================== */
4192
4193int CPL_DLL GDALCheckDatasetDimensions(int nXSize, int nYSize);
4194int CPL_DLL GDALCheckBandCount(int nBands, int bIsZeroAllowed);
4195
4196/* Internal use only */
4197
4198/* CPL_DLL exported, but only for in-tree drivers that can be built as plugins
4199 */
4200int CPL_DLL GDALReadWorldFile2(const char *pszBaseFilename,
4201 const char *pszExtension,
4202 double *padfGeoTransform,
4203 char **papszSiblingFiles,
4204 char **ppszWorldFileNameOut);
4205int CPL_DLL GDALReadTabFile2(const char *pszBaseFilename,
4206 double *padfGeoTransform, char **ppszWKT,
4207 int *pnGCPCount, GDAL_GCP **ppasGCPs,
4208 char **papszSiblingFiles,
4209 char **ppszTabFileNameOut);
4210
4211void CPL_DLL GDALCopyRasterIOExtraArg(GDALRasterIOExtraArg *psDestArg,
4212 GDALRasterIOExtraArg *psSrcArg);
4213
4215
4216void GDALNullifyOpenDatasetsList();
4217CPLMutex **GDALGetphDMMutex();
4218CPLMutex **GDALGetphDLMutex();
4219void GDALNullifyProxyPoolSingleton();
4220void GDALSetResponsiblePIDForCurrentThread(GIntBig responsiblePID);
4221GIntBig GDALGetResponsiblePIDForCurrentThread();
4222
4223CPLString GDALFindAssociatedFile(const char *pszBasename, const char *pszExt,
4224 CSLConstList papszSiblingFiles, int nFlags);
4225
4226CPLErr CPL_DLL EXIFExtractMetadata(char **&papszMetadata, void *fpL,
4227 int nOffset, int bSwabflag, int nTIFFHEADER,
4228 int &nExifOffset, int &nInterOffset,
4229 int &nGPSOffset);
4230
4231int GDALValidateOpenOptions(GDALDriverH hDriver,
4232 const char *const *papszOptionOptions);
4233int GDALValidateOptions(const char *pszOptionList,
4234 const char *const *papszOptionsToValidate,
4235 const char *pszErrorMessageOptionType,
4236 const char *pszErrorMessageContainerName);
4237
4238GDALRIOResampleAlg GDALRasterIOGetResampleAlg(const char *pszResampling);
4239const char *GDALRasterIOGetResampleAlg(GDALRIOResampleAlg eResampleAlg);
4240
4241void GDALRasterIOExtraArgSetResampleAlg(GDALRasterIOExtraArg *psExtraArg,
4242 int nXSize, int nYSize, int nBufXSize,
4243 int nBufYSize);
4244
4245GDALDataset *GDALCreateOverviewDataset(GDALDataset *poDS, int nOvrLevel,
4246 bool bThisLevelOnly);
4247
4248// Should cover particular cases of #3573, #4183, #4506, #6578
4249// Behavior is undefined if fVal1 or fVal2 are NaN (should be tested before
4250// calling this function)
4251template <class T> inline bool ARE_REAL_EQUAL(T fVal1, T fVal2, int ulp = 2)
4252{
4253 return fVal1 == fVal2 || /* Should cover infinity */
4254 std::abs(fVal1 - fVal2) < std::numeric_limits<float>::epsilon() *
4255 std::abs(fVal1 + fVal2) * ulp;
4256}
4257
4258double GDALAdjustNoDataCloseToFloatMax(double dfVal);
4259
4260#define DIV_ROUND_UP(a, b) (((a) % (b)) == 0 ? ((a) / (b)) : (((a) / (b)) + 1))
4261
4262// Number of data samples that will be used to compute approximate statistics
4263// (minimum value, maximum value, etc.)
4264#define GDALSTAT_APPROX_NUMSAMPLES 2500
4265
4266void GDALSerializeGCPListToXML(CPLXMLNode *psParentNode,
4267 const std::vector<gdal::GCP> &asGCPs,
4268 const OGRSpatialReference *poGCP_SRS);
4269void GDALDeserializeGCPListFromXML(const CPLXMLNode *psGCPList,
4270 std::vector<gdal::GCP> &asGCPs,
4271 OGRSpatialReference **ppoGCP_SRS);
4272
4273void GDALSerializeOpenOptionsToXML(CPLXMLNode *psParentNode,
4274 char **papszOpenOptions);
4275char **GDALDeserializeOpenOptionsFromXML(const CPLXMLNode *psParentNode);
4276
4277int GDALCanFileAcceptSidecarFile(const char *pszFilename);
4278
4279bool GDALCanReliablyUseSiblingFileList(const char *pszFilename);
4280
4281typedef enum
4282{
4283 GSF_UNSIGNED_INT,
4284 GSF_SIGNED_INT,
4285 GSF_FLOATING_POINT,
4286} GDALBufferSampleFormat;
4287
4288bool CPL_DLL GDALBufferHasOnlyNoData(const void *pBuffer, double dfNoDataValue,
4289 size_t nWidth, size_t nHeight,
4290 size_t nLineStride, size_t nComponents,
4291 int nBitsPerSample,
4292 GDALBufferSampleFormat nSampleFormat);
4293
4294void CPL_DLL GDALCopyNoDataValue(GDALRasterBand *poDstBand,
4295 GDALRasterBand *poSrcBand);
4296
4297double CPL_DLL GDALGetNoDataValueCastToDouble(int64_t nVal);
4298double CPL_DLL GDALGetNoDataValueCastToDouble(uint64_t nVal);
4299
4300// Remove me in GDAL 4.0. See GetMetadataItem() implementation
4301// Internal use in GDAL only !
4302// Declaration copied in swig/include/gdal.i
4303void CPL_DLL GDALEnablePixelTypeSignedByteWarning(GDALRasterBandH hBand,
4304 bool b);
4305
4306std::string CPL_DLL GDALGetCompressionFormatForJPEG(VSILFILE *fp);
4307std::string CPL_DLL GDALGetCompressionFormatForJPEG(const void *pBuffer,
4308 size_t nBufferSize);
4309
4311 GDALRATTableType eTableType,
4312 const std::vector<std::shared_ptr<GDALMDArray>> &apoArrays,
4313 const std::vector<GDALRATFieldUsage> &aeUsages);
4314
4316
4317#endif /* ndef GDAL_PRIV_H_INCLUDED */
String list class designed around our use of C "char**" string lists.
Definition: cpl_string.h:444
Convenient string class based on std::string.
Definition: cpl_string.h:315
Abstract class, implemented by GDALAttribute and GDALMDArray.
Definition: gdal_priv.h:2933
const std::string & GetFullName() const
Return the name of an array or attribute.
Definition: gdal_priv.h:3010
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:3000
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:2245
Class used as a session object for asynchronous requests.
Definition: gdal_priv.h:2369
int GetXOffset() const
Return x offset.
Definition: gdal_priv.h:2406
int GetYOffset() const
Return y offset.
Definition: gdal_priv.h:2414
int GetYSize() const
Return height.
Definition: gdal_priv.h:2430
int GetBandCount() const
Return band count.
Definition: gdal_priv.h:2470
GDALDataType GetBufferType() const
Return buffer data type.
Definition: gdal_priv.h:2462
int GetBandSpace() const
Return band spacing.
Definition: gdal_priv.h:2502
int GetBufferYSize() const
Return buffer height.
Definition: gdal_priv.h:2454
int GetXSize() const
Return width.
Definition: gdal_priv.h:2422
virtual GDALAsyncStatusType GetNextUpdatedRegion(double dfTimeout, int *pnBufXOff, int *pnBufYOff, int *pnBufXSize, int *pnBufYSize)=0
= 0;
void * GetBuffer()
Return buffer.
Definition: gdal_priv.h:2438
int GetPixelSpace() const
Return pixel spacing.
Definition: gdal_priv.h:2486
int * GetBandMap()
Return band map.
Definition: gdal_priv.h:2478
GDALDataset * GetGDALDataset()
Return dataset.
Definition: gdal_priv.h:2398
int GetLineSpace() const
Return line spacing.
Definition: gdal_priv.h:2494
int GetBufferXSize() const
Return buffer width.
Definition: gdal_priv.h:2446
Class modeling an attribute that has a name, a value and a type, and is typically used to describe a ...
Definition: gdal_priv.h:3164
A color table / palette.
Definition: gdal_priv.h:1306
static GDALColorTableH ToHandle(GDALColorTable *poCT)
Convert a GDALColorTable* to a GDALRasterBandH.
Definition: gdal_priv.h:1331
~GDALColorTable()
Destructor.
static GDALColorTable * FromHandle(GDALColorTableH hCT)
Convert a GDALColorTableH to a GDALColorTable*.
Definition: gdal_priv.h:1339
Class returned by GetBands() that act as a container for raster bands.
Definition: gdal_priv.h:636
Class returned by GetFeatures() that act as a container for vector features.
Definition: gdal_priv.h:966
Layer iterator.
Definition: gdal_priv.h:912
void pointer
pointer
Definition: gdal_priv.h:920
void difference_type
difference_type
Definition: gdal_priv.h:919
std::input_iterator_tag iterator_category
iterator_category
Definition: gdal_priv.h:922
Class returned by GetLayers() that acts as a range of layers.
Definition: gdal_priv.h:898
A set of associated raster bands, usually from one file.
Definition: gdal_priv.h:485
virtual bool SetQueryLoggerFunc(GDALQueryLoggerFunc pfnQueryLoggerFuncIn, void *poQueryLoggerArgIn)
SetQueryLoggerFunc.
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:850
bool IsMarkedSuppressOnClose()
Return MarkSuppressOnClose flag.
Definition: gdal_priv.h:786
OGRErr Release()
Drop a reference to this dataset, and if the reference count drops to one close (destroy) the dataset...
Definition: gdaldataset.cpp:5474
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:794
static GDALDataset * FromHandle(GDALDatasetH hDS)
Convert a GDALDatasetH to a GDALDataset*.
Definition: gdal_priv.h:842
static GDALDatasetH ToHandle(GDALDataset *poDS)
Convert a GDALDataset* to a GDALDatasetH.
Definition: gdal_priv.h:834
GDALAccess GetAccess() const
Return access mode.
Definition: gdal_priv.h:772
Class modeling a a dimension / axis used to index multidimensional arrays.
Definition: gdal_priv.h:3648
const std::string & GetName() const
Return the name.
Definition: gdal_priv.h:3662
const std::string & GetDirection() const
Return the axis direction.
Definition: gdal_priv.h:3697
const std::string & GetFullName() const
Return the full name.
Definition: gdal_priv.h:3671
GUInt64 GetSize() const
Return the size, that is the number of values along the dimension.
Definition: gdal_priv.h:3706
const std::string & GetType() const
Return the axis type.
Definition: gdal_priv.h:3684
Class for managing the registration of file format drivers.
Definition: gdal_priv.h:2287
Format specific driver.
Definition: gdal_priv.h:1943
static GDALDriver * FromHandle(GDALDriverH hDriver)
Convert a GDALDriverH to a GDALDriver*.
Definition: gdal_priv.h:2167
static GDALDriverH ToHandle(GDALDriver *poDriver)
Convert a GDALDriver* to a GDALDriverH.
Definition: gdal_priv.h:2159
Class for a component of a compound extended data type.
Definition: gdal_priv.h:2671
const GDALExtendedDataType & GetType() const
Return the data type of the component.
Definition: gdal_priv.h:2702
size_t GetOffset() const
Return the offset (in bytes) of the component in the compound data type.
Definition: gdal_priv.h:2693
const std::string & GetName() const
Return the name.
Definition: gdal_priv.h:2684
GDALEDTComponent(const GDALEDTComponent &)
Copy constructor.
Class used to represent potentially complex data types.
Definition: gdal_priv.h:2535
bool operator!=(const GDALExtendedDataType &other) const
Non-equality operator.
Definition: gdal_priv.h:2555
GDALExtendedDataTypeSubType GetSubType() const
Return subtype.
Definition: gdal_priv.h:2594
size_t GetSize() const
Return data type size in bytes.
Definition: gdal_priv.h:2615
size_t GetMaxStringLength() const
Return the maximum length of a string in bytes.
Definition: gdal_priv.h:2624
static GDALExtendedDataType Create(GDALDataType eType)
Return a new GDALExtendedDataType of class GEDTC_NUMERIC.
Definition: gdalmultidim.cpp:9886
static GDALExtendedDataType CreateString(size_t nMaxStringLength=0, GDALExtendedDataTypeSubType eSubType=GEDTST_NONE)
Return a new GDALExtendedDataType of class GEDTC_STRING.
Definition: gdalmultidim.cpp:9951
GDALDataType GetNumericDataType() const
Return numeric data type (only valid when GetClass() == GEDTC_NUMERIC)
Definition: gdal_priv.h:2583
GDALExtendedDataTypeClass GetClass() const
Return type class.
Definition: gdal_priv.h:2573
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:2604
const std::string & GetName() const
Return type name.
Definition: gdal_priv.h:2564
Class modeling a named container of GDALAttribute, GDALMDArray, OGRLayer or other GDALGroup.
Definition: gdal_priv.h:2764
const std::string & GetName() const
Return the name of the group.
Definition: gdal_priv.h:2815
const std::string & GetFullName() const
Return the full name of the group.
Definition: gdal_priv.h:2824
Interface used to get a single GDALAttribute or a set of GDALAttribute.
Definition: gdal_priv.h:2723
Class modeling a multi-dimensional array.
Definition: gdal_priv.h:3278
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:3449
Object with metadata.
Definition: gdal_priv.h:156
static GDALMajorObject * FromHandle(GDALMajorObjectH hMajorObject)
Convert a GDALMajorObjectH to a GDALMajorObject*.
Definition: gdal_priv.h:199
static GDALMajorObjectH ToHandle(GDALMajorObject *poMajorObject)
Convert a GDALMajorObject* to a GDALMajorObjectH.
Definition: gdal_priv.h:191
Class for dataset open functions.
Definition: gdal_priv.h:296
int bStatOK
Whether stat()'ing the file was successful.
Definition: gdal_priv.h:317
GByte * pabyHeader
Buffer with first bytes of the file.
Definition: gdal_priv.h:327
int bIsDirectory
Whether the file is a directory.
Definition: gdal_priv.h:319
char ** papszOpenOptions
Open options.
Definition: gdal_priv.h:309
GDALAccess eAccess
Access flag.
Definition: gdal_priv.h:312
int nOpenFlags
Open flags.
Definition: gdal_priv.h:314
VSILFILE * fpL
Pointer to the file.
Definition: gdal_priv.h:322
char * pszFilename
Filename.
Definition: gdal_priv.h:307
int nHeaderBytes
Number of bytes in pabyHeader.
Definition: gdal_priv.h:325
const char *const * papszAllowedDrivers
Allowed drivers (NULL for all)
Definition: gdal_priv.h:330
Proxy for a plugin driver.
Definition: gdal_priv.h:2220
const char * GetMetadataItem(const char *pszName, const char *pszDomain="") override
Fetch single metadata item.
Definition: gdaldrivermanager.cpp:1303
char ** GetMetadata(const char *pszDomain) override
Fetch metadata.
Definition: gdaldrivermanager.cpp:1260
const std::string & GetPluginFileName() const
Return the plugin file name (not a full path)
Definition: gdal_priv.h:2245
CPLErr SetMetadataItem(const char *pszName, const char *pszValue, const char *pszDomain="") override
Set single metadata item.
Definition: gdaldrivermanager.cpp:1268
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:1462
void static GDALRasterBandH ToHandle(GDALRasterBand *poBand)
Convert a GDALRasterBand* to a GDALRasterBandH.
Definition: gdal_priv.h:1750
virtual bool IsMaskBand() const
Returns whether a band is a mask band.
Definition: gdalrasterband.cpp:7603
virtual CPLErr IRasterIO(GDALRWFlag, int, int, int, int, void *, int, int, GDALDataType, GSpacing, GSpacing, GDALRasterIOExtraArg *psExtraArg)
Read/write a region of image data for this band.
Definition: rasterio.cpp:207
CPLErr 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:1758
A single raster block in the block cache.
Definition: gdal_priv.h:1148
int GetDirty() const
Return the dirty flag.
Definition: gdal_priv.h:1245
GDALRasterBand * GetBand()
Accessor to source GDALRasterBand object.
Definition: gdal_priv.h:1272
int GetXSize() const
Return the width of the block.
Definition: gdal_priv.h:1229
GPtrDiff_t GetBlockSize() const
Return the block size in bytes.
Definition: gdal_priv.h:1261
int GetYSize() const
Return the height of the block.
Definition: gdal_priv.h:1237
GDALDataType GetDataType() const
Return the data type.
Definition: gdal_priv.h:1205
int GetXOff() const
Return the x offset of the top-left corner of the block.
Definition: gdal_priv.h:1213
int AddLock(void)
Increment the lock count.
Definition: gdal_priv.h:1187
void * GetDataRef(void)
Return the data buffer.
Definition: gdal_priv.h:1253
int GetYOff() const
Return the y offset of the top-left corner of the block.
Definition: gdal_priv.h:1221
int DropLock(void)
Decrement the lock count.
Definition: gdal_priv.h:1193
Store the raw result of an attribute value, which might contain dynamically allocated structures (lik...
Definition: gdal_priv.h:3099
size_t size() const
Return the size in bytes of the raw result.
Definition: gdal_priv.h:3135
const GByte * data() const
Return pointer to the start of data.
Definition: gdal_priv.h:3129
const GByte & operator[](size_t idx) const
Return byte at specified index.
Definition: gdal_priv.h:3123
Definition of a table relationship.
Definition: gdal_priv.h:3807
const std::string & GetName() const
Get the name of the relationship.
Definition: gdal_priv.h:3846
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:3941
void SetType(GDALRelationshipType eType)
Sets the type of the relationship.
Definition: gdal_priv.h:3993
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:3963
void SetMappingTableName(const std::string &osName)
Sets the name of the mapping table for many-to-many relationships.
Definition: gdal_priv.h:3886
static GDALRelationshipH ToHandle(GDALRelationship *poRelationship)
Convert a GDALRelationship* to a GDALRelationshipH.
Definition: gdal_priv.h:4110
const std::string & GetForwardPathLabel() const
Get the label of the forward path for the relationship.
Definition: gdal_priv.h:4013
const std::string & GetLeftTableName() const
Get the name of the left (or base/origin) table in the relationship.
Definition: gdal_priv.h:3861
const std::string & GetBackwardPathLabel() const
Get the label of the backward path for the relationship.
Definition: gdal_priv.h:4053
const std::string & GetRelatedTableType() const
Get the type string of the related table.
Definition: gdal_priv.h:4088
const std::string & GetMappingTableName() const
Get the name of the mapping table for many-to-many relationships.
Definition: gdal_priv.h:3877
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:3919
GDALRelationshipCardinality GetCardinality() const
Get the cardinality of the relationship.
Definition: gdal_priv.h:3852
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:3930
void SetForwardPathLabel(const std::string &osLabel)
Sets the label of the forward path for the relationship.
Definition: gdal_priv.h:4033
void SetBackwardPathLabel(const std::string &osLabel)
Sets the label of the backward path for the relationship.
Definition: gdal_priv.h:4073
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:3908
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:3975
static GDALRelationship * FromHandle(GDALRelationshipH hRelationship)
Convert a GDALRelationshipH to a GDALRelationship*.
Definition: gdal_priv.h:4117
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:3952
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:3835
GDALRelationshipType GetType() const
Get the type of the relationship.
Definition: gdal_priv.h:3984
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:3897
const std::string & GetRightTableName() const
Get the name of the right (or related/destination) table in the relationship.
Definition: gdal_priv.h:3868
void SetRelatedTableType(const std::string &osType)
Sets the type string of the related table.
Definition: gdal_priv.h:4103
A simple feature, including geometry and attributes.
Definition: ogr_feature.h:893
Definition of a field domain.
Definition: ogr_feature.h:1627
Definition of a geometry field of an OGRFeatureDefn.
Definition: ogr_feature.h:346
Abstract base class for all geometry classes.
Definition: ogr_geometry.h:377
This class represents a layer of simple features, with access methods.
Definition: ogrsf_frmts.h:74
This class represents an OpenGIS Spatial Reference System, and contains methods for converting betwee...
Definition: ogr_spatialref.h:169
This class represents a style table.
Definition: ogr_featurestyle.h:86
C++ wrapper over the C GDAL_GCP structure.
Definition: gdal_priv.h:355
double Line() const
Returns the "line" member.
Definition: gdal_priv.h:396
double & Pixel()
Returns a reference to the "pixel" member.
Definition: gdal_priv.h:390
double X() const
Returns the "X" member.
Definition: gdal_priv.h:408
double & X()
Returns a reference to the "X" member.
Definition: gdal_priv.h:414
double Pixel() const
Returns the "pixel" member.
Definition: gdal_priv.h:384
double & Z()
Returns a reference to the "Z" member.
Definition: gdal_priv.h:438
double Y() const
Returns the "Y" member.
Definition: gdal_priv.h:420
const GDAL_GCP * c_ptr() const
Casts as a C GDAL_GCP pointer.
Definition: gdal_priv.h:444
double & Y()
Returns a reference to the "Y" member.
Definition: gdal_priv.h:426
const char * Id() const
Returns the "id" member.
Definition: gdal_priv.h:368
const char * Info() const
Returns the "info" member.
Definition: gdal_priv.h:376
double Z() const
Returns the "Z" member.
Definition: gdal_priv.h:432
double & Line()
Returns a reference to the "line" member.
Definition: gdal_priv.h:402
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:256
#define STRCASECMP(a, b)
Alias for strcasecmp()
Definition: cpl_port.h:544
#define CPL_NULL_TERMINATED
Null terminated variadic.
Definition: cpl_port.h:938
unsigned long long GUIntBig
Large unsigned integer type (generally 64-bit unsigned integer type).
Definition: cpl_port.h:218
#define CPL_C_END
Macro to end a block of C symbols.
Definition: cpl_port.h:299
#define CPL_C_START
Macro to start a block of C symbols.
Definition: cpl_port.h:295
GIntBig GInt64
Signed 64 bit integer type.
Definition: cpl_port.h:236
#define CPL_PRINT_FUNC_FORMAT(format_idx, arg_idx)
Tag a function to have printf() formatting.
Definition: cpl_port.h:950
#define CPL_DISALLOW_COPY_ASSIGN(ClassName)
Helper to remove the copy and assignment constructors so that the compiler will not generate the defa...
Definition: cpl_port.h:1042
char ** CSLConstList
Type of a constant null-terminated list of nul terminated strings.
Definition: cpl_port.h:1183
GUIntBig GUInt64
Unsigned 64 bit integer type.
Definition: cpl_port.h:238
#define CPL_WARN_UNUSED_RESULT
Qualifier to warn when the return value of a function is not used.
Definition: cpl_port.h:976
unsigned char GByte
Unsigned byte type.
Definition: cpl_port.h:185
long long GIntBig
Large signed integer type (generally 64-bit integer type).
Definition: cpl_port.h:215
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.
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:315
void(* GDALQueryLoggerFunc)(const char *pszSQL, const char *pszError, int64_t lNumRecords, int64_t lExecutionTimeMilliseconds, void *pQueryLoggerArg)
Type of functions to pass to GDALDatasetSetQueryLoggerFunc.
Definition: gdal.h:1307
GDALRATTableType
RAT table type (thematic or athematic)
Definition: gdal.h:1917
GDALAccess
Definition: gdal.h:125
@ GA_ReadOnly
Definition: gdal.h:126
GDALPaletteInterp
Definition: gdal.h:253
@ GPI_RGB
Definition: gdal.h:255
GDALDataType
Definition: gdal.h:64
@ GDT_Byte
Definition: gdal.h:66
@ GDT_Float64
Definition: gdal.h:75
@ GDT_Unknown
Definition: gdal.h:65
void * GDALDatasetH
Opaque type used for the C bindings of the C++ GDALDataset class.
Definition: gdal.h:291
GDALRasterAttributeTableH GDALCreateRasterAttributeTableFromMDArrays(GDALRATTableType eTableType, int nArrays, const GDALMDArrayH *ahArrays, const GDALRATFieldUsage *paeUsages)
Return a virtual Raster Attribute Table from several GDALMDArray's.
Definition: gdalmultidim_rat.cpp:429
GDALExtendedDataTypeClass
Enumeration giving the class of a GDALExtendedDataType.
Definition: gdal.h:321
@ GEDTC_NUMERIC
Numeric value.
Definition: gdal.h:323
GDALRelationshipCardinality
Cardinality of relationship.
Definition: gdal.h:2003
GDALRIOResampleAlg
RasterIO() resampling method.
Definition: gdal.h:143
CPLErr GDALClose(GDALDatasetH)
Close GDAL dataset.
Definition: gdaldataset.cpp:4086
void * GDALRelationshipH
Opaque type used for the C bindings of the C++ GDALRelationship class.
Definition: gdal.h:312
int GDALGetDataTypeSizeBytes(GDALDataType)
Get data type size in bytes.
Definition: gdal_misc.cpp:337
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:3540
GDALExtendedDataTypeSubType
Enumeration giving the subtype of a GDALExtendedDataType.
Definition: gdal.h:334
@ GEDTST_NONE
None.
Definition: gdal.h:336
void * GDALMajorObjectH
Opaque type used for the C bindings of the C++ GDALMajorObject class.
Definition: gdal.h:288
GDALColorInterp
Definition: gdal.h:227
GDALRelationshipType
Type of relationship.
Definition: gdal.h:2019
GDALAsyncStatusType
status of the asynchronous stream
Definition: gdal.h:111
void * GDALDriverH
Opaque type used for the C bindings of the C++ GDALDriver class.
Definition: gdal.h:297
GDALRWFlag
Definition: gdal.h:132
void * GDALRasterBandH
Opaque type used for the C bindings of the C++ GDALRasterBand class.
Definition: gdal.h:294
void * GDALColorTableH
Opaque type used for the C bindings of the C++ GDALColorTable class.
Definition: gdal.h:300
std::unique_ptr< GDALDataset, GDALDatasetUniquePtrDeleter > GDALDatasetUniquePtr
Unique pointer type for GDALDataset.
Definition: gdal_priv.h:1137
constexpr GDALSuggestedBlockAccessPattern GSBAP_UNKNOWN
Unknown, or no particular read order is suggested.
Definition: gdal_priv.h:1444
int GDALSuggestedBlockAccessPattern
Suggested/most efficient access pattern to blocks.
Definition: gdal_priv.h:1441
constexpr GDALSuggestedBlockAccessPattern GSBAP_RANDOM
Random access to blocks is efficient.
Definition: gdal_priv.h:1447
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:1433
@ GMVR_0_AND_1_ONLY
Definition: gdal_priv.h:1436
@ GMVR_0_AND_255_ONLY
Definition: gdal_priv.h:1437
constexpr GDALSuggestedBlockAccessPattern GSBAP_TOP_TO_BOTTOM
Reading by strips from top to bottom is the most efficient.
Definition: gdal_priv.h:1450
GDALIdentifyEnum
Enumeration used by GDALDriver::pfnIdentify().
Definition: gdal_priv.h:1917
@ GDAL_IDENTIFY_TRUE
Identify determined the file is recognized by the probed driver.
Definition: gdal_priv.h:1924
@ GDAL_IDENTIFY_FALSE
Identify determined the file is not recognized by the probed driver.
Definition: gdal_priv.h:1922
@ GDAL_IDENTIFY_UNKNOWN
Identify could not determine if the file is recognized or not by the probed driver.
Definition: gdal_priv.h:1920
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:1457
constexpr GDALSuggestedBlockAccessPattern GSBAP_BOTTOM_TO_TOP
Reading by strips from bottom to top is the most efficient.
Definition: gdal_priv.h:1453
Core portability services for cross-platform OGR code.
OGRwkbGeometryType
List of well known binary geometry types.
Definition: ogr_core.h:416
@ wkbUnknown
unknown type, non-standard
Definition: ogr_core.h:417
int OGRErr
Type for a OGR error.
Definition: ogr_core.h:387
Simple feature classes.
std::unique_ptr< OGRFeature, OGRFeatureUniquePtrDeleter > OGRFeatureUniquePtr
Unique pointer type for OGRFeature.
Definition: ogr_feature.h:1570
OGRLayer::FeatureIterator begin(OGRLayer *poLayer)
Return begin of feature iterator.
Definition: ogrsf_frmts.h:422
OGRLayer::FeatureIterator end(OGRLayer *poLayer)
Return end of feature iterator.
Definition: ogrsf_frmts.h:430
Document node structure.
Definition: cpl_minixml.h:71
Color tuple.
Definition: gdal.h:1844
Object returned by GetFeatures() iterators.
Definition: gdal_priv.h:863
Structure to pass extra arguments to RasterIO() method, must be initialized with INIT_RASTERIO_EXTRA_...
Definition: gdal.h:176
The GDALSubdatasetInfo abstract class provides methods to extract and manipulate subdataset informati...
Definition: gdalsubdatasetinfo.h:43
Ground Control Point.
Definition: gdal.h:1077
Virtual file handle.
Definition: cpl_vsi_virtual.h:63