[gdal-dev] argument default value in the C API to GDALAlgorithmArg
Chris Toney
jctoney at gmail.com
Wed Aug 6 21:44:16 PDT 2025
Hi Even,
> If you need this in 3.11, you can define the following implementation
> detail in your code
>
> struct GDALAlgorithmArgHS
Could GDALAlgorithmArgHS be defined in gdalalgorithm.h (as struct
GDALAlgorithmHS is)?
Chris
On Mon, Aug 4, 2025 at 2:42 AM Even Rouault <even.rouault at spatialys.com> wrote:
>
> Hi Chris,
>
> This was indeed missing in the C API. Queued for 3.12 in
> https://github.com/OSGeo/gdal/pull/12853
>
> If you need this in 3.11, you can define the following implementation
> detail in your code
>
> struct GDALAlgorithmArgHS
> {
> GDALAlgorithmArg *ptr = nullptr;
>
> explicit GDALAlgorithmArgHS(GDALAlgorithmArg *arg) : ptr(arg)
> {
> }
> };
>
> but better conditionalize it to 3.11 only, so that to avoid issues in
> later version if we would change the definition of struct GDALAlgorithmArgHS
>
> and then do things like
>
> GDALAlgorithmArgH hArg;
>
> hArg->ptr->GetDefault<std::string>();
>
> Even
>
>
> Le 04/08/2025 à 03:46, Chris Toney via gdal-dev a écrit :
> > Hi,
> > In the C API there is GDALAlgorithmArgHasDefaultValue(), but no
> > interface to the GetDefault() class method to access the value itself
> > when there is one (nor in the Python bindings, AFAICS).
> >
> > I don't believe there is a fromHandle() method on GDALAlgorithmArg to
> > get to the C++ object.
> >
> > Is there possibly a workaround for that when working through the C API?
> >
> > Chris
> > _______________________________________________
> > gdal-dev mailing list
> > gdal-dev at lists.osgeo.org
> > https://lists.osgeo.org/mailman/listinfo/gdal-dev
>
> --
> http://www.spatialys.com
> My software is free, but my time generally not.
>
More information about the gdal-dev
mailing list