diff options
author | Allen Byrne <50328838+byrnHDF@users.noreply.github.com> | 2021-02-25 21:12:57 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-25 21:12:57 (GMT) |
commit | c7ffe683e57fd8822fcf04320cf0500454486e53 (patch) | |
tree | 416e84f9adfbc32a9499b4dfff9f215a24684500 /java | |
parent | c29e1b9fdfcba9ca276600b1bad4ec2cf17bb01e (diff) | |
download | hdf5-c7ffe683e57fd8822fcf04320cf0500454486e53.zip hdf5-c7ffe683e57fd8822fcf04320cf0500454486e53.tar.gz hdf5-c7ffe683e57fd8822fcf04320cf0500454486e53.tar.bz2 |
Primary change is HDFFV-11212 - new refs and JNI (#372)
* OESS-98 convert plugin option to FetchContent, add tests
* Fixes for pkcfg files because of plugin option
* OESS-98 fix tools test for plugins
* Keep doxygen comments under 100 chars long - format hint
* Whitespace
* HDFFV-11144 - Reclassify CMake messages
* HDFFV-11099/11100 added help text
* Reworked switch statement to compare string instead
* Fix typo
* Update CDash mode
* Correct name of threadsafe
* Correct option name
* Undo accidental commit
* Note LLVM 10 to 11 format default changes
* Update format plugin
* Undo clang-format version 11 changes
* One more correction
* Update supported platforms
* Revert whitespace changes
* Correct whitespace
* Changes from PR#3
* HDFFV-11213 added option to control gcc10 warnings diagnostics
* HDFFV-11212 Use the new references correctly in JNI utility and tests
* format source
* Fix typo
* Add new test file
* HDFFV-11212 - update test and remove unused arg
* Minor non-space formatting changes
* Use H5I_INVALID_ID instead of "-1"
* source formatting
* add missing testfile, update jni function
* Undo commit of debug code
* remove mislocated file
* Fix h5repack test for handling of fapls and id close
* Update h5diff test files usage text
* HDFFV-11212 add new ref tests for JNI export dataset
* src format update
* Remove blank line typo
* src format typo
* long double requires %Lg
* Another long double foramt specifer S.B. %Lg
* issue with t128bit test
* Windows issue with h5dump and type.
* Fix review issues
* refactor function nesting and fix error checks
* format fixes
* Remove untested functions and javadoc quiet comments
* Restore TRY block.
* Change string append errors to memory exception
* revert to H5_JNI_FATAL_ERROR - support functions need work
* Add assertion error for h5util functions
* remove duplicate function
* format fix
* Revert HD function error handling
* Update copyright comments
Diffstat (limited to 'java')
98 files changed, 2333 insertions, 1182 deletions
diff --git a/java/examples/datasets/H5Ex_D_Alloc.java b/java/examples/datasets/H5Ex_D_Alloc.java index dd7e7ae..e4fcde2 100644 --- a/java/examples/datasets/H5Ex_D_Alloc.java +++ b/java/examples/datasets/H5Ex_D_Alloc.java @@ -65,11 +65,11 @@ public class H5Ex_D_Alloc { } private static void allocation() { - long file_id = -1; - long filespace_id = -1; - long dataset_id1 = -1; - long dataset_id2 = -1; - long dcpl_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long filespace_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id1 = HDF5Constants.H5I_INVALID_HID; + long dataset_id2 = HDF5Constants.H5I_INVALID_HID; + long dcpl_id = HDF5Constants.H5I_INVALID_HID; long[] dims = { DIM_X, DIM_Y }; int[][] dset_data = new int[DIM_X][DIM_Y]; int space_status = 0; diff --git a/java/examples/datasets/H5Ex_D_Checksum.java b/java/examples/datasets/H5Ex_D_Checksum.java index 9dcfdb3..2298791 100644 --- a/java/examples/datasets/H5Ex_D_Checksum.java +++ b/java/examples/datasets/H5Ex_D_Checksum.java @@ -93,10 +93,10 @@ public class H5Ex_D_Checksum { } private static void writeChecksum() { - long file_id = -1; - long filespace_id = -1; - long dataset_id = -1; - long dcpl_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long filespace_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; + long dcpl_id = HDF5Constants.H5I_INVALID_HID; long[] dims = { DIM_X, DIM_Y }; long[] chunk_dims = { CHUNK_X, CHUNK_Y }; int[][] dset_data = new int[DIM_X][DIM_Y]; @@ -193,9 +193,9 @@ public class H5Ex_D_Checksum { } private static void readChecksum() { - long file_id = -1; - long dataset_id = -1; - long dcpl_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; + long dcpl_id = HDF5Constants.H5I_INVALID_HID; int[][] dset_data = new int[DIM_X][DIM_Y]; // Open an existing file. diff --git a/java/examples/datasets/H5Ex_D_Chunk.java b/java/examples/datasets/H5Ex_D_Chunk.java index 3afa53c..fdbc47d 100644 --- a/java/examples/datasets/H5Ex_D_Chunk.java +++ b/java/examples/datasets/H5Ex_D_Chunk.java @@ -66,10 +66,10 @@ public class H5Ex_D_Chunk { } private static void writeChunk() { - long file_id = -1; - long filespace_id = -1; - long dataset_id = -1; - long dcpl_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long filespace_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; + long dcpl_id = HDF5Constants.H5I_INVALID_HID; long[] dims = { DIM_X, DIM_Y }; long[] chunk_dims = { CHUNK_X, CHUNK_Y }; int[][] dset_data = new int[DIM_X][DIM_Y]; @@ -201,10 +201,10 @@ public class H5Ex_D_Chunk { } private static void readChunk() { - long file_id = -1; - long filespace_id = -1; - long dataset_id = -1; - long dcpl_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long filespace_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; + long dcpl_id = HDF5Constants.H5I_INVALID_HID; int[][] dset_data = new int[DIM_X][DIM_Y]; // Open an existing file. diff --git a/java/examples/datasets/H5Ex_D_Compact.java b/java/examples/datasets/H5Ex_D_Compact.java index 347c05c..509b221 100644 --- a/java/examples/datasets/H5Ex_D_Compact.java +++ b/java/examples/datasets/H5Ex_D_Compact.java @@ -60,10 +60,10 @@ public class H5Ex_D_Compact { } private static void writeCompact() { - long file_id = -1; - long filespace_id = -1; - long dataset_id = -1; - long dcpl_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long filespace_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; + long dcpl_id = HDF5Constants.H5I_INVALID_HID; long[] dims = { DIM_X, DIM_Y }; int[][] dset_data = new int[DIM_X][DIM_Y]; @@ -163,10 +163,10 @@ public class H5Ex_D_Compact { } private static void readCompact() { - long file_id = -1; - long filespace_id = -1; - long dataset_id = -1; - long dcpl_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long filespace_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; + long dcpl_id = HDF5Constants.H5I_INVALID_HID; int[][] dset_data = new int[DIM_X][DIM_Y]; // Open file and dataset using the default properties. diff --git a/java/examples/datasets/H5Ex_D_External.java b/java/examples/datasets/H5Ex_D_External.java index 5cf03af..c88234c 100644 --- a/java/examples/datasets/H5Ex_D_External.java +++ b/java/examples/datasets/H5Ex_D_External.java @@ -34,10 +34,10 @@ public class H5Ex_D_External { private static final int NAME_BUF_SIZE = 32; private static void writeExternal() { - long file_id = -1; - long dcpl_id = -1; - long filespace_id = -1; - long dataset_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long dcpl_id = HDF5Constants.H5I_INVALID_HID; + long filespace_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; long[] dims = { DIM_X, DIM_Y }; int[][] dset_data = new int[DIM_X][DIM_Y]; @@ -138,9 +138,9 @@ public class H5Ex_D_External { } private static void readExternal() { - long file_id = -1; - long dcpl_id = -1; - long dataset_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long dcpl_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; int[][] dset_data = new int[DIM_X][DIM_Y]; String[] Xname = new String[1]; diff --git a/java/examples/datasets/H5Ex_D_FillValue.java b/java/examples/datasets/H5Ex_D_FillValue.java index a19c026..c8b905e 100644 --- a/java/examples/datasets/H5Ex_D_FillValue.java +++ b/java/examples/datasets/H5Ex_D_FillValue.java @@ -40,10 +40,10 @@ public class H5Ex_D_FillValue { private static final int FILLVAL = 99; private static void fillValue() { - long file_id = -1; - long dcpl_id = -1; - long dataspace_id = -1; - long dataset_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long dcpl_id = HDF5Constants.H5I_INVALID_HID; + long dataspace_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; long[] dims = { DIM_X, DIM_Y }; long[] extdims = { EDIM_X, EDIM_Y }; long[] chunk_dims = { CHUNK_X, CHUNK_Y }; diff --git a/java/examples/datasets/H5Ex_D_Gzip.java b/java/examples/datasets/H5Ex_D_Gzip.java index 67d15bb..cbe6be9 100644 --- a/java/examples/datasets/H5Ex_D_Gzip.java +++ b/java/examples/datasets/H5Ex_D_Gzip.java @@ -95,10 +95,10 @@ public class H5Ex_D_Gzip { } private static void writeGzip() { - long file_id = -1; - long filespace_id = -1; - long dataset_id = -1; - long dcpl_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long filespace_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; + long dcpl_id = HDF5Constants.H5I_INVALID_HID; long[] dims = { DIM_X, DIM_Y }; long[] chunk_dims = { CHUNK_X, CHUNK_Y }; int[][] dset_data = new int[DIM_X][DIM_Y]; @@ -196,9 +196,9 @@ public class H5Ex_D_Gzip { } private static void readGzip() { - long file_id = -1; - long dataset_id = -1; - long dcpl_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; + long dcpl_id = HDF5Constants.H5I_INVALID_HID; int[][] dset_data = new int[DIM_X][DIM_Y]; // Open an existing file. diff --git a/java/examples/datasets/H5Ex_D_Hyperslab.java b/java/examples/datasets/H5Ex_D_Hyperslab.java index 57dfa6a..6174478 100644 --- a/java/examples/datasets/H5Ex_D_Hyperslab.java +++ b/java/examples/datasets/H5Ex_D_Hyperslab.java @@ -34,9 +34,9 @@ public class H5Ex_D_Hyperslab { private static final int RANK = 2; private static void writeHyperslab() { - long file_id = -1; - long filespace_id = -1; - long dataset_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long filespace_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; long[] dims = { DIM_X, DIM_Y }; int[][] dset_data = new int[DIM_X][DIM_Y]; @@ -142,10 +142,10 @@ public class H5Ex_D_Hyperslab { } private static void readHyperslab() { - long file_id = -1; - long filespace_id = -1; - long dataset_id = -1; - long dcpl_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long filespace_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; + long dcpl_id = HDF5Constants.H5I_INVALID_HID; int[][] dset_data = new int[DIM_X][DIM_Y]; // Open an existing file. diff --git a/java/examples/datasets/H5Ex_D_Nbit.java b/java/examples/datasets/H5Ex_D_Nbit.java index d995a02..417d88b 100644 --- a/java/examples/datasets/H5Ex_D_Nbit.java +++ b/java/examples/datasets/H5Ex_D_Nbit.java @@ -96,11 +96,11 @@ public class H5Ex_D_Nbit { } private static void writeData() throws Exception { - long file_id = -1; - long filespace_id = -1; - long dataset_id = -1; - long dtype_id = -1; - long dcpl_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long filespace_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; + long dtype_id = HDF5Constants.H5I_INVALID_HID; + long dcpl_id = HDF5Constants.H5I_INVALID_HID; long[] dims = { DIM_X, DIM_Y }; long[] chunk_dims = { CHUNK_X, CHUNK_Y }; int[][] dset_data = new int[DIM_X][DIM_Y]; @@ -157,9 +157,9 @@ public class H5Ex_D_Nbit { } private static void readData() throws Exception { - long file_id = -1; - long dataset_id = -1; - long dcpl_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; + long dcpl_id = HDF5Constants.H5I_INVALID_HID; int[][] dset_data = new int[DIM_X][DIM_Y]; // Open an existing file. diff --git a/java/examples/datasets/H5Ex_D_ReadWrite.java b/java/examples/datasets/H5Ex_D_ReadWrite.java index 3f6e9ac..cf33057 100644 --- a/java/examples/datasets/H5Ex_D_ReadWrite.java +++ b/java/examples/datasets/H5Ex_D_ReadWrite.java @@ -32,9 +32,9 @@ public class H5Ex_D_ReadWrite { private static final int RANK = 2; private static void WriteDataset() { - long file_id = -1; - long filespace_id = -1; - long dataset_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long filespace_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; long[] dims = { DIM_X, DIM_Y }; int[][] dset_data = new int[DIM_X][DIM_Y]; @@ -109,8 +109,8 @@ public class H5Ex_D_ReadWrite { } private static void ReadDataset() { - long file_id = -1; - long dataset_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; int[][] dset_data = new int[DIM_X][DIM_Y]; // Open file using the default properties. diff --git a/java/examples/datasets/H5Ex_D_Shuffle.java b/java/examples/datasets/H5Ex_D_Shuffle.java index 9677e75..9e705bd 100644 --- a/java/examples/datasets/H5Ex_D_Shuffle.java +++ b/java/examples/datasets/H5Ex_D_Shuffle.java @@ -122,10 +122,10 @@ public class H5Ex_D_Shuffle { } private static void writeShuffle() { - long file_id = -1; - long filespace_id = -1; - long dataset_id = -1; - long dcpl_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long filespace_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; + long dcpl_id = HDF5Constants.H5I_INVALID_HID; long[] dims = { DIM_X, DIM_Y }; long[] chunk_dims = { CHUNK_X, CHUNK_Y }; int[][] dset_data = new int[DIM_X][DIM_Y]; @@ -229,9 +229,9 @@ public class H5Ex_D_Shuffle { } private static void readShuffle() { - long file_id = -1; - long dataset_id = -1; - long dcpl_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; + long dcpl_id = HDF5Constants.H5I_INVALID_HID; int[][] dset_data = new int[DIM_X][DIM_Y]; // Open an existing file. diff --git a/java/examples/datasets/H5Ex_D_Sofloat.java b/java/examples/datasets/H5Ex_D_Sofloat.java index 5818371..22ee2d3 100644 --- a/java/examples/datasets/H5Ex_D_Sofloat.java +++ b/java/examples/datasets/H5Ex_D_Sofloat.java @@ -96,10 +96,10 @@ public class H5Ex_D_Sofloat { } private static void writeData() { - long file_id = -1; - long filespace_id = -1; - long dataset_id = -1; - long dcpl_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long filespace_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; + long dcpl_id = HDF5Constants.H5I_INVALID_HID; long[] dims = { DIM_X, DIM_Y }; long[] chunk_dims = { CHUNK_X, CHUNK_Y }; double[][] dset_data = new double[DIM_X][DIM_Y]; @@ -213,9 +213,9 @@ public class H5Ex_D_Sofloat { } private static void readData() { - long file_id = -1; - long dataset_id = -1; - long dcpl_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; + long dcpl_id = HDF5Constants.H5I_INVALID_HID; double[][] dset_data = new double[DIM_X][DIM_Y]; // Open file using the default properties. diff --git a/java/examples/datasets/H5Ex_D_Soint.java b/java/examples/datasets/H5Ex_D_Soint.java index 3f5f170..b2f0a29 100644 --- a/java/examples/datasets/H5Ex_D_Soint.java +++ b/java/examples/datasets/H5Ex_D_Soint.java @@ -96,10 +96,10 @@ public class H5Ex_D_Soint { } private static void writeData() { - long file_id = -1; - long filespace_id = -1; - long dataset_id = -1; - long dcpl_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long filespace_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; + long dcpl_id = HDF5Constants.H5I_INVALID_HID; long[] dims = { DIM_X, DIM_Y }; long[] chunk_dims = { CHUNK_X, CHUNK_Y }; int[][] dset_data = new int[DIM_X][DIM_Y]; @@ -195,9 +195,9 @@ public class H5Ex_D_Soint { } private static void readData() { - long file_id = -1; - long dataset_id = -1; - long dcpl_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; + long dcpl_id = HDF5Constants.H5I_INVALID_HID; int[][] dset_data = new int[DIM_X][DIM_Y]; // Open file using the default properties. diff --git a/java/examples/datasets/H5Ex_D_Szip.java b/java/examples/datasets/H5Ex_D_Szip.java index 57ba873..8891bc9 100644 --- a/java/examples/datasets/H5Ex_D_Szip.java +++ b/java/examples/datasets/H5Ex_D_Szip.java @@ -95,10 +95,10 @@ public class H5Ex_D_Szip { } private static void writeSzip() { - long file_id = -1; - long filespace_id = -1; - long dataset_id = -1; - long dcpl_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long filespace_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; + long dcpl_id = HDF5Constants.H5I_INVALID_HID; long[] dims = { DIM_X, DIM_Y }; long[] chunk_dims = { CHUNK_X, CHUNK_Y }; int[][] dset_data = new int[DIM_X][DIM_Y]; @@ -196,9 +196,9 @@ public class H5Ex_D_Szip { } private static void readSzip() { - long file_id = -1; - long dataset_id = -1; - long dcpl_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; + long dcpl_id = HDF5Constants.H5I_INVALID_HID; int[][] dset_data = new int[DIM_X][DIM_Y]; // Open an existing file. diff --git a/java/examples/datasets/H5Ex_D_Transform.java b/java/examples/datasets/H5Ex_D_Transform.java index 04bfa2e..7f0cf5a 100644 --- a/java/examples/datasets/H5Ex_D_Transform.java +++ b/java/examples/datasets/H5Ex_D_Transform.java @@ -36,10 +36,10 @@ public class H5Ex_D_Transform { private static String RTRANSFORM = "x-1"; private static void writeData() { - long file_id = -1; - long filespace_id = -1; - long dataset_id = -1; - long dxpl_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long filespace_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; + long dxpl_id = HDF5Constants.H5I_INVALID_HID; long[] dims = { DIM_X, DIM_Y }; int[][] dset_data = new int[DIM_X][DIM_Y]; @@ -144,9 +144,9 @@ public class H5Ex_D_Transform { private static void readData() { - long file_id = -1; - long dataset_id = -1; - long dxpl_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; + long dxpl_id = HDF5Constants.H5I_INVALID_HID; int[][] dset_data = new int[DIM_X][DIM_Y]; // Open an existing file using the default properties. diff --git a/java/examples/datasets/H5Ex_D_UnlimitedAdd.java b/java/examples/datasets/H5Ex_D_UnlimitedAdd.java index 925023a..deecd7c 100644 --- a/java/examples/datasets/H5Ex_D_UnlimitedAdd.java +++ b/java/examples/datasets/H5Ex_D_UnlimitedAdd.java @@ -39,10 +39,10 @@ public class H5Ex_D_UnlimitedAdd { private static final int NDIMS = 2; private static void writeUnlimited() { - long file_id = -1; - long dcpl_id = -1; - long dataspace_id = -1; - long dataset_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long dcpl_id = HDF5Constants.H5I_INVALID_HID; + long dataspace_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; long[] dims = { DIM_X, DIM_Y }; long[] chunk_dims = { CHUNK_X, CHUNK_Y }; long[] maxdims = { HDF5Constants.H5S_UNLIMITED, HDF5Constants.H5S_UNLIMITED }; @@ -143,9 +143,9 @@ public class H5Ex_D_UnlimitedAdd { } private static void extendUnlimited() { - long file_id = -1; - long dataspace_id = -1; - long dataset_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long dataspace_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; long[] dims = { DIM_X, DIM_Y }; long[] extdims = { EDIM_X, EDIM_Y }; long[] start = { 0, 0 }; @@ -293,9 +293,9 @@ public class H5Ex_D_UnlimitedAdd { } private static void readUnlimited() { - long file_id = -1; - long dataspace_id = -1; - long dataset_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long dataspace_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; long[] dims = { DIM_X, DIM_Y }; int[][] dset_data; diff --git a/java/examples/datasets/H5Ex_D_UnlimitedGzip.java b/java/examples/datasets/H5Ex_D_UnlimitedGzip.java index 40ddc60..2421610 100644 --- a/java/examples/datasets/H5Ex_D_UnlimitedGzip.java +++ b/java/examples/datasets/H5Ex_D_UnlimitedGzip.java @@ -99,10 +99,10 @@ public class H5Ex_D_UnlimitedGzip { } private static void writeUnlimited() { - long file_id = -1; - long dcpl_id = -1; - long dataspace_id = -1; - long dataset_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long dcpl_id = HDF5Constants.H5I_INVALID_HID; + long dataspace_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; long[] dims = { DIM_X, DIM_Y }; long[] chunk_dims = { CHUNK_X, CHUNK_Y }; long[] maxdims = { HDF5Constants.H5S_UNLIMITED, HDF5Constants.H5S_UNLIMITED }; @@ -200,9 +200,9 @@ public class H5Ex_D_UnlimitedGzip { } private static void extendUnlimited() { - long file_id = -1; - long dataspace_id = -1; - long dataset_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long dataspace_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; long[] dims = { DIM_X, DIM_Y }; long[] extdims = { EDIM_X, EDIM_Y }; long[] start = { 0, 0 }; @@ -350,10 +350,10 @@ public class H5Ex_D_UnlimitedGzip { } private static void readUnlimited() { - long file_id = -1; - long dataspace_id = -1; - long dataset_id = -1; - long dcpl_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long dataspace_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; + long dcpl_id = HDF5Constants.H5I_INVALID_HID; long[] dims = { DIM_X, DIM_Y }; int[][] dset_data; diff --git a/java/examples/datasets/H5Ex_D_UnlimitedMod.java b/java/examples/datasets/H5Ex_D_UnlimitedMod.java index 0476bc1..966ab03 100644 --- a/java/examples/datasets/H5Ex_D_UnlimitedMod.java +++ b/java/examples/datasets/H5Ex_D_UnlimitedMod.java @@ -39,10 +39,10 @@ public class H5Ex_D_UnlimitedMod { private static final int NDIMS = 2; private static void writeUnlimited() { - long file_id = -1; - long dcpl_id = -1; - long dataspace_id = -1; - long dataset_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long dcpl_id = HDF5Constants.H5I_INVALID_HID; + long dataspace_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; long[] dims = { DIM_X, DIM_Y }; long[] chunk_dims = { CHUNK_X, CHUNK_Y }; long[] maxdims = { HDF5Constants.H5S_UNLIMITED, HDF5Constants.H5S_UNLIMITED }; @@ -143,9 +143,9 @@ public class H5Ex_D_UnlimitedMod { } private static void extendUnlimited() { - long file_id = -1; - long dataspace_id = -1; - long dataset_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long dataspace_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; long[] dims = { DIM_X, DIM_Y }; long[] extdims = { EDIM_X, EDIM_Y }; int[][] dset_data; @@ -279,9 +279,9 @@ public class H5Ex_D_UnlimitedMod { } private static void readUnlimited() { - long file_id = -1; - long dataspace_id = -1; - long dataset_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long dataspace_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; long[] dims = { DIM_X, DIM_Y }; int[][] dset_data; diff --git a/java/examples/datatypes/H5Ex_T_Array.java b/java/examples/datatypes/H5Ex_T_Array.java index 30eb360..7b8a4bd 100644 --- a/java/examples/datatypes/H5Ex_T_Array.java +++ b/java/examples/datatypes/H5Ex_T_Array.java @@ -34,11 +34,11 @@ public class H5Ex_T_Array { private static final int NDIMS = 2; private static void CreateDataset() { - long file_id = -1; - long filetype_id = -1; - long memtype_id = -1; - long dataspace_id = -1; - long dataset_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long filetype_id = HDF5Constants.H5I_INVALID_HID; + long memtype_id = HDF5Constants.H5I_INVALID_HID; + long dataspace_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; long[] dims = { DIM0 }; long[] adims = { ADIM0, ADIM1 }; int[][][] dset_data = new int[DIM0][ADIM0][ADIM1]; @@ -152,10 +152,10 @@ public class H5Ex_T_Array { } private static void ReadDataset() { - long file_id = -1; - long filetype_id = -1; - long memtype_id = -1; - long dataset_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long filetype_id = HDF5Constants.H5I_INVALID_HID; + long memtype_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; long[] dims = { DIM0 }; long[] adims = { ADIM0, ADIM1 }; int[][][] dset_data; diff --git a/java/examples/datatypes/H5Ex_T_ArrayAttribute.java b/java/examples/datatypes/H5Ex_T_ArrayAttribute.java index 26d7fb6..cd6b174 100644 --- a/java/examples/datatypes/H5Ex_T_ArrayAttribute.java +++ b/java/examples/datatypes/H5Ex_T_ArrayAttribute.java @@ -35,12 +35,12 @@ public class H5Ex_T_ArrayAttribute { private static final int NDIMS = 2; private static void CreateDataset() { - long file_id = -1; - long filetype_id = -1; - long memtype_id = -1; - long dataspace_id = -1; - long dataset_id = -1; - long attribute_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long filetype_id = HDF5Constants.H5I_INVALID_HID; + long memtype_id = HDF5Constants.H5I_INVALID_HID; + long dataspace_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; + long attribute_id = HDF5Constants.H5I_INVALID_HID; long[] dims = { DIM0 }; long[] adims = { ADIM0, ADIM1 }; int[][][] dset_data = new int[DIM0][ADIM0][ADIM1]; @@ -84,7 +84,7 @@ public class H5Ex_T_ArrayAttribute { dataset_id = H5.H5Dcreate(file_id, DATASETNAME, HDF5Constants.H5T_STD_I32LE, dataspace_id, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); H5.H5Sclose(dataspace_id); - dataspace_id = -1; + dataspace_id = HDF5Constants.H5I_INVALID_HID; } } catch (Exception e) { @@ -175,11 +175,11 @@ public class H5Ex_T_ArrayAttribute { } private static void ReadDataset() { - long file_id = -1; - long filetype_id = -1; - long memtype_id = -1; - long dataset_id = -1; - long attribute_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long filetype_id = HDF5Constants.H5I_INVALID_HID; + long memtype_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; + long attribute_id = HDF5Constants.H5I_INVALID_HID; long[] dims = { DIM0 }; long[] adims = { ADIM0, ADIM1 }; int[][][] dset_data; diff --git a/java/examples/datatypes/H5Ex_T_Bit.java b/java/examples/datatypes/H5Ex_T_Bit.java index 30acda4..d14f850 100644 --- a/java/examples/datatypes/H5Ex_T_Bit.java +++ b/java/examples/datatypes/H5Ex_T_Bit.java @@ -32,9 +32,9 @@ public class H5Ex_T_Bit { private static final int RANK = 2; private static void CreateDataset() { - long file_id = -1; - long dataspace_id = -1; - long dataset_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long dataspace_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; long[] dims = { DIM0, DIM1 }; int[][] dset_data = new int[DIM0][DIM1]; @@ -116,9 +116,9 @@ public class H5Ex_T_Bit { } private static void ReadDataset() { - long file_id = -1; - long dataspace_id = -1; - long dataset_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long dataspace_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; long[] dims = { DIM0, DIM1 }; int[][] dset_data; diff --git a/java/examples/datatypes/H5Ex_T_BitAttribute.java b/java/examples/datatypes/H5Ex_T_BitAttribute.java index 2059dd5..eae9624 100644 --- a/java/examples/datatypes/H5Ex_T_BitAttribute.java +++ b/java/examples/datatypes/H5Ex_T_BitAttribute.java @@ -33,10 +33,10 @@ public class H5Ex_T_BitAttribute { private static final int RANK = 2; private static void CreateDataset() { - long file_id = -1; - long dataspace_id = -1; - long dataset_id = -1; - long attribute_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long dataspace_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; + long attribute_id = HDF5Constants.H5I_INVALID_HID; long[] dims = { DIM0, DIM1 }; int[][] dset_data = new int[DIM0][DIM1]; @@ -66,7 +66,7 @@ public class H5Ex_T_BitAttribute { dataset_id = H5.H5Dcreate(file_id, DATASETNAME, HDF5Constants.H5T_STD_I32LE, dataspace_id, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); H5.H5Sclose(dataspace_id); - dataspace_id = -1; + dataspace_id = HDF5Constants.H5I_INVALID_HID; } } catch (Exception e) { @@ -139,10 +139,10 @@ public class H5Ex_T_BitAttribute { } private static void ReadDataset() { - long file_id = -1; - long dataspace_id = -1; - long dataset_id = -1; - long attribute_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long dataspace_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; + long attribute_id = HDF5Constants.H5I_INVALID_HID; long[] dims = { DIM0, DIM1 }; int[][] dset_data; diff --git a/java/examples/datatypes/H5Ex_T_Commit.java b/java/examples/datatypes/H5Ex_T_Commit.java index 35caa6b..fe72d58 100644 --- a/java/examples/datatypes/H5Ex_T_Commit.java +++ b/java/examples/datatypes/H5Ex_T_Commit.java @@ -101,9 +101,9 @@ public class H5Ex_T_Commit { } private static void CreateDataType() { - long file_id = -1; - long strtype_id = -1; - long filetype_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long strtype_id = HDF5Constants.H5I_INVALID_HID; + long filetype_id = HDF5Constants.H5I_INVALID_HID; Sensor_Datatype datatypes = new Sensor_Datatype(); // Create a new file using default properties. try { @@ -183,9 +183,9 @@ public class H5Ex_T_Commit { } private static void ReadDataType() { - long file_id = -1; - long typeclass_id = -1; - long filetype_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long typeclass_id = HDF5Constants.H5I_INVALID_HID; + long filetype_id = HDF5Constants.H5I_INVALID_HID; // Open an existing file. try { diff --git a/java/examples/datatypes/H5Ex_T_Compound.java b/java/examples/datatypes/H5Ex_T_Compound.java index 61e79c7..b5b30b1 100644 --- a/java/examples/datatypes/H5Ex_T_Compound.java +++ b/java/examples/datatypes/H5Ex_T_Compound.java @@ -122,12 +122,12 @@ public class H5Ex_T_Compound { } private static void CreateDataset() { - long file_id = -1; - long strtype_id = -1; - long memtype_id = -1; - long filetype_id = -1; - long dataspace_id = -1; - long dataset_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long strtype_id = HDF5Constants.H5I_INVALID_HID; + long memtype_id = HDF5Constants.H5I_INVALID_HID; + long filetype_id = HDF5Constants.H5I_INVALID_HID; + long dataspace_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; long[] dims = { DIM0 }; Sensor[] object_data = new Sensor[DIM0]; byte[] dset_data = null; @@ -286,11 +286,11 @@ public class H5Ex_T_Compound { } private static void ReadDataset() { - long file_id = -1; - long strtype_id = -1; - long memtype_id = -1; - long dataspace_id = -1; - long dataset_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long strtype_id = HDF5Constants.H5I_INVALID_HID; + long memtype_id = HDF5Constants.H5I_INVALID_HID; + long dataspace_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; long[] dims = { DIM0 }; Sensor[] object_data2; byte[] dset_data; diff --git a/java/examples/datatypes/H5Ex_T_CompoundAttribute.java b/java/examples/datatypes/H5Ex_T_CompoundAttribute.java index 4294b4a..678472f 100644 --- a/java/examples/datatypes/H5Ex_T_CompoundAttribute.java +++ b/java/examples/datatypes/H5Ex_T_CompoundAttribute.java @@ -125,13 +125,13 @@ public class H5Ex_T_CompoundAttribute { } private static void CreateDataset() { - long file_id = -1; - long strtype_id = -1; - long memtype_id = -1; - long filetype_id = -1; - long dataspace_id = -1; - long dataset_id = -1; - long attribute_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long strtype_id = HDF5Constants.H5I_INVALID_HID; + long memtype_id = HDF5Constants.H5I_INVALID_HID; + long filetype_id = HDF5Constants.H5I_INVALID_HID; + long dataspace_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; + long attribute_id = HDF5Constants.H5I_INVALID_HID; long[] dims = { DIM0 }; Sensor[] object_data = new Sensor[DIM0]; byte[] dset_data = null; @@ -205,7 +205,7 @@ public class H5Ex_T_CompoundAttribute { dataset_id = H5.H5Dcreate(file_id, DATASETNAME, HDF5Constants.H5T_STD_I32LE, dataspace_id, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); H5.H5Sclose(dataspace_id); - dataspace_id = -1; + dataspace_id = HDF5Constants.H5I_INVALID_HID; } } catch (Exception e) { @@ -310,12 +310,12 @@ public class H5Ex_T_CompoundAttribute { } private static void ReadDataset() { - long file_id = -1; - long strtype_id = -1; - long memtype_id = -1; - long dataspace_id = -1; - long dataset_id = -1; - long attribute_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long strtype_id = HDF5Constants.H5I_INVALID_HID; + long memtype_id = HDF5Constants.H5I_INVALID_HID; + long dataspace_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; + long attribute_id = HDF5Constants.H5I_INVALID_HID; long[] dims = { DIM0 }; Sensor[] object_data2; byte[] dset_data; diff --git a/java/examples/datatypes/H5Ex_T_Float.java b/java/examples/datatypes/H5Ex_T_Float.java index e469d63..f808954 100644 --- a/java/examples/datatypes/H5Ex_T_Float.java +++ b/java/examples/datatypes/H5Ex_T_Float.java @@ -36,9 +36,9 @@ public class H5Ex_T_Float { private static final int RANK = 2; private static void CreateDataset() { - long file_id = -1; - long dataspace_id = -1; - long dataset_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long dataspace_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; long[] dims = { DIM0, DIM1 }; double[][] dset_data = new double[DIM0][DIM1]; @@ -120,9 +120,9 @@ public class H5Ex_T_Float { } private static void ReadDataset() { - long file_id = -1; - long dataspace_id = -1; - long dataset_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long dataspace_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; long[] dims = { DIM0, DIM1 }; double[][] dset_data; diff --git a/java/examples/datatypes/H5Ex_T_FloatAttribute.java b/java/examples/datatypes/H5Ex_T_FloatAttribute.java index b6c92be..2f98b5a 100644 --- a/java/examples/datatypes/H5Ex_T_FloatAttribute.java +++ b/java/examples/datatypes/H5Ex_T_FloatAttribute.java @@ -37,10 +37,10 @@ public class H5Ex_T_FloatAttribute { private static final int RANK = 2; private static void CreateDataset() { - long file_id = -1; - long dataspace_id = -1; - long dataset_id = -1; - long attribute_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long dataspace_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; + long attribute_id = HDF5Constants.H5I_INVALID_HID; long[] dims = { DIM0, DIM1 }; double[][] dset_data = new double[DIM0][DIM1]; @@ -66,7 +66,7 @@ public class H5Ex_T_FloatAttribute { dataset_id = H5.H5Dcreate(file_id, DATASETNAME, HDF5Constants.H5T_STD_I32LE, dataspace_id, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); H5.H5Sclose(dataspace_id); - dataspace_id = -1; + dataspace_id = HDF5Constants.H5I_INVALID_HID; } } catch (Exception e) { @@ -139,10 +139,10 @@ public class H5Ex_T_FloatAttribute { } private static void ReadDataset() { - long file_id = -1; - long dataspace_id = -1; - long dataset_id = -1; - long attribute_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long dataspace_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; + long attribute_id = HDF5Constants.H5I_INVALID_HID; long[] dims = { DIM0, DIM1 }; double[][] dset_data; diff --git a/java/examples/datatypes/H5Ex_T_Integer.java b/java/examples/datatypes/H5Ex_T_Integer.java index f0b3755..e99cdb6 100644 --- a/java/examples/datatypes/H5Ex_T_Integer.java +++ b/java/examples/datatypes/H5Ex_T_Integer.java @@ -34,9 +34,9 @@ public class H5Ex_T_Integer { private static final int RANK = 2; private static void CreateDataset() { - long file_id = -1; - long dataspace_id = -1; - long dataset_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long dataspace_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; long[] dims = { DIM0, DIM1 }; int[][] dset_data = new int[DIM0][DIM1]; @@ -117,9 +117,9 @@ public class H5Ex_T_Integer { } private static void ReadDataset() { - long file_id = -1; - long dataspace_id = -1; - long dataset_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long dataspace_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; long[] dims = { DIM0, DIM1 }; int[][] dset_data; diff --git a/java/examples/datatypes/H5Ex_T_IntegerAttribute.java b/java/examples/datatypes/H5Ex_T_IntegerAttribute.java index 8c85c63..b80b342 100644 --- a/java/examples/datatypes/H5Ex_T_IntegerAttribute.java +++ b/java/examples/datatypes/H5Ex_T_IntegerAttribute.java @@ -35,10 +35,10 @@ public class H5Ex_T_IntegerAttribute { private static final int RANK = 2; private static void CreateDataset() { - long file_id = -1; - long dataspace_id = -1; - long dataset_id = -1; - long attribute_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long dataspace_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; + long attribute_id = HDF5Constants.H5I_INVALID_HID; long[] dims = { DIM0, DIM1 }; int[][] dset_data = new int[DIM0][DIM1]; @@ -64,7 +64,7 @@ public class H5Ex_T_IntegerAttribute { dataset_id = H5.H5Dcreate(file_id, DATASETNAME, HDF5Constants.H5T_STD_I32LE, dataspace_id, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); H5.H5Sclose(dataspace_id); - dataspace_id = -1; + dataspace_id = HDF5Constants.H5I_INVALID_HID; } } catch (Exception e) { @@ -137,10 +137,10 @@ public class H5Ex_T_IntegerAttribute { } private static void ReadDataset() { - long file_id = -1; - long dataspace_id = -1; - long dataset_id = -1; - long attribute_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long dataspace_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; + long attribute_id = HDF5Constants.H5I_INVALID_HID; long[] dims = { DIM0, DIM1 }; int[][] dset_data; diff --git a/java/examples/datatypes/H5Ex_T_ObjectReference.java b/java/examples/datatypes/H5Ex_T_ObjectReference.java index 97f02af..0099bfa 100644 --- a/java/examples/datatypes/H5Ex_T_ObjectReference.java +++ b/java/examples/datatypes/H5Ex_T_ObjectReference.java @@ -65,11 +65,11 @@ public class H5Ex_T_ObjectReference { } private static void writeObjRef() { - long file_id = -1; - long dataspace_id = -1; - long filespace_id = -1; - long group_id = -1; - long dataset_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long dataspace_id = HDF5Constants.H5I_INVALID_HID; + long filespace_id = HDF5Constants.H5I_INVALID_HID; + long group_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; long[] dims = { DIM0 }; byte[][] dset_data = new byte[DIM0][8]; @@ -90,9 +90,9 @@ public class H5Ex_T_ObjectReference { HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); if (dataset_id >= 0) H5.H5Dclose(dataset_id); - dataset_id = -1; + dataset_id = HDF5Constants.H5I_INVALID_HID; H5.H5Sclose(dataspace_id); - dataspace_id = -1; + dataspace_id = HDF5Constants.H5I_INVALID_HID; } } catch (Exception e) { @@ -106,7 +106,7 @@ public class H5Ex_T_ObjectReference { HDF5Constants.H5P_DEFAULT); if (group_id >= 0) H5.H5Gclose(group_id); - group_id = -1; + group_id = HDF5Constants.H5I_INVALID_HID; } catch (Exception e) { e.printStackTrace(); @@ -187,11 +187,11 @@ public class H5Ex_T_ObjectReference { } private static void readObjRef() { - long file_id = -1; - long dataset_id = -1; - long dataspace_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; + long dataspace_id = HDF5Constants.H5I_INVALID_HID; int object_type = -1; - long object_id = -1; + long object_id = HDF5Constants.H5I_INVALID_HID; long[] dims = { DIM0 }; byte[][] dset_data; diff --git a/java/examples/datatypes/H5Ex_T_ObjectReferenceAttribute.java b/java/examples/datatypes/H5Ex_T_ObjectReferenceAttribute.java index b1cab7c..ee2fe26 100644 --- a/java/examples/datatypes/H5Ex_T_ObjectReferenceAttribute.java +++ b/java/examples/datatypes/H5Ex_T_ObjectReferenceAttribute.java @@ -67,11 +67,11 @@ public class H5Ex_T_ObjectReferenceAttribute { } private static void CreateDataset() { - long file_id = -1; - long dataspace_id = -1; - long group_id = -1; - long dataset_id = -1; - long attribute_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long dataspace_id = HDF5Constants.H5I_INVALID_HID; + long group_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; + long attribute_id = HDF5Constants.H5I_INVALID_HID; long[] dims = { DIM0 }; byte[][] dset_data = new byte[DIM0][8]; @@ -92,9 +92,9 @@ public class H5Ex_T_ObjectReferenceAttribute { HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); if (dataset_id >= 0) H5.H5Dclose(dataset_id); - dataset_id = -1; + dataset_id = HDF5Constants.H5I_INVALID_HID; H5.H5Sclose(dataspace_id); - dataspace_id = -1; + dataspace_id = HDF5Constants.H5I_INVALID_HID; } } catch (Exception e) { @@ -108,7 +108,7 @@ public class H5Ex_T_ObjectReferenceAttribute { HDF5Constants.H5P_DEFAULT); if (group_id >= 0) H5.H5Gclose(group_id); - group_id = -1; + group_id = HDF5Constants.H5I_INVALID_HID; } catch (Exception e) { e.printStackTrace(); @@ -139,7 +139,7 @@ public class H5Ex_T_ObjectReferenceAttribute { dataset_id = H5.H5Dcreate(file_id, DATASETNAME, HDF5Constants.H5T_STD_I32LE, dataspace_id, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); H5.H5Sclose(dataspace_id); - dataspace_id = -1; + dataspace_id = HDF5Constants.H5I_INVALID_HID; } } catch (Exception e) { @@ -212,12 +212,12 @@ public class H5Ex_T_ObjectReferenceAttribute { } private static void ReadDataset() { - long file_id = -1; - long dataspace_id = -1; - long dataset_id = -1; - long attribute_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long dataspace_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; + long attribute_id = HDF5Constants.H5I_INVALID_HID; int object_type = -1; - long object_id = -1; + long object_id = HDF5Constants.H5I_INVALID_HID; long[] dims = { DIM0 }; byte[][] dset_data; diff --git a/java/examples/datatypes/H5Ex_T_Opaque.java b/java/examples/datatypes/H5Ex_T_Opaque.java index 1d9ab1b..09ecbe6 100644 --- a/java/examples/datatypes/H5Ex_T_Opaque.java +++ b/java/examples/datatypes/H5Ex_T_Opaque.java @@ -32,10 +32,10 @@ public class H5Ex_T_Opaque { private static final int RANK = 1; private static void CreateDataset() { - long file_id = -1; - long dataspace_id = -1; - long datatype_id = -1; - long dataset_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long dataspace_id = HDF5Constants.H5I_INVALID_HID; + long datatype_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; long[] dims = { DIM0 }; byte[] dset_data = new byte[DIM0 * LEN]; byte[] str_data = { 'O', 'P', 'A', 'Q', 'U', 'E' }; @@ -138,11 +138,11 @@ public class H5Ex_T_Opaque { } private static void ReadDataset() { - long file_id = -1; - long datatype_id = -1; - long dataspace_id = -1; - long dataset_id = -1; - long type_len = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long datatype_id = HDF5Constants.H5I_INVALID_HID; + long dataspace_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; + long type_len = HDF5Constants.H5I_INVALID_HID; long[] dims = { DIM0 }; byte[] dset_data; String tag_name = null; diff --git a/java/examples/datatypes/H5Ex_T_OpaqueAttribute.java b/java/examples/datatypes/H5Ex_T_OpaqueAttribute.java index 8955d77..abfa810 100644 --- a/java/examples/datatypes/H5Ex_T_OpaqueAttribute.java +++ b/java/examples/datatypes/H5Ex_T_OpaqueAttribute.java @@ -33,11 +33,11 @@ public class H5Ex_T_OpaqueAttribute { private static final int RANK = 1; private static void CreateDataset() { - long file_id = -1; - long dataspace_id = -1; - long datatype_id = -1; - long dataset_id = -1; - long attribute_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long dataspace_id = HDF5Constants.H5I_INVALID_HID; + long datatype_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; + long attribute_id = HDF5Constants.H5I_INVALID_HID; long[] dims = { DIM0 }; byte[] dset_data = new byte[DIM0 * LEN]; byte[] str_data = { 'O', 'P', 'A', 'Q', 'U', 'E' }; @@ -65,7 +65,7 @@ public class H5Ex_T_OpaqueAttribute { dataset_id = H5.H5Dcreate(file_id, DATASETNAME, HDF5Constants.H5T_STD_I32LE, dataspace_id, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); H5.H5Sclose(dataspace_id); - dataspace_id = -1; + dataspace_id = HDF5Constants.H5I_INVALID_HID; } } catch (Exception e) { @@ -158,11 +158,11 @@ public class H5Ex_T_OpaqueAttribute { } private static void ReadDataset() { - long file_id = -1; - long datatype_id = -1; - long dataspace_id = -1; - long dataset_id = -1; - long attribute_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long datatype_id = HDF5Constants.H5I_INVALID_HID; + long dataspace_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; + long attribute_id = HDF5Constants.H5I_INVALID_HID; long type_len = -1; long[] dims = { DIM0 }; byte[] dset_data; diff --git a/java/examples/datatypes/H5Ex_T_String.java b/java/examples/datatypes/H5Ex_T_String.java index f91d866..107c52b 100644 --- a/java/examples/datatypes/H5Ex_T_String.java +++ b/java/examples/datatypes/H5Ex_T_String.java @@ -32,11 +32,11 @@ public class H5Ex_T_String { private static final int RANK = 1; private static void CreateDataset() { - long file_id = -1; - long memtype_id = -1; - long filetype_id = -1; - long dataspace_id = -1; - long dataset_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long memtype_id = HDF5Constants.H5I_INVALID_HID; + long filetype_id = HDF5Constants.H5I_INVALID_HID; + long dataspace_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; long[] dims = { DIM0 }; byte[][] dset_data = new byte[DIM0][SDIM]; StringBuffer[] str_data = { new StringBuffer("Parting"), new StringBuffer("is such"), @@ -156,11 +156,11 @@ public class H5Ex_T_String { } private static void ReadDataset() { - long file_id = -1; - long filetype_id = -1; - long memtype_id = -1; - long dataspace_id = -1; - long dataset_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long filetype_id = HDF5Constants.H5I_INVALID_HID; + long memtype_id = HDF5Constants.H5I_INVALID_HID; + long dataspace_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; long sdim = 0; long[] dims = { DIM0 }; byte[][] dset_data; diff --git a/java/examples/datatypes/H5Ex_T_StringAttribute.java b/java/examples/datatypes/H5Ex_T_StringAttribute.java index 7fe46c8..ab5e95c 100644 --- a/java/examples/datatypes/H5Ex_T_StringAttribute.java +++ b/java/examples/datatypes/H5Ex_T_StringAttribute.java @@ -33,12 +33,12 @@ public class H5Ex_T_StringAttribute { private static final int RANK = 1; private static void CreateDataset() { - long file_id = -1; - long memtype_id = -1; - long filetype_id = -1; - long dataspace_id = -1; - long dataset_id = -1; - long attribute_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long memtype_id = HDF5Constants.H5I_INVALID_HID; + long filetype_id = HDF5Constants.H5I_INVALID_HID; + long dataspace_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; + long attribute_id = HDF5Constants.H5I_INVALID_HID; long[] dims = { DIM0 }; byte[][] dset_data = new byte[DIM0][SDIM]; StringBuffer[] str_data = { new StringBuffer("Parting"), new StringBuffer("is such"), @@ -80,7 +80,7 @@ public class H5Ex_T_StringAttribute { dataset_id = H5.H5Dcreate(file_id, DATASETNAME, HDF5Constants.H5T_STD_I32LE, dataspace_id, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); H5.H5Sclose(dataspace_id); - dataspace_id = -1; + dataspace_id = HDF5Constants.H5I_INVALID_HID; } } catch (Exception e) { @@ -179,12 +179,12 @@ public class H5Ex_T_StringAttribute { } private static void ReadDataset() { - long file_id = -1; - long filetype_id = -1; - long memtype_id = -1; - long dataspace_id = -1; - long dataset_id = -1; - long attribute_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long filetype_id = HDF5Constants.H5I_INVALID_HID; + long memtype_id = HDF5Constants.H5I_INVALID_HID; + long dataspace_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; + long attribute_id = HDF5Constants.H5I_INVALID_HID; long sdim = 0; long[] dims = { DIM0 }; byte[][] dset_data; diff --git a/java/examples/datatypes/H5Ex_T_VLString.java b/java/examples/datatypes/H5Ex_T_VLString.java index e1c9bd5..4a638eb 100644 --- a/java/examples/datatypes/H5Ex_T_VLString.java +++ b/java/examples/datatypes/H5Ex_T_VLString.java @@ -26,10 +26,10 @@ public class H5Ex_T_VLString private static String DATASETNAME = "DS1"; private static void createDataset() { - long file_id = -1; - long type_id = -1; - long dataspace_id = -1; - long dataset_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long type_id = HDF5Constants.H5I_INVALID_HID; + long dataspace_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; int rank = 1; String[] str_data = { "Parting", "is such", "sweet", "sorrow." }; long[] dims = { str_data.length }; @@ -93,9 +93,9 @@ public class H5Ex_T_VLString } private static void readDataset() { - long file_id = -1; - long type_id = -1; - long dataset_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long type_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; String[] str_data = { "", "", "", "" }; try { diff --git a/java/examples/groups/H5Ex_G_Compact.java b/java/examples/groups/H5Ex_G_Compact.java index 6078c6c..a24ed33 100644 --- a/java/examples/groups/H5Ex_G_Compact.java +++ b/java/examples/groups/H5Ex_G_Compact.java @@ -60,9 +60,9 @@ public class H5Ex_G_Compact { } public static void CreateGroup() { - long file_id = -1; - long group_id = -1; - long fapl_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long group_id = HDF5Constants.H5I_INVALID_HID; + long fapl_id = HDF5Constants.H5I_INVALID_HID; H5G_info_t ginfo; long size; diff --git a/java/examples/groups/H5Ex_G_Corder.java b/java/examples/groups/H5Ex_G_Corder.java index 74f70ba..a00252f 100644 --- a/java/examples/groups/H5Ex_G_Corder.java +++ b/java/examples/groups/H5Ex_G_Corder.java @@ -25,10 +25,10 @@ public class H5Ex_G_Corder { private static String FILE = "H5Ex_G_Corder.h5"; private static void CreateGroup() throws Exception { - long file_id = -1; - long group_id = -1; - long subgroup_id = -1; - long gcpl_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long group_id = HDF5Constants.H5I_INVALID_HID; + long subgroup_id = HDF5Constants.H5I_INVALID_HID; + long gcpl_id = HDF5Constants.H5I_INVALID_HID; int status; H5G_info_t ginfo; int i; diff --git a/java/examples/groups/H5Ex_G_Create.java b/java/examples/groups/H5Ex_G_Create.java index f653987..7d9e150 100644 --- a/java/examples/groups/H5Ex_G_Create.java +++ b/java/examples/groups/H5Ex_G_Create.java @@ -25,8 +25,8 @@ public class H5Ex_G_Create { private static String GROUPNAME = "G1"; private static void CreateGroup() { - long file_id = -1; - long group_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long group_id = HDF5Constants.H5I_INVALID_HID; // Create a new file using default properties. try { diff --git a/java/examples/groups/H5Ex_G_Intermediate.java b/java/examples/groups/H5Ex_G_Intermediate.java index 6109e9a..4649741 100644 --- a/java/examples/groups/H5Ex_G_Intermediate.java +++ b/java/examples/groups/H5Ex_G_Intermediate.java @@ -31,9 +31,9 @@ public class H5Ex_G_Intermediate { private void CreateGroup() throws Exception { - long file_id = -1; - long group_id = -1; - long gcpl_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long group_id = HDF5Constants.H5I_INVALID_HID; + long gcpl_id = HDF5Constants.H5I_INVALID_HID; try { // Create a new file_id using the default properties. diff --git a/java/examples/groups/H5Ex_G_Iterate.java b/java/examples/groups/H5Ex_G_Iterate.java index 71361f8..02798eb 100644 --- a/java/examples/groups/H5Ex_G_Iterate.java +++ b/java/examples/groups/H5Ex_G_Iterate.java @@ -58,7 +58,7 @@ public class H5Ex_G_Iterate { } private static void do_iterate() { - long file_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; // Open a file using default properties. try { diff --git a/java/examples/groups/H5Ex_G_Phase.java b/java/examples/groups/H5Ex_G_Phase.java index 7824123..744ce6c 100644 --- a/java/examples/groups/H5Ex_G_Phase.java +++ b/java/examples/groups/H5Ex_G_Phase.java @@ -60,11 +60,11 @@ public class H5Ex_G_Phase { } private static void CreateGroup() { - long file_id = -1; - long group_id = -1; - long subgroup_id = -1; - long fapl_id = -1; - long gcpl_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long group_id = HDF5Constants.H5I_INVALID_HID; + long subgroup_id = HDF5Constants.H5I_INVALID_HID; + long fapl_id = HDF5Constants.H5I_INVALID_HID; + long gcpl_id = HDF5Constants.H5I_INVALID_HID; H5G_info_t ginfo; String name = "G0"; // Name of subgroup_id int i; diff --git a/java/examples/groups/H5Ex_G_Traverse.java b/java/examples/groups/H5Ex_G_Traverse.java index 76ed6c8..61f2122 100644 --- a/java/examples/groups/H5Ex_G_Traverse.java +++ b/java/examples/groups/H5Ex_G_Traverse.java @@ -43,7 +43,7 @@ public class H5Ex_G_Traverse { public static H5L_iterate_t iter_cb = new H5L_iter_callbackT(); private static void OpenGroup() { - long file_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; H5O_info_t infobuf; opdata od = new opdata(); diff --git a/java/examples/groups/H5Ex_G_Visit.java b/java/examples/groups/H5Ex_G_Visit.java index c479259..544cbf4 100644 --- a/java/examples/groups/H5Ex_G_Visit.java +++ b/java/examples/groups/H5Ex_G_Visit.java @@ -47,7 +47,7 @@ public class H5Ex_G_Visit { private void VisitGroup() throws Exception { - long file_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; try { // Open file diff --git a/java/examples/intro/H5_CreateAttribute.java b/java/examples/intro/H5_CreateAttribute.java index 22b03ad..ab45039 100644 --- a/java/examples/intro/H5_CreateAttribute.java +++ b/java/examples/intro/H5_CreateAttribute.java @@ -28,10 +28,10 @@ public class H5_CreateAttribute { private static String DATASETATTRIBUTE = "Units"; private static void CreateDatasetAttribute() { - long file_id = -1; - long dataspace_id = -1; - long dataset_id = -1; - long attribute_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long dataspace_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; + long attribute_id = HDF5Constants.H5I_INVALID_HID; long[] dims1 = { DIM_X, DIM_Y }; long[] dims = { 2 }; int[] attr_data = { 100, 200 }; diff --git a/java/examples/intro/H5_CreateDataset.java b/java/examples/intro/H5_CreateDataset.java index 7b56e83..f376272 100644 --- a/java/examples/intro/H5_CreateDataset.java +++ b/java/examples/intro/H5_CreateDataset.java @@ -27,9 +27,9 @@ public class H5_CreateDataset { private static final int DIM_Y = 6; private static void CreateDataset() { - long file_id = -1; - long dataspace_id = -1; - long dataset_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long dataspace_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; long[] dims = { DIM_X, DIM_Y }; // Create a new file using default properties. diff --git a/java/examples/intro/H5_CreateFile.java b/java/examples/intro/H5_CreateFile.java index 367e61f..773df81 100644 --- a/java/examples/intro/H5_CreateFile.java +++ b/java/examples/intro/H5_CreateFile.java @@ -24,7 +24,7 @@ public class H5_CreateFile { static final String FILENAME = "H5_CreateFile.h5"; private static void CreateFile() { - long file_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; // Create a new file using default properties. try { diff --git a/java/examples/intro/H5_CreateGroup.java b/java/examples/intro/H5_CreateGroup.java index 54f6252..ab970e1 100644 --- a/java/examples/intro/H5_CreateGroup.java +++ b/java/examples/intro/H5_CreateGroup.java @@ -25,8 +25,8 @@ public class H5_CreateGroup { private static String GROUPNAME = "MyGroup"; private static void CreateGroup() { - long file_id = -1; - long group_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long group_id = HDF5Constants.H5I_INVALID_HID; // Create a new file using default properties. try { diff --git a/java/examples/intro/H5_CreateGroupAbsoluteRelative.java b/java/examples/intro/H5_CreateGroupAbsoluteRelative.java index b9c35d7..ae142ae 100644 --- a/java/examples/intro/H5_CreateGroupAbsoluteRelative.java +++ b/java/examples/intro/H5_CreateGroupAbsoluteRelative.java @@ -27,10 +27,10 @@ public class H5_CreateGroupAbsoluteRelative { private static String GROUPNAME_B = "GroupB"; private static void CreateGroupAbsoluteAndRelative() { - long file_id = -1; - long group1_id = -1; - long group2_id = -1; - long group3_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long group1_id = HDF5Constants.H5I_INVALID_HID; + long group2_id = HDF5Constants.H5I_INVALID_HID; + long group3_id = HDF5Constants.H5I_INVALID_HID; // Create a new file using default properties. try { diff --git a/java/examples/intro/H5_CreateGroupDataset.java b/java/examples/intro/H5_CreateGroupDataset.java index 191a21a..9657cf0 100644 --- a/java/examples/intro/H5_CreateGroupDataset.java +++ b/java/examples/intro/H5_CreateGroupDataset.java @@ -32,12 +32,12 @@ public class H5_CreateGroupDataset { private static final int DIM2_Y = 10; private static void h5_crtgrpd() { - long file_id = -1; - long dataspace_id = -1; - long dataset_id = -1; - long group_id = -1; - long group1_id = -1; - long group2_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long dataspace_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; + long group_id = HDF5Constants.H5I_INVALID_HID; + long group1_id = HDF5Constants.H5I_INVALID_HID; + long group2_id = HDF5Constants.H5I_INVALID_HID; int[][] dset1_data = new int[DIM1_X][DIM1_Y]; int[][] dset2_data = new int[DIM2_X][DIM2_Y]; long[] dims1 = { DIM1_X, DIM1_Y }; @@ -108,7 +108,7 @@ public class H5_CreateGroupDataset { try { if (dataspace_id >= 0) H5.H5Sclose(dataspace_id); - dataspace_id = -1; + dataspace_id = HDF5Constants.H5I_INVALID_HID; } catch (Exception e) { e.printStackTrace(); @@ -118,7 +118,7 @@ public class H5_CreateGroupDataset { try { if (dataset_id >= 0) H5.H5Dclose(dataset_id); - dataset_id = -1; + dataset_id = HDF5Constants.H5I_INVALID_HID; } catch (Exception e) { e.printStackTrace(); diff --git a/java/examples/intro/H5_ReadWrite.java b/java/examples/intro/H5_ReadWrite.java index 812ac77..82beec9 100644 --- a/java/examples/intro/H5_ReadWrite.java +++ b/java/examples/intro/H5_ReadWrite.java @@ -27,9 +27,9 @@ public class H5_ReadWrite { private static final int DIM_Y = 6; private static void ReadWriteDataset() { - long file_id = -1; - long dataspace_id = -1; - long dataset_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long dataspace_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; long[] dims = { DIM_X, DIM_Y }; int[][] dset_data = new int[DIM_X][DIM_Y]; diff --git a/java/src/hdf/hdf5lib/HDF5Constants.java b/java/src/hdf/hdf5lib/HDF5Constants.java index 39a1e5f..334abee 100644 --- a/java/src/hdf/hdf5lib/HDF5Constants.java +++ b/java/src/hdf/hdf5lib/HDF5Constants.java @@ -47,54 +47,103 @@ public class HDF5Constants { public static final int H5_SZIP_ALLOW_K13_OPTION_MASK = H5_SZIP_ALLOW_K13_OPTION_MASK(); /** Special parameters for szip compression */ public static final int H5_SZIP_CHIP_OPTION_MASK = H5_SZIP_CHIP_OPTION_MASK(); + /** indices on links, unknown index type */ public static final int H5_INDEX_UNKNOWN = H5_INDEX_UNKNOWN(); + /** indices on links, index on names */ public static final int H5_INDEX_NAME = H5_INDEX_NAME(); + /** indices on links, index on creation order */ public static final int H5_INDEX_CRT_ORDER = H5_INDEX_CRT_ORDER(); + /** indices on links, number of indices defined */ public static final int H5_INDEX_N = H5_INDEX_N(); + /** */ public static final int H5_ITER_UNKNOWN = H5_ITER_UNKNOWN(); + /** */ public static final int H5_ITER_INC = H5_ITER_INC(); + /** */ public static final int H5_ITER_DEC = H5_ITER_DEC(); + /** */ public static final int H5_ITER_NATIVE = H5_ITER_NATIVE(); + /** */ public static final int H5_ITER_N = H5_ITER_N(); + /** */ public static final int H5AC_CURR_CACHE_CONFIG_VERSION = H5AC_CURR_CACHE_CONFIG_VERSION(); + /** */ public static final int H5AC_MAX_TRACE_FILE_NAME_LEN = H5AC_MAX_TRACE_FILE_NAME_LEN(); + /** */ public static final int H5AC_METADATA_WRITE_STRATEGY_PROCESS_ZERO_ONLY = H5AC_METADATA_WRITE_STRATEGY_PROCESS_ZERO_ONLY(); + /** */ public static final int H5AC_METADATA_WRITE_STRATEGY_DISTRIBUTED = H5AC_METADATA_WRITE_STRATEGY_DISTRIBUTED(); + /** */ public static final int H5C_incr_off = H5C_incr_off(); + /** */ public static final int H5C_incr_threshold = H5C_incr_threshold(); + /** */ public static final int H5C_flash_incr_off = H5C_flash_incr_off(); + /** */ public static final int H5C_flash_incr_add_space = H5C_flash_incr_add_space(); + /** */ public static final int H5C_decr_off = H5C_decr_off(); + /** */ public static final int H5C_decr_threshold = H5C_decr_threshold(); + /** */ public static final int H5C_decr_age_out = H5C_decr_age_out(); + /** */ public static final int H5C_decr_age_out_with_threshold = H5C_decr_age_out_with_threshold(); + /** */ public static final int H5D_CHUNK_IDX_BTREE = H5D_CHUNK_IDX_BTREE(); + /** */ public static final int H5D_ALLOC_TIME_DEFAULT = H5D_ALLOC_TIME_DEFAULT(); + /** */ public static final int H5D_ALLOC_TIME_EARLY = H5D_ALLOC_TIME_EARLY(); + /** */ public static final int H5D_ALLOC_TIME_ERROR = H5D_ALLOC_TIME_ERROR(); + /** */ public static final int H5D_ALLOC_TIME_INCR = H5D_ALLOC_TIME_INCR(); + /** */ public static final int H5D_ALLOC_TIME_LATE = H5D_ALLOC_TIME_LATE(); + /** */ public static final int H5D_FILL_TIME_ERROR = H5D_FILL_TIME_ERROR(); + /** */ public static final int H5D_FILL_TIME_ALLOC = H5D_FILL_TIME_ALLOC(); + /** */ public static final int H5D_FILL_TIME_NEVER = H5D_FILL_TIME_NEVER(); + /** */ public static final int H5D_FILL_TIME_IFSET = H5D_FILL_TIME_IFSET(); + /** */ public static final int H5D_FILL_VALUE_DEFAULT = H5D_FILL_VALUE_DEFAULT(); + /** */ public static final int H5D_FILL_VALUE_ERROR = H5D_FILL_VALUE_ERROR(); + /** */ public static final int H5D_FILL_VALUE_UNDEFINED = H5D_FILL_VALUE_UNDEFINED(); + /** */ public static final int H5D_FILL_VALUE_USER_DEFINED = H5D_FILL_VALUE_USER_DEFINED(); + /** */ public static final int H5D_LAYOUT_ERROR = H5D_LAYOUT_ERROR(); + /** */ public static final int H5D_CHUNKED = H5D_CHUNKED(); + /** */ public static final int H5D_COMPACT = H5D_COMPACT(); + /** */ public static final int H5D_CONTIGUOUS = H5D_CONTIGUOUS(); + /** */ public static final int H5D_VIRTUAL = H5D_VIRTUAL(); + /** */ public static final int H5D_NLAYOUTS = H5D_NLAYOUTS(); + /** */ public static final int H5D_SPACE_STATUS_ALLOCATED = H5D_SPACE_STATUS_ALLOCATED(); + /** */ public static final int H5D_SPACE_STATUS_ERROR = H5D_SPACE_STATUS_ERROR(); + /** */ public static final int H5D_SPACE_STATUS_NOT_ALLOCATED = H5D_SPACE_STATUS_NOT_ALLOCATED(); + /** */ public static final int H5D_SPACE_STATUS_PART_ALLOCATED = H5D_SPACE_STATUS_PART_ALLOCATED(); + /** */ public static final int H5D_VDS_ERROR = H5D_VDS_ERROR(); + /** */ public static final int H5D_VDS_FIRST_MISSING = H5D_VDS_FIRST_MISSING(); + /** */ public static final int H5D_VDS_LAST_AVAILABLE = H5D_VDS_LAST_AVAILABLE(); + /** */ public static final int H5D_CHUNK_DONT_FILTER_PARTIAL_CHUNKS = H5D_CHUNK_DONT_FILTER_PARTIAL_CHUNKS(); /** Different kinds of error information - H5E_type_t */ @@ -452,96 +501,184 @@ public class HDF5Constants { /** Generic low-level file I/O errors - Write failed */ public static final long H5E_WRITEERROR = H5E_WRITEERROR(); + /** */ private static final int H5ES_STATUS_IN_PROGRESS = H5ES_STATUS_IN_PROGRESS(); + /** */ private static final int H5ES_STATUS_SUCCEED = H5ES_STATUS_SUCCEED(); + /** */ private static final int H5ES_STATUS_FAIL = H5ES_STATUS_FAIL(); + /** */ public static final int H5F_ACC_CREAT = H5F_ACC_CREAT(); + /** */ public static final int H5F_ACC_EXCL = H5F_ACC_EXCL(); + /** */ public static final int H5F_ACC_RDONLY = H5F_ACC_RDONLY(); + /** */ public static final int H5F_ACC_RDWR = H5F_ACC_RDWR(); + /** */ public static final int H5F_ACC_TRUNC = H5F_ACC_TRUNC(); + /** */ public static final int H5F_ACC_DEFAULT = H5F_ACC_DEFAULT(); + /** */ public static final int H5F_ACC_SWMR_READ = H5F_ACC_SWMR_READ(); + /** */ public static final int H5F_ACC_SWMR_WRITE = H5F_ACC_SWMR_WRITE(); + /** */ public static final int H5F_CLOSE_DEFAULT = H5F_CLOSE_DEFAULT(); + /** */ public static final int H5F_CLOSE_SEMI = H5F_CLOSE_SEMI(); + /** */ public static final int H5F_CLOSE_STRONG = H5F_CLOSE_STRONG(); + /** */ public static final int H5F_CLOSE_WEAK = H5F_CLOSE_WEAK(); + /** */ public static final int H5F_LIBVER_ERROR = H5F_LIBVER_ERROR(); + /** */ public static final int H5F_LIBVER_EARLIEST = H5F_LIBVER_EARLIEST(); + /** */ public static final int H5F_LIBVER_V18 = H5F_LIBVER_V18(); + /** */ public static final int H5F_LIBVER_V110 = H5F_LIBVER_V110(); + /** */ public static final int H5F_LIBVER_V112 = H5F_LIBVER_V112(); + /** */ public static final int H5F_LIBVER_V114 = H5F_LIBVER_V114(); + /** */ public static final int H5F_LIBVER_NBOUNDS = H5F_LIBVER_NBOUNDS(); + /** */ public static final int H5F_LIBVER_LATEST = H5F_LIBVER_LATEST(); + /** */ public static final int H5F_OBJ_ALL = H5F_OBJ_ALL(); + /** */ public static final int H5F_OBJ_ATTR = H5F_OBJ_ATTR(); + /** */ public static final int H5F_OBJ_DATASET = H5F_OBJ_DATASET(); + /** */ public static final int H5F_OBJ_DATATYPE = H5F_OBJ_DATATYPE(); + /** */ public static final int H5F_OBJ_FILE = H5F_OBJ_FILE(); + /** */ public static final int H5F_OBJ_GROUP = H5F_OBJ_GROUP(); + /** */ public static final int H5F_OBJ_LOCAL = H5F_OBJ_LOCAL(); + /** */ public static final int H5F_SCOPE_GLOBAL = H5F_SCOPE_GLOBAL(); + /** */ public static final int H5F_SCOPE_LOCAL = H5F_SCOPE_LOCAL(); + /** */ public static final int H5F_UNLIMITED = H5F_UNLIMITED(); + /** */ public static final int H5F_FSPACE_STRATEGY_FSM_AGGR = H5F_FSPACE_STRATEGY_FSM_AGGR(); + /** */ public static final int H5F_FSPACE_STRATEGY_AGGR = H5F_FSPACE_STRATEGY_AGGR(); + /** */ public static final int H5F_FSPACE_STRATEGY_PAGE = H5F_FSPACE_STRATEGY_PAGE(); + /** */ public static final int H5F_FSPACE_STRATEGY_NONE = H5F_FSPACE_STRATEGY_NONE(); + /** */ public static final int H5F_FSPACE_STRATEGY_NTYPES = H5F_FSPACE_STRATEGY_NTYPES(); + /** */ public static final long H5FD_CORE = H5FD_CORE(); + /** */ public static final long H5FD_DIRECT = H5FD_DIRECT(); + /** */ public static final long H5FD_FAMILY = H5FD_FAMILY(); + /** */ public static final long H5FD_LOG = H5FD_LOG(); + /** */ public static final long H5FD_MPIO = H5FD_MPIO(); + /** */ public static final long H5FD_MULTI = H5FD_MULTI(); + /** */ public static final long H5FD_SEC2 = H5FD_SEC2(); + /** */ public static final long H5FD_STDIO = H5FD_STDIO(); + /** */ public static final long H5FD_WINDOWS = H5FD_WINDOWS(); + /** */ public static final long H5FD_ROS3 = H5FD_ROS3(); + /** */ public static final long H5FD_HDFS = H5FD_HDFS(); + /** */ public static final int H5FD_LOG_LOC_READ = H5FD_LOG_LOC_READ(); + /** */ public static final int H5FD_LOG_LOC_WRITE = H5FD_LOG_LOC_WRITE(); + /** */ public static final int H5FD_LOG_LOC_SEEK = H5FD_LOG_LOC_SEEK(); + /** */ public static final int H5FD_LOG_LOC_IO = H5FD_LOG_LOC_IO(); + /** */ public static final int H5FD_LOG_FILE_READ = H5FD_LOG_FILE_READ(); + /** */ public static final int H5FD_LOG_FILE_WRITE = H5FD_LOG_FILE_WRITE(); + /** */ public static final int H5FD_LOG_FILE_IO = H5FD_LOG_FILE_IO(); + /** */ public static final int H5FD_LOG_FLAVOR = H5FD_LOG_FLAVOR(); + /** */ public static final int H5FD_LOG_NUM_READ = H5FD_LOG_NUM_READ(); + /** */ public static final int H5FD_LOG_NUM_WRITE = H5FD_LOG_NUM_WRITE(); + /** */ public static final int H5FD_LOG_NUM_SEEK = H5FD_LOG_NUM_SEEK(); + /** */ public static final int H5FD_LOG_NUM_TRUNCATE = H5FD_LOG_NUM_TRUNCATE(); + /** */ public static final int H5FD_LOG_NUM_IO = H5FD_LOG_NUM_IO(); + /** */ public static final int H5FD_LOG_TIME_OPEN = H5FD_LOG_TIME_OPEN(); + /** */ public static final int H5FD_LOG_TIME_STAT = H5FD_LOG_TIME_STAT(); + /** */ public static final int H5FD_LOG_TIME_READ = H5FD_LOG_TIME_READ(); + /** */ public static final int H5FD_LOG_TIME_WRITE = H5FD_LOG_TIME_WRITE(); + /** */ public static final int H5FD_LOG_TIME_SEEK = H5FD_LOG_TIME_SEEK(); + /** */ public static final int H5FD_LOG_TIME_CLOSE = H5FD_LOG_TIME_CLOSE(); + /** */ public static final int H5FD_LOG_TIME_IO = H5FD_LOG_TIME_IO(); + /** */ public static final int H5FD_LOG_ALLOC = H5FD_LOG_ALLOC(); + /** */ public static final int H5FD_LOG_ALL = H5FD_LOG_ALL(); + /** */ public static final int H5FD_MEM_NOLIST = H5FD_MEM_NOLIST(); + /** */ public static final int H5FD_MEM_DEFAULT = H5FD_MEM_DEFAULT(); + /** */ public static final int H5FD_MEM_SUPER = H5FD_MEM_SUPER(); + /** */ public static final int H5FD_MEM_BTREE = H5FD_MEM_BTREE(); + /** */ public static final int H5FD_MEM_DRAW = H5FD_MEM_DRAW(); + /** */ public static final int H5FD_MEM_GHEAP = H5FD_MEM_GHEAP(); + /** */ public static final int H5FD_MEM_LHEAP = H5FD_MEM_LHEAP(); + /** */ public static final int H5FD_MEM_OHDR = H5FD_MEM_OHDR(); + /** */ public static final int H5FD_MEM_NTYPES = H5FD_MEM_NTYPES(); + /** */ public static final long H5FD_DEFAULT_HADDR_SIZE = H5FD_DEFAULT_HADDR_SIZE(); + /** */ public static final long H5FD_MEM_DEFAULT_SIZE = H5FD_MEM_DEFAULT_SIZE(); + /** */ public static final long H5FD_MEM_DEFAULT_SUPER_SIZE = H5FD_MEM_DEFAULT_SUPER_SIZE(); + /** */ public static final long H5FD_MEM_DEFAULT_BTREE_SIZE = H5FD_MEM_DEFAULT_BTREE_SIZE(); + /** */ public static final long H5FD_MEM_DEFAULT_DRAW_SIZE = H5FD_MEM_DEFAULT_DRAW_SIZE(); + /** */ public static final long H5FD_MEM_DEFAULT_GHEAP_SIZE = H5FD_MEM_DEFAULT_GHEAP_SIZE(); + /** */ public static final long H5FD_MEM_DEFAULT_LHEAP_SIZE = H5FD_MEM_DEFAULT_LHEAP_SIZE(); + /** */ public static final long H5FD_MEM_DEFAULT_OHDR_SIZE = H5FD_MEM_DEFAULT_OHDR_SIZE(); // public static final int H5G_DATASET = H5G_DATASET(); @@ -561,120 +698,229 @@ public class HDF5Constants { // public static final int H5G_TYPE = H5G_TYPE(); // public static final int H5G_UNKNOWN = H5G_UNKNOWN(); + /** */ public static final int H5G_STORAGE_TYPE_UNKNOWN = H5G_STORAGE_TYPE_UNKNOWN(); + /** */ public static final int H5G_STORAGE_TYPE_SYMBOL_TABLE = H5G_STORAGE_TYPE_SYMBOL_TABLE(); + /** */ public static final int H5G_STORAGE_TYPE_COMPACT = H5G_STORAGE_TYPE_COMPACT(); + /** */ public static final int H5G_STORAGE_TYPE_DENSE = H5G_STORAGE_TYPE_DENSE(); + /** */ public static final int H5I_ATTR = H5I_ATTR(); + /** */ public static final int H5I_BADID = H5I_BADID(); + /** */ public static final int H5I_DATASET = H5I_DATASET(); + /** */ public static final int H5I_DATASPACE = H5I_DATASPACE(); + /** */ public static final int H5I_DATATYPE = H5I_DATATYPE(); + /** */ public static final int H5I_ERROR_CLASS = H5I_ERROR_CLASS(); + /** */ public static final int H5I_ERROR_MSG = H5I_ERROR_MSG(); + /** */ public static final int H5I_ERROR_STACK = H5I_ERROR_STACK(); + /** */ public static final int H5I_FILE = H5I_FILE(); + /** */ public static final int H5I_GENPROP_CLS = H5I_GENPROP_CLS(); + /** */ public static final int H5I_GENPROP_LST = H5I_GENPROP_LST(); + /** */ public static final int H5I_GROUP = H5I_GROUP(); + /** */ public static final int H5I_INVALID_HID = H5I_INVALID_HID(); + /** */ public static final int H5I_NTYPES = H5I_NTYPES(); + /** */ public static final int H5I_UNINIT = H5I_UNINIT(); + /** */ public static final int H5I_VFL = H5I_VFL(); + /** */ public static final int H5I_VOL = H5I_VOL(); + /** */ public static final int H5L_TYPE_ERROR = H5L_TYPE_ERROR(); + /** */ public static final int H5L_TYPE_HARD = H5L_TYPE_HARD(); + /** */ public static final int H5L_TYPE_SOFT = H5L_TYPE_SOFT(); + /** */ public static final int H5L_TYPE_EXTERNAL = H5L_TYPE_EXTERNAL(); + /** */ public static final int H5L_TYPE_MAX = H5L_TYPE_MAX(); + /** */ public static final int H5O_COPY_SHALLOW_HIERARCHY_FLAG = H5O_COPY_SHALLOW_HIERARCHY_FLAG(); + /** */ public static final int H5O_COPY_EXPAND_SOFT_LINK_FLAG = H5O_COPY_EXPAND_SOFT_LINK_FLAG(); + /** */ public static final int H5O_COPY_EXPAND_EXT_LINK_FLAG = H5O_COPY_EXPAND_EXT_LINK_FLAG(); + /** */ public static final int H5O_COPY_EXPAND_REFERENCE_FLAG = H5O_COPY_EXPAND_REFERENCE_FLAG(); + /** */ public static final int H5O_COPY_WITHOUT_ATTR_FLAG = H5O_COPY_WITHOUT_ATTR_FLAG(); + /** */ public static final int H5O_COPY_PRESERVE_NULL_FLAG = H5O_COPY_PRESERVE_NULL_FLAG(); + /** */ public static final int H5O_INFO_BASIC = H5O_INFO_BASIC(); + /** */ public static final int H5O_INFO_TIME = H5O_INFO_TIME(); + /** */ public static final int H5O_INFO_NUM_ATTRS = H5O_INFO_NUM_ATTRS(); + /** */ public static final int H5O_INFO_ALL = H5O_INFO_ALL(); + /** */ public static final int H5O_NATIVE_INFO_HDR = H5O_NATIVE_INFO_HDR(); + /** */ public static final int H5O_NATIVE_INFO_META_SIZE = H5O_NATIVE_INFO_META_SIZE(); + /** */ public static final int H5O_NATIVE_INFO_ALL = H5O_NATIVE_INFO_ALL(); + /** */ public static final int H5O_SHMESG_NONE_FLAG = H5O_SHMESG_NONE_FLAG(); + /** */ public static final int H5O_SHMESG_SDSPACE_FLAG = H5O_SHMESG_SDSPACE_FLAG(); + /** */ public static final int H5O_SHMESG_DTYPE_FLAG = H5O_SHMESG_DTYPE_FLAG(); + /** */ public static final int H5O_SHMESG_FILL_FLAG = H5O_SHMESG_FILL_FLAG(); + /** */ public static final int H5O_SHMESG_PLINE_FLAG = H5O_SHMESG_PLINE_FLAG(); + /** */ public static final int H5O_SHMESG_ATTR_FLAG = H5O_SHMESG_ATTR_FLAG(); + /** */ public static final int H5O_SHMESG_ALL_FLAG = H5O_SHMESG_ALL_FLAG(); + /** */ public static final int H5O_TYPE_UNKNOWN = H5O_TYPE_UNKNOWN(); + /** */ public static final int H5O_TYPE_GROUP = H5O_TYPE_GROUP(); + /** */ public static final int H5O_TYPE_DATASET = H5O_TYPE_DATASET(); + /** */ public static final int H5O_TYPE_NAMED_DATATYPE = H5O_TYPE_NAMED_DATATYPE(); + /** */ public static final int H5O_TYPE_NTYPES = H5O_TYPE_NTYPES(); + /** */ public static final int H5O_MAX_TOKEN_SIZE = H5O_MAX_TOKEN_SIZE(); + /** */ public static final H5O_token_t H5O_TOKEN_UNDEF = H5O_TOKEN_UNDEF(); + /** */ public static final long H5P_ROOT = H5P_ROOT(); + /** */ public static final long H5P_OBJECT_CREATE = H5P_OBJECT_CREATE(); + /** */ public static final long H5P_FILE_CREATE = H5P_FILE_CREATE(); + /** */ public static final long H5P_FILE_ACCESS = H5P_FILE_ACCESS(); + /** */ public static final long H5P_DATASET_CREATE = H5P_DATASET_CREATE(); + /** */ public static final long H5P_DATASET_ACCESS = H5P_DATASET_ACCESS(); + /** */ public static final long H5P_DATASET_XFER = H5P_DATASET_XFER(); + /** */ public static final long H5P_FILE_MOUNT = H5P_FILE_MOUNT(); + /** */ public static final long H5P_GROUP_CREATE = H5P_GROUP_CREATE(); + /** */ public static final long H5P_GROUP_ACCESS = H5P_GROUP_ACCESS(); + /** */ public static final long H5P_DATATYPE_CREATE = H5P_DATATYPE_CREATE(); + /** */ public static final long H5P_DATATYPE_ACCESS = H5P_DATATYPE_ACCESS(); + /** */ public static final long H5P_STRING_CREATE = H5P_STRING_CREATE(); + /** */ public static final long H5P_ATTRIBUTE_CREATE = H5P_ATTRIBUTE_CREATE(); + /** */ public static final long H5P_ATTRIBUTE_ACCESS = H5P_ATTRIBUTE_ACCESS(); + /** */ public static final long H5P_OBJECT_COPY = H5P_OBJECT_COPY(); + /** */ public static final long H5P_LINK_CREATE = H5P_LINK_CREATE(); + /** */ public static final long H5P_LINK_ACCESS = H5P_LINK_ACCESS(); + /** */ public static final long H5P_VOL_INITIALIZE = H5P_VOL_INITIALIZE(); + /** */ public static final long H5P_FILE_CREATE_DEFAULT = H5P_FILE_CREATE_DEFAULT(); + /** */ public static final long H5P_FILE_ACCESS_DEFAULT = H5P_FILE_ACCESS_DEFAULT(); + /** */ public static final long H5P_DATASET_CREATE_DEFAULT = H5P_DATASET_CREATE_DEFAULT(); + /** */ public static final long H5P_DATASET_ACCESS_DEFAULT = H5P_DATASET_ACCESS_DEFAULT(); + /** */ public static final long H5P_DATASET_XFER_DEFAULT = H5P_DATASET_XFER_DEFAULT(); + /** */ public static final long H5P_FILE_MOUNT_DEFAULT = H5P_FILE_MOUNT_DEFAULT(); + /** */ public static final long H5P_GROUP_CREATE_DEFAULT = H5P_GROUP_CREATE_DEFAULT(); + /** */ public static final long H5P_GROUP_ACCESS_DEFAULT = H5P_GROUP_ACCESS_DEFAULT(); + /** */ public static final long H5P_DATATYPE_CREATE_DEFAULT = H5P_DATATYPE_CREATE_DEFAULT(); + /** */ public static final long H5P_DATATYPE_ACCESS_DEFAULT = H5P_DATATYPE_ACCESS_DEFAULT(); + /** */ public static final long H5P_ATTRIBUTE_CREATE_DEFAULT = H5P_ATTRIBUTE_CREATE_DEFAULT(); + /** */ public static final long H5P_ATTRIBUTE_ACCESS_DEFAULT = H5P_ATTRIBUTE_ACCESS_DEFAULT(); + /** */ public static final long H5P_OBJECT_COPY_DEFAULT = H5P_OBJECT_COPY_DEFAULT(); + /** */ public static final long H5P_LINK_CREATE_DEFAULT = H5P_LINK_CREATE_DEFAULT(); + /** */ public static final long H5P_LINK_ACCESS_DEFAULT = H5P_LINK_ACCESS_DEFAULT(); + /** */ public static final long H5P_VOL_INITIALIZE_DEFAULT = H5P_VOL_INITIALIZE_DEFAULT(); + /** */ public static final int H5P_CRT_ORDER_TRACKED = H5P_CRT_ORDER_TRACKED(); + /** */ public static final int H5P_CRT_ORDER_INDEXED = H5P_CRT_ORDER_INDEXED(); + /** */ public static final long H5P_DEFAULT = H5P_DEFAULT(); + /** */ public static final int H5PL_TYPE_ERROR = H5PL_TYPE_ERROR(); + /** */ public static final int H5PL_TYPE_FILTER = H5PL_TYPE_FILTER(); + /** */ public static final int H5PL_TYPE_VOL = H5PL_TYPE_VOL(); + /** */ public static final int H5PL_TYPE_NONE = H5PL_TYPE_NONE(); + /** */ public static final int H5PL_FILTER_PLUGIN = H5PL_FILTER_PLUGIN(); + /** */ public static final int H5PL_VOL_PLUGIN = H5PL_VOL_PLUGIN(); + /** */ public static final int H5PL_ALL_PLUGIN = H5PL_ALL_PLUGIN(); + /** */ public static final int H5R_ATTR = H5R_ATTR(); + /** */ public static final int H5R_BADTYPE = H5R_BADTYPE(); + /** */ public static final int H5R_DATASET_REGION = H5R_DATASET_REGION(); + /** */ public static final int H5R_DATASET_REGION1 = H5R_DATASET_REGION1(); + /** */ public static final int H5R_DATASET_REGION2 = H5R_DATASET_REGION2(); + /** */ public static final int H5R_MAXTYPE = H5R_MAXTYPE(); + /** */ public static final int H5R_REF_BUF_SIZE = H5R_REF_BUF_SIZE(); + /** */ public static final int H5R_OBJ_REF_BUF_SIZE = H5R_OBJ_REF_BUF_SIZE(); + /** */ public static final int H5R_OBJECT = H5R_OBJECT(); + /** */ public static final int H5R_OBJECT1 = H5R_OBJECT1(); + /** */ public static final int H5R_OBJECT2 = H5R_OBJECT2(); /** Define atomic datatypes */ @@ -724,222 +970,438 @@ public class HDF5Constants { /** Define atomic datatypes */ public static final int H5S_UNLIMITED = H5S_UNLIMITED(); + /** */ public static final long H5T_ALPHA_B16 = H5T_ALPHA_B16(); + /** */ public static final long H5T_ALPHA_B32 = H5T_ALPHA_B32(); + /** */ public static final long H5T_ALPHA_B64 = H5T_ALPHA_B64(); + /** */ public static final long H5T_ALPHA_B8 = H5T_ALPHA_B8(); + /** */ public static final long H5T_ALPHA_F32 = H5T_ALPHA_F32(); + /** */ public static final long H5T_ALPHA_F64 = H5T_ALPHA_F64(); + /** */ public static final long H5T_ALPHA_I16 = H5T_ALPHA_I16(); + /** */ public static final long H5T_ALPHA_I32 = H5T_ALPHA_I32(); + /** */ public static final long H5T_ALPHA_I64 = H5T_ALPHA_I64(); + /** */ public static final long H5T_ALPHA_I8 = H5T_ALPHA_I8(); + /** */ public static final long H5T_ALPHA_U16 = H5T_ALPHA_U16(); + /** */ public static final long H5T_ALPHA_U32 = H5T_ALPHA_U32(); + /** */ public static final long H5T_ALPHA_U64 = H5T_ALPHA_U64(); + /** */ public static final long H5T_ALPHA_U8 = H5T_ALPHA_U8(); + /** */ public static final int H5T_ARRAY = H5T_ARRAY(); + /** */ public static final int H5T_BITFIELD = H5T_BITFIELD(); + /** */ public static final int H5T_BKG_NO = H5T_BKG_NO(); + /** */ public static final int H5T_BKG_YES = H5T_BKG_YES(); + /** */ public static final long H5T_C_S1 = H5T_C_S1(); + /** */ public static final int H5T_COMPOUND = H5T_COMPOUND(); + /** */ public static final int H5T_CONV_CONV = H5T_CONV_CONV(); + /** */ public static final int H5T_CONV_FREE = H5T_CONV_FREE(); + /** */ public static final int H5T_CONV_INIT = H5T_CONV_INIT(); + /** */ public static final int H5T_CSET_ERROR = H5T_CSET_ERROR(); + /** */ public static final int H5T_CSET_ASCII = H5T_CSET_ASCII(); + /** */ public static final int H5T_CSET_UTF8 = H5T_CSET_UTF8(); + /** */ public static final int H5T_CSET_RESERVED_10 = H5T_CSET_RESERVED_10(); + /** */ public static final int H5T_CSET_RESERVED_11 = H5T_CSET_RESERVED_11(); + /** */ public static final int H5T_CSET_RESERVED_12 = H5T_CSET_RESERVED_12(); + /** */ public static final int H5T_CSET_RESERVED_13 = H5T_CSET_RESERVED_13(); + /** */ public static final int H5T_CSET_RESERVED_14 = H5T_CSET_RESERVED_14(); + /** */ public static final int H5T_CSET_RESERVED_15 = H5T_CSET_RESERVED_15(); + /** */ public static final int H5T_CSET_RESERVED_2 = H5T_CSET_RESERVED_2(); + /** */ public static final int H5T_CSET_RESERVED_3 = H5T_CSET_RESERVED_3(); + /** */ public static final int H5T_CSET_RESERVED_4 = H5T_CSET_RESERVED_4(); + /** */ public static final int H5T_CSET_RESERVED_5 = H5T_CSET_RESERVED_5(); + /** */ public static final int H5T_CSET_RESERVED_6 = H5T_CSET_RESERVED_6(); + /** */ public static final int H5T_CSET_RESERVED_7 = H5T_CSET_RESERVED_7(); + /** */ public static final int H5T_CSET_RESERVED_8 = H5T_CSET_RESERVED_8(); + /** */ public static final int H5T_CSET_RESERVED_9 = H5T_CSET_RESERVED_9(); + /** */ public static final int H5T_DIR_ASCEND = H5T_DIR_ASCEND(); + /** */ public static final int H5T_DIR_DEFAULT = H5T_DIR_DEFAULT(); + /** */ public static final int H5T_DIR_DESCEND = H5T_DIR_DESCEND(); + /** */ public static final int H5T_ENUM = H5T_ENUM(); + /** */ public static final int H5T_FLOAT = H5T_FLOAT(); + /** */ public static final long H5T_FORTRAN_S1 = H5T_FORTRAN_S1(); + /** */ public static final long H5T_IEEE_F32BE = H5T_IEEE_F32BE(); + /** */ public static final long H5T_IEEE_F32LE = H5T_IEEE_F32LE(); + /** */ public static final long H5T_IEEE_F64BE = H5T_IEEE_F64BE(); + /** */ public static final long H5T_IEEE_F64LE = H5T_IEEE_F64LE(); + /** */ public static final int H5T_INTEGER = H5T_INTEGER(); + /** */ public static final long H5T_INTEL_B16 = H5T_INTEL_B16(); + /** */ public static final long H5T_INTEL_B32 = H5T_INTEL_B32(); + /** */ public static final long H5T_INTEL_B64 = H5T_INTEL_B64(); + /** */ public static final long H5T_INTEL_B8 = H5T_INTEL_B8(); + /** */ public static final long H5T_INTEL_F32 = H5T_INTEL_F32(); + /** */ public static final long H5T_INTEL_F64 = H5T_INTEL_F64(); + /** */ public static final long H5T_INTEL_I16 = H5T_INTEL_I16(); + /** */ public static final long H5T_INTEL_I32 = H5T_INTEL_I32(); + /** */ public static final long H5T_INTEL_I64 = H5T_INTEL_I64(); + /** */ public static final long H5T_INTEL_I8 = H5T_INTEL_I8(); + /** */ public static final long H5T_INTEL_U16 = H5T_INTEL_U16(); + /** */ public static final long H5T_INTEL_U32 = H5T_INTEL_U32(); + /** */ public static final long H5T_INTEL_U64 = H5T_INTEL_U64(); + /** */ public static final long H5T_INTEL_U8 = H5T_INTEL_U8(); + /** */ public static final long H5T_MIPS_B16 = H5T_MIPS_B16(); + /** */ public static final long H5T_MIPS_B32 = H5T_MIPS_B32(); + /** */ public static final long H5T_MIPS_B64 = H5T_MIPS_B64(); + /** */ public static final long H5T_MIPS_B8 = H5T_MIPS_B8(); + /** */ public static final long H5T_MIPS_F32 = H5T_MIPS_F32(); + /** */ public static final long H5T_MIPS_F64 = H5T_MIPS_F64(); + /** */ public static final long H5T_MIPS_I16 = H5T_MIPS_I16(); + /** */ public static final long H5T_MIPS_I32 = H5T_MIPS_I32(); + /** */ public static final long H5T_MIPS_I64 = H5T_MIPS_I64(); + /** */ public static final long H5T_MIPS_I8 = H5T_MIPS_I8(); + /** */ public static final long H5T_MIPS_U16 = H5T_MIPS_U16(); + /** */ public static final long H5T_MIPS_U32 = H5T_MIPS_U32(); + /** */ public static final long H5T_MIPS_U64 = H5T_MIPS_U64(); + /** */ public static final long H5T_MIPS_U8 = H5T_MIPS_U8(); + /** */ public static final long H5T_NATIVE_B16 = H5T_NATIVE_B16(); + /** */ public static final long H5T_NATIVE_B32 = H5T_NATIVE_B32(); + /** */ public static final long H5T_NATIVE_B64 = H5T_NATIVE_B64(); + /** */ public static final long H5T_NATIVE_B8 = H5T_NATIVE_B8(); + /** */ public static final long H5T_NATIVE_CHAR = H5T_NATIVE_CHAR(); + /** */ public static final long H5T_NATIVE_DOUBLE = H5T_NATIVE_DOUBLE(); + /** */ public static final long H5T_NATIVE_FLOAT = H5T_NATIVE_FLOAT(); + /** */ public static final long H5T_NATIVE_HADDR = H5T_NATIVE_HADDR(); + /** */ public static final long H5T_NATIVE_HBOOL = H5T_NATIVE_HBOOL(); + /** */ public static final long H5T_NATIVE_HERR = H5T_NATIVE_HERR(); + /** */ public static final long H5T_NATIVE_HSIZE = H5T_NATIVE_HSIZE(); + /** */ public static final long H5T_NATIVE_HSSIZE = H5T_NATIVE_HSSIZE(); + /** */ public static final long H5T_NATIVE_INT = H5T_NATIVE_INT(); + /** */ public static final long H5T_NATIVE_INT_FAST16 = H5T_NATIVE_INT_FAST16(); + /** */ public static final long H5T_NATIVE_INT_FAST32 = H5T_NATIVE_INT_FAST32(); + /** */ public static final long H5T_NATIVE_INT_FAST64 = H5T_NATIVE_INT_FAST64(); + /** */ public static final long H5T_NATIVE_INT_FAST8 = H5T_NATIVE_INT_FAST8(); + /** */ public static final long H5T_NATIVE_INT_LEAST16 = H5T_NATIVE_INT_LEAST16(); + /** */ public static final long H5T_NATIVE_INT_LEAST32 = H5T_NATIVE_INT_LEAST32(); + /** */ public static final long H5T_NATIVE_INT_LEAST64 = H5T_NATIVE_INT_LEAST64(); + /** */ public static final long H5T_NATIVE_INT_LEAST8 = H5T_NATIVE_INT_LEAST8(); + /** */ public static final long H5T_NATIVE_INT16 = H5T_NATIVE_INT16(); + /** */ public static final long H5T_NATIVE_INT32 = H5T_NATIVE_INT32(); + /** */ public static final long H5T_NATIVE_INT64 = H5T_NATIVE_INT64(); + /** */ public static final long H5T_NATIVE_INT8 = H5T_NATIVE_INT8(); + /** */ public static final long H5T_NATIVE_LDOUBLE = H5T_NATIVE_LDOUBLE(); + /** */ public static final long H5T_NATIVE_LLONG = H5T_NATIVE_LLONG(); + /** */ public static final long H5T_NATIVE_LONG = H5T_NATIVE_LONG(); + /** */ public static final long H5T_NATIVE_OPAQUE = H5T_NATIVE_OPAQUE(); + /** */ public static final long H5T_NATIVE_SCHAR = H5T_NATIVE_SCHAR(); + /** */ public static final long H5T_NATIVE_SHORT = H5T_NATIVE_SHORT(); + /** */ public static final long H5T_NATIVE_UCHAR = H5T_NATIVE_UCHAR(); + /** */ public static final long H5T_NATIVE_UINT = H5T_NATIVE_UINT(); + /** */ public static final long H5T_NATIVE_UINT_FAST16 = H5T_NATIVE_UINT_FAST16(); + /** */ public static final long H5T_NATIVE_UINT_FAST32 = H5T_NATIVE_UINT_FAST32(); + /** */ public static final long H5T_NATIVE_UINT_FAST64 = H5T_NATIVE_UINT_FAST64(); + /** */ public static final long H5T_NATIVE_UINT_FAST8 = H5T_NATIVE_UINT_FAST8(); + /** */ public static final long H5T_NATIVE_UINT_LEAST16 = H5T_NATIVE_UINT_LEAST16(); + /** */ public static final long H5T_NATIVE_UINT_LEAST32 = H5T_NATIVE_UINT_LEAST32(); + /** */ public static final long H5T_NATIVE_UINT_LEAST64 = H5T_NATIVE_UINT_LEAST64(); + /** */ public static final long H5T_NATIVE_UINT_LEAST8 = H5T_NATIVE_UINT_LEAST8(); + /** */ public static final long H5T_NATIVE_UINT16 = H5T_NATIVE_UINT16(); + /** */ public static final long H5T_NATIVE_UINT32 = H5T_NATIVE_UINT32(); + /** */ public static final long H5T_NATIVE_UINT64 = H5T_NATIVE_UINT64(); + /** */ public static final long H5T_NATIVE_UINT8 = H5T_NATIVE_UINT8(); + /** */ public static final long H5T_NATIVE_ULLONG = H5T_NATIVE_ULLONG(); + /** */ public static final long H5T_NATIVE_ULONG = H5T_NATIVE_ULONG(); + /** */ public static final long H5T_NATIVE_USHORT = H5T_NATIVE_USHORT(); + /** */ public static final int H5T_NCLASSES = H5T_NCLASSES(); + /** */ public static final int H5T_NO_CLASS = H5T_NO_CLASS(); + /** */ public static final int H5T_NORM_ERROR = H5T_NORM_ERROR(); + /** */ public static final int H5T_NORM_IMPLIED = H5T_NORM_IMPLIED(); + /** */ public static final int H5T_NORM_MSBSET = H5T_NORM_MSBSET(); + /** */ public static final int H5T_NORM_NONE = H5T_NORM_NONE(); + /** */ public static final int H5T_NPAD = H5T_NPAD(); + /** */ public static final int H5T_NSGN = H5T_NSGN(); + /** */ public static final int H5T_OPAQUE = H5T_OPAQUE(); + /** */ public static final int H5T_OPAQUE_TAG_MAX = H5T_OPAQUE_TAG_MAX(); /* 1.6.5 */ + /** */ public static final int H5T_ORDER_BE = H5T_ORDER_BE(); + /** */ public static final int H5T_ORDER_ERROR = H5T_ORDER_ERROR(); + /** */ public static final int H5T_ORDER_LE = H5T_ORDER_LE(); + /** */ public static final int H5T_ORDER_NONE = H5T_ORDER_NONE(); + /** */ public static final int H5T_ORDER_VAX = H5T_ORDER_VAX(); + /** */ public static final int H5T_PAD_BACKGROUND = H5T_PAD_BACKGROUND(); + /** */ public static final int H5T_PAD_ERROR = H5T_PAD_ERROR(); + /** */ public static final int H5T_PAD_ONE = H5T_PAD_ONE(); + /** */ public static final int H5T_PAD_ZERO = H5T_PAD_ZERO(); + /** */ public static final int H5T_PERS_DONTCARE = H5T_PERS_DONTCARE(); + /** */ public static final int H5T_PERS_HARD = H5T_PERS_HARD(); + /** */ public static final int H5T_PERS_SOFT = H5T_PERS_SOFT(); + /** */ public static final int H5T_REFERENCE = H5T_REFERENCE(); + /** */ public static final int H5T_SGN_2 = H5T_SGN_2(); + /** */ public static final int H5T_SGN_ERROR = H5T_SGN_ERROR(); + /** */ public static final int H5T_SGN_NONE = H5T_SGN_NONE(); + /** */ public static final long H5T_STD_B16BE = H5T_STD_B16BE(); + /** */ public static final long H5T_STD_B16LE = H5T_STD_B16LE(); + /** */ public static final long H5T_STD_B32BE = H5T_STD_B32BE(); + /** */ public static final long H5T_STD_B32LE = H5T_STD_B32LE(); + /** */ public static final long H5T_STD_B64BE = H5T_STD_B64BE(); + /** */ public static final long H5T_STD_B64LE = H5T_STD_B64LE(); + /** */ public static final long H5T_STD_B8BE = H5T_STD_B8BE(); + /** */ public static final long H5T_STD_B8LE = H5T_STD_B8LE(); + /** */ public static final long H5T_STD_I16BE = H5T_STD_I16BE(); + /** */ public static final long H5T_STD_I16LE = H5T_STD_I16LE(); + /** */ public static final long H5T_STD_I32BE = H5T_STD_I32BE(); + /** */ public static final long H5T_STD_I32LE = H5T_STD_I32LE(); + /** */ public static final long H5T_STD_I64BE = H5T_STD_I64BE(); + /** */ public static final long H5T_STD_I64LE = H5T_STD_I64LE(); + /** */ public static final long H5T_STD_I8BE = H5T_STD_I8BE(); + /** */ public static final long H5T_STD_I8LE = H5T_STD_I8LE(); + /** */ public static final long H5T_STD_REF_DSETREG = H5T_STD_REF_DSETREG(); + /** */ public static final long H5T_STD_REF_OBJ = H5T_STD_REF_OBJ(); + /** */ public static final long H5T_STD_REF = H5T_STD_REF(); + /** */ public static final long H5T_STD_U16BE = H5T_STD_U16BE(); + /** */ public static final long H5T_STD_U16LE = H5T_STD_U16LE(); + /** */ public static final long H5T_STD_U32BE = H5T_STD_U32BE(); + /** */ public static final long H5T_STD_U32LE = H5T_STD_U32LE(); + /** */ public static final long H5T_STD_U64BE = H5T_STD_U64BE(); + /** */ public static final long H5T_STD_U64LE = H5T_STD_U64LE(); + /** */ public static final long H5T_STD_U8BE = H5T_STD_U8BE(); + /** */ public static final long H5T_STD_U8LE = H5T_STD_U8LE(); + /** */ public static final int H5T_STR_ERROR = H5T_STR_ERROR(); + /** */ public static final int H5T_STR_NULLPAD = H5T_STR_NULLPAD(); + /** */ public static final int H5T_STR_NULLTERM = H5T_STR_NULLTERM(); + /** */ public static final int H5T_STR_RESERVED_10 = H5T_STR_RESERVED_10(); + /** */ public static final int H5T_STR_RESERVED_11 = H5T_STR_RESERVED_11(); + /** */ public static final int H5T_STR_RESERVED_12 = H5T_STR_RESERVED_12(); + /** */ public static final int H5T_STR_RESERVED_13 = H5T_STR_RESERVED_13(); + /** */ public static final int H5T_STR_RESERVED_14 = H5T_STR_RESERVED_14(); + /** */ public static final int H5T_STR_RESERVED_15 = H5T_STR_RESERVED_15(); + /** */ public static final int H5T_STR_RESERVED_3 = H5T_STR_RESERVED_3(); + /** */ public static final int H5T_STR_RESERVED_4 = H5T_STR_RESERVED_4(); + /** */ public static final int H5T_STR_RESERVED_5 = H5T_STR_RESERVED_5(); + /** */ public static final int H5T_STR_RESERVED_6 = H5T_STR_RESERVED_6(); + /** */ public static final int H5T_STR_RESERVED_7 = H5T_STR_RESERVED_7(); + /** */ public static final int H5T_STR_RESERVED_8 = H5T_STR_RESERVED_8(); + /** */ public static final int H5T_STR_RESERVED_9 = H5T_STR_RESERVED_9(); + /** */ public static final int H5T_STR_SPACEPAD = H5T_STR_SPACEPAD(); + /** */ public static final int H5T_STRING = H5T_STRING(); + /** */ public static final int H5T_TIME = H5T_TIME(); + /** */ public static final long H5T_UNIX_D32BE = H5T_UNIX_D32BE(); + /** */ public static final long H5T_UNIX_D32LE = H5T_UNIX_D32LE(); + /** */ public static final long H5T_UNIX_D64BE = H5T_UNIX_D64BE(); + /** */ public static final long H5T_UNIX_D64LE = H5T_UNIX_D64LE(); + /** */ public static final long H5T_VARIABLE = H5T_VARIABLE(); + /** */ public static final int H5T_VLEN = H5T_VLEN(); + /** */ public static final int H5T_VL_T = H5T_VL_T(); + /** */ public static final int H5VL_CAP_FLAG_NONE = H5VL_CAP_FLAG_NONE(); + /** */ public static final int H5VL_CAP_FLAG_THREADSAFE = H5VL_CAP_FLAG_THREADSAFE(); + /** */ public static final long H5VL_NATIVE = H5VL_NATIVE(); + /** */ public static final String H5VL_NATIVE_NAME = H5VL_NATIVE_NAME(); + /** */ public static final int H5VL_NATIVE_VALUE = H5VL_NATIVE_VALUE(); + /** */ public static final int H5VL_NATIVE_VERSION = H5VL_NATIVE_VERSION(); + /** */ public static final int H5_VOL_INVALID = H5_VOL_INVALID(); + /** */ public static final int H5_VOL_NATIVE = H5_VOL_NATIVE(); + /** */ public static final int H5_VOL_RESERVED = H5_VOL_RESERVED(); + /** */ public static final int H5_VOL_MAX = H5_VOL_MAX(); /** Return values for filter callback function */ diff --git a/java/src/hdf/hdf5lib/HDF5GroupInfo.java b/java/src/hdf/hdf5lib/HDF5GroupInfo.java index 44b41bb..e08f991 100644 --- a/java/src/hdf/hdf5lib/HDF5GroupInfo.java +++ b/java/src/hdf/hdf5lib/HDF5GroupInfo.java @@ -41,6 +41,8 @@ public class HDF5GroupInfo { long mtime; int linklen; + /** Container for the information reported about an HDF5 Object + * from the H5Gget_obj_info() method */ public HDF5GroupInfo() { fileno = new long[2]; objno = new long[2]; @@ -88,27 +90,32 @@ public class HDF5GroupInfo { linklen = 0; } - /* accessors */ + /** fileno accessors */ public long[] getFileno() { return fileno; } + /** accessors */ public long[] getObjno() { return objno; } + /** accessors */ public int getType() { return type; } + /** accessors */ public int getNlink() { return nlink; } + /** accessors */ public long getMtime() { return mtime; } + /** accessors */ public int getLinklen() { return linklen; } diff --git a/java/src/hdf/hdf5lib/structs/H5A_info_t.java b/java/src/hdf/hdf5lib/structs/H5A_info_t.java index a274551..4aa610b 100644 --- a/java/src/hdf/hdf5lib/structs/H5A_info_t.java +++ b/java/src/hdf/hdf5lib/structs/H5A_info_t.java @@ -21,10 +21,14 @@ import java.io.Serializable; */ public class H5A_info_t implements Serializable{ private static final long serialVersionUID = 2791443594041667613L; - public boolean corder_valid; // Indicate if creation order is valid - public long corder; // Creation order of attribute - public int cset; // Character set of attribute name - public long data_size; // Size of raw data + /** Indicate if creation order is valid */ + public boolean corder_valid; + /** Creation order of attribute */ + public long corder; + /** Character set of attribute name */ + public int cset; + /** Size of raw data */ + public long data_size; H5A_info_t(boolean corder_valid, long corder, int cset, long data_size) { this.corder_valid = corder_valid; diff --git a/java/src/hdf/hdf5lib/structs/H5_ih_info_t.java b/java/src/hdf/hdf5lib/structs/H5_ih_info_t.java index 96082ab..97b239a 100644 --- a/java/src/hdf/hdf5lib/structs/H5_ih_info_t.java +++ b/java/src/hdf/hdf5lib/structs/H5_ih_info_t.java @@ -21,7 +21,9 @@ import java.io.Serializable; */ public class H5_ih_info_t implements Serializable { private static final long serialVersionUID = -142238015615462707L; + /** */ public long index_size; /* btree and/or list */ + /** */ public long heap_size; H5_ih_info_t (long index_size, long heap_size) diff --git a/java/src/jni/exceptionImp.c b/java/src/jni/exceptionImp.c index 6e08023..3ccb6ef 100644 --- a/java/src/jni/exceptionImp.c +++ b/java/src/jni/exceptionImp.c @@ -262,12 +262,25 @@ done: * exception. */ jboolean -h5outOfMemory(JNIEnv *env, const char *functName) +h5outOfMemory(JNIEnv *env, const char *message) { - return H5JNIErrorClass(env, functName, "java/lang/OutOfMemoryError"); + return H5JNIErrorClass(env, message, "java/lang/OutOfMemoryError"); } /* end h5outOfMemory() */ /* + * Create and throw an 'AssertionError' + * + * Note: This routine never returns from the 'throw', + * and the Java native method immediately raises the + * exception. + */ +jboolean +h5assertion(JNIEnv *env, const char *message) +{ + return H5JNIErrorClass(env, message, "java/lang/AssertionError"); +} /* end h5assertion() */ + +/* * A fatal error in a JNI call * Create and throw an 'InternalError' * @@ -276,9 +289,9 @@ h5outOfMemory(JNIEnv *env, const char *functName) * exception. */ jboolean -h5JNIFatalError(JNIEnv *env, const char *functName) +h5JNIFatalError(JNIEnv *env, const char *message) { - return H5JNIErrorClass(env, functName, "java/lang/InternalError"); + return H5JNIErrorClass(env, message, "java/lang/InternalError"); } /* end h5JNIFatalError() */ /* @@ -290,9 +303,9 @@ h5JNIFatalError(JNIEnv *env, const char *functName) * exception. */ jboolean -h5nullArgument(JNIEnv *env, const char *functName) +h5nullArgument(JNIEnv *env, const char *message) { - return H5JNIErrorClass(env, functName, "java/lang/NullPointerException"); + return H5JNIErrorClass(env, message, "java/lang/NullPointerException"); } /* end h5nullArgument() */ /* @@ -304,9 +317,9 @@ h5nullArgument(JNIEnv *env, const char *functName) * exception. */ jboolean -h5badArgument(JNIEnv *env, const char *functName) +h5badArgument(JNIEnv *env, const char *message) { - return H5JNIErrorClass(env, functName, "java/lang/IllegalArgumentException"); + return H5JNIErrorClass(env, message, "java/lang/IllegalArgumentException"); } /* end h5badArgument() */ /* @@ -318,9 +331,9 @@ h5badArgument(JNIEnv *env, const char *functName) * exception. */ jboolean -h5unimplemented(JNIEnv *env, const char *functName) +h5unimplemented(JNIEnv *env, const char *message) { - return H5JNIErrorClass(env, functName, "java/lang/UnsupportedOperationException"); + return H5JNIErrorClass(env, message, "java/lang/UnsupportedOperationException"); } /* end h5unimplemented() */ /* h5raiseException(). This routine is called to generate diff --git a/java/src/jni/h5Constants.c b/java/src/jni/h5Constants.c index 7f60153..7354e95 100644 --- a/java/src/jni/h5Constants.c +++ b/java/src/jni/h5Constants.c @@ -1403,7 +1403,7 @@ Java_hdf_hdf5lib_HDF5Constants_H5FD_1DIRECT(JNIEnv *env, jclass cls) #ifdef H5_HAVE_DIRECT return H5FD_DIRECT; #else - return -1; + return H5I_INVALID_HID; #endif } JNIEXPORT jlong JNICALL @@ -1417,7 +1417,7 @@ Java_hdf_hdf5lib_HDF5Constants_H5FD_1HDFS(JNIEnv *env, jclass cls) #ifdef H5_HAVE_LIBHDFS return H5FD_HDFS; #else - return -1; + return H5I_INVALID_HID; #endif } JNIEXPORT jlong JNICALL @@ -1446,7 +1446,7 @@ Java_hdf_hdf5lib_HDF5Constants_H5FD_1ROS3(JNIEnv *env, jclass cls) #ifdef H5_HAVE_ROS3_VFD return H5FD_ROS3; #else - return -1; + return H5I_INVALID_HID; #endif } JNIEXPORT jlong JNICALL @@ -1460,7 +1460,7 @@ Java_hdf_hdf5lib_HDF5Constants_H5FD_1WINDOWS(JNIEnv *env, jclass cls) #ifdef H5_HAVE_WINDOWS return H5FD_DIRECT; #else - return -1; + return H5I_INVALID_HID; #endif } JNIEXPORT jint JNICALL diff --git a/java/src/jni/h5aImp.c b/java/src/jni/h5aImp.c index c365144..6bf86d0 100644 --- a/java/src/jni/h5aImp.c +++ b/java/src/jni/h5aImp.c @@ -1133,7 +1133,7 @@ H5AreadVL_asstr(JNIEnv *env, hid_t aid, hid_t tid, jobjectArray buf) for (i = 0; i < (size_t)n; i++) { h5str.s[0] = '\0'; - if (!h5str_sprintf(ENVONLY, &h5str, aid, tid, &(((char *)readBuf)[i * typeSize]), typeSize, 0)) + if (!h5str_sprintf(ENVONLY, &h5str, aid, tid, &(((char *)readBuf)[i * typeSize]), 0)) CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); if (NULL == (jstr = ENVPTR->NewStringUTF(ENVONLY, h5str.s))) @@ -1425,7 +1425,7 @@ Java_hdf_hdf5lib_H5_H5Aread_1reg_1ref(JNIEnv *env, jclass clss, jlong attr_id, j for (i = 0; i < n; i++) { h5str.s[0] = '\0'; - if (!h5str_sprintf(ENVONLY, &h5str, (hid_t)attr_id, (hid_t)mem_type_id, (void *)&ref_data[i], 0, 0)) + if (!h5str_sprintf(ENVONLY, &h5str, (hid_t)attr_id, (hid_t)mem_type_id, (void *)&ref_data[i], 0)) CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); if (NULL == (jstr = ENVPTR->NewStringUTF(ENVONLY, h5str.s))) diff --git a/java/src/jni/h5dImp.c b/java/src/jni/h5dImp.c index f8f2325..73b252a 100644 --- a/java/src/jni/h5dImp.c +++ b/java/src/jni/h5dImp.c @@ -1290,7 +1290,7 @@ H5DreadVL_asstr(JNIEnv *env, hid_t did, hid_t tid, hid_t mem_sid, hid_t file_sid for (i = 0; i < (size_t)n; i++) { h5str.s[0] = '\0'; - if (!h5str_sprintf(ENVONLY, &h5str, did, tid, &(((char *)readBuf)[i * typeSize]), typeSize, 0)) + if (!h5str_sprintf(ENVONLY, &h5str, did, tid, &(((char *)readBuf)[i * typeSize]), 0)) CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); if (NULL == (jstr = ENVPTR->NewStringUTF(ENVONLY, h5str.s))) @@ -1669,8 +1669,7 @@ Java_hdf_hdf5lib_H5_H5Dread_1reg_1ref(JNIEnv *env, jclass clss, jlong dataset_id for (i = 0; i < n; i++) { h5str.s[0] = '\0'; - if (!h5str_sprintf(ENVONLY, &h5str, (hid_t)dataset_id, (hid_t)mem_type_id, (void *)&ref_data[i], 0, - 0)) + if (!h5str_sprintf(ENVONLY, &h5str, (hid_t)dataset_id, (hid_t)mem_type_id, (void *)&ref_data[i], 0)) CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); if (NULL == (jstr = ENVPTR->NewStringUTF(ENVONLY, h5str.s))) diff --git a/java/src/jni/h5jni.h b/java/src/jni/h5jni.h index fb6f22a..f437d36 100644 --- a/java/src/jni/h5jni.h +++ b/java/src/jni/h5jni.h @@ -267,9 +267,10 @@ extern jboolean h5JNIFatalError(JNIEnv *env, const char *); extern jboolean h5nullArgument(JNIEnv *env, const char *); extern jboolean h5badArgument(JNIEnv *env, const char *); extern jboolean h5outOfMemory(JNIEnv *env, const char *); +extern jboolean h5assertion(JNIEnv *env, const char *); +extern jboolean h5unimplemented(JNIEnv *env, const char *); extern jboolean h5libraryError(JNIEnv *env); extern jboolean h5raiseException(JNIEnv *env, const char *, const char *); -extern jboolean h5unimplemented(JNIEnv *env, const char *functName); /* * The following macros are to facilitate immediate cleanup+return @@ -305,21 +306,27 @@ extern jboolean h5unimplemented(JNIEnv *env, const char *functName); goto done; \ } while (0) -#define H5_LIBRARY_ERROR(env) \ +#define H5_ASSERTION_ERROR(env, message) \ do { \ - h5libraryError(env); \ + h5assertion(env, message); \ goto done; \ } while (0) -#define H5_RAISE_EXCEPTION(env, message, exception) \ +#define H5_UNIMPLEMENTED(env, message) \ do { \ - h5raiseException(env, message, exception); \ + h5unimplemented(env, message); \ goto done; \ } while (0) -#define H5_UNIMPLEMENTED(env, message) \ +#define H5_LIBRARY_ERROR(env) \ do { \ - h5unimplemented(env, message); \ + h5libraryError(env); \ + goto done; \ + } while (0) + +#define H5_RAISE_EXCEPTION(env, message, exception) \ + do { \ + h5raiseException(env, message, exception); \ goto done; \ } while (0) diff --git a/java/src/jni/h5util.c b/java/src/jni/h5util.c index 5b38daf..2e02e4d 100644 --- a/java/src/jni/h5util.c +++ b/java/src/jni/h5util.c @@ -28,8 +28,6 @@ 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 */ @@ -54,18 +52,19 @@ 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_dump_region_blocks(JNIEnv *env, h5str_t *str, hid_t region, hid_t region_obj, + int expand_data); +static int h5str_dump_region_points(JNIEnv *env, h5str_t *str, hid_t region, hid_t region_obj, + int expand_data); +static int h5str_dump_region_attribute(JNIEnv *env, h5str_t *str, hid_t region_id); 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); static hid_t h5str_get_big_endian_type(hid_t type); static htri_t h5str_detect_vlen(hid_t tid); static htri_t h5str_detect_vlen_str(hid_t tid); -static int h5tools_dump_simple_data(JNIEnv *env, FILE *stream, hid_t container, hid_t type, void *_mem, - hsize_t nelmts); +static int h5str_dump_simple_data(JNIEnv *env, FILE *stream, hid_t container, hid_t type, void *_mem, + hsize_t nelmts); static int h5str_render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t block_nelmts); static int render_bin_output_region_data_blocks(FILE *stream, hid_t region_id, hid_t container, int ndims, @@ -185,13 +184,14 @@ h5str_convert(JNIEnv *env, char **in_str, hid_t container, hid_t tid, void *out_ H5T_class_t tclass = H5T_NO_CLASS; const char delimiter[] = " ," H5_COMPOUND_BEGIN_INDICATOR H5_COMPOUND_END_INDICATOR H5_ARRAY_BEGIN_INDICATOR H5_ARRAY_END_INDICATOR H5_VLEN_BEGIN_INDICATOR H5_VLEN_END_INDICATOR; - size_t typeSize = 0; - hid_t mtid = H5I_INVALID_HID; - char * this_str = NULL; - char * token; - char * cptr = NULL; - int n; - size_t retVal = 0; + + size_t retVal = 0; + size_t typeSize = 0; + hid_t mtid = H5I_INVALID_HID; + char * this_str = NULL; + char * cptr = NULL; + char * token; + int n; if (!in_str) H5_NULL_ARGUMENT_ERROR(ENVONLY, "h5str_convert: in_str is NULL"); @@ -239,7 +239,7 @@ h5str_convert(JNIEnv *env, char **in_str, hid_t container, hid_t tid, void *out_ case sizeof(long double): { long double tmp_ldouble = 0.0; - sscanf(token, "%Lf", &tmp_ldouble); + sscanf(token, "%Lg", &tmp_ldouble); HDmemcpy(cptr, &tmp_ldouble, sizeof(long double)); break; } @@ -644,27 +644,27 @@ done: * * Purpose: Object reference -- show the name of the referenced object. * - * Return: Nothing + * Return: SUCCEED or FAIL *------------------------------------------------------------------------- */ -void -h5str_sprint_reference(JNIEnv *env, h5str_t *out_str, hid_t container, void *ref_p) +int +h5str_sprint_reference(JNIEnv *env, h5str_t *out_str, void *ref_p) { - ssize_t buf_size; - char * ref_name = NULL; - const H5R_ref_t *ref_vp = (H5R_ref_t *)ref_p; + ssize_t buf_size; + char * ref_name = NULL; + H5R_ref_t *ref_vp = (H5R_ref_t *)ref_p; - UNUSED(container); + int ret_value = FAIL; if (!h5str_append(out_str, " \"")) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + H5_ASSERTION_ERROR(ENVONLY, "Unable to append string."); buf_size = H5Rget_file_name(ref_vp, NULL, 0); if (buf_size) { ref_name = (char *)HDmalloc(sizeof(char) * (size_t)buf_size + 1); if (H5Rget_file_name(ref_vp, ref_name, buf_size + 1) >= 0) { ref_name[buf_size] = '\0'; if (!h5str_append(out_str, ref_name)) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + H5_ASSERTION_ERROR(ENVONLY, "Unable to append string."); } HDfree(ref_name); ref_name = NULL; @@ -676,7 +676,7 @@ h5str_sprint_reference(JNIEnv *env, h5str_t *out_str, hid_t container, void *ref if (H5Rget_obj_name(ref_vp, H5P_DEFAULT, ref_name, buf_size + 1) >= 0) { ref_name[buf_size] = '\0'; if (!h5str_append(out_str, ref_name)) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + H5_ASSERTION_ERROR(ENVONLY, "Unable to append string."); } HDfree(ref_name); ref_name = NULL; @@ -689,17 +689,61 @@ h5str_sprint_reference(JNIEnv *env, h5str_t *out_str, hid_t container, void *ref if (H5Rget_attr_name(ref_vp, ref_name, buf_size + 1) >= 0) { ref_name[buf_size] = '\0'; if (!h5str_append(out_str, ref_name)) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + H5_ASSERTION_ERROR(ENVONLY, "Unable to append string."); } HDfree(ref_name); ref_name = NULL; } } if (!h5str_append(out_str, "\"")) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + H5_ASSERTION_ERROR(ENVONLY, "Unable to append string."); + + ret_value = SUCCEED; done: if (ref_name) HDfree(ref_name); + + return ret_value; +} /* h5str_sprint_reference */ + +int +h5str_region_dataset(JNIEnv *env, h5str_t *out_str, H5R_ref_t *ref_vp, int expand_data) +{ + hid_t new_obj_id = H5I_INVALID_HID; + hid_t new_obj_sid = H5I_INVALID_HID; + H5S_sel_type region_type; + + int ret_value = FAIL; + + if ((new_obj_id = H5Ropen_object(ref_vp, H5P_DEFAULT, H5P_DEFAULT)) < 0) { + ret_value = SUCCEED; /* An uncreated region is a valid state */ + goto done; + } + + if ((new_obj_sid = H5Ropen_region(ref_vp, H5P_DEFAULT, H5P_DEFAULT)) < 0) + H5_LIBRARY_ERROR(ENVONLY); + + if ((region_type = H5Sget_select_type(new_obj_sid)) > H5S_SEL_ERROR) { + if (H5S_SEL_POINTS == region_type) { + if (h5str_dump_region_points(ENVONLY, out_str, new_obj_sid, new_obj_id, expand_data) < 0) + CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + } + else if (H5S_SEL_HYPERSLABS == region_type) { + if (h5str_dump_region_blocks(ENVONLY, out_str, new_obj_sid, new_obj_id, expand_data) < 0) + CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + } + } + + ret_value = SUCCEED; +done: + if (new_obj_sid >= 0) + if (H5Sclose(new_obj_sid) < 0) + H5_LIBRARY_ERROR(ENVONLY); + if (new_obj_id >= 0) + if (H5Dclose(new_obj_id) < 0) + H5_LIBRARY_ERROR(ENVONLY); + + return ret_value; } /* @@ -710,8 +754,7 @@ done: * FAILURE: 0 */ size_t -h5str_sprintf(JNIEnv *env, h5str_t *out_str, hid_t container, hid_t tid, void *in_buf, size_t in_buf_len, - int expand_data) +h5str_sprintf(JNIEnv *env, h5str_t *out_str, hid_t container, hid_t tid, void *in_buf, int expand_data) { unsigned char *ucptr = (unsigned char *)in_buf; static char fmt_llong[8], fmt_ullong[8]; @@ -719,7 +762,6 @@ h5str_sprintf(JNIEnv *env, h5str_t *out_str, hid_t container, hid_t tid, void *i size_t typeSize = 0; H5T_sign_t nsign = H5T_SGN_ERROR; hid_t mtid = H5I_INVALID_HID; - hid_t obj = H5I_INVALID_HID; char * cptr = (char *)in_buf; char * this_str = NULL; int n; @@ -734,8 +776,6 @@ h5str_sprintf(JNIEnv *env, h5str_t *out_str, hid_t container, hid_t tid, void *i H5_LIBRARY_ERROR(ENVONLY); if (!(typeSize = H5Tget_size(tid))) H5_LIBRARY_ERROR(ENVONLY); - if (!(nsign = H5Tget_sign(tid))) - H5_LIBRARY_ERROR(ENVONLY); /* Build default formats for long long types */ if (!fmt_llong[0]) { @@ -744,7 +784,6 @@ h5str_sprintf(JNIEnv *env, h5str_t *out_str, hid_t container, hid_t tid, void *i if (HDsnprintf(fmt_ullong, sizeof(fmt_ullong), "%%%su", H5_PRINTF_LL_WIDTH) < 0) H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsnprintf failure"); } /* end if */ - switch (tclass) { case H5T_FLOAT: { switch (typeSize) { @@ -805,6 +844,8 @@ h5str_sprintf(JNIEnv *env, h5str_t *out_str, hid_t container, hid_t tid, void *i htri_t is_variable; char * tmp_str; + typeSize = 0; + if ((is_variable = H5Tis_variable_str(tid)) < 0) H5_LIBRARY_ERROR(ENVONLY); @@ -1003,7 +1044,7 @@ h5str_sprintf(JNIEnv *env, h5str_t *out_str, hid_t container, hid_t tid, void *i H5_LIBRARY_ERROR(ENVONLY); if (!h5str_append(out_str, H5_COMPOUND_BEGIN_INDICATOR)) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + H5_ASSERTION_ERROR(ENVONLY, "Unable to append string."); for (i = 0; i < (unsigned)n; i++) { offset = H5Tget_member_offset(tid, i); @@ -1011,12 +1052,12 @@ h5str_sprintf(JNIEnv *env, h5str_t *out_str, hid_t container, hid_t tid, void *i if ((mtid = H5Tget_member_type(tid, i)) < 0) H5_LIBRARY_ERROR(ENVONLY); - if (!h5str_sprintf(ENVONLY, out_str, container, mtid, &cptr[offset], in_buf_len, expand_data)) + if (!h5str_sprintf(ENVONLY, out_str, container, mtid, &cptr[offset], expand_data)) CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); if ((i + 1) < (unsigned)n) if (!h5str_append(out_str, ", ")) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + H5_ASSERTION_ERROR(ENVONLY, "Unable to append string."); if (H5Tclose(mtid) < 0) H5_LIBRARY_ERROR(ENVONLY); @@ -1024,7 +1065,7 @@ h5str_sprintf(JNIEnv *env, h5str_t *out_str, hid_t container, hid_t tid, void *i } if (!h5str_append(out_str, H5_COMPOUND_END_INDICATOR)) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + H5_ASSERTION_ERROR(ENVONLY, "Unable to append string."); break; } @@ -1034,7 +1075,7 @@ h5str_sprintf(JNIEnv *env, h5str_t *out_str, hid_t container, hid_t tid, void *i if (H5Tenum_nameof(tid, cptr, enum_name, sizeof enum_name) >= 0) { if (!h5str_append(out_str, enum_name)) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + H5_ASSERTION_ERROR(ENVONLY, "Unable to append string."); } else { size_t i; @@ -1057,130 +1098,120 @@ h5str_sprintf(JNIEnv *env, h5str_t *out_str, hid_t container, hid_t tid, void *i } case H5T_REFERENCE: { - if (h5str_is_zero(cptr, typeSize)) { - if (!h5str_append(out_str, "NULL")) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); - break; - } - if (H5Tequal(tid, H5T_STD_REF)) { - H5O_type_t obj_type = -1; /* Object type */ - H5R_type_t ref_type; /* Reference type */ - const H5R_ref_t *ref_vp = (H5R_ref_t *)cptr; + hid_t new_obj_id = H5I_INVALID_HID; + H5O_type_t obj_type = -1; /* Object type */ + H5R_type_t ref_type; /* Reference type */ + + H5R_ref_t *ref_vp = (H5R_ref_t *)cptr; ref_type = H5Rget_type(ref_vp); - H5Rget_obj_type3(ref_vp, H5P_DEFAULT, &obj_type); switch (ref_type) { - case H5R_OBJECT1: { - /* Object references -- show the type and OID of the referenced object. */ - H5O_info2_t oi; - - if ((obj = H5Ropen_object(ref_vp, H5P_DEFAULT, H5P_DEFAULT)) >= 0) { - H5Oget_info3(obj, &oi, H5O_INFO_BASIC); - if (H5Oclose(obj) < 0) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + case H5R_OBJECT1: + if (H5Rget_obj_type3(ref_vp, H5P_DEFAULT, &obj_type) >= 0) { + switch (obj_type) { + case H5O_TYPE_DATASET: + if (h5str_region_dataset(ENVONLY, out_str, ref_vp, expand_data) < 0) + CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + break; + + case H5O_TYPE_GROUP: + case H5O_TYPE_NAMED_DATATYPE: + case H5O_TYPE_MAP: + case H5O_TYPE_UNKNOWN: + case H5O_TYPE_NTYPES: + default: { + /* Object references -- show the type and OID of the referenced object. */ + H5O_info2_t oi; + char * obj_tok_str = NULL; + if ((new_obj_id = H5Ropen_object(ref_vp, H5P_DEFAULT, H5P_DEFAULT)) >= + 0) { + H5Oget_info3(new_obj_id, &oi, H5O_INFO_BASIC); + H5Otoken_to_str(new_obj_id, &oi.token, &obj_tok_str); + if (H5Dclose(new_obj_id) < 0) + H5_LIBRARY_ERROR(ENVONLY); + } + else + H5_LIBRARY_ERROR(ENVONLY); + + if (NULL == (this_str = (char *)HDmalloc(14))) + H5_OUT_OF_MEMORY_ERROR( + ENVONLY, "h5str_sprintf: failed to allocate string buffer"); + if (HDsprintf(this_str, "%u-", (unsigned)oi.type) < 0) + H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsprintf failure"); + if (!h5str_append(out_str, this_str)) + H5_ASSERTION_ERROR(ENVONLY, "Unable to append string."); + HDfree(this_str); + this_str = NULL; + + /* Print OID */ + { + char *token_str; + + H5Otoken_to_str(tid, &oi.token, &token_str); + + if (NULL == (this_str = (char *)HDmalloc(64 + strlen(token_str) + 1))) + H5_OUT_OF_MEMORY_ERROR( + ENVONLY, "h5str_sprintf: failed to allocate string buffer"); + if (HDsprintf(this_str, "%lu:%s", oi.fileno, token_str) < 0) + H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsprintf failure"); + + H5free_memory(token_str); + } + } break; + } /* end switch */ } else - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); - - if (NULL == (this_str = (char *)HDmalloc(14))) - H5_OUT_OF_MEMORY_ERROR(ENVONLY, - "h5str_sprintf: failed to allocate string buffer"); - if (HDsprintf(this_str, "%u-", (unsigned)oi.type) < 0) - H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsprintf failure"); - if (!h5str_append(out_str, this_str)) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); - HDfree(this_str); - this_str = NULL; - - switch (obj_type) { - case H5O_TYPE_GROUP: - if (!h5str_append(out_str, H5_TOOLS_GROUP)) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); - break; - - case H5O_TYPE_DATASET: - if (!h5str_append(out_str, H5_TOOLS_DATASET)) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); - break; - - case H5O_TYPE_NAMED_DATATYPE: - if (!h5str_append(out_str, H5_TOOLS_DATATYPE)) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); - break; - - case H5O_TYPE_MAP: - case H5O_TYPE_UNKNOWN: - case H5O_TYPE_NTYPES: - default: - break; - } /* end switch */ - H5Oclose(obj); - h5str_sprint_reference(ENVONLY, out_str, container, ref_vp); - - /* Print OID */ - { - char *token_str; - - H5Otoken_to_str(tid, &oi.token, &token_str); - - if (NULL == (this_str = (char *)HDmalloc(64 + strlen(token_str) + 1))) - H5_OUT_OF_MEMORY_ERROR(ENVONLY, - "h5str_sprintf: failed to allocate string buffer"); - if (HDsprintf(this_str, "%lu:%s", oi.fileno, token_str) < 0) - H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsprintf failure"); - - H5free_memory(token_str); - } - - } - - break; + H5_LIBRARY_ERROR(ENVONLY); + break; case H5R_DATASET_REGION1: - if (!h5str_append(out_str, H5_TOOLS_DATASET)) + if (h5str_region_dataset(ENVONLY, out_str, ref_vp, expand_data) < 0) CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); - h5str_sprint_reference(ENVONLY, out_str, container, (void *)cptr); break; case H5R_OBJECT2: - switch (obj_type) { - case H5O_TYPE_GROUP: - if (!h5str_append(out_str, H5_TOOLS_GROUP)) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); - break; - - case H5O_TYPE_DATASET: - if (!h5str_append(out_str, H5_TOOLS_DATASET)) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); - break; - - case H5O_TYPE_NAMED_DATATYPE: - if (!h5str_append(out_str, H5_TOOLS_DATATYPE)) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); - break; - - case H5O_TYPE_MAP: - case H5O_TYPE_UNKNOWN: - case H5O_TYPE_NTYPES: - default: - break; - } /* end switch */ - h5str_sprint_reference(ENVONLY, out_str, container, (void *)cptr); + if (H5Rget_obj_type3(ref_vp, H5P_DEFAULT, &obj_type) >= 0) { + switch (obj_type) { + case H5O_TYPE_GROUP: + break; + + case H5O_TYPE_DATASET: + if (h5str_region_dataset(ENVONLY, out_str, ref_vp, expand_data) < 0) + CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + break; + + case H5O_TYPE_NAMED_DATATYPE: + break; + + case H5O_TYPE_MAP: + case H5O_TYPE_UNKNOWN: + case H5O_TYPE_NTYPES: + default: + break; + } /* end switch */ + } + else + H5_ASSERTION_ERROR(ENVONLY, "h5str_sprintf: H5R_OBJECT2 failed"); break; case H5R_DATASET_REGION2: - if (!h5str_append(out_str, H5_TOOLS_DATASET)) + if (h5str_region_dataset(ENVONLY, out_str, ref_vp, expand_data) < 0) CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); - h5str_sprint_reference(ENVONLY, out_str, container, (void *)cptr); break; case H5R_ATTR: - if (!h5str_append(out_str, H5_TOOLS_ATTRIBUTE)) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); - h5str_sprint_reference(ENVONLY, out_str, container, (void *)cptr); + if ((new_obj_id = H5Ropen_attr(ref_vp, H5P_DEFAULT, H5P_DEFAULT)) >= 0) { + if (h5str_dump_region_attribute(ENVONLY, out_str, new_obj_id) < 0) + CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + if (H5Aclose(new_obj_id) < 0) + H5_LIBRARY_ERROR(ENVONLY); + } break; case H5R_BADTYPE: case H5R_MAXTYPE: default: break; } /* end switch */ + + if (H5Rdestroy(ref_vp) < 0) + H5_LIBRARY_ERROR(ENVONLY); } else if (H5Tequal(tid, H5T_STD_REF_DSETREG)) { /* (H5R_DSET_REG_REF_BUF_SIZE == typeSize) */ @@ -1200,7 +1231,7 @@ h5str_sprintf(JNIEnv *env, h5str_t *out_str, hid_t container, hid_t tid, void *i int rank = 0; if (!h5str_append(out_str, H5_ARRAY_BEGIN_INDICATOR)) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + H5_ASSERTION_ERROR(ENVONLY, "Unable to append string."); if ((mtid = H5Tget_super(tid)) < 0) H5_LIBRARY_ERROR(ENVONLY); @@ -1218,17 +1249,16 @@ h5str_sprintf(JNIEnv *env, h5str_t *out_str, hid_t container, hid_t tid, void *i total_elmts *= dims[i]; for (i = 0; i < total_elmts; i++) { - if (!h5str_sprintf(ENVONLY, out_str, container, mtid, &(cptr[i * baseSize]), in_buf_len, - expand_data)) + if (!h5str_sprintf(ENVONLY, out_str, container, mtid, &(cptr[i * baseSize]), expand_data)) CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); if ((i + 1) < total_elmts) if (!h5str_append(out_str, ", ")) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + H5_ASSERTION_ERROR(ENVONLY, "Unable to append string."); } if (!h5str_append(out_str, H5_ARRAY_END_INDICATOR)) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + H5_ASSERTION_ERROR(ENVONLY, "Unable to append string."); if (H5Tclose(mtid) < 0) H5_LIBRARY_ERROR(ENVONLY); @@ -1249,20 +1279,20 @@ h5str_sprintf(JNIEnv *env, h5str_t *out_str, hid_t container, hid_t tid, void *i H5_LIBRARY_ERROR(ENVONLY); if (!h5str_append(out_str, H5_VLEN_BEGIN_INDICATOR)) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + H5_ASSERTION_ERROR(ENVONLY, "Unable to append string."); for (i = 0; i < (unsigned)vl_buf->len; i++) { if (!h5str_sprintf(ENVONLY, out_str, container, mtid, &(((char *)vl_buf->p)[i * baseSize]), - vl_buf->len, expand_data)) + expand_data)) CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); if ((i + 1) < (unsigned)vl_buf->len) if (!h5str_append(out_str, ", ")) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + H5_ASSERTION_ERROR(ENVONLY, "Unable to append string."); } if (!h5str_append(out_str, H5_VLEN_END_INDICATOR)) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + H5_ASSERTION_ERROR(ENVONLY, "Unable to append string."); if (H5Tclose(mtid) < 0) H5_LIBRARY_ERROR(ENVONLY); @@ -1304,7 +1334,7 @@ h5str_sprintf(JNIEnv *env, h5str_t *out_str, hid_t container, hid_t tid, void *i if (this_str) { if (!h5str_append(out_str, this_str)) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + H5_ASSERTION_ERROR(ENVONLY, "Unable to append string."); HDfree(this_str); this_str = NULL; @@ -1405,12 +1435,12 @@ h5str_print_region_data_blocks(JNIEnv *env, hid_t region_id, h5str_t *str, int n for (numindex = 0; numindex < numelem; numindex++) { if (!h5str_sprintf(ENVONLY, str, region_id, type_id, ((char *)region_buf + numindex * type_size), - 0, 1)) + 1)) CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); if (numindex + 1 < numelem) if (!h5str_append(str, ", ")) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + H5_ASSERTION_ERROR(ENVONLY, "Unable to append string."); } /* end for (jndx = 0; jndx < numelem; jndx++, region_elmtno++, ctx.cur_elmt++) */ } /* end for (blkndx = 0; blkndx < nblocks; blkndx++) */ @@ -1434,7 +1464,7 @@ done: } /* end h5str_print_region_data_blocks */ int -h5str_dump_region_blocks_data(JNIEnv *env, h5str_t *str, hid_t region, hid_t region_id) +h5str_dump_region_blocks(JNIEnv *env, h5str_t *str, hid_t region_space, hid_t region_id, int expand_data) { hssize_t nblocks; hsize_t alloc_size; @@ -1443,29 +1473,31 @@ h5str_dump_region_blocks_data(JNIEnv *env, h5str_t *str, hid_t region, hid_t reg hid_t type_id = H5I_INVALID_HID; int ndims = -1; int ret_value = FAIL; + int i; + char tmp_str[256]; /* * This function fails if the region does not have blocks. */ - H5E_BEGIN_TRY { nblocks = H5Sget_select_hyper_nblocks(region); } + H5E_BEGIN_TRY { nblocks = H5Sget_select_hyper_nblocks(region_space); } H5E_END_TRY; - if (nblocks < 0) - H5_LIBRARY_ERROR(ENVONLY); - - if ((ndims = H5Sget_simple_extent_ndims(region)) < 0) + if (nblocks <= 0) { + ret_value = SUCCEED; + goto done; + } + if ((ndims = H5Sget_simple_extent_ndims(region_space)) < 0) H5_LIBRARY_ERROR(ENVONLY); /* Print block information */ alloc_size = (hsize_t)nblocks * (hsize_t)ndims * 2 * (hsize_t)sizeof(ptdata[0]); - if (alloc_size == (hsize_t)((size_t)alloc_size)) { - if (NULL == (ptdata = (hsize_t *)HDmalloc((size_t)alloc_size))) - H5_OUT_OF_MEMORY_ERROR(ENVONLY, - "h5str_dump_region_blocks_data: failed to allocate region block buffer"); + if (NULL == (ptdata = (hsize_t *)HDmalloc((size_t)alloc_size))) + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_dump_region_blocks: failed to allocate region block buffer"); - if (H5Sget_select_hyper_blocklist(region, (hsize_t)0, (hsize_t)nblocks, ptdata) < 0) - H5_LIBRARY_ERROR(ENVONLY); + if (H5Sget_select_hyper_blocklist(region_space, (hsize_t)0, (hsize_t)nblocks, ptdata) < 0) + H5_LIBRARY_ERROR(ENVONLY); + if (expand_data) { if ((dtype = H5Dget_type(region_id)) < 0) H5_LIBRARY_ERROR(ENVONLY); @@ -1474,66 +1506,19 @@ h5str_dump_region_blocks_data(JNIEnv *env, h5str_t *str, hid_t region, hid_t reg if (h5str_print_region_data_blocks(ENVONLY, region_id, str, ndims, type_id, nblocks, ptdata) < 0) CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); - } /* if (alloc_size == (hsize_t)((size_t)alloc_size)) */ - - ret_value = SUCCEED; - -done: - if (type_id >= 0) - H5Tclose(type_id); - if (dtype >= 0) - H5Tclose(dtype); - if (ptdata) - HDfree(ptdata); - - 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) -{ - hssize_t nblocks; - hsize_t alloc_size; - hsize_t *ptdata = NULL; - char tmp_str[256]; - int ndims = -1; - int ret_value = FAIL; - - UNUSED(region_id); - - /* - * This function fails if the region does not have blocks. - */ - H5E_BEGIN_TRY { nblocks = H5Sget_select_hyper_nblocks(region); } - H5E_END_TRY; - - if (nblocks < 0) - H5_LIBRARY_ERROR(ENVONLY); - - if ((ndims = H5Sget_simple_extent_ndims(region)) < 0) - H5_LIBRARY_ERROR(ENVONLY); - - /* Print block information */ - alloc_size = (hsize_t)nblocks * (hsize_t)ndims * 2 * (hsize_t)sizeof(ptdata[0]); - if (alloc_size == (hsize_t)((size_t)alloc_size)) { - int i; - - if (NULL == (ptdata = (hsize_t *)HDmalloc((size_t)alloc_size))) - H5_OUT_OF_MEMORY_ERROR(ENVONLY, - "h5str_dump_region_blocks: failed to allocate region block buffer"); - - if (H5Sget_select_hyper_blocklist(region, (hsize_t)0, (hsize_t)nblocks, ptdata) < 0) - H5_LIBRARY_ERROR(ENVONLY); + } + else { + if (!h5str_append(str, " REGION_TYPE BLOCK")) + H5_ASSERTION_ERROR(ENVONLY, "Unable to append string."); if (!h5str_append(str, " {")) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + H5_ASSERTION_ERROR(ENVONLY, "Unable to append string."); for (i = 0; i < nblocks; i++) { int j; if (!h5str_append(str, " ")) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + H5_ASSERTION_ERROR(ENVONLY, "Unable to append string."); /* Start coordinates and opposite corner */ for (j = 0; j < ndims; j++) { @@ -1543,7 +1528,7 @@ h5str_dump_region_blocks(JNIEnv *env, h5str_t *str, hid_t region, hid_t region_i H5_JNI_FATAL_ERROR(ENVONLY, "h5str_dump_region_blocks: HDsprintf failure"); if (!h5str_append(str, tmp_str)) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + H5_ASSERTION_ERROR(ENVONLY, "Unable to append string."); } for (j = 0; j < ndims; j++) { @@ -1554,28 +1539,30 @@ h5str_dump_region_blocks(JNIEnv *env, h5str_t *str, hid_t region, hid_t region_i H5_JNI_FATAL_ERROR(ENVONLY, "h5str_dump_region_blocks: HDsprintf failure"); if (!h5str_append(str, tmp_str)) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + H5_ASSERTION_ERROR(ENVONLY, "Unable to append string."); } if (!h5str_append(str, ") ")) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + H5_ASSERTION_ERROR(ENVONLY, "Unable to append string."); tmp_str[0] = '\0'; } if (!h5str_append(str, " }")) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); - } /* if (alloc_size == (hsize_t)((size_t)alloc_size)) */ - + H5_ASSERTION_ERROR(ENVONLY, "Unable to append string."); + } ret_value = SUCCEED; done: + if (type_id >= 0) + H5Tclose(type_id); + if (dtype >= 0) + H5Tclose(dtype); if (ptdata) HDfree(ptdata); return ret_value; } /* end h5str_dump_region_blocks */ -#endif /*------------------------------------------------------------------------- * Purpose: Print the data values from a dataset referenced by region points. @@ -1628,12 +1615,12 @@ h5str_print_region_data_points(JNIEnv *env, hid_t region_space, hid_t region_id, if (H5Sget_simple_extent_dims(mem_space, total_size, NULL) < 0) H5_LIBRARY_ERROR(ENVONLY); - if (!h5str_sprintf(ENVONLY, str, region_id, type_id, ((char *)region_buf + jndx * type_size), 0, 1)) + if (!h5str_sprintf(ENVONLY, str, region_id, type_id, ((char *)region_buf + jndx * type_size), 1)) CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); if (jndx + 1 < (size_t)npoints) if (!h5str_append(str, ", ")) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + H5_ASSERTION_ERROR(ENVONLY, "Unable to append string."); } /* end for (jndx = 0; jndx < npoints; jndx++, elmtno++) */ ret_value = SUCCEED; @@ -1650,140 +1637,93 @@ done: } /* end h5str_print_region_data_points */ int -h5str_dump_region_points_data(JNIEnv *env, h5str_t *str, hid_t region, hid_t region_id) +h5str_dump_region_points(JNIEnv *env, h5str_t *str, hid_t region_space, hid_t region_id, int expand_data) { - hssize_t npoints; hsize_t alloc_size; + hssize_t npoints = -1; hsize_t *ptdata = NULL; hid_t dtype = H5I_INVALID_HID; hid_t type_id = H5I_INVALID_HID; int ndims = -1; int ret_value = FAIL; + int i; + char tmp_str[256]; /* * This function fails if the region does not have points. */ - H5E_BEGIN_TRY { npoints = H5Sget_select_elem_npoints(region); } + H5E_BEGIN_TRY { npoints = H5Sget_select_elem_npoints(region_space); } H5E_END_TRY; - if (npoints < 0) - H5_LIBRARY_ERROR(ENVONLY); - - if ((ndims = H5Sget_simple_extent_ndims(region)) < 0) + if (npoints <= 0) { + ret_value = SUCCEED; + goto done; + } + if ((ndims = H5Sget_simple_extent_ndims(region_space)) < 0) H5_LIBRARY_ERROR(ENVONLY); /* Print point information */ - if (npoints > 0) { - alloc_size = (hsize_t)npoints * (hsize_t)ndims * (hsize_t)sizeof(ptdata[0]); - if (alloc_size == (hsize_t)((size_t)alloc_size)) { - if (NULL == (ptdata = (hsize_t *)HDmalloc((size_t)alloc_size))) - H5_OUT_OF_MEMORY_ERROR( - ENVONLY, "h5str_dump_region_points_data: failed to allocate region point data buffer"); - - if (H5Sget_select_elem_pointlist(region, (hsize_t)0, (hsize_t)npoints, ptdata) < 0) - H5_LIBRARY_ERROR(ENVONLY); - - if ((dtype = H5Dget_type(region_id)) < 0) - H5_LIBRARY_ERROR(ENVONLY); - - if ((type_id = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) < 0) - H5_LIBRARY_ERROR(ENVONLY); - - if (h5str_print_region_data_points(ENVONLY, region, region_id, str, ndims, type_id, npoints, - ptdata) < 0) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); - } - } - - ret_value = SUCCEED; - -done: - if (type_id >= 0) - H5Tclose(type_id); - if (dtype >= 0) - H5Tclose(dtype); - if (ptdata) - HDfree(ptdata); - - 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) -{ - hssize_t npoints; - hsize_t alloc_size; - hsize_t *ptdata = NULL; - char tmp_str[256]; - int ndims = -1; - int ret_value = FAIL; - - UNUSED(region_id); - - /* - * This function fails if the region does not have points. - */ - H5E_BEGIN_TRY { npoints = H5Sget_select_elem_npoints(region); } - H5E_END_TRY; - - if (npoints < 0) - H5_LIBRARY_ERROR(ENVONLY); + alloc_size = (hsize_t)npoints * (hsize_t)ndims * (hsize_t)sizeof(ptdata[0]); + if (NULL == (ptdata = (hsize_t *)HDmalloc((size_t)alloc_size))) + H5_OUT_OF_MEMORY_ERROR(ENVONLY, + "h5str_dump_region_points: failed to allocate region point data buffer"); - if ((ndims = H5Sget_simple_extent_ndims(region)) < 0) + if (H5Sget_select_elem_pointlist(region_space, (hsize_t)0, (hsize_t)npoints, ptdata) < 0) H5_LIBRARY_ERROR(ENVONLY); - /* Print point information */ - if (npoints > 0) { - int i; - - alloc_size = (hsize_t)npoints * (hsize_t)ndims * (hsize_t)sizeof(ptdata[0]); - if (alloc_size == (hsize_t)((size_t)alloc_size)) { - if (NULL == (ptdata = (hsize_t *)HDmalloc((size_t)alloc_size))) - H5_OUT_OF_MEMORY_ERROR(ENVONLY, - "h5str_dump_region_points: failed to allocate region point buffer"); + if (expand_data) { + if ((dtype = H5Dget_type(region_id)) < 0) + H5_LIBRARY_ERROR(ENVONLY); - if (H5Sget_select_elem_pointlist(region, (hsize_t)0, (hsize_t)npoints, ptdata) < 0) - H5_LIBRARY_ERROR(ENVONLY); + if ((type_id = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) < 0) + H5_LIBRARY_ERROR(ENVONLY); - if (!h5str_append(str, " {")) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + if (h5str_print_region_data_points(ENVONLY, region_space, region_id, str, ndims, type_id, npoints, + ptdata) < 0) + CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + } + else { + if (!h5str_append(str, " REGION_TYPE POINT")) + H5_ASSERTION_ERROR(ENVONLY, "Unable to append string."); - for (i = 0; i < npoints; i++) { - int j; + if (!h5str_append(str, " {")) + H5_ASSERTION_ERROR(ENVONLY, "Unable to append string."); - if (!h5str_append(str, " ")) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + for (i = 0; i < npoints; i++) { + int j; - for (j = 0; j < ndims; j++) { - tmp_str[0] = '\0'; + if (!h5str_append(str, " ")) + H5_ASSERTION_ERROR(ENVONLY, "Unable to append string."); - if (HDsprintf(tmp_str, "%s%lu", j ? "," : "(", (unsigned long)(ptdata[i * ndims + j])) < - 0) - H5_JNI_FATAL_ERROR(ENVONLY, "h5str_dump_region_points: HDsprintf failure"); + for (j = 0; j < ndims; j++) { + tmp_str[0] = '\0'; - if (!h5str_append(str, tmp_str)) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); - } /* end for (j = 0; j < ndims; j++) */ + if (HDsprintf(tmp_str, "%s%lu", j ? "," : "(", (unsigned long)(ptdata[i * ndims + j])) < 0) + H5_JNI_FATAL_ERROR(ENVONLY, "h5str_dump_region_points: HDsprintf failure"); - if (!h5str_append(str, ") ")) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); - } /* end for (i = 0; i < npoints; i++) */ + if (!h5str_append(str, tmp_str)) + H5_ASSERTION_ERROR(ENVONLY, "Unable to append string."); + } /* end for (j = 0; j < ndims; j++) */ - if (!h5str_append(str, " }")) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); - } /* end if (alloc_size == (hsize_t)((size_t) alloc_size)) */ - } /* end if (npoints > 0) */ + if (!h5str_append(str, ") ")) + H5_ASSERTION_ERROR(ENVONLY, "Unable to append string."); + } /* end for (i = 0; i < npoints; i++) */ + if (!h5str_append(str, " }")) + H5_ASSERTION_ERROR(ENVONLY, "Unable to append string."); + } ret_value = SUCCEED; done: + if (type_id >= 0) + H5Tclose(type_id); + if (dtype >= 0) + H5Tclose(dtype); if (ptdata) HDfree(ptdata); return ret_value; } /* end h5str_dump_region_points */ -#endif static int h5str_is_zero(const void *_mem, size_t size) @@ -2308,30 +2248,22 @@ h5str_render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hs /* Region data */ for (block_index = 0; block_index < block_nelmts; block_index++) { mem = ((unsigned char *)_mem) + block_index * size; - if ((region_id = H5Ropen_object((const H5R_ref_t *)mem, H5P_DEFAULT, H5P_DEFAULT)) < 0) + if ((region_id = H5Ropen_object((H5R_ref_t *)mem, H5P_DEFAULT, H5P_DEFAULT)) < 0) continue; - else { - if ((region_space = - H5Ropen_region((const H5R_ref_t *)mem, H5P_DEFAULT, H5P_DEFAULT)) >= 0) { - if (!h5str_is_zero(mem, H5Tget_size(H5T_STD_REF))) { - region_type = H5Sget_select_type(region_space); - if (region_type == H5S_SEL_POINTS) - ret_value = render_bin_output_region_points(stream, region_space, - region_id, container); - else - ret_value = render_bin_output_region_blocks(stream, region_space, - region_id, container); - } - H5Sclose(region_space); - } /* end if (region_space >= 0) */ - H5Dclose(region_id); - } - - if ((region_type = H5Sget_select_type(region_space)) < 0) { + if ((region_space = H5Ropen_region((H5R_ref_t *)mem, H5P_DEFAULT, H5P_DEFAULT)) >= 0) { + if (!h5str_is_zero(mem, H5Tget_size(H5T_STD_REF))) { + region_type = H5Sget_select_type(region_space); + if (region_type == H5S_SEL_POINTS) + ret_value = render_bin_output_region_points(stream, region_space, region_id, + container); + else if (region_type == H5S_SEL_HYPERSLABS) + ret_value = render_bin_output_region_blocks(stream, region_space, region_id, + container); + } H5Sclose(region_space); - H5Dclose(region_id); - continue; - } + } /* end if (region_space >= 0) */ + H5Dclose(region_id); + if (ret_value < 0) break; } @@ -2711,6 +2643,109 @@ done: return ret_value; } /* end render_bin_output_region_points */ +/*------------------------------------------------------------------------- + * Purpose: Print some values from an attribute referenced by object reference. + * + * Parameters Description: + * FILE *buffer is the string into which to render + *------------------------------------------------------------------------- + */ +static int +h5str_dump_region_attribute(JNIEnv *env, h5str_t *str, hid_t region_id) +{ + int ret_value = SUCCEED; + hid_t atype = H5I_INVALID_HID; + hid_t type_id = H5I_INVALID_HID; + hid_t region_space = H5I_INVALID_HID; + hsize_t total_size[H5S_MAX_RANK]; /* total size of dataset*/ + size_t i; /* counter */ + size_t size; /* datum size */ + int sndims; /* rank of dataspace */ + hsize_t p_nelmts; /* total selected elmts */ + hsize_t alloc_size; + + unsigned char *buf = NULL; /* buffer for raw data */ + + /* VL data special information */ + unsigned int vl_data = 0; /* contains VL datatypes */ + + if ((region_space = H5Aget_space(region_id)) < 0) { + ret_value = FAIL; + goto done; + } + + if ((sndims = H5Sget_simple_extent_ndims(region_space)) < 0) { + ret_value = FAIL; + goto done; + } + + /* Assume entire data space to be read */ + H5Sget_simple_extent_dims(region_space, total_size, NULL); + p_nelmts = 1; + + for (i = 0; i < sndims; i++) + p_nelmts *= total_size[i]; + + if ((atype = H5Aget_type(region_id)) < 0) { + ret_value = FAIL; + goto done; + } + if ((type_id = H5Tget_native_type(atype, H5T_DIR_DEFAULT)) < 0) { + ret_value = FAIL; + goto done; + } + + /* Check if we have VL data in the dataset's datatype */ + if (h5str_detect_vlen(type_id) == TRUE) + vl_data = TRUE; + + if (!(size = H5Tget_size(type_id))) { + ret_value = FAIL; + goto done; + } + + alloc_size = p_nelmts * size; + HDassert(alloc_size == (hsize_t)((size_t)alloc_size)); /*check for overflow*/ + if (NULL != (buf = (unsigned char *)HDmalloc((size_t)alloc_size))) { + /* Read the data */ + if (H5Aread(region_id, type_id, buf) >= 0) { + + for (i = 0; i < p_nelmts; i++) { + size_t bytes_in = 0; /* # of bytes to write */ + void * memref = buf + i * size; + + if (!(bytes_in = h5str_sprintf(ENVONLY, str, region_id, type_id, memref, 1))) + CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + + if ((i < p_nelmts - 1) && (bytes_in > 0)) { + if (!h5str_append(str, ", ")) + H5_ASSERTION_ERROR(ENVONLY, "Unable to append string."); + } + } + + /* Reclaim any VL memory, if necessary */ + if (vl_data) { + if (H5Treclaim(type_id, region_space, H5P_DEFAULT, buf) < 0) + H5_LIBRARY_ERROR(ENVONLY); + } + } + else + H5_LIBRARY_ERROR(ENVONLY); + } + +done: + if (buf) + HDfree(buf); + if (region_space >= 0) + H5Sclose(region_space); + if (type_id >= 0) + H5Tclose(type_id); + if (atype >= 0) + H5Tclose(type_id); + + return ret_value; +} + int h5str_dump_simple_dset(JNIEnv *env, FILE *stream, hid_t dset, int binary_order) { @@ -2865,7 +2900,7 @@ h5str_dump_simple_dset(JNIEnv *env, FILE *stream, hid_t dset, int binary_order) H5_LIBRARY_ERROR(ENVONLY); if (binary_order == 99) { - if (h5tools_dump_simple_data(ENVONLY, stream, dset, p_type, sm_buf, hs_nelmts) < 0) + if (h5str_dump_simple_data(ENVONLY, stream, dset, p_type, sm_buf, hs_nelmts) < 0) CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); } else { @@ -2936,7 +2971,7 @@ H5Tdetect_variable_str(hid_t tid) } /* end H5Tdetect_variable_str */ static int -h5tools_dump_simple_data(JNIEnv *env, FILE *stream, hid_t container, hid_t type, void *_mem, hsize_t nelmts) +h5str_dump_simple_data(JNIEnv *env, FILE *stream, hid_t container, hid_t type, void *_mem, hsize_t nelmts) { unsigned char *mem = (unsigned char *)_mem; h5str_t buffer; /* string into which to render */ @@ -2956,38 +2991,38 @@ h5tools_dump_simple_data(JNIEnv *env, FILE *stream, hid_t container, hid_t type, h5str_new(&buffer, 32 * size); if (!buffer.s) - H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5tools_dump_simple_data: failed to allocate buffer"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_dump_simple_data: failed to allocate buffer"); - if (!(bytes_in = h5str_sprintf(ENVONLY, &buffer, container, type, memref, 0, 1))) + if (!(bytes_in = h5str_sprintf(ENVONLY, &buffer, container, type, memref, 1))) CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); - if (i > 0) { + if ((i > 0) && (bytes_in > 0)) { if (HDfprintf(stream, ", ") < 0) - H5_JNI_FATAL_ERROR(ENVONLY, "h5tools_dump_simple_data: HDfprintf failure"); + H5_JNI_FATAL_ERROR(ENVONLY, "h5str_dump_simple_data: HDfprintf failure"); if (line_count >= H5TOOLS_TEXT_BLOCK) { line_count = 0; if (HDfprintf(stream, "\n") < 0) - H5_JNI_FATAL_ERROR(ENVONLY, "h5tools_dump_simple_data: HDfprintf failure"); + H5_JNI_FATAL_ERROR(ENVONLY, "h5str_dump_simple_data: HDfprintf failure"); } } if (HDfprintf(stream, "%s", buffer.s) < 0) - H5_JNI_FATAL_ERROR(ENVONLY, "h5tools_dump_simple_data: HDfprintf failure"); + H5_JNI_FATAL_ERROR(ENVONLY, "h5str_dump_simple_data: HDfprintf failure"); h5str_free(&buffer); } /* end for (i = 0; i < nelmts... */ if (HDfprintf(stream, "\n") < 0) - H5_JNI_FATAL_ERROR(ENVONLY, "h5tools_dump_simple_data: HDfprintf failure"); + H5_JNI_FATAL_ERROR(ENVONLY, "h5str_dump_simple_data: HDfprintf failure"); done: if (buffer.s) h5str_free(&buffer); return ret_value; -} /* end h5tools_dump_simple_data */ +} /* end h5str_dump_simple_data */ /* * Utility Java APIs @@ -3041,7 +3076,7 @@ Java_hdf_hdf5lib_H5_H5AreadComplex(JNIEnv *env, jclass clss, jlong attr_id, jlon for (i = 0; i < (size_t)n; i++) { h5str.s[0] = '\0'; - if (!h5str_sprintf(ENVONLY, &h5str, attr_id, mem_type_id, readBuf + (i * size), 0, 0)) + if (!h5str_sprintf(ENVONLY, &h5str, attr_id, mem_type_id, readBuf + (i * size), 0)) CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); if (NULL == (jstr = ENVPTR->NewStringUTF(ENVONLY, h5str.s))) @@ -3585,7 +3620,7 @@ Java_hdf_hdf5lib_H5_H5export_1dataset(JNIEnv *env, jclass clss, jstring file_exp H5_JNI_FATAL_ERROR(ENVONLY, "HDfopen failed"); if ((ret_val = h5str_dump_simple_dset(ENVONLY, stream, dataset_id, binary_order)) < 0) - H5_JNI_FATAL_ERROR(ENVONLY, "h5str_dump_simple_dset failed"); + H5_ASSERTION_ERROR(ENVONLY, "h5str_dump_simple_dset failed"); if (stream) { HDfclose(stream); diff --git a/java/src/jni/h5util.h b/java/src/jni/h5util.h index 4b79eda..a5e9607 100644 --- a/java/src/jni/h5util.h +++ b/java/src/jni/h5util.h @@ -41,13 +41,11 @@ extern void h5str_resize(h5str_t *str, size_t new_len); extern char * h5str_append(h5str_t *str, const char *cstr); extern size_t h5str_convert(JNIEnv *env, char **in_str, hid_t container, hid_t tid, void *out_buf, size_t out_buf_offset); -extern void h5str_sprint_reference(JNIEnv *env, h5str_t *out_str, hid_t container, void *ref_p); +extern int h5str_sprint_reference(JNIEnv *env, h5str_t *out_str, void *ref_p); extern size_t h5str_sprintf(JNIEnv *env, h5str_t *out_str, hid_t container, hid_t tid, void *in_buf, - size_t in_buf_len, int expand_data); + int expand_data); extern void h5str_array_free(char **strs, size_t len); extern int h5str_dump_simple_dset(JNIEnv *env, FILE *stream, hid_t dset, int binary_order); -extern int h5str_dump_region_blocks_data(JNIEnv *env, h5str_t *str, hid_t region, hid_t region_obj); -extern int h5str_dump_region_points_data(JNIEnv *env, h5str_t *str, hid_t region, hid_t region_obj); extern htri_t H5Tdetect_variable_str(hid_t tid); diff --git a/java/test/CMakeLists.txt b/java/test/CMakeLists.txt index 66991c4..c791c79 100644 --- a/java/test/CMakeLists.txt +++ b/java/test/CMakeLists.txt @@ -27,6 +27,7 @@ set (HDF5_JAVA_TEST_SOURCES TestH5Lbasic TestH5Lcreate TestH5R + TestH5Rref TestH5P TestH5PData TestH5Pfapl @@ -93,6 +94,8 @@ HDFTEST_COPY_FILE("${PROJECT_SOURCE_DIR}/h5ex_g_iterate.orig" "${PROJECT_BINARY_ HDFTEST_COPY_FILE("${PROJECT_SOURCE_DIR}/h5ex_g_iterate.orig" "${PROJECT_BINARY_DIR}/h5ex_g_iterateL2.hdf" "${HDF5_JAVA_TEST_LIB_TARGET}_files") HDFTEST_COPY_FILE("${PROJECT_SOURCE_DIR}/h5ex_g_iterate.orig" "${PROJECT_BINARY_DIR}/h5ex_g_iterateO1.hdf" "${HDF5_JAVA_TEST_LIB_TARGET}_files") HDFTEST_COPY_FILE("${PROJECT_SOURCE_DIR}/h5ex_g_iterate.orig" "${PROJECT_BINARY_DIR}/h5ex_g_iterateO2.hdf" "${HDF5_JAVA_TEST_LIB_TARGET}_files") +HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/trefer_reg.h5" "${PROJECT_BINARY_DIR}/trefer_reg.h5" "${HDF5_JAVA_TEST_LIB_TARGET}_files") +HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/trefer_attr.h5" "${PROJECT_BINARY_DIR}/trefer_attr.h5" "${HDF5_JAVA_TEST_LIB_TARGET}_files") add_custom_target(${HDF5_JAVA_TEST_LIB_TARGET}_files ALL COMMENT "Copying files needed by ${HDF5_JAVA_TEST_LIB_TARGET} tests" DEPENDS ${${HDF5_JAVA_TEST_LIB_TARGET}_files_list}) @@ -208,6 +211,8 @@ if (HDF5_TEST_JAVA AND HDF5_TEST_SERIAL) HDFTEST_COPY_FILE("${PROJECT_SOURCE_DIR}/h5ex_g_iterate.orig" "${PROJECT_BINARY_DIR}/${voltest}/h5ex_g_iterateL2.hdf" "${HDF5_JAVA_TEST_LIB_TARGET}_${voltest}_files") HDFTEST_COPY_FILE("${PROJECT_SOURCE_DIR}/h5ex_g_iterate.orig" "${PROJECT_BINARY_DIR}/${voltest}/h5ex_g_iterateO1.hdf" "${HDF5_JAVA_TEST_LIB_TARGET}_${voltest}_files") HDFTEST_COPY_FILE("${PROJECT_SOURCE_DIR}/h5ex_g_iterate.orig" "${PROJECT_BINARY_DIR}/${voltest}/h5ex_g_iterateO2.hdf" "${HDF5_JAVA_TEST_LIB_TARGET}_${voltest}_files") + HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/trefer_reg.h5" "${PROJECT_BINARY_DIR}/${voltest}/trefer_reg.h5" "${HDF5_JAVA_TEST_LIB_TARGET}_${voltest}_files") + HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/trefer_attr.h5" "${PROJECT_BINARY_DIR}/${voltest}/trefer_attr.h5" "${HDF5_JAVA_TEST_LIB_TARGET}_${voltest}_files") add_custom_target(${HDF5_JAVA_TEST_LIB_TARGET}_${voltest}_files ALL COMMENT "Copying files needed by ${HDF5_JAVA_TEST_LIB_TARGET} tests" DEPENDS ${${HDF5_JAVA_TEST_LIB_TARGET}_${voltest}_files_list}) diff --git a/java/test/Makefile.am b/java/test/Makefile.am index 954dffb..a110acd 100644 --- a/java/test/Makefile.am +++ b/java/test/Makefile.am @@ -58,6 +58,7 @@ noinst_JAVA = \ TestH5Lbasic.java \ TestH5Lcreate.java \ TestH5R.java \ + TestH5Rref.java \ TestH5P.java \ TestH5PData.java \ TestH5Pfapl.java \ diff --git a/java/test/TestAll.java b/java/test/TestAll.java index a59e990..efca20c 100644 --- a/java/test/TestAll.java +++ b/java/test/TestAll.java @@ -25,7 +25,7 @@ import org.junit.runners.Suite; TestH5Tparams.class, TestH5Tbasic.class, TestH5T.class, TestH5Dparams.class, TestH5D.class, TestH5Dplist.class, TestH5Lparams.class, TestH5Lbasic.class, TestH5Lcreate.class, - TestH5R.class, + TestH5R.class, TestH5Rref.class, TestH5P.class, TestH5PData.class, TestH5Pfapl.class, TestH5Pvirtual.class, TestH5Plist.class, TestH5Pfapls3.class, TestH5Pfaplhdfs.class, TestH5A.class, diff --git a/java/test/TestH5.java b/java/test/TestH5.java index 717d323..81d33ef 100644 --- a/java/test/TestH5.java +++ b/java/test/TestH5.java @@ -32,6 +32,7 @@ import java.io.StreamTokenizer; import hdf.hdf5lib.H5; import hdf.hdf5lib.HDF5Constants; +import hdf.hdf5lib.exceptions.HDF5Exception; import hdf.hdf5lib.exceptions.HDF5LibraryException; import org.junit.After; @@ -47,22 +48,21 @@ import org.junit.rules.TestName; */ public class TestH5 { @Rule public TestName testname = new TestName(); - @Before - public void showTestName() { - System.out.print(testname.getMethodName()); - } - @After - public void nextTestName() { - System.out.println(); - } private static final String H5_FILE = "testData.h5"; private static final String EXPORT_FILE = "testExport.txt"; + private static final String H5_DREG_FILE = "trefer_reg.h5"; + private static final String EXPORT_DREG_FILE = "testExportReg.txt"; + private static final String H5_AREG_FILE = "trefer_attr.h5"; + private static final String EXPORT_AREG_FILE = "testExportAReg.txt"; private static final int DIM_X = 4; private static final int DIM_Y = 6; + private static final int DIM_BLKS = 36; + private static final int DIM_PNTS = 10; + private static final int DIM_ATTR = 12; private static final int RANK = 2; - long H5fid = -1; - long H5dsid = -1; - long H5did = -1; + long H5fid = HDF5Constants.H5I_INVALID_HID; + long H5dsid = HDF5Constants.H5I_INVALID_HID; + long H5did = HDF5Constants.H5I_INVALID_HID; long[] H5dims = { DIM_X, DIM_Y }; private final void _deleteFile(String filename) { @@ -78,7 +78,7 @@ public class TestH5 { } private final long _createDataset(long fid, long dsid, String name, long dapl) { - long did = -1; + long did = HDF5Constants.H5I_INVALID_HID; try { did = H5.H5Dcreate(fid, name, HDF5Constants.H5T_STD_I32LE, dsid, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, dapl); @@ -115,22 +115,64 @@ public class TestH5 { } } - public final void _closeH5File() throws HDF5LibraryException { + private final void _closeH5File() { if (H5did >= 0) try {H5.H5Dclose(H5did);} catch (Exception ex) {} if (H5dsid > 0) try {H5.H5Sclose(H5dsid);} catch (Exception ex) {} if (H5fid > 0) try {H5.H5Fclose(H5fid);} catch (Exception ex) {} - H5fid = -1; - H5dsid = -1; - H5did = -1; + H5fid = HDF5Constants.H5I_INVALID_HID; + H5dsid = HDF5Constants.H5I_INVALID_HID; + H5did = HDF5Constants.H5I_INVALID_HID; + } + + public void _openH5File(String filename, String dsetname) { + try { + H5fid = H5.H5Fopen(filename, + HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("TestH5._openH5file: " + err); + } + assertTrue("TestH5._openH5file: H5.H5Fopen: ", H5fid >= 0); + try { + H5did = H5.H5Dopen(H5fid, dsetname, HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("TestH5._openH5file: " + err); + } + assertTrue("TestH5._openH5file: H5.H5Dopen: ", H5did >= 0); + try { + H5dsid = H5.H5Dget_space(H5did); + } + catch (Throwable err) { + err.printStackTrace(); + fail("TestH5._openH5file: " + err); + } + assertTrue("TestH5._openH5file: H5.H5Screate_simple: ",H5dsid > 0); } public final void _deleteH5file() { + _closeH5File(); _deleteFile(H5_FILE); } + @After + public void closeH5File() throws HDF5LibraryException { + _closeH5File(); + System.out.println(); + } + + @Before + public void verifyCount() + throws NullPointerException, HDF5Exception { + assertTrue("H5 open ids is 0", H5.getOpenIDCount()==0); + System.out.print(testname.getMethodName()); + } + /** * Test method for {@link hdf.hdf5lib.H5#J2C(int)}. * NOTE: @@ -411,4 +453,84 @@ public class TestH5 { } _deleteH5file(); } + + @Test + public void testH5export_regdataset() { + int[] dset_data_expect = {66, 69, 72, 75, 78, 81, 96, 99, 102, 105, 108, + 111, 126, 129, 132, 135, 138, 141, 156, 159, 162, 165, 168, 171, + 186, 189, 192, 195, 198, 201, 216, 219, 222, 225, 228, 231, + 207, 66, 252, 48, 84, 96, 12, 14, 213, 99}; + int[] dset_indata = new int[DIM_BLKS+DIM_PNTS]; + String objName = "/Dataset1"; + + _openH5File(H5_DREG_FILE, objName); + + try { + H5.H5export_dataset(EXPORT_DREG_FILE, H5_DREG_FILE, objName, 99); + } + catch (HDF5LibraryException err) { + err.printStackTrace(); + fail("H5export_dataset failed: " + err); + } + + File file = new File(EXPORT_DREG_FILE); + + try { + Reader reader = new FileReader(EXPORT_DREG_FILE); + StreamTokenizer streamTokenizer = new StreamTokenizer(reader); + int indx = 0; + while(streamTokenizer.nextToken() != StreamTokenizer.TT_EOF){ + if(streamTokenizer.ttype == StreamTokenizer.TT_NUMBER) { + dset_indata[indx] = (int)streamTokenizer.nval; + indx++; + } + } + reader.close(); + } + catch (IOException err) { + err.printStackTrace(); + fail("read file failed: " + err); + } + for(int row = 0; row < DIM_X; row++) + assertTrue("H5export_dataset: <"+row+">"+dset_indata[row], dset_indata[row]==dset_data_expect[row]); + } + + @Test + public void testH5export_attrdataset() { + int[] dset_data_expect = {0, 3, 6, 9, 1, 4, 7, 10, 2, 5, 8, 11}; + int[] dset_indata = new int[DIM_ATTR]; + String objName = "/Dataset3"; + + _openH5File(H5_AREG_FILE, objName); + + try { + H5.H5export_dataset(EXPORT_AREG_FILE, H5_AREG_FILE, objName, 99); + } + catch (HDF5LibraryException err) { + err.printStackTrace(); + fail("H5export_dataset failed: " + err); + } + + File file = new File(EXPORT_AREG_FILE); + + try { + Reader reader = new FileReader(EXPORT_AREG_FILE); + StreamTokenizer streamTokenizer = new StreamTokenizer(reader); + int indx = 0; + int jndx = 0; + while(streamTokenizer.nextToken() != StreamTokenizer.TT_EOF){ + if(streamTokenizer.ttype == StreamTokenizer.TT_NUMBER) { + dset_indata[indx] = (int)streamTokenizer.nval; + indx++; + } + } + reader.close(); + } + catch (IOException err) { + err.printStackTrace(); + fail("read file failed: " + err); + } + for(int row = 0; row < DIM_X; row++) + assertTrue("H5export_dataset: <"+row+">"+dset_indata[row], dset_indata[row]==dset_data_expect[row]); + } } diff --git a/java/test/TestH5A.java b/java/test/TestH5A.java index cff03f9..5ec773f 100644 --- a/java/test/TestH5A.java +++ b/java/test/TestH5A.java @@ -43,14 +43,14 @@ public class TestH5A { private static final String H5_FILE = "testA.h5"; private static final int DIM_X = 4; private static final int DIM_Y = 6; - long H5fid = -1; - long H5dsid = -1; - long H5did = -1; + long H5fid = HDF5Constants.H5I_INVALID_HID; + long H5dsid = HDF5Constants.H5I_INVALID_HID; + long H5did = HDF5Constants.H5I_INVALID_HID; long[] H5dims = { DIM_X, DIM_Y }; - long type_id = -1; - long space_id = -1; - long lapl_id = -1; - long aapl_id = -1; + long type_id = HDF5Constants.H5I_INVALID_HID; + long space_id = HDF5Constants.H5I_INVALID_HID; + long lapl_id = HDF5Constants.H5I_INVALID_HID; + long aapl_id = HDF5Constants.H5I_INVALID_HID; private final void _deleteFile(String filename) { File file = new File(filename); @@ -61,7 +61,7 @@ public class TestH5A { } private final long _createDataset(long fid, long dsid, String name, long dapl) { - long did = -1; + long did = HDF5Constants.H5I_INVALID_HID; try { did = H5.H5Dcreate(fid, name, HDF5Constants.H5T_STD_I32BE, dsid, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, dapl); @@ -132,7 +132,7 @@ public class TestH5A { @Test public void testH5Acreate2() { - long attr_id = -1; + long attr_id = HDF5Constants.H5I_INVALID_HID; try { attr_id = H5.H5Acreate(H5did, "dset", type_id, space_id, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); assertTrue("testH5Acreate2", attr_id >= 0); @@ -160,8 +160,8 @@ public class TestH5A { @Test public void testH5Aopen() { String attr_name = "dset"; - long attribute_id = -1; - long attr_id = -1; + long attribute_id = HDF5Constants.H5I_INVALID_HID; + long attr_id = HDF5Constants.H5I_INVALID_HID; try { attr_id = H5.H5Acreate(H5did, attr_name, type_id, space_id, @@ -197,8 +197,8 @@ public class TestH5A { int idx_type = HDF5Constants.H5_INDEX_CRT_ORDER; int order = HDF5Constants.H5_ITER_INC; long n = 0; - long attr_id = -1; - long attribute_id = -1; + long attr_id = HDF5Constants.H5I_INVALID_HID; + long attribute_id = HDF5Constants.H5I_INVALID_HID; try { attr_id = H5.H5Acreate(H5did, "file", type_id, space_id, @@ -256,7 +256,7 @@ public class TestH5A { public void testH5Acreate_by_name() { String obj_name = "."; String attr_name = "DATASET"; - long attribute_id = -1; + long attribute_id = HDF5Constants.H5I_INVALID_HID; boolean bool_val = false; try { @@ -288,7 +288,7 @@ public class TestH5A { long loc_id = H5fid; String old_attr_name = "old"; String new_attr_name = "new"; - long attr_id = -1; + long attr_id = HDF5Constants.H5I_INVALID_HID; int ret_val = -1; boolean bool_val = false; @@ -326,7 +326,7 @@ public class TestH5A { String obj_name = "."; String old_attr_name = "old"; String new_attr_name = "new"; - long attr_id = -1; + long attr_id = HDF5Constants.H5I_INVALID_HID; int ret_val = -1; boolean bool_val = false; @@ -368,7 +368,7 @@ public class TestH5A { String obj_name = "."; String attr_name = "DATASET1"; String ret_name = null; - long attribute_id = -1; + long attribute_id = HDF5Constants.H5I_INVALID_HID; try { attribute_id = H5.H5Acreate_by_name(H5fid, obj_name, attr_name, @@ -398,8 +398,8 @@ public class TestH5A { int idx_type = HDF5Constants.H5_INDEX_NAME; int order = HDF5Constants.H5_ITER_INC; int n = 0; - long attr1_id = -1; - long attr2_id = -1; + long attr1_id = HDF5Constants.H5I_INVALID_HID; + long attr2_id = HDF5Constants.H5I_INVALID_HID; try { attr1_id = H5.H5Acreate_by_name(loc_id, obj_name, attr_name, @@ -435,8 +435,8 @@ public class TestH5A { @Test public void testH5Aget_storage_size() { - long attr_id = -1; - long attr_size = -1; + long attr_id = HDF5Constants.H5I_INVALID_HID; + long attr_size = HDF5Constants.H5I_INVALID_HID; try { attr_id = H5.H5Acreate(H5did, "dset", type_id, space_id, @@ -458,8 +458,8 @@ public class TestH5A { @Test public void testH5Aget_info() { H5A_info_t attr_info = null; - long attribute_id = -1; - long attr_id = -1; + long attribute_id = HDF5Constants.H5I_INVALID_HID; + long attr_id = HDF5Constants.H5I_INVALID_HID; try { attr_id = H5.H5Acreate(H5did, "dset", type_id, space_id, @@ -490,8 +490,8 @@ public class TestH5A { @Test public void testH5Aget_info1() { H5A_info_t attr_info = null; - long attribute_id = -1; - long attr_id = -1; + long attribute_id = HDF5Constants.H5I_INVALID_HID; + long attr_id = HDF5Constants.H5I_INVALID_HID; int order = HDF5Constants.H5_ITER_INC; try { @@ -526,8 +526,8 @@ public class TestH5A { @Test public void testH5Aget_info_by_idx() { - long attr_id = -1; - long attr2_id = -1;; + long attr_id = HDF5Constants.H5I_INVALID_HID; + long attr2_id = HDF5Constants.H5I_INVALID_HID;; H5A_info_t attr_info = null; try { @@ -582,7 +582,7 @@ public class TestH5A { @Test public void testH5Aget_info_by_name() { - long attr_id = -1; + long attr_id = HDF5Constants.H5I_INVALID_HID; H5A_info_t attr_info = null; String obj_name = "."; String attr_name = "DATASET"; @@ -607,7 +607,7 @@ public class TestH5A { @Test public void testH5Adelete_by_name() { - long attr_id = -1; + long attr_id = HDF5Constants.H5I_INVALID_HID; int ret_val = -1; boolean bool_val = false; boolean exists = false; @@ -650,8 +650,8 @@ public class TestH5A { @Test public void testH5Aexists() { boolean exists = false; - long attr_id = -1; - long attribute_id = -1; + long attr_id = HDF5Constants.H5I_INVALID_HID; + long attribute_id = HDF5Constants.H5I_INVALID_HID; try { exists = H5.H5Aexists(H5fid, "None"); @@ -689,10 +689,10 @@ public class TestH5A { @Test public void testH5Adelete_by_idx_order() { boolean exists = false; - long attr1_id = -1; - long attr2_id = -1; - long attr3_id = -1; - long attr4_id = -1; + long attr1_id = HDF5Constants.H5I_INVALID_HID; + long attr2_id = HDF5Constants.H5I_INVALID_HID; + long attr3_id = HDF5Constants.H5I_INVALID_HID; + long attr4_id = HDF5Constants.H5I_INVALID_HID; try { attr1_id = H5.H5Acreate_by_name(H5fid, ".", "attribute1", @@ -731,9 +731,9 @@ public class TestH5A { @Test public void testH5Adelete_by_idx_name1() { boolean exists = false; - long attr1_id = -1; - long attr2_id = -1; - long attr3_id = -1; + long attr1_id = HDF5Constants.H5I_INVALID_HID; + long attr2_id = HDF5Constants.H5I_INVALID_HID; + long attr3_id = HDF5Constants.H5I_INVALID_HID; try { attr1_id = H5.H5Acreate_by_name(H5fid, ".", "attribute1", @@ -766,10 +766,10 @@ public class TestH5A { @Test public void testH5Adelete_by_idx_name2() { boolean exists = false; - long attr1_id = -1; - long attr2_id = -1; - long attr3_id = -1; - long attr4_id = -1; + long attr1_id = HDF5Constants.H5I_INVALID_HID; + long attr2_id = HDF5Constants.H5I_INVALID_HID; + long attr3_id = HDF5Constants.H5I_INVALID_HID; + long attr4_id = HDF5Constants.H5I_INVALID_HID; try { attr1_id = H5.H5Acreate_by_name(H5fid, ".", "attribute1", @@ -821,8 +821,8 @@ public class TestH5A { public void testH5Aopen_by_name() { String obj_name = "."; String attr_name = "DATASET"; - long attribute_id = -1; - long aid = -1; + long attribute_id = HDF5Constants.H5I_INVALID_HID; + long aid = HDF5Constants.H5I_INVALID_HID; try { attribute_id = H5.H5Acreate_by_name(H5fid, obj_name, attr_name, @@ -856,9 +856,9 @@ public class TestH5A { @Test public void testH5Awrite_readVL() { String attr_name = "VLdata"; - long attr_id = -1; - long atype_id = -1; - long aspace_id = -1; + long attr_id = HDF5Constants.H5I_INVALID_HID; + long atype_id = HDF5Constants.H5I_INVALID_HID; + long aspace_id = HDF5Constants.H5I_INVALID_HID; String[] str_data = { "Parting", "is such", "sweet", "sorrow." }; long[] dims = { str_data.length }; long lsize = 1; @@ -923,8 +923,8 @@ public class TestH5A { public void testH5Aget_create_plist() { String attr_name = "DATASET1"; int char_encoding = 0; - long plist_id = -1; - long attribute_id = -1; + long plist_id = HDF5Constants.H5I_INVALID_HID; + long attribute_id = HDF5Constants.H5I_INVALID_HID; try { plist_id = H5.H5Pcreate(HDF5Constants.H5P_ATTRIBUTE_CREATE); @@ -984,10 +984,10 @@ public class TestH5A { @Test public void testH5Aiterate() { - long attr1_id = -1; - long attr2_id = -1; - long attr3_id = -1; - long attr4_id = -1; + long attr1_id = HDF5Constants.H5I_INVALID_HID; + long attr2_id = HDF5Constants.H5I_INVALID_HID; + long attr3_id = HDF5Constants.H5I_INVALID_HID; + long attr4_id = HDF5Constants.H5I_INVALID_HID; class idata { public String attr_name = null; @@ -1052,10 +1052,10 @@ public class TestH5A { @Test public void testH5Aiterate_by_name() { - long attr1_id = -1; - long attr2_id = -1; - long attr3_id = -1; - long attr4_id = -1; + long attr1_id = HDF5Constants.H5I_INVALID_HID; + long attr2_id = HDF5Constants.H5I_INVALID_HID; + long attr3_id = HDF5Constants.H5I_INVALID_HID; + long attr4_id = HDF5Constants.H5I_INVALID_HID; class idata { public String attr_name = null; diff --git a/java/test/TestH5D.java b/java/test/TestH5D.java index 21f0879..2d6c95d 100644 --- a/java/test/TestH5D.java +++ b/java/test/TestH5D.java @@ -39,13 +39,13 @@ public class TestH5D { private static final int DIM_X = 4; private static final int DIM_Y = 6; private static final int RANK = 2; - long H5fid = -1; - long H5faplid = -1; - long H5dsid = -1; - long H5dtid = -1; - long H5did = -1; - long H5did0 = -1; - long H5dcpl_id = -1; + long H5fid = HDF5Constants.H5I_INVALID_HID; + long H5faplid = HDF5Constants.H5I_INVALID_HID; + long H5dsid = HDF5Constants.H5I_INVALID_HID; + long H5dtid = HDF5Constants.H5I_INVALID_HID; + long H5did = HDF5Constants.H5I_INVALID_HID; + long H5did0 = HDF5Constants.H5I_INVALID_HID; + long H5dcpl_id = HDF5Constants.H5I_INVALID_HID; long[] H5dims = { DIM_X, DIM_Y }; // Values for the status of space allocation @@ -195,9 +195,9 @@ public class TestH5D { try {H5.H5Fclose(H5fid);} catch (Exception ex) {} } - private final void _openH5file(String name, long dapl) { + private final void _openH5file(String filename, String dsetname, long dapl) { try { - H5fid = H5.H5Fopen(H5_FILE, + H5fid = H5.H5Fopen(filename, HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { @@ -206,7 +206,7 @@ public class TestH5D { } assertTrue("TestH5D._openH5file: H5.H5Fopen: ",H5fid >= 0); try { - H5did = H5.H5Dopen(H5fid, name, dapl); + H5did = H5.H5Dopen(H5fid, dsetname, dapl); } catch (Throwable err) { err.printStackTrace(); @@ -268,7 +268,7 @@ public class TestH5D { @Test public void testH5Dcreate() { - long dataset_id = -1; + long dataset_id = HDF5Constants.H5I_INVALID_HID; try { dataset_id = H5.H5Dcreate(H5fid, "dset", HDF5Constants.H5T_STD_I32BE, H5dsid, @@ -292,7 +292,7 @@ public class TestH5D { @Test public void testH5Dcreate_anon() { - long dataset_id = -1; + long dataset_id = HDF5Constants.H5I_INVALID_HID; try { dataset_id = H5.H5Dcreate_anon(H5fid, HDF5Constants.H5T_STD_I32BE, H5dsid, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); @@ -315,12 +315,12 @@ public class TestH5D { @Test public void testH5Dopen() { - long dataset_id = -1; + long dataset_id = HDF5Constants.H5I_INVALID_HID; _createDataset(H5fid, H5dsid, "dset", HDF5Constants.H5P_DEFAULT); try { H5.H5Dclose(H5did); - H5did = -1; + H5did = HDF5Constants.H5I_INVALID_HID; dataset_id = H5.H5Dopen(H5fid, "dset", HDF5Constants.H5P_DEFAULT); } catch (Exception err) { @@ -388,8 +388,8 @@ public class TestH5D { @Test public void testH5Dget_access_plist() { - long dapl_id = -1; - long test_dapl_id = -1; + long dapl_id = HDF5Constants.H5I_INVALID_HID; + long test_dapl_id = HDF5Constants.H5I_INVALID_HID; int[] mdc_nelmts1 = {0}; int[] mdc_nelmts2 = {0}; long[] rdcc_nelmts1 = {0}; @@ -500,7 +500,7 @@ public class TestH5D { @Test(expected = HDF5LibraryException.class) public void testH5Dget_space_closed() throws Throwable { - long dataset_id = -1; + long dataset_id = HDF5Constants.H5I_INVALID_HID; try { dataset_id = H5.H5Dcreate(H5fid, "dset", HDF5Constants.H5T_STD_I32BE, H5dsid, @@ -518,7 +518,7 @@ public class TestH5D { @Test public void testH5Dget_space() { - long dataspace_id = -1; + long dataspace_id = HDF5Constants.H5I_INVALID_HID; _createDataset(H5fid, H5dsid, "dset", HDF5Constants.H5P_DEFAULT); try { @@ -542,7 +542,7 @@ public class TestH5D { @Test(expected = HDF5LibraryException.class) public void testH5Dget_type_closed() throws Throwable { - long dataset_id = -1; + long dataset_id = HDF5Constants.H5I_INVALID_HID; try { dataset_id = H5.H5Dcreate(H5fid, "dset", HDF5Constants.H5T_STD_I32BE, H5dsid, @@ -560,7 +560,7 @@ public class TestH5D { @Test public void testH5Dget_type() { - long datatype_id = -1; + long datatype_id = HDF5Constants.H5I_INVALID_HID; _createDataset(H5fid, H5dsid, "dset", HDF5Constants.H5P_DEFAULT); try { diff --git a/java/test/TestH5Dplist.java b/java/test/TestH5Dplist.java index 97ce084..8dc2f4e 100644 --- a/java/test/TestH5Dplist.java +++ b/java/test/TestH5Dplist.java @@ -42,10 +42,10 @@ public class TestH5Dplist { private static final int NDIMS = 2; private static final int FILLVAL = 99; private static final int RANK = 2; - long H5fid = -1; - long H5dsid = -1; - long H5did = -1; - long H5dcpl_id = -1; + long H5fid = HDF5Constants.H5I_INVALID_HID; + long H5dsid = HDF5Constants.H5I_INVALID_HID; + long H5did = HDF5Constants.H5I_INVALID_HID; + long H5dcpl_id = HDF5Constants.H5I_INVALID_HID; long[] H5dims = { DIM_X, DIM_Y }; long[] H5extdims = { EDIM_X, EDIM_Y }; long[] H5chunk_dims = { CHUNK_X, CHUNK_Y }; diff --git a/java/test/TestH5F.java b/java/test/TestH5F.java index 3ef4635..dab46b4 100644 --- a/java/test/TestH5F.java +++ b/java/test/TestH5F.java @@ -49,7 +49,7 @@ public class TestH5F { HDF5Constants.H5F_OBJ_DATASET, HDF5Constants.H5F_OBJ_GROUP, HDF5Constants.H5F_OBJ_DATATYPE, HDF5Constants.H5F_OBJ_ATTR, HDF5Constants.H5F_OBJ_ALL }; - long H5fid = -1; + long H5fid = HDF5Constants.H5I_INVALID_HID; private final void _deleteFile(String filename) { File file = new File(filename); @@ -74,7 +74,7 @@ public class TestH5F { public void deleteH5file() throws HDF5LibraryException { if (H5fid > 0) { try {H5.H5Fclose(H5fid);} catch (Exception ex) {} - H5fid = -1; + H5fid = HDF5Constants.H5I_INVALID_HID; } _deleteFile(H5_FILE); System.out.println(); @@ -82,7 +82,7 @@ public class TestH5F { @Test public void testH5Fget_create_plist() { - long plist = -1; + long plist = HDF5Constants.H5I_INVALID_HID; try { plist = H5.H5Fget_create_plist(H5fid); @@ -106,7 +106,7 @@ public class TestH5F { @Test public void testH5Fget_access_plist() { - long plist = -1; + long plist = HDF5Constants.H5I_INVALID_HID; try { plist = H5.H5Fget_access_plist(H5fid); @@ -134,7 +134,7 @@ public class TestH5F { if (H5fid > 0) { try {H5.H5Fclose(H5fid);} catch (Exception ex) {} - H5fid = -1; + H5fid = HDF5Constants.H5I_INVALID_HID; } try { @@ -159,7 +159,7 @@ public class TestH5F { if (H5fid > 0) { try {H5.H5Fclose(H5fid);} catch (Exception ex) {} - H5fid = -1; + H5fid = HDF5Constants.H5I_INVALID_HID; } try { @@ -182,8 +182,8 @@ public class TestH5F { public void testH5Fget_fileno_same() { long fileno1 = 0; long fileno2 = 0; - long fid1 = -1; - long fid2 = -1; + long fid1 = HDF5Constants.H5I_INVALID_HID; + long fid2 = HDF5Constants.H5I_INVALID_HID; try { fid1 = H5.H5Fcreate(H5_FILE2, HDF5Constants.H5F_ACC_TRUNC, @@ -213,7 +213,7 @@ public class TestH5F { public void testH5Fget_fileno_diff() { long fileno1 = 0; long fileno2 = 0; - long fid2 = -1; + long fid2 = HDF5Constants.H5I_INVALID_HID; try { fid2 = H5.H5Fcreate(H5_FILE2, HDF5Constants.H5F_ACC_TRUNC, diff --git a/java/test/TestH5Fbasic.java b/java/test/TestH5Fbasic.java index 225e311..c89fea7 100644 --- a/java/test/TestH5Fbasic.java +++ b/java/test/TestH5Fbasic.java @@ -35,7 +35,7 @@ public class TestH5Fbasic { @Rule public TestName testname = new TestName(); private static final String H5_FILE = "testFb.h5"; private static final String TXT_FILE = "testFb.txt"; - long H5fid = -1; + long H5fid = HDF5Constants.H5I_INVALID_HID; private final void _deleteFile(String filename) { File file = new File(filename); @@ -90,7 +90,7 @@ public class TestH5Fbasic { @Test(expected = HDF5LibraryException.class) public void testH5Fopen_read_only() throws Throwable { - long fid = -1; + long fid = HDF5Constants.H5I_INVALID_HID; try { fid = H5.H5Fopen(H5_FILE, HDF5Constants.H5F_ACC_RDWR, @@ -125,8 +125,8 @@ public class TestH5Fbasic { @Test(expected = HDF5LibraryException.class) public void testH5Freopen_closed() throws Throwable { - long fid = -1; - long fid2 = -1; + long fid = HDF5Constants.H5I_INVALID_HID; + long fid2 = HDF5Constants.H5I_INVALID_HID; try { fid = H5.H5Fopen(H5_FILE, HDF5Constants.H5F_ACC_RDWR, @@ -148,8 +148,8 @@ public class TestH5Fbasic { @Test public void testH5Freopen() { - long fid = -1; - long fid2 = -1; + long fid = HDF5Constants.H5I_INVALID_HID; + long fid2 = HDF5Constants.H5I_INVALID_HID; try { fid = H5.H5Fopen(H5_FILE, HDF5Constants.H5F_ACC_RDWR, @@ -182,7 +182,7 @@ public class TestH5Fbasic { @Test public void testH5Fclose() { - long fid = -1; + long fid = HDF5Constants.H5I_INVALID_HID; try { fid = H5.H5Fopen(H5_FILE, HDF5Constants.H5F_ACC_RDWR, @@ -202,7 +202,7 @@ public class TestH5Fbasic { @Test(expected = HDF5LibraryException.class) public void testH5Fclose_twice() throws Throwable { - long fid = -1; + long fid = HDF5Constants.H5I_INVALID_HID; try { fid = H5.H5Fopen(H5_FILE, HDF5Constants.H5F_ACC_RDWR, diff --git a/java/test/TestH5Fparams.java b/java/test/TestH5Fparams.java index 85bfdf5..3475167 100644 --- a/java/test/TestH5Fparams.java +++ b/java/test/TestH5Fparams.java @@ -105,7 +105,7 @@ public class TestH5Fparams { @Test public void testH5Fcreate() { - long fid = -1; + long fid = HDF5Constants.H5I_INVALID_HID; File file = null; try { @@ -132,7 +132,7 @@ public class TestH5Fparams { @Test public void testH5Fflush_global() { - long fid = -1; + long fid = HDF5Constants.H5I_INVALID_HID; try { fid = H5.H5Fcreate("test.h5", HDF5Constants.H5F_ACC_TRUNC, @@ -158,7 +158,7 @@ public class TestH5Fparams { @Test public void testH5Fflush_local() { - long fid = -1; + long fid = HDF5Constants.H5I_INVALID_HID; try { fid = H5.H5Fcreate("test.h5", HDF5Constants.H5F_ACC_TRUNC, @@ -184,7 +184,7 @@ public class TestH5Fparams { @Test public void testH5Fget_info() { - long fid = -1; + long fid = HDF5Constants.H5I_INVALID_HID; try { try { @@ -215,7 +215,7 @@ public class TestH5Fparams { @Ignore//(expected = HDF5FunctionArgumentException.class) public void testH5Fset_libver_bounds_invalidlow() throws Throwable { - long fid = -1; + long fid = HDF5Constants.H5I_INVALID_HID; try { try { @@ -234,7 +234,7 @@ public class TestH5Fparams { @Ignore//(expected = HDF5FunctionArgumentException.class) public void testH5Fset_libver_bounds_invalidhigh() throws Throwable { - long fid = -1; + long fid = HDF5Constants.H5I_INVALID_HID; try { try { diff --git a/java/test/TestH5Fswmr.java b/java/test/TestH5Fswmr.java index 6a7ccfa..c81019a 100644 --- a/java/test/TestH5Fswmr.java +++ b/java/test/TestH5Fswmr.java @@ -33,9 +33,9 @@ public class TestH5Fswmr { @Rule public TestName testname = new TestName(); private static final String H5_FILE = "testswmr.h5"; - long H5fid = -1; - long H5fapl = -1; - long H5fcpl = -1; + long H5fid = HDF5Constants.H5I_INVALID_HID; + long H5fapl = HDF5Constants.H5I_INVALID_HID; + long H5fcpl = HDF5Constants.H5I_INVALID_HID; private final void _deleteFile(String filename) { File file = new File(filename); @@ -63,15 +63,15 @@ public class TestH5Fswmr { public void deleteH5file() throws HDF5LibraryException { if (H5fapl > 0) { try {H5.H5Pclose(H5fapl);} catch (Exception ex) {} - H5fapl = -1; + H5fapl = HDF5Constants.H5I_INVALID_HID; } if (H5fcpl > 0) { try {H5.H5Pclose(H5fcpl);} catch (Exception ex) {} - H5fcpl = -1; + H5fcpl = HDF5Constants.H5I_INVALID_HID; } if (H5fid > 0) { try {H5.H5Fclose(H5fid);} catch (Exception ex) {} - H5fid = -1; + H5fid = HDF5Constants.H5I_INVALID_HID; } _deleteFile(H5_FILE); System.out.println(); diff --git a/java/test/TestH5G.java b/java/test/TestH5G.java index abd9642..87d56d7 100644 --- a/java/test/TestH5G.java +++ b/java/test/TestH5G.java @@ -39,11 +39,11 @@ public class TestH5G { private static final String[] GROUPS = { "/G1", "/G1/G11", "/G1/G12", "/G1/G11/G111", "/G1/G11/G112", "/G1/G11/G113", "/G1/G11/G114" }; private static final String[] GROUPS2 = { "/G1", "/G1/G14", "/G1/G12", "/G1/G13", "/G1/G11"}; - long H5fid = -1; - long H5fid2 = -1; + long H5fid = HDF5Constants.H5I_INVALID_HID; + long H5fid2 = HDF5Constants.H5I_INVALID_HID; private final long _createGroup(long fid, String name) { - long gid = -1; + long gid = HDF5Constants.H5I_INVALID_HID; try { gid = H5.H5Gcreate(fid, name, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); @@ -58,8 +58,8 @@ public class TestH5G { } private final long _createGroup2(long fid, String name) { - long gid = -1; - long gcpl = -1; + long gid = HDF5Constants.H5I_INVALID_HID; + long gcpl = HDF5Constants.H5I_INVALID_HID; try { gcpl = H5.H5Pcreate(HDF5Constants.H5P_GROUP_CREATE); //create gcpl } @@ -92,12 +92,12 @@ public class TestH5G { } private final long _openGroup(long fid, String name) { - long gid = -1; + long gid = HDF5Constants.H5I_INVALID_HID; try { gid = H5.H5Gopen(fid, name, HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { - gid = -1; + gid = HDF5Constants.H5I_INVALID_HID; err.printStackTrace(); fail("H5.H5Gopen: " + err); } @@ -134,7 +134,7 @@ public class TestH5G { assertTrue("TestH5G.createH5file: H5.H5Fcreate: ", H5fid > 0); assertTrue("TestH5G.createH5file: H5.H5Fcreate: ", H5fid2 > 0); - long gid = -1; + long gid = HDF5Constants.H5I_INVALID_HID; for (int i = 0; i < GROUPS.length; i++) { gid = _createGroup(H5fid, GROUPS[i]); @@ -165,7 +165,7 @@ public class TestH5G { @Test public void testH5Gopen() { - long gid = -1; + long gid = HDF5Constants.H5I_INVALID_HID; for (int i = 0; i < GROUPS.length; i++) { try { gid = H5.H5Gopen(H5fid, GROUPS[i], HDF5Constants.H5P_DEFAULT); @@ -185,8 +185,8 @@ public class TestH5G { @Test public void testH5Gget_create_plist() { - long gid = -1; - long pid = -1; + long gid = HDF5Constants.H5I_INVALID_HID; + long pid = HDF5Constants.H5I_INVALID_HID; for (int i = 0; i < GROUPS.length; i++) { try { diff --git a/java/test/TestH5Gbasic.java b/java/test/TestH5Gbasic.java index aea417e..539b336 100644 --- a/java/test/TestH5Gbasic.java +++ b/java/test/TestH5Gbasic.java @@ -33,10 +33,10 @@ import org.junit.rules.TestName; public class TestH5Gbasic { @Rule public TestName testname = new TestName(); private static final String H5_FILE = "testGb.h5"; - long H5fid = -1; + long H5fid = HDF5Constants.H5I_INVALID_HID; private final long _createGroup(long fid, String name) { - long gid = -1; + long gid = HDF5Constants.H5I_INVALID_HID; try { gid = H5.H5Gcreate(fid, name, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); @@ -85,7 +85,7 @@ public class TestH5Gbasic { @Test(expected = NullPointerException.class) public void testH5Gcreate_null() throws Throwable { - long gid = -1; + long gid = HDF5Constants.H5I_INVALID_HID; // it should fail because the group name is null gid = H5.H5Gcreate(H5fid, null, HDF5Constants.H5P_DEFAULT, @@ -102,7 +102,7 @@ public class TestH5Gbasic { @Test public void testH5Gcreate() { - long gid = -1; + long gid = HDF5Constants.H5I_INVALID_HID; try { gid = H5.H5Gcreate(H5fid, "/testH5Gcreate", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, @@ -145,7 +145,7 @@ public class TestH5Gbasic { @Test public void testH5Gcreate_anon() { - long gid = -1; + long gid = HDF5Constants.H5I_INVALID_HID; try { gid = H5.H5Gcreate_anon(H5fid, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); @@ -161,7 +161,7 @@ public class TestH5Gbasic { @Test(expected = NullPointerException.class) public void testH5Gopen_null() throws Throwable { - long gid = -1; + long gid = HDF5Constants.H5I_INVALID_HID; gid = H5.H5Gopen(H5fid, null, HDF5Constants.H5P_DEFAULT); @@ -175,7 +175,7 @@ public class TestH5Gbasic { @Test(expected = HDF5LibraryException.class) public void testH5Gopen_not_exists() throws Throwable { - long gid = -1; + long gid = HDF5Constants.H5I_INVALID_HID; gid = H5.H5Gopen(H5fid, "Never_created", HDF5Constants.H5P_DEFAULT); @@ -209,7 +209,7 @@ public class TestH5Gbasic { @Test public void testH5Gget_create_plist() { - long pid = -1; + long pid = HDF5Constants.H5I_INVALID_HID; long gid = _createGroup(H5fid, "/testH5Gcreate"); assertTrue(gid > 0); diff --git a/java/test/TestH5Giterate.java b/java/test/TestH5Giterate.java index af210ca..88c84db 100644 --- a/java/test/TestH5Giterate.java +++ b/java/test/TestH5Giterate.java @@ -31,15 +31,15 @@ import org.junit.rules.TestName; public class TestH5Giterate { @Rule public TestName testname = new TestName(); private static final String H5_FILE = "h5ex_g_iterate.hdf"; - long H5fid = -1; + long H5fid = HDF5Constants.H5I_INVALID_HID; private final long _openGroup(long fid, String name) { - long gid = -1; + long gid = HDF5Constants.H5I_INVALID_HID; try { gid = H5.H5Gopen(fid, name, HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { - gid = -1; + gid = HDF5Constants.H5I_INVALID_HID; err.printStackTrace(); fail("H5.H5Gcreate: " + err); } diff --git a/java/test/TestH5Lbasic.java b/java/test/TestH5Lbasic.java index bc4d65c..17da0ba 100644 --- a/java/test/TestH5Lbasic.java +++ b/java/test/TestH5Lbasic.java @@ -35,7 +35,7 @@ import org.junit.rules.TestName; public class TestH5Lbasic { @Rule public TestName testname = new TestName(); private static final String H5_FILE = "h5ex_g_iterateL1.hdf"; - long H5fid = -1; + long H5fid = HDF5Constants.H5I_INVALID_HID; @Before public void openH5file() diff --git a/java/test/TestH5Lcreate.java b/java/test/TestH5Lcreate.java index de29c1e..fedb18d 100644 --- a/java/test/TestH5Lcreate.java +++ b/java/test/TestH5Lcreate.java @@ -41,13 +41,13 @@ public class TestH5Lcreate { private static final String H5_FILE = "testL.h5"; private static final int DIM_X = 4; private static final int DIM_Y = 6; - long H5fcpl = -1; - long H5fid = -1; - long H5dsid = -1; - long H5did1 = -1; - long H5did2 = -1; - long H5gcpl = -1; - long H5gid = -1; + long H5fcpl = HDF5Constants.H5I_INVALID_HID; + long H5fid = HDF5Constants.H5I_INVALID_HID; + long H5dsid = HDF5Constants.H5I_INVALID_HID; + long H5did1 = HDF5Constants.H5I_INVALID_HID; + long H5did2 = HDF5Constants.H5I_INVALID_HID; + long H5gcpl = HDF5Constants.H5I_INVALID_HID; + long H5gid = HDF5Constants.H5I_INVALID_HID; long[] H5dims = { DIM_X, DIM_Y }; private final void _deleteFile(String filename) { @@ -64,7 +64,7 @@ public class TestH5Lcreate { } private final long _createDataset(long fid, long dsid, String name, long dapl) { - long did = -1; + long did = HDF5Constants.H5I_INVALID_HID; try { did = H5.H5Dcreate(fid, name, HDF5Constants.H5T_STD_I32BE, dsid, @@ -80,7 +80,7 @@ public class TestH5Lcreate { } private final long _createGroup(long fid, String name) { - long gid = -1; + long gid = HDF5Constants.H5I_INVALID_HID; try { H5gcpl = HDF5Constants.H5P_DEFAULT; gid = H5.H5Gcreate(fid, name, HDF5Constants.H5P_DEFAULT, diff --git a/java/test/TestH5Obasic.java b/java/test/TestH5Obasic.java index 89474c4..2ec13f3 100644 --- a/java/test/TestH5Obasic.java +++ b/java/test/TestH5Obasic.java @@ -41,7 +41,7 @@ public class TestH5Obasic { private static final String H5_FILE = "h5ex_g_iterateO1.hdf"; private static H5O_token_t H5la_ds1 = null; private static H5O_token_t H5la_l1 = null; - long H5fid = -1; + long H5fid = HDF5Constants.H5I_INVALID_HID; @Before public void openH5file() @@ -69,7 +69,7 @@ public class TestH5Obasic { @Test(expected = HDF5LibraryException.class) public void testH5Oopen_not_exists() throws Throwable { - long oid = -1; + long oid = HDF5Constants.H5I_INVALID_HID; oid = H5.H5Oopen(H5fid, "Never_created", HDF5Constants.H5P_DEFAULT); @@ -78,7 +78,7 @@ public class TestH5Obasic { @Test public void testH5Oget_info_dataset() { - long oid = -1; + long oid = HDF5Constants.H5I_INVALID_HID; H5O_info_t obj_info = null; try { @@ -96,7 +96,7 @@ public class TestH5Obasic { @Test public void testH5Oget_info_hardlink() { - long oid = -1; + long oid = HDF5Constants.H5I_INVALID_HID; H5O_info_t obj_info = null; try { oid = H5.H5Oopen(H5fid, "L1", HDF5Constants.H5P_DEFAULT); @@ -113,7 +113,7 @@ public class TestH5Obasic { @Test public void testH5Oget_info_group() { - long oid = -1; + long oid = HDF5Constants.H5I_INVALID_HID; H5O_info_t obj_info = null; try { oid = H5.H5Oopen(H5fid, "G1", HDF5Constants.H5P_DEFAULT); @@ -130,7 +130,7 @@ public class TestH5Obasic { @Test public void testH5Oget_info_datatype() { - long oid = -1; + long oid = HDF5Constants.H5I_INVALID_HID; H5O_info_t obj_info = null; try { oid = H5.H5Oopen(H5fid, "DT1", HDF5Constants.H5P_DEFAULT); @@ -234,7 +234,7 @@ public class TestH5Obasic { @Test public void testH5Oget_info_by_idx_n0() { - long oid = -1; + long oid = HDF5Constants.H5I_INVALID_HID; H5O_info_t obj_info = null; try { oid = H5.H5Oopen(H5fid, "DS1", HDF5Constants.H5P_DEFAULT); @@ -260,7 +260,7 @@ public class TestH5Obasic { @Test public void testH5Oget_info_by_idx_n3() { - long oid = -1; + long oid = HDF5Constants.H5I_INVALID_HID; H5O_info_t obj_info = null; try { oid = H5.H5Oopen(H5fid, "L1", HDF5Constants.H5P_DEFAULT); @@ -286,7 +286,7 @@ public class TestH5Obasic { @Test public void testH5Oget_native_info_dataset() { - long oid = -1; + long oid = HDF5Constants.H5I_INVALID_HID; H5O_native_info_t native_info = null; try { @@ -306,7 +306,7 @@ public class TestH5Obasic { @Test public void testH5Oget_native_info_hardlink() { - long oid = -1; + long oid = HDF5Constants.H5I_INVALID_HID; H5O_native_info_t native_info = null; try { @@ -326,7 +326,7 @@ public class TestH5Obasic { @Test public void testH5Oget_native_info_group() { - long oid = -1; + long oid = HDF5Constants.H5I_INVALID_HID; H5O_native_info_t native_info = null; try { @@ -346,7 +346,7 @@ public class TestH5Obasic { @Test public void testH5Oget_native_info_datatype() { - long oid = -1; + long oid = HDF5Constants.H5I_INVALID_HID; H5O_native_info_t native_info = null; try { @@ -464,7 +464,7 @@ public class TestH5Obasic { @Test public void testH5Oget_native_info_by_idx_n0() { - long oid = -1; + long oid = HDF5Constants.H5I_INVALID_HID; H5O_native_info_t native_info = null; H5O_hdr_info_t ohdr; H5_ih_info_t oinfo; @@ -503,7 +503,7 @@ public class TestH5Obasic { @Test public void testH5Oget_native_info_by_idx_n3() { - long oid = -1; + long oid = HDF5Constants.H5I_INVALID_HID; H5O_native_info_t native_info = null; H5O_hdr_info_t ohdr; H5_ih_info_t oinfo; @@ -630,7 +630,7 @@ public class TestH5Obasic { @Test public void testH5Oopen_by_token() { - long oid = -1; + long oid = HDF5Constants.H5I_INVALID_HID; H5O_info_t obj_info = null; try { try { @@ -668,7 +668,7 @@ public class TestH5Obasic { @Test public void testH5Oopen_by_idx_n0() { - long oid = -1; + long oid = HDF5Constants.H5I_INVALID_HID; H5O_info_t obj_info = null; try { try { @@ -706,7 +706,7 @@ public class TestH5Obasic { @Test public void testH5Oopen_by_idx_n3() { - long oid = -1; + long oid = HDF5Constants.H5I_INVALID_HID; H5O_info_t obj_info = null; try { try { diff --git a/java/test/TestH5Ocopy.java b/java/test/TestH5Ocopy.java index 4888e76..8948115 100644 --- a/java/test/TestH5Ocopy.java +++ b/java/test/TestH5Ocopy.java @@ -36,13 +36,13 @@ public class TestH5Ocopy { private static final String FILENAME = "testRefsattribute.h5"; private static final int DIM_X = 4; private static final int DIM_Y = 6; - long H5fid = -1; - long H5dsid = -1; - long H5did1 = -1; - long H5did2 = -1; - long H5gcpl = -1; - long H5gid = -1; - long H5dsid2 = -1; + long H5fid = HDF5Constants.H5I_INVALID_HID; + long H5dsid = HDF5Constants.H5I_INVALID_HID; + long H5did1 = HDF5Constants.H5I_INVALID_HID; + long H5did2 = HDF5Constants.H5I_INVALID_HID; + long H5gcpl = HDF5Constants.H5I_INVALID_HID; + long H5gid = HDF5Constants.H5I_INVALID_HID; + long H5dsid2 = HDF5Constants.H5I_INVALID_HID; long[] dims = { 2 }; private final void _deleteFile(String filename) { @@ -59,7 +59,7 @@ public class TestH5Ocopy { } private final long _createDataset(long fid, long dsid, String name, long dapl) { - long did = -1; + long did = HDF5Constants.H5I_INVALID_HID; try { did = H5.H5Dcreate(fid, name, HDF5Constants.H5T_STD_I32BE, dsid, @@ -75,7 +75,7 @@ public class TestH5Ocopy { } private final long _createGroup(long fid, String name) { - long gid = -1; + long gid = HDF5Constants.H5I_INVALID_HID; try { H5gcpl = HDF5Constants.H5P_DEFAULT; gid = H5.H5Gcreate(fid, name, HDF5Constants.H5P_DEFAULT, @@ -136,10 +136,10 @@ public class TestH5Ocopy { @Test public void testH5OcopyRefsAttr() { - long ocp_plist_id = -1; + long ocp_plist_id = HDF5Constants.H5I_INVALID_HID; byte rbuf0[]=null , rbuf1[] = null; byte[] dset_data = new byte[16]; - long attribute_id = -1; + long attribute_id = HDF5Constants.H5I_INVALID_HID; try { @@ -184,9 +184,9 @@ public class TestH5Ocopy { public void testH5OcopyRefsDatasettodiffFile() { byte rbuf1[] = null; byte[] dset_data = new byte[16]; - long ocp_plist_id = -1; - long dataset_id = -1; - long H5fid2 = -1; + long ocp_plist_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; + long H5fid2 = HDF5Constants.H5I_INVALID_HID; try { rbuf1 = H5.H5Rcreate(H5fid, "DS2", HDF5Constants.H5R_OBJECT, -1); @@ -244,9 +244,9 @@ public class TestH5Ocopy { public void testH5OcopyRefsDatasettosameFile() { byte rbuf0[]=null , rbuf1[] = null; byte[] dset_data = new byte[16]; - long ocp_plist_id = -1; - long dataset_id = -1; - long did = -1; + long ocp_plist_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; + long did = HDF5Constants.H5I_INVALID_HID; int obj_type = -1; byte[] read_data = new byte[16]; @@ -328,9 +328,9 @@ public class TestH5Ocopy { // @Test(expected = HDF5LibraryException.class) // public void testH5OcopyInvalidRef() throws Throwable { // final long _pid_ = HDF5Constants.H5P_DEFAULT; -// long sid = -1; -// long did = -1; -// long aid = -1; +// long sid = HDF5Constants.H5I_INVALID_HID; +// long did = HDF5Constants.H5I_INVALID_HID; +// long aid = HDF5Constants.H5I_INVALID_HID; // // try { // sid = H5.H5Screate_simple(1, new long[] {1}, null); diff --git a/java/test/TestH5Ocreate.java b/java/test/TestH5Ocreate.java index 959e990..797b665 100644 --- a/java/test/TestH5Ocreate.java +++ b/java/test/TestH5Ocreate.java @@ -41,13 +41,13 @@ public class TestH5Ocreate { private static final String H5_FILE = "testO.h5"; private static final int DIM_X = 4; private static final int DIM_Y = 6; - long H5fcpl = -1; - long H5fid = -1; - long H5dsid = -1; - long H5did1 = -1; - long H5did2 = -1; - long H5gcpl = -1; - long H5gid = -1; + long H5fcpl = HDF5Constants.H5I_INVALID_HID; + long H5fid = HDF5Constants.H5I_INVALID_HID; + long H5dsid = HDF5Constants.H5I_INVALID_HID; + long H5did1 = HDF5Constants.H5I_INVALID_HID; + long H5did2 = HDF5Constants.H5I_INVALID_HID; + long H5gcpl = HDF5Constants.H5I_INVALID_HID; + long H5gid = HDF5Constants.H5I_INVALID_HID; long[] H5dims = { DIM_X, DIM_Y }; private final void _deleteFile(String filename) { @@ -64,7 +64,7 @@ public class TestH5Ocreate { } private final long _createDataset(long fid, long dsid, String name, long dapl) { - long did = -1; + long did = HDF5Constants.H5I_INVALID_HID; try { did = H5.H5Dcreate(fid, name, HDF5Constants.H5T_STD_I32BE, dsid, @@ -80,7 +80,7 @@ public class TestH5Ocreate { } private final long _createGroup(long fid, String name) { - long gid = -1; + long gid = HDF5Constants.H5I_INVALID_HID; try { H5gcpl = HDF5Constants.H5P_DEFAULT; gid = H5.H5Gcreate(fid, name, HDF5Constants.H5P_DEFAULT, @@ -293,7 +293,7 @@ public class TestH5Ocreate { @Test public void testH5Olink() { - long oid = -1; + long oid = HDF5Constants.H5I_INVALID_HID; H5O_info_t obj_info = null; H5O_info_t dst_obj_info = null; try { @@ -380,7 +380,7 @@ public class TestH5Ocreate { @Test public void testH5Ocomment() { - long oid = -1; + long oid = HDF5Constants.H5I_INVALID_HID; String obj_comment = null; try { oid = H5.H5Oopen(H5fid, "DS1", HDF5Constants.H5P_DEFAULT); @@ -405,7 +405,7 @@ public class TestH5Ocreate { @Test public void testH5Ocomment_clear() { - long oid = -1; + long oid = HDF5Constants.H5I_INVALID_HID; String obj_comment = null; try { oid = H5.H5Oopen(H5fid, "DS1", HDF5Constants.H5P_DEFAULT); @@ -506,7 +506,7 @@ public class TestH5Ocreate { @Test public void testH5Oinc_dec_count() { - long oid = -1; + long oid = HDF5Constants.H5I_INVALID_HID; H5O_info_t obj_info = null; try { try { diff --git a/java/test/TestH5P.java b/java/test/TestH5P.java index 786c330..34bd5a9 100644 --- a/java/test/TestH5P.java +++ b/java/test/TestH5P.java @@ -41,20 +41,20 @@ public class TestH5P { private static final int DIM_X = 4; private static final int DIM_Y = 6; long[] H5dims = { DIM_X, DIM_Y }; - long H5fid = -1; - long H5dsid = -1; - long H5did = -1; - long lapl_id = -1; - long fapl_id = -1; - long fcpl_id = -1; - long ocpl_id = -1; - long ocp_plist_id = -1; - long lcpl_id = -1; - long plapl_id = -1; - long plist_id = -1; - long gapl_id = -1; - long gcpl_id = -1; - long acpl_id = -1; + long H5fid = HDF5Constants.H5I_INVALID_HID; + long H5dsid = HDF5Constants.H5I_INVALID_HID; + long H5did = HDF5Constants.H5I_INVALID_HID; + long lapl_id = HDF5Constants.H5I_INVALID_HID; + long fapl_id = HDF5Constants.H5I_INVALID_HID; + long fcpl_id = HDF5Constants.H5I_INVALID_HID; + long ocpl_id = HDF5Constants.H5I_INVALID_HID; + long ocp_plist_id = HDF5Constants.H5I_INVALID_HID; + long lcpl_id = HDF5Constants.H5I_INVALID_HID; + long plapl_id = HDF5Constants.H5I_INVALID_HID; + long plist_id = HDF5Constants.H5I_INVALID_HID; + long gapl_id = HDF5Constants.H5I_INVALID_HID; + long gcpl_id = HDF5Constants.H5I_INVALID_HID; + long acpl_id = HDF5Constants.H5I_INVALID_HID; private final void _deleteFile(String filename) { File file = new File(filename); @@ -65,7 +65,7 @@ public class TestH5P { } private final long _createDataset(long fid, long dsid, String name, long dapl) { - long did = -1; + long did = HDF5Constants.H5I_INVALID_HID; try { did = H5.H5Dcreate(fid, name, HDF5Constants.H5T_STD_I32BE, dsid, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, dapl); diff --git a/java/test/TestH5PData.java b/java/test/TestH5PData.java index 82864cd..095f8d0 100644 --- a/java/test/TestH5PData.java +++ b/java/test/TestH5PData.java @@ -37,10 +37,10 @@ public class TestH5PData { private static final String H5_FILE = "testPD.h5"; private static final int DIM_X = 12; private static final int DIM_Y = 18; - long H5fid = -1; - long H5dsid = -1; - long H5did = -1; - long plist_id = -1; + long H5fid = HDF5Constants.H5I_INVALID_HID; + long H5dsid = HDF5Constants.H5I_INVALID_HID; + long H5did = HDF5Constants.H5I_INVALID_HID; + long plist_id = HDF5Constants.H5I_INVALID_HID; long[] H5dims = { DIM_X, DIM_Y }; double windchillF[][] = {{36.0, 31.0, 25.0, 19.0, 13.0, 7.0, 1.0, -5.0, -11.0, -16.0, -22.0, -28.0, -34.0, -40.0, -46.0, -52.0, -57.0, -63.0}, @@ -66,7 +66,7 @@ public class TestH5PData { } private final long _createFloatDataset(long fid, long dsid, String name, long dapl) { - long did = -1; + long did = HDF5Constants.H5I_INVALID_HID; try { did = H5.H5Dcreate(fid, name, HDF5Constants.H5T_NATIVE_FLOAT, dsid, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, dapl); diff --git a/java/test/TestH5PL.java b/java/test/TestH5PL.java index 98665dc..3481924 100644 --- a/java/test/TestH5PL.java +++ b/java/test/TestH5PL.java @@ -147,11 +147,11 @@ public class TestH5PL { @Ignore public void TestH5PLdlopen() { - long file_id = -1; - long filespace_id = -1; - long dataset_id = -1; - long fapl_id = -1; - long dcpl_id = -1; + long file_id = HDF5Constants.H5I_INVALID_HID; + long filespace_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; + long fapl_id = HDF5Constants.H5I_INVALID_HID; + long dcpl_id = HDF5Constants.H5I_INVALID_HID; try { int[] cd_values = {9, 0, 0, 0}; int[] libversion = {0, 0, 0}; diff --git a/java/test/TestH5Pfapl.java b/java/test/TestH5Pfapl.java index d5d0901..e265020 100644 --- a/java/test/TestH5Pfapl.java +++ b/java/test/TestH5Pfapl.java @@ -47,17 +47,17 @@ public class TestH5Pfapl { private static final int DIM_Y = 6; private static final int DIMF_X = 12; private static final int DIMF_Y = 18; - long H5fid = -1; - long H5dsid = -1; - long H5did = -1; - long H5Fdsid = -1; - long H5Fdid = -1; + long H5fid = HDF5Constants.H5I_INVALID_HID; + long H5dsid = HDF5Constants.H5I_INVALID_HID; + long H5did = HDF5Constants.H5I_INVALID_HID; + long H5Fdsid = HDF5Constants.H5I_INVALID_HID; + long H5Fdid = HDF5Constants.H5I_INVALID_HID; long[] H5dims = { DIM_X, DIM_Y }; - long fapl_id = -1; - long plapl_id = -1; - long dapl_id = -1; - long plist_id = -1; - long btplist_id = -1; + long fapl_id = HDF5Constants.H5I_INVALID_HID; + long plapl_id = HDF5Constants.H5I_INVALID_HID; + long dapl_id = HDF5Constants.H5I_INVALID_HID; + long plist_id = HDF5Constants.H5I_INVALID_HID; + long btplist_id = HDF5Constants.H5I_INVALID_HID; long[] H5Fdims = { DIMF_X, DIMF_Y }; double windchillF[][] = {{36.0, 31.0, 25.0, 19.0, 13.0, 7.0, 1.0, -5.0, -11.0, -16.0, -22.0, -28.0, -34.0, -40.0, -46.0, -52.0, -57.0, -63.0}, @@ -130,7 +130,7 @@ public class TestH5Pfapl { } private final long _createDataset(long fid, long dsid, String name, long dapl) { - long did = -1; + long did = HDF5Constants.H5I_INVALID_HID; try { did = H5.H5Dcreate(fid, name, HDF5Constants.H5T_STD_I32BE, dsid, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, dapl); @@ -385,7 +385,7 @@ public class TestH5Pfapl { @Test public void testH5Pget_elink_fapl() { - long ret_val_id = -1; + long ret_val_id = HDF5Constants.H5I_INVALID_HID; try { ret_val_id = H5.H5Pget_elink_fapl(plapl_id); assertTrue("H5Pget_elink_fapl", ret_val_id >= 0); @@ -403,7 +403,7 @@ public class TestH5Pfapl { @Test public void testH5P_elink_fapl() { - long ret_val_id = -1; + long ret_val_id = HDF5Constants.H5I_INVALID_HID; try { H5.H5Pset_elink_fapl(plapl_id, fapl_id ); ret_val_id = H5.H5Pget_elink_fapl(plapl_id); @@ -421,7 +421,7 @@ public class TestH5Pfapl { @Test public void testH5P_elink_file_cache_size() { - long elink_fapl_id = -1; + long elink_fapl_id = HDF5Constants.H5I_INVALID_HID; int efc_size = 0; try { H5.H5Pset_elink_fapl(plapl_id, fapl_id ); diff --git a/java/test/TestH5Pfaplhdfs.java b/java/test/TestH5Pfaplhdfs.java index 398a4d4..5ba8946 100644 --- a/java/test/TestH5Pfaplhdfs.java +++ b/java/test/TestH5Pfaplhdfs.java @@ -34,11 +34,11 @@ import org.junit.rules.TestName; public class TestH5Pfaplhdfs { @Rule public TestName testname = new TestName(); - long fapl_id = -1; - long plapl_id = -1; - long dapl_id = -1; - long plist_id = -1; - long btplist_id = -1; + long fapl_id = HDF5Constants.H5I_INVALID_HID; + long plapl_id = HDF5Constants.H5I_INVALID_HID; + long dapl_id = HDF5Constants.H5I_INVALID_HID; + long plist_id = HDF5Constants.H5I_INVALID_HID; + long btplist_id = HDF5Constants.H5I_INVALID_HID; @Before public void createFileAccess() throws NullPointerException, HDF5Exception diff --git a/java/test/TestH5Pfapls3.java b/java/test/TestH5Pfapls3.java index a55856c..7f39a6a 100644 --- a/java/test/TestH5Pfapls3.java +++ b/java/test/TestH5Pfapls3.java @@ -34,11 +34,11 @@ import org.junit.rules.TestName; public class TestH5Pfapls3 { @Rule public TestName testname = new TestName(); - long fapl_id = -1; - long plapl_id = -1; - long dapl_id = -1; - long plist_id = -1; - long btplist_id = -1; + long fapl_id = HDF5Constants.H5I_INVALID_HID; + long plapl_id = HDF5Constants.H5I_INVALID_HID; + long dapl_id = HDF5Constants.H5I_INVALID_HID; + long plist_id = HDF5Constants.H5I_INVALID_HID; + long btplist_id = HDF5Constants.H5I_INVALID_HID; @Before public void createFileAccess() throws NullPointerException, HDF5Exception diff --git a/java/test/TestH5Plist.java b/java/test/TestH5Plist.java index 7c43693..825eeb4 100644 --- a/java/test/TestH5Plist.java +++ b/java/test/TestH5Plist.java @@ -85,7 +85,7 @@ public class TestH5Plist { PROP3_NAME, PROP4_NAME}; - long plist_class_id = -1; + long plist_class_id = HDF5Constants.H5I_INVALID_HID; @Before public void createPropClass()throws NullPointerException, HDF5Exception @@ -114,9 +114,9 @@ public class TestH5Plist { @Test public void testH5P_genprop_basic_class() { int status = -1; - long cid1 = -1; // Generic Property class ID - long cid2 = -1; // Generic Property class ID - long cid3 = -1; // Generic Property class ID + long cid1 = HDF5Constants.H5I_INVALID_HID; // Generic Property class ID + long cid2 = HDF5Constants.H5I_INVALID_HID; // Generic Property class ID + long cid3 = HDF5Constants.H5I_INVALID_HID; // Generic Property class ID String name = null; // Name of class try { @@ -162,7 +162,7 @@ public class TestH5Plist { // Close parent class try { H5.H5Pclose_class(cid2); - cid2 = -1; + cid2 = HDF5Constants.H5I_INVALID_HID; } catch (Throwable err) { err.printStackTrace(); @@ -172,7 +172,7 @@ public class TestH5Plist { // Close class try { H5.H5Pclose_class(plist_class_id); - plist_class_id = -1; + plist_class_id = HDF5Constants.H5I_INVALID_HID; } catch (Throwable err) { err.printStackTrace(); @@ -242,7 +242,7 @@ public class TestH5Plist { // Close parent class's parent try { H5.H5Pclose_class(cid3); - cid3 = -1; + cid3 = HDF5Constants.H5I_INVALID_HID; } catch (Throwable err) { err.printStackTrace(); @@ -252,7 +252,7 @@ public class TestH5Plist { // Close parent class's parent try { H5.H5Pclose_class(cid2); - cid2 = -1; + cid2 = HDF5Constants.H5I_INVALID_HID; } catch (Throwable err) { err.printStackTrace(); @@ -262,7 +262,7 @@ public class TestH5Plist { // Close parent class's parent try { H5.H5Pclose_class(cid1); - cid1 = -1; + cid1 = HDF5Constants.H5I_INVALID_HID; } catch (Throwable err) { err.printStackTrace(); @@ -634,7 +634,7 @@ public class TestH5Plist { @Test public void testH5P_genprop_basic_list_prop() { boolean status = false; - long lid1 = -1; // Generic Property list ID + long lid1 = HDF5Constants.H5I_INVALID_HID; // Generic Property list ID long nprops = -1; // Number of properties in class try { @@ -760,7 +760,7 @@ public class TestH5Plist { // @Test // public void testH5P_genprop_class_callback() { // class cdata { -// public long cls_id = -1; +// public long cls_id = HDF5Constants.H5I_INVALID_HID; // public int cls_count = -1; // cdata(long id, int count) { // this.cls_id = id; @@ -813,11 +813,11 @@ public class TestH5Plist { // } // H5P_cls_close_func_cb cls_close_cb = new H5P_cls_close_callback(); // -// long cid1 = -1; // Generic Property class ID -// long cid2 = -1; // Generic Property class ID -// long lid1 = -1; // Generic Property list ID -// long lid2 = -1; // Generic Property list ID -// long lid3 = -1; // Generic Property list ID +// long cid1 = HDF5Constants.H5I_INVALID_HID; // Generic Property class ID +// long cid2 = HDF5Constants.H5I_INVALID_HID; // Generic Property class ID +// long lid1 = HDF5Constants.H5I_INVALID_HID; // Generic Property list ID +// long lid2 = HDF5Constants.H5I_INVALID_HID; // Generic Property list ID +// long lid3 = HDF5Constants.H5I_INVALID_HID; // Generic Property list ID // long nprops = -1; // Number of properties in class // // try { diff --git a/java/test/TestH5Pvirtual.java b/java/test/TestH5Pvirtual.java index 4c9a763..30e761d 100644 --- a/java/test/TestH5Pvirtual.java +++ b/java/test/TestH5Pvirtual.java @@ -52,13 +52,13 @@ public class TestH5Pvirtual { private static final int fill_value = -1; long[] H5dims = { DIM_Y }; long[] VDSH5dims = { VDSDIM_X, VDSDIM_Y }; - long H5fid = -1; - long H5dsid = -1; - long H5dssid = -1; - long H5dvsid = -1; - long H5did = -1; - long H5dcplid = -1; - long H5dapl_id = -1; + long H5fid = HDF5Constants.H5I_INVALID_HID; + long H5dsid = HDF5Constants.H5I_INVALID_HID; + long H5dssid = HDF5Constants.H5I_INVALID_HID; + long H5dvsid = HDF5Constants.H5I_INVALID_HID; + long H5did = HDF5Constants.H5I_INVALID_HID; + long H5dcplid = HDF5Constants.H5I_INVALID_HID; + long H5dapl_id = HDF5Constants.H5I_INVALID_HID; private final void _deleteFile(String filename) { File file = new File(filename); @@ -69,8 +69,8 @@ public class TestH5Pvirtual { } private final long _createDataset(long fid, long dsid, String name, long dcpl, long dapl) { - long did = -1; - long space_id = -1; + long did = HDF5Constants.H5I_INVALID_HID; + long space_id = HDF5Constants.H5I_INVALID_HID; long[] start = {0, 0}; long[] stride = null; long[] count = {1, 1}; @@ -100,9 +100,9 @@ public class TestH5Pvirtual { int[] dset_data = new int[DIM_Y]; // Create source files and datasets for (int i=0; i < 3; i++) { - long space_id = -1; - long dset_id = -1; - long file_id = -1; + long space_id = HDF5Constants.H5I_INVALID_HID; + long dset_id = HDF5Constants.H5I_INVALID_HID; + long file_id = HDF5Constants.H5I_INVALID_HID; for (int j = 0; j < DIM_Y; j++) dset_data[j] = i+1; try { @@ -265,7 +265,7 @@ public class TestH5Pvirtual { @Test public void testH5Pget_selection_source_dataset() throws Throwable { - long src_space = -1; + long src_space = HDF5Constants.H5I_INVALID_HID; long src_selection = -1; H5did = _createDataset(H5fid, H5dsid, "VDS", H5dcplid, H5dapl_id); diff --git a/java/test/TestH5R.java b/java/test/TestH5R.java index a51c7b6..930f432 100644 --- a/java/test/TestH5R.java +++ b/java/test/TestH5R.java @@ -39,11 +39,11 @@ public class TestH5R { private static final String H5_FILE = "testH5R.h5"; private static final int DIM_X = 4; private static final int DIM_Y = 6; - long H5fid = -1; - long H5dsid = -1; - long H5did = -1; - long H5gid = -1; - long H5did2 = -1; + long H5fid = HDF5Constants.H5I_INVALID_HID; + long H5dsid = HDF5Constants.H5I_INVALID_HID; + long H5did = HDF5Constants.H5I_INVALID_HID; + long H5gid = HDF5Constants.H5I_INVALID_HID; + long H5did2 = HDF5Constants.H5I_INVALID_HID; long[] H5dims = { DIM_X, DIM_Y }; int[][] dset_data = new int[DIM_X][DIM_Y]; int FILLVAL = 99; @@ -62,7 +62,7 @@ public class TestH5R { } private final long _createDataset(long fid, long dsid, String name, long dapl) { - long did = -1; + long did = HDF5Constants.H5I_INVALID_HID; try { did = H5.H5Dcreate(fid, name, HDF5Constants.H5T_STD_I32BE, dsid, @@ -78,7 +78,7 @@ public class TestH5R { } private final long _createGroup(long fid, String name) { - long gid = -1; + long gid = HDF5Constants.H5I_INVALID_HID; try { gid = H5.H5Gcreate(fid, name, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); @@ -150,109 +150,6 @@ public class TestH5R { System.out.println(); } - // Test v1.8 APIs params - /* - * @Ignore public void testH5Rget_name() { long loc_id = H5fid; int ref_type = - * HDF5Constants.H5R_OBJECT; long ret_val = -1; byte[] ref = null; String[] name = {""}; String - * objName = "/dset"; - * - * try { ref = H5.H5Rcreate(H5fid, objName, ref_type, -1); } catch (Throwable err) { - * err.printStackTrace(); fail("H5.H5Rget_name:H5Rcreate " + err); } - * - * try { ret_val = H5.H5Rget_name(loc_id, ref_type, ref, name, 16); } catch (Throwable err) { - * err.printStackTrace(); fail("H5.H5Rget_name: " + err); } - * - * assertTrue("testH5Rget_name: H5Rget_name", ret_val>0); assertTrue("The name of the object: ", - * objName.equals(name[0])); } - * - * @Ignore public void testH5Rget_obj_type2() { int ref_type=HDF5Constants.H5R_OBJECT; byte[] - * ref=null; - * - * String objName = "/dset"; int obj_type = -1; - * - * try { ref = H5.H5Rcreate(H5fid, objName, ref_type, -1); } catch(Throwable err) { - * err.printStackTrace(); } - * - * try { obj_type = H5.H5Rget_obj_type(H5fid, HDF5Constants.H5R_OBJECT, ref); } catch (Throwable - * err) { err.printStackTrace(); fail("H5.H5Rget_obj_type2: " + err); } assertEquals(obj_type, - * HDF5Constants.H5O_TYPE_DATASET); } - * - * @Ignore public void testH5Rcreate_refobj() { byte[] ref = null; - * - * try { ref = H5.H5Rcreate(H5fid, "/dset", HDF5Constants.H5R_OBJECT, -1); } catch (Throwable err) { - * err.printStackTrace(); fail("H5.H5Rcreate: " + err); } assertNotNull(ref); } - * - * @Ignore public void testH5Rcreate_regionrefobj() { byte[] ref = null; try { ref = - * H5.H5Rcreate(H5fid, "/dset", HDF5Constants.H5R_DATASET_REGION, H5dsid); } catch (Throwable err) { - * err.printStackTrace(); fail("H5.H5Rcreate: " + err); } assertNotNull(ref); } - * - * @Ignore public void testH5Rdereference() { byte[] ref1 = null; byte[] ref2 = null; long - * dataset_id = -1; long group_id = -1; try { //Create reference on dataset ref1 = - * H5.H5Rcreate(H5fid, "/dset", HDF5Constants.H5R_DATASET_REGION, H5dsid); dataset_id= - * H5.H5Rdereference(H5fid, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5R_DATASET_REGION, ref1); - * - * //Create reference on group ref2 = H5.H5Rcreate(H5gid, "/Group1", HDF5Constants.H5R_OBJECT, -1); - * group_id= H5.H5Rdereference(H5gid, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5R_OBJECT, ref2); - * assertNotNull(ref1); assertNotNull(ref2); assertTrue(dataset_id >= 0); assertTrue(group_id >= 0); - * } catch (Throwable err) { err.printStackTrace(); fail("TestH5Rdereference " + err); } finally { - * try {H5.H5Dclose(dataset_id);} catch (Exception ex) {} try {H5.H5Gclose(group_id);} catch - * (Exception ex) {} } } - * - * @Ignore public void testH5Rget_region() { byte[] ref = null; long dsid = -1; try { ref = - * H5.H5Rcreate(H5fid, "/dset", HDF5Constants.H5R_DATASET_REGION, H5dsid); dsid = - * H5.H5Rget_region(H5fid, HDF5Constants.H5R_DATASET_REGION, ref); assertNotNull(ref); - * assertTrue(dsid >= 0); } catch (Throwable err) { err.printStackTrace(); - * fail("TestH5Rget_region: " + err); } finally { try {H5.H5Sclose(dsid);} catch (Exception ex) {} } - * } - * - * @Ignore//(expected = IllegalArgumentException.class) public void testH5Rget_name_Invalidreftype() - * throws Throwable { byte[] ref = null; String[] name = {""}; ref = H5.H5Rcreate(H5fid, "/dset", - * HDF5Constants.H5R_OBJECT, -1); H5.H5Rget_name(H5fid, HDF5Constants.H5R_DATASET_REGION, ref, name, - * 16); } - * - * @Ignore//(expected = NullPointerException.class) public void testH5Rget_name_NULLreference() - * throws Throwable { byte[] ref = null; String[] name = {""}; H5.H5Rget_name(H5fid, - * HDF5Constants.H5R_OBJECT, ref, name, 16); } - * - * @Ignore//(expected = HDF5LibraryException.class) public void - * testH5Rget_obj_type2_Invalidreftype() throws Throwable { byte[] ref = null; ref = - * H5.H5Rcreate(H5fid, "/dset", HDF5Constants.H5R_OBJECT, -1); H5.H5Rget_obj_type(H5fid, - * HDF5Constants.H5R_DATASET_REGION, ref); } - * - * @Ignore//(expected = HDF5LibraryException.class) public void testH5Rcreate_InvalidObjectName() - * throws Throwable { byte[] ref=H5.H5Rcreate(H5fid, "/GROUPS", HDF5Constants.H5R_OBJECT, -1); } - * - * @Ignore//(expected = HDF5LibraryException.class) public void testH5Rcreate_Invalidspace_id() - * throws Throwable { byte[] ref=H5.H5Rcreate(H5fid, "/dset", HDF5Constants.H5R_DATASET_REGION, -1); - * } - * - * @Ignore//(expected = IllegalArgumentException.class) public void testH5Rcreate_Invalidreftype() - * throws Throwable { byte[] ref=H5.H5Rcreate(H5fid, "/dset", HDF5Constants.H5R_BADTYPE, -1); } - * - * @Ignore//(expected = IllegalArgumentException.class) public void - * testH5Rgetregion_Invalidreftype() throws Throwable { byte[] ref = null; ref = H5.H5Rcreate(H5fid, - * "/dset", HDF5Constants.H5R_OBJECT, H5dsid); H5.H5Rget_region(H5fid, - * HDF5Constants.H5R_DATASET_REGION, ref); } - * - * @Ignore//(expected = IllegalArgumentException.class) public void - * testH5Rgetregion_Badreferencetype() throws Throwable { byte[] ref = null; ref = - * H5.H5Rcreate(H5fid, "/dset", HDF5Constants.H5R_OBJECT, H5dsid); H5.H5Rget_region(H5fid, - * HDF5Constants.H5R_OBJECT, ref); } - * - * @Ignore//(expected = NullPointerException.class) public void testH5Rgetregion_Nullreference() - * throws Throwable { byte[] ref = null; H5.H5Rget_region(H5fid, HDF5Constants.H5R_DATASET_REGION, - * ref); } - * - * @Ignore//(expected = NullPointerException.class) public void testH5Rdereference_Nullreference() - * throws Throwable { byte[] ref = null; H5.H5Rdereference(H5did2, HDF5Constants.H5P_DEFAULT, - * HDF5Constants.H5R_OBJECT, ref); } - * - * @Ignore//(expected = IllegalArgumentException.class) public void - * testH5Rdereference_Invalidreference() throws Throwable { byte[] ref1 = null; byte[] ref2 = null; - * ref1 = H5.H5Rcreate(H5fid, "/dset", HDF5Constants.H5R_DATASET_REGION, H5dsid); ref2 = - * H5.H5Rcreate(H5gid, "/Group1", HDF5Constants.H5R_OBJECT, -1); H5.H5Rdereference(H5gid, - * HDF5Constants.H5P_DEFAULT, HDF5Constants.H5R_OBJECT, ref1); } - */ // Test v1.12 APIs params @Test diff --git a/java/test/TestH5Rref.java b/java/test/TestH5Rref.java new file mode 100644 index 0000000..aeec64f --- /dev/null +++ b/java/test/TestH5Rref.java @@ -0,0 +1,561 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * distribution tree, or in https://www.hdfgroup.org/licenses. * + * If you do not have access to either file, you may request a copy from * + * help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.io.File; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; +import hdf.hdf5lib.exceptions.HDF5Exception; +import hdf.hdf5lib.exceptions.HDF5LibraryException; +import hdf.hdf5lib.exceptions.HDF5FunctionArgumentException; + +import org.junit.After; +import org.junit.Before; +import org.junit.Ignore; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestName; + +public class TestH5Rref { + @Rule public TestName testname = new TestName(); + private static final String H5_DREG_FILE = "trefer_reg.h5"; + private static final String H5_AREG_FILE = "trefer_attr.h5"; + long H5fid = HDF5Constants.H5I_INVALID_HID; + long H5dsid = HDF5Constants.H5I_INVALID_HID; + long H5did = HDF5Constants.H5I_INVALID_HID; + + private boolean byteArrayCheck(final byte[] array) { + for (byte b : array) { + if (b != 0) { + return false; + } + } + return true; + } + + public void openH5file(String filename, String dsetname) { + try { + H5fid = H5.H5Fopen(filename, + HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("TestH5R._openH5file: " + err); + } + assertTrue("TestH5R._openH5file: H5.H5Fopen: ", H5fid >= 0); + try { + H5did = H5.H5Dopen(H5fid, dsetname, HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("TestH5R._openH5file: " + err); + } + assertTrue("TestH5R._openH5file: H5.H5Dopen: ", H5did >= 0); + try { + H5dsid = H5.H5Dget_space(H5did); + } + catch (Throwable err) { + err.printStackTrace(); + fail("TestH5R._openH5file: " + err); + } + assertTrue("TestH5R._openH5file: H5.H5Screate_simple: ",H5dsid > 0); + } + + @After + public void closeH5file() throws HDF5LibraryException { + if (H5did >= 0) + try {H5.H5Dclose(H5did);} catch (Exception ex) {} + if (H5dsid > 0) + try {H5.H5Sclose(H5dsid);} catch (Exception ex) {} + if (H5fid > 0) + try {H5.H5Fclose(H5fid);} catch (Exception ex) {} + H5fid = HDF5Constants.H5I_INVALID_HID; + H5dsid = HDF5Constants.H5I_INVALID_HID; + H5did = HDF5Constants.H5I_INVALID_HID; + System.out.println(); + } + + @Before + public void verifyCount() + throws NullPointerException, HDF5Exception { + assertTrue("H5 open ids is 0", H5.getOpenIDCount()==0); + System.out.print(testname.getMethodName()); + } + + // Test v1.12 APIs params + + @Test + public void testH5Rget_object() { + int ref_type = HDF5Constants.H5R_OBJECT1; + long f_type = HDF5Constants.H5I_INVALID_HID; + int obj_type = -1; + int ndims = 1; + long ret_val = -1; + byte[][] refbuf = null; + String name = ""; + String objName = "/DS_NA"; + + try { + openH5file(H5_DREG_FILE, objName); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Rget_object: openH5file: " + err); + } + try { + f_type = H5.H5Dget_type(H5did); + int result = H5.H5Tget_class(f_type); + assertTrue("testH5Rget_object: H5Tget_class", result > 0); + String class_name = H5.H5Tget_class_name(result); + assertTrue("testH5Rget_object: H5Tget_class", class_name.compareTo("H5T_REFERENCE")==0); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Rget_object: " + err); + } + finally { + try {H5.H5Tclose(f_type);} catch (Exception ex) {} + } + try { + ndims = H5.H5Sget_simple_extent_ndims(H5dsid); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Rget_object: H5Sget_simple_extent_ndims: " + err); + } + refbuf = new byte[ndims][HDF5Constants.H5R_REF_BUF_SIZE]; + // Read the reference from the dataset. + try { + H5.H5Dread(H5did, HDF5Constants.H5T_STD_REF, + HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, refbuf); + } + catch (Exception err) { + err.printStackTrace(); + fail("testH5Rget_object: H5Dread: " + err); + } + + for (int i = 0; i < ndims; i++) { + try { + ret_val = H5.H5Rget_type(refbuf[i]); + assertTrue("testH5Rget_object: H5Rget_type["+i+"]="+ret_val, ret_val == ref_type); + if (!byteArrayCheck(refbuf[i])) { + try { + obj_type = H5.H5Rget_obj_type3(refbuf[i], HDF5Constants.H5P_DEFAULT); + assertEquals(obj_type, HDF5Constants.H5O_TYPE_DATASET); + } + catch (Throwable err2) { + err2.printStackTrace(); + fail("testH5Rget_object: H5.H5Rget_obj_type3: " + err2); + } + } + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Rget_object: H5Rget_type: " + err); + } + finally { + H5.H5Rdestroy(refbuf[i]); + } + } + } + + @Test + public void testH5Rget_obj_type3() { + long f_type = HDF5Constants.H5I_INVALID_HID; + int ref_type = HDF5Constants.H5R_DATASET_REGION2; + int obj_type = -1; + int ndims = 1; + long ret_val = -1; + byte[][] refbuf = null; + String objName = "/Dataset1"; + + try { + openH5file(H5_DREG_FILE, objName); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Rget_obj_type3: openH5file: " + err); + } + try { + f_type = H5.H5Dget_type(H5did); + int result = H5.H5Tget_class(f_type); + assertTrue("testH5Rget_obj_type3: H5Tget_class", result > 0); + String class_name = H5.H5Tget_class_name(result); + assertTrue("testH5Rget_obj_type3: H5Tget_class="+class_name, class_name.compareTo("H5T_REFERENCE")==0); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Rget_obj_type3: " + err); + } + finally { + try {H5.H5Tclose(f_type);} catch (Exception ex) {} + } + try { + ndims = H5.H5Sget_simple_extent_ndims(H5dsid); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Rget_obj_type3: H5Sget_simple_extent_ndims: " + err); + } + refbuf = new byte[ndims][HDF5Constants.H5R_REF_BUF_SIZE]; + // Read the reference from the dataset. + try { + H5.H5Dread(H5did, HDF5Constants.H5T_STD_REF, + HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, refbuf); + } + catch (Exception err) { + err.printStackTrace(); + fail("testH5Rget_obj_type3: H5Dread: " + err); + } + + for (int i = 0; i < ndims; i++) { + try { + ret_val = H5.H5Rget_type(refbuf[i]); + assertTrue("testH5Rget_obj_type3: H5Rget_type["+i+"]="+ret_val, ret_val == ref_type); + if (!byteArrayCheck(refbuf[i])) { + try { + obj_type = H5.H5Rget_obj_type3(refbuf[i], HDF5Constants.H5P_DEFAULT); + assertEquals(obj_type, HDF5Constants.H5O_TYPE_DATASET); + } + catch (Throwable err2) { + err2.printStackTrace(); + fail("testH5Rget_obj_type3: H5.H5Rget_obj_type3: " + err2); + } + } + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Rget_obj_type3: H5Rget_type: " + err); + } + finally { + H5.H5Rdestroy(refbuf[i]); + } + } + } + + @Test + public void testH5Rget_region_dataset() { + long f_type = HDF5Constants.H5I_INVALID_HID; + long loc_id = HDF5Constants.H5I_INVALID_HID; + long loc_sid = HDF5Constants.H5I_INVALID_HID; + int ref_type = HDF5Constants.H5R_DATASET_REGION2; + int ndims = 1; + long ret_val = -1; + byte[][] refbuf = null; + String name = ""; + String objName = "/Dataset1"; + + try { + openH5file(H5_DREG_FILE, objName); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Rget_region_dataset: openH5file: " + err); + } + try { + f_type = H5.H5Dget_type(H5did); + int result = H5.H5Tget_class(f_type); + assertTrue("testH5Rget_region_dataset: H5Tget_class", result > 0); + String class_name = H5.H5Tget_class_name(result); + assertTrue("testH5Rget_region_dataset: H5Tget_class="+class_name, class_name.compareTo("H5T_REFERENCE")==0); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Rget_region_dataset: " + err); + } + finally { + try {H5.H5Tclose(f_type);} catch (Exception ex) {} + } + try { + ndims = H5.H5Sget_simple_extent_ndims(H5dsid); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Rget_region_dataset: H5Sget_simple_extent_ndims: " + err); + } + refbuf = new byte[ndims][HDF5Constants.H5R_REF_BUF_SIZE]; + // Read the reference from the dataset. + try { + H5.H5Dread(H5did, HDF5Constants.H5T_STD_REF, + HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, refbuf); + } + catch (Exception err) { + err.printStackTrace(); + fail("testH5Rget_obj_type3: H5Dread: " + err); + } + for (int i = 0; i < ndims; i++) { + try { + ret_val = H5.H5Rget_type(refbuf[i]); + assertTrue("testH5Rget_region_dataset: H5Rget_type["+i+"]="+ret_val, ret_val == ref_type); + try { + loc_id = H5.H5Ropen_object(refbuf[i], HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + assertTrue(loc_id >= 0); + boolean regionzero = byteArrayCheck(refbuf[i]); + if (i > 1) + assertTrue(regionzero); + else { + try { + loc_sid = H5.H5Ropen_region(refbuf[i], HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + assertTrue(loc_sid >= 0); + int region_type = -1; + try { + int reg_ndims = H5.H5Sget_simple_extent_ndims(loc_sid); + region_type = H5.H5Sget_select_type(loc_sid); + if (i == 1) + assertTrue(region_type == HDF5Constants.H5S_SEL_POINTS); + else + assertTrue(region_type == HDF5Constants.H5S_SEL_HYPERSLABS); + if (region_type == HDF5Constants.H5S_SEL_POINTS) { + long reg_npoints = H5.H5Sget_select_elem_npoints(loc_sid); + // Coordinates for get point selection + long getcoord[] = new long[reg_ndims * (int)reg_npoints]; + // Known coordinates for point selection + long coord[][] = {{6,9},{2,2},{8,4},{1,6},{2,8},{3,2}, + {0,4},{9,0},{7,1},{3,3}}; + try { + H5.H5Sget_select_elem_pointlist(loc_sid, 0, reg_npoints, getcoord); + assertTrue("H5.H5Sget_select_elem_pointlist", coord[0][0] == getcoord[0]); + assertTrue("H5.H5Sget_select_elem_pointlist", coord[0][1] == getcoord[1]); + assertTrue("H5.H5Sget_select_elem_pointlist", coord[1][0] == getcoord[2]); + assertTrue("H5.H5Sget_select_elem_pointlist", coord[1][1] == getcoord[3]); + assertTrue("H5.H5Sget_select_elem_pointlist", coord[2][0] == getcoord[4]); + assertTrue("H5.H5Sget_select_elem_pointlist", coord[2][1] == getcoord[5]); + } + catch (Throwable err3) { + err3.printStackTrace(); + fail("H5.H5Sget_select_elem_pointlist: " + err3); + } + } + else if (region_type == HDF5Constants.H5S_SEL_HYPERSLABS) { + long reg_nblocks = H5.H5Sget_select_hyper_nblocks(loc_sid); + assertTrue("H5Sget_select_hyper_nblocks", reg_nblocks == 1); + // Coordinates for get block selection + long getblocks[] = new long[reg_ndims * (int)reg_nblocks * 2]; + long start[] = {2,2}; + long block[] = {8,8}; + try { + H5.H5Sget_select_hyper_blocklist(loc_sid, 0, reg_nblocks, getblocks); + assertTrue("H5.H5Sget_select_hyper_blocklist", start[0] == getblocks[0]); + assertTrue("H5.H5Sget_select_hyper_blocklist", start[1] == getblocks[1]); + assertTrue("H5.H5Sget_select_hyper_blocklist", (block[0]-1) == getblocks[2]); + assertTrue("H5.H5Sget_select_hyper_blocklist", (block[1]-1) == getblocks[3]); + } + catch (Throwable err3) { + err3.printStackTrace(); + fail("H5.H5Sget_select_hyper_blocklist: " + err3); + } + } + } + catch (Throwable err2) { + err2.printStackTrace(); + fail("testH5Rget_region_dataset: H5Sget_select_type: " + err2); + } + } + catch (Throwable err1) { + err1.printStackTrace(); + fail("testH5Rget_region_dataset: " + err1); + } + finally { + try {H5.H5Sclose(loc_sid);} catch (Exception ex) {} + } + } + } + catch (Throwable err0) { + err0.printStackTrace(); + fail("testH5Rget_region_dataset: " + err0); + } + finally { + try {H5.H5Dclose(loc_id);} catch (Exception ex) {} + } + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Rget_region_dataset: H5Rget_type: " + err); + } + finally { + H5.H5Rdestroy(refbuf[i]); + } + } //for (int i = 0; i < ndims; i++) + } + + @Test + public void testH5Rget_region_attribute() { + long f_type = HDF5Constants.H5I_INVALID_HID; + long loc_id = HDF5Constants.H5I_INVALID_HID; + long loc_sid = HDF5Constants.H5I_INVALID_HID; + int ref_type = HDF5Constants.H5R_ATTR; + int obj_type = -1; + int ndims = 1; + long ret_val = -1; + byte[][] refbuf = null; + String objName = "/Dataset3"; + + try { + openH5file(H5_AREG_FILE, objName); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Rget_region_attribute: openH5file: " + err); + } + try { + f_type = H5.H5Dget_type(H5did); + int result = H5.H5Tget_class(f_type); + assertTrue("testH5Rget_region_attribute: H5Tget_class", result > 0); + String class_name = H5.H5Tget_class_name(result); + assertTrue("testH5Rget_region_attribute: H5Tget_class="+class_name, class_name.compareTo("H5T_REFERENCE")==0); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Rget_region_attribute: " + err); + } + finally { + try {H5.H5Tclose(f_type);} catch (Exception ex) {} + } + try { + ndims = H5.H5Sget_simple_extent_ndims(H5dsid); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Rget_region_attribute: H5Sget_simple_extent_ndims: " + err); + } + refbuf = new byte[ndims][HDF5Constants.H5R_REF_BUF_SIZE]; + // Read the reference from the dataset. + try { + H5.H5Dread(H5did, HDF5Constants.H5T_STD_REF, + HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, refbuf); + } + catch (Exception err) { + err.printStackTrace(); + fail("testH5Rget_region_attribute: H5Dread: " + err); + } + + for (int i = 0; i < ndims; i++) { + try { + ret_val = H5.H5Rget_type(refbuf[i]); + assertTrue("testH5Rget_region_attribute: H5Rget_type["+i+"]="+ret_val, ret_val == ref_type); + try { + loc_id = H5.H5Ropen_attr(refbuf[i], HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + assertTrue(loc_id >= 0); + if (!byteArrayCheck(refbuf[i])) { + try { + loc_sid = H5.H5Aget_space(loc_id); + assertTrue(loc_sid >= 0); + } + catch (Throwable err1) { + err1.printStackTrace(); + fail("testH5Rget_region_attribute: " + err1); + } + finally { + try {H5.H5Sclose(loc_sid);} catch (Exception ex) {} + } + } + } + catch (Throwable err0) { + err0.printStackTrace(); + fail("testH5Rget_region_attribute: " + err0); + } + finally { + try {H5.H5Aclose(loc_id);} catch (Exception ex) {} + } + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Rget_region_attribute: H5Rget_type: " + err); + } + finally { + H5.H5Rdestroy(refbuf[i]); + } + } + } + + +// These tests need to be updated with new APIs +// @Test// +// public void testH5Rget_group() { +// long loc_id = H5fid; +// int ref_type = HDF5Constants.H5R_OBJECT2; +// long ret_val = -1; +// byte[] ref = null; +// String name = ""; +// String objName = "/dset"; +// +// try { +// ref = H5.H5Rcreate_object(H5fid, objName, HDF5Constants.H5P_DEFAULT); +// } +// catch (Throwable err) { +// err.printStackTrace(); +// fail("testH5Rget_object: H5Rcreate_object " + err); +// } +// try { +// dataset_id= H5.H5Rdereference(H5fid, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5R_DATASET_REGION, ref1); +// +// //Create reference on group +// ref2 = H5.H5Rcreate(H5gid, "/Group1", HDF5Constants.H5R_OBJECT, -1); +// group_id= H5.H5Rdereference(H5gid, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5R_OBJECT, ref2); +// assertNotNull(ref1); +// assertNotNull(ref2); +// assertTrue(dataset_id >= 0); +// assertTrue(group_id >= 0); +// } +// catch (Throwable err) { +// err.printStackTrace(); +// fail("TestH5Rdereference " + err); +// } +// finally { +// try {H5.H5Dclose(dataset_id);} catch (Exception ex) {} +// try {H5.H5Gclose(group_id);} catch (Exception ex) {} +// } +// } + +// @Test// +// public void testH5Rget_attr() { +// long loc_id = H5fid; +// int ref_type = HDF5Constants.H5R_OBJECT2; +// long ret_val = -1; +// byte[] ref = null; +// String name = ""; +// String objName = "/dset"; +// +// try { +// ref = H5.H5Rcreate_object(H5fid, objName, HDF5Constants.H5P_DEFAULT); +// } +// catch (Throwable err) { +// err.printStackTrace(); +// fail("testH5Rget_object: H5Rcreate_object " + err); +// } +// try { +// dsid = H5.H5Rget_region(H5fid, HDF5Constants.H5R_DATASET_REGION, ref); +// assertNotNull(ref); +// assertTrue(dsid >= 0); +// } +// catch (Throwable err) { +// err.printStackTrace(); +// fail("TestH5Rget_region: " + err); +// } +// finally { +// try {H5.H5Sclose(dsid);} catch (Exception ex) {} +// } +// } + +} diff --git a/java/test/TestH5S.java b/java/test/TestH5S.java index 03943a4..b09ff6f 100644 --- a/java/test/TestH5S.java +++ b/java/test/TestH5S.java @@ -30,7 +30,7 @@ import org.junit.rules.TestName; public class TestH5S { @Rule public TestName testname = new TestName(); - long H5sid = -1; + long H5sid = HDF5Constants.H5I_INVALID_HID; int H5rank = 2; long H5dims[] = {5, 5}; long H5maxdims[] = {10, 10}; @@ -181,7 +181,7 @@ public class TestH5S { @Test public void testH5Scopy() { - long sid = -1; + long sid = HDF5Constants.H5I_INVALID_HID; int read_rank = -1; try { @@ -201,7 +201,7 @@ public class TestH5S { @Test public void testH5Sextent_copy() { - long sid = -1; + long sid = HDF5Constants.H5I_INVALID_HID; int class_type = -1; try { @@ -222,7 +222,7 @@ public class TestH5S { @Test public void testH5Sextent_equal() { - long sid = -1; + long sid = HDF5Constants.H5I_INVALID_HID; boolean result = false; try { @@ -252,8 +252,8 @@ public class TestH5S { @Test public void testH5Sencode_decode_null_dataspace() { - long sid = -1; - long decoded_sid = -1; + long sid = HDF5Constants.H5I_INVALID_HID; + long decoded_sid = HDF5Constants.H5I_INVALID_HID; byte[] null_sbuf = null; boolean result = false; @@ -299,8 +299,8 @@ public class TestH5S { @Test public void testH5Sencode_decode_scalar_dataspace() { - long sid = -1; - long decoded_sid = -1; + long sid = HDF5Constants.H5I_INVALID_HID; + long decoded_sid = HDF5Constants.H5I_INVALID_HID; byte[] scalar_sbuf = null; boolean result = false; int iresult = -1; @@ -470,7 +470,7 @@ public class TestH5S { @Test public void testH5Sget_select_hyper() { - long space1 = -1; + long space1 = HDF5Constants.H5I_INVALID_HID; long start[] = {0,0}; long stride[] = {1,1}; long count[] = {1,1}; @@ -508,7 +508,7 @@ public class TestH5S { @Test public void testH5Sget_select_valid() { - long space1 = -1; + long space1 = HDF5Constants.H5I_INVALID_HID; long start[] = {1,0}; long stride[] = {1,1}; long count[] = {2,3}; diff --git a/java/test/TestH5Sbasic.java b/java/test/TestH5Sbasic.java index e6698c6..5bcdc61 100644 --- a/java/test/TestH5Sbasic.java +++ b/java/test/TestH5Sbasic.java @@ -56,7 +56,7 @@ public class TestH5Sbasic { @Test public void testH5Screate_scalar() { - long sid = -1; + long sid = HDF5Constants.H5I_INVALID_HID; int class_type = -1; try { sid = H5.H5Screate(HDF5Constants.H5S_SCALAR); @@ -75,7 +75,7 @@ public class TestH5Sbasic { @Test public void testH5Screate_null() { - long sid = -1; + long sid = HDF5Constants.H5I_INVALID_HID; int class_type = -1; try { sid = H5.H5Screate(HDF5Constants.H5S_NULL); @@ -125,7 +125,7 @@ public class TestH5Sbasic { @Test public void testH5Screate_simple() { - long sid = -1; + long sid = HDF5Constants.H5I_INVALID_HID; int class_type = -1; int rank = 2; long dims[] = {5, 5}; @@ -148,7 +148,7 @@ public class TestH5Sbasic { @Test public void testH5Screate_simple_unlimted() { - long sid = -1; + long sid = HDF5Constants.H5I_INVALID_HID; int class_type = -1; int rank = 2; long dims[] = {5, 5}; @@ -171,7 +171,7 @@ public class TestH5Sbasic { @Test public void testH5Screate_simple_unlimted_1d() { - long sid = -1; + long sid = HDF5Constants.H5I_INVALID_HID; int class_type = -1; int rank = 1; long dims[] = {5}; @@ -194,7 +194,7 @@ public class TestH5Sbasic { @Test public void testH5Screate_simple_max_default() { - long sid = -1; + long sid = HDF5Constants.H5I_INVALID_HID; int rank = 2; long dims[] = {5, 5}; @@ -213,7 +213,7 @@ public class TestH5Sbasic { @Test public void testH5Screate_simple_extent() { - long sid = -1; + long sid = HDF5Constants.H5I_INVALID_HID; int rank = 2; long dims[] = {5, 5}; long maxdims[] = {10, 10}; @@ -270,7 +270,7 @@ public class TestH5Sbasic { @Test(expected = IllegalArgumentException.class) public void testH5Sselect_adjust_rank_offset() throws Throwable { - long sid = -1; + long sid = HDF5Constants.H5I_INVALID_HID; long offset[][] = {{0,1},{2,4},{5,6}}; try { @@ -292,7 +292,7 @@ public class TestH5Sbasic { @Test(expected = IllegalArgumentException.class) public void testH5Sselect_intersect_block_rank_start() throws Throwable { - long sid = -1; + long sid = HDF5Constants.H5I_INVALID_HID; long start[] = new long[2]; long end[] = null; @@ -308,7 +308,7 @@ public class TestH5Sbasic { @Test(expected = IllegalArgumentException.class) public void testH5Sselect_intersect_block_rank_end() throws Throwable { - long sid = -1; + long sid = HDF5Constants.H5I_INVALID_HID; long start[] = null; long end[] = new long[2]; @@ -336,7 +336,7 @@ public class TestH5Sbasic { @Test(expected = NullPointerException.class) public void testH5Scombine_hyperslab_null_start() throws Throwable { - long sid = -1; + long sid = HDF5Constants.H5I_INVALID_HID; long start[] = null; long stride[] = null; long count[] = new long[2]; @@ -354,7 +354,7 @@ public class TestH5Sbasic { @Test(expected = NullPointerException.class) public void testH5Scombine_hyperslab_null_count() throws Throwable { - long sid = -1; + long sid = HDF5Constants.H5I_INVALID_HID; long start[] = new long[2]; long stride[] = null; long count[] = null; diff --git a/java/test/TestH5T.java b/java/test/TestH5T.java index 18b5985..55326cb 100644 --- a/java/test/TestH5T.java +++ b/java/test/TestH5T.java @@ -33,8 +33,8 @@ import org.junit.rules.TestName; public class TestH5T { @Rule public TestName testname = new TestName(); private static final String H5_FILE = "testT.h5"; - long H5fid = -1; - long H5strdid = -1; + long H5fid = HDF5Constants.H5I_INVALID_HID; + long H5strdid = HDF5Constants.H5I_INVALID_HID; private final void _deleteFile(String filename) { File file = null; @@ -129,7 +129,7 @@ public class TestH5T { @Test public void testH5Tarray_create() { - long filetype_id = -1; + long filetype_id = HDF5Constants.H5I_INVALID_HID; long[] adims = { 3, 5 }; try { @@ -148,7 +148,7 @@ public class TestH5T { @Test public void testH5Tget_array_ndims() { - long filetype_id = -1; + long filetype_id = HDF5Constants.H5I_INVALID_HID; int ndims = 0; long[] adims = { 3, 5 }; @@ -176,7 +176,7 @@ public class TestH5T { @Test public void testH5Tget_array_dims() { - long filetype_id = -1; + long filetype_id = HDF5Constants.H5I_INVALID_HID; int ndims = 0; long[] adims = { 3, 5 }; long[] rdims = new long[2]; @@ -207,7 +207,7 @@ public class TestH5T { @Test public void testH5Tenum_functions() { - long filetype_id =-1; + long filetype_id =HDF5Constants.H5I_INVALID_HID; String enum_type ="Enum_type"; byte[] enum_val = new byte[1]; String enum_name = null; @@ -275,7 +275,7 @@ public class TestH5T { @Test public void testH5Tenum_create_functions() { - long filetype_id = -1; + long filetype_id = HDF5Constants.H5I_INVALID_HID; byte[] enum_val = new byte[1]; // Create a enumerate datatype @@ -315,7 +315,7 @@ public class TestH5T { @Test public void testH5Topaque_functions() { - long filetype_id = -1; + long filetype_id = HDF5Constants.H5I_INVALID_HID; String opaque_name = null; // Create a opaque datatype @@ -345,7 +345,7 @@ public class TestH5T { @Test public void testH5Tvlen_create() { - long filetype_id = -1; + long filetype_id = HDF5Constants.H5I_INVALID_HID; try { filetype_id = H5.H5Tvlen_create(HDF5Constants.H5T_C_S1); @@ -368,7 +368,7 @@ public class TestH5T { @Test public void testH5Tis_variable_str() { - long filetype_id = -1; + long filetype_id = HDF5Constants.H5I_INVALID_HID; try { filetype_id = H5.H5Tcopy(HDF5Constants.H5T_C_S1); @@ -399,7 +399,7 @@ public class TestH5T { @Test public void testH5Tcompound_functions() { - long filetype_id =-1; + long filetype_id =HDF5Constants.H5I_INVALID_HID; // Create a compound datatype try { diff --git a/java/test/TestH5Tbasic.java b/java/test/TestH5Tbasic.java index 6dbc6e3..fa98f65 100644 --- a/java/test/TestH5Tbasic.java +++ b/java/test/TestH5Tbasic.java @@ -40,7 +40,7 @@ public class TestH5Tbasic { @Test public void testH5Tcopy() { - long H5strdid = -1; + long H5strdid = HDF5Constants.H5I_INVALID_HID; try { H5strdid = H5.H5Tcopy(HDF5Constants.H5T_C_S1); assertTrue("H5.H5Tcopy",H5strdid > 0); @@ -57,7 +57,7 @@ public class TestH5Tbasic { @Test public void testH5Tequal() { - long H5strdid = -1; + long H5strdid = HDF5Constants.H5I_INVALID_HID; try { H5strdid = H5.H5Tcopy(HDF5Constants.H5T_C_S1); assertTrue("H5.H5Tcopy",H5strdid > 0); @@ -76,7 +76,7 @@ public class TestH5Tbasic { @Test public void testH5Tequal_not() { - long H5strdid = -1; + long H5strdid = HDF5Constants.H5I_INVALID_HID; try { H5strdid = H5.H5Tcopy(HDF5Constants.H5T_STD_U64LE); assertTrue("H5.H5Tcopy",H5strdid > 0); @@ -98,8 +98,8 @@ public class TestH5Tbasic { String[] strs = {"a1234","b1234"}; int srcLen = 5; int dstLen = 10; - long srcId = -1; - long dstId = -1; + long srcId = HDF5Constants.H5I_INVALID_HID; + long dstId = HDF5Constants.H5I_INVALID_HID; int dimSize = strs.length; byte[] buf = new byte[dimSize*dstLen]; @@ -131,7 +131,7 @@ public class TestH5Tbasic { @Test public void testH5Torder_size() { - long H5strdid = -1; + long H5strdid = HDF5Constants.H5I_INVALID_HID; try { // Fixed length string H5strdid = H5.H5Tcopy(HDF5Constants.H5T_C_S1); diff --git a/java/test/junit.sh.in b/java/test/junit.sh.in index 2eabdf0..8c22c5a 100644 --- a/java/test/junit.sh.in +++ b/java/test/junit.sh.in @@ -46,6 +46,8 @@ HDFLIB_HOME="$top_srcdir/java/lib" BLDDIR="." BLDLIBDIR="$BLDDIR/testlibs" HDFTEST_HOME="$top_srcdir/java/test" +TOOLS_TESTFILES="$top_srcdir/tools/testfiles" + JARFILE=jar@PACKAGE_TARNAME@-@PACKAGE_VERSION@.jar TESTJARFILE=jar@PACKAGE_TARNAME@test.jar test -d $BLDLIBDIR || mkdir -p $BLDLIBDIR @@ -93,6 +95,7 @@ $HDFTEST_HOME/testfiles/JUnit-TestH5Lparams.txt $HDFTEST_HOME/testfiles/JUnit-TestH5Lbasic.txt $HDFTEST_HOME/testfiles/JUnit-TestH5Lcreate.txt $HDFTEST_HOME/testfiles/JUnit-TestH5R.txt +$HDFTEST_HOME/testfiles/JUnit-TestH5Rref.txt $HDFTEST_HOME/testfiles/JUnit-TestH5P.txt $HDFTEST_HOME/testfiles/JUnit-TestH5PData.txt $HDFTEST_HOME/testfiles/JUnit-TestH5Pfapl.txt @@ -146,7 +149,7 @@ COPY_LIBFILES_TO_BLDLIBDIR() fi fi done - if [ "$IS_DARWIN" = "yes" ]; then + if [ "$IS_DARWIN" = "yes" ]; then (cd testlibs; \ install_name_tool -add_rpath @loader_path libhdf5_java.dylib; \ exist_path=` otool -l libhdf5_java.dylib | grep libhdf5 | grep -v java | awk '{print $2}'`; \ @@ -248,6 +251,8 @@ COPY_DATAFILES_TO_BLDDIR() $CP -f $HDFTEST_HOME/h5ex_g_iterate.orig $BLDDIR/h5ex_g_iterateL2.hdf $CP -f $HDFTEST_HOME/h5ex_g_iterate.orig $BLDDIR/h5ex_g_iterateO1.hdf $CP -f $HDFTEST_HOME/h5ex_g_iterate.orig $BLDDIR/h5ex_g_iterateO2.hdf + $CP -f $TOOLS_TESTFILES/trefer_reg.h5 $BLDDIR/trefer_reg.h5 + $CP -f $TOOLS_TESTFILES/trefer_attr.h5 $BLDDIR/trefer_attr.h5 } CLEAN_DATAFILES_AND_BLDDIR() @@ -768,6 +773,27 @@ else test yes = "$verbose" && $DIFF JUnit-TestH5R.txt JUnit-TestH5R.out |sed 's/^/ /' fi +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Rref" +TESTING JUnit-TestH5Rref +($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Rref > JUnit-TestH5Rref.ext) + +# Extract file name, line number, version and thread IDs because they may be different +sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ + -e 's/line [0-9]*/line (number)/' \ + -e 's/Time: [0-9]*[\.,[0-9]*]*/Time: XXXX/' \ + -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \ + -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \ + JUnit-TestH5Rref.ext > JUnit-TestH5Rref.out + +if diff JUnit-TestH5Rref.out JUnit-TestH5Rref.txt > /dev/null; then + echo " PASSED JUnit-TestH5Rref" +else + echo "**FAILED** JUnit-TestH5Rref" + echo " Expected result differs from actual result" + nerrors="`expr $nerrors + 1`" + test yes = "$verbose" && $DIFF JUnit-TestH5Rref.txt JUnit-TestH5Rref.out |sed 's/^/ /' +fi + echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5P" TESTING JUnit-TestH5P ($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5P > JUnit-TestH5P.ext) diff --git a/java/test/testfiles/JUnit-TestH5.txt b/java/test/testfiles/JUnit-TestH5.txt index 4bab633..59765d9 100644 --- a/java/test/testfiles/JUnit-TestH5.txt +++ b/java/test/testfiles/JUnit-TestH5.txt @@ -3,8 +3,10 @@ JUnit version 4.11 .testJ2C .testH5export_dataset .testIsSerializable +.testH5export_attrdataset .testH5garbage_collect .testH5error_off +.testH5export_regdataset .serializeToDisk .testH5open .testH5check_version @@ -13,5 +15,5 @@ JUnit version 4.11 Time: XXXX -OK (11 tests) +OK (13 tests) diff --git a/java/test/testfiles/JUnit-TestH5Rref.txt b/java/test/testfiles/JUnit-TestH5Rref.txt new file mode 100644 index 0000000..05019c0 --- /dev/null +++ b/java/test/testfiles/JUnit-TestH5Rref.txt @@ -0,0 +1,10 @@ +JUnit version 4.11 +.testH5Rget_region_dataset +.testH5Rget_object +.testH5Rget_region_attribute +.testH5Rget_obj_type3 + +Time: XXXX + +OK (4 tests) + |