GDAL

- Main Page
- Related Pages
- Classes
- Files
- Download
- Issue Tracker

- File List
- File Members

gdal_proxy.h
1 /******************************************************************************
2 * $Id: gdal_proxy.h 36501 2016-11-25 14:09:24Z rouault $
3 *
4 * Project: GDAL Core
5 * Purpose: GDAL Core C++/Private declarations
6 * Author: Even Rouault <even dot rouault at mines dash paris dot org>
7 *
8 ******************************************************************************
9 * Copyright (c) 2008-2014, Even Rouault <even dot rouault at mines-paris dot org>
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 GDAL_PROXY_H_INCLUDED
31 #define GDAL_PROXY_H_INCLUDED
32
33 #ifndef DOXYGEN_SKIP
34
35 #include "gdal.h"
36
37 #ifdef __cplusplus
38
39 #include "gdal_priv.h"
40 #include "cpl_hash_set.h"
41
42 /* ******************************************************************** */
43 /* GDALProxyDataset */
44 /* ******************************************************************** */
45
46 class CPL_DLL GDALProxyDataset : public GDALDataset
47 {
48 protected:
49 GDALProxyDataset() {};
50
51 virtual GDALDataset *RefUnderlyingDataset() = 0;
52 virtual void UnrefUnderlyingDataset(GDALDataset* poUnderlyingDataset);
53
54 virtual CPLErr IBuildOverviews( const char *, int, int *,
55 int, int *, GDALProgressFunc, void * ) CPL_OVERRIDE;
56 virtual CPLErr IRasterIO( GDALRWFlag, int, int, int, int,
57 void *, int, int, GDALDataType,
58 int, int *, GSpacing, GSpacing, GSpacing,
59 GDALRasterIOExtraArg* psExtraArg ) CPL_OVERRIDE;
60 public:
61
62 virtual char **GetMetadataDomainList() CPL_OVERRIDE;
63 virtual char **GetMetadata( const char * pszDomain ) CPL_OVERRIDE;
64 virtual CPLErr SetMetadata( char ** papszMetadata,
65 const char * pszDomain ) CPL_OVERRIDE;
66 virtual const char *GetMetadataItem( const char * pszName,
67 const char * pszDomain ) CPL_OVERRIDE;
68 virtual CPLErr SetMetadataItem( const char * pszName,
69 const char * pszValue,
70 const char * pszDomain ) CPL_OVERRIDE;
71
72 virtual void FlushCache(void) CPL_OVERRIDE;
73
74 virtual const char *GetProjectionRef(void) CPL_OVERRIDE;
75 virtual CPLErr SetProjection( const char * ) CPL_OVERRIDE;
76
77 virtual CPLErr GetGeoTransform( double * ) CPL_OVERRIDE;
78 virtual CPLErr SetGeoTransform( double * ) CPL_OVERRIDE;
79
80 virtual void *GetInternalHandle( const char * ) CPL_OVERRIDE;
81 virtual GDALDriver *GetDriver(void) CPL_OVERRIDE;
82 virtual char **GetFileList(void) CPL_OVERRIDE;
83
84 virtual int GetGCPCount() CPL_OVERRIDE;
85 virtual const char *GetGCPProjection() CPL_OVERRIDE;
86 virtual const GDAL_GCP *GetGCPs() CPL_OVERRIDE;
87 virtual CPLErr SetGCPs( int nGCPCount, const GDAL_GCP *pasGCPList,
88 const char *pszGCPProjection ) CPL_OVERRIDE;
89
90 virtual CPLErr AdviseRead( int nXOff, int nYOff, int nXSize, int nYSize,
91 int nBufXSize, int nBufYSize,
92 GDALDataType eDT,
93 int nBandCount, int *panBandList,
94 char **papszOptions ) CPL_OVERRIDE;
95
96 virtual CPLErr CreateMaskBand( int nFlags ) CPL_OVERRIDE;
97
98 private:
99 CPL_DISALLOW_COPY_ASSIGN(GDALProxyDataset)
100 };
101
102 /* ******************************************************************** */
103 /* GDALProxyRasterBand */
104 /* ******************************************************************** */
105
106 class CPL_DLL GDALProxyRasterBand : public GDALRasterBand
107 {
108 protected:
109 GDALProxyRasterBand() {};
110
111 virtual GDALRasterBand* RefUnderlyingRasterBand() = 0;
112 virtual void UnrefUnderlyingRasterBand(GDALRasterBand* poUnderlyingRasterBand);
113
114 virtual CPLErr IReadBlock( int, int, void * ) CPL_OVERRIDE;
115 virtual CPLErr IWriteBlock( int, int, void * ) CPL_OVERRIDE;
116 virtual CPLErr IRasterIO( GDALRWFlag, int, int, int, int,
117 void *, int, int, GDALDataType,
118 GSpacing, GSpacing, GDALRasterIOExtraArg* psExtraArg ) CPL_OVERRIDE;
119
120 public:
121
122 virtual char **GetMetadataDomainList() CPL_OVERRIDE;
123 virtual char **GetMetadata( const char * pszDomain ) CPL_OVERRIDE;
124 virtual CPLErr SetMetadata( char ** papszMetadata,
125 const char * pszDomain ) CPL_OVERRIDE;
126 virtual const char *GetMetadataItem( const char * pszName,
127 const char * pszDomain ) CPL_OVERRIDE;
128 virtual CPLErr SetMetadataItem( const char * pszName,
129 const char * pszValue,
130 const char * pszDomain ) CPL_OVERRIDE;
131 virtual CPLErr FlushCache() CPL_OVERRIDE;
132 virtual char **GetCategoryNames() CPL_OVERRIDE;
133 virtual double GetNoDataValue( int *pbSuccess = NULL ) CPL_OVERRIDE;
134 virtual double GetMinimum( int *pbSuccess = NULL ) CPL_OVERRIDE;
135 virtual double GetMaximum(int *pbSuccess = NULL ) CPL_OVERRIDE;
136 virtual double GetOffset( int *pbSuccess = NULL ) CPL_OVERRIDE;
137 virtual double GetScale( int *pbSuccess = NULL ) CPL_OVERRIDE;
138 virtual const char *GetUnitType() CPL_OVERRIDE;
139 virtual GDALColorInterp GetColorInterpretation() CPL_OVERRIDE;
140 virtual GDALColorTable *GetColorTable() CPL_OVERRIDE;
141 virtual CPLErr Fill(double dfRealValue, double dfImaginaryValue = 0) CPL_OVERRIDE;
142
143 virtual CPLErr SetCategoryNames( char ** ) CPL_OVERRIDE;
144 virtual CPLErr SetNoDataValue( double ) CPL_OVERRIDE;
145 virtual CPLErr DeleteNoDataValue() CPL_OVERRIDE;
146 virtual CPLErr SetColorTable( GDALColorTable * ) CPL_OVERRIDE;
147 virtual CPLErr SetColorInterpretation( GDALColorInterp ) CPL_OVERRIDE;
148 virtual CPLErr SetOffset( double ) CPL_OVERRIDE;
149 virtual CPLErr SetScale( double ) CPL_OVERRIDE;
150 virtual CPLErr SetUnitType( const char * ) CPL_OVERRIDE;
151
152 virtual CPLErr GetStatistics( int bApproxOK, int bForce,
153 double *pdfMin, double *pdfMax,
154 double *pdfMean, double *padfStdDev ) CPL_OVERRIDE;
155 virtual CPLErr ComputeStatistics( int bApproxOK,
156 double *pdfMin, double *pdfMax,
157 double *pdfMean, double *pdfStdDev,
158 GDALProgressFunc, void *pProgressData ) CPL_OVERRIDE;
159 virtual CPLErr SetStatistics( double dfMin, double dfMax,
160 double dfMean, double dfStdDev ) CPL_OVERRIDE;
161 virtual CPLErr ComputeRasterMinMax( int, double* ) CPL_OVERRIDE;
162
163 virtual int HasArbitraryOverviews() CPL_OVERRIDE;
164 virtual int GetOverviewCount() CPL_OVERRIDE;
165 virtual GDALRasterBand *GetOverview(int) CPL_OVERRIDE;
166 virtual GDALRasterBand *GetRasterSampleOverview( GUIntBig ) CPL_OVERRIDE;
167 virtual CPLErr BuildOverviews( const char *, int, int *,
168 GDALProgressFunc, void * ) CPL_OVERRIDE;
169
170 virtual CPLErr AdviseRead( int nXOff, int nYOff, int nXSize, int nYSize,
171 int nBufXSize, int nBufYSize,
172 GDALDataType eDT, char **papszOptions ) CPL_OVERRIDE;
173
174 virtual CPLErr GetHistogram( double dfMin, double dfMax,
175 int nBuckets, GUIntBig * panHistogram,
176 int bIncludeOutOfRange, int bApproxOK,
177 GDALProgressFunc, void *pProgressData ) CPL_OVERRIDE;
178
179 virtual CPLErr GetDefaultHistogram( double *pdfMin, double *pdfMax,
180 int *pnBuckets, GUIntBig ** ppanHistogram,
181 int bForce,
182 GDALProgressFunc, void *pProgressData) CPL_OVERRIDE;
183 virtual CPLErr SetDefaultHistogram( double dfMin, double dfMax,
184 int nBuckets, GUIntBig *panHistogram ) CPL_OVERRIDE;
185
186 virtual GDALRasterAttributeTable *GetDefaultRAT() CPL_OVERRIDE;
187 virtual CPLErr SetDefaultRAT( const GDALRasterAttributeTable * ) CPL_OVERRIDE;
188
189 virtual GDALRasterBand *GetMaskBand() CPL_OVERRIDE;
190 virtual int GetMaskFlags() CPL_OVERRIDE;
191 virtual CPLErr CreateMaskBand( int nFlags ) CPL_OVERRIDE;
192
193 virtual CPLVirtualMem *GetVirtualMemAuto( GDALRWFlag eRWFlag,
194 int *pnPixelSpace,
195 GIntBig *pnLineSpace,
196 char **papszOptions ) CPL_OVERRIDE;
197 private:
198 CPL_DISALLOW_COPY_ASSIGN(GDALProxyRasterBand)
199 };
200
201 /* ******************************************************************** */
202 /* GDALProxyPoolDataset */
203 /* ******************************************************************** */
204
205 typedef struct _GDALProxyPoolCacheEntry GDALProxyPoolCacheEntry;
206 class GDALProxyPoolRasterBand;
207
208 class CPL_DLL GDALProxyPoolDataset : public GDALProxyDataset
209 {
210 private:
211 GIntBig responsiblePID;
212
213 char *pszProjectionRef;
214 double adfGeoTransform[6];
215 int bHasSrcProjection;
216 int bHasSrcGeoTransform;
217 char *pszGCPProjection;
218 int nGCPCount;
219 GDAL_GCP *pasGCPList;
220 CPLHashSet *metadataSet;
221 CPLHashSet *metadataItemSet;
222
223 GDALProxyPoolCacheEntry* cacheEntry;
224
225 protected:
226 virtual GDALDataset *RefUnderlyingDataset() CPL_OVERRIDE;
227 virtual void UnrefUnderlyingDataset(GDALDataset* poUnderlyingDataset) CPL_OVERRIDE;
228
229 friend class GDALProxyPoolRasterBand;
230
231 public:
232 GDALProxyPoolDataset(const char* pszSourceDatasetDescription,
233 int nRasterXSize, int nRasterYSize,
234 GDALAccess eAccess = GA_ReadOnly,
235 int bShared = FALSE,
236 const char * pszProjectionRef = NULL,
237 double * padfGeoTransform = NULL);
238 virtual ~GDALProxyPoolDataset();
239
240 void SetOpenOptions(char** papszOpenOptions);
241 void AddSrcBandDescription( GDALDataType eDataType, int nBlockXSize, int nBlockYSize);
242
243 virtual const char *GetProjectionRef(void) CPL_OVERRIDE;
244 virtual CPLErr SetProjection( const char * ) CPL_OVERRIDE;
245
246 virtual CPLErr GetGeoTransform( double * ) CPL_OVERRIDE;
247 virtual CPLErr SetGeoTransform( double * ) CPL_OVERRIDE;
248
249 /* Special behaviour for the following methods : they return a pointer */
250 /* data type, that must be cached by the proxy, so it doesn't become invalid */
251 /* when the underlying object get closed */
252 virtual char **GetMetadata( const char * pszDomain ) CPL_OVERRIDE;
253 virtual const char *GetMetadataItem( const char * pszName,
254 const char * pszDomain ) CPL_OVERRIDE;
255
256 virtual void *GetInternalHandle( const char * pszRequest ) CPL_OVERRIDE;
257
258 virtual const char *GetGCPProjection() CPL_OVERRIDE;
259 virtual const GDAL_GCP *GetGCPs() CPL_OVERRIDE;
260 private:
261 CPL_DISALLOW_COPY_ASSIGN(GDALProxyPoolDataset)
262 };
263
264 /* ******************************************************************** */
265 /* GDALProxyPoolRasterBand */
266 /* ******************************************************************** */
267
268 class GDALProxyPoolOverviewRasterBand;
269 class GDALProxyPoolMaskBand;
270
271 class CPL_DLL GDALProxyPoolRasterBand : public GDALProxyRasterBand
272 {
273 private:
274 CPLHashSet *metadataSet;
275 CPLHashSet *metadataItemSet;
276 char *pszUnitType;
277 char **papszCategoryNames;
278 GDALColorTable *poColorTable;
279
280 int nSizeProxyOverviewRasterBand;
281 GDALProxyPoolOverviewRasterBand **papoProxyOverviewRasterBand;
282 GDALProxyPoolMaskBand *poProxyMaskBand;
283
284 void Init();
285
286 protected:
287 virtual GDALRasterBand* RefUnderlyingRasterBand() CPL_OVERRIDE;
288 virtual void UnrefUnderlyingRasterBand(GDALRasterBand* poUnderlyingRasterBand) CPL_OVERRIDE;
289
290 friend class GDALProxyPoolOverviewRasterBand;
291 friend class GDALProxyPoolMaskBand;
292
293 public:
294 GDALProxyPoolRasterBand(GDALProxyPoolDataset* poDS, int nBand,
295 GDALDataType eDataType,
296 int nBlockXSize, int nBlockYSize);
297 GDALProxyPoolRasterBand(GDALProxyPoolDataset* poDS,
298 GDALRasterBand* poUnderlyingRasterBand);
299 virtual ~GDALProxyPoolRasterBand();
300
301 void AddSrcMaskBandDescription( GDALDataType eDataType, int nBlockXSize, int nBlockYSize);
302
303 /* Special behaviour for the following methods : they return a pointer */
304 /* data type, that must be cached by the proxy, so it doesn't become invalid */
305 /* when the underlying object get closed */
306 virtual char **GetMetadata( const char * pszDomain ) CPL_OVERRIDE;
307 virtual const char *GetMetadataItem( const char * pszName,
308 const char * pszDomain ) CPL_OVERRIDE;
309 virtual char **GetCategoryNames() CPL_OVERRIDE;
310 virtual const char *GetUnitType() CPL_OVERRIDE;
311 virtual GDALColorTable *GetColorTable() CPL_OVERRIDE;
312 virtual GDALRasterBand *GetOverview(int) CPL_OVERRIDE;
313 virtual GDALRasterBand *GetRasterSampleOverview( GUIntBig nDesiredSamples) CPL_OVERRIDE; // TODO
314 virtual GDALRasterBand *GetMaskBand() CPL_OVERRIDE;
315 private:
316 CPL_DISALLOW_COPY_ASSIGN(GDALProxyPoolRasterBand)
317 };
318
319 /* ******************************************************************** */
320 /* GDALProxyPoolOverviewRasterBand */
321 /* ******************************************************************** */
322
323 class GDALProxyPoolOverviewRasterBand : public GDALProxyPoolRasterBand
324 {
325 private:
326 GDALProxyPoolRasterBand *poMainBand;
327 int nOverviewBand;
328
329 GDALRasterBand *poUnderlyingMainRasterBand;
330 int nRefCountUnderlyingMainRasterBand;
331
332 protected:
333 virtual GDALRasterBand* RefUnderlyingRasterBand() CPL_OVERRIDE;
334 virtual void UnrefUnderlyingRasterBand(GDALRasterBand* poUnderlyingRasterBand) CPL_OVERRIDE;
335
336 public:
337 GDALProxyPoolOverviewRasterBand(GDALProxyPoolDataset* poDS,
338 GDALRasterBand* poUnderlyingOverviewBand,
339 GDALProxyPoolRasterBand* poMainBand,
340 int nOverviewBand);
341 virtual ~GDALProxyPoolOverviewRasterBand();
342 };
343
344 /* ******************************************************************** */
345 /* GDALProxyPoolMaskBand */
346 /* ******************************************************************** */
347
348 class GDALProxyPoolMaskBand : public GDALProxyPoolRasterBand
349 {
350 private:
351 GDALProxyPoolRasterBand *poMainBand;
352
353 GDALRasterBand *poUnderlyingMainRasterBand;
354 int nRefCountUnderlyingMainRasterBand;
355
356 protected:
357 virtual GDALRasterBand* RefUnderlyingRasterBand() CPL_OVERRIDE;
358 virtual void UnrefUnderlyingRasterBand(GDALRasterBand* poUnderlyingRasterBand) CPL_OVERRIDE;
359
360 public:
361 GDALProxyPoolMaskBand(GDALProxyPoolDataset* poDS,
362 GDALRasterBand* poUnderlyingMaskBand,
363 GDALProxyPoolRasterBand* poMainBand);
364 GDALProxyPoolMaskBand(GDALProxyPoolDataset* poDS,
365 GDALProxyPoolRasterBand* poMainBand,
366 GDALDataType eDataType,
367 int nBlockXSize, int nBlockYSize);
368 virtual ~GDALProxyPoolMaskBand();
369 };
370
371 #endif
372
373 /* ******************************************************************** */
374 /* C types and methods declarations */
375 /* ******************************************************************** */
376
377 CPL_C_START
378
379 typedef struct GDALProxyPoolDatasetHS *GDALProxyPoolDatasetH;
380
381 GDALProxyPoolDatasetH CPL_DLL GDALProxyPoolDatasetCreate(const char* pszSourceDatasetDescription,
382 int nRasterXSize, int nRasterYSize,
383 GDALAccess eAccess, int bShared,
384 const char * pszProjectionRef,
385 double * padfGeoTransform);
386
387 void CPL_DLL GDALProxyPoolDatasetDelete(GDALProxyPoolDatasetH hProxyPoolDataset);
388
389 void CPL_DLL GDALProxyPoolDatasetAddSrcBandDescription( GDALProxyPoolDatasetH hProxyPoolDataset,
390 GDALDataType eDataType,
391 int nBlockXSize, int nBlockYSize);
392
393 CPL_C_END
394
395 #endif /* #ifndef DOXYGEN_SKIP */
396
397 #endif /* GDAL_PROXY_H_INCLUDED */
GDALRasterAttributeTable
The GDALRasterAttributeTable (or RAT) class is used to encapsulate a table used to provide attribute ...
Definition: gdal_rat.h:46
GDALDataType
GDALDataType
Definition: gdal.h:57
CPL_C_START
#define CPL_C_START
Macro to start a block of C symbols.
Definition: cpl_port.h:352
gdal_priv.h
C++ GDAL entry points.
CPL_OVERRIDE
#define CPL_OVERRIDE
To be used in public headers only.
Definition: cpl_port.h:1055
GDALRWFlag
GDALRWFlag
Definition: gdal.h:105
cpl_hash_set.h
Hash set implementation.
CPLVirtualMem
struct CPLVirtualMem CPLVirtualMem
Opaque type that represents a virtual memory mapping.
Definition: cpl_virtualmem.h:62
GSpacing
GIntBig GSpacing
Type to express pixel, line or band spacing.
Definition: gdal.h:259
gdal.h
Public (C callable) GDAL entry points.
GDALRasterIOExtraArg
Structure to pass extra arguments to RasterIO() method.
Definition: gdal.h:133
GUIntBig
unsigned long long GUIntBig
Large unsigned integer type (generally 64-bit unsigned integer type).
Definition: cpl_port.h:253
GDALRasterBand
A single raster band (or channel).
Definition: gdal_priv.h:829
GDALAccess
GDALAccess
Definition: gdal.h:99
GDALDataset
A set of associated raster bands, usually from one file.
Definition: gdal_priv.h:322
CPL_C_END
#define CPL_C_END
Macro to end a block of C symbols.
Definition: cpl_port.h:354
GIntBig
long long GIntBig
Large signed integer type (generally 64-bit integer type).
Definition: cpl_port.h:250
GDALColorInterp
GDALColorInterp
Definition: gdal.h:176
CPLHashSet
struct _CPLHashSet CPLHashSet
Opaque type for a hash set.
Definition: cpl_hash_set.h:52
GA_ReadOnly
Definition: gdal.h:100
GDALDriver
Format specific driver.
Definition: gdal_priv.h:1160
GDALColorTable
A color table / palette.
Definition: gdal_priv.h:749
GDAL_GCP
Ground Control Point.
Definition: gdal.h:514
CPLErr
CPLErr
Error category.
Definition: cpl_error.h:52
CPL_DISALLOW_COPY_ASSIGN
#define CPL_DISALLOW_COPY_ASSIGN(ClassName)
Helper to remove the copy and assignment constructors so that the compiler will not generate the defa...
Definition: cpl_port.h:1085

Generated for GDAL by 1.8.9.1.