LCOV - code coverage report
Current view: directory - gcore - gdal_priv.h (source / functions) Found Hit Coverage
Test: gdal_filtered.info Lines: 15 13 86.7 %
Date: 2012-12-26 Functions: 15 13 86.7 %

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

Generated by: LCOV version 1.7