LCOV - code coverage report
Current view: top level - frmts/gtiff - gtiffrasterband.h (source / functions) Hit Total Coverage
Test: gdal_filtered.info Lines: 4 4 100.0 %
Date: 2025-01-18 12:42:00 Functions: 2 2 100.0 %

          Line data    Source code
       1             : /******************************************************************************
       2             :  *
       3             :  * Project:  GeoTIFF Driver
       4             :  * Purpose:  GDAL GeoTIFF support.
       5             :  * Author:   Frank Warmerdam, warmerdam@pobox.com
       6             :  *
       7             :  ******************************************************************************
       8             :  * Copyright (c) 1998, 2002, Frank Warmerdam <warmerdam@pobox.com>
       9             :  * Copyright (c) 2007-2015, Even Rouault <even dot rouault at spatialys dot com>
      10             :  *
      11             :  * SPDX-License-Identifier: MIT
      12             :  ****************************************************************************/
      13             : 
      14             : #ifndef GTIFFRASTERBAND_H_INCLUDED
      15             : #define GTIFFRASTERBAND_H_INCLUDED
      16             : 
      17             : #include "gdal_pam.h"
      18             : #include "gdal_rat.h"
      19             : 
      20             : #include "gtiff.h"
      21             : 
      22             : #include <set>
      23             : 
      24             : /************************************************************************/
      25             : /* ==================================================================== */
      26             : /*                            GTiffRasterBand                           */
      27             : /* ==================================================================== */
      28             : /************************************************************************/
      29             : 
      30             : class GTiffDataset;
      31             : 
      32             : class GTiffRasterBand CPL_NON_FINAL : public GDALPamRasterBand
      33             : {
      34             :     CPL_DISALLOW_COPY_ASSIGN(GTiffRasterBand)
      35             : 
      36             :     friend class GTiffDataset;
      37             : 
      38             :     double m_dfOffset = 0;
      39             :     double m_dfScale = 1;
      40             :     CPLString m_osUnitType{};
      41             :     CPLString m_osDescription{};
      42             :     GDALColorInterp m_eBandInterp = GCI_Undefined;
      43             :     std::set<GTiffRasterBand **> m_aSetPSelf{};
      44             :     bool m_bHaveOffsetScale = false;
      45             :     std::unique_ptr<GDALRasterAttributeTable> m_poRAT{};
      46             : 
      47             :     int DirectIO(GDALRWFlag eRWFlag, int nXOff, int nYOff, int nXSize,
      48             :                  int nYSize, void *pData, int nBufXSize, int nBufYSize,
      49             :                  GDALDataType eBufType, GSpacing nPixelSpace,
      50             :                  GSpacing nLineSpace, GDALRasterIOExtraArg *psExtraArg);
      51             : 
      52             :     static void DropReferenceVirtualMem(void *pUserData);
      53             :     CPLVirtualMem *GetVirtualMemAutoInternal(GDALRWFlag eRWFlag,
      54             :                                              int *pnPixelSpace,
      55             :                                              GIntBig *pnLineSpace,
      56             :                                              char **papszOptions);
      57             : 
      58             :     void *CacheMultiRange(int nXOff, int nYOff, int nXSize, int nYSize,
      59             :                           int nBufXSize, int nBufYSize,
      60             :                           GDALRasterIOExtraArg *psExtraArg);
      61             : 
      62             :   protected:
      63             :     GTiffDataset *m_poGDS = nullptr;
      64             :     GDALMultiDomainMetadata m_oGTiffMDMD{};
      65             : 
      66             :     double m_dfNoDataValue = DEFAULT_NODATA_VALUE;
      67             :     bool m_bNoDataSet = false;
      68             : 
      69             :     int64_t m_nNoDataValueInt64 = GDAL_PAM_DEFAULT_NODATA_VALUE_INT64;
      70             :     bool m_bNoDataSetAsInt64 = false;
      71             : 
      72             :     uint64_t m_nNoDataValueUInt64 = GDAL_PAM_DEFAULT_NODATA_VALUE_UINT64;
      73             :     bool m_bNoDataSetAsUInt64 = false;
      74             : 
      75             :     void NullBlock(void *pData);
      76             :     CPLErr FillCacheForOtherBands(int nBlockXOff, int nBlockYOff);
      77             :     void CacheMaskForBlock(int nBlockXOff, int nBlockYOff);
      78             :     void ResetNoDataValues(bool bResetDatasetToo);
      79             : 
      80             :     int ComputeBlockId(int nBlockXOff, int nBlockYOff) const;
      81             : 
      82             :   public:
      83             :     GTiffRasterBand(GTiffDataset *, int);
      84             :     virtual ~GTiffRasterBand();
      85             : 
      86        2825 :     virtual bool IsBaseGTiffClass() const
      87             :     {
      88        2825 :         return true;
      89             :     }
      90             : 
      91             :     virtual CPLErr IReadBlock(int, int, void *) override;
      92             :     virtual CPLErr IWriteBlock(int, int, void *) override;
      93             : 
      94             :     virtual GDALSuggestedBlockAccessPattern
      95         704 :     GetSuggestedBlockAccessPattern() const override
      96             :     {
      97         704 :         return GSBAP_RANDOM;
      98             :     }
      99             : 
     100             :     virtual int IGetDataCoverageStatus(int nXOff, int nYOff, int nXSize,
     101             :                                        int nYSize, int nMaskFlagStop,
     102             :                                        double *pdfDataPct) override;
     103             : 
     104             :     virtual CPLErr IRasterIO(GDALRWFlag eRWFlag, int nXOff, int nYOff,
     105             :                              int nXSize, int nYSize, void *pData, int nBufXSize,
     106             :                              int nBufYSize, GDALDataType eBufType,
     107             :                              GSpacing nPixelSpace, GSpacing nLineSpace,
     108             :                              GDALRasterIOExtraArg *psExtraArg) override final;
     109             : 
     110             :     virtual const char *GetDescription() const override final;
     111             :     virtual void SetDescription(const char *) override final;
     112             : 
     113             :     virtual GDALColorInterp GetColorInterpretation() override /*final*/;
     114             :     virtual GDALColorTable *GetColorTable() override /*final*/;
     115             :     virtual CPLErr SetColorTable(GDALColorTable *) override final;
     116             : 
     117             :     CPLErr SetNoDataValue(double) override final;
     118             :     CPLErr SetNoDataValueAsInt64(int64_t nNoData) override final;
     119             :     CPLErr SetNoDataValueAsUInt64(uint64_t nNoData) override final;
     120             :     double GetNoDataValue(int *pbSuccess = nullptr) override final;
     121             :     int64_t GetNoDataValueAsInt64(int *pbSuccess = nullptr) override final;
     122             :     uint64_t GetNoDataValueAsUInt64(int *pbSuccess = nullptr) override final;
     123             :     CPLErr DeleteNoDataValue() override final;
     124             : 
     125             :     virtual double GetOffset(int *pbSuccess = nullptr) override final;
     126             :     virtual CPLErr SetOffset(double dfNewValue) override final;
     127             :     virtual double GetScale(int *pbSuccess = nullptr) override final;
     128             :     virtual CPLErr SetScale(double dfNewValue) override final;
     129             :     virtual const char *GetUnitType() override final;
     130             :     virtual CPLErr SetUnitType(const char *pszNewValue) override final;
     131             :     virtual CPLErr SetColorInterpretation(GDALColorInterp) override final;
     132             : 
     133             :     virtual char **GetMetadataDomainList() override final;
     134             :     virtual CPLErr SetMetadata(char **, const char * = "") override final;
     135             :     virtual char **GetMetadata(const char *pszDomain = "") override final;
     136             :     virtual CPLErr SetMetadataItem(const char *, const char *,
     137             :                                    const char * = "") override final;
     138             :     virtual const char *
     139             :     GetMetadataItem(const char *pszName,
     140             :                     const char *pszDomain = "") override final;
     141             :     virtual int GetOverviewCount() override final;
     142             :     virtual GDALRasterBand *GetOverview(int) override final;
     143             : 
     144             :     virtual GDALRasterBand *GetMaskBand() override final;
     145             :     virtual int GetMaskFlags() override final;
     146             :     virtual CPLErr CreateMaskBand(int nFlags) override final;
     147             :     virtual bool IsMaskBand() const override final;
     148             :     virtual GDALMaskValueRange GetMaskValueRange() const override final;
     149             : 
     150             :     virtual CPLVirtualMem *
     151             :     GetVirtualMemAuto(GDALRWFlag eRWFlag, int *pnPixelSpace,
     152             :                       GIntBig *pnLineSpace, char **papszOptions) override final;
     153             : 
     154             :     GDALRasterAttributeTable *GetDefaultRAT() override final;
     155             :     virtual CPLErr
     156             :     SetDefaultRAT(const GDALRasterAttributeTable *) override final;
     157             :     virtual CPLErr GetHistogram(double dfMin, double dfMax, int nBuckets,
     158             :                                 GUIntBig *panHistogram, int bIncludeOutOfRange,
     159             :                                 int bApproxOK, GDALProgressFunc,
     160             :                                 void *pProgressData) override final;
     161             : 
     162             :     virtual CPLErr GetDefaultHistogram(double *pdfMin, double *pdfMax,
     163             :                                        int *pnBuckets, GUIntBig **ppanHistogram,
     164             :                                        int bForce, GDALProgressFunc,
     165             :                                        void *pProgressData) override final;
     166             : };
     167             : 
     168             : #endif  //  GTIFFRASTERBAND_H_INCLUDED

Generated by: LCOV version 1.14