[Gdal-dev] Some thoughts on C# SWIG wrapper

Simon Perkins sy at perkins.net
Fri Mar 2 16:50:17 EST 2007


Richard Matsunaga wrote:
> I've just started using the C# bindings and have some questions.
>  
> 1. Is the casing used in the bindings a by-product of SWIG, or can 
> this be changed to follow the usual conventions? e.g. the 'gdal' 
> class, the 'GDAL' namespace, the use of underscores

This would be nice, but I suspect that there are a number of people out 
there using the existing bindings who might object to having to change 
their code. Standard usage would have called the GDAL namespace "Gdal", 
and the gdal class "Gdal" as well (I think this would work), but I can 
live with this quirk.

>  
> 2. Is it possible to make enums out of the constants (since the values 
> are dynamically generated, even separate classes would be better), so 
> they have some useful context? It makes it much harder for non 
> GDAL/OGR experts to find the correct values.

This would also be nice, but again we have the backwards compatibility 
issue. We could keep the GDAL.gdalconst class, but add the enums into 
the GDAL namespace, but then the GDAL functions that currently expect 
ints would either have to be duplicated for enum versions, or we'd break 
code.

One option would be to fake the enums with classes like:

namespace GDAL
{
    public class DataType
    {
       public static const int Byte = 0;
       public static const int Int16 = 1;
       ...
    }
}

We could add these classes in addition to GDAL.gdalconst and allow 
people to use them interchangeably.

Tamas: what do you think?

Cheers,

Sy

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20070302/f026727c/attachment.html


More information about the Gdal-dev mailing list