[gdal-dev] Java API: how to find dimensions of MDArray
Laurențiu Nicola
lnicola at dend.ro
Mon Jun 5 22:31:10 PDT 2023
Hi Barry,
I haven't used Java in a while, but those are type signatures as used in JNI. If I recall correctly, (DDDDDLjava/lang/Long;Ljava/lang/Boolean;)V is void f(double p1, double p2, double p3, double p4, double p5, long p6, boolean p6).
They're used to disambiguate overloaded methods.
Laurentiu
PS: I found https://docs.oracle.com/en/java/javase/20/docs/specs/jni/types.html with more details.
On Tue, Jun 6, 2023, at 04:43, Barry DeZonia wrote:
> Even,
>
> Does this look okay as part of my typemap declaration? It is the only part I am confused about. I am very unfamiliar with this "(DDDDDL...." stuff And the L and V after each parameter. Where can I learn what this stuff means?
>
> %typemap(argout) (int *nDimensions, GDALDimenion const **pDimensions )
> {
> const jclass dimensionClass = jenv->FindClass("org/gdal/gdal/Dimension");
> const jclass vectorClass = jenv->FindClass("java/util/Vector");
> const jmethodID add = jenv->GetMethodID(vectorClass, "add", "(Ljava/lang/Object;)Z");
> const jmethodID dimensionCon = jenv->GetMethodID(dimensionClass, "<init>",
> "(DDDDDLjava/lang/Long;Ljava/lang/Boolean;)V");
>
> for( int i = 0; i < *$1; i++ ) {
> jobject dimensionObj = jenv->NewObject(dimensionClass, dimensionCon,
> &((*$2)[i]),
> true);
> jenv->CallBooleanMethod($input, add, dimensionObj);
> }
> }
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20230606/309c52b7/attachment.htm>
More information about the gdal-dev
mailing list