On Jul 22, 2008, at 9:48 AM, Ari Jolma wrote:
The trac.osgeo.org does not answer so I'll put this here.
Hobu, would it be ok to have (int len, int *output) typemap. They
can be used in GetHistogram method like this (note that the API is
same for C# but it must use different typemaps. From Band.i:
%typemap(check) (int len, int *output)
{
/* %typemap(check) (int len, int *output) */
if ($1 < 1) $1 = 1; /* stop idiocy */
$2 = (int *)CPLMalloc( $1 * sizeof(int) );
}
Ari,
This isn't too different from what I proposed except for I think that
abusing the check typemap like that (malloc'ing the integer array) is
a recipe for disaster. The check typemap could possibly be run
multiple times, right? Otherwise, it looks pretty close to what I had
for a proposal http://trac.osgeo.org/gdal/changeset/14941 .
I'm open to changing the GetHistogram function signature within Band.i
however you guys wish (ideally to support just using (int len, int
*output) and not having a special typemap for just this function), and
while it would be nice that we wouldn't need the #ifdefs for every
possible language we might ever support ;), it's not the end of the
world either...
Howard
_______________________________________________
gdal-dev mailing list
gdal-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev