[Gdal-dev] Re: gdal swig interface Band.i Updated

Frank Warmerdam warmerdam at pobox.com
Fri Aug 4 08:44:15 EDT 2006


Daniele Romagnoli wrote:
> Dear Mr. Warmerdam
> 
> A while ago, I have added some lines of code to the "Band.i" interface 
> contained into the GDAL\SWIG\Include subdirectory, in order to expose 
> the method GetBlockSize via SWIG.
> 
> 
>   %apply (int *OUTPUT){int *blockXSize, int *blockYSize}
>   void GetBlockSize(int *blockXSize, int *blockYSize){
>               GDALGetBlockSize(self, blockXSize, blockYSize);
>   }
> 
> 
> Is this a good way?
> I have tested it for Java binding and it work.
> 
> Can we add this to the available bindings in order to allow its use to 
> other users?
> 
> Let me know how do you think about it, as well as your advices.
> Thank you very much.

Daniele,

I don't see anything obviously wrong with your formulation, but when
I look in Band.i or the various other .i files I don't see anything
quite analygous to your approach either.  Some other functions that
return values in variables to which passed pointers are provided just
look like this:

   void GetOffset( double *val, int *hasval ) {
     *val = GDALGetRasterOffset( self, hasval );
   }

I'm not sure if "val and hasval" are special names or exactly what
makes this work.  But it makes me wonder if the approach you suggest
is appropriate.

Also, we could contemplate making BlockXSize and BlockYSize immutable
attributes of a band, in the same way that XSize, YSize and DataType are
handled.  I'm not sure of the benefits of this compared to just exposing
the method.

I'm cc:ing gdal-dev in the hopes of getting some wisdom from those who
understand the matter better than I do.

Best regards,
-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | President OSGF, http://osgeo.org




More information about the Gdal-dev mailing list