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 /* -------------------------------------------------------------------- */
45 class GDALMajorObject;
46 class GDALDataset;
47 class GDALRasterBand;
48 class GDALDriver;
49 class GDALRasterAttributeTable;
50 class GDALProxyDataset;
51 class GDALProxyRasterBand;
52 class GDALAsyncReader;
53
54 /* -------------------------------------------------------------------- */
55 /* Pull in the public declarations. This gets the C apis, and */
56 /* also various constants. However, we will still get to */
57 /* provide the real class definitions for the GDAL classes. */
58 /* -------------------------------------------------------------------- */
59
60 #include "gdal.h"
61 #include "gdal_frmts.h"
62 #include "cpl_vsi.h"
63 #include "cpl_conv.h"
64 #include "cpl_string.h"
65 #include "cpl_minixml.h"
66 #include "cpl_multiproc.h"
67 #include "cpl_atomic_ops.h"
68
69 #include <stdarg.h>
70
71 #include <cmath>
72 #include <cstdint>
73 #include <iterator>
74 #include <limits>
75 #include <map>
76 #include <memory>
77 #include <vector>
78
79 #include "ogr_core.h"
80 #include "ogr_feature.h"
81
83 #define GMO_VALID 0x0001
84 #define GMO_IGNORE_UNIMPLEMENTED 0x0002
85 #define GMO_SUPPORT_MD 0x0004
86 #define GMO_SUPPORT_MDMD 0x0008
87 #define GMO_MD_DIRTY 0x0010
88 #define GMO_PAM_CLASS 0x0020
89
91 /************************************************************************/
92 /* GDALMultiDomainMetadata */
93 /************************************************************************/
94
96 class CPL_DLL GDALMultiDomainMetadata
97 {
98 private:
99 char **papszDomainList;
100 CPLStringList **papoMetadataLists;
101
102 public:
103 GDALMultiDomainMetadata();
104 ~GDALMultiDomainMetadata();
105
106 int XMLInit( CPLXMLNode *psMetadata, int bMerge );
107 CPLXMLNode *Serialize();
108
109 char **GetDomainList() { return papszDomainList; }
110
111 char **GetMetadata( const char * pszDomain = "" );
112 CPLErr SetMetadata( char ** papszMetadata,
113 const char * pszDomain = "" );
114 const char *GetMetadataItem( const char * pszName,
115 const char * pszDomain = "" );
116 CPLErr SetMetadataItem( const char * pszName,
117 const char * pszValue,
118 const char * pszDomain = "" );
119
120 void Clear();
121
122 private:
123 CPL_DISALLOW_COPY_ASSIGN(GDALMultiDomainMetadata)
124 };
126
127 /* ******************************************************************** */
128 /* GDALMajorObject */
129 /* */
130 /* Base class providing metadata, description and other */
131 /* services shared by major objects. */
132 /* ******************************************************************** */
133
135 class CPL_DLL GDALMajorObject
136 {
137 protected:
139 int nFlags; // GMO_* flags.
140 CPLString sDescription{};
141 GDALMultiDomainMetadata oMDMD{};
142
144
145 char **BuildMetadataDomainList( char** papszList,
146 int bCheckNonEmpty, ... ) CPL_NULL_TERMINATED;
147 public:
148 GDALMajorObject();
149 virtual ~GDALMajorObject();
150
151 int GetMOFlags() const;
152 void SetMOFlags( int nFlagsIn );
153
154 virtual const char *GetDescription() const;
155 virtual void SetDescription( const char * );
156
157 virtual char **GetMetadataDomainList();
158
159 virtual char **GetMetadata( const char * pszDomain = "" );
160 virtual CPLErr SetMetadata( char ** papszMetadata,
161 const char * pszDomain = "" );
162 virtual const char *GetMetadataItem( const char * pszName,
163 const char * pszDomain = "" );
164 virtual CPLErr SetMetadataItem( const char * pszName,
165 const char * pszValue,
166 const char * pszDomain = "" );
167
171 static inline GDALMajorObjectH ToHandle(GDALMajorObject* poMajorObject)
172 { return static_cast<GDALMajorObjectH>(poMajorObject); }
173
177 static inline GDALMajorObject* FromHandle(GDALMajorObjectH hMajorObject)
178 { return static_cast<GDALMajorObject*>(hMajorObject); }
179 };
180
181 /* ******************************************************************** */
182 /* GDALDefaultOverviews */
183 /* ******************************************************************** */
184
186 class CPL_DLL GDALDefaultOverviews
187 {
188 friend class GDALDataset;
189
190 GDALDataset *poDS;
191 GDALDataset *poODS;
192
193 CPLString osOvrFilename{};
194
195 bool bOvrIsAux;
196
197 bool bCheckedForMask;
198 bool bOwnMaskDS;
199 GDALDataset *poMaskDS;
200
201 // For "overview datasets" we record base level info so we can
202 // find our way back to get overview masks.
203 GDALDataset *poBaseDS;
204
205 // Stuff for deferred initialize/overviewscans.
206 bool bCheckedForOverviews;
207 void OverviewScan();
208 char *pszInitName;
209 bool bInitNameIsOVR;
210 char **papszInitSiblingFiles;
211
212 public:
213 GDALDefaultOverviews();
214 ~GDALDefaultOverviews();
215
216 void Initialize( GDALDataset *poDSIn, const char *pszName = nullptr,
217 char **papszSiblingFiles = nullptr,
218 int bNameIsOVR = FALSE );
219
220 void TransferSiblingFiles( char** papszSiblingFiles );
221
222 int IsInitialized();
223
224 int CloseDependentDatasets();
225
226 // Overview Related
227
228 int GetOverviewCount( int nBand );
229 GDALRasterBand *GetOverview( int nBand, int iOverview );
230
231 CPLErr BuildOverviews( const char * pszBasename,
232 const char * pszResampling,
233 int nOverviews, int * panOverviewList,
234 int nBands, int * panBandList,
235 GDALProgressFunc pfnProgress,
236 void *pProgressData );
237
238 CPLErr BuildOverviewsSubDataset( const char * pszPhysicalFile,
239 const char * pszResampling,
240 int nOverviews, int * panOverviewList,
241 int nBands, int * panBandList,
242 GDALProgressFunc pfnProgress,
243 void *pProgressData );
244
245 CPLErr CleanOverviews();
246
247 // Mask Related
248
249 CPLErr CreateMaskBand( int nFlags, int nBand = -1 );
250 GDALRasterBand *GetMaskBand( int nBand );
251 int GetMaskFlags( int nBand );
252
253 int HaveMaskFile( char **papszSiblings = nullptr,
254 const char *pszBasename = nullptr );
255
256 char** GetSiblingFiles() { return papszInitSiblingFiles; }
257
258 private:
259 CPL_DISALLOW_COPY_ASSIGN(GDALDefaultOverviews)
260 };
262
263 /* ******************************************************************** */
264 /* GDALOpenInfo */
265 /* ******************************************************************** */
266
268 class CPL_DLL GDALOpenInfo
269 {
270 bool bHasGotSiblingFiles;
271 char **papszSiblingFiles;
272 int nHeaderBytesTried;
273
274 public:
275 GDALOpenInfo( const char * pszFile, int nOpenFlagsIn,
276 const char * const * papszSiblingFiles = nullptr );
277 ~GDALOpenInfo( void );
278
280 char *pszFilename;
282 char** papszOpenOptions;
283
285 GDALAccess eAccess;
287 int nOpenFlags;
288
290 int bStatOK;
292 int bIsDirectory;
293
295 VSILFILE *fpL;
296
298 int nHeaderBytes;
300 GByte *pabyHeader;
301
303 const char* const* papszAllowedDrivers;
304
305 int TryToIngest(int nBytes);
306 char **GetSiblingFiles();
307 char **StealSiblingFiles();
308 bool AreSiblingFilesLoaded() const;
309
310 private:
311 CPL_DISALLOW_COPY_ASSIGN(GDALOpenInfo)
312 };
313
314 /* ******************************************************************** */
315 /* GDALDataset */
316 /* ******************************************************************** */
317
318 class OGRLayer;
319 class OGRGeometry;
320 class OGRSpatialReference;
321 class OGRStyleTable;
322 class swq_select;
323 class swq_select_parse_options;
324 class GDALGroup;
325
327 typedef struct GDALSQLParseInfo GDALSQLParseInfo;
329
331 #ifdef GDAL_COMPILATION
332 #define OPTIONAL_OUTSIDE_GDAL(val)
333 #else
334 #define OPTIONAL_OUTSIDE_GDAL(val) = val
335 #endif
336
339 class CPL_DLL GDALDataset : public GDALMajorObject
340 {
341 friend GDALDatasetH CPL_STDCALL GDALOpenEx( const char* pszFilename,
342 unsigned int nOpenFlags,
343 const char* const* papszAllowedDrivers,
344 const char* const* papszOpenOptions,
345 const char* const* papszSiblingFiles );
346 friend void CPL_STDCALL GDALClose( GDALDatasetH hDS );
347
348 friend class GDALDriver;
349 friend class GDALDefaultOverviews;
350 friend class GDALProxyDataset;
351 friend class GDALDriverManager;
352
353 CPL_INTERNAL void AddToDatasetOpenList();
354
355 CPL_INTERNAL static void ReportErrorV(
356 const char* pszDSName,
357 CPLErr eErrClass, CPLErrorNum err_no,
358 const char *fmt, va_list args);
359 protected:
361 GDALDriver *poDriver = nullptr;
362 GDALAccess eAccess = GA_ReadOnly;
363
364 // Stored raster information.
365 int nRasterXSize = 512;
366 int nRasterYSize = 512;
367 int nBands = 0;
368 GDALRasterBand **papoBands = nullptr;
369
370 int nOpenFlags = 0;
371
372 int nRefCount = 1;
373 bool bForceCachedIO = false;
374 bool bShared = false;
375 bool bIsInternal = true;
376 bool bSuppressOnClose = false;
377
378 mutable std::map<std::string, std::unique_ptr<OGRFieldDomain>> m_oMapFieldDomains{};
379
380 GDALDataset(void);
381 explicit GDALDataset(int bForceCachedIO);
382
383 void RasterInitialize( int, int );
384 void SetBand( int, GDALRasterBand * );
385
386 GDALDefaultOverviews oOvManager{};
387
388 virtual CPLErr IBuildOverviews( const char *, int, int *,
389 int, int *, GDALProgressFunc, void * );
390
391 virtual CPLErr IRasterIO( GDALRWFlag, int, int, int, int,
392 void *, int, int, GDALDataType,
393 int, int *, GSpacing, GSpacing, GSpacing,
394 GDALRasterIOExtraArg* psExtraArg ) CPL_WARN_UNUSED_RESULT;
395
396 CPLErr BlockBasedRasterIO( GDALRWFlag, int, int, int, int,
397 void *, int, int, GDALDataType,
398 int, int *, GSpacing, GSpacing, GSpacing,
399 GDALRasterIOExtraArg* psExtraArg ) CPL_WARN_UNUSED_RESULT;
400 void BlockBasedFlushCache(bool bAtClosing);
401
402 CPLErr BandBasedRasterIO( GDALRWFlag eRWFlag,
403 int nXOff, int nYOff, int nXSize, int nYSize,
404 void * pData, int nBufXSize, int nBufYSize,
405 GDALDataType eBufType,
406 int nBandCount, int *panBandMap,
407 GSpacing nPixelSpace, GSpacing nLineSpace,
408 GSpacing nBandSpace,
409 GDALRasterIOExtraArg* psExtraArg ) CPL_WARN_UNUSED_RESULT;
410
411 CPLErr RasterIOResampled( GDALRWFlag eRWFlag,
412 int nXOff, int nYOff, int nXSize, int nYSize,
413 void * pData, int nBufXSize, int nBufYSize,
414 GDALDataType eBufType,
415 int nBandCount, int *panBandMap,
416 GSpacing nPixelSpace, GSpacing nLineSpace,
417 GSpacing nBandSpace,
418 GDALRasterIOExtraArg* psExtraArg ) CPL_WARN_UNUSED_RESULT;
419
420 CPLErr ValidateRasterIOOrAdviseReadParameters(
421 const char* pszCallingFunc,
422 int* pbStopProcessingOnCENone,
423 int nXOff, int nYOff, int nXSize, int nYSize,
424 int nBufXSize, int nBufYSize,
425 int nBandCount, int *panBandMap);
426
427 CPLErr TryOverviewRasterIO( GDALRWFlag eRWFlag,
428 int nXOff, int nYOff, int nXSize, int nYSize,
429 void * pData, int nBufXSize, int nBufYSize,
430 GDALDataType eBufType,
431 int nBandCount, int *panBandMap,
432 GSpacing nPixelSpace, GSpacing nLineSpace,
433 GSpacing nBandSpace,
434 GDALRasterIOExtraArg* psExtraArg,
435 int* pbTried);
436
437 void ShareLockWithParentDataset(GDALDataset* poParentDataset);
438
440
441 void CleanupPostFileClosing();
442
443 virtual int CloseDependentDatasets();
445 int ValidateLayerCreationOptions( const char* const* papszLCO );
446
447 char **papszOpenOptions = nullptr;
448
449 friend class GDALRasterBand;
450
451 // The below methods related to read write mutex are fragile logic, and
452 // should not be used by out-of-tree code if possible.
453 int EnterReadWrite(GDALRWFlag eRWFlag);
454 void LeaveReadWrite();
455 void InitRWLock();
456
457 void TemporarilyDropReadWriteLock();
458 void ReacquireReadWriteLock();
459
460 void DisableReadWriteMutex();
461
462 int AcquireMutex();
463 void ReleaseMutex();
465
466 public:
467 ~GDALDataset() override;
468
469 int GetRasterXSize();
470 int GetRasterYSize();
471 int GetRasterCount();
472 GDALRasterBand *GetRasterBand( int );
473
475 class CPL_DLL Bands
476 {
477 private:
478
479 friend class GDALDataset;
480 GDALDataset* m_poSelf;
481 CPL_INTERNAL explicit Bands(GDALDataset* poSelf): m_poSelf(poSelf) {}
482
483 class CPL_DLL Iterator
484 {
485 struct Private;
486 std::unique_ptr<Private> m_poPrivate;
487 public:
488 Iterator(GDALDataset* poDS, bool bStart);
489 Iterator(const Iterator& oOther); // declared but not defined. Needed for gcc 5.4 at least
490 Iterator(Iterator&& oOther) noexcept; // declared but not defined. Needed for gcc 5.4 at least
491 ~Iterator();
492 GDALRasterBand* operator*();
493 Iterator& operator++();
494 bool operator!=(const Iterator& it) const;
495 };
496
497 public:
498
499 const Iterator begin() const;
500
501 const Iterator end() const;
502
503 size_t size() const;
504
505 GDALRasterBand* operator[](int iBand);
506 GDALRasterBand* operator[](size_t iBand);
507 };
508
509 Bands GetBands();
510
511 virtual void FlushCache(bool bAtClosing = false);
512
513 virtual const OGRSpatialReference* GetSpatialRef() const;
514 virtual CPLErr SetSpatialRef(const OGRSpatialReference* poSRS);
515
516 // Compatibility layer
517 const char *GetProjectionRef(void) const;
518 CPLErr SetProjection( const char * pszProjection );
519
520 virtual CPLErr GetGeoTransform( double * padfTransform );
521 virtual CPLErr SetGeoTransform( double * padfTransform );
522
523 virtual CPLErr AddBand( GDALDataType eType,
524 char **papszOptions=nullptr );
525
526 virtual void *GetInternalHandle( const char * pszHandleName );
527 virtual GDALDriver *GetDriver(void);
528 virtual char **GetFileList(void);
529
530 virtual const char* GetDriverName();
531
532 virtual const OGRSpatialReference* GetGCPSpatialRef() const;
533 virtual int GetGCPCount();
534 virtual const GDAL_GCP *GetGCPs();
535 virtual CPLErr SetGCPs( int nGCPCount, const GDAL_GCP *pasGCPList,
536 const OGRSpatialReference * poGCP_SRS );
537
538 // Compatibility layer
539 const char *GetGCPProjection();
540 CPLErr SetGCPs( int nGCPCount, const GDAL_GCP *pasGCPList,
541 const char *pszGCPProjection );
542
543 virtual CPLErr AdviseRead( int nXOff, int nYOff, int nXSize, int nYSize,
544 int nBufXSize, int nBufYSize,
545 GDALDataType eDT,
546 int nBandCount, int *panBandList,
547 char **papszOptions );
548
549 virtual CPLErr CreateMaskBand( int nFlagsIn );
550
551 virtual GDALAsyncReader*
552 BeginAsyncReader(int nXOff, int nYOff, int nXSize, int nYSize,
553 void *pBuf, int nBufXSize, int nBufYSize,
554 GDALDataType eBufType,
555 int nBandCount, int* panBandMap,
556 int nPixelSpace, int nLineSpace, int nBandSpace,
557 char **papszOptions);
558 virtual void EndAsyncReader(GDALAsyncReader *);
559
561 struct RawBinaryLayout
562 {
563 enum class Interleaving
564 {
565 UNKNOWN,
566 BIP,
567 BIL,
568 BSQ
569 };
570 std::string osRawFilename{};
571 Interleaving eInterleaving = Interleaving::UNKNOWN;
572 GDALDataType eDataType = GDT_Unknown;
573 bool bLittleEndianOrder = false;
574
575 vsi_l_offset nImageOffset = 0;
576 GIntBig nPixelOffset = 0;
577 GIntBig nLineOffset = 0;
578 GIntBig nBandOffset = 0;
579 };
580
581 virtual bool GetRawBinaryLayout(RawBinaryLayout&);
583
584 CPLErr RasterIO( GDALRWFlag, int, int, int, int,
585 void *, int, int, GDALDataType,
586 int, int *, GSpacing, GSpacing, GSpacing,
587 GDALRasterIOExtraArg* psExtraArg
588 #ifndef DOXYGEN_SKIP
589 OPTIONAL_OUTSIDE_GDAL(nullptr)
590 #endif
591 ) CPL_WARN_UNUSED_RESULT;
592
593 int Reference();
594 int Dereference();
595 int ReleaseRef();
596
600 GDALAccess GetAccess() const { return eAccess; }
601
602 int GetShared() const;
603 void MarkAsShared();
604
605 void MarkSuppressOnClose();
606
610 char **GetOpenOptions() { return papszOpenOptions; }
611
612 static GDALDataset **GetOpenDatasets( int *pnDatasetCount );
613
614 CPLErr BuildOverviews( const char *, int, int *,
615 int, int *, GDALProgressFunc, void * );
616
617 #ifndef DOXYGEN_XML
618 void ReportError(CPLErr eErrClass, CPLErrorNum err_no, const char *fmt, ...) CPL_PRINT_FUNC_FORMAT (4, 5);
619
620 static void ReportError(const char* pszDSName,
621 CPLErr eErrClass, CPLErrorNum err_no,
622 const char *fmt, ...) CPL_PRINT_FUNC_FORMAT (4, 5);
623 #endif
624
625 char ** GetMetadata(const char * pszDomain = "") override;
626
627 // Only defined when Doxygen enabled
628 #ifdef DOXYGEN_SKIP
629 CPLErr SetMetadata( char ** papszMetadata,
630 const char * pszDomain ) override;
631 CPLErr SetMetadataItem( const char * pszName,
632 const char * pszValue,
633 const char * pszDomain ) override;
634 #endif
635
636 char **GetMetadataDomainList() override;
637
638 virtual void ClearStatistics();
639
643 static inline GDALDatasetH ToHandle(GDALDataset* poDS)
644 { return static_cast<GDALDatasetH>(poDS); }
645
649 static inline GDALDataset* FromHandle(GDALDatasetH hDS)
650 { return static_cast<GDALDataset*>(hDS); }
651
655 static GDALDataset* Open( const char* pszFilename,
656 unsigned int nOpenFlags = 0,
657 const char* const* papszAllowedDrivers = nullptr,
658 const char* const* papszOpenOptions = nullptr,
659 const char* const* papszSiblingFiles = nullptr )
660 {
661 return FromHandle(GDALOpenEx(pszFilename, nOpenFlags,
662 papszAllowedDrivers,
663 papszOpenOptions,
664 papszSiblingFiles));
665 }
666
668 struct FeatureLayerPair
669 {
671 OGRFeatureUniquePtr feature{};
672
674 OGRLayer* layer = nullptr;
675 };
676
678 // SetEnableOverviews() only to be used by GDALOverviewDataset
679 void SetEnableOverviews(bool bEnable);
680
681 // Only to be used by driver's GetOverviewCount() method.
682 bool AreOverviewsEnabled() const;
684
685 private:
686 class Private;
687 Private *m_poPrivate;
688
689 CPL_INTERNAL OGRLayer* BuildLayerFromSelectInfo(swq_select* psSelectInfo,
690 OGRGeometry *poSpatialFilter,
691 const char *pszDialect,
692 swq_select_parse_options* poSelectParseOptions);
693 CPLStringList oDerivedMetadataList{};
694
695 public:
696
697 virtual int GetLayerCount();
698 virtual OGRLayer *GetLayer(int iLayer);
699
700 virtual bool IsLayerPrivate(int iLayer) const;
701
705 class CPL_DLL Layers
706 {
707 private:
708
709 friend class GDALDataset;
710 GDALDataset* m_poSelf;
711 CPL_INTERNAL explicit Layers(GDALDataset* poSelf): m_poSelf(poSelf) {}
712
713 public:
714
718 class CPL_DLL Iterator
719 {
720 struct Private;
721 std::unique_ptr<Private> m_poPrivate;
722 public:
723
724 using value_type = OGRLayer*;
725 using reference = OGRLayer*;
726 using difference_type = void;
727 using pointer = void;
728 using iterator_category = std::input_iterator_tag;
730 Iterator();
731 Iterator(GDALDataset* poDS, bool bStart);
732 Iterator(const Iterator& oOther);
733 Iterator(Iterator&& oOther) noexcept;
734 ~Iterator();
736 Iterator& operator=(const Iterator& oOther);
737 Iterator& operator=(Iterator&& oOther) noexcept;
739 OGRLayer* operator*() const;
740 Iterator& operator++();
741 Iterator operator++(int);
742 bool operator!=(const Iterator& it) const;
743 };
744
745 Iterator begin() const;
746 Iterator end() const;
747
748 size_t size() const;
749
750 OGRLayer* operator[](int iLayer);
751 OGRLayer* operator[](size_t iLayer);
752 OGRLayer* operator[](const char* pszLayername);
753 };
754
755 Layers GetLayers();
756
757 virtual OGRLayer *GetLayerByName(const char *);
758 virtual OGRErr DeleteLayer(int iLayer);
759
760 virtual void ResetReading();
761 virtual OGRFeature* GetNextFeature( OGRLayer** ppoBelongingLayer,
762 double* pdfProgressPct,
763 GDALProgressFunc pfnProgress,
764 void* pProgressData );
765
766
768 class CPL_DLL Features
769 {
770 private:
771
772 friend class GDALDataset;
773 GDALDataset* m_poSelf;
774 CPL_INTERNAL explicit Features(GDALDataset* poSelf): m_poSelf(poSelf) {}
775
776 class CPL_DLL Iterator
777 {
778 struct Private;
779 std::unique_ptr<Private> m_poPrivate;
780 public:
781 Iterator(GDALDataset* poDS, bool bStart);
782 Iterator(const Iterator& oOther); // declared but not defined. Needed for gcc 5.4 at least
783 Iterator(Iterator&& oOther) noexcept; // declared but not defined. Needed for gcc 5.4 at least
784 ~Iterator();
785 const FeatureLayerPair& operator*() const;
786 Iterator& operator++();
787 bool operator!=(const Iterator& it) const;
788 };
789
790 public:
791
792 const Iterator begin() const;
793
794 const Iterator end() const;
795 };
796
797 Features GetFeatures();
798
799 virtual int TestCapability( const char * );
800
801 virtual std::vector<std::string> GetFieldDomainNames(CSLConstList papszOptions = nullptr) const;
802
803 virtual const OGRFieldDomain* GetFieldDomain(const std::string& name) const;
804
805 virtual bool AddFieldDomain(std::unique_ptr<OGRFieldDomain>&& domain,
806 std::string& failureReason);
807
808 virtual bool DeleteFieldDomain(const std::string& name,
809 std::string& failureReason);
810
811 virtual bool UpdateFieldDomain(std::unique_ptr<OGRFieldDomain>&& domain,
812 std::string& failureReason);
813
814 virtual OGRLayer *CreateLayer( const char *pszName,
815 OGRSpatialReference *poSpatialRef = nullptr,
816 OGRwkbGeometryType eGType = wkbUnknown,
817 char ** papszOptions = nullptr );
818 virtual OGRLayer *CopyLayer( OGRLayer *poSrcLayer,
819 const char *pszNewName,
820 char **papszOptions = nullptr );
821
822 virtual OGRStyleTable *GetStyleTable();
823 virtual void SetStyleTableDirectly( OGRStyleTable *poStyleTable );
824
825 virtual void SetStyleTable(OGRStyleTable *poStyleTable);
826
827 virtual OGRLayer * ExecuteSQL( const char *pszStatement,
828 OGRGeometry *poSpatialFilter,
829 const char *pszDialect );
830 virtual void ReleaseResultSet( OGRLayer * poResultsSet );
831 virtual OGRErr AbortSQL( );
832
833 int GetRefCount() const;
834 int GetSummaryRefCount() const;
835 OGRErr Release();
836
837 virtual OGRErr StartTransaction(int bForce=FALSE);
838 virtual OGRErr CommitTransaction();
839 virtual OGRErr RollbackTransaction();
840
841 virtual std::shared_ptr<GDALGroup> GetRootGroup() const;
842
844 static int IsGenericSQLDialect(const char* pszDialect);
845
846 // Semi-public methods. Only to be used by in-tree drivers.
847 GDALSQLParseInfo* BuildParseInfo(swq_select* psSelectInfo,
848 swq_select_parse_options* poSelectParseOptions);
849 static void DestroyParseInfo(GDALSQLParseInfo* psParseInfo );
850 OGRLayer * ExecuteSQL( const char *pszStatement,
851 OGRGeometry *poSpatialFilter,
852 const char *pszDialect,
853 swq_select_parse_options* poSelectParseOptions);
855
856 protected:
857 virtual OGRLayer *ICreateLayer( const char *pszName,
858 OGRSpatialReference *poSpatialRef = nullptr,
859 OGRwkbGeometryType eGType = wkbUnknown,
860 char ** papszOptions = nullptr );
861
863 OGRErr ProcessSQLCreateIndex( const char * );
864 OGRErr ProcessSQLDropIndex( const char * );
865 OGRErr ProcessSQLDropTable( const char * );
866 OGRErr ProcessSQLAlterTableAddColumn( const char * );
867 OGRErr ProcessSQLAlterTableDropColumn( const char * );
868 OGRErr ProcessSQLAlterTableAlterColumn( const char * );
869 OGRErr ProcessSQLAlterTableRenameColumn( const char * );
870
871 OGRStyleTable *m_poStyleTable = nullptr;
872
873 // Compatibility layers
874 const OGRSpatialReference* GetSpatialRefFromOldGetProjectionRef() const;
875 CPLErr OldSetProjectionFromSetSpatialRef(const OGRSpatialReference* poSRS);
876 const OGRSpatialReference* GetGCPSpatialRefFromOldGetGCPProjection() const;
877 CPLErr OldSetGCPsFromNew( int nGCPCount, const GDAL_GCP *pasGCPList,
878 const OGRSpatialReference * poGCP_SRS );
879
880 friend class GDALProxyPoolDataset;
881 virtual const char *_GetProjectionRef();
882 const char *GetProjectionRefFromSpatialRef(const OGRSpatialReference*) const;
883 virtual const char *_GetGCPProjection();
884 const char *GetGCPProjectionFromSpatialRef(const OGRSpatialReference* poSRS) const;
885 virtual CPLErr _SetProjection( const char * pszProjection );
886 virtual CPLErr _SetGCPs( int nGCPCount, const GDAL_GCP *pasGCPList,
887 const char *pszGCPProjection );
889
890 private:
891 CPL_DISALLOW_COPY_ASSIGN(GDALDataset)
892 };
893
895 struct CPL_DLL GDALDatasetUniquePtrDeleter
896 {
897 void operator()(GDALDataset* poDataset) const
898 { GDALClose(poDataset); }
899 };
901
907 using GDALDatasetUniquePtr = std::unique_ptr<GDALDataset, GDALDatasetUniquePtrDeleter>;
908
909 /* ******************************************************************** */
910 /* GDALRasterBlock */
911 /* ******************************************************************** */
912
917 class CPL_DLL GDALRasterBlock
918 {
919 friend class GDALAbstractBandBlockCache;
920
921 GDALDataType eType;
922
923 bool bDirty;
924 volatile int nLockCount;
925
926 int nXOff;
927 int nYOff;
928
929 int nXSize;
930 int nYSize;
931
932 void *pData;
933
934 GDALRasterBand *poBand;
935
936 GDALRasterBlock *poNext;
937 GDALRasterBlock *poPrevious;
938
939 bool bMustDetach;
940
941 CPL_INTERNAL void Detach_unlocked( void );
942 CPL_INTERNAL void Touch_unlocked( void );
943
944 CPL_INTERNAL void RecycleFor( int nXOffIn, int nYOffIn );
945
946 public:
947 GDALRasterBlock( GDALRasterBand *, int, int );
948 GDALRasterBlock( int nXOffIn, int nYOffIn ); /* only for lookup purpose */
949 virtual ~GDALRasterBlock();
950
951 CPLErr Internalize( void );
952 void Touch( void );
953 void MarkDirty( void );
954 void MarkClean( void );
956 int AddLock( void ) { return CPLAtomicInc(&nLockCount); }
958 int DropLock( void ) { return CPLAtomicDec(&nLockCount); }
959 void Detach();
960
961 CPLErr Write();
962
966 GDALDataType GetDataType() const { return eType; }
970 int GetXOff() const { return nXOff; }
974 int GetYOff() const { return nYOff; }
978 int GetXSize() const { return nXSize; }
982 int GetYSize() const { return nYSize; }
986 int GetDirty() const { return bDirty; }
990 void *GetDataRef( void ) { return pData; }
994 GPtrDiff_t GetBlockSize() const {
995 return static_cast<GPtrDiff_t>(nXSize) * nYSize * GDALGetDataTypeSizeBytes(eType); }
996
997 int TakeLock();
998 int DropLockForRemovalFromStorage();
999
1002 GDALRasterBand *GetBand() { return poBand; }
1003
1004 static void FlushDirtyBlocks();
1005 static int FlushCacheBlock(int bDirtyBlocksOnly = FALSE);
1006 static void Verify();
1007
1008 static void EnterDisableDirtyBlockFlush();
1009 static void LeaveDisableDirtyBlockFlush();
1010
1011 #ifdef notdef
1012 static void CheckNonOrphanedBlocks(GDALRasterBand* poBand);
1013 void DumpBlock();
1014 static void DumpAll();
1015 #endif
1016
1017 /* Should only be called by GDALDestroyDriverManager() */
1019 CPL_INTERNAL static void DestroyRBMutex();
1021
1022 private:
1023 CPL_DISALLOW_COPY_ASSIGN(GDALRasterBlock)
1024 };
1025
1026 /* ******************************************************************** */
1027 /* GDALColorTable */
1028 /* ******************************************************************** */
1029
1032 class CPL_DLL GDALColorTable
1033 {
1034 GDALPaletteInterp eInterp;
1035
1036 std::vector<GDALColorEntry> aoEntries{};
1037
1038 public:
1039 explicit GDALColorTable( GDALPaletteInterp = GPI_RGB );
1040 ~GDALColorTable();
1041
1042 GDALColorTable *Clone() const;
1043 int IsSame(const GDALColorTable* poOtherCT) const;
1044
1045 GDALPaletteInterp GetPaletteInterpretation() const;
1046
1047 int GetColorEntryCount() const;
1048 const GDALColorEntry *GetColorEntry( int ) const;
1049 int GetColorEntryAsRGB( int, GDALColorEntry * ) const;
1050 void SetColorEntry( int, const GDALColorEntry * );
1051 int CreateColorRamp( int, const GDALColorEntry * ,
1052 int, const GDALColorEntry * );
1053 bool IsIdentity() const;
1054
1058 static inline GDALColorTableH ToHandle(GDALColorTable* poCT)
1059 { return static_cast<GDALColorTableH>(poCT); }
1060
1064 static inline GDALColorTable* FromHandle(GDALColorTableH hCT)
1065 { return static_cast<GDALColorTable*>(hCT); }
1066
1067 };
1068
1069 /* ******************************************************************** */
1070 /* GDALAbstractBandBlockCache */
1071 /* ******************************************************************** */
1072
1074
1076 // only used by GDALRasterBand implementation.
1077
1078 class GDALAbstractBandBlockCache
1079 {
1080 // List of blocks that can be freed or recycled, and its lock
1081 CPLLock *hSpinLock = nullptr;
1082 GDALRasterBlock *psListBlocksToFree = nullptr;
1083
1084 // Band keep alive counter, and its lock & condition
1085 CPLCond *hCond = nullptr;
1086 CPLMutex *hCondMutex = nullptr;
1087 volatile int nKeepAliveCounter = 0;
1088
1089 volatile int m_nDirtyBlocks = 0;
1090
1091 CPL_DISALLOW_COPY_ASSIGN(GDALAbstractBandBlockCache)
1092
1093 protected:
1094 GDALRasterBand *poBand;
1095
1096 int m_nInitialDirtyBlocksInFlushCache = 0;
1097 int m_nLastTick = -1;
1098 bool m_bWriteDirtyBlocks = true;
1099
1100 void FreeDanglingBlocks();
1101 void UnreferenceBlockBase();
1102
1103 void StartDirtyBlockFlushingLog();
1104 void UpdateDirtyBlockFlushingLog();
1105 void EndDirtyBlockFlushingLog();
1106
1107 public:
1108 explicit GDALAbstractBandBlockCache(GDALRasterBand* poBand);
1109 virtual ~GDALAbstractBandBlockCache();
1110
1111 GDALRasterBlock* CreateBlock(int nXBlockOff, int nYBlockOff);
1112 void AddBlockToFreeList( GDALRasterBlock * );
1113 void IncDirtyBlocks(int nInc);
1114 void WaitCompletionPendingTasks();
1115 void DisableDirtyBlockWriting() { m_bWriteDirtyBlocks = false; }
1116
1117 virtual bool Init() = 0;
1118 virtual bool IsInitOK() = 0;
1119 virtual CPLErr FlushCache() = 0;
1120 virtual CPLErr AdoptBlock( GDALRasterBlock* poBlock ) = 0;
1121 virtual GDALRasterBlock *TryGetLockedBlockRef( int nXBlockOff,
1122 int nYBlockYOff ) = 0;
1123 virtual CPLErr UnreferenceBlock( GDALRasterBlock* poBlock ) = 0;
1124 virtual CPLErr FlushBlock( int nXBlockOff, int nYBlockOff,
1125 int bWriteDirtyBlock ) = 0;
1126 };
1127
1128 GDALAbstractBandBlockCache* GDALArrayBandBlockCacheCreate(GDALRasterBand* poBand);
1129 GDALAbstractBandBlockCache* GDALHashSetBandBlockCacheCreate(GDALRasterBand* poBand);
1130
1132
1133 /* ******************************************************************** */
1134 /* GDALRasterBand */
1135 /* ******************************************************************** */
1136
1137 class GDALMDArray;
1138
1140 typedef enum
1141 {
1142 GMVR_UNKNOWN,
1143 GMVR_0_AND_1_ONLY,
1144 GMVR_0_AND_255_ONLY,
1145 } GDALMaskValueRange;
1146
1147
1150 class CPL_DLL GDALRasterBand : public GDALMajorObject
1151 {
1152 private:
1153 friend class GDALArrayBandBlockCache;
1154 friend class GDALHashSetBandBlockCache;
1155 friend class GDALRasterBlock;
1156 friend class GDALDataset;
1157
1158 CPLErr eFlushBlockErr = CE_None;
1159 GDALAbstractBandBlockCache* poBandBlockCache = nullptr;
1160
1161 CPL_INTERNAL void SetFlushBlockErr( CPLErr eErr );
1162 CPL_INTERNAL CPLErr UnreferenceBlock( GDALRasterBlock* poBlock );
1163 CPL_INTERNAL void SetValidPercent( GUIntBig nSampleCount, GUIntBig nValidCount );
1164 CPL_INTERNAL void IncDirtyBlocks(int nInc);
1165
1166 protected:
1168 GDALDataset *poDS = nullptr;
1169 int nBand = 0; /* 1 based */
1170
1171 int nRasterXSize = 0;
1172 int nRasterYSize = 0;
1173
1174 GDALDataType eDataType = GDT_Byte;
1175 GDALAccess eAccess = GA_ReadOnly;
1176
1177 /* stuff related to blocking, and raster cache */
1178 int nBlockXSize = -1;
1179 int nBlockYSize = -1;
1180 int nBlocksPerRow = 0;
1181 int nBlocksPerColumn = 0;
1182
1183 int nBlockReads = 0;
1184 int bForceCachedIO = 0;
1185
1186 GDALRasterBand *poMask = nullptr;
1187 bool bOwnMask = false;
1188 int nMaskFlags = 0;
1189
1190 void InvalidateMaskBand();
1191
1192 friend class GDALProxyRasterBand;
1193 friend class GDALDefaultOverviews;
1194
1195 CPLErr RasterIOResampled( GDALRWFlag, int, int, int, int,
1196 void *, int, int, GDALDataType,
1197 GSpacing, GSpacing, GDALRasterIOExtraArg* psExtraArg ) CPL_WARN_UNUSED_RESULT;
1198
1199 int EnterReadWrite(GDALRWFlag eRWFlag);
1200 void LeaveReadWrite();
1201 void InitRWLock();
1203
1204 protected:
1205 virtual CPLErr IReadBlock( int nBlockXOff, int nBlockYOff, void * pData ) = 0;
1206 virtual CPLErr IWriteBlock( int nBlockXOff, int nBlockYOff, void * pData );
1207
1208 virtual CPLErr IRasterIO( GDALRWFlag, int, int, int, int,
1209 void *, int, int, GDALDataType,
1210 GSpacing, GSpacing, GDALRasterIOExtraArg* psExtraArg ) CPL_WARN_UNUSED_RESULT;
1211
1212 virtual int IGetDataCoverageStatus( int nXOff, int nYOff,
1213 int nXSize, int nYSize,
1214 int nMaskFlagStop,
1215 double* pdfDataPct);
1217 CPLErr OverviewRasterIO( GDALRWFlag, int, int, int, int,
1218 void *, int, int, GDALDataType,
1219 GSpacing, GSpacing, GDALRasterIOExtraArg* psExtraArg ) CPL_WARN_UNUSED_RESULT;
1220
1221 CPLErr TryOverviewRasterIO( GDALRWFlag eRWFlag,
1222 int nXOff, int nYOff, int nXSize, int nYSize,
1223 void * pData, int nBufXSize, int nBufYSize,
1224 GDALDataType eBufType,
1225 GSpacing nPixelSpace, GSpacing nLineSpace,
1226 GDALRasterIOExtraArg* psExtraArg,
1227 int* pbTried );
1228
1229 int InitBlockInfo();
1230
1231 void AddBlockToFreeList( GDALRasterBlock * );
1233
1234 public:
1235 GDALRasterBand();
1236 explicit GDALRasterBand(int bForceCachedIO);
1237
1238 ~GDALRasterBand() override;
1239
1240 int GetXSize();
1241 int GetYSize();
1242 int GetBand();
1243 GDALDataset*GetDataset();
1244
1245 GDALDataType GetRasterDataType( void );
1246 void GetBlockSize( int *, int * );
1247 CPLErr GetActualBlockSize ( int, int, int *, int * );
1248 GDALAccess GetAccess();
1249
1250 CPLErr RasterIO( GDALRWFlag, int, int, int, int,
1251 void *, int, int, GDALDataType,
1252 GSpacing, GSpacing, GDALRasterIOExtraArg* psExtraArg
1253 #ifndef DOXYGEN_SKIP
1254 OPTIONAL_OUTSIDE_GDAL(nullptr)
1255 #endif
1256 ) CPL_WARN_UNUSED_RESULT;
1257 CPLErr ReadBlock( int, int, void * ) CPL_WARN_UNUSED_RESULT;
1258
1259 CPLErr WriteBlock( int, int, void * ) CPL_WARN_UNUSED_RESULT;
1260
1261 GDALRasterBlock *GetLockedBlockRef( int nXBlockOff, int nYBlockOff,
1262 int bJustInitialize = FALSE ) CPL_WARN_UNUSED_RESULT;
1263 GDALRasterBlock *TryGetLockedBlockRef( int nXBlockOff, int nYBlockYOff ) CPL_WARN_UNUSED_RESULT;
1264 CPLErr FlushBlock( int, int, int bWriteDirtyBlock = TRUE );
1265
1266 unsigned char* GetIndexColorTranslationTo(/* const */ GDALRasterBand* poReferenceBand,
1267 unsigned char* pTranslationTable = nullptr,
1268 int* pApproximateMatching = nullptr);
1269
1270 // New OpengIS CV_SampleDimension stuff.
1271
1272 virtual CPLErr FlushCache(bool bAtClosing = false);
1273 virtual char **GetCategoryNames();
1274 virtual double GetNoDataValue( int *pbSuccess = nullptr );
1275 virtual int64_t GetNoDataValueAsInt64( int *pbSuccess = nullptr );
1276 virtual uint64_t GetNoDataValueAsUInt64( int *pbSuccess = nullptr );
1277 virtual double GetMinimum( int *pbSuccess = nullptr );
1278 virtual double GetMaximum(int *pbSuccess = nullptr );
1279 virtual double GetOffset( int *pbSuccess = nullptr );
1280 virtual double GetScale( int *pbSuccess = nullptr );
1281 virtual const char *GetUnitType();
1282 virtual GDALColorInterp GetColorInterpretation();
1283 virtual GDALColorTable *GetColorTable();
1284 virtual CPLErr Fill(double dfRealValue, double dfImaginaryValue = 0);
1285
1286 virtual CPLErr SetCategoryNames( char ** papszNames );
1287 virtual CPLErr SetNoDataValue( double dfNoData );
1288 virtual CPLErr SetNoDataValueAsInt64( int64_t nNoData );
1289 virtual CPLErr SetNoDataValueAsUInt64( uint64_t nNoData );
1290 virtual CPLErr DeleteNoDataValue();
1291 virtual CPLErr SetColorTable( GDALColorTable * poCT );
1292 virtual CPLErr SetColorInterpretation( GDALColorInterp eColorInterp );
1293 virtual CPLErr SetOffset( double dfNewOffset );
1294 virtual CPLErr SetScale( double dfNewScale );
1295 virtual CPLErr SetUnitType( const char * pszNewValue );
1296
1297 virtual CPLErr GetStatistics( int bApproxOK, int bForce,
1298 double *pdfMin, double *pdfMax,
1299 double *pdfMean, double *padfStdDev );
1300 virtual CPLErr ComputeStatistics( int bApproxOK,
1301 double *pdfMin, double *pdfMax,
1302 double *pdfMean, double *pdfStdDev,
1303 GDALProgressFunc, void *pProgressData );
1304 virtual CPLErr SetStatistics( double dfMin, double dfMax,
1305 double dfMean, double dfStdDev );
1306 virtual CPLErr ComputeRasterMinMax( int, double* );
1307
1308 // Only defined when Doxygen enabled
1309 #ifdef DOXYGEN_SKIP
1310 CPLErr SetMetadata( char ** papszMetadata,
1311 const char * pszDomain ) override;
1312 CPLErr SetMetadataItem( const char * pszName,
1313 const char * pszValue,
1314 const char * pszDomain ) override;
1315 #endif
1316
1317 virtual int HasArbitraryOverviews();
1318 virtual int GetOverviewCount();
1319 virtual GDALRasterBand *GetOverview(int);
1320 virtual GDALRasterBand *GetRasterSampleOverview( GUIntBig );
1321 virtual CPLErr BuildOverviews( const char * pszResampling,
1322 int nOverviews,
1323 int * panOverviewList,
1324 GDALProgressFunc pfnProgress,
1325 void * pProgressData );
1326
1327 virtual CPLErr AdviseRead( int nXOff, int nYOff, int nXSize, int nYSize,
1328 int nBufXSize, int nBufYSize,
1329 GDALDataType eBufType, char **papszOptions );
1330
1331 virtual CPLErr GetHistogram( double dfMin, double dfMax,
1332 int nBuckets, GUIntBig * panHistogram,
1333 int bIncludeOutOfRange, int bApproxOK,
1334 GDALProgressFunc, void *pProgressData );
1335
1336 virtual CPLErr GetDefaultHistogram( double *pdfMin, double *pdfMax,
1337 int *pnBuckets, GUIntBig ** ppanHistogram,
1338 int bForce,
1339 GDALProgressFunc, void *pProgressData);
1340 virtual CPLErr SetDefaultHistogram( double dfMin, double dfMax,
1341 int nBuckets, GUIntBig *panHistogram );
1342
1343 virtual GDALRasterAttributeTable *GetDefaultRAT();
1344 virtual CPLErr SetDefaultRAT( const GDALRasterAttributeTable * poRAT );
1345
1346 virtual GDALRasterBand *GetMaskBand();
1347 virtual int GetMaskFlags();
1348 virtual CPLErr CreateMaskBand( int nFlagsIn );
1349 virtual bool IsMaskBand() const;
1350 virtual GDALMaskValueRange GetMaskValueRange() const;
1351
1352 virtual CPLVirtualMem *GetVirtualMemAuto( GDALRWFlag eRWFlag,
1353 int *pnPixelSpace,
1354 GIntBig *pnLineSpace,
1355 char **papszOptions ) CPL_WARN_UNUSED_RESULT;
1356
1357 int GetDataCoverageStatus( int nXOff, int nYOff,
1358 int nXSize, int nYSize,
1359 int nMaskFlagStop = 0,
1360 double* pdfDataPct = nullptr );
1361
1362 std::shared_ptr<GDALMDArray> AsMDArray() const;
1363
1364 #ifndef DOXYGEN_XML
1365 void ReportError(CPLErr eErrClass, CPLErrorNum err_no, const char *fmt, ...) CPL_PRINT_FUNC_FORMAT (4, 5);
1366 #endif
1367
1371 static inline GDALRasterBandH ToHandle(GDALRasterBand* poBand)
1372 { return static_cast<GDALRasterBandH>(poBand); }
1373
1377 static inline GDALRasterBand* FromHandle(GDALRasterBandH hBand)
1378 { return static_cast<GDALRasterBand*>(hBand); }
1379
1380 private:
1381 CPL_DISALLOW_COPY_ASSIGN(GDALRasterBand)
1382 };
1383
1385 /* ******************************************************************** */
1386 /* GDALAllValidMaskBand */
1387 /* ******************************************************************** */
1388
1389 class CPL_DLL GDALAllValidMaskBand : public GDALRasterBand
1390 {
1391 protected:
1392 CPLErr IReadBlock( int, int, void * ) override;
1393
1394 CPL_DISALLOW_COPY_ASSIGN(GDALAllValidMaskBand)
1395
1396 public:
1397 explicit GDALAllValidMaskBand( GDALRasterBand * );
1398 ~GDALAllValidMaskBand() override;
1399
1400 GDALRasterBand *GetMaskBand() override;
1401 int GetMaskFlags() override;
1402
1403 bool IsMaskBand() const override { return true; }
1404 GDALMaskValueRange GetMaskValueRange() const override { return GMVR_0_AND_255_ONLY; }
1405
1406 CPLErr ComputeStatistics( int bApproxOK,
1407 double *pdfMin, double *pdfMax,
1408 double *pdfMean, double *pdfStdDev,
1409 GDALProgressFunc, void *pProgressData ) override;
1410
1411 };
1412
1413 /* ******************************************************************** */
1414 /* GDALNoDataMaskBand */
1415 /* ******************************************************************** */
1416
1417 class CPL_DLL GDALNoDataMaskBand : public GDALRasterBand
1418 {
1419 double dfNoDataValue = 0;
1420 int64_t nNoDataValueInt64 = 0;
1421 uint64_t nNoDataValueUInt64 = 0;
1422 GDALRasterBand *poParent;
1423
1424 CPL_DISALLOW_COPY_ASSIGN(GDALNoDataMaskBand)
1425
1426 protected:
1427 CPLErr IReadBlock( int, int, void * ) override;
1428 CPLErr IRasterIO( GDALRWFlag, int, int, int, int,
1429 void *, int, int, GDALDataType,
1430 GSpacing, GSpacing, GDALRasterIOExtraArg* psExtraArg ) override;
1431
1432 public:
1433 explicit GDALNoDataMaskBand( GDALRasterBand * );
1434 ~GDALNoDataMaskBand() override;
1435
1436 bool IsMaskBand() const override { return true; }
1437 GDALMaskValueRange GetMaskValueRange() const override { return GMVR_0_AND_255_ONLY; }
1438
1439 static bool IsNoDataInRange(double dfNoDataValue,
1440 GDALDataType eDataType);
1441 };
1442
1443 /* ******************************************************************** */
1444 /* GDALNoDataValuesMaskBand */
1445 /* ******************************************************************** */
1446
1447 class CPL_DLL GDALNoDataValuesMaskBand : public GDALRasterBand
1448 {
1449 double *padfNodataValues;
1450
1451 CPL_DISALLOW_COPY_ASSIGN(GDALNoDataValuesMaskBand)
1452
1453 protected:
1454 CPLErr IReadBlock( int, int, void * ) override;
1455
1456 public:
1457 explicit GDALNoDataValuesMaskBand( GDALDataset * );
1458 ~GDALNoDataValuesMaskBand() override;
1459
1460 bool IsMaskBand() const override { return true; }
1461 GDALMaskValueRange GetMaskValueRange() const override { return GMVR_0_AND_255_ONLY; }
1462 };
1463
1464 /* ******************************************************************** */
1465 /* GDALRescaledAlphaBand */
1466 /* ******************************************************************** */
1467
1468 class GDALRescaledAlphaBand : public GDALRasterBand
1469 {
1470 GDALRasterBand *poParent;
1471 void *pTemp;
1472
1473 CPL_DISALLOW_COPY_ASSIGN(GDALRescaledAlphaBand)
1474
1475 protected:
1476 CPLErr IReadBlock( int, int, void * ) override;
1477 CPLErr IRasterIO( GDALRWFlag, int, int, int, int,
1478 void *, int, int, GDALDataType,
1479 GSpacing, GSpacing,
1480 GDALRasterIOExtraArg* psExtraArg ) override;
1481
1482 public:
1483 explicit GDALRescaledAlphaBand( GDALRasterBand * );
1484 ~GDALRescaledAlphaBand() override;
1485
1486 bool IsMaskBand() const override { return true; }
1487 };
1489
1490 /* ******************************************************************** */
1491 /* GDALIdentifyEnum */
1492 /* ******************************************************************** */
1493
1499 typedef enum
1500 {
1502 GDAL_IDENTIFY_UNKNOWN = -1,
1504 GDAL_IDENTIFY_FALSE = 0,
1506 GDAL_IDENTIFY_TRUE = 1
1507 } GDALIdentifyEnum;
1508
1509 /* ******************************************************************** */
1510 /* GDALDriver */
1511 /* ******************************************************************** */
1512
1524 class CPL_DLL GDALDriver : public GDALMajorObject
1525 {
1526 public:
1527 GDALDriver();
1528 ~GDALDriver() override;
1529
1530 CPLErr SetMetadataItem( const char * pszName,
1531 const char * pszValue,
1532 const char * pszDomain = "" ) override;
1533
1534 /* -------------------------------------------------------------------- */
1535 /* Public C++ methods. */
1536 /* -------------------------------------------------------------------- */
1537 GDALDataset *Create( const char * pszName,
1538 int nXSize, int nYSize, int nBands,
1539 GDALDataType eType, CSLConstList papszOptions ) CPL_WARN_UNUSED_RESULT;
1540
1541 GDALDataset *CreateMultiDimensional( const char * pszName,
1542 CSLConstList papszRootGroupOptions,
1543 CSLConstList papszOptions ) CPL_WARN_UNUSED_RESULT;
1544
1545 CPLErr Delete( const char * pszName );
1546 CPLErr Rename( const char * pszNewName,
1547 const char * pszOldName );
1548 CPLErr CopyFiles( const char * pszNewName,
1549 const char * pszOldName );
1550
1551 GDALDataset *CreateCopy( const char *, GDALDataset *,
1552 int, CSLConstList papszOptions,
1553 GDALProgressFunc pfnProgress,
1554 void * pProgressData ) CPL_WARN_UNUSED_RESULT;
1555
1556 /* -------------------------------------------------------------------- */
1557 /* The following are semiprivate, not intended to be accessed */
1558 /* by anyone but the formats instantiating and populating the */
1559 /* drivers. */
1560 /* -------------------------------------------------------------------- */
1562 GDALDataset *(*pfnOpen)( GDALOpenInfo * );
1563
1564 GDALDataset *(*pfnCreate)( const char * pszName,
1565 int nXSize, int nYSize, int nBands,
1566 GDALDataType eType,
1567 char ** papszOptions );
1568
1569 GDALDataset *(*pfnCreateEx)( GDALDriver*, const char * pszName,
1570 int nXSize, int nYSize, int nBands,
1571 GDALDataType eType,
1572 char ** papszOptions );
1573
1574 GDALDataset *(*pfnCreateMultiDimensional)( const char * pszName,
1575 CSLConstList papszRootGroupOptions,
1576 CSLConstList papszOptions );
1577
1578 CPLErr (*pfnDelete)( const char * pszName );
1579
1580 GDALDataset *(*pfnCreateCopy)( const char *, GDALDataset *,
1581 int, char **,
1582 GDALProgressFunc pfnProgress,
1583 void * pProgressData );
1584
1585 void *pDriverData;
1586
1587 void (*pfnUnloadDriver)(GDALDriver *);
1588
1596 int (*pfnIdentify)( GDALOpenInfo * );
1597 int (*pfnIdentifyEx)( GDALDriver*, GDALOpenInfo * );
1598
1599 CPLErr (*pfnRename)( const char * pszNewName,
1600 const char * pszOldName );
1601 CPLErr (*pfnCopyFiles)( const char * pszNewName,
1602 const char * pszOldName );
1603
1604 // Used for legacy OGR drivers, and Python drivers
1605 GDALDataset *(*pfnOpenWithDriverArg)( GDALDriver*, GDALOpenInfo * );
1606
1607 /* For legacy OGR drivers */
1608 GDALDataset *(*pfnCreateVectorOnly)( GDALDriver*,
1609 const char * pszName,
1610 char ** papszOptions );
1611 CPLErr (*pfnDeleteDataSource)( GDALDriver*,
1612 const char * pszName );
1614
1615 /* -------------------------------------------------------------------- */
1616 /* Helper methods. */
1617 /* -------------------------------------------------------------------- */
1619 GDALDataset *DefaultCreateCopy( const char *, GDALDataset *,
1620 int, CSLConstList papszOptions,
1621 GDALProgressFunc pfnProgress,
1622 void * pProgressData ) CPL_WARN_UNUSED_RESULT;
1623
1624 static CPLErr DefaultCreateCopyMultiDimensional(
1625 GDALDataset *poSrcDS,
1626 GDALDataset *poDstDS,
1627 bool bStrict,
1628 CSLConstList /*papszOptions*/,
1629 GDALProgressFunc pfnProgress,
1630 void * pProgressData );
1631
1632 static CPLErr DefaultCopyMasks( GDALDataset *poSrcDS,
1633 GDALDataset *poDstDS,
1634 int bStrict );
1635 static CPLErr DefaultCopyMasks( GDALDataset *poSrcDS,
1636 GDALDataset *poDstDS,
1637 int bStrict,
1638 CSLConstList papszOptions,
1639 GDALProgressFunc pfnProgress,
1640 void * pProgressData );
1642 static CPLErr QuietDelete( const char * pszName,
1643 CSLConstList papszAllowedDrivers = nullptr);
1644
1646 static CPLErr DefaultRename( const char * pszNewName,
1647 const char * pszOldName );
1648 static CPLErr DefaultCopyFiles( const char * pszNewName,
1649 const char * pszOldName );
1651
1655 static inline GDALDriverH ToHandle(GDALDriver* poDriver)
1656 { return static_cast<GDALDriverH>(poDriver); }
1657
1661 static inline GDALDriver* FromHandle(GDALDriverH hDriver)
1662 { return static_cast<GDALDriver*>(hDriver); }
1663
1664 private:
1665 CPL_DISALLOW_COPY_ASSIGN(GDALDriver)
1666 };
1667
1668 /* ******************************************************************** */
1669 /* GDALDriverManager */
1670 /* ******************************************************************** */
1671
1679 class CPL_DLL GDALDriverManager : public GDALMajorObject
1680 {
1681 int nDrivers = 0;
1682 GDALDriver **papoDrivers = nullptr;
1683 std::map<CPLString, GDALDriver*> oMapNameToDrivers{};
1684 std::string m_osDriversIniPath{};
1685
1686 GDALDriver *GetDriver_unlocked( int iDriver )
1687 { return (iDriver >= 0 && iDriver < nDrivers) ?
1688 papoDrivers[iDriver] : nullptr; }
1689
1690 GDALDriver *GetDriverByName_unlocked( const char * pszName ) const
1691 { auto oIter = oMapNameToDrivers.find(CPLString(pszName).toupper());
1692 return oIter == oMapNameToDrivers.end() ? nullptr : oIter->second;
1693 }
1694
1695 static char** GetSearchPaths(const char* pszGDAL_DRIVER_PATH);
1696
1697 static void CleanupPythonDrivers();
1698
1699 CPL_DISALLOW_COPY_ASSIGN(GDALDriverManager)
1700
1701 public:
1702 GDALDriverManager();
1703 ~GDALDriverManager();
1704
1705 int GetDriverCount( void ) const;
1706 GDALDriver *GetDriver( int );
1707 GDALDriver *GetDriverByName( const char * );
1708
1709 int RegisterDriver( GDALDriver * );
1710 void DeregisterDriver( GDALDriver * );
1711
1712 // AutoLoadDrivers is a no-op if compiled with GDAL_NO_AUTOLOAD defined.
1713 void AutoLoadDrivers();
1714 void AutoSkipDrivers();
1715 void ReorderDrivers();
1716
1717 static void AutoLoadPythonDrivers();
1718 };
1719
1720 CPL_C_START
1721 GDALDriverManager CPL_DLL * GetGDALDriverManager( void );
1722 CPL_C_END
1723
1724 /* ******************************************************************** */
1725 /* GDALAsyncReader */
1726 /* ******************************************************************** */
1727
1733 class CPL_DLL GDALAsyncReader
1734 {
1735
1736 CPL_DISALLOW_COPY_ASSIGN(GDALAsyncReader)
1737
1738 protected:
1740 GDALDataset* poDS;
1741 int nXOff;
1742 int nYOff;
1743 int nXSize;
1744 int nYSize;
1745 void * pBuf;
1746 int nBufXSize;
1747 int nBufYSize;
1748 GDALDataType eBufType;
1749 int nBandCount;
1750 int* panBandMap;
1751 int nPixelSpace;
1752 int nLineSpace;
1753 int nBandSpace;
1755
1756 public:
1757 GDALAsyncReader();
1758 virtual ~GDALAsyncReader();
1759
1763 GDALDataset* GetGDALDataset() {return poDS;}
1767 int GetXOffset() const { return nXOff; }
1771 int GetYOffset() const { return nYOff; }
1775 int GetXSize() const { return nXSize; }
1779 int GetYSize() const { return nYSize; }
1783 void * GetBuffer() {return pBuf;}
1787 int GetBufferXSize() const { return nBufXSize; }
1791 int GetBufferYSize() const { return nBufYSize; }
1795 GDALDataType GetBufferType() const { return eBufType; }
1799 int GetBandCount() const { return nBandCount; }
1803 int* GetBandMap() { return panBandMap; }
1807 int GetPixelSpace() const { return nPixelSpace; }
1811 int GetLineSpace() const { return nLineSpace; }
1815 int GetBandSpace() const { return nBandSpace; }
1816
1817 virtual GDALAsyncStatusType
1818 GetNextUpdatedRegion(double dfTimeout,
1819 int* pnBufXOff, int* pnBufYOff,
1820 int* pnBufXSize, int* pnBufYSize) = 0;
1821 virtual int LockBuffer( double dfTimeout = -1.0 );
1822 virtual void UnlockBuffer();
1823 };
1824
1825 /* ******************************************************************** */
1826 /* Multidimensional array API */
1827 /* ******************************************************************** */
1828
1829 class GDALMDArray;
1830 class GDALAttribute;
1831 class GDALDimension;
1832 class GDALEDTComponent;
1833
1834 /* ******************************************************************** */
1835 /* GDALExtendedDataType */
1836 /* ******************************************************************** */
1837
1845 class CPL_DLL GDALExtendedDataType
1846 {
1847 public:
1848 ~GDALExtendedDataType();
1849
1850 GDALExtendedDataType(const GDALExtendedDataType&);
1851
1852 GDALExtendedDataType& operator= (GDALExtendedDataType&&);
1853
1854 static GDALExtendedDataType Create(GDALDataType eType);
1855 static GDALExtendedDataType Create(const std::string& osName,
1856 size_t nTotalSize,
1857 std::vector<std::unique_ptr<GDALEDTComponent>>&& components);
1858 static GDALExtendedDataType CreateString(size_t nMaxStringLength = 0,
1859 GDALExtendedDataTypeSubType eSubType = GEDTST_NONE);
1860
1861 bool operator== (const GDALExtendedDataType& ) const;
1863 bool operator!= (const GDALExtendedDataType& other) const { return !(operator==(other)); }
1864
1869 const std::string& GetName() const { return m_osName; }
1870
1875 GDALExtendedDataTypeClass GetClass() const { return m_eClass; }
1876
1881 GDALDataType GetNumericDataType() const { return m_eNumericDT; }
1882
1889 GDALExtendedDataTypeSubType GetSubType() const { return m_eSubType; }
1890
1895 const std::vector<std::unique_ptr<GDALEDTComponent>>& GetComponents() const { return m_aoComponents; }
1896
1903 size_t GetSize() const { return m_nSize; }
1904
1909 size_t GetMaxStringLength() const { return m_nMaxStringLength; }
1910
1911 bool CanConvertTo(const GDALExtendedDataType& other) const;
1912
1913 bool NeedsFreeDynamicMemory() const;
1914
1915 void FreeDynamicMemory(void* pBuffer) const;
1916
1917 static
1918 bool CopyValue(const void* pSrc, const GDALExtendedDataType& srcType,
1919 void* pDst, const GDALExtendedDataType& dstType);
1920
1921 private:
1922 GDALExtendedDataType(size_t nMaxStringLength, GDALExtendedDataTypeSubType eSubType);
1923 explicit GDALExtendedDataType(GDALDataType eType);
1924 GDALExtendedDataType(const std::string& osName,
1925 size_t nTotalSize,
1926 std::vector<std::unique_ptr<GDALEDTComponent>>&& components);
1927
1928 std::string m_osName{};
1929 GDALExtendedDataTypeClass m_eClass = GEDTC_NUMERIC;
1930 GDALExtendedDataTypeSubType m_eSubType = GEDTST_NONE;
1931 GDALDataType m_eNumericDT = GDT_Unknown;
1932 std::vector<std::unique_ptr<GDALEDTComponent>> m_aoComponents{};
1933 size_t m_nSize = 0;
1934 size_t m_nMaxStringLength = 0;
1935 };
1936
1937 /* ******************************************************************** */
1938 /* GDALEDTComponent */
1939 /* ******************************************************************** */
1940
1946 class CPL_DLL GDALEDTComponent
1947 {
1948 public:
1949 ~GDALEDTComponent();
1950 GDALEDTComponent(const std::string& name, size_t offset, const GDALExtendedDataType& type);
1951 GDALEDTComponent(const GDALEDTComponent&);
1952
1953 bool operator== (const GDALEDTComponent& ) const;
1954
1959 const std::string& GetName() const { return m_osName; }
1960
1965 size_t GetOffset() const { return m_nOffset; }
1966
1971 const GDALExtendedDataType& GetType() const { return m_oType; }
1972
1973 private:
1974 std::string m_osName;
1975 size_t m_nOffset;
1976 GDALExtendedDataType m_oType;
1977 };
1978
1979 /* ******************************************************************** */
1980 /* GDALIHasAttribute */
1981 /* ******************************************************************** */
1982
1988 class CPL_DLL GDALIHasAttribute
1989 {
1990 protected:
1991 std::shared_ptr<GDALAttribute> GetAttributeFromAttributes(const std::string& osName) const;
1992
1993 public:
1994 virtual ~GDALIHasAttribute();
1995
1996 virtual std::shared_ptr<GDALAttribute> GetAttribute(const std::string& osName) const;
1997
1998 virtual std::vector<std::shared_ptr<GDALAttribute>> GetAttributes(CSLConstList papszOptions = nullptr) const;
1999
2000 virtual std::shared_ptr<GDALAttribute> CreateAttribute(
2001 const std::string& osName,
2002 const std::vector<GUInt64>& anDimensions,
2003 const GDALExtendedDataType& oDataType,
2004 CSLConstList papszOptions = nullptr);
2005 };
2006
2007 /* ******************************************************************** */
2008 /* GDALGroup */
2009 /* ******************************************************************** */
2010
2019 class CPL_DLL GDALGroup: public GDALIHasAttribute
2020 {
2021 protected:
2023 std::string m_osName{};
2024 std::string m_osFullName{};
2025
2026 GDALGroup(const std::string& osParentName, const std::string& osName);
2027
2028 const GDALGroup* GetInnerMostGroup(const std::string& osPathOrArrayOrDim,
2029 std::shared_ptr<GDALGroup>& curGroupHolder,
2030 std::string& osLastPart) const;
2032
2033 public:
2034 virtual ~GDALGroup();
2035
2040 const std::string& GetName() const { return m_osName; }
2041
2046 const std::string& GetFullName() const { return m_osFullName; }
2047
2048 virtual std::vector<std::string> GetMDArrayNames(CSLConstList papszOptions = nullptr) const;
2049 virtual std::shared_ptr<GDALMDArray> OpenMDArray(const std::string& osName,
2050 CSLConstList papszOptions = nullptr) const;
2051
2052 virtual std::vector<std::string> GetGroupNames(CSLConstList papszOptions = nullptr) const;
2053 virtual std::shared_ptr<GDALGroup> OpenGroup(const std::string& osName,
2054 CSLConstList papszOptions = nullptr) const;
2055
2056 virtual std::vector<std::string> GetVectorLayerNames(CSLConstList papszOptions = nullptr) const;
2057 virtual OGRLayer* OpenVectorLayer(const std::string& osName,
2058 CSLConstList papszOptions = nullptr) const;
2059
2060 virtual std::vector<std::shared_ptr<GDALDimension>> GetDimensions(CSLConstList papszOptions = nullptr) const;
2061
2062 virtual std::shared_ptr<GDALGroup> CreateGroup(const std::string& osName,
2063 CSLConstList papszOptions = nullptr);
2064
2065 virtual std::shared_ptr<GDALDimension> CreateDimension(const std::string& osName,
2066 const std::string& osType,
2067 const std::string& osDirection,
2068 GUInt64 nSize,
2069 CSLConstList papszOptions = nullptr);
2070
2071 virtual std::shared_ptr<GDALMDArray> CreateMDArray(const std::string& osName,
2072 const std::vector<std::shared_ptr<GDALDimension>>& aoDimensions,
2073 const GDALExtendedDataType& oDataType,
2074 CSLConstList papszOptions = nullptr);
2075
2076 GUInt64 GetTotalCopyCost() const;
2077
2078 virtual bool CopyFrom(const std::shared_ptr<GDALGroup>& poDstRootGroup,
2079 GDALDataset* poSrcDS,
2080 const std::shared_ptr<GDALGroup>& poSrcGroup,
2081 bool bStrict,
2082 GUInt64& nCurCost,
2083 const GUInt64 nTotalCost,
2084 GDALProgressFunc pfnProgress,
2085 void * pProgressData,
2086 CSLConstList papszOptions = nullptr);
2087
2088 virtual CSLConstList GetStructuralInfo() const;
2089
2090 std::shared_ptr<GDALMDArray> OpenMDArrayFromFullname(
2091 const std::string& osFullName,
2092 CSLConstList papszOptions = nullptr) const;
2093
2094 std::shared_ptr<GDALMDArray> ResolveMDArray(const std::string& osName,
2095 const std::string& osStartingPath,
2096 CSLConstList papszOptions = nullptr) const;
2097
2098 std::shared_ptr<GDALGroup> OpenGroupFromFullname(
2099 const std::string& osFullName,
2100 CSLConstList papszOptions = nullptr) const;
2101
2102 std::shared_ptr<GDALDimension> OpenDimensionFromFullname(
2103 const std::string& osFullName) const;
2104
2105 virtual void ClearStatistics();
2106
2108 static constexpr GUInt64 COPY_COST = 1000;
2110 };
2111
2112 /* ******************************************************************** */
2113 /* GDALAbstractMDArray */
2114 /* ******************************************************************** */
2115
2121 class CPL_DLL GDALAbstractMDArray
2122 {
2123 protected:
2125 std::string m_osName{};
2126 std::string m_osFullName{};
2127 std::weak_ptr<GDALAbstractMDArray> m_pSelf{};
2128
2129 GDALAbstractMDArray(const std::string& osParentName, const std::string& osName);
2130
2131 void SetSelf(std::weak_ptr<GDALAbstractMDArray> self) { m_pSelf = self; }
2132
2133 bool CheckReadWriteParams(const GUInt64* arrayStartIdx,
2134 const size_t* count,
2135 const GInt64*& arrayStep,
2136 const GPtrDiff_t*& bufferStride,
2137 const GDALExtendedDataType& bufferDataType,
2138 const void* buffer,
2139 const void* buffer_alloc_start,
2140 size_t buffer_alloc_size,
2141 std::vector<GInt64>& tmp_arrayStep,
2142 std::vector<GPtrDiff_t>& tmp_bufferStride) const;
2143
2144 virtual bool IRead(const GUInt64* arrayStartIdx, // array of size GetDimensionCount()
2145 const size_t* count, // array of size GetDimensionCount()
2146 const GInt64* arrayStep, // step in elements
2147 const GPtrDiff_t* bufferStride, // stride in elements
2148 const GDALExtendedDataType& bufferDataType,
2149 void* pDstBuffer) const = 0;
2150
2151 virtual bool IWrite(const GUInt64* arrayStartIdx, // array of size GetDimensionCount()
2152 const size_t* count, // array of size GetDimensionCount()
2153 const GInt64* arrayStep, // step in elements
2154 const GPtrDiff_t* bufferStride, // stride in elements
2155 const GDALExtendedDataType& bufferDataType,
2156 const void* pSrcBuffer);
2158
2159 public:
2160 virtual ~GDALAbstractMDArray();
2161
2166 const std::string& GetName() const{ return m_osName; }
2167
2172 const std::string& GetFullName() const{ return m_osFullName; }
2173
2174 GUInt64 GetTotalElementsCount() const;
2175
2176 virtual size_t GetDimensionCount() const;
2177
2178 virtual const std::vector<std::shared_ptr<GDALDimension>>& GetDimensions() const = 0;
2179
2180 virtual const GDALExtendedDataType &GetDataType() const = 0;
2181
2182 virtual std::vector<GUInt64> GetBlockSize() const;
2183
2184 virtual std::vector<size_t> GetProcessingChunkSize(size_t nMaxChunkMemory) const;
2185
2201 typedef bool (*FuncProcessPerChunkType)(
2202 GDALAbstractMDArray* array,
2203 const GUInt64* chunkArrayStartIdx,
2204 const size_t* chunkCount,
2205 GUInt64 iCurChunk,
2206 GUInt64 nChunkCount,
2207 void* pUserData);
2208
2209 virtual bool ProcessPerChunk(const GUInt64* arrayStartIdx,
2210 const GUInt64* count,
2211 const size_t* chunkSize,
2212 FuncProcessPerChunkType pfnFunc,
2213 void* pUserData);
2214
2215 virtual bool Read(const GUInt64* arrayStartIdx, // array of size GetDimensionCount()
2216 const size_t* count, // array of size GetDimensionCount()
2217 const GInt64* arrayStep, // step in elements
2218 const GPtrDiff_t* bufferStride, // stride in elements
2219 const GDALExtendedDataType& bufferDataType,
2220 void* pDstBuffer,
2221 const void* pDstBufferAllocStart = nullptr,
2222 size_t nDstBufferAllocSize = 0) const;
2223
2224 bool Write(const GUInt64* arrayStartIdx, // array of size GetDimensionCount()
2225 const size_t* count, // array of size GetDimensionCount()
2226 const GInt64* arrayStep, // step in elements
2227 const GPtrDiff_t* bufferStride, // stride in elements
2228 const GDALExtendedDataType& bufferDataType,
2229 const void* pSrcBuffer,
2230 const void* pSrcBufferAllocStart = nullptr,
2231 size_t nSrcBufferAllocSize = 0);
2232 };
2233
2234 /* ******************************************************************** */
2235 /* GDALRawResult */
2236 /* ******************************************************************** */
2237
2244 class CPL_DLL GDALRawResult
2245 {
2246 private:
2247 GDALExtendedDataType m_dt;
2248 size_t m_nEltCount;
2249 size_t m_nSize;
2250 GByte* m_raw;
2251
2252 void FreeMe();
2253
2254 GDALRawResult(const GDALRawResult&) = delete;
2255 GDALRawResult& operator=(const GDALRawResult&) = delete;
2256
2257 protected:
2258 friend class GDALAttribute;
2260 GDALRawResult(GByte* raw,
2261 const GDALExtendedDataType& dt,
2262 size_t nEltCount);
2264
2265 public:
2266 ~GDALRawResult();
2267 GDALRawResult(GDALRawResult&&);
2268 GDALRawResult& operator=(GDALRawResult&&);
2269
2271 const GByte& operator[](size_t idx) const { return m_raw[idx]; }
2273 const GByte* data() const { return m_raw; }
2275 size_t size() const { return m_nSize; }
2276
2278 GByte* StealData();
2280 };
2281
2282
2283 /* ******************************************************************** */
2284 /* GDALAttribute */
2285 /* ******************************************************************** */
2286
2297 class CPL_DLL GDALAttribute: virtual public GDALAbstractMDArray
2298 {
2299 mutable std::string m_osCachedVal{};
2300
2301 protected:
2303 GDALAttribute(const std::string& osParentName, const std::string& osName);
2305
2306 public:
2307
2308 std::vector<GUInt64> GetDimensionsSize() const;
2309
2310 GDALRawResult ReadAsRaw() const;
2311 const char* ReadAsString() const;
2312 int ReadAsInt() const;
2313 double ReadAsDouble() const;
2314 CPLStringList ReadAsStringArray() const;
2315 std::vector<int> ReadAsIntArray() const;
2316 std::vector<double> ReadAsDoubleArray() const;
2317
2318 using GDALAbstractMDArray::Write;
2319 bool Write(const void* pabyValue, size_t nLen);
2320 bool Write(const char*);
2321 bool WriteInt(int);
2322 bool Write(double);
2323 bool Write(CSLConstList);
2324 bool Write(const double*, size_t);
2325
2327 static constexpr GUInt64 COPY_COST = 100;
2329
2330 };
2331
2332 /************************************************************************/
2333 /* GDALAttributeString */
2334 /************************************************************************/
2335
2337 class CPL_DLL GDALAttributeString final: public GDALAttribute
2338 {
2339 std::vector<std::shared_ptr<GDALDimension>> m_dims{};
2340 GDALExtendedDataType m_dt = GDALExtendedDataType::CreateString();
2341 std::string m_osValue;
2342
2343 protected:
2344
2345 bool IRead(const GUInt64* ,
2346 const size_t* ,
2347 const GInt64* ,
2348 const GPtrDiff_t* ,
2349 const GDALExtendedDataType& bufferDataType,
2350 void* pDstBuffer) const override;
2351
2352 public:
2353 GDALAttributeString(const std::string& osParentName,
2354 const std::string& osName,
2355 const std::string& osValue,
2356 GDALExtendedDataTypeSubType eSubType = GEDTST_NONE);
2357
2358 const std::vector<std::shared_ptr<GDALDimension>>& GetDimensions() const override;
2359
2360 const GDALExtendedDataType &GetDataType() const override;
2361 };
2363
2364 /************************************************************************/
2365 /* GDALAttributeNumeric */
2366 /************************************************************************/
2367
2369 class CPL_DLL GDALAttributeNumeric final: public GDALAttribute
2370 {
2371 std::vector<std::shared_ptr<GDALDimension>> m_dims{};
2372 GDALExtendedDataType m_dt;
2373 int m_nValue = 0;
2374 double m_dfValue = 0;
2375 std::vector<GUInt32> m_anValuesUInt32{};
2376
2377 protected:
2378
2379 bool IRead(const GUInt64* ,
2380 const size_t* ,
2381 const GInt64* ,
2382 const GPtrDiff_t* ,
2383 const GDALExtendedDataType& bufferDataType,
2384 void* pDstBuffer) const override;
2385
2386 public:
2387 GDALAttributeNumeric(const std::string& osParentName,
2388 const std::string& osName,
2389 double dfValue);
2390 GDALAttributeNumeric(const std::string& osParentName,
2391 const std::string& osName,
2392 int nValue);
2393 GDALAttributeNumeric(const std::string& osParentName,
2394 const std::string& osName,
2395 const std::vector<GUInt32>& anValues);
2396
2397 const std::vector<std::shared_ptr<GDALDimension>>& GetDimensions() const override;
2398
2399 const GDALExtendedDataType &GetDataType() const override;
2400 };
2402
2403 /* ******************************************************************** */
2404 /* GDALMDArray */
2405 /* ******************************************************************** */
2406
2415 class CPL_DLL GDALMDArray: virtual public GDALAbstractMDArray, public GDALIHasAttribute
2416 {
2417 friend class GDALMDArrayResampled;
2418 std::shared_ptr<GDALMDArray> GetView(const std::vector<GUInt64>& indices) const;
2419
2420 inline std::shared_ptr<GDALMDArray> atInternal(std::vector<GUInt64>& indices) const
2421 {
2422 return GetView(indices);
2423 }
2424
2425 template<typename... GUInt64VarArg>
2426 // cppcheck-suppress functionStatic
2427 inline std::shared_ptr<GDALMDArray> atInternal(std::vector<GUInt64>& indices,
2428 GUInt64 idx, GUInt64VarArg... tail) const
2429 {
2430 indices.push_back(idx);
2431 return atInternal(indices, tail...);
2432 }
2433
2434 mutable bool m_bHasTriedCachedArray = false;
2435 mutable std::shared_ptr<GDALMDArray> m_poCachedArray{};
2436
2437 protected:
2439 GDALMDArray(const std::string& osParentName, const std::string& osName);
2440
2441 virtual bool IAdviseRead(const GUInt64* arrayStartIdx,
2442 const size_t* count,
2443 CSLConstList papszOptions) const;
2444
2445 virtual bool IsCacheable() const { return true; }
2446
2447 virtual bool SetStatistics( bool bApproxStats,
2448 double dfMin, double dfMax,
2449 double dfMean, double dfStdDev,
2450 GUInt64 nValidCount );
2451
2452 static std::string MassageName(const std::string& inputName);
2453
2454 std::shared_ptr<GDALGroup> GetCacheRootGroup(bool bCanCreate,
2455 std::string& osCacheFilenameOut) const;
2457
2458 public:
2459
2460 GUInt64 GetTotalCopyCost() const;
2461
2462 virtual bool CopyFrom(GDALDataset* poSrcDS,
2463 const GDALMDArray* poSrcArray,
2464 bool bStrict,
2465 GUInt64& nCurCost,
2466 const GUInt64 nTotalCost,
2467 GDALProgressFunc pfnProgress,
2468 void * pProgressData);
2469
2471 virtual bool IsWritable() const = 0;
2472
2481 virtual const std::string& GetFilename() const = 0;
2482
2483 virtual CSLConstList GetStructuralInfo() const;
2484
2485 virtual const std::string& GetUnit() const;
2486
2487 virtual bool SetUnit(const std::string& osUnit);
2488
2489 virtual bool SetSpatialRef(const OGRSpatialReference* poSRS);
2490
2491 virtual std::shared_ptr<OGRSpatialReference> GetSpatialRef() const;
2492
2493 virtual const void* GetRawNoDataValue() const;
2494
2495 double GetNoDataValueAsDouble(bool* pbHasNoData = nullptr) const;
2496
2497 int64_t GetNoDataValueAsInt64(bool* pbHasNoData = nullptr) const;
2498
2499 uint64_t GetNoDataValueAsUInt64(bool* pbHasNoData = nullptr) const;
2500
2501 virtual bool SetRawNoDataValue(const void* pRawNoData);
2502
2504 bool SetNoDataValue(int nNoData) { return SetNoDataValue(static_cast<int64_t>(nNoData)); }
2506
2507 bool SetNoDataValue(double dfNoData);
2508
2509 bool SetNoDataValue(int64_t nNoData);
2510
2511 bool SetNoDataValue(uint64_t nNoData);
2512
2513 virtual double GetOffset(bool* pbHasOffset = nullptr, GDALDataType* peStorageType = nullptr) const;
2514
2515 virtual double GetScale(bool* pbHasScale = nullptr, GDALDataType* peStorageType = nullptr) const;
2516
2517 virtual bool SetOffset(double dfOffset, GDALDataType eStorageType = GDT_Unknown);
2518
2519 virtual bool SetScale(double dfScale, GDALDataType eStorageType = GDT_Unknown);
2520
2521 std::shared_ptr<GDALMDArray> GetView(const std::string& viewExpr) const;
2522
2523 std::shared_ptr<GDALMDArray> operator[](const std::string& fieldName) const;
2524
2534 // sphinx 4.1.0 / breathe 4.30.0 don't like typename...
2536 template<typename... GUInt64VarArg>
2538 // cppcheck-suppress functionStatic
2539 std::shared_ptr<GDALMDArray> at(GUInt64 idx, GUInt64VarArg... tail) const
2540 {
2541 std::vector<GUInt64> indices;
2542 indices.push_back(idx);
2543 return atInternal(indices, tail...);
2544 }
2545
2546 virtual std::shared_ptr<GDALMDArray> Transpose(const std::vector<int>& anMapNewAxisToOldAxis) const;
2547
2548 std::shared_ptr<GDALMDArray> GetUnscaled() const;
2549
2550 virtual std::shared_ptr<GDALMDArray> GetMask(CSLConstList papszOptions) const;
2551
2552 std::shared_ptr<GDALMDArray>
2553 GetResampled( const std::vector<std::shared_ptr<GDALDimension>>& apoNewDims,
2554 GDALRIOResampleAlg resampleAlg,
2555 const OGRSpatialReference* poTargetSRS,
2556 CSLConstList papszOptions ) const;
2557
2558 virtual GDALDataset* AsClassicDataset(size_t iXDim, size_t iYDim) const;
2559
2560 virtual CPLErr GetStatistics( bool bApproxOK, bool bForce,
2561 double *pdfMin, double *pdfMax,
2562 double *pdfMean, double *padfStdDev,
2563 GUInt64* pnValidCount,
2564 GDALProgressFunc pfnProgress, void *pProgressData );
2565
2566 virtual bool ComputeStatistics( bool bApproxOK,
2567 double *pdfMin, double *pdfMax,
2568 double *pdfMean, double *pdfStdDev,
2569 GUInt64* pnValidCount,
2570 GDALProgressFunc, void *pProgressData );
2571
2572 virtual void ClearStatistics();
2573
2574 virtual std::vector<std::shared_ptr<GDALMDArray>> GetCoordinateVariables() const;
2575
2576 bool AdviseRead(const GUInt64* arrayStartIdx,
2577 const size_t* count,
2578 CSLConstList papszOptions = nullptr) const;
2579
2580 bool IsRegularlySpaced(double& dfStart, double& dfIncrement) const;
2581
2582 bool GuessGeoTransform(size_t nDimX, size_t nDimY, bool bPixelIsPoint,
2583 double adfGeoTransform[6]) const;
2584
2585 bool Cache( CSLConstList papszOptions = nullptr ) const;
2586
2587 bool Read(const GUInt64* arrayStartIdx, // array of size GetDimensionCount()
2588 const size_t* count, // array of size GetDimensionCount()
2589 const GInt64* arrayStep, // step in elements
2590 const GPtrDiff_t* bufferStride, // stride in elements
2591 const GDALExtendedDataType& bufferDataType,
2592 void* pDstBuffer,
2593 const void* pDstBufferAllocStart = nullptr,
2594 size_t nDstBufferAllocSize = 0) const override final;
2595
2597 static constexpr GUInt64 COPY_COST = 1000;
2598
2599 bool CopyFromAllExceptValues(const GDALMDArray* poSrcArray,
2600 bool bStrict,
2601 GUInt64& nCurCost,
2602 const GUInt64 nTotalCost,
2603 GDALProgressFunc pfnProgress,
2604 void * pProgressData);
2605 struct Range
2606 {
2607 GUInt64 m_nStartIdx;
2608 GInt64 m_nIncr;
2609 Range(GUInt64 nStartIdx = 0, GInt64 nIncr = 0):
2610 m_nStartIdx(nStartIdx), m_nIncr(nIncr) {}
2611 };
2612
2613 struct ViewSpec
2614 {
2615 std::string m_osFieldName{};
2616
2617 // or
2618
2619 std::vector<size_t> m_mapDimIdxToParentDimIdx{}; // of size m_dims.size()
2620 std::vector<Range> m_parentRanges{} ; // of size m_poParent->GetDimensionCount()
2621 };
2622
2623 virtual std::shared_ptr<GDALMDArray> GetView(const std::string& viewExpr,
2624 bool bRenameDimensions,
2625 std::vector<ViewSpec>& viewSpecs) const;
2627 };
2628
2630 bool GDALMDRasterIOFromBand(GDALRasterBand* poBand,
2631 GDALRWFlag eRWFlag,
2632 size_t iDimX,
2633 size_t iDimY,
2634 const GUInt64* arrayStartIdx,
2635 const size_t* count,
2636 const GInt64* arrayStep,
2637 const GPtrDiff_t* bufferStride,
2638 const GDALExtendedDataType& bufferDataType,
2639 void* pBuffer);
2641
2642 /************************************************************************/
2643 /* GDALMDArrayRegularlySpaced */
2644 /************************************************************************/
2645
2647 class CPL_DLL GDALMDArrayRegularlySpaced: public GDALMDArray
2648 {
2649 double m_dfStart;
2650 double m_dfIncrement;
2651 double m_dfOffsetInIncrement;
2652 GDALExtendedDataType m_dt = GDALExtendedDataType::Create(GDT_Float64);
2653 std::vector<std::shared_ptr<GDALDimension>> m_dims;
2654 std::vector<std::shared_ptr<GDALAttribute>> m_attributes{};
2655 std::string m_osEmptyFilename{};
2656
2657 protected:
2658
2659 bool IRead(const GUInt64* ,
2660 const size_t* ,
2661 const GInt64* ,
2662 const GPtrDiff_t* ,
2663 const GDALExtendedDataType& bufferDataType,
2664 void* pDstBuffer) const override;
2665
2666 public:
2667 GDALMDArrayRegularlySpaced(
2668 const std::string& osParentName,
2669 const std::string& osName,
2670 const std::shared_ptr<GDALDimension>& poDim,
2671 double dfStart, double dfIncrement,
2672 double dfOffsetInIncrement);
2673
2674 bool IsWritable() const override { return false; }
2675
2676 const std::string& GetFilename() const override { return m_osEmptyFilename; }
2677
2678 const std::vector<std::shared_ptr<GDALDimension>>& GetDimensions() const override;
2679
2680 const GDALExtendedDataType &GetDataType() const override;
2681
2682 std::vector<std::shared_ptr<GDALAttribute>> GetAttributes(CSLConstList) const override;
2683
2684 void AddAttribute(const std::shared_ptr<GDALAttribute>& poAttr);
2685 };
2687
2688 /* ******************************************************************** */
2689 /* GDALDimension */
2690 /* ******************************************************************** */
2691
2703 class CPL_DLL GDALDimension
2704 {
2705 public:
2707 GDALDimension(const std::string& osParentName,
2708 const std::string& osName,
2709 const std::string& osType,
2710 const std::string& osDirection,
2711 GUInt64 nSize);
2713
2714 virtual ~GDALDimension();
2715
2720 const std::string& GetName() const { return m_osName; }
2721
2726 const std::string& GetFullName() const { return m_osFullName; }
2727
2736 const std::string& GetType() const { return m_osType; }
2737
2746 const std::string& GetDirection() const { return m_osDirection; }
2747
2752 GUInt64 GetSize() const { return m_nSize; }
2753
2754 virtual std::shared_ptr<GDALMDArray> GetIndexingVariable() const;
2755
2756 virtual bool SetIndexingVariable(std::shared_ptr<GDALMDArray> poIndexingVariable);
2757
2758 protected:
2760 std::string m_osName;
2761 std::string m_osFullName;
2762 std::string m_osType;
2763 std::string m_osDirection;
2764 GUInt64 m_nSize;
2766 };
2767
2768
2769 /************************************************************************/
2770 /* GDALDimensionWeakIndexingVar() */
2771 /************************************************************************/
2772
2774 class CPL_DLL GDALDimensionWeakIndexingVar: public GDALDimension
2775 {
2776 std::weak_ptr<GDALMDArray> m_poIndexingVariable{};
2777
2778 public:
2779 GDALDimensionWeakIndexingVar(const std::string& osParentName,
2780 const std::string& osName,
2781 const std::string& osType,
2782 const std::string& osDirection,
2783 GUInt64 nSize);
2784
2785 std::shared_ptr<GDALMDArray> GetIndexingVariable() const override;
2786
2787 bool SetIndexingVariable(std::shared_ptr<GDALMDArray> poIndexingVariable) override;
2788 };
2790
2791 /************************************************************************/
2792 /* GDALAntiRecursionGuard */
2793 /************************************************************************/
2794
2796 struct GDALAntiRecursionStruct;
2797 class GDALAntiRecursionGuard
2798 {
2799 GDALAntiRecursionStruct* m_psAntiRecursionStruct;
2800 std::string m_osIdentifier;
2801 int m_nDepth;
2802
2803 GDALAntiRecursionGuard(const GDALAntiRecursionGuard&) = delete;
2804 GDALAntiRecursionGuard& operator= (const GDALAntiRecursionGuard&) = delete;
2805
2806 public:
2807 explicit GDALAntiRecursionGuard(const std::string& osIdentifier);
2808 GDALAntiRecursionGuard(const GDALAntiRecursionGuard& other, const std::string& osIdentifier);
2809 ~GDALAntiRecursionGuard();
2810 int GetCallDepth() const { return m_nDepth; }
2811 };
2813
2814
2815 /* ==================================================================== */
2816 /* An assortment of overview related stuff. */
2817 /* ==================================================================== */
2818
2820 /* Only exported for drivers as plugin. Signature may change */
2821 CPLErr CPL_DLL
2822 GDALRegenerateOverviewsMultiBand(int nBands, GDALRasterBand** papoSrcBands,
2823 int nOverviews,
2824 GDALRasterBand*** papapoOverviewBands,
2825 const char * pszResampling,
2826 GDALProgressFunc pfnProgress, void * pProgressData );
2827
2828 typedef CPLErr (*GDALResampleFunction)
2829 ( double dfXRatioDstToSrc,
2830 double dfYRatioDstToSrc,
2831 double dfSrcXDelta,
2832 double dfSrcYDelta,
2833 GDALDataType eWrkDataType,
2834 const void * pChunk,
2835 const GByte * pabyChunkNodataMask,
2836 int nChunkXOff, int nChunkXSize,
2837 int nChunkYOff, int nChunkYSize,
2838 int nDstXOff, int nDstXOff2,
2839 int nDstYOff, int nDstYOff2,
2840 GDALRasterBand * poOverview,
2841 void** ppDstBuffer,
2842 GDALDataType* peDstBufferDataType,
2843 const char * pszResampling,
2844 int bHasNoData, float fNoDataValue,
2845 GDALColorTable* poColorTable,
2846 GDALDataType eSrcDataType,
2847 bool bPropagateNoData );
2848
2849 GDALResampleFunction GDALGetResampleFunction(const char* pszResampling,
2850 int* pnRadius);
2851
2852 GDALDataType GDALGetOvrWorkDataType(const char* pszResampling,
2853 GDALDataType eSrcDataType);
2854
2855 CPL_C_START
2856
2857 CPLErr CPL_DLL
2858 HFAAuxBuildOverviews( const char *pszOvrFilename, GDALDataset *poParentDS,
2859 GDALDataset **ppoDS,
2860 int nBands, int *panBandList,
2861 int nNewOverviews, int *panNewOverviewList,
2862 const char *pszResampling,
2863 GDALProgressFunc pfnProgress,
2864 void *pProgressData );
2865
2866 CPLErr CPL_DLL
2867 GTIFFBuildOverviews( const char * pszFilename,
2868 int nBands, GDALRasterBand **papoBandList,
2869 int nOverviews, int * panOverviewList,
2870 const char * pszResampling,
2871 GDALProgressFunc pfnProgress, void * pProgressData );
2872
2873 int CPL_DLL GDALBandGetBestOverviewLevel(GDALRasterBand* poBand,
2874 int &nXOff, int &nYOff,
2875 int &nXSize, int &nYSize,
2876 int nBufXSize, int nBufYSize) CPL_WARN_DEPRECATED("Use GDALBandGetBestOverviewLevel2 instead");
2877 int CPL_DLL GDALBandGetBestOverviewLevel2(GDALRasterBand* poBand,
2878 int &nXOff, int &nYOff,
2879 int &nXSize, int &nYSize,
2880 int nBufXSize, int nBufYSize,
2881 GDALRasterIOExtraArg* psExtraArg);
2882
2883 int CPL_DLL GDALOvLevelAdjust( int nOvLevel, int nXSize ) CPL_WARN_DEPRECATED("Use GDALOvLevelAdjust2 instead");
2884 int CPL_DLL GDALOvLevelAdjust2( int nOvLevel, int nXSize, int nYSize );
2885 int CPL_DLL GDALComputeOvFactor( int nOvrXSize, int nRasterXSize,
2886 int nOvrYSize, int nRasterYSize );
2887
2888 GDALDataset CPL_DLL *
2889 GDALFindAssociatedAuxFile( const char *pszBasefile, GDALAccess eAccess,
2890 GDALDataset *poDependentDS );
2891
2892 /* ==================================================================== */
2893 /* Infrastructure to check that dataset characteristics are valid */
2894 /* ==================================================================== */
2895
2896 int CPL_DLL GDALCheckDatasetDimensions( int nXSize, int nYSize );
2897 int CPL_DLL GDALCheckBandCount( int nBands, int bIsZeroAllowed );
2898
2899 /* Internal use only */
2900
2901 /* CPL_DLL exported, but only for in-tree drivers that can be built as plugins */
2902 int CPL_DLL GDALReadWorldFile2( const char *pszBaseFilename, const char *pszExtension,
2903 double *padfGeoTransform, char** papszSiblingFiles,
2904 char** ppszWorldFileNameOut);
2905 int GDALReadTabFile2( const char * pszBaseFilename,
2906 double *padfGeoTransform, char **ppszWKT,
2907 int *pnGCPCount, GDAL_GCP **ppasGCPs,
2908 char** papszSiblingFiles, char** ppszTabFileNameOut );
2909
2910 void CPL_DLL GDALCopyRasterIOExtraArg(GDALRasterIOExtraArg* psDestArg,
2911 GDALRasterIOExtraArg* psSrcArg);
2912
2913 CPL_C_END
2914
2915 void GDALNullifyOpenDatasetsList();
2916 CPLMutex** GDALGetphDMMutex();
2917 CPLMutex** GDALGetphDLMutex();
2918 void GDALNullifyProxyPoolSingleton();
2919 void GDALSetResponsiblePIDForCurrentThread(GIntBig responsiblePID);
2920 GIntBig GDALGetResponsiblePIDForCurrentThread();
2921
2922 CPLString GDALFindAssociatedFile( const char *pszBasename, const char *pszExt,
2923 CSLConstList papszSiblingFiles, int nFlags );
2924
2925 CPLErr CPL_DLL EXIFExtractMetadata(char**& papszMetadata,
2926 void *fpL, int nOffset,
2927 int bSwabflag, int nTIFFHEADER,
2928 int& nExifOffset, int& nInterOffset, int& nGPSOffset);
2929
2930 int GDALValidateOpenOptions( GDALDriverH hDriver,
2931 const char* const* papszOptionOptions);
2932 int GDALValidateOptions( const char* pszOptionList,
2933 const char* const* papszOptionsToValidate,
2934 const char* pszErrorMessageOptionType,
2935 const char* pszErrorMessageContainerName);
2936
2937 GDALRIOResampleAlg GDALRasterIOGetResampleAlg(const char* pszResampling);
2938 const char* GDALRasterIOGetResampleAlg(GDALRIOResampleAlg eResampleAlg);
2939
2940 void GDALRasterIOExtraArgSetResampleAlg(GDALRasterIOExtraArg* psExtraArg,
2941 int nXSize, int nYSize,
2942 int nBufXSize, int nBufYSize);
2943
2944
2945 GDALDataset* GDALCreateOverviewDataset(GDALDataset* poDS, int nOvrLevel,
2946 int bThisLevelOnly);
2947
2948 // Should cover particular cases of #3573, #4183, #4506, #6578
2949 // Behavior is undefined if fVal1 or fVal2 are NaN (should be tested before
2950 // calling this function)
2951 template<class T> inline bool ARE_REAL_EQUAL(T fVal1, T fVal2, int ulp = 2)
2952 {
2953 return fVal1 == fVal2 || /* Should cover infinity */
2954 std::abs(fVal1 - fVal2) < std::numeric_limits<float>::epsilon() * std::abs(fVal1+fVal2) * ulp;
2955 }
2956
2957 double GDALAdjustNoDataCloseToFloatMax(double dfVal);
2958
2959 #define DIV_ROUND_UP(a, b) ( ((a) % (b)) == 0 ? ((a) / (b)) : (((a) / (b)) + 1) )
2960
2961 // Number of data samples that will be used to compute approximate statistics
2962 // (minimum value, maximum value, etc.)
2963 #define GDALSTAT_APPROX_NUMSAMPLES 2500
2964
2965 void GDALSerializeGCPListToXML( CPLXMLNode* psParentNode,
2966 GDAL_GCP* pasGCPList,
2967 int nGCPCount,
2968 const OGRSpatialReference* poGCP_SRS );
2969 void GDALDeserializeGCPListFromXML( CPLXMLNode* psGCPList,
2970 GDAL_GCP** ppasGCPList,
2971 int* pnGCPCount,
2972 OGRSpatialReference** ppoGCP_SRS );
2973
2974 void GDALSerializeOpenOptionsToXML( CPLXMLNode* psParentNode, char** papszOpenOptions);
2975 char** GDALDeserializeOpenOptionsFromXML( CPLXMLNode* psParentNode );
2976
2977 int GDALCanFileAcceptSidecarFile(const char* pszFilename);
2978
2979 bool GDALCanReliablyUseSiblingFileList(const char* pszFilename);
2980
2981 bool CPL_DLL GDALIsDriverDeprecatedForGDAL35StillEnabled(const char* pszDriverName, const char* pszExtraMsg = "");
2982
2983 typedef enum
2984 {
2985 GSF_UNSIGNED_INT,
2986 GSF_SIGNED_INT,
2987 GSF_FLOATING_POINT,
2988 } GDALBufferSampleFormat;
2989
2990 bool CPL_DLL GDALBufferHasOnlyNoData(const void* pBuffer,
2991 double dfNoDataValue,
2992 size_t nWidth, size_t nHeight,
2993 size_t nLineStride,
2994 size_t nComponents,
2995 int nBitsPerSample,
2996 GDALBufferSampleFormat nSampleFormat);
2997
2998 void CPL_DLL GDALCopyNoDataValue(GDALRasterBand* poDstBand,
2999 GDALRasterBand* poSrcBand);
3000
3001 double CPL_DLL GDALGetNoDataValueCastToDouble(int64_t nVal);
3002 double CPL_DLL GDALGetNoDataValueCastToDouble(uint64_t nVal);
3003
3005
3006 #endif /* ndef GDAL_PRIV_H_INCLUDED */
GDAL_IDENTIFY_UNKNOWN
@ GDAL_IDENTIFY_UNKNOWN
Identify could not determine if the file is recognized or not by the probed driver.
Definition: gdal_priv.h:1502
GDALDimension::GetFullName
const std::string & GetFullName() const
Return the full name.
Definition: gdal_priv.h:2726
CPL_PRINT_FUNC_FORMAT
#define CPL_PRINT_FUNC_FORMAT(format_idx, arg_idx)
Tag a function to have printf() formatting.
Definition: cpl_port.h:841
GDAL_IDENTIFY_FALSE
@ GDAL_IDENTIFY_FALSE
Identify determined the file is not recognized by the probed driver.
Definition: gdal_priv.h:1504
GDALOpenInfo::fpL
VSILFILE * fpL
Pointer to the file.
Definition: gdal_priv.h:295
GDALExtendedDataType::GetSize
size_t GetSize() const
Return data type size in bytes.
Definition: gdal_priv.h:1903
GDALDimension::SetIndexingVariable
virtual bool SetIndexingVariable(std::shared_ptr< GDALMDArray > poIndexingVariable)
Set the variable that is used to index the dimension.
Definition: gdalmultidim.cpp:8239
GDALGetDataTypeSizeBytes
int GDALGetDataTypeSizeBytes(GDALDataType)
Get data type size in bytes.
Definition: gdal_misc.cpp:323
GDALGroup::GetFullName
const std::string & GetFullName() const
Return the full name of the group.
Definition: gdal_priv.h:2046
GDALRasterBand::GetMaskValueRange
virtual GDALMaskValueRange GetMaskValueRange() const
Returns the range of values that a mask band can take.
Definition: gdalrasterband.cpp:6717
GByte
unsigned char GByte
Unsigned byte type.
Definition: cpl_port.h:203
GDALAsyncReader::GetYOffset
int GetYOffset() const
Return y offset.
Definition: gdal_priv.h:1771
GDALExtendedDataType
Class used to represent potentially complex data types.
Definition: gdal_priv.h:1845
GDALRasterBlock::GetYSize
int GetYSize() const
Return the height of the block.
Definition: gdal_priv.h:982
GDALDataset::Layers::Iterator::iterator_category
std::input_iterator_tag iterator_category
iterator_category
Definition: gdal_priv.h:728
GUInt64
GUIntBig GUInt64
Unsigned 64 bit integer type.
Definition: cpl_port.h:251
gdal.h
GDALOpenInfo
Class for dataset open functions.
Definition: gdal_priv.h:268
GDALDataset::Layers::Iterator
Layer iterator.
Definition: gdal_priv.h:718
GDALRasterBand::ComputeStatistics
virtual CPLErr ComputeStatistics(int bApproxOK, double *pdfMin, double *pdfMax, double *pdfMean, double *pdfStdDev, GDALProgressFunc, void *pProgressData)
Compute image statistics.
Definition: gdalrasterband.cpp:5214
GDALAsyncReader::GetPixelSpace
int GetPixelSpace() const
Return pixel spacing.
Definition: gdal_priv.h:1807
GDALAbstractMDArray::GetFullName
const std::string & GetFullName() const
Return the name of an array or attribute.
Definition: gdal_priv.h:2172
GDALRasterBlock::GetBlockSize
GPtrDiff_t GetBlockSize() const
Return the block size in bytes.
Definition: gdal_priv.h:994
GDALEDTComponent
Class for a component of a compound extended data type.
Definition: gdal_priv.h:1946
GDALAsyncReader::GetBandCount
int GetBandCount() const
Return band count.
Definition: gdal_priv.h:1799
GDALRasterBand::IsMaskBand
virtual bool IsMaskBand() const
Returns whether a band is a mask band.
Definition: gdalrasterband.cpp:6667
begin
OGRLayer::FeatureIterator begin(OGRLayer *poLayer)
Return begin of feature iterator.
Definition: ogrsf_frmts.h:289
GDALOpenEx
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
GDALDataset::Layers::Iterator::difference_type
void difference_type
difference_type
Definition: gdal_priv.h:726
GDALMDArray::IsWritable
virtual bool IsWritable() const =0
Return whether an array is writable.
OGRStyleTable
This class represents a style table.
Definition: ogr_featurestyle.h:84
GEDTC_NUMERIC
@ GEDTC_NUMERIC
Numeric value.
Definition: gdal.h:294
CPLStringList
String list class designed around our use of C "char**" string lists.
Definition: cpl_string.h:428
GDALAsyncReader
Class used as a session object for asynchronous requests.
Definition: gdal_priv.h:1733
GDT_Unknown
@ GDT_Unknown
Definition: gdal.h:64
GMVR_0_AND_255_ONLY
@ GMVR_0_AND_255_ONLY
Definition: gdal_priv.h:1144
GDALExtendedDataType::GetClass
GDALExtendedDataTypeClass GetClass() const
Return type class.
Definition: gdal_priv.h:1875
GDALAsyncReader::GetBufferYSize
int GetBufferYSize() const
Return buffer height.
Definition: gdal_priv.h:1791
cpl_minixml.h
GDALDriver
Format specific driver.
Definition: gdal_priv.h:1524
cpl_vsi.h
OGRSpatialReference
This class represents an OpenGIS Spatial Reference System, and contains methods for converting betwee...
Definition: ogr_spatialref.h:157
GDALAbstractMDArray
Abstract class, implemented by GDALAttribute and GDALMDArray.
Definition: gdal_priv.h:2121
GDALDataset::Bands
Class returned by GetBands() that act as a container for raster bands.
Definition: gdal_priv.h:475
GDALMDArray::at
std::shared_ptr< GDALMDArray > at(GUInt64 idx, GUInt64VarArg... tail) const
Return a view of the array using integer indexing.
Definition: gdal_priv.h:2539
GDALColorTableH
void * GDALColorTableH
Opaque type used for the C bindings of the C++ GDALColorTable class.
Definition: gdal.h:278
GDALAsyncReader::GetLineSpace
int GetLineSpace() const
Return line spacing.
Definition: gdal_priv.h:1811
GDALClose
void GDALClose(GDALDatasetH)
Close GDAL dataset.
Definition: gdaldataset.cpp:3757
GDALRasterBlock::GetDataRef
void * GetDataRef(void)
Return the data buffer.
Definition: gdal_priv.h:990
GDALOpenInfo::nOpenFlags
int nOpenFlags
Open flags.
Definition: gdal_priv.h:287
GDALOpenInfo::papszOpenOptions
char ** papszOpenOptions
Open options.
Definition: gdal_priv.h:282
GDALMajorObject::SetMetadataItem
virtual CPLErr SetMetadataItem(const char *pszName, const char *pszValue, const char *pszDomain="")
Set single metadata item.
Definition: gdalmajorobject.cpp:388
OGRGeometry
Abstract base class for all geometry classes.
Definition: ogr_geometry.h:326
GDALColorEntry
Color tuple.
Definition: gdal.h:1320
GDALDimension::GetName
const std::string & GetName() const
Return the name.
Definition: gdal_priv.h:2720
GDALAbstractMDArray::GetDimensions
virtual const std::vector< std::shared_ptr< GDALDimension > > & GetDimensions() const =0
Return the dimensions of an attribute/array.
GDALColorInterp
GDALColorInterp
Definition: gdal.h:204
OGRLayer
This class represents a layer of simple features, with access methods.
Definition: ogrsf_frmts.h:70
CPLString
Convenient string class based on std::string.
Definition: cpl_string.h:319
GDALRasterBand
A single raster band (or channel).
Definition: gdal_priv.h:1150
GInt64
GIntBig GInt64
Signed 64 bit integer type.
Definition: cpl_port.h:249
GDALIdentifyEnum
GDALIdentifyEnum
Enumeration used by GDALDriver::pfnIdentify().
Definition: gdal_priv.h:1499
GDALAsyncReader::GetBandSpace
int GetBandSpace() const
Return band spacing.
Definition: gdal_priv.h:1815
GMVR_0_AND_1_ONLY
@ GMVR_0_AND_1_ONLY
Definition: gdal_priv.h:1143
GDALIHasAttribute::GetAttributes
virtual std::vector< std::shared_ptr< GDALAttribute > > GetAttributes(CSLConstList papszOptions=nullptr) const
Return the list of attributes contained in a GDALMDArray or GDALGroup.
Definition: gdalmultidim.cpp:223
GPtrDiff_t
int GPtrDiff_t
Integer type large enough to hold the difference between 2 addresses.
Definition: cpl_port.h:266
GDALDimension::GetDirection
const std::string & GetDirection() const
Return the axis direction.
Definition: gdal_priv.h:2746
GDALAsyncReader::GetBufferType
GDALDataType GetBufferType() const
Return buffer data type.
Definition: gdal_priv.h:1795
GDALExtendedDataTypeClass
GDALExtendedDataTypeClass
Enumeration giving the class of a GDALExtendedDataType.
Definition: gdal.h:292
GDALMaskValueRange
GDALMaskValueRange
Range of values found in a mask band.
Definition: gdal_priv.h:1140
GDALRawResult::data
const GByte * data() const
Return pointer to the start of data.
Definition: gdal_priv.h:2273
GDALDataType
GDALDataType
Definition: gdal.h:63
CPLXMLNode
Document node structure.
Definition: cpl_minixml.h:69
OGRFeatureUniquePtr
std::unique_ptr< OGRFeature, OGRFeatureUniquePtrDeleter > OGRFeatureUniquePtr
Unique pointer type for OGRFeature.
Definition: ogr_feature.h:837
GDALAbstractMDArray::GetName
const std::string & GetName() const
Return the name of an array or attribute.
Definition: gdal_priv.h:2166
GDALRasterBlock
A single raster block in the block cache.
Definition: gdal_priv.h:917
GDALMajorObjectH
void * GDALMajorObjectH
Opaque type used for the C bindings of the C++ GDALMajorObject class.
Definition: gdal.h:266
GDALRawResult
Store the raw result of an attribute value, which might contain dynamically allocated structures (lik...
Definition: gdal_priv.h:2244
GDALGroup
Class modeling a named container of GDALAttribute, GDALMDArray, OGRLayer or other GDALGroup.
Definition: gdal_priv.h:2019
GDALDataset
A set of associated raster bands, usually from one file.
Definition: gdal_priv.h:339
GDALDataset::GetOpenOptions
char ** GetOpenOptions()
Return open options.
Definition: gdal_priv.h:610
GDALDataset::BuildOverviews
CPLErr BuildOverviews(const char *, int, int *, int, int *, GDALProgressFunc, void *)
Build raster overview(s)
Definition: gdaldataset.cpp:1980
GDALMajorObject::FromHandle
static GDALMajorObject * FromHandle(GDALMajorObjectH hMajorObject)
Convert a GDALMajorObjectH to a GDALMajorObject*.
Definition: gdal_priv.h:177
GDALRawResult::size
size_t size() const
Return the size in bytes of the raw result.
Definition: gdal_priv.h:2275
GDALIHasAttribute
Interface used to get a single GDALAttribute or a set of GDALAttribute.
Definition: gdal_priv.h:1988
GDALOpenInfo::bStatOK
int bStatOK
Whether stat()'ing the file was successful.
Definition: gdal_priv.h:290
CPL_C_START
#define CPL_C_START
Macro to start a block of C symbols.
Definition: cpl_port.h:301
GDALDriverManager
Class for managing the registration of file format drivers.
Definition: gdal_priv.h:1679
GDALMDArray
Class modeling a multi-dimensional array.
Definition: gdal_priv.h:2415
GDALOpenInfo::pabyHeader
GByte * pabyHeader
Buffer with first bytes of the file.
Definition: gdal_priv.h:300
GDALAsyncReader::GetYSize
int GetYSize() const
Return height.
Definition: gdal_priv.h:1779
GDALOpenInfo::eAccess
GDALAccess eAccess
Access flag.
Definition: gdal_priv.h:285
GDALRasterBand::GetMaskBand
virtual GDALRasterBand * GetMaskBand()
Return the mask band associated with the band.
Definition: gdalrasterband.cpp:6244
GDALExtendedDataType::GetNumericDataType
GDALDataType GetNumericDataType() const
Return numeric data type (only valid when GetClass() == GEDTC_NUMERIC)
Definition: gdal_priv.h:1881
GDALExtendedDataType::CreateString
static GDALExtendedDataType CreateString(size_t nMaxStringLength=0, GDALExtendedDataTypeSubType eSubType=GEDTST_NONE)
Return a new GDALExtendedDataType of class GEDTC_STRING.
Definition: gdalmultidim.cpp:7965
CSLConstList
char ** CSLConstList
Type of a constant null-terminated list of nul terminated strings.
Definition: cpl_port.h:1053
CPLErrorNum
int CPLErrorNum
Error number.
Definition: cpl_error.h:94
GUIntBig
unsigned long long GUIntBig
Large unsigned integer type (generally 64-bit unsigned integer type).
Definition: cpl_port.h:233
GDALDataset::Open
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:655
GDT_Float64
@ GDT_Float64
Definition: gdal.h:73
GDALExtendedDataType::GetSubType
GDALExtendedDataTypeSubType GetSubType() const
Return subtype.
Definition: gdal_priv.h:1889
GDALRasterBlock::DropLock
int DropLock(void)
Decrement the lock count.
Definition: gdal_priv.h:958
GDALOpenInfo::bIsDirectory
int bIsDirectory
Whether the file is a directory.
Definition: gdal_priv.h:292
GDALDimension::GetType
const std::string & GetType() const
Return the axis type.
Definition: gdal_priv.h:2736
GDAL_GCP
Ground Control Point.
Definition: gdal.h:732
CPL_C_END
#define CPL_C_END
Macro to end a block of C symbols.
Definition: cpl_port.h:303
GDALRasterBand::IReadBlock
virtual CPLErr IReadBlock(int nBlockXOff, int nBlockYOff, void *pData)=0
Read a block of data.
GDALDimension
Class modeling a a dimension / axis used to index multidimensional arrays.
Definition: gdal_priv.h:2703
GEDTST_NONE
@ GEDTST_NONE
None.
Definition: gdal.h:306
CPL_NULL_TERMINATED
#define CPL_NULL_TERMINATED
Null terminated variadic.
Definition: cpl_port.h:831
GDALExtendedDataType::GetComponents
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:1895
GDALAbstractMDArray::GetDataType
virtual const GDALExtendedDataType & GetDataType() const =0
Return the data type of an attribute/array.
ogr_feature.h
GDALDataset::FeatureLayerPair
Object returned by GetFeatures() iterators.
Definition: gdal_priv.h:668
GDALAsyncReader::GetGDALDataset
GDALDataset * GetGDALDataset()
Return dataset.
Definition: gdal_priv.h:1763
cpl_conv.h
GDALDataset::ToHandle
static GDALDatasetH ToHandle(GDALDataset *poDS)
Convert a GDALDataset* to a GDALDatasetH.
Definition: gdal_priv.h:643
CPLVirtualMem
struct CPLVirtualMem CPLVirtualMem
Opaque type that represents a virtual memory mapping.
Definition: cpl_virtualmem.h:62
cpl_string.h
GDALAbstractMDArray::Read
virtual bool Read(const GUInt64 *arrayStartIdx, const size_t *count, const GInt64 *arrayStep, const GPtrDiff_t *bufferStride, const GDALExtendedDataType &bufferDataType, void *pDstBuffer, const void *pDstBufferAllocStart=nullptr, size_t nDstBufferAllocSize=0) const
Read part or totality of a multidimensional array or attribute.
Definition: gdalmultidim.cpp:1747
GDALOpenInfo::papszAllowedDrivers
const char *const * papszAllowedDrivers
Allowed drivers (NULL for all)
Definition: gdal_priv.h:303
GDALMajorObject::SetMetadata
virtual CPLErr SetMetadata(char **papszMetadata, const char *pszDomain="")
Set metadata.
Definition: gdalmajorobject.cpp:292
GDALDataset::CloseDependentDatasets
virtual int CloseDependentDatasets()
Drop references to any other datasets referenced by this dataset.
Definition: gdaldataset.cpp:4144
GDALColorTable::ToHandle
static GDALColorTableH ToHandle(GDALColorTable *poCT)
Convert a GDALColorTable* to a GDALRasterBandH.
Definition: gdal_priv.h:1058
GDALRasterBlock::AddLock
int AddLock(void)
Increment the lock count.
Definition: gdal_priv.h:956
GDALDataset::CreateMaskBand
virtual CPLErr CreateMaskBand(int nFlagsIn)
Adds a mask band to the dataset.
Definition: gdaldataset.cpp:3147
OGRFieldDomain
Definition of a field domain.
Definition: ogr_feature.h:876
GSpacing
GIntBig GSpacing
Type to express pixel, line or band spacing.
Definition: gdal.h:287
vsi_l_offset
GUIntBig vsi_l_offset
Type for a file offset.
Definition: cpl_vsi.h:140
GDALDimension::GetSize
GUInt64 GetSize() const
Return the size, that is the number of values along the dimension.
Definition: gdal_priv.h:2752
GDALAccess
GDALAccess
Definition: gdal.h:116
end
OGRLayer::FeatureIterator end(OGRLayer *poLayer)
Return end of feature iterator.
Definition: ogrsf_frmts.h:294
GDALAsyncStatusType
GDALAsyncStatusType
status of the asynchronous stream
Definition: gdal.h:103
GDALEDTComponent::GetOffset
size_t GetOffset() const
Return the offset (in bytes) of the component in the compound data type.
Definition: gdal_priv.h:1965
GDALDriver::FromHandle
static GDALDriver * FromHandle(GDALDriverH hDriver)
Convert a GDALDriverH to a GDALDriver*.
Definition: gdal_priv.h:1661
GDALRawResult::operator[]
const GByte & operator[](size_t idx) const
Return byte at specified index.
Definition: gdal_priv.h:2271
GDAL_IDENTIFY_TRUE
@ GDAL_IDENTIFY_TRUE
Identify determined the file is recognized by the probed driver.
Definition: gdal_priv.h:1506
OGRErr
int OGRErr
Type for a OGR error.
Definition: ogr_core.h:341
GA_ReadOnly
@ GA_ReadOnly
Definition: gdal.h:117
GDALDimension::GetIndexingVariable
virtual std::shared_ptr< GDALMDArray > GetIndexingVariable() const
Return the variable that is used to index the dimension (if there is one).
Definition: gdalmultidim.cpp:8218
GDALAsyncReader::GetXSize
int GetXSize() const
Return width.
Definition: gdal_priv.h:1775
GDALRasterBlock::GetDirty
int GetDirty() const
Return the dirty flag.
Definition: gdal_priv.h:986
GIntBig
long long GIntBig
Large signed integer type (generally 64-bit integer type).
Definition: cpl_port.h:230
GDALDataset::Layers::Iterator::pointer
void pointer
pointer
Definition: gdal_priv.h:727
GDALAsyncReader::GetBufferXSize
int GetBufferXSize() const
Return buffer width.
Definition: gdal_priv.h:1787
GDALOpenInfo::nHeaderBytes
int nHeaderBytes
Number of bytes in pabyHeader.
Definition: gdal_priv.h:298
OGRwkbGeometryType
OGRwkbGeometryType
List of well known binary geometry types.
Definition: ogr_core.h:368
GDALDriver::ToHandle
static GDALDriverH ToHandle(GDALDriver *poDriver)
Convert a GDALDriver* to a GDALDriverH.
Definition: gdal_priv.h:1655
GDALRasterIOExtraArg
Structure to pass extra arguments to RasterIO() method, must be initialized with INIT_RASTERIO_EXTRA_...
Definition: gdal.h:161
GDALRasterBand::ToHandle
void static GDALRasterBandH ToHandle(GDALRasterBand *poBand)
Convert a GDALRasterBand* to a GDALRasterBandH.
Definition: gdal_priv.h:1371
GDALRasterBlock::GetYOff
int GetYOff() const
Return the y offset of the top-left corner of the block.
Definition: gdal_priv.h:974
CPL_WARN_UNUSED_RESULT
#define CPL_WARN_UNUSED_RESULT
Qualifier to warn when the return value of a function is not used.
Definition: cpl_port.h:866
GDALDataset::GetAccess
GDALAccess GetAccess() const
Return access mode.
Definition: gdal_priv.h:600
OGRFeature
A simple feature, including geometry and attributes.
Definition: ogr_feature.h:379
GDALMDArray::GetFilename
virtual const std::string & GetFilename() const =0
Return the filename that contains that array.
GDALRWFlag
GDALRWFlag
Definition: gdal.h:122
GDALDataset::Features
Class returned by GetFeatures() that act as a container for vector features.
Definition: gdal_priv.h:768
GDALMajorObject
Object with metadata.
Definition: gdal_priv.h:135
GDALAbstractMDArray::Write
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:1864
GDALRasterBand::IRasterIO
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
CPLErr
Error category.
Definition: cpl_error.h:52
GDALAttribute
Class modeling an attribute that has a name, a value and a type, and is typically used to describe a ...
Definition: gdal_priv.h:2297
GDALEDTComponent::GetType
const GDALExtendedDataType & GetType() const
Return the data type of the component.
Definition: gdal_priv.h:1971
GDALOpenInfo::pszFilename
char * pszFilename
Filename.
Definition: gdal_priv.h:280
GDALColorTable::FromHandle
static GDALColorTable * FromHandle(GDALColorTableH hCT)
Convert a GDALColorTableH to a GDALColorTable*.
Definition: gdal_priv.h:1064
GDT_Byte
@ GDT_Byte
Definition: gdal.h:65
GPI_RGB
@ GPI_RGB
Definition: gdal.h:233
GDALExtendedDataTypeSubType
GDALExtendedDataTypeSubType
Enumeration giving the subtype of a GDALExtendedDataType.
Definition: gdal.h:304
GDALDatasetUniquePtr
std::unique_ptr< GDALDataset, GDALDatasetUniquePtrDeleter > GDALDatasetUniquePtr
Unique pointer type for GDALDataset.
Definition: gdal_priv.h:907
GDALRasterBand::GetMaskFlags
virtual int GetMaskFlags()
Return the status flags of the mask band associated with the band.
Definition: gdalrasterband.cpp:6526
GDALRIOResampleAlg
GDALRIOResampleAlg
RasterIO() resampling method.
Definition: gdal.h:131
GetGDALDriverManager
GDALDriverManager * GetGDALDriverManager(void)
Fetch the global GDAL driver manager.
Definition: gdaldrivermanager.cpp:105
GDALRasterAttributeTable
Definition: gdal_rat.h:47
GDALAsyncReader::GetXOffset
int GetXOffset() const
Return x offset.
Definition: gdal_priv.h:1767
GDALExtendedDataType::GetMaxStringLength
size_t GetMaxStringLength() const
Return the maximum length of a string in bytes.
Definition: gdal_priv.h:1909
GDALRasterBlock::GetBand
GDALRasterBand * GetBand()
Accessor to source GDALRasterBand object.
Definition: gdal_priv.h:1002
GDALDataset::Layers
Class returned by GetLayers() that acts as a range of layers.
Definition: gdal_priv.h:705
GDALRasterBlock::GetXOff
int GetXOff() const
Return the x offset of the top-left corner of the block.
Definition: gdal_priv.h:970
GDALRasterBlock::GetDataType
GDALDataType GetDataType() const
Return the data type.
Definition: gdal_priv.h:966
GDALDataset::FromHandle
static GDALDataset * FromHandle(GDALDatasetH hDS)
Convert a GDALDatasetH to a GDALDataset*.
Definition: gdal_priv.h:649
ogr_core.h
GDALPaletteInterp
GDALPaletteInterp
Definition: gdal.h:230
GDALExtendedDataType::Create
static GDALExtendedDataType Create(GDALDataType eType)
Return a new GDALExtendedDataType of class GEDTC_NUMERIC.
Definition: gdalmultidim.cpp:7901
GDALMajorObject::ToHandle
static GDALMajorObjectH ToHandle(GDALMajorObject *poMajorObject)
Convert a GDALMajorObject* to a GDALMajorObjectH.
Definition: gdal_priv.h:171
GDALRasterBandH
void * GDALRasterBandH
Opaque type used for the C bindings of the C++ GDALRasterBand class.
Definition: gdal.h:272
GDALGroup::GetName
const std::string & GetName() const
Return the name of the group.
Definition: gdal_priv.h:2040
wkbUnknown
@ wkbUnknown
unknown type, non-standard
Definition: ogr_core.h:370
GDALAsyncReader::GetBuffer
void * GetBuffer()
Return buffer.
Definition: gdal_priv.h:1783
GDALExtendedDataType::GetName
const std::string & GetName() const
Return type name.
Definition: gdal_priv.h:1869
CPL_DISALLOW_COPY_ASSIGN
#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:927
GDALEDTComponent::GetName
const std::string & GetName() const
Return the name.
Definition: gdal_priv.h:1959
GDALRasterBlock::GetXSize
int GetXSize() const
Return the width of the block.
Definition: gdal_priv.h:978
GDALDatasetH
void * GDALDatasetH
Opaque type used for the C bindings of the C++ GDALDataset class.
Definition: gdal.h:269
GDALRasterBand::FromHandle
static GDALRasterBand * FromHandle(GDALRasterBandH hBand)
Convert a GDALRasterBandH to a GDALRasterBand*.
Definition: gdal_priv.h:1377
GDALColorTable
A color table / palette.
Definition: gdal_priv.h:1032
VSILFILE
FILE VSILFILE
Opaque type for a FILE that implements the VSIVirtualHandle API.
Definition: cpl_vsi.h:156
GDALAsyncReader::GetBandMap
int * GetBandMap()
Return band map.
Definition: gdal_priv.h:1803
GDALDriverH
void * GDALDriverH
Opaque type used for the C bindings of the C++ GDALDriver class.
Definition: gdal.h:275