diff options
Diffstat (limited to 'java/src/jni/h5oImp.c')
-rw-r--r-- | java/src/jni/h5oImp.c | 117 |
1 files changed, 67 insertions, 50 deletions
diff --git a/java/src/jni/h5oImp.c b/java/src/jni/h5oImp.c index e8abead..6093e46 100644 --- a/java/src/jni/h5oImp.c +++ b/java/src/jni/h5oImp.c @@ -105,11 +105,11 @@ Java_hdf_hdf5lib_H5_H5Ocopy /* * Class: hdf_hdf5lib_H5 * Method: H5Oget_info - * Signature: (J)Lhdf/hdf5lib/structs/H5O_info_t; + * Signature: (JI)Lhdf/hdf5lib/structs/H5O_info_t; */ JNIEXPORT jobject JNICALL Java_hdf_hdf5lib_H5_H5Oget_1info - (JNIEnv *env, jclass clss, jlong loc_id) + (JNIEnv *env, jclass clss, jlong loc_id, jint fields) { herr_t status = -1; H5O_info_t infobuf; @@ -119,7 +119,7 @@ Java_hdf_hdf5lib_H5_H5Oget_1info jobject ihinfobuf2; jobject ret_obj = NULL; - status = H5Oget_info((hid_t)loc_id, &infobuf); + status = H5Oget_info2((hid_t)loc_id, &infobuf, (unsigned)fields); if (status < 0) { h5libraryError(env); @@ -168,11 +168,11 @@ Java_hdf_hdf5lib_H5_H5Oget_1info /* * Class: hdf_hdf5lib_H5 * Method: H5Oget_info_by_name - * Signature: (JLjava/lang/String;J)Lhdf/hdf5lib/structs/H5O_info_t; + * Signature: (JLjava/lang/String;IJ)Lhdf/hdf5lib/structs/H5O_info_t; */ JNIEXPORT jobject JNICALL Java_hdf_hdf5lib_H5_H5Oget_1info_1by_1name - (JNIEnv *env, jclass clss, jlong loc_id, jstring name, jlong access_id) + (JNIEnv *env, jclass clss, jlong loc_id, jstring name, jint fields, jlong access_id) { const char *lName; herr_t status = -1; @@ -185,7 +185,7 @@ Java_hdf_hdf5lib_H5_H5Oget_1info_1by_1name PIN_JAVA_STRING(name, lName); if (lName != NULL) { - status = H5Oget_info_by_name((hid_t)loc_id, lName, &infobuf, (hid_t)access_id); + status = H5Oget_info_by_name2((hid_t)loc_id, lName, &infobuf, (unsigned)fields, (hid_t)access_id); UNPIN_JAVA_STRING(name, lName); @@ -237,12 +237,12 @@ Java_hdf_hdf5lib_H5_H5Oget_1info_1by_1name /* * Class: hdf_hdf5lib_H5 * Method: H5Oget_info_by_idx - * Signature: (JLjava/lang/String;IIJJ)Lhdf/hdf5lib/structs/H5O_info_t; + * Signature: (JLjava/lang/String;IIJIJ)Lhdf/hdf5lib/structs/H5O_info_t; */ JNIEXPORT jobject JNICALL Java_hdf_hdf5lib_H5_H5Oget_1info_1by_1idx (JNIEnv *env, jclass clss, jlong loc_id, - jstring name, jint index_field, jint order, jlong link_n, jlong access_id) + jstring name, jint index_field, jint order, jlong link_n, jint fields, jlong access_id) { const char *lName; herr_t status; @@ -255,7 +255,7 @@ Java_hdf_hdf5lib_H5_H5Oget_1info_1by_1idx PIN_JAVA_STRING(name, lName); if (lName != NULL) { - status = H5Oget_info_by_idx((hid_t)loc_id, lName, (H5_index_t)index_field, (H5_iter_order_t)order, (hsize_t)link_n, &infobuf, (hid_t)access_id); + status = H5Oget_info_by_idx2((hid_t)loc_id, lName, (H5_index_t)index_field, (H5_iter_order_t)order, (hsize_t)link_n, &infobuf, (unsigned)fields, (hid_t)access_id); UNPIN_JAVA_STRING(name, lName); @@ -372,41 +372,58 @@ H5O_iterate_cb constructor = CBENVPTR->GetMethodID(CBENVPAR cls, "<init>", "(IIIIJJJJJJ)V"); if (constructor != 0) { hdrinfobuf = CBENVPTR->NewObjectA(CBENVPAR cls, constructor, args); - - args[0].j = (jlong)info->meta_size.obj.index_size; - args[1].j = (jlong)info->meta_size.obj.heap_size; - // get a reference to the H5_ih_info_t class - cls = CBENVPTR->FindClass(CBENVPAR "hdf/hdf5lib/structs/H5_ih_info_t"); - if (cls != 0) { - // get a reference to the constructor; the name is <init> - constructor = CBENVPTR->GetMethodID(CBENVPAR cls, "<init>", "(JJ)V"); - if (constructor != 0) { - ihinfobuf1 = CBENVPTR->NewObjectA(CBENVPAR cls, constructor, args); - args[0].j = (jlong)info->meta_size.attr.index_size; - args[1].j = (jlong)info->meta_size.attr.heap_size; - ihinfobuf2 = CBENVPTR->NewObjectA(CBENVPAR cls, constructor, args); - - args[0].j = (jlong)info->fileno; - args[1].j = (jlong)info->addr; - args[2].i = info->type; - args[3].i = (jint)info->rc; - args[4].j = (jlong)info->num_attrs; - args[5].j = info->atime; - args[6].j = info->mtime; - args[7].j = info->ctime; - args[8].j = info->btime; - args[9].l = hdrinfobuf; - args[10].l = ihinfobuf1; - args[11].l = ihinfobuf2; - // get a reference to the H5O_info_t class - cls = CBENVPTR->FindClass(CBENVPAR "hdf/hdf5lib/structs/H5O_info_t"); - if (cls != 0) { - // get a reference to the constructor; the name is <init> - constructor = CBENVPTR->GetMethodID(CBENVPAR cls, "<init>", "(JJIIJJJJJLhdf/hdf5lib/structs/H5O_hdr_info_t;Lhdf/hdf5lib/structs/H5_ih_info_t;Lhdf/hdf5lib/structs/H5_ih_info_t;)V"); - if (constructor != 0) { - cb_info_t = CBENVPTR->NewObjectA(CBENVPAR cls, constructor, args); - - status = CBENVPTR->CallIntMethod(CBENVPAR visit_callback, mid, g_id, str, cb_info_t, op_data); + if (hdrinfobuf == NULL) { + printf("H5O_iterate_cb ERROR: hdf/hdf5lib/structs/H5O_hdr_info_t: Creation failed\n"); + } + else { + args[0].j = (jlong)info->meta_size.obj.index_size; + args[1].j = (jlong)info->meta_size.obj.heap_size; + // get a reference to the H5_ih_info_t class + cls = CBENVPTR->FindClass(CBENVPAR "hdf/hdf5lib/structs/H5_ih_info_t"); + if (cls != 0) { + // get a reference to the constructor; the name is <init> + constructor = CBENVPTR->GetMethodID(CBENVPAR cls, "<init>", "(JJ)V"); + if (constructor != 0) { + ihinfobuf1 = CBENVPTR->NewObjectA(CBENVPAR cls, constructor, args); + if (ihinfobuf1 == NULL) { + printf("H5O_iterate_cb ERROR: hdf/hdf5lib/structs/H5_ih_info_t: Creation failed\n"); + } + else { + args[0].j = (jlong)info->meta_size.attr.index_size; + args[1].j = (jlong)info->meta_size.attr.heap_size; + ihinfobuf2 = CBENVPTR->NewObjectA(CBENVPAR cls, constructor, args); + if (ihinfobuf2 == NULL) { + printf("H5O_iterate_cb ERROR: hdf/hdf5lib/structs/H5_ih_info_t: Creation failed\n"); + } + else { + args[0].j = (jlong)info->fileno; + args[1].j = (jlong)info->addr; + args[2].i = info->type; + args[3].i = (jint)info->rc; + args[4].j = (jlong)info->num_attrs; + args[5].j = info->atime; + args[6].j = info->mtime; + args[7].j = info->ctime; + args[8].j = info->btime; + args[9].l = hdrinfobuf; + args[10].l = ihinfobuf1; + args[11].l = ihinfobuf2; + // get a reference to the H5O_info_t class + cls = CBENVPTR->FindClass(CBENVPAR "hdf/hdf5lib/structs/H5O_info_t"); + if (cls != 0) { + // get a reference to the constructor; the name is <init> + constructor = CBENVPTR->GetMethodID(CBENVPAR cls, "<init>", "(JJIIJJJJJLhdf/hdf5lib/structs/H5O_hdr_info_t;Lhdf/hdf5lib/structs/H5_ih_info_t;Lhdf/hdf5lib/structs/H5_ih_info_t;)V"); + if (constructor != 0) { + cb_info_t = CBENVPTR->NewObjectA(CBENVPAR cls, constructor, args); + if (cb_info_t == NULL) { + printf("H5O_iterate_cb ERROR: hdf/hdf5lib/structs/H5O_info_t: Creation failed\n"); + } + else { + status = CBENVPTR->CallIntMethod(CBENVPAR visit_callback, mid, g_id, str, cb_info_t, op_data); + } + } + } + } } } } @@ -423,12 +440,12 @@ H5O_iterate_cb /* * Class: hdf_hdf5lib_H5 * Method: H5Ovisit - * Signature: (JIILjava/lang/Object;Ljava/lang/Object;)I + * Signature: (JIILjava/lang/Object;Ljava/lang/Object;I)I */ JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Ovisit (JNIEnv *env, jclass clss, jlong grp_id, jint idx_type, jint order, - jobject callback_op, jobject op_data) + jobject callback_op, jobject op_data, jint fields) { herr_t status = -1; @@ -442,7 +459,7 @@ Java_hdf_hdf5lib_H5_H5Ovisit h5nullArgument(env, "H5Ovisit: callback_op is NULL"); } /* end if */ else { - status = H5Ovisit((hid_t)grp_id, (H5_index_t)idx_type, (H5_iter_order_t)order, (H5O_iterate_t)H5O_iterate_cb, (void*)op_data); + status = H5Ovisit2((hid_t)grp_id, (H5_index_t)idx_type, (H5_iter_order_t)order, (H5O_iterate_t)H5O_iterate_cb, (void*)op_data, (unsigned)fields); if (status < 0) h5libraryError(env); @@ -454,12 +471,12 @@ Java_hdf_hdf5lib_H5_H5Ovisit /* * Class: hdf_hdf5lib_H5 * Method: H5Ovisit_by_name - * Signature: (JLjava/lang/String;IILjava/lang/Object;Ljava/lang/Object;J)I + * Signature: (JLjava/lang/String;IILjava/lang/Object;Ljava/lang/Object;IJ)I */ JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Ovisit_1by_1name (JNIEnv *env, jclass clss, jlong grp_id, jstring name, jint idx_type, jint order, - jobject callback_op, jobject op_data, jlong access_id) + jobject callback_op, jobject op_data, jint fields, jlong access_id) { herr_t status = -1; const char *lName; @@ -478,7 +495,7 @@ Java_hdf_hdf5lib_H5_H5Ovisit_1by_1name else { PIN_JAVA_STRING(name, lName); if (lName != NULL) { - status = H5Ovisit_by_name((hid_t)grp_id, lName, (H5_index_t)idx_type, (H5_iter_order_t)order, (H5O_iterate_t)H5O_iterate_cb, (void*)op_data, (hid_t)access_id); + status = H5Ovisit_by_name2((hid_t)grp_id, lName, (H5_index_t)idx_type, (H5_iter_order_t)order, (H5O_iterate_t)H5O_iterate_cb, (void*)op_data, (unsigned)fields, (hid_t)access_id); UNPIN_JAVA_STRING(name, lName); |