32#ifndef GDAL_PRIV_H_INCLUDED
33#define GDAL_PRIV_H_INCLUDED
50class GDALProxyDataset;
51class GDALProxyRasterBand;
62#include "gdal_frmts.h"
63#include "gdalsubdatasetinfo.h"
68#include "cpl_multiproc.h"
69#include "cpl_atomic_ops.h"
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
100class CPL_DLL GDALMultiDomainMetadata
107 bool operator()(
const char *a,
const char *b)
const
113 std::map<const char *, CPLStringList, Comparator> oMetadata{};
116 GDALMultiDomainMetadata();
117 ~GDALMultiDomainMetadata();
119 int XMLInit(
const CPLXMLNode *psMetadata,
int bMerge);
124 return aosDomainList.List();
127 char **GetMetadata(
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 =
"");
161 GDALMultiDomainMetadata oMDMD{};
165 char **BuildMetadataDomainList(
char **papszList,
int bCheckNonEmpty,
172 int GetMOFlags()
const;
173 void SetMOFlags(
int nFlagsIn);
175 virtual const char *GetDescription()
const;
176 virtual void SetDescription(
const char *);
178 virtual char **GetMetadataDomainList();
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 =
"");
210class CPL_DLL GDALDefaultOverviews
221 bool bCheckedForMask;
230 bool bCheckedForOverviews;
234 char **papszInitSiblingFiles;
237 GDALDefaultOverviews();
238 ~GDALDefaultOverviews();
240 void Initialize(
GDALDataset *poDSIn,
const char *pszName =
nullptr,
241 char **papszSiblingFiles =
nullptr,
int bNameIsOVR = FALSE);
243 void TransferSiblingFiles(
char **papszSiblingFiles);
251 int GetOverviewCount(
int nBand);
255 int nOverviews,
const int *panOverviewList,
256 int nBands,
const int *panBandList,
257 GDALProgressFunc pfnProgress,
void *pProgressData,
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,
268 CPLErr BuildOverviewsMask(
const char *pszResampling,
int nOverviews,
269 const int *panOverviewList,
270 GDALProgressFunc pfnProgress,
void *pProgressData,
279 int GetMaskFlags(
int nBand);
281 int HaveMaskFile(
char **papszSiblings =
nullptr,
282 const char *pszBasename =
nullptr);
284 char **GetSiblingFiles()
286 return papszInitSiblingFiles;
302 bool bHasGotSiblingFiles;
303 char **papszSiblingFiles;
304 int nHeaderBytesTried;
308 const char *
const *papszSiblingFiles =
nullptr);
337 int TryToIngest(
int nBytes);
338 char **GetSiblingFiles();
339 char **StealSiblingFiles();
340 bool AreSiblingFilesLoaded()
const;
362 explicit GCP(
const char *pszId =
"",
const char *pszInfo =
"",
363 double dfPixel = 0,
double dfLine = 0,
double dfX = 0,
364 double dfY = 0,
double dfZ = 0);
368 GCP &operator=(
const GCP &);
373 inline const char *
Id()
const
378 void SetId(
const char *pszId);
381 inline const char *
Info()
const
386 void SetInfo(
const char *pszInfo);
391 return gcp.dfGCPPixel;
397 return gcp.dfGCPPixel;
403 return gcp.dfGCPLine;
409 return gcp.dfGCPLine;
413 inline double X()
const
425 inline double Y()
const
437 inline double Z()
const
454 static const GDAL_GCP *c_ptr(
const std::vector<GCP> &asGCPs);
456 static std::vector<GCP> fromC(
const GDAL_GCP *pasGCPList,
int nGCPCount);
473class swq_select_parse_options;
477typedef struct GDALSQLParseInfo GDALSQLParseInfo;
481#ifdef GDAL_COMPILATION
482#define OPTIONAL_OUTSIDE_GDAL(val)
484#define OPTIONAL_OUTSIDE_GDAL(val) = val
492 GDALOpenEx(
const char *pszFilename,
unsigned int nOpenFlags,
493 const char *
const *papszAllowedDrivers,
494 const char *
const *papszOpenOptions,
495 const char *
const *papszSiblingFiles);
499 friend class GDALDefaultOverviews;
500 friend class GDALProxyDataset;
503 CPL_INTERNAL
void AddToDatasetOpenList();
505 CPL_INTERNAL
void UnregisterFromSharedDataset();
507 CPL_INTERNAL
static void ReportErrorV(
const char *pszDSName,
509 const char *fmt, va_list args);
517 int nRasterXSize = 512;
518 int nRasterYSize = 512;
522 static constexpr int OPEN_FLAGS_CLOSED = -1;
527 bool bForceCachedIO =
false;
528 bool bShared =
false;
529 bool bIsInternal =
true;
530 bool bSuppressOnClose =
false;
532 mutable std::map<std::string, std::unique_ptr<OGRFieldDomain>>
533 m_oMapFieldDomains{};
538 void RasterInitialize(
int,
int);
540 void SetBand(
int nNewBand, std::unique_ptr<GDALRasterBand> poBand);
542 GDALDefaultOverviews oOvManager{};
544 virtual CPLErr IBuildOverviews(
const char *,
int,
const int *,
int,
545 const int *, GDALProgressFunc,
void *,
554 BlockBasedRasterIO(
GDALRWFlag,
int,
int,
int,
int,
void *,
int,
int,
557 CPLErr BlockBasedFlushCache(
bool bAtClosing);
560 BandBasedRasterIO(
GDALRWFlag eRWFlag,
int nXOff,
int nYOff,
int nXSize,
561 int nYSize,
void *pData,
int nBufXSize,
int nBufYSize,
568 RasterIOResampled(
GDALRWFlag eRWFlag,
int nXOff,
int nYOff,
int nXSize,
569 int nYSize,
void *pData,
int nBufXSize,
int nBufYSize,
575 CPLErr ValidateRasterIOOrAdviseReadParameters(
576 const char *pszCallingFunc,
int *pbStopProcessingOnCENone,
int nXOff,
577 int nYOff,
int nXSize,
int nYSize,
int nBufXSize,
int nBufYSize,
578 int nBandCount,
int *panBandMap);
581 int nXSize,
int nYSize,
void *pData,
582 int nBufXSize,
int nBufYSize,
584 int *panBandMap,
GSpacing nPixelSpace,
588 void ShareLockWithParentDataset(
GDALDataset *poParentDataset);
592 void CleanupPostFileClosing();
594 virtual int CloseDependentDatasets();
596 int ValidateLayerCreationOptions(
const char *
const *papszLCO);
598 char **papszOpenOptions =
nullptr;
605 void LeaveReadWrite();
608 void TemporarilyDropReadWriteLock();
609 void ReacquireReadWriteLock();
611 void DisableReadWriteMutex();
616 bool IsAllBands(
int nBandCount,
const int *panBandList)
const;
624 int GetRasterXSize()
const;
625 int GetRasterYSize()
const;
626 int GetRasterCount()
const;
637 void *poQueryLoggerArgIn);
651 class CPL_DLL Iterator
654 std::unique_ptr<Private> m_poPrivate;
658 Iterator(
const Iterator &oOther);
660 Iterator(Iterator &&oOther)
noexcept;
664 Iterator &operator++();
665 bool operator!=(
const Iterator &it)
const;
669 const Iterator
begin()
const;
671 const Iterator
end()
const;
681 virtual CPLErr FlushCache(
bool bAtClosing =
false);
682 virtual CPLErr DropCache();
684 virtual GIntBig GetEstimatedRAMUsage();
690 const char *GetProjectionRef(
void)
const;
691 CPLErr SetProjection(
const char *pszProjection);
693 virtual CPLErr GetGeoTransform(
double *padfTransform);
694 virtual CPLErr SetGeoTransform(
double *padfTransform);
698 virtual void *GetInternalHandle(
const char *pszHandleName);
700 virtual char **GetFileList(
void);
702 virtual const char *GetDriverName();
705 virtual int GetGCPCount();
711 const char *GetGCPProjection();
713 const char *pszGCPProjection);
715 virtual CPLErr AdviseRead(
int nXOff,
int nYOff,
int nXSize,
int nYSize,
717 int nBandCount,
int *panBandList,
718 char **papszOptions);
720 virtual CPLErr CreateMaskBand(
int nFlagsIn);
723 BeginAsyncReader(
int nXOff,
int nYOff,
int nXSize,
int nYSize,
void *pBuf,
725 int nBandCount,
int *panBandMap,
int nPixelSpace,
726 int nLineSpace,
int nBandSpace,
char **papszOptions);
730 struct RawBinaryLayout
732 enum class Interleaving
739 std::string osRawFilename{};
740 Interleaving eInterleaving = Interleaving::UNKNOWN;
742 bool bLittleEndianOrder =
false;
750 virtual bool GetRawBinaryLayout(RawBinaryLayout &);
757 OPTIONAL_OUTSIDE_GDAL(
nullptr)
761 virtual CPLStringList GetCompressionFormats(
int nXOff,
int nYOff,
762 int nXSize,
int nYSize,
764 const int *panBandList);
765 virtual CPLErr ReadCompressedData(
const char *pszFormat,
int nXOff,
766 int nYOff,
int nXSize,
int nYSize,
767 int nBands,
const int *panBandList,
768 void **ppBuffer,
size_t *pnBufferSize,
769 char **ppszDetailedFormat);
783 int GetShared()
const;
786 void MarkSuppressOnClose();
787 void UnMarkSuppressOnClose();
794 return bSuppressOnClose;
802 return papszOpenOptions;
805 static GDALDataset **GetOpenDatasets(
int *pnDatasetCount);
807 CPLErr BuildOverviews(
const char *,
int,
const int *,
int,
const int *,
808 GDALProgressFunc,
void *,
811 OPTIONAL_OUTSIDE_GDAL(
nullptr)
819 static
void ReportError(const
char *pszDSName,
CPLErr eErrClass,
824 char **GetMetadata(
const char *pszDomain =
"")
override;
830 const char *pszDomain)
override;
833 char **GetMetadataDomainList()
override;
835 virtual void ClearStatistics();
857 unsigned int nOpenFlags = 0,
858 const char *
const *papszAllowedDrivers =
nullptr,
859 const char *
const *papszOpenOptions =
nullptr,
860 const char *
const *papszSiblingFiles =
nullptr)
862 return FromHandle(
GDALOpenEx(pszFilename, nOpenFlags,
863 papszAllowedDrivers, papszOpenOptions,
879 void SetEnableOverviews(
bool bEnable);
882 bool AreOverviewsEnabled()
const;
887 Private *m_poPrivate;
889 CPL_INTERNAL
OGRLayer *BuildLayerFromSelectInfo(
890 swq_select *psSelectInfo,
OGRGeometry *poSpatialFilter,
891 const char *pszDialect, swq_select_parse_options *poSelectParseOptions);
895 virtual int GetLayerCount();
896 virtual OGRLayer *GetLayer(
int iLayer);
898 virtual bool IsLayerPrivate(
int iLayer)
const;
920 std::unique_ptr<Private> m_poPrivate;
928 std::input_iterator_tag;
954 OGRLayer *operator[](
size_t iLayer);
955 OGRLayer *operator[](
const char *pszLayername);
960 virtual OGRLayer *GetLayerByName(
const char *);
961 virtual OGRErr DeleteLayer(
int iLayer);
963 virtual void ResetReading();
965 double *pdfProgressPct,
966 GDALProgressFunc pfnProgress,
967 void *pProgressData);
981 class CPL_DLL Iterator
984 std::unique_ptr<Private> m_poPrivate;
988 Iterator(
const Iterator &oOther);
990 Iterator(Iterator &&oOther)
noexcept;
994 Iterator &operator++();
995 bool operator!=(
const Iterator &it)
const;
999 const Iterator
begin()
const;
1001 const Iterator
end()
const;
1006 virtual int TestCapability(
const char *);
1008 virtual std::vector<std::string>
1009 GetFieldDomainNames(
CSLConstList papszOptions =
nullptr)
const;
1011 virtual const OGRFieldDomain *GetFieldDomain(
const std::string &name)
const;
1013 virtual bool AddFieldDomain(std::unique_ptr<OGRFieldDomain> &&domain,
1014 std::string &failureReason);
1016 virtual bool DeleteFieldDomain(
const std::string &name,
1017 std::string &failureReason);
1019 virtual bool UpdateFieldDomain(std::unique_ptr<OGRFieldDomain> &&domain,
1020 std::string &failureReason);
1022 virtual std::vector<std::string>
1023 GetRelationshipNames(
CSLConstList papszOptions =
nullptr)
const;
1026 GetRelationship(
const std::string &name)
const;
1029 AddRelationship(std::unique_ptr<GDALRelationship> &&relationship,
1030 std::string &failureReason);
1032 virtual bool DeleteRelationship(
const std::string &name,
1033 std::string &failureReason);
1036 UpdateRelationship(std::unique_ptr<GDALRelationship> &&relationship,
1037 std::string &failureReason);
1040 OGRLayer *CreateLayer(
const char *pszName);
1042 OGRLayer *CreateLayer(
const char *pszName, std::nullptr_t);
1045 OGRLayer *CreateLayer(
const char *pszName,
1050 OGRLayer *CreateLayer(
const char *pszName,
1055 char **papszOptions =
nullptr);
1058 virtual void SetStyleTableDirectly(
OGRStyleTable *poStyleTable);
1062 virtual OGRLayer *ExecuteSQL(
const char *pszStatement,
1064 const char *pszDialect);
1065 virtual void ReleaseResultSet(
OGRLayer *poResultsSet);
1066 virtual OGRErr AbortSQL();
1068 int GetRefCount()
const;
1069 int GetSummaryRefCount()
const;
1072 virtual OGRErr StartTransaction(
int bForce = FALSE);
1073 virtual OGRErr CommitTransaction();
1074 virtual OGRErr RollbackTransaction();
1076 virtual std::shared_ptr<GDALGroup> GetRootGroup()
const;
1079 static int IsGenericSQLDialect(
const char *pszDialect);
1083 BuildParseInfo(swq_select *psSelectInfo,
1084 swq_select_parse_options *poSelectParseOptions);
1085 static void DestroyParseInfo(GDALSQLParseInfo *psParseInfo);
1087 const char *pszDialect,
1088 swq_select_parse_options *poSelectParseOptions);
1092 virtual OGRLayer *ICreateLayer(
const char *pszName,
1097 OGRErr ProcessSQLCreateIndex(
const char *);
1098 OGRErr ProcessSQLDropIndex(
const char *);
1099 OGRErr ProcessSQLDropTable(
const char *);
1100 OGRErr ProcessSQLAlterTableAddColumn(
const char *);
1101 OGRErr ProcessSQLAlterTableDropColumn(
const char *);
1102 OGRErr ProcessSQLAlterTableAlterColumn(
const char *);
1103 OGRErr ProcessSQLAlterTableRenameColumn(
const char *);
1107 friend class GDALProxyPoolDataset;
1115struct CPL_DLL GDALDatasetUniquePtrDeleter
1126struct CPL_DLL GDALDatasetUniquePtrReleaser
1143 std::unique_ptr<GDALDataset, GDALDatasetUniquePtrDeleter>;
1155 friend class GDALAbstractBandBlockCache;
1160 volatile int nLockCount;
1177 CPL_INTERNAL
void Detach_unlocked(
void);
1178 CPL_INTERNAL
void Touch_unlocked(
void);
1180 CPL_INTERNAL
void RecycleFor(
int nXOffIn,
int nYOffIn);
1187 CPLErr Internalize(
void);
1189 void MarkDirty(
void);
1190 void MarkClean(
void);
1195 return CPLAtomicInc(&nLockCount);
1201 return CPLAtomicDec(&nLockCount);
1269 return static_cast<GPtrDiff_t>(nXSize) * nYSize *
1274 int DropLockForRemovalFromStorage();
1283 static void FlushDirtyBlocks();
1284 static int FlushCacheBlock(
int bDirtyBlocksOnly = FALSE);
1285 static void Verify();
1287 static void EnterDisableDirtyBlockFlush();
1288 static void LeaveDisableDirtyBlockFlush();
1293 static void DumpAll();
1298 CPL_INTERNAL
static void DestroyRBMutex();
1315 std::vector<GDALColorEntry> aoEntries{};
1326 int GetColorEntryCount()
const;
1332 bool IsIdentity()
const;
1360class GDALAbstractBandBlockCache
1363 CPLLock *hSpinLock =
nullptr;
1367 CPLCond *hCond =
nullptr;
1368 CPLMutex *hCondMutex =
nullptr;
1369 volatile int nKeepAliveCounter = 0;
1371 volatile int m_nDirtyBlocks = 0;
1378 int m_nInitialDirtyBlocksInFlushCache = 0;
1379 int m_nLastTick = -1;
1380 size_t m_nWriteDirtyBlocksDisabled = 0;
1382 void FreeDanglingBlocks();
1383 void UnreferenceBlockBase();
1385 void StartDirtyBlockFlushingLog();
1386 void UpdateDirtyBlockFlushingLog();
1387 void EndDirtyBlockFlushingLog();
1391 virtual ~GDALAbstractBandBlockCache();
1395 void IncDirtyBlocks(
int nInc);
1396 void WaitCompletionPendingTasks();
1398 void EnableDirtyBlockWriting()
1400 --m_nWriteDirtyBlocksDisabled;
1403 void DisableDirtyBlockWriting()
1405 ++m_nWriteDirtyBlocksDisabled;
1408 bool HasDirtyBlocks()
const
1410 return m_nDirtyBlocks > 0;
1413 virtual bool Init() = 0;
1414 virtual bool IsInitOK() = 0;
1415 virtual CPLErr FlushCache() = 0;
1418 int nYBlockYOff) = 0;
1420 virtual CPLErr FlushBlock(
int nXBlockOff,
int nYBlockOff,
1421 int bWriteDirtyBlock) = 0;
1424GDALAbstractBandBlockCache *
1426GDALAbstractBandBlockCache *
1470 friend class GDALArrayBandBlockCache;
1471 friend class GDALHashSetBandBlockCache;
1475 CPLErr eFlushBlockErr = CE_None;
1476 GDALAbstractBandBlockCache *poBandBlockCache =
nullptr;
1478 CPL_INTERNAL
void SetFlushBlockErr(
CPLErr eErr);
1480 CPL_INTERNAL
void IncDirtyBlocks(
int nInc);
1487 int nRasterXSize = 0;
1488 int nRasterYSize = 0;
1494 int nBlockXSize = -1;
1495 int nBlockYSize = -1;
1496 int nBlocksPerRow = 0;
1497 int nBlocksPerColumn = 0;
1499 int nBlockReads = 0;
1500 int bForceCachedIO = 0;
1502 class GDALRasterBandOwnedOrNot
1505 GDALRasterBandOwnedOrNot()
1510 : m_poBandOwned(bOwned ? poBand :
nullptr),
1511 m_poBandRef(bOwned ?
nullptr : poBand)
1517 m_poBandOwned.reset();
1518 m_poBandRef =
nullptr;
1523 m_poBandOwned.reset(bOwned ? poBand :
nullptr);
1524 m_poBandRef = bOwned ? nullptr : poBand;
1532 bool IsOwned()
const
1534 return m_poBandOwned !=
nullptr;
1539 return m_poBandOwned ? m_poBandOwned.get() : m_poBandRef;
1544 std::unique_ptr<GDALRasterBand> m_poBandOwned{};
1548 GDALRasterBandOwnedOrNot poMask{};
1549 bool m_bEnablePixelTypeSignedByteWarning =
1553 void InvalidateMaskBand();
1555 friend class GDALProxyRasterBand;
1556 friend class GDALDefaultOverviews;
1559 RasterIOResampled(
GDALRWFlag,
int,
int,
int,
int,
void *,
int,
int,
1564 void LeaveReadWrite();
1572 virtual CPLErr IWriteBlock(
int nBlockXOff,
int nBlockYOff,
void *pData);
1579 virtual int IGetDataCoverageStatus(
int nXOff,
int nYOff,
int nXSize,
1580 int nYSize,
int nMaskFlagStop,
1581 double *pdfDataPct);
1584 OverviewRasterIO(
GDALRWFlag,
int,
int,
int,
int,
void *,
int,
int,
1589 int nXSize,
int nYSize,
void *pData,
1590 int nBufXSize,
int nBufYSize,
1595 int InitBlockInfo();
1599 bool HasBlockCache()
const
1601 return poBandBlockCache !=
nullptr;
1604 bool HasDirtyBlocks()
const
1606 return poBandBlockCache && poBandBlockCache->HasDirtyBlocks();
1623 void GetBlockSize(
int *,
int *);
1624 CPLErr GetActualBlockSize(
int,
int,
int *,
int *);
1627 GetSuggestedBlockAccessPattern()
const;
1635 OPTIONAL_OUTSIDE_GDAL(
nullptr)
1643 GetLockedBlockRef(
int nXBlockOff,
int nYBlockOff,
1645 GDALRasterBlock *TryGetLockedBlockRef(
int nXBlockOff,
int nYBlockYOff)
1647 CPLErr FlushBlock(
int,
int,
int bWriteDirtyBlock = TRUE);
1651 unsigned char *pTranslationTable =
nullptr,
1652 int *pApproximateMatching =
nullptr);
1656 virtual CPLErr FlushCache(
bool bAtClosing =
false);
1657 virtual CPLErr DropCache();
1658 virtual char **GetCategoryNames();
1659 virtual double GetNoDataValue(
int *pbSuccess =
nullptr);
1660 virtual int64_t GetNoDataValueAsInt64(
int *pbSuccess =
nullptr);
1661 virtual uint64_t GetNoDataValueAsUInt64(
int *pbSuccess =
nullptr);
1662 virtual double GetMinimum(
int *pbSuccess =
nullptr);
1663 virtual double GetMaximum(
int *pbSuccess =
nullptr);
1664 virtual double GetOffset(
int *pbSuccess =
nullptr);
1665 virtual double GetScale(
int *pbSuccess =
nullptr);
1666 virtual const char *GetUnitType();
1669 virtual CPLErr Fill(
double dfRealValue,
double dfImaginaryValue = 0);
1671 virtual CPLErr SetCategoryNames(
char **papszNames);
1672 virtual CPLErr SetNoDataValue(
double dfNoData);
1673 virtual CPLErr SetNoDataValueAsInt64(int64_t nNoData);
1674 virtual CPLErr SetNoDataValueAsUInt64(uint64_t nNoData);
1675 virtual CPLErr DeleteNoDataValue();
1678 virtual CPLErr SetOffset(
double dfNewOffset);
1679 virtual CPLErr SetScale(
double dfNewScale);
1680 virtual CPLErr SetUnitType(
const char *pszNewValue);
1682 virtual CPLErr GetStatistics(
int bApproxOK,
int bForce,
double *pdfMin,
1683 double *pdfMax,
double *pdfMean,
1684 double *padfStdDev);
1685 virtual CPLErr ComputeStatistics(
int bApproxOK,
double *pdfMin,
1686 double *pdfMax,
double *pdfMean,
1687 double *pdfStdDev, GDALProgressFunc,
1688 void *pProgressData);
1689 virtual CPLErr SetStatistics(
double dfMin,
double dfMax,
double dfMean,
1691 virtual CPLErr ComputeRasterMinMax(
int,
double *);
1697 const char *pszDomain)
override;
1699 virtual const char *GetMetadataItem(
const char *pszName,
1700 const char *pszDomain =
"")
override;
1702 virtual int HasArbitraryOverviews();
1703 virtual int GetOverviewCount();
1706 virtual CPLErr BuildOverviews(
const char *pszResampling,
int nOverviews,
1707 const int *panOverviewList,
1708 GDALProgressFunc pfnProgress,
1709 void *pProgressData,
1712 virtual CPLErr AdviseRead(
int nXOff,
int nYOff,
int nXSize,
int nYSize,
1713 int nBufXSize,
int nBufYSize,
1716 virtual CPLErr GetHistogram(
double dfMin,
double dfMax,
int nBuckets,
1717 GUIntBig *panHistogram,
int bIncludeOutOfRange,
1718 int bApproxOK, GDALProgressFunc,
1719 void *pProgressData);
1721 virtual CPLErr GetDefaultHistogram(
double *pdfMin,
double *pdfMax,
1722 int *pnBuckets,
GUIntBig **ppanHistogram,
1723 int bForce, GDALProgressFunc,
1724 void *pProgressData);
1725 virtual CPLErr SetDefaultHistogram(
double dfMin,
double dfMax,
int nBuckets,
1732 virtual int GetMaskFlags();
1733 virtual CPLErr CreateMaskBand(
int nFlagsIn);
1734 virtual bool IsMaskBand()
const;
1738 GetVirtualMemAuto(
GDALRWFlag eRWFlag,
int *pnPixelSpace,
1742 int GetDataCoverageStatus(
int nXOff,
int nYOff,
int nXSize,
int nYSize,
1743 int nMaskFlagStop = 0,
1744 double *pdfDataPct =
nullptr);
1746 std::shared_ptr<GDALMDArray> AsMDArray()
const;
1772 void EnablePixelTypeSignedByteWarning(
bool b)
1773#ifndef GDAL_COMPILATION
1774 CPL_WARN_DEPRECATED(
"Do not use that method outside of GDAL!")
1792 CPLErr IReadBlock(
int,
int,
void *)
override;
1798 ~GDALAllValidMaskBand()
override;
1801 int GetMaskFlags()
override;
1803 bool IsMaskBand()
const override
1813 CPLErr ComputeStatistics(
int bApproxOK,
double *pdfMin,
double *pdfMax,
1814 double *pdfMean,
double *pdfStdDev,
1815 GDALProgressFunc,
void *pProgressData)
override;
1825 double m_dfNoDataValue = 0;
1826 int64_t m_nNoDataValueInt64 = 0;
1827 uint64_t m_nNoDataValueUInt64 = 0;
1840 explicit GDALNoDataMaskBand(
GDALRasterBand *,
double dfNoDataValue);
1841 ~GDALNoDataMaskBand()
override;
1853 static bool IsNoDataInRange(
double dfNoDataValue,
GDALDataType eDataType);
1862 double *padfNodataValues;
1867 CPLErr IReadBlock(
int,
int,
void *)
override;
1871 ~GDALNoDataValuesMaskBand()
override;
1873 bool IsMaskBand()
const override
1903 ~GDALRescaledAlphaBand()
override;
1954 CPLErr SetMetadataItem(
const char *pszName,
const char *pszValue,
1955 const char *pszDomain =
"")
override;
1960 GDALDataset *Create(
const char *pszName,
int nXSize,
int nYSize,
int nBands,
1965 CreateMultiDimensional(
const char *pszName,
1969 CPLErr Delete(
const char *pszName);
1970 CPLErr Rename(
const char *pszNewName,
const char *pszOldName);
1971 CPLErr CopyFiles(
const char *pszNewName,
const char *pszOldName);
1975 GDALProgressFunc pfnProgress,
1978 bool CanVectorTranslateFrom(
const char *pszDestName,
1981 char ***ppapszFailureReasons);
1984 VectorTranslateFrom(
const char *pszDestName,
GDALDataset *poSourceDS,
1986 GDALProgressFunc pfnProgress,
2001 OpenCallback pfnOpen =
nullptr;
2003 virtual OpenCallback GetOpenCallback()
2008 typedef GDALDataset *(*CreateCallback)(
const char *pszName,
int nXSize,
2009 int nYSize,
int nBands,
2011 char **papszOptions);
2013 CreateCallback pfnCreate =
nullptr;
2015 virtual CreateCallback GetCreateCallback()
2022 char **papszOptions) =
nullptr;
2024 typedef GDALDataset *(*CreateMultiDimensionalCallback)(
2025 const char *pszName,
CSLConstList papszRootGroupOptions,
2028 CreateMultiDimensionalCallback pfnCreateMultiDimensional =
nullptr;
2030 virtual CreateMultiDimensionalCallback GetCreateMultiDimensionalCallback()
2032 return pfnCreateMultiDimensional;
2035 typedef CPLErr (*DeleteCallback)(
const char *pszName);
2036 DeleteCallback pfnDelete =
nullptr;
2038 virtual DeleteCallback GetDeleteCallback()
2045 GDALProgressFunc pfnProgress,
2046 void *pProgressData);
2048 CreateCopyCallback pfnCreateCopy =
nullptr;
2050 virtual CreateCopyCallback GetCreateCopyCallback()
2052 return pfnCreateCopy;
2055 void *pDriverData =
nullptr;
2057 void (*pfnUnloadDriver)(
GDALDriver *) =
nullptr;
2070 typedef CPLErr (*RenameCallback)(
const char *pszNewName,
2071 const char *pszOldName);
2072 RenameCallback pfnRename =
nullptr;
2074 virtual RenameCallback GetRenameCallback()
2079 typedef CPLErr (*CopyFilesCallback)(
const char *pszNewName,
2080 const char *pszOldName);
2081 CopyFilesCallback pfnCopyFiles =
nullptr;
2083 virtual CopyFilesCallback GetCopyFilesCallback()
2085 return pfnCopyFiles;
2094 char **papszOptions) =
nullptr;
2095 CPLErr (*pfnDeleteDataSource)(
GDALDriver *,
const char *pszName) =
nullptr;
2101 bool (*pfnCanVectorTranslateFrom)(
2104 char ***ppapszFailureReasons) =
nullptr;
2113 GDALProgressFunc pfnProgress,
void *pProgressData) =
nullptr;
2130 GDALProgressFunc pfnProgress,
2133 static CPLErr DefaultCreateCopyMultiDimensional(
2136 void *pProgressData);
2142 GDALProgressFunc pfnProgress,
2143 void *pProgressData);
2145 CPLErr QuietDeleteForCreateCopy(
const char *pszFilename,
2149 static CPLErr QuietDelete(
const char *pszName,
2153 static CPLErr DefaultRename(
const char *pszNewName,
const char *pszOldName);
2154 static CPLErr DefaultCopyFiles(
const char *pszNewName,
2155 const char *pszOldName);
2227 const std::string m_osPluginFileName;
2228 std::string m_osPluginFullPath{};
2229 std::unique_ptr<GDALDriver> m_poRealDriver{};
2230 std::set<std::string> m_oSetMetadataItems{};
2240 void SetPluginFullPath(
const std::string &osFullPath)
2242 m_osPluginFullPath = osFullPath;
2253 return m_osPluginFileName;
2257 OpenCallback GetOpenCallback()
override;
2259 CreateCallback GetCreateCallback()
override;
2261 CreateMultiDimensionalCallback GetCreateMultiDimensionalCallback()
override;
2263 CreateCopyCallback GetCreateCopyCallback()
override;
2265 DeleteCallback GetDeleteCallback()
override;
2267 RenameCallback GetRenameCallback()
override;
2269 CopyFilesCallback GetCopyFilesCallback()
override;
2273 const char *pszDomain =
"")
override;
2275 char **
GetMetadata(
const char *pszDomain)
override;
2278 const char *pszDomain =
"")
override;
2296 std::map<CPLString, GDALDriver *> oMapNameToDrivers{};
2297 std::string m_osPluginPath{};
2298 std::string m_osDriversIniPath{};
2299 mutable std::string m_osLastTriedDirectory{};
2300 std::set<std::string> m_oSetPluginFileNames{};
2301 bool m_bInDeferredDriverLoading =
false;
2302 std::map<std::string, std::unique_ptr<GDALDriver>> m_oMapRealDrivers{};
2303 std::vector<std::unique_ptr<GDALDriver>> m_aoHiddenDrivers{};
2307 return (iDriver >= 0 && iDriver < nDrivers) ? papoDrivers[iDriver]
2311 GDALDriver *GetDriverByName_unlocked(
const char *pszName)
const
2313 auto oIter = oMapNameToDrivers.find(
CPLString(pszName).toupper());
2314 return oIter == oMapNameToDrivers.end() ? nullptr : oIter->second;
2317 static void CleanupPythonDrivers();
2319 std::string GetPluginFullPath(
const char *pszFilename)
const;
2321 int RegisterDriver(
GDALDriver *,
bool bHidden);
2328 GDALOpenEx(
const char *pszFilename,
unsigned int nOpenFlags,
2329 const char *
const *papszAllowedDrivers,
2330 const char *
const *papszOpenOptions,
2331 const char *
const *papszSiblingFiles);
2334 static char **GetSearchPaths(
const char *pszGDAL_DRIVER_PATH);
2335 int GetDriverCount(
bool bIncludeHidden)
const;
2336 GDALDriver *GetDriver(
int iDriver,
bool bIncludeHidden);
2343 int GetDriverCount(
void)
const;
2351 void AutoLoadDrivers();
2352 void AutoSkipDrivers();
2353 void ReorderDrivers();
2354 static CPLErr LoadPlugin(
const char *name);
2356 static void AutoLoadPythonDrivers();
2515 int *pnBufXSize,
int *pnBufYSize) = 0;
2516 virtual int LockBuffer(
double dfTimeout = -1.0);
2517 virtual void UnlockBuffer();
2552 Create(
const std::string &osName,
size_t nTotalSize,
2553 std::vector<std::unique_ptr<GDALEDTComponent>> &&components);
2555 CreateString(
size_t nMaxStringLength = 0,
2563 return !(operator==(other));
2591 return m_eNumericDT;
2612 return m_aoComponents;
2632 return m_nMaxStringLength;
2637 bool NeedsFreeDynamicMemory()
const;
2639 void FreeDynamicMemory(
void *pBuffer)
const;
2644 static bool CopyValues(
const void *pSrc,
2648 GPtrDiff_t nDstStrideInElts,
size_t nValues);
2655 const std::string &osName,
size_t nTotalSize,
2656 std::vector<std::unique_ptr<GDALEDTComponent>> &&components);
2658 std::string m_osName{};
2662 std::vector<std::unique_ptr<GDALEDTComponent>> m_aoComponents{};
2664 size_t m_nMaxStringLength = 0;
2714 std::string m_osName;
2731 std::shared_ptr<GDALAttribute>
2732 GetAttributeFromAttributes(
const std::string &osName)
const;
2737 virtual std::shared_ptr<GDALAttribute>
2738 GetAttribute(
const std::string &osName)
const;
2740 virtual std::vector<std::shared_ptr<GDALAttribute>>
2741 GetAttributes(
CSLConstList papszOptions =
nullptr)
const;
2743 virtual std::shared_ptr<GDALAttribute>
2744 CreateAttribute(
const std::string &osName,
2745 const std::vector<GUInt64> &anDimensions,
2749 virtual bool DeleteAttribute(
const std::string &osName,
2773 std::string m_osName{};
2776 std::string m_osFullName{};
2780 const std::string m_osContext{};
2782 std::weak_ptr<GDALGroup> m_pSelf{};
2785 bool m_bValid =
true;
2787 GDALGroup(
const std::string &osParentName,
const std::string &osName,
2788 const std::string &osContext = std::string());
2791 GetInnerMostGroup(
const std::string &osPathOrArrayOrDim,
2792 std::shared_ptr<GDALGroup> &curGroupHolder,
2793 std::string &osLastPart)
const;
2795 void BaseRename(
const std::string &osNewName);
2797 bool CheckValidAndErrorOutIfNot()
const;
2799 void SetSelf(
const std::shared_ptr<GDALGroup> &self)
2804 virtual void NotifyChildrenOfRenaming()
2808 virtual void NotifyChildrenOfDeletion()
2832 return m_osFullName;
2835 virtual std::vector<std::string>
2836 GetMDArrayNames(
CSLConstList papszOptions =
nullptr)
const;
2837 virtual std::shared_ptr<GDALMDArray>
2838 OpenMDArray(
const std::string &osName,
2841 virtual std::vector<std::string>
2842 GetGroupNames(
CSLConstList papszOptions =
nullptr)
const;
2843 virtual std::shared_ptr<GDALGroup>
2844 OpenGroup(
const std::string &osName,
2847 virtual std::vector<std::string>
2848 GetVectorLayerNames(
CSLConstList papszOptions =
nullptr)
const;
2850 OpenVectorLayer(
const std::string &osName,
2853 virtual std::vector<std::shared_ptr<GDALDimension>>
2854 GetDimensions(
CSLConstList papszOptions =
nullptr)
const;
2856 virtual std::shared_ptr<GDALGroup>
2857 CreateGroup(
const std::string &osName,
CSLConstList papszOptions =
nullptr);
2859 virtual bool DeleteGroup(
const std::string &osName,
2862 virtual std::shared_ptr<GDALDimension>
2863 CreateDimension(
const std::string &osName,
const std::string &osType,
2864 const std::string &osDirection,
GUInt64 nSize,
2867 virtual std::shared_ptr<GDALMDArray> CreateMDArray(
2868 const std::string &osName,
2869 const std::vector<std::shared_ptr<GDALDimension>> &aoDimensions,
2873 virtual bool DeleteMDArray(
const std::string &osName,
2876 GUInt64 GetTotalCopyCost()
const;
2878 virtual bool CopyFrom(
const std::shared_ptr<GDALGroup> &poDstRootGroup,
2880 const std::shared_ptr<GDALGroup> &poSrcGroup,
2881 bool bStrict,
GUInt64 &nCurCost,
2883 GDALProgressFunc pfnProgress,
void *pProgressData,
2888 std::shared_ptr<GDALMDArray>
2889 OpenMDArrayFromFullname(
const std::string &osFullName,
2892 std::shared_ptr<GDALMDArray>
2893 ResolveMDArray(
const std::string &osName,
const std::string &osStartingPath,
2896 std::shared_ptr<GDALGroup>
2897 OpenGroupFromFullname(
const std::string &osFullName,
2900 std::shared_ptr<GDALDimension>
2901 OpenDimensionFromFullname(
const std::string &osFullName)
const;
2903 virtual void ClearStatistics();
2905 virtual bool Rename(
const std::string &osNewName);
2907 std::shared_ptr<GDALGroup>
2908 SubsetDimensionFromSelection(
const std::string &osSelection)
const;
2911 virtual void ParentRenamed(
const std::string &osNewParentFullName);
2913 virtual void Deleted();
2915 virtual void ParentDeleted();
2917 const std::string &GetContext()
const
2925 static constexpr GUInt64 COPY_COST = 1000;
2942 std::string m_osName{};
2945 std::string m_osFullName{};
2946 std::weak_ptr<GDALAbstractMDArray> m_pSelf{};
2949 bool m_bValid =
true;
2952 const std::string &osName);
2954 void SetSelf(
const std::shared_ptr<GDALAbstractMDArray> &self)
2959 bool CheckValidAndErrorOutIfNot()
const;
2961 bool CheckReadWriteParams(
const GUInt64 *arrayStartIdx,
const size_t *count,
2962 const GInt64 *&arrayStep,
2966 const void *buffer_alloc_start,
2967 size_t buffer_alloc_size,
2968 std::vector<GInt64> &tmp_arrayStep,
2969 std::vector<GPtrDiff_t> &tmp_bufferStride)
const;
2972 IRead(
const GUInt64 *arrayStartIdx,
2973 const size_t *count,
2977 void *pDstBuffer)
const = 0;
2980 IWrite(
const GUInt64 *arrayStartIdx,
2981 const size_t *count,
2986 void BaseRename(
const std::string &osNewName);
2988 virtual void NotifyChildrenOfRenaming()
2992 virtual void NotifyChildrenOfDeletion()
3018 return m_osFullName;
3021 GUInt64 GetTotalElementsCount()
const;
3023 virtual size_t GetDimensionCount()
const;
3025 virtual const std::vector<std::shared_ptr<GDALDimension>> &
3030 virtual std::vector<GUInt64> GetBlockSize()
const;
3032 virtual std::vector<size_t>
3033 GetProcessingChunkSize(
size_t nMaxChunkMemory)
const;
3051 typedef bool (*FuncProcessPerChunkType)(
3053 const GUInt64 *chunkArrayStartIdx,
3054 const size_t *chunkCount,
3060 virtual bool ProcessPerChunk(
const GUInt64 *arrayStartIdx,
3061 const GUInt64 *count,
const size_t *chunkSize,
3062 FuncProcessPerChunkType pfnFunc,
3066 Read(
const GUInt64 *arrayStartIdx,
3067 const size_t *count,
3071 const void *pDstBufferAllocStart =
nullptr,
3072 size_t nDstBufferAllocSize = 0)
const;
3075 Write(
const GUInt64 *arrayStartIdx,
3076 const size_t *count,
3080 const void *pSrcBufferAllocStart =
nullptr,
3081 size_t nSrcBufferAllocSize = 0);
3083 virtual bool Rename(
const std::string &osNewName);
3086 virtual void Deleted();
3088 virtual void ParentDeleted();
3090 virtual void ParentRenamed(
const std::string &osNewParentFullName);
3171 mutable std::string m_osCachedVal{};
3175 GDALAttribute(
const std::string &osParentName,
const std::string &osName);
3179 std::vector<GUInt64> GetDimensionsSize()
const;
3182 const char *ReadAsString()
const;
3183 int ReadAsInt()
const;
3184 double ReadAsDouble()
const;
3186 std::vector<int> ReadAsIntArray()
const;
3187 std::vector<double> ReadAsDoubleArray()
const;
3190 bool Write(
const void *pabyValue,
size_t nLen);
3191 bool Write(
const char *);
3195 bool Write(
const double *,
size_t);
3198 static constexpr GUInt64 COPY_COST = 100;
3207class CPL_DLL GDALAttributeString final :
public GDALAttribute
3209 std::vector<std::shared_ptr<GDALDimension>> m_dims{};
3211 std::string m_osValue;
3216 void *pDstBuffer)
const override;
3219 GDALAttributeString(
const std::string &osParentName,
3220 const std::string &osName,
const std::string &osValue,
3223 const std::vector<std::shared_ptr<GDALDimension>> &
3224 GetDimensions()
const override;
3236class CPL_DLL GDALAttributeNumeric final :
public GDALAttribute
3238 std::vector<std::shared_ptr<GDALDimension>> m_dims{};
3241 double m_dfValue = 0;
3242 std::vector<GUInt32> m_anValuesUInt32{};
3247 void *pDstBuffer)
const override;
3250 GDALAttributeNumeric(
const std::string &osParentName,
3251 const std::string &osName,
double dfValue);
3252 GDALAttributeNumeric(
const std::string &osParentName,
3253 const std::string &osName,
int nValue);
3254 GDALAttributeNumeric(
const std::string &osParentName,
3255 const std::string &osName,
3256 const std::vector<GUInt32> &anValues);
3258 const std::vector<std::shared_ptr<GDALDimension>> &
3259 GetDimensions()
const override;
3285 friend class GDALMDArrayResampled;
3286 std::shared_ptr<GDALMDArray>
3287 GetView(
const std::vector<GUInt64> &indices)
const;
3289 inline std::shared_ptr<GDALMDArray>
3290 atInternal(
const std::vector<GUInt64> &indices)
const
3292 return GetView(indices);
3295 template <
typename... GUInt64VarArg>
3297 inline std::shared_ptr<GDALMDArray>
3298 atInternal(std::vector<GUInt64> &indices,
GUInt64 idx,
3299 GUInt64VarArg... tail)
const
3301 indices.push_back(idx);
3302 return atInternal(indices, tail...);
3307 const std::string m_osContext{};
3309 mutable bool m_bHasTriedCachedArray =
false;
3310 mutable std::shared_ptr<GDALMDArray> m_poCachedArray{};
3314 GDALMDArray(
const std::string &osParentName,
const std::string &osName,
3315 const std::string &osContext = std::string());
3317 virtual bool IAdviseRead(
const GUInt64 *arrayStartIdx,
const size_t *count,
3320 virtual bool IsCacheable()
const
3325 virtual bool SetStatistics(
bool bApproxStats,
double dfMin,
double dfMax,
3326 double dfMean,
double dfStdDev,
3329 static std::string MassageName(
const std::string &inputName);
3331 std::shared_ptr<GDALGroup>
3332 GetCacheRootGroup(
bool bCanCreate, std::string &osCacheFilenameOut)
const;
3335 bool IsTransposedRequest(
const size_t *count,
3339 bool ReadForTransposedRequest(
const GUInt64 *arrayStartIdx,
3340 const size_t *count,
const GInt64 *arrayStep,
3343 void *pDstBuffer)
const;
3345 bool IsStepOneContiguousRowMajorOrderedSameDataType(
3346 const size_t *count,
const GInt64 *arrayStep,
3352 bool ReadUsingContiguousIRead(
const GUInt64 *arrayStartIdx,
3353 const size_t *count,
const GInt64 *arrayStep,
3356 void *pDstBuffer)
const;
3358 static std::shared_ptr<GDALMDArray>
3359 CreateGLTOrthorectified(
const std::shared_ptr<GDALMDArray> &poParent,
3360 const std::shared_ptr<GDALMDArray> &poGLTX,
3361 const std::shared_ptr<GDALMDArray> &poGLTY,
3362 int nGLTIndexOffset,
3363 const std::vector<double> &adfGeoTransform);
3368 GUInt64 GetTotalCopyCost()
const;
3371 bool bStrict,
GUInt64 &nCurCost,
3373 GDALProgressFunc pfnProgress,
void *pProgressData);
3390 virtual const std::string &GetUnit()
const;
3392 virtual bool SetUnit(
const std::string &osUnit);
3396 virtual std::shared_ptr<OGRSpatialReference> GetSpatialRef()
const;
3398 virtual const void *GetRawNoDataValue()
const;
3400 double GetNoDataValueAsDouble(
bool *pbHasNoData =
nullptr)
const;
3402 int64_t GetNoDataValueAsInt64(
bool *pbHasNoData =
nullptr)
const;
3404 uint64_t GetNoDataValueAsUInt64(
bool *pbHasNoData =
nullptr)
const;
3406 virtual bool SetRawNoDataValue(
const void *pRawNoData);
3409 bool SetNoDataValue(
int nNoData)
3411 return SetNoDataValue(
static_cast<int64_t
>(nNoData));
3416 bool SetNoDataValue(
double dfNoData);
3418 bool SetNoDataValue(int64_t nNoData);
3420 bool SetNoDataValue(uint64_t nNoData);
3422 virtual bool Resize(
const std::vector<GUInt64> &anNewDimSizes,
3425 virtual double GetOffset(
bool *pbHasOffset =
nullptr,
3428 virtual double GetScale(
bool *pbHasScale =
nullptr,
3431 virtual bool SetOffset(
double dfOffset,
3434 virtual bool SetScale(
double dfScale,
3437 std::shared_ptr<GDALMDArray> GetView(
const std::string &viewExpr)
const;
3439 std::shared_ptr<GDALMDArray> operator[](
const std::string &fieldName)
const;
3452 template <
typename... GUInt64VarArg>
3455 std::shared_ptr<GDALMDArray>
at(
GUInt64 idx, GUInt64VarArg... tail)
const
3457 std::vector<GUInt64> indices;
3458 indices.push_back(idx);
3459 return atInternal(indices, tail...);
3462 virtual std::shared_ptr<GDALMDArray>
3463 Transpose(
const std::vector<int> &anMapNewAxisToOldAxis)
const;
3465 std::shared_ptr<GDALMDArray> GetUnscaled(
3466 double dfOverriddenScale = std::numeric_limits<double>::quiet_NaN(),
3467 double dfOverriddenOffset = std::numeric_limits<double>::quiet_NaN(),
3468 double dfOverriddenDstNodata =
3469 std::numeric_limits<double>::quiet_NaN())
const;
3471 virtual std::shared_ptr<GDALMDArray>
3474 virtual std::shared_ptr<GDALMDArray>
3475 GetResampled(
const std::vector<std::shared_ptr<GDALDimension>> &apoNewDims,
3480 std::shared_ptr<GDALMDArray>
3481 GetGridded(
const std::string &osGridOptions,
3482 const std::shared_ptr<GDALMDArray> &poXArray =
nullptr,
3483 const std::shared_ptr<GDALMDArray> &poYArray =
nullptr,
3487 AsClassicDataset(
size_t iXDim,
size_t iYDim,
3488 const std::shared_ptr<GDALGroup> &poRootGroup =
nullptr,
3491 virtual CPLErr GetStatistics(
bool bApproxOK,
bool bForce,
double *pdfMin,
3492 double *pdfMax,
double *pdfMean,
3493 double *padfStdDev,
GUInt64 *pnValidCount,
3494 GDALProgressFunc pfnProgress,
3495 void *pProgressData);
3497 virtual bool ComputeStatistics(
bool bApproxOK,
double *pdfMin,
3498 double *pdfMax,
double *pdfMean,
3499 double *pdfStdDev,
GUInt64 *pnValidCount,
3500 GDALProgressFunc,
void *pProgressData,
3503 virtual void ClearStatistics();
3505 virtual std::vector<std::shared_ptr<GDALMDArray>>
3506 GetCoordinateVariables()
const;
3508 bool AdviseRead(
const GUInt64 *arrayStartIdx,
const size_t *count,
3511 bool IsRegularlySpaced(
double &dfStart,
double &dfIncrement)
const;
3513 bool GuessGeoTransform(
size_t nDimX,
size_t nDimY,
bool bPixelIsPoint,
3514 double adfGeoTransform[6])
const;
3519 Read(
const GUInt64 *arrayStartIdx,
3520 const size_t *count,
3524 const void *pDstBufferAllocStart =
nullptr,
3525 size_t nDstBufferAllocSize = 0) const override final;
3527 virtual std::shared_ptr<
GDALGroup> GetRootGroup() const;
3530 static constexpr
GUInt64 COPY_COST = 1000;
3532 bool CopyFromAllExceptValues(const
GDALMDArray *poSrcArray,
bool bStrict,
3534 GDALProgressFunc pfnProgress,
3535 void *pProgressData);
3543 : m_nStartIdx(nStartIdx), m_nIncr(nIncr)
3550 std::string m_osFieldName{};
3555 m_mapDimIdxToParentDimIdx{};
3560 virtual std::shared_ptr<GDALMDArray>
3561 GetView(
const std::string &viewExpr,
bool bRenameDimensions,
3562 std::vector<ViewSpec> &viewSpecs)
const;
3564 const std::string &GetContext()
const
3574 size_t iDimX,
size_t iDimY,
3575 const GUInt64 *arrayStartIdx,
const size_t *count,
3588class CPL_DLL GDALMDArrayRegularlySpaced :
public GDALMDArray
3591 double m_dfIncrement;
3592 double m_dfOffsetInIncrement;
3594 std::vector<std::shared_ptr<GDALDimension>> m_dims;
3595 std::vector<std::shared_ptr<GDALAttribute>> m_attributes{};
3596 std::string m_osEmptyFilename{};
3601 void *pDstBuffer)
const override;
3604 GDALMDArrayRegularlySpaced(
const std::string &osParentName,
3605 const std::string &osName,
3606 const std::shared_ptr<GDALDimension> &poDim,
3607 double dfStart,
double dfIncrement,
3608 double dfOffsetInIncrement);
3610 static std::shared_ptr<GDALMDArrayRegularlySpaced>
3611 Create(
const std::string &osParentName,
const std::string &osName,
3612 const std::shared_ptr<GDALDimension> &poDim,
double dfStart,
3613 double dfIncrement,
double dfOffsetInIncrement);
3615 bool IsWritable()
const override
3620 const std::string &GetFilename()
const override
3622 return m_osEmptyFilename;
3625 const std::vector<std::shared_ptr<GDALDimension>> &
3626 GetDimensions()
const override;
3630 std::vector<std::shared_ptr<GDALAttribute>>
3633 void AddAttribute(
const std::shared_ptr<GDALAttribute> &poAttr);
3657 GDALDimension(
const std::string &osParentName,
const std::string &osName,
3658 const std::string &osType,
const std::string &osDirection,
3679 return m_osFullName;
3705 return m_osDirection;
3717 virtual std::shared_ptr<GDALMDArray> GetIndexingVariable()
const;
3720 SetIndexingVariable(std::shared_ptr<GDALMDArray> poIndexingVariable);
3722 virtual bool Rename(
const std::string &osNewName);
3725 virtual void ParentRenamed(
const std::string &osNewParentFullName);
3727 virtual void ParentDeleted();
3732 std::string m_osName;
3733 std::string m_osFullName;
3734 std::string m_osType;
3735 std::string m_osDirection;
3738 void BaseRename(
const std::string &osNewName);
3748class CPL_DLL GDALDimensionWeakIndexingVar :
public GDALDimension
3750 std::weak_ptr<GDALMDArray> m_poIndexingVariable{};
3753 GDALDimensionWeakIndexingVar(
const std::string &osParentName,
3754 const std::string &osName,
3755 const std::string &osType,
3756 const std::string &osDirection,
GUInt64 nSize);
3758 std::shared_ptr<GDALMDArray> GetIndexingVariable()
const override;
3760 bool SetIndexingVariable(
3761 std::shared_ptr<GDALMDArray> poIndexingVariable)
override;
3763 void SetSize(
GUInt64 nNewSize);
3772struct GDALAntiRecursionStruct;
3774class GDALAntiRecursionGuard
3776 GDALAntiRecursionStruct *m_psAntiRecursionStruct;
3777 std::string m_osIdentifier;
3780 GDALAntiRecursionGuard(
const GDALAntiRecursionGuard &) =
delete;
3781 GDALAntiRecursionGuard &operator=(
const GDALAntiRecursionGuard &) =
delete;
3784 explicit GDALAntiRecursionGuard(
const std::string &osIdentifier);
3785 GDALAntiRecursionGuard(
const GDALAntiRecursionGuard &other,
3786 const std::string &osIdentifier);
3787 ~GDALAntiRecursionGuard();
3789 int GetCallDepth()
const
3816 std::string m_osName{};
3817 std::string m_osLeftTableName{};
3818 std::string m_osRightTableName{};
3821 std::string m_osMappingTableName{};
3822 std::vector<std::string> m_osListLeftTableFields{};
3823 std::vector<std::string> m_osListRightTableFields{};
3824 std::vector<std::string> m_osListLeftMappingTableFields{};
3825 std::vector<std::string> m_osListRightMappingTableFields{};
3827 std::string m_osForwardPathLabel{};
3828 std::string m_osBackwardPathLabel{};
3829 std::string m_osRelatedTableType{};
3842 const std::string &osLeftTableName,
3843 const std::string &osRightTableName,
3846 : m_osName(osName), m_osLeftTableName(osLeftTableName),
3847 m_osRightTableName(osRightTableName), m_eCardinality(eCardinality)
3860 return m_eCardinality;
3869 return m_osLeftTableName;
3876 return m_osRightTableName;
3885 return m_osMappingTableName;
3894 m_osMappingTableName = osName;
3905 return m_osListLeftTableFields;
3916 return m_osListRightTableFields;
3927 m_osListLeftTableFields = osListFields;
3938 m_osListRightTableFields = osListFields;
3949 return m_osListLeftMappingTableFields;
3960 return m_osListRightMappingTableFields;
3971 m_osListLeftMappingTableFields = osListFields;
3983 m_osListRightMappingTableFields = osListFields;
4021 return m_osForwardPathLabel;
4041 m_osForwardPathLabel = osLabel;
4061 return m_osBackwardPathLabel;
4081 m_osBackwardPathLabel = osLabel;
4096 return m_osRelatedTableType;
4111 m_osRelatedTableType = osType;
4135CPLErr CPL_DLL GDALRegenerateOverviewsMultiBand(
4138 const char *pszResampling, GDALProgressFunc pfnProgress,
4141typedef CPLErr (*GDALResampleFunction)(
4142 double dfXRatioDstToSrc,
double dfYRatioDstToSrc,
double dfSrcXDelta,
4143 double dfSrcYDelta,
GDALDataType eWrkDataType,
const void *pChunk,
4144 const GByte *pabyChunkNodataMask,
int nChunkXOff,
int nChunkXSize,
4145 int nChunkYOff,
int nChunkYSize,
int nDstXOff,
int nDstXOff2,
int nDstYOff,
4147 GDALDataType *peDstBufferDataType,
const char *pszResampling,
4148 bool bHasNoData,
double dfNoDataValue,
GDALColorTable *poColorTable,
4151GDALResampleFunction GDALGetResampleFunction(
const char *pszResampling,
4154std::string GDALGetNormalizedOvrResampling(
const char *pszResampling);
4156GDALDataType GDALGetOvrWorkDataType(
const char *pszResampling,
4162HFAAuxBuildOverviews(
const char *pszOvrFilename,
GDALDataset *poParentDS,
4163 GDALDataset **ppoDS,
int nBands,
const int *panBandList,
4164 int nNewOverviews,
const int *panNewOverviewList,
4165 const char *pszResampling, GDALProgressFunc pfnProgress,
4168CPLErr CPL_DLL GTIFFBuildOverviews(
const char *pszFilename,
int nBands,
4170 int nOverviews,
const int *panOverviewList,
4171 const char *pszResampling,
4172 GDALProgressFunc pfnProgress,
4173 void *pProgressData,
4176int CPL_DLL GDALBandGetBestOverviewLevel(
GDALRasterBand *poBand,
int &nXOff,
4177 int &nYOff,
int &nXSize,
int &nYSize,
4178 int nBufXSize,
int nBufYSize)
4179 CPL_WARN_DEPRECATED(
"Use GDALBandGetBestOverviewLevel2 instead");
4180int CPL_DLL GDALBandGetBestOverviewLevel2(
GDALRasterBand *poBand,
int &nXOff,
4181 int &nYOff,
int &nXSize,
int &nYSize,
4182 int nBufXSize,
int nBufYSize,
4185int CPL_DLL GDALOvLevelAdjust(
int nOvLevel,
int nXSize)
4186 CPL_WARN_DEPRECATED(
"Use GDALOvLevelAdjust2 instead");
4187int CPL_DLL GDALOvLevelAdjust2(
int nOvLevel,
int nXSize,
int nYSize);
4188int CPL_DLL GDALComputeOvFactor(
int nOvrXSize,
int nRasterXSize,
int nOvrYSize,
4191GDALDataset CPL_DLL *GDALFindAssociatedAuxFile(
const char *pszBasefile,
4199int CPL_DLL GDALCheckDatasetDimensions(
int nXSize,
int nYSize);
4200int CPL_DLL GDALCheckBandCount(
int nBands,
int bIsZeroAllowed);
4206int CPL_DLL GDALReadWorldFile2(
const char *pszBaseFilename,
4207 const char *pszExtension,
4208 double *padfGeoTransform,
4209 char **papszSiblingFiles,
4210 char **ppszWorldFileNameOut);
4211int CPL_DLL GDALReadTabFile2(
const char *pszBaseFilename,
4212 double *padfGeoTransform,
char **ppszWKT,
4213 int *pnGCPCount,
GDAL_GCP **ppasGCPs,
4214 char **papszSiblingFiles,
4215 char **ppszTabFileNameOut);
4222void GDALNullifyOpenDatasetsList();
4223CPLMutex **GDALGetphDMMutex();
4224CPLMutex **GDALGetphDLMutex();
4225void GDALNullifyProxyPoolSingleton();
4226void GDALSetResponsiblePIDForCurrentThread(
GIntBig responsiblePID);
4227GIntBig GDALGetResponsiblePIDForCurrentThread();
4229CPLString GDALFindAssociatedFile(
const char *pszBasename,
const char *pszExt,
4232CPLErr CPL_DLL EXIFExtractMetadata(
char **&papszMetadata,
void *fpL,
4233 int nOffset,
int bSwabflag,
int nTIFFHEADER,
4234 int &nExifOffset,
int &nInterOffset,
4238 const char *
const *papszOptionOptions);
4239int GDALValidateOptions(
const char *pszOptionList,
4240 const char *
const *papszOptionsToValidate,
4241 const char *pszErrorMessageOptionType,
4242 const char *pszErrorMessageContainerName);
4248 int nXSize,
int nYSize,
int nBufXSize,
4252 bool bThisLevelOnly);
4257template <
class T>
inline bool ARE_REAL_EQUAL(T fVal1, T fVal2,
int ulp = 2)
4259 return fVal1 == fVal2 ||
4260 std::abs(fVal1 - fVal2) < std::numeric_limits<float>::epsilon() *
4261 std::abs(fVal1 + fVal2) * ulp;
4264double GDALAdjustNoDataCloseToFloatMax(
double dfVal);
4266#define DIV_ROUND_UP(a, b) (((a) % (b)) == 0 ? ((a) / (b)) : (((a) / (b)) + 1))
4270#define GDALSTAT_APPROX_NUMSAMPLES 2500
4272void GDALSerializeGCPListToXML(
CPLXMLNode *psParentNode,
4273 const std::vector<gdal::GCP> &asGCPs,
4275void GDALDeserializeGCPListFromXML(
const CPLXMLNode *psGCPList,
4276 std::vector<gdal::GCP> &asGCPs,
4279void GDALSerializeOpenOptionsToXML(
CPLXMLNode *psParentNode,
4280 char **papszOpenOptions);
4281char **GDALDeserializeOpenOptionsFromXML(
const CPLXMLNode *psParentNode);
4283int GDALCanFileAcceptSidecarFile(
const char *pszFilename);
4285bool GDALCanReliablyUseSiblingFileList(
const char *pszFilename);
4292} GDALBufferSampleFormat;
4294bool CPL_DLL GDALBufferHasOnlyNoData(
const void *pBuffer,
double dfNoDataValue,
4295 size_t nWidth,
size_t nHeight,
4296 size_t nLineStride,
size_t nComponents,
4298 GDALBufferSampleFormat nSampleFormat);
4303double CPL_DLL GDALGetNoDataValueCastToDouble(int64_t nVal);
4304double CPL_DLL GDALGetNoDataValueCastToDouble(uint64_t nVal);
4309void CPL_DLL GDALEnablePixelTypeSignedByteWarning(
GDALRasterBandH hBand,
4312std::string CPL_DLL GDALGetCompressionFormatForJPEG(
VSILFILE *fp);
4313std::string CPL_DLL GDALGetCompressionFormatForJPEG(
const void *pBuffer,
4314 size_t nBufferSize);
4318 const std::vector<std::shared_ptr<GDALMDArray>> &apoArrays,
4319 const std::vector<GDALRATFieldUsage> &aeUsages);
String list class designed around our use of C "char**" string lists.
Definition: cpl_string.h:449
Convenient string class based on std::string.
Definition: cpl_string.h:320
Abstract class, implemented by GDALAttribute and GDALMDArray.
Definition: gdal_priv.h:2939
const std::string & GetFullName() const
Return the name of an array or attribute.
Definition: gdal_priv.h:3016
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:3006
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:2375
int GetXOffset() const
Return x offset.
Definition: gdal_priv.h:2412
int GetYOffset() const
Return y offset.
Definition: gdal_priv.h:2420
int GetYSize() const
Return height.
Definition: gdal_priv.h:2436
int GetBandCount() const
Return band count.
Definition: gdal_priv.h:2476
GDALDataType GetBufferType() const
Return buffer data type.
Definition: gdal_priv.h:2468
int GetBandSpace() const
Return band spacing.
Definition: gdal_priv.h:2508
int GetBufferYSize() const
Return buffer height.
Definition: gdal_priv.h:2460
int GetXSize() const
Return width.
Definition: gdal_priv.h:2428
virtual GDALAsyncStatusType GetNextUpdatedRegion(double dfTimeout, int *pnBufXOff, int *pnBufYOff, int *pnBufXSize, int *pnBufYSize)=0
= 0;
void * GetBuffer()
Return buffer.
Definition: gdal_priv.h:2444
int GetPixelSpace() const
Return pixel spacing.
Definition: gdal_priv.h:2492
int * GetBandMap()
Return band map.
Definition: gdal_priv.h:2484
GDALDataset * GetGDALDataset()
Return dataset.
Definition: gdal_priv.h:2404
int GetLineSpace() const
Return line spacing.
Definition: gdal_priv.h:2500
int GetBufferXSize() const
Return buffer width.
Definition: gdal_priv.h:2452
Class modeling an attribute that has a name, a value and a type, and is typically used to describe a ...
Definition: gdal_priv.h:3170
A color table / palette.
Definition: gdal_priv.h:1312
static GDALColorTableH ToHandle(GDALColorTable *poCT)
Convert a GDALColorTable* to a GDALRasterBandH.
Definition: gdal_priv.h:1337
~GDALColorTable()
Destructor.
static GDALColorTable * FromHandle(GDALColorTableH hCT)
Convert a GDALColorTableH to a GDALColorTable*.
Definition: gdal_priv.h:1345
Class returned by GetBands() that act as a container for raster bands.
Definition: gdal_priv.h:642
Class returned by GetFeatures() that act as a container for vector features.
Definition: gdal_priv.h:972
Layer iterator.
Definition: gdal_priv.h:918
void pointer
pointer
Definition: gdal_priv.h:926
void difference_type
difference_type
Definition: gdal_priv.h:925
std::input_iterator_tag iterator_category
iterator_category
Definition: gdal_priv.h:928
Class returned by GetLayers() that acts as a range of layers.
Definition: gdal_priv.h:904
A set of associated raster bands, usually from one file.
Definition: gdal_priv.h:490
virtual int CloseDependentDatasets()
Drop references to any other datasets referenced by this dataset.
Definition: gdaldataset.cpp:4517
virtual bool SetQueryLoggerFunc(GDALQueryLoggerFunc pfnQueryLoggerFuncIn, void *poQueryLoggerArgIn)
SetQueryLoggerFunc.
virtual CPLErr CreateMaskBand(int nFlagsIn)
Adds a mask band to the dataset.
Definition: gdaldataset.cpp:3351
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:856
bool IsMarkedSuppressOnClose()
Return MarkSuppressOnClose flag.
Definition: gdal_priv.h:792
OGRErr Release()
Drop a reference to this dataset, and if the reference count drops to one close (destroy) the dataset...
Definition: gdaldataset.cpp:5515
CPLErr SetMetadata(char **papszMetadata, const char *pszDomain) override
Set metadata.
CPLErr BuildOverviews(const char *, int, const int *, int, const int *, GDALProgressFunc, void *, CSLConstList papszOptions)
Build raster overview(s)
Definition: gdaldataset.cpp:2122
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:800
static GDALDataset * FromHandle(GDALDatasetH hDS)
Convert a GDALDatasetH to a GDALDataset*.
Definition: gdal_priv.h:848
static GDALDatasetH ToHandle(GDALDataset *poDS)
Convert a GDALDataset* to a GDALDatasetH.
Definition: gdal_priv.h:840
GDALAccess GetAccess() const
Return access mode.
Definition: gdal_priv.h:778
Class modeling a a dimension / axis used to index multidimensional arrays.
Definition: gdal_priv.h:3654
const std::string & GetName() const
Return the name.
Definition: gdal_priv.h:3668
const std::string & GetDirection() const
Return the axis direction.
Definition: gdal_priv.h:3703
const std::string & GetFullName() const
Return the full name.
Definition: gdal_priv.h:3677
GUInt64 GetSize() const
Return the size, that is the number of values along the dimension.
Definition: gdal_priv.h:3712
const std::string & GetType() const
Return the axis type.
Definition: gdal_priv.h:3690
Class for managing the registration of file format drivers.
Definition: gdal_priv.h:2293
Format specific driver.
Definition: gdal_priv.h:1949
static GDALDriver * FromHandle(GDALDriverH hDriver)
Convert a GDALDriverH to a GDALDriver*.
Definition: gdal_priv.h:2173
static GDALDriverH ToHandle(GDALDriver *poDriver)
Convert a GDALDriver* to a GDALDriverH.
Definition: gdal_priv.h:2165
Class for a component of a compound extended data type.
Definition: gdal_priv.h:2677
const GDALExtendedDataType & GetType() const
Return the data type of the component.
Definition: gdal_priv.h:2708
size_t GetOffset() const
Return the offset (in bytes) of the component in the compound data type.
Definition: gdal_priv.h:2699
const std::string & GetName() const
Return the name.
Definition: gdal_priv.h:2690
GDALEDTComponent(const GDALEDTComponent &)
Copy constructor.
Class used to represent potentially complex data types.
Definition: gdal_priv.h:2541
bool operator!=(const GDALExtendedDataType &other) const
Non-equality operator.
Definition: gdal_priv.h:2561
GDALExtendedDataTypeSubType GetSubType() const
Return subtype.
Definition: gdal_priv.h:2600
size_t GetSize() const
Return data type size in bytes.
Definition: gdal_priv.h:2621
size_t GetMaxStringLength() const
Return the maximum length of a string in bytes.
Definition: gdal_priv.h:2630
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:2589
GDALExtendedDataTypeClass GetClass() const
Return type class.
Definition: gdal_priv.h:2579
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:2610
const std::string & GetName() const
Return type name.
Definition: gdal_priv.h:2570
Class modeling a named container of GDALAttribute, GDALMDArray, OGRLayer or other GDALGroup.
Definition: gdal_priv.h:2770
const std::string & GetName() const
Return the name of the group.
Definition: gdal_priv.h:2821
const std::string & GetFullName() const
Return the full name of the group.
Definition: gdal_priv.h:2830
Interface used to get a single GDALAttribute or a set of GDALAttribute.
Definition: gdal_priv.h:2729
Class modeling a multi-dimensional array.
Definition: gdal_priv.h:3284
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:3455
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:301
int bStatOK
Whether stat()'ing the file was successful.
Definition: gdal_priv.h:322
GByte * pabyHeader
Buffer with first bytes of the file.
Definition: gdal_priv.h:332
int bIsDirectory
Whether the file is a directory.
Definition: gdal_priv.h:324
char ** papszOpenOptions
Open options.
Definition: gdal_priv.h:314
GDALAccess eAccess
Access flag.
Definition: gdal_priv.h:317
int nOpenFlags
Open flags.
Definition: gdal_priv.h:319
VSILFILE * fpL
Pointer to the file.
Definition: gdal_priv.h:327
char * pszFilename
Filename.
Definition: gdal_priv.h:312
int nHeaderBytes
Number of bytes in pabyHeader.
Definition: gdal_priv.h:330
const char *const * papszAllowedDrivers
Allowed drivers (NULL for all)
Definition: gdal_priv.h:335
Proxy for a plugin driver.
Definition: gdal_priv.h:2226
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
GDALPluginDriverProxy(const std::string &osPluginFileName)
Constructor for a plugin driver proxy.
Definition: gdaldrivermanager.cpp:1233
const std::string & GetPluginFileName() const
Return the plugin file name (not a full path)
Definition: gdal_priv.h:2251
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:1468
void static GDALRasterBandH ToHandle(GDALRasterBand *poBand)
Convert a GDALRasterBand* to a GDALRasterBandH.
Definition: gdal_priv.h:1756
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.
virtual GDALMaskValueRange GetMaskValueRange() const
Returns the range of values that a mask band can take.
Definition: gdalrasterband.cpp:7654
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:1764
A single raster block in the block cache.
Definition: gdal_priv.h:1154
int GetDirty() const
Return the dirty flag.
Definition: gdal_priv.h:1251
GDALRasterBand * GetBand()
Accessor to source GDALRasterBand object.
Definition: gdal_priv.h:1278
int GetXSize() const
Return the width of the block.
Definition: gdal_priv.h:1235
GPtrDiff_t GetBlockSize() const
Return the block size in bytes.
Definition: gdal_priv.h:1267
int GetYSize() const
Return the height of the block.
Definition: gdal_priv.h:1243
GDALDataType GetDataType() const
Return the data type.
Definition: gdal_priv.h:1211
int GetXOff() const
Return the x offset of the top-left corner of the block.
Definition: gdal_priv.h:1219
int AddLock(void)
Increment the lock count.
Definition: gdal_priv.h:1193
void * GetDataRef(void)
Return the data buffer.
Definition: gdal_priv.h:1259
int GetYOff() const
Return the y offset of the top-left corner of the block.
Definition: gdal_priv.h:1227
int DropLock(void)
Decrement the lock count.
Definition: gdal_priv.h:1199
Store the raw result of an attribute value, which might contain dynamically allocated structures (lik...
Definition: gdal_priv.h:3105
size_t size() const
Return the size in bytes of the raw result.
Definition: gdal_priv.h:3141
const GByte * data() const
Return pointer to the start of data.
Definition: gdal_priv.h:3135
const GByte & operator[](size_t idx) const
Return byte at specified index.
Definition: gdal_priv.h:3129
Definition of a table relationship.
Definition: gdal_priv.h:3813
const std::string & GetName() const
Get the name of the relationship.
Definition: gdal_priv.h:3852
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:3947
void SetType(GDALRelationshipType eType)
Sets the type of the relationship.
Definition: gdal_priv.h:3999
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:3969
void SetMappingTableName(const std::string &osName)
Sets the name of the mapping table for many-to-many relationships.
Definition: gdal_priv.h:3892
static GDALRelationshipH ToHandle(GDALRelationship *poRelationship)
Convert a GDALRelationship* to a GDALRelationshipH.
Definition: gdal_priv.h:4116
const std::string & GetForwardPathLabel() const
Get the label of the forward path for the relationship.
Definition: gdal_priv.h:4019
const std::string & GetLeftTableName() const
Get the name of the left (or base/origin) table in the relationship.
Definition: gdal_priv.h:3867
const std::string & GetBackwardPathLabel() const
Get the label of the backward path for the relationship.
Definition: gdal_priv.h:4059
const std::string & GetRelatedTableType() const
Get the type string of the related table.
Definition: gdal_priv.h:4094
const std::string & GetMappingTableName() const
Get the name of the mapping table for many-to-many relationships.
Definition: gdal_priv.h:3883
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:3925
GDALRelationshipCardinality GetCardinality() const
Get the cardinality of the relationship.
Definition: gdal_priv.h:3858
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:3936
void SetForwardPathLabel(const std::string &osLabel)
Sets the label of the forward path for the relationship.
Definition: gdal_priv.h:4039
void SetBackwardPathLabel(const std::string &osLabel)
Sets the label of the backward path for the relationship.
Definition: gdal_priv.h:4079
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:3914
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:3981
static GDALRelationship * FromHandle(GDALRelationshipH hRelationship)
Convert a GDALRelationshipH to a GDALRelationship*.
Definition: gdal_priv.h:4123
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:3958
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:3841
GDALRelationshipType GetType() const
Get the type of the relationship.
Definition: gdal_priv.h:3990
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:3903
const std::string & GetRightTableName() const
Get the name of the right (or related/destination) table in the relationship.
Definition: gdal_priv.h:3874
void SetRelatedTableType(const std::string &osType)
Sets the type string of the related table.
Definition: gdal_priv.h:4109
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:360
double Line() const
Returns the "line" member.
Definition: gdal_priv.h:401
double & Pixel()
Returns a reference to the "pixel" member.
Definition: gdal_priv.h:395
double X() const
Returns the "X" member.
Definition: gdal_priv.h:413
double & X()
Returns a reference to the "X" member.
Definition: gdal_priv.h:419
double Pixel() const
Returns the "pixel" member.
Definition: gdal_priv.h:389
double & Z()
Returns a reference to the "Z" member.
Definition: gdal_priv.h:443
double Y() const
Returns the "Y" member.
Definition: gdal_priv.h:425
const GDAL_GCP * c_ptr() const
Casts as a C GDAL_GCP pointer.
Definition: gdal_priv.h:449
double & Y()
Returns a reference to the "Y" member.
Definition: gdal_priv.h:431
const char * Id() const
Returns the "id" member.
Definition: gdal_priv.h:373
const char * Info() const
Returns the "info" member.
Definition: gdal_priv.h:381
double Z() const
Returns the "Z" member.
Definition: gdal_priv.h:437
double & Line()
Returns a reference to the "line" member.
Definition: gdal_priv.h:407
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
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:1311
GDALRATTableType
RAT table type (thematic or athematic)
Definition: gdal.h:2030
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:2116
@ GRC_ONE_TO_MANY
One-to-many.
Definition: gdal.h:2120
GDALRIOResampleAlg
RasterIO() resampling method.
Definition: gdal.h:143
CPLErr GDALClose(GDALDatasetH)
Close GDAL dataset.
Definition: gdaldataset.cpp:4127
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:3577
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:2132
@ GRT_ASSOCIATION
Association relationship.
Definition: gdal.h:2136
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:1143
constexpr GDALSuggestedBlockAccessPattern GSBAP_UNKNOWN
Unknown, or no particular read order is suggested.
Definition: gdal_priv.h:1450
int GDALSuggestedBlockAccessPattern
Suggested/most efficient access pattern to blocks.
Definition: gdal_priv.h:1447
constexpr GDALSuggestedBlockAccessPattern GSBAP_RANDOM
Random access to blocks is efficient.
Definition: gdal_priv.h:1453
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:1439
@ GMVR_0_AND_1_ONLY
Definition: gdal_priv.h:1442
@ GMVR_0_AND_255_ONLY
Definition: gdal_priv.h:1443
constexpr GDALSuggestedBlockAccessPattern GSBAP_TOP_TO_BOTTOM
Reading by strips from top to bottom is the most efficient.
Definition: gdal_priv.h:1456
GDALIdentifyEnum
Enumeration used by GDALDriver::pfnIdentify().
Definition: gdal_priv.h:1923
@ GDAL_IDENTIFY_TRUE
Identify determined the file is recognized by the probed driver.
Definition: gdal_priv.h:1930
@ GDAL_IDENTIFY_FALSE
Identify determined the file is not recognized by the probed driver.
Definition: gdal_priv.h:1928
@ GDAL_IDENTIFY_UNKNOWN
Identify could not determine if the file is recognized or not by the probed driver.
Definition: gdal_priv.h:1926
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:1463
constexpr GDALSuggestedBlockAccessPattern GSBAP_BOTTOM_TO_TOP
Reading by strips from bottom to top is the most efficient.
Definition: gdal_priv.h:1459
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
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:426
OGRLayer::FeatureIterator end(OGRLayer *poLayer)
Return end of feature iterator.
Definition: ogrsf_frmts.h:434
Document node structure.
Definition: cpl_minixml.h:71
Color tuple.
Definition: gdal.h:1957
Object returned by GetFeatures() iterators.
Definition: gdal_priv.h:869
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