GDAL
gdal_priv.h
1 /******************************************************************************
2  * $Id: gdal_priv.h 27874 2014-10-17 18:36:22Z 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 
35 /* -------------------------------------------------------------------- */
36 /* Predeclare various classes before pulling in gdal.h, the */
37 /* public declarations. */
38 /* -------------------------------------------------------------------- */
39 class GDALMajorObject;
40 class GDALDataset;
41 class GDALRasterBand;
42 class GDALDriver;
44 class GDALProxyDataset;
46 class GDALAsyncReader;
47 
48 /* -------------------------------------------------------------------- */
49 /* Pull in the public declarations. This gets the C apis, and */
50 /* also various constants. However, we will still get to */
51 /* provide the real class definitions for the GDAL classes. */
52 /* -------------------------------------------------------------------- */
53 
54 #include "gdal.h"
55 #include "gdal_frmts.h"
56 #include "cpl_vsi.h"
57 #include "cpl_conv.h"
58 #include "cpl_string.h"
59 #include "cpl_minixml.h"
60 #include <vector>
61 
62 #define GMO_VALID 0x0001
63 #define GMO_IGNORE_UNIMPLEMENTED 0x0002
64 #define GMO_SUPPORT_MD 0x0004
65 #define GMO_SUPPORT_MDMD 0x0008
66 #define GMO_MD_DIRTY 0x0010
67 #define GMO_PAM_CLASS 0x0020
68 
69 /************************************************************************/
70 /* GDALMultiDomainMetadata */
71 /************************************************************************/
72 
74 {
75 private:
76  char **papszDomainList;
77  CPLStringList **papoMetadataLists;
78 
79 public:
82 
83  int XMLInit( CPLXMLNode *psMetadata, int bMerge );
84  CPLXMLNode *Serialize();
85 
86  char **GetDomainList() { return papszDomainList; }
87 
88  char **GetMetadata( const char * pszDomain = "" );
89  CPLErr SetMetadata( char ** papszMetadata,
90  const char * pszDomain = "" );
91  const char *GetMetadataItem( const char * pszName,
92  const char * pszDomain = "" );
93  CPLErr SetMetadataItem( const char * pszName,
94  const char * pszValue,
95  const char * pszDomain = "" );
96 
97  void Clear();
98 };
99 
100 /* ******************************************************************** */
101 /* GDALMajorObject */
102 /* */
103 /* Base class providing metadata, description and other */
104 /* services shared by major objects. */
105 /* ******************************************************************** */
106 
108 
109 class CPL_DLL GDALMajorObject
110 {
111  protected:
112  int nFlags; // GMO_* flags.
113  CPLString sDescription;
115 
116  char **BuildMetadataDomainList(char** papszList, int bCheckNonEmpty, ...) CPL_NULL_TERMINATED;
117 
118  public:
119  GDALMajorObject();
120  virtual ~GDALMajorObject();
121 
122  int GetMOFlags();
123  void SetMOFlags(int nFlags);
124 
125  virtual const char *GetDescription() const;
126  virtual void SetDescription( const char * );
127 
128  virtual char **GetMetadataDomainList();
129 
130  virtual char **GetMetadata( const char * pszDomain = "" );
131  virtual CPLErr SetMetadata( char ** papszMetadata,
132  const char * pszDomain = "" );
133  virtual const char *GetMetadataItem( const char * pszName,
134  const char * pszDomain = "" );
135  virtual CPLErr SetMetadataItem( const char * pszName,
136  const char * pszValue,
137  const char * pszDomain = "" );
138 };
139 
140 /* ******************************************************************** */
141 /* GDALDefaultOverviews */
142 /* ******************************************************************** */
143 class CPL_DLL GDALDefaultOverviews
144 {
145  friend class GDALDataset;
146 
147  GDALDataset *poDS;
148  GDALDataset *poODS;
149 
150  CPLString osOvrFilename;
151 
152  int bOvrIsAux;
153 
154  int bCheckedForMask;
155  int bOwnMaskDS;
156  GDALDataset *poMaskDS;
157 
158  // for "overview datasets" we record base level info so we can
159  // find our way back to get overview masks.
160  GDALDataset *poBaseDS;
161 
162  // Stuff for deferred initialize/overviewscans...
163  bool bCheckedForOverviews;
164  void OverviewScan();
165  char *pszInitName;
166  int bInitNameIsOVR;
167  char **papszInitSiblingFiles;
168 
169  public:
172 
173  void Initialize( GDALDataset *poDS, const char *pszName = NULL,
174  char **papszSiblingFiles = NULL,
175  int bNameIsOVR = FALSE );
176 
177  int IsInitialized();
178 
180 
181  // Overview Related
182 
183  int GetOverviewCount(int);
184  GDALRasterBand *GetOverview(int,int);
185 
186  CPLErr BuildOverviews( const char * pszBasename,
187  const char * pszResampling,
188  int nOverviews, int * panOverviewList,
189  int nBands, int * panBandList,
190  GDALProgressFunc pfnProgress,
191  void *pProgressData );
192 
193  CPLErr BuildOverviewsSubDataset( const char * pszPhysicalFile,
194  const char * pszResampling,
195  int nOverviews, int * panOverviewList,
196  int nBands, int * panBandList,
197  GDALProgressFunc pfnProgress,
198  void *pProgressData );
199 
200  CPLErr CleanOverviews();
201 
202  // Mask Related
203 
204  CPLErr CreateMaskBand( int nFlags, int nBand = -1 );
205  GDALRasterBand *GetMaskBand( int nBand );
206  int GetMaskFlags( int nBand );
207 
208  int HaveMaskFile( char **papszSiblings = NULL,
209  const char *pszBasename = NULL );
210 
211  char** GetSiblingFiles() { return papszInitSiblingFiles; }
212 };
213 
214 /* ******************************************************************** */
215 /* GDALOpenInfo */
216 /* */
217 /* Structure of data about dataset for open functions. */
218 /* ******************************************************************** */
219 
220 class CPL_DLL GDALOpenInfo
221 {
222  public:
223  GDALOpenInfo( const char * pszFile, GDALAccess eAccessIn,
224  char **papszSiblingFiles = NULL );
225  ~GDALOpenInfo( void );
226 
227  char *pszFilename;
228  char **papszSiblingFiles;
229 
230  GDALAccess eAccess;
231 
232  int bStatOK;
233  int bIsDirectory;
234 
235  FILE *fp;
236 
237  int nHeaderBytes;
238  GByte *pabyHeader;
239 
240 };
241 
242 /* ******************************************************************** */
243 /* GDALDataset */
244 /* ******************************************************************** */
245 
246 /* Internal method for now. Might be subject to later revisions */
247 GDALDatasetH GDALOpenInternal( const char * pszFilename, GDALAccess eAccess,
248  const char* const * papszAllowedDrivers);
249 GDALDatasetH GDALOpenInternal( GDALOpenInfo& oOpenInfo,
250  const char* const * papszAllowedDrivers);
251 
253 
254 class CPL_DLL GDALDataset : public GDALMajorObject
255 {
256  friend GDALDatasetH CPL_STDCALL GDALOpen( const char *, GDALAccess);
257  friend GDALDatasetH CPL_STDCALL GDALOpenShared( const char *, GDALAccess);
258 
259  /* Internal method for now. Might be subject to later revisions */
260  friend GDALDatasetH GDALOpenInternal( const char *, GDALAccess, const char* const * papszAllowedDrivers);
261  friend GDALDatasetH GDALOpenInternal( GDALOpenInfo& oOpenInfo,
262  const char* const * papszAllowedDrivers);
263 
264  friend class GDALDriver;
265  friend class GDALDefaultOverviews;
266  friend class GDALProxyDataset;
267  friend class GDALDriverManager;
268 
269  protected:
270  GDALDriver *poDriver;
271  GDALAccess eAccess;
272 
273  // Stored raster information.
274  int nRasterXSize;
275  int nRasterYSize;
276  int nBands;
277  GDALRasterBand **papoBands;
278 
279  int bForceCachedIO;
280 
281  int nRefCount;
282  int bShared;
283 
284  GDALDataset(void);
285  void RasterInitialize( int, int );
286  void SetBand( int, GDALRasterBand * );
287 
288  GDALDefaultOverviews oOvManager;
289 
290  virtual CPLErr IBuildOverviews( const char *, int, int *,
291  int, int *, GDALProgressFunc, void * );
292 
293  virtual CPLErr IRasterIO( GDALRWFlag, int, int, int, int,
294  void *, int, int, GDALDataType,
295  int, int *, int, int, int );
296 
297  CPLErr BlockBasedRasterIO( GDALRWFlag, int, int, int, int,
298  void *, int, int, GDALDataType,
299  int, int *, int, int, int );
300  void BlockBasedFlushCache();
301 
302  CPLErr ValidateRasterIOOrAdviseReadParameters(
303  const char* pszCallingFunc,
304  int* pbStopProcessingOnCENone,
305  int nXOff, int nYOff, int nXSize, int nYSize,
306  int nBufXSize, int nBufYSize,
307  int nBandCount, int *panBandMap);
308 
309  virtual int CloseDependentDatasets();
310 
311  friend class GDALRasterBand;
312 
313  public:
314  virtual ~GDALDataset();
315 
316  int GetRasterXSize( void );
317  int GetRasterYSize( void );
318  int GetRasterCount( void );
319  GDALRasterBand *GetRasterBand( int );
320 
321  virtual void FlushCache(void);
322 
323  virtual const char *GetProjectionRef(void);
324  virtual CPLErr SetProjection( const char * );
325 
326  virtual CPLErr GetGeoTransform( double * );
327  virtual CPLErr SetGeoTransform( double * );
328 
329  virtual CPLErr AddBand( GDALDataType eType,
330  char **papszOptions=NULL );
331 
332  virtual void *GetInternalHandle( const char * );
333  virtual GDALDriver *GetDriver(void);
334  virtual char **GetFileList(void);
335 
336  virtual int GetGCPCount();
337  virtual const char *GetGCPProjection();
338  virtual const GDAL_GCP *GetGCPs();
339  virtual CPLErr SetGCPs( int nGCPCount, const GDAL_GCP *pasGCPList,
340  const char *pszGCPProjection );
341 
342  virtual CPLErr AdviseRead( int nXOff, int nYOff, int nXSize, int nYSize,
343  int nBufXSize, int nBufYSize,
344  GDALDataType eDT,
345  int nBandCount, int *panBandList,
346  char **papszOptions );
347 
348  virtual CPLErr CreateMaskBand( int nFlags );
349 
350  virtual GDALAsyncReader*
351  BeginAsyncReader(int nXOff, int nYOff, int nXSize, int nYSize,
352  void *pBuf, int nBufXSize, int nBufYSize,
353  GDALDataType eBufType,
354  int nBandCount, int* panBandMap,
355  int nPixelSpace, int nLineSpace, int nBandSpace,
356  char **papszOptions);
357  virtual void EndAsyncReader(GDALAsyncReader *);
358 
359  CPLErr RasterIO( GDALRWFlag, int, int, int, int,
360  void *, int, int, GDALDataType,
361  int, int *, int, int, int );
362 
363  int Reference();
364  int Dereference();
365  GDALAccess GetAccess() { return eAccess; }
366 
367  int GetShared();
368  void MarkAsShared();
369 
370  static GDALDataset **GetOpenDatasets( int *pnDatasetCount );
371 
372  CPLErr BuildOverviews( const char *, int, int *,
373  int, int *, GDALProgressFunc, void * );
374 
375  void ReportError(CPLErr eErrClass, int err_no, const char *fmt, ...) CPL_PRINT_FUNC_FORMAT (4, 5);
376 };
377 
378 /* ******************************************************************** */
379 /* GDALRasterBlock */
380 /* ******************************************************************** */
381 
383 
384 class CPL_DLL GDALRasterBlock
385 {
386  GDALDataType eType;
387 
388  int bDirty;
389  int nLockCount;
390 
391  int nXOff;
392  int nYOff;
393 
394  int nXSize;
395  int nYSize;
396 
397  void *pData;
398 
399  GDALRasterBand *poBand;
400 
401  GDALRasterBlock *poNext;
402  GDALRasterBlock *poPrevious;
403 
404  public:
405  GDALRasterBlock( GDALRasterBand *, int, int );
406  virtual ~GDALRasterBlock();
407 
408  CPLErr Internalize( void );
409  void Touch( void );
410  void MarkDirty( void );
411  void MarkClean( void );
412  void AddLock( void ) { nLockCount++; }
413  void DropLock( void ) { nLockCount--; }
414  void Detach();
415 
416  CPLErr Write();
417 
418  GDALDataType GetDataType() { return eType; }
419  int GetXOff() { return nXOff; }
420  int GetYOff() { return nYOff; }
421  int GetXSize() { return nXSize; }
422  int GetYSize() { return nYSize; }
423  int GetDirty() { return bDirty; }
424  int GetLockCount() { return nLockCount; }
425 
426  void *GetDataRef( void ) { return pData; }
427 
430  GDALRasterBand *GetBand() { return poBand; }
431 
432  static int FlushCacheBlock();
433  static void Verify();
434 
435  static int SafeLockBlock( GDALRasterBlock ** );
436 
437  /* Should only be called by GDALDestroyDriverManager() */
438  static void DestroyRBMutex();
439 };
440 
441 /* ******************************************************************** */
442 /* GDALColorTable */
443 /* ******************************************************************** */
444 
447 class CPL_DLL GDALColorTable
448 {
449  GDALPaletteInterp eInterp;
450 
451  std::vector<GDALColorEntry> aoEntries;
452 
453 public:
455  ~GDALColorTable();
456 
457  GDALColorTable *Clone() const;
458 
459  GDALPaletteInterp GetPaletteInterpretation() const;
460 
461  int GetColorEntryCount() const;
462  const GDALColorEntry *GetColorEntry( int ) const;
463  int GetColorEntryAsRGB( int, GDALColorEntry * ) const;
464  void SetColorEntry( int, const GDALColorEntry * );
465  int CreateColorRamp( int, const GDALColorEntry * ,
466  int, const GDALColorEntry * );
467 };
468 
469 /* ******************************************************************** */
470 /* GDALRasterBand */
471 /* ******************************************************************** */
472 
474 
475 class CPL_DLL GDALRasterBand : public GDALMajorObject
476 {
477  private:
478  CPLErr eFlushBlockErr;
479 
480  void SetFlushBlockErr( CPLErr eErr );
481 
482  friend class GDALRasterBlock;
483 
484  protected:
485  GDALDataset *poDS;
486  int nBand; /* 1 based */
487 
488  int nRasterXSize;
489  int nRasterYSize;
490 
491  GDALDataType eDataType;
492  GDALAccess eAccess;
493 
494  /* stuff related to blocking, and raster cache */
495  int nBlockXSize;
496  int nBlockYSize;
497  int nBlocksPerRow;
498  int nBlocksPerColumn;
499 
500  int bSubBlockingActive;
501  int nSubBlocksPerRow;
502  int nSubBlocksPerColumn;
503  GDALRasterBlock **papoBlocks;
504 
505  int nBlockReads;
506  int bForceCachedIO;
507 
508  GDALRasterBand *poMask;
509  bool bOwnMask;
510  int nMaskFlags;
511 
512  void InvalidateMaskBand();
513 
514  friend class GDALDataset;
515  friend class GDALProxyRasterBand;
516  friend class GDALDefaultOverviews;
517 
518  protected:
519  virtual CPLErr IReadBlock( int, int, void * ) = 0;
520  virtual CPLErr IWriteBlock( int, int, void * );
521  virtual CPLErr IRasterIO( GDALRWFlag, int, int, int, int,
522  void *, int, int, GDALDataType,
523  int, int );
524  CPLErr OverviewRasterIO( GDALRWFlag, int, int, int, int,
525  void *, int, int, GDALDataType,
526  int, int );
527 
528  int InitBlockInfo();
529 
530  CPLErr AdoptBlock( int, int, GDALRasterBlock * );
531  GDALRasterBlock *TryGetLockedBlockRef( int nXBlockOff, int nYBlockYOff );
532 
533  public:
534  GDALRasterBand();
535 
536  virtual ~GDALRasterBand();
537 
538  int GetXSize();
539  int GetYSize();
540  int GetBand();
541  GDALDataset*GetDataset();
542 
543  GDALDataType GetRasterDataType( void );
544  void GetBlockSize( int *, int * );
545  GDALAccess GetAccess();
546 
547  CPLErr RasterIO( GDALRWFlag, int, int, int, int,
548  void *, int, int, GDALDataType,
549  int, int );
550  CPLErr ReadBlock( int, int, void * );
551 
552  CPLErr WriteBlock( int, int, void * );
553 
554  GDALRasterBlock *GetLockedBlockRef( int nXBlockOff, int nYBlockOff,
555  int bJustInitialize = FALSE );
556  CPLErr FlushBlock( int = -1, int = -1, int bWriteDirtyBlock = TRUE );
557 
558  unsigned char* GetIndexColorTranslationTo(/* const */ GDALRasterBand* poReferenceBand,
559  unsigned char* pTranslationTable = NULL,
560  int* pApproximateMatching = NULL);
561 
562  // New OpengIS CV_SampleDimension stuff.
563 
564  virtual CPLErr FlushCache();
565  virtual char **GetCategoryNames();
566  virtual double GetNoDataValue( int *pbSuccess = NULL );
567  virtual double GetMinimum( int *pbSuccess = NULL );
568  virtual double GetMaximum(int *pbSuccess = NULL );
569  virtual double GetOffset( int *pbSuccess = NULL );
570  virtual double GetScale( int *pbSuccess = NULL );
571  virtual const char *GetUnitType();
572  virtual GDALColorInterp GetColorInterpretation();
573  virtual GDALColorTable *GetColorTable();
574  virtual CPLErr Fill(double dfRealValue, double dfImaginaryValue = 0);
575 
576  virtual CPLErr SetCategoryNames( char ** );
577  virtual CPLErr SetNoDataValue( double );
578  virtual CPLErr SetColorTable( GDALColorTable * );
579  virtual CPLErr SetColorInterpretation( GDALColorInterp );
580  virtual CPLErr SetOffset( double );
581  virtual CPLErr SetScale( double );
582  virtual CPLErr SetUnitType( const char * );
583 
584  virtual CPLErr GetStatistics( int bApproxOK, int bForce,
585  double *pdfMin, double *pdfMax,
586  double *pdfMean, double *padfStdDev );
587  virtual CPLErr ComputeStatistics( int bApproxOK,
588  double *pdfMin, double *pdfMax,
589  double *pdfMean, double *pdfStdDev,
590  GDALProgressFunc, void *pProgressData );
591  virtual CPLErr SetStatistics( double dfMin, double dfMax,
592  double dfMean, double dfStdDev );
593  virtual CPLErr ComputeRasterMinMax( int, double* );
594 
595  virtual int HasArbitraryOverviews();
596  virtual int GetOverviewCount();
597  virtual GDALRasterBand *GetOverview(int);
598  virtual GDALRasterBand *GetRasterSampleOverview( int );
599  virtual CPLErr BuildOverviews( const char *, int, int *,
600  GDALProgressFunc, void * );
601 
602  virtual CPLErr AdviseRead( int nXOff, int nYOff, int nXSize, int nYSize,
603  int nBufXSize, int nBufYSize,
604  GDALDataType eDT, char **papszOptions );
605 
606  virtual CPLErr GetHistogram( double dfMin, double dfMax,
607  int nBuckets, int * panHistogram,
608  int bIncludeOutOfRange, int bApproxOK,
609  GDALProgressFunc, void *pProgressData );
610 
611  virtual CPLErr GetDefaultHistogram( double *pdfMin, double *pdfMax,
612  int *pnBuckets, int ** ppanHistogram,
613  int bForce,
614  GDALProgressFunc, void *pProgressData);
615  virtual CPLErr SetDefaultHistogram( double dfMin, double dfMax,
616  int nBuckets, int *panHistogram );
617 
618  virtual GDALRasterAttributeTable *GetDefaultRAT();
619  virtual CPLErr SetDefaultRAT( const GDALRasterAttributeTable * );
620 
621  virtual GDALRasterBand *GetMaskBand();
622  virtual int GetMaskFlags();
623  virtual CPLErr CreateMaskBand( int nFlags );
624 
625  virtual CPLVirtualMem *GetVirtualMemAuto( GDALRWFlag eRWFlag,
626  int *pnPixelSpace,
627  GIntBig *pnLineSpace,
628  char **papszOptions );
629 
630  void ReportError(CPLErr eErrClass, int err_no, const char *fmt, ...) CPL_PRINT_FUNC_FORMAT (4, 5);
631 };
632 
633 /* ******************************************************************** */
634 /* GDALAllValidMaskBand */
635 /* ******************************************************************** */
636 
637 class CPL_DLL GDALAllValidMaskBand : public GDALRasterBand
638 {
639  protected:
640  virtual CPLErr IReadBlock( int, int, void * );
641 
642  public:
644  virtual ~GDALAllValidMaskBand();
645 
646  virtual GDALRasterBand *GetMaskBand();
647  virtual int GetMaskFlags();
648 };
649 
650 /* ******************************************************************** */
651 /* GDALNoDataMaskBand */
652 /* ******************************************************************** */
653 
654 class CPL_DLL GDALNoDataMaskBand : public GDALRasterBand
655 {
656  double dfNoDataValue;
657  GDALRasterBand *poParent;
658 
659  protected:
660  virtual CPLErr IReadBlock( int, int, void * );
661  virtual CPLErr IRasterIO( GDALRWFlag, int, int, int, int,
662  void *, int, int, GDALDataType,
663  int, int );
664 
665  public:
667  virtual ~GDALNoDataMaskBand();
668 };
669 
670 /* ******************************************************************** */
671 /* GDALNoDataValuesMaskBand */
672 /* ******************************************************************** */
673 
675 {
676  double *padfNodataValues;
677 
678  protected:
679  virtual CPLErr IReadBlock( int, int, void * );
680 
681  public:
683  virtual ~GDALNoDataValuesMaskBand();
684 };
685 
686 /* ******************************************************************** */
687 /* GDALRescaledAlphaBand */
688 /* ******************************************************************** */
689 
691 {
692  GDALRasterBand *poParent;
693  void *pTemp;
694 
695  protected:
696  virtual CPLErr IReadBlock( int, int, void * );
697  virtual CPLErr IRasterIO( GDALRWFlag, int, int, int, int,
698  void *, int, int, GDALDataType,
699  int, int );
700 
701  public:
703  virtual ~GDALRescaledAlphaBand();
704 };
705 
706 /* ******************************************************************** */
707 /* GDALDriver */
708 /* ******************************************************************** */
709 
710 
722 class CPL_DLL GDALDriver : public GDALMajorObject
723 {
724  public:
725  GDALDriver();
726  ~GDALDriver();
727 
728 /* -------------------------------------------------------------------- */
729 /* Public C++ methods. */
730 /* -------------------------------------------------------------------- */
731  GDALDataset *Create( const char * pszName,
732  int nXSize, int nYSize, int nBands,
733  GDALDataType eType, char ** papszOptions ) CPL_WARN_UNUSED_RESULT;
734 
735  CPLErr Delete( const char * pszName );
736  CPLErr Rename( const char * pszNewName,
737  const char * pszOldName );
738  CPLErr CopyFiles( const char * pszNewName,
739  const char * pszOldName );
740 
741  GDALDataset *CreateCopy( const char *, GDALDataset *,
742  int, char **,
743  GDALProgressFunc pfnProgress,
744  void * pProgressData ) CPL_WARN_UNUSED_RESULT;
745 
746 /* -------------------------------------------------------------------- */
747 /* The following are semiprivate, not intended to be accessed */
748 /* by anyone but the formats instantiating and populating the */
749 /* drivers. */
750 /* -------------------------------------------------------------------- */
751  GDALDataset *(*pfnOpen)( GDALOpenInfo * );
752 
753  GDALDataset *(*pfnCreate)( const char * pszName,
754  int nXSize, int nYSize, int nBands,
755  GDALDataType eType,
756  char ** papszOptions );
757 
758  CPLErr (*pfnDelete)( const char * pszName );
759 
760  GDALDataset *(*pfnCreateCopy)( const char *, GDALDataset *,
761  int, char **,
762  GDALProgressFunc pfnProgress,
763  void * pProgressData );
764 
765  void *pDriverData;
766 
767  void (*pfnUnloadDriver)(GDALDriver *);
768 
769  int (*pfnIdentify)( GDALOpenInfo * );
770 
771  CPLErr (*pfnRename)( const char * pszNewName,
772  const char * pszOldName );
773  CPLErr (*pfnCopyFiles)( const char * pszNewName,
774  const char * pszOldName );
775 
776 /* -------------------------------------------------------------------- */
777 /* Helper methods. */
778 /* -------------------------------------------------------------------- */
779  GDALDataset *DefaultCreateCopy( const char *, GDALDataset *,
780  int, char **,
781  GDALProgressFunc pfnProgress,
782  void * pProgressData ) CPL_WARN_UNUSED_RESULT;
783  static CPLErr DefaultCopyMasks( GDALDataset *poSrcDS,
784  GDALDataset *poDstDS,
785  int bStrict );
786  static CPLErr QuietDelete( const char * pszName );
787 
788  CPLErr DefaultRename( const char * pszNewName,
789  const char * pszOldName );
790  CPLErr DefaultCopyFiles( const char * pszNewName,
791  const char * pszOldName );
792 };
793 
794 /* ******************************************************************** */
795 /* GDALDriverManager */
796 /* ******************************************************************** */
797 
805 class CPL_DLL GDALDriverManager : public GDALMajorObject
806 {
807  int nDrivers;
808  GDALDriver **papoDrivers;
809 
810  char *pszHome;
811 
812  public:
815 
816  int GetDriverCount( void );
817  GDALDriver *GetDriver( int );
818  GDALDriver *GetDriverByName( const char * );
819 
820  int RegisterDriver( GDALDriver * );
821  void MoveDriver( GDALDriver *, int );
822  void DeregisterDriver( GDALDriver * );
823 
824  void AutoLoadDrivers();
825  void AutoSkipDrivers();
826 
827  const char *GetHome();
828  void SetHome( const char * );
829 };
830 
831 CPL_C_START
832 GDALDriverManager CPL_DLL * GetGDALDriverManager( void );
833 CPL_C_END
834 
835 /* ******************************************************************** */
836 /* GDALAsyncReader */
837 /* ******************************************************************** */
838 
844 class CPL_DLL GDALAsyncReader
845 {
846  protected:
847  GDALDataset* poDS;
848  int nXOff;
849  int nYOff;
850  int nXSize;
851  int nYSize;
852  void * pBuf;
853  int nBufXSize;
854  int nBufYSize;
855  GDALDataType eBufType;
856  int nBandCount;
857  int* panBandMap;
858  int nPixelSpace;
859  int nLineSpace;
860  int nBandSpace;
861 
862  public:
863  GDALAsyncReader();
864  virtual ~GDALAsyncReader();
865 
866  GDALDataset* GetGDALDataset() {return poDS;}
867  int GetXOffset() {return nXOff;}
868  int GetYOffset() {return nYOff;}
869  int GetXSize() {return nXSize;}
870  int GetYSize() {return nYSize;}
871  void * GetBuffer() {return pBuf;}
872  int GetBufferXSize() {return nBufXSize;}
873  int GetBufferYSize() {return nBufYSize;}
874  GDALDataType GetBufferType() {return eBufType;}
875  int GetBandCount() {return nBandCount;}
876  int* GetBandMap() {return panBandMap;}
877  int GetPixelSpace() {return nPixelSpace;}
878  int GetLineSpace() {return nLineSpace;}
879  int GetBandSpace() {return nBandSpace;}
880 
881  virtual GDALAsyncStatusType
882  GetNextUpdatedRegion(double dfTimeout,
883  int* pnBufXOff, int* pnBufYOff,
884  int* pnBufXSize, int* pnBufYSize) = 0;
885  virtual int LockBuffer( double dfTimeout = -1.0 );
886  virtual void UnlockBuffer();
887 };
888 
889 /* ==================================================================== */
890 /* An assortment of overview related stuff. */
891 /* ==================================================================== */
892 
893 /* Not a public symbol for the moment */
894 CPLErr
895 GDALRegenerateOverviewsMultiBand(int nBands, GDALRasterBand** papoSrcBands,
896  int nOverviews,
897  GDALRasterBand*** papapoOverviewBands,
898  const char * pszResampling,
899  GDALProgressFunc pfnProgress, void * pProgressData );
900 
901 CPL_C_START
902 
903 #ifndef WIN32CE
904 
905 CPLErr CPL_DLL
906 HFAAuxBuildOverviews( const char *pszOvrFilename, GDALDataset *poParentDS,
907  GDALDataset **ppoDS,
908  int nBands, int *panBandList,
909  int nNewOverviews, int *panNewOverviewList,
910  const char *pszResampling,
911  GDALProgressFunc pfnProgress,
912  void *pProgressData );
913 
914 #endif /* WIN32CE */
915 
916 CPLErr CPL_DLL
917 GTIFFBuildOverviews( const char * pszFilename,
918  int nBands, GDALRasterBand **papoBandList,
919  int nOverviews, int * panOverviewList,
920  const char * pszResampling,
921  GDALProgressFunc pfnProgress, void * pProgressData );
922 
923 CPLErr CPL_DLL
924 GDALDefaultBuildOverviews( GDALDataset *hSrcDS, const char * pszBasename,
925  const char * pszResampling,
926  int nOverviews, int * panOverviewList,
927  int nBands, int * panBandList,
928  GDALProgressFunc pfnProgress, void * pProgressData);
929 
930 int CPL_DLL GDALBandGetBestOverviewLevel(GDALRasterBand* poBand,
931  int &nXOff, int &nYOff,
932  int &nXSize, int &nYSize,
933  int nBufXSize, int nBufYSize);
934 
935 int CPL_DLL GDALOvLevelAdjust( int nOvLevel, int nXSize );
936 
937 GDALDataset CPL_DLL *
938 GDALFindAssociatedAuxFile( const char *pszBasefile, GDALAccess eAccess,
939  GDALDataset *poDependentDS );
940 
941 /* ==================================================================== */
942 /* Misc functions. */
943 /* ==================================================================== */
944 
945 CPLErr CPL_DLL GDALParseGMLCoverage( CPLXMLNode *psTree,
946  int *pnXSize, int *pnYSize,
947  double *padfGeoTransform,
948  char **ppszProjection );
949 
950 /* ==================================================================== */
951 /* Infrastructure to check that dataset characteristics are valid */
952 /* ==================================================================== */
953 
954 int CPL_DLL GDALCheckDatasetDimensions( int nXSize, int nYSize );
955 int CPL_DLL GDALCheckBandCount( int nBands, int bIsZeroAllowed );
956 
957 
958 // Test if 2 floating point values match. Useful when comparing values
959 // stored as a string at some point. See #3573, #4183, #4506
960 #define ARE_REAL_EQUAL(dfVal1, dfVal2) \
961  (dfVal1 == dfVal2 || fabs(dfVal1 - dfVal2) < 1e-10 || (dfVal2 != 0 && fabs(1 - dfVal1 / dfVal2) < 1e-10 ))
962 
963 /* Internal use only */
964 
965 /* CPL_DLL exported, but only for in-tree drivers that can be built as plugins */
966 int CPL_DLL GDALReadWorldFile2( const char *pszBaseFilename, const char *pszExtension,
967  double *padfGeoTransform, char** papszSiblingFiles,
968  char** ppszWorldFileNameOut);
969 int GDALReadTabFile2( const char * pszBaseFilename,
970  double *padfGeoTransform, char **ppszWKT,
971  int *pnGCPCount, GDAL_GCP **ppasGCPs,
972  char** papszSiblingFiles, char** ppszTabFileNameOut );
973 
974 CPL_C_END
975 
976 void GDALNullifyOpenDatasetsList();
977 void** GDALGetphDMMutex();
978 void** GDALGetphDLMutex();
979 void GDALNullifyProxyPoolSingleton();
980 GDALDriver* GDALGetAPIPROXYDriver();
981 void GDALSetResponsiblePIDForCurrentThread(GIntBig responsiblePID);
982 GIntBig GDALGetResponsiblePIDForCurrentThread();
983 
984 CPLString GDALFindAssociatedFile( const char *pszBasename, const char *pszExt,
985  char **papszSiblingFiles, int nFlags );
986 
987 CPLErr EXIFExtractMetadata(char**& papszMetadata,
988  void *fpL, int nOffset,
989  int bSwabflag, int nTIFFHEADER,
990  int& nExifOffset, int& nInterOffset, int& nGPSOffset);
991 
992 #define DIV_ROUND_UP(a, b) ( ((a) % (b)) == 0 ? ((a) / (b)) : (((a) / (b)) + 1) )
993 
994 // Number of data samples that will be used to compute approximate statistics
995 // (minimum value, maximum value, etc.)
996 #define GDALSTAT_APPROX_NUMSAMPLES 2500
997 
998 CPL_C_START
999 /* Caution: for technical reason this declaration is duplicated in gdal_crs.c */
1000 /* so any signature change should be reflected there too */
1001 void GDALSerializeGCPListToXML( CPLXMLNode* psParentNode,
1002  GDAL_GCP* pasGCPList,
1003  int nGCPCount,
1004  const char* pszGCPProjection );
1005 void GDALDeserializeGCPListFromXML( CPLXMLNode* psGCPList,
1006  GDAL_GCP** ppasGCPList,
1007  int* pnGCPCount,
1008  char** ppszGCPProjection );
1009 CPL_C_END
1010 
1011 #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
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:3280
GDALDataType
Definition: gdal.h:55
Definition: gdal_priv.h:674
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:4450
Definitions for CPL mini XML Parser/Serializer.
Definition: gdal.h:134
Definition: gdal_proxy.h:99
GDALDatasetH GDALOpenShared(const char *, GDALAccess) CPL_WARN_UNUSED_RESULT
Open a raster file as a GDALDataset.
Definition: gdaldataset.cpp:2408
GDALRWFlag
Definition: gdal.h:99
void * GDALDatasetH
Opaque type used for the C bindings of the C++ GDALDataset class.
Definition: gdal.h:162
Definition: gdal_priv.h:654
Color tuple.
Definition: gdal.h:640
A single raster block in the block cache.
Definition: gdal_priv.h:384
virtual int GetMaskFlags()
Return the status flags of the mask band associated with the band.
Definition: gdalrasterband.cpp:4650
Convenient string class based on std::string.
Definition: cpl_string.h:226
virtual CPLErr BuildOverviews(const char *, int, int *, GDALProgressFunc, void *)
Build raster overview(s)
Definition: gdalrasterband.cpp:2194
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:1359
Various convenience functions for working with strings and string lists.
Definition: gdal_priv.h:143
virtual CPLErr FlushCache()
Flush raster data cache.
Definition: gdalrasterband.cpp:850
virtual CPLErr CreateMaskBand(int nFlags)
Adds a mask band to the current band.
Definition: gdalrasterband.cpp:4723
virtual CPLErr CreateMaskBand(int nFlags)
Adds a mask band to the dataset.
Definition: gdaldataset.cpp:2161
Public (C callable) GDAL entry points.
GDALAsyncStatusType
status of the asynchronous stream
Definition: gdal.h:80
Definition: gdal_proxy.h:44
GDALRasterBand * GetBand()
Accessor to source GDALRasterBand object.
Definition: gdal_priv.h:430
Definition: gdal_priv.h:220
Definition: gdal_priv.h:637
String list class designed around our use of C "char**" string lists.
Definition: cpl_string.h:300
GDALDatasetH GDALOpen(const char *pszFilename, GDALAccess eAccess) CPL_WARN_UNUSED_RESULT
Open a raster file as a GDALDataset.
Definition: gdaldataset.cpp:2251
GDALPaletteInterp
Definition: gdal.h:131
virtual int CloseDependentDatasets()
Drop references to any other datasets referenced by this dataset.
Definition: gdaldataset.cpp:2789
Various convenience functions for CPL.
void ReportError(CPLErr eErrClass, int err_no, const char *fmt,...) CPL_PRINT_FUNC_FORMAT(4
Emits an error related to a raster band.
Definition: gdalrasterband.cpp:4940
Object with metadata.
Definition: gdal_priv.h:109
CPLErr RasterIO(GDALRWFlag, int, int, int, int, void *, int, int, GDALDataType, int, int)
Read/write a region of image data for this band.
Definition: gdalrasterband.cpp:170
A single raster band (or channel).
Definition: gdal_priv.h:475
GDALAccess
Definition: gdal.h:93
Definition: gdal_priv.h:73
A set of associated raster bands, usually from one file.
Definition: gdal_priv.h:254
GDALAccess GetAccess()
Find out if we have update permission for this band.
Definition: gdalrasterband.cpp:1395
Class for managing the registration of file format drivers.
Definition: gdal_priv.h:805
Definition: gdal_priv.h:690
GDALColorInterp
Definition: gdal.h:105
Format specific driver.
Definition: gdal_priv.h:722
Definition: gdal_priv.h:447
Ground Control Point.
Definition: gdal.h:255
Class used as a session object for asynchronous requests.
Definition: gdal_priv.h:844

Generated for GDAL by doxygen 1.8.11.