GDAL
gdal_priv.h
Go to the documentation of this file.
1/******************************************************************************
2 * $Id$
3 *
4 * Name: gdal_priv.h
5 * Project: GDAL Core
6 * Purpose: GDAL Core C++/Private declarations.
7 * Author: Frank Warmerdam, warmerdam@pobox.com
8 *
9 ******************************************************************************
10 * Copyright (c) 1998, Frank Warmerdam
11 * Copyright (c) 2007-2014, Even Rouault <even dot rouault at spatialys.com>
12 *
13 * Permission is hereby granted, free of charge, to any person obtaining a
14 * copy of this software and associated documentation files (the "Software"),
15 * to deal in the Software without restriction, including without limitation
16 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
17 * and/or sell copies of the Software, and to permit persons to whom the
18 * Software is furnished to do so, subject to the following conditions:
19 *
20 * The above copyright notice and this permission notice shall be included
21 * in all copies or substantial portions of the Software.
22 *
23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
24 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
26 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
28 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
29 * DEALINGS IN THE SOFTWARE.
30 ****************************************************************************/
31
32#ifndef GDAL_PRIV_H_INCLUDED
33#define GDAL_PRIV_H_INCLUDED
34
41/* -------------------------------------------------------------------- */
42/* Predeclare various classes before pulling in gdal.h, the */
43/* public declarations. */
44/* -------------------------------------------------------------------- */
45class GDALMajorObject;
46class GDALDataset;
47class GDALRasterBand;
48class GDALDriver;
50class GDALProxyDataset;
51class GDALProxyRasterBand;
52class GDALAsyncReader;
54
55/* -------------------------------------------------------------------- */
56/* Pull in the public declarations. This gets the C apis, and */
57/* also various constants. However, we will still get to */
58/* provide the real class definitions for the GDAL classes. */
59/* -------------------------------------------------------------------- */
60
61#include "gdal.h"
62#include "gdal_frmts.h"
63#include "cpl_vsi.h"
64#include "cpl_conv.h"
65#include "cpl_string.h"
66#include "cpl_minixml.h"
67#include "cpl_multiproc.h"
68#include "cpl_atomic_ops.h"
69
70#include <stdarg.h>
71
72#include <cmath>
73#include <cstdint>
74#include <iterator>
75#include <limits>
76#include <map>
77#include <memory>
78#include <vector>
79
80#include "ogr_core.h"
81#include "ogr_feature.h"
82
84#define GMO_VALID 0x0001
85#define GMO_IGNORE_UNIMPLEMENTED 0x0002
86#define GMO_SUPPORT_MD 0x0004
87#define GMO_SUPPORT_MDMD 0x0008
88#define GMO_MD_DIRTY 0x0010
89#define GMO_PAM_CLASS 0x0020
91
92/************************************************************************/
93/* GDALMultiDomainMetadata */
94/************************************************************************/
95
97class CPL_DLL GDALMultiDomainMetadata
98{
99private:
100 char **papszDomainList;
101 CPLStringList **papoMetadataLists;
102
103public:
104 GDALMultiDomainMetadata();
105 ~GDALMultiDomainMetadata();
106
107 int XMLInit( CPLXMLNode *psMetadata, int bMerge );
108 CPLXMLNode *Serialize();
109
110 char **GetDomainList() { return papszDomainList; }
111
112 char **GetMetadata( const char * pszDomain = "" );
113 CPLErr SetMetadata( char ** papszMetadata,
114 const char * pszDomain = "" );
115 const char *GetMetadataItem( const char * pszName,
116 const char * pszDomain = "" );
117 CPLErr SetMetadataItem( const char * pszName,
118 const char * pszValue,
119 const char * pszDomain = "" );
120
121 void Clear();
122
123 private:
124 CPL_DISALLOW_COPY_ASSIGN(GDALMultiDomainMetadata)
125};
127
128/* ******************************************************************** */
129/* GDALMajorObject */
130/* */
131/* Base class providing metadata, description and other */
132/* services shared by major objects. */
133/* ******************************************************************** */
134
136class CPL_DLL GDALMajorObject
137{
138 protected:
140 int nFlags; // GMO_* flags.
141 CPLString sDescription{};
142 GDALMultiDomainMetadata oMDMD{};
143
145
146 char **BuildMetadataDomainList( char** papszList,
147 int bCheckNonEmpty, ... ) CPL_NULL_TERMINATED;
148 public:
150 virtual ~GDALMajorObject();
151
152 int GetMOFlags() const;
153 void SetMOFlags( int nFlagsIn );
154
155 virtual const char *GetDescription() const;
156 virtual void SetDescription( const char * );
157
158 virtual char **GetMetadataDomainList();
159
160 virtual char **GetMetadata( const char * pszDomain = "" );
161 virtual CPLErr SetMetadata( char ** papszMetadata,
162 const char * pszDomain = "" );
163 virtual const char *GetMetadataItem( const char * pszName,
164 const char * pszDomain = "" );
165 virtual CPLErr SetMetadataItem( const char * pszName,
166 const char * pszValue,
167 const char * pszDomain = "" );
168
172 static inline GDALMajorObjectH ToHandle(GDALMajorObject* poMajorObject)
173 { return static_cast<GDALMajorObjectH>(poMajorObject); }
174
178 static inline GDALMajorObject* FromHandle(GDALMajorObjectH hMajorObject)
179 { return static_cast<GDALMajorObject*>(hMajorObject); }
180};
181
182/* ******************************************************************** */
183/* GDALDefaultOverviews */
184/* ******************************************************************** */
185
187class CPL_DLL GDALDefaultOverviews
188{
189 friend class GDALDataset;
190
191 GDALDataset *poDS;
192 GDALDataset *poODS;
193
194 CPLString osOvrFilename{};
195
196 bool bOvrIsAux;
197
198 bool bCheckedForMask;
199 bool bOwnMaskDS;
200 GDALDataset *poMaskDS;
201
202 // For "overview datasets" we record base level info so we can
203 // find our way back to get overview masks.
204 GDALDataset *poBaseDS;
205
206 // Stuff for deferred initialize/overviewscans.
207 bool bCheckedForOverviews;
208 void OverviewScan();
209 char *pszInitName;
210 bool bInitNameIsOVR;
211 char **papszInitSiblingFiles;
212
213 public:
214 GDALDefaultOverviews();
215 ~GDALDefaultOverviews();
216
217 void Initialize( GDALDataset *poDSIn, const char *pszName = nullptr,
218 char **papszSiblingFiles = nullptr,
219 int bNameIsOVR = FALSE );
220
221 void TransferSiblingFiles( char** papszSiblingFiles );
222
223 int IsInitialized();
224
226
227 // Overview Related
228
229 int GetOverviewCount( int nBand );
230 GDALRasterBand *GetOverview( int nBand, int iOverview );
231
232 CPLErr BuildOverviews( const char * pszBasename,
233 const char * pszResampling,
234 int nOverviews, int * panOverviewList,
235 int nBands, int * panBandList,
236 GDALProgressFunc pfnProgress,
237 void *pProgressData );
238
239 CPLErr BuildOverviewsSubDataset( const char * pszPhysicalFile,
240 const char * pszResampling,
241 int nOverviews, int * panOverviewList,
242 int nBands, int * panBandList,
243 GDALProgressFunc pfnProgress,
244 void *pProgressData );
245
246 CPLErr CleanOverviews();
247
248 // Mask Related
249
250 CPLErr CreateMaskBand( int nFlags, int nBand = -1 );
251 GDALRasterBand *GetMaskBand( int nBand );
252 int GetMaskFlags( int nBand );
253
254 int HaveMaskFile( char **papszSiblings = nullptr,
255 const char *pszBasename = nullptr );
256
257 char** GetSiblingFiles() { return papszInitSiblingFiles; }
258
259 private:
260 CPL_DISALLOW_COPY_ASSIGN(GDALDefaultOverviews)
261};
263
264/* ******************************************************************** */
265/* GDALOpenInfo */
266/* ******************************************************************** */
267
269class CPL_DLL GDALOpenInfo
270{
271 bool bHasGotSiblingFiles;
272 char **papszSiblingFiles;
273 int nHeaderBytesTried;
274
275 public:
276 GDALOpenInfo( const char * pszFile, int nOpenFlagsIn,
277 const char * const * papszSiblingFiles = nullptr );
278 ~GDALOpenInfo( void );
279
284
289
294
297
302
304 const char* const* papszAllowedDrivers;
305
306 int TryToIngest(int nBytes);
307 char **GetSiblingFiles();
308 char **StealSiblingFiles();
309 bool AreSiblingFilesLoaded() const;
310
311 private:
313};
314
315/* ******************************************************************** */
316/* GDALDataset */
317/* ******************************************************************** */
318
319class OGRLayer;
320class OGRGeometry;
322class OGRStyleTable;
323class swq_select;
324class swq_select_parse_options;
325class GDALGroup;
326
328typedef struct GDALSQLParseInfo GDALSQLParseInfo;
330
332#ifdef GDAL_COMPILATION
333#define OPTIONAL_OUTSIDE_GDAL(val)
334#else
335#define OPTIONAL_OUTSIDE_GDAL(val) = val
336#endif
338
340class CPL_DLL GDALDataset : public GDALMajorObject
341{
342 friend GDALDatasetH CPL_STDCALL GDALOpenEx( const char* pszFilename,
343 unsigned int nOpenFlags,
344 const char* const* papszAllowedDrivers,
345 const char* const* papszOpenOptions,
346 const char* const* papszSiblingFiles );
347 friend void CPL_STDCALL GDALClose( GDALDatasetH hDS );
348
349 friend class GDALDriver;
350 friend class GDALDefaultOverviews;
351 friend class GDALProxyDataset;
352 friend class GDALDriverManager;
353
354 CPL_INTERNAL void AddToDatasetOpenList();
355
356 CPL_INTERNAL static void ReportErrorV(
357 const char* pszDSName,
358 CPLErr eErrClass, CPLErrorNum err_no,
359 const char *fmt, va_list args);
360 protected:
362 GDALDriver *poDriver = nullptr;
363 GDALAccess eAccess = GA_ReadOnly;
364
365 // Stored raster information.
366 int nRasterXSize = 512;
367 int nRasterYSize = 512;
368 int nBands = 0;
369 GDALRasterBand **papoBands = nullptr;
370
371 int nOpenFlags = 0;
372
373 int nRefCount = 1;
374 bool bForceCachedIO = false;
375 bool bShared = false;
376 bool bIsInternal = true;
377 bool bSuppressOnClose = false;
378
379 mutable std::map<std::string, std::unique_ptr<OGRFieldDomain>> m_oMapFieldDomains{};
380
381 GDALDataset(void);
382 explicit GDALDataset(int bForceCachedIO);
383
384 void RasterInitialize( int, int );
385 void SetBand( int, GDALRasterBand * );
386
387 GDALDefaultOverviews oOvManager{};
388
389 virtual CPLErr IBuildOverviews( const char *, int, int *,
390 int, int *, GDALProgressFunc, void * );
391
392 virtual CPLErr IRasterIO( GDALRWFlag, int, int, int, int,
393 void *, int, int, GDALDataType,
394 int, int *, GSpacing, GSpacing, GSpacing,
396
397 CPLErr BlockBasedRasterIO( GDALRWFlag, int, int, int, int,
398 void *, int, int, GDALDataType,
399 int, int *, GSpacing, GSpacing, GSpacing,
401 void BlockBasedFlushCache(bool bAtClosing);
402
403 CPLErr BandBasedRasterIO( GDALRWFlag eRWFlag,
404 int nXOff, int nYOff, int nXSize, int nYSize,
405 void * pData, int nBufXSize, int nBufYSize,
406 GDALDataType eBufType,
407 int nBandCount, int *panBandMap,
408 GSpacing nPixelSpace, GSpacing nLineSpace,
409 GSpacing nBandSpace,
411
412 CPLErr RasterIOResampled( GDALRWFlag eRWFlag,
413 int nXOff, int nYOff, int nXSize, int nYSize,
414 void * pData, int nBufXSize, int nBufYSize,
415 GDALDataType eBufType,
416 int nBandCount, int *panBandMap,
417 GSpacing nPixelSpace, GSpacing nLineSpace,
418 GSpacing nBandSpace,
420
421 CPLErr ValidateRasterIOOrAdviseReadParameters(
422 const char* pszCallingFunc,
423 int* pbStopProcessingOnCENone,
424 int nXOff, int nYOff, int nXSize, int nYSize,
425 int nBufXSize, int nBufYSize,
426 int nBandCount, int *panBandMap);
427
428 CPLErr TryOverviewRasterIO( GDALRWFlag eRWFlag,
429 int nXOff, int nYOff, int nXSize, int nYSize,
430 void * pData, int nBufXSize, int nBufYSize,
431 GDALDataType eBufType,
432 int nBandCount, int *panBandMap,
433 GSpacing nPixelSpace, GSpacing nLineSpace,
434 GSpacing nBandSpace,
435 GDALRasterIOExtraArg* psExtraArg,
436 int* pbTried);
437
438 void ShareLockWithParentDataset(GDALDataset* poParentDataset);
439
441
442 void CleanupPostFileClosing();
443
444 virtual int CloseDependentDatasets();
446 int ValidateLayerCreationOptions( const char* const* papszLCO );
447
448 char **papszOpenOptions = nullptr;
449
450 friend class GDALRasterBand;
451
452 // The below methods related to read write mutex are fragile logic, and
453 // should not be used by out-of-tree code if possible.
454 int EnterReadWrite(GDALRWFlag eRWFlag);
455 void LeaveReadWrite();
456 void InitRWLock();
457
458 void TemporarilyDropReadWriteLock();
459 void ReacquireReadWriteLock();
460
461 void DisableReadWriteMutex();
462
463 int AcquireMutex();
464 void ReleaseMutex();
466
467 public:
468 ~GDALDataset() override;
469
470 int GetRasterXSize();
471 int GetRasterYSize();
472 int GetRasterCount();
473 GDALRasterBand *GetRasterBand( int );
474
476 class CPL_DLL Bands
477 {
478 private:
479
480 friend class GDALDataset;
481 GDALDataset* m_poSelf;
482 CPL_INTERNAL explicit Bands(GDALDataset* poSelf): m_poSelf(poSelf) {}
483
484 class CPL_DLL Iterator
485 {
486 struct Private;
487 std::unique_ptr<Private> m_poPrivate;
488 public:
489 Iterator(GDALDataset* poDS, bool bStart);
490 Iterator(const Iterator& oOther); // declared but not defined. Needed for gcc 5.4 at least
491 Iterator(Iterator&& oOther) noexcept; // declared but not defined. Needed for gcc 5.4 at least
492 ~Iterator();
493 GDALRasterBand* operator*();
494 Iterator& operator++();
495 bool operator!=(const Iterator& it) const;
496 };
497
498 public:
499
500 const Iterator begin() const;
501
502 const Iterator end() const;
503
504 size_t size() const;
505
506 GDALRasterBand* operator[](int iBand);
507 GDALRasterBand* operator[](size_t iBand);
508 };
509
510 Bands GetBands();
511
512 virtual void FlushCache(bool bAtClosing = false);
513
514 virtual const OGRSpatialReference* GetSpatialRef() const;
515 virtual CPLErr SetSpatialRef(const OGRSpatialReference* poSRS);
516
517 // Compatibility layer
518 const char *GetProjectionRef(void) const;
519 CPLErr SetProjection( const char * pszProjection );
520
521 virtual CPLErr GetGeoTransform( double * padfTransform );
522 virtual CPLErr SetGeoTransform( double * padfTransform );
523
524 virtual CPLErr AddBand( GDALDataType eType,
525 char **papszOptions=nullptr );
526
527 virtual void *GetInternalHandle( const char * pszHandleName );
528 virtual GDALDriver *GetDriver(void);
529 virtual char **GetFileList(void);
530
531 virtual const char* GetDriverName();
532
533 virtual const OGRSpatialReference* GetGCPSpatialRef() const;
534 virtual int GetGCPCount();
535 virtual const GDAL_GCP *GetGCPs();
536 virtual CPLErr SetGCPs( int nGCPCount, const GDAL_GCP *pasGCPList,
537 const OGRSpatialReference * poGCP_SRS );
538
539 // Compatibility layer
540 const char *GetGCPProjection();
541 CPLErr SetGCPs( int nGCPCount, const GDAL_GCP *pasGCPList,
542 const char *pszGCPProjection );
543
544 virtual CPLErr AdviseRead( int nXOff, int nYOff, int nXSize, int nYSize,
545 int nBufXSize, int nBufYSize,
546 GDALDataType eDT,
547 int nBandCount, int *panBandList,
548 char **papszOptions );
549
550 virtual CPLErr CreateMaskBand( int nFlagsIn );
551
552 virtual GDALAsyncReader*
553 BeginAsyncReader(int nXOff, int nYOff, int nXSize, int nYSize,
554 void *pBuf, int nBufXSize, int nBufYSize,
555 GDALDataType eBufType,
556 int nBandCount, int* panBandMap,
557 int nPixelSpace, int nLineSpace, int nBandSpace,
558 char **papszOptions);
559 virtual void EndAsyncReader(GDALAsyncReader *);
560
562 struct RawBinaryLayout
563 {
564 enum class Interleaving
565 {
566 UNKNOWN,
567 BIP,
568 BIL,
569 BSQ
570 };
571 std::string osRawFilename{};
572 Interleaving eInterleaving = Interleaving::UNKNOWN;
573 GDALDataType eDataType = GDT_Unknown;
574 bool bLittleEndianOrder = false;
575
576 vsi_l_offset nImageOffset = 0;
577 GIntBig nPixelOffset = 0;
578 GIntBig nLineOffset = 0;
579 GIntBig nBandOffset = 0;
580 };
581
582 virtual bool GetRawBinaryLayout(RawBinaryLayout&);
584
585 CPLErr RasterIO( GDALRWFlag, int, int, int, int,
586 void *, int, int, GDALDataType,
587 int, int *, GSpacing, GSpacing, GSpacing,
588 GDALRasterIOExtraArg* psExtraArg
589#ifndef DOXYGEN_SKIP
590 OPTIONAL_OUTSIDE_GDAL(nullptr)
591#endif
593
594 int Reference();
595 int Dereference();
596 int ReleaseRef();
597
601 GDALAccess GetAccess() const { return eAccess; }
602
603 int GetShared() const;
604 void MarkAsShared();
605
606 void MarkSuppressOnClose();
607
611 char **GetOpenOptions() { return papszOpenOptions; }
612
613 static GDALDataset **GetOpenDatasets( int *pnDatasetCount );
614
615 CPLErr BuildOverviews( const char *, int, int *,
616 int, int *, GDALProgressFunc, void * );
617
618#ifndef DOXYGEN_XML
619 void ReportError(CPLErr eErrClass, CPLErrorNum err_no, const char *fmt, ...) CPL_PRINT_FUNC_FORMAT (4, 5);
620
621 static void ReportError(const char* pszDSName,
622 CPLErr eErrClass, CPLErrorNum err_no,
623 const char *fmt, ...) CPL_PRINT_FUNC_FORMAT (4, 5);
624#endif
625
626 char ** GetMetadata(const char * pszDomain = "") override;
627
628// Only defined when Doxygen enabled
629#ifdef DOXYGEN_SKIP
630 CPLErr SetMetadata( char ** papszMetadata,
631 const char * pszDomain ) override;
632 CPLErr SetMetadataItem( const char * pszName,
633 const char * pszValue,
634 const char * pszDomain ) override;
635#endif
636
637 char **GetMetadataDomainList() override;
638
639 virtual void ClearStatistics();
640
644 static inline GDALDatasetH ToHandle(GDALDataset* poDS)
645 { return static_cast<GDALDatasetH>(poDS); }
646
651 { return static_cast<GDALDataset*>(hDS); }
652
656 static GDALDataset* Open( const char* pszFilename,
657 unsigned int nOpenFlags = 0,
658 const char* const* papszAllowedDrivers = nullptr,
659 const char* const* papszOpenOptions = nullptr,
660 const char* const* papszSiblingFiles = nullptr )
661 {
662 return FromHandle(GDALOpenEx(pszFilename, nOpenFlags,
663 papszAllowedDrivers,
664 papszOpenOptions,
665 papszSiblingFiles));
666 }
667
670 {
673
675 OGRLayer* layer = nullptr;
676 };
677
679 // SetEnableOverviews() only to be used by GDALOverviewDataset
680 void SetEnableOverviews(bool bEnable);
681
682 // Only to be used by driver's GetOverviewCount() method.
683 bool AreOverviewsEnabled() const;
685
686private:
687 class Private;
688 Private *m_poPrivate;
689
690 CPL_INTERNAL OGRLayer* BuildLayerFromSelectInfo(swq_select* psSelectInfo,
691 OGRGeometry *poSpatialFilter,
692 const char *pszDialect,
693 swq_select_parse_options* poSelectParseOptions);
694 CPLStringList oDerivedMetadataList{};
695
696 public:
697
698 virtual int GetLayerCount();
699 virtual OGRLayer *GetLayer(int iLayer);
700
701 virtual bool IsLayerPrivate(int iLayer) const;
702
706 class CPL_DLL Layers
707 {
708 private:
709
710 friend class GDALDataset;
711 GDALDataset* m_poSelf;
712 CPL_INTERNAL explicit Layers(GDALDataset* poSelf): m_poSelf(poSelf) {}
713
714 public:
715
719 class CPL_DLL Iterator
720 {
721 struct Private;
722 std::unique_ptr<Private> m_poPrivate;
723 public:
724
727 using difference_type = void;
728 using pointer = void;
729 using iterator_category = std::input_iterator_tag;
731 Iterator();
732 Iterator(GDALDataset* poDS, bool bStart);
733 Iterator(const Iterator& oOther);
734 Iterator(Iterator&& oOther) noexcept;
737 Iterator& operator=(const Iterator& oOther);
738 Iterator& operator=(Iterator&& oOther) noexcept;
740 OGRLayer* operator*() const;
741 Iterator& operator++();
742 Iterator operator++(int);
743 bool operator!=(const Iterator& it) const;
744 };
745
746 Iterator begin() const;
747 Iterator end() const;
748
749 size_t size() const;
750
751 OGRLayer* operator[](int iLayer);
752 OGRLayer* operator[](size_t iLayer);
753 OGRLayer* operator[](const char* pszLayername);
754 };
755
756 Layers GetLayers();
757
758 virtual OGRLayer *GetLayerByName(const char *);
759 virtual OGRErr DeleteLayer(int iLayer);
760
761 virtual void ResetReading();
762 virtual OGRFeature* GetNextFeature( OGRLayer** ppoBelongingLayer,
763 double* pdfProgressPct,
764 GDALProgressFunc pfnProgress,
765 void* pProgressData );
766
767
769 class CPL_DLL Features
770 {
771 private:
772
773 friend class GDALDataset;
774 GDALDataset* m_poSelf;
775 CPL_INTERNAL explicit Features(GDALDataset* poSelf): m_poSelf(poSelf) {}
776
777 class CPL_DLL Iterator
778 {
779 struct Private;
780 std::unique_ptr<Private> m_poPrivate;
781 public:
782 Iterator(GDALDataset* poDS, bool bStart);
783 Iterator(const Iterator& oOther); // declared but not defined. Needed for gcc 5.4 at least
784 Iterator(Iterator&& oOther) noexcept; // declared but not defined. Needed for gcc 5.4 at least
785 ~Iterator();
786 const FeatureLayerPair& operator*() const;
787 Iterator& operator++();
788 bool operator!=(const Iterator& it) const;
789 };
790
791 public:
792
793 const Iterator begin() const;
794
795 const Iterator end() const;
796 };
797
798 Features GetFeatures();
799
800 virtual int TestCapability( const char * );
801
802 virtual std::vector<std::string> GetFieldDomainNames(CSLConstList papszOptions = nullptr) const;
803
804 virtual const OGRFieldDomain* GetFieldDomain(const std::string& name) const;
805
806 virtual bool AddFieldDomain(std::unique_ptr<OGRFieldDomain>&& domain,
807 std::string& failureReason);
808
809 virtual bool DeleteFieldDomain(const std::string& name,
810 std::string& failureReason);
811
812 virtual bool UpdateFieldDomain(std::unique_ptr<OGRFieldDomain>&& domain,
813 std::string& failureReason);
814
815 virtual std::vector<std::string> GetRelationshipNames(CSLConstList papszOptions = nullptr) const;
816
817 virtual const GDALRelationship* GetRelationship(const std::string& name) const;
818
819 virtual bool AddRelationship(std::unique_ptr<GDALRelationship>&& relationship,
820 std::string& failureReason);
821
822 virtual bool DeleteRelationship(const std::string& name,
823 std::string& failureReason);
824
825 virtual bool UpdateRelationship(std::unique_ptr<GDALRelationship>&& relationship,
826 std::string& failureReason);
827
828 virtual OGRLayer *CreateLayer( const char *pszName,
829 OGRSpatialReference *poSpatialRef = nullptr,
831 char ** papszOptions = nullptr );
832 virtual OGRLayer *CopyLayer( OGRLayer *poSrcLayer,
833 const char *pszNewName,
834 char **papszOptions = nullptr );
835
836 virtual OGRStyleTable *GetStyleTable();
837 virtual void SetStyleTableDirectly( OGRStyleTable *poStyleTable );
838
839 virtual void SetStyleTable(OGRStyleTable *poStyleTable);
840
841 virtual OGRLayer * ExecuteSQL( const char *pszStatement,
842 OGRGeometry *poSpatialFilter,
843 const char *pszDialect );
844 virtual void ReleaseResultSet( OGRLayer * poResultsSet );
845 virtual OGRErr AbortSQL( );
846
847 int GetRefCount() const;
848 int GetSummaryRefCount() const;
849 OGRErr Release();
850
851 virtual OGRErr StartTransaction(int bForce=FALSE);
852 virtual OGRErr CommitTransaction();
853 virtual OGRErr RollbackTransaction();
854
855 virtual std::shared_ptr<GDALGroup> GetRootGroup() const;
856
858 static int IsGenericSQLDialect(const char* pszDialect);
859
860 // Semi-public methods. Only to be used by in-tree drivers.
861 GDALSQLParseInfo* BuildParseInfo(swq_select* psSelectInfo,
862 swq_select_parse_options* poSelectParseOptions);
863 static void DestroyParseInfo(GDALSQLParseInfo* psParseInfo );
864 OGRLayer * ExecuteSQL( const char *pszStatement,
865 OGRGeometry *poSpatialFilter,
866 const char *pszDialect,
867 swq_select_parse_options* poSelectParseOptions);
869
870 protected:
871 virtual OGRLayer *ICreateLayer( const char *pszName,
872 OGRSpatialReference *poSpatialRef = nullptr,
874 char ** papszOptions = nullptr );
875
877 OGRErr ProcessSQLCreateIndex( const char * );
878 OGRErr ProcessSQLDropIndex( const char * );
879 OGRErr ProcessSQLDropTable( const char * );
880 OGRErr ProcessSQLAlterTableAddColumn( const char * );
881 OGRErr ProcessSQLAlterTableDropColumn( const char * );
882 OGRErr ProcessSQLAlterTableAlterColumn( const char * );
883 OGRErr ProcessSQLAlterTableRenameColumn( const char * );
884
885 OGRStyleTable *m_poStyleTable = nullptr;
886
887 // Compatibility layers
888 const OGRSpatialReference* GetSpatialRefFromOldGetProjectionRef() const;
889 CPLErr OldSetProjectionFromSetSpatialRef(const OGRSpatialReference* poSRS);
890 const OGRSpatialReference* GetGCPSpatialRefFromOldGetGCPProjection() const;
891 CPLErr OldSetGCPsFromNew( int nGCPCount, const GDAL_GCP *pasGCPList,
892 const OGRSpatialReference * poGCP_SRS );
893
894 friend class GDALProxyPoolDataset;
895 virtual const char *_GetProjectionRef();
896 const char *GetProjectionRefFromSpatialRef(const OGRSpatialReference*) const;
897 virtual const char *_GetGCPProjection();
898 const char *GetGCPProjectionFromSpatialRef(const OGRSpatialReference* poSRS) const;
899 virtual CPLErr _SetProjection( const char * pszProjection );
900 virtual CPLErr _SetGCPs( int nGCPCount, const GDAL_GCP *pasGCPList,
901 const char *pszGCPProjection );
903
904 private:
906};
907
909struct CPL_DLL GDALDatasetUniquePtrDeleter
910{
911 void operator()(GDALDataset* poDataset) const
912 { GDALClose(poDataset); }
913};
915
921using GDALDatasetUniquePtr = std::unique_ptr<GDALDataset, GDALDatasetUniquePtrDeleter>;
922
923/* ******************************************************************** */
924/* GDALRasterBlock */
925/* ******************************************************************** */
926
931class CPL_DLL GDALRasterBlock
932{
933 friend class GDALAbstractBandBlockCache;
934
935 GDALDataType eType;
936
937 bool bDirty;
938 volatile int nLockCount;
939
940 int nXOff;
941 int nYOff;
942
943 int nXSize;
944 int nYSize;
945
946 void *pData;
947
948 GDALRasterBand *poBand;
949
950 GDALRasterBlock *poNext;
951 GDALRasterBlock *poPrevious;
952
953 bool bMustDetach;
954
955 CPL_INTERNAL void Detach_unlocked( void );
956 CPL_INTERNAL void Touch_unlocked( void );
957
958 CPL_INTERNAL void RecycleFor( int nXOffIn, int nYOffIn );
959
960 public:
961 GDALRasterBlock( GDALRasterBand *, int, int );
962 GDALRasterBlock( int nXOffIn, int nYOffIn ); /* only for lookup purpose */
963 virtual ~GDALRasterBlock();
964
965 CPLErr Internalize( void );
966 void Touch( void );
967 void MarkDirty( void );
968 void MarkClean( void );
970 int AddLock( void ) { return CPLAtomicInc(&nLockCount); }
972 int DropLock( void ) { return CPLAtomicDec(&nLockCount); }
973 void Detach();
974
975 CPLErr Write();
976
980 GDALDataType GetDataType() const { return eType; }
984 int GetXOff() const { return nXOff; }
988 int GetYOff() const { return nYOff; }
992 int GetXSize() const { return nXSize; }
996 int GetYSize() const { return nYSize; }
1000 int GetDirty() const { return bDirty; }
1004 void *GetDataRef( void ) { return pData; }
1009 return static_cast<GPtrDiff_t>(nXSize) * nYSize * GDALGetDataTypeSizeBytes(eType); }
1010
1011 int TakeLock();
1012 int DropLockForRemovalFromStorage();
1013
1016 GDALRasterBand *GetBand() { return poBand; }
1017
1018 static void FlushDirtyBlocks();
1019 static int FlushCacheBlock(int bDirtyBlocksOnly = FALSE);
1020 static void Verify();
1021
1022 static void EnterDisableDirtyBlockFlush();
1023 static void LeaveDisableDirtyBlockFlush();
1024
1025#ifdef notdef
1026 static void CheckNonOrphanedBlocks(GDALRasterBand* poBand);
1027 void DumpBlock();
1028 static void DumpAll();
1029#endif
1030
1031 /* Should only be called by GDALDestroyDriverManager() */
1033 CPL_INTERNAL static void DestroyRBMutex();
1035
1036 private:
1038};
1039
1040/* ******************************************************************** */
1041/* GDALColorTable */
1042/* ******************************************************************** */
1043
1046class CPL_DLL GDALColorTable
1047{
1048 GDALPaletteInterp eInterp;
1049
1050 std::vector<GDALColorEntry> aoEntries{};
1051
1052public:
1055
1056 GDALColorTable *Clone() const;
1057 int IsSame(const GDALColorTable* poOtherCT) const;
1058
1059 GDALPaletteInterp GetPaletteInterpretation() const;
1060
1061 int GetColorEntryCount() const;
1062 const GDALColorEntry *GetColorEntry( int ) const;
1063 int GetColorEntryAsRGB( int, GDALColorEntry * ) const;
1064 void SetColorEntry( int, const GDALColorEntry * );
1065 int CreateColorRamp( int, const GDALColorEntry * ,
1066 int, const GDALColorEntry * );
1067 bool IsIdentity() const;
1068
1073 { return static_cast<GDALColorTableH>(poCT); }
1074
1079 { return static_cast<GDALColorTable*>(hCT); }
1080
1081};
1082
1083/* ******************************************************************** */
1084/* GDALAbstractBandBlockCache */
1085/* ******************************************************************** */
1086
1088
1090// only used by GDALRasterBand implementation.
1091
1092class GDALAbstractBandBlockCache
1093{
1094 // List of blocks that can be freed or recycled, and its lock
1095 CPLLock *hSpinLock = nullptr;
1096 GDALRasterBlock *psListBlocksToFree = nullptr;
1097
1098 // Band keep alive counter, and its lock & condition
1099 CPLCond *hCond = nullptr;
1100 CPLMutex *hCondMutex = nullptr;
1101 volatile int nKeepAliveCounter = 0;
1102
1103 volatile int m_nDirtyBlocks = 0;
1104
1105 CPL_DISALLOW_COPY_ASSIGN(GDALAbstractBandBlockCache)
1106
1107 protected:
1108 GDALRasterBand *poBand;
1109
1110 int m_nInitialDirtyBlocksInFlushCache = 0;
1111 int m_nLastTick = -1;
1112 bool m_bWriteDirtyBlocks = true;
1113
1114 void FreeDanglingBlocks();
1115 void UnreferenceBlockBase();
1116
1117 void StartDirtyBlockFlushingLog();
1118 void UpdateDirtyBlockFlushingLog();
1119 void EndDirtyBlockFlushingLog();
1120
1121 public:
1122 explicit GDALAbstractBandBlockCache(GDALRasterBand* poBand);
1123 virtual ~GDALAbstractBandBlockCache();
1124
1125 GDALRasterBlock* CreateBlock(int nXBlockOff, int nYBlockOff);
1126 void AddBlockToFreeList( GDALRasterBlock * );
1127 void IncDirtyBlocks(int nInc);
1128 void WaitCompletionPendingTasks();
1129 void DisableDirtyBlockWriting() { m_bWriteDirtyBlocks = false; }
1130
1131 virtual bool Init() = 0;
1132 virtual bool IsInitOK() = 0;
1133 virtual CPLErr FlushCache() = 0;
1134 virtual CPLErr AdoptBlock( GDALRasterBlock* poBlock ) = 0;
1135 virtual GDALRasterBlock *TryGetLockedBlockRef( int nXBlockOff,
1136 int nYBlockYOff ) = 0;
1137 virtual CPLErr UnreferenceBlock( GDALRasterBlock* poBlock ) = 0;
1138 virtual CPLErr FlushBlock( int nXBlockOff, int nYBlockOff,
1139 int bWriteDirtyBlock ) = 0;
1140};
1141
1142GDALAbstractBandBlockCache* GDALArrayBandBlockCacheCreate(GDALRasterBand* poBand);
1143GDALAbstractBandBlockCache* GDALHashSetBandBlockCacheCreate(GDALRasterBand* poBand);
1144
1146
1147/* ******************************************************************** */
1148/* GDALRasterBand */
1149/* ******************************************************************** */
1150
1151class GDALMDArray;
1152
1154typedef enum
1155{
1156 GMVR_UNKNOWN,
1160
1163
1166
1169
1172
1175
1178
1181class CPL_DLL GDALRasterBand : public GDALMajorObject
1182{
1183 private:
1184 friend class GDALArrayBandBlockCache;
1185 friend class GDALHashSetBandBlockCache;
1186 friend class GDALRasterBlock;
1187 friend class GDALDataset;
1188
1189 CPLErr eFlushBlockErr = CE_None;
1190 GDALAbstractBandBlockCache* poBandBlockCache = nullptr;
1191
1192 CPL_INTERNAL void SetFlushBlockErr( CPLErr eErr );
1193 CPL_INTERNAL CPLErr UnreferenceBlock( GDALRasterBlock* poBlock );
1194 CPL_INTERNAL void IncDirtyBlocks(int nInc);
1195
1196 protected:
1198 GDALDataset *poDS = nullptr;
1199 int nBand = 0; /* 1 based */
1200
1201 int nRasterXSize = 0;
1202 int nRasterYSize = 0;
1203
1204 GDALDataType eDataType = GDT_Byte;
1205 GDALAccess eAccess = GA_ReadOnly;
1206
1207 /* stuff related to blocking, and raster cache */
1208 int nBlockXSize = -1;
1209 int nBlockYSize = -1;
1210 int nBlocksPerRow = 0;
1211 int nBlocksPerColumn = 0;
1212
1213 int nBlockReads = 0;
1214 int bForceCachedIO = 0;
1215
1216 GDALRasterBand *poMask = nullptr;
1217 bool bOwnMask = false;
1218 int nMaskFlags = 0;
1219
1220 void InvalidateMaskBand();
1221
1222 friend class GDALProxyRasterBand;
1223 friend class GDALDefaultOverviews;
1224
1225 CPLErr RasterIOResampled( GDALRWFlag, int, int, int, int,
1226 void *, int, int, GDALDataType,
1228
1229 int EnterReadWrite(GDALRWFlag eRWFlag);
1230 void LeaveReadWrite();
1231 void InitRWLock();
1232 void SetValidPercent( GUIntBig nSampleCount, GUIntBig nValidCount );
1234
1235 protected:
1236 virtual CPLErr IReadBlock( int nBlockXOff, int nBlockYOff, void * pData ) = 0;
1237 virtual CPLErr IWriteBlock( int nBlockXOff, int nBlockYOff, void * pData );
1238
1239 virtual CPLErr IRasterIO( GDALRWFlag, int, int, int, int,
1240 void *, int, int, GDALDataType,
1242
1243 virtual int IGetDataCoverageStatus( int nXOff, int nYOff,
1244 int nXSize, int nYSize,
1245 int nMaskFlagStop,
1246 double* pdfDataPct);
1248 CPLErr OverviewRasterIO( GDALRWFlag, int, int, int, int,
1249 void *, int, int, GDALDataType,
1251
1252 CPLErr TryOverviewRasterIO( GDALRWFlag eRWFlag,
1253 int nXOff, int nYOff, int nXSize, int nYSize,
1254 void * pData, int nBufXSize, int nBufYSize,
1255 GDALDataType eBufType,
1256 GSpacing nPixelSpace, GSpacing nLineSpace,
1257 GDALRasterIOExtraArg* psExtraArg,
1258 int* pbTried );
1259
1260 int InitBlockInfo();
1261
1262 void AddBlockToFreeList( GDALRasterBlock * );
1264
1265 public:
1267 explicit GDALRasterBand(int bForceCachedIO);
1268
1269 ~GDALRasterBand() override;
1270
1271 int GetXSize();
1272 int GetYSize();
1273 int GetBand();
1274 GDALDataset*GetDataset();
1275
1276 GDALDataType GetRasterDataType( void );
1277 void GetBlockSize( int *, int * );
1278 CPLErr GetActualBlockSize ( int, int, int *, int * );
1279
1280 virtual GDALSuggestedBlockAccessPattern GetSuggestedBlockAccessPattern() const;
1281
1282 GDALAccess GetAccess();
1283
1284 CPLErr RasterIO( GDALRWFlag, int, int, int, int,
1285 void *, int, int, GDALDataType,
1287#ifndef DOXYGEN_SKIP
1288 OPTIONAL_OUTSIDE_GDAL(nullptr)
1289#endif
1291 CPLErr ReadBlock( int, int, void * ) CPL_WARN_UNUSED_RESULT;
1292
1293 CPLErr WriteBlock( int, int, void * ) CPL_WARN_UNUSED_RESULT;
1294
1295 GDALRasterBlock *GetLockedBlockRef( int nXBlockOff, int nYBlockOff,
1296 int bJustInitialize = FALSE ) CPL_WARN_UNUSED_RESULT;
1297 GDALRasterBlock *TryGetLockedBlockRef( int nXBlockOff, int nYBlockYOff ) CPL_WARN_UNUSED_RESULT;
1298 CPLErr FlushBlock( int, int, int bWriteDirtyBlock = TRUE );
1299
1300 unsigned char* GetIndexColorTranslationTo(/* const */ GDALRasterBand* poReferenceBand,
1301 unsigned char* pTranslationTable = nullptr,
1302 int* pApproximateMatching = nullptr);
1303
1304 // New OpengIS CV_SampleDimension stuff.
1305
1306 virtual CPLErr FlushCache(bool bAtClosing = false);
1307 virtual char **GetCategoryNames();
1308 virtual double GetNoDataValue( int *pbSuccess = nullptr );
1309 virtual int64_t GetNoDataValueAsInt64( int *pbSuccess = nullptr );
1310 virtual uint64_t GetNoDataValueAsUInt64( int *pbSuccess = nullptr );
1311 virtual double GetMinimum( int *pbSuccess = nullptr );
1312 virtual double GetMaximum(int *pbSuccess = nullptr );
1313 virtual double GetOffset( int *pbSuccess = nullptr );
1314 virtual double GetScale( int *pbSuccess = nullptr );
1315 virtual const char *GetUnitType();
1316 virtual GDALColorInterp GetColorInterpretation();
1317 virtual GDALColorTable *GetColorTable();
1318 virtual CPLErr Fill(double dfRealValue, double dfImaginaryValue = 0);
1319
1320 virtual CPLErr SetCategoryNames( char ** papszNames );
1321 virtual CPLErr SetNoDataValue( double dfNoData );
1322 virtual CPLErr SetNoDataValueAsInt64( int64_t nNoData );
1323 virtual CPLErr SetNoDataValueAsUInt64( uint64_t nNoData );
1324 virtual CPLErr DeleteNoDataValue();
1325 virtual CPLErr SetColorTable( GDALColorTable * poCT );
1326 virtual CPLErr SetColorInterpretation( GDALColorInterp eColorInterp );
1327 virtual CPLErr SetOffset( double dfNewOffset );
1328 virtual CPLErr SetScale( double dfNewScale );
1329 virtual CPLErr SetUnitType( const char * pszNewValue );
1330
1331 virtual CPLErr GetStatistics( int bApproxOK, int bForce,
1332 double *pdfMin, double *pdfMax,
1333 double *pdfMean, double *padfStdDev );
1334 virtual CPLErr ComputeStatistics( int bApproxOK,
1335 double *pdfMin, double *pdfMax,
1336 double *pdfMean, double *pdfStdDev,
1337 GDALProgressFunc, void *pProgressData );
1338 virtual CPLErr SetStatistics( double dfMin, double dfMax,
1339 double dfMean, double dfStdDev );
1340 virtual CPLErr ComputeRasterMinMax( int, double* );
1341
1342// Only defined when Doxygen enabled
1343#ifdef DOXYGEN_SKIP
1344 CPLErr SetMetadata( char ** papszMetadata,
1345 const char * pszDomain ) override;
1346 CPLErr SetMetadataItem( const char * pszName,
1347 const char * pszValue,
1348 const char * pszDomain ) override;
1349#endif
1350
1351 virtual int HasArbitraryOverviews();
1352 virtual int GetOverviewCount();
1353 virtual GDALRasterBand *GetOverview(int);
1354 virtual GDALRasterBand *GetRasterSampleOverview( GUIntBig );
1355 virtual CPLErr BuildOverviews( const char * pszResampling,
1356 int nOverviews,
1357 int * panOverviewList,
1358 GDALProgressFunc pfnProgress,
1359 void * pProgressData );
1360
1361 virtual CPLErr AdviseRead( int nXOff, int nYOff, int nXSize, int nYSize,
1362 int nBufXSize, int nBufYSize,
1363 GDALDataType eBufType, char **papszOptions );
1364
1365 virtual CPLErr GetHistogram( double dfMin, double dfMax,
1366 int nBuckets, GUIntBig * panHistogram,
1367 int bIncludeOutOfRange, int bApproxOK,
1368 GDALProgressFunc, void *pProgressData );
1369
1370 virtual CPLErr GetDefaultHistogram( double *pdfMin, double *pdfMax,
1371 int *pnBuckets, GUIntBig ** ppanHistogram,
1372 int bForce,
1373 GDALProgressFunc, void *pProgressData);
1374 virtual CPLErr SetDefaultHistogram( double dfMin, double dfMax,
1375 int nBuckets, GUIntBig *panHistogram );
1376
1377 virtual GDALRasterAttributeTable *GetDefaultRAT();
1378 virtual CPLErr SetDefaultRAT( const GDALRasterAttributeTable * poRAT );
1379
1380 virtual GDALRasterBand *GetMaskBand();
1381 virtual int GetMaskFlags();
1382 virtual CPLErr CreateMaskBand( int nFlagsIn );
1383 virtual bool IsMaskBand() const;
1384 virtual GDALMaskValueRange GetMaskValueRange() const;
1385
1386 virtual CPLVirtualMem *GetVirtualMemAuto( GDALRWFlag eRWFlag,
1387 int *pnPixelSpace,
1388 GIntBig *pnLineSpace,
1389 char **papszOptions ) CPL_WARN_UNUSED_RESULT;
1390
1391 int GetDataCoverageStatus( int nXOff, int nYOff,
1392 int nXSize, int nYSize,
1393 int nMaskFlagStop = 0,
1394 double* pdfDataPct = nullptr );
1395
1396 std::shared_ptr<GDALMDArray> AsMDArray() const;
1397
1398#ifndef DOXYGEN_XML
1399 void ReportError(CPLErr eErrClass, CPLErrorNum err_no, const char *fmt, ...) CPL_PRINT_FUNC_FORMAT (4, 5);
1400#endif
1401
1406 { return static_cast<GDALRasterBandH>(poBand); }
1407
1412 { return static_cast<GDALRasterBand*>(hBand); }
1413
1414private:
1416};
1417
1419/* ******************************************************************** */
1420/* GDALAllValidMaskBand */
1421/* ******************************************************************** */
1422
1423class CPL_DLL GDALAllValidMaskBand : public GDALRasterBand
1424{
1425 protected:
1426 CPLErr IReadBlock( int, int, void * ) override;
1427
1428 CPL_DISALLOW_COPY_ASSIGN(GDALAllValidMaskBand)
1429
1430 public:
1431 explicit GDALAllValidMaskBand( GDALRasterBand * );
1432 ~GDALAllValidMaskBand() override;
1433
1434 GDALRasterBand *GetMaskBand() override;
1435 int GetMaskFlags() override;
1436
1437 bool IsMaskBand() const override { return true; }
1438 GDALMaskValueRange GetMaskValueRange() const override { return GMVR_0_AND_255_ONLY; }
1439
1440 CPLErr ComputeStatistics( int bApproxOK,
1441 double *pdfMin, double *pdfMax,
1442 double *pdfMean, double *pdfStdDev,
1443 GDALProgressFunc, void *pProgressData ) override;
1444
1445};
1446
1447/* ******************************************************************** */
1448/* GDALNoDataMaskBand */
1449/* ******************************************************************** */
1450
1451class CPL_DLL GDALNoDataMaskBand : public GDALRasterBand
1452{
1453 friend class GDALRasterBand;
1454 double dfNoDataValue = 0;
1455 int64_t nNoDataValueInt64 = 0;
1456 uint64_t nNoDataValueUInt64 = 0;
1457 GDALRasterBand *poParent;
1458
1459 CPL_DISALLOW_COPY_ASSIGN(GDALNoDataMaskBand)
1460
1461 protected:
1462 CPLErr IReadBlock( int, int, void * ) override;
1463 CPLErr IRasterIO( GDALRWFlag, int, int, int, int,
1464 void *, int, int, GDALDataType,
1465 GSpacing, GSpacing, GDALRasterIOExtraArg* psExtraArg ) override;
1466
1467 public:
1468 explicit GDALNoDataMaskBand( GDALRasterBand * );
1469 ~GDALNoDataMaskBand() override;
1470
1471 bool IsMaskBand() const override { return true; }
1472 GDALMaskValueRange GetMaskValueRange() const override { return GMVR_0_AND_255_ONLY; }
1473
1474 static bool IsNoDataInRange(double dfNoDataValue,
1475 GDALDataType eDataType);
1476};
1477
1478/* ******************************************************************** */
1479/* GDALNoDataValuesMaskBand */
1480/* ******************************************************************** */
1481
1482class CPL_DLL GDALNoDataValuesMaskBand : public GDALRasterBand
1483{
1484 double *padfNodataValues;
1485
1486 CPL_DISALLOW_COPY_ASSIGN(GDALNoDataValuesMaskBand)
1487
1488 protected:
1489 CPLErr IReadBlock( int, int, void * ) override;
1490
1491 public:
1492 explicit GDALNoDataValuesMaskBand( GDALDataset * );
1493 ~GDALNoDataValuesMaskBand() override;
1494
1495 bool IsMaskBand() const override { return true; }
1496 GDALMaskValueRange GetMaskValueRange() const override { return GMVR_0_AND_255_ONLY; }
1497};
1498
1499/* ******************************************************************** */
1500/* GDALRescaledAlphaBand */
1501/* ******************************************************************** */
1502
1503class GDALRescaledAlphaBand : public GDALRasterBand
1504{
1505 GDALRasterBand *poParent;
1506 void *pTemp;
1507
1508 CPL_DISALLOW_COPY_ASSIGN(GDALRescaledAlphaBand)
1509
1510 protected:
1511 CPLErr IReadBlock( int, int, void * ) override;
1512 CPLErr IRasterIO( GDALRWFlag, int, int, int, int,
1513 void *, int, int, GDALDataType,
1515 GDALRasterIOExtraArg* psExtraArg ) override;
1516
1517 public:
1518 explicit GDALRescaledAlphaBand( GDALRasterBand * );
1519 ~GDALRescaledAlphaBand() override;
1520
1521 bool IsMaskBand() const override { return true; }
1522};
1524
1525/* ******************************************************************** */
1526/* GDALIdentifyEnum */
1527/* ******************************************************************** */
1528
1534typedef enum
1535{
1543
1544/* ******************************************************************** */
1545/* GDALDriver */
1546/* ******************************************************************** */
1547
1559class CPL_DLL GDALDriver : public GDALMajorObject
1560{
1561 public:
1562 GDALDriver();
1563 ~GDALDriver() override;
1564
1565 CPLErr SetMetadataItem( const char * pszName,
1566 const char * pszValue,
1567 const char * pszDomain = "" ) override;
1568
1569/* -------------------------------------------------------------------- */
1570/* Public C++ methods. */
1571/* -------------------------------------------------------------------- */
1572 GDALDataset *Create( const char * pszName,
1573 int nXSize, int nYSize, int nBands,
1574 GDALDataType eType, CSLConstList papszOptions ) CPL_WARN_UNUSED_RESULT;
1575
1576 GDALDataset *CreateMultiDimensional( const char * pszName,
1577 CSLConstList papszRootGroupOptions,
1578 CSLConstList papszOptions ) CPL_WARN_UNUSED_RESULT;
1579
1580 CPLErr Delete( const char * pszName );
1581 CPLErr Rename( const char * pszNewName,
1582 const char * pszOldName );
1583 CPLErr CopyFiles( const char * pszNewName,
1584 const char * pszOldName );
1585
1586 GDALDataset *CreateCopy( const char *, GDALDataset *,
1587 int, CSLConstList papszOptions,
1588 GDALProgressFunc pfnProgress,
1589 void * pProgressData ) CPL_WARN_UNUSED_RESULT;
1590
1591/* -------------------------------------------------------------------- */
1592/* The following are semiprivate, not intended to be accessed */
1593/* by anyone but the formats instantiating and populating the */
1594/* drivers. */
1595/* -------------------------------------------------------------------- */
1597 GDALDataset *(*pfnOpen)( GDALOpenInfo * );
1598
1599 GDALDataset *(*pfnCreate)( const char * pszName,
1600 int nXSize, int nYSize, int nBands,
1601 GDALDataType eType,
1602 char ** papszOptions );
1603
1604 GDALDataset *(*pfnCreateEx)( GDALDriver*, const char * pszName,
1605 int nXSize, int nYSize, int nBands,
1606 GDALDataType eType,
1607 char ** papszOptions );
1608
1609 GDALDataset *(*pfnCreateMultiDimensional)( const char * pszName,
1610 CSLConstList papszRootGroupOptions,
1611 CSLConstList papszOptions );
1612
1613 CPLErr (*pfnDelete)( const char * pszName );
1614
1615 GDALDataset *(*pfnCreateCopy)( const char *, GDALDataset *,
1616 int, char **,
1617 GDALProgressFunc pfnProgress,
1618 void * pProgressData );
1619
1620 void *pDriverData;
1621
1622 void (*pfnUnloadDriver)(GDALDriver *);
1623
1631 int (*pfnIdentify)( GDALOpenInfo * );
1632 int (*pfnIdentifyEx)( GDALDriver*, GDALOpenInfo * );
1633
1634 CPLErr (*pfnRename)( const char * pszNewName,
1635 const char * pszOldName );
1636 CPLErr (*pfnCopyFiles)( const char * pszNewName,
1637 const char * pszOldName );
1638
1639 // Used for legacy OGR drivers, and Python drivers
1640 GDALDataset *(*pfnOpenWithDriverArg)( GDALDriver*, GDALOpenInfo * );
1641
1642 /* For legacy OGR drivers */
1643 GDALDataset *(*pfnCreateVectorOnly)( GDALDriver*,
1644 const char * pszName,
1645 char ** papszOptions );
1646 CPLErr (*pfnDeleteDataSource)( GDALDriver*,
1647 const char * pszName );
1649
1650/* -------------------------------------------------------------------- */
1651/* Helper methods. */
1652/* -------------------------------------------------------------------- */
1654 GDALDataset *DefaultCreateCopy( const char *, GDALDataset *,
1655 int, CSLConstList papszOptions,
1656 GDALProgressFunc pfnProgress,
1657 void * pProgressData ) CPL_WARN_UNUSED_RESULT;
1658
1659 static CPLErr DefaultCreateCopyMultiDimensional(
1660 GDALDataset *poSrcDS,
1661 GDALDataset *poDstDS,
1662 bool bStrict,
1663 CSLConstList /*papszOptions*/,
1664 GDALProgressFunc pfnProgress,
1665 void * pProgressData );
1666
1667 static CPLErr DefaultCopyMasks( GDALDataset *poSrcDS,
1668 GDALDataset *poDstDS,
1669 int bStrict );
1670 static CPLErr DefaultCopyMasks( GDALDataset *poSrcDS,
1671 GDALDataset *poDstDS,
1672 int bStrict,
1673 CSLConstList papszOptions,
1674 GDALProgressFunc pfnProgress,
1675 void * pProgressData );
1677 static CPLErr QuietDelete( const char * pszName,
1678 CSLConstList papszAllowedDrivers = nullptr);
1679
1681 static CPLErr DefaultRename( const char * pszNewName,
1682 const char * pszOldName );
1683 static CPLErr DefaultCopyFiles( const char * pszNewName,
1684 const char * pszOldName );
1686
1690 static inline GDALDriverH ToHandle(GDALDriver* poDriver)
1691 { return static_cast<GDALDriverH>(poDriver); }
1692
1696 static inline GDALDriver* FromHandle(GDALDriverH hDriver)
1697 { return static_cast<GDALDriver*>(hDriver); }
1698
1699private:
1701};
1702
1703/* ******************************************************************** */
1704/* GDALDriverManager */
1705/* ******************************************************************** */
1706
1715{
1716 int nDrivers = 0;
1717 GDALDriver **papoDrivers = nullptr;
1718 std::map<CPLString, GDALDriver*> oMapNameToDrivers{};
1719 std::string m_osDriversIniPath{};
1720
1721 GDALDriver *GetDriver_unlocked( int iDriver )
1722 { return (iDriver >= 0 && iDriver < nDrivers) ?
1723 papoDrivers[iDriver] : nullptr; }
1724
1725 GDALDriver *GetDriverByName_unlocked( const char * pszName ) const
1726 { auto oIter = oMapNameToDrivers.find(CPLString(pszName).toupper());
1727 return oIter == oMapNameToDrivers.end() ? nullptr : oIter->second;
1728 }
1729
1730 static char** GetSearchPaths(const char* pszGDAL_DRIVER_PATH);
1731
1732 static void CleanupPythonDrivers();
1733
1735
1736 public:
1739
1740 int GetDriverCount( void ) const;
1741 GDALDriver *GetDriver( int );
1742 GDALDriver *GetDriverByName( const char * );
1743
1744 int RegisterDriver( GDALDriver * );
1745 void DeregisterDriver( GDALDriver * );
1746
1747 // AutoLoadDrivers is a no-op if compiled with GDAL_NO_AUTOLOAD defined.
1748 void AutoLoadDrivers();
1749 void AutoSkipDrivers();
1750 void ReorderDrivers();
1751
1752 static void AutoLoadPythonDrivers();
1753};
1754
1756GDALDriverManager CPL_DLL * GetGDALDriverManager( void );
1758
1759/* ******************************************************************** */
1760/* GDALAsyncReader */
1761/* ******************************************************************** */
1762
1768class CPL_DLL GDALAsyncReader
1769{
1770
1772
1773 protected:
1775 GDALDataset* poDS;
1776 int nXOff;
1777 int nYOff;
1778 int nXSize;
1779 int nYSize;
1780 void * pBuf;
1781 int nBufXSize;
1782 int nBufYSize;
1783 GDALDataType eBufType;
1784 int nBandCount;
1785 int* panBandMap;
1786 int nPixelSpace;
1787 int nLineSpace;
1788 int nBandSpace;
1790
1791 public:
1793 virtual ~GDALAsyncReader();
1794
1798 GDALDataset* GetGDALDataset() {return poDS;}
1802 int GetXOffset() const { return nXOff; }
1806 int GetYOffset() const { return nYOff; }
1810 int GetXSize() const { return nXSize; }
1814 int GetYSize() const { return nYSize; }
1818 void * GetBuffer() {return pBuf;}
1822 int GetBufferXSize() const { return nBufXSize; }
1826 int GetBufferYSize() const { return nBufYSize; }
1830 GDALDataType GetBufferType() const { return eBufType; }
1834 int GetBandCount() const { return nBandCount; }
1838 int* GetBandMap() { return panBandMap; }
1842 int GetPixelSpace() const { return nPixelSpace; }
1846 int GetLineSpace() const { return nLineSpace; }
1850 int GetBandSpace() const { return nBandSpace; }
1851
1852 virtual GDALAsyncStatusType
1853 GetNextUpdatedRegion(double dfTimeout,
1854 int* pnBufXOff, int* pnBufYOff,
1855 int* pnBufXSize, int* pnBufYSize) = 0;
1856 virtual int LockBuffer( double dfTimeout = -1.0 );
1857 virtual void UnlockBuffer();
1858};
1859
1860/* ******************************************************************** */
1861/* Multidimensional array API */
1862/* ******************************************************************** */
1863
1864class GDALMDArray;
1865class GDALAttribute;
1866class GDALDimension;
1867class GDALEDTComponent;
1868
1869/* ******************************************************************** */
1870/* GDALExtendedDataType */
1871/* ******************************************************************** */
1872
1881{
1882public:
1884
1886
1888
1889 static GDALExtendedDataType Create(GDALDataType eType);
1890 static GDALExtendedDataType Create(const std::string& osName,
1891 size_t nTotalSize,
1892 std::vector<std::unique_ptr<GDALEDTComponent>>&& components);
1893 static GDALExtendedDataType CreateString(size_t nMaxStringLength = 0,
1895
1896 bool operator== (const GDALExtendedDataType& ) const;
1898 bool operator!= (const GDALExtendedDataType& other) const { return !(operator==(other)); }
1899
1904 const std::string& GetName() const { return m_osName; }
1905
1910 GDALExtendedDataTypeClass GetClass() const { return m_eClass; }
1911
1916 GDALDataType GetNumericDataType() const { return m_eNumericDT; }
1917
1924 GDALExtendedDataTypeSubType GetSubType() const { return m_eSubType; }
1925
1930 const std::vector<std::unique_ptr<GDALEDTComponent>>& GetComponents() const { return m_aoComponents; }
1931
1938 size_t GetSize() const { return m_nSize; }
1939
1944 size_t GetMaxStringLength() const { return m_nMaxStringLength; }
1945
1946 bool CanConvertTo(const GDALExtendedDataType& other) const;
1947
1948 bool NeedsFreeDynamicMemory() const;
1949
1950 void FreeDynamicMemory(void* pBuffer) const;
1951
1952 static
1953 bool CopyValue(const void* pSrc, const GDALExtendedDataType& srcType,
1954 void* pDst, const GDALExtendedDataType& dstType);
1955
1956 static
1957 bool CopyValues(const void* pSrc, const GDALExtendedDataType& srcType,
1958 GPtrDiff_t nSrcStrideInElts,
1959 void* pDst, const GDALExtendedDataType& dstType,
1960 GPtrDiff_t nDstStrideInElts,
1961 size_t nValues);
1962
1963private:
1964 GDALExtendedDataType(size_t nMaxStringLength, GDALExtendedDataTypeSubType eSubType);
1965 explicit GDALExtendedDataType(GDALDataType eType);
1966 GDALExtendedDataType(const std::string& osName,
1967 size_t nTotalSize,
1968 std::vector<std::unique_ptr<GDALEDTComponent>>&& components);
1969
1970 std::string m_osName{};
1973 GDALDataType m_eNumericDT = GDT_Unknown;
1974 std::vector<std::unique_ptr<GDALEDTComponent>> m_aoComponents{};
1975 size_t m_nSize = 0;
1976 size_t m_nMaxStringLength = 0;
1977};
1978
1979/* ******************************************************************** */
1980/* GDALEDTComponent */
1981/* ******************************************************************** */
1982
1988class CPL_DLL GDALEDTComponent
1989{
1990public:
1992 GDALEDTComponent(const std::string& name, size_t offset, const GDALExtendedDataType& type);
1994
1995 bool operator== (const GDALEDTComponent& ) const;
1996
2001 const std::string& GetName() const { return m_osName; }
2002
2007 size_t GetOffset() const { return m_nOffset; }
2008
2013 const GDALExtendedDataType& GetType() const { return m_oType; }
2014
2015private:
2016 std::string m_osName;
2017 size_t m_nOffset;
2018 GDALExtendedDataType m_oType;
2019};
2020
2021/* ******************************************************************** */
2022/* GDALIHasAttribute */
2023/* ******************************************************************** */
2024
2031{
2032protected:
2033 std::shared_ptr<GDALAttribute> GetAttributeFromAttributes(const std::string& osName) const;
2034
2035public:
2036 virtual ~GDALIHasAttribute();
2037
2038 virtual std::shared_ptr<GDALAttribute> GetAttribute(const std::string& osName) const;
2039
2040 virtual std::vector<std::shared_ptr<GDALAttribute>> GetAttributes(CSLConstList papszOptions = nullptr) const;
2041
2042 virtual std::shared_ptr<GDALAttribute> CreateAttribute(
2043 const std::string& osName,
2044 const std::vector<GUInt64>& anDimensions,
2045 const GDALExtendedDataType& oDataType,
2046 CSLConstList papszOptions = nullptr);
2047};
2048
2049/* ******************************************************************** */
2050/* GDALGroup */
2051/* ******************************************************************** */
2052
2061class CPL_DLL GDALGroup: public GDALIHasAttribute
2062{
2063protected:
2065 std::string m_osName{};
2066 std::string m_osFullName{};
2067
2068 GDALGroup(const std::string& osParentName, const std::string& osName);
2069
2070 const GDALGroup* GetInnerMostGroup(const std::string& osPathOrArrayOrDim,
2071 std::shared_ptr<GDALGroup>& curGroupHolder,
2072 std::string& osLastPart) const;
2074
2075public:
2076 virtual ~GDALGroup();
2077
2082 const std::string& GetName() const { return m_osName; }
2083
2088 const std::string& GetFullName() const { return m_osFullName; }
2089
2090 virtual std::vector<std::string> GetMDArrayNames(CSLConstList papszOptions = nullptr) const;
2091 virtual std::shared_ptr<GDALMDArray> OpenMDArray(const std::string& osName,
2092 CSLConstList papszOptions = nullptr) const;
2093
2094 virtual std::vector<std::string> GetGroupNames(CSLConstList papszOptions = nullptr) const;
2095 virtual std::shared_ptr<GDALGroup> OpenGroup(const std::string& osName,
2096 CSLConstList papszOptions = nullptr) const;
2097
2098 virtual std::vector<std::string> GetVectorLayerNames(CSLConstList papszOptions = nullptr) const;
2099 virtual OGRLayer* OpenVectorLayer(const std::string& osName,
2100 CSLConstList papszOptions = nullptr) const;
2101
2102 virtual std::vector<std::shared_ptr<GDALDimension>> GetDimensions(CSLConstList papszOptions = nullptr) const;
2103
2104 virtual std::shared_ptr<GDALGroup> CreateGroup(const std::string& osName,
2105 CSLConstList papszOptions = nullptr);
2106
2107 virtual std::shared_ptr<GDALDimension> CreateDimension(const std::string& osName,
2108 const std::string& osType,
2109 const std::string& osDirection,
2110 GUInt64 nSize,
2111 CSLConstList papszOptions = nullptr);
2112
2113 virtual std::shared_ptr<GDALMDArray> CreateMDArray(const std::string& osName,
2114 const std::vector<std::shared_ptr<GDALDimension>>& aoDimensions,
2115 const GDALExtendedDataType& oDataType,
2116 CSLConstList papszOptions = nullptr);
2117
2118 GUInt64 GetTotalCopyCost() const;
2119
2120 virtual bool CopyFrom(const std::shared_ptr<GDALGroup>& poDstRootGroup,
2121 GDALDataset* poSrcDS,
2122 const std::shared_ptr<GDALGroup>& poSrcGroup,
2123 bool bStrict,
2124 GUInt64& nCurCost,
2125 const GUInt64 nTotalCost,
2126 GDALProgressFunc pfnProgress,
2127 void * pProgressData,
2128 CSLConstList papszOptions = nullptr);
2129
2130 virtual CSLConstList GetStructuralInfo() const;
2131
2132 std::shared_ptr<GDALMDArray> OpenMDArrayFromFullname(
2133 const std::string& osFullName,
2134 CSLConstList papszOptions = nullptr) const;
2135
2136 std::shared_ptr<GDALMDArray> ResolveMDArray(const std::string& osName,
2137 const std::string& osStartingPath,
2138 CSLConstList papszOptions = nullptr) const;
2139
2140 std::shared_ptr<GDALGroup> OpenGroupFromFullname(
2141 const std::string& osFullName,
2142 CSLConstList papszOptions = nullptr) const;
2143
2144 std::shared_ptr<GDALDimension> OpenDimensionFromFullname(
2145 const std::string& osFullName) const;
2146
2147 virtual void ClearStatistics();
2148
2150 static constexpr GUInt64 COPY_COST = 1000;
2152};
2153
2154/* ******************************************************************** */
2155/* GDALAbstractMDArray */
2156/* ******************************************************************** */
2157
2164{
2165protected:
2167 std::string m_osName{};
2168 std::string m_osFullName{};
2169 std::weak_ptr<GDALAbstractMDArray> m_pSelf{};
2170
2171 GDALAbstractMDArray(const std::string& osParentName, const std::string& osName);
2172
2173 void SetSelf(std::weak_ptr<GDALAbstractMDArray> self) { m_pSelf = self; }
2174
2175 bool CheckReadWriteParams(const GUInt64* arrayStartIdx,
2176 const size_t* count,
2177 const GInt64*& arrayStep,
2178 const GPtrDiff_t*& bufferStride,
2179 const GDALExtendedDataType& bufferDataType,
2180 const void* buffer,
2181 const void* buffer_alloc_start,
2182 size_t buffer_alloc_size,
2183 std::vector<GInt64>& tmp_arrayStep,
2184 std::vector<GPtrDiff_t>& tmp_bufferStride) const;
2185
2186 virtual bool IRead(const GUInt64* arrayStartIdx, // array of size GetDimensionCount()
2187 const size_t* count, // array of size GetDimensionCount()
2188 const GInt64* arrayStep, // step in elements
2189 const GPtrDiff_t* bufferStride, // stride in elements
2190 const GDALExtendedDataType& bufferDataType,
2191 void* pDstBuffer) const = 0;
2192
2193 virtual bool IWrite(const GUInt64* arrayStartIdx, // array of size GetDimensionCount()
2194 const size_t* count, // array of size GetDimensionCount()
2195 const GInt64* arrayStep, // step in elements
2196 const GPtrDiff_t* bufferStride, // stride in elements
2197 const GDALExtendedDataType& bufferDataType,
2198 const void* pSrcBuffer);
2200
2201public:
2202 virtual ~GDALAbstractMDArray();
2203
2208 const std::string& GetName() const{ return m_osName; }
2209
2214 const std::string& GetFullName() const{ return m_osFullName; }
2215
2216 GUInt64 GetTotalElementsCount() const;
2217
2218 virtual size_t GetDimensionCount() const;
2219
2220 virtual const std::vector<std::shared_ptr<GDALDimension>>& GetDimensions() const = 0;
2221
2222 virtual const GDALExtendedDataType &GetDataType() const = 0;
2223
2224 virtual std::vector<GUInt64> GetBlockSize() const;
2225
2226 virtual std::vector<size_t> GetProcessingChunkSize(size_t nMaxChunkMemory) const;
2227
2243 typedef bool (*FuncProcessPerChunkType)(
2244 GDALAbstractMDArray* array,
2245 const GUInt64* chunkArrayStartIdx,
2246 const size_t* chunkCount,
2247 GUInt64 iCurChunk,
2248 GUInt64 nChunkCount,
2249 void* pUserData);
2250
2251 virtual bool ProcessPerChunk(const GUInt64* arrayStartIdx,
2252 const GUInt64* count,
2253 const size_t* chunkSize,
2254 FuncProcessPerChunkType pfnFunc,
2255 void* pUserData);
2256
2257 virtual bool Read(const GUInt64* arrayStartIdx, // array of size GetDimensionCount()
2258 const size_t* count, // array of size GetDimensionCount()
2259 const GInt64* arrayStep, // step in elements
2260 const GPtrDiff_t* bufferStride, // stride in elements
2261 const GDALExtendedDataType& bufferDataType,
2262 void* pDstBuffer,
2263 const void* pDstBufferAllocStart = nullptr,
2264 size_t nDstBufferAllocSize = 0) const;
2265
2266 bool Write(const GUInt64* arrayStartIdx, // array of size GetDimensionCount()
2267 const size_t* count, // array of size GetDimensionCount()
2268 const GInt64* arrayStep, // step in elements
2269 const GPtrDiff_t* bufferStride, // stride in elements
2270 const GDALExtendedDataType& bufferDataType,
2271 const void* pSrcBuffer,
2272 const void* pSrcBufferAllocStart = nullptr,
2273 size_t nSrcBufferAllocSize = 0);
2274};
2275
2276/* ******************************************************************** */
2277/* GDALRawResult */
2278/* ******************************************************************** */
2279
2286class CPL_DLL GDALRawResult
2287{
2288private:
2290 size_t m_nEltCount;
2291 size_t m_nSize;
2292 GByte* m_raw;
2293
2294 void FreeMe();
2295
2296 GDALRawResult(const GDALRawResult&) = delete;
2297 GDALRawResult& operator=(const GDALRawResult&) = delete;
2298
2299protected:
2300 friend class GDALAttribute;
2302 GDALRawResult(GByte* raw,
2303 const GDALExtendedDataType& dt,
2304 size_t nEltCount);
2306
2307public:
2310 GDALRawResult& operator=(GDALRawResult&&);
2311
2313 const GByte& operator[](size_t idx) const { return m_raw[idx]; }
2315 const GByte* data() const { return m_raw; }
2317 size_t size() const { return m_nSize; }
2318
2320 GByte* StealData();
2322};
2323
2324
2325/* ******************************************************************** */
2326/* GDALAttribute */
2327/* ******************************************************************** */
2328
2339class CPL_DLL GDALAttribute: virtual public GDALAbstractMDArray
2340{
2341 mutable std::string m_osCachedVal{};
2342
2343protected:
2345 GDALAttribute(const std::string& osParentName, const std::string& osName);
2347
2348public:
2349
2350 std::vector<GUInt64> GetDimensionsSize() const;
2351
2352 GDALRawResult ReadAsRaw() const;
2353 const char* ReadAsString() const;
2354 int ReadAsInt() const;
2355 double ReadAsDouble() const;
2356 CPLStringList ReadAsStringArray() const;
2357 std::vector<int> ReadAsIntArray() const;
2358 std::vector<double> ReadAsDoubleArray() const;
2359
2361 bool Write(const void* pabyValue, size_t nLen);
2362 bool Write(const char*);
2363 bool WriteInt(int);
2364 bool Write(double);
2365 bool Write(CSLConstList);
2366 bool Write(const double*, size_t);
2367
2369 static constexpr GUInt64 COPY_COST = 100;
2371
2372};
2373
2374/************************************************************************/
2375/* GDALAttributeString */
2376/************************************************************************/
2377
2379class CPL_DLL GDALAttributeString final: public GDALAttribute
2380{
2381 std::vector<std::shared_ptr<GDALDimension>> m_dims{};
2383 std::string m_osValue;
2384
2385protected:
2386
2387 bool IRead(const GUInt64* ,
2388 const size_t* ,
2389 const GInt64* ,
2390 const GPtrDiff_t* ,
2391 const GDALExtendedDataType& bufferDataType,
2392 void* pDstBuffer) const override;
2393
2394public:
2395 GDALAttributeString(const std::string& osParentName,
2396 const std::string& osName,
2397 const std::string& osValue,
2399
2400 const std::vector<std::shared_ptr<GDALDimension>>& GetDimensions() const override;
2401
2402 const GDALExtendedDataType &GetDataType() const override;
2403};
2405
2406/************************************************************************/
2407/* GDALAttributeNumeric */
2408/************************************************************************/
2409
2411class CPL_DLL GDALAttributeNumeric final: public GDALAttribute
2412{
2413 std::vector<std::shared_ptr<GDALDimension>> m_dims{};
2415 int m_nValue = 0;
2416 double m_dfValue = 0;
2417 std::vector<GUInt32> m_anValuesUInt32{};
2418
2419protected:
2420
2421 bool IRead(const GUInt64* ,
2422 const size_t* ,
2423 const GInt64* ,
2424 const GPtrDiff_t* ,
2425 const GDALExtendedDataType& bufferDataType,
2426 void* pDstBuffer) const override;
2427
2428public:
2429 GDALAttributeNumeric(const std::string& osParentName,
2430 const std::string& osName,
2431 double dfValue);
2432 GDALAttributeNumeric(const std::string& osParentName,
2433 const std::string& osName,
2434 int nValue);
2435 GDALAttributeNumeric(const std::string& osParentName,
2436 const std::string& osName,
2437 const std::vector<GUInt32>& anValues);
2438
2439 const std::vector<std::shared_ptr<GDALDimension>>& GetDimensions() const override;
2440
2441 const GDALExtendedDataType &GetDataType() const override;
2442};
2444
2445/* ******************************************************************** */
2446/* GDALMDArray */
2447/* ******************************************************************** */
2448
2457class CPL_DLL GDALMDArray: virtual public GDALAbstractMDArray, public GDALIHasAttribute
2458{
2459 friend class GDALMDArrayResampled;
2460 std::shared_ptr<GDALMDArray> GetView(const std::vector<GUInt64>& indices) const;
2461
2462 inline std::shared_ptr<GDALMDArray> atInternal(std::vector<GUInt64>& indices) const
2463 {
2464 return GetView(indices);
2465 }
2466
2467 template<typename... GUInt64VarArg>
2468 // cppcheck-suppress functionStatic
2469 inline std::shared_ptr<GDALMDArray> atInternal(std::vector<GUInt64>& indices,
2470 GUInt64 idx, GUInt64VarArg... tail) const
2471 {
2472 indices.push_back(idx);
2473 return atInternal(indices, tail...);
2474 }
2475
2476 mutable bool m_bHasTriedCachedArray = false;
2477 mutable std::shared_ptr<GDALMDArray> m_poCachedArray{};
2478
2479protected:
2481 GDALMDArray(const std::string& osParentName, const std::string& osName);
2482
2483 virtual bool IAdviseRead(const GUInt64* arrayStartIdx,
2484 const size_t* count,
2485 CSLConstList papszOptions) const;
2486
2487 virtual bool IsCacheable() const { return true; }
2488
2489 virtual bool SetStatistics( bool bApproxStats,
2490 double dfMin, double dfMax,
2491 double dfMean, double dfStdDev,
2492 GUInt64 nValidCount );
2493
2494 static std::string MassageName(const std::string& inputName);
2495
2496 std::shared_ptr<GDALGroup> GetCacheRootGroup(bool bCanCreate,
2497 std::string& osCacheFilenameOut) const;
2498
2499 // Returns if bufferStride values express a transposed view of the array
2500 bool IsTransposedRequest(const size_t* count,
2501 const GPtrDiff_t* bufferStride) const;
2502
2503 // Should only be called if IsTransposedRequest() returns true
2504 bool ReadForTransposedRequest(const GUInt64* arrayStartIdx,
2505 const size_t* count,
2506 const GInt64* arrayStep,
2507 const GPtrDiff_t* bufferStride,
2508 const GDALExtendedDataType& bufferDataType,
2509 void* pDstBuffer) const;
2511
2512public:
2513
2514 GUInt64 GetTotalCopyCost() const;
2515
2516 virtual bool CopyFrom(GDALDataset* poSrcDS,
2517 const GDALMDArray* poSrcArray,
2518 bool bStrict,
2519 GUInt64& nCurCost,
2520 const GUInt64 nTotalCost,
2521 GDALProgressFunc pfnProgress,
2522 void * pProgressData);
2523
2525 virtual bool IsWritable() const = 0;
2526
2535 virtual const std::string& GetFilename() const = 0;
2536
2537 virtual CSLConstList GetStructuralInfo() const;
2538
2539 virtual const std::string& GetUnit() const;
2540
2541 virtual bool SetUnit(const std::string& osUnit);
2542
2543 virtual bool SetSpatialRef(const OGRSpatialReference* poSRS);
2544
2545 virtual std::shared_ptr<OGRSpatialReference> GetSpatialRef() const;
2546
2547 virtual const void* GetRawNoDataValue() const;
2548
2549 double GetNoDataValueAsDouble(bool* pbHasNoData = nullptr) const;
2550
2551 int64_t GetNoDataValueAsInt64(bool* pbHasNoData = nullptr) const;
2552
2553 uint64_t GetNoDataValueAsUInt64(bool* pbHasNoData = nullptr) const;
2554
2555 virtual bool SetRawNoDataValue(const void* pRawNoData);
2556
2558 bool SetNoDataValue(int nNoData) { return SetNoDataValue(static_cast<int64_t>(nNoData)); }
2560
2561 bool SetNoDataValue(double dfNoData);
2562
2563 bool SetNoDataValue(int64_t nNoData);
2564
2565 bool SetNoDataValue(uint64_t nNoData);
2566
2567 virtual double GetOffset(bool* pbHasOffset = nullptr, GDALDataType* peStorageType = nullptr) const;
2568
2569 virtual double GetScale(bool* pbHasScale = nullptr, GDALDataType* peStorageType = nullptr) const;
2570
2571 virtual bool SetOffset(double dfOffset, GDALDataType eStorageType = GDT_Unknown);
2572
2573 virtual bool SetScale(double dfScale, GDALDataType eStorageType = GDT_Unknown);
2574
2575 std::shared_ptr<GDALMDArray> GetView(const std::string& viewExpr) const;
2576
2577 std::shared_ptr<GDALMDArray> operator[](const std::string& fieldName) const;
2578
2588 // sphinx 4.1.0 / breathe 4.30.0 don't like typename...
2590 template<typename... GUInt64VarArg>
2592 // cppcheck-suppress functionStatic
2593 std::shared_ptr<GDALMDArray> at(GUInt64 idx, GUInt64VarArg... tail) const
2594 {
2595 std::vector<GUInt64> indices;
2596 indices.push_back(idx);
2597 return atInternal(indices, tail...);
2598 }
2599
2600 virtual std::shared_ptr<GDALMDArray> Transpose(const std::vector<int>& anMapNewAxisToOldAxis) const;
2601
2602 std::shared_ptr<GDALMDArray> GetUnscaled() const;
2603
2604 virtual std::shared_ptr<GDALMDArray> GetMask(CSLConstList papszOptions) const;
2605
2606 std::shared_ptr<GDALMDArray>
2607 GetResampled( const std::vector<std::shared_ptr<GDALDimension>>& apoNewDims,
2608 GDALRIOResampleAlg resampleAlg,
2609 const OGRSpatialReference* poTargetSRS,
2610 CSLConstList papszOptions ) const;
2611
2612 virtual GDALDataset* AsClassicDataset(size_t iXDim, size_t iYDim) const;
2613
2614 virtual CPLErr GetStatistics( bool bApproxOK, bool bForce,
2615 double *pdfMin, double *pdfMax,
2616 double *pdfMean, double *padfStdDev,
2617 GUInt64* pnValidCount,
2618 GDALProgressFunc pfnProgress, void *pProgressData );
2619
2620 virtual bool ComputeStatistics( bool bApproxOK,
2621 double *pdfMin, double *pdfMax,
2622 double *pdfMean, double *pdfStdDev,
2623 GUInt64* pnValidCount,
2624 GDALProgressFunc, void *pProgressData );
2625
2626 virtual void ClearStatistics();
2627
2628 virtual std::vector<std::shared_ptr<GDALMDArray>> GetCoordinateVariables() const;
2629
2630 bool AdviseRead(const GUInt64* arrayStartIdx,
2631 const size_t* count,
2632 CSLConstList papszOptions = nullptr) const;
2633
2634 bool IsRegularlySpaced(double& dfStart, double& dfIncrement) const;
2635
2636 bool GuessGeoTransform(size_t nDimX, size_t nDimY, bool bPixelIsPoint,
2637 double adfGeoTransform[6]) const;
2638
2639 bool Cache( CSLConstList papszOptions = nullptr ) const;
2640
2641 bool Read(const GUInt64* arrayStartIdx, // array of size GetDimensionCount()
2642 const size_t* count, // array of size GetDimensionCount()
2643 const GInt64* arrayStep, // step in elements
2644 const GPtrDiff_t* bufferStride, // stride in elements
2645 const GDALExtendedDataType& bufferDataType,
2646 void* pDstBuffer,
2647 const void* pDstBufferAllocStart = nullptr,
2648 size_t nDstBufferAllocSize = 0) const override final;
2649
2651 static constexpr GUInt64 COPY_COST = 1000;
2652
2653 bool CopyFromAllExceptValues(const GDALMDArray* poSrcArray,
2654 bool bStrict,
2655 GUInt64& nCurCost,
2656 const GUInt64 nTotalCost,
2657 GDALProgressFunc pfnProgress,
2658 void * pProgressData);
2659 struct Range
2660 {
2661 GUInt64 m_nStartIdx;
2662 GInt64 m_nIncr;
2663 explicit Range(GUInt64 nStartIdx = 0, GInt64 nIncr = 0):
2664 m_nStartIdx(nStartIdx), m_nIncr(nIncr) {}
2665 };
2666
2667 struct ViewSpec
2668 {
2669 std::string m_osFieldName{};
2670
2671 // or
2672
2673 std::vector<size_t> m_mapDimIdxToParentDimIdx{}; // of size m_dims.size()
2674 std::vector<Range> m_parentRanges{} ; // of size m_poParent->GetDimensionCount()
2675 };
2676
2677 virtual std::shared_ptr<GDALMDArray> GetView(const std::string& viewExpr,
2678 bool bRenameDimensions,
2679 std::vector<ViewSpec>& viewSpecs) const;
2681};
2682
2684bool GDALMDRasterIOFromBand(GDALRasterBand* poBand,
2685 GDALRWFlag eRWFlag,
2686 size_t iDimX,
2687 size_t iDimY,
2688 const GUInt64* arrayStartIdx,
2689 const size_t* count,
2690 const GInt64* arrayStep,
2691 const GPtrDiff_t* bufferStride,
2692 const GDALExtendedDataType& bufferDataType,
2693 void* pBuffer);
2695
2696/************************************************************************/
2697/* GDALMDArrayRegularlySpaced */
2698/************************************************************************/
2699
2701class CPL_DLL GDALMDArrayRegularlySpaced: public GDALMDArray
2702{
2703 double m_dfStart;
2704 double m_dfIncrement;
2705 double m_dfOffsetInIncrement;
2707 std::vector<std::shared_ptr<GDALDimension>> m_dims;
2708 std::vector<std::shared_ptr<GDALAttribute>> m_attributes{};
2709 std::string m_osEmptyFilename{};
2710
2711protected:
2712
2713 bool IRead(const GUInt64* ,
2714 const size_t* ,
2715 const GInt64* ,
2716 const GPtrDiff_t* ,
2717 const GDALExtendedDataType& bufferDataType,
2718 void* pDstBuffer) const override;
2719
2720public:
2721 GDALMDArrayRegularlySpaced(
2722 const std::string& osParentName,
2723 const std::string& osName,
2724 const std::shared_ptr<GDALDimension>& poDim,
2725 double dfStart, double dfIncrement,
2726 double dfOffsetInIncrement);
2727
2728 static std::shared_ptr<GDALMDArrayRegularlySpaced> Create(
2729 const std::string& osParentName,
2730 const std::string& osName,
2731 const std::shared_ptr<GDALDimension>& poDim,
2732 double dfStart, double dfIncrement,
2733 double dfOffsetInIncrement);
2734
2735 bool IsWritable() const override { return false; }
2736
2737 const std::string& GetFilename() const override { return m_osEmptyFilename; }
2738
2739 const std::vector<std::shared_ptr<GDALDimension>>& GetDimensions() const override;
2740
2741 const GDALExtendedDataType &GetDataType() const override;
2742
2743 std::vector<std::shared_ptr<GDALAttribute>> GetAttributes(CSLConstList) const override;
2744
2745 void AddAttribute(const std::shared_ptr<GDALAttribute>& poAttr);
2746};
2748
2749/* ******************************************************************** */
2750/* GDALDimension */
2751/* ******************************************************************** */
2752
2764class CPL_DLL GDALDimension
2765{
2766public:
2768 GDALDimension(const std::string& osParentName,
2769 const std::string& osName,
2770 const std::string& osType,
2771 const std::string& osDirection,
2772 GUInt64 nSize);
2774
2775 virtual ~GDALDimension();
2776
2781 const std::string& GetName() const { return m_osName; }
2782
2787 const std::string& GetFullName() const { return m_osFullName; }
2788
2797 const std::string& GetType() const { return m_osType; }
2798
2807 const std::string& GetDirection() const { return m_osDirection; }
2808
2813 GUInt64 GetSize() const { return m_nSize; }
2814
2815 virtual std::shared_ptr<GDALMDArray> GetIndexingVariable() const;
2816
2817 virtual bool SetIndexingVariable(std::shared_ptr<GDALMDArray> poIndexingVariable);
2818
2819protected:
2821 std::string m_osName;
2822 std::string m_osFullName;
2823 std::string m_osType;
2824 std::string m_osDirection;
2825 GUInt64 m_nSize;
2827};
2828
2829
2830/************************************************************************/
2831/* GDALDimensionWeakIndexingVar() */
2832/************************************************************************/
2833
2835class CPL_DLL GDALDimensionWeakIndexingVar: public GDALDimension
2836{
2837 std::weak_ptr<GDALMDArray> m_poIndexingVariable{};
2838
2839public:
2840 GDALDimensionWeakIndexingVar(const std::string& osParentName,
2841 const std::string& osName,
2842 const std::string& osType,
2843 const std::string& osDirection,
2844 GUInt64 nSize);
2845
2846 std::shared_ptr<GDALMDArray> GetIndexingVariable() const override;
2847
2848 bool SetIndexingVariable(std::shared_ptr<GDALMDArray> poIndexingVariable) override;
2849};
2851
2852/************************************************************************/
2853/* GDALAntiRecursionGuard */
2854/************************************************************************/
2855
2857struct GDALAntiRecursionStruct;
2858class GDALAntiRecursionGuard
2859{
2860 GDALAntiRecursionStruct* m_psAntiRecursionStruct;
2861 std::string m_osIdentifier;
2862 int m_nDepth;
2863
2864 GDALAntiRecursionGuard(const GDALAntiRecursionGuard&) = delete;
2865 GDALAntiRecursionGuard& operator= (const GDALAntiRecursionGuard&) = delete;
2866
2867public:
2868 explicit GDALAntiRecursionGuard(const std::string& osIdentifier);
2869 GDALAntiRecursionGuard(const GDALAntiRecursionGuard& other, const std::string& osIdentifier);
2870 ~GDALAntiRecursionGuard();
2871 int GetCallDepth() const { return m_nDepth; }
2872};
2874
2875/************************************************************************/
2876/* Relationships */
2877/************************************************************************/
2878
2890class CPL_DLL GDALRelationship
2891{
2892protected:
2894 std::string m_osName{};
2895 std::string m_osLeftTableName{};
2896 std::string m_osRightTableName{};
2898 std::string m_osMappingTableName{};
2899 std::vector<std::string> m_osListLeftTableFields{};
2900 std::vector<std::string> m_osListRightTableFields{};
2901 std::vector<std::string> m_osListLeftMappingTableFields{};
2902 std::vector<std::string> m_osListRightMappingTableFields{};
2904 std::string m_osForwardPathLabel{};
2905 std::string m_osBackwardPathLabel{};
2906 std::string m_osRelatedTableType{};
2907
2910public:
2918 GDALRelationship(const std::string& osName,
2919 const std::string& osLeftTableName,
2920 const std::string& osRightTableName,
2922 : m_osName(osName), m_osLeftTableName(osLeftTableName), m_osRightTableName(osRightTableName), m_eCardinality(eCardinality)
2923 {}
2924
2926 const std::string& GetName() const { return m_osName; }
2927
2929 GDALRelationshipCardinality GetCardinality() const { return m_eCardinality; }
2930
2935 const std::string& GetLeftTableName() const { return m_osLeftTableName; }
2936
2938 const std::string& GetRightTableName() const { return m_osRightTableName; }
2939
2944 const std::string& GetMappingTableName() const { return m_osMappingTableName; }
2945
2950 void SetMappingTableName( const std::string& osName ) { m_osMappingTableName = osName; }
2951
2957 const std::vector<std::string>& GetLeftTableFields() const { return m_osListLeftTableFields; }
2958
2964 const std::vector<std::string>& GetRightTableFields() const { return m_osListRightTableFields; }
2965
2971 void SetLeftTableFields( const std::vector<std::string>& osListFields ) { m_osListLeftTableFields = osListFields; }
2972
2978 void SetRightTableFields( const std::vector<std::string>& osListFields ) { m_osListRightTableFields = osListFields; }
2979
2985 const std::vector<std::string>& GetLeftMappingTableFields() const { return m_osListLeftMappingTableFields; }
2986
2992 const std::vector<std::string>& GetRightMappingTableFields() const { return m_osListRightMappingTableFields; }
2993
2999 void SetLeftMappingTableFields( const std::vector<std::string>& osListFields ) { m_osListLeftMappingTableFields = osListFields; }
3000
3006 void SetRightMappingTableFields( const std::vector<std::string>& osListFields ) { m_osListRightMappingTableFields = osListFields; }
3007
3012 GDALRelationshipType GetType() const { return m_eType; }
3013
3018 void SetType( GDALRelationshipType eType ) { m_eType = eType; }
3019
3034 const std::string& GetForwardPathLabel() const { return m_osForwardPathLabel; }
3035
3050 void SetForwardPathLabel( const std::string& osLabel ) { m_osForwardPathLabel = osLabel; }
3051
3066 const std::string& GetBackwardPathLabel() const { return m_osBackwardPathLabel; }
3067
3082 void SetBackwardPathLabel( const std::string& osLabel ) { m_osBackwardPathLabel = osLabel; }
3083
3093 const std::string& GetRelatedTableType() const { return m_osRelatedTableType; }
3094
3104 void SetRelatedTableType( const std::string& osType ) { m_osRelatedTableType = osType; }
3105
3108 static inline GDALRelationshipH ToHandle(GDALRelationship* poRelationship)
3109 { return static_cast<GDALRelationshipH>(poRelationship); }
3110
3113 static inline GDALRelationship* FromHandle(GDALRelationshipH hRelationship)
3114 { return static_cast<GDALRelationship*>(hRelationship); }
3115};
3116
3117/* ==================================================================== */
3118/* An assortment of overview related stuff. */
3119/* ==================================================================== */
3120
3122/* Only exported for drivers as plugin. Signature may change */
3123CPLErr CPL_DLL
3124GDALRegenerateOverviewsMultiBand(int nBands, GDALRasterBand** papoSrcBands,
3125 int nOverviews,
3126 GDALRasterBand*** papapoOverviewBands,
3127 const char * pszResampling,
3128 GDALProgressFunc pfnProgress, void * pProgressData );
3129
3130typedef CPLErr (*GDALResampleFunction)
3131 ( double dfXRatioDstToSrc,
3132 double dfYRatioDstToSrc,
3133 double dfSrcXDelta,
3134 double dfSrcYDelta,
3135 GDALDataType eWrkDataType,
3136 const void * pChunk,
3137 const GByte * pabyChunkNodataMask,
3138 int nChunkXOff, int nChunkXSize,
3139 int nChunkYOff, int nChunkYSize,
3140 int nDstXOff, int nDstXOff2,
3141 int nDstYOff, int nDstYOff2,
3142 GDALRasterBand * poOverview,
3143 void** ppDstBuffer,
3144 GDALDataType* peDstBufferDataType,
3145 const char * pszResampling,
3146 int bHasNoData, float fNoDataValue,
3147 GDALColorTable* poColorTable,
3148 GDALDataType eSrcDataType,
3149 bool bPropagateNoData );
3150
3151GDALResampleFunction GDALGetResampleFunction(const char* pszResampling,
3152 int* pnRadius);
3153
3154GDALDataType GDALGetOvrWorkDataType(const char* pszResampling,
3155 GDALDataType eSrcDataType);
3156
3158
3159CPLErr CPL_DLL
3160HFAAuxBuildOverviews( const char *pszOvrFilename, GDALDataset *poParentDS,
3161 GDALDataset **ppoDS,
3162 int nBands, int *panBandList,
3163 int nNewOverviews, int *panNewOverviewList,
3164 const char *pszResampling,
3165 GDALProgressFunc pfnProgress,
3166 void *pProgressData );
3167
3168CPLErr CPL_DLL
3169GTIFFBuildOverviews( const char * pszFilename,
3170 int nBands, GDALRasterBand **papoBandList,
3171 int nOverviews, int * panOverviewList,
3172 const char * pszResampling,
3173 GDALProgressFunc pfnProgress, void * pProgressData );
3174
3175int CPL_DLL GDALBandGetBestOverviewLevel(GDALRasterBand* poBand,
3176 int &nXOff, int &nYOff,
3177 int &nXSize, int &nYSize,
3178 int nBufXSize, int nBufYSize) CPL_WARN_DEPRECATED("Use GDALBandGetBestOverviewLevel2 instead");
3179int CPL_DLL GDALBandGetBestOverviewLevel2(GDALRasterBand* poBand,
3180 int &nXOff, int &nYOff,
3181 int &nXSize, int &nYSize,
3182 int nBufXSize, int nBufYSize,
3183 GDALRasterIOExtraArg* psExtraArg);
3184
3185int CPL_DLL GDALOvLevelAdjust( int nOvLevel, int nXSize ) CPL_WARN_DEPRECATED("Use GDALOvLevelAdjust2 instead");
3186int CPL_DLL GDALOvLevelAdjust2( int nOvLevel, int nXSize, int nYSize );
3187int CPL_DLL GDALComputeOvFactor( int nOvrXSize, int nRasterXSize,
3188 int nOvrYSize, int nRasterYSize );
3189
3190GDALDataset CPL_DLL *
3191GDALFindAssociatedAuxFile( const char *pszBasefile, GDALAccess eAccess,
3192 GDALDataset *poDependentDS );
3193
3194/* ==================================================================== */
3195/* Infrastructure to check that dataset characteristics are valid */
3196/* ==================================================================== */
3197
3198int CPL_DLL GDALCheckDatasetDimensions( int nXSize, int nYSize );
3199int CPL_DLL GDALCheckBandCount( int nBands, int bIsZeroAllowed );
3200
3201/* Internal use only */
3202
3203/* CPL_DLL exported, but only for in-tree drivers that can be built as plugins */
3204int CPL_DLL GDALReadWorldFile2( const char *pszBaseFilename, const char *pszExtension,
3205 double *padfGeoTransform, char** papszSiblingFiles,
3206 char** ppszWorldFileNameOut);
3207int GDALReadTabFile2( const char * pszBaseFilename,
3208 double *padfGeoTransform, char **ppszWKT,
3209 int *pnGCPCount, GDAL_GCP **ppasGCPs,
3210 char** papszSiblingFiles, char** ppszTabFileNameOut );
3211
3212void CPL_DLL GDALCopyRasterIOExtraArg(GDALRasterIOExtraArg* psDestArg,
3213 GDALRasterIOExtraArg* psSrcArg);
3214
3216
3217void GDALNullifyOpenDatasetsList();
3218CPLMutex** GDALGetphDMMutex();
3219CPLMutex** GDALGetphDLMutex();
3220void GDALNullifyProxyPoolSingleton();
3221void GDALSetResponsiblePIDForCurrentThread(GIntBig responsiblePID);
3222GIntBig GDALGetResponsiblePIDForCurrentThread();
3223
3224CPLString GDALFindAssociatedFile( const char *pszBasename, const char *pszExt,
3225 CSLConstList papszSiblingFiles, int nFlags );
3226
3227CPLErr CPL_DLL EXIFExtractMetadata(char**& papszMetadata,
3228 void *fpL, int nOffset,
3229 int bSwabflag, int nTIFFHEADER,
3230 int& nExifOffset, int& nInterOffset, int& nGPSOffset);
3231
3232int GDALValidateOpenOptions( GDALDriverH hDriver,
3233 const char* const* papszOptionOptions);
3234int GDALValidateOptions( const char* pszOptionList,
3235 const char* const* papszOptionsToValidate,
3236 const char* pszErrorMessageOptionType,
3237 const char* pszErrorMessageContainerName);
3238
3239GDALRIOResampleAlg GDALRasterIOGetResampleAlg(const char* pszResampling);
3240const char* GDALRasterIOGetResampleAlg(GDALRIOResampleAlg eResampleAlg);
3241
3242void GDALRasterIOExtraArgSetResampleAlg(GDALRasterIOExtraArg* psExtraArg,
3243 int nXSize, int nYSize,
3244 int nBufXSize, int nBufYSize);
3245
3246
3247GDALDataset* GDALCreateOverviewDataset(GDALDataset* poDS, int nOvrLevel,
3248 bool bThisLevelOnly);
3249
3250// Should cover particular cases of #3573, #4183, #4506, #6578
3251// Behavior is undefined if fVal1 or fVal2 are NaN (should be tested before
3252// calling this function)
3253template<class T> inline bool ARE_REAL_EQUAL(T fVal1, T fVal2, int ulp = 2)
3254{
3255 return fVal1 == fVal2 || /* Should cover infinity */
3256 std::abs(fVal1 - fVal2) < std::numeric_limits<float>::epsilon() * std::abs(fVal1+fVal2) * ulp;
3257}
3258
3259double GDALAdjustNoDataCloseToFloatMax(double dfVal);
3260
3261#define DIV_ROUND_UP(a, b) ( ((a) % (b)) == 0 ? ((a) / (b)) : (((a) / (b)) + 1) )
3262
3263// Number of data samples that will be used to compute approximate statistics
3264// (minimum value, maximum value, etc.)
3265#define GDALSTAT_APPROX_NUMSAMPLES 2500
3266
3267void GDALSerializeGCPListToXML( CPLXMLNode* psParentNode,
3268 GDAL_GCP* pasGCPList,
3269 int nGCPCount,
3270 const OGRSpatialReference* poGCP_SRS );
3271void GDALDeserializeGCPListFromXML( CPLXMLNode* psGCPList,
3272 GDAL_GCP** ppasGCPList,
3273 int* pnGCPCount,
3274 OGRSpatialReference** ppoGCP_SRS );
3275
3276void GDALSerializeOpenOptionsToXML( CPLXMLNode* psParentNode, char** papszOpenOptions);
3277char** GDALDeserializeOpenOptionsFromXML( CPLXMLNode* psParentNode );
3278
3279int GDALCanFileAcceptSidecarFile(const char* pszFilename);
3280
3281bool GDALCanReliablyUseSiblingFileList(const char* pszFilename);
3282
3283bool CPL_DLL GDALIsDriverDeprecatedForGDAL35StillEnabled(const char* pszDriverName, const char* pszExtraMsg = "");
3284
3285typedef enum
3286{
3287 GSF_UNSIGNED_INT,
3288 GSF_SIGNED_INT,
3289 GSF_FLOATING_POINT,
3290} GDALBufferSampleFormat;
3291
3292bool CPL_DLL GDALBufferHasOnlyNoData(const void* pBuffer,
3293 double dfNoDataValue,
3294 size_t nWidth, size_t nHeight,
3295 size_t nLineStride,
3296 size_t nComponents,
3297 int nBitsPerSample,
3298 GDALBufferSampleFormat nSampleFormat);
3299
3300void CPL_DLL GDALCopyNoDataValue(GDALRasterBand* poDstBand,
3301 GDALRasterBand* poSrcBand);
3302
3303double CPL_DLL GDALGetNoDataValueCastToDouble(int64_t nVal);
3304double CPL_DLL GDALGetNoDataValueCastToDouble(uint64_t nVal);
3305
3307
3308#endif /* ndef GDAL_PRIV_H_INCLUDED */
String list class designed around our use of C "char**" string lists.
Definition: cpl_string.h:430
Convenient string class based on std::string.
Definition: cpl_string.h:321
Abstract class, implemented by GDALAttribute and GDALMDArray.
Definition: gdal_priv.h:2164
const std::string & GetFullName() const
Return the name of an array or attribute.
Definition: gdal_priv.h:2214
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:2208
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:1910
Class used as a session object for asynchronous requests.
Definition: gdal_priv.h:1769
int GetXOffset() const
Return x offset.
Definition: gdal_priv.h:1802
int GetYOffset() const
Return y offset.
Definition: gdal_priv.h:1806
int GetYSize() const
Return height.
Definition: gdal_priv.h:1814
int GetBandCount() const
Return band count.
Definition: gdal_priv.h:1834
GDALDataType GetBufferType() const
Return buffer data type.
Definition: gdal_priv.h:1830
int GetBandSpace() const
Return band spacing.
Definition: gdal_priv.h:1850
int GetBufferYSize() const
Return buffer height.
Definition: gdal_priv.h:1826
int GetXSize() const
Return width.
Definition: gdal_priv.h:1810
virtual GDALAsyncStatusType GetNextUpdatedRegion(double dfTimeout, int *pnBufXOff, int *pnBufYOff, int *pnBufXSize, int *pnBufYSize)=0
Get async IO update.
void * GetBuffer()
Return buffer.
Definition: gdal_priv.h:1818
int GetPixelSpace() const
Return pixel spacing.
Definition: gdal_priv.h:1842
int * GetBandMap()
Return band map.
Definition: gdal_priv.h:1838
GDALDataset * GetGDALDataset()
Return dataset.
Definition: gdal_priv.h:1798
int GetLineSpace() const
Return line spacing.
Definition: gdal_priv.h:1846
int GetBufferXSize() const
Return buffer width.
Definition: gdal_priv.h:1822
Class modeling an attribute that has a name, a value and a type, and is typically used to describe a ...
Definition: gdal_priv.h:2340
A color table / palette.
Definition: gdal_priv.h:1047
static GDALColorTableH ToHandle(GDALColorTable *poCT)
Convert a GDALColorTable* to a GDALRasterBandH.
Definition: gdal_priv.h:1072
~GDALColorTable()
Destructor.
static GDALColorTable * FromHandle(GDALColorTableH hCT)
Convert a GDALColorTableH to a GDALColorTable*.
Definition: gdal_priv.h:1078
Class returned by GetBands() that act as a container for raster bands.
Definition: gdal_priv.h:477
Class returned by GetFeatures() that act as a container for vector features.
Definition: gdal_priv.h:770
Layer iterator.
Definition: gdal_priv.h:720
void pointer
pointer
Definition: gdal_priv.h:728
void difference_type
difference_type
Definition: gdal_priv.h:727
std::input_iterator_tag iterator_category
iterator_category
Definition: gdal_priv.h:729
Class returned by GetLayers() that acts as a range of layers.
Definition: gdal_priv.h:707
A set of associated raster bands, usually from one file.
Definition: gdal_priv.h:341
virtual int CloseDependentDatasets()
Drop references to any other datasets referenced by this dataset.
Definition: gdaldataset.cpp:4147
CPLErr BuildOverviews(const char *, int, int *, int, int *, GDALProgressFunc, void *)
Build raster overview(s)
Definition: gdaldataset.cpp:1980
virtual CPLErr CreateMaskBand(int nFlagsIn)
Adds a mask band to the dataset.
Definition: gdaldataset.cpp:3147
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:656
CPLErr SetMetadata(char **papszMetadata, const char *pszDomain) override
Set metadata.
CPLErr SetMetadataItem(const char *pszName, const char *pszValue, const char *pszDomain) override
Set single metadata item.
char ** GetOpenOptions()
Return open options.
Definition: gdal_priv.h:611
static GDALDataset * FromHandle(GDALDatasetH hDS)
Convert a GDALDatasetH to a GDALDataset*.
Definition: gdal_priv.h:650
static GDALDatasetH ToHandle(GDALDataset *poDS)
Convert a GDALDataset* to a GDALDatasetH.
Definition: gdal_priv.h:644
GDALAccess GetAccess() const
Return access mode.
Definition: gdal_priv.h:601
Class modeling a a dimension / axis used to index multidimensional arrays.
Definition: gdal_priv.h:2765
const std::string & GetName() const
Return the name.
Definition: gdal_priv.h:2781
const std::string & GetDirection() const
Return the axis direction.
Definition: gdal_priv.h:2807
const std::string & GetFullName() const
Return the full name.
Definition: gdal_priv.h:2787
GUInt64 GetSize() const
Return the size, that is the number of values along the dimension.
Definition: gdal_priv.h:2813
const std::string & GetType() const
Return the axis type.
Definition: gdal_priv.h:2797
Class for managing the registration of file format drivers.
Definition: gdal_priv.h:1715
Format specific driver.
Definition: gdal_priv.h:1560
static GDALDriver * FromHandle(GDALDriverH hDriver)
Convert a GDALDriverH to a GDALDriver*.
Definition: gdal_priv.h:1696
static GDALDriverH ToHandle(GDALDriver *poDriver)
Convert a GDALDriver* to a GDALDriverH.
Definition: gdal_priv.h:1690
Class for a component of a compound extended data type.
Definition: gdal_priv.h:1989
const GDALExtendedDataType & GetType() const
Return the data type of the component.
Definition: gdal_priv.h:2013
size_t GetOffset() const
Return the offset (in bytes) of the component in the compound data type.
Definition: gdal_priv.h:2007
const std::string & GetName() const
Return the name.
Definition: gdal_priv.h:2001
GDALEDTComponent(const GDALEDTComponent &)
Copy constructor.
Class used to represent potentially complex data types.
Definition: gdal_priv.h:1881
GDALExtendedDataTypeSubType GetSubType() const
Return subtype.
Definition: gdal_priv.h:1924
size_t GetSize() const
Return data type size in bytes.
Definition: gdal_priv.h:1938
size_t GetMaxStringLength() const
Return the maximum length of a string in bytes.
Definition: gdal_priv.h:1944
static GDALExtendedDataType Create(GDALDataType eType)
Return a new GDALExtendedDataType of class GEDTC_NUMERIC.
Definition: gdalmultidim.cpp:8306
static GDALExtendedDataType CreateString(size_t nMaxStringLength=0, GDALExtendedDataTypeSubType eSubType=GEDTST_NONE)
Return a new GDALExtendedDataType of class GEDTC_STRING.
Definition: gdalmultidim.cpp:8370
GDALDataType GetNumericDataType() const
Return numeric data type (only valid when GetClass() == GEDTC_NUMERIC)
Definition: gdal_priv.h:1916
GDALExtendedDataTypeClass GetClass() const
Return type class.
Definition: gdal_priv.h:1910
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:1930
const std::string & GetName() const
Return type name.
Definition: gdal_priv.h:1904
Class modeling a named container of GDALAttribute, GDALMDArray, OGRLayer or other GDALGroup.
Definition: gdal_priv.h:2062
const std::string & GetName() const
Return the name of the group.
Definition: gdal_priv.h:2082
const std::string & GetFullName() const
Return the full name of the group.
Definition: gdal_priv.h:2088
Interface used to get a single GDALAttribute or a set of GDALAttribute.
Definition: gdal_priv.h:2031
Class modeling a multi-dimensional array.
Definition: gdal_priv.h:2458
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:2593
Object with metadata.
Definition: gdal_priv.h:137
static GDALMajorObject * FromHandle(GDALMajorObjectH hMajorObject)
Convert a GDALMajorObjectH to a GDALMajorObject*.
Definition: gdal_priv.h:178
static GDALMajorObjectH ToHandle(GDALMajorObject *poMajorObject)
Convert a GDALMajorObject* to a GDALMajorObjectH.
Definition: gdal_priv.h:172
Class for dataset open functions.
Definition: gdal_priv.h:270
int bStatOK
Whether stat()'ing the file was successful.
Definition: gdal_priv.h:291
GByte * pabyHeader
Buffer with first bytes of the file.
Definition: gdal_priv.h:301
int bIsDirectory
Whether the file is a directory.
Definition: gdal_priv.h:293
char ** papszOpenOptions
Open options.
Definition: gdal_priv.h:283
GDALAccess eAccess
Access flag.
Definition: gdal_priv.h:286
int nOpenFlags
Open flags.
Definition: gdal_priv.h:288
VSILFILE * fpL
Pointer to the file.
Definition: gdal_priv.h:296
char * pszFilename
Filename.
Definition: gdal_priv.h:281
int nHeaderBytes
Number of bytes in pabyHeader.
Definition: gdal_priv.h:299
const char *const * papszAllowedDrivers
Allowed drivers (NULL for all)
Definition: gdal_priv.h:304
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:1182
void static GDALRasterBandH ToHandle(GDALRasterBand *poBand)
Convert a GDALRasterBand* to a GDALRasterBandH.
Definition: gdal_priv.h:1405
virtual bool IsMaskBand() const
Returns whether a band is a mask band.
Definition: gdalrasterband.cpp:7180
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:209
CPLErr SetMetadata(char **papszMetadata, const char *pszDomain) override
Set metadata.
virtual CPLErr IReadBlock(int nBlockXOff, int nBlockYOff, void *pData)=0
Read a block of data.
virtual GDALMaskValueRange GetMaskValueRange() const
Returns the range of values that a mask band can take.
Definition: gdalrasterband.cpp:7230
CPLErr SetMetadataItem(const char *pszName, const char *pszValue, const char *pszDomain) override
Set single metadata item.
static GDALRasterBand * FromHandle(GDALRasterBandH hBand)
Convert a GDALRasterBandH to a GDALRasterBand*.
Definition: gdal_priv.h:1411
A single raster block in the block cache.
Definition: gdal_priv.h:932
int GetDirty() const
Return the dirty flag.
Definition: gdal_priv.h:1000
GDALRasterBand * GetBand()
Accessor to source GDALRasterBand object.
Definition: gdal_priv.h:1016
int GetXSize() const
Return the width of the block.
Definition: gdal_priv.h:992
GPtrDiff_t GetBlockSize() const
Return the block size in bytes.
Definition: gdal_priv.h:1008
int GetYSize() const
Return the height of the block.
Definition: gdal_priv.h:996
GDALDataType GetDataType() const
Return the data type.
Definition: gdal_priv.h:980
int GetXOff() const
Return the x offset of the top-left corner of the block.
Definition: gdal_priv.h:984
int AddLock(void)
Increment the lock count.
Definition: gdal_priv.h:970
void * GetDataRef(void)
Return the data buffer.
Definition: gdal_priv.h:1004
int GetYOff() const
Return the y offset of the top-left corner of the block.
Definition: gdal_priv.h:988
int DropLock(void)
Decrement the lock count.
Definition: gdal_priv.h:972
Store the raw result of an attribute value, which might contain dynamically allocated structures (lik...
Definition: gdal_priv.h:2287
size_t size() const
Return the size in bytes of the raw result.
Definition: gdal_priv.h:2317
const GByte * data() const
Return pointer to the start of data.
Definition: gdal_priv.h:2315
const GByte & operator[](size_t idx) const
Return byte at specified index.
Definition: gdal_priv.h:2313
Definition of a table relationship.
Definition: gdal_priv.h:2891
const std::string & GetName() const
Get the name of the relationship.
Definition: gdal_priv.h:2926
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:2985
void SetType(GDALRelationshipType eType)
Sets the type of the relationship.
Definition: gdal_priv.h:3018
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:2999
void SetMappingTableName(const std::string &osName)
Sets the name of the mapping table for many-to-many relationships.
Definition: gdal_priv.h:2950
static GDALRelationshipH ToHandle(GDALRelationship *poRelationship)
Convert a GDALRelationship* to a GDALRelationshipH.
Definition: gdal_priv.h:3108
const std::string & GetForwardPathLabel() const
Get the label of the forward path for the relationship.
Definition: gdal_priv.h:3034
const std::string & GetLeftTableName() const
Get the name of the left (or base/origin) table in the relationship.
Definition: gdal_priv.h:2935
const std::string & GetBackwardPathLabel() const
Get the label of the backward path for the relationship.
Definition: gdal_priv.h:3066
const std::string & GetRelatedTableType() const
Get the type string of the related table.
Definition: gdal_priv.h:3093
const std::string & GetMappingTableName() const
Get the name of the mapping table for many-to-many relationships.
Definition: gdal_priv.h:2944
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:2971
GDALRelationshipCardinality GetCardinality() const
Get the cardinality of the relationship.
Definition: gdal_priv.h:2929
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:2978
void SetForwardPathLabel(const std::string &osLabel)
Sets the label of the forward path for the relationship.
Definition: gdal_priv.h:3050
void SetBackwardPathLabel(const std::string &osLabel)
Sets the label of the backward path for the relationship.
Definition: gdal_priv.h:3082
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:2964
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:3006
static GDALRelationship * FromHandle(GDALRelationshipH hRelationship)
Convert a GDALRelationshipH to a GDALRelationship*.
Definition: gdal_priv.h:3113
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:2992
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:2918
GDALRelationshipType GetType() const
Get the type of the relationship.
Definition: gdal_priv.h:3012
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:2957
const std::string & GetRightTableName() const
Get the name of the right (or related/destination) table in the relationship.
Definition: gdal_priv.h:2938
void SetRelatedTableType(const std::string &osType)
Sets the type string of the related table.
Definition: gdal_priv.h:3104
A simple feature, including geometry and attributes.
Definition: ogr_feature.h:382
Definition of a field domain.
Definition: ogr_feature.h:882
Abstract base class for all geometry classes.
Definition: ogr_geometry.h:327
This class represents a layer of simple features, with access methods.
Definition: ogrsf_frmts.h:73
This class represents an OpenGIS Spatial Reference System, and contains methods for converting betwee...
Definition: ogr_spatialref.h:158
This class represents a style table.
Definition: ogr_featurestyle.h:85
Various convenience functions for CPL.
CPLErr
Error category.
Definition: cpl_error.h:53
int CPLErrorNum
Error number.
Definition: cpl_error.h:94
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:269
#define CPL_NULL_TERMINATED
Null terminated variadic.
Definition: cpl_port.h:834
unsigned long long GUIntBig
Large unsigned integer type (generally 64-bit unsigned integer type).
Definition: cpl_port.h:233
#define CPL_C_END
Macro to end a block of C symbols.
Definition: cpl_port.h:306
#define CPL_C_START
Macro to start a block of C symbols.
Definition: cpl_port.h:304
GIntBig GInt64
Signed 64 bit integer type.
Definition: cpl_port.h:249
#define CPL_PRINT_FUNC_FORMAT(format_idx, arg_idx)
Tag a function to have printf() formatting.
Definition: cpl_port.h:844
#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:930
char ** CSLConstList
Type of a constant null-terminated list of nul terminated strings.
Definition: cpl_port.h:1056
GUIntBig GUInt64
Unsigned 64 bit integer type.
Definition: cpl_port.h:251
#define CPL_WARN_UNUSED_RESULT
Qualifier to warn when the return value of a function is not used.
Definition: cpl_port.h:869
unsigned char GByte
Unsigned byte type.
Definition: cpl_port.h:203
long long GIntBig
Large signed integer type (generally 64-bit integer type).
Definition: cpl_port.h:230
Various convenience functions for working with strings and string lists.
struct CPLVirtualMem CPLVirtualMem
Opaque type that represents a virtual memory mapping.
Definition: cpl_virtualmem.h:62
Standard C Covers.
FILE VSILFILE
Opaque type for a FILE that implements the VSIVirtualHandle API.
Definition: cpl_vsi.h:158
GUIntBig vsi_l_offset
Type for a file offset.
Definition: cpl_vsi.h:142
Public (C callable) GDAL entry points.
GIntBig GSpacing
Type to express pixel, line or band spacing.
Definition: gdal.h:292
GDALAccess
Definition: gdal.h:116
@ GA_ReadOnly
Definition: gdal.h:117
void GDALClose(GDALDatasetH)
Close GDAL dataset.
Definition: gdaldataset.cpp:3760
GDALPaletteInterp
Definition: gdal.h:231
@ GPI_RGB
Definition: gdal.h:233
GDALDataType
Definition: gdal.h:63
@ GDT_Byte
Definition: gdal.h:65
@ GDT_Float64
Definition: gdal.h:73
@ GDT_Unknown
Definition: gdal.h:64
void * GDALDatasetH
Opaque type used for the C bindings of the C++ GDALDataset class.
Definition: gdal.h:269
GDALExtendedDataTypeClass
Enumeration giving the class of a GDALExtendedDataType.
Definition: gdal.h:297
@ GEDTC_NUMERIC
Numeric value.
Definition: gdal.h:299
GDALRelationshipCardinality
Cardinality of relationship.
Definition: gdal.h:1629
@ GRC_ONE_TO_MANY
One-to-many.
Definition: gdal.h:1633
GDALRIOResampleAlg
RasterIO() resampling method.
Definition: gdal.h:132
void * GDALRelationshipH
Opaque type used for the C bindings of the C++ GDALRelationship class.
Definition: gdal.h:289
int GDALGetDataTypeSizeBytes(GDALDataType)
Get data type size in bytes.
Definition: gdal_misc.cpp:319
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:3338
GDALExtendedDataTypeSubType
Enumeration giving the subtype of a GDALExtendedDataType.
Definition: gdal.h:309
@ GEDTST_NONE
None.
Definition: gdal.h:311
void * GDALMajorObjectH
Opaque type used for the C bindings of the C++ GDALMajorObject class.
Definition: gdal.h:266
GDALColorInterp
Definition: gdal.h:205
GDALRelationshipType
Type of relationship.
Definition: gdal.h:1645
@ GRT_ASSOCIATION
Association relationship.
Definition: gdal.h:1649
GDALAsyncStatusType
status of the asynchronous stream
Definition: gdal.h:104
void * GDALDriverH
Opaque type used for the C bindings of the C++ GDALDriver class.
Definition: gdal.h:275
GDALRWFlag
Definition: gdal.h:122
void * GDALRasterBandH
Opaque type used for the C bindings of the C++ GDALRasterBand class.
Definition: gdal.h:272
void * GDALColorTableH
Opaque type used for the C bindings of the C++ GDALColorTable class.
Definition: gdal.h:278
std::unique_ptr< GDALDataset, GDALDatasetUniquePtrDeleter > GDALDatasetUniquePtr
Unique pointer type for GDALDataset.
Definition: gdal_priv.h:921
constexpr GDALSuggestedBlockAccessPattern GSBAP_UNKNOWN
Unknown, or no particular read order is suggested.
Definition: gdal_priv.h:1165
int GDALSuggestedBlockAccessPattern
Suggested/most efficient access pattern to blocks.
Definition: gdal_priv.h:1162
constexpr GDALSuggestedBlockAccessPattern GSBAP_RANDOM
Random access to blocks is efficient.
Definition: gdal_priv.h:1168
GDALDriverManager * GetGDALDriverManager(void)
Fetch the global GDAL driver manager.
Definition: gdaldrivermanager.cpp:101
GDALMaskValueRange
Range of values found in a mask band.
Definition: gdal_priv.h:1155
@ GMVR_0_AND_1_ONLY
Definition: gdal_priv.h:1157
@ GMVR_0_AND_255_ONLY
Definition: gdal_priv.h:1158
constexpr GDALSuggestedBlockAccessPattern GSBAP_TOP_TO_BOTTOM
Reading by strips from top to bottom is the most efficient.
Definition: gdal_priv.h:1171
GDALIdentifyEnum
Enumeration used by GDALDriver::pfnIdentify().
Definition: gdal_priv.h:1535
@ GDAL_IDENTIFY_TRUE
Identify determined the file is recognized by the probed driver.
Definition: gdal_priv.h:1541
@ GDAL_IDENTIFY_FALSE
Identify determined the file is not recognized by the probed driver.
Definition: gdal_priv.h:1539
@ GDAL_IDENTIFY_UNKNOWN
Identify could not determine if the file is recognized or not by the probed driver.
Definition: gdal_priv.h:1537
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:1177
constexpr GDALSuggestedBlockAccessPattern GSBAP_BOTTOM_TO_TOP
Reading by strips from bottom to top is the most efficient.
Definition: gdal_priv.h:1174
Core portability services for cross-platform OGR code.
OGRwkbGeometryType
List of well known binary geometry types.
Definition: ogr_core.h:369
@ wkbUnknown
unknown type, non-standard
Definition: ogr_core.h:370
int OGRErr
Type for a OGR error.
Definition: ogr_core.h:341
Simple feature classes.
std::unique_ptr< OGRFeature, OGRFeatureUniquePtrDeleter > OGRFeatureUniquePtr
Unique pointer type for OGRFeature.
Definition: ogr_feature.h:842
OGRLayer::FeatureIterator begin(OGRLayer *poLayer)
Return begin of feature iterator.
Definition: ogrsf_frmts.h:322
OGRLayer::FeatureIterator end(OGRLayer *poLayer)
Return end of feature iterator.
Definition: ogrsf_frmts.h:327
Document node structure.
Definition: cpl_minixml.h:70
Color tuple.
Definition: gdal.h:1482
Object returned by GetFeatures() iterators.
Definition: gdal_priv.h:670
Structure to pass extra arguments to RasterIO() method, must be initialized with INIT_RASTERIO_EXTRA_...
Definition: gdal.h:162
Ground Control Point.
Definition: gdal.h:872