diff options
Diffstat (limited to 'java')
-rw-r--r-- | java/src/hdf/hdf5lib/H5.java | 4 | ||||
-rw-r--r-- | java/src/jni/h5util.c | 10 | ||||
-rw-r--r-- | java/src/jni/h5vlImp.c | 60 | ||||
-rw-r--r-- | java/src/jni/h5vlImp.h | 22 | ||||
-rw-r--r-- | java/test/TestH5VL.java | 26 | ||||
-rw-r--r-- | java/test/testfiles/JUnit-TestH5VL.txt | 3 |
6 files changed, 108 insertions, 17 deletions
diff --git a/java/src/hdf/hdf5lib/H5.java b/java/src/hdf/hdf5lib/H5.java index 5b704dd..872fbc7 100644 --- a/java/src/hdf/hdf5lib/H5.java +++ b/java/src/hdf/hdf5lib/H5.java @@ -10895,9 +10895,11 @@ public class H5 implements java.io.Serializable { /// VOL Connector Functionality public synchronized static native long H5VLregister_connector_by_name(String connector_name, long vipl_id); public synchronized static native long H5VLregister_connector_by_value(int connector_value, long vipl_id); - public synchronized static native boolean H5VLis_connector_registered(String name); + public synchronized static native boolean H5VLis_connector_registered_by_name(String name); + public synchronized static native boolean H5VLis_connector_registered_by_value(int connector_value); public synchronized static native long H5VLget_connector_id(long object_id); public synchronized static native long H5VLget_connector_id_by_name(String name); + public synchronized static native long H5VLget_connector_id_by_value(int connector_value); public synchronized static native String H5VLget_connector_name(long object_id); public synchronized static native void H5VLclose(long connector_id); public synchronized static native void H5VLunregister_connector(long connector_id); diff --git a/java/src/jni/h5util.c b/java/src/jni/h5util.c index 55f7571..f45902f 100644 --- a/java/src/jni/h5util.c +++ b/java/src/jni/h5util.c @@ -28,6 +28,8 @@ extern "C" { #include "hdf5.h" #include "h5util.h" +#define SKIP_UNUSED_DUMP_ROUTINES + /* size of hyperslab buffer when a dataset is bigger than H5TOOLS_MALLOCSIZE */ hsize_t H5TOOLS_BUFSIZE = (32 * 1024 * 1024); /* 32 MB */ int H5TOOLS_TEXT_BLOCK = 16; /* Number of elements on a line in a text export file */ @@ -52,8 +54,10 @@ void *edata; /* Local Prototypes */ /********************/ +#ifndef SKIP_UNUSED_DUMP_ROUTINES static int h5str_dump_region_blocks(JNIEnv *env, h5str_t *str, hid_t region, hid_t region_obj); static int h5str_dump_region_points(JNIEnv *env, h5str_t *str, hid_t region, hid_t region_obj); +#endif static int h5str_is_zero(const void *_mem, size_t size); static hid_t h5str_get_native_type(hid_t type); static hid_t h5str_get_little_endian_type(hid_t type); @@ -708,7 +712,6 @@ h5str_sprintf unsigned char *ucptr = (unsigned char *) in_buf; static char fmt_llong[8], fmt_ullong[8]; H5T_class_t tclass = H5T_NO_CLASS; - H5T_str_t pad; size_t typeSize = 0; H5T_sign_t nsign = H5T_SGN_ERROR; hid_t mtid = H5I_INVALID_HID; @@ -814,7 +817,6 @@ h5str_sprintf else { tmp_str = cptr; } - pad = H5Tget_strpad(tid); /* Check for NULL pointer for string */ if (!tmp_str) { @@ -1482,6 +1484,7 @@ done: return ret_value; } /* end h5str_dump_region_blocks_data */ +#ifndef SKIP_UNUSED_DUMP_ROUTINES static int h5str_dump_region_blocks (JNIEnv *env, h5str_t *str, hid_t region, hid_t region_id) @@ -1569,6 +1572,7 @@ done: return ret_value; } /* end h5str_dump_region_blocks */ +#endif /*------------------------------------------------------------------------- * Purpose: Print the data values from a dataset referenced by region points. @@ -1701,6 +1705,7 @@ done: return ret_value; } /* end h5str_dump_region_points_data */ +#ifndef SKIP_UNUSED_DUMP_ROUTINES static int h5str_dump_region_points (JNIEnv *env, h5str_t *str, hid_t region, hid_t region_id) @@ -1776,6 +1781,7 @@ done: return ret_value; } /* end h5str_dump_region_points */ +#endif static int h5str_is_zero diff --git a/java/src/jni/h5vlImp.c b/java/src/jni/h5vlImp.c index 0fee343..1ead30b 100644 --- a/java/src/jni/h5vlImp.c +++ b/java/src/jni/h5vlImp.c @@ -78,11 +78,11 @@ done: /* * Class: hdf_hdf5lib_H5 - * Method: H5VLis_connector_registered + * Method: H5VLis_connector_registered_by_name * Signature: (Ljava/lang/String;)Z */ JNIEXPORT jboolean JNICALL -Java_hdf_hdf5lib_H5_H5VLis_1connector_1registered +Java_hdf_hdf5lib_H5_H5VLis_1connector_1registered_1by_1name (JNIEnv *env, jclass clss, jobject connector_name) { const char *volName = NULL; @@ -91,11 +91,11 @@ Java_hdf_hdf5lib_H5_H5VLis_1connector_1registered UNUSED(clss); if (NULL == connector_name) - H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5VLis_connector_registered: VOL connector name is NULL"); + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5VLis_connector_registered_by_name: VOL connector name is NULL"); - PIN_JAVA_STRING(ENVONLY, connector_name, volName, NULL, "H5VLis_connector_registered: VOL connector name not pinned"); + PIN_JAVA_STRING(ENVONLY, connector_name, volName, NULL, "H5VLis_connector_registered_by_name: VOL connector name not pinned"); - if ((bval = H5VLis_connector_registered(volName)) < 0) + if ((bval = H5VLis_connector_registered_by_name(volName)) < 0) H5_LIBRARY_ERROR(ENVONLY); bval = (bval > 0) ? JNI_TRUE : JNI_FALSE; @@ -105,7 +105,32 @@ done: UNPIN_JAVA_STRING(ENVONLY, connector_name, volName); return (jboolean)bval; -} /* end Java_hdf_hdf5lib_H5_H5VLis_1connector_1registered */ +} /* end Java_hdf_hdf5lib_H5_H5VLis_1connector_1registered_1by_1name */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5VLis_connector_registered_by_value + * Signature: (I)Z + */ +JNIEXPORT jboolean JNICALL +Java_hdf_hdf5lib_H5_H5VLis_1connector_1registered_1by_1value + (JNIEnv *env, jclass clss, jint connector_value) +{ + htri_t bval = JNI_FALSE; + + UNUSED(clss); + + if (connector_value < 0) + H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5VLis_connector_registered_by_value: VOL connector value < 0"); + + if ((bval = H5VLis_connector_registered_by_value((H5VL_class_value_t)connector_value)) < 0) + H5_LIBRARY_ERROR(ENVONLY); + + bval = (bval > 0) ? JNI_TRUE : JNI_FALSE; + +done: + return (jboolean)bval; +} /* end Java_hdf_hdf5lib_H5_H5VLis_1connector_1registered_1by_1value */ /* * Class: hdf_hdf5lib_H5 @@ -158,6 +183,29 @@ done: /* * Class: hdf_hdf5lib_H5 + * Method: H5VLget_connector_id_by_value + * Signature: (I)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5_H5VLget_1connector_1id_1by_1value + (JNIEnv *env, jclass clss, jint connector_value) +{ + hid_t status = H5I_INVALID_HID; + + UNUSED(clss); + + if (connector_value < 0) + H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5VLget_connector_id_by_value: VOL connector value < 0"); + + if ((status = H5VLget_connector_id_by_value((H5VL_class_value_t)connector_value)) < 0) + H5_LIBRARY_ERROR(ENVONLY); + +done: + return (jlong)status; +} /* end Java_hdf_hdf5lib_H5_H5VLget_1connector_1id_1by_1value */ + +/* + * Class: hdf_hdf5lib_H5 * Method: H5VLget_connector_name * Signature: (J)Ljava/lang/String; */ diff --git a/java/src/jni/h5vlImp.h b/java/src/jni/h5vlImp.h index 6dd7529..a58abef 100644 --- a/java/src/jni/h5vlImp.h +++ b/java/src/jni/h5vlImp.h @@ -40,15 +40,24 @@ Java_hdf_hdf5lib_H5_H5VLregister_1connector_1by_1value /* * Class: hdf_hdf5lib_H5 - * Method: H5VLis_connector_registered + * Method: H5VLis_connector_registered_by_name * Signature: (Ljava/lang/String;)Z */ JNIEXPORT jboolean JNICALL -Java_hdf_hdf5lib_H5_H5VLis_1connector_1registered +Java_hdf_hdf5lib_H5_H5VLis_1connector_1registered_1by_1name (JNIEnv *, jclass, jobject); /* * Class: hdf_hdf5lib_H5 + * Method: H5VLis_connector_registered_by_value + * Signature: (I)Z + */ +JNIEXPORT jboolean JNICALL +Java_hdf_hdf5lib_H5_H5VLis_1connector_1registered_1by_1value + (JNIEnv *, jclass, jint); + +/* + * Class: hdf_hdf5lib_H5 * Method: H5VLget_connector_id * Signature: (J)J */ @@ -67,6 +76,15 @@ Java_hdf_hdf5lib_H5_H5VLget_1connector_1id_1by_1name /* * Class: hdf_hdf5lib_H5 + * Method: H5VLget_connector_id_by_value + * Signature: (I)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5_H5VLget_1connector_1id_1by_1value + (JNIEnv *, jclass, jint); + +/* + * Class: hdf_hdf5lib_H5 * Method: H5VLget_connector_name * Signature: (J)Ljava/lang/String; */ diff --git a/java/test/TestH5VL.java b/java/test/TestH5VL.java index d774dbb..bd660d3 100644 --- a/java/test/TestH5VL.java +++ b/java/test/TestH5VL.java @@ -55,15 +55,18 @@ public class TestH5VL { try { boolean is_registered; - is_registered = H5.H5VLis_connector_registered(HDF5Constants.H5VL_NATIVE_NAME); - assertTrue("H5.H5VLis_connector_registered H5VL_NATIVE_NAME", is_registered); + is_registered = H5.H5VLis_connector_registered_by_name(HDF5Constants.H5VL_NATIVE_NAME); + assertTrue("H5.H5VLis_connector_registered_by_name H5VL_NATIVE_NAME", is_registered); - is_registered = H5.H5VLis_connector_registered("FAKE_VOL_NAME"); - assertFalse("H5.H5VLis_connector_registered FAKE_VOL_NAME", is_registered); + is_registered = H5.H5VLis_connector_registered_by_name("FAKE_VOL_NAME"); + assertFalse("H5.H5VLis_connector_registered_by_name FAKE_VOL_NAME", is_registered); + + is_registered = H5.H5VLis_connector_registered_by_value(HDF5Constants.H5VL_NATIVE_VALUE); + assertTrue("H5.H5VLis_connector_registered_by_value H5VL_NATIVE_VALUE", is_registered); } catch (Throwable err) { err.printStackTrace(); - fail("H5.H5VLis_connector_registered " + err); + fail("testH5VLnative_init(): " + err); } } @@ -113,6 +116,19 @@ public class TestH5VL { } @Test + public void testH5VLget_connector_id_by_value() { + try { + long native_id = H5.H5VLget_connector_id_by_value(HDF5Constants.H5VL_NATIVE_VALUE); + assertTrue("H5.H5VLget_connector_id_by_value H5VL_NATIVE_VALUE", native_id >= 0); + assertEquals(HDF5Constants.H5VL_NATIVE, native_id); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5VLget_connector_id_by_value " + err); + } + } + + @Test public void testH5VLget_connector_name() { String H5_FILE = "testFvl.h5"; diff --git a/java/test/testfiles/JUnit-TestH5VL.txt b/java/test/testfiles/JUnit-TestH5VL.txt index f646009..ff94969 100644 --- a/java/test/testfiles/JUnit-TestH5VL.txt +++ b/java/test/testfiles/JUnit-TestH5VL.txt @@ -1,5 +1,6 @@ JUnit version 4.11 .testH5VLget_connector_id_by_name +.testH5VLget_connector_id_by_value .testH5VLget_connector_id .testH5VLnative_init .testH5VLget_connector_name @@ -8,5 +9,5 @@ JUnit version 4.11 Time: XXXX -OK (6 tests) +OK (7 tests) |