1 /******************************************************************************
2  * $Id: pcrasterrasterband.h d23b5a0d22b88657e4fc31f2513701842f0b0585 2019-08-11 03:09:59 +0200 Even Rouault $
3  *
4  * Project:  PCRaster Integration
5  * Purpose:  PCRaster raster band declaration.
6  * Author:   Kor de Jong, Oliver Schmitz
7  *
8  ******************************************************************************
9  * Copyright (c) PCRaster owners
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 #ifndef INCLUDED_PCRASTERRASTERBAND
31 #define INCLUDED_PCRASTERRASTERBAND
32 
33 #include "gdal_pam.h"
34 
35 // namespace {
36   // PCRasterRasterBand declarations.
37 // }
38 class PCRasterDataset;
39 
40 // namespace {
41 
42 //! This class specialises the GDALRasterBand class for PCRaster rasters.
43 /*!
44 */
45 class PCRasterRasterBand final: public GDALPamRasterBand
46 {
47 
48 private:
49 
50   //! Dataset this band is part of. For use only.
51   PCRasterDataset const* d_dataset;
52 
53   double           d_noDataValue;
54   bool             d_defaultNoDataValueOverridden;
55   GDALDataType     d_create_in;
56 
57   virtual CPLErr   IRasterIO           (GDALRWFlag, int, int, int, int,
58                                         void *, int, int, GDALDataType,
59                                         GSpacing nPixelSpace,
60                                         GSpacing nLineSpace,
61                                         GDALRasterIOExtraArg* psExtraArg) override;
62 
63   //! Assignment operator. NOT IMPLEMENTED.
64   PCRasterRasterBand& operator=        (const PCRasterRasterBand&);
65 
66   //! Copy constructor. NOT IMPLEMENTED.
67                    PCRasterRasterBand  (const PCRasterRasterBand&);
68 
69 protected:
70   // cppcheck-suppress functionConst
71   double           GetNoDataValue      (int* success=nullptr) override;
72   double           GetMinimum          (int* success) override;
73   double           GetMaximum          (int* success) override;
74 
75 public:
76   explicit          PCRasterRasterBand  (PCRasterDataset* dataset);
77   /* virtual */    ~PCRasterRasterBand ();
78 
79   //----------------------------------------------------------------------------
80   // MANIPULATORS
81   //----------------------------------------------------------------------------
82 
83   CPLErr           IWriteBlock         (CPL_UNUSED int nBlockXoff,
84                                         int nBlockYoff,
85                                         void* buffer) override;
86 
87   CPLErr           SetNoDataValue      (double no_data) override;
88 
89   //----------------------------------------------------------------------------
90   // ACCESSORS
91   //----------------------------------------------------------------------------
92 
93   CPLErr           IReadBlock          (int nBlockXoff,
94                                         int nBlockYoff,
95                                         void* buffer) override;
96 };
97 // } // namespace
98 
99 #endif
100