/* * Class: hdf_hdf5lib_H5 * Method: H5Ovisit * Signature: (JIILjava/lang/Object;Ljava/lang/Object;)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) { herr_t status = -1; ENVPTR->GetJavaVM(ENVPAR &jvm); visit_callback = callback_op; if (op_data == NULL) { h5nullArgument(env, "H5Ovisit: op_data is NULL"); } /* end if */ else if (callback_op == NULL) { 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); if (status < 0) h5libraryError(env); } return status; } /* end 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 */ 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) { herr_t status = -1; const char *lName; ENVPTR->GetJavaVM(ENVPAR &jvm); visit_callback = callback_op; if (op_data == NULL) { h5nullArgument(env, "H5Ovisit_by_name: op_data is NULL"); return -1; } /* end if */ else if (callback_op == NULL) { h5nullArgument(env, "H5Ovisit_by_name: callback_op is NULL"); return -1; } /* end if */ 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); UNPIN_JAVA_STRING(name, lName); if (status < 0) h5libraryError(env); } } return status; } /* end Java_hdf_hdf5lib_H5_H5Ovisit_1by_1name */
/* * Class: hdf_hdf5lib_H5 * Method: H5get_libversion * Signature: ([I)I */ JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5get_1libversion (JNIEnv *env, jclass clss, jintArray libversion) { unsigned *theArray = NULL; herr_t status = -1; jboolean isCopy; if (libversion == NULL) { h5nullArgument(env, "H5get_version: libversion is NULL"); } /* end if */ else { theArray = (unsigned*)ENVPTR->GetIntArrayElements(ENVPAR libversion, &isCopy); if (theArray == NULL) { h5JNIFatalError( env, "H5get_libversion: input not pinned"); } /* end if */ else { status = H5get_libversion(&(theArray[0]), &(theArray[1]), &(theArray[2])); if (status < 0) { ENVPTR->ReleaseIntArrayElements(ENVPAR libversion, (jint*)theArray, JNI_ABORT); h5libraryError(env); } /* end if */ ENVPTR->ReleaseIntArrayElements(ENVPAR libversion, (jint*)theArray,0); } /* end else */ } /* end else */ return (jint)status; } /* end Java_hdf_hdf5lib_H5_H5get_1libversion */
/* * Class: hdf_hdf5lib_H5 * Method: _H5Rdereference * Signature: (JJI[B)J */ JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Rdereference(JNIEnv *env, jclass clss, jlong dataset, jlong access_list, jint ref_type, jbyteArray ref) { jboolean isCopy; jbyte *refP; hid_t retVal = -1; if (ref == NULL) { h5nullArgument( env, "H5Rdereference: ref is NULL"); } /* end if */ else if ((ref_type == H5R_OBJECT) && ENVPTR->GetArrayLength(ENVPAR ref) != H5R_OBJ_REF_BUF_SIZE) { h5badArgument( env, "H5Rdereference: obj ref input array != H5R_OBJ_REF_BUF_SIZE"); } /* end else if */ else if ((ref_type == H5R_DATASET_REGION) && ENVPTR->GetArrayLength(ENVPAR ref) != H5R_DSET_REG_REF_BUF_SIZE) { h5badArgument( env, "H5Rdereference: region ref input array != H5R_DSET_REG_REF_BUF_SIZE"); } /* end else if */ else { refP = (jbyte*)ENVPTR->GetByteArrayElements(ENVPAR ref, &isCopy); if (refP == NULL) { h5JNIFatalError(env, "H5Rderefernce: ref not pinned"); } /* end if */ else { retVal = H5Rdereference2((hid_t)dataset, (hid_t)access_list, (H5R_type_t)ref_type, refP); ENVPTR->ReleaseByteArrayElements(ENVPAR ref, refP, JNI_ABORT); if (retVal < 0) h5libraryError(env); } /* end else */ } /* end else */ return (jlong)retVal; } /* end Java_hdf_hdf5lib_H5__1H5Rdereference */
/* * Class: hdf_hdf5lib_H5 * Method: H5G_obj_t H5Rget_obj_type * Signature: (JI[B)I */ JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Rget_1obj_1type(JNIEnv *env, jclass clss, jlong loc_id, jint ref_type, jbyteArray ref) { int retVal =-1; jboolean isCopy; jbyte *refP; H5O_type_t object_info; if (ref == NULL) { h5nullArgument( env, "H5Rget_object_type: ref is NULL"); } /* end if */ else { refP = (jbyte*)ENVPTR->GetByteArrayElements(ENVPAR ref, &isCopy); if (refP == NULL) { h5JNIFatalError(env, "H5Rget_object_type: ref not pinned"); } /* end if */ else { retVal = H5Rget_obj_type2((hid_t)loc_id, (H5R_type_t)ref_type, refP, &object_info); if(retVal >= 0) retVal = object_info; ENVPTR->ReleaseByteArrayElements(ENVPAR ref, refP, JNI_ABORT); if (retVal < 0) h5libraryError(env); } /* end else */ } /* end else */ return (jint)retVal; } /* end Java_hdf_hdf5lib_H5_H5Rget_1obj_1type */
/* * Class: hdf_hdf5lib_H5 * Method: H5Literate_by_name * Signature: (JLjava/lang/String;IIJLjava/lang/Object;Ljava/lang/Object;J)I */ JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Literate_1by_1name (JNIEnv *env, jclass clss, jlong grp_id, jstring name, jint idx_type, jint order, jlong idx, jobject callback_op, jobject op_data, jlong access_id) { hsize_t start_idx = (hsize_t)idx; herr_t status = -1; const char *lName; ENVPTR->GetJavaVM(ENVPAR &jvm); cb_wrapper wrapper = {callback_op, op_data}; if ((op_data == NULL) || (callback_op == NULL)) { h5nullArgument(env, "H5Literate_by_name: op_data or callback_op is NULL"); } /* end if */ else { PIN_JAVA_STRING(name, lName); if (lName != NULL) { status = H5Literate_by_name((hid_t)grp_id, lName, (H5_index_t)idx_type, (H5_iter_order_t)order, (hsize_t*)&start_idx, (H5L_iterate_t)H5L_iterate_cb, (void*)&wrapper, (hid_t)access_id); UNPIN_JAVA_STRING(name, lName); if (status < 0) h5libraryError(env); } } /* end else */ return status; } /* end Java_hdf_hdf5lib_H5_H5Literate_1by_1name */
/* * Class: hdf_hdf5lib_H5 * Method: H5Aread * Signature: (JJ[B)I */ JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Aread (JNIEnv *env, jclass clss, jlong attr_id, jlong mem_type_id, jbyteArray buf) { herr_t status = -1; jbyte *byteP; jboolean isCopy; if (buf == NULL) { h5nullArgument( env,"H5Aread: buf is NULL"); } /* end if */ else { byteP = ENVPTR->GetByteArrayElements(ENVPAR buf, &isCopy); if (byteP == NULL) { h5JNIFatalError( env,"H5Aread: buf is not pinned"); } /* end if */ else { status = H5Aread((hid_t)attr_id, (hid_t)mem_type_id, byteP); if (status < 0) { ENVPTR->ReleaseByteArrayElements(ENVPAR buf, byteP, JNI_ABORT); h5libraryError(env); } /* end if */ else { ENVPTR->ReleaseByteArrayElements(ENVPAR buf, byteP, 0); } /* end else */ } /* end else */ } /* end else */ return (jint)status; } /* end Java_hdf_hdf5lib_H5_H5Aread */
/* * Class: hdf_hdf5lib_H5 * Method: int H5Rget_obj_type2 * Signature: (JI[B[I)I */ JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Rget_1obj_1type2(JNIEnv *env, jclass clss, jlong loc_id, jint ref_type, jbyteArray ref, jintArray ref_obj) { jint status; jboolean isCopy; jbyte *refP; jint *ref_objP; int retVal = -1; if (ref == NULL) { h5nullArgument( env, "H5Rget_object_type: ref is NULL"); } /* end if */ else if (ref_obj == NULL) { h5nullArgument( env, "H5Rget_object_type: ref_obj is NULL"); } /* end else if */ else { refP = (jbyte *)ENVPTR->GetByteArrayElements(ENVPAR ref, &isCopy); if (refP == NULL) { h5JNIFatalError(env, "H5Rget_object_type: ref not pinned"); } /* end if */ else { ref_objP = (jint *)ENVPTR->GetIntArrayElements(ENVPAR ref_obj, &isCopy); if (ref_objP == NULL) { ENVPTR->ReleaseByteArrayElements(ENVPAR ref,refP,0); h5JNIFatalError(env, "H5Rget_object_type: ref_obj not pinned"); } /* end if */ else { status = H5Rget_obj_type2((hid_t)loc_id, (H5R_type_t)ref_type, refP, (H5O_type_t*)ref_objP); retVal = ref_objP[0]; ENVPTR->ReleaseByteArrayElements(ENVPAR ref, refP, JNI_ABORT); if (status < 0) { ENVPTR->ReleaseIntArrayElements(ENVPAR ref_obj,ref_objP, JNI_ABORT); h5libraryError(env); } /* end if */ else { ENVPTR->ReleaseIntArrayElements(ENVPAR ref_obj, ref_objP, 0); } /* end else */ } /* end else */ } /* end else */ } /* end else */ return (jint)retVal; } /* end Java_hdf_hdf5lib_H5_H5Rget_1obj_1type2 */
/* * Class: hdf_hdf5lib_H5 * Method: H5Eget_msg * Signature: (J[I)Ljava/lang/String; */ JNIEXPORT jstring JNICALL Java_hdf_hdf5lib_H5_H5Eget_1msg (JNIEnv *env, jclass cls, jlong msg_id, jintArray error_msg_type_list) { char *namePtr; jstring str = NULL; jboolean isCopy; ssize_t buf_size; jint *theArray; H5E_type_t error_msg_type; if (msg_id < 0) { h5badArgument(env, "H5Eget_msg: invalid argument"); } /* end if */ else if (error_msg_type_list == NULL) { h5nullArgument(env, "H5Eget_msg: error_msg_type_list is NULL"); } /* end if */ else { /* get the length of the name */ buf_size = H5Eget_msg((hid_t)msg_id, NULL, NULL, 0); if ((buf_size < 0) || (buf_size == 0)) { h5JNIFatalError(env, "H5Eget_msg: Invalid message"); } /* end if */ else { buf_size++; /* add extra space for the null terminator */ namePtr = (char*)HDmalloc(sizeof(char) * (size_t)buf_size); if (namePtr == NULL) { h5outOfMemory(env, "H5Eget_msg: malloc failed"); } /* end if */ else { theArray = (jint*)ENVPTR->GetIntArrayElements(ENVPAR error_msg_type_list, &isCopy); if (theArray == NULL) { HDfree(namePtr); h5JNIFatalError(env, "H5Eget_msg: error_msg_type_list not pinned"); } /* end if */ else { buf_size = H5Eget_msg((hid_t)msg_id, &error_msg_type, (char *)namePtr, (size_t)buf_size); if (buf_size < 0) { HDfree(namePtr); ENVPTR->ReleaseIntArrayElements(ENVPAR error_msg_type_list, theArray, JNI_ABORT); h5libraryError(env); } /* end if */ else { theArray[0] = error_msg_type; ENVPTR->ReleaseIntArrayElements(ENVPAR error_msg_type_list, theArray, 0); str = ENVPTR->NewStringUTF(ENVPAR namePtr); HDfree(namePtr); } /* end else */ } /* end else */ } /* end else */ } /* end else */ } /* end else */ return str; } /* end Java_hdf_hdf5lib_H5_H5Eget_1msg */
/* * Class: hdf_hdf5lib_H5 * Method: H5Rget_name * Signature: (JI[B[Ljava/lang/String;J)J */ JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Rget_1name(JNIEnv *env, jclass clss, jlong loc_id, jint ref_type, jbyteArray ref, jobjectArray name, jlong size) { jlong ret_val = -1; jbyte *refP; jboolean isCopy; char *aName = NULL; jstring str; size_t bs; bs = (size_t)size; if (bs <= 0) { h5badArgument(env, "H5Rget_name: size <= 0"); } /* end if */ else if (ref == NULL) { h5nullArgument(env, "H5Rget_name: ref is NULL"); } /* end else if */ else { if ((ref_type == H5R_OBJECT) && ENVPTR->GetArrayLength(ENVPAR ref) != H5R_OBJ_REF_BUF_SIZE) { h5badArgument(env, "H5Rget_name: obj ref input array != H5R_OBJ_REF_BUF_SIZE"); } /* end if */ else if ((ref_type == H5R_DATASET_REGION) && ENVPTR->GetArrayLength(ENVPAR ref) != H5R_DSET_REG_REF_BUF_SIZE) { h5badArgument(env, "H5Rget_name: region ref input array != H5R_DSET_REG_REF_BUF_SIZE"); } /* end else if */ else { refP = (jbyte *)ENVPTR->GetByteArrayElements(ENVPAR ref, &isCopy); if (refP == NULL) { h5JNIFatalError(env, "H5Rget_name: ref not pinned"); } /* end if */ else { aName = (char*)HDmalloc(sizeof(char)*bs); if (aName == NULL) { ENVPTR->ReleaseByteArrayElements(ENVPAR ref, refP, JNI_ABORT); h5outOfMemory(env, "H5Rget_name: malloc failed"); } /* end if */ else { ret_val = (jlong)H5Rget_name((hid_t)loc_id, (H5R_type_t)ref_type, refP, aName, bs) ; ENVPTR->ReleaseByteArrayElements(ENVPAR ref, refP, JNI_ABORT); if (ret_val < 0) { HDfree(aName); h5libraryError(env); } /* end if */ else { str = ENVPTR->NewStringUTF(ENVPAR aName); ENVPTR->SetObjectArrayElement(ENVPAR name, 0, str); HDfree(aName); } /* end else */ } /* end else */ } /* end else */ } /* end else */ } /* end else */ return ret_val; } /* end Java_hdf_hdf5lib_H5_H5Rget_1name */
/* * Class: hdf_hdf5lib_H5 * Method: H5Ewalk2 * Signature: (JJLjava/lang/Object;Ljava/lang/Object;)V */ JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Ewalk2 (JNIEnv *env, jclass cls, jlong stk_id, jlong direction, jobject callback_op, jobject op_data) { ENVPTR->GetJavaVM(ENVPAR &jvm); visit_callback = callback_op; if ((op_data == NULL) || (callback_op == NULL)) { h5nullArgument(env, "H5Ewalk2: op_data or callback_op is NULL"); } /* end if */ else if (H5Ewalk2(stk_id, (H5E_direction_t)direction, (H5E_walk2_t)H5E_walk_cb, (void*)op_data) < 0) h5libraryError(env); } /* end iJava_hdf_hdf5lib_H5_H5Ewalk2f */
/* * Class: hdf_hdf5lib_H5 * Method: H5Rcreate * Signature: ([BJLjava/lang/String;IJ)I */ JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Rcreate(JNIEnv *env, jclass clss, jbyteArray ref, jlong loc_id, jstring name, jint ref_type, jlong space_id) { const char *rName; herr_t status = -1; jbyte *refP; jboolean isCopy2; PIN_JAVA_STRING(name, rName, -1); if (ref == NULL) { UNPIN_JAVA_STRING(name, rName); h5nullArgument( env, "H5Rcreate: ref is NULL"); } /* end if */ else { if ((ref_type == H5R_OBJECT) && ENVPTR->GetArrayLength(ENVPAR ref) != H5R_OBJ_REF_BUF_SIZE) { UNPIN_JAVA_STRING(name, rName); h5badArgument( env, "H5Rcreate: ref input array != H5R_OBJ_REF_BUF_SIZE"); } /* end if */ else if ((ref_type == H5R_DATASET_REGION) && ENVPTR->GetArrayLength(ENVPAR ref) != H5R_DSET_REG_REF_BUF_SIZE) { UNPIN_JAVA_STRING(name, rName); h5badArgument( env, "H5Rcreate: region ref input array != H5R_DSET_REG_REF_BUF_SIZE"); } /* end else if */ else if ((ref_type != H5R_OBJECT) && (ref_type != H5R_DATASET_REGION)) { UNPIN_JAVA_STRING(name, rName); h5badArgument( env, "H5Rcreate: ref_type unknown type "); } /* end else if */ else { refP = (jbyte*)ENVPTR->GetByteArrayElements(ENVPAR ref, &isCopy2); if (refP == NULL) { UNPIN_JAVA_STRING(name, rName); h5JNIFatalError(env, "H5Rcreate: ref not pinned"); } /* end if */ else { status = H5Rcreate(refP, (hid_t)loc_id, rName, (H5R_type_t)ref_type, (hid_t)space_id); UNPIN_JAVA_STRING(name, rName); if (status < 0) { ENVPTR->ReleaseByteArrayElements(ENVPAR ref, refP, JNI_ABORT); h5libraryError(env); } /* end if */ else { ENVPTR->ReleaseByteArrayElements(ENVPAR ref, refP, 0); } /* end else */ } /* end else */ } /* end else */ } /* end else */ return (jint)status; } /* end Java_hdf_hdf5lib_H5_H5Rcreate */
/* * Class: hdf_hdf5lib_H5 * Method: H5Lvisit * Signature: (JIILjava/lang/Object;Ljava/lang/Object;)I */ JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Lvisit (JNIEnv *env, jclass clss, jlong grp_id, jint idx_type, jint order, jobject callback_op, jobject op_data) { herr_t status = -1; cb_wrapper wrapper = {callback_op, op_data}; ENVPTR->GetJavaVM(ENVPAR &jvm); if ((op_data == NULL) || (callback_op == NULL)) { h5nullArgument(env, "H5Lvisit: op_data or callback_op is NULL"); } /* end if */ else { status = H5Lvisit((hid_t)grp_id, (H5_index_t)idx_type, (H5_iter_order_t)order, (H5L_iterate_t)H5L_iterate_cb, (void*)&wrapper); if (status < 0) h5libraryError(env); } /* end else */ return status; } /* end Java_hdf_hdf5lib_H5_H5Lvisit */
/* * Class: hdf_hdf5lib_H5 * Method: H5Aiterate * Signature: (JIIJLjava/lang/Object;Ljava/lang/Object;)I */ JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Aiterate (JNIEnv *env, jclass clss, jlong grp_id, jint idx_type, jint order, jlong idx, jobject callback_op, jobject op_data) { hsize_t start_idx = (hsize_t)idx; herr_t status = -1; ENVPTR->GetJavaVM(ENVPAR &jvm); visit_callback = callback_op; if ((op_data == NULL) || (callback_op == NULL)) { h5nullArgument(env, "H5Literate_by_name: op_data or callback_op is NULL"); } /* end if */ else { status = H5Aiterate2((hid_t)grp_id, (H5_index_t)idx_type, (H5_iter_order_t)order, (hsize_t*)&start_idx, (H5A_operator2_t)H5A_iterate_cb, (void*)op_data); if (status < 0) h5libraryError(env); } /* end else */ return (jint)status; } /* end Java_hdf_hdf5lib_H5_H5Aiterate */
/* * Class: hdf_hdf5lib_H5 * Method: H5AreadVL * Signature: (JJJJJ[Ljava/lang/String;)I */ JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5AreadVL (JNIEnv *env, jclass clss, jlong attr_id, jlong mem_type_id, jobjectArray buf) { herr_t status = -1; htri_t isStr = 0; htri_t isVlenStr = 0; htri_t isComplex = 0; if (buf == NULL) { h5nullArgument(env, "H5AreadVL: buf is NULL"); } /* end if */ else { isStr = H5Tdetect_class((hid_t)mem_type_id, H5T_STRING); if (H5Tget_class((hid_t)mem_type_id) == H5T_COMPOUND) { unsigned i; int nm = H5Tget_nmembers(mem_type_id); for(i = 0; i <nm; i++) { hid_t nested_tid = H5Tget_member_type((hid_t)mem_type_id, i); isComplex = H5Tdetect_class((hid_t)nested_tid, H5T_COMPOUND) || H5Tdetect_class((hid_t)nested_tid, H5T_VLEN); H5Tclose(nested_tid); } } else if (H5Tget_class((hid_t)mem_type_id) == H5T_VLEN) { isVlenStr = 1; /* strings created by H5Tvlen_create(H5T_C_S1) */ } if (isStr == 0 || isComplex>0 || isVlenStr) { status = H5AreadVL_asstr(env, (hid_t)attr_id, (hid_t)mem_type_id, buf); } else if (isStr > 0) { status = H5AreadVL_str(env, (hid_t)attr_id, (hid_t)mem_type_id, buf); } } /* end else */ return (jint)status; } /* end Java_hdf_hdf5lib_H5_H5Aread_1VL */