Line data Source code
1 : /****************************************************************************** 2 : * 3 : * Project: GDAL Core 4 : * Purpose: Declaration of GDALAsyncReader base class. 5 : * Author: Frank Warmerdam, warmerdam@pobox.com 6 : * 7 : ****************************************************************************** 8 : * Copyright (c) 2010, Frank Warmerdam 9 : * 10 : * SPDX-License-Identifier: MIT 11 : ****************************************************************************/ 12 : 13 : #ifndef GDALASYNCREADER_H_INCLUDED 14 : #define GDALASYNCREADER_H_INCLUDED 15 : 16 : #include "cpl_port.h" 17 : 18 : #include "gdal.h" 19 : 20 : class GDALDataset; 21 : 22 : /* ******************************************************************** */ 23 : /* GDALAsyncReader */ 24 : /* ******************************************************************** */ 25 : 26 : /** 27 : * Class used as a session object for asynchronous requests. They are 28 : * created with GDALDataset::BeginAsyncReader(), and destroyed with 29 : * GDALDataset::EndAsyncReader(). 30 : */ 31 1 : class CPL_DLL GDALAsyncReader 32 : { 33 : 34 : CPL_DISALLOW_COPY_ASSIGN(GDALAsyncReader) 35 : 36 : protected: 37 : //! @cond Doxygen_Suppress 38 : GDALDataset *poDS; 39 : int nXOff; 40 : int nYOff; 41 : int nXSize; 42 : int nYSize; 43 : void *pBuf; 44 : int nBufXSize; 45 : int nBufYSize; 46 : GDALDataType eBufType; 47 : int nBandCount; 48 : int *panBandMap; 49 : int nPixelSpace; 50 : int nLineSpace; 51 : int nBandSpace; 52 : //! @endcond 53 : 54 : public: 55 : GDALAsyncReader(); 56 : virtual ~GDALAsyncReader(); 57 : 58 : /** Return dataset. 59 : * @return dataset 60 : */ 61 : GDALDataset *GetGDALDataset() 62 : { 63 : return poDS; 64 : } 65 : 66 : /** Return x offset. 67 : * @return x offset. 68 : */ 69 : int GetXOffset() const 70 : { 71 : return nXOff; 72 : } 73 : 74 : /** Return y offset. 75 : * @return y offset. 76 : */ 77 : int GetYOffset() const 78 : { 79 : return nYOff; 80 : } 81 : 82 : /** Return width. 83 : * @return width 84 : */ 85 : int GetXSize() const 86 : { 87 : return nXSize; 88 : } 89 : 90 : /** Return height. 91 : * @return height 92 : */ 93 : int GetYSize() const 94 : { 95 : return nYSize; 96 : } 97 : 98 : /** Return buffer. 99 : * @return buffer 100 : */ 101 : void *GetBuffer() 102 : { 103 : return pBuf; 104 : } 105 : 106 : /** Return buffer width. 107 : * @return buffer width. 108 : */ 109 : int GetBufferXSize() const 110 : { 111 : return nBufXSize; 112 : } 113 : 114 : /** Return buffer height. 115 : * @return buffer height. 116 : */ 117 : int GetBufferYSize() const 118 : { 119 : return nBufYSize; 120 : } 121 : 122 : /** Return buffer data type. 123 : * @return buffer data type. 124 : */ 125 : GDALDataType GetBufferType() const 126 : { 127 : return eBufType; 128 : } 129 : 130 : /** Return band count. 131 : * @return band count 132 : */ 133 : int GetBandCount() const 134 : { 135 : return nBandCount; 136 : } 137 : 138 : /** Return band map. 139 : * @return band map. 140 : */ 141 : int *GetBandMap() 142 : { 143 : return panBandMap; 144 : } 145 : 146 : /** Return pixel spacing. 147 : * @return pixel spacing. 148 : */ 149 : int GetPixelSpace() const 150 : { 151 : return nPixelSpace; 152 : } 153 : 154 : /** Return line spacing. 155 : * @return line spacing. 156 : */ 157 : int GetLineSpace() const 158 : { 159 : return nLineSpace; 160 : } 161 : 162 : /** Return band spacing. 163 : * @return band spacing. 164 : */ 165 : int GetBandSpace() const 166 : { 167 : return nBandSpace; 168 : } 169 : 170 : virtual GDALAsyncStatusType 171 : GetNextUpdatedRegion(double dfTimeout, int *pnBufXOff, int *pnBufYOff, 172 : int *pnBufXSize, int *pnBufYSize) = 0; 173 : virtual int LockBuffer(double dfTimeout = -1.0); 174 : virtual void UnlockBuffer(); 175 : }; 176 : 177 : #endif