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

          Line data    Source code
       1             : /*
       2             :  *  keaband.h
       3             :  *
       4             :  *  Created by Pete Bunting on 01/08/2012.
       5             :  *  Copyright 2012 LibKEA. All rights reserved.
       6             :  *
       7             :  *  This file is part of LibKEA.
       8             :  *
       9             :  * SPDX-License-Identifier: MIT
      10             :  *
      11             :  */
      12             : 
      13             : #ifndef KEABAND_H
      14             : #define KEABAND_H
      15             : 
      16             : #include "gdal_priv.h"
      17             : #include "keadataset.h"
      18             : 
      19             : class KEAOverview;
      20             : class KEAMaskBand;
      21             : 
      22             : // Provides the implementation of a GDAL raster band
      23             : class KEARasterBand CPL_NON_FINAL : public GDALRasterBand
      24             : {
      25             :   private:
      26             :     LockedRefCount *m_pRefCount = nullptr;  // reference count of m_pImageIO
      27             : 
      28             :     int m_nOverviews = 0;                        // number of overviews
      29             :     KEAOverview **m_panOverviewBands = nullptr;  // array of overview objects
      30             :     GDALRasterBand *m_pMaskBand =
      31             :         nullptr;  // pointer to mask band if one exists (and been requested)
      32             :     bool m_bMaskBandOwned = false;  // do we delete it or not?
      33             : 
      34             :     GDALRasterAttributeTable *m_pAttributeTable =
      35             :         nullptr;  // pointer to the attribute table
      36             :                   // created on first call to GetDefaultRAT()
      37             :     GDALColorTable *m_pColorTable = nullptr;  // pointer to the color table
      38             :         // created on first call to GetColorTable()
      39             : 
      40             :     int m_nAttributeChunkSize = 0;  // for reporting via the metadata
      41             :   public:
      42             :     // constructor/destructor
      43             :     KEARasterBand(KEADataset *pDataset, int nSrcBand, GDALAccess eAccess,
      44             :                   kealib::KEAImageIO *pImageIO, LockedRefCount *pRefCount);
      45             :     ~KEARasterBand();
      46             : 
      47             :     // virtual methods for overview support
      48             :     int GetOverviewCount() override;
      49             :     GDALRasterBand *GetOverview(int nOverview) override;
      50             : 
      51             :     // virtual methods for band names (aka description)
      52             :     void SetDescription(const char *) override;
      53             : 
      54             :     // virtual methods for handling the metadata
      55             :     CPLErr SetMetadataItem(const char *pszName, const char *pszValue,
      56             :                            const char *pszDomain = "") override;
      57             :     const char *GetMetadataItem(const char *pszName,
      58             :                                 const char *pszDomain = "") override;
      59             :     char **GetMetadata(const char *pszDomain = "") override;
      60             :     CPLErr SetMetadata(char **papszMetadata,
      61             :                        const char *pszDomain = "") override;
      62             : 
      63             :     // virtual methods for the no data value
      64             :     double GetNoDataValue(int *pbSuccess = nullptr) override;
      65             :     int64_t GetNoDataValueAsInt64(int *pbSuccess = nullptr) override;
      66             :     uint64_t GetNoDataValueAsUInt64(int *pbSuccess = nullptr) override;
      67             : 
      68             :     CPLErr SetNoDataValue(double dfNoData) override;
      69             :     CPLErr SetNoDataValueAsInt64(int64_t nNoData) override;
      70             :     CPLErr SetNoDataValueAsUInt64(uint64_t nNoData) override;
      71             : 
      72             :     virtual CPLErr DeleteNoDataValue() override;
      73             : 
      74             :     // histogram methods
      75             :     CPLErr GetDefaultHistogram(double *pdfMin, double *pdfMax, int *pnBuckets,
      76             :                                GUIntBig **ppanHistogram, int bForce,
      77             :                                GDALProgressFunc, void *pProgressData) override;
      78             :     CPLErr SetDefaultHistogram(double dfMin, double dfMax, int nBuckets,
      79             :                                GUIntBig *panHistogram) override;
      80             : 
      81             :     // virtual methods for RATs
      82             :     GDALRasterAttributeTable *GetDefaultRAT() override;
      83             :     CPLErr SetDefaultRAT(const GDALRasterAttributeTable *poRAT) override;
      84             : 
      85             :     // virtual methods for color tables
      86             :     GDALColorTable *GetColorTable() override;
      87             :     CPLErr SetColorTable(GDALColorTable *poCT) override;
      88             : 
      89             :     // virtual methods for color interpretation
      90             :     GDALColorInterp GetColorInterpretation() override;
      91             :     CPLErr SetColorInterpretation(GDALColorInterp gdalinterp) override;
      92             : 
      93             :     // Virtual methods for band masks.
      94             :     CPLErr CreateMaskBand(int nFlags) override;
      95             :     GDALRasterBand *GetMaskBand() override;
      96             :     int GetMaskFlags() override;
      97             : 
      98             :     // internal methods for overviews
      99             :     void readExistingOverviews();
     100             :     void deleteOverviewObjects();
     101             :     void CreateOverviews(int nOverviews, const int *panOverviewList);
     102             : 
     103           1 :     KEAOverview **GetOverviewList()
     104             :     {
     105           1 :         return m_panOverviewBands;
     106             :     }
     107             : 
     108             :     kealib::KEALayerType getLayerType() const;
     109             :     void setLayerType(kealib::KEALayerType eLayerType);
     110             : 
     111             :   protected:
     112             :     // methods for accessing data as blocks
     113             :     virtual CPLErr IReadBlock(int, int, void *) override;
     114             :     virtual CPLErr IWriteBlock(int, int, void *) override;
     115             : 
     116             :     // updates m_papszMetadataList
     117             :     void UpdateMetadataList();
     118             : 
     119             :     // sets/gets the histogram column from a string (for metadata)
     120             :     CPLErr SetHistogramFromString(const char *pszString);
     121             :     char *GetHistogramAsString();
     122             :     // So we can return the histogram as a string from GetMetadataItem
     123             :     char *m_pszHistoBinValues = nullptr;
     124             : 
     125             :     kealib::KEAImageIO *m_pImageIO =
     126             :         nullptr;  // our image access pointer - refcounted
     127             :     char **m_papszMetadataList = nullptr;  // CPLStringList of metadata
     128             :     kealib::KEADataType m_eKEADataType;    // data type as KEA enum
     129             :     CPLMutex *m_hMutex;
     130             : };
     131             : 
     132             : #endif  // KEABAND_H

Generated by: LCOV version 1.14