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 virtual int CloseDependentDatasets();
442 int ValidateLayerCreationOptions( const char* const* papszLCO );
443
444 char **papszOpenOptions = nullptr;
445
446 friend class GDALRasterBand;
447
448 // The below methods related to read write mutex are fragile logic, and
449 // should not be used by out-of-tree code if possible.
450 int EnterReadWrite(GDALRWFlag eRWFlag);
451 void LeaveReadWrite();
452 void InitRWLock();
453
454 void TemporarilyDropReadWriteLock();
455 void ReacquireReadWriteLock();
456
457 void DisableReadWriteMutex();
458
459 int AcquireMutex();
460 void ReleaseMutex();
462
463 public:
464 ~GDALDataset() override;
465
466 int GetRasterXSize();
467 int GetRasterYSize();
468 int GetRasterCount();
469 GDALRasterBand *GetRasterBand( int );
470
472 class CPL_DLL Bands
473 {
474 private:
475
476 friend class GDALDataset;
477 GDALDataset* m_poSelf;
478 CPL_INTERNAL explicit Bands(GDALDataset* poSelf): m_poSelf(poSelf) {}
479
480 class CPL_DLL Iterator
481 {
482 struct Private;
483 std::unique_ptr<Private> m_poPrivate;
484 public:
485 Iterator(GDALDataset* poDS, bool bStart);
486 Iterator(const Iterator& oOther); // declared but not defined. Needed for gcc 5.4 at least
487 Iterator(Iterator&& oOther) noexcept; // declared but not defined. Needed for gcc 5.4 at least
488 ~Iterator();
489 GDALRasterBand* operator*();
490 Iterator& operator++();
491 bool operator!=(const Iterator& it) const;
492 };
493
494 public:
495
496 const Iterator begin() const;
497
498 const Iterator end() const;
499
500 size_t size() const;
501
502 GDALRasterBand* operator[](int iBand);
503 GDALRasterBand* operator[](size_t iBand);
504 };
505
506 Bands GetBands();
507
508 virtual void FlushCache(bool bAtClosing = false);
509
510 virtual const OGRSpatialReference* GetSpatialRef() const;
511 virtual CPLErr SetSpatialRef(const OGRSpatialReference* poSRS);
512
513 // Compatibility layer
514 const char *GetProjectionRef(void) const;
515 CPLErr SetProjection( const char * pszProjection );
516
517 virtual CPLErr GetGeoTransform( double * padfTransform );
518 virtual CPLErr SetGeoTransform( double * padfTransform );
519
520 virtual CPLErr AddBand( GDALDataType eType,
521 char **papszOptions=nullptr );
522
523 virtual void *GetInternalHandle( const char * pszHandleName );
524 virtual GDALDriver *GetDriver(void);
525 virtual char **GetFileList(void);
526
527 virtual const char* GetDriverName();
528
529 virtual const OGRSpatialReference* GetGCPSpatialRef() const;
530 virtual int GetGCPCount();
531 virtual const GDAL_GCP *GetGCPs();
532 virtual CPLErr SetGCPs( int nGCPCount, const GDAL_GCP *pasGCPList,
533 const OGRSpatialReference * poGCP_SRS );
534
535 // Compatibility layer
536 const char *GetGCPProjection();
537 CPLErr SetGCPs( int nGCPCount, const GDAL_GCP *pasGCPList,
538 const char *pszGCPProjection );
539
540 virtual CPLErr AdviseRead( int nXOff, int nYOff, int nXSize, int nYSize,
541 int nBufXSize, int nBufYSize,
542 GDALDataType eDT,
543 int nBandCount, int *panBandList,
544 char **papszOptions );
545
546 virtual CPLErr CreateMaskBand( int nFlagsIn );
547
548 virtual GDALAsyncReader*
549 BeginAsyncReader(int nXOff, int nYOff, int nXSize, int nYSize,
550 void *pBuf, int nBufXSize, int nBufYSize,
551 GDALDataType eBufType,
552 int nBandCount, int* panBandMap,
553 int nPixelSpace, int nLineSpace, int nBandSpace,
554 char **papszOptions);
555 virtual void EndAsyncReader(GDALAsyncReader *);
556
558 struct RawBinaryLayout
559 {
560 enum class Interleaving
561 {
562 UNKNOWN,
563 BIP,
564 BIL,
565 BSQ
566 };
567 std::string osRawFilename{};
568 Interleaving eInterleaving = Interleaving::UNKNOWN;
569 GDALDataType eDataType = GDT_Unknown;
570 bool bLittleEndianOrder = false;
571
572 vsi_l_offset nImageOffset = 0;
573 GIntBig nPixelOffset = 0;
574 GIntBig nLineOffset = 0;
575 GIntBig nBandOffset = 0;
576 };
577
578 virtual bool GetRawBinaryLayout(RawBinaryLayout&);
580
581 CPLErr RasterIO( GDALRWFlag, int, int, int, int,
582 void *, int, int, GDALDataType,
583 int, int *, GSpacing, GSpacing, GSpacing,
584 GDALRasterIOExtraArg* psExtraArg
585 #ifndef DOXYGEN_SKIP
586 OPTIONAL_OUTSIDE_GDAL(nullptr)
587 #endif
588 ) CPL_WARN_UNUSED_RESULT;
589
590 int Reference();
591 int Dereference();
592 int ReleaseRef();
593
597 GDALAccess GetAccess() const { return eAccess; }
598
599 int GetShared() const;
600 void MarkAsShared();
601
603 void MarkSuppressOnClose() { bSuppressOnClose = true; }
604
608 char **GetOpenOptions() { return papszOpenOptions; }
609
610 static GDALDataset **GetOpenDatasets( int *pnDatasetCount );
611
612 CPLErr BuildOverviews( const char *, int, int *,
613 int, int *, GDALProgressFunc, void * );
614
615 #ifndef DOXYGEN_XML
616 void ReportError(CPLErr eErrClass, CPLErrorNum err_no, const char *fmt, ...) CPL_PRINT_FUNC_FORMAT (4, 5);
617
618 static void ReportError(const char* pszDSName,
619 CPLErr eErrClass, CPLErrorNum err_no,
620 const char *fmt, ...) CPL_PRINT_FUNC_FORMAT (4, 5);
621 #endif
622
623 char ** GetMetadata(const char * pszDomain = "") override;
624
625 // Only defined when Doxygen enabled
626 #ifdef DOXYGEN_SKIP
627 CPLErr SetMetadata( char ** papszMetadata,
628 const char * pszDomain ) override;
629 CPLErr SetMetadataItem( const char * pszName,
630 const char * pszValue,
631 const char * pszDomain ) override;
632 #endif
633
634 char **GetMetadataDomainList() override;
635
636 virtual void ClearStatistics();
637
641 static inline GDALDatasetH ToHandle(GDALDataset* poDS)
642 { return static_cast<GDALDatasetH>(poDS); }
643
647 static inline GDALDataset* FromHandle(GDALDatasetH hDS)
648 { return static_cast<GDALDataset*>(hDS); }
649
653 static GDALDataset* Open( const char* pszFilename,
654 unsigned int nOpenFlags = 0,
655 const char* const* papszAllowedDrivers = nullptr,
656 const char* const* papszOpenOptions = nullptr,
657 const char* const* papszSiblingFiles = nullptr )
658 {
659 return FromHandle(GDALOpenEx(pszFilename, nOpenFlags,
660 papszAllowedDrivers,
661 papszOpenOptions,
662 papszSiblingFiles));
663 }
664
666 struct FeatureLayerPair
667 {
669 OGRFeatureUniquePtr feature{};
670
672 OGRLayer* layer = nullptr;
673 };
674
676 // SetEnableOverviews() only to be used by GDALOverviewDataset
677 void SetEnableOverviews(bool bEnable);
678
679 // Only to be used by driver's GetOverviewCount() method.
680 bool AreOverviewsEnabled() const;
682
683 private:
684 class Private;
685 Private *m_poPrivate;
686
687 CPL_INTERNAL OGRLayer* BuildLayerFromSelectInfo(swq_select* psSelectInfo,
688 OGRGeometry *poSpatialFilter,
689 const char *pszDialect,
690 swq_select_parse_options* poSelectParseOptions);
691 CPLStringList oDerivedMetadataList{};
692
693 public:
694
695 virtual int GetLayerCount();
696 virtual OGRLayer *GetLayer(int iLayer);
697
698 virtual bool IsLayerPrivate(int iLayer) const;
699
703 class CPL_DLL Layers
704 {
705 private:
706
707 friend class GDALDataset;
708 GDALDataset* m_poSelf;
709 CPL_INTERNAL explicit Layers(GDALDataset* poSelf): m_poSelf(poSelf) {}
710
711 public:
712
716 class CPL_DLL Iterator
717 {
718 struct Private;
719 std::unique_ptr<Private> m_poPrivate;
720 public:
721
722 using value_type = OGRLayer*;
723 using reference = OGRLayer*;
724 using difference_type = void;
725 using pointer = void;
726 using iterator_category = std::input_iterator_tag;
728 Iterator();
729 Iterator(GDALDataset* poDS, bool bStart);
730 Iterator(const Iterator& oOther);
731 Iterator(Iterator&& oOther) noexcept;
732 ~Iterator();
734 Iterator& operator=(const Iterator& oOther);
735 Iterator& operator=(Iterator&& oOther) noexcept;
737 OGRLayer* operator*() const;
738 Iterator& operator++();
739 Iterator operator++(int);
740 bool operator!=(const Iterator& it) const;
741 };
742
743 Iterator begin() const;
744 Iterator end() const;
745
746 size_t size() const;
747
748 OGRLayer* operator[](int iLayer);
749 OGRLayer* operator[](size_t iLayer);
750 OGRLayer* operator[](const char* pszLayername);
751 };
752
753 Layers GetLayers();
754
755 virtual OGRLayer *GetLayerByName(const char *);
756 virtual OGRErr DeleteLayer(int iLayer);
757
758 virtual void ResetReading();
759 virtual OGRFeature* GetNextFeature( OGRLayer** ppoBelongingLayer,
760 double* pdfProgressPct,
761 GDALProgressFunc pfnProgress,
762 void* pProgressData );
763
764
766 class CPL_DLL Features
767 {
768 private:
769
770 friend class GDALDataset;
771 GDALDataset* m_poSelf;
772 CPL_INTERNAL explicit Features(GDALDataset* poSelf): m_poSelf(poSelf) {}
773
774 class CPL_DLL Iterator
775 {
776 struct Private;
777 std::unique_ptr<Private> m_poPrivate;
778 public:
779 Iterator(GDALDataset* poDS, bool bStart);
780 Iterator(const Iterator& oOther); // declared but not defined. Needed for gcc 5.4 at least
781 Iterator(Iterator&& oOther) noexcept; // declared but not defined. Needed for gcc 5.4 at least
782 ~Iterator();
783 const FeatureLayerPair& operator*() const;
784 Iterator& operator++();
785 bool operator!=(const Iterator& it) const;
786 };
787
788 public:
789
790 const Iterator begin() const;
791
792 const Iterator end() const;
793 };
794
795 Features GetFeatures();
796
797 virtual int TestCapability( const char * );
798
799 virtual const OGRFieldDomain* GetFieldDomain(const std::string& name) const;
800
801 virtual bool AddFieldDomain(std::unique_ptr<OGRFieldDomain>&& domain,
802 std::string& failureReason);
803
804 virtual OGRLayer *CreateLayer( const char *pszName,
805 OGRSpatialReference *poSpatialRef = nullptr,
806 OGRwkbGeometryType eGType = wkbUnknown,
807 char ** papszOptions = nullptr );
808 virtual OGRLayer *CopyLayer( OGRLayer *poSrcLayer,
809 const char *pszNewName,
810 char **papszOptions = nullptr );
811
812 virtual OGRStyleTable *GetStyleTable();
813 virtual void SetStyleTableDirectly( OGRStyleTable *poStyleTable );
814
815 virtual void SetStyleTable(OGRStyleTable *poStyleTable);
816
817 virtual OGRLayer * ExecuteSQL( const char *pszStatement,
818 OGRGeometry *poSpatialFilter,
819 const char *pszDialect );
820 virtual void ReleaseResultSet( OGRLayer * poResultsSet );
821 virtual OGRErr AbortSQL( );
822
823 int GetRefCount() const;
824 int GetSummaryRefCount() const;
825 OGRErr Release();
826
827 virtual OGRErr StartTransaction(int bForce=FALSE);
828 virtual OGRErr CommitTransaction();
829 virtual OGRErr RollbackTransaction();
830
831 virtual std::shared_ptr<GDALGroup> GetRootGroup() const;
832
834 static int IsGenericSQLDialect(const char* pszDialect);
835
836 // Semi-public methods. Only to be used by in-tree drivers.
837 GDALSQLParseInfo* BuildParseInfo(swq_select* psSelectInfo,
838 swq_select_parse_options* poSelectParseOptions);
839 static void DestroyParseInfo(GDALSQLParseInfo* psParseInfo );
840 OGRLayer * ExecuteSQL( const char *pszStatement,
841 OGRGeometry *poSpatialFilter,
842 const char *pszDialect,
843 swq_select_parse_options* poSelectParseOptions);
845
846 protected:
847 virtual OGRLayer *ICreateLayer( const char *pszName,
848 OGRSpatialReference *poSpatialRef = nullptr,
849 OGRwkbGeometryType eGType = wkbUnknown,
850 char ** papszOptions = nullptr );
851
853 OGRErr ProcessSQLCreateIndex( const char * );
854 OGRErr ProcessSQLDropIndex( const char * );
855 OGRErr ProcessSQLDropTable( const char * );
856 OGRErr ProcessSQLAlterTableAddColumn( const char * );
857 OGRErr ProcessSQLAlterTableDropColumn( const char * );
858 OGRErr ProcessSQLAlterTableAlterColumn( const char * );
859 OGRErr ProcessSQLAlterTableRenameColumn( const char * );
860
861 OGRStyleTable *m_poStyleTable = nullptr;
862
863 // Compatibility layers
864 const OGRSpatialReference* GetSpatialRefFromOldGetProjectionRef() const;
865 CPLErr OldSetProjectionFromSetSpatialRef(const OGRSpatialReference* poSRS);
866 const OGRSpatialReference* GetGCPSpatialRefFromOldGetGCPProjection() const;
867 CPLErr OldSetGCPsFromNew( int nGCPCount, const GDAL_GCP *pasGCPList,
868 const OGRSpatialReference * poGCP_SRS );
869
870 friend class GDALProxyPoolDataset;
871 virtual const char *_GetProjectionRef();
872 const char *GetProjectionRefFromSpatialRef(const OGRSpatialReference*) const;
873 virtual const char *_GetGCPProjection();
874 const char *GetGCPProjectionFromSpatialRef(const OGRSpatialReference* poSRS) const;
875 virtual CPLErr _SetProjection( const char * pszProjection );
876 virtual CPLErr _SetGCPs( int nGCPCount, const GDAL_GCP *pasGCPList,
877 const char *pszGCPProjection );
879
880 private:
881 CPL_DISALLOW_COPY_ASSIGN(GDALDataset)
882 };
883
885 struct CPL_DLL GDALDatasetUniquePtrDeleter
886 {
887 void operator()(GDALDataset* poDataset) const
888 { GDALClose(poDataset); }
889 };
891
897 using GDALDatasetUniquePtr = std::unique_ptr<GDALDataset, GDALDatasetUniquePtrDeleter>;
898
899 /* ******************************************************************** */
900 /* GDALRasterBlock */
901 /* ******************************************************************** */
902
907 class CPL_DLL GDALRasterBlock
908 {
909 friend class GDALAbstractBandBlockCache;
910
911 GDALDataType eType;
912
913 bool bDirty;
914 volatile int nLockCount;
915
916 int nXOff;
917 int nYOff;
918
919 int nXSize;
920 int nYSize;
921
922 void *pData;
923
924 GDALRasterBand *poBand;
925
926 GDALRasterBlock *poNext;
927 GDALRasterBlock *poPrevious;
928
929 bool bMustDetach;
930
931 CPL_INTERNAL void Detach_unlocked( void );
932 CPL_INTERNAL void Touch_unlocked( void );
933
934 CPL_INTERNAL void RecycleFor( int nXOffIn, int nYOffIn );
935
936 public:
937 GDALRasterBlock( GDALRasterBand *, int, int );
938 GDALRasterBlock( int nXOffIn, int nYOffIn ); /* only for lookup purpose */
939 virtual ~GDALRasterBlock();
940
941 CPLErr Internalize( void );
942 void Touch( void );
943 void MarkDirty( void );
944 void MarkClean( void );
946 int AddLock( void ) { return CPLAtomicInc(&nLockCount); }
948 int DropLock( void ) { return CPLAtomicDec(&nLockCount); }
949 void Detach();
950
951 CPLErr Write();
952
956 GDALDataType GetDataType() const { return eType; }
960 int GetXOff() const { return nXOff; }
964 int GetYOff() const { return nYOff; }
968 int GetXSize() const { return nXSize; }
972 int GetYSize() const { return nYSize; }
976 int GetDirty() const { return bDirty; }
980 void *GetDataRef( void ) { return pData; }
984 GPtrDiff_t GetBlockSize() const {
985 return static_cast<GPtrDiff_t>(nXSize) * nYSize * GDALGetDataTypeSizeBytes(eType); }
986
987 int TakeLock();
988 int DropLockForRemovalFromStorage();
989
992 GDALRasterBand *GetBand() { return poBand; }
993
994 static void FlushDirtyBlocks();
995 static int FlushCacheBlock(int bDirtyBlocksOnly = FALSE);
996 static void Verify();
997
998 static void EnterDisableDirtyBlockFlush();
999 static void LeaveDisableDirtyBlockFlush();
1000
1001 #ifdef notdef
1002 static void CheckNonOrphanedBlocks(GDALRasterBand* poBand);
1003 void DumpBlock();
1004 static void DumpAll();
1005 #endif
1006
1007 /* Should only be called by GDALDestroyDriverManager() */
1009 CPL_INTERNAL static void DestroyRBMutex();
1011
1012 private:
1013 CPL_DISALLOW_COPY_ASSIGN(GDALRasterBlock)
1014 };
1015
1016 /* ******************************************************************** */
1017 /* GDALColorTable */
1018 /* ******************************************************************** */
1019
1022 class CPL_DLL GDALColorTable
1023 {
1024 GDALPaletteInterp eInterp;
1025
1026 std::vector<GDALColorEntry> aoEntries{};
1027
1028 public:
1029 explicit GDALColorTable( GDALPaletteInterp = GPI_RGB );
1030 ~GDALColorTable();
1031
1032 GDALColorTable *Clone() const;
1033 int IsSame(const GDALColorTable* poOtherCT) const;
1034
1035 GDALPaletteInterp GetPaletteInterpretation() const;
1036
1037 int GetColorEntryCount() const;
1038 const GDALColorEntry *GetColorEntry( int ) const;
1039 int GetColorEntryAsRGB( int, GDALColorEntry * ) const;
1040 void SetColorEntry( int, const GDALColorEntry * );
1041 int CreateColorRamp( int, const GDALColorEntry * ,
1042 int, const GDALColorEntry * );
1043
1047 static inline GDALColorTableH ToHandle(GDALColorTable* poCT)
1048 { return static_cast<GDALColorTableH>(poCT); }
1049
1053 static inline GDALColorTable* FromHandle(GDALColorTableH hCT)
1054 { return static_cast<GDALColorTable*>(hCT); }
1055
1056 };
1057
1058 /* ******************************************************************** */
1059 /* GDALAbstractBandBlockCache */
1060 /* ******************************************************************** */
1061
1063
1065 // only used by GDALRasterBand implementation.
1066
1067 class GDALAbstractBandBlockCache
1068 {
1069 // List of blocks that can be freed or recycled, and its lock
1070 CPLLock *hSpinLock = nullptr;
1071 GDALRasterBlock *psListBlocksToFree = nullptr;
1072
1073 // Band keep alive counter, and its lock & condition
1074 CPLCond *hCond = nullptr;
1075 CPLMutex *hCondMutex = nullptr;
1076 volatile int nKeepAliveCounter = 0;
1077
1078 volatile int m_nDirtyBlocks = 0;
1079
1080 CPL_DISALLOW_COPY_ASSIGN(GDALAbstractBandBlockCache)
1081
1082 protected:
1083 GDALRasterBand *poBand;
1084
1085 int m_nInitialDirtyBlocksInFlushCache = 0;
1086 int m_nLastTick = -1;
1087 bool m_bWriteDirtyBlocks = true;
1088
1089 void FreeDanglingBlocks();
1090 void UnreferenceBlockBase();
1091
1092 void StartDirtyBlockFlushingLog();
1093 void UpdateDirtyBlockFlushingLog();
1094 void EndDirtyBlockFlushingLog();
1095
1096 public:
1097 explicit GDALAbstractBandBlockCache(GDALRasterBand* poBand);
1098 virtual ~GDALAbstractBandBlockCache();
1099
1100 GDALRasterBlock* CreateBlock(int nXBlockOff, int nYBlockOff);
1101 void AddBlockToFreeList( GDALRasterBlock * );
1102 void IncDirtyBlocks(int nInc);
1103 void WaitCompletionPendingTasks();
1104 void DisableDirtyBlockWriting() { m_bWriteDirtyBlocks = false; }
1105
1106 virtual bool Init() = 0;
1107 virtual bool IsInitOK() = 0;
1108 virtual CPLErr FlushCache() = 0;
1109 virtual CPLErr AdoptBlock( GDALRasterBlock* poBlock ) = 0;
1110 virtual GDALRasterBlock *TryGetLockedBlockRef( int nXBlockOff,
1111 int nYBlockYOff ) = 0;
1112 virtual CPLErr UnreferenceBlock( GDALRasterBlock* poBlock ) = 0;
1113 virtual CPLErr FlushBlock( int nXBlockOff, int nYBlockOff,
1114 int bWriteDirtyBlock ) = 0;
1115 };
1116
1117 GDALAbstractBandBlockCache* GDALArrayBandBlockCacheCreate(GDALRasterBand* poBand);
1118 GDALAbstractBandBlockCache* GDALHashSetBandBlockCacheCreate(GDALRasterBand* poBand);
1119
1121
1122 /* ******************************************************************** */
1123 /* GDALRasterBand */
1124 /* ******************************************************************** */
1125
1126 class GDALMDArray;
1127
1130 class CPL_DLL GDALRasterBand : public GDALMajorObject
1131 {
1132 private:
1133 friend class GDALArrayBandBlockCache;
1134 friend class GDALHashSetBandBlockCache;
1135 friend class GDALRasterBlock;
1136 friend class GDALDataset;
1137
1138 CPLErr eFlushBlockErr = CE_None;
1139 GDALAbstractBandBlockCache* poBandBlockCache = nullptr;
1140
1141 CPL_INTERNAL void SetFlushBlockErr( CPLErr eErr );
1142 CPL_INTERNAL CPLErr UnreferenceBlock( GDALRasterBlock* poBlock );
1143 CPL_INTERNAL void SetValidPercent( GUIntBig nSampleCount, GUIntBig nValidCount );
1144 CPL_INTERNAL void IncDirtyBlocks(int nInc);
1145
1146 protected:
1148 GDALDataset *poDS = nullptr;
1149 int nBand = 0; /* 1 based */
1150
1151 int nRasterXSize = 0;
1152 int nRasterYSize = 0;
1153
1154 GDALDataType eDataType = GDT_Byte;
1155 GDALAccess eAccess = GA_ReadOnly;
1156
1157 /* stuff related to blocking, and raster cache */
1158 int nBlockXSize = -1;
1159 int nBlockYSize = -1;
1160 int nBlocksPerRow = 0;
1161 int nBlocksPerColumn = 0;
1162
1163 int nBlockReads = 0;
1164 int bForceCachedIO = 0;
1165
1166 GDALRasterBand *poMask = nullptr;
1167 bool bOwnMask = false;
1168 int nMaskFlags = 0;
1169
1170 void InvalidateMaskBand();
1171
1172 friend class GDALProxyRasterBand;
1173 friend class GDALDefaultOverviews;
1174
1175 CPLErr RasterIOResampled( GDALRWFlag, int, int, int, int,
1176 void *, int, int, GDALDataType,
1177 GSpacing, GSpacing, GDALRasterIOExtraArg* psExtraArg ) CPL_WARN_UNUSED_RESULT;
1178
1179 int EnterReadWrite(GDALRWFlag eRWFlag);
1180 void LeaveReadWrite();
1181 void InitRWLock();
1183
1184 protected:
1185 virtual CPLErr IReadBlock( int nBlockXOff, int nBlockYOff, void * pData ) = 0;
1186 virtual CPLErr IWriteBlock( int nBlockXOff, int nBlockYOff, void * pData );
1187
1188 virtual CPLErr IRasterIO( GDALRWFlag, int, int, int, int,
1189 void *, int, int, GDALDataType,
1190 GSpacing, GSpacing, GDALRasterIOExtraArg* psExtraArg ) CPL_WARN_UNUSED_RESULT;
1191
1192 virtual int IGetDataCoverageStatus( int nXOff, int nYOff,
1193 int nXSize, int nYSize,
1194 int nMaskFlagStop,
1195 double* pdfDataPct);
1197 CPLErr OverviewRasterIO( GDALRWFlag, int, int, int, int,
1198 void *, int, int, GDALDataType,
1199 GSpacing, GSpacing, GDALRasterIOExtraArg* psExtraArg ) CPL_WARN_UNUSED_RESULT;
1200
1201 CPLErr TryOverviewRasterIO( GDALRWFlag eRWFlag,
1202 int nXOff, int nYOff, int nXSize, int nYSize,
1203 void * pData, int nBufXSize, int nBufYSize,
1204 GDALDataType eBufType,
1205 GSpacing nPixelSpace, GSpacing nLineSpace,
1206 GDALRasterIOExtraArg* psExtraArg,
1207 int* pbTried );
1208
1209 int InitBlockInfo();
1210
1211 void AddBlockToFreeList( GDALRasterBlock * );
1213
1214 public:
1215 GDALRasterBand();
1216 explicit GDALRasterBand(int bForceCachedIO);
1217
1218 ~GDALRasterBand() override;
1219
1220 int GetXSize();
1221 int GetYSize();
1222 int GetBand();
1223 GDALDataset*GetDataset();
1224
1225 GDALDataType GetRasterDataType( void );
1226 void GetBlockSize( int *, int * );
1227 CPLErr GetActualBlockSize ( int, int, int *, int * );
1228 GDALAccess GetAccess();
1229
1230 CPLErr RasterIO( GDALRWFlag, int, int, int, int,
1231 void *, int, int, GDALDataType,
1232 GSpacing, GSpacing, GDALRasterIOExtraArg* psExtraArg
1233 #ifndef DOXYGEN_SKIP
1234 OPTIONAL_OUTSIDE_GDAL(nullptr)
1235 #endif
1236 ) CPL_WARN_UNUSED_RESULT;
1237 CPLErr ReadBlock( int, int, void * ) CPL_WARN_UNUSED_RESULT;
1238
1239 CPLErr WriteBlock( int, int, void * ) CPL_WARN_UNUSED_RESULT;
1240
1241 GDALRasterBlock *GetLockedBlockRef( int nXBlockOff, int nYBlockOff,
1242 int bJustInitialize = FALSE ) CPL_WARN_UNUSED_RESULT;
1243 GDALRasterBlock *TryGetLockedBlockRef( int nXBlockOff, int nYBlockYOff ) CPL_WARN_UNUSED_RESULT;
1244 CPLErr FlushBlock( int, int, int bWriteDirtyBlock = TRUE );
1245
1246 unsigned char* GetIndexColorTranslationTo(/* const */ GDALRasterBand* poReferenceBand,
1247 unsigned char* pTranslationTable = nullptr,
1248 int* pApproximateMatching = nullptr);
1249
1250 // New OpengIS CV_SampleDimension stuff.
1251
1252 virtual CPLErr FlushCache(bool bAtClosing = false);
1253 virtual char **GetCategoryNames();
1254 virtual double GetNoDataValue( int *pbSuccess = nullptr );
1255 virtual double GetMinimum( int *pbSuccess = nullptr );
1256 virtual double GetMaximum(int *pbSuccess = nullptr );
1257 virtual double GetOffset( int *pbSuccess = nullptr );
1258 virtual double GetScale( int *pbSuccess = nullptr );
1259 virtual const char *GetUnitType();
1260 virtual GDALColorInterp GetColorInterpretation();
1261 virtual GDALColorTable *GetColorTable();
1262 virtual CPLErr Fill(double dfRealValue, double dfImaginaryValue = 0);
1263
1264 virtual CPLErr SetCategoryNames( char ** papszNames );
1265 virtual CPLErr SetNoDataValue( double dfNoData );
1266 virtual CPLErr DeleteNoDataValue();
1267 virtual CPLErr SetColorTable( GDALColorTable * poCT );
1268 virtual CPLErr SetColorInterpretation( GDALColorInterp eColorInterp );
1269 virtual CPLErr SetOffset( double dfNewOffset );
1270 virtual CPLErr SetScale( double dfNewScale );
1271 virtual CPLErr SetUnitType( const char * pszNewValue );
1272
1273 virtual CPLErr GetStatistics( int bApproxOK, int bForce,
1274 double *pdfMin, double *pdfMax,
1275 double *pdfMean, double *padfStdDev );
1276 virtual CPLErr ComputeStatistics( int bApproxOK,
1277 double *pdfMin, double *pdfMax,
1278 double *pdfMean, double *pdfStdDev,
1279 GDALProgressFunc, void *pProgressData );
1280 virtual CPLErr SetStatistics( double dfMin, double dfMax,
1281 double dfMean, double dfStdDev );
1282 virtual CPLErr ComputeRasterMinMax( int, double* );
1283
1284 // Only defined when Doxygen enabled
1285 #ifdef DOXYGEN_SKIP
1286 CPLErr SetMetadata( char ** papszMetadata,
1287 const char * pszDomain ) override;
1288 CPLErr SetMetadataItem( const char * pszName,
1289 const char * pszValue,
1290 const char * pszDomain ) override;
1291 #endif
1292
1293 virtual int HasArbitraryOverviews();
1294 virtual int GetOverviewCount();
1295 virtual GDALRasterBand *GetOverview(int);
1296 virtual GDALRasterBand *GetRasterSampleOverview( GUIntBig );
1297 virtual CPLErr BuildOverviews( const char * pszResampling,
1298 int nOverviews,
1299 int * panOverviewList,
1300 GDALProgressFunc pfnProgress,
1301 void * pProgressData );
1302
1303 virtual CPLErr AdviseRead( int nXOff, int nYOff, int nXSize, int nYSize,
1304 int nBufXSize, int nBufYSize,
1305 GDALDataType eBufType, char **papszOptions );
1306
1307 virtual CPLErr GetHistogram( double dfMin, double dfMax,
1308 int nBuckets, GUIntBig * panHistogram,
1309 int bIncludeOutOfRange, int bApproxOK,
1310 GDALProgressFunc, void *pProgressData );
1311
1312 virtual CPLErr GetDefaultHistogram( double *pdfMin, double *pdfMax,
1313 int *pnBuckets, GUIntBig ** ppanHistogram,
1314 int bForce,
1315 GDALProgressFunc, void *pProgressData);
1316 virtual CPLErr SetDefaultHistogram( double dfMin, double dfMax,
1317 int nBuckets, GUIntBig *panHistogram );
1318
1319 virtual GDALRasterAttributeTable *GetDefaultRAT();
1320 virtual CPLErr SetDefaultRAT( const GDALRasterAttributeTable * poRAT );
1321
1322 virtual GDALRasterBand *GetMaskBand();
1323 virtual int GetMaskFlags();
1324 virtual CPLErr CreateMaskBand( int nFlagsIn );
1325
1326 virtual CPLVirtualMem *GetVirtualMemAuto( GDALRWFlag eRWFlag,
1327 int *pnPixelSpace,
1328 GIntBig *pnLineSpace,
1329 char **papszOptions ) CPL_WARN_UNUSED_RESULT;
1330
1331 int GetDataCoverageStatus( int nXOff, int nYOff,
1332 int nXSize, int nYSize,
1333 int nMaskFlagStop = 0,
1334 double* pdfDataPct = nullptr );
1335
1336 std::shared_ptr<GDALMDArray> AsMDArray() const;
1337
1338 #ifndef DOXYGEN_XML
1339 void ReportError(CPLErr eErrClass, CPLErrorNum err_no, const char *fmt, ...) CPL_PRINT_FUNC_FORMAT (4, 5);
1340 #endif
1341
1345 static inline GDALRasterBandH ToHandle(GDALRasterBand* poBand)
1346 { return static_cast<GDALRasterBandH>(poBand); }
1347
1351 static inline GDALRasterBand* FromHandle(GDALRasterBandH hBand)
1352 { return static_cast<GDALRasterBand*>(hBand); }
1353
1354 private:
1355 CPL_DISALLOW_COPY_ASSIGN(GDALRasterBand)
1356 };
1357
1359 /* ******************************************************************** */
1360 /* GDALAllValidMaskBand */
1361 /* ******************************************************************** */
1362
1363 class CPL_DLL GDALAllValidMaskBand : public GDALRasterBand
1364 {
1365 protected:
1366 CPLErr IReadBlock( int, int, void * ) override;
1367
1368 CPL_DISALLOW_COPY_ASSIGN(GDALAllValidMaskBand)
1369
1370 public:
1371 explicit GDALAllValidMaskBand( GDALRasterBand * );
1372 ~GDALAllValidMaskBand() override;
1373
1374 GDALRasterBand *GetMaskBand() override;
1375 int GetMaskFlags() override;
1376
1377 CPLErr ComputeStatistics( int bApproxOK,
1378 double *pdfMin, double *pdfMax,
1379 double *pdfMean, double *pdfStdDev,
1380 GDALProgressFunc, void *pProgressData ) override;
1381
1382 };
1383
1384 /* ******************************************************************** */
1385 /* GDALNoDataMaskBand */
1386 /* ******************************************************************** */
1387
1388 class CPL_DLL GDALNoDataMaskBand : public GDALRasterBand
1389 {
1390 double dfNoDataValue;
1391 GDALRasterBand *poParent;
1392
1393 CPL_DISALLOW_COPY_ASSIGN(GDALNoDataMaskBand)
1394
1395 protected:
1396 CPLErr IReadBlock( int, int, void * ) override;
1397 CPLErr IRasterIO( GDALRWFlag, int, int, int, int,
1398 void *, int, int, GDALDataType,
1399 GSpacing, GSpacing, GDALRasterIOExtraArg* psExtraArg ) override;
1400
1401 public:
1402 explicit GDALNoDataMaskBand( GDALRasterBand * );
1403 ~GDALNoDataMaskBand() override;
1404
1405 static bool IsNoDataInRange(double dfNoDataValue,
1406 GDALDataType eDataType);
1407 };
1408
1409 /* ******************************************************************** */
1410 /* GDALNoDataValuesMaskBand */
1411 /* ******************************************************************** */
1412
1413 class CPL_DLL GDALNoDataValuesMaskBand : public GDALRasterBand
1414 {
1415 double *padfNodataValues;
1416
1417 CPL_DISALLOW_COPY_ASSIGN(GDALNoDataValuesMaskBand)
1418
1419 protected:
1420 CPLErr IReadBlock( int, int, void * ) override;
1421
1422 public:
1423 explicit GDALNoDataValuesMaskBand( GDALDataset * );
1424 ~GDALNoDataValuesMaskBand() override;
1425 };
1426
1427 /* ******************************************************************** */
1428 /* GDALRescaledAlphaBand */
1429 /* ******************************************************************** */
1430
1431 class GDALRescaledAlphaBand : public GDALRasterBand
1432 {
1433 GDALRasterBand *poParent;
1434 void *pTemp;
1435
1436 CPL_DISALLOW_COPY_ASSIGN(GDALRescaledAlphaBand)
1437
1438 protected:
1439 CPLErr IReadBlock( int, int, void * ) override;
1440 CPLErr IRasterIO( GDALRWFlag, int, int, int, int,
1441 void *, int, int, GDALDataType,
1442 GSpacing, GSpacing,
1443 GDALRasterIOExtraArg* psExtraArg ) override;
1444
1445 public:
1446 explicit GDALRescaledAlphaBand( GDALRasterBand * );
1447 ~GDALRescaledAlphaBand() override;
1448 };
1450
1451 /* ******************************************************************** */
1452 /* GDALIdentifyEnum */
1453 /* ******************************************************************** */
1454
1460 typedef enum
1461 {
1463 GDAL_IDENTIFY_UNKNOWN = -1,
1465 GDAL_IDENTIFY_FALSE = 0,
1467 GDAL_IDENTIFY_TRUE = 1
1468 } GDALIdentifyEnum;
1469
1470 /* ******************************************************************** */
1471 /* GDALDriver */
1472 /* ******************************************************************** */
1473
1485 class CPL_DLL GDALDriver : public GDALMajorObject
1486 {
1487 public:
1488 GDALDriver();
1489 ~GDALDriver() override;
1490
1491 CPLErr SetMetadataItem( const char * pszName,
1492 const char * pszValue,
1493 const char * pszDomain = "" ) override;
1494
1495 /* -------------------------------------------------------------------- */
1496 /* Public C++ methods. */
1497 /* -------------------------------------------------------------------- */
1498 GDALDataset *Create( const char * pszName,
1499 int nXSize, int nYSize, int nBands,
1500 GDALDataType eType, CSLConstList papszOptions ) CPL_WARN_UNUSED_RESULT;
1501
1502 GDALDataset *CreateMultiDimensional( const char * pszName,
1503 CSLConstList papszRootGroupOptions,
1504 CSLConstList papszOptions ) CPL_WARN_UNUSED_RESULT;
1505
1506 CPLErr Delete( const char * pszName );
1507 CPLErr Rename( const char * pszNewName,
1508 const char * pszOldName );
1509 CPLErr CopyFiles( const char * pszNewName,
1510 const char * pszOldName );
1511
1512 GDALDataset *CreateCopy( const char *, GDALDataset *,
1513 int, CSLConstList papszOptions,
1514 GDALProgressFunc pfnProgress,
1515 void * pProgressData ) CPL_WARN_UNUSED_RESULT;
1516
1517 /* -------------------------------------------------------------------- */
1518 /* The following are semiprivate, not intended to be accessed */
1519 /* by anyone but the formats instantiating and populating the */
1520 /* drivers. */
1521 /* -------------------------------------------------------------------- */
1523 GDALDataset *(*pfnOpen)( GDALOpenInfo * );
1524
1525 GDALDataset *(*pfnCreate)( const char * pszName,
1526 int nXSize, int nYSize, int nBands,
1527 GDALDataType eType,
1528 char ** papszOptions );
1529
1530 GDALDataset *(*pfnCreateEx)( GDALDriver*, const char * pszName,
1531 int nXSize, int nYSize, int nBands,
1532 GDALDataType eType,
1533 char ** papszOptions );
1534
1535 GDALDataset *(*pfnCreateMultiDimensional)( const char * pszName,
1536 CSLConstList papszRootGroupOptions,
1537 CSLConstList papszOptions );
1538
1539 CPLErr (*pfnDelete)( const char * pszName );
1540
1541 GDALDataset *(*pfnCreateCopy)( const char *, GDALDataset *,
1542 int, char **,
1543 GDALProgressFunc pfnProgress,
1544 void * pProgressData );
1545
1546 void *pDriverData;
1547
1548 void (*pfnUnloadDriver)(GDALDriver *);
1549
1557 int (*pfnIdentify)( GDALOpenInfo * );
1558 int (*pfnIdentifyEx)( GDALDriver*, GDALOpenInfo * );
1559
1560 CPLErr (*pfnRename)( const char * pszNewName,
1561 const char * pszOldName );
1562 CPLErr (*pfnCopyFiles)( const char * pszNewName,
1563 const char * pszOldName );
1564
1565 // Used for legacy OGR drivers, and Python drivers
1566 GDALDataset *(*pfnOpenWithDriverArg)( GDALDriver*, GDALOpenInfo * );
1567
1568 /* For legacy OGR drivers */
1569 GDALDataset *(*pfnCreateVectorOnly)( GDALDriver*,
1570 const char * pszName,
1571 char ** papszOptions );
1572 CPLErr (*pfnDeleteDataSource)( GDALDriver*,
1573 const char * pszName );
1575
1576 /* -------------------------------------------------------------------- */
1577 /* Helper methods. */
1578 /* -------------------------------------------------------------------- */
1580 GDALDataset *DefaultCreateCopy( const char *, GDALDataset *,
1581 int, CSLConstList papszOptions,
1582 GDALProgressFunc pfnProgress,
1583 void * pProgressData ) CPL_WARN_UNUSED_RESULT;
1584
1585 static CPLErr DefaultCreateCopyMultiDimensional(
1586 GDALDataset *poSrcDS,
1587 GDALDataset *poDstDS,
1588 bool bStrict,
1589 CSLConstList /*papszOptions*/,
1590 GDALProgressFunc pfnProgress,
1591 void * pProgressData );
1592
1593 static CPLErr DefaultCopyMasks( GDALDataset *poSrcDS,
1594 GDALDataset *poDstDS,
1595 int bStrict );
1596 static CPLErr DefaultCopyMasks( GDALDataset *poSrcDS,
1597 GDALDataset *poDstDS,
1598 int bStrict,
1599 CSLConstList papszOptions,
1600 GDALProgressFunc pfnProgress,
1601 void * pProgressData );
1603 static CPLErr QuietDelete( const char * pszName,
1604 const char *const *papszAllowedDrivers = nullptr);
1605
1607 static CPLErr DefaultRename( const char * pszNewName,
1608 const char * pszOldName );
1609 static CPLErr DefaultCopyFiles( const char * pszNewName,
1610 const char * pszOldName );
1612
1616 static inline GDALDriverH ToHandle(GDALDriver* poDriver)
1617 { return static_cast<GDALDriverH>(poDriver); }
1618
1622 static inline GDALDriver* FromHandle(GDALDriverH hDriver)
1623 { return static_cast<GDALDriver*>(hDriver); }
1624
1625 private:
1626 CPL_DISALLOW_COPY_ASSIGN(GDALDriver)
1627 };
1628
1629 /* ******************************************************************** */
1630 /* GDALDriverManager */
1631 /* ******************************************************************** */
1632
1640 class CPL_DLL GDALDriverManager : public GDALMajorObject
1641 {
1642 int nDrivers = 0;
1643 GDALDriver **papoDrivers = nullptr;
1644 std::map<CPLString, GDALDriver*> oMapNameToDrivers{};
1645
1646 GDALDriver *GetDriver_unlocked( int iDriver )
1647 { return (iDriver >= 0 && iDriver < nDrivers) ?
1648 papoDrivers[iDriver] : nullptr; }
1649
1650 GDALDriver *GetDriverByName_unlocked( const char * pszName )
1651 { return oMapNameToDrivers[CPLString(pszName).toupper()]; }
1652
1653 static char** GetSearchPaths(const char* pszGDAL_DRIVER_PATH);
1654
1655 static void CleanupPythonDrivers();
1656
1657 CPL_DISALLOW_COPY_ASSIGN(GDALDriverManager)
1658
1659 public:
1660 GDALDriverManager();
1661 ~GDALDriverManager();
1662
1663 int GetDriverCount( void ) const;
1664 GDALDriver *GetDriver( int );
1665 GDALDriver *GetDriverByName( const char * );
1666
1667 int RegisterDriver( GDALDriver * );
1668 void DeregisterDriver( GDALDriver * );
1669
1670 // AutoLoadDrivers is a no-op if compiled with GDAL_NO_AUTOLOAD defined.
1671 static void AutoLoadDrivers();
1672 void AutoSkipDrivers();
1673
1674 static void AutoLoadPythonDrivers();
1675 };
1676
1677 CPL_C_START
1678 GDALDriverManager CPL_DLL * GetGDALDriverManager( void );
1679 CPL_C_END
1680
1681 /* ******************************************************************** */
1682 /* GDALAsyncReader */
1683 /* ******************************************************************** */
1684
1690 class CPL_DLL GDALAsyncReader
1691 {
1692
1693 CPL_DISALLOW_COPY_ASSIGN(GDALAsyncReader)
1694
1695 protected:
1697 GDALDataset* poDS;
1698 int nXOff;
1699 int nYOff;
1700 int nXSize;
1701 int nYSize;
1702 void * pBuf;
1703 int nBufXSize;
1704 int nBufYSize;
1705 GDALDataType eBufType;
1706 int nBandCount;
1707 int* panBandMap;
1708 int nPixelSpace;
1709 int nLineSpace;
1710 int nBandSpace;
1712
1713 public:
1714 GDALAsyncReader();
1715 virtual ~GDALAsyncReader();
1716
1720 GDALDataset* GetGDALDataset() {return poDS;}
1724 int GetXOffset() const { return nXOff; }
1728 int GetYOffset() const { return nYOff; }
1732 int GetXSize() const { return nXSize; }
1736 int GetYSize() const { return nYSize; }
1740 void * GetBuffer() {return pBuf;}
1744 int GetBufferXSize() const { return nBufXSize; }
1748 int GetBufferYSize() const { return nBufYSize; }
1752 GDALDataType GetBufferType() const { return eBufType; }
1756 int GetBandCount() const { return nBandCount; }
1760 int* GetBandMap() { return panBandMap; }
1764 int GetPixelSpace() const { return nPixelSpace; }
1768 int GetLineSpace() const { return nLineSpace; }
1772 int GetBandSpace() const { return nBandSpace; }
1773
1774 virtual GDALAsyncStatusType
1775 GetNextUpdatedRegion(double dfTimeout,
1776 int* pnBufXOff, int* pnBufYOff,
1777 int* pnBufXSize, int* pnBufYSize) = 0;
1778 virtual int LockBuffer( double dfTimeout = -1.0 );
1779 virtual void UnlockBuffer();
1780 };
1781
1782 /* ******************************************************************** */
1783 /* Multidimensional array API */
1784 /* ******************************************************************** */
1785
1786 class GDALMDArray;
1787 class GDALAttribute;
1788 class GDALDimension;
1789 class GDALEDTComponent;
1790
1791 /* ******************************************************************** */
1792 /* GDALExtendedDataType */
1793 /* ******************************************************************** */
1794
1802 class CPL_DLL GDALExtendedDataType
1803 {
1804 public:
1805 ~GDALExtendedDataType();
1806
1807 GDALExtendedDataType(const GDALExtendedDataType&);
1808
1809 GDALExtendedDataType& operator= (GDALExtendedDataType&&);
1810
1811 static GDALExtendedDataType Create(GDALDataType eType);
1812 static GDALExtendedDataType Create(const std::string& osName,
1813 size_t nTotalSize,
1814 std::vector<std::unique_ptr<GDALEDTComponent>>&& components);
1815 static GDALExtendedDataType CreateString(size_t nMaxStringLength = 0,
1816 GDALExtendedDataTypeSubType eSubType = GEDTST_NONE);
1817
1818 bool operator== (const GDALExtendedDataType& ) const;
1820 bool operator!= (const GDALExtendedDataType& other) const { return !(operator==(other)); }
1821
1826 const std::string& GetName() const { return m_osName; }
1827
1832 GDALExtendedDataTypeClass GetClass() const { return m_eClass; }
1833
1838 GDALDataType GetNumericDataType() const { return m_eNumericDT; }
1839
1846 GDALExtendedDataTypeSubType GetSubType() const { return m_eSubType; }
1847
1852 const std::vector<std::unique_ptr<GDALEDTComponent>>& GetComponents() const { return m_aoComponents; }
1853
1860 size_t GetSize() const { return m_nSize; }
1861
1866 size_t GetMaxStringLength() const { return m_nMaxStringLength; }
1867
1868 bool CanConvertTo(const GDALExtendedDataType& other) const;
1869
1870 bool NeedsFreeDynamicMemory() const;
1871
1872 void FreeDynamicMemory(void* pBuffer) const;
1873
1874 static
1875 bool CopyValue(const void* pSrc, const GDALExtendedDataType& srcType,
1876 void* pDst, const GDALExtendedDataType& dstType);
1877
1878 private:
1879 GDALExtendedDataType(size_t nMaxStringLength, GDALExtendedDataTypeSubType eSubType);
1880 explicit GDALExtendedDataType(GDALDataType eType);
1881 GDALExtendedDataType(const std::string& osName,
1882 size_t nTotalSize,
1883 std::vector<std::unique_ptr<GDALEDTComponent>>&& components);
1884
1885 std::string m_osName{};
1886 GDALExtendedDataTypeClass m_eClass = GEDTC_NUMERIC;
1887 GDALExtendedDataTypeSubType m_eSubType = GEDTST_NONE;
1888 GDALDataType m_eNumericDT = GDT_Unknown;
1889 std::vector<std::unique_ptr<GDALEDTComponent>> m_aoComponents{};
1890 size_t m_nSize = 0;
1891 size_t m_nMaxStringLength = 0;
1892 };
1893
1894 /* ******************************************************************** */
1895 /* GDALEDTComponent */
1896 /* ******************************************************************** */
1897
1903 class CPL_DLL GDALEDTComponent
1904 {
1905 public:
1906 ~GDALEDTComponent();
1907 GDALEDTComponent(const std::string& name, size_t offset, const GDALExtendedDataType& type);
1908 GDALEDTComponent(const GDALEDTComponent&);
1909
1910 bool operator== (const GDALEDTComponent& ) const;
1911
1916 const std::string& GetName() const { return m_osName; }
1917
1922 size_t GetOffset() const { return m_nOffset; }
1923
1928 const GDALExtendedDataType& GetType() const { return m_oType; }
1929
1930 private:
1931 std::string m_osName;
1932 size_t m_nOffset;
1933 GDALExtendedDataType m_oType;
1934 };
1935
1936 /* ******************************************************************** */
1937 /* GDALIHasAttribute */
1938 /* ******************************************************************** */
1939
1945 class CPL_DLL GDALIHasAttribute
1946 {
1947 protected:
1948 std::shared_ptr<GDALAttribute> GetAttributeFromAttributes(const std::string& osName) const;
1949
1950 public:
1951 virtual ~GDALIHasAttribute();
1952
1953 virtual std::shared_ptr<GDALAttribute> GetAttribute(const std::string& osName) const;
1954
1955 virtual std::vector<std::shared_ptr<GDALAttribute>> GetAttributes(CSLConstList papszOptions = nullptr) const;
1956
1957 virtual std::shared_ptr<GDALAttribute> CreateAttribute(
1958 const std::string& osName,
1959 const std::vector<GUInt64>& anDimensions,
1960 const GDALExtendedDataType& oDataType,
1961 CSLConstList papszOptions = nullptr);
1962 };
1963
1964 /* ******************************************************************** */
1965 /* GDALGroup */
1966 /* ******************************************************************** */
1967
1976 class CPL_DLL GDALGroup: public GDALIHasAttribute
1977 {
1978 protected:
1980 std::string m_osName{};
1981 std::string m_osFullName{};
1982
1983 GDALGroup(const std::string& osParentName, const std::string& osName);
1984
1985 const GDALGroup* GetInnerMostGroup(const std::string& osPathOrArrayOrDim,
1986 std::shared_ptr<GDALGroup>& curGroupHolder,
1987 std::string& osLastPart) const;
1989
1990 public:
1991 virtual ~GDALGroup();
1992
1997 const std::string& GetName() const { return m_osName; }
1998
2003 const std::string& GetFullName() const { return m_osFullName; }
2004
2005 virtual std::vector<std::string> GetMDArrayNames(CSLConstList papszOptions = nullptr) const;
2006 virtual std::shared_ptr<GDALMDArray> OpenMDArray(const std::string& osName,
2007 CSLConstList papszOptions = nullptr) const;
2008
2009 virtual std::vector<std::string> GetGroupNames(CSLConstList papszOptions = nullptr) const;
2010 virtual std::shared_ptr<GDALGroup> OpenGroup(const std::string& osName,
2011 CSLConstList papszOptions = nullptr) const;
2012
2013 virtual std::vector<std::string> GetVectorLayerNames(CSLConstList papszOptions = nullptr) const;
2014 virtual OGRLayer* OpenVectorLayer(const std::string& osName,
2015 CSLConstList papszOptions = nullptr) const;
2016
2017 virtual std::vector<std::shared_ptr<GDALDimension>> GetDimensions(CSLConstList papszOptions = nullptr) const;
2018
2019 virtual std::shared_ptr<GDALGroup> CreateGroup(const std::string& osName,
2020 CSLConstList papszOptions = nullptr);
2021
2022 virtual std::shared_ptr<GDALDimension> CreateDimension(const std::string& osName,
2023 const std::string& osType,
2024 const std::string& osDirection,
2025 GUInt64 nSize,
2026 CSLConstList papszOptions = nullptr);
2027
2028 virtual std::shared_ptr<GDALMDArray> CreateMDArray(const std::string& osName,
2029 const std::vector<std::shared_ptr<GDALDimension>>& aoDimensions,
2030 const GDALExtendedDataType& oDataType,
2031 CSLConstList papszOptions = nullptr);
2032
2033 GUInt64 GetTotalCopyCost() const;
2034
2035 virtual bool CopyFrom(const std::shared_ptr<GDALGroup>& poDstRootGroup,
2036 GDALDataset* poSrcDS,
2037 const std::shared_ptr<GDALGroup>& poSrcGroup,
2038 bool bStrict,
2039 GUInt64& nCurCost,
2040 const GUInt64 nTotalCost,
2041 GDALProgressFunc pfnProgress,
2042 void * pProgressData,
2043 CSLConstList papszOptions = nullptr);
2044
2045 virtual CSLConstList GetStructuralInfo() const;
2046
2047 std::shared_ptr<GDALMDArray> OpenMDArrayFromFullname(
2048 const std::string& osFullName,
2049 CSLConstList papszOptions = nullptr) const;
2050
2051 std::shared_ptr<GDALMDArray> ResolveMDArray(const std::string& osName,
2052 const std::string& osStartingPath,
2053 CSLConstList papszOptions = nullptr) const;
2054
2055 std::shared_ptr<GDALGroup> OpenGroupFromFullname(
2056 const std::string& osFullName,
2057 CSLConstList papszOptions = nullptr) const;
2058
2059 std::shared_ptr<GDALDimension> OpenDimensionFromFullname(
2060 const std::string& osFullName) const;
2061
2062 virtual void ClearStatistics();
2063
2065 static constexpr GUInt64 COPY_COST = 1000;
2067 };
2068
2069 /* ******************************************************************** */
2070 /* GDALAbstractMDArray */
2071 /* ******************************************************************** */
2072
2078 class CPL_DLL GDALAbstractMDArray
2079 {
2080 protected:
2082 std::string m_osName{};
2083 std::string m_osFullName{};
2084 std::weak_ptr<GDALAbstractMDArray> m_pSelf{};
2085
2086 GDALAbstractMDArray(const std::string& osParentName, const std::string& osName);
2087
2088 void SetSelf(std::weak_ptr<GDALAbstractMDArray> self) { m_pSelf = self; }
2089
2090 bool CheckReadWriteParams(const GUInt64* arrayStartIdx,
2091 const size_t* count,
2092 const GInt64*& arrayStep,
2093 const GPtrDiff_t*& bufferStride,
2094 const GDALExtendedDataType& bufferDataType,
2095 const void* buffer,
2096 const void* buffer_alloc_start,
2097 size_t buffer_alloc_size,
2098 std::vector<GInt64>& tmp_arrayStep,
2099 std::vector<GPtrDiff_t>& tmp_bufferStride) const;
2100
2101 virtual bool IRead(const GUInt64* arrayStartIdx, // array of size GetDimensionCount()
2102 const size_t* count, // array of size GetDimensionCount()
2103 const GInt64* arrayStep, // step in elements
2104 const GPtrDiff_t* bufferStride, // stride in elements
2105 const GDALExtendedDataType& bufferDataType,
2106 void* pDstBuffer) const = 0;
2107
2108 virtual bool IWrite(const GUInt64* arrayStartIdx, // array of size GetDimensionCount()
2109 const size_t* count, // array of size GetDimensionCount()
2110 const GInt64* arrayStep, // step in elements
2111 const GPtrDiff_t* bufferStride, // stride in elements
2112 const GDALExtendedDataType& bufferDataType,
2113 const void* pSrcBuffer);
2115
2116 public:
2117 virtual ~GDALAbstractMDArray();
2118
2123 const std::string& GetName() const{ return m_osName; }
2124
2129 const std::string& GetFullName() const{ return m_osFullName; }
2130
2131 GUInt64 GetTotalElementsCount() const;
2132
2133 virtual size_t GetDimensionCount() const;
2134
2135 virtual const std::vector<std::shared_ptr<GDALDimension>>& GetDimensions() const = 0;
2136
2137 virtual const GDALExtendedDataType &GetDataType() const = 0;
2138
2139 virtual std::vector<GUInt64> GetBlockSize() const;
2140
2141 virtual std::vector<size_t> GetProcessingChunkSize(size_t nMaxChunkMemory) const;
2142
2158 typedef bool (*FuncProcessPerChunkType)(
2159 GDALAbstractMDArray* array,
2160 const GUInt64* chunkArrayStartIdx,
2161 const size_t* chunkCount,
2162 GUInt64 iCurChunk,
2163 GUInt64 nChunkCount,
2164 void* pUserData);
2165
2166 virtual bool ProcessPerChunk(const GUInt64* arrayStartIdx,
2167 const GUInt64* count,
2168 const size_t* chunkSize,
2169 FuncProcessPerChunkType pfnFunc,
2170 void* pUserData);
2171
2172 virtual bool Read(const GUInt64* arrayStartIdx, // array of size GetDimensionCount()
2173 const size_t* count, // array of size GetDimensionCount()
2174 const GInt64* arrayStep, // step in elements
2175 const GPtrDiff_t* bufferStride, // stride in elements
2176 const GDALExtendedDataType& bufferDataType,
2177 void* pDstBuffer,
2178 const void* pDstBufferAllocStart = nullptr,
2179 size_t nDstBufferAllocSize = 0) const;
2180
2181 bool Write(const GUInt64* arrayStartIdx, // array of size GetDimensionCount()
2182 const size_t* count, // array of size GetDimensionCount()
2183 const GInt64* arrayStep, // step in elements
2184 const GPtrDiff_t* bufferStride, // stride in elements
2185 const GDALExtendedDataType& bufferDataType,
2186 const void* pSrcBuffer,
2187 const void* pSrcBufferAllocStart = nullptr,
2188 size_t nSrcBufferAllocSize = 0);
2189 };
2190
2191 /* ******************************************************************** */
2192 /* GDALRawResult */
2193 /* ******************************************************************** */
2194
2201 class CPL_DLL GDALRawResult
2202 {
2203 private:
2204 GDALExtendedDataType m_dt;
2205 size_t m_nEltCount;
2206 size_t m_nSize;
2207 GByte* m_raw;
2208
2209 void FreeMe();
2210
2211 GDALRawResult(const GDALRawResult&) = delete;
2212 GDALRawResult& operator=(const GDALRawResult&) = delete;
2213
2214 protected:
2215 friend class GDALAttribute;
2217 GDALRawResult(GByte* raw,
2218 const GDALExtendedDataType& dt,
2219 size_t nEltCount);
2221
2222 public:
2223 ~GDALRawResult();
2224 GDALRawResult(GDALRawResult&&);
2225 GDALRawResult& operator=(GDALRawResult&&);
2226
2228 const GByte& operator[](size_t idx) const { return m_raw[idx]; }
2230 const GByte* data() const { return m_raw; }
2232 size_t size() const { return m_nSize; }
2233
2235 GByte* StealData();
2237 };
2238
2239
2240 /* ******************************************************************** */
2241 /* GDALAttribute */
2242 /* ******************************************************************** */
2243
2254 class CPL_DLL GDALAttribute: virtual public GDALAbstractMDArray
2255 {
2256 mutable std::string m_osCachedVal{};
2257
2258 protected:
2260 GDALAttribute(const std::string& osParentName, const std::string& osName);
2262
2263 public:
2264
2265 std::vector<GUInt64> GetDimensionsSize() const;
2266
2267 GDALRawResult ReadAsRaw() const;
2268 const char* ReadAsString() const;
2269 int ReadAsInt() const;
2270 double ReadAsDouble() const;
2271 CPLStringList ReadAsStringArray() const;
2272 std::vector<int> ReadAsIntArray() const;
2273 std::vector<double> ReadAsDoubleArray() const;
2274
2275 using GDALAbstractMDArray::Write;
2276 bool Write(const void* pabyValue, size_t nLen);
2277 bool Write(const char*);
2278 bool WriteInt(int);
2279 bool Write(double);
2280 bool Write(CSLConstList);
2281 bool Write(const double*, size_t);
2282
2284 static constexpr GUInt64 COPY_COST = 100;
2286
2287 };
2288
2289 /************************************************************************/
2290 /* GDALAttributeString */
2291 /************************************************************************/
2292
2294 class CPL_DLL GDALAttributeString final: public GDALAttribute
2295 {
2296 std::vector<std::shared_ptr<GDALDimension>> m_dims{};
2297 GDALExtendedDataType m_dt = GDALExtendedDataType::CreateString();
2298 std::string m_osValue;
2299
2300 protected:
2301
2302 bool IRead(const GUInt64* ,
2303 const size_t* ,
2304 const GInt64* ,
2305 const GPtrDiff_t* ,
2306 const GDALExtendedDataType& bufferDataType,
2307 void* pDstBuffer) const override;
2308
2309 public:
2310 GDALAttributeString(const std::string& osParentName,
2311 const std::string& osName,
2312 const std::string& osValue,
2313 GDALExtendedDataTypeSubType eSubType = GEDTST_NONE);
2314
2315 const std::vector<std::shared_ptr<GDALDimension>>& GetDimensions() const override;
2316
2317 const GDALExtendedDataType &GetDataType() const override;
2318 };
2320
2321 /************************************************************************/
2322 /* GDALAttributeNumeric */
2323 /************************************************************************/
2324
2326 class CPL_DLL GDALAttributeNumeric final: public GDALAttribute
2327 {
2328 std::vector<std::shared_ptr<GDALDimension>> m_dims{};
2329 GDALExtendedDataType m_dt;
2330 int m_nValue = 0;
2331 double m_dfValue = 0;
2332 std::vector<GUInt32> m_anValuesUInt32{};
2333
2334 protected:
2335
2336 bool IRead(const GUInt64* ,
2337 const size_t* ,
2338 const GInt64* ,
2339 const GPtrDiff_t* ,
2340 const GDALExtendedDataType& bufferDataType,
2341 void* pDstBuffer) const override;
2342
2343 public:
2344 GDALAttributeNumeric(const std::string& osParentName,
2345 const std::string& osName,
2346 double dfValue);
2347 GDALAttributeNumeric(const std::string& osParentName,
2348 const std::string& osName,
2349 int nValue);
2350 GDALAttributeNumeric(const std::string& osParentName,
2351 const std::string& osName,
2352 const std::vector<GUInt32>& anValues);
2353
2354 const std::vector<std::shared_ptr<GDALDimension>>& GetDimensions() const override;
2355
2356 const GDALExtendedDataType &GetDataType() const override;
2357 };
2359
2360 /* ******************************************************************** */
2361 /* GDALMDArray */
2362 /* ******************************************************************** */
2363
2372 class CPL_DLL GDALMDArray: virtual public GDALAbstractMDArray, public GDALIHasAttribute
2373 {
2374 friend class GDALMDArrayResampled;
2375 std::shared_ptr<GDALMDArray> GetView(const std::vector<GUInt64>& indices) const;
2376
2377 inline std::shared_ptr<GDALMDArray> atInternal(std::vector<GUInt64>& indices) const
2378 {
2379 return GetView(indices);
2380 }
2381
2382 template<typename... GUInt64VarArg>
2383 // cppcheck-suppress functionStatic
2384 inline std::shared_ptr<GDALMDArray> atInternal(std::vector<GUInt64>& indices,
2385 GUInt64 idx, GUInt64VarArg... tail) const
2386 {
2387 indices.push_back(idx);
2388 return atInternal(indices, tail...);
2389 }
2390
2391 mutable bool m_bHasTriedCachedArray = false;
2392 mutable std::shared_ptr<GDALMDArray> m_poCachedArray{};
2393
2394 protected:
2396 GDALMDArray(const std::string& osParentName, const std::string& osName);
2397
2398 virtual bool IAdviseRead(const GUInt64* arrayStartIdx,
2399 const size_t* count,
2400 CSLConstList papszOptions) const;
2401
2402 virtual bool IsCacheable() const { return true; }
2403
2404 virtual bool SetStatistics( bool bApproxStats,
2405 double dfMin, double dfMax,
2406 double dfMean, double dfStdDev,
2407 GUInt64 nValidCount );
2408
2409 static std::string MassageName(const std::string& inputName);
2410
2411 std::shared_ptr<GDALGroup> GetCacheRootGroup(bool bCanCreate,
2412 std::string& osCacheFilenameOut) const;
2414
2415 public:
2416
2417 GUInt64 GetTotalCopyCost() const;
2418
2419 virtual bool CopyFrom(GDALDataset* poSrcDS,
2420 const GDALMDArray* poSrcArray,
2421 bool bStrict,
2422 GUInt64& nCurCost,
2423 const GUInt64 nTotalCost,
2424 GDALProgressFunc pfnProgress,
2425 void * pProgressData);
2426
2428 virtual bool IsWritable() const = 0;
2429
2438 virtual const std::string& GetFilename() const = 0;
2439
2440 virtual CSLConstList GetStructuralInfo() const;
2441
2442 virtual const std::string& GetUnit() const;
2443
2444 virtual bool SetUnit(const std::string& osUnit);
2445
2446 virtual bool SetSpatialRef(const OGRSpatialReference* poSRS);
2447
2448 virtual std::shared_ptr<OGRSpatialReference> GetSpatialRef() const;
2449
2450 virtual const void* GetRawNoDataValue() const;
2451
2452 double GetNoDataValueAsDouble(bool* pbHasNoData = nullptr) const;
2453
2454 virtual bool SetRawNoDataValue(const void* pRawNoData);
2455
2456 bool SetNoDataValue(double dfNoData);
2457
2458 virtual double GetOffset(bool* pbHasOffset = nullptr, GDALDataType* peStorageType = nullptr) const;
2459
2460 virtual double GetScale(bool* pbHasScale = nullptr, GDALDataType* peStorageType = nullptr) const;
2461
2462 virtual bool SetOffset(double dfOffset, GDALDataType eStorageType = GDT_Unknown);
2463
2464 virtual bool SetScale(double dfScale, GDALDataType eStorageType = GDT_Unknown);
2465
2466 std::shared_ptr<GDALMDArray> GetView(const std::string& viewExpr) const;
2467
2468 std::shared_ptr<GDALMDArray> operator[](const std::string& fieldName) const;
2469
2479 // sphinx 4.1.0 / breathe 4.30.0 don't like typename...
2481 template<typename... GUInt64VarArg>
2483 // cppcheck-suppress functionStatic
2484 std::shared_ptr<GDALMDArray> at(GUInt64 idx, GUInt64VarArg... tail) const
2485 {
2486 std::vector<GUInt64> indices;
2487 indices.push_back(idx);
2488 return atInternal(indices, tail...);
2489 }
2490
2491 virtual std::shared_ptr<GDALMDArray> Transpose(const std::vector<int>& anMapNewAxisToOldAxis) const;
2492
2493 std::shared_ptr<GDALMDArray> GetUnscaled() const;
2494
2495 virtual std::shared_ptr<GDALMDArray> GetMask(CSLConstList papszOptions) const;
2496
2497 std::shared_ptr<GDALMDArray>
2498 GetResampled( const std::vector<std::shared_ptr<GDALDimension>>& apoNewDims,
2499 GDALRIOResampleAlg resampleAlg,
2500 const OGRSpatialReference* poTargetSRS,
2501 CSLConstList papszOptions ) const;
2502
2503 virtual GDALDataset* AsClassicDataset(size_t iXDim, size_t iYDim) const;
2504
2505 virtual CPLErr GetStatistics( bool bApproxOK, bool bForce,
2506 double *pdfMin, double *pdfMax,
2507 double *pdfMean, double *padfStdDev,
2508 GUInt64* pnValidCount,
2509 GDALProgressFunc pfnProgress, void *pProgressData );
2510
2511 virtual bool ComputeStatistics( bool bApproxOK,
2512 double *pdfMin, double *pdfMax,
2513 double *pdfMean, double *pdfStdDev,
2514 GUInt64* pnValidCount,
2515 GDALProgressFunc, void *pProgressData );
2516
2517 virtual void ClearStatistics();
2518
2519 virtual std::vector<std::shared_ptr<GDALMDArray>> GetCoordinateVariables() const;
2520
2521 bool AdviseRead(const GUInt64* arrayStartIdx,
2522 const size_t* count,
2523 CSLConstList papszOptions = nullptr) const;
2524
2525 bool IsRegularlySpaced(double& dfStart, double& dfIncrement) const;
2526
2527 bool GuessGeoTransform(size_t nDimX, size_t nDimY, bool bPixelIsPoint,
2528 double adfGeoTransform[6]) const;
2529
2530 bool Cache( CSLConstList papszOptions = nullptr ) const;
2531
2532 bool Read(const GUInt64* arrayStartIdx, // array of size GetDimensionCount()
2533 const size_t* count, // array of size GetDimensionCount()
2534 const GInt64* arrayStep, // step in elements
2535 const GPtrDiff_t* bufferStride, // stride in elements
2536 const GDALExtendedDataType& bufferDataType,
2537 void* pDstBuffer,
2538 const void* pDstBufferAllocStart = nullptr,
2539 size_t nDstBufferAllocSize = 0) const override final;
2540
2542 static constexpr GUInt64 COPY_COST = 1000;
2543
2544 bool CopyFromAllExceptValues(const GDALMDArray* poSrcArray,
2545 bool bStrict,
2546 GUInt64& nCurCost,
2547 const GUInt64 nTotalCost,
2548 GDALProgressFunc pfnProgress,
2549 void * pProgressData);
2550 struct Range
2551 {
2552 GUInt64 m_nStartIdx;
2553 GInt64 m_nIncr;
2554 Range(GUInt64 nStartIdx = 0, GInt64 nIncr = 0):
2555 m_nStartIdx(nStartIdx), m_nIncr(nIncr) {}
2556 };
2557
2558 struct ViewSpec
2559 {
2560 std::string m_osFieldName{};
2561
2562 // or
2563
2564 std::vector<size_t> m_mapDimIdxToParentDimIdx{}; // of size m_dims.size()
2565 std::vector<Range> m_parentRanges{} ; // of size m_poParent->GetDimensionCount()
2566 };
2567
2568 virtual std::shared_ptr<GDALMDArray> GetView(const std::string& viewExpr,
2569 bool bRenameDimensions,
2570 std::vector<ViewSpec>& viewSpecs) const;
2572 };
2573
2575 bool GDALMDRasterIOFromBand(GDALRasterBand* poBand,
2576 GDALRWFlag eRWFlag,
2577 size_t iDimX,
2578 size_t iDimY,
2579 const GUInt64* arrayStartIdx,
2580 const size_t* count,
2581 const GInt64* arrayStep,
2582 const GPtrDiff_t* bufferStride,
2583 const GDALExtendedDataType& bufferDataType,
2584 void* pBuffer);
2586
2587 /************************************************************************/
2588 /* GDALMDArrayRegularlySpaced */
2589 /************************************************************************/
2590
2592 class CPL_DLL GDALMDArrayRegularlySpaced: public GDALMDArray
2593 {
2594 double m_dfStart;
2595 double m_dfIncrement;
2596 double m_dfOffsetInIncrement;
2597 GDALExtendedDataType m_dt = GDALExtendedDataType::Create(GDT_Float64);
2598 std::vector<std::shared_ptr<GDALDimension>> m_dims;
2599 std::vector<std::shared_ptr<GDALAttribute>> m_attributes{};
2600 std::string m_osEmptyFilename{};
2601
2602 protected:
2603
2604 bool IRead(const GUInt64* ,
2605 const size_t* ,
2606 const GInt64* ,
2607 const GPtrDiff_t* ,
2608 const GDALExtendedDataType& bufferDataType,
2609 void* pDstBuffer) const override;
2610
2611 public:
2612 GDALMDArrayRegularlySpaced(
2613 const std::string& osParentName,
2614 const std::string& osName,
2615 const std::shared_ptr<GDALDimension>& poDim,
2616 double dfStart, double dfIncrement,
2617 double dfOffsetInIncrement);
2618
2619 bool IsWritable() const override { return false; }
2620
2621 const std::string& GetFilename() const override { return m_osEmptyFilename; }
2622
2623 const std::vector<std::shared_ptr<GDALDimension>>& GetDimensions() const override;
2624
2625 const GDALExtendedDataType &GetDataType() const override;
2626
2627 std::vector<std::shared_ptr<GDALAttribute>> GetAttributes(CSLConstList) const override;
2628
2629 void AddAttribute(const std::shared_ptr<GDALAttribute>& poAttr);
2630 };
2632
2633 /* ******************************************************************** */
2634 /* GDALDimension */
2635 /* ******************************************************************** */
2636
2648 class CPL_DLL GDALDimension
2649 {
2650 public:
2652 GDALDimension(const std::string& osParentName,
2653 const std::string& osName,
2654 const std::string& osType,
2655 const std::string& osDirection,
2656 GUInt64 nSize);
2658
2659 virtual ~GDALDimension();
2660
2665 const std::string& GetName() const { return m_osName; }
2666
2671 const std::string& GetFullName() const { return m_osFullName; }
2672
2681 const std::string& GetType() const { return m_osType; }
2682
2691 const std::string& GetDirection() const { return m_osDirection; }
2692
2697 GUInt64 GetSize() const { return m_nSize; }
2698
2699 virtual std::shared_ptr<GDALMDArray> GetIndexingVariable() const;
2700
2701 virtual bool SetIndexingVariable(std::shared_ptr<GDALMDArray> poIndexingVariable);
2702
2703 protected:
2705 std::string m_osName;
2706 std::string m_osFullName;
2707 std::string m_osType;
2708 std::string m_osDirection;
2709 GUInt64 m_nSize;
2711 };
2712
2713
2714 /************************************************************************/
2715 /* GDALDimensionWeakIndexingVar() */
2716 /************************************************************************/
2717
2719 class CPL_DLL GDALDimensionWeakIndexingVar: public GDALDimension
2720 {
2721 std::weak_ptr<GDALMDArray> m_poIndexingVariable{};
2722
2723 public:
2724 GDALDimensionWeakIndexingVar(const std::string& osParentName,
2725 const std::string& osName,
2726 const std::string& osType,
2727 const std::string& osDirection,
2728 GUInt64 nSize);
2729
2730 std::shared_ptr<GDALMDArray> GetIndexingVariable() const override;
2731
2732 bool SetIndexingVariable(std::shared_ptr<GDALMDArray> poIndexingVariable) override;
2733 };
2735
2736 /************************************************************************/
2737 /* GDALAntiRecursionGuard */
2738 /************************************************************************/
2739
2741 struct GDALAntiRecursionStruct;
2742 class GDALAntiRecursionGuard
2743 {
2744 GDALAntiRecursionStruct* m_psAntiRecursionStruct;
2745 std::string m_osIdentifier;
2746 int m_nDepth;
2747
2748 GDALAntiRecursionGuard(const GDALAntiRecursionGuard&) = delete;
2749 GDALAntiRecursionGuard& operator= (const GDALAntiRecursionGuard&) = delete;
2750
2751 public:
2752 explicit GDALAntiRecursionGuard(const std::string& osIdentifier);
2753 GDALAntiRecursionGuard(const GDALAntiRecursionGuard& other, const std::string& osIdentifier);
2754 ~GDALAntiRecursionGuard();
2755 int GetCallDepth() const { return m_nDepth; }
2756 };
2758
2759
2760 /* ==================================================================== */
2761 /* An assortment of overview related stuff. */
2762 /* ==================================================================== */
2763
2765 /* Only exported for drivers as plugin. Signature may change */
2766 CPLErr CPL_DLL
2767 GDALRegenerateOverviewsMultiBand(int nBands, GDALRasterBand** papoSrcBands,
2768 int nOverviews,
2769 GDALRasterBand*** papapoOverviewBands,
2770 const char * pszResampling,
2771 GDALProgressFunc pfnProgress, void * pProgressData );
2772
2773 typedef CPLErr (*GDALResampleFunction)
2774 ( double dfXRatioDstToSrc,
2775 double dfYRatioDstToSrc,
2776 double dfSrcXDelta,
2777 double dfSrcYDelta,
2778 GDALDataType eWrkDataType,
2779 const void * pChunk,
2780 const GByte * pabyChunkNodataMask,
2781 int nChunkXOff, int nChunkXSize,
2782 int nChunkYOff, int nChunkYSize,
2783 int nDstXOff, int nDstXOff2,
2784 int nDstYOff, int nDstYOff2,
2785 GDALRasterBand * poOverview,
2786 void** ppDstBuffer,
2787 GDALDataType* peDstBufferDataType,
2788 const char * pszResampling,
2789 int bHasNoData, float fNoDataValue,
2790 GDALColorTable* poColorTable,
2791 GDALDataType eSrcDataType,
2792 bool bPropagateNoData );
2793
2794 GDALResampleFunction GDALGetResampleFunction(const char* pszResampling,
2795 int* pnRadius);
2796
2797 GDALDataType GDALGetOvrWorkDataType(const char* pszResampling,
2798 GDALDataType eSrcDataType);
2799
2800 CPL_C_START
2801
2802 CPLErr CPL_DLL
2803 HFAAuxBuildOverviews( const char *pszOvrFilename, GDALDataset *poParentDS,
2804 GDALDataset **ppoDS,
2805 int nBands, int *panBandList,
2806 int nNewOverviews, int *panNewOverviewList,
2807 const char *pszResampling,
2808 GDALProgressFunc pfnProgress,
2809 void *pProgressData );
2810
2811 CPLErr CPL_DLL
2812 GTIFFBuildOverviews( const char * pszFilename,
2813 int nBands, GDALRasterBand **papoBandList,
2814 int nOverviews, int * panOverviewList,
2815 const char * pszResampling,
2816 GDALProgressFunc pfnProgress, void * pProgressData );
2817
2818 int CPL_DLL GDALBandGetBestOverviewLevel(GDALRasterBand* poBand,
2819 int &nXOff, int &nYOff,
2820 int &nXSize, int &nYSize,
2821 int nBufXSize, int nBufYSize) CPL_WARN_DEPRECATED("Use GDALBandGetBestOverviewLevel2 instead");
2822 int CPL_DLL GDALBandGetBestOverviewLevel2(GDALRasterBand* poBand,
2823 int &nXOff, int &nYOff,
2824 int &nXSize, int &nYSize,
2825 int nBufXSize, int nBufYSize,
2826 GDALRasterIOExtraArg* psExtraArg);
2827
2828 int CPL_DLL GDALOvLevelAdjust( int nOvLevel, int nXSize ) CPL_WARN_DEPRECATED("Use GDALOvLevelAdjust2 instead");
2829 int CPL_DLL GDALOvLevelAdjust2( int nOvLevel, int nXSize, int nYSize );
2830 int CPL_DLL GDALComputeOvFactor( int nOvrXSize, int nRasterXSize,
2831 int nOvrYSize, int nRasterYSize );
2832
2833 GDALDataset CPL_DLL *
2834 GDALFindAssociatedAuxFile( const char *pszBasefile, GDALAccess eAccess,
2835 GDALDataset *poDependentDS );
2836
2837 /* ==================================================================== */
2838 /* Infrastructure to check that dataset characteristics are valid */
2839 /* ==================================================================== */
2840
2841 int CPL_DLL GDALCheckDatasetDimensions( int nXSize, int nYSize );
2842 int CPL_DLL GDALCheckBandCount( int nBands, int bIsZeroAllowed );
2843
2844 /* Internal use only */
2845
2846 /* CPL_DLL exported, but only for in-tree drivers that can be built as plugins */
2847 int CPL_DLL GDALReadWorldFile2( const char *pszBaseFilename, const char *pszExtension,
2848 double *padfGeoTransform, char** papszSiblingFiles,
2849 char** ppszWorldFileNameOut);
2850 int GDALReadTabFile2( const char * pszBaseFilename,
2851 double *padfGeoTransform, char **ppszWKT,
2852 int *pnGCPCount, GDAL_GCP **ppasGCPs,
2853 char** papszSiblingFiles, char** ppszTabFileNameOut );
2854
2855 void CPL_DLL GDALCopyRasterIOExtraArg(GDALRasterIOExtraArg* psDestArg,
2856 GDALRasterIOExtraArg* psSrcArg);
2857
2858 CPL_C_END
2859
2860 void GDALNullifyOpenDatasetsList();
2861 CPLMutex** GDALGetphDMMutex();
2862 CPLMutex** GDALGetphDLMutex();
2863 void GDALNullifyProxyPoolSingleton();
2864 void GDALSetResponsiblePIDForCurrentThread(GIntBig responsiblePID);
2865 GIntBig GDALGetResponsiblePIDForCurrentThread();
2866
2867 CPLString GDALFindAssociatedFile( const char *pszBasename, const char *pszExt,
2868 CSLConstList papszSiblingFiles, int nFlags );
2869
2870 CPLErr CPL_DLL EXIFExtractMetadata(char**& papszMetadata,
2871 void *fpL, int nOffset,
2872 int bSwabflag, int nTIFFHEADER,
2873 int& nExifOffset, int& nInterOffset, int& nGPSOffset);
2874
2875 int GDALValidateOpenOptions( GDALDriverH hDriver,
2876 const char* const* papszOptionOptions);
2877 int GDALValidateOptions( const char* pszOptionList,
2878 const char* const* papszOptionsToValidate,
2879 const char* pszErrorMessageOptionType,
2880 const char* pszErrorMessageContainerName);
2881
2882 GDALRIOResampleAlg GDALRasterIOGetResampleAlg(const char* pszResampling);
2883 const char* GDALRasterIOGetResampleAlg(GDALRIOResampleAlg eResampleAlg);
2884
2885 void GDALRasterIOExtraArgSetResampleAlg(GDALRasterIOExtraArg* psExtraArg,
2886 int nXSize, int nYSize,
2887 int nBufXSize, int nBufYSize);
2888
2889
2890 GDALDataset* GDALCreateOverviewDataset(GDALDataset* poDS, int nOvrLevel,
2891 int bThisLevelOnly);
2892
2893 // Should cover particular cases of #3573, #4183, #4506, #6578
2894 // Behavior is undefined if fVal1 or fVal2 are NaN (should be tested before
2895 // calling this function)
2896 template<class T> inline bool ARE_REAL_EQUAL(T fVal1, T fVal2, int ulp = 2)
2897 {
2898 return fVal1 == fVal2 || /* Should cover infinity */
2899 std::abs(fVal1 - fVal2) < std::numeric_limits<float>::epsilon() * std::abs(fVal1+fVal2) * ulp;
2900 }
2901
2902 double GDALAdjustNoDataCloseToFloatMax(double dfVal);
2903
2904 #define DIV_ROUND_UP(a, b) ( ((a) % (b)) == 0 ? ((a) / (b)) : (((a) / (b)) + 1) )
2905
2906 // Number of data samples that will be used to compute approximate statistics
2907 // (minimum value, maximum value, etc.)
2908 #define GDALSTAT_APPROX_NUMSAMPLES 2500
2909
2910 void GDALSerializeGCPListToXML( CPLXMLNode* psParentNode,
2911 GDAL_GCP* pasGCPList,
2912 int nGCPCount,
2913 const OGRSpatialReference* poGCP_SRS );
2914 void GDALDeserializeGCPListFromXML( CPLXMLNode* psGCPList,
2915 GDAL_GCP** ppasGCPList,
2916 int* pnGCPCount,
2917 OGRSpatialReference** ppoGCP_SRS );
2918
2919 void GDALSerializeOpenOptionsToXML( CPLXMLNode* psParentNode, char** papszOpenOptions);
2920 char** GDALDeserializeOpenOptionsFromXML( CPLXMLNode* psParentNode );
2921
2922 int GDALCanFileAcceptSidecarFile(const char* pszFilename);
2923
2924 bool GDALCanReliablyUseSiblingFileList(const char* pszFilename);
2925
2926 bool CPL_DLL GDALIsDriverDeprecatedForGDAL35StillEnabled(const char* pszDriverName, const char* pszExtraMsg = "");
2927
2928 typedef enum
2929 {
2930 GSF_UNSIGNED_INT,
2931 GSF_SIGNED_INT,
2932 GSF_FLOATING_POINT,
2933 } GDALBufferSampleFormat;
2934
2935 bool CPL_DLL GDALBufferHasOnlyNoData(const void* pBuffer,
2936 double dfNoDataValue,
2937 size_t nWidth, size_t nHeight,
2938 size_t nLineStride,
2939 size_t nComponents,
2940 int nBitsPerSample,
2941 GDALBufferSampleFormat nSampleFormat);
2942
2944
2945 #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:1463
GDALDimension::GetFullName
const std::string & GetFullName() const
Return the full name.
Definition: gdal_priv.h:2671
CPL_PRINT_FUNC_FORMAT
#define CPL_PRINT_FUNC_FORMAT(format_idx, arg_idx)
Tag a function to have printf() formatting.
Definition: cpl_port.h:869
GDAL_IDENTIFY_FALSE
@ GDAL_IDENTIFY_FALSE
Identify determined the file is not recognized by the probed driver.
Definition: gdal_priv.h:1465
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:1860
GDALDimension::SetIndexingVariable
virtual bool SetIndexingVariable(std::shared_ptr< GDALMDArray > poIndexingVariable)
Set the variable that is used to index the dimension.
Definition: gdalmultidim.cpp:8054
GDALGetDataTypeSizeBytes
int GDALGetDataTypeSizeBytes(GDALDataType)
Get data type size in bytes.
Definition: gdal_misc.cpp:308
GDALGroup::GetFullName
const std::string & GetFullName() const
Return the full name of the group.
Definition: gdal_priv.h:2003
GByte
unsigned char GByte
Unsigned byte type.
Definition: cpl_port.h:215
GDALAsyncReader::GetYOffset
int GetYOffset() const
Return y offset.
Definition: gdal_priv.h:1728
GDALExtendedDataType
Class used to represent potentially complex data types.
Definition: gdal_priv.h:1802
GDALRasterBlock::GetYSize
int GetYSize() const
Return the height of the block.
Definition: gdal_priv.h:972
GDALDataset::Layers::Iterator::iterator_category
std::input_iterator_tag iterator_category
iterator_category
Definition: gdal_priv.h:726
GUInt64
GUIntBig GUInt64
Unsigned 64 bit integer type.
Definition: cpl_port.h:265
gdal.h
GDALOpenInfo
Class for dataset open functions.
Definition: gdal_priv.h:268
GDALDataset::Layers::Iterator
Layer iterator.
Definition: gdal_priv.h:716
GDALRasterBand::ComputeStatistics
virtual CPLErr ComputeStatistics(int bApproxOK, double *pdfMin, double *pdfMax, double *pdfMean, double *pdfStdDev, GDALProgressFunc, void *pProgressData)
Compute image statistics.
Definition: gdalrasterband.cpp:4927
GDALAsyncReader::GetPixelSpace
int GetPixelSpace() const
Return pixel spacing.
Definition: gdal_priv.h:1764
GDALAbstractMDArray::GetFullName
const std::string & GetFullName() const
Return the name of an array or attribute.
Definition: gdal_priv.h:2129
GDALRasterBlock::GetBlockSize
GPtrDiff_t GetBlockSize() const
Return the block size in bytes.
Definition: gdal_priv.h:984
GDALEDTComponent
Class for a component of a compound extended data type.
Definition: gdal_priv.h:1903
GDALAsyncReader::GetBandCount
int GetBandCount() const
Return band count.
Definition: gdal_priv.h:1756
begin
OGRLayer::FeatureIterator begin(OGRLayer *poLayer)
Return begin of feature iterator.
Definition: ogrsf_frmts.h:287
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:3308
GDALDataset::Layers::Iterator::difference_type
void difference_type
difference_type
Definition: gdal_priv.h:724
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:293
CPLStringList
String list class designed around our use of C "char**" string lists.
Definition: cpl_string.h:441
GDALAsyncReader
Class used as a session object for asynchronous requests.
Definition: gdal_priv.h:1690
GDT_Unknown
@ GDT_Unknown
Definition: gdal.h:63
GPtrDiff_t
GIntBig GPtrDiff_t
Integer type large enough to hold the difference between 2 addresses.
Definition: cpl_port.h:282
GDALExtendedDataType::GetClass
GDALExtendedDataTypeClass GetClass() const
Return type class.
Definition: gdal_priv.h:1832
GDALAsyncReader::GetBufferYSize
int GetBufferYSize() const
Return buffer height.
Definition: gdal_priv.h:1748
cpl_minixml.h
GDALDriver
Format specific driver.
Definition: gdal_priv.h:1485
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:2078
GDALDataset::Bands
Class returned by GetBands() that act as a container for raster bands.
Definition: gdal_priv.h:472
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:2484
GDALColorTableH
void * GDALColorTableH
Opaque type used for the C bindings of the C++ GDALColorTable class.
Definition: gdal.h:277
GDALAsyncReader::GetLineSpace
int GetLineSpace() const
Return line spacing.
Definition: gdal_priv.h:1768
GDALClose
void GDALClose(GDALDatasetH)
Close GDAL dataset.
Definition: gdaldataset.cpp:3727
GDALRasterBlock::GetDataRef
void * GetDataRef(void)
Return the data buffer.
Definition: gdal_priv.h:980
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:1286
GDALDimension::GetName
const std::string & GetName() const
Return the name.
Definition: gdal_priv.h:2665
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:203
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:332
GDALRasterBand
A single raster band (or channel).
Definition: gdal_priv.h:1130
GInt64
GIntBig GInt64
Signed 64 bit integer type.
Definition: cpl_port.h:263
GDALIdentifyEnum
GDALIdentifyEnum
Enumeration used by GDALDriver::pfnIdentify().
Definition: gdal_priv.h:1460
GDALAsyncReader::GetBandSpace
int GetBandSpace() const
Return band spacing.
Definition: gdal_priv.h:1772
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
GDALDimension::GetDirection
const std::string & GetDirection() const
Return the axis direction.
Definition: gdal_priv.h:2691
GDALAsyncReader::GetBufferType
GDALDataType GetBufferType() const
Return buffer data type.
Definition: gdal_priv.h:1752
GDALExtendedDataTypeClass
GDALExtendedDataTypeClass
Enumeration giving the class of a GDALExtendedDataType.
Definition: gdal.h:291
GDALRawResult::data
const GByte * data() const
Return pointer to the start of data.
Definition: gdal_priv.h:2230
GDALDataType
GDALDataType
Definition: gdal.h:62
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:796
GDALAbstractMDArray::GetName
const std::string & GetName() const
Return the name of an array or attribute.
Definition: gdal_priv.h:2123
GDALRasterBlock
A single raster block in the block cache.
Definition: gdal_priv.h:907
GDALMajorObjectH
void * GDALMajorObjectH
Opaque type used for the C bindings of the C++ GDALMajorObject class.
Definition: gdal.h:265
GDALRawResult
Store the raw result of an attribute value, which might contain dynamically allocated structures (lik...
Definition: gdal_priv.h:2201
GDALGroup
Class modeling a named container of GDALAttribute, GDALMDArray, OGRLayer or other GDALGroup.
Definition: gdal_priv.h:1976
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:608
GDALDataset::BuildOverviews
CPLErr BuildOverviews(const char *, int, int *, int, int *, GDALProgressFunc, void *)
Build raster overview(s)
Definition: gdaldataset.cpp:1950
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:2232
GDALIHasAttribute
Interface used to get a single GDALAttribute or a set of GDALAttribute.
Definition: gdal_priv.h:1945
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:329
GDALDriverManager
Class for managing the registration of file format drivers.
Definition: gdal_priv.h:1640
GDALMDArray
Class modeling a multi-dimensional array.
Definition: gdal_priv.h:2372
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:1736
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:5957
GDALExtendedDataType::GetNumericDataType
GDALDataType GetNumericDataType() const
Return numeric data type (only valid when GetClass() == GEDTC_NUMERIC)
Definition: gdal_priv.h:1838
GDALExtendedDataType::CreateString
static GDALExtendedDataType CreateString(size_t nMaxStringLength=0, GDALExtendedDataTypeSubType eSubType=GEDTST_NONE)
Return a new GDALExtendedDataType of class GEDTC_STRING.
Definition: gdalmultidim.cpp:7780
CSLConstList
char ** CSLConstList
Type of a constant null-terminated list of nul terminated strings.
Definition: cpl_port.h:1169
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:247
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:653
GDT_Float64
@ GDT_Float64
Definition: gdal.h:72
GDALExtendedDataType::GetSubType
GDALExtendedDataTypeSubType GetSubType() const
Return subtype.
Definition: gdal_priv.h:1846
GDALRasterBlock::DropLock
int DropLock(void)
Decrement the lock count.
Definition: gdal_priv.h:948
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:2681
GDAL_GCP
Ground Control Point.
Definition: gdal.h:710
CPL_C_END
#define CPL_C_END
Macro to end a block of C symbols.
Definition: cpl_port.h:331
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:2648
GEDTST_NONE
@ GEDTST_NONE
None.
Definition: gdal.h:305
CPL_NULL_TERMINATED
#define CPL_NULL_TERMINATED
Null terminated variadic.
Definition: cpl_port.h:859
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:1852
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:666
GDALAsyncReader::GetGDALDataset
GDALDataset * GetGDALDataset()
Return dataset.
Definition: gdal_priv.h:1720
CPLString::toupper
CPLString & toupper(void)
Convert to upper case in place.
Definition: cplstring.cpp:316
cpl_conv.h
GDALDataset::ToHandle
static GDALDatasetH ToHandle(GDALDataset *poDS)
Convert a GDALDataset* to a GDALDatasetH.
Definition: gdal_priv.h:641
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:1724
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:4114
GDALColorTable::ToHandle
static GDALColorTableH ToHandle(GDALColorTable *poCT)
Convert a GDALColorTable* to a GDALRasterBandH.
Definition: gdal_priv.h:1047
GDALRasterBlock::AddLock
int AddLock(void)
Increment the lock count.
Definition: gdal_priv.h:946
GDALDataset::CreateMaskBand
virtual CPLErr CreateMaskBand(int nFlagsIn)
Adds a mask band to the dataset.
Definition: gdaldataset.cpp:3117
OGRFieldDomain
Definition of a field domain.
Definition: ogr_feature.h:835
GSpacing
GIntBig GSpacing
Type to express pixel, line or band spacing.
Definition: gdal.h:286
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:2697
GDALAccess
GDALAccess
Definition: gdal.h:115
GDALDataset::MarkSuppressOnClose
void MarkSuppressOnClose()
Set that the dataset must be deleted on close.
Definition: gdal_priv.h:603
end
OGRLayer::FeatureIterator end(OGRLayer *poLayer)
Return end of feature iterator.
Definition: ogrsf_frmts.h:292
GDALAsyncStatusType
GDALAsyncStatusType
status of the asynchronous stream
Definition: gdal.h:102
GDALEDTComponent::GetOffset
size_t GetOffset() const
Return the offset (in bytes) of the component in the compound data type.
Definition: gdal_priv.h:1922
GDALDriver::FromHandle
static GDALDriver * FromHandle(GDALDriverH hDriver)
Convert a GDALDriverH to a GDALDriver*.
Definition: gdal_priv.h:1622
GDALRawResult::operator[]
const GByte & operator[](size_t idx) const
Return byte at specified index.
Definition: gdal_priv.h:2228
GDAL_IDENTIFY_TRUE
@ GDAL_IDENTIFY_TRUE
Identify determined the file is recognized by the probed driver.
Definition: gdal_priv.h:1467
OGRErr
int OGRErr
Type for a OGR error.
Definition: ogr_core.h:318
GA_ReadOnly
@ GA_ReadOnly
Definition: gdal.h:116
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:8033
GDALAsyncReader::GetXSize
int GetXSize() const
Return width.
Definition: gdal_priv.h:1732
GDALRasterBlock::GetDirty
int GetDirty() const
Return the dirty flag.
Definition: gdal_priv.h:976
GIntBig
long long GIntBig
Large signed integer type (generally 64-bit integer type).
Definition: cpl_port.h:244
GDALDataset::Layers::Iterator::pointer
void pointer
pointer
Definition: gdal_priv.h:725
GDALAsyncReader::GetBufferXSize
int GetBufferXSize() const
Return buffer width.
Definition: gdal_priv.h:1744
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:345
GDALDriver::ToHandle
static GDALDriverH ToHandle(GDALDriver *poDriver)
Convert a GDALDriver* to a GDALDriverH.
Definition: gdal_priv.h:1616
GDALRasterIOExtraArg
Structure to pass extra arguments to RasterIO() method, must be initialized with INIT_RASTERIO_EXTRA_...
Definition: gdal.h:160
GDALRasterBand::ToHandle
void static GDALRasterBandH ToHandle(GDALRasterBand *poBand)
Convert a GDALRasterBand* to a GDALRasterBandH.
Definition: gdal_priv.h:1345
GDALRasterBlock::GetYOff
int GetYOff() const
Return the y offset of the top-left corner of the block.
Definition: gdal_priv.h:964
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:894
GDALDataset::GetAccess
GDALAccess GetAccess() const
Return access mode.
Definition: gdal_priv.h:597
OGRFeature
A simple feature, including geometry and attributes.
Definition: ogr_feature.h:370
GDALMDArray::GetFilename
virtual const std::string & GetFilename() const =0
Return the filename that contains that array.
GDALRWFlag
GDALRWFlag
Definition: gdal.h:121
GDALDataset::Features
Class returned by GetFeatures() that act as a container for vector features.
Definition: gdal_priv.h:766
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:1841
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:2254
GDALEDTComponent::GetType
const GDALExtendedDataType & GetType() const
Return the data type of the component.
Definition: gdal_priv.h:1928
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:1053
GDT_Byte
@ GDT_Byte
Definition: gdal.h:64
GPI_RGB
@ GPI_RGB
Definition: gdal.h:232
GDALExtendedDataTypeSubType
GDALExtendedDataTypeSubType
Enumeration giving the subtype of a GDALExtendedDataType.
Definition: gdal.h:303
GDALDatasetUniquePtr
std::unique_ptr< GDALDataset, GDALDatasetUniquePtrDeleter > GDALDatasetUniquePtr
Unique pointer type for GDALDataset.
Definition: gdal_priv.h:897
GDALRasterBand::GetMaskFlags
virtual int GetMaskFlags()
Return the status flags of the mask band associated with the band.
Definition: gdalrasterband.cpp:6222
GDALRIOResampleAlg
GDALRIOResampleAlg
RasterIO() resampling method.
Definition: gdal.h:130
GetGDALDriverManager
GDALDriverManager * GetGDALDriverManager(void)
Fetch the global GDAL driver manager.
Definition: gdaldrivermanager.cpp:99
GDALRasterAttributeTable
Definition: gdal_rat.h:47
GDALAsyncReader::GetXOffset
int GetXOffset() const
Return x offset.
Definition: gdal_priv.h:1724
GDALExtendedDataType::GetMaxStringLength
size_t GetMaxStringLength() const
Return the maximum length of a string in bytes.
Definition: gdal_priv.h:1866
GDALRasterBlock::GetBand
GDALRasterBand * GetBand()
Accessor to source GDALRasterBand object.
Definition: gdal_priv.h:992
GDALDataset::Layers
Class returned by GetLayers() that acts as a range of layers.
Definition: gdal_priv.h:703
GDALRasterBlock::GetXOff
int GetXOff() const
Return the x offset of the top-left corner of the block.
Definition: gdal_priv.h:960
GDALRasterBlock::GetDataType
GDALDataType GetDataType() const
Return the data type.
Definition: gdal_priv.h:956
GDALDataset::FromHandle
static GDALDataset * FromHandle(GDALDatasetH hDS)
Convert a GDALDatasetH to a GDALDataset*.
Definition: gdal_priv.h:647
ogr_core.h
GDALPaletteInterp
GDALPaletteInterp
Definition: gdal.h:229
GDALExtendedDataType::Create
static GDALExtendedDataType Create(GDALDataType eType)
Return a new GDALExtendedDataType of class GEDTC_NUMERIC.
Definition: gdalmultidim.cpp:7716
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:271
GDALGroup::GetName
const std::string & GetName() const
Return the name of the group.
Definition: gdal_priv.h:1997
wkbUnknown
@ wkbUnknown
unknown type, non-standard
Definition: ogr_core.h:347
GDALAsyncReader::GetBuffer
void * GetBuffer()
Return buffer.
Definition: gdal_priv.h:1740
GDALExtendedDataType::GetName
const std::string & GetName() const
Return type name.
Definition: gdal_priv.h:1826
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:955
GDALEDTComponent::GetName
const std::string & GetName() const
Return the name.
Definition: gdal_priv.h:1916
GDALRasterBlock::GetXSize
int GetXSize() const
Return the width of the block.
Definition: gdal_priv.h:968
GDALDatasetH
void * GDALDatasetH
Opaque type used for the C bindings of the C++ GDALDataset class.
Definition: gdal.h:268
GDALRasterBand::FromHandle
static GDALRasterBand * FromHandle(GDALRasterBandH hBand)
Convert a GDALRasterBandH to a GDALRasterBand*.
Definition: gdal_priv.h:1351
GDALColorTable
A color table / palette.
Definition: gdal_priv.h:1022
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:1760
GDALDriverH
void * GDALDriverH
Opaque type used for the C bindings of the C++ GDALDriver class.
Definition: gdal.h:274