GDAL

- Main Page
- Related Pages
- Classes
- Files
- Download
- Issue Tracker

- File List
- File Members

gdal_priv.h
Go to the documentation of this file.
1 /******************************************************************************
2 * $Id: gdal_priv.h 37723 2017-03-16 17:07:53Z rouault $
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 mines-paris dot org>
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 #include <vector>
69 #include <map>
70 #include "ogr_core.h"
71
73 #define GMO_VALID 0x0001
74 #define GMO_IGNORE_UNIMPLEMENTED 0x0002
75 #define GMO_SUPPORT_MD 0x0004
76 #define GMO_SUPPORT_MDMD 0x0008
77 #define GMO_MD_DIRTY 0x0010
78 #define GMO_PAM_CLASS 0x0020
79
81 /************************************************************************/
82 /* GDALMultiDomainMetadata */
83 /************************************************************************/
84
86 class CPL_DLL GDALMultiDomainMetadata
87 {
88 private:
89 char **papszDomainList;
90 CPLStringList **papoMetadataLists;
91
92 public:
93 GDALMultiDomainMetadata();
94 ~GDALMultiDomainMetadata();
95
96 int XMLInit( CPLXMLNode *psMetadata, int bMerge );
97 CPLXMLNode *Serialize();
98
99 char **GetDomainList() { return papszDomainList; }
100
101 char **GetMetadata( const char * pszDomain = "" );
102 CPLErr SetMetadata( char ** papszMetadata,
103 const char * pszDomain = "" );
104 const char *GetMetadataItem( const char * pszName,
105 const char * pszDomain = "" );
106 CPLErr SetMetadataItem( const char * pszName,
107 const char * pszValue,
108 const char * pszDomain = "" );
109
110 void Clear();
111
112 private:
113 CPL_DISALLOW_COPY_ASSIGN(GDALMultiDomainMetadata)
114 };
116
117 /* ******************************************************************** */
118 /* GDALMajorObject */
119 /* */
120 /* Base class providing metadata, description and other */
121 /* services shared by major objects. */
122 /* ******************************************************************** */
123
125 class CPL_DLL GDALMajorObject
126 {
127 protected:
129 int nFlags; // GMO_* flags.
130 CPLString sDescription;
131 GDALMultiDomainMetadata oMDMD;
132
134
135 char **BuildMetadataDomainList( char** papszList,
136 int bCheckNonEmpty, ... ) CPL_NULL_TERMINATED;
137 public:
138 GDALMajorObject();
139 virtual ~GDALMajorObject();
140
141 int GetMOFlags() const;
142 void SetMOFlags( int nFlagsIn );
143
144 virtual const char *GetDescription() const;
145 virtual void SetDescription( const char * );
146
147 virtual char **GetMetadataDomainList();
148
149 virtual char **GetMetadata( const char * pszDomain = "" );
150 virtual CPLErr SetMetadata( char ** papszMetadata,
151 const char * pszDomain = "" );
152 virtual const char *GetMetadataItem( const char * pszName,
153 const char * pszDomain = "" );
154 virtual CPLErr SetMetadataItem( const char * pszName,
155 const char * pszValue,
156 const char * pszDomain = "" );
157 };
158
159 /* ******************************************************************** */
160 /* GDALDefaultOverviews */
161 /* ******************************************************************** */
162
164 class CPL_DLL GDALDefaultOverviews
165 {
166 friend class GDALDataset;
167
168 GDALDataset *poDS;
169 GDALDataset *poODS;
170
171 CPLString osOvrFilename;
172
173 bool bOvrIsAux;
174
175 bool bCheckedForMask;
176 bool bOwnMaskDS;
177 GDALDataset *poMaskDS;
178
179 // For "overview datasets" we record base level info so we can
180 // find our way back to get overview masks.
181 GDALDataset *poBaseDS;
182
183 // Stuff for deferred initialize/overviewscans.
184 bool bCheckedForOverviews;
185 void OverviewScan();
186 char *pszInitName;
187 bool bInitNameIsOVR;
188 char **papszInitSiblingFiles;
189
190 public:
191 GDALDefaultOverviews();
192 ~GDALDefaultOverviews();
193
194 void Initialize( GDALDataset *poDSIn, const char *pszName = NULL,
195 char **papszSiblingFiles = NULL,
196 int bNameIsOVR = FALSE );
197
198 void TransferSiblingFiles( char** papszSiblingFiles );
199
200 int IsInitialized();
201
202 int CloseDependentDatasets();
203
204 // Overview Related
205
206 int GetOverviewCount( int nBand );
207 GDALRasterBand *GetOverview( int nBand, int iOverview );
208
209 CPLErr BuildOverviews( const char * pszBasename,
210 const char * pszResampling,
211 int nOverviews, int * panOverviewList,
212 int nBands, int * panBandList,
213 GDALProgressFunc pfnProgress,
214 void *pProgressData );
215
216 CPLErr BuildOverviewsSubDataset( const char * pszPhysicalFile,
217 const char * pszResampling,
218 int nOverviews, int * panOverviewList,
219 int nBands, int * panBandList,
220 GDALProgressFunc pfnProgress,
221 void *pProgressData );
222
223 CPLErr CleanOverviews();
224
225 // Mask Related
226
227 CPLErr CreateMaskBand( int nFlags, int nBand = -1 );
228 GDALRasterBand *GetMaskBand( int nBand );
229 int GetMaskFlags( int nBand );
230
231 int HaveMaskFile( char **papszSiblings = NULL,
232 const char *pszBasename = NULL );
233
234 char** GetSiblingFiles() { return papszInitSiblingFiles; }
235
236 private:
237 CPL_DISALLOW_COPY_ASSIGN(GDALDefaultOverviews)
238 };
240
241 /* ******************************************************************** */
242 /* GDALOpenInfo */
243 /* ******************************************************************** */
244
246 class CPL_DLL GDALOpenInfo
247 {
248 bool bHasGotSiblingFiles;
249 char **papszSiblingFiles;
250 int nHeaderBytesTried;
251
252 public:
253 GDALOpenInfo( const char * pszFile, int nOpenFlagsIn,
254 char **papszSiblingFiles = NULL );
255 ~GDALOpenInfo( void );
256
258 char *pszFilename;
260 char** papszOpenOptions;
261
263 GDALAccess eAccess;
265 int nOpenFlags;
266
268 int bStatOK;
270 int bIsDirectory;
271
273 VSILFILE *fpL;
274
276 int nHeaderBytes;
278 GByte *pabyHeader;
279
281 const char* const* papszAllowedDrivers;
282
283 int TryToIngest(int nBytes);
284 char **GetSiblingFiles();
285 char **StealSiblingFiles();
286 bool AreSiblingFilesLoaded() const;
287
288 private:
289 CPL_DISALLOW_COPY_ASSIGN(GDALOpenInfo)
290 };
291
292 /* ******************************************************************** */
293 /* GDALDataset */
294 /* ******************************************************************** */
295
296 class OGRLayer;
297 class OGRGeometry;
298 class OGRSpatialReference;
299 class OGRStyleTable;
300 class swq_select;
301 class swq_select_parse_options;
302
304 typedef struct GDALSQLParseInfo GDALSQLParseInfo;
306
307 #ifdef DETECT_OLD_IRASTERIO
308 typedef void signature_changed;
309 #endif
310
312 #ifdef GDAL_COMPILATION
313 #define OPTIONAL_OUTSIDE_GDAL(val)
314 #else
315 #define OPTIONAL_OUTSIDE_GDAL(val) = val
316 #endif
317
319 class OGRFeature;
320
322 class CPL_DLL GDALDataset : public GDALMajorObject
323 {
324 friend GDALDatasetH CPL_STDCALL GDALOpenEx( const char* pszFilename,
325 unsigned int nOpenFlags,
326 const char* const* papszAllowedDrivers,
327 const char* const* papszOpenOptions,
328 const char* const* papszSiblingFiles );
329 friend void CPL_STDCALL GDALClose( GDALDatasetH hDS );
330
331 friend class GDALDriver;
332 friend class GDALDefaultOverviews;
333 friend class GDALProxyDataset;
334 friend class GDALDriverManager;
335
336 void AddToDatasetOpenList();
337
338 void Init( bool bForceCachedIO );
339
340 protected:
342 GDALDriver *poDriver;
343 GDALAccess eAccess;
344
345 // Stored raster information.
346 int nRasterXSize;
347 int nRasterYSize;
348 int nBands;
349 GDALRasterBand **papoBands;
350
351 int nOpenFlags;
352
353 int nRefCount;
354 bool bForceCachedIO;
355 bool bShared;
356 bool bIsInternal;
357 bool bSuppressOnClose;
358
359 GDALDataset(void);
360 explicit GDALDataset(int bForceCachedIO);
361
362 void RasterInitialize( int, int );
363 void SetBand( int, GDALRasterBand * );
364
365 GDALDefaultOverviews oOvManager;
366
367 virtual CPLErr IBuildOverviews( const char *, int, int *,
368 int, int *, GDALProgressFunc, void * );
369
370 #ifdef DETECT_OLD_IRASTERIO
371 virtual signature_changed IRasterIO( GDALRWFlag, int, int, int, int,
372 void *, int, int, GDALDataType,
373 int, int *, int, int, int ) {};
374 #endif
375
376 virtual CPLErr IRasterIO( GDALRWFlag, int, int, int, int,
377 void *, int, int, GDALDataType,
378 int, int *, GSpacing, GSpacing, GSpacing,
379 GDALRasterIOExtraArg* psExtraArg ) CPL_WARN_UNUSED_RESULT;
380
381 CPLErr BlockBasedRasterIO( GDALRWFlag, int, int, int, int,
382 void *, int, int, GDALDataType,
383 int, int *, GSpacing, GSpacing, GSpacing,
384 GDALRasterIOExtraArg* psExtraArg ) CPL_WARN_UNUSED_RESULT;
385 void BlockBasedFlushCache();
386
387 CPLErr BandBasedRasterIO( GDALRWFlag eRWFlag,
388 int nXOff, int nYOff, int nXSize, int nYSize,
389 void * pData, int nBufXSize, int nBufYSize,
390 GDALDataType eBufType,
391 int nBandCount, int *panBandMap,
392 GSpacing nPixelSpace, GSpacing nLineSpace,
393 GSpacing nBandSpace,
394 GDALRasterIOExtraArg* psExtraArg ) CPL_WARN_UNUSED_RESULT;
395
396 CPLErr RasterIOResampled( GDALRWFlag eRWFlag,
397 int nXOff, int nYOff, int nXSize, int nYSize,
398 void * pData, int nBufXSize, int nBufYSize,
399 GDALDataType eBufType,
400 int nBandCount, int *panBandMap,
401 GSpacing nPixelSpace, GSpacing nLineSpace,
402 GSpacing nBandSpace,
403 GDALRasterIOExtraArg* psExtraArg ) CPL_WARN_UNUSED_RESULT;
404
405 CPLErr ValidateRasterIOOrAdviseReadParameters(
406 const char* pszCallingFunc,
407 int* pbStopProcessingOnCENone,
408 int nXOff, int nYOff, int nXSize, int nYSize,
409 int nBufXSize, int nBufYSize,
410 int nBandCount, int *panBandMap);
411
412 CPLErr TryOverviewRasterIO( GDALRWFlag eRWFlag,
413 int nXOff, int nYOff, int nXSize, int nYSize,
414 void * pData, int nBufXSize, int nBufYSize,
415 GDALDataType eBufType,
416 int nBandCount, int *panBandMap,
417 GSpacing nPixelSpace, GSpacing nLineSpace,
418 GSpacing nBandSpace,
419 GDALRasterIOExtraArg* psExtraArg,
420 int* pbTried);
421
423 virtual int CloseDependentDatasets();
425 int ValidateLayerCreationOptions( const char* const* papszLCO );
426
427 char **papszOpenOptions;
428
429 friend class GDALRasterBand;
430
431 // The below methods related to read write mutex are fragile logic, and
432 // should not be used by out-of-tree code if possible.
433 int EnterReadWrite(GDALRWFlag eRWFlag);
434 void LeaveReadWrite();
435 void InitRWLock();
436
437 void TemporarilyDropReadWriteLock();
438 void ReacquireReadWriteLock();
439
440 void DisableReadWriteMutex();
441
442 int AcquireMutex();
443 void ReleaseMutex();
445
446 public:
447 virtual ~GDALDataset();
448
449 int GetRasterXSize( void );
450 int GetRasterYSize( void );
451 int GetRasterCount( void );
452 GDALRasterBand *GetRasterBand( int );
453
454 virtual void FlushCache(void);
455
456 virtual const char *GetProjectionRef(void);
457 virtual CPLErr SetProjection( const char * pszProjection );
458
459 virtual CPLErr GetGeoTransform( double * padfTransform );
460 virtual CPLErr SetGeoTransform( double * padfTransform );
461
462 virtual CPLErr AddBand( GDALDataType eType,
463 char **papszOptions=NULL );
464
465 virtual void *GetInternalHandle( const char * pszHandleName );
466 virtual GDALDriver *GetDriver(void);
467 virtual char **GetFileList(void);
468
469 virtual const char* GetDriverName();
470
471 virtual int GetGCPCount();
472 virtual const char *GetGCPProjection();
473 virtual const GDAL_GCP *GetGCPs();
474 virtual CPLErr SetGCPs( int nGCPCount, const GDAL_GCP *pasGCPList,
475 const char *pszGCPProjection );
476
477 virtual CPLErr AdviseRead( int nXOff, int nYOff, int nXSize, int nYSize,
478 int nBufXSize, int nBufYSize,
479 GDALDataType eDT,
480 int nBandCount, int *panBandList,
481 char **papszOptions );
482
483 virtual CPLErr CreateMaskBand( int nFlagsIn );
484
485 virtual GDALAsyncReader*
486 BeginAsyncReader(int nXOff, int nYOff, int nXSize, int nYSize,
487 void *pBuf, int nBufXSize, int nBufYSize,
488 GDALDataType eBufType,
489 int nBandCount, int* panBandMap,
490 int nPixelSpace, int nLineSpace, int nBandSpace,
491 char **papszOptions);
492 virtual void EndAsyncReader(GDALAsyncReader *);
493
494 CPLErr RasterIO( GDALRWFlag, int, int, int, int,
495 void *, int, int, GDALDataType,
496 int, int *, GSpacing, GSpacing, GSpacing,
497 GDALRasterIOExtraArg* psExtraArg
498 #ifndef DOXYGEN_SKIP
499 OPTIONAL_OUTSIDE_GDAL(NULL)
500 #endif
501 ) CPL_WARN_UNUSED_RESULT;
502
503 int Reference();
504 int Dereference();
505 int ReleaseRef();
506
510 GDALAccess GetAccess() const { return eAccess; }
511
512 int GetShared() const;
513 void MarkAsShared();
514
516 void MarkSuppressOnClose() { bSuppressOnClose = true; }
517
521 char **GetOpenOptions() { return papszOpenOptions; }
522
523 static GDALDataset **GetOpenDatasets( int *pnDatasetCount );
524
525 CPLErr BuildOverviews( const char *, int, int *,
526 int, int *, GDALProgressFunc, void * );
527
528 void ReportError(CPLErr eErrClass, CPLErrorNum err_no, const char *fmt, ...) CPL_PRINT_FUNC_FORMAT (4, 5);
529
530 virtual char ** GetMetadata(const char * pszDomain = "") CPL_OVERRIDE;
531
532 // Only defined when Doxygen enabled
533 #ifdef DOXYGEN_SKIP
534 virtual CPLErr SetMetadata( char ** papszMetadata,
535 const char * pszDomain ) CPL_OVERRIDE;
536 virtual const char *GetMetadataItem( const char * pszName,
537 const char * pszDomain ) CPL_OVERRIDE;
538 virtual CPLErr SetMetadataItem( const char * pszName,
539 const char * pszValue,
540 const char * pszDomain ) CPL_OVERRIDE;
541 #endif
542
543 virtual char ** GetMetadataDomainList() CPL_OVERRIDE;
544
545 private:
546 void *m_hPrivateData;
547
548 OGRLayer* BuildLayerFromSelectInfo(swq_select* psSelectInfo,
549 OGRGeometry *poSpatialFilter,
550 const char *pszDialect,
551 swq_select_parse_options* poSelectParseOptions);
552 CPLStringList oDerivedMetadataList;
553 public:
554
555 virtual int GetLayerCount();
556 virtual OGRLayer *GetLayer(int iLayer);
557 virtual OGRLayer *GetLayerByName(const char *);
558 virtual OGRErr DeleteLayer(int iLayer);
559
560 virtual void ResetReading();
561 virtual OGRFeature* GetNextFeature( OGRLayer** ppoBelongingLayer,
562 double* pdfProgressPct,
563 GDALProgressFunc pfnProgress,
564 void* pProgressData );
565
566 virtual int TestCapability( const char * );
567
568 virtual OGRLayer *CreateLayer( const char *pszName,
569 OGRSpatialReference *poSpatialRef = NULL,
570 OGRwkbGeometryType eGType = wkbUnknown,
571 char ** papszOptions = NULL );
572 virtual OGRLayer *CopyLayer( OGRLayer *poSrcLayer,
573 const char *pszNewName,
574 char **papszOptions = NULL );
575
576 virtual OGRStyleTable *GetStyleTable();
577 virtual void SetStyleTableDirectly( OGRStyleTable *poStyleTable );
578
579 virtual void SetStyleTable(OGRStyleTable *poStyleTable);
580
581 virtual OGRLayer * ExecuteSQL( const char *pszStatement,
582 OGRGeometry *poSpatialFilter,
583 const char *pszDialect );
584 virtual void ReleaseResultSet( OGRLayer * poResultsSet );
585
586 int GetRefCount() const;
587 int GetSummaryRefCount() const;
588 OGRErr Release();
589
590 virtual OGRErr StartTransaction(int bForce=FALSE);
591 virtual OGRErr CommitTransaction();
592 virtual OGRErr RollbackTransaction();
593
595 static int IsGenericSQLDialect(const char* pszDialect);
596
597 // Semi-public methods. Only to be used by in-tree drivers.
598 GDALSQLParseInfo* BuildParseInfo(swq_select* psSelectInfo,
599 swq_select_parse_options* poSelectParseOptions);
600 static void DestroyParseInfo(GDALSQLParseInfo* psParseInfo );
601 OGRLayer * ExecuteSQL( const char *pszStatement,
602 OGRGeometry *poSpatialFilter,
603 const char *pszDialect,
604 swq_select_parse_options* poSelectParseOptions);
606
607 protected:
608 virtual OGRLayer *ICreateLayer( const char *pszName,
609 OGRSpatialReference *poSpatialRef = NULL,
610 OGRwkbGeometryType eGType = wkbUnknown,
611 char ** papszOptions = NULL );
612
614 OGRErr ProcessSQLCreateIndex( const char * );
615 OGRErr ProcessSQLDropIndex( const char * );
616 OGRErr ProcessSQLDropTable( const char * );
617 OGRErr ProcessSQLAlterTableAddColumn( const char * );
618 OGRErr ProcessSQLAlterTableDropColumn( const char * );
619 OGRErr ProcessSQLAlterTableAlterColumn( const char * );
620 OGRErr ProcessSQLAlterTableRenameColumn( const char * );
621
622 OGRStyleTable *m_poStyleTable;
624
625 private:
626 CPL_DISALLOW_COPY_ASSIGN(GDALDataset)
627 };
628
629 /* ******************************************************************** */
630 /* GDALRasterBlock */
631 /* ******************************************************************** */
632
637 class CPL_DLL GDALRasterBlock
638 {
639 friend class GDALAbstractBandBlockCache;
640
641 GDALDataType eType;
642
643 bool bDirty;
644 volatile int nLockCount;
645
646 int nXOff;
647 int nYOff;
648
649 int nXSize;
650 int nYSize;
651
652 void *pData;
653
654 GDALRasterBand *poBand;
655
656 GDALRasterBlock *poNext;
657 GDALRasterBlock *poPrevious;
658
659 bool bMustDetach;
660
661 void Detach_unlocked( void );
662 void Touch_unlocked( void );
663
664 void RecycleFor( int nXOffIn, int nYOffIn );
665
666 public:
667 GDALRasterBlock( GDALRasterBand *, int, int );
668 GDALRasterBlock( int nXOffIn, int nYOffIn ); /* only for lookup purpose */
669 virtual ~GDALRasterBlock();
670
671 CPLErr Internalize( void );
672 void Touch( void );
673 void MarkDirty( void );
674 void MarkClean( void );
676 int AddLock( void ) { return CPLAtomicInc(&nLockCount); }
678 int DropLock( void ) { return CPLAtomicDec(&nLockCount); }
679 void Detach();
680
681 CPLErr Write();
682
686 GDALDataType GetDataType() const { return eType; }
690 int GetXOff() const { return nXOff; }
694 int GetYOff() const { return nYOff; }
698 int GetXSize() const { return nXSize; }
702 int GetYSize() const { return nYSize; }
706 int GetDirty() const { return bDirty; }
710 void *GetDataRef( void ) { return pData; }
714 int GetBlockSize() const {
715 return nXSize * nYSize * GDALGetDataTypeSizeBytes(eType); }
716
717 int TakeLock();
718 int DropLockForRemovalFromStorage();
719
722 GDALRasterBand *GetBand() { return poBand; }
723
724 static void FlushDirtyBlocks();
725 static int FlushCacheBlock(int bDirtyBlocksOnly = FALSE);
726 static void Verify();
727
728 #ifdef notdef
729 static void CheckNonOrphanedBlocks(GDALRasterBand* poBand);
730 void DumpBlock();
731 static void DumpAll();
732 #endif
733
734 /* Should only be called by GDALDestroyDriverManager() */
736 static void DestroyRBMutex();
738
739 private:
740 CPL_DISALLOW_COPY_ASSIGN(GDALRasterBlock)
741 };
742
743 /* ******************************************************************** */
744 /* GDALColorTable */
745 /* ******************************************************************** */
746
749 class CPL_DLL GDALColorTable
750 {
751 GDALPaletteInterp eInterp;
752
753 std::vector<GDALColorEntry> aoEntries;
754
755 public:
756 explicit GDALColorTable( GDALPaletteInterp = GPI_RGB );
757 ~GDALColorTable();
758
759 GDALColorTable *Clone() const;
760 int IsSame(const GDALColorTable* poOtherCT) const;
761
762 GDALPaletteInterp GetPaletteInterpretation() const;
763
764 int GetColorEntryCount() const;
765 const GDALColorEntry *GetColorEntry( int ) const;
766 int GetColorEntryAsRGB( int, GDALColorEntry * ) const;
767 void SetColorEntry( int, const GDALColorEntry * );
768 int CreateColorRamp( int, const GDALColorEntry * ,
769 int, const GDALColorEntry * );
770 };
771
772 /* ******************************************************************** */
773 /* GDALAbstractBandBlockCache */
774 /* ******************************************************************** */
775
777
779 // CPL_DLL is just technical here. This is really a private concept
780 // only used by GDALRasterBand implementation.
781
782 class CPL_DLL GDALAbstractBandBlockCache
783 {
784 // List of blocks that can be freed or recycled, and its lock
785 CPLLock *hSpinLock;
786 GDALRasterBlock *psListBlocksToFree;
787
788 // Band keep alive counter, and its lock & condition
789 CPLCond *hCond;
790 CPLMutex *hCondMutex;
791 volatile int nKeepAliveCounter;
792
793 protected:
794 GDALRasterBand *poBand;
795
796 void FreeDanglingBlocks();
797 void UnreferenceBlockBase();
798 void WaitKeepAliveCounter();
799
800 public:
801 explicit GDALAbstractBandBlockCache(GDALRasterBand* poBand);
802 virtual ~GDALAbstractBandBlockCache();
803
804 GDALRasterBlock* CreateBlock(int nXBlockOff, int nYBlockOff);
805 void AddBlockToFreeList( GDALRasterBlock * );
806
807 virtual bool Init() = 0;
808 virtual bool IsInitOK() = 0;
809 virtual CPLErr FlushCache() = 0;
810 virtual CPLErr AdoptBlock( GDALRasterBlock* poBlock ) = 0;
811 virtual GDALRasterBlock *TryGetLockedBlockRef( int nXBlockOff,
812 int nYBlockYOff ) = 0;
813 virtual CPLErr UnreferenceBlock( GDALRasterBlock* poBlock ) = 0;
814 virtual CPLErr FlushBlock( int nXBlockOff, int nYBlockOff,
815 int bWriteDirtyBlock ) = 0;
816 };
817
818 GDALAbstractBandBlockCache* GDALArrayBandBlockCacheCreate(GDALRasterBand* poBand);
819 GDALAbstractBandBlockCache* GDALHashSetBandBlockCacheCreate(GDALRasterBand* poBand);
820
822
823 /* ******************************************************************** */
824 /* GDALRasterBand */
825 /* ******************************************************************** */
826
829 class CPL_DLL GDALRasterBand : public GDALMajorObject
830 {
831 private:
832 friend class GDALArrayBandBlockCache;
833 friend class GDALHashSetBandBlockCache;
834 friend class GDALRasterBlock;
835
836 CPLErr eFlushBlockErr;
837 GDALAbstractBandBlockCache* poBandBlockCache;
838
839 void SetFlushBlockErr( CPLErr eErr );
840 CPLErr UnreferenceBlock( GDALRasterBlock* poBlock );
841
842 void Init(int bForceCachedIO);
843
844 protected:
846 GDALDataset *poDS;
847 int nBand; /* 1 based */
848
849 int nRasterXSize;
850 int nRasterYSize;
851
852 GDALDataType eDataType;
853 GDALAccess eAccess;
854
855 /* stuff related to blocking, and raster cache */
856 int nBlockXSize;
857 int nBlockYSize;
858 int nBlocksPerRow;
859 int nBlocksPerColumn;
860
861 int nBlockReads;
862 int bForceCachedIO;
863
864 GDALRasterBand *poMask;
865 bool bOwnMask;
866 int nMaskFlags;
867
868 void InvalidateMaskBand();
869
870 friend class GDALDataset;
871 friend class GDALProxyRasterBand;
872 friend class GDALDefaultOverviews;
873
874 CPLErr RasterIOResampled( GDALRWFlag, int, int, int, int,
875 void *, int, int, GDALDataType,
876 GSpacing, GSpacing, GDALRasterIOExtraArg* psExtraArg ) CPL_WARN_UNUSED_RESULT;
877
878 int EnterReadWrite(GDALRWFlag eRWFlag);
879 void LeaveReadWrite();
880 void InitRWLock();
882
883 protected:
884 virtual CPLErr IReadBlock( int nBlockXOff, int nBlockYOff, void * pData ) = 0;
885 virtual CPLErr IWriteBlock( int nBlockXOff, int nBlockYOff, void * pData );
886
887 #ifdef DETECT_OLD_IRASTERIO
888 virtual signature_changed IRasterIO( GDALRWFlag, int, int, int, int,
889 void *, int, int, GDALDataType,
890 int, int ) {};
891 #endif
892
893 virtual CPLErr IRasterIO( GDALRWFlag, int, int, int, int,
894 void *, int, int, GDALDataType,
895 GSpacing, GSpacing, GDALRasterIOExtraArg* psExtraArg ) CPL_WARN_UNUSED_RESULT;
896
897 virtual int IGetDataCoverageStatus( int nXOff, int nYOff,
898 int nXSize, int nYSize,
899 int nMaskFlagStop,
900 double* pdfDataPct);
902 CPLErr OverviewRasterIO( GDALRWFlag, int, int, int, int,
903 void *, int, int, GDALDataType,
904 GSpacing, GSpacing, GDALRasterIOExtraArg* psExtraArg ) CPL_WARN_UNUSED_RESULT;
905
906 CPLErr TryOverviewRasterIO( GDALRWFlag eRWFlag,
907 int nXOff, int nYOff, int nXSize, int nYSize,
908 void * pData, int nBufXSize, int nBufYSize,
909 GDALDataType eBufType,
910 GSpacing nPixelSpace, GSpacing nLineSpace,
911 GDALRasterIOExtraArg* psExtraArg,
912 int* pbTried );
913
914 int InitBlockInfo();
915
916 void AddBlockToFreeList( GDALRasterBlock * );
918
919 GDALRasterBlock *TryGetLockedBlockRef( int nXBlockOff, int nYBlockYOff );
920
921 public:
922 GDALRasterBand();
923 explicit GDALRasterBand(int bForceCachedIO);
924
925 virtual ~GDALRasterBand();
926
927 int GetXSize();
928 int GetYSize();
929 int GetBand();
930 GDALDataset*GetDataset();
931
932 GDALDataType GetRasterDataType( void );
933 void GetBlockSize( int *, int * );
934 CPLErr GetActualBlockSize ( int, int, int *, int * );
935 GDALAccess GetAccess();
936
937 CPLErr RasterIO( GDALRWFlag, int, int, int, int,
938 void *, int, int, GDALDataType,
939 GSpacing, GSpacing, GDALRasterIOExtraArg* psExtraArg
940 #ifndef DOXYGEN_SKIP
941 OPTIONAL_OUTSIDE_GDAL(NULL)
942 #endif
943 ) CPL_WARN_UNUSED_RESULT;
944 CPLErr ReadBlock( int, int, void * ) CPL_WARN_UNUSED_RESULT;
945
946 CPLErr WriteBlock( int, int, void * ) CPL_WARN_UNUSED_RESULT;
947
948 GDALRasterBlock *GetLockedBlockRef( int nXBlockOff, int nYBlockOff,
949 int bJustInitialize = FALSE ) CPL_WARN_UNUSED_RESULT;
950 CPLErr FlushBlock( int, int, int bWriteDirtyBlock = TRUE );
951
952 unsigned char* GetIndexColorTranslationTo(/* const */ GDALRasterBand* poReferenceBand,
953 unsigned char* pTranslationTable = NULL,
954 int* pApproximateMatching = NULL);
955
956 // New OpengIS CV_SampleDimension stuff.
957
958 virtual CPLErr FlushCache();
959 virtual char **GetCategoryNames();
960 virtual double GetNoDataValue( int *pbSuccess = NULL );
961 virtual double GetMinimum( int *pbSuccess = NULL );
962 virtual double GetMaximum(int *pbSuccess = NULL );
963 virtual double GetOffset( int *pbSuccess = NULL );
964 virtual double GetScale( int *pbSuccess = NULL );
965 virtual const char *GetUnitType();
966 virtual GDALColorInterp GetColorInterpretation();
967 virtual GDALColorTable *GetColorTable();
968 virtual CPLErr Fill(double dfRealValue, double dfImaginaryValue = 0);
969
970 virtual CPLErr SetCategoryNames( char ** papszNames );
971 virtual CPLErr SetNoDataValue( double dfNoData );
972 virtual CPLErr DeleteNoDataValue();
973 virtual CPLErr SetColorTable( GDALColorTable * poCT );
974 virtual CPLErr SetColorInterpretation( GDALColorInterp eColorInterp );
975 virtual CPLErr SetOffset( double dfNewOffset );
976 virtual CPLErr SetScale( double dfNewScale );
977 virtual CPLErr SetUnitType( const char * pszNewValue );
978
979 virtual CPLErr GetStatistics( int bApproxOK, int bForce,
980 double *pdfMin, double *pdfMax,
981 double *pdfMean, double *padfStdDev );
982 virtual CPLErr ComputeStatistics( int bApproxOK,
983 double *pdfMin, double *pdfMax,
984 double *pdfMean, double *pdfStdDev,
985 GDALProgressFunc, void *pProgressData );
986 virtual CPLErr SetStatistics( double dfMin, double dfMax,
987 double dfMean, double dfStdDev );
988 virtual CPLErr ComputeRasterMinMax( int, double* );
989
990 // Only defined when Doxygen enabled
991 #ifdef DOXYGEN_SKIP
992 virtual char **GetMetadata( const char * pszDomain = "" ) CPL_OVERRIDE;
993 virtual CPLErr SetMetadata( char ** papszMetadata,
994 const char * pszDomain ) CPL_OVERRIDE;
995 virtual const char *GetMetadataItem( const char * pszName,
996 const char * pszDomain ) CPL_OVERRIDE;
997 virtual CPLErr SetMetadataItem( const char * pszName,
998 const char * pszValue,
999 const char * pszDomain ) CPL_OVERRIDE;
1000 #endif
1001
1002 virtual int HasArbitraryOverviews();
1003 virtual int GetOverviewCount();
1004 virtual GDALRasterBand *GetOverview(int);
1005 virtual GDALRasterBand *GetRasterSampleOverview( GUIntBig );
1006 virtual CPLErr BuildOverviews( const char * pszResampling,
1007 int nOverviews,
1008 int * panOverviewList,
1009 GDALProgressFunc pfnProgress,
1010 void * pProgressData );
1011
1012 virtual CPLErr AdviseRead( int nXOff, int nYOff, int nXSize, int nYSize,
1013 int nBufXSize, int nBufYSize,
1014 GDALDataType eBufType, char **papszOptions );
1015
1016 virtual CPLErr GetHistogram( double dfMin, double dfMax,
1017 int nBuckets, GUIntBig * panHistogram,
1018 int bIncludeOutOfRange, int bApproxOK,
1019 GDALProgressFunc, void *pProgressData );
1020
1021 virtual CPLErr GetDefaultHistogram( double *pdfMin, double *pdfMax,
1022 int *pnBuckets, GUIntBig ** ppanHistogram,
1023 int bForce,
1024 GDALProgressFunc, void *pProgressData);
1025 virtual CPLErr SetDefaultHistogram( double dfMin, double dfMax,
1026 int nBuckets, GUIntBig *panHistogram );
1027
1028 virtual GDALRasterAttributeTable *GetDefaultRAT();
1029 virtual CPLErr SetDefaultRAT( const GDALRasterAttributeTable * poRAT );
1030
1031 virtual GDALRasterBand *GetMaskBand();
1032 virtual int GetMaskFlags();
1033 virtual CPLErr CreateMaskBand( int nFlagsIn );
1034
1035 virtual CPLVirtualMem *GetVirtualMemAuto( GDALRWFlag eRWFlag,
1036 int *pnPixelSpace,
1037 GIntBig *pnLineSpace,
1038 char **papszOptions ) CPL_WARN_UNUSED_RESULT;
1039
1040 int GetDataCoverageStatus( int nXOff, int nYOff,
1041 int nXSize, int nYSize,
1042 int nMaskFlagStop = 0,
1043 double* pdfDataPct = NULL );
1044
1045 void ReportError(CPLErr eErrClass, CPLErrorNum err_no, const char *fmt, ...) CPL_PRINT_FUNC_FORMAT (4, 5);
1046
1047 private:
1048 CPL_DISALLOW_COPY_ASSIGN(GDALRasterBand)
1049 };
1050
1052 /* ******************************************************************** */
1053 /* GDALAllValidMaskBand */
1054 /* ******************************************************************** */
1055
1056 class CPL_DLL GDALAllValidMaskBand : public GDALRasterBand
1057 {
1058 protected:
1059 virtual CPLErr IReadBlock( int, int, void * ) CPL_OVERRIDE;
1060
1061 public:
1062 explicit GDALAllValidMaskBand( GDALRasterBand * );
1063 virtual ~GDALAllValidMaskBand();
1064
1065 virtual GDALRasterBand *GetMaskBand() CPL_OVERRIDE;
1066 virtual int GetMaskFlags() CPL_OVERRIDE;
1067 };
1068
1069 /* ******************************************************************** */
1070 /* GDALNoDataMaskBand */
1071 /* ******************************************************************** */
1072
1073 class CPL_DLL GDALNoDataMaskBand : public GDALRasterBand
1074 {
1075 double dfNoDataValue;
1076 GDALRasterBand *poParent;
1077
1078 protected:
1079 virtual CPLErr IReadBlock( int, int, void * ) CPL_OVERRIDE;
1080 virtual CPLErr IRasterIO( GDALRWFlag, int, int, int, int,
1081 void *, int, int, GDALDataType,
1082 GSpacing, GSpacing, GDALRasterIOExtraArg* psExtraArg ) CPL_OVERRIDE;
1083
1084 public:
1085 explicit GDALNoDataMaskBand( GDALRasterBand * );
1086 virtual ~GDALNoDataMaskBand();
1087 };
1088
1089 /* ******************************************************************** */
1090 /* GDALNoDataValuesMaskBand */
1091 /* ******************************************************************** */
1092
1093 class CPL_DLL GDALNoDataValuesMaskBand : public GDALRasterBand
1094 {
1095 double *padfNodataValues;
1096
1097 protected:
1098 virtual CPLErr IReadBlock( int, int, void * ) CPL_OVERRIDE;
1099
1100 public:
1101 explicit GDALNoDataValuesMaskBand( GDALDataset * );
1102 virtual ~GDALNoDataValuesMaskBand();
1103 };
1104
1105 /* ******************************************************************** */
1106 /* GDALRescaledAlphaBand */
1107 /* ******************************************************************** */
1108
1109 class GDALRescaledAlphaBand : public GDALRasterBand
1110 {
1111 GDALRasterBand *poParent;
1112 void *pTemp;
1113
1114 protected:
1115 virtual CPLErr IReadBlock( int, int, void * ) CPL_OVERRIDE;
1116 virtual CPLErr IRasterIO( GDALRWFlag, int, int, int, int,
1117 void *, int, int, GDALDataType,
1118 GSpacing, GSpacing, GDALRasterIOExtraArg* psExtraArg ) CPL_OVERRIDE;
1119
1120 public:
1121 explicit GDALRescaledAlphaBand( GDALRasterBand * );
1122 virtual ~GDALRescaledAlphaBand();
1123 };
1125
1126 /* ******************************************************************** */
1127 /* GDALIdentifyEnum */
1128 /* ******************************************************************** */
1129
1135 typedef enum
1136 {
1138 GDAL_IDENTIFY_UNKNOWN = -1,
1140 GDAL_IDENTIFY_FALSE = 0,
1142 GDAL_IDENTIFY_TRUE = 1
1143 } GDALIdentifyEnum;
1144
1145 /* ******************************************************************** */
1146 /* GDALDriver */
1147 /* ******************************************************************** */
1148
1160 class CPL_DLL GDALDriver : public GDALMajorObject
1161 {
1162 public:
1163 GDALDriver();
1164 virtual ~GDALDriver();
1165
1166 virtual CPLErr SetMetadataItem( const char * pszName,
1167 const char * pszValue,
1168 const char * pszDomain = "" ) CPL_OVERRIDE;
1169
1170 /* -------------------------------------------------------------------- */
1171 /* Public C++ methods. */
1172 /* -------------------------------------------------------------------- */
1173 GDALDataset *Create( const char * pszName,
1174 int nXSize, int nYSize, int nBands,
1175 GDALDataType eType, char ** papszOptions ) CPL_WARN_UNUSED_RESULT;
1176
1177 CPLErr Delete( const char * pszName );
1178 CPLErr Rename( const char * pszNewName,
1179 const char * pszOldName );
1180 CPLErr CopyFiles( const char * pszNewName,
1181 const char * pszOldName );
1182
1183 GDALDataset *CreateCopy( const char *, GDALDataset *,
1184 int, char **,
1185 GDALProgressFunc pfnProgress,
1186 void * pProgressData ) CPL_WARN_UNUSED_RESULT;
1187
1188 /* -------------------------------------------------------------------- */
1189 /* The following are semiprivate, not intended to be accessed */
1190 /* by anyone but the formats instantiating and populating the */
1191 /* drivers. */
1192 /* -------------------------------------------------------------------- */
1194 GDALDataset *(*pfnOpen)( GDALOpenInfo * );
1195
1196 GDALDataset *(*pfnCreate)( const char * pszName,
1197 int nXSize, int nYSize, int nBands,
1198 GDALDataType eType,
1199 char ** papszOptions );
1200
1201 CPLErr (*pfnDelete)( const char * pszName );
1202
1203 GDALDataset *(*pfnCreateCopy)( const char *, GDALDataset *,
1204 int, char **,
1205 GDALProgressFunc pfnProgress,
1206 void * pProgressData );
1207
1208 void *pDriverData;
1209
1210 void (*pfnUnloadDriver)(GDALDriver *);
1211
1219 int (*pfnIdentify)( GDALOpenInfo * );
1220
1221 CPLErr (*pfnRename)( const char * pszNewName,
1222 const char * pszOldName );
1223 CPLErr (*pfnCopyFiles)( const char * pszNewName,
1224 const char * pszOldName );
1225
1226 /* For legacy OGR drivers */
1227 GDALDataset *(*pfnOpenWithDriverArg)( GDALDriver*, GDALOpenInfo * );
1228 GDALDataset *(*pfnCreateVectorOnly)( GDALDriver*,
1229 const char * pszName,
1230 char ** papszOptions );
1231 CPLErr (*pfnDeleteDataSource)( GDALDriver*,
1232 const char * pszName );
1234
1235 /* -------------------------------------------------------------------- */
1236 /* Helper methods. */
1237 /* -------------------------------------------------------------------- */
1239 GDALDataset *DefaultCreateCopy( const char *, GDALDataset *,
1240 int, char **,
1241 GDALProgressFunc pfnProgress,
1242 void * pProgressData ) CPL_WARN_UNUSED_RESULT;
1243 static CPLErr DefaultCopyMasks( GDALDataset *poSrcDS,
1244 GDALDataset *poDstDS,
1245 int bStrict );
1247 static CPLErr QuietDelete( const char * pszName );
1248
1250 static CPLErr DefaultRename( const char * pszNewName,
1251 const char * pszOldName );
1252 static CPLErr DefaultCopyFiles( const char * pszNewName,
1253 const char * pszOldName );
1255 private:
1256 CPL_DISALLOW_COPY_ASSIGN(GDALDriver)
1257 };
1258
1259 /* ******************************************************************** */
1260 /* GDALDriverManager */
1261 /* ******************************************************************** */
1262
1270 class CPL_DLL GDALDriverManager : public GDALMajorObject
1271 {
1272 int nDrivers;
1273 GDALDriver **papoDrivers;
1274 std::map<CPLString, GDALDriver*> oMapNameToDrivers;
1275
1276 GDALDriver *GetDriver_unlocked( int iDriver )
1277 { return (iDriver >= 0 && iDriver < nDrivers) ?
1278 papoDrivers[iDriver] : NULL; }
1279
1280 GDALDriver *GetDriverByName_unlocked( const char * pszName )
1281 { return oMapNameToDrivers[CPLString(pszName).toupper()]; }
1282
1283 public:
1284 GDALDriverManager();
1285 ~GDALDriverManager();
1286
1287 int GetDriverCount( void ) const;
1288 GDALDriver *GetDriver( int );
1289 GDALDriver *GetDriverByName( const char * );
1290
1291 int RegisterDriver( GDALDriver * );
1292 void DeregisterDriver( GDALDriver * );
1293
1294 // AutoLoadDrivers is a no-op if compiled with GDAL_NO_AUTOLOAD defined.
1295 static void AutoLoadDrivers();
1296 void AutoSkipDrivers();
1297 };
1298
1299 CPL_C_START
1300 GDALDriverManager CPL_DLL * GetGDALDriverManager( void );
1301 CPL_C_END
1302
1303 /* ******************************************************************** */
1304 /* GDALAsyncReader */
1305 /* ******************************************************************** */
1306
1312 class CPL_DLL GDALAsyncReader
1313 {
1314 protected:
1316 GDALDataset* poDS;
1317 int nXOff;
1318 int nYOff;
1319 int nXSize;
1320 int nYSize;
1321 void * pBuf;
1322 int nBufXSize;
1323 int nBufYSize;
1324 GDALDataType eBufType;
1325 int nBandCount;
1326 int* panBandMap;
1327 int nPixelSpace;
1328 int nLineSpace;
1329 int nBandSpace;
1331
1332 public:
1333 GDALAsyncReader();
1334 virtual ~GDALAsyncReader();
1335
1339 GDALDataset* GetGDALDataset() {return poDS;}
1343 int GetXOffset() const { return nXOff; }
1347 int GetYOffset() const { return nYOff; }
1351 int GetXSize() const { return nXSize; }
1355 int GetYSize() const { return nYSize; }
1359 void * GetBuffer() {return pBuf;}
1363 int GetBufferXSize() const { return nBufXSize; }
1367 int GetBufferYSize() const { return nBufYSize; }
1371 GDALDataType GetBufferType() const { return eBufType; }
1375 int GetBandCount() const { return nBandCount; }
1379 int* GetBandMap() { return panBandMap; }
1383 int GetPixelSpace() const { return nPixelSpace; }
1387 int GetLineSpace() const { return nLineSpace; }
1391 int GetBandSpace() const { return nBandSpace; }
1392
1393 virtual GDALAsyncStatusType
1394 GetNextUpdatedRegion(double dfTimeout,
1395 int* pnBufXOff, int* pnBufYOff,
1396 int* pnBufXSize, int* pnBufYSize) = 0;
1397 virtual int LockBuffer( double dfTimeout = -1.0 );
1398 virtual void UnlockBuffer();
1399 };
1400
1401 /* ==================================================================== */
1402 /* An assortment of overview related stuff. */
1403 /* ==================================================================== */
1404
1406 /* Only exported for drivers as plugin. Signature may change */
1407 CPLErr CPL_DLL
1408 GDALRegenerateOverviewsMultiBand(int nBands, GDALRasterBand** papoSrcBands,
1409 int nOverviews,
1410 GDALRasterBand*** papapoOverviewBands,
1411 const char * pszResampling,
1412 GDALProgressFunc pfnProgress, void * pProgressData );
1413
1414 typedef CPLErr (*GDALResampleFunction)
1415 ( double dfXRatioDstToSrc,
1416 double dfYRatioDstToSrc,
1417 double dfSrcXDelta,
1418 double dfSrcYDelta,
1419 GDALDataType eWrkDataType,
1420 void * pChunk,
1421 GByte * pabyChunkNodataMask,
1422 int nChunkXOff, int nChunkXSize,
1423 int nChunkYOff, int nChunkYSize,
1424 int nDstXOff, int nDstXOff2,
1425 int nDstYOff, int nDstYOff2,
1426 GDALRasterBand * poOverview,
1427 const char * pszResampling,
1428 int bHasNoData, float fNoDataValue,
1429 GDALColorTable* poColorTable,
1430 GDALDataType eSrcDataType,
1431 bool bPropagateNoData );
1432
1433 GDALResampleFunction GDALGetResampleFunction(const char* pszResampling,
1434 int* pnRadius);
1435
1436 #ifdef GDAL_ENABLE_RESAMPLING_MULTIBAND
1437 typedef CPLErr (*GDALResampleFunctionMultiBands)
1438 ( double dfXRatioDstToSrc,
1439 double dfYRatioDstToSrc,
1440 double dfSrcXDelta,
1441 double dfSrcYDelta,
1442 GDALDataType eWrkDataType,
1443 void * pChunk, int nBands,
1444 GByte * pabyChunkNodataMask,
1445 int nChunkXOff, int nChunkXSize,
1446 int nChunkYOff, int nChunkYSize,
1447 int nDstXOff, int nDstXOff2,
1448 int nDstYOff, int nDstYOff2,
1449 GDALRasterBand ** papoDstBands,
1450 const char * pszResampling,
1451 int bHasNoData, float fNoDataValue,
1452 GDALColorTable* poColorTable,
1453 GDALDataType eSrcDataType);
1454
1455 GDALResampleFunctionMultiBands GDALGetResampleFunctionMultiBands(const char* pszResampling,
1456 int* pnRadius);
1457 #endif
1458
1459 GDALDataType GDALGetOvrWorkDataType(const char* pszResampling,
1460 GDALDataType eSrcDataType);
1461
1462 CPL_C_START
1463
1464 CPLErr CPL_DLL
1465 HFAAuxBuildOverviews( const char *pszOvrFilename, GDALDataset *poParentDS,
1466 GDALDataset **ppoDS,
1467 int nBands, int *panBandList,
1468 int nNewOverviews, int *panNewOverviewList,
1469 const char *pszResampling,
1470 GDALProgressFunc pfnProgress,
1471 void *pProgressData );
1472
1473 CPLErr CPL_DLL
1474 GTIFFBuildOverviews( const char * pszFilename,
1475 int nBands, GDALRasterBand **papoBandList,
1476 int nOverviews, int * panOverviewList,
1477 const char * pszResampling,
1478 GDALProgressFunc pfnProgress, void * pProgressData );
1479
1480 CPLErr CPL_DLL
1481 GDALDefaultBuildOverviews( GDALDataset *hSrcDS, const char * pszBasename,
1482 const char * pszResampling,
1483 int nOverviews, int * panOverviewList,
1484 int nBands, int * panBandList,
1485 GDALProgressFunc pfnProgress, void * pProgressData);
1486
1487 int CPL_DLL GDALBandGetBestOverviewLevel(GDALRasterBand* poBand,
1488 int &nXOff, int &nYOff,
1489 int &nXSize, int &nYSize,
1490 int nBufXSize, int nBufYSize) CPL_WARN_DEPRECATED("Use GDALBandGetBestOverviewLevel2 instead");
1491 int CPL_DLL GDALBandGetBestOverviewLevel2(GDALRasterBand* poBand,
1492 int &nXOff, int &nYOff,
1493 int &nXSize, int &nYSize,
1494 int nBufXSize, int nBufYSize,
1495 GDALRasterIOExtraArg* psExtraArg);
1496
1497 int CPL_DLL GDALOvLevelAdjust( int nOvLevel, int nXSize ) CPL_WARN_DEPRECATED("Use GDALOvLevelAdjust2 instead");
1498 int CPL_DLL GDALOvLevelAdjust2( int nOvLevel, int nXSize, int nYSize );
1499 int CPL_DLL GDALComputeOvFactor( int nOvrXSize, int nRasterXSize,
1500 int nOvrYSize, int nRasterYSize );
1501
1502 GDALDataset CPL_DLL *
1503 GDALFindAssociatedAuxFile( const char *pszBasefile, GDALAccess eAccess,
1504 GDALDataset *poDependentDS );
1505
1506 /* ==================================================================== */
1507 /* Misc functions. */
1508 /* ==================================================================== */
1509
1510 CPLErr CPL_DLL GDALParseGMLCoverage( CPLXMLNode *psTree,
1511 int *pnXSize, int *pnYSize,
1512 double *padfGeoTransform,
1513 char **ppszProjection );
1514
1515 /* ==================================================================== */
1516 /* Infrastructure to check that dataset characteristics are valid */
1517 /* ==================================================================== */
1518
1519 int CPL_DLL GDALCheckDatasetDimensions( int nXSize, int nYSize );
1520 int CPL_DLL GDALCheckBandCount( int nBands, int bIsZeroAllowed );
1521
1522 // Test if 2 floating point values match. Useful when comparing values
1523 // stored as a string at some point. See #3573, #4183, #4506
1524 #define ARE_REAL_EQUAL(dfVal1, dfVal2) \
1525 /* Is it FLT_MIN ? Cf #6578 */ \
1526 (((float)dfVal2 == (float)1.17549435e-38) ? ((float)dfVal1 == (float)dfVal2) : \
1527 /* Or DBL_MIN ? */ \
1528 (dfVal2 == 2.2250738585072014e-308) ? (dfVal1 == dfVal2) : \
1529 /* General case */ \
1530 (dfVal1 == dfVal2 || fabs(dfVal1 - dfVal2) < 1e-10 || (dfVal2 != 0 && fabs(1 - dfVal1 / dfVal2) < 1e-10 )))
1531
1532 /* Internal use only */
1533
1534 /* CPL_DLL exported, but only for in-tree drivers that can be built as plugins */
1535 int CPL_DLL GDALReadWorldFile2( const char *pszBaseFilename, const char *pszExtension,
1536 double *padfGeoTransform, char** papszSiblingFiles,
1537 char** ppszWorldFileNameOut);
1538 int GDALReadTabFile2( const char * pszBaseFilename,
1539 double *padfGeoTransform, char **ppszWKT,
1540 int *pnGCPCount, GDAL_GCP **ppasGCPs,
1541 char** papszSiblingFiles, char** ppszTabFileNameOut );
1542
1543 void CPL_DLL GDALCopyRasterIOExtraArg(GDALRasterIOExtraArg* psDestArg,
1544 GDALRasterIOExtraArg* psSrcArg);
1545
1546 CPL_C_END
1547
1548 void GDALNullifyOpenDatasetsList();
1549 CPLMutex** GDALGetphDMMutex();
1550 CPLMutex** GDALGetphDLMutex();
1551 void GDALNullifyProxyPoolSingleton();
1552 GDALDriver* GDALGetAPIPROXYDriver();
1553 void GDALSetResponsiblePIDForCurrentThread(GIntBig responsiblePID);
1554 GIntBig GDALGetResponsiblePIDForCurrentThread();
1555
1556 CPLString GDALFindAssociatedFile( const char *pszBasename, const char *pszExt,
1557 char **papszSiblingFiles, int nFlags );
1558
1559 CPLErr EXIFExtractMetadata(char**& papszMetadata,
1560 void *fpL, int nOffset,
1561 int bSwabflag, int nTIFFHEADER,
1562 int& nExifOffset, int& nInterOffset, int& nGPSOffset);
1563
1564 int GDALValidateOpenOptions( GDALDriverH hDriver,
1565 const char* const* papszOptionOptions);
1566 int GDALValidateOptions( const char* pszOptionList,
1567 const char* const* papszOptionsToValidate,
1568 const char* pszErrorMessageOptionType,
1569 const char* pszErrorMessageContainerName);
1570
1571 GDALRIOResampleAlg GDALRasterIOGetResampleAlg(const char* pszResampling);
1572 const char* GDALRasterIOGetResampleAlg(GDALRIOResampleAlg eResampleAlg);
1573
1574 void GDALRasterIOExtraArgSetResampleAlg(GDALRasterIOExtraArg* psExtraArg,
1575 int nXSize, int nYSize,
1576 int nBufXSize, int nBufYSize);
1577
1578
1579 GDALDataset* GDALCreateOverviewDataset(GDALDataset* poDS, int nOvrLevel,
1580 int bThisLevelOnly);
1581
1582 #define DIV_ROUND_UP(a, b) ( ((a) % (b)) == 0 ? ((a) / (b)) : (((a) / (b)) + 1) )
1583
1584 // Number of data samples that will be used to compute approximate statistics
1585 // (minimum value, maximum value, etc.)
1586 #define GDALSTAT_APPROX_NUMSAMPLES 2500
1587
1588 CPL_C_START
1589 /* Caution: for technical reason this declaration is duplicated in gdal_crs.c */
1590 /* so any signature change should be reflected there too */
1591 void GDALSerializeGCPListToXML( CPLXMLNode* psParentNode,
1592 GDAL_GCP* pasGCPList,
1593 int nGCPCount,
1594 const char* pszGCPProjection );
1595 void GDALDeserializeGCPListFromXML( CPLXMLNode* psGCPList,
1596 GDAL_GCP** ppasGCPList,
1597 int* pnGCPCount,
1598 char** ppszGCPProjection );
1599 CPL_C_END
1600
1601 void GDALSerializeOpenOptionsToXML( CPLXMLNode* psParentNode, char** papszOpenOptions);
1602 char** GDALDeserializeOpenOptionsFromXML( CPLXMLNode* psParentNode );
1603
1604 int GDALCanFileAcceptSidecarFile(const char* pszFilename);
1606
1607 #endif /* ndef GDAL_PRIV_H_INCLUDED */
GDALRasterAttributeTable
The GDALRasterAttributeTable (or RAT) class is used to encapsulate a table used to provide attribute ...
Definition: gdal_rat.h:46
GDALOpenEx
GDALDatasetH GDALOpenEx(const char *pszFilename, unsigned int nOpenFlags, const char *const *papszAllowedDrivers, const char *const *papszOpenOptions, const char *const *papszSiblingFiles) CPL_WARN_UNUSED_RESULT
Open a raster or vector file as a GDALDataset.
Definition: gdaldataset.cpp:2662
GDALDataType
GDALDataType
Definition: gdal.h:57
GDALAsyncReader::GetBufferType
GDALDataType GetBufferType() const
Return buffer data type.
Definition: gdal_priv.h:1371
GDAL_IDENTIFY_UNKNOWN
Identify could not determine if the file is recognized or not by the probed driver.
Definition: gdal_priv.h:1138
CPLXMLNode
Document node structure.
Definition: cpl_minixml.h:66
cpl_vsi.h
Standard C Covers.
cpl_minixml.h
Definitions for CPL mini XML Parser/Serializer.
GDALRasterBlock::GetYOff
int GetYOff() const
Return the y offset of the top-left corner of the block.
Definition: gdal_priv.h:694
GPI_RGB
Definition: gdal.h:205
GDALAsyncReader::GetGDALDataset
GDALDataset * GetGDALDataset()
Return dataset.
Definition: gdal_priv.h:1339
CPL_C_START
#define CPL_C_START
Macro to start a block of C symbols.
Definition: cpl_port.h:352
CPL_OVERRIDE
#define CPL_OVERRIDE
To be used in public headers only.
Definition: cpl_port.h:1055
GDALOpenInfo::papszAllowedDrivers
const char *const * papszAllowedDrivers
Allowed drivers (NULL for all)
Definition: gdal_priv.h:281
GDALAsyncReader::GetBandMap
int * GetBandMap()
Return band map.
Definition: gdal_priv.h:1379
GDALRasterBlock::DropLock
int DropLock(void)
Decrement the lock count.
Definition: gdal_priv.h:678
VSILFILE
FILE VSILFILE
Opaque type for a FILE that implements the VSIVirtualHandle API.
Definition: cpl_vsi.h:154
GDALDataset::GetOpenOptions
char ** GetOpenOptions()
Return open options.
Definition: gdal_priv.h:521
GDALRasterBand::ReportError
void ReportError(CPLErr eErrClass, CPLErrorNum err_no, const char *fmt,...) CPL_PRINT_FUNC_FORMAT(4
Emits an error related to a raster band.
Definition: gdalrasterband.cpp:6501
GDALOpenInfo::pabyHeader
GByte * pabyHeader
Buffer with first bytes of the file.
Definition: gdal_priv.h:278
GDALRasterBlock::GetXOff
int GetXOff() const
Return the x offset of the top-left corner of the block.
Definition: gdal_priv.h:690
GDALOpenInfo::eAccess
GDALAccess eAccess
Access flag.
Definition: gdal_priv.h:263
GDALRIOResampleAlg
GDALRIOResampleAlg
RasterIO() resampling method.
Definition: gdal.h:114
GDALOpenInfo::fpL
VSILFILE * fpL
Pointer to the file.
Definition: gdal_priv.h:273
GDALAsyncReader::GetXSize
int GetXSize() const
Return width.
Definition: gdal_priv.h:1351
GDALRWFlag
GDALRWFlag
Definition: gdal.h:105
GDALDatasetH
void * GDALDatasetH
Opaque type used for the C bindings of the C++ GDALDataset class.
Definition: gdal.h:241
GByte
unsigned char GByte
Unsigned byte type.
Definition: cpl_port.h:207
GDALOpenInfo::pszFilename
char * pszFilename
Filename.
Definition: gdal_priv.h:258
GDALColorEntry
Color tuple.
Definition: gdal.h:998
GDALOpenInfo::nOpenFlags
int nOpenFlags
Open flags.
Definition: gdal_priv.h:265
GDALRasterBlock
A single raster block in the block cache.
Definition: gdal_priv.h:637
GDALMajorObject::GetMetadata
virtual char ** GetMetadata(const char *pszDomain="")
Fetch metadata.
Definition: gdalmajorobject.cpp:249
GDALRasterBand::BuildOverviews
virtual CPLErr BuildOverviews(const char *pszResampling, int nOverviews, int *panOverviewList, GDALProgressFunc pfnProgress, void *pProgressData)
Build raster overview(s)
Definition: gdalrasterband.cpp:2387
GDALRasterBlock::AddLock
int AddLock(void)
Increment the lock count.
Definition: gdal_priv.h:676
CPLString
Convenient string class based on std::string.
Definition: cpl_string.h:338
GDALRasterBand::RasterIO
CPLErr RasterIO(GDALRWFlag, int, int, int, int, void *, int, int, GDALDataType, GSpacing, GSpacing, GDALRasterIOExtraArg *psExtraArg) CPL_WARN_UNUSED_RESULT
Read/write a region of image data for this band.
Definition: gdalrasterband.cpp:282
CPL_PRINT_FUNC_FORMAT
#define CPL_PRINT_FUNC_FORMAT(format_idx, arg_idx)
Tag a function to have printf() formatting.
Definition: cpl_port.h:967
wkbUnknown
unknown type, non-standard
Definition: ogr_core.h:314
GDALAsyncReader::GetLineSpace
int GetLineSpace() const
Return line spacing.
Definition: gdal_priv.h:1387
CPLVirtualMem
struct CPLVirtualMem CPLVirtualMem
Opaque type that represents a virtual memory mapping.
Definition: cpl_virtualmem.h:62
GDALRasterBand::IReadBlock
virtual CPLErr IReadBlock(int nBlockXOff, int nBlockYOff, void *pData)=0
Read a block of data.
GDALDataset::BuildOverviews
CPLErr BuildOverviews(const char *, int, int *, int, int *, GDALProgressFunc, void *)
Build raster overview(s)
Definition: gdaldataset.cpp:1491
cpl_string.h
Various convenience functions for working with strings and string lists.
GDALRasterBand::FlushCache
virtual CPLErr FlushCache()
Flush raster data cache.
Definition: gdalrasterband.cpp:1026
GSpacing
GIntBig GSpacing
Type to express pixel, line or band spacing.
Definition: gdal.h:259
GDALOpenInfo::bIsDirectory
int bIsDirectory
Whether the file is a directory.
Definition: gdal_priv.h:270
GDALMajorObject::GetMetadataItem
virtual const char * GetMetadataItem(const char *pszName, const char *pszDomain="")
Fetch single metadata item.
Definition: gdalmajorobject.cpp:344
GDALRasterBlock::GetYSize
int GetYSize() const
Return the height of the block.
Definition: gdal_priv.h:702
GDALRasterBlock::GetXSize
int GetXSize() const
Return the width of the block.
Definition: gdal_priv.h:698
GDALRasterBand::AdviseRead
virtual CPLErr AdviseRead(int nXOff, int nYOff, int nXSize, int nYSize, int nBufXSize, int nBufYSize, GDALDataType eBufType, char **papszOptions)
Advise driver of upcoming read requests.
Definition: gdalrasterband.cpp:3666
OGRwkbGeometryType
OGRwkbGeometryType
List of well known binary geometry types.
Definition: ogr_core.h:312
GDALRasterBand::GetMetadata
virtual char ** GetMetadata(const char *pszDomain="") CPL_OVERRIDE
Fetch metadata.
gdal.h
Public (C callable) GDAL entry points.
GDALAsyncStatusType
GDALAsyncStatusType
status of the asynchronous stream
Definition: gdal.h:86
OGRGeometry
Abstract base class for all geometry classes.
Definition: ogr_geometry.h:118
GDALMajorObject::SetMetadata
virtual CPLErr SetMetadata(char **papszMetadata, const char *pszDomain="")
Set metadata.
Definition: gdalmajorobject.cpp:292
GDALAsyncReader::GetBuffer
void * GetBuffer()
Return buffer.
Definition: gdal_priv.h:1359
GDALRasterBlock::GetBand
GDALRasterBand * GetBand()
Accessor to source GDALRasterBand object.
Definition: gdal_priv.h:722
GDALOpenInfo
Class for dataset open functions.
Definition: gdal_priv.h:246
GDALAsyncReader::GetYOffset
int GetYOffset() const
Return y offset.
Definition: gdal_priv.h:1347
GDALDataset::MarkSuppressOnClose
void MarkSuppressOnClose()
Set that the dataset must be deleted on close.
Definition: gdal_priv.h:516
CPLStringList
String list class designed around our use of C "char**" string lists.
Definition: cpl_string.h:449
GDALRasterIOExtraArg
Structure to pass extra arguments to RasterIO() method.
Definition: gdal.h:133
GDAL_IDENTIFY_TRUE
Identify determined the file is recognized by the probed driver.
Definition: gdal_priv.h:1142
GDALPaletteInterp
GDALPaletteInterp
Definition: gdal.h:202
ogr_core.h
Core portability services for cross-platform OGR code.
GDALOpenInfo::bStatOK
int bStatOK
Whether stat()'ing the file was successful.
Definition: gdal_priv.h:268
GDALOpenInfo::nHeaderBytes
int nHeaderBytes
Number of bytes in pabyHeader.
Definition: gdal_priv.h:276
GDALDataset::CloseDependentDatasets
virtual int CloseDependentDatasets()
Drop references to any other datasets referenced by this dataset.
Definition: gdaldataset.cpp:3413
GDALRasterBlock::GetDataRef
void * GetDataRef(void)
Return the data buffer.
Definition: gdal_priv.h:710
GDALAsyncReader::GetYSize
int GetYSize() const
Return height.
Definition: gdal_priv.h:1355
GDALDataset::CreateMaskBand
virtual CPLErr CreateMaskBand(int nFlagsIn)
Adds a mask band to the dataset.
Definition: gdaldataset.cpp:2474
GUIntBig
unsigned long long GUIntBig
Large unsigned integer type (generally 64-bit unsigned integer type).
Definition: cpl_port.h:253
CPLErrorNum
int CPLErrorNum
Error number.
Definition: cpl_error.h:94
cpl_conv.h
Various convenience functions for CPL.
OGRSpatialReference
This class represents an OpenGIS Spatial Reference System, and contains methods for converting betwee...
Definition: ogr_spatialref.h:132
GDALAsyncReader::GetBufferXSize
int GetBufferXSize() const
Return buffer width.
Definition: gdal_priv.h:1363
GDALDriverH
void * GDALDriverH
Opaque type used for the C bindings of the C++ GDALDriver class.
Definition: gdal.h:247
GDALClose
void GDALClose(GDALDatasetH)
Close GDAL dataset.
Definition: gdaldataset.cpp:3040
GDALOpenInfo::papszOpenOptions
char ** papszOpenOptions
Open options.
Definition: gdal_priv.h:260
GDALMajorObject
Object with metadata.
Definition: gdal_priv.h:125
GDALAsyncReader::GetBufferYSize
int GetBufferYSize() const
Return buffer height.
Definition: gdal_priv.h:1367
OGRLayer
This class represents a layer of simple features, with access methods.
Definition: ogrsf_frmts.h:68
GDALRasterBlock::GetDirty
int GetDirty() const
Return the dirty flag.
Definition: gdal_priv.h:706
GDALRasterBand
A single raster band (or channel).
Definition: gdal_priv.h:829
GDALAccess
GDALAccess
Definition: gdal.h:99
GDALAsyncReader::GetPixelSpace
int GetPixelSpace() const
Return pixel spacing.
Definition: gdal_priv.h:1383
OGRFeature
A simple feature, including geometry and attributes.
Definition: ogr_feature.h:279
GDALRasterBand::CreateMaskBand
virtual CPLErr CreateMaskBand(int nFlagsIn)
Adds a mask band to the current band.
Definition: gdalrasterband.cpp:6265
GDALAsyncReader::GetBandSpace
int GetBandSpace() const
Return band spacing.
Definition: gdal_priv.h:1391
OGRStyleTable
This class represents a style table.
Definition: ogr_featurestyle.h:83
GDALDataset
A set of associated raster bands, usually from one file.
Definition: gdal_priv.h:322
CPL_C_END
#define CPL_C_END
Macro to end a block of C symbols.
Definition: cpl_port.h:354
GIntBig
long long GIntBig
Large signed integer type (generally 64-bit integer type).
Definition: cpl_port.h:250
GDALAsyncReader::GetXOffset
int GetXOffset() const
Return x offset.
Definition: gdal_priv.h:1343
GDALDriverManager
Class for managing the registration of file format drivers.
Definition: gdal_priv.h:1270
CPL_NULL_TERMINATED
#define CPL_NULL_TERMINATED
Null terminated variadic.
Definition: cpl_port.h:957
CPLString::toupper
CPLString & toupper(void)
Convert to upper case in place.
Definition: cplstring.cpp:312
GDALIdentifyEnum
GDALIdentifyEnum
Enumeration used by GDALDriver::pfnIdentify().
Definition: gdal_priv.h:1135
OGRErr
int OGRErr
Simple container for a bounding region.
Definition: ogr_core.h:285
GDALColorInterp
GDALColorInterp
Definition: gdal.h:176
GDALGetDataTypeSizeBytes
int GDALGetDataTypeSizeBytes(GDALDataType)
Get data type size in bytes.
Definition: gdal_misc.cpp:222
GDALMajorObject::SetMetadataItem
virtual CPLErr SetMetadataItem(const char *pszName, const char *pszValue, const char *pszDomain="")
Set single metadata item.
Definition: gdalmajorobject.cpp:388
GDALRasterBlock::GetDataType
GDALDataType GetDataType() const
Return the data type.
Definition: gdal_priv.h:686
GDAL_IDENTIFY_FALSE
Identify determined the file is not recognized by the probed driver.
Definition: gdal_priv.h:1140
GDALAsyncReader::GetBandCount
int GetBandCount() const
Return band count.
Definition: gdal_priv.h:1375
GDALDriver
Format specific driver.
Definition: gdal_priv.h:1160
GDALRasterBlock::GetBlockSize
int GetBlockSize() const
Return the block size in bytes.
Definition: gdal_priv.h:714
GDALColorTable
A color table / palette.
Definition: gdal_priv.h:749
GDALMajorObject::GetMetadataDomainList
virtual char ** GetMetadataDomainList()
Fetch list of metadata domains.
Definition: gdalmajorobject.cpp:161
GDALDataset::GetAccess
GDALAccess GetAccess() const
Return access mode.
Definition: gdal_priv.h:510
GDAL_GCP
Ground Control Point.
Definition: gdal.h:514
CPLErr
CPLErr
Error category.
Definition: cpl_error.h:52
GetGDALDriverManager
GDALDriverManager * GetGDALDriverManager(void)
Fetch the global GDAL driver manager.
Definition: gdaldrivermanager.cpp:96
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:1085
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:999
GDALAsyncReader
Class used as a session object for asynchronous requests.
Definition: gdal_priv.h:1312

Generated for GDAL by 1.8.8.