[gdal-dev] Propose removing OGRRegisterAll(void); in ogrsf_frmts.h

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[gdal-dev] Propose removing OGRRegisterAll(void); in ogrsf_frmts.h

Kurt Schwehr-2
In Even's https://trac.osgeo.org/gdal/changeset/41094:

Even handles the multiple definitions of OGRRegisterAll().  I propose that we remove the one from ogrsf_frmts.h ( which was not my first thought ).  I think the common cases are:

1) you just want all the drivers registered and don't care about individual registers, so just use ogr_api.h.  You will likely need it anyway.

2) you are definiting a register function and don't care about OGRRegisterAll so include ogrsf_frmts.h

3) you want a specific driver registered and don't care about OGRRegisterAll so include ogrsf_frmts.h

Cases 2 and 3 likely will have to include ogr_api.h to do their work, but maybe not in a rare case.

Why add extra in case 1?

Thoughts?

_______________________________________________
gdal-dev mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/gdal-dev
Reply | Threaded
Open this post in threaded view
|

Re: Propose removing OGRRegisterAll(void); in ogrsf_frmts.h

Even Rouault-2

On jeudi 21 décembre 2017 05:45:02 CET Kurt Schwehr wrote:

> In Even's https://trac.osgeo.org/gdal/changeset/41094:

>

> Even handles the multiple definitions of OGRRegisterAll(). I propose that

> we remove the one from ogrsf_frmts.h ( which was not my first thought ). I

> think the common cases are:

>

> 1) you just want all the drivers registered and don't care about individual

> registers, so just use ogr_api.h. You will likely need it anyway.

>

> 2) you are definiting a register function and don't care

> about OGRRegisterAll so include ogrsf_frmts.h

>

> 3) you want a specific driver registered and don't care

> about OGRRegisterAll so include ogrsf_frmts.h

>

> Cases 2 and 3 likely will have to include ogr_api.h to do their work, but

> maybe not in a rare case.

>

> Why add extra in case 1?

 

People only using the C++ API might just need to include ogrsf_frmts.h currently.

 

But actually looking at inclusiong chain:

 

ogrsf_frmts.h includes gdal_priv.h

gdal_priv.h includes gdal.h

gdal.h includes ogr_api.h

 

So I've just committed the redefinition in ogrsf_frmts.h

 

Even

 

--

Spatialys - Geospatial professional services

http://www.spatialys.com


_______________________________________________
gdal-dev mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/gdal-dev