GDAL
gdal_priv.h
Go to the documentation of this file.
1 /******************************************************************************
2  * $Id: gdal_priv.h 33808 2016-03-29 21:15:28Z goatbar $
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;
50 class GDALProxyDataset;
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 
72 #define GMO_VALID 0x0001
73 #define GMO_IGNORE_UNIMPLEMENTED 0x0002
74 #define GMO_SUPPORT_MD 0x0004
75 #define GMO_SUPPORT_MDMD 0x0008
76 #define GMO_MD_DIRTY 0x0010
77 #define GMO_PAM_CLASS 0x0020
78 
79 /************************************************************************/
80 /* GDALMultiDomainMetadata */
81 /************************************************************************/
82 
84 {
85 private:
86  char **papszDomainList;
87  CPLStringList **papoMetadataLists;
88 
89 public:
92 
93  int XMLInit( CPLXMLNode *psMetadata, int bMerge );
94  CPLXMLNode *Serialize();
95 
96  char **GetDomainList() { return papszDomainList; }
97 
98  char **GetMetadata( const char * pszDomain = "" );
99  CPLErr SetMetadata( char ** papszMetadata,
100  const char * pszDomain = "" );
101  const char *GetMetadataItem( const char * pszName,
102  const char * pszDomain = "" );
103  CPLErr SetMetadataItem( const char * pszName,
104  const char * pszValue,
105  const char * pszDomain = "" );
106 
107  void Clear();
108 
109  private:
110  CPL_DISALLOW_COPY_ASSIGN(GDALMultiDomainMetadata);
111 };
112 
113 /* ******************************************************************** */
114 /* GDALMajorObject */
115 /* */
116 /* Base class providing metadata, description and other */
117 /* services shared by major objects. */
118 /* ******************************************************************** */
119 
121 
122 class CPL_DLL GDALMajorObject
123 {
124  protected:
125  int nFlags; // GMO_* flags.
126  CPLString sDescription;
128 
129  char **BuildMetadataDomainList(char** papszList, int bCheckNonEmpty, ...) CPL_NULL_TERMINATED;
130 
131  public:
132  GDALMajorObject();
133  virtual ~GDALMajorObject();
134 
135  int GetMOFlags();
136  void SetMOFlags(int nFlagsIn);
137 
138  virtual const char *GetDescription() const;
139  virtual void SetDescription( const char * );
140 
141  virtual char **GetMetadataDomainList();
142 
143  virtual char **GetMetadata( const char * pszDomain = "" );
144  virtual CPLErr SetMetadata( char ** papszMetadata,
145  const char * pszDomain = "" );
146  virtual const char *GetMetadataItem( const char * pszName,
147  const char * pszDomain = "" );
148  virtual CPLErr SetMetadataItem( const char * pszName,
149  const char * pszValue,
150  const char * pszDomain = "" );
151 };
152 
153 /* ******************************************************************** */
154 /* GDALDefaultOverviews */
155 /* ******************************************************************** */
156 class CPL_DLL GDALDefaultOverviews
157 {
158  friend class GDALDataset;
159 
160  GDALDataset *poDS;
161  GDALDataset *poODS;
162 
163  CPLString osOvrFilename;
164 
165  int bOvrIsAux;
166 
167  int bCheckedForMask;
168  int bOwnMaskDS;
169  GDALDataset *poMaskDS;
170 
171  // for "overview datasets" we record base level info so we can
172  // find our way back to get overview masks.
173  GDALDataset *poBaseDS;
174 
175  // Stuff for deferred initialize/overviewscans...
176  bool bCheckedForOverviews;
177  void OverviewScan();
178  char *pszInitName;
179  int bInitNameIsOVR;
180  char **papszInitSiblingFiles;
181 
182  public:
185 
186  void Initialize( GDALDataset *poDSIn, const char *pszName = NULL,
187  char **papszSiblingFiles = NULL,
188  int bNameIsOVR = FALSE );
189 
190  void TransferSiblingFiles(char** papszSiblingFiles);
191 
192  int IsInitialized();
193 
195 
196  // Overview Related
197 
198  int GetOverviewCount(int);
199  GDALRasterBand *GetOverview(int,int);
200 
201  CPLErr BuildOverviews( const char * pszBasename,
202  const char * pszResampling,
203  int nOverviews, int * panOverviewList,
204  int nBands, int * panBandList,
205  GDALProgressFunc pfnProgress,
206  void *pProgressData );
207 
208  CPLErr BuildOverviewsSubDataset( const char * pszPhysicalFile,
209  const char * pszResampling,
210  int nOverviews, int * panOverviewList,
211  int nBands, int * panBandList,
212  GDALProgressFunc pfnProgress,
213  void *pProgressData );
214 
215  CPLErr CleanOverviews();
216 
217  // Mask Related
218 
219  CPLErr CreateMaskBand( int nFlags, int nBand = -1 );
220  GDALRasterBand *GetMaskBand( int nBand );
221  int GetMaskFlags( int nBand );
222 
223  int HaveMaskFile( char **papszSiblings = NULL,
224  const char *pszBasename = NULL );
225 
226  char** GetSiblingFiles() { return papszInitSiblingFiles; }
227 
228  private:
229  CPL_DISALLOW_COPY_ASSIGN(GDALDefaultOverviews);
230 };
231 
232 /* ******************************************************************** */
233 /* GDALOpenInfo */
234 /* */
235 /* Structure of data about dataset for open functions. */
236 /* ******************************************************************** */
237 
238 class CPL_DLL GDALOpenInfo
239 {
240  bool bHasGotSiblingFiles;
241  char **papszSiblingFiles;
242  int nHeaderBytesTried;
243 
244  public:
245  GDALOpenInfo( const char * pszFile, int nOpenFlagsIn,
246  char **papszSiblingFiles = NULL );
247  ~GDALOpenInfo( void );
248 
249  char *pszFilename;
250  char** papszOpenOptions;
251 
252  GDALAccess eAccess;
253  int nOpenFlags;
254 
255  int bStatOK;
256  int bIsDirectory;
257 
258  VSILFILE *fpL;
259 
260  int nHeaderBytes;
261  GByte *pabyHeader;
262 
263  int TryToIngest(int nBytes);
264  char **GetSiblingFiles();
265  char **StealSiblingFiles();
266  bool AreSiblingFilesLoaded() const;
267 
268  private:
269  CPL_DISALLOW_COPY_ASSIGN(GDALOpenInfo);
270 };
271 
272 /* ******************************************************************** */
273 /* GDALDataset */
274 /* ******************************************************************** */
275 
276 class OGRLayer;
277 class OGRGeometry;
278 class OGRSpatialReference;
279 class OGRStyleTable;
280 class swq_select;
282 typedef struct GDALSQLParseInfo GDALSQLParseInfo;
283 
284 #ifdef DETECT_OLD_IRASTERIO
285 typedef void signature_changed;
286 #endif
287 
288 #ifdef GDAL_COMPILATION
289 #define OPTIONAL_OUTSIDE_GDAL(val)
290 #else
291 #define OPTIONAL_OUTSIDE_GDAL(val) = val
292 #endif
293 
295 
296 class CPL_DLL GDALDataset : public GDALMajorObject
297 {
298  friend GDALDatasetH CPL_STDCALL GDALOpenEx( const char* pszFilename,
299  unsigned int nOpenFlags,
300  const char* const* papszAllowedDrivers,
301  const char* const* papszOpenOptions,
302  const char* const* papszSiblingFiles );
303  friend void CPL_STDCALL GDALClose( GDALDatasetH hDS );
304 
305  friend class GDALDriver;
306  friend class GDALDefaultOverviews;
307  friend class GDALProxyDataset;
308  friend class GDALDriverManager;
309 
310  void AddToDatasetOpenList();
311 
312  void Init(int bForceCachedIO);
313 
314  protected:
315  GDALDriver *poDriver;
316  GDALAccess eAccess;
317 
318  // Stored raster information.
319  int nRasterXSize;
320  int nRasterYSize;
321  int nBands;
322  GDALRasterBand **papoBands;
323 
324  int nOpenFlags;
325 
326  int nRefCount;
327  GByte bForceCachedIO;
328  GByte bShared;
329  GByte bIsInternal;
330  GByte bSuppressOnClose;
331 
332  GDALDataset(void);
333  GDALDataset(int bForceCachedIO);
334 
335  void RasterInitialize( int, int );
336  void SetBand( int, GDALRasterBand * );
337 
338  GDALDefaultOverviews oOvManager;
339 
340  virtual CPLErr IBuildOverviews( const char *, int, int *,
341  int, int *, GDALProgressFunc, void * );
342 
343 #ifdef DETECT_OLD_IRASTERIO
344  virtual signature_changed IRasterIO( GDALRWFlag, int, int, int, int,
345  void *, int, int, GDALDataType,
346  int, int *, int, int, int ) {};
347 #endif
348 
349  virtual CPLErr IRasterIO( GDALRWFlag, int, int, int, int,
350  void *, int, int, GDALDataType,
351  int, int *, GSpacing, GSpacing, GSpacing,
352  GDALRasterIOExtraArg* psExtraArg ) CPL_WARN_UNUSED_RESULT;
353 
354  CPLErr BlockBasedRasterIO( GDALRWFlag, int, int, int, int,
355  void *, int, int, GDALDataType,
356  int, int *, GSpacing, GSpacing, GSpacing,
357  GDALRasterIOExtraArg* psExtraArg ) CPL_WARN_UNUSED_RESULT;
358  void BlockBasedFlushCache();
359 
360  CPLErr BandBasedRasterIO( GDALRWFlag eRWFlag,
361  int nXOff, int nYOff, int nXSize, int nYSize,
362  void * pData, int nBufXSize, int nBufYSize,
363  GDALDataType eBufType,
364  int nBandCount, int *panBandMap,
365  GSpacing nPixelSpace, GSpacing nLineSpace,
366  GSpacing nBandSpace,
367  GDALRasterIOExtraArg* psExtraArg ) CPL_WARN_UNUSED_RESULT;
368 
369  CPLErr RasterIOResampled( GDALRWFlag eRWFlag,
370  int nXOff, int nYOff, int nXSize, int nYSize,
371  void * pData, int nBufXSize, int nBufYSize,
372  GDALDataType eBufType,
373  int nBandCount, int *panBandMap,
374  GSpacing nPixelSpace, GSpacing nLineSpace,
375  GSpacing nBandSpace,
376  GDALRasterIOExtraArg* psExtraArg ) CPL_WARN_UNUSED_RESULT;
377 
378  CPLErr ValidateRasterIOOrAdviseReadParameters(
379  const char* pszCallingFunc,
380  int* pbStopProcessingOnCENone,
381  int nXOff, int nYOff, int nXSize, int nYSize,
382  int nBufXSize, int nBufYSize,
383  int nBandCount, int *panBandMap);
384 
385  CPLErr TryOverviewRasterIO( GDALRWFlag eRWFlag,
386  int nXOff, int nYOff, int nXSize, int nYSize,
387  void * pData, int nBufXSize, int nBufYSize,
388  GDALDataType eBufType,
389  int nBandCount, int *panBandMap,
390  GSpacing nPixelSpace, GSpacing nLineSpace,
391  GSpacing nBandSpace,
392  GDALRasterIOExtraArg* psExtraArg,
393  int* pbTried);
394 
395  virtual int CloseDependentDatasets();
396 
397  int ValidateLayerCreationOptions( const char* const* papszLCO );
398 
399  char **papszOpenOptions;
400 
401  friend class GDALRasterBand;
402 
403  // The below methods related to read write mutex are fragile logic, and
404  // should not be used by out-of-tree code if possible.
405  int EnterReadWrite(GDALRWFlag eRWFlag);
406  void LeaveReadWrite();
407 
408  void TemporarilyDropReadWriteLock();
409  void ReacquireReadWriteLock();
410 
411  void DisableReadWriteMutex();
412 
413  int AcquireMutex();
414  void ReleaseMutex();
415 
416  public:
417  virtual ~GDALDataset();
418 
419  int GetRasterXSize( void );
420  int GetRasterYSize( void );
421  int GetRasterCount( void );
422  GDALRasterBand *GetRasterBand( int );
423 
424  virtual void FlushCache(void);
425 
426  virtual const char *GetProjectionRef(void);
427  virtual CPLErr SetProjection( const char * );
428 
429  virtual CPLErr GetGeoTransform( double * );
430  virtual CPLErr SetGeoTransform( double * );
431 
432  virtual CPLErr AddBand( GDALDataType eType,
433  char **papszOptions=NULL );
434 
435  virtual void *GetInternalHandle( const char * );
436  virtual GDALDriver *GetDriver(void);
437  virtual char **GetFileList(void);
438 
439  virtual const char* GetDriverName();
440 
441  virtual int GetGCPCount();
442  virtual const char *GetGCPProjection();
443  virtual const GDAL_GCP *GetGCPs();
444  virtual CPLErr SetGCPs( int nGCPCount, const GDAL_GCP *pasGCPList,
445  const char *pszGCPProjection );
446 
447  virtual CPLErr AdviseRead( int nXOff, int nYOff, int nXSize, int nYSize,
448  int nBufXSize, int nBufYSize,
449  GDALDataType eDT,
450  int nBandCount, int *panBandList,
451  char **papszOptions );
452 
453  virtual CPLErr CreateMaskBand( int nFlagsIn );
454 
455  virtual GDALAsyncReader*
456  BeginAsyncReader(int nXOff, int nYOff, int nXSize, int nYSize,
457  void *pBuf, int nBufXSize, int nBufYSize,
458  GDALDataType eBufType,
459  int nBandCount, int* panBandMap,
460  int nPixelSpace, int nLineSpace, int nBandSpace,
461  char **papszOptions);
462  virtual void EndAsyncReader(GDALAsyncReader *);
463 
464  CPLErr RasterIO( GDALRWFlag, int, int, int, int,
465  void *, int, int, GDALDataType,
466  int, int *, GSpacing, GSpacing, GSpacing,
467  GDALRasterIOExtraArg* psExtraArg
468 #ifndef DOXYGEN_SKIP
469  OPTIONAL_OUTSIDE_GDAL(NULL)
470 #endif
471  ) CPL_WARN_UNUSED_RESULT;
472 
473  int Reference();
474  int Dereference();
475  GDALAccess GetAccess() const { return eAccess; }
476 
477  int GetShared();
478  void MarkAsShared();
479 
480  void MarkSuppressOnClose() { bSuppressOnClose = TRUE; }
481 
482  char **GetOpenOptions() { return papszOpenOptions; }
483 
484  static GDALDataset **GetOpenDatasets( int *pnDatasetCount );
485 
486  CPLErr BuildOverviews( const char *, int, int *,
487  int, int *, GDALProgressFunc, void * );
488 
489  void ReportError(CPLErr eErrClass, CPLErrorNum err_no, const char *fmt, ...) CPL_PRINT_FUNC_FORMAT (4, 5);
490 
491 private:
492  void *m_hPrivateData;
493 
494  OGRLayer* BuildLayerFromSelectInfo(swq_select* psSelectInfo,
495  OGRGeometry *poSpatialFilter,
496  const char *pszDialect,
497  swq_select_parse_options* poSelectParseOptions);
498 
499  public:
500 
501  virtual int GetLayerCount();
502  virtual OGRLayer *GetLayer(int);
503  virtual OGRLayer *GetLayerByName(const char *);
504  virtual OGRErr DeleteLayer(int);
505 
506  virtual int TestCapability( const char * );
507 
508  virtual OGRLayer *CreateLayer( const char *pszName,
509  OGRSpatialReference *poSpatialRef = NULL,
511  char ** papszOptions = NULL );
512  virtual OGRLayer *CopyLayer( OGRLayer *poSrcLayer,
513  const char *pszNewName,
514  char **papszOptions = NULL );
515 
516  virtual OGRStyleTable *GetStyleTable();
517  virtual void SetStyleTableDirectly( OGRStyleTable *poStyleTable );
518 
519  virtual void SetStyleTable(OGRStyleTable *poStyleTable);
520 
521  virtual OGRLayer * ExecuteSQL( const char *pszStatement,
522  OGRGeometry *poSpatialFilter,
523  const char *pszDialect );
524  virtual void ReleaseResultSet( OGRLayer * poResultsSet );
525 
526  int GetRefCount() const;
527  int GetSummaryRefCount() const;
528  OGRErr Release();
529 
530  virtual OGRErr StartTransaction(int bForce=FALSE);
531  virtual OGRErr CommitTransaction();
532  virtual OGRErr RollbackTransaction();
533 
534  static int IsGenericSQLDialect(const char* pszDialect);
535 
536  // Semi-public methods. Only to be used by in-tree drivers.
537  GDALSQLParseInfo* BuildParseInfo(swq_select* psSelectInfo,
538  swq_select_parse_options* poSelectParseOptions);
539  void DestroyParseInfo(GDALSQLParseInfo* psParseInfo );
540  OGRLayer * ExecuteSQL( const char *pszStatement,
541  OGRGeometry *poSpatialFilter,
542  const char *pszDialect,
543  swq_select_parse_options* poSelectParseOptions);
544 
545  protected:
546 
547  virtual OGRLayer *ICreateLayer( const char *pszName,
548  OGRSpatialReference *poSpatialRef = NULL,
550  char ** papszOptions = NULL );
551 
552  OGRErr ProcessSQLCreateIndex( const char * );
553  OGRErr ProcessSQLDropIndex( const char * );
554  OGRErr ProcessSQLDropTable( const char * );
555  OGRErr ProcessSQLAlterTableAddColumn( const char * );
556  OGRErr ProcessSQLAlterTableDropColumn( const char * );
557  OGRErr ProcessSQLAlterTableAlterColumn( const char * );
558  OGRErr ProcessSQLAlterTableRenameColumn( const char * );
559 
560  OGRStyleTable *m_poStyleTable;
561 
562  private:
563  CPL_DISALLOW_COPY_ASSIGN(GDALDataset);
564 };
565 
566 /* ******************************************************************** */
567 /* GDALRasterBlock */
568 /* ******************************************************************** */
569 
571 // And the global block manager that manages a least-recently-used list of
572 // blocks from various datasets/bands
573 
574 class CPL_DLL GDALRasterBlock
575 {
576  friend class GDALAbstractBandBlockCache;
577 
578  GDALDataType eType;
579 
580  int bDirty;
581  volatile int nLockCount;
582 
583  int nXOff;
584  int nYOff;
585 
586  int nXSize;
587  int nYSize;
588 
589  void *pData;
590 
591  GDALRasterBand *poBand;
592 
593  GDALRasterBlock *poNext;
594  GDALRasterBlock *poPrevious;
595 
596  int bMustDetach;
597 
598  void Detach_unlocked( void );
599  void Touch_unlocked( void );
600 
601  void RecycleFor( int nXOffIn, int nYOffIn );
602 
603  public:
604  GDALRasterBlock( GDALRasterBand *, int, int );
605  GDALRasterBlock( int nXOffIn, int nYOffIn ); /* only for lookup purpose */
606  virtual ~GDALRasterBlock();
607 
608  CPLErr Internalize( void );
609  void Touch( void );
610  void MarkDirty( void );
611  void MarkClean( void );
612  int AddLock( void ) { return CPLAtomicInc(&nLockCount); }
613  int DropLock( void ) { return CPLAtomicDec(&nLockCount); }
614  void Detach();
615 
616  CPLErr Write();
617 
618  GDALDataType GetDataType() const { return eType; }
619  int GetXOff() const { return nXOff; }
620  int GetYOff() const { return nYOff; }
621  int GetXSize() const { return nXSize; }
622  int GetYSize() const { return nYSize; }
623  int GetDirty() const { return bDirty; }
624 
625  void *GetDataRef( void ) { return pData; }
626  int GetBlockSize() const {
627  return nXSize * nYSize * GDALGetDataTypeSizeBytes(eType); }
628 
629  int TakeLock();
630  int DropLockForRemovalFromStorage();
631 
634  GDALRasterBand *GetBand() { return poBand; }
635 
636  static void FlushDirtyBlocks();
637  static int FlushCacheBlock(int bDirtyBlocksOnly = FALSE);
638  static void Verify();
639 
640 #ifdef notdef
641  static void CheckNonOrphanedBlocks(GDALRasterBand* poBand);
642  void DumpBlock();
643  static void DumpAll();
644 #endif
645 
646  /* Should only be called by GDALDestroyDriverManager() */
647  static void DestroyRBMutex();
648 
649  private:
650  CPL_DISALLOW_COPY_ASSIGN(GDALRasterBlock);
651 };
652 
653 /* ******************************************************************** */
654 /* GDALColorTable */
655 /* ******************************************************************** */
656 
659 class CPL_DLL GDALColorTable
660 {
661  GDALPaletteInterp eInterp;
662 
663  std::vector<GDALColorEntry> aoEntries;
664 
665 public:
667  ~GDALColorTable();
668 
669  GDALColorTable *Clone() const;
670  int IsSame(const GDALColorTable* poOtherCT) const;
671 
672  GDALPaletteInterp GetPaletteInterpretation() const;
673 
674  int GetColorEntryCount() const;
675  const GDALColorEntry *GetColorEntry( int ) const;
676  int GetColorEntryAsRGB( int, GDALColorEntry * ) const;
677  void SetColorEntry( int, const GDALColorEntry * );
678  int CreateColorRamp( int, const GDALColorEntry * ,
679  int, const GDALColorEntry * );
680 };
681 
682 /* ******************************************************************** */
683 /* GDALAbstractBandBlockCache */
684 /* ******************************************************************** */
685 
687 // CPL_DLL is just technical here. This is really a private concept
688 // only used by GDALRasterBand implementation.
689 
691 {
692  // List of blocks that can be freed or recycled, and its lock
693  CPLLock *hSpinLock;
694  GDALRasterBlock *psListBlocksToFree;
695 
696  // Band keep alive counter, and its lock & condition
697  CPLCond *hCond;
698  CPLMutex *hCondMutex;
699  volatile int nKeepAliveCounter;
700 
701  protected:
702  GDALRasterBand *poBand;
703 
704  void FreeDanglingBlocks();
705  void UnreferenceBlockBase();
706  void WaitKeepAliveCounter();
707 
708  public:
710  virtual ~GDALAbstractBandBlockCache();
711 
712  GDALRasterBlock* CreateBlock(int nXBlockOff, int nYBlockOff);
713  void AddBlockToFreeList( GDALRasterBlock * );
714 
715  virtual bool Init() = 0;
716  virtual bool IsInitOK() = 0;
717  virtual CPLErr FlushCache() = 0;
718  virtual CPLErr AdoptBlock( GDALRasterBlock* poBlock ) = 0;
719  virtual GDALRasterBlock *TryGetLockedBlockRef( int nXBlockOff,
720  int nYBlockYOff ) = 0;
721  virtual CPLErr UnreferenceBlock( GDALRasterBlock* poBlock ) = 0;
722  virtual CPLErr FlushBlock( int nXBlockOff, int nYBlockOff,
723  int bWriteDirtyBlock ) = 0;
724 };
725 
726 GDALAbstractBandBlockCache* GDALArrayBandBlockCacheCreate(GDALRasterBand* poBand);
727 GDALAbstractBandBlockCache* GDALHashSetBandBlockCacheCreate(GDALRasterBand* poBand);
728 
729 /* ******************************************************************** */
730 /* GDALRasterBand */
731 /* ******************************************************************** */
732 
734 
735 class CPL_DLL GDALRasterBand : public GDALMajorObject
736 {
737  private:
738  friend class GDALArrayBandBlockCache;
739  friend class GDALHashSetBandBlockCache;
740  friend class GDALRasterBlock;
741 
742  CPLErr eFlushBlockErr;
743  GDALAbstractBandBlockCache* poBandBlockCache;
744 
745  void SetFlushBlockErr( CPLErr eErr );
746  CPLErr UnreferenceBlock( GDALRasterBlock* poBlock );
747 
748  void Init(int bForceCachedIO);
749 
750  protected:
751  GDALDataset *poDS;
752  int nBand; /* 1 based */
753 
754  int nRasterXSize;
755  int nRasterYSize;
756 
757  GDALDataType eDataType;
758  GDALAccess eAccess;
759 
760  /* stuff related to blocking, and raster cache */
761  int nBlockXSize;
762  int nBlockYSize;
763  int nBlocksPerRow;
764  int nBlocksPerColumn;
765 
766  int nBlockReads;
767  int bForceCachedIO;
768 
769  GDALRasterBand *poMask;
770  bool bOwnMask;
771  int nMaskFlags;
772 
773  void InvalidateMaskBand();
774 
775  friend class GDALDataset;
776  friend class GDALProxyRasterBand;
777  friend class GDALDefaultOverviews;
778 
779  CPLErr RasterIOResampled( GDALRWFlag, int, int, int, int,
780  void *, int, int, GDALDataType,
781  GSpacing, GSpacing, GDALRasterIOExtraArg* psExtraArg ) CPL_WARN_UNUSED_RESULT;
782 
783  int EnterReadWrite(GDALRWFlag eRWFlag);
784  void LeaveReadWrite();
785 
786  protected:
787  virtual CPLErr IReadBlock( int, int, void * ) = 0;
788  virtual CPLErr IWriteBlock( int, int, void * );
789 
790 #ifdef DETECT_OLD_IRASTERIO
791  virtual signature_changed IRasterIO( GDALRWFlag, int, int, int, int,
792  void *, int, int, GDALDataType,
793  int, int ) {};
794 #endif
795 
796  virtual CPLErr IRasterIO( GDALRWFlag, int, int, int, int,
797  void *, int, int, GDALDataType,
798  GSpacing, GSpacing, GDALRasterIOExtraArg* psExtraArg ) CPL_WARN_UNUSED_RESULT;
799  CPLErr OverviewRasterIO( GDALRWFlag, int, int, int, int,
800  void *, int, int, GDALDataType,
801  GSpacing, GSpacing, GDALRasterIOExtraArg* psExtraArg ) CPL_WARN_UNUSED_RESULT;
802 
803  CPLErr TryOverviewRasterIO( GDALRWFlag eRWFlag,
804  int nXOff, int nYOff, int nXSize, int nYSize,
805  void * pData, int nBufXSize, int nBufYSize,
806  GDALDataType eBufType,
807  GSpacing nPixelSpace, GSpacing nLineSpace,
808  GDALRasterIOExtraArg* psExtraArg,
809  int* pbTried );
810 
811  int InitBlockInfo();
812 
813  CPLErr AdoptBlock( GDALRasterBlock * );
814  GDALRasterBlock *TryGetLockedBlockRef( int nXBlockOff, int nYBlockYOff );
815  void AddBlockToFreeList( GDALRasterBlock * );
816 
817  public:
818  GDALRasterBand();
819  GDALRasterBand(int bForceCachedIO);
820 
821  virtual ~GDALRasterBand();
822 
823  int GetXSize();
824  int GetYSize();
825  int GetBand();
826  GDALDataset*GetDataset();
827 
828  GDALDataType GetRasterDataType( void );
829  void GetBlockSize( int *, int * );
830  GDALAccess GetAccess();
831 
832  CPLErr RasterIO( GDALRWFlag, int, int, int, int,
833  void *, int, int, GDALDataType,
835 #ifndef DOXYGEN_SKIP
836  OPTIONAL_OUTSIDE_GDAL(NULL)
837 #endif
838  ) CPL_WARN_UNUSED_RESULT;
839  CPLErr ReadBlock( int, int, void * ) CPL_WARN_UNUSED_RESULT;
840 
841  CPLErr WriteBlock( int, int, void * ) CPL_WARN_UNUSED_RESULT;
842 
843  GDALRasterBlock *GetLockedBlockRef( int nXBlockOff, int nYBlockOff,
844  int bJustInitialize = FALSE ) CPL_WARN_UNUSED_RESULT;
845  CPLErr FlushBlock( int, int, int bWriteDirtyBlock = TRUE );
846 
847  unsigned char* GetIndexColorTranslationTo(/* const */ GDALRasterBand* poReferenceBand,
848  unsigned char* pTranslationTable = NULL,
849  int* pApproximateMatching = NULL);
850 
851  // New OpengIS CV_SampleDimension stuff.
852 
853  virtual CPLErr FlushCache();
854  virtual char **GetCategoryNames();
855  virtual double GetNoDataValue( int *pbSuccess = NULL );
856  virtual double GetMinimum( int *pbSuccess = NULL );
857  virtual double GetMaximum(int *pbSuccess = NULL );
858  virtual double GetOffset( int *pbSuccess = NULL );
859  virtual double GetScale( int *pbSuccess = NULL );
860  virtual const char *GetUnitType();
861  virtual GDALColorInterp GetColorInterpretation();
862  virtual GDALColorTable *GetColorTable();
863  virtual CPLErr Fill(double dfRealValue, double dfImaginaryValue = 0);
864 
865  virtual CPLErr SetCategoryNames( char ** );
866  virtual CPLErr SetNoDataValue( double );
867  virtual CPLErr DeleteNoDataValue();
868  virtual CPLErr SetColorTable( GDALColorTable * );
869  virtual CPLErr SetColorInterpretation( GDALColorInterp );
870  virtual CPLErr SetOffset( double );
871  virtual CPLErr SetScale( double );
872  virtual CPLErr SetUnitType( const char * );
873 
874  virtual CPLErr GetStatistics( int bApproxOK, int bForce,
875  double *pdfMin, double *pdfMax,
876  double *pdfMean, double *padfStdDev );
877  virtual CPLErr ComputeStatistics( int bApproxOK,
878  double *pdfMin, double *pdfMax,
879  double *pdfMean, double *pdfStdDev,
880  GDALProgressFunc, void *pProgressData );
881  virtual CPLErr SetStatistics( double dfMin, double dfMax,
882  double dfMean, double dfStdDev );
883  virtual CPLErr ComputeRasterMinMax( int, double* );
884 
885  virtual int HasArbitraryOverviews();
886  virtual int GetOverviewCount();
887  virtual GDALRasterBand *GetOverview(int);
888  virtual GDALRasterBand *GetRasterSampleOverview( GUIntBig );
889  virtual CPLErr BuildOverviews( const char *, int, int *,
890  GDALProgressFunc, void * );
891 
892  virtual CPLErr AdviseRead( int nXOff, int nYOff, int nXSize, int nYSize,
893  int nBufXSize, int nBufYSize,
894  GDALDataType eDT, char **papszOptions );
895 
896  virtual CPLErr GetHistogram( double dfMin, double dfMax,
897  int nBuckets, GUIntBig * panHistogram,
898  int bIncludeOutOfRange, int bApproxOK,
899  GDALProgressFunc, void *pProgressData );
900 
901  virtual CPLErr GetDefaultHistogram( double *pdfMin, double *pdfMax,
902  int *pnBuckets, GUIntBig ** ppanHistogram,
903  int bForce,
904  GDALProgressFunc, void *pProgressData);
905  virtual CPLErr SetDefaultHistogram( double dfMin, double dfMax,
906  int nBuckets, GUIntBig *panHistogram );
907 
908  virtual GDALRasterAttributeTable *GetDefaultRAT();
909  virtual CPLErr SetDefaultRAT( const GDALRasterAttributeTable * );
910 
911  virtual GDALRasterBand *GetMaskBand();
912  virtual int GetMaskFlags();
913  virtual CPLErr CreateMaskBand( int nFlagsIn );
914 
915  virtual CPLVirtualMem *GetVirtualMemAuto( GDALRWFlag eRWFlag,
916  int *pnPixelSpace,
917  GIntBig *pnLineSpace,
918  char **papszOptions ) CPL_WARN_UNUSED_RESULT;
919 
920  void ReportError(CPLErr eErrClass, CPLErrorNum err_no, const char *fmt, ...) CPL_PRINT_FUNC_FORMAT (4, 5);
921 
922 private:
923  CPL_DISALLOW_COPY_ASSIGN(GDALRasterBand);
924 };
925 
926 /* ******************************************************************** */
927 /* GDALAllValidMaskBand */
928 /* ******************************************************************** */
929 
930 class CPL_DLL GDALAllValidMaskBand : public GDALRasterBand
931 {
932  protected:
933  virtual CPLErr IReadBlock( int, int, void * );
934 
935  public:
937  virtual ~GDALAllValidMaskBand();
938 
939  virtual GDALRasterBand *GetMaskBand();
940  virtual int GetMaskFlags();
941 };
942 
943 /* ******************************************************************** */
944 /* GDALNoDataMaskBand */
945 /* ******************************************************************** */
946 
947 class CPL_DLL GDALNoDataMaskBand : public GDALRasterBand
948 {
949  double dfNoDataValue;
950  GDALRasterBand *poParent;
951 
952  protected:
953  virtual CPLErr IReadBlock( int, int, void * );
954  virtual CPLErr IRasterIO( GDALRWFlag, int, int, int, int,
955  void *, int, int, GDALDataType,
956  GSpacing, GSpacing, GDALRasterIOExtraArg* psExtraArg );
957 
958  public:
960  virtual ~GDALNoDataMaskBand();
961 };
962 
963 /* ******************************************************************** */
964 /* GDALNoDataValuesMaskBand */
965 /* ******************************************************************** */
966 
968 {
969  double *padfNodataValues;
970 
971  protected:
972  virtual CPLErr IReadBlock( int, int, void * );
973 
974  public:
976  virtual ~GDALNoDataValuesMaskBand();
977 };
978 
979 /* ******************************************************************** */
980 /* GDALRescaledAlphaBand */
981 /* ******************************************************************** */
982 
984 {
985  GDALRasterBand *poParent;
986  void *pTemp;
987 
988  protected:
989  virtual CPLErr IReadBlock( int, int, void * );
990  virtual CPLErr IRasterIO( GDALRWFlag, int, int, int, int,
991  void *, int, int, GDALDataType,
992  GSpacing, GSpacing, GDALRasterIOExtraArg* psExtraArg );
993 
994  public:
996  virtual ~GDALRescaledAlphaBand();
997 };
998 
999 /* ******************************************************************** */
1000 /* GDALIdentifyEnum */
1001 /* ******************************************************************** */
1002 
1008 typedef enum
1009 {
1017 
1018 /* ******************************************************************** */
1019 /* GDALDriver */
1020 /* ******************************************************************** */
1021 
1022 
1034 class CPL_DLL GDALDriver : public GDALMajorObject
1035 {
1036  public:
1037  GDALDriver();
1038  ~GDALDriver();
1039 
1040  virtual CPLErr SetMetadataItem( const char * pszName,
1041  const char * pszValue,
1042  const char * pszDomain = "" );
1043 
1044 /* -------------------------------------------------------------------- */
1045 /* Public C++ methods. */
1046 /* -------------------------------------------------------------------- */
1047  GDALDataset *Create( const char * pszName,
1048  int nXSize, int nYSize, int nBands,
1049  GDALDataType eType, char ** papszOptions ) CPL_WARN_UNUSED_RESULT;
1050 
1051  CPLErr Delete( const char * pszName );
1052  CPLErr Rename( const char * pszNewName,
1053  const char * pszOldName );
1054  CPLErr CopyFiles( const char * pszNewName,
1055  const char * pszOldName );
1056 
1057  GDALDataset *CreateCopy( const char *, GDALDataset *,
1058  int, char **,
1059  GDALProgressFunc pfnProgress,
1060  void * pProgressData ) CPL_WARN_UNUSED_RESULT;
1061 
1062 /* -------------------------------------------------------------------- */
1063 /* The following are semiprivate, not intended to be accessed */
1064 /* by anyone but the formats instantiating and populating the */
1065 /* drivers. */
1066 /* -------------------------------------------------------------------- */
1067  GDALDataset *(*pfnOpen)( GDALOpenInfo * );
1068 
1069  GDALDataset *(*pfnCreate)( const char * pszName,
1070  int nXSize, int nYSize, int nBands,
1071  GDALDataType eType,
1072  char ** papszOptions );
1073 
1074  CPLErr (*pfnDelete)( const char * pszName );
1075 
1076  GDALDataset *(*pfnCreateCopy)( const char *, GDALDataset *,
1077  int, char **,
1078  GDALProgressFunc pfnProgress,
1079  void * pProgressData );
1080 
1081  void *pDriverData;
1082 
1083  void (*pfnUnloadDriver)(GDALDriver *);
1084 
1092  int (*pfnIdentify)( GDALOpenInfo * );
1093 
1094  CPLErr (*pfnRename)( const char * pszNewName,
1095  const char * pszOldName );
1096  CPLErr (*pfnCopyFiles)( const char * pszNewName,
1097  const char * pszOldName );
1098 
1099  /* For legacy OGR drivers */
1100  GDALDataset *(*pfnOpenWithDriverArg)( GDALDriver*, GDALOpenInfo * );
1101  GDALDataset *(*pfnCreateVectorOnly)( GDALDriver*,
1102  const char * pszName,
1103  char ** papszOptions );
1104  CPLErr (*pfnDeleteDataSource)( GDALDriver*,
1105  const char * pszName );
1106 
1107 /* -------------------------------------------------------------------- */
1108 /* Helper methods. */
1109 /* -------------------------------------------------------------------- */
1110  GDALDataset *DefaultCreateCopy( const char *, GDALDataset *,
1111  int, char **,
1112  GDALProgressFunc pfnProgress,
1113  void * pProgressData ) CPL_WARN_UNUSED_RESULT;
1114  static CPLErr DefaultCopyMasks( GDALDataset *poSrcDS,
1115  GDALDataset *poDstDS,
1116  int bStrict );
1117  static CPLErr QuietDelete( const char * pszName );
1118 
1119  CPLErr DefaultRename( const char * pszNewName,
1120  const char * pszOldName );
1121  CPLErr DefaultCopyFiles( const char * pszNewName,
1122  const char * pszOldName );
1123 private:
1124  CPL_DISALLOW_COPY_ASSIGN(GDALDriver);
1125 };
1126 
1127 /* ******************************************************************** */
1128 /* GDALDriverManager */
1129 /* ******************************************************************** */
1130 
1138 class CPL_DLL GDALDriverManager : public GDALMajorObject
1139 {
1140  int nDrivers;
1141  GDALDriver **papoDrivers;
1142  std::map<CPLString, GDALDriver*> oMapNameToDrivers;
1143 
1144  GDALDriver *GetDriver_unlocked( int iDriver )
1145  { return (iDriver >= 0 && iDriver < nDrivers) ? papoDrivers[iDriver] : NULL; }
1146 
1147  GDALDriver *GetDriverByName_unlocked( const char * pszName )
1148  { return oMapNameToDrivers[CPLString(pszName).toupper()]; }
1149 
1150  public:
1152  ~GDALDriverManager();
1153 
1154  int GetDriverCount( void );
1155  GDALDriver *GetDriver( int );
1156  GDALDriver *GetDriverByName( const char * );
1157 
1158  int RegisterDriver( GDALDriver * );
1159  void DeregisterDriver( GDALDriver * );
1160 
1161  // AutoLoadDrivers is a no-op if compiled with GDAL_NO_AUTOLOAD defined.
1162  void AutoLoadDrivers();
1163  void AutoSkipDrivers();
1164 };
1165 
1166 CPL_C_START
1167 GDALDriverManager CPL_DLL * GetGDALDriverManager( void );
1168 CPL_C_END
1169 
1170 /* ******************************************************************** */
1171 /* GDALAsyncReader */
1172 /* ******************************************************************** */
1173 
1179 class CPL_DLL GDALAsyncReader
1180 {
1181  protected:
1182  GDALDataset* poDS;
1183  int nXOff;
1184  int nYOff;
1185  int nXSize;
1186  int nYSize;
1187  void * pBuf;
1188  int nBufXSize;
1189  int nBufYSize;
1190  GDALDataType eBufType;
1191  int nBandCount;
1192  int* panBandMap;
1193  int nPixelSpace;
1194  int nLineSpace;
1195  int nBandSpace;
1196 
1197  public:
1198  GDALAsyncReader();
1199  virtual ~GDALAsyncReader();
1200 
1201  GDALDataset* GetGDALDataset() {return poDS;}
1202  int GetXOffset() const { return nXOff; }
1203  int GetYOffset() const { return nYOff; }
1204  int GetXSize() const { return nXSize; }
1205  int GetYSize() const { return nYSize; }
1206  void * GetBuffer() {return pBuf;}
1207  int GetBufferXSize() const { return nBufXSize; }
1208  int GetBufferYSize() const { return nBufYSize; }
1209  GDALDataType GetBufferType() const { return eBufType; }
1210  int GetBandCount() const { return nBandCount; }
1211  int* GetBandMap() { return panBandMap; }
1212  int GetPixelSpace() const { return nPixelSpace; }
1213  int GetLineSpace() const { return nLineSpace; }
1214  int GetBandSpace() const { return nBandSpace; }
1215 
1216  virtual GDALAsyncStatusType
1217  GetNextUpdatedRegion(double dfTimeout,
1218  int* pnBufXOff, int* pnBufYOff,
1219  int* pnBufXSize, int* pnBufYSize) = 0;
1220  virtual int LockBuffer( double dfTimeout = -1.0 );
1221  virtual void UnlockBuffer();
1222 };
1223 
1224 /* ==================================================================== */
1225 /* An assortment of overview related stuff. */
1226 /* ==================================================================== */
1227 
1228 /* Only exported for drivers as plugin. Signature may change */
1229 CPLErr CPL_DLL
1230 GDALRegenerateOverviewsMultiBand(int nBands, GDALRasterBand** papoSrcBands,
1231  int nOverviews,
1232  GDALRasterBand*** papapoOverviewBands,
1233  const char * pszResampling,
1234  GDALProgressFunc pfnProgress, void * pProgressData );
1235 
1236 typedef CPLErr (*GDALResampleFunction)
1237  ( double dfXRatioDstToSrc,
1238  double dfYRatioDstToSrc,
1239  double dfSrcXDelta,
1240  double dfSrcYDelta,
1241  GDALDataType eWrkDataType,
1242  void * pChunk,
1243  GByte * pabyChunkNodataMask,
1244  int nChunkXOff, int nChunkXSize,
1245  int nChunkYOff, int nChunkYSize,
1246  int nDstXOff, int nDstXOff2,
1247  int nDstYOff, int nDstYOff2,
1248  GDALRasterBand * poOverview,
1249  const char * pszResampling,
1250  int bHasNoData, float fNoDataValue,
1251  GDALColorTable* poColorTable,
1252  GDALDataType eSrcDataType);
1253 
1254 GDALResampleFunction GDALGetResampleFunction(const char* pszResampling,
1255  int* pnRadius);
1256 
1257 #ifdef GDAL_ENABLE_RESAMPLING_MULTIBAND
1258 typedef CPLErr (*GDALResampleFunctionMultiBands)
1259  ( double dfXRatioDstToSrc,
1260  double dfYRatioDstToSrc,
1261  double dfSrcXDelta,
1262  double dfSrcYDelta,
1263  GDALDataType eWrkDataType,
1264  void * pChunk, int nBands,
1265  GByte * pabyChunkNodataMask,
1266  int nChunkXOff, int nChunkXSize,
1267  int nChunkYOff, int nChunkYSize,
1268  int nDstXOff, int nDstXOff2,
1269  int nDstYOff, int nDstYOff2,
1270  GDALRasterBand ** papoDstBands,
1271  const char * pszResampling,
1272  int bHasNoData, float fNoDataValue,
1273  GDALColorTable* poColorTable,
1274  GDALDataType eSrcDataType);
1275 
1276 GDALResampleFunctionMultiBands GDALGetResampleFunctionMultiBands(const char* pszResampling,
1277  int* pnRadius);
1278 #endif
1279 
1280 GDALDataType GDALGetOvrWorkDataType(const char* pszResampling,
1281  GDALDataType eSrcDataType);
1282 
1283 CPL_C_START
1284 
1285 CPLErr CPL_DLL
1286 HFAAuxBuildOverviews( const char *pszOvrFilename, GDALDataset *poParentDS,
1287  GDALDataset **ppoDS,
1288  int nBands, int *panBandList,
1289  int nNewOverviews, int *panNewOverviewList,
1290  const char *pszResampling,
1291  GDALProgressFunc pfnProgress,
1292  void *pProgressData );
1293 
1294 CPLErr CPL_DLL
1295 GTIFFBuildOverviews( const char * pszFilename,
1296  int nBands, GDALRasterBand **papoBandList,
1297  int nOverviews, int * panOverviewList,
1298  const char * pszResampling,
1299  GDALProgressFunc pfnProgress, void * pProgressData );
1300 
1301 CPLErr CPL_DLL
1302 GDALDefaultBuildOverviews( GDALDataset *hSrcDS, const char * pszBasename,
1303  const char * pszResampling,
1304  int nOverviews, int * panOverviewList,
1305  int nBands, int * panBandList,
1306  GDALProgressFunc pfnProgress, void * pProgressData);
1307 
1308 int CPL_DLL GDALBandGetBestOverviewLevel(GDALRasterBand* poBand,
1309  int &nXOff, int &nYOff,
1310  int &nXSize, int &nYSize,
1311  int nBufXSize, int nBufYSize) CPL_WARN_DEPRECATED("Use GDALBandGetBestOverviewLevel2 instead");
1312 int CPL_DLL GDALBandGetBestOverviewLevel2(GDALRasterBand* poBand,
1313  int &nXOff, int &nYOff,
1314  int &nXSize, int &nYSize,
1315  int nBufXSize, int nBufYSize,
1316  GDALRasterIOExtraArg* psExtraArg);
1317 
1318 int CPL_DLL GDALOvLevelAdjust( int nOvLevel, int nXSize ) CPL_WARN_DEPRECATED("Use GDALOvLevelAdjust2 instead");
1319 int CPL_DLL GDALOvLevelAdjust2( int nOvLevel, int nXSize, int nYSize );
1320 int CPL_DLL GDALComputeOvFactor( int nOvrXSize, int nRasterXSize,
1321  int nOvrYSize, int nRasterYSize );
1322 
1323 GDALDataset CPL_DLL *
1324 GDALFindAssociatedAuxFile( const char *pszBasefile, GDALAccess eAccess,
1325  GDALDataset *poDependentDS );
1326 
1327 /* ==================================================================== */
1328 /* Misc functions. */
1329 /* ==================================================================== */
1330 
1331 CPLErr CPL_DLL GDALParseGMLCoverage( CPLXMLNode *psTree,
1332  int *pnXSize, int *pnYSize,
1333  double *padfGeoTransform,
1334  char **ppszProjection );
1335 
1336 /* ==================================================================== */
1337 /* Infrastructure to check that dataset characteristics are valid */
1338 /* ==================================================================== */
1339 
1340 int CPL_DLL GDALCheckDatasetDimensions( int nXSize, int nYSize );
1341 int CPL_DLL GDALCheckBandCount( int nBands, int bIsZeroAllowed );
1342 
1343 
1344 // Test if 2 floating point values match. Useful when comparing values
1345 // stored as a string at some point. See #3573, #4183, #4506
1346 #define ARE_REAL_EQUAL(dfVal1, dfVal2) \
1347  (dfVal1 == dfVal2 || fabs(dfVal1 - dfVal2) < 1e-10 || (dfVal2 != 0 && fabs(1 - dfVal1 / dfVal2) < 1e-10 ))
1348 
1349 /* Internal use only */
1350 
1351 /* CPL_DLL exported, but only for in-tree drivers that can be built as plugins */
1352 int CPL_DLL GDALReadWorldFile2( const char *pszBaseFilename, const char *pszExtension,
1353  double *padfGeoTransform, char** papszSiblingFiles,
1354  char** ppszWorldFileNameOut);
1355 int GDALReadTabFile2( const char * pszBaseFilename,
1356  double *padfGeoTransform, char **ppszWKT,
1357  int *pnGCPCount, GDAL_GCP **ppasGCPs,
1358  char** papszSiblingFiles, char** ppszTabFileNameOut );
1359 
1360 void CPL_DLL GDALCopyRasterIOExtraArg(GDALRasterIOExtraArg* psDestArg,
1361  GDALRasterIOExtraArg* psSrcArg);
1362 
1363 CPL_C_END
1364 
1365 void GDALNullifyOpenDatasetsList();
1366 CPLMutex** GDALGetphDMMutex();
1367 CPLMutex** GDALGetphDLMutex();
1368 void GDALNullifyProxyPoolSingleton();
1369 GDALDriver* GDALGetAPIPROXYDriver();
1370 void GDALSetResponsiblePIDForCurrentThread(GIntBig responsiblePID);
1371 GIntBig GDALGetResponsiblePIDForCurrentThread();
1372 
1373 CPLString GDALFindAssociatedFile( const char *pszBasename, const char *pszExt,
1374  char **papszSiblingFiles, int nFlags );
1375 
1376 CPLErr EXIFExtractMetadata(char**& papszMetadata,
1377  void *fpL, int nOffset,
1378  int bSwabflag, int nTIFFHEADER,
1379  int& nExifOffset, int& nInterOffset, int& nGPSOffset);
1380 
1381 int GDALValidateOpenOptions( GDALDriverH hDriver,
1382  const char* const* papszOptionOptions);
1383 int GDALValidateOptions( const char* pszOptionList,
1384  const char* const* papszOptionsToValidate,
1385  const char* pszErrorMessageOptionType,
1386  const char* pszErrorMessageContainerName);
1387 
1388 GDALRIOResampleAlg GDALRasterIOGetResampleAlg(const char* pszResampling);
1389 const char* GDALRasterIOGetResampleAlg(GDALRIOResampleAlg eResampleAlg);
1390 
1391 void GDALRasterIOExtraArgSetResampleAlg(GDALRasterIOExtraArg* psExtraArg,
1392  int nXSize, int nYSize,
1393  int nBufXSize, int nBufYSize);
1394 
1395 /* CPL_DLL exported, but only for gdalwarp */
1396 GDALDataset CPL_DLL* GDALCreateOverviewDataset(GDALDataset* poDS, int nOvrLevel,
1397  int bThisLevelOnly, int bOwnDS);
1398 
1399 #define DIV_ROUND_UP(a, b) ( ((a) % (b)) == 0 ? ((a) / (b)) : (((a) / (b)) + 1) )
1400 
1401 // Number of data samples that will be used to compute approximate statistics
1402 // (minimum value, maximum value, etc.)
1403 #define GDALSTAT_APPROX_NUMSAMPLES 2500
1404 
1405 CPL_C_START
1406 /* Caution: for technical reason this declaration is duplicated in gdal_crs.c */
1407 /* so any signature change should be reflected there too */
1408 void GDALSerializeGCPListToXML( CPLXMLNode* psParentNode,
1409  GDAL_GCP* pasGCPList,
1410  int nGCPCount,
1411  const char* pszGCPProjection );
1412 void GDALDeserializeGCPListFromXML( CPLXMLNode* psGCPList,
1413  GDAL_GCP** ppasGCPList,
1414  int* pnGCPCount,
1415  char** ppszGCPProjection );
1416 CPL_C_END
1417 
1418 void GDALSerializeOpenOptionsToXML( CPLXMLNode* psParentNode, char** papszOpenOptions);
1419 char** GDALDeserializeOpenOptionsFromXML( CPLXMLNode* psParentNode );
1420 
1421 int GDALCanFileAcceptSidecarFile(const char* pszFilename);
1422 
1423 #endif /* ndef GDAL_PRIV_H_INCLUDED */
The GDALRasterAttributeTable (or RAT) class is used to encapsulate a table used to provide attribute ...
Definition: gdal_rat.h:46
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:2618
virtual CPLErr AdviseRead(int nXOff, int nYOff, int nXSize, int nYSize, int nBufXSize, int nBufYSize, GDALDataType eDT, char **papszOptions)
Advise driver of upcoming read requests.
Definition: gdalrasterband.cpp:3390
GDALDataType
Definition: gdal.h:57
Definition: gdal_priv.h:967
Definition: swq.h:328
Identify could not determine if the file is recognized or not by the probed driver.
Definition: gdal_priv.h:1011
Document node structure.
Definition: cpl_minixml.h:65
Standard C Covers.
virtual GDALRasterBand * GetMaskBand()
Return the mask band associated with the band.
Definition: gdalrasterband.cpp:4618
Definitions for CPL mini XML Parser/Serializer.
Definition: gdal.h:202
int GDALCheckBandCount(int nBands, int bIsZeroAllowed)
Return TRUE if the band count is valid.
Definition: gdal_misc.cpp:3178
Definition: gdal_proxy.h:104
int GDALCheckDatasetDimensions(int nXSize, int nYSize)
Return TRUE if the dataset dimensions are valid.
Definition: gdal_misc.cpp:3154
This manages how a raster band store its cached block.
Definition: gdal_priv.h:690
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:5144
GDALRIOResampleAlg
RasterIO() resampling method.
Definition: gdal.h:113
GDALRWFlag
Definition: gdal.h:104
CPLErr GDALRegenerateOverviewsMultiBand(int nBands, GDALRasterBand **papoSrcBands, int nOverviews, GDALRasterBand ***papapoOverviewBands, const char *pszResampling, GDALProgressFunc pfnProgress, void *pProgressData)
Variant of GDALRegenerateOverviews, specially dedicated for generating compressed pixel-interleaved o...
Definition: overview.cpp:2689
void * GDALDatasetH
Opaque type used for the C bindings of the C++ GDALDataset class.
Definition: gdal.h:230
Definition: gdal_priv.h:947
Color tuple.
Definition: gdal.h:925
A single raster block in the block cache.
Definition: gdal_priv.h:574
virtual int GetMaskFlags()
Return the status flags of the mask band associated with the band.
Definition: gdalrasterband.cpp:4852
Convenient string class based on std::string.
Definition: cpl_string.h:283
virtual CPLErr BuildOverviews(const char *, int, int *, GDALProgressFunc, void *)
Build raster overview(s)
Definition: gdalrasterband.cpp:2180
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:181
unknown type, non-standard
Definition: ogr_core.h:335
struct CPLVirtualMem CPLVirtualMem
Opaque type that represents a virtual memory mapping.
Definition: cpl_virtualmem.h:60
CPLErr BuildOverviews(const char *, int, int *, int, int *, GDALProgressFunc, void *)
Build raster overview(s)
Definition: gdaldataset.cpp:1415
Various convenience functions for working with strings and string lists.
Definition: gdal_priv.h:156
virtual CPLErr FlushCache()
Flush raster data cache.
Definition: gdalrasterband.cpp:849
GIntBig GSpacing
Type to express pixel, line or band spacing.
Definition: gdal.h:248
OGRwkbGeometryType
List of well known binary geometry types.
Definition: ogr_core.h:333
Public (C callable) GDAL entry points.
GDALAsyncStatusType
status of the asynchronous stream
Definition: gdal.h:85
Definition: gdal_proxy.h:44
Abstract base class for all geometry classes.
Definition: ogr_geometry.h:104
GDALRasterBand * GetBand()
Accessor to source GDALRasterBand object.
Definition: gdal_priv.h:634
Definition: gdal_priv.h:238
Definition: gdal_priv.h:930
CPLString GDALFindAssociatedFile(const char *pszBasename, const char *pszExt, char **papszSiblingFiles, int nFlags)
Find file with alternate extension.
Definition: gdal_misc.cpp:967
String list class designed around our use of C "char**" string lists.
Definition: cpl_string.h:362
Definition: swq.h:310
Structure to pass extra arguments to RasterIO() method.
Definition: gdal.h:132
Identify determined the file is recognized by the probed driver.
Definition: gdal_priv.h:1015
GDALPaletteInterp
Definition: gdal.h:199
Core portability services for cross-platform OGR code.
virtual int CloseDependentDatasets()
Drop references to any other datasets referenced by this dataset.
Definition: gdaldataset.cpp:3280
virtual CPLErr CreateMaskBand(int nFlagsIn)
Adds a mask band to the dataset.
Definition: gdaldataset.cpp:2431
Various convenience functions for CPL.
This class represents an OpenGIS Spatial Reference System, and contains methods for converting betwee...
Definition: ogr_spatialref.h:129
void * GDALDriverH
Opaque type used for the C bindings of the C++ GDALDriver class.
Definition: gdal.h:236
void GDALClose(GDALDatasetH)
Close GDAL dataset.
Definition: gdaldataset.cpp:2973
Object with metadata.
Definition: gdal_priv.h:122
This class represents a layer of simple features, with access methods.
Definition: ogrsf_frmts.h:66
A single raster band (or channel).
Definition: gdal_priv.h:735
GDALAccess
Definition: gdal.h:98
Definition: gdal_priv.h:83
virtual CPLErr CreateMaskBand(int nFlagsIn)
Adds a mask band to the current band.
Definition: gdalrasterband.cpp:4925
This class represents a style table.
Definition: ogr_featurestyle.h:82
A set of associated raster bands, usually from one file.
Definition: gdal_priv.h:296
GDALAccess GetAccess()
Find out if we have update permission for this band.
Definition: gdalrasterband.cpp:1289
Class for managing the registration of file format drivers.
Definition: gdal_priv.h:1138
Definition: gdal_priv.h:983
CPLString & toupper(void)
Convert to upper case in place.
Definition: cplstring.cpp:298
GDALIdentifyEnum
Enumeration used by GDALDriver::pfnIdentify().
Definition: gdal_priv.h:1008
GDALColorInterp
Definition: gdal.h:173
int GDALGetDataTypeSizeBytes(GDALDataType)
Get data type size in bytes.
Definition: gdal_misc.cpp:204
virtual CPLErr SetMetadataItem(const char *pszName, const char *pszValue, const char *pszDomain="")
Set single metadata item.
Definition: gdalmajorobject.cpp:374
Identify determined the file is not recognized by the probed driver.
Definition: gdal_priv.h:1013
Format specific driver.
Definition: gdal_priv.h:1034
Definition: gdal_priv.h:659
Ground Control Point.
Definition: gdal.h:492
GDALDriverManager * GetGDALDriverManager(void)
Fetch the global GDAL driver manager.
Definition: gdaldrivermanager.cpp:75
Class used as a session object for asynchronous requests.
Definition: gdal_priv.h:1179

Generated for GDAL by doxygen 1.8.6.