LCOV - code coverage report
Current view: top level - gcore - gdalallvalidmaskband.cpp (source / functions) Hit Total Coverage
Test: gdal_filtered.info Lines: 26 26 100.0 %
Date: 2024-05-04 12:52:34 Functions: 5 5 100.0 %

          Line data    Source code
       1             : /******************************************************************************
       2             :  *
       3             :  * Project:  GDAL Core
       4             :  * Purpose:  Implementation of GDALAllValidMaskBand, a class implementing all
       5             :  *           a default 'all valid' band mask.
       6             :  * Author:   Frank Warmerdam, warmerdam@pobox.com
       7             :  *
       8             :  ******************************************************************************
       9             :  * Copyright (c) 2007, Frank Warmerdam
      10             :  *
      11             :  * Permission is hereby granted, free of charge, to any person obtaining a
      12             :  * copy of this software and associated documentation files (the "Software"),
      13             :  * to deal in the Software without restriction, including without limitation
      14             :  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
      15             :  * and/or sell copies of the Software, and to permit persons to whom the
      16             :  * Software is furnished to do so, subject to the following conditions:
      17             :  *
      18             :  * The above copyright notice and this permission notice shall be included
      19             :  * in all copies or substantial portions of the Software.
      20             :  *
      21             :  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
      22             :  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
      23             :  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
      24             :  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
      25             :  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
      26             :  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
      27             :  * DEALINGS IN THE SOFTWARE.
      28             :  ****************************************************************************/
      29             : 
      30             : #include "cpl_port.h"
      31             : #include "gdal_priv.h"
      32             : 
      33             : #include <cstring>
      34             : 
      35             : #include "gdal.h"
      36             : #include "cpl_error.h"
      37             : 
      38             : //! @cond Doxygen_Suppress
      39             : /************************************************************************/
      40             : /*                        GDALAllValidMaskBand()                        */
      41             : /************************************************************************/
      42             : 
      43       20196 : GDALAllValidMaskBand::GDALAllValidMaskBand(GDALRasterBand *poParent)
      44       20196 :     : GDALRasterBand(FALSE)
      45             : {
      46       20196 :     poDS = nullptr;
      47       20196 :     nBand = 0;
      48             : 
      49       20196 :     nRasterXSize = poParent->GetXSize();
      50       20196 :     nRasterYSize = poParent->GetYSize();
      51             : 
      52       20196 :     eDataType = GDT_Byte;
      53       20196 :     poParent->GetBlockSize(&nBlockXSize, &nBlockYSize);
      54       20196 : }
      55             : 
      56             : /************************************************************************/
      57             : /*                       ~GDALAllValidMaskBand()                        */
      58             : /************************************************************************/
      59             : 
      60             : GDALAllValidMaskBand::~GDALAllValidMaskBand() = default;
      61             : 
      62             : /************************************************************************/
      63             : /*                             IReadBlock()                             */
      64             : /************************************************************************/
      65             : 
      66         318 : CPLErr GDALAllValidMaskBand::IReadBlock(int /* nXBlockOff */,
      67             :                                         int /* nYBlockOff */, void *pImage)
      68             : {
      69         318 :     memset(pImage, 255, static_cast<size_t>(nBlockXSize) * nBlockYSize);
      70             : 
      71         318 :     return CE_None;
      72             : }
      73             : 
      74             : /************************************************************************/
      75             : /*                            GetMaskBand()                             */
      76             : /************************************************************************/
      77             : 
      78           3 : GDALRasterBand *GDALAllValidMaskBand::GetMaskBand()
      79             : 
      80             : {
      81           3 :     return this;
      82             : }
      83             : 
      84             : /************************************************************************/
      85             : /*                            GetMaskFlags()                            */
      86             : /************************************************************************/
      87             : 
      88           6 : int GDALAllValidMaskBand::GetMaskFlags()
      89             : 
      90             : {
      91           6 :     return GMF_ALL_VALID;
      92             : }
      93             : 
      94             : /************************************************************************/
      95             : /*                           ComputeStatistics()                        */
      96             : /************************************************************************/
      97             : 
      98           1 : CPLErr GDALAllValidMaskBand::ComputeStatistics(
      99             :     int /* bApproxOK */, double *pdfMin, double *pdfMax, double *pdfMean,
     100             :     double *pdfStdDev, GDALProgressFunc, void * /*pProgressData*/)
     101             : {
     102           1 :     if (pdfMin)
     103           1 :         *pdfMin = 255.0;
     104           1 :     if (pdfMax)
     105           1 :         *pdfMax = 255.0;
     106           1 :     if (pdfMean)
     107           1 :         *pdfMean = 255.0;
     108           1 :     if (pdfStdDev)
     109           1 :         *pdfStdDev = 0.0;
     110           1 :     return CE_None;
     111             : }
     112             : 
     113             : //! @endcond

Generated by: LCOV version 1.14