diff options
Diffstat (limited to 'java/src/hdf/hdf5lib/H5.java')
-rw-r--r-- | java/src/hdf/hdf5lib/H5.java | 554 |
1 files changed, 448 insertions, 106 deletions
diff --git a/java/src/hdf/hdf5lib/H5.java b/java/src/hdf/hdf5lib/H5.java index f9f9b65..e354207 100644 --- a/java/src/hdf/hdf5lib/H5.java +++ b/java/src/hdf/hdf5lib/H5.java @@ -499,9 +499,9 @@ public class H5 implements java.io.Serializable { private synchronized static native boolean H5is_library_threadsafe(); // /////// unimplemented //////// - // H5_DLL herr_t H5free_memory(void *mem); - // H5_DLL void *H5allocate_memory(size_t size, hbool_t clear); - // H5_DLL void *H5resize_memory(void *mem, size_t size); + // herr_t H5free_memory(void *mem); + // void *H5allocate_memory(size_t size, hbool_t clear); + // void *H5resize_memory(void *mem, size_t size); // //////////////////////////////////////////////////////////// // // @@ -852,7 +852,8 @@ public class H5 implements java.io.Serializable { * @exception HDF5LibraryException * - Error from the HDF-5 Library. **/ - public static long H5Aget_space(long attr_id) throws HDF5LibraryException { + public static long H5Aget_space(long attr_id) throws HDF5LibraryException + { long id = _H5Aget_space(attr_id); if (id > 0) { log.trace("OPEN_IDS: H5Aget_space add {}", id); @@ -888,7 +889,8 @@ public class H5 implements java.io.Serializable { * @exception HDF5LibraryException * - Error from the HDF-5 Library. **/ - public static long H5Aget_type(long attr_id) throws HDF5LibraryException { + public static long H5Aget_type(long attr_id) throws HDF5LibraryException + { long id = _H5Aget_type(attr_id); if (id > 0) { log.trace("OPEN_IDS: H5Aget_type add {}", id); @@ -918,8 +920,9 @@ public class H5 implements java.io.Serializable { * @exception NullPointerException * - Name is null. **/ - public static long H5Aopen(long obj_id, String attr_name, long aapl_id) throws HDF5LibraryException, - NullPointerException { + public static long H5Aopen(long obj_id, String attr_name, long aapl_id) + throws HDF5LibraryException, NullPointerException + { long id = _H5Aopen(obj_id, attr_name, aapl_id); if (id > 0) { log.trace("OPEN_IDS: H5Aopen add {}", id); @@ -959,7 +962,8 @@ public class H5 implements java.io.Serializable { * - Name is null. **/ public static long H5Aopen_by_idx(long loc_id, String obj_name, int idx_type, int order, long n, long aapl_id, - long lapl_id) throws HDF5LibraryException, NullPointerException { + long lapl_id) throws HDF5LibraryException, NullPointerException + { long id = _H5Aopen_by_idx(loc_id, obj_name, idx_type, order, n, aapl_id, lapl_id); if (id > 0) { log.trace("OPEN_IDS: H5Aopen_by_idx add {}", id); @@ -994,7 +998,8 @@ public class H5 implements java.io.Serializable { * - obj_name is null. **/ public static long H5Aopen_by_name(long loc_id, String obj_name, String attr_name, long aapl_id, long lapl_id) - throws HDF5LibraryException, NullPointerException { + throws HDF5LibraryException, NullPointerException + { long id = _H5Aopen_by_name(loc_id, obj_name, attr_name, aapl_id, lapl_id); if (id > 0) { log.trace("OPEN_IDS: H5Aopen_by_name add {}", id); @@ -1015,8 +1020,10 @@ public class H5 implements java.io.Serializable { * IN: Identifier of an attribute to read. * @param mem_type_id * IN: Identifier of the attribute datatype (in memory). - * @param buf - * IN: Buffer for data to be read. + * @param obj + * Buffer to store data read from the file. + * @param isCriticalPinning + * request lock on data reference. * * @return a non-negative value if successful * @@ -1025,9 +1032,19 @@ public class H5 implements java.io.Serializable { * @exception NullPointerException * - data buffer is null. **/ - public synchronized static native int H5Aread(long attr_id, long mem_type_id, byte[] buf) + public synchronized static native int H5Aread(long attr_id, long mem_type_id, byte[] obj, boolean isCriticalPinning) throws HDF5LibraryException, NullPointerException; + public synchronized static int H5Aread(long attr_id, long mem_type_id, byte[] buf) throws HDF5LibraryException, NullPointerException + { + return H5Aread(attr_id, mem_type_id, buf, true); + } + + public synchronized static int H5Aread(long attr_id, long mem_type_id, Object obj) throws HDF5Exception, HDF5LibraryException, NullPointerException + { + return H5Aread(attr_id, mem_type_id, obj, true); + } + /** * H5Aread reads an attribute, specified with attr_id. The attribute's memory datatype is specified with * mem_type_id. The entire attribute is read into data object from the file. @@ -1038,31 +1055,143 @@ public class H5 implements java.io.Serializable { * IN: Identifier of the attribute datatype (in memory). * @param obj * IN: Object for data to be read. + * @param isCriticalPinning + * request lock on data reference. * * @return a non-negative value if successful * + * @exception HDF5Exception + * - Failure in the data conversion. * @exception HDF5LibraryException * - Error from the HDF-5 Library. * @exception NullPointerException * - data buffer is null. See public synchronized static native int H5Aread( ) **/ - public synchronized static int H5Aread(long attr_id, long mem_type_id, Object obj) throws HDF5Exception, - NullPointerException { - HDFArray theArray = new HDFArray(obj); - byte[] buf = theArray.emptyBytes(); + public synchronized static int H5Aread(long attr_id, long mem_type_id, Object obj, boolean isCriticalPinning) + throws HDF5Exception, HDF5LibraryException, NullPointerException + { + int status = -1; + boolean is1D = false; - // This will raise an exception if there is an error - int status = H5Aread(attr_id, mem_type_id, buf); + Class dataClass = obj.getClass(); + if (!dataClass.isArray()) { + throw (new HDF5JavaException("H5Aread: data is not an array")); + } - // No exception: status really ought to be OK - if (status >= 0) { - obj = theArray.arrayify(buf); + String cname = dataClass.getName(); + is1D = (cname.lastIndexOf('[') == cname.indexOf('[')); + char dname = cname.charAt(cname.lastIndexOf("[") + 1); + log.trace("H5Aread: cname={} is1D={} dname={}", cname, is1D, dname); + + if (is1D && (dname == 'B')) { + log.trace("H5Aread_dname_B"); + status = H5Aread(attr_id, mem_type_id, (byte[]) obj, isCriticalPinning); + } + else if (is1D && (dname == 'S')) { + log.trace("H5Aread_dname_S"); + status = H5Aread_short(attr_id, mem_type_id, (short[]) obj, isCriticalPinning); + } + else if (is1D && (dname == 'I')) { + log.trace("H5Aread_dname_I"); + status = H5Aread_int(attr_id, mem_type_id, (int[]) obj, isCriticalPinning); + } + else if (is1D && (dname == 'J')) { + log.trace("H5Aread_dname_J"); + status = H5Aread_long(attr_id, mem_type_id, (long[]) obj, isCriticalPinning); + } + else if (is1D && (dname == 'F')) { + log.trace("H5Aread_dname_F"); + status = H5Aread_float(attr_id, mem_type_id, (float[]) obj, isCriticalPinning); + } + else if (is1D && (dname == 'D')) { + log.trace("H5Aread_dname_D"); + status = H5Aread_double(attr_id, mem_type_id, (double[]) obj, isCriticalPinning); + } + else if ((H5.H5Tdetect_class(mem_type_id, HDF5Constants.H5T_REFERENCE) && (is1D && (dataClass.getComponentType() == String.class))) || H5.H5Tequal(mem_type_id, HDF5Constants.H5T_STD_REF_DSETREG)) { + log.trace("H5Aread_reg_ref"); + status = H5Aread_reg_ref(attr_id, mem_type_id, (String[]) obj); + } + else if (is1D && (dataClass.getComponentType() == String.class)) { + log.trace("H5Aread_string type"); + status = H5Aread_string(attr_id, mem_type_id, (String[]) obj); + } + else { + // Create a data buffer to hold the data into a Java Array + HDFArray theArray = new HDFArray(obj); + byte[] buf = theArray.emptyBytes(); + log.trace("H5Aread_else"); + + // This will raise an exception if there is an error + status = H5Aread(attr_id, mem_type_id, buf, isCriticalPinning); + + // No exception: status really ought to be OK + if (status >= 0) { + obj = theArray.arrayify(buf); + } + + // clean up these: assign 'null' as hint to gc() + buf = null; + theArray = null; } return status; } - public synchronized static native int H5AreadVL(long attr_id, long mem_type_id, String[] buf) + public synchronized static native int H5Aread_double(long attr_id, long mem_type_id, double[] buf, boolean isCriticalPinning) + throws HDF5LibraryException, NullPointerException; + + public synchronized static int H5Aread_double(long attr_id, long mem_type_id, double[] buf) + throws HDF5LibraryException, NullPointerException + { + return H5Aread_double(attr_id, mem_type_id, buf, true); + } + + public synchronized static native int H5Aread_float(long attr_id, long mem_type_id, float[] buf, boolean isCriticalPinning) + throws HDF5LibraryException, NullPointerException; + + public synchronized static int H5Aread_float(long attr_id, long mem_type_id, float[] buf) + throws HDF5LibraryException, NullPointerException + { + return H5Aread_float(attr_id, mem_type_id, buf, true); + } + + public synchronized static native int H5Aread_int(long attr_id, long mem_type_id, int[] buf, boolean isCriticalPinning) + throws HDF5LibraryException, NullPointerException; + + public synchronized static int H5Aread_int(long attr_id, long mem_type_id, int[] buf) + throws HDF5LibraryException, NullPointerException + { + return H5Aread_int(attr_id, mem_type_id, buf, true); + } + + public synchronized static native int H5Aread_long(long attr_id, long mem_type_id, long[] buf, boolean isCriticalPinning) + throws HDF5LibraryException, NullPointerException; + + public synchronized static int H5Aread_long(long attr_id, long mem_type_id, long[] buf) + throws HDF5LibraryException, NullPointerException + { + return H5Aread_long(attr_id, mem_type_id, buf, true); + } + + public synchronized static native int H5Aread_reg_ref(long attr_id, long mem_type_id, String[] buf) + throws HDF5LibraryException, NullPointerException; + + public synchronized static native int H5Aread_short(long attr_id, long mem_type_id, short[] buf, boolean isCriticalPinning) + throws HDF5LibraryException, NullPointerException; + + public synchronized static int H5Aread_short(long attr_id, long mem_type_id, short[] buf) + throws HDF5LibraryException, NullPointerException + { + return H5Aread_short(attr_id, mem_type_id, buf, true); + } + + public synchronized static native int H5AreadVL(long attr_id, long mem_type_id, Object[] buf) + throws HDF5LibraryException, NullPointerException; + + public synchronized static native int H5Aread_string(long attr_id, long mem_type_id, String[] buf) + throws HDF5LibraryException, NullPointerException; + + public synchronized static native int H5Aread_VLStrings(long attr_id, long mem_type_id, Object[] buf) throws HDF5LibraryException, NullPointerException; public synchronized static native int H5AreadComplex(long attr_id, long mem_type_id, String[] buf) @@ -1123,7 +1252,9 @@ public class H5 implements java.io.Serializable { * @param mem_type_id * IN: Identifier of the attribute datatype (in memory). * @param buf - * IN: Data to be written. + * IN: Buffer with data to be written to the file. + * @param isCriticalPinning + * IN: request lock on data reference. * * @return a non-negative value if successful * @@ -1132,9 +1263,21 @@ public class H5 implements java.io.Serializable { * @exception NullPointerException * - data is null. **/ - public synchronized static native int H5Awrite(long attr_id, long mem_type_id, byte[] buf) + public synchronized static native int H5Awrite(long attr_id, long mem_type_id, byte[] buf, boolean isCriticalPinning) throws HDF5LibraryException, NullPointerException; + public synchronized static int H5Awrite(long attr_id, long mem_type_id, byte[] buf) + throws HDF5LibraryException, NullPointerException + { + return H5Awrite(attr_id, mem_type_id, buf, true); + } + + public synchronized static int H5Awrite(long attr_id, long mem_type_id, Object obj) + throws HDF5Exception, HDF5LibraryException, NullPointerException + { + return H5Awrite(attr_id, mem_type_id, obj, true); + } + /** * H5Awrite writes an attribute, specified with attr_id. The attribute's memory datatype is specified with * mem_type_id. The entire attribute is written from data object to the file. @@ -1145,28 +1288,140 @@ public class H5 implements java.io.Serializable { * IN: Identifier of the attribute datatype (in memory). * @param obj * IN: Data object to be written. + * @param isCriticalPinning + * request lock on data reference. * * @return a non-negative value if successful * + * @exception HDF5Exception + * - Failure in the data conversion. * @exception HDF5LibraryException * - Error from the HDF-5 Library. * @exception NullPointerException - * - data object is null. See public synchronized static native int H5Awrite(int attr_id, int - * mem_type_id, byte[] buf); + * - data object is null **/ - public synchronized static int H5Awrite(long attr_id, long mem_type_id, Object obj) - throws HDF5Exception, NullPointerException + public synchronized static int H5Awrite(long attr_id, long mem_type_id, Object obj, boolean isCriticalPinning) + throws HDF5Exception, HDF5LibraryException, NullPointerException { - HDFArray theArray = new HDFArray(obj); - byte[] buf = theArray.byteify(); + int status = -1; + boolean is1D = false; - int retVal = H5Awrite(attr_id, mem_type_id, buf); - buf = null; - theArray = null; - return retVal; + Class dataClass = obj.getClass(); + if (!dataClass.isArray()) { + throw (new HDF5JavaException("H5Dwrite: data is not an array")); + } + + String cname = dataClass.getName(); + is1D = (cname.lastIndexOf('[') == cname.indexOf('[')); + char dname = cname.charAt(cname.lastIndexOf("[") + 1); + + if (is1D && (dname == 'B')) { + status = H5Awrite(attr_id, mem_type_id, (byte[]) obj, isCriticalPinning); + } + else if (is1D && (dname == 'S')) { + status = H5Awrite_short(attr_id, mem_type_id, (short[]) obj, isCriticalPinning); + } + else if (is1D && (dname == 'I')) { + status = H5Awrite_int(attr_id, mem_type_id, (int[]) obj, isCriticalPinning); + } + else if (is1D && (dname == 'J')) { + status = H5Awrite_long(attr_id, mem_type_id, (long[]) obj, isCriticalPinning); + } + else if (is1D && (dname == 'F')) { + status = H5Awrite_float(attr_id, mem_type_id, (float[]) obj, isCriticalPinning); + } + else if (is1D && (dname == 'D')) { + status = H5Awrite_double(attr_id, mem_type_id, (double[]) obj, isCriticalPinning); + } + else if (is1D && (dataClass.getComponentType() == String.class)) { + log.trace("H5Dwrite_string type"); + status = H5Awrite_string(attr_id, mem_type_id, (String[]) obj); + } + else { + HDFArray theArray = new HDFArray(obj); + byte[] buf = theArray.byteify(); + + status = H5Awrite(attr_id, mem_type_id, buf); + buf = null; + theArray = null; + } + + return status; } - public synchronized static native int H5AwriteVL(long attr_id, long mem_type_id, String[] buf) + public synchronized static native int H5Awrite_double(long attr_id, long mem_type_id, double[] buf, boolean isCriticalPinning) + throws HDF5LibraryException, NullPointerException; + + public synchronized static int H5Awrite_double(long attr_id, long mem_type_id, double[] buf) + throws HDF5LibraryException, NullPointerException + { + return H5Awrite_double(attr_id, mem_type_id, buf, true); + } + + public synchronized static native int H5Awrite_float(long attr_id, long mem_type_id, float[] buf, boolean isCriticalPinning) + throws HDF5LibraryException, NullPointerException; + + public synchronized static int H5Awrite_float(long attr_id, long mem_type_id, float[] buf) + throws HDF5LibraryException, NullPointerException + { + return H5Awrite_float(attr_id, mem_type_id, buf, true); + } + + public synchronized static native int H5Awrite_int(long attr_id, long mem_type_id, int[] buf, boolean isCriticalPinning) + throws HDF5LibraryException, NullPointerException; + + public synchronized static int H5Awrite_int(long attr_id, long mem_type_id, int[] buf) + throws HDF5LibraryException, NullPointerException + { + return H5Awrite_int(attr_id, mem_type_id, buf, true); + } + + public synchronized static native int H5Awrite_long(long attr_id, long mem_type_id, long[] buf, boolean isCriticalPinning) + throws HDF5LibraryException, NullPointerException; + + public synchronized static int H5Awrite_long(long attr_id, long mem_type_id, long[] buf) + throws HDF5LibraryException, NullPointerException + { + return H5Awrite_long(attr_id, mem_type_id, buf, true); + } + + public synchronized static native int H5Awrite_short(long attr_id, long mem_type_id, short[] buf, boolean isCriticalPinning) + throws HDF5LibraryException, NullPointerException; + + public synchronized static int H5Awrite_short(long attr_id, long mem_type_id, short[] buf) + throws HDF5LibraryException, NullPointerException + { + return H5Awrite_short(attr_id, mem_type_id, buf, true); + } + + public synchronized static native int H5Awrite_string(long attr_id, long mem_type_id, String[] buf) + throws HDF5LibraryException, NullPointerException; + + public synchronized static native int H5AwriteVL(long attr_id, long mem_type_id, Object[] buf) + throws HDF5LibraryException, NullPointerException; + + /** + * H5Awrite_VLStrings writes a variable length String dataset, specified by its identifier attr_id, from + * the application memory buffer buf into the file. + * + * ---- contributed by Rosetta Biosoftware + * + * @param attr_id + * Identifier of the attribute read from. + * @param mem_type_id + * Identifier of the memory datatype. + * @param buf + * Buffer with data to be written to the file. + * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - name is null. + **/ + + public synchronized static native int H5Awrite_VLStrings(long attr_id, long mem_type_id, Object[] buf) throws HDF5LibraryException, NullPointerException; /** @@ -1614,8 +1869,8 @@ public class H5 implements java.io.Serializable { * @exception NullPointerException * - name is null. **/ - public static long H5Dopen(long loc_id, String name, long dapl_id) throws HDF5LibraryException, - NullPointerException { + public static long H5Dopen(long loc_id, String name, long dapl_id) throws HDF5LibraryException, NullPointerException + { long id = _H5Dopen2(loc_id, name, dapl_id); if (id > 0) { log.trace("OPEN_IDS: H5Dopen add {}", id); @@ -1664,12 +1919,14 @@ public class H5 implements java.io.Serializable { NullPointerException; public synchronized static int H5Dread(long dataset_id, long mem_type_id, long mem_space_id, long file_space_id, - long xfer_plist_id, byte[] buf) throws HDF5LibraryException, NullPointerException { + long xfer_plist_id, byte[] buf) throws HDF5LibraryException, NullPointerException + { return H5Dread(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, buf, true); } public synchronized static int H5Dread(long dataset_id, long mem_type_id, long mem_space_id, long file_space_id, - long xfer_plist_id, Object obj) throws HDF5Exception, HDF5LibraryException, NullPointerException { + long xfer_plist_id, Object obj) throws HDF5Exception, HDF5LibraryException, NullPointerException + { return H5Dread(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, obj, true); } @@ -1703,7 +1960,8 @@ public class H5 implements java.io.Serializable { **/ public synchronized static int H5Dread(long dataset_id, long mem_type_id, long mem_space_id, long file_space_id, long xfer_plist_id, Object obj, boolean isCriticalPinning) throws HDF5Exception, HDF5LibraryException, - NullPointerException { + NullPointerException + { int status = -1; boolean is1D = false; @@ -1734,7 +1992,8 @@ public class H5 implements java.io.Serializable { } else if (is1D && (dname == 'J')) { log.trace("H5Dread_dname_J"); - status = H5Dread_long(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, (long[]) obj); + status = H5Dread_long(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, (long[]) obj, + isCriticalPinning); } else if (is1D && (dname == 'F')) { log.trace("H5Dread_dname_F"); @@ -1783,7 +2042,8 @@ public class H5 implements java.io.Serializable { throws HDF5LibraryException, NullPointerException; public synchronized static int H5Dread_double(long dataset_id, long mem_type_id, long mem_space_id, - long file_space_id, long xfer_plist_id, double[] buf) throws HDF5LibraryException, NullPointerException { + long file_space_id, long xfer_plist_id, double[] buf) throws HDF5LibraryException, NullPointerException + { return H5Dread_double(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, buf, true); } @@ -1792,7 +2052,8 @@ public class H5 implements java.io.Serializable { throws HDF5LibraryException, NullPointerException; public synchronized static int H5Dread_float(long dataset_id, long mem_type_id, long mem_space_id, - long file_space_id, long xfer_plist_id, float[] buf) throws HDF5LibraryException, NullPointerException { + long file_space_id, long xfer_plist_id, float[] buf) throws HDF5LibraryException, NullPointerException + { return H5Dread_float(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, buf, true); } @@ -1801,7 +2062,8 @@ public class H5 implements java.io.Serializable { NullPointerException; public synchronized static int H5Dread_int(long dataset_id, long mem_type_id, long mem_space_id, - long file_space_id, long xfer_plist_id, int[] buf) throws HDF5LibraryException, NullPointerException { + long file_space_id, long xfer_plist_id, int[] buf) throws HDF5LibraryException, NullPointerException + { return H5Dread_int(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, buf, true); } @@ -1810,22 +2072,21 @@ public class H5 implements java.io.Serializable { NullPointerException; public synchronized static int H5Dread_long(long dataset_id, long mem_type_id, long mem_space_id, - long file_space_id, long xfer_plist_id, long[] buf) throws HDF5LibraryException, NullPointerException { + long file_space_id, long xfer_plist_id, long[] buf) throws HDF5LibraryException, NullPointerException + { return H5Dread_long(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, buf, true); } public synchronized static native int H5Dread_reg_ref(long dataset_id, long mem_type_id, long mem_space_id, long file_space_id, long xfer_plist_id, String[] buf) throws HDF5LibraryException, NullPointerException; - public synchronized static native int H5Dread_reg_ref_data(long dataset_id, long mem_type_id, long mem_space_id, - long file_space_id, long xfer_plist_id, String[] buf) throws HDF5LibraryException, NullPointerException; - public synchronized static native int H5Dread_short(long dataset_id, long mem_type_id, long mem_space_id, long file_space_id, long xfer_plist_id, short[] buf, boolean isCriticalPinning) throws HDF5LibraryException, NullPointerException; public synchronized static int H5Dread_short(long dataset_id, long mem_type_id, long mem_space_id, - long file_space_id, long xfer_plist_id, short[] buf) throws HDF5LibraryException, NullPointerException { + long file_space_id, long xfer_plist_id, short[] buf) throws HDF5LibraryException, NullPointerException + { return H5Dread_short(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, buf, true); } @@ -1929,12 +2190,14 @@ public class H5 implements java.io.Serializable { NullPointerException; public synchronized static int H5Dwrite(long dataset_id, long mem_type_id, long mem_space_id, long file_space_id, - long xfer_plist_id, byte[] buf) throws HDF5LibraryException, NullPointerException { + long xfer_plist_id, byte[] buf) throws HDF5LibraryException, NullPointerException + { return H5Dwrite(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, buf, true); } public synchronized static int H5Dwrite(long dataset_id, long mem_type_id, long mem_space_id, long file_space_id, - long xfer_plist_id, Object obj) throws HDF5Exception, HDF5LibraryException, NullPointerException { + long xfer_plist_id, Object obj) throws HDF5Exception, HDF5LibraryException, NullPointerException + { return H5Dwrite(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, obj, true); } @@ -1968,7 +2231,8 @@ public class H5 implements java.io.Serializable { **/ public synchronized static int H5Dwrite(long dataset_id, long mem_type_id, long mem_space_id, long file_space_id, long xfer_plist_id, Object obj, boolean isCriticalPinning) throws HDF5Exception, HDF5LibraryException, - NullPointerException { + NullPointerException + { int status = -1; boolean is1D = false; @@ -2031,7 +2295,8 @@ public class H5 implements java.io.Serializable { throws HDF5LibraryException, NullPointerException; public synchronized static int H5Dwrite_double(long dataset_id, long mem_type_id, long mem_space_id, - long file_space_id, long xfer_plist_id, double[] buf) throws HDF5LibraryException, NullPointerException { + long file_space_id, long xfer_plist_id, double[] buf) throws HDF5LibraryException, NullPointerException + { return H5Dwrite_double(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, buf, true); } @@ -2040,7 +2305,8 @@ public class H5 implements java.io.Serializable { throws HDF5LibraryException, NullPointerException; public synchronized static int H5Dwrite_float(long dataset_id, long mem_type_id, long mem_space_id, - long file_space_id, long xfer_plist_id, float[] buf) throws HDF5LibraryException, NullPointerException { + long file_space_id, long xfer_plist_id, float[] buf) throws HDF5LibraryException, NullPointerException + { return H5Dwrite_float(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, buf, true); } @@ -2049,7 +2315,8 @@ public class H5 implements java.io.Serializable { NullPointerException; public synchronized static int H5Dwrite_int(long dataset_id, long mem_type_id, long mem_space_id, - long file_space_id, long xfer_plist_id, int[] buf) throws HDF5LibraryException, NullPointerException { + long file_space_id, long xfer_plist_id, int[] buf) throws HDF5LibraryException, NullPointerException + { return H5Dwrite_int(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, buf, true); } @@ -2058,7 +2325,8 @@ public class H5 implements java.io.Serializable { NullPointerException; public synchronized static int H5Dwrite_long(long dataset_id, long mem_type_id, long mem_space_id, - long file_space_id, long xfer_plist_id, long[] buf) throws HDF5LibraryException, NullPointerException { + long file_space_id, long xfer_plist_id, long[] buf) throws HDF5LibraryException, NullPointerException + { return H5Dwrite_long(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, buf, true); } @@ -2067,7 +2335,8 @@ public class H5 implements java.io.Serializable { throws HDF5LibraryException, NullPointerException; public synchronized static int H5Dwrite_short(long dataset_id, long mem_type_id, long mem_space_id, - long file_space_id, long xfer_plist_id, short[] buf) throws HDF5LibraryException, NullPointerException { + long file_space_id, long xfer_plist_id, short[] buf) throws HDF5LibraryException, NullPointerException + { return H5Dwrite_short(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, buf, true); } @@ -2133,10 +2402,10 @@ public class H5 implements java.io.Serializable { public synchronized static native void H5Drefresh(long dset_id) throws HDF5LibraryException; // /////// unimplemented //////// - // H5_DLL herr_t H5Ddebug(hid_t dset_id); - // H5_DLL herr_t H5Dget_chunk_storage_size(hid_t dset_id, const hsize_t *offset, hsize_t *chunk_bytes); - // H5_DLL herr_t H5Dformat_convert(hid_t dset_id); - // H5_DLL herr_t H5Dget_chunk_index_type(hid_t did, H5D_chunk_index_t *idx_type); + // herr_t H5Ddebug(hid_t dset_id); + // herr_t H5Dget_chunk_storage_size(hid_t dset_id, const hsize_t *offset, hsize_t *chunk_bytes); + // herr_t H5Dformat_convert(hid_t dset_id); + // herr_t H5Dget_chunk_index_type(hid_t did, H5D_chunk_index_t *idx_type); // herr_t H5Dgather(hid_t src_space_id, const void *src_buf, hid_t type_id, // size_t dst_buf_size, void *dst_buf, H5D_gather_func_t op, void *op_data); @@ -2808,10 +3077,29 @@ public class H5 implements java.io.Serializable { * - Error from the HDF-5 Library. * @exception NullPointerException * - name is null. + * + * @deprecated As of HDF5 1.10.5 in favor of H5Fis_accessible. **/ public synchronized static native boolean H5Fis_hdf5(String name) throws HDF5LibraryException, NullPointerException; /** + * H5Fis_accessible determines if the file can be opened with the given fapl. + * + * @param name + * IN: File name to check. + * @param file_id + * IN: File identifier for a currently-open HDF5 file + * + * @return true if file is accessible, false if not. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - name is null. + **/ + public synchronized static native boolean H5Fis_accessible(String name, long file_id) throws HDF5LibraryException, NullPointerException; + + /** * H5Fmount mounts the file specified by child_id onto the group specified by loc_id and name using the mount * properties plist_id. * @@ -2942,20 +3230,20 @@ public class H5 implements java.io.Serializable { throws HDF5LibraryException, NullPointerException; // /////// unimplemented //////// - // H5_DLL herr_t H5Fget_eoa(hid_t file_id, haddr_t *eoa); - // H5_DLL herr_t H5Fincrement_filesize(hid_t file_id, hsize_t increment); + // herr_t H5Fget_eoa(hid_t file_id, haddr_t *eoa); + // herr_t H5Fincrement_filesize(hid_t file_id, hsize_t increment); // ssize_t H5Fget_file_image(hid_t file_id, void * buf_ptr, size_t buf_len); // herr_t H5Fget_metadata_read_retry_info(hid_t file_id, H5F_retry_info_t *info); // ssize_t H5Fget_free_sections(hid_t file_id, H5F_mem_t type, size_t nsects, H5F_sect_info_t *sect_info/*out*/); - // H5_DLL herr_t H5Fset_libver_bounds(hid_t file_id, H5F_libver_t low, H5F_libver_t high); - // H5_DLL herr_t H5Fformat_convert(hid_t fid); - // H5_DLL herr_t H5Freset_page_buffering_stats(hid_t file_id); - // H5_DLL herr_t H5Fget_page_buffering_stats(hid_t file_id, unsigned accesses[2], + // herr_t H5Fset_libver_bounds(hid_t file_id, H5F_libver_t low, H5F_libver_t high); + // herr_t H5Fformat_convert(hid_t fid); + // herr_t H5Freset_page_buffering_stats(hid_t file_id); + // herr_t H5Fget_page_buffering_stats(hid_t file_id, unsigned accesses[2], // unsigned hits[2], unsigned misses[2], unsigned evictions[2], unsigned bypasses[2]); - // H5_DLL herr_t H5Fget_mdc_image_info(hid_t file_id, haddr_t *image_addr, hsize_t *image_size); + // herr_t H5Fget_mdc_image_info(hid_t file_id, haddr_t *image_addr, hsize_t *image_size); // #ifdef H5_HAVE_PARALLEL - // H5_DLL herr_t H5Fset_mpi_atomicity(hid_t file_id, hbool_t flag); - // H5_DLL herr_t H5Fget_mpi_atomicity(hid_t file_id, hbool_t *flag); + // herr_t H5Fset_mpi_atomicity(hid_t file_id, hbool_t flag); + // herr_t H5Fget_mpi_atomicity(hid_t file_id, hbool_t *flag); // #endif /* H5_HAVE_PARALLEL */ // /** @@ -3015,25 +3303,25 @@ public class H5 implements java.io.Serializable { // //////////////////////////////////////////////////////////// // /////// unimplemented //////// - // H5_DLL hid_t H5FDregister(const H5FD_class_t *cls); - // H5_DLL herr_t H5FDunregister(hid_t driver_id); - // H5_DLL H5FD_t *H5FDopen(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr); - // H5_DLL herr_t H5FDclose(H5FD_t *file); - // H5_DLL int H5FDcmp(const H5FD_t *f1, const H5FD_t *f2); - // H5_DLL int H5FDquery(const H5FD_t *f, unsigned long *flags); - // H5_DLL haddr_t H5FDalloc(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size); - // H5_DLL herr_t H5FDfree(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, hsize_t size); - // H5_DLL haddr_t H5FDget_eoa(H5FD_t *file, H5FD_mem_t type); - // H5_DLL herr_t H5FDset_eoa(H5FD_t *file, H5FD_mem_t type, haddr_t eoa); - // H5_DLL haddr_t H5FDget_eof(H5FD_t *file, H5FD_mem_t type); - // H5_DLL herr_t H5FDget_vfd_handle(H5FD_t *file, hid_t fapl, void**file_handle); - // H5_DLL herr_t H5FDread(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size, void *buf/*out*/); - // H5_DLL herr_t H5FDwrite(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size, const void *buf); - // H5_DLL herr_t H5FDflush(H5FD_t *file, hid_t dxpl_id, hbool_t closing); - // H5_DLL herr_t H5FDtruncate(H5FD_t *file, hid_t dxpl_id, hbool_t closing); - // H5_DLL herr_t H5FDlock(H5FD_t *file, hbool_t rw); - // H5_DLL herr_t H5FDunlock(H5FD_t *file); - // H5_DLL herr_t H5FDdriver_query(hid_t driver_id, unsigned long *flags/*out*/); + // hid_t H5FDregister(const H5FD_class_t *cls); + // herr_t H5FDunregister(hid_t driver_id); + // H5FD_t *H5FDopen(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr); + // herr_t H5FDclose(H5FD_t *file); + // int H5FDcmp(const H5FD_t *f1, const H5FD_t *f2); + // int H5FDquery(const H5FD_t *f, unsigned long *flags); + // haddr_t H5FDalloc(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size); + // herr_t H5FDfree(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, hsize_t size); + // haddr_t H5FDget_eoa(H5FD_t *file, H5FD_mem_t type); + // herr_t H5FDset_eoa(H5FD_t *file, H5FD_mem_t type, haddr_t eoa); + // haddr_t H5FDget_eof(H5FD_t *file, H5FD_mem_t type); + // herr_t H5FDget_vfd_handle(H5FD_t *file, hid_t fapl, void**file_handle); + // herr_t H5FDread(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size, void *buf/*out*/); + // herr_t H5FDwrite(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size, const void *buf); + // herr_t H5FDflush(H5FD_t *file, hid_t dxpl_id, hbool_t closing); + // herr_t H5FDtruncate(H5FD_t *file, hid_t dxpl_id, hbool_t closing); + // herr_t H5FDlock(H5FD_t *file, hbool_t rw); + // herr_t H5FDunlock(H5FD_t *file); + // herr_t H5FDdriver_query(hid_t driver_id, unsigned long *flags/*out*/); // //////////////////////////////////////////////////////////// // // @@ -3506,7 +3794,7 @@ public class H5 implements java.io.Serializable { // //////////////////////////////////////////////////////////// // // - // H5I: HDF5 1.8 Identifier Interface API Functions // + // H5I: HDF5 Identifier Interface API Functions // // // // //////////////////////////////////////////////////////////// @@ -3662,12 +3950,20 @@ public class H5 implements java.io.Serializable { // hid_t H5Iregister(H5I_type_t type, const void *object); + // typedef herr_t (*H5I_free_t)(void *); // H5I_type_t H5Iregister_type(size_t hash_size, unsigned reserved, H5I_free_t free_func); // void *H5Iremove_verify(hid_t id, H5I_type_t id_type); + // Type of the function to compare objects & keys + // typedef int (*H5I_search_func_t)(void *obj, hid_t id, void *key); // void *H5Isearch(H5I_type_t type, H5I_search_func_t func, void *key); + // Type of the H5Iiterate callback function + // typedef herr_t (*H5I_iterate_func_t)(hid_t id, void *udata); + // herr_t H5Iiterate(H5I_type_t type, H5I_iterate_func_t op, void *op_data); + + // ////////////////////////////////////////////////////////////////// // H5L: Link Interface Functions // // ////////////////////////////////////////////////////////////////// @@ -4695,9 +4991,9 @@ public class H5 implements java.io.Serializable { public synchronized static native void H5Orefresh(long object_id) throws HDF5LibraryException; // /////// unimplemented //////// - // H5_DLL herr_t H5Odisable_mdc_flushes(hid_t object_id); - // H5_DLL herr_t H5Oenable_mdc_flushes(hid_t object_id); - // H5_DLL herr_t H5Oare_mdc_flushes_disabled(hid_t object_id, hbool_t *are_disabled); + // herr_t H5Odisable_mdc_flushes(hid_t object_id); + // herr_t H5Oenable_mdc_flushes(hid_t object_id); + // herr_t H5Oare_mdc_flushes_disabled(hid_t object_id, hbool_t *are_disabled); // //////////////////////////////////////////////////////////// // // @@ -4982,6 +5278,27 @@ public class H5 implements java.io.Serializable { private synchronized static native long _H5Pcopy(long plist) throws HDF5LibraryException; + // Define property list class callback function pointer types + // typedef herr_t (*H5P_cls_create_func_t)(hid_t prop_id, void *create_data); + // typedef herr_t (*H5P_cls_copy_func_t)(hid_t new_prop_id, hid_t old_prop_id, void *copy_data); + // typedef herr_t (*H5P_cls_close_func_t)(hid_t prop_id, void *close_data); + + // Define property list callback function pointer types + // typedef herr_t (*H5P_prp_cb1_t)(const char *name, size_t size, void *value); + // typedef herr_t (*H5P_prp_cb2_t)(hid_t prop_id, const char *name, size_t size, void *value); + // typedef H5P_prp_cb1_t H5P_prp_create_func_t; + // typedef H5P_prp_cb2_t H5P_prp_set_func_t; + // typedef H5P_prp_cb2_t H5P_prp_get_func_t; + // typedef herr_t (*H5P_prp_encode_func_t)(const void *value, void **buf, size_t *size); + // typedef herr_t (*H5P_prp_decode_func_t)(const void **buf, void *value); + // typedef H5P_prp_cb2_t H5P_prp_delete_func_t; + // typedef H5P_prp_cb1_t H5P_prp_copy_func_t; + // typedef int (*H5P_prp_compare_func_t)(const void *value1, const void *value2, size_t size); + // typedef H5P_prp_cb1_t H5P_prp_close_func_t; + + // Define property list iteration function type + // typedef herr_t (*H5P_iterate_t)(hid_t id, const char *name, void *iter_data); + public static long H5Pcreate_class_nocb(long parent_class, String name) throws HDF5LibraryException { long id = _H5Pcreate_class_nocb(parent_class, name); if (id > 0) { @@ -6145,6 +6462,11 @@ public class H5 implements java.io.Serializable { public synchronized static native void H5Pset_evict_on_close(long fapl_id, boolean evict_on_close) throws HDF5LibraryException; + // ///// unimplemented ///// + // herr_t H5Pset_vol(hid_t plist_id, hid_t new_vol_id, const void *new_vol_info); + // herr_t H5Pget_vol_id(hid_t plist_id, hid_t *vol_id); + // herr_t H5Pget_vol_info(hid_t plist_id, void **vol_info); + // Dataset creation property list (DCPL) routines // /** @@ -7523,13 +7845,13 @@ public class H5 implements java.io.Serializable { // herr_t H5Pget_core_write_tracking(hid_t fapl_id, hbool_t *is_enabled, size_t *page_size); // #ifdef H5_HAVE_PARALLEL // herr_t H5Pset_all_coll_metadata_ops(hid_t accpl_id, hbool_t is_collective); - // H5_DLL herr_t H5Pget_all_coll_metadata_ops(hid_t plist_id, hbool_t *is_collective); + // herr_t H5Pget_all_coll_metadata_ops(hid_t plist_id, hbool_t *is_collective); // herr_t H5Pset_coll_metadata_write(hid_t fapl_id, hbool_t is_collective); // herr_t H5Pget_coll_metadata_write(hid_t fapl_id, hbool_t *is_collective); // #endif /* H5_HAVE_PARALLEL */ - // H5_DLL herr_t H5Pset_mdc_image_config(hid_t plist_id, H5AC_cache_image_config_t *config_ptr); - // H5_DLL herr_t H5Pget_mdc_image_config(hid_t plist_id, H5AC_cache_image_config_t *config_ptr /*out*/); - // H5_DLL herr_t H5Pset_page_buffer_size(hid_t plist_id, size_t buf_size, unsigned min_meta_per, unsigned min_raw_per); + // herr_t H5Pset_mdc_image_config(hid_t plist_id, H5AC_cache_image_config_t *config_ptr); + // herr_t H5Pget_mdc_image_config(hid_t plist_id, H5AC_cache_image_config_t *config_ptr /*out*/); + // herr_t H5Pset_page_buffer_size(hid_t plist_id, size_t buf_size, unsigned min_meta_per, unsigned min_raw_per); // herr_t H5Pget_page_buffer_size(hid_t fapl_id, size_t *buf_size, unsigned *min_meta_perc, unsigned *min_raw_perc); // herr_t H5Pset_object_flush_cb (hid_t fapl_id, H5F_flush_cb_t func, void *user_data); // herr_t H5Pget_object_flush_cb (hid_t fapl_id, H5F_flush_cb_t *func, void **user_data); @@ -7552,9 +7874,9 @@ public class H5 implements java.io.Serializable { // herr_t H5Pget_type_conv_cb(hid_t plist, H5T_conv_except_func_t *func, void **op_data) // herr_t H5Pset_type_conv_cb( hid_t plist, H5T_conv_except_func_t func, void *op_data) // #ifdef H5_HAVE_PARALLEL - // H5_DLL herr_t H5Pget_mpio_actual_chunk_opt_mode(hid_t plist_id, H5D_mpio_actual_chunk_opt_mode_t *actual_chunk_opt_mode); - // H5_DLL herr_t H5Pget_mpio_actual_io_mode(hid_t plist_id, H5D_mpio_actual_io_mode_t *actual_io_mode); - // H5_DLL herr_t H5Pget_mpio_no_collective_cause(hid_t plist_id, uint32_t *local_no_collective_cause, uint32_t *global_no_collective_cause); + // herr_t H5Pget_mpio_actual_chunk_opt_mode(hid_t plist_id, H5D_mpio_actual_chunk_opt_mode_t *actual_chunk_opt_mode); + // herr_t H5Pget_mpio_actual_io_mode(hid_t plist_id, H5D_mpio_actual_io_mode_t *actual_io_mode); + // herr_t H5Pget_mpio_no_collective_cause(hid_t plist_id, uint32_t *local_no_collective_cause, uint32_t *global_no_collective_cause); // #endif /* H5_HAVE_PARALLEL */ // Link creation property list (LCPL) routines // @@ -8497,16 +8819,17 @@ public class H5 implements java.io.Serializable { // /////// unimplemented //////// // #ifdef NEW_HYPERSLAB_API - // H5_DLL hid_t H5Scombine_hyperslab(hid_t space_id, H5S_seloper_t op, + // hid_t H5Scombine_hyperslab(hid_t space_id, H5S_seloper_t op, // const hsize_t start[], // const hsize_t _stride[], // const hsize_t count[], // const hsize_t _block[]); - // H5_DLL herr_t H5Sselect_select(hid_t space1_id, H5S_seloper_t op, + // herr_t H5Sselect_select(hid_t space1_id, H5S_seloper_t op, // hid_t space2_id); - // H5_DLL hid_t H5Scombine_select(hid_t space1_id, H5S_seloper_t op, + // hid_t H5Scombine_select(hid_t space1_id, H5S_seloper_t op, // hid_t space2_id); // #endif /* NEW_HYPERSLAB_API */ + // herr_t H5Sselect_copy(hid_t dst_id, hid_t src_id); @@ -9985,6 +10308,25 @@ public class H5 implements java.io.Serializable { // //////////////////////////////////////////////////////////// // // + // H5VL: VOL Interface Functions // + // // + // //////////////////////////////////////////////////////////// + + /// 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 long H5VLget_connector_id(String name); + 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); + + // /////// unimplemented //////// + // hid_t H5VLregister_connector(const H5VL_class_t *cls, hid_t vipl_id); + + + // //////////////////////////////////////////////////////////// + // // // H5Z: Filter Interface Functions // // // // //////////////////////////////////////////////////////////// @@ -9995,9 +10337,9 @@ public class H5 implements java.io.Serializable { public synchronized static native int H5Zunregister(int filter) throws HDF5LibraryException, NullPointerException; -} + // /////// unimplemented //////// -// /////// unimplemented //////// + // herr_t H5Zregister(const void *cls); -// herr_t H5Zregister(const void *cls); +} |