32 #ifndef GDAL_PRIV_H_INCLUDED 33 #define GDAL_PRIV_H_INCLUDED 50 class GDALProxyDataset;
51 class GDALProxyRasterBand;
61 #include "gdal_frmts.h" 66 #include "cpl_multiproc.h" 67 #include "cpl_atomic_ops.h" 80 #define GMO_VALID 0x0001 81 #define GMO_IGNORE_UNIMPLEMENTED 0x0002 82 #define GMO_SUPPORT_MD 0x0004 83 #define GMO_SUPPORT_MDMD 0x0008 84 #define GMO_MD_DIRTY 0x0010 85 #define GMO_PAM_CLASS 0x0020 93 class CPL_DLL GDALMultiDomainMetadata
96 char **papszDomainList;
100 GDALMultiDomainMetadata();
101 ~GDALMultiDomainMetadata();
103 int XMLInit(
CPLXMLNode *psMetadata,
int bMerge );
106 char **GetDomainList() {
return papszDomainList; }
108 char **GetMetadata(
const char * pszDomain =
"" );
109 CPLErr SetMetadata(
char ** papszMetadata,
110 const char * pszDomain =
"" );
111 const char *GetMetadataItem(
const char * pszName,
112 const char * pszDomain =
"" );
113 CPLErr SetMetadataItem(
const char * pszName,
114 const char * pszValue,
115 const char * pszDomain =
"" );
138 GDALMultiDomainMetadata oMDMD{};
142 char **BuildMetadataDomainList(
char** papszList,
148 int GetMOFlags()
const;
149 void SetMOFlags(
int nFlagsIn );
151 virtual const char *GetDescription()
const;
152 virtual void SetDescription(
const char * );
154 virtual char **GetMetadataDomainList();
156 virtual char **GetMetadata(
const char * pszDomain =
"" );
157 virtual CPLErr SetMetadata(
char ** papszMetadata,
158 const char * pszDomain =
"" );
159 virtual const char *GetMetadataItem(
const char * pszName,
160 const char * pszDomain =
"" );
161 virtual CPLErr SetMetadataItem(
const char * pszName,
162 const char * pszValue,
163 const char * pszDomain =
"" );
183 class CPL_DLL GDALDefaultOverviews
194 bool bCheckedForMask;
203 bool bCheckedForOverviews;
207 char **papszInitSiblingFiles;
210 GDALDefaultOverviews();
211 ~GDALDefaultOverviews();
213 void Initialize(
GDALDataset *poDSIn,
const char *pszName =
nullptr,
214 char **papszSiblingFiles =
nullptr,
215 int bNameIsOVR = FALSE );
217 void TransferSiblingFiles(
char** papszSiblingFiles );
225 int GetOverviewCount(
int nBand );
229 const char * pszResampling,
230 int nOverviews,
int * panOverviewList,
231 int nBands,
int * panBandList,
232 GDALProgressFunc pfnProgress,
233 void *pProgressData );
235 CPLErr BuildOverviewsSubDataset(
const char * pszPhysicalFile,
236 const char * pszResampling,
237 int nOverviews,
int * panOverviewList,
238 int nBands,
int * panBandList,
239 GDALProgressFunc pfnProgress,
240 void *pProgressData );
248 int GetMaskFlags(
int nBand );
250 int HaveMaskFile(
char **papszSiblings =
nullptr,
251 const char *pszBasename =
nullptr );
253 char** GetSiblingFiles() {
return papszInitSiblingFiles; }
267 bool bHasGotSiblingFiles;
268 char **papszSiblingFiles;
269 int nHeaderBytesTried;
273 const char *
const * papszSiblingFiles =
nullptr );
302 int TryToIngest(
int nBytes);
303 char **GetSiblingFiles();
304 char **StealSiblingFiles();
305 bool AreSiblingFilesLoaded()
const;
320 class swq_select_parse_options;
323 typedef struct GDALSQLParseInfo GDALSQLParseInfo;
327 #ifdef GDAL_COMPILATION 328 #define OPTIONAL_OUTSIDE_GDAL(val) 330 #define OPTIONAL_OUTSIDE_GDAL(val) = val 338 unsigned int nOpenFlags,
339 const char*
const* papszAllowedDrivers,
340 const char*
const* papszOpenOptions,
341 const char*
const* papszSiblingFiles );
345 friend class GDALDefaultOverviews;
346 friend class GDALProxyDataset;
349 void AddToDatasetOpenList();
357 int nRasterXSize = 512;
358 int nRasterYSize = 512;
365 bool bForceCachedIO =
false;
366 bool bShared =
false;
367 bool bIsInternal =
true;
368 bool bSuppressOnClose =
false;
373 void RasterInitialize(
int,
int );
376 GDALDefaultOverviews oOvManager{};
378 virtual CPLErr IBuildOverviews(
const char *,
int,
int *,
379 int,
int *, GDALProgressFunc,
void * );
390 void BlockBasedFlushCache();
393 int nXOff,
int nYOff,
int nXSize,
int nYSize,
394 void * pData,
int nBufXSize,
int nBufYSize,
396 int nBandCount,
int *panBandMap,
402 int nXOff,
int nYOff,
int nXSize,
int nYSize,
403 void * pData,
int nBufXSize,
int nBufYSize,
405 int nBandCount,
int *panBandMap,
410 CPLErr ValidateRasterIOOrAdviseReadParameters(
411 const char* pszCallingFunc,
412 int* pbStopProcessingOnCENone,
413 int nXOff,
int nYOff,
int nXSize,
int nYSize,
414 int nBufXSize,
int nBufYSize,
415 int nBandCount,
int *panBandMap);
418 int nXOff,
int nYOff,
int nXSize,
int nYSize,
419 void * pData,
int nBufXSize,
int nBufYSize,
421 int nBandCount,
int *panBandMap,
428 virtual int CloseDependentDatasets();
430 int ValidateLayerCreationOptions(
const char*
const* papszLCO );
432 char **papszOpenOptions =
nullptr;
439 void LeaveReadWrite();
442 void TemporarilyDropReadWriteLock();
443 void ReacquireReadWriteLock();
445 void DisableReadWriteMutex();
454 int GetRasterXSize();
455 int GetRasterYSize();
456 int GetRasterCount();
468 class CPL_DLL Iterator
471 std::unique_ptr<Private> m_poPrivate;
474 Iterator(
const Iterator& oOther);
475 Iterator(Iterator&& oOther) noexcept;
478 Iterator& operator++();
479 bool operator!=(
const Iterator& it)
const;
484 const Iterator
begin()
const;
486 const Iterator
end()
const;
496 virtual void FlushCache(
void);
498 virtual const char *GetProjectionRef(
void);
499 virtual CPLErr SetProjection(
const char * pszProjection );
501 virtual CPLErr GetGeoTransform(
double * padfTransform );
502 virtual CPLErr SetGeoTransform(
double * padfTransform );
505 char **papszOptions=
nullptr );
507 virtual void *GetInternalHandle(
const char * pszHandleName );
509 virtual char **GetFileList(
void);
511 virtual const char* GetDriverName();
513 virtual int GetGCPCount();
514 virtual const char *GetGCPProjection();
516 virtual CPLErr SetGCPs(
int nGCPCount,
const GDAL_GCP *pasGCPList,
517 const char *pszGCPProjection );
519 virtual CPLErr AdviseRead(
int nXOff,
int nYOff,
int nXSize,
int nYSize,
520 int nBufXSize,
int nBufYSize,
522 int nBandCount,
int *panBandList,
523 char **papszOptions );
525 virtual CPLErr CreateMaskBand(
int nFlagsIn );
528 BeginAsyncReader(
int nXOff,
int nYOff,
int nXSize,
int nYSize,
529 void *pBuf,
int nBufXSize,
int nBufYSize,
531 int nBandCount,
int* panBandMap,
532 int nPixelSpace,
int nLineSpace,
int nBandSpace,
533 char **papszOptions);
541 OPTIONAL_OUTSIDE_GDAL(
nullptr)
554 int GetShared()
const;
565 static GDALDataset **GetOpenDatasets(
int *pnDatasetCount );
567 CPLErr BuildOverviews(
const char *,
int,
int *,
568 int,
int *, GDALProgressFunc,
void * );
572 char ** GetMetadata(
const char * pszDomain =
"")
override;
576 CPLErr SetMetadata(
char ** papszMetadata,
577 const char * pszDomain )
override;
578 const char *GetMetadataItem(
const char * pszName,
579 const char * pszDomain )
override;
580 CPLErr SetMetadataItem(
const char * pszName,
581 const char * pszValue,
582 const char * pszDomain )
override;
585 char **GetMetadataDomainList()
override;
603 unsigned int nOpenFlags = 0,
604 const char*
const* papszAllowedDrivers =
nullptr,
605 const char*
const* papszOpenOptions =
nullptr,
606 const char*
const* papszSiblingFiles =
nullptr )
608 return FromHandle(
GDALOpenEx(pszFilename, nOpenFlags,
626 Private *m_poPrivate;
628 OGRLayer* BuildLayerFromSelectInfo(swq_select* psSelectInfo,
630 const char *pszDialect,
631 swq_select_parse_options* poSelectParseOptions);
636 virtual int GetLayerCount();
637 virtual OGRLayer *GetLayer(
int iLayer);
658 std::unique_ptr<Private> m_poPrivate;
679 bool operator!=(
const Iterator& it)
const;
688 OGRLayer* operator[](
size_t iLayer);
689 OGRLayer* operator[](
const char* pszLayername);
694 virtual OGRLayer *GetLayerByName(
const char *);
695 virtual OGRErr DeleteLayer(
int iLayer);
697 virtual void ResetReading();
699 double* pdfProgressPct,
700 GDALProgressFunc pfnProgress,
701 void* pProgressData );
713 class CPL_DLL Iterator
716 std::unique_ptr<Private> m_poPrivate;
719 Iterator(
const Iterator& oOther);
720 Iterator(Iterator&& oOther) noexcept;
723 Iterator& operator++();
724 bool operator!=(
const Iterator& it)
const;
729 const Iterator
begin()
const;
731 const Iterator
end()
const;
736 virtual int TestCapability(
const char * );
738 virtual OGRLayer *CreateLayer(
const char *pszName,
741 char ** papszOptions =
nullptr );
743 const char *pszNewName,
744 char **papszOptions =
nullptr );
747 virtual void SetStyleTableDirectly(
OGRStyleTable *poStyleTable );
751 virtual OGRLayer * ExecuteSQL(
const char *pszStatement,
753 const char *pszDialect );
754 virtual void ReleaseResultSet(
OGRLayer * poResultsSet );
756 int GetRefCount()
const;
757 int GetSummaryRefCount()
const;
760 virtual OGRErr StartTransaction(
int bForce=FALSE);
761 virtual OGRErr CommitTransaction();
762 virtual OGRErr RollbackTransaction();
765 static int IsGenericSQLDialect(
const char* pszDialect);
768 GDALSQLParseInfo* BuildParseInfo(swq_select* psSelectInfo,
769 swq_select_parse_options* poSelectParseOptions);
770 static void DestroyParseInfo(GDALSQLParseInfo* psParseInfo );
771 OGRLayer * ExecuteSQL(
const char *pszStatement,
773 const char *pszDialect,
774 swq_select_parse_options* poSelectParseOptions);
778 virtual OGRLayer *ICreateLayer(
const char *pszName,
781 char ** papszOptions =
nullptr );
784 OGRErr ProcessSQLCreateIndex(
const char * );
785 OGRErr ProcessSQLDropIndex(
const char * );
786 OGRErr ProcessSQLDropTable(
const char * );
787 OGRErr ProcessSQLAlterTableAddColumn(
const char * );
788 OGRErr ProcessSQLAlterTableDropColumn(
const char * );
789 OGRErr ProcessSQLAlterTableAlterColumn(
const char * );
790 OGRErr ProcessSQLAlterTableRenameColumn(
const char * );
800 struct CPL_DLL GDALDatasetUniquePtrDeleter
824 friend class GDALAbstractBandBlockCache;
829 volatile int nLockCount;
846 void Detach_unlocked(
void );
847 void Touch_unlocked(
void );
849 void RecycleFor(
int nXOffIn,
int nYOffIn );
856 CPLErr Internalize(
void );
858 void MarkDirty(
void );
859 void MarkClean(
void );
861 int AddLock(
void ) {
return CPLAtomicInc(&nLockCount); }
863 int DropLock(
void ) {
return CPLAtomicDec(&nLockCount); }
903 int DropLockForRemovalFromStorage();
909 static void FlushDirtyBlocks();
910 static int FlushCacheBlock(
int bDirtyBlocksOnly = FALSE);
911 static void Verify();
913 static void EnterDisableDirtyBlockFlush();
914 static void LeaveDisableDirtyBlockFlush();
919 static void DumpAll();
924 static void DestroyRBMutex();
941 std::vector<GDALColorEntry> aoEntries{};
952 int GetColorEntryCount()
const;
983 class CPL_DLL GDALAbstractBandBlockCache
986 CPLLock *hSpinLock =
nullptr;
990 CPLCond *hCond =
nullptr;
991 CPLMutex *hCondMutex =
nullptr;
992 volatile int nKeepAliveCounter = 0;
999 void FreeDanglingBlocks();
1000 void UnreferenceBlockBase();
1001 void WaitKeepAliveCounter();
1005 virtual ~GDALAbstractBandBlockCache();
1010 virtual bool Init() = 0;
1011 virtual bool IsInitOK() = 0;
1012 virtual CPLErr FlushCache() = 0;
1015 int nYBlockYOff ) = 0;
1017 virtual CPLErr FlushBlock(
int nXBlockOff,
int nYBlockOff,
1018 int bWriteDirtyBlock ) = 0;
1021 GDALAbstractBandBlockCache* GDALArrayBandBlockCacheCreate(
GDALRasterBand* poBand);
1022 GDALAbstractBandBlockCache* GDALHashSetBandBlockCacheCreate(
GDALRasterBand* poBand);
1035 friend class GDALArrayBandBlockCache;
1036 friend class GDALHashSetBandBlockCache;
1039 CPLErr eFlushBlockErr = CE_None;
1040 GDALAbstractBandBlockCache* poBandBlockCache =
nullptr;
1042 void SetFlushBlockErr(
CPLErr eErr );
1051 int nRasterXSize = 0;
1052 int nRasterYSize = 0;
1058 int nBlockXSize = -1;
1059 int nBlockYSize = -1;
1060 int nBlocksPerRow = 0;
1061 int nBlocksPerColumn = 0;
1063 int nBlockReads = 0;
1064 int bForceCachedIO = 0;
1067 bool bOwnMask =
false;
1070 void InvalidateMaskBand();
1073 friend class GDALProxyRasterBand;
1074 friend class GDALDefaultOverviews;
1081 void LeaveReadWrite();
1086 virtual CPLErr IReadBlock(
int nBlockXOff,
int nBlockYOff,
void * pData ) = 0;
1087 virtual CPLErr IWriteBlock(
int nBlockXOff,
int nBlockYOff,
void * pData );
1093 virtual int IGetDataCoverageStatus(
int nXOff,
int nYOff,
1094 int nXSize,
int nYSize,
1096 double* pdfDataPct);
1103 int nXOff,
int nYOff,
int nXSize,
int nYSize,
1104 void * pData,
int nBufXSize,
int nBufYSize,
1110 int InitBlockInfo();
1115 GDALRasterBlock *TryGetLockedBlockRef(
int nXBlockOff,
int nYBlockYOff );
1129 void GetBlockSize(
int *,
int * );
1130 CPLErr GetActualBlockSize (
int,
int,
int *,
int * );
1136 #ifndef DOXYGEN_SKIP
1137 OPTIONAL_OUTSIDE_GDAL(
nullptr)
1146 CPLErr FlushBlock(
int,
int,
int bWriteDirtyBlock = TRUE );
1148 unsigned char* GetIndexColorTranslationTo(
GDALRasterBand* poReferenceBand,
1149 unsigned char* pTranslationTable =
nullptr,
1150 int* pApproximateMatching =
nullptr);
1154 virtual CPLErr FlushCache();
1155 virtual char **GetCategoryNames();
1156 virtual double GetNoDataValue(
int *pbSuccess =
nullptr );
1157 virtual double GetMinimum(
int *pbSuccess =
nullptr );
1158 virtual double GetMaximum(
int *pbSuccess =
nullptr );
1159 virtual double GetOffset(
int *pbSuccess =
nullptr );
1160 virtual double GetScale(
int *pbSuccess =
nullptr );
1161 virtual const char *GetUnitType();
1164 virtual CPLErr Fill(
double dfRealValue,
double dfImaginaryValue = 0);
1166 virtual CPLErr SetCategoryNames(
char ** papszNames );
1167 virtual CPLErr SetNoDataValue(
double dfNoData );
1168 virtual CPLErr DeleteNoDataValue();
1171 virtual CPLErr SetOffset(
double dfNewOffset );
1172 virtual CPLErr SetScale(
double dfNewScale );
1173 virtual CPLErr SetUnitType(
const char * pszNewValue );
1175 virtual CPLErr GetStatistics(
int bApproxOK,
int bForce,
1176 double *pdfMin,
double *pdfMax,
1177 double *pdfMean,
double *padfStdDev );
1178 virtual CPLErr ComputeStatistics(
int bApproxOK,
1179 double *pdfMin,
double *pdfMax,
1180 double *pdfMean,
double *pdfStdDev,
1181 GDALProgressFunc,
void *pProgressData );
1182 virtual CPLErr SetStatistics(
double dfMin,
double dfMax,
1183 double dfMean,
double dfStdDev );
1184 virtual CPLErr ComputeRasterMinMax(
int,
double* );
1188 char **GetMetadata(
const char * pszDomain =
"" )
override;
1189 CPLErr SetMetadata(
char ** papszMetadata,
1190 const char * pszDomain )
override;
1191 const char *GetMetadataItem(
const char * pszName,
1192 const char * pszDomain )
override;
1193 CPLErr SetMetadataItem(
const char * pszName,
1194 const char * pszValue,
1195 const char * pszDomain )
override;
1198 virtual int HasArbitraryOverviews();
1199 virtual int GetOverviewCount();
1202 virtual CPLErr BuildOverviews(
const char * pszResampling,
1204 int * panOverviewList,
1205 GDALProgressFunc pfnProgress,
1206 void * pProgressData );
1208 virtual CPLErr AdviseRead(
int nXOff,
int nYOff,
int nXSize,
int nYSize,
1209 int nBufXSize,
int nBufYSize,
1212 virtual CPLErr GetHistogram(
double dfMin,
double dfMax,
1213 int nBuckets,
GUIntBig * panHistogram,
1214 int bIncludeOutOfRange,
int bApproxOK,
1215 GDALProgressFunc,
void *pProgressData );
1217 virtual CPLErr GetDefaultHistogram(
double *pdfMin,
double *pdfMax,
1218 int *pnBuckets,
GUIntBig ** ppanHistogram,
1220 GDALProgressFunc,
void *pProgressData);
1221 virtual CPLErr SetDefaultHistogram(
double dfMin,
double dfMax,
1222 int nBuckets,
GUIntBig *panHistogram );
1228 virtual int GetMaskFlags();
1229 virtual CPLErr CreateMaskBand(
int nFlagsIn );
1236 int GetDataCoverageStatus(
int nXOff,
int nYOff,
1237 int nXSize,
int nYSize,
1238 int nMaskFlagStop = 0,
1239 double* pdfDataPct =
nullptr );
1267 CPLErr IReadBlock(
int,
int,
void * )
override;
1273 ~GDALAllValidMaskBand()
override;
1276 int GetMaskFlags()
override;
1278 CPLErr ComputeStatistics(
int bApproxOK,
1279 double *pdfMin,
double *pdfMax,
1280 double *pdfMean,
double *pdfStdDev,
1281 GDALProgressFunc,
void *pProgressData )
override;
1291 double dfNoDataValue;
1297 CPLErr IReadBlock(
int,
int,
void * )
override;
1304 ~GDALNoDataMaskBand()
override;
1306 static bool IsNoDataInRange(
double dfNoDataValue,
1316 double *padfNodataValues;
1321 CPLErr IReadBlock(
int,
int,
void * )
override;
1324 explicit GDALNoDataValuesMaskBand(
GDALDataset * );
1325 ~GDALNoDataValuesMaskBand()
override;
1340 CPLErr IReadBlock(
int,
int,
void * )
override;
1348 ~GDALRescaledAlphaBand()
override;
1392 CPLErr SetMetadataItem(
const char * pszName,
1393 const char * pszValue,
1394 const char * pszDomain =
"" )
override;
1400 int nXSize,
int nYSize,
int nBands,
1403 CPLErr Delete(
const char * pszName );
1404 CPLErr Rename(
const char * pszNewName,
1405 const char * pszOldName );
1406 CPLErr CopyFiles(
const char * pszNewName,
1407 const char * pszOldName );
1411 GDALProgressFunc pfnProgress,
1423 int nXSize,
int nYSize,
int nBands,
1425 char ** papszOptions );
1427 CPLErr (*pfnDelete)(
const char * pszName );
1431 GDALProgressFunc pfnProgress,
1432 void * pProgressData );
1447 CPLErr (*pfnRename)(
const char * pszNewName,
1448 const char * pszOldName );
1449 CPLErr (*pfnCopyFiles)(
const char * pszNewName,
1450 const char * pszOldName );
1454 GDALDataset *(*pfnCreateVectorOnly)( GDALDriver*,
1455 const char * pszName,
1456 char ** papszOptions );
1457 CPLErr (*pfnDeleteDataSource)( GDALDriver*,
1458 const char * pszName );
1465 GDALDataset *DefaultCreateCopy(
const char *, GDALDataset *,
1467 GDALProgressFunc pfnProgress,
1469 static CPLErr DefaultCopyMasks( GDALDataset *poSrcDS,
1470 GDALDataset *poDstDS,
1472 static CPLErr DefaultCopyMasks( GDALDataset *poSrcDS,
1473 GDALDataset *poDstDS,
1476 GDALProgressFunc pfnProgress,
1477 void * pProgressData );
1479 static CPLErr QuietDelete(
const char * pszName );
1482 static CPLErr DefaultRename(
const char * pszNewName,
1483 const char * pszOldName );
1484 static CPLErr DefaultCopyFiles(
const char * pszNewName,
1485 const char * pszOldName );
1498 {
return static_cast<GDALDriver*
>(hDriver); }
1519 std::map<CPLString, GDALDriver*> oMapNameToDrivers{};
1521 GDALDriver *GetDriver_unlocked(
int iDriver )
1522 {
return (iDriver >= 0 && iDriver < nDrivers) ?
1523 papoDrivers[iDriver] :
nullptr; }
1525 GDALDriver *GetDriverByName_unlocked(
const char * pszName )
1534 int GetDriverCount(
void )
const;
1542 static void AutoLoadDrivers();
1543 void AutoSkipDrivers();
1644 GetNextUpdatedRegion(
double dfTimeout,
1645 int* pnBufXOff,
int* pnBufYOff,
1646 int* pnBufXSize,
int* pnBufYSize) = 0;
1647 virtual int LockBuffer(
double dfTimeout = -1.0 );
1648 virtual void UnlockBuffer();
1658 GDALRegenerateOverviewsMultiBand(
int nBands,
GDALRasterBand** papoSrcBands,
1661 const char * pszResampling,
1662 GDALProgressFunc pfnProgress,
void * pProgressData );
1664 typedef CPLErr (*GDALResampleFunction)
1665 (
double dfXRatioDstToSrc,
1666 double dfYRatioDstToSrc,
1671 GByte * pabyChunkNodataMask,
1672 int nChunkXOff,
int nChunkXSize,
1673 int nChunkYOff,
int nChunkYSize,
1674 int nDstXOff,
int nDstXOff2,
1675 int nDstYOff,
int nDstYOff2,
1677 const char * pszResampling,
1678 int bHasNoData,
float fNoDataValue,
1681 bool bPropagateNoData );
1683 GDALResampleFunction GDALGetResampleFunction(
const char* pszResampling,
1686 #ifdef GDAL_ENABLE_RESAMPLING_MULTIBAND 1687 typedef CPLErr (*GDALResampleFunctionMultiBands)
1688 (
double dfXRatioDstToSrc,
1689 double dfYRatioDstToSrc,
1693 void * pChunk,
int nBands,
1694 GByte * pabyChunkNodataMask,
1695 int nChunkXOff,
int nChunkXSize,
1696 int nChunkYOff,
int nChunkYSize,
1697 int nDstXOff,
int nDstXOff2,
1698 int nDstYOff,
int nDstYOff2,
1700 const char * pszResampling,
1701 int bHasNoData,
float fNoDataValue,
1705 GDALResampleFunctionMultiBands GDALGetResampleFunctionMultiBands(
const char* pszResampling,
1709 GDALDataType GDALGetOvrWorkDataType(
const char* pszResampling,
1715 HFAAuxBuildOverviews(
const char *pszOvrFilename,
GDALDataset *poParentDS,
1717 int nBands,
int *panBandList,
1718 int nNewOverviews,
int *panNewOverviewList,
1719 const char *pszResampling,
1720 GDALProgressFunc pfnProgress,
1721 void *pProgressData );
1724 GTIFFBuildOverviews(
const char * pszFilename,
1726 int nOverviews,
int * panOverviewList,
1727 const char * pszResampling,
1728 GDALProgressFunc pfnProgress,
void * pProgressData );
1731 GDALDefaultBuildOverviews(
GDALDataset *hSrcDS,
const char * pszBasename,
1732 const char * pszResampling,
1733 int nOverviews,
int * panOverviewList,
1734 int nBands,
int * panBandList,
1735 GDALProgressFunc pfnProgress,
void * pProgressData);
1738 int &nXOff,
int &nYOff,
1739 int &nXSize,
int &nYSize,
1740 int nBufXSize,
int nBufYSize) CPL_WARN_DEPRECATED(
"Use GDALBandGetBestOverviewLevel2 instead");
1741 int CPL_DLL GDALBandGetBestOverviewLevel2(
GDALRasterBand* poBand,
1742 int &nXOff,
int &nYOff,
1743 int &nXSize,
int &nYSize,
1744 int nBufXSize,
int nBufYSize,
1747 int CPL_DLL GDALOvLevelAdjust(
int nOvLevel,
int nXSize ) CPL_WARN_DEPRECATED(
"Use GDALOvLevelAdjust2 instead");
1748 int CPL_DLL GDALOvLevelAdjust2(
int nOvLevel,
int nXSize,
int nYSize );
1749 int CPL_DLL GDALComputeOvFactor(
int nOvrXSize,
int nRasterXSize,
1750 int nOvrYSize,
int nRasterYSize );
1753 GDALFindAssociatedAuxFile(
const char *pszBasefile,
GDALAccess eAccess,
1760 int CPL_DLL GDALCheckDatasetDimensions(
int nXSize,
int nYSize );
1761 int CPL_DLL GDALCheckBandCount(
int nBands,
int bIsZeroAllowed );
1766 int CPL_DLL GDALReadWorldFile2(
const char *pszBaseFilename,
const char *pszExtension,
1767 double *padfGeoTransform,
char** papszSiblingFiles,
1768 char** ppszWorldFileNameOut);
1769 int GDALReadTabFile2(
const char * pszBaseFilename,
1770 double *padfGeoTransform,
char **ppszWKT,
1771 int *pnGCPCount,
GDAL_GCP **ppasGCPs,
1772 char** papszSiblingFiles,
char** ppszTabFileNameOut );
1779 void GDALNullifyOpenDatasetsList();
1780 CPLMutex** GDALGetphDMMutex();
1781 CPLMutex** GDALGetphDLMutex();
1782 void GDALNullifyProxyPoolSingleton();
1784 void GDALSetResponsiblePIDForCurrentThread(
GIntBig responsiblePID);
1785 GIntBig GDALGetResponsiblePIDForCurrentThread();
1787 CPLString GDALFindAssociatedFile(
const char *pszBasename,
const char *pszExt,
1790 CPLErr EXIFExtractMetadata(
char**& papszMetadata,
1791 void *fpL,
int nOffset,
1792 int bSwabflag,
int nTIFFHEADER,
1793 int& nExifOffset,
int& nInterOffset,
int& nGPSOffset);
1796 const char*
const* papszOptionOptions);
1797 int GDALValidateOptions(
const char* pszOptionList,
1798 const char*
const* papszOptionsToValidate,
1799 const char* pszErrorMessageOptionType,
1800 const char* pszErrorMessageContainerName);
1806 int nXSize,
int nYSize,
1807 int nBufXSize,
int nBufYSize);
1811 int bThisLevelOnly);
1816 template<
class T>
inline bool ARE_REAL_EQUAL(T fVal1, T fVal2,
int ulp = 2)
1818 return fVal1 == fVal2 ||
1819 std::abs(fVal1 - fVal2) < std::numeric_limits<float>::epsilon() * std::abs(fVal1+fVal2) * ulp;
1822 double GDALAdjustNoDataCloseToFloatMax(
double dfVal);
1824 #define DIV_ROUND_UP(a, b) ( ((a) % (b)) == 0 ? ((a) / (b)) : (((a) / (b)) + 1) ) 1828 #define GDALSTAT_APPROX_NUMSAMPLES 2500 1833 void GDALSerializeGCPListToXML(
CPLXMLNode* psParentNode,
1836 const char* pszGCPProjection );
1837 void GDALDeserializeGCPListFromXML(
CPLXMLNode* psGCPList,
1840 char** ppszGCPProjection );
1843 void GDALSerializeOpenOptionsToXML(
CPLXMLNode* psParentNode,
char** papszOpenOptions);
1844 char** GDALDeserializeOpenOptionsFromXML(
CPLXMLNode* psParentNode );
1846 int GDALCanFileAcceptSidecarFile(
const char* pszFilename);
The GDALRasterAttributeTable (or RAT) class is used to encapsulate a table used to provide attribute ...
Definition: gdal_rat.h:47
Layer iterator.
Definition: gdal_priv.h:655
GDALDatasetH GDALOpenEx(const char *pszFilename, unsigned int nOpenFlags, const char *const *papszAllowedDrivers, const char *const *papszOpenOptions, const char *const *papszSiblingFiles) CPL_WARN_UNUSED_RESULT
Open a raster or vector file as a GDALDataset.
Definition: gdaldataset.cpp:2649
int GetBlockSize() const
Return the block size in bytes.
Definition: gdal_priv.h:899
std::unique_ptr< OGRFeature, OGRFeatureUniquePtrDeleter > OGRFeatureUniquePtr
Unique pointer type for OGRFeature.
Definition: ogr_feature.h:780
int GetYSize() const
Return height.
Definition: gdal_priv.h:1605
GDALDataType
Definition: gdal.h:60
Identify could not determine if the file is recognized or not by the probed driver.
Definition: gdal_priv.h:1364
std::unique_ptr< GDALDataset, GDALDatasetUniquePtrDeleter > GDALDatasetUniquePtr
Unique pointer type for GDALDataset.
Definition: gdal_priv.h:812
Document node structure.
Definition: cpl_minixml.h:66
Definitions for CPL mini XML Parser/Serializer.
void static GDALRasterBandH ToHandle(GDALRasterBand *poBand)
Convert a GDALRasterBand* to a GDALRasterBandH.
Definition: gdal_priv.h:1246
GDALDataset * GetGDALDataset()
Return dataset.
Definition: gdal_priv.h:1589
int GetBandCount() const
Return band count.
Definition: gdal_priv.h:1625
#define CPL_C_START
Macro to start a block of C symbols.
Definition: cpl_port.h:337
Object returned by GetFeatures() iterators.
Definition: gdal_priv.h:615
const char *const * papszAllowedDrivers
Allowed drivers (NULL for all)
Definition: gdal_priv.h:300
int GetXOffset() const
Return x offset.
Definition: gdal_priv.h:1593
int * GetBandMap()
Return band map.
Definition: gdal_priv.h:1629
int DropLock(void)
Decrement the lock count.
Definition: gdal_priv.h:863
FILE VSILFILE
Opaque type for a FILE that implements the VSIVirtualHandle API.
Definition: cpl_vsi.h:156
char ** GetOpenOptions()
Return open options.
Definition: gdal_priv.h:563
void pointer
pointer
Definition: gdal_priv.h:664
GByte * pabyHeader
Buffer with first bytes of the file.
Definition: gdal_priv.h:297
int GetLineSpace() const
Return line spacing.
Definition: gdal_priv.h:1637
GDALAccess eAccess
Access flag.
Definition: gdal_priv.h:282
GDALDataType GetDataType() const
Return the data type.
Definition: gdal_priv.h:871
GDALRIOResampleAlg
RasterIO() resampling method.
Definition: gdal.h:128
VSILFILE * fpL
Pointer to the file.
Definition: gdal_priv.h:292
int GetBufferYSize() const
Return buffer height.
Definition: gdal_priv.h:1617
static GDALRasterBand * FromHandle(GDALRasterBandH hBand)
Convert a GDALRasterBandH to a GDALRasterBand*.
Definition: gdal_priv.h:1252
int GetBandSpace() const
Return band spacing.
Definition: gdal_priv.h:1641
GDALRWFlag
Definition: gdal.h:119
void * GDALDatasetH
Opaque type used for the C bindings of the C++ GDALDataset class.
Definition: gdal.h:255
unsigned char GByte
Unsigned byte type.
Definition: cpl_port.h:215
char * pszFilename
Filename.
Definition: gdal_priv.h:277
Color tuple.
Definition: gdal.h:1044
int nOpenFlags
Open flags.
Definition: gdal_priv.h:284
A single raster block in the block cache.
Definition: gdal_priv.h:822
void * GDALRasterBandH
Opaque type used for the C bindings of the C++ GDALRasterBand class.
Definition: gdal.h:258
int AddLock(void)
Increment the lock count.
Definition: gdal_priv.h:861
Convenient string class based on std::string.
Definition: cpl_string.h:329
#define CPL_PRINT_FUNC_FORMAT(format_idx, arg_idx)
Tag a function to have printf() formatting.
Definition: cpl_port.h:906
unknown type, non-standard
Definition: ogr_core.h:319
struct CPLVirtualMem CPLVirtualMem
Opaque type that represents a virtual memory mapping.
Definition: cpl_virtualmem.h:62
CPLErr BuildOverviews(const char *, int, int *, int, int *, GDALProgressFunc, void *)
Build raster overview(s)
Definition: gdaldataset.cpp:1458
Various convenience functions for working with strings and string lists.
GIntBig GSpacing
Type to express pixel, line or band spacing.
Definition: gdal.h:273
int bIsDirectory
Whether the file is a directory.
Definition: gdal_priv.h:289
static GDALColorTableH ToHandle(GDALColorTable *poCT)
Convert a GDALColorTable* to a GDALRasterBandH.
Definition: gdal_priv.h:962
int GetDirty() const
Return the dirty flag.
Definition: gdal_priv.h:891
int GetXOff() const
Return the x offset of the top-left corner of the block.
Definition: gdal_priv.h:875
OGRwkbGeometryType
List of well known binary geometry types.
Definition: ogr_core.h:317
static GDALDriverH ToHandle(GDALDriver *poDriver)
Convert a GDALDriver* to a GDALDriverH.
Definition: gdal_priv.h:1491
Public (C callable) GDAL entry points.
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:602
GDALAsyncStatusType
status of the asynchronous stream
Definition: gdal.h:100
int GetPixelSpace() const
Return pixel spacing.
Definition: gdal_priv.h:1633
Abstract base class for all geometry classes.
Definition: ogr_geometry.h:286
char ** CSLConstList
Type of a constant null-terminated list of nul terminated strings.
Definition: cpl_port.h:1186
void * GetBuffer()
Return buffer.
Definition: gdal_priv.h:1609
GDALRasterBand * GetBand()
Accessor to source GDALRasterBand object.
Definition: gdal_priv.h:907
Class for dataset open functions.
Definition: gdal_priv.h:265
GDALAccess GetAccess() const
Return access mode.
Definition: gdal_priv.h:552
void MarkSuppressOnClose()
Set that the dataset must be deleted on close.
Definition: gdal_priv.h:558
String list class designed around our use of C "char**" string lists.
Definition: cpl_string.h:438
static GDALDriver * FromHandle(GDALDriverH hDriver)
Convert a GDALDriverH to a GDALDriver*.
Definition: gdal_priv.h:1497
Identify determined the file is recognized by the probed driver.
Definition: gdal_priv.h:1368
static GDALMajorObjectH ToHandle(GDALMajorObject *poMajorObject)
Convert a GDALMajorObject* to a GDALMajorObjectH.
Definition: gdal_priv.h:168
GDALPaletteInterp
Definition: gdal.h:216
Core portability services for cross-platform OGR code.
int bStatOK
Whether stat()'ing the file was successful.
Definition: gdal_priv.h:287
int nHeaderBytes
Number of bytes in pabyHeader.
Definition: gdal_priv.h:295
Class returned by GetBands() that act as a container for raster bands.
Definition: gdal_priv.h:460
virtual int CloseDependentDatasets()
Drop references to any other datasets referenced by this dataset.
Definition: gdaldataset.cpp:3432
void * GetDataRef(void)
Return the data buffer.
Definition: gdal_priv.h:895
virtual CPLErr CreateMaskBand(int nFlagsIn)
Adds a mask band to the dataset.
Definition: gdaldataset.cpp:2460
unsigned long long GUIntBig
Large unsigned integer type (generally 64-bit unsigned integer type).
Definition: cpl_port.h:251
int CPLErrorNum
Error number.
Definition: cpl_error.h:94
Various convenience functions for CPL.
This class represents an OpenGIS Spatial Reference System, and contains methods for converting betwee...
Definition: ogr_spatialref.h:147
int GetXSize() const
Return width.
Definition: gdal_priv.h:1601
void * GDALDriverH
Opaque type used for the C bindings of the C++ GDALDriver class.
Definition: gdal.h:261
int GetXSize() const
Return the width of the block.
Definition: gdal_priv.h:883
void GDALClose(GDALDatasetH)
Close GDAL dataset.
Definition: gdaldataset.cpp:3061
static GDALDatasetH ToHandle(GDALDataset *poDS)
Convert a GDALDataset* to a GDALDatasetH.
Definition: gdal_priv.h:590
void * GDALMajorObjectH
Opaque type used for the C bindings of the C++ GDALMajorObject class.
Definition: gdal.h:252
char ** papszOpenOptions
Open options.
Definition: gdal_priv.h:279
Object with metadata.
Definition: gdal_priv.h:132
int GetYSize() const
Return the height of the block.
Definition: gdal_priv.h:887
Class returned by GetLayers() that acts as a range of layers.
Definition: gdal_priv.h:642
static GDALDataset * FromHandle(GDALDatasetH hDS)
Convert a GDALDatasetH to a GDALDataset*.
Definition: gdal_priv.h:596
std::input_iterator_tag iterator_category
iterator_category
Definition: gdal_priv.h:665
This class represents a layer of simple features, with access methods.
Definition: ogrsf_frmts.h:70
int GetYOffset() const
Return y offset.
Definition: gdal_priv.h:1597
A single raster band (or channel).
Definition: gdal_priv.h:1032
GDALAccess
Definition: gdal.h:113
A simple feature, including geometry and attributes.
Definition: ogr_feature.h:354
This class represents a style table.
Definition: ogr_featurestyle.h:84
A set of associated raster bands, usually from one file.
Definition: gdal_priv.h:335
#define CPL_C_END
Macro to end a block of C symbols.
Definition: cpl_port.h:339
GDALDataType GetBufferType() const
Return buffer data type.
Definition: gdal_priv.h:1621
long long GIntBig
Large signed integer type (generally 64-bit integer type).
Definition: cpl_port.h:248
void * GDALColorTableH
Opaque type used for the C bindings of the C++ GDALColorTable class.
Definition: gdal.h:264
Class for managing the registration of file format drivers.
Definition: gdal_priv.h:1515
OGRLayer::FeatureIterator begin(OGRLayer *poLayer)
Return begin of feature iterator.
Definition: ogrsf_frmts.h:287
#define CPL_NULL_TERMINATED
Null terminated variadic.
Definition: cpl_port.h:896
int GetYOff() const
Return the y offset of the top-left corner of the block.
Definition: gdal_priv.h:879
CPLSTRING_METHOD_DLL CPLString & toupper(void)
Convert to upper case in place.
Definition: cplstring.cpp:316
GDALIdentifyEnum
Enumeration used by GDALDriver::pfnIdentify().
Definition: gdal_priv.h:1361
int OGRErr
Simple container for a bounding region.
Definition: ogr_core.h:290
GDALColorInterp
Definition: gdal.h:190
int GDALGetDataTypeSizeBytes(GDALDataType)
Get data type size in bytes.
Definition: gdal_misc.cpp:305
Class returned by GetFeatures() that act as a container for vector features.
Definition: gdal_priv.h:705
static GDALMajorObject * FromHandle(GDALMajorObjectH hMajorObject)
Convert a GDALMajorObjectH to a GDALMajorObject*.
Definition: gdal_priv.h:174
Identify determined the file is not recognized by the probed driver.
Definition: gdal_priv.h:1366
OGRLayer::FeatureIterator end(OGRLayer *poLayer)
Return end of feature iterator.
Definition: ogrsf_frmts.h:292
void difference_type
difference_type
Definition: gdal_priv.h:663
Format specific driver.
Definition: gdal_priv.h:1386
A color table / palette.
Definition: gdal_priv.h:937
Ground Control Point.
Definition: gdal.h:560
CPLErr
Error category.
Definition: cpl_error.h:52
GDALDriverManager * GetGDALDriverManager(void)
Fetch the global GDAL driver manager.
Definition: gdaldrivermanager.cpp:97
#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:989
int GetBufferXSize() const
Return buffer width.
Definition: gdal_priv.h:1613
#define CPL_WARN_UNUSED_RESULT
Qualifier to warn when the return value of a function is not used.
Definition: cpl_port.h:931
Class used as a session object for asynchronous requests.
Definition: gdal_priv.h:1559
static GDALColorTable * FromHandle(GDALColorTableH hCT)
Convert a GDALColorTableH to a GDALColorTable*.
Definition: gdal_priv.h:968