[Gdal-dev] Guidelines for the typemap usage for the SWIG bindings

Tamas Szekeres szekerest at gmail.com
Fri Apr 20 18:46:33 EDT 2007


Developers,

Upon adding support for Band.GetRasterCategoryNames,
Band.SetRasterCategoryNames to the SWIG interface I've realized the
need of an agreement among the binding owners about the desired usage
of the various typemaps. In the current implementation I cannot see an
obvious direction. Actually it would be much easier if there were a
common policy when %applying the typemaps on a particular member.

In case of the typemap char** we could use for example

%typemap() char **stringarray   for passing and returning arrays of strings
%typemap() char **argout  for mapping outbound string parameters
and so on

Currently it's quite a difficult task even to count how many different
typemaps we have for char** particularly.

Having an unique approach would ensure not require to implement
various typemaps for the same purpose.
In addition we should also remove the several inhouse solutions like:

%rename (GetProjectionMethodParameterList) OPTGetParameterList;
#if defined(SWIGPERL)
%apply (char **free) {(char **)};
%apply (char **argout) {(char **username)};
#endif
char **OPTGetParameterList( char *method, char **username );
#if defined(SWIGPERL)
%clear (char **);
%clear (char **username);
#endif

Which is not too benefical for the other languages.

I guess this kind of work - if needed - would require an RFC to have.
But at first we should get together with the ideas which ones we
should really keep, omit or replace.

Best regards,

Tamas



More information about the Gdal-dev mailing list