Line data Source code
1 : /******************************************************************************
2 : * $Id$
3 : *
4 : * Project: OpenGIS Simple Features Reference Implementation
5 : * Purpose: Classes related to format registration, and file opening.
6 : * Author: Frank Warmerdam, warmerda@home.com
7 : *
8 : ******************************************************************************
9 : * Copyright (c) 1999, Les Technologies SoftMap Inc.
10 : * Copyright (c) 2007-2014, Even Rouault <even dot rouault at spatialys.com>
11 : *
12 : * SPDX-License-Identifier: MIT
13 : ****************************************************************************/
14 :
15 : #ifndef OGRSF_FRMTS_H_INCLUDED
16 : #define OGRSF_FRMTS_H_INCLUDED
17 :
18 : #include "cpl_progress.h"
19 : #include "ogr_feature.h"
20 : #include "ogr_featurestyle.h"
21 : #include "gdal_priv.h"
22 :
23 : #include <memory>
24 : #include <deque>
25 :
26 : /**
27 : * \file ogrsf_frmts.h
28 : *
29 : * Classes related to registration of format support, and opening datasets.
30 : */
31 :
32 : //! @cond Doxygen_Suppress
33 : #if !defined(GDAL_COMPILATION) && !defined(SUPPRESS_DEPRECATION_WARNINGS)
34 : #define OGR_DEPRECATED(x) CPL_WARN_DEPRECATED(x)
35 : #else
36 : #define OGR_DEPRECATED(x)
37 : #endif
38 : //! @endcond
39 :
40 : class OGRLayerAttrIndex;
41 : class OGRSFDriver;
42 :
43 : struct ArrowArrayStream;
44 :
45 : /************************************************************************/
46 : /* OGRLayer */
47 : /************************************************************************/
48 :
49 : /**
50 : * This class represents a layer of simple features, with access methods.
51 : *
52 : */
53 :
54 : /* Note: any virtual method added to this class must also be added in the */
55 : /* OGRLayerDecorator and OGRMutexedLayer classes. */
56 :
57 : class CPL_DLL OGRLayer : public GDALMajorObject
58 : {
59 : private:
60 : struct Private;
61 : std::unique_ptr<Private> m_poPrivate;
62 :
63 : void ConvertGeomsIfNecessary(OGRFeature *poFeature);
64 :
65 : class CPL_DLL FeatureIterator
66 : {
67 : struct Private;
68 : std::unique_ptr<Private> m_poPrivate;
69 :
70 : public:
71 : FeatureIterator(OGRLayer *poLayer, bool bStart);
72 : FeatureIterator(
73 : FeatureIterator &&oOther) noexcept; // declared but not defined.
74 : // Needed for gcc 5.4 at least
75 : ~FeatureIterator();
76 : OGRFeatureUniquePtr &operator*();
77 : FeatureIterator &operator++();
78 : bool operator!=(const FeatureIterator &it) const;
79 : };
80 :
81 : friend inline FeatureIterator begin(OGRLayer *poLayer);
82 : friend inline FeatureIterator end(OGRLayer *poLayer);
83 :
84 : CPL_DISALLOW_COPY_ASSIGN(OGRLayer)
85 :
86 : protected:
87 : //! @cond Doxygen_Suppress
88 : int m_bFilterIsEnvelope;
89 : OGRGeometry *m_poFilterGeom;
90 : OGRPreparedGeometry *m_pPreparedFilterGeom; /* m_poFilterGeom compiled as a
91 : prepared geometry */
92 : OGREnvelope m_sFilterEnvelope;
93 : int m_iGeomFieldFilter; // specify the index on which the spatial
94 : // filter is active.
95 :
96 : int FilterGeometry(const OGRGeometry *);
97 : // int FilterGeometry( OGRGeometry *, OGREnvelope*
98 : // psGeometryEnvelope);
99 : int InstallFilter(OGRGeometry *);
100 : bool
101 : ValidateGeometryFieldIndexForSetSpatialFilter(int iGeomField,
102 : const OGRGeometry *poGeomIn,
103 : bool bIsSelectLayer = false);
104 :
105 : OGRErr GetExtentInternal(int iGeomField, OGREnvelope *psExtent, int bForce);
106 : //! @endcond
107 :
108 : virtual OGRErr ISetFeature(OGRFeature *poFeature) CPL_WARN_UNUSED_RESULT;
109 : virtual OGRErr ICreateFeature(OGRFeature *poFeature) CPL_WARN_UNUSED_RESULT;
110 : virtual OGRErr IUpsertFeature(OGRFeature *poFeature) CPL_WARN_UNUSED_RESULT;
111 : virtual OGRErr
112 : IUpdateFeature(OGRFeature *poFeature, int nUpdatedFieldsCount,
113 : const int *panUpdatedFieldsIdx, int nUpdatedGeomFieldsCount,
114 : const int *panUpdatedGeomFieldsIdx,
115 : bool bUpdateStyleString) CPL_WARN_UNUSED_RESULT;
116 :
117 : //! @cond Doxygen_Suppress
118 : CPLStringList m_aosArrowArrayStreamOptions{};
119 :
120 : friend struct OGRGenSQLResultsLayerArrowStreamPrivateData;
121 :
122 : struct ArrowArrayStreamPrivateData
123 : {
124 : bool m_bArrowArrayStreamInProgress = false;
125 : bool m_bEOF = false;
126 : OGRLayer *m_poLayer = nullptr;
127 : std::vector<GIntBig> m_anQueriedFIDs{};
128 : size_t m_iQueriedFIDS = 0;
129 : std::deque<std::unique_ptr<OGRFeature>> m_oFeatureQueue{};
130 : };
131 :
132 : std::shared_ptr<ArrowArrayStreamPrivateData>
133 : m_poSharedArrowArrayStreamPrivateData{};
134 :
135 : struct ArrowArrayStreamPrivateDataSharedDataWrapper
136 : {
137 : std::shared_ptr<ArrowArrayStreamPrivateData> poShared{};
138 : };
139 : //! @endcond
140 :
141 : friend class OGRArrowArrayHelper;
142 : friend class OGRGenSQLResultsLayer;
143 : static void ReleaseArray(struct ArrowArray *array);
144 : static void ReleaseSchema(struct ArrowSchema *schema);
145 : static void ReleaseStream(struct ArrowArrayStream *stream);
146 : virtual int GetArrowSchema(struct ArrowArrayStream *,
147 : struct ArrowSchema *out_schema);
148 : virtual int GetNextArrowArray(struct ArrowArrayStream *,
149 : struct ArrowArray *out_array);
150 : static int StaticGetArrowSchema(struct ArrowArrayStream *,
151 : struct ArrowSchema *out_schema);
152 : static int StaticGetNextArrowArray(struct ArrowArrayStream *,
153 : struct ArrowArray *out_array);
154 : static const char *GetLastErrorArrowArrayStream(struct ArrowArrayStream *);
155 :
156 : static struct ArrowSchema *
157 : CreateSchemaForWKBGeometryColumn(const OGRGeomFieldDefn *poFieldDefn,
158 : const char *pszArrowFormat,
159 : const char *pszExtensionName);
160 :
161 : virtual bool
162 : CanPostFilterArrowArray(const struct ArrowSchema *schema) const;
163 : void PostFilterArrowArray(const struct ArrowSchema *schema,
164 : struct ArrowArray *array,
165 : CSLConstList papszOptions) const;
166 :
167 : //! @cond Doxygen_Suppress
168 : bool CreateFieldFromArrowSchemaInternal(const struct ArrowSchema *schema,
169 : const std::string &osFieldPrefix,
170 : CSLConstList papszOptions);
171 : //! @endcond
172 :
173 : public:
174 : OGRLayer();
175 : virtual ~OGRLayer();
176 :
177 : /** Return begin of feature iterator.
178 : *
179 : * Using this iterator for standard range-based loops is safe, but
180 : * due to implementation limitations, you shouldn't try to access
181 : * (dereference) more than one iterator step at a time, since the
182 : * OGRFeatureUniquePtr reference is reused.
183 : *
184 : * Only one iterator per layer can be active at a time.
185 : * @since GDAL 2.3
186 : */
187 : FeatureIterator begin();
188 :
189 : /** Return end of feature iterator. */
190 : FeatureIterator end();
191 :
192 : virtual OGRGeometry *GetSpatialFilter();
193 : virtual void SetSpatialFilter(OGRGeometry *);
194 : virtual void SetSpatialFilterRect(double dfMinX, double dfMinY,
195 : double dfMaxX, double dfMaxY);
196 :
197 : virtual void SetSpatialFilter(int iGeomField, OGRGeometry *);
198 : virtual void SetSpatialFilterRect(int iGeomField, double dfMinX,
199 : double dfMinY, double dfMaxX,
200 : double dfMaxY);
201 :
202 : virtual OGRErr SetAttributeFilter(const char *);
203 :
204 : virtual void ResetReading() = 0;
205 : virtual OGRFeature *GetNextFeature() CPL_WARN_UNUSED_RESULT = 0;
206 : virtual OGRErr SetNextByIndex(GIntBig nIndex);
207 : virtual OGRFeature *GetFeature(GIntBig nFID) CPL_WARN_UNUSED_RESULT;
208 :
209 : virtual GDALDataset *GetDataset();
210 : virtual bool GetArrowStream(struct ArrowArrayStream *out_stream,
211 : CSLConstList papszOptions = nullptr);
212 : virtual bool IsArrowSchemaSupported(const struct ArrowSchema *schema,
213 : CSLConstList papszOptions,
214 : std::string &osErrorMsg) const;
215 : virtual bool
216 : CreateFieldFromArrowSchema(const struct ArrowSchema *schema,
217 : CSLConstList papszOptions = nullptr);
218 : virtual bool WriteArrowBatch(const struct ArrowSchema *schema,
219 : struct ArrowArray *array,
220 : CSLConstList papszOptions = nullptr);
221 :
222 : OGRErr SetFeature(OGRFeature *poFeature) CPL_WARN_UNUSED_RESULT;
223 : OGRErr CreateFeature(OGRFeature *poFeature) CPL_WARN_UNUSED_RESULT;
224 : OGRErr UpsertFeature(OGRFeature *poFeature) CPL_WARN_UNUSED_RESULT;
225 : OGRErr UpdateFeature(OGRFeature *poFeature, int nUpdatedFieldsCount,
226 : const int *panUpdatedFieldsIdx,
227 : int nUpdatedGeomFieldsCount,
228 : const int *panUpdatedGeomFieldsIdx,
229 : bool bUpdateStyleString) CPL_WARN_UNUSED_RESULT;
230 :
231 : virtual OGRErr DeleteFeature(GIntBig nFID) CPL_WARN_UNUSED_RESULT;
232 :
233 : virtual const char *GetName();
234 : virtual OGRwkbGeometryType GetGeomType();
235 : virtual OGRFeatureDefn *GetLayerDefn() = 0;
236 : virtual int FindFieldIndex(const char *pszFieldName, int bExactMatch);
237 :
238 : virtual OGRSpatialReference *GetSpatialRef();
239 :
240 : /** Return type of OGRLayer::GetSupportedSRSList() */
241 : typedef std::vector<
242 : std::unique_ptr<OGRSpatialReference, OGRSpatialReferenceReleaser>>
243 : GetSupportedSRSListRetType;
244 : virtual const GetSupportedSRSListRetType &
245 : GetSupportedSRSList(int iGeomField);
246 : virtual OGRErr SetActiveSRS(int iGeomField,
247 : const OGRSpatialReference *poSRS);
248 :
249 : virtual GIntBig GetFeatureCount(int bForce = TRUE);
250 : virtual OGRErr GetExtent(OGREnvelope *psExtent,
251 : int bForce = TRUE) CPL_WARN_UNUSED_RESULT;
252 : virtual OGRErr GetExtent(int iGeomField, OGREnvelope *psExtent,
253 : int bForce = TRUE) CPL_WARN_UNUSED_RESULT;
254 :
255 : virtual OGRErr GetExtent3D(int iGeomField, OGREnvelope3D *psExtent3D,
256 : int bForce = TRUE) CPL_WARN_UNUSED_RESULT;
257 :
258 : virtual int TestCapability(const char *) = 0;
259 :
260 : virtual OGRErr Rename(const char *pszNewName) CPL_WARN_UNUSED_RESULT;
261 :
262 : virtual OGRErr CreateField(const OGRFieldDefn *poField,
263 : int bApproxOK = TRUE);
264 : virtual OGRErr DeleteField(int iField);
265 : virtual OGRErr ReorderFields(int *panMap);
266 : virtual OGRErr AlterFieldDefn(int iField, OGRFieldDefn *poNewFieldDefn,
267 : int nFlagsIn);
268 : virtual OGRErr
269 : AlterGeomFieldDefn(int iGeomField,
270 : const OGRGeomFieldDefn *poNewGeomFieldDefn,
271 : int nFlagsIn);
272 :
273 : virtual OGRErr CreateGeomField(const OGRGeomFieldDefn *poField,
274 : int bApproxOK = TRUE);
275 :
276 : virtual OGRErr SyncToDisk();
277 :
278 : virtual OGRStyleTable *GetStyleTable();
279 : virtual void SetStyleTableDirectly(OGRStyleTable *poStyleTable);
280 :
281 : virtual void SetStyleTable(OGRStyleTable *poStyleTable);
282 :
283 : virtual OGRErr StartTransaction() CPL_WARN_UNUSED_RESULT;
284 : virtual OGRErr CommitTransaction() CPL_WARN_UNUSED_RESULT;
285 : virtual OGRErr RollbackTransaction();
286 :
287 : virtual const char *GetFIDColumn();
288 : virtual const char *GetGeometryColumn();
289 :
290 : virtual OGRErr SetIgnoredFields(CSLConstList papszFields);
291 :
292 : virtual OGRGeometryTypeCounter *
293 : GetGeometryTypes(int iGeomField, int nFlagsGGT, int &nEntryCountOut,
294 : GDALProgressFunc pfnProgress, void *pProgressData);
295 :
296 : OGRErr Intersection(OGRLayer *pLayerMethod, OGRLayer *pLayerResult,
297 : char **papszOptions = nullptr,
298 : GDALProgressFunc pfnProgress = nullptr,
299 : void *pProgressArg = nullptr);
300 : OGRErr Union(OGRLayer *pLayerMethod, OGRLayer *pLayerResult,
301 : char **papszOptions = nullptr,
302 : GDALProgressFunc pfnProgress = nullptr,
303 : void *pProgressArg = nullptr);
304 : OGRErr SymDifference(OGRLayer *pLayerMethod, OGRLayer *pLayerResult,
305 : char **papszOptions, GDALProgressFunc pfnProgress,
306 : void *pProgressArg);
307 : OGRErr Identity(OGRLayer *pLayerMethod, OGRLayer *pLayerResult,
308 : char **papszOptions = nullptr,
309 : GDALProgressFunc pfnProgress = nullptr,
310 : void *pProgressArg = nullptr);
311 : OGRErr Update(OGRLayer *pLayerMethod, OGRLayer *pLayerResult,
312 : char **papszOptions = nullptr,
313 : GDALProgressFunc pfnProgress = nullptr,
314 : void *pProgressArg = nullptr);
315 : OGRErr Clip(OGRLayer *pLayerMethod, OGRLayer *pLayerResult,
316 : char **papszOptions = nullptr,
317 : GDALProgressFunc pfnProgress = nullptr,
318 : void *pProgressArg = nullptr);
319 : OGRErr Erase(OGRLayer *pLayerMethod, OGRLayer *pLayerResult,
320 : char **papszOptions = nullptr,
321 : GDALProgressFunc pfnProgress = nullptr,
322 : void *pProgressArg = nullptr);
323 :
324 : int Reference();
325 : int Dereference();
326 : int GetRefCount() const;
327 : //! @cond Doxygen_Suppress
328 : GIntBig GetFeaturesRead();
329 : //! @endcond
330 :
331 : /* non virtual : convenience wrapper for ReorderFields() */
332 : OGRErr ReorderField(int iOldFieldPos, int iNewFieldPos);
333 :
334 : //! @cond Doxygen_Suppress
335 : int AttributeFilterEvaluationNeedsGeometry();
336 :
337 : /* consider these private */
338 : OGRErr InitializeIndexSupport(const char *);
339 :
340 5775 : OGRLayerAttrIndex *GetIndex()
341 : {
342 5775 : return m_poAttrIndex;
343 : }
344 :
345 13 : int GetGeomFieldFilter() const
346 : {
347 13 : return m_iGeomFieldFilter;
348 : }
349 :
350 13 : const char *GetAttrQueryString() const
351 : {
352 13 : return m_pszAttrQueryString;
353 : }
354 :
355 : //! @endcond
356 :
357 : /** Convert a OGRLayer* to a OGRLayerH.
358 : * @since GDAL 2.3
359 : */
360 28468 : static inline OGRLayerH ToHandle(OGRLayer *poLayer)
361 : {
362 28468 : return reinterpret_cast<OGRLayerH>(poLayer);
363 : }
364 :
365 : /** Convert a OGRLayerH to a OGRLayer*.
366 : * @since GDAL 2.3
367 : */
368 698969 : static inline OGRLayer *FromHandle(OGRLayerH hLayer)
369 : {
370 698969 : return reinterpret_cast<OGRLayer *>(hLayer);
371 : }
372 :
373 : //! @cond Doxygen_Suppress
374 : bool FilterWKBGeometry(const GByte *pabyWKB, size_t nWKBSize,
375 : bool bEnvelopeAlreadySet,
376 : OGREnvelope &sEnvelope) const;
377 :
378 : static bool FilterWKBGeometry(const GByte *pabyWKB, size_t nWKBSize,
379 : bool bEnvelopeAlreadySet,
380 : OGREnvelope &sEnvelope,
381 : const OGRGeometry *poFilterGeom,
382 : bool bFilterIsEnvelope,
383 : const OGREnvelope &sFilterEnvelope,
384 : OGRPreparedGeometry *&poPreparedFilterGeom);
385 : //! @endcond
386 :
387 : /** Field name used by GetArrowSchema() for a FID column when
388 : * GetFIDColumn() is not set.
389 : */
390 : static constexpr const char *DEFAULT_ARROW_FID_NAME = "OGC_FID";
391 :
392 : /** Field name used by GetArrowSchema() for the name of the (single)
393 : * geometry column (returned by GetGeometryColumn()) is not set.
394 : */
395 : static constexpr const char *DEFAULT_ARROW_GEOMETRY_NAME = "wkb_geometry";
396 :
397 : protected:
398 : //! @cond Doxygen_Suppress
399 : OGRStyleTable *m_poStyleTable;
400 : OGRFeatureQuery *m_poAttrQuery;
401 : char *m_pszAttrQueryString;
402 : OGRLayerAttrIndex *m_poAttrIndex;
403 :
404 : int m_nRefCount;
405 :
406 : GIntBig m_nFeaturesRead;
407 : //! @endcond
408 : };
409 :
410 : /** Return begin of feature iterator.
411 : *
412 : * Using this iterator for standard range-based loops is safe, but
413 : * due to implementation limitations, you shouldn't try to access
414 : * (dereference) more than one iterator step at a time, since the
415 : * std::unique_ptr<OGRFeature> reference is reused.
416 : *
417 : * Only one iterator per layer can be active at a time.
418 : * @since GDAL 2.3
419 : * @see OGRLayer::begin()
420 : */
421 2385 : inline OGRLayer::FeatureIterator begin(OGRLayer *poLayer)
422 : {
423 2385 : return poLayer->begin();
424 : }
425 :
426 : /** Return end of feature iterator.
427 : * @see OGRLayer::end()
428 : */
429 2385 : inline OGRLayer::FeatureIterator end(OGRLayer *poLayer)
430 : {
431 2385 : return poLayer->end();
432 : }
433 :
434 : /** Unique pointer type for OGRLayer.
435 : * @since GDAL 3.2
436 : */
437 : using OGRLayerUniquePtr = std::unique_ptr<OGRLayer>;
438 :
439 : /************************************************************************/
440 : /* OGRGetNextFeatureThroughRaw */
441 : /************************************************************************/
442 :
443 : /** Template class offering a GetNextFeature() implementation relying on
444 : * GetNextRawFeature()
445 : *
446 : * @since GDAL 3.2
447 : */
448 : template <class BaseLayer> class OGRGetNextFeatureThroughRaw
449 : {
450 : protected:
451 : ~OGRGetNextFeatureThroughRaw() = default;
452 :
453 : public:
454 : /** Implement OGRLayer::GetNextFeature(), relying on
455 : * BaseLayer::GetNextRawFeature() */
456 48833 : OGRFeature *GetNextFeature()
457 : {
458 48833 : const auto poThis = static_cast<BaseLayer *>(this);
459 15582 : while (true)
460 : {
461 64415 : OGRFeature *poFeature = poThis->GetNextRawFeature();
462 64415 : if (poFeature == nullptr)
463 3796 : return nullptr;
464 :
465 13305 : if ((poThis->m_poFilterGeom == nullptr ||
466 121238 : poThis->FilterGeometry(poFeature->GetGeometryRef())) &&
467 66003 : (poThis->m_poAttrQuery == nullptr ||
468 14318 : poThis->m_poAttrQuery->Evaluate(poFeature)))
469 : {
470 45037 : return poFeature;
471 : }
472 : else
473 15582 : delete poFeature;
474 : }
475 : }
476 : };
477 :
478 : /** Utility macro to define GetNextFeature() through GetNextRawFeature() */
479 : #define DEFINE_GET_NEXT_FEATURE_THROUGH_RAW(BaseLayer) \
480 : private: \
481 : friend class OGRGetNextFeatureThroughRaw<BaseLayer>; \
482 : \
483 : public: \
484 : OGRFeature *GetNextFeature() override \
485 : { \
486 : return OGRGetNextFeatureThroughRaw<BaseLayer>::GetNextFeature(); \
487 : }
488 :
489 : /************************************************************************/
490 : /* OGRDataSource */
491 : /************************************************************************/
492 :
493 : /**
494 : * LEGACY class. Use GDALDataset in your new code ! This class may be
495 : * removed in a later release.
496 : *
497 : * This class represents a data source. A data source potentially
498 : * consists of many layers (OGRLayer). A data source normally consists
499 : * of one, or a related set of files, though the name doesn't have to be
500 : * a real item in the file system.
501 : *
502 : * When an OGRDataSource is destroyed, all its associated OGRLayers objects
503 : * are also destroyed.
504 : *
505 : * NOTE: Starting with GDAL 2.0, it is *NOT* safe to cast the handle of
506 : * a C function that returns a OGRDataSourceH to a OGRDataSource*. If a C++
507 : * object is needed, the handle should be cast to GDALDataset*.
508 : *
509 : * @deprecated
510 : */
511 :
512 : class CPL_DLL OGRDataSource : public GDALDataset
513 : {
514 : public:
515 : OGRDataSource();
516 : //! @cond Doxygen_Suppress
517 : virtual const char *GetName()
518 : OGR_DEPRECATED("Use GDALDataset class instead") = 0;
519 :
520 : static void DestroyDataSource(OGRDataSource *)
521 : OGR_DEPRECATED("Use GDALDataset class instead");
522 : //! @endcond
523 : };
524 :
525 : /************************************************************************/
526 : /* OGRSFDriver */
527 : /************************************************************************/
528 :
529 : /**
530 : * LEGACY class. Use GDALDriver in your new code ! This class may be
531 : * removed in a later release.
532 : *
533 : * Represents an operational format driver.
534 : *
535 : * One OGRSFDriver derived class will normally exist for each file format
536 : * registered for use, regardless of whether a file has or will be opened.
537 : * The list of available drivers is normally managed by the
538 : * OGRSFDriverRegistrar.
539 : *
540 : * NOTE: Starting with GDAL 2.0, it is *NOT* safe to cast the handle of
541 : * a C function that returns a OGRSFDriverH to a OGRSFDriver*. If a C++ object
542 : * is needed, the handle should be cast to GDALDriver*.
543 : *
544 : * @deprecated
545 : */
546 :
547 : class CPL_DLL OGRSFDriver : public GDALDriver
548 : {
549 : public:
550 : //! @cond Doxygen_Suppress
551 : virtual ~OGRSFDriver();
552 :
553 : virtual const char *GetName()
554 : OGR_DEPRECATED("Use GDALDriver class instead") = 0;
555 :
556 : virtual OGRDataSource *Open(const char *pszName, int bUpdate = FALSE)
557 : OGR_DEPRECATED("Use GDALDriver class instead") = 0;
558 :
559 : virtual int TestCapability(const char *pszCap)
560 : OGR_DEPRECATED("Use GDALDriver class instead") = 0;
561 :
562 : virtual OGRDataSource *CreateDataSource(const char *pszName,
563 : char ** = nullptr)
564 : OGR_DEPRECATED("Use GDALDriver class instead");
565 : virtual OGRErr DeleteDataSource(const char *pszName)
566 : OGR_DEPRECATED("Use GDALDriver class instead");
567 : //! @endcond
568 : };
569 :
570 : /************************************************************************/
571 : /* OGRSFDriverRegistrar */
572 : /************************************************************************/
573 :
574 : /**
575 : * LEGACY class. Use GDALDriverManager in your new code ! This class may be
576 : * removed in a later release.
577 : *
578 : * Singleton manager for OGRSFDriver instances that will be used to try
579 : * and open datasources. Normally the registrar is populated with
580 : * standard drivers using the OGRRegisterAll() function and does not need
581 : * to be directly accessed. The driver registrar and all registered drivers
582 : * may be cleaned up on shutdown using OGRCleanupAll().
583 : *
584 : * @deprecated
585 : */
586 :
587 : class CPL_DLL OGRSFDriverRegistrar
588 : {
589 :
590 : OGRSFDriverRegistrar();
591 : ~OGRSFDriverRegistrar();
592 :
593 : static GDALDataset *OpenWithDriverArg(GDALDriver *poDriver,
594 : GDALOpenInfo *poOpenInfo);
595 : static GDALDataset *CreateVectorOnly(GDALDriver *poDriver,
596 : const char *pszName,
597 : char **papszOptions);
598 : static CPLErr DeleteDataSource(GDALDriver *poDriver, const char *pszName);
599 :
600 : public:
601 : //! @cond Doxygen_Suppress
602 : static OGRSFDriverRegistrar *GetRegistrar()
603 : OGR_DEPRECATED("Use GDALDriverManager class instead");
604 :
605 : // cppcheck-suppress functionStatic
606 : void RegisterDriver(OGRSFDriver *poDriver)
607 : OGR_DEPRECATED("Use GDALDriverManager class instead");
608 :
609 : // cppcheck-suppress functionStatic
610 : int GetDriverCount(void)
611 : OGR_DEPRECATED("Use GDALDriverManager class instead");
612 : // cppcheck-suppress functionStatic
613 : GDALDriver *GetDriver(int iDriver)
614 : OGR_DEPRECATED("Use GDALDriverManager class instead");
615 : // cppcheck-suppress functionStatic
616 : GDALDriver *GetDriverByName(const char *)
617 : OGR_DEPRECATED("Use GDALDriverManager class instead");
618 :
619 : // cppcheck-suppress functionStatic
620 : int GetOpenDSCount() OGR_DEPRECATED("Use GDALDriverManager class instead");
621 : // cppcheck-suppress functionStatic
622 : OGRDataSource *GetOpenDS(int)
623 : OGR_DEPRECATED("Use GDALDriverManager class instead");
624 : //! @endcond
625 : };
626 :
627 : /* -------------------------------------------------------------------- */
628 : /* Various available registration methods. */
629 : /* -------------------------------------------------------------------- */
630 : CPL_C_START
631 :
632 : //! @cond Doxygen_Suppress
633 : void OGRRegisterAllInternal();
634 :
635 : void CPL_DLL RegisterOGRFileGDB();
636 : void DeclareDeferredOGRFileGDBPlugin();
637 : void CPL_DLL RegisterOGRShape();
638 : void CPL_DLL RegisterOGRNTF();
639 : void CPL_DLL RegisterOGRSDTS();
640 : void CPL_DLL RegisterOGRTiger();
641 : void CPL_DLL RegisterOGRS57();
642 : void CPL_DLL RegisterOGRTAB();
643 : void CPL_DLL RegisterOGRMIF();
644 : void CPL_DLL RegisterOGROGDI();
645 : void DeclareDeferredOGROGDIPlugin();
646 : void CPL_DLL RegisterOGRODBC();
647 : void DeclareDeferredOGRODBCPlugin();
648 : void CPL_DLL RegisterOGRWAsP();
649 : void CPL_DLL RegisterOGRPG();
650 : void DeclareDeferredOGRPGPlugin();
651 : void CPL_DLL RegisterOGRMSSQLSpatial();
652 : void DeclareDeferredOGRMSSQLSpatialPlugin();
653 : void CPL_DLL RegisterOGRMySQL();
654 : void DeclareDeferredOGRMySQLPlugin();
655 : void CPL_DLL RegisterOGROCI();
656 : void DeclareDeferredOGROCIPlugin();
657 : void CPL_DLL RegisterOGRDGN();
658 : void CPL_DLL RegisterOGRGML();
659 : void CPL_DLL RegisterOGRLIBKML();
660 : void DeclareDeferredOGRLIBKMLPlugin();
661 : void CPL_DLL RegisterOGRKML();
662 : void CPL_DLL RegisterOGRFlatGeobuf();
663 : void CPL_DLL RegisterOGRGeoJSON();
664 : void CPL_DLL RegisterOGRGeoJSONSeq();
665 : void CPL_DLL RegisterOGRESRIJSON();
666 : void CPL_DLL RegisterOGRTopoJSON();
667 : void CPL_DLL RegisterOGRAVCBin();
668 : void CPL_DLL RegisterOGRAVCE00();
669 : void CPL_DLL RegisterOGRMEM();
670 : void CPL_DLL RegisterOGRVRT();
671 : void CPL_DLL RegisterOGRSQLite();
672 : void CPL_DLL RegisterOGRCSV();
673 : void CPL_DLL RegisterOGRILI1();
674 : void CPL_DLL RegisterOGRILI2();
675 : void CPL_DLL RegisterOGRPGeo();
676 : void CPL_DLL RegisterOGRDXF();
677 : void CPL_DLL RegisterOGRCAD();
678 : void DeclareDeferredOGRCADPlugin();
679 : void CPL_DLL RegisterOGRDWG();
680 : void CPL_DLL RegisterOGRDGNV8();
681 : void DeclareDeferredOGRDWGPlugin();
682 : void DeclareDeferredOGRDGNV8Plugin();
683 : void CPL_DLL RegisterOGRIDB();
684 : void DeclareDeferredOGRIDBPlugin();
685 : void CPL_DLL RegisterOGRGMT();
686 : void CPL_DLL RegisterOGRGPX();
687 : void CPL_DLL RegisterOGRGeoconcept();
688 : void CPL_DLL RegisterOGRNAS();
689 : void CPL_DLL RegisterOGRGeoRSS();
690 : void CPL_DLL RegisterOGRVFK();
691 : void DeclareDeferredOGRVFKPlugin();
692 : void CPL_DLL RegisterOGRPGDump();
693 : void CPL_DLL RegisterOGROSM();
694 : void CPL_DLL RegisterOGRGPSBabel();
695 : void CPL_DLL RegisterOGRPDS();
696 : void CPL_DLL RegisterOGRWFS();
697 : void CPL_DLL RegisterOGROAPIF();
698 : void CPL_DLL RegisterOGRSOSI();
699 : void DeclareDeferredOGRSOSIPlugin();
700 : void CPL_DLL RegisterOGREDIGEO();
701 : void CPL_DLL RegisterOGRSVG();
702 : void CPL_DLL RegisterOGRIdrisi();
703 : void CPL_DLL RegisterOGRXLS();
704 : void DeclareDeferredOGRXLSPlugin();
705 : void CPL_DLL RegisterOGRODS();
706 : void CPL_DLL RegisterOGRXLSX();
707 : void CPL_DLL RegisterOGRElastic();
708 : void DeclareDeferredOGRElasticPlugin();
709 : void CPL_DLL RegisterOGRGeoPackage();
710 : void CPL_DLL RegisterOGRCarto();
711 : void DeclareDeferredOGRCartoPlugin();
712 : void CPL_DLL RegisterOGRAmigoCloud();
713 : void CPL_DLL RegisterOGRSXF();
714 : void CPL_DLL RegisterOGROpenFileGDB();
715 : void DeclareDeferredOGROpenFileGDBPlugin();
716 : void CPL_DLL RegisterOGRSelafin();
717 : void CPL_DLL RegisterOGRJML();
718 : void CPL_DLL RegisterOGRPLSCENES();
719 : void DeclareDeferredOGRPLSCENESPlugin();
720 : void CPL_DLL RegisterOGRCSW();
721 : void CPL_DLL RegisterOGRMongoDBv3();
722 : void DeclareDeferredOGRMongoDBv3Plugin();
723 : void CPL_DLL RegisterOGRVDV();
724 : void CPL_DLL RegisterOGRGMLAS();
725 : void DeclareDeferredOGRGMLASPlugin();
726 : void CPL_DLL RegisterOGRMVT();
727 : void CPL_DLL RegisterOGRNGW();
728 : void CPL_DLL RegisterOGRMapML();
729 : void CPL_DLL RegisterOGRLVBAG();
730 : void CPL_DLL RegisterOGRHANA();
731 : void DeclareDeferredOGRHANAPlugin();
732 : void CPL_DLL RegisterOGRParquet();
733 : void DeclareDeferredOGRParquetPlugin();
734 : void CPL_DLL RegisterOGRArrow();
735 : void DeclareDeferredOGRArrowPlugin();
736 : void CPL_DLL RegisterOGRGTFS();
737 : void CPL_DLL RegisterOGRPMTiles();
738 : void CPL_DLL RegisterOGRJSONFG();
739 : void CPL_DLL RegisterOGRMiraMon();
740 : void CPL_DLL RegisterOGRXODR();
741 : void DeclareDeferredOGRXODRPlugin();
742 : void CPL_DLL RegisterOGRADBC();
743 : void DeclareDeferredOGRADBCPlugin();
744 : void CPL_DLL RegisterOGRAIVector();
745 : // @endcond
746 :
747 : CPL_C_END
748 :
749 : #endif /* ndef OGRSF_FRMTS_H_INCLUDED */
|