Coverage Report

Created: 2025-11-16 06:25

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/gdal/gcore/gdal_asyncreader.h
Line
Count
Source
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
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
0
    {
63
0
        return poDS;
64
0
    }
65
66
    /** Return x offset.
67
     * @return x offset.
68
     */
69
    int GetXOffset() const
70
0
    {
71
0
        return nXOff;
72
0
    }
73
74
    /** Return y offset.
75
     * @return y offset.
76
     */
77
    int GetYOffset() const
78
0
    {
79
0
        return nYOff;
80
0
    }
81
82
    /** Return width.
83
     * @return width
84
     */
85
    int GetXSize() const
86
0
    {
87
0
        return nXSize;
88
0
    }
89
90
    /** Return height.
91
     * @return height
92
     */
93
    int GetYSize() const
94
0
    {
95
0
        return nYSize;
96
0
    }
97
98
    /** Return buffer.
99
     * @return buffer
100
     */
101
    void *GetBuffer()
102
0
    {
103
0
        return pBuf;
104
0
    }
105
106
    /** Return buffer width.
107
     * @return buffer width.
108
     */
109
    int GetBufferXSize() const
110
0
    {
111
0
        return nBufXSize;
112
0
    }
113
114
    /** Return buffer height.
115
     * @return buffer height.
116
     */
117
    int GetBufferYSize() const
118
0
    {
119
0
        return nBufYSize;
120
0
    }
121
122
    /** Return buffer data type.
123
     * @return buffer data type.
124
     */
125
    GDALDataType GetBufferType() const
126
0
    {
127
0
        return eBufType;
128
0
    }
129
130
    /** Return band count.
131
     * @return band count
132
     */
133
    int GetBandCount() const
134
0
    {
135
0
        return nBandCount;
136
0
    }
137
138
    /** Return band map.
139
     * @return band map.
140
     */
141
    int *GetBandMap()
142
0
    {
143
0
        return panBandMap;
144
0
    }
145
146
    /** Return pixel spacing.
147
     * @return pixel spacing.
148
     */
149
    int GetPixelSpace() const
150
0
    {
151
0
        return nPixelSpace;
152
0
    }
153
154
    /** Return line spacing.
155
     * @return line spacing.
156
     */
157
    int GetLineSpace() const
158
0
    {
159
0
        return nLineSpace;
160
0
    }
161
162
    /** Return band spacing.
163
     * @return band spacing.
164
     */
165
    int GetBandSpace() const
166
0
    {
167
0
        return nBandSpace;
168
0
    }
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