From 104d63f25a8cb6e156bc901eb85aafc0b67775ee Mon Sep 17 00:00:00 2001 From: Jordan Henderson Date: Fri, 10 Mar 2017 08:32:24 -0600 Subject: Merge latest changes from develop --- CMakeFilters.cmake | 54 +- CMakeInstallation.cmake | 146 +- CMakeLists.txt | 330 +++-- CTestConfig.cmake | 4 +- MANIFEST | 59 +- UserMacros.cmake | 7 +- c++/CMakeLists.txt | 8 +- c++/examples/CMakeLists.txt | 12 +- c++/examples/CMakeTests.cmake | 49 +- c++/src/CMakeLists.txt | 9 +- c++/src/H5AbstractDs.cpp | 436 +++--- c++/src/H5AbstractDs.h | 68 +- c++/src/H5ArrayType.cpp | 142 +- c++/src/H5ArrayType.h | 48 +- c++/src/H5AtomType.cpp | 360 ++--- c++/src/H5AtomType.h | 60 +- c++/src/H5Attribute.cpp | 500 +++---- c++/src/H5Attribute.h | 94 +- c++/src/H5Classes.h | 52 +- c++/src/H5CommonFG.cpp | 413 +++--- c++/src/H5CommonFG.h | 68 +- c++/src/H5CompType.cpp | 582 ++++---- c++/src/H5CompType.h | 126 +- c++/src/H5CppDoc.h | 18 +- c++/src/H5DataSet.cpp | 820 +++++----- c++/src/H5DataSet.h | 120 +- c++/src/H5DataSpace.cpp | 793 +++++----- c++/src/H5DataSpace.h | 152 +- c++/src/H5DataType.cpp | 928 ++++++------ c++/src/H5DataType.h | 156 +- c++/src/H5DcreatProp.cpp | 902 +++++------ c++/src/H5DcreatProp.h | 199 ++- c++/src/H5DxferProp.cpp | 578 ++++---- c++/src/H5DxferProp.h | 126 +- c++/src/H5EnumType.cpp | 354 ++--- c++/src/H5EnumType.h | 72 +- c++/src/H5Exception.cpp | 650 ++++---- c++/src/H5Exception.h | 154 +- c++/src/H5FaccProp.cpp | 862 +++++------ c++/src/H5FaccProp.h | 164 +- c++/src/H5FcreatProp.cpp | 365 +++-- c++/src/H5FcreatProp.h | 89 +- c++/src/H5File.cpp | 661 +++++---- c++/src/H5File.h | 125 +- c++/src/H5FloatType.cpp | 402 ++--- c++/src/H5FloatType.h | 66 +- c++/src/H5Group.cpp | 146 +- c++/src/H5Group.h | 58 +- c++/src/H5IdComponent.cpp | 392 +++-- c++/src/H5IdComponent.h | 110 +- c++/src/H5Include.h | 4 +- c++/src/H5IntType.cpp | 168 +-- c++/src/H5IntType.h | 42 +- c++/src/H5LaccProp.cpp | 34 +- c++/src/H5LaccProp.h | 26 +- c++/src/H5Library.cpp | 200 +-- c++/src/H5Library.h | 36 +- c++/src/H5Location.cpp | 1921 ++++++++++++------------ c++/src/H5Location.h | 298 ++-- c++/src/H5Object.cpp | 419 +++--- c++/src/H5Object.h | 136 +- c++/src/H5OcreatProp.cpp | 124 +- c++/src/H5OcreatProp.h | 42 +- c++/src/H5PredType.cpp | 453 +++--- c++/src/H5PredType.h | 328 ++-- c++/src/H5PropList.cpp | 769 +++++----- c++/src/H5PropList.h | 142 +- c++/src/H5StrType.cpp | 326 ++-- c++/src/H5StrType.h | 56 +- c++/src/H5VarLenType.cpp | 96 +- c++/src/H5VarLenType.h | 32 +- c++/test/CMakeLists.txt | 2 +- c++/test/CMakeTests.cmake | 27 +- c++/test/dsets.cpp | 1668 ++++++++++----------- c++/test/h5cpputil.cpp | 142 +- c++/test/h5cpputil.h | 70 +- c++/test/tarray.cpp | 486 +++--- c++/test/tattr.cpp | 2062 +++++++++++++------------- c++/test/tcompound.cpp | 958 ++++++------ c++/test/tdspl.cpp | 124 +- c++/test/testhdf5.cpp | 88 +- c++/test/tfile.cpp | 844 ++++++----- c++/test/tfilter.cpp | 90 +- c++/test/th5s.cpp | 575 ++++--- c++/test/titerate.cpp | 370 ++--- c++/test/tlinks.cpp | 312 ++-- c++/test/tobject.cpp | 500 +++---- c++/test/trefer.cpp | 1062 ++++++------- c++/test/ttypes.cpp | 622 ++++---- c++/test/tvlstr.cpp | 1022 ++++++------- config/cmake/CMakeFindJavaCommon.cmake | 14 +- config/cmake/ConfigureChecks.cmake | 102 +- config/cmake/FindHDFJAVA.cmake.in | 12 +- config/cmake/FindJNI.cmake | 2 - config/cmake/HDF518_Examples.cmake.in | 80 +- config/cmake/HDF5Macros.cmake | 24 +- config/cmake/HDF5UseFortran.cmake | 285 ++-- config/cmake/HDF5_Examples.cmake.in | 264 ++-- config/cmake/HDF5_Process_Flex_Files.cmake | 4 +- config/cmake/HDFCompilerFlags.cmake | 200 +-- config/cmake/README.txt.cmake.in | 2 +- config/cmake/UseJava.cmake | 2 +- config/cmake/UserMacros/Windows_MT.cmake | 19 +- config/cmake/cacheinit.cmake | 2 + config/cmake/hdf5-config-version.cmake.in | 30 +- config/cmake/hdf5-config.cmake.in | 2 +- config/cmake/jrunTest.cmake | 154 +- config/cmake/scripts/CTestScript.cmake | 379 +++-- config/cmake/scripts/HDF5config.cmake | 209 ++- config/cmake/userblockTest.cmake | 34 +- config/cmake/vfdTest.cmake | 45 +- config/cmake_ext_mod/CheckTypeSize.cmake | 24 +- config/cmake_ext_mod/ConfigureChecks.cmake | 208 +-- config/cmake_ext_mod/FindMPI.cmake | 37 +- config/cmake_ext_mod/FindSZIP.cmake | 44 +- config/cmake_ext_mod/HDFLibMacros.cmake | 43 +- config/cmake_ext_mod/HDFMacros.cmake | 160 +- config/cmake_ext_mod/HDFUseFortran.cmake | 23 +- config/cmake_ext_mod/grepTest.cmake | 20 +- config/cmake_ext_mod/prunTest.cmake | 145 -- config/cmake_ext_mod/runTest.cmake | 80 +- configure.ac | 14 +- examples/CMakeLists.txt | 12 +- examples/CMakeTests.cmake | 92 +- fortran/CMakeLists.txt | 12 +- fortran/examples/CMakeLists.txt | 16 +- fortran/examples/CMakeTests.cmake | 88 +- fortran/src/CMakeLists.txt | 58 +- fortran/src/Makefile.am | 4 +- fortran/test/CMakeLists.txt | 60 +- fortran/test/CMakeTests.cmake | 124 +- fortran/testpar/CMakeLists.txt | 10 +- hl/CMakeLists.txt | 10 +- hl/c++/CMakeLists.txt | 6 +- hl/c++/examples/CMakeLists.txt | 4 +- hl/c++/examples/CMakeTests.cmake | 17 +- hl/c++/src/CMakeLists.txt | 9 +- hl/c++/test/CMakeLists.txt | 2 +- hl/c++/test/CMakeTests.cmake | 15 +- hl/examples/CMakeLists.txt | 6 +- hl/examples/CMakeTests.cmake | 27 +- hl/fortran/CMakeLists.txt | 6 +- hl/fortran/examples/CMakeLists.txt | 8 +- hl/fortran/examples/CMakeTests.cmake | 17 +- hl/fortran/src/CMakeLists.txt | 44 +- hl/fortran/test/CMakeLists.txt | 10 +- hl/fortran/test/CMakeTests.cmake | 122 +- hl/src/CMakeLists.txt | 9 +- hl/test/CMakeLists.txt | 8 +- hl/test/CMakeTests.cmake | 23 +- hl/tools/CMakeLists.txt | 2 +- hl/tools/gif2h5/CMakeLists.txt | 24 +- hl/tools/h5watch/CMakeLists.txt | 18 +- hl/tools/h5watch/CMakeTests.cmake | 66 +- java/CMakeLists.txt | 12 +- java/examples/CMakeLists.txt | 2 +- java/examples/datasets/CMakeLists.txt | 40 +- java/examples/datasets/H5Ex_D_Chunk.java | 5 +- java/examples/datasets/H5Ex_D_Compact.java | 5 +- java/examples/datasets/runExample.sh.in | 2 + java/examples/datatypes/CMakeLists.txt | 28 +- java/examples/datatypes/runExample.sh.in | 1 + java/examples/groups/CMakeLists.txt | 38 +- java/examples/groups/runExample.sh.in | 8 + java/examples/intro/CMakeLists.txt | 30 +- java/examples/intro/runExample.sh.in | 1 + java/src/CMakeLists.txt | 2 +- java/src/Makefile.am | 1 + java/src/hdf/CMakeLists.txt | 2 +- java/src/hdf/hdf5lib/CMakeLists.txt | 4 +- java/src/hdf/hdf5lib/H5.java | 6 +- java/src/jni/CMakeLists.txt | 10 +- java/src/jni/h5Constants.c | 1222 +++++++-------- java/src/jni/h5dImp.h | 4 +- java/src/jni/h5fImp.h | 8 +- java/src/jni/h5gImp.h | 4 +- java/src/jni/h5oImp.h | 4 +- java/src/jni/h5tImp.h | 4 +- java/test/CMakeLists.txt | 16 +- java/test/JUnit-interface.txt | 3 +- java/test/TestH5Ocopy.java | 1 + java/test/TestH5Pvirtual.java | 5 +- java/test/junit.sh.in | 9 + release_docs/INSTALL_CMake.txt | 308 ++-- release_docs/RELEASE.txt | 1475 ++---------------- release_docs/USING_CMake_Examples.txt | 4 +- release_docs/USING_HDF5_CMake.txt | 232 +-- src/CMakeLists.txt | 40 +- src/H5AC.c | 308 ++-- src/H5ACdbg.c | 203 ++- src/H5ACmpio.c | 80 +- src/H5ACpkg.h | 13 +- src/H5ACprivate.h | 69 +- src/H5ACpublic.h | 61 + src/H5B2pkg.h | 9 - src/H5Bpkg.h | 3 - src/H5C.c | 1850 +++++++++++++---------- src/H5Cdbg.c | 467 +++++- src/H5Cepoch.c | 5 +- src/H5Cmpio.c | 377 ++--- src/H5Cpkg.h | 564 +++++-- src/H5Cprivate.h | 481 +++++- src/H5Cquery.c | 5 +- src/H5EApkg.h | 15 - src/H5F.c | 74 +- src/H5FApkg.h | 9 - src/H5FDmulti.c | 14 +- src/H5FSpkg.h | 6 - src/H5Fint.c | 67 +- src/H5Fio.c | 2 +- src/H5Fpkg.h | 12 +- src/H5Fprivate.h | 4 + src/H5Fpublic.h | 1 + src/H5Fsuper.c | 58 +- src/H5Gpkg.h | 3 - src/H5HFcache.c | 684 ++++++++- src/H5HFpkg.h | 9 - src/H5HGpkg.h | 3 - src/H5HLpkg.h | 6 - src/H5MF.c | 193 +-- src/H5MFaggr.c | 15 +- src/H5MFprivate.h | 8 +- src/H5O.c | 7 +- src/H5Opkg.h | 13 +- src/H5Oprivate.h | 16 +- src/H5Pfapl.c | 255 ++++ src/H5Ppublic.h | 2 + src/H5SMpkg.h | 2 - src/H5win32defs.h | 4 +- src/Makefile.am | 6 +- test/CMakeLists.txt | 137 +- test/CMakeTests.cmake | 288 ++-- test/Makefile.am | 51 +- test/cache.c | 417 +++--- test/cache_api.c | 16 +- test/cache_common.c | 132 +- test/cache_common.h | 3 +- test/cache_tagging.c | 10 +- test/dsets.c | 10 +- test/earray.c | 246 --- test/enc_dec_plist.c | 7 + test/evict_on_close.c | 16 +- test/fheap.c | 104 +- test/fillval.c | 2 +- test/freespace.c | 10 +- test/gen_plist.c | 9 + test/h5test.c | 4 +- test/links.c | 15 +- test/objcopy.c | 2 +- test/swmr_check_compat_vfd.c | 6 +- test/testfiles/plist_files/dapl_32be | Bin 136 -> 186 bytes test/testfiles/plist_files/dapl_32le | Bin 136 -> 186 bytes test/testfiles/plist_files/dapl_64be | Bin 136 -> 186 bytes test/testfiles/plist_files/dapl_64le | Bin 136 -> 186 bytes test/testfiles/plist_files/def_dapl_32be | Bin 131 -> 181 bytes test/testfiles/plist_files/def_dapl_32le | Bin 131 -> 181 bytes test/testfiles/plist_files/def_dapl_64be | Bin 131 -> 181 bytes test/testfiles/plist_files/def_dapl_64le | Bin 131 -> 181 bytes test/testfiles/plist_files/def_dxpl_32be | Bin 225 -> 245 bytes test/testfiles/plist_files/def_dxpl_32le | Bin 225 -> 245 bytes test/testfiles/plist_files/def_dxpl_64be | Bin 225 -> 245 bytes test/testfiles/plist_files/def_dxpl_64le | Bin 225 -> 245 bytes test/testfiles/plist_files/def_fapl_32be | Bin 1460 -> 1520 bytes test/testfiles/plist_files/def_fapl_32le | Bin 1460 -> 1520 bytes test/testfiles/plist_files/def_fapl_64be | Bin 1460 -> 1520 bytes test/testfiles/plist_files/def_fapl_64le | Bin 1460 -> 1520 bytes test/testfiles/plist_files/dxpl_32be | Bin 229 -> 249 bytes test/testfiles/plist_files/dxpl_32le | Bin 229 -> 249 bytes test/testfiles/plist_files/dxpl_64be | Bin 229 -> 249 bytes test/testfiles/plist_files/dxpl_64le | Bin 229 -> 249 bytes test/testfiles/plist_files/fapl_32be | Bin 1462 -> 1522 bytes test/testfiles/plist_files/fapl_32le | Bin 1462 -> 1522 bytes test/testfiles/plist_files/fapl_64be | Bin 1462 -> 1522 bytes test/testfiles/plist_files/fapl_64le | Bin 1462 -> 1522 bytes test/testfiles/plist_files/fcpl_32be | Bin 413 -> 413 bytes test/testfiles/plist_files/fcpl_32le | Bin 413 -> 413 bytes test/testfiles/plist_files/fcpl_64be | Bin 413 -> 413 bytes test/testfiles/plist_files/fcpl_64le | Bin 413 -> 413 bytes test/testfiles/plist_files/lapl_32be | Bin 1565 -> 1625 bytes test/testfiles/plist_files/lapl_32le | Bin 1565 -> 1625 bytes test/testfiles/plist_files/lapl_64be | Bin 1565 -> 1625 bytes test/testfiles/plist_files/lapl_64le | Bin 1565 -> 1625 bytes test/testflushrefresh.sh.in | 4 +- test/tfile.c | 123 +- test/unlink.c | 4 +- test/vds.c | 55 +- testpar/CMakeLists.txt | 4 +- testpar/CMakeTests.cmake | 22 +- testpar/t_cache.c | 44 +- tools/CMakeLists.txt | 6 +- tools/lib/CMakeLists.txt | 9 +- tools/lib/h5diff.c | 168 +-- tools/lib/h5diff_array.c | 25 +- tools/lib/h5diff_dset.c | 3 + tools/lib/h5tools_dump.c | 134 +- tools/src/CMakeLists.txt | 2 +- tools/src/h5copy/CMakeLists.txt | 35 +- tools/src/h5diff/CMakeLists.txt | 53 +- tools/src/h5dump/CMakeLists.txt | 39 +- tools/src/h5dump/h5dump_xml.c | 2 +- tools/src/h5format_convert/CMakeLists.txt | 21 +- tools/src/h5import/CMakeLists.txt | 21 +- tools/src/h5jam/CMakeLists.txt | 23 +- tools/src/h5ls/CMakeLists.txt | 39 +- tools/src/h5repack/CMakeLists.txt | 35 +- tools/src/h5repack/h5repack.c | 36 +- tools/src/h5repack/h5repack_copy.c | 24 +- tools/src/h5repack/h5repack_main.c | 425 +++--- tools/src/h5repack/h5repack_parse.c | 7 +- tools/src/h5repack/h5repack_verify.c | 9 +- tools/src/h5stat/CMakeLists.txt | 35 +- tools/src/misc/CMakeLists.txt | 27 +- tools/test/CMakeLists.txt | 2 +- tools/test/h5copy/CMakeLists.txt | 4 +- tools/test/h5copy/CMakeTests.cmake | 152 +- tools/test/h5copy/testh5copy.sh.in | 95 +- tools/test/h5diff/CMakeLists.txt | 32 +- tools/test/h5diff/CMakeTests.cmake | 143 +- tools/test/h5diff/Makefile.am | 16 + tools/test/h5diff/h5diffgentest.c | 263 +++- tools/test/h5diff/testh5diff.sh.in | 36 +- tools/test/h5dump/CMakeLists.txt | 32 +- tools/test/h5dump/CMakeTests.cmake | 150 +- tools/test/h5dump/CMakeTestsPBITS.cmake | 18 +- tools/test/h5dump/CMakeTestsVDS.cmake | 34 +- tools/test/h5dump/CMakeTestsXML.cmake | 26 +- tools/test/h5dump/Makefile.am | 16 +- tools/test/h5dump/h5dumpgentest.c | 152 +- tools/test/h5format_convert/CMakeLists.txt | 4 +- tools/test/h5format_convert/CMakeTests.cmake | 50 +- tools/test/h5format_convert/h5fc_gentest.c | 3 +- tools/test/h5format_convert/testh5fc.sh.in | 3 + tools/test/h5import/CMakeLists.txt | 2 +- tools/test/h5import/CMakeTests.cmake | 44 +- tools/test/h5jam/CMakeLists.txt | 4 +- tools/test/h5jam/CMakeTests.cmake | 68 +- tools/test/h5ls/CMakeLists.txt | 30 +- tools/test/h5ls/CMakeTests.cmake | 66 +- tools/test/h5ls/CMakeTestsVDS.cmake | 14 +- tools/test/h5ls/Makefile.am | 16 + tools/test/h5ls/testh5ls.sh.in | 38 +- tools/test/h5repack/CMakeLists.txt | 2 +- tools/test/h5repack/CMakeTests.cmake | 199 +-- tools/test/h5repack/h5repack.sh.in | 30 +- tools/test/h5repack/h5repacktst.c | 3 +- tools/test/h5stat/CMakeLists.txt | 4 +- tools/test/h5stat/CMakeTests.cmake | 18 +- tools/test/misc/CMakeLists.txt | 4 +- tools/test/misc/CMakeTests.cmake | 32 +- tools/test/misc/Makefile.am | 2 +- tools/test/misc/testh5repart.sh.in | 2 +- tools/test/misc/vds/CMakeLists.txt | 6 +- tools/test/perform/CMakeLists.txt | 8 +- tools/test/perform/CMakeTests.cmake | 111 +- tools/test/perform/sio_perf.c | 4 - 355 files changed, 25375 insertions(+), 22358 deletions(-) delete mode 100644 config/cmake_ext_mod/prunTest.cmake diff --git a/CMakeFilters.cmake b/CMakeFilters.cmake index b7aa77d..700ef15 100644 --- a/CMakeFilters.cmake +++ b/CMakeFilters.cmake @@ -17,14 +17,14 @@ if (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "GIT" OR HDF5_ALLOW_EXTERNAL_SUPPORT MAT elseif (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ") if (NOT TGZPATH) set (TGZPATH ${HDF5_SOURCE_DIR}) - endif (NOT TGZPATH) + endif () set (ZLIB_URL ${TGZPATH}/${ZLIB_TGZ_NAME}) set (SZIP_URL ${TGZPATH}/${SZIP_TGZ_NAME}) - else (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "GIT") + else () set (ZLIB_USE_EXTERNAL 0) set (SZIP_USE_EXTERNAL 0) - endif (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "GIT") -endif (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "GIT" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ") + endif () +endif () #----------------------------------------------------------------------------- # Option for ZLib support @@ -39,9 +39,9 @@ if (HDF5_ENABLE_Z_LIB_SUPPORT) if (ZLIB_FOUND) set (LINK_LIBS ${LINK_LIBS} ${ZLIB_LIBRARIES}) set (LINK_SHARED_LIBS ${LINK_SHARED_LIBS} ${ZLIB_LIBRARIES}) - endif (ZLIB_FOUND) - endif (NOT ZLIB_FOUND) - endif (NOT ZLIB_USE_EXTERNAL) + endif () + endif () + endif () if (ZLIB_FOUND) set (H5_HAVE_FILTER_DEFLATE 1) set (H5_HAVE_ZLIB_H 1) @@ -49,33 +49,33 @@ if (HDF5_ENABLE_Z_LIB_SUPPORT) set (H5_ZLIB_HEADER "zlib.h") set (ZLIB_INCLUDE_DIR_GEN ${ZLIB_INCLUDE_DIR}) set (ZLIB_INCLUDE_DIRS ${ZLIB_INCLUDE_DIRS} ${ZLIB_INCLUDE_DIR}) - else (ZLIB_FOUND) + else () if (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "GIT" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ") EXTERNAL_ZLIB_LIBRARY (${HDF5_ALLOW_EXTERNAL_SUPPORT}) set (H5_HAVE_FILTER_DEFLATE 1) set (H5_HAVE_ZLIB_H 1) set (H5_HAVE_LIBZ 1) message (STATUS "Filter ZLIB is built") - else (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "GIT" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ") + else () message (FATAL_ERROR " ZLib is Required for ZLib support in HDF5") - endif (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "GIT" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ") - endif (ZLIB_FOUND) - else (NOT H5_ZLIB_HEADER) + endif () + endif () + else () # This project is being called from within another and ZLib is already configured set (H5_HAVE_FILTER_DEFLATE 1) set (H5_HAVE_ZLIB_H 1) set (H5_HAVE_LIBZ 1) - endif (NOT H5_ZLIB_HEADER) + endif () if (H5_HAVE_FILTER_DEFLATE) set (EXTERNAL_FILTERS "${EXTERNAL_FILTERS} DEFLATE") - endif (H5_HAVE_FILTER_DEFLATE) + endif () if (BUILD_SHARED_LIBS) set (LINK_SHARED_LIBS ${LINK_SHARED_LIBS} ${ZLIB_SHARED_LIBRARY}) - endif (BUILD_SHARED_LIBS) + endif () set (LINK_LIBS ${LINK_LIBS} ${ZLIB_STATIC_LIBRARY}) INCLUDE_DIRECTORIES (${ZLIB_INCLUDE_DIRS}) message (STATUS "Filter ZLIB is ON") -endif (HDF5_ENABLE_Z_LIB_SUPPORT) +endif () #----------------------------------------------------------------------------- # Option for SzLib support @@ -90,37 +90,37 @@ if (HDF5_ENABLE_SZIP_SUPPORT) if (SZIP_FOUND) set (LINK_LIBS ${LINK_LIBS} ${SZIP_LIBRARIES}) set (LINK_SHARED_LIBS ${LINK_SHARED_LIBS} ${SZIP_LIBRARIES}) - endif (SZIP_FOUND) - endif (NOT SZIP_FOUND) - endif (NOT SZIP_USE_EXTERNAL) + endif () + endif () + endif () if (SZIP_FOUND) set (H5_HAVE_FILTER_SZIP 1) set (H5_HAVE_SZLIB_H 1) set (H5_HAVE_LIBSZ 1) set (SZIP_INCLUDE_DIR_GEN ${SZIP_INCLUDE_DIR}) set (SZIP_INCLUDE_DIRS ${SZIP_INCLUDE_DIRS} ${SZIP_INCLUDE_DIR}) - else (SZIP_FOUND) + else () if (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "GIT" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ") EXTERNAL_SZIP_LIBRARY (${HDF5_ALLOW_EXTERNAL_SUPPORT} ${HDF5_ENABLE_SZIP_ENCODING}) set (H5_HAVE_FILTER_SZIP 1) set (H5_HAVE_SZLIB_H 1) set (H5_HAVE_LIBSZ 1) message (STATUS "Filter SZIP is built") - else (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "GIT" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ") + else () message (FATAL_ERROR "SZIP is Required for SZIP support in HDF5") - endif (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "GIT" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ") - endif (SZIP_FOUND) + endif () + endif () if (BUILD_SHARED_LIBS) set (LINK_SHARED_LIBS ${LINK_SHARED_LIBS} ${SZIP_SHARED_LIBRARY}) - endif (BUILD_SHARED_LIBS) + endif () set (LINK_LIBS ${LINK_LIBS} ${SZIP_STATIC_LIBRARY}) INCLUDE_DIRECTORIES (${SZIP_INCLUDE_DIRS}) message (STATUS "Filter SZIP is ON") if (H5_HAVE_FILTER_SZIP) set (EXTERNAL_FILTERS "${EXTERNAL_FILTERS} DECODE") - endif (H5_HAVE_FILTER_SZIP) + endif () if (HDF5_ENABLE_SZIP_ENCODING) set (H5_HAVE_SZIP_ENCODER 1) set (EXTERNAL_FILTERS "${EXTERNAL_FILTERS} ENCODE") - endif (HDF5_ENABLE_SZIP_ENCODING) -endif (HDF5_ENABLE_SZIP_SUPPORT) + endif () +endif () diff --git a/CMakeInstallation.cmake b/CMakeInstallation.cmake index 65d2222..3f0f7ca 100644 --- a/CMakeInstallation.cmake +++ b/CMakeInstallation.cmake @@ -8,9 +8,9 @@ if (WIN32) find_program (NSIS_EXECUTABLE NSIS.exe PATHS "$ENV{ProgramFiles}\\NSIS" "$ENV{ProgramFiles${PF_ENV_EXT}}\\NSIS") if(NOT CPACK_WIX_ROOT) file(TO_CMAKE_PATH "$ENV{WIX}" CPACK_WIX_ROOT) - endif() + endif () find_program (WIX_EXECUTABLE candle PATHS "${CPACK_WIX_ROOT}/bin") -endif (WIN32) +endif () #----------------------------------------------------------------------------- # Add file(s) to CMake Install @@ -21,31 +21,33 @@ if (NOT HDF5_INSTALL_NO_DEVELOPMENT) DESTINATION ${HDF5_INSTALL_INCLUDE_DIR} COMPONENT headers ) -endif (NOT HDF5_INSTALL_NO_DEVELOPMENT) +endif () #----------------------------------------------------------------------------- # Add Target(s) to CMake Install for import into other projects #----------------------------------------------------------------------------- if (NOT HDF5_EXTERNALLY_CONFIGURED) - install ( - EXPORT ${HDF5_EXPORTED_TARGETS} - DESTINATION ${HDF5_INSTALL_CMAKE_DIR} - FILE ${HDF5_PACKAGE}${HDF_PACKAGE_EXT}-targets.cmake - NAMESPACE ${HDF5_PACKAGE}:: - COMPONENT configinstall - ) -endif (NOT HDF5_EXTERNALLY_CONFIGURED) - -#----------------------------------------------------------------------------- -# Export all exported targets to the build tree for use by parent project -#----------------------------------------------------------------------------- -if (NOT HDF5_EXTERNALLY_CONFIGURED) - export ( - TARGETS ${HDF5_LIBRARIES_TO_EXPORT} ${HDF5_LIB_DEPENDENCIES} ${HDF5_UTILS_TO_EXPORT} - FILE ${HDF5_PACKAGE}${HDF_PACKAGE_EXT}-targets.cmake - NAMESPACE ${HDF5_PACKAGE}:: - ) -endif (NOT HDF5_EXTERNALLY_CONFIGURED) + if (HDF5_EXPORTED_TARGETS) + install ( + EXPORT ${HDF5_EXPORTED_TARGETS} + DESTINATION ${HDF5_INSTALL_CMAKE_DIR} + FILE ${HDF5_PACKAGE}${HDF_PACKAGE_EXT}-targets.cmake + NAMESPACE ${HDF5_PACKAGE}:: + COMPONENT configinstall + ) + endif () + + #----------------------------------------------------------------------------- + # Export all exported targets to the build tree for use by parent project + #----------------------------------------------------------------------------- + if (NOT HDF5_EXTERNALLY_CONFIGURED) + export ( + TARGETS ${HDF5_LIBRARIES_TO_EXPORT} ${HDF5_LIB_DEPENDENCIES} ${HDF5_UTILS_TO_EXPORT} + FILE ${HDF5_PACKAGE}${HDF_PACKAGE_EXT}-targets.cmake + NAMESPACE ${HDF5_PACKAGE}:: + ) + endif () +endif () #----------------------------------------------------------------------------- # Set includes needed for build @@ -95,7 +97,7 @@ if (NOT HDF5_EXTERNALLY_CONFIGURED) DESTINATION ${HDF5_INSTALL_CMAKE_DIR} COMPONENT configinstall ) -endif (NOT HDF5_EXTERNALLY_CONFIGURED) +endif () #----------------------------------------------------------------------------- # Configure the hdf5-config-version .cmake file for the install directory @@ -110,16 +112,16 @@ if (NOT HDF5_EXTERNALLY_CONFIGURED) DESTINATION ${HDF5_INSTALL_CMAKE_DIR} COMPONENT configinstall ) -endif (NOT HDF5_EXTERNALLY_CONFIGURED) +endif () #----------------------------------------------------------------------------- # Configure the libhdf5.settings file for the lib info #----------------------------------------------------------------------------- if (H5_WORDS_BIGENDIAN) set (BYTESEX big-endian) -else (H5_WORDS_BIGENDIAN) +else () set (BYTESEX little-endian) -endif (H5_WORDS_BIGENDIAN) +endif () configure_file ( ${HDF_RESOURCES_DIR}/libhdf5.settings.cmake.in ${HDF5_BINARY_DIR}/libhdf5.settings @ONLY @@ -135,10 +137,10 @@ install ( #----------------------------------------------------------------------------- #foreach (libs ${LINK_LIBS}) # set (LIBS "${LIBS} -l${libs}") -#endforeach (libs ${LINK_LIBS}) +#endforeach () #foreach (libs ${HDF5_LIBRARIES_TO_EXPORT}) # set (HDF5LIBS "${HDF5LIBS} -l${libs}") -#endforeach (libs ${HDF5_LIBRARIES_TO_EXPORT}) +#endforeach () #configure_file ( # ${HDF_RESOURCES_DIR}/libhdf5.pc.in # ${HDF5_BINARY_DIR}/CMakeFiles/libhdf5.pc @ONLY @@ -178,8 +180,8 @@ if (HDF5_PACK_EXAMPLES) DESTINATION ${HDF5_INSTALL_DATA_DIR} COMPONENT hdfdocuments ) - endif (EXISTS "${HDF5_EXAMPLES_COMPRESSED_DIR}/${HDF5_EXAMPLES_COMPRESSED}") -endif (HDF5_PACK_EXAMPLES) + endif () +endif () #----------------------------------------------------------------------------- # Configure the README.txt file for the binary package @@ -191,7 +193,7 @@ HDF_README_PROPERTIES(HDF5_BUILD_FORTRAN) #----------------------------------------------------------------------------- if (WIN32) configure_file (${HDF5_SOURCE_DIR}/COPYING ${HDF5_BINARY_DIR}/COPYING.txt @ONLY) -endif (WIN32) +endif () #----------------------------------------------------------------------------- # Add Document File(s) to CMake Install @@ -214,7 +216,7 @@ if (NOT HDF5_EXTERNALLY_CONFIGURED) ${release_files} ${HDF5_SOURCE_DIR}/release_docs/USING_HDF5_VS.txt ) - endif (WIN32) + endif () if (HDF5_PACK_INSTALL_DOCS) set (release_files ${release_files} @@ -227,40 +229,40 @@ if (NOT HDF5_EXTERNALLY_CONFIGURED) ${release_files} ${HDF5_SOURCE_DIR}/release_docs/INSTALL_Windows.txt ) - endif (WIN32) + endif () if (CYGWIN) set (release_files ${release_files} ${HDF5_SOURCE_DIR}/release_docs/INSTALL_Cygwin.txt ) - endif (CYGWIN) + endif () if (HDF5_ENABLE_PARALLEL) set (release_files ${release_files} ${HDF5_SOURCE_DIR}/release_docs/INSTALL_parallel ) - endif (HDF5_ENABLE_PARALLEL) - endif (HDF5_PACK_INSTALL_DOCS) + endif () + endif () install ( FILES ${release_files} DESTINATION ${HDF5_INSTALL_DATA_DIR} COMPONENT hdfdocuments ) - endif (EXISTS "${HDF5_SOURCE_DIR}/release_docs" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/release_docs") -endif (NOT HDF5_EXTERNALLY_CONFIGURED) + endif () +endif () if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) if (CMAKE_HOST_UNIX) set (CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}/HDF_Group/${HDF5_PACKAGE_NAME}/${HDF5_PACKAGE_VERSION}" CACHE PATH "Install path prefix, prepended onto install directories." FORCE) - else (CMAKE_HOST_UNIX) + else () GetDefaultWindowsPrefixBase(CMAKE_GENERIC_PROGRAM_FILES) set (CMAKE_INSTALL_PREFIX "${CMAKE_GENERIC_PROGRAM_FILES}/HDF_Group/${HDF5_PACKAGE_NAME}/${HDF5_PACKAGE_VERSION}" CACHE PATH "Install path prefix, prepended onto install directories." FORCE) set (CMAKE_GENERIC_PROGRAM_FILES) - endif (CMAKE_HOST_UNIX) -endif (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) + endif () +endif () #----------------------------------------------------------------------------- # Set the cpack variables @@ -270,9 +272,9 @@ if (NOT HDF5_EXTERNALLY_CONFIGURED AND NOT HDF5_NO_PACKAGES) set (CPACK_PACKAGE_NAME "${HDF5_PACKAGE_NAME}") if (CDASH_LOCAL) set (CPACK_PACKAGE_VERSION "${HDF5_PACKAGE_VERSION}") - else (CDASH_LOCAL) + else () set (CPACK_PACKAGE_VERSION "${HDF5_PACKAGE_VERSION_STRING}") - endif (CDASH_LOCAL) + endif () set (CPACK_PACKAGE_VERSION_MAJOR "${HDF5_PACKAGE_VERSION_MAJOR}") set (CPACK_PACKAGE_VERSION_MINOR "${HDF5_PACKAGE_VERSION_MINOR}") set (CPACK_PACKAGE_VERSION_PATCH "") @@ -280,13 +282,13 @@ if (NOT HDF5_EXTERNALLY_CONFIGURED AND NOT HDF5_NO_PACKAGES) set (CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/release_docs/RELEASE.txt") set (CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/release_docs/COPYING") set (CPACK_RESOURCE_FILE_README "${CMAKE_CURRENT_SOURCE_DIR}/release_docs/RELEASE.txt") - endif (EXISTS "${HDF5_SOURCE_DIR}/release_docs") + endif () set (CPACK_PACKAGE_RELOCATABLE TRUE) if (OVERRIDE_INSTALL_VERSION) set (CPACK_PACKAGE_INSTALL_DIRECTORY "${CPACK_PACKAGE_VENDOR}/${CPACK_PACKAGE_NAME}/${OVERRIDE_INSTALL_VERSION}") - else (OVERRIDE_INSTALL_VERSION) + else () set (CPACK_PACKAGE_INSTALL_DIRECTORY "${CPACK_PACKAGE_VENDOR}/${CPACK_PACKAGE_NAME}/${CPACK_PACKAGE_VERSION}") - endif (OVERRIDE_INSTALL_VERSION) + endif () set (CPACK_PACKAGE_ICON "${HDF_RESOURCES_EXT_DIR}/hdf.bmp") set (CPACK_GENERATOR "TGZ") @@ -295,7 +297,7 @@ if (NOT HDF5_EXTERNALLY_CONFIGURED AND NOT HDF5_NO_PACKAGES) if (NSIS_EXECUTABLE) list (APPEND CPACK_GENERATOR "NSIS") - endif (NSIS_EXECUTABLE) + endif () # Installers for 32- vs. 64-bit CMake: # - Root install directory (displayed to end user at installer-run time) # - "NSIS package/display name" (text used in the installer GUI) @@ -304,10 +306,10 @@ if (NOT HDF5_EXTERNALLY_CONFIGURED AND NOT HDF5_NO_PACKAGES) if (CMAKE_CL_64) set (CPACK_NSIS_INSTALL_ROOT "$PROGRAMFILES64") set (CPACK_PACKAGE_INSTALL_REGISTRY_KEY "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION} (Win64)") - else (CMAKE_CL_64) + else () set (CPACK_NSIS_INSTALL_ROOT "$PROGRAMFILES") set (CPACK_PACKAGE_INSTALL_REGISTRY_KEY "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}") - endif (CMAKE_CL_64) + endif () # set the install/unistall icon used for the installer itself # There is a bug in NSI that does not handle full unix paths properly. set (CPACK_NSIS_MUI_ICON "${HDF_RESOURCES_EXT_DIR}\\\\hdf.ico") @@ -317,15 +319,15 @@ if (NOT HDF5_EXTERNALLY_CONFIGURED AND NOT HDF5_NO_PACKAGES) set (CPACK_NSIS_DISPLAY_NAME "${CPACK_NSIS_PACKAGE_NAME}") if (OVERRIDE_INSTALL_VERSION) set (CPACK_PACKAGE_INSTALL_DIRECTORY "${CPACK_PACKAGE_VENDOR}\\\\${CPACK_PACKAGE_NAME}\\\\${OVERRIDE_INSTALL_VERSION}") - else (OVERRIDE_INSTALL_VERSION) + else () set (CPACK_PACKAGE_INSTALL_DIRECTORY "${CPACK_PACKAGE_VENDOR}\\\\${CPACK_PACKAGE_NAME}\\\\${CPACK_PACKAGE_VERSION}") - endif (OVERRIDE_INSTALL_VERSION) + endif () set (CPACK_NSIS_CONTACT "${HDF5_PACKAGE_BUGREPORT}") set (CPACK_NSIS_MODIFY_PATH ON) if (WIX_EXECUTABLE) list (APPEND CPACK_GENERATOR "WIX") - endif (WIX_EXECUTABLE) + endif () #WiX variables set (CPACK_WIX_UNINSTALL "1") # .. variable:: CPACK_WIX_LICENSE_RTF @@ -368,7 +370,7 @@ if (NOT HDF5_EXTERNALLY_CONFIGURED AND NOT HDF5_NO_PACKAGES) set(CPACK_WIX_PROPERTY_ARPHELPLINK "${HDF5_PACKAGE_BUGREPORT}") if (BUILD_SHARED_LIBS) set(CPACK_WIX_PATCH_FILE "${HDF_RESOURCES_DIR}/patch.xml") - endif (BUILD_SHARED_LIBS) + endif () elseif (APPLE) list (APPEND CPACK_GENERATOR "STGZ") list (APPEND CPACK_GENERATOR "DragNDrop") @@ -403,8 +405,8 @@ if (NOT HDF5_EXTERNALLY_CONFIGURED AND NOT HDF5_NO_PACKAGES) FILES ${HDF5_BINARY_DIR}/CMakeFiles/PkgInfo DESTINATION .. ) - endif (HDF5_PACK_MACOSX_FRAMEWORK AND HDF5_BUILD_FRAMEWORKS) - else (WIN32) + endif () + else () list (APPEND CPACK_GENERATOR "STGZ") set (CPACK_PACKAGING_INSTALL_PREFIX "/${CPACK_PACKAGE_INSTALL_DIRECTORY}") set (CPACK_COMPONENTS_ALL_IN_ONE_PACKAGE ON) @@ -442,12 +444,12 @@ The HDF5 data model, file format, API, library, and tools are open and distribut #----------------------------------------------------------------------------- # configure_file ("${HDF5_RESOURCES_DIR}/hdf5.spec.in" "${CMAKE_CURRENT_BINARY_DIR}/${HDF5_PACKAGE_NAME}.spec" @ONLY IMMEDIATE) # set (CPACK_RPM_USER_BINARY_SPECFILE "${CMAKE_CURRENT_BINARY_DIR}/${HDF5_PACKAGE_NAME}.spec") - endif (WIN32) + endif () # By default, do not warn when built on machines using only VS Express: if (NOT DEFINED CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS) set (CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS ON) - endif (NOT DEFINED CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS) + endif () include (InstallRequiredSystemLibraries) set (CPACK_INSTALL_CMAKE_PROJECTS "${HDF5_BINARY_DIR};HDF5;ALL;/") @@ -457,23 +459,23 @@ The HDF5 data model, file format, API, library, and tools are open and distribut if (ZLIB_FOUND AND ZLIB_USE_EXTERNAL) if (WIN32) set (CPACK_INSTALL_CMAKE_PROJECTS "${CPACK_INSTALL_CMAKE_PROJECTS};${ZLIB_INCLUDE_DIR_GEN};ZLIB;ALL;/") - else (WIN32) + else () set (CPACK_INSTALL_CMAKE_PROJECTS "${CPACK_INSTALL_CMAKE_PROJECTS};${ZLIB_INCLUDE_DIR_GEN};ZLIB;libraries;/") set (CPACK_INSTALL_CMAKE_PROJECTS "${CPACK_INSTALL_CMAKE_PROJECTS};${ZLIB_INCLUDE_DIR_GEN};ZLIB;headers;/") set (CPACK_INSTALL_CMAKE_PROJECTS "${CPACK_INSTALL_CMAKE_PROJECTS};${ZLIB_INCLUDE_DIR_GEN};ZLIB;configinstall;/") - endif (WIN32) - endif (ZLIB_FOUND AND ZLIB_USE_EXTERNAL) + endif () + endif () if (SZIP_FOUND AND SZIP_USE_EXTERNAL) if (WIN32) set (CPACK_INSTALL_CMAKE_PROJECTS "${CPACK_INSTALL_CMAKE_PROJECTS};${SZIP_INCLUDE_DIR_GEN};SZIP;ALL;/") - else (WIN32) + else () set (CPACK_INSTALL_CMAKE_PROJECTS "${CPACK_INSTALL_CMAKE_PROJECTS};${SZIP_INCLUDE_DIR_GEN};SZIP;libraries;/") set (CPACK_INSTALL_CMAKE_PROJECTS "${CPACK_INSTALL_CMAKE_PROJECTS};${SZIP_INCLUDE_DIR_GEN};SZIP;headers;/") set (CPACK_INSTALL_CMAKE_PROJECTS "${CPACK_INSTALL_CMAKE_PROJECTS};${SZIP_INCLUDE_DIR_GEN};SZIP;configinstall;/") - endif (WIN32) - endif (SZIP_FOUND AND SZIP_USE_EXTERNAL) - endif (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ") - endif (HDF5_PACKAGE_EXTLIBS) + endif () + endif () + endif () + endif () include (CPack) @@ -537,7 +539,7 @@ The HDF5 data model, file format, API, library, and tools are open and distribut GROUP Development INSTALL_TYPES Full Developer ) - endif (HDF5_BUILD_FORTRAN) + endif () if (HDF5_BUILD_CPP_LIB) cpack_add_component (cpplibraries @@ -552,7 +554,7 @@ The HDF5 data model, file format, API, library, and tools are open and distribut GROUP Development INSTALL_TYPES Full Developer ) - endif (HDF5_BUILD_CPP_LIB) + endif () if (HDF5_BUILD_TOOLS) cpack_add_component (toolsapplications @@ -573,7 +575,7 @@ The HDF5 data model, file format, API, library, and tools are open and distribut GROUP Development INSTALL_TYPES Full Developer ) - endif (HDF5_BUILD_TOOLS) + endif () if (HDF5_BUILD_HL_LIB) cpack_add_component (hllibraries @@ -607,7 +609,7 @@ The HDF5 data model, file format, API, library, and tools are open and distribut GROUP Development INSTALL_TYPES Full Developer ) - endif (HDF5_BUILD_CPP_LIB) + endif () if (HDF5_BUILD_FORTRAN) cpack_add_component (hlfortlibraries DISPLAY_NAME "HDF5 HL Fortran Libraries" @@ -615,7 +617,7 @@ The HDF5 data model, file format, API, library, and tools are open and distribut GROUP Runtime INSTALL_TYPES Full Developer User ) - endif (HDF5_BUILD_FORTRAN) - endif (HDF5_BUILD_HL_LIB) + endif () + endif () -endif (NOT HDF5_EXTERNALLY_CONFIGURED AND NOT HDF5_NO_PACKAGES) +endif () diff --git a/CMakeLists.txt b/CMakeLists.txt index b59943e..11c9b53 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 3.1.0) +cmake_minimum_required (VERSION 3.2.2) PROJECT (HDF5 C CXX) #----------------------------------------------------------------------------- @@ -76,13 +76,13 @@ endif () # # Override the zlib header file # if (VTK_USE_SYSTEM_ZLIB) # set (H5_ZLIB_HEADER "zlib.h") -# else (VTK_USE_SYSTEM_ZLIB) +# else () # set (H5_ZLIB_HEADER "vtk_zlib.h") # # Set vars that FindZlib would have set if used in sub project # set (ZLIB_INCLUDE_DIRS "${VTK_ZLIB_INCLUDE_DIRS}") # set (ZLIB_LIBRARIES vtkzlib) -# endif (VTK_USE_SYSTEM_ZLIB) -# endif (HDF5_ENABLE_Z_LIB_SUPPORT) +# endif () +# endif () # # # Add the sub project # add_subdirectory (Utilities/hdf5-1.8) @@ -100,7 +100,7 @@ option (HDF5_USE_FOLDERS "Enable folder grouping of projects in IDEs." ON) mark_as_advanced (HDF5_USE_FOLDERS) if (HDF5_USE_FOLDERS) set_property (GLOBAL PROPERTY USE_FOLDERS ON) -endif (HDF5_USE_FOLDERS) +endif () option (HDF5_NO_PACKAGES "CPACK - Disable packaging" OFF) mark_as_advanced (HDF5_NO_PACKAGES) option (ALLOW_UNSUPPORTED "Allow unsupported combinations of configure options" OFF) @@ -201,48 +201,48 @@ set (HDF5_JAVA_LOGGING_SIMPLE_JAR ${HDF5_SOURCE_DIR}/java/lib/ext/slf4j-simple- if (APPLE) option (HDF5_BUILD_FRAMEWORKS "TRUE to build as frameworks libraries, FALSE to build according to BUILD_SHARED_LIBS" FALSE) -endif (APPLE) +endif () if (NOT HDF5_INSTALL_BIN_DIR) set (HDF5_INSTALL_BIN_DIR bin) -endif (NOT HDF5_INSTALL_BIN_DIR) +endif () if (NOT HDF5_INSTALL_LIB_DIR) if (APPLE) if (HDF5_BUILD_FRAMEWORKS) set (HDF5_INSTALL_JAR_DIR ../Java) - else (HDF5_BUILD_FRAMEWORKS) + else () set (HDF5_INSTALL_JAR_DIR lib) - endif (HDF5_BUILD_FRAMEWORKS) + endif () set (HDF5_INSTALL_FMWK_DIR ${CMAKE_INSTALL_FRAMEWORK_PREFIX}) - else (APPLE) + else () set (HDF5_INSTALL_JAR_DIR lib) - endif (APPLE) + endif () set (HDF5_INSTALL_LIB_DIR lib) -endif (NOT HDF5_INSTALL_LIB_DIR) +endif () if (NOT HDF5_INSTALL_INCLUDE_DIR) set (HDF5_INSTALL_INCLUDE_DIR include) -endif (NOT HDF5_INSTALL_INCLUDE_DIR) +endif () if (NOT HDF5_INSTALL_DATA_DIR) if (NOT WIN32) if (APPLE) if (HDF5_BUILD_FRAMEWORKS) set (HDF5_INSTALL_EXTRA_DIR ../SharedSupport) - else (HDF5_BUILD_FRAMEWORKS) + else () set (HDF5_INSTALL_EXTRA_DIR share) - endif (HDF5_BUILD_FRAMEWORKS) + endif () set (HDF5_INSTALL_FWRK_DIR ${CMAKE_INSTALL_FRAMEWORK_PREFIX}) - endif (APPLE) + endif () set (HDF5_INSTALL_DATA_DIR share) set (HDF5_INSTALL_CMAKE_DIR share/cmake) - else (NOT WIN32) + else () set (HDF5_INSTALL_DATA_DIR ".") set (HDF5_INSTALL_CMAKE_DIR cmake) - endif (NOT WIN32) -endif (NOT HDF5_INSTALL_DATA_DIR) + endif () +endif () -if(DEFINED ADDITIONAL_CMAKE_PREFIX_PATH AND EXISTS "${ADDITIONAL_CMAKE_PREFIX_PATH}") +if (DEFINED ADDITIONAL_CMAKE_PREFIX_PATH AND EXISTS "${ADDITIONAL_CMAKE_PREFIX_PATH}") set (CMAKE_PREFIX_PATH ${ADDITIONAL_CMAKE_PREFIX_PATH} ${CMAKE_PREFIX_PATH}) -endif(DEFINED ADDITIONAL_CMAKE_PREFIX_PATH AND EXISTS "${ADDITIONAL_CMAKE_PREFIX_PATH}") +endif () #----------------------------------------------------------------------------- # parse the full version number from H5public.h and include in H5_VERS_INFO @@ -268,74 +268,74 @@ string (REGEX REPLACE ".*LT_VERS_REVISION[ \t]+=[ \t]+([0-9]*).*$" "\\1" H5_SOVERS_MINOR ${_lt_vers_am_contents}) string (REGEX REPLACE ".*LT_VERS_AGE[ \t]+=[ \t]+([0-9]*).*$" "\\1" H5_SOVERS_RELEASE ${_lt_vers_am_contents}) -MATH (EXPR H5_SOVERS_MAJOR ${H5_SOVERS_INTERFACE}-${H5_SOVERS_RELEASE}) +math (EXPR H5_SOVERS_MAJOR ${H5_SOVERS_INTERFACE}-${H5_SOVERS_RELEASE}) message (STATUS "SOVERSION: ${H5_SOVERS_MAJOR}.${H5_SOVERS_RELEASE}.${H5_SOVERS_MINOR}") string (REGEX MATCH ".*LT_TOOLS_VERS_INTERFACE[ \t]+=[ \t]+([0-9]*).*$" H5_TOOLS_SOVERS_EXISTS ${_lt_vers_am_contents}) -if(H5_TOOLS_SOVERS_EXISTS) +if (H5_TOOLS_SOVERS_EXISTS) string (REGEX REPLACE ".*LT_TOOLS_VERS_INTERFACE[ \t]+=[ \t]+([0-9]*).*$" "\\1" H5_TOOLS_SOVERS_INTERFACE ${_lt_vers_am_contents}) string (REGEX REPLACE ".*LT_TOOLS_VERS_REVISION[ \t]+=[ \t]+([0-9]*).*$" "\\1" H5_TOOLS_SOVERS_MINOR ${_lt_vers_am_contents}) string (REGEX REPLACE ".*LT_TOOLS_VERS_AGE[ \t]+=[ \t]+([0-9]*).*$" "\\1" H5_TOOLS_SOVERS_RELEASE ${_lt_vers_am_contents}) - MATH (EXPR H5_TOOLS_SOVERS_MAJOR ${H5_TOOLS_SOVERS_INTERFACE}-${H5_TOOLS_SOVERS_RELEASE}) + math (EXPR H5_TOOLS_SOVERS_MAJOR ${H5_TOOLS_SOVERS_INTERFACE}-${H5_TOOLS_SOVERS_RELEASE}) message (STATUS "SOVERSION_TOOLS: ${H5_TOOLS_SOVERS_MAJOR}.${H5_TOOLS_SOVERS_RELEASE}.${H5_TOOLS_SOVERS_MINOR}") -endif() +endif () string (REGEX REPLACE ".*LT_CXX_VERS_INTERFACE[ \t]+=[ \t]+([0-9]*).*$" H5_CXX_SOVERS_EXISTS ${_lt_vers_am_contents}) -if(H5_CXX_SOVERS_EXISTS) +if (H5_CXX_SOVERS_EXISTS) string (REGEX REPLACE ".*LT_CXX_VERS_INTERFACE[ \t]+=[ \t]+([0-9]*).*$" "\\1" H5_CXX_SOVERS_INTERFACE ${_lt_vers_am_contents}) string (REGEX REPLACE ".*LT_CXX_VERS_REVISION[ \t]+=[ \t]+([0-9]*).*$" "\\1" H5_CXX_SOVERS_MINOR ${_lt_vers_am_contents}) string (REGEX REPLACE ".*LT_CXX_VERS_AGE[ \t]+=[ \t]+([0-9]*).*$" "\\1" H5_CXX_SOVERS_RELEASE ${_lt_vers_am_contents}) - MATH (EXPR H5_CXX_SOVERS_MAJOR ${H5_CXX_SOVERS_INTERFACE}-${H5_CXX_SOVERS_RELEASE}) + math (EXPR H5_CXX_SOVERS_MAJOR ${H5_CXX_SOVERS_INTERFACE}-${H5_CXX_SOVERS_RELEASE}) message (STATUS "SOVERSION_CXX: ${H5_CXX_SOVERS_MAJOR}.${H5_CXX_SOVERS_RELEASE}.${H5_CXX_SOVERS_MINOR}") -endif() +endif () string (REGEX REPLACE ".*LT_F_VERS_INTERFACE[ \t]+=[ \t]+([0-9]*).*$" H5_F_SOVERS_EXISTS ${_lt_vers_am_contents}) -if(H5_F_SOVERS_EXISTS) +if (H5_F_SOVERS_EXISTS) string (REGEX REPLACE ".*LT_F_VERS_INTERFACE[ \t]+=[ \t]+([0-9]*).*$" "\\1" H5_F_SOVERS_INTERFACE ${_lt_vers_am_contents}) string (REGEX REPLACE ".*LT_F_VERS_REVISION[ \t]+=[ \t]+([0-9]*).*$" "\\1" H5_F_SOVERS_MINOR ${_lt_vers_am_contents}) string (REGEX REPLACE ".*LT_F_VERS_AGE[ \t]+=[ \t]+([0-9]*).*$" "\\1" H5_F_SOVERS_RELEASE ${_lt_vers_am_contents}) - MATH (EXPR H5_F_SOVERS_MAJOR ${H5_F_SOVERS_INTERFACE}-${H5_F_SOVERS_RELEASE}) + math (EXPR H5_F_SOVERS_MAJOR ${H5_F_SOVERS_INTERFACE}-${H5_F_SOVERS_RELEASE}) message (STATUS "SOVERSION_F: ${H5_F_SOVERS_MAJOR}.${H5_F_SOVERS_RELEASE}.${H5_F_SOVERS_MINOR}") -endif() +endif () string (REGEX REPLACE ".*LT_HL_VERS_INTERFACE[ \t]+=[ \t]+([0-9]*).*$" H5_HL_SOVERS_EXISTS ${_lt_vers_am_contents}) -if(H5_HL_SOVERS_EXISTS) +if (H5_HL_SOVERS_EXISTS) string (REGEX REPLACE ".*LT_HL_VERS_INTERFACE[ \t]+=[ \t]+([0-9]*).*$" "\\1" H5_HL_SOVERS_INTERFACE ${_lt_vers_am_contents}) string (REGEX REPLACE ".*LT_HL_VERS_REVISION[ \t]+=[ \t]+([0-9]*).*$" "\\1" H5_HL_SOVERS_MINOR ${_lt_vers_am_contents}) string (REGEX REPLACE ".*LT_HL_VERS_AGE[ \t]+=[ \t]+([0-9]*).*$" "\\1" H5_HL_SOVERS_RELEASE ${_lt_vers_am_contents}) - MATH (EXPR H5_HL_SOVERS_MAJOR ${H5_HL_SOVERS_INTERFACE}-${H5_HL_SOVERS_RELEASE}) + math (EXPR H5_HL_SOVERS_MAJOR ${H5_HL_SOVERS_INTERFACE}-${H5_HL_SOVERS_RELEASE}) message (STATUS "SOVERSION_HL: ${H5_HL_SOVERS_MAJOR}.${H5_HL_SOVERS_RELEASE}.${H5_HL_SOVERS_MINOR}") -endif() +endif () string (REGEX REPLACE ".*LT_HL_CXX_VERS_INTERFACE[ \t]+=[ \t]+([0-9]*).*$" H5_HL_CXX_SOVERS_EXISTS ${_lt_vers_am_contents}) -if(H5_HL_CXX_SOVERS_EXISTS) +if (H5_HL_CXX_SOVERS_EXISTS) string (REGEX REPLACE ".*LT_HL_CXX_VERS_INTERFACE[ \t]+=[ \t]+([0-9]*).*$" "\\1" H5_HL_CXX_SOVERS_INTERFACE ${_lt_vers_am_contents}) string (REGEX REPLACE ".*LT_HL_CXX_VERS_REVISION[ \t]+=[ \t]+([0-9]*).*$" "\\1" H5_HL_CXX_SOVERS_MINOR ${_lt_vers_am_contents}) string (REGEX REPLACE ".*LT_HL_CXX_VERS_AGE[ \t]+=[ \t]+([0-9]*).*$" "\\1" H5_HL_CXX_SOVERS_RELEASE ${_lt_vers_am_contents}) - MATH (EXPR H5_HL_CXX_SOVERS_MAJOR ${H5_HL_CXX_SOVERS_INTERFACE}-${H5_HL_CXX_SOVERS_RELEASE}) + math (EXPR H5_HL_CXX_SOVERS_MAJOR ${H5_HL_CXX_SOVERS_INTERFACE}-${H5_HL_CXX_SOVERS_RELEASE}) message (STATUS "SOVERSION_HL_CXX: ${H5_HL_CXX_SOVERS_MAJOR}.${H5_HL_CXX_SOVERS_RELEASE}.${H5_HL_CXX_SOVERS_MINOR}") -endif() +endif () string (REGEX REPLACE ".*LT_HL_F_VERS_INTERFACE[ \t]+=[ \t]+([0-9]*).*$" H5_HL_F_SOVERS_EXISTS ${_lt_vers_am_contents}) -if(H5_HL_F_SOVERS_EXISTS) +if (H5_HL_F_SOVERS_EXISTS) string (REGEX REPLACE ".*LT_HL_F_VERS_INTERFACE[ \t]+=[ \t]+([0-9]*).*$" "\\1" H5_HL_F_SOVERS_INTERFACE ${_lt_vers_am_contents}) string (REGEX REPLACE ".*LT_HL_F_VERS_REVISION[ \t]+=[ \t]+([0-9]*).*$" "\\1" H5_HL_F_SOVERS_MINOR ${_lt_vers_am_contents}) string (REGEX REPLACE ".*LT_HL_F_VERS_AGE[ \t]+=[ \t]+([0-9]*).*$" "\\1" H5_HL_F_SOVERS_RELEASE ${_lt_vers_am_contents}) - MATH (EXPR H5_HL_F_SOVERS_MAJOR ${H5_HL_F_SOVERS_INTERFACE}-${H5_HL_F_SOVERS_RELEASE}) + math (EXPR H5_HL_F_SOVERS_MAJOR ${H5_HL_F_SOVERS_INTERFACE}-${H5_HL_F_SOVERS_RELEASE}) message (STATUS "SOVERSION_HL_F: ${H5_HL_F_SOVERS_MAJOR}.${H5_HL_F_SOVERS_RELEASE}.${H5_HL_F_SOVERS_MINOR}") -endif() +endif () string (REGEX REPLACE ".*LT_JAVA_VERS_INTERFACE[ \t]+=[ \t]+([0-9]*).*$" H5_JAVA_SOVERS_EXISTS ${_lt_vers_am_contents}) if(H5_JAVA_SOVERS_EXISTS) string (REGEX REPLACE ".*LT_JAVA_VERS_INTERFACE[ \t]+=[ \t]+([0-9]*).*$" @@ -344,9 +344,9 @@ if(H5_JAVA_SOVERS_EXISTS) "\\1" H5_JAVA_SOVERS_MINOR ${_lt_vers_am_contents}) string (REGEX REPLACE ".*LT_JAVA_VERS_AGE[ \t]+=[ \t]+([0-9]*).*$" "\\1" H5_JAVA_SOVERS_RELEASE ${_lt_vers_am_contents}) - MATH (EXPR H5_JAVA_SOVERS_MAJOR ${H5_JAVA_SOVERS_INTERFACE}-${H5_JAVA_SOVERS_RELEASE}) + math (EXPR H5_JAVA_SOVERS_MAJOR ${H5_JAVA_SOVERS_INTERFACE}-${H5_JAVA_SOVERS_RELEASE}) message (STATUS "SOVERSION_JAVA: ${H5_JAVA_SOVERS_MAJOR}.${H5_JAVA_SOVERS_RELEASE}.${H5_JAVA_SOVERS_MINOR}") -endif() +endif () #----------------------------------------------------------------------------- # Basic HDF5 stuff here @@ -358,45 +358,45 @@ set (HDF5_PACKAGE_VERSION_MAJOR "${H5_VERS_MAJOR}.${H5_VERS_MINOR}") set (HDF5_PACKAGE_VERSION_MINOR "${H5_VERS_RELEASE}") if (NOT "${H5_VERS_SUBRELEASE}" STREQUAL "") set (HDF5_PACKAGE_VERSION_STRING "${HDF5_PACKAGE_VERSION}-${H5_VERS_SUBRELEASE}") -else (NOT "${H5_VERS_SUBRELEASE}" STREQUAL "") +else () set (HDF5_PACKAGE_VERSION_STRING "${HDF5_PACKAGE_VERSION}") -endif (NOT "${H5_VERS_SUBRELEASE}" STREQUAL "") +endif () set (HDF5_PACKAGE_SOVERSION "${H5_SOVERS_MAJOR}.${H5_SOVERS_RELEASE}.${H5_SOVERS_MINOR}") -if(H5_TOOLS_SOVERS_EXISTS) +if (H5_TOOLS_SOVERS_EXISTS) set (HDF5_TOOLS_PACKAGE_SOVERSION "${H5_TOOLS_SOVERS_MAJOR}.${H5_TOOLS_SOVERS_RELEASE}.${H5_TOOLS_SOVERS_MINOR}") -else() +else () set (HDF5_TOOLS_PACKAGE_SOVERSION "${H5_SOVERS_MAJOR}.${H5_SOVERS_RELEASE}.${H5_SOVERS_MINOR}") -endif() -if(H5_CXX_SOVERS_EXISTS) +endif () +if (H5_CXX_SOVERS_EXISTS) set (HDF5_CXX_PACKAGE_SOVERSION "${H5_CXX_SOVERS_MAJOR}.${H5_CXX_SOVERS_RELEASE}.${H5_CXX_SOVERS_MINOR}") -else() +else () set (HDF5_CXX_PACKAGE_SOVERSION "${H5_SOVERS_MAJOR}.${H5_SOVERS_RELEASE}.${H5_SOVERS_MINOR}") -endif() -if(H5_F_SOVERS_EXISTS) +endif () +if (H5_F_SOVERS_EXISTS) set (HDF5_F_PACKAGE_SOVERSION "${H5_F_SOVERS_MAJOR}.${H5_F_SOVERS_RELEASE}.${H5_F_SOVERS_MINOR}") -else() +else () set (HDF5_F_PACKAGE_SOVERSION "${H5_SOVERS_MAJOR}.${H5_SOVERS_RELEASE}.${H5_SOVERS_MINOR}") -endif() -if(H5_HL_SOVERS_EXISTS) +endif () +if (H5_HL_SOVERS_EXISTS) set (HDF5_HL_PACKAGE_SOVERSION "${H5_HL_SOVERS_MAJOR}.${H5_HL_SOVERS_RELEASE}.${H5_HL_SOVERS_MINOR}") -else() +else () set (HDF5_HL_PACKAGE_SOVERSION "${H5_SOVERS_MAJOR}.${H5_SOVERS_RELEASE}.${H5_SOVERS_MINOR}") -endif() -if(H5_HL_F_SOVERS_EXISTS) +endif () +if (H5_HL_F_SOVERS_EXISTS) set (HDF5_HL_CXX_PACKAGE_SOVERSION "${H5_HL_CXX_SOVERS_MAJOR}.${H5_HL_CXX_SOVERS_RELEASE}.${H5_HL_CXX_SOVERS_MINOR}") -else() +else () set (HDF5_HL_CXX_PACKAGE_SOVERSION "${H5_SOVERS_MAJOR}.${H5_SOVERS_RELEASE}.${H5_SOVERS_MINOR}") -endif() -if(H5_HL_F_SOVERS_EXISTS) +endif () +if (H5_HL_F_SOVERS_EXISTS) set (HDF5_HL_F_PACKAGE_SOVERSION "${H5_HL_F_SOVERS_MAJOR}.${H5_HL_F_SOVERS_RELEASE}.${H5_HL_F_SOVERS_MINOR}") -else() +else () set (HDF5_HL_F_PACKAGE_SOVERSION "${H5_SOVERS_MAJOR}.${H5_SOVERS_RELEASE}.${H5_SOVERS_MINOR}") -endif() -if(H5_JAVA_SOVERS_EXISTS) +endif () +if (H5_JAVA_SOVERS_EXISTS) set (HDF5_PACKAGE_SOVERSION "${H5_JAVA_SOVERS_MAJOR}.${H5_JAVA_SOVERS_RELEASE}.${H5_JAVA_SOVERS_MINOR}") -else() +else () set (HDF5_JAVA_PACKAGE_SOVERSION "${H5_SOVERS_MAJOR}.${H5_SOVERS_RELEASE}.${H5_SOVERS_MINOR}") -endif() +endif () set (HDF5_PACKAGE_STRING "${HDF5_PACKAGE_NAME} ${HDF5_PACKAGE_VERSION_STRING}") set (HDF5_PACKAGE_TARNAME "${HDF5_PACKAGE}${HDF_PACKAGE_EXT}") set (HDF5_PACKAGE_URL "http://www.hdfgroup.org") @@ -427,16 +427,19 @@ if (NOT HDF5_EXTERNALLY_CONFIGURED) ) if (WIN32) set (CMAKE_TEST_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${CMAKE_BUILD_TYPE}) - else (WIN32) + set (CMAKE_PDB_OUTPUT_DIRECTORY + ${PROJECT_BINARY_DIR}/bin CACHE PATH "Single Directory for all pdb files." + ) + else () set (CMAKE_TEST_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) - endif (WIN32) -else (NOT HDF5_EXTERNALLY_CONFIGURED) + endif () +else () # if we are externally configured, but the project uses old cmake scripts # this may not be set and utilities like H5detect will fail if (NOT CMAKE_RUNTIME_OUTPUT_DIRECTORY) set (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${EXECUTABLE_OUTPUT_PATH}) - endif (NOT CMAKE_RUNTIME_OUTPUT_DIRECTORY) -endif (NOT HDF5_EXTERNALLY_CONFIGURED) + endif () +endif () #----------------------------------------------------------------------------- # Targets built within this project are exported at Install time for use @@ -444,7 +447,7 @@ endif (NOT HDF5_EXTERNALLY_CONFIGURED) #----------------------------------------------------------------------------- if (NOT HDF5_EXPORTED_TARGETS) set (HDF5_EXPORTED_TARGETS "hdf5-targets") -endif (NOT HDF5_EXPORTED_TARGETS) +endif () #----------------------------------------------------------------------------- # To include a library in the list exported by the project AT BUILD TIME, @@ -470,17 +473,17 @@ set (CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE ON) #----------------------------------------------------------------------------- if (HDF5_BUILD_FRAMEWORKS AND NOT BUILD_SHARED_LIBS) set (BUILD_SHARED_LIBS ON CACHE BOOL "Build Shared Libraries") -endif (HDF5_BUILD_FRAMEWORKS AND NOT BUILD_SHARED_LIBS) +endif () #----------------------------------------------------------------------------- -# Option to Build Shared and Static libs, default is static +# Option to Build Shared and Static libs, default is both #----------------------------------------------------------------------------- option (BUILD_SHARED_LIBS "Build Shared Libraries" ON) set (H5_ENABLE_SHARED_LIB NO) if (BUILD_SHARED_LIBS) set (H5_ENABLE_SHARED_LIB YES) set (LINK_SHARED_LIBS ${LINK_LIBS}) -endif (BUILD_SHARED_LIBS) +endif () set (H5_ENABLE_STATIC_LIB YES) set (CMAKE_POSITION_INDEPENDENT_CODE ON) @@ -492,8 +495,8 @@ if (BUILD_STATIC_EXECS) if (NOT WIN32) set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -static") set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static") - endif (NOT WIN32) -endif (BUILD_STATIC_EXECS) + endif () +endif () #----------------------------------------------------------------------------- # Option to use code coverage @@ -503,7 +506,7 @@ if (HDF5_ENABLE_COVERAGE) set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -O0 -fprofile-arcs -ftest-coverage") set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -O0 -fprofile-arcs -ftest-coverage") set (LDFLAGS "${LDFLAGS} -fprofile-arcs -ftest-coverage") -endif (HDF5_ENABLE_COVERAGE) +endif () #----------------------------------------------------------------------------- # Option to indicate using dmalloc @@ -512,7 +515,7 @@ endif (HDF5_ENABLE_COVERAGE) # if (HDF5_ENABLE_USING_DMALLOC) # find_package (DMALLOC) # set (H5_HAVE_DMALLOC DMALLOC_FOUND) -# endif (HDF5_ENABLE_USING_DMALLOC) +# endif () #----------------------------------------------------------------------------- # Option to indicate using a memory checker @@ -520,7 +523,7 @@ endif (HDF5_ENABLE_COVERAGE) option (HDF5_ENABLE_USING_MEMCHECKER "Indicate that a memory checker is used" OFF) if (HDF5_ENABLE_USING_MEMCHECKER) set (H5_USING_MEMCHECKER 1) -endif (HDF5_ENABLE_USING_MEMCHECKER) +endif () #----------------------------------------------------------------------------- # Option to indicate internal memory allocation sanity checks are enabled @@ -528,7 +531,7 @@ endif (HDF5_ENABLE_USING_MEMCHECKER) option (HDF5_MEMORY_ALLOC_SANITY_CHECK "Indicate that internal memory allocation sanity checks are enabled" OFF) if (HDF5_MEMORY_ALLOC_SANITY_CHECK) set (H5_MEMORY_ALLOC_SANITY_CHECK 1) -endif (HDF5_MEMORY_ALLOC_SANITY_CHECK) +endif () #----------------------------------------------------------------------------- # Option to use deprecated public API symbols @@ -536,9 +539,9 @@ endif (HDF5_MEMORY_ALLOC_SANITY_CHECK) option (HDF5_ENABLE_DEPRECATED_SYMBOLS "Enable deprecated public API symbols" ON) if (HDF5_ENABLE_DEPRECATED_SYMBOLS) set (H5_NO_DEPRECATED_SYMBOLS 0) -else (HDF5_ENABLE_DEPRECATED_SYMBOLS) +else () set (H5_NO_DEPRECATED_SYMBOLS 1) -endif (HDF5_ENABLE_DEPRECATED_SYMBOLS) +endif () #----------------------------------------------------------------------------- # When building utility executables that generate other (source) files : @@ -553,24 +556,24 @@ if (WIN32) add_definitions (-D_BIND_TO_CURRENT_VCLIBS_VERSION=1) add_definitions (-D_CRT_SECURE_NO_WARNINGS) add_definitions (-D_CONSOLE) - endif (NOT CYGWIN) -endif (WIN32) + endif () +endif () if (MSVC) set (CMAKE_MFC_FLAG 0) set (WIN_COMPILE_FLAGS "") set (WIN_LINK_FLAGS "") -endif (MSVC) +endif () set (MAKE_SYSTEM) if (CMAKE_BUILD_TOOL MATCHES "make") set (MAKE_SYSTEM 1) -endif (CMAKE_BUILD_TOOL MATCHES "make") +endif () set (CFG_INIT "/${CMAKE_CFG_INTDIR}") if (MAKE_SYSTEM) set (CFG_INIT "") -endif (MAKE_SYSTEM) +endif () #----------------------------------------------------------------------------- # Add some definitions for Debug Builds @@ -582,19 +585,19 @@ if (CMAKE_BUILD_TYPE MATCHES Debug) # Enable tracing of the API if (HDF5_ENABLE_TRACE) add_definitions (-DH5_DEBUG_API ) - endif (HDF5_ENABLE_TRACE) + endif () # Enable instrumenting of the library's internal operations option (HDF5_ENABLE_INSTRUMENT "Instrument The library" OFF) if (HDF5_ENABLE_INSTRUMENT) set (H5_HAVE_INSTRUMENTED_LIBRARY 1) - endif (HDF5_ENABLE_INSTRUMENT) + endif () mark_as_advanced (HDF5_ENABLE_INSTRUMENT) -else (CMAKE_BUILD_TYPE MATCHES Debug) +else () add_definitions (-DNDEBUG) if (HDF5_ENABLE_TRACE) add_definitions (-DH5_DEBUG_API ) - endif (HDF5_ENABLE_TRACE) -endif (CMAKE_BUILD_TYPE MATCHES Debug) + endif () +endif () #----------------------------------------------------------------------------- # Option to embed library info into executables @@ -602,7 +605,7 @@ endif (CMAKE_BUILD_TYPE MATCHES Debug) option (HDF5_ENABLE_EMBEDDED_LIBINFO "embed library info into executables" ON) if (HDF5_ENABLE_EMBEDDED_LIBINFO) set (H5_HAVE_EMBEDDED_LIBINFO 1) -endif (HDF5_ENABLE_EMBEDDED_LIBINFO) +endif () include (${HDF_RESOURCES_DIR}/HDFCompilerFlags.cmake) @@ -627,10 +630,10 @@ if (HDF5_ENABLE_PARALLEL) # Used by Fortran + MPI CHECK_SYMBOL_EXISTS (MPI_Comm_c2f "${MPI_C_INCLUDE_PATH}/mpi.h" H5_HAVE_MPI_MULTI_LANG_Comm) CHECK_SYMBOL_EXISTS (MPI_Info_c2f "${MPI_C_INCLUDE_PATH}/mpi.h" H5_HAVE_MPI_MULTI_LANG_Info) - else (MPI_C_FOUND) + else () message (STATUS "Parallel libraries not found") - endif (MPI_C_FOUND) -endif (HDF5_ENABLE_PARALLEL) + endif () +endif () # Parallel IO usage requires MPI to be Linked and Included if (H5_HAVE_PARALLEL) @@ -638,8 +641,8 @@ if (H5_HAVE_PARALLEL) set (LINK_SHARED_LIBS ${LINK_SHARED_LIBS} ${MPI_C_LIBRARIES}) if (MPI_C_LINK_FLAGS) set (CMAKE_EXE_LINKER_FLAGS "${MPI_C_LINK_FLAGS} ${CMAKE_EXE_LINKER_FLAGS}") - endif (MPI_C_LINK_FLAGS) -endif (H5_HAVE_PARALLEL) + endif () +endif () set (DEFAULT_API_VERSION "v110") #----------------------------------------------------------------------------- @@ -650,7 +653,7 @@ set (H5_USE_16_API_DEFAULT 0) if (HDF5_USE_16_API_DEFAULT) set (H5_USE_16_API_DEFAULT 1) set (DEFAULT_API_VERSION "v16") -endif (HDF5_USE_16_API_DEFAULT) +endif () #----------------------------------------------------------------------------- # Option to use 1.8.x API @@ -660,7 +663,7 @@ set (H5_USE_18_API_DEFAULT 0) if (HDF5_USE_18_API_DEFAULT) set (H5_USE_18_API_DEFAULT 1) set (DEFAULT_API_VERSION "v18") -endif (HDF5_USE_18_API_DEFAULT) +endif () #----------------------------------------------------------------------------- # Include user macros @@ -681,13 +684,13 @@ if (NOT HDF5_EXTERNALLY_CONFIGURED) set (HDF5_NO_PACKAGES OFF CACHE BOOL "CPACK - Disable packaging" FORCE) if (HDF5_ENABLE_Z_LIB_SUPPORT AND ZLIB_FOUND) PACKAGE_ZLIB_LIBRARY (${HDF5_ALLOW_EXTERNAL_SUPPORT}) - endif (HDF5_ENABLE_Z_LIB_SUPPORT AND ZLIB_FOUND) + endif () if (HDF5_ENABLE_SZIP_SUPPORT AND SZIP_FOUND) PACKAGE_SZIP_LIBRARY (${HDF5_ALLOW_EXTERNAL_SUPPORT}) - endif (HDF5_ENABLE_SZIP_SUPPORT AND SZIP_FOUND) - endif (HDF5_PACKAGE_EXTLIBS) -endif (NOT HDF5_EXTERNALLY_CONFIGURED) + endif () + endif () +endif () #----------------------------------------------------------------------------- # Option to use threadsafe #----------------------------------------------------------------------------- @@ -699,45 +702,45 @@ if (HDF5_ENABLE_THREADSAFE) if (HDF5_ENABLE_PARALLEL) if (NOT ALLOW_UNSUPPORTED) message (FATAL_ERROR " **** parallel and thread-safety options are not supported **** ") - else (NOT ALLOW_UNSUPPORTED) + else () message (STATUS " **** Allowing unsupported parallel and thread-safety options **** ") - endif (NOT ALLOW_UNSUPPORTED) - endif (HDF5_ENABLE_PARALLEL) + endif () + endif () if (HDF5_BUILD_FORTRAN) if (NOT ALLOW_UNSUPPORTED) message (FATAL_ERROR " **** Fortran and thread-safety options are not supported **** ") - else (NOT ALLOW_UNSUPPORTED) + else () message (STATUS " **** Allowing unsupported Fortran and thread-safety options **** ") - endif (NOT ALLOW_UNSUPPORTED) - endif (HDF5_BUILD_FORTRAN) + endif () + endif () if (HDF5_BUILD_CPP_LIB) if (NOT ALLOW_UNSUPPORTED) message (FATAL_ERROR " **** C++ and thread-safety options are not supported **** ") - else (NOT ALLOW_UNSUPPORTED) + else () message (STATUS " **** Allowing unsupported C++ and thread-safety options **** ") - endif (NOT ALLOW_UNSUPPORTED) - endif (HDF5_BUILD_CPP_LIB) + endif () + endif () if (HDF5_BUILD_HL_LIB) if (NOT ALLOW_UNSUPPORTED) message (FATAL_ERROR " **** HL and thread-safety options are not supported **** ") - else (NOT ALLOW_UNSUPPORTED) + else () message (STATUS " **** Allowing unsupported HL and thread-safety options **** ") - endif (NOT ALLOW_UNSUPPORTED) - endif (HDF5_BUILD_HL_LIB) + endif () + endif () if (H5_HAVE_IOEO) message (STATUS " **** Win32 threads requires WINVER>=0x600 (Windows Vista/7/8) **** ") set (H5_HAVE_WIN_THREADS 1) - else (H5_HAVE_IOEO) + else () if (NOT H5_HAVE_PTHREAD_H) message (FATAL_ERROR " **** thread-safe option requires Win32 threads or Pthreads **** ") - endif (NOT H5_HAVE_PTHREAD_H) - endif (H5_HAVE_IOEO) + endif () + endif () set(THREADS_PREFER_PTHREAD_FLAG ON) find_package(Threads) if (NOT Threads_FOUND) message (STATUS " **** thread-safe package not found - threads still might work **** ") - endif (NOT Threads_FOUND) -endif (HDF5_ENABLE_THREADSAFE) + endif () +endif () # ----------------------------------------------------------------------- # wrapper script variables @@ -755,15 +758,15 @@ if (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN" OR HDF5_ALLOW_EXTERNAL_SUPPORT MAT ADD_DEPENDENCIES (${HDF5_LIB_TARGET} ZLIB) if (BUILD_SHARED_LIBS) add_dependencies (${HDF5_LIBSH_TARGET} ZLIB) - endif (BUILD_SHARED_LIBS) - endif (ZLIB_FOUND AND ZLIB_USE_EXTERNAL) + endif () + endif () if (SZIP_FOUND AND SZIP_USE_EXTERNAL) ADD_DEPENDENCIES (${HDF5_LIB_TARGET} SZIP) if (BUILD_SHARED_LIBS) add_dependencies (${HDF5_LIBSH_TARGET} SZIP) - endif (BUILD_SHARED_LIBS) - endif (SZIP_FOUND AND SZIP_USE_EXTERNAL) -endif (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "GIT" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ") + endif () + endif () +endif () #----------------------------------------------------------------------------- # Dashboard and Testing Settings @@ -780,7 +783,7 @@ if (BUILD_TESTING) if (HDF5_TEST_VFD) option (HDF5_TEST_FHEAP_VFD "Execute tests with different VFDs" ON) mark_as_advanced (HDF5_TEST_FHEAP_VFD) - endif (HDF5_TEST_VFD) + endif () option (HDF_TEST_EXPRESS "Control testing framework (0-3)" "0") mark_as_advanced (HDF_TEST_EXPRESS) @@ -795,14 +798,14 @@ if (BUILD_TESTING) if (EXISTS "${HDF5_SOURCE_DIR}/test" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/test") add_subdirectory (${HDF5_SOURCE_DIR}/tools/lib ${PROJECT_BINARY_DIR}/tools/lib) add_subdirectory (${HDF5_SOURCE_DIR}/test ${PROJECT_BINARY_DIR}/test) - endif (EXISTS "${HDF5_SOURCE_DIR}/test" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/test") + endif () if (H5_HAVE_PARALLEL) if (EXISTS "${HDF5_SOURCE_DIR}/testpar" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/testpar") add_subdirectory (${HDF5_SOURCE_DIR}/testpar ${PROJECT_BINARY_DIR}/testpar) - endif (EXISTS "${HDF5_SOURCE_DIR}/testpar" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/testpar") - endif (H5_HAVE_PARALLEL) - endif (NOT HDF5_EXTERNALLY_CONFIGURED) -endif (BUILD_TESTING) + endif () + endif () + endif () +endif () #----------------------------------------------------------------------------- # Option to build HDF5 Tools @@ -811,8 +814,8 @@ if (EXISTS "${HDF5_SOURCE_DIR}/tools" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/tools option (HDF5_BUILD_TOOLS "Build HDF5 Tools" ON) if (HDF5_BUILD_TOOLS) add_subdirectory (${HDF5_SOURCE_DIR}/tools ${PROJECT_BINARY_DIR}/tools) - endif (HDF5_BUILD_TOOLS) -endif (EXISTS "${HDF5_SOURCE_DIR}/tools" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/tools") + endif () +endif () #----------------------------------------------------------------------------- # Option to build examples @@ -821,8 +824,8 @@ if (EXISTS "${HDF5_SOURCE_DIR}/examples" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/ex option (HDF5_BUILD_EXAMPLES "Build HDF5 Library Examples" ON) if (HDF5_BUILD_EXAMPLES) add_subdirectory (${HDF5_SOURCE_DIR}/examples ${PROJECT_BINARY_DIR}/examples) - endif (HDF5_BUILD_EXAMPLES) -endif (EXISTS "${HDF5_SOURCE_DIR}/examples" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/examples") + endif () +endif () #----------------------------------------------------------------------------- # Option to build High Level API's @@ -832,8 +835,8 @@ if (EXISTS "${HDF5_SOURCE_DIR}/hl" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/hl") if (HDF5_BUILD_HL_LIB) set (H5_INCLUDE_HL 1) add_subdirectory (${HDF5_SOURCE_DIR}/hl ${PROJECT_BINARY_DIR}/hl) - endif (HDF5_BUILD_HL_LIB) -endif (EXISTS "${HDF5_SOURCE_DIR}/hl" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/hl") + endif () +endif () #----------------------------------------------------------------------------- # Option to build Fortran bindings/tests/examples @@ -851,10 +854,10 @@ if (EXISTS "${HDF5_SOURCE_DIR}/fortran" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/for if (NOT ALLOW_UNSUPPORTED) message (STATUS " **** Shared FORTRAN libraries are unsupported **** ") set (SKIP_HDF5_FORTRAN_SHARED ON) - else (NOT ALLOW_UNSUPPORTED) + else () message (STATUS " **** Allowing unsupported Fortran shared libraries **** ") - endif (NOT ALLOW_UNSUPPORTED) - endif (BUILD_SHARED_LIBS AND APPLE) + endif () + endif () option (HDF5_ENABLE_F2003 "Enable FORTRAN 2003 Standard" ON) include (${HDF_RESOURCES_EXT_DIR}/HDFUseFortran.cmake) @@ -871,8 +874,17 @@ if (EXISTS "${HDF5_SOURCE_DIR}/fortran" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/for if (HDF5_ENABLE_F2003) if (NOT FORTRAN_HAVE_ISO_C_BINDING) set (HDF5_ENABLE_F2003 OFF) - endif (NOT FORTRAN_HAVE_ISO_C_BINDING) - endif (HDF5_ENABLE_F2003) + endif () + endif () + + # Parallel IO usage requires MPI to be Linked and Included + if (H5_HAVE_PARALLEL) + set (LINK_Fortran_LIBS ${LINK_LIBS} ${MPI_Fortran_LIBRARIES}) + set (LINK_Fortran_SHARED_LIBS ${LINK_SHARED_LIBS} ${MPI_Fortran_LIBRARIES}) + if (MPI_Fortran_LINK_FLAGS) + set (CMAKE_Fortran_EXE_LINKER_FLAGS "${MPI_Fortran_LINK_FLAGS} ${CMAKE_EXE_LINKER_FLAGS}") + endif () + endif () # ----------------------------------------------------------------------- # wrapper script variables @@ -884,10 +896,10 @@ if (EXISTS "${HDF5_SOURCE_DIR}/fortran" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/for if (EXISTS "${HDF5_SOURCE_DIR}/hl/fortran" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/hl/fortran") #-- Build the High Level Fortran source codes add_subdirectory (${HDF5_SOURCE_DIR}/hl/fortran ${PROJECT_BINARY_DIR}/hl/fortran) - endif (EXISTS "${HDF5_SOURCE_DIR}/hl/fortran" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/hl/fortran") - endif (HDF5_BUILD_HL_LIB) - endif (HDF5_BUILD_FORTRAN) -endif (EXISTS "${HDF5_SOURCE_DIR}/fortran" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/fortran") + endif () + endif () + endif () +endif () #----------------------------------------------------------------------------- # Option to build HDF5 C++ Library @@ -899,22 +911,22 @@ if (EXISTS "${HDF5_SOURCE_DIR}/c++" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/c++") if (HDF5_ENABLE_PARALLEL) if (NOT ALLOW_UNSUPPORTED) message (FATAL_ERROR " **** Parallel and C++ options are mutually exclusive **** ") - else (NOT ALLOW_UNSUPPORTED) + else () message (STATUS " **** Allowing unsupported Parallel and C++ options **** ") - endif (NOT ALLOW_UNSUPPORTED) - endif (HDF5_ENABLE_PARALLEL) + endif () + endif () if (CMAKE_NO_STD_NAMESPACE) set (H5_NO_STD 1) - endif (CMAKE_NO_STD_NAMESPACE) + endif () add_subdirectory (${HDF5_SOURCE_DIR}/c++ ${PROJECT_BINARY_DIR}/c++) if (HDF5_BUILD_HL_LIB) if (EXISTS "${HDF5_SOURCE_DIR}/hl/c++" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/hl/c++") #-- Build the High Level Fortran source codes add_subdirectory (${HDF5_SOURCE_DIR}/hl/c++ ${PROJECT_BINARY_DIR}/hl/c++) - endif (EXISTS "${HDF5_SOURCE_DIR}/hl/c++" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/hl/c++") - endif (HDF5_BUILD_HL_LIB) - endif (HDF5_BUILD_CPP_LIB) -endif (EXISTS "${HDF5_SOURCE_DIR}/c++" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/c++") + endif () + endif () + endif () +endif () #----------------------------------------------------------------------------- # Check if Fortran's default real is double precision. If it is and HL is @@ -923,8 +935,8 @@ endif (EXISTS "${HDF5_SOURCE_DIR}/c++" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/c++" if (HDF5_BUILD_FORTRAN AND HDF5_BUILD_HL_LIB) if (NOT FORTRAN_DEFAULT_REAL_NOT_DOUBLE) message (FATAL_ERROR " **** Fortran high-level routines are not supported when the default REAL is DOUBLE PRECISION, use HDF5_BUILD_HL_LIB:BOOL=OFF **** ") - endif (NOT FORTRAN_DEFAULT_REAL_NOT_DOUBLE) -endif (HDF5_BUILD_FORTRAN AND HDF5_BUILD_HL_LIB) + endif () +endif () #----------------------------------------------------------------------------- # Option to build HDF5 Java Library @@ -933,8 +945,8 @@ if (EXISTS "${HDF5_SOURCE_DIR}/java" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/java") option (HDF5_BUILD_JAVA "Build Java HDF5 Library" OFF) if (HDF5_BUILD_JAVA) add_subdirectory (${HDF5_SOURCE_DIR}/java ${PROJECT_BINARY_DIR}/java) - endif (HDF5_BUILD_JAVA) -endif (EXISTS "${HDF5_SOURCE_DIR}/java" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/java") + endif () +endif () #----------------------------------------------------------------------------- # Generate the H5pubconf.h file containing user settings needed by compilation diff --git a/CTestConfig.cmake b/CTestConfig.cmake index 849d218..3f5f380 100644 --- a/CTestConfig.cmake +++ b/CTestConfig.cmake @@ -11,10 +11,10 @@ set (CTEST_DROP_METHOD "http") if (CDASH_LOCAL) set (CTEST_DROP_SITE "cdash-internal.hdfgroup.org") set (CTEST_DROP_LOCATION "/submit.php?project=HDF5Trunk") -else (CDASH_LOCAL) +else () set (CTEST_DROP_SITE "cdash.hdfgroup.org") set (CTEST_DROP_LOCATION "/submit.php?project=HDF5+Trunk") -endif (CDASH_LOCAL) +endif () set (CTEST_DROP_SITE_CDASH TRUE) set (UPDATE_TYPE git) diff --git a/MANIFEST b/MANIFEST index b43e7ef..95c9bbd 100644 --- a/MANIFEST +++ b/MANIFEST @@ -504,10 +504,12 @@ ./src/H5C.c ./src/H5Cdbg.c ./src/H5Cepoch.c +./src/H5Cimage.c ./src/H5Clog.c ./src/H5Cmodule.h ./src/H5Cmpio.c ./src/H5Cpkg.h +./src/H5Cprefetched.c ./src/H5Cprivate.h ./src/H5Cpublic.h ./src/H5Cquery.c @@ -737,6 +739,7 @@ ./src/H5Obogus.c ./src/H5Obtreek.c ./src/H5Ocache.c +./src/H5Ocache_image.c ./src/H5Ochunk.c ./src/H5Ocont.c ./src/H5Ocopy.c @@ -881,13 +884,20 @@ ./src/libhdf5.settings.in ./src/H5win32defs.h +./test/AtomicWriterReader.txt ./test/COPYING ./test/H5srcdir.h ./test/H5srcdir_str.h.in ./test/Makefile.am +./test/POSIX_Order_Write_Test_Report.docx +./test/POSIX_Order_Write_Test_Report.pdf +./test/SWMR_POSIX_Order_UG.txt +./test/SWMR_UseCase_UG.txt ./test/accum.c ./test/accum_swmr_reader.c ./test/app_ref.c +./test/atomic_reader.c +./test/atomic_writer.c ./test/bad_compound.h5 ./test/be_data.h5 ./test/be_extlink1.h5 @@ -901,6 +911,7 @@ ./test/cache_api.c ./test/cache_common.c ./test/cache_common.h +./test/cache_image.c ./test/cache_logging.c ./test/cache_tagging.c ./test/cmpd_dset.c @@ -946,6 +957,8 @@ ./test/flush1.c ./test/flush2.c ./test/flushrefresh.c +./test/genall5.c +./test/genall5.h ./test/gen_bad_ohdr.c ./test/gen_bad_compound.c ./test/gen_bogus.c @@ -953,6 +966,7 @@ ./test/gen_deflate.c ./test/gen_file_image.c ./test/gen_filespace.c +./test/gen_idx.c ./test/gen_mergemsg.c ./test/gen_new_array.c ./test/gen_new_fill.c @@ -1001,7 +1015,18 @@ ./test/specmetaread.h5 ./test/stab.c ./test/swmr.c +./test/swmr_addrem_writer.c ./test/swmr_check_compat_vfd.c +./test/swmr_common.c +./test/swmr_common.h +./test/swmr_generator.c +./test/swmr_reader.c +./test/swmr_remove_reader.c +./test/swmr_remove_writer.c +./test/swmr_sparse_reader.c +./test/swmr_sparse_writer.c +./test/swmr_start_write.c +./test/swmr_writer.c ./test/tarray.c ./test/tarrold.h5 ./test/tattr.c @@ -1020,7 +1045,10 @@ ./test/testhdf5.h ./test/testlibinfo.sh.in ./test/test_plugin.sh.in +./test/test_usecases.sh.in ./test/testmeta.c +./test/testswmr.sh.in +./test/testvdsswmr.sh.in ./test/tfile.c ./test/tgenprop.c ./test/th5o.c @@ -1051,14 +1079,24 @@ ./test/tunicode.c ./test/tvlstr.c ./test/tvltypes.c +./test/twriteorder.c ./test/unlink.c ./test/unregister.c +./test/use_append_chunk.c +./test/use_append_mchunks.c +./test/use_common.c +./test/use_disable_mdc_flushes.c +./test/use.h ./test/vfd.c ./test/test_filters_le.h5 ./test/test_filters_be.h5 ./test/gen_filters.c ./test/chunk_info.c ./test/vds.c +./test/vds_swmr.h +./test/vds_swmr_gen.c +./test/vds_swmr_reader.c +./test/vds_swmr_writer.c ./test/testfiles/err_compat_1 ./test/testfiles/err_compat_2 @@ -1201,7 +1239,9 @@ ./tools/src/h5dump/h5dump_xml.c ./tools/src/h5dump/h5dump_xml.h ./tools/test/h5dump/Makefile.am +./tools/test/h5dump/dynlib_dump.c ./tools/test/h5dump/h5dumpgentest.c +./tools/test/h5dump/h5dump_plugin.sh.in ./tools/test/h5dump/testh5dump.sh.in ./tools/test/h5dump/testh5dumppbits.sh.in ./tools/test/h5dump/testh5dumpxml.sh.in @@ -1273,7 +1313,9 @@ ./tools/src/h5diff/h5diff_main.c ./tools/src/h5diff/ph5diff_main.c ./tools/test/h5diff/Makefile.am +./tools/test/h5diff/dynlib_diff.c ./tools/test/h5diff/h5diffgentest.c +./tools/test/h5diff/h5diff_plugin.sh.in ./tools/test/h5diff/testh5diff.sh.in ./tools/test/h5diff/testph5diff.sh.in @@ -1354,6 +1396,8 @@ ./tools/src/h5ls/Makefile.am ./tools/src/h5ls/h5ls.c ./tools/test/h5ls/Makefile.am +./tools/test/h5ls/dynlib_ls.c +./tools/test/h5ls/h5ls_plugin.sh.in ./tools/test/h5ls/testh5ls.sh.in ./tools/test/h5ls/testh5lsvds.sh.in @@ -1738,6 +1782,9 @@ ./tools/testfiles/tstring2.ddl ./tools/testfiles/tstringe.ddl ./tools/testfiles/tszip.ddl +./tools/testfiles/tudfilter.ddl +./tools/testfiles/tudfilter.h5 +./tools/testfiles/tudfilter.ls ./tools/testfiles/tudlink.h5 ./tools/testfiles/tudlink.h5.xml ./tools/testfiles/tudlink-1.ddl @@ -2108,6 +2155,10 @@ ./tools/test/h5diff/testfiles/h5diff_57.txt ./tools/test/h5diff/testfiles/h5diff_58.txt ./tools/test/h5diff/testfiles/h5diff_59.txt +./tools/test/h5diff/testfiles/h5diff_60.txt +./tools/test/h5diff/testfiles/h5diff_61.txt +./tools/test/h5diff/testfiles/h5diff_62.txt +./tools/test/h5diff/testfiles/h5diff_63.txt ./tools/test/h5diff/testfiles/h5diff_600.txt ./tools/test/h5diff/testfiles/h5diff_601.txt ./tools/test/h5diff/testfiles/h5diff_603.txt @@ -2310,6 +2361,12 @@ ./tools/test/h5diff/testfiles/tmptest.he5 ./tools/test/h5diff/testfiles/h5diff_tmp2.txt ./tools/test/h5diff/testfiles/tmpSingleSiteBethe.output.h5 +./tools/test/h5diff/testfiles/tudfilter.h5 +./tools/test/h5diff/testfiles/tudfilter2.h5 +./tools/test/h5diff/testfiles/h5diff_ud.txt +./tools/test/h5diff/testfiles/h5diff_udfail.txt +./tools/test/h5diff/testfiles/diff_strings1.h5 +./tools/test/h5diff/testfiles/diff_strings2.h5 #vds ./tools/test/h5diff/testfiles/h5diff_v1.txt ./tools/test/h5diff/testfiles/h5diff_v2.txt @@ -2967,7 +3024,6 @@ ./config/cmake_ext_mod/HDFUseFortran.cmake ./config/cmake_ext_mod/NSIS.InstallOptions.ini.in ./config/cmake_ext_mod/NSIS.template.in -./config/cmake_ext_mod/prunTest.cmake ./config/cmake_ext_mod/runTest.cmake ./config/cmake_ext_mod/version.plist.in @@ -3075,6 +3131,7 @@ # CMake-specific User Scripts ./config/cmake/scripts/CTestScript.cmake ./config/cmake/scripts/HDF5config.cmake +./config/cmake/scripts/HDF5options.cmake # Files generated by autogen ./aclocal.m4 diff --git a/UserMacros.cmake b/UserMacros.cmake index 65ea5d4..01e76ed 100644 --- a/UserMacros.cmake +++ b/UserMacros.cmake @@ -7,16 +7,15 @@ #----------------------------------------------------------------------------- # Option to Build with User Defined Values #----------------------------------------------------------------------------- -MACRO (MACRO_USER_DEFINED_LIBS) +macro (MACRO_USER_DEFINED_LIBS) set (USER_DEFINED_VALUE "FALSE") -ENDMACRO (MACRO_USER_DEFINED_LIBS) +endmacro () #------------------------------------------------------------------------------- option (BUILD_USER_DEFINED_LIBS "Build With User Defined Values" OFF) if (BUILD_USER_DEFINED_LIBS) MACRO_USER_DEFINED_LIBS () -endif (BUILD_USER_DEFINED_LIBS) +endif () #----------------------------------------------------------------------------- #------------------- E X A M P L E E N D ----------------------------------- #----------------------------------------------------------------------------- - \ No newline at end of file diff --git a/c++/CMakeLists.txt b/c++/CMakeLists.txt index 6f288a0..c9c4815 100644 --- a/c++/CMakeLists.txt +++ b/c++/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 3.1.0) +cmake_minimum_required (VERSION 3.2.2) PROJECT (HDF5_CPP) #----------------------------------------------------------------------------- @@ -25,7 +25,7 @@ INCLUDE_DIRECTORIES (${HDF5_BINARY_DIR}) if (H5_HAVE_PARALLEL) add_definitions ("-DMPICH_SKIP_MPICXX") add_definitions ("-DMPICH_IGNORE_CXX_SEEK") -endif (H5_HAVE_PARALLEL) +endif () add_subdirectory (${HDF5_CPP_SOURCE_DIR}/src ${HDF5_CPP_BINARY_DIR}/src) @@ -34,11 +34,11 @@ add_subdirectory (${HDF5_CPP_SOURCE_DIR}/src ${HDF5_CPP_BINARY_DIR}/src) #----------------------------------------------------------------------------- if (HDF5_BUILD_EXAMPLES) add_subdirectory (${HDF5_CPP_SOURCE_DIR}/examples ${HDF5_CPP_BINARY_DIR}/examples) -endif (HDF5_BUILD_EXAMPLES) +endif () #----------------------------------------------------------------------------- # Build the CPP unit tests #----------------------------------------------------------------------------- if (BUILD_TESTING) add_subdirectory (${HDF5_CPP_SOURCE_DIR}/test ${HDF5_CPP_BINARY_DIR}/test) -endif (BUILD_TESTING) +endif () diff --git a/c++/examples/CMakeLists.txt b/c++/examples/CMakeLists.txt index cfcdd8d..e5b0b4a 100644 --- a/c++/examples/CMakeLists.txt +++ b/c++/examples/CMakeLists.txt @@ -1,11 +1,11 @@ -cmake_minimum_required (VERSION 3.1.0) +cmake_minimum_required (VERSION 3.2.2) +PROJECT (HDF5_CPP_EXAMPLES) + # -------------------------------------------------------------------- # Notes: When creating examples they should be prefixed # with "cpp_ex_". This allows for easier filtering of the examples. # -------------------------------------------------------------------- -PROJECT (HDF5_CPP_EXAMPLES) - #----------------------------------------------------------------------------- # Define examples #----------------------------------------------------------------------------- @@ -38,7 +38,7 @@ foreach (example ${examples}) TARGET_C_PROPERTIES (cpp_ex_${example} STATIC " " " ") target_link_libraries (cpp_ex_${example} ${HDF5_CPP_LIB_TARGET} ${HDF5_LIB_TARGET}) set_target_properties (cpp_ex_${example} PROPERTIES FOLDER examples/cpp) -endforeach (example ${examples}) +endforeach () foreach (example ${tutr_examples}) add_executable (cpp_ex_${example} ${HDF5_CPP_EXAMPLES_SOURCE_DIR}/${example}.cpp) @@ -46,8 +46,8 @@ foreach (example ${tutr_examples}) TARGET_C_PROPERTIES (cpp_ex_${example} STATIC " " " ") target_link_libraries (cpp_ex_${example} ${HDF5_CPP_LIB_TARGET} ${HDF5_LIB_TARGET}) set_target_properties (cpp_ex_${example} PROPERTIES FOLDER examples/cpp) -endforeach (example ${tutr_examples}) +endforeach () if (BUILD_TESTING) include (CMakeTests.cmake) -endif (BUILD_TESTING) +endif () diff --git a/c++/examples/CMakeTests.cmake b/c++/examples/CMakeTests.cmake index 4db8c68..8b5c6b9 100644 --- a/c++/examples/CMakeTests.cmake +++ b/c++/examples/CMakeTests.cmake @@ -8,7 +8,7 @@ add_test ( NAME CPP_ex-clear-objects COMMAND ${CMAKE_COMMAND} - -E remove + -E remove Group.h5 SDS.h5 SDScompound.h5 @@ -17,16 +17,29 @@ ) if (NOT "${last_test}" STREQUAL "") set_tests_properties (CPP_ex-clear-objects PROPERTIES DEPENDS ${last_test}) - endif (NOT "${last_test}" STREQUAL "") + endif () set (last_test "CPP_ex-clear-objects") foreach (example ${examples}) - add_test (NAME CPP_ex_${example} COMMAND $) + if (HDF5_ENABLE_USING_MEMCHECKER) + add_test (NAME CPP_ex_${example} COMMAND $) + else () + add_test (NAME CPP_ex_${example} COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$" + -D "TEST_ARGS:STRING=" + -D "TEST_EXPECT=0" + -D "TEST_SKIP_COMPARE=TRUE" + -D "TEST_OUTPUT=cpp_ex_${example}.txt" + #-D "TEST_REFERENCE=cpp_ex_${example}.out" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) + endif () if (NOT "${last_test}" STREQUAL "") set_tests_properties (CPP_ex_${example} PROPERTIES DEPENDS ${last_test}) - endif (NOT "${last_test}" STREQUAL "") + endif () set (last_test "CPP_ex_${example}") - endforeach (example ${examples}) + endforeach () #the following dependicies are handled by the order of the files # SET_TESTS_PROPERTIES(CPP_ex_readdata PROPERTIES DEPENDS CPP_ex_create) # SET_TESTS_PROPERTIES(CPP_ex_chunks PROPERTIES DEPENDS CPP_ex_extend_ds) @@ -34,7 +47,7 @@ add_test ( NAME CPP_ex_tutr-clear-objects COMMAND ${CMAKE_COMMAND} - -E remove + -E remove h5tutr_cmprss.h5 h5tutr_dset.h5 h5tutr_extend.h5 @@ -44,18 +57,30 @@ ) if (NOT "${last_test}" STREQUAL "") set_tests_properties (CPP_ex_tutr-clear-objects PROPERTIES DEPENDS ${last_test}) - endif (NOT "${last_test}" STREQUAL "") + endif () set (last_test "CPP_ex_tutr-clear-objects") - + foreach (example ${tutr_examples}) - add_test (NAME CPP_ex_${example} COMMAND $) + if (HDF5_ENABLE_USING_MEMCHECKER) + add_test (NAME CPP_ex_${example} COMMAND $) + else () + add_test (NAME CPP_ex_${example} COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$" + -D "TEST_ARGS:STRING=" + -D "TEST_EXPECT=0" + -D "TEST_SKIP_COMPARE=TRUE" + -D "TEST_OUTPUT=cpp_ex_${example}.txt" + #-D "TEST_REFERENCE=cpp_ex_${example}.out" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) + endif () if (NOT "${last_test}" STREQUAL "") set_tests_properties (CPP_ex_${example} PROPERTIES DEPENDS ${last_test}) - endif (NOT "${last_test}" STREQUAL "") + endif () set (last_test "CPP_ex_${example}") - endforeach (example ${tutr_examples}) + endforeach () #the following dependicies are handled by the order of the files # SET_TESTS_PROPERTIES(CPP_ex_h5tutr_crtatt PROPERTIES DEPENDS CPP_ex_h5tutr_crtdat) # SET_TESTS_PROPERTIES(CPP_ex_h5tutr_rdwt PROPERTIES DEPENDS CPP_ex_h5tutr_crtdat) # SET_TESTS_PROPERTIES(CPP_ex_h5tutr_crtgrpd PROPERTIES DEPENDS CPP_ex_h5tutr_crtgrpar) - \ No newline at end of file diff --git a/c++/src/CMakeLists.txt b/c++/src/CMakeLists.txt index 445d57b..b147cfa 100644 --- a/c++/src/CMakeLists.txt +++ b/c++/src/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 3.1.0) +cmake_minimum_required (VERSION 3.2.2) PROJECT (HDF5_CPP_SRC) #----------------------------------------------------------------------------- @@ -104,7 +104,7 @@ if (BUILD_SHARED_LIBS) INTERFACE_COMPILE_DEFINITIONS H5_BUILT_AS_DYNAMIC_LIB=1 ) set (install_targets ${install_targets} ${HDF5_CPP_LIBSH_TARGET}) -endif (BUILD_SHARED_LIBS) +endif () #----------------------------------------------------------------------------- # Add file(s) to CMake Install @@ -124,7 +124,8 @@ install ( if (HDF5_EXPORTED_TARGETS) if (BUILD_SHARED_LIBS) INSTALL_TARGET_PDB (${HDF5_CPP_LIBSH_TARGET} ${HDF5_INSTALL_BIN_DIR} cpplibraries) - endif (BUILD_SHARED_LIBS) + endif () + INSTALL_TARGET_PDB (${HDF5_CPP_LIB_TARGET} ${HDF5_INSTALL_BIN_DIR} cpplibraries) install ( TARGETS @@ -137,4 +138,4 @@ if (HDF5_EXPORTED_TARGETS) FRAMEWORK DESTINATION ${HDF5_INSTALL_FWRK_DIR} COMPONENT cpplibraries INCLUDES DESTINATION include ) -endif (HDF5_EXPORTED_TARGETS) +endif () diff --git a/c++/src/H5AbstractDs.cpp b/c++/src/H5AbstractDs.cpp index 9e76b55..621578e 100644 --- a/c++/src/H5AbstractDs.cpp +++ b/c++/src/H5AbstractDs.cpp @@ -34,16 +34,16 @@ namespace H5 { //-------------------------------------------------------------------------- -// Function: AbstractDs default constructor -///\brief Default constructor -// Programmer Binh-Minh Ribler - 2000 +// Function: AbstractDs default constructor +///\brief Default constructor +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- AbstractDs::AbstractDs(){} //-------------------------------------------------------------------------- -// Function: AbstractDs default constructor -///\brief Creates an AbstractDs instance using an existing id. -// Programmer Binh-Minh Ribler - 2000 +// Function: AbstractDs default constructor +///\brief Creates an AbstractDs instance using an existing id. +// Programmer Binh-Minh Ribler - 2000 // // *** Deprecation warning *** // This constructor is no longer appropriate because the data member "id" had @@ -54,275 +54,275 @@ AbstractDs::AbstractDs(){} // Mar 2016 -BMR, AbstractDs::AbstractDs(const hid_t ds_id){} //-------------------------------------------------------------------------- -// Function: AbstractDs::getTypeClass -///\brief Returns the class of the datatype that is used by this -/// object, which can be a dataset or an attribute. -///\return Datatype class identifier -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 +// Function: AbstractDs::getTypeClass +///\brief Returns the class of the datatype that is used by this +/// object, which can be a dataset or an attribute. +///\return Datatype class identifier +///\exception H5::DataTypeIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- H5T_class_t AbstractDs::getTypeClass() const { - // Gets the datatype used by this dataset or attribute. - // p_get_type calls either H5Dget_type or H5Aget_type depending on - // which object invokes getTypeClass - hid_t datatype_id; - try { - datatype_id = p_get_type(); // returned value is already validated - } - catch (DataSetIException& E) { - throw DataTypeIException("DataSet::getTypeClass", E.getDetailMsg()); - } - catch (AttributeIException& E) { - throw DataTypeIException("Attribute::getTypeClass", E.getDetailMsg()); - } + // Gets the datatype used by this dataset or attribute. + // p_get_type calls either H5Dget_type or H5Aget_type depending on + // which object invokes getTypeClass + hid_t datatype_id; + try { + datatype_id = p_get_type(); // returned value is already validated + } + catch (DataSetIException& E) { + throw DataTypeIException("DataSet::getTypeClass", E.getDetailMsg()); + } + catch (AttributeIException& E) { + throw DataTypeIException("Attribute::getTypeClass", E.getDetailMsg()); + } - // Gets the class of the datatype and validate it before returning - H5T_class_t type_class = H5Tget_class(datatype_id); + // Gets the class of the datatype and validate it before returning + H5T_class_t type_class = H5Tget_class(datatype_id); - // Close temporary datatype_id - herr_t ret_value = H5Tclose(datatype_id); - if (ret_value < 0) - { - if (fromClass() == "DataSet") - throw DataTypeIException("DataSet::getTypeClass", "H5Tclose failed"); - else if (fromClass() == "Attribute") - throw DataTypeIException("Attribute::getTypeClass", "H5Tclose failed"); - } + // Close temporary datatype_id + herr_t ret_value = H5Tclose(datatype_id); + if (ret_value < 0) + { + if (fromClass() == "DataSet") + throw DataTypeIException("DataSet::getTypeClass", "H5Tclose failed"); + else if (fromClass() == "Attribute") + throw DataTypeIException("Attribute::getTypeClass", "H5Tclose failed"); + } - // Check on the returned type_class - if (type_class == H5T_NO_CLASS) - { - if (fromClass() == "DataSet") - throw DataTypeIException("DataSet::getTypeClass", "H5Tget_class returns H5T_NO_CLASS"); - else if (fromClass() == "Attribute") - throw DataTypeIException("Attribute::getTypeClass", "H5Tget_class returns H5T_NO_CLASS"); - } - return(type_class); + // Check on the returned type_class + if (type_class == H5T_NO_CLASS) + { + if (fromClass() == "DataSet") + throw DataTypeIException("DataSet::getTypeClass", "H5Tget_class returns H5T_NO_CLASS"); + else if (fromClass() == "Attribute") + throw DataTypeIException("Attribute::getTypeClass", "H5Tget_class returns H5T_NO_CLASS"); + } + return(type_class); } //-------------------------------------------------------------------------- -// Function: AbstractDs::getDataType -///\brief Returns the generic datatype of this abstract dataset, which -/// can be a dataset or an attribute. -///\return DataType instance -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 +// Function: AbstractDs::getDataType +///\brief Returns the generic datatype of this abstract dataset, which +/// can be a dataset or an attribute. +///\return DataType instance +///\exception H5::DataTypeIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- DataType AbstractDs::getDataType() const { - // Gets the id of the datatype used by this dataset or attribute using - // p_get_type. p_get_type calls either H5Dget_type or H5Aget_type - // depending on which object invokes getDataType. Then, create and - // return the DataType object - try { - DataType datatype; - f_DataType_setId(&datatype, p_get_type()); - return(datatype); - } - catch (DataSetIException& E) { - throw DataTypeIException("DataSet::getDataType", E.getDetailMsg()); - } - catch (AttributeIException& E) { - throw DataTypeIException("Attribute::getDataType", E.getDetailMsg()); - } + // Gets the id of the datatype used by this dataset or attribute using + // p_get_type. p_get_type calls either H5Dget_type or H5Aget_type + // depending on which object invokes getDataType. Then, create and + // return the DataType object + try { + DataType datatype; + f_DataType_setId(&datatype, p_get_type()); + return(datatype); + } + catch (DataSetIException& E) { + throw DataTypeIException("DataSet::getDataType", E.getDetailMsg()); + } + catch (AttributeIException& E) { + throw DataTypeIException("Attribute::getDataType", E.getDetailMsg()); + } } //-------------------------------------------------------------------------- -// Function: AbstractDs::getArrayType -///\brief Returns the array datatype of this abstract dataset which -/// can be a dataset or an attribute. -///\return ArrayType instance -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - Jul, 2005 +// Function: AbstractDs::getArrayType +///\brief Returns the array datatype of this abstract dataset which +/// can be a dataset or an attribute. +///\return ArrayType instance +///\exception H5::DataTypeIException +// Programmer Binh-Minh Ribler - Jul, 2005 //-------------------------------------------------------------------------- ArrayType AbstractDs::getArrayType() const { - // Gets the id of the datatype used by this dataset or attribute using - // p_get_type. p_get_type calls either H5Dget_type or H5Aget_type - // depending on which object invokes getArrayType. Then, create and - // return the ArrayType object - try { - // Create ArrayType and set values this way to work around the - // problem described in the JIRA issue HDFFV-7947 - ArrayType arraytype; - f_DataType_setId(&arraytype, p_get_type()); - return(arraytype); - } - catch (DataSetIException& E) { - throw DataTypeIException("DataSet::getArrayType", E.getDetailMsg()); - } - catch (AttributeIException& E) { - throw DataTypeIException("Attribute::getArrayType", E.getDetailMsg()); - } + // Gets the id of the datatype used by this dataset or attribute using + // p_get_type. p_get_type calls either H5Dget_type or H5Aget_type + // depending on which object invokes getArrayType. Then, create and + // return the ArrayType object + try { + // Create ArrayType and set values this way to work around the + // problem described in the JIRA issue HDFFV-7947 + ArrayType arraytype; + f_DataType_setId(&arraytype, p_get_type()); + return(arraytype); + } + catch (DataSetIException& E) { + throw DataTypeIException("DataSet::getArrayType", E.getDetailMsg()); + } + catch (AttributeIException& E) { + throw DataTypeIException("Attribute::getArrayType", E.getDetailMsg()); + } } //-------------------------------------------------------------------------- -// Function: AbstractDs::getCompType -///\brief Returns the compound datatype of this abstract dataset which -/// can be a dataset or an attribute. -///\return CompType instance -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 +// Function: AbstractDs::getCompType +///\brief Returns the compound datatype of this abstract dataset which +/// can be a dataset or an attribute. +///\return CompType instance +///\exception H5::DataTypeIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- CompType AbstractDs::getCompType() const { - // Gets the id of the datatype used by this dataset or attribute using - // p_get_type. p_get_type calls either H5Dget_type or H5Aget_type - // depending on which object invokes getCompType. Then, create and - // return the CompType object - try { - CompType comptype; - f_DataType_setId(&comptype, p_get_type()); - return(comptype); - } - catch (DataSetIException& E) { - throw DataTypeIException("DataSet::getCompType", E.getDetailMsg()); - } - catch (AttributeIException& E) { - throw DataTypeIException("Attribute::getCompType", E.getDetailMsg()); - } + // Gets the id of the datatype used by this dataset or attribute using + // p_get_type. p_get_type calls either H5Dget_type or H5Aget_type + // depending on which object invokes getCompType. Then, create and + // return the CompType object + try { + CompType comptype; + f_DataType_setId(&comptype, p_get_type()); + return(comptype); + } + catch (DataSetIException& E) { + throw DataTypeIException("DataSet::getCompType", E.getDetailMsg()); + } + catch (AttributeIException& E) { + throw DataTypeIException("Attribute::getCompType", E.getDetailMsg()); + } } //-------------------------------------------------------------------------- -// Function: AbstractDs::getEnumType -///\brief Returns the enumeration datatype of this abstract dataset which -/// can be a dataset or an attribute. -///\return EnumType instance -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 +// Function: AbstractDs::getEnumType +///\brief Returns the enumeration datatype of this abstract dataset which +/// can be a dataset or an attribute. +///\return EnumType instance +///\exception H5::DataTypeIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- EnumType AbstractDs::getEnumType() const { - // Gets the id of the datatype used by this dataset or attribute using - // p_get_type. p_get_type calls either H5Dget_type or H5Aget_type - // depending on which object invokes getEnumType. Then, create and - // return the EnumType object - try { - EnumType enumtype; - f_DataType_setId(&enumtype, p_get_type()); - return(enumtype); - } - catch (DataSetIException& E) { - throw DataTypeIException("DataSet::getEnumType", E.getDetailMsg()); - } - catch (AttributeIException& E) { - throw DataTypeIException("Attribute::getEnumType", E.getDetailMsg()); - } + // Gets the id of the datatype used by this dataset or attribute using + // p_get_type. p_get_type calls either H5Dget_type or H5Aget_type + // depending on which object invokes getEnumType. Then, create and + // return the EnumType object + try { + EnumType enumtype; + f_DataType_setId(&enumtype, p_get_type()); + return(enumtype); + } + catch (DataSetIException& E) { + throw DataTypeIException("DataSet::getEnumType", E.getDetailMsg()); + } + catch (AttributeIException& E) { + throw DataTypeIException("Attribute::getEnumType", E.getDetailMsg()); + } } //-------------------------------------------------------------------------- -// Function: AbstractDs::getIntType -///\brief Returns the integer datatype of this abstract dataset which -/// can be a dataset or an attribute. -///\return IntType instance -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 +// Function: AbstractDs::getIntType +///\brief Returns the integer datatype of this abstract dataset which +/// can be a dataset or an attribute. +///\return IntType instance +///\exception H5::DataTypeIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- IntType AbstractDs::getIntType() const { - // Gets the id of the datatype used by this dataset or attribute using - // p_get_type. p_get_type calls either H5Dget_type or H5Aget_type - // depending on which object invokes getIntType. Then, create and - // return the IntType object - try { - IntType inttype; - f_DataType_setId(&inttype, p_get_type()); - return(inttype); - } - catch (DataSetIException& E) { - throw DataTypeIException("DataSet::getIntType", E.getDetailMsg()); - } - catch (AttributeIException& E) { - throw DataTypeIException("Attribute::getIntType", E.getDetailMsg()); - } + // Gets the id of the datatype used by this dataset or attribute using + // p_get_type. p_get_type calls either H5Dget_type or H5Aget_type + // depending on which object invokes getIntType. Then, create and + // return the IntType object + try { + IntType inttype; + f_DataType_setId(&inttype, p_get_type()); + return(inttype); + } + catch (DataSetIException& E) { + throw DataTypeIException("DataSet::getIntType", E.getDetailMsg()); + } + catch (AttributeIException& E) { + throw DataTypeIException("Attribute::getIntType", E.getDetailMsg()); + } } //-------------------------------------------------------------------------- -// Function: AbstractDs::getFloatType -///\brief Returns the floating-point datatype of this abstract dataset, -/// which can be a dataset or an attribute. -///\return FloatType instance -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 +// Function: AbstractDs::getFloatType +///\brief Returns the floating-point datatype of this abstract dataset, +/// which can be a dataset or an attribute. +///\return FloatType instance +///\exception H5::DataTypeIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- FloatType AbstractDs::getFloatType() const { - // Gets the id of the datatype used by this dataset or attribute using - // p_get_type. p_get_type calls either H5Dget_type or H5Aget_type - // depending on which object invokes getFloatType. Then, create and - // return the FloatType object - try { - FloatType floatype; - f_DataType_setId(&floatype, p_get_type()); - return(floatype); - } - catch (DataSetIException& E) { - throw DataTypeIException("DataSet::getFloatType", E.getDetailMsg()); - } - catch (AttributeIException& E) { - throw DataTypeIException("Attribute::getFloatType", E.getDetailMsg()); - } + // Gets the id of the datatype used by this dataset or attribute using + // p_get_type. p_get_type calls either H5Dget_type or H5Aget_type + // depending on which object invokes getFloatType. Then, create and + // return the FloatType object + try { + FloatType floatype; + f_DataType_setId(&floatype, p_get_type()); + return(floatype); + } + catch (DataSetIException& E) { + throw DataTypeIException("DataSet::getFloatType", E.getDetailMsg()); + } + catch (AttributeIException& E) { + throw DataTypeIException("Attribute::getFloatType", E.getDetailMsg()); + } } //-------------------------------------------------------------------------- -// Function: AbstractDs::getStrType -///\brief Returns the string datatype of this abstract dataset which -/// can be a dataset or an attribute. -///\return StrType instance -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 +// Function: AbstractDs::getStrType +///\brief Returns the string datatype of this abstract dataset which +/// can be a dataset or an attribute. +///\return StrType instance +///\exception H5::DataTypeIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- StrType AbstractDs::getStrType() const { - // Gets the id of the datatype used by this dataset or attribute using - // p_get_type. p_get_type calls either H5Dget_type or H5Aget_type - // depending on which object invokes getStrType. Then, create and - // return the StrType object - try { - StrType strtype; - f_DataType_setId(&strtype, p_get_type()); - return(strtype); - } - catch (DataSetIException& E) { - throw DataTypeIException("DataSet::getStrType", E.getDetailMsg()); - } - catch (AttributeIException& E) { - throw DataTypeIException("Attribute::getStrType", E.getDetailMsg()); - } + // Gets the id of the datatype used by this dataset or attribute using + // p_get_type. p_get_type calls either H5Dget_type or H5Aget_type + // depending on which object invokes getStrType. Then, create and + // return the StrType object + try { + StrType strtype; + f_DataType_setId(&strtype, p_get_type()); + return(strtype); + } + catch (DataSetIException& E) { + throw DataTypeIException("DataSet::getStrType", E.getDetailMsg()); + } + catch (AttributeIException& E) { + throw DataTypeIException("Attribute::getStrType", E.getDetailMsg()); + } } //-------------------------------------------------------------------------- -// Function: AbstractDs::getVarLenType -///\brief Returns the floating-point datatype of this abstract dataset, -/// which can be a dataset or an attribute. -///\return VarLenType instance -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - Jul, 2005 +// Function: AbstractDs::getVarLenType +///\brief Returns the floating-point datatype of this abstract dataset, +/// which can be a dataset or an attribute. +///\return VarLenType instance +///\exception H5::DataTypeIException +// Programmer Binh-Minh Ribler - Jul, 2005 //-------------------------------------------------------------------------- VarLenType AbstractDs::getVarLenType() const { - // Gets the id of the datatype used by this dataset or attribute using - // p_get_type. p_get_type calls either H5Dget_type or H5Aget_type - // depending on which object invokes getVarLenType. Then, create and - // return the VarLenType object - try { - VarLenType varlentype; - f_DataType_setId(&varlentype, p_get_type()); - return(varlentype); - } - catch (DataSetIException& E) { - throw DataTypeIException("DataSet::getVarLenType", E.getDetailMsg()); - } - catch (AttributeIException& E) { - throw DataTypeIException("Attribute::getVarLenType", E.getDetailMsg()); - } + // Gets the id of the datatype used by this dataset or attribute using + // p_get_type. p_get_type calls either H5Dget_type or H5Aget_type + // depending on which object invokes getVarLenType. Then, create and + // return the VarLenType object + try { + VarLenType varlentype; + f_DataType_setId(&varlentype, p_get_type()); + return(varlentype); + } + catch (DataSetIException& E) { + throw DataTypeIException("DataSet::getVarLenType", E.getDetailMsg()); + } + catch (AttributeIException& E) { + throw DataTypeIException("Attribute::getVarLenType", E.getDetailMsg()); + } } //-------------------------------------------------------------------------- -// Function: AbstractDs destructor -///\brief Noop destructor. -// Programmer Binh-Minh Ribler - 2000 +// Function: AbstractDs destructor +///\brief Noop destructor. +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- AbstractDs::~AbstractDs() {} diff --git a/c++/src/H5AbstractDs.h b/c++/src/H5AbstractDs.h index 1b4775c..eaa9d14 100644 --- a/c++/src/H5AbstractDs.h +++ b/c++/src/H5AbstractDs.h @@ -37,44 +37,44 @@ class DataSpace; */ class H5_DLLCPP AbstractDs { public: - // Gets a copy the datatype of that this abstract dataset uses. - // Note that this datatype is a generic one and can only be accessed - // via generic member functions, i.e., member functions belong - // to DataType. To get specific datatype, i.e. EnumType, FloatType, - // etc..., use the specific functions, that follow, instead. - DataType getDataType() const; + // Gets a copy the datatype of that this abstract dataset uses. + // Note that this datatype is a generic one and can only be accessed + // via generic member functions, i.e., member functions belong + // to DataType. To get specific datatype, i.e. EnumType, FloatType, + // etc..., use the specific functions, that follow, instead. + DataType getDataType() const; - // Gets a copy of the specific datatype of this abstract dataset. - ArrayType getArrayType() const; - CompType getCompType() const; - EnumType getEnumType() const; - IntType getIntType() const; - FloatType getFloatType() const; - StrType getStrType() const; - VarLenType getVarLenType() const; + // Gets a copy of the specific datatype of this abstract dataset. + ArrayType getArrayType() const; + CompType getCompType() const; + EnumType getEnumType() const; + IntType getIntType() const; + FloatType getFloatType() const; + StrType getStrType() const; + VarLenType getVarLenType() const; - ///\brief Gets the size in memory of this abstract dataset. - virtual size_t getInMemDataSize() const = 0; + ///\brief Gets the size in memory of this abstract dataset. + virtual size_t getInMemDataSize() const = 0; - ///\brief Gets the dataspace of this abstract dataset - pure virtual. - virtual DataSpace getSpace() const = 0; + ///\brief Gets the dataspace of this abstract dataset - pure virtual. + virtual DataSpace getSpace() const = 0; - // Gets the class of the datatype that is used by this abstract - // dataset. - H5T_class_t getTypeClass() const; + // Gets the class of the datatype that is used by this abstract + // dataset. + H5T_class_t getTypeClass() const; - ///\brief Returns the amount of storage size required - pure virtual. - virtual hsize_t getStorageSize() const = 0; + ///\brief Returns the amount of storage size required - pure virtual. + virtual hsize_t getStorageSize() const = 0; - // Returns this class name - pure virtual. - virtual H5std_string fromClass() const = 0; + // Returns this class name - pure virtual. + virtual H5std_string fromClass() const = 0; - // Destructor - virtual ~AbstractDs(); + // Destructor + virtual ~AbstractDs(); protected: - // Default constructor - AbstractDs(); + // Default constructor + AbstractDs(); // *** Deprecation warning *** // The following two constructors are no longer appropriate after the @@ -83,14 +83,14 @@ class H5_DLLCPP AbstractDs { // other will be removed from 1.10 release, and then from 1.8 if its // removal does not raise any problems in two 1.10 releases. - // Mar 2016 -BMR, AbstractDs(const hid_t h5_id); + // Mar 2016 -BMR, AbstractDs(const hid_t h5_id); - // Copy constructor - // AbstractDs( const AbstractDs& original ); + // Copy constructor + // AbstractDs( const AbstractDs& original ); private: - // This member function is implemented by DataSet and Attribute - pure virtual. - virtual hid_t p_get_type() const = 0; + // This member function is implemented by DataSet and Attribute - pure virtual. + virtual hid_t p_get_type() const = 0; }; } #endif // __AbstractDs_H diff --git a/c++/src/H5ArrayType.cpp b/c++/src/H5ArrayType.cpp index ecce591..3cdcc0a 100644 --- a/c++/src/H5ArrayType.cpp +++ b/c++/src/H5ArrayType.cpp @@ -30,95 +30,95 @@ namespace H5 { //-------------------------------------------------------------------------- -// Function: ArrayType default constructor -///\brief Default constructor: Creates a stub ArrayType -// Programmer Binh-Minh Ribler - May 2004 +// Function: ArrayType default constructor +///\brief Default constructor: Creates a stub ArrayType +// Programmer Binh-Minh Ribler - May 2004 //-------------------------------------------------------------------------- ArrayType::ArrayType() : DataType() {} //-------------------------------------------------------------------------- -// Function: ArrayType overloaded constructor -///\brief Creates an ArrayType object using an existing id. -///\param existing_id - IN: Id of an existing datatype -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - May 2004 +// Function: ArrayType overloaded constructor +///\brief Creates an ArrayType object using an existing id. +///\param existing_id - IN: Id of an existing datatype +///\exception H5::DataTypeIException +// Programmer Binh-Minh Ribler - May 2004 //-------------------------------------------------------------------------- -ArrayType::ArrayType( const hid_t existing_id ) : DataType( existing_id ) {} +ArrayType::ArrayType(const hid_t existing_id) : DataType(existing_id) {} //-------------------------------------------------------------------------- -// Function: ArrayType copy constructor -///\brief Copy constructor: makes a copy of the original ArrayType object. -// Programmer Binh-Minh Ribler - May 2004 +// Function: ArrayType copy constructor +///\brief Copy constructor: makes a copy of the original ArrayType object. +// Programmer Binh-Minh Ribler - May 2004 //-------------------------------------------------------------------------- ArrayType::ArrayType(const ArrayType& original) : DataType(original) {} //-------------------------------------------------------------------------- -// Function: ArrayType overloaded constructor -///\brief Creates a new array data type based on the specified -/// \a base_type. -///\param base_type - IN: Existing datatype -///\param ndims - IN: Rank of the array, [0..H5S_MAX_RANK] -///\param dims - IN: Size of each array dimension -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - May 2004 +// Function: ArrayType overloaded constructor +///\brief Creates a new array data type based on the specified +/// \a base_type. +///\param base_type - IN: Existing datatype +///\param ndims - IN: Rank of the array, [0..H5S_MAX_RANK] +///\param dims - IN: Size of each array dimension +///\exception H5::DataTypeIException +// Programmer Binh-Minh Ribler - May 2004 //-------------------------------------------------------------------------- ArrayType::ArrayType(const DataType& base_type, int ndims, const hsize_t* dims) : DataType() { // Call C API to create an array data type hid_t new_type_id = H5Tarray_create2(base_type.getId(), ndims, dims); if (new_type_id < 0) - throw DataTypeIException("ArrayType constructor", "H5Tarray_create2 failed"); + throw DataTypeIException("ArrayType constructor", "H5Tarray_create2 failed"); // Set the id for this object id = new_type_id; } //-------------------------------------------------------------------------- -// Function: ArrayType overloaded constructor -///\brief Creates an ArrayType instance by opening an HDF5 array datatype -/// given its name, provided as a C character string. -///\param dtype_name - IN: Array type name -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - Dec 2016 +// Function: ArrayType overloaded constructor +///\brief Creates an ArrayType instance by opening an HDF5 array datatype +/// given its name, provided as a C character string. +///\param dtype_name - IN: Array type name +///\exception H5::DataTypeIException +// Programmer Binh-Minh Ribler - Dec 2016 // Description -// In 1.10.1, this constructor was introduced and will replace the -// existing function CommonFG::openArrayType(const char*) to -// improve usability. -// -BMR, Dec 2016 +// In 1.10.1, this constructor was introduced and will replace the +// existing function CommonFG::openArrayType(const char*) to +// improve usability. +// -BMR, Dec 2016 //-------------------------------------------------------------------------- ArrayType::ArrayType(const H5Location& loc, const char *dtype_name) : DataType() { - id = p_opentype(loc, dtype_name); + id = p_opentype(loc, dtype_name); } //-------------------------------------------------------------------------- -// Function: ArrayType overloaded constructor -///\brief Creates an ArrayType instance by opening an HDF5 array datatype -/// given its name, provided as an \c H5std_string. -///\param dtype_name - IN: Array type name -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - Dec 2016 +// Function: ArrayType overloaded constructor +///\brief Creates an ArrayType instance by opening an HDF5 array datatype +/// given its name, provided as an \c H5std_string. +///\param dtype_name - IN: Array type name +///\exception H5::DataTypeIException +// Programmer Binh-Minh Ribler - Dec 2016 // Description -// In 1.10.1, this constructor was introduced and will replace the -// existing function CommonFG::openArrayType(const H5std_string&) -// to improve usability. -// -BMR, Dec 2016 +// In 1.10.1, this constructor was introduced and will replace the +// existing function CommonFG::openArrayType(const H5std_string&) +// to improve usability. +// -BMR, Dec 2016 //-------------------------------------------------------------------------- ArrayType::ArrayType(const H5Location& loc, const H5std_string& dtype_name) : DataType() { - id = p_opentype(loc, dtype_name.c_str()); + id = p_opentype(loc, dtype_name.c_str()); } //-------------------------------------------------------------------------- -// Function: ArrayType::operator= -///\brief Assignment operator -///\param rhs - IN: Reference to the existing array datatype -///\return Reference to ArrayType instance -///\exception H5::DataTypeIException +// Function: ArrayType::operator= +///\brief Assignment operator +///\param rhs - IN: Reference to the existing array datatype +///\return Reference to ArrayType instance +///\exception H5::DataTypeIException // Description -// Closes the id on the lhs object first with setId, then copies -// each data member from the rhs object. (Issue HDFFV-9562) -// Programmer Binh-Minh Ribler - Mar 2016 +// Closes the id on the lhs object first with setId, then copies +// each data member from the rhs object. (Issue HDFFV-9562) +// Programmer Binh-Minh Ribler - Mar 2016 // Modification //-------------------------------------------------------------------------- ArrayType& ArrayType::operator=(const ArrayType& rhs) @@ -139,14 +139,14 @@ ArrayType& ArrayType::operator=(const ArrayType& rhs) } //-------------------------------------------------------------------------- -// Function: ArrayType::getArrayNDims -///\brief Returns the number of dimensions for an array datatype. -///\return Number of dimensions -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - May 2004 +// Function: ArrayType::getArrayNDims +///\brief Returns the number of dimensions for an array datatype. +///\return Number of dimensions +///\exception H5::DataTypeIException +// Programmer Binh-Minh Ribler - May 2004 // Modification -// Apr, 2016 -// Became const. +// Apr, 2016 +// Became const. //-------------------------------------------------------------------------- int ArrayType::getArrayNDims() const { @@ -154,38 +154,38 @@ int ArrayType::getArrayNDims() const int ndims = H5Tget_array_ndims(id); if (ndims < 0) { - throw DataTypeIException("ArrayType::getArrayNDims", "H5Tget_array_ndims failed"); + throw DataTypeIException("ArrayType::getArrayNDims", "H5Tget_array_ndims failed"); } return(ndims); } //-------------------------------------------------------------------------- -// Function: ArrayType::getArrayDims -///\brief Retrieves the size of all dimensions of an array datatype. -///\param dims - OUT: Sizes of dimensions -///\return Number of dimensions -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - May 2004 +// Function: ArrayType::getArrayDims +///\brief Retrieves the size of all dimensions of an array datatype. +///\param dims - OUT: Sizes of dimensions +///\return Number of dimensions +///\exception H5::DataTypeIException +// Programmer Binh-Minh Ribler - May 2004 // Modification -// Apr, 2016 -// Became const. +// Apr, 2016 +// Became const. //-------------------------------------------------------------------------- int ArrayType::getArrayDims(hsize_t* dims) const { // Get the dimensions int ndims = H5Tget_array_dims2(id, dims); if (ndims < 0) - throw DataTypeIException("ArrayType::getArrayDims", "H5Tget_array_dims2 failed"); + throw DataTypeIException("ArrayType::getArrayDims", "H5Tget_array_dims2 failed"); // Return the number of dimensions return(ndims); } //-------------------------------------------------------------------------- -// Function: ArrayType destructor -///\brief Properly terminates access to this array datatype. -// Programmer Binh-Minh Ribler - May 2004 +// Function: ArrayType destructor +///\brief Properly terminates access to this array datatype. +// Programmer Binh-Minh Ribler - May 2004 //-------------------------------------------------------------------------- ArrayType::~ArrayType() {} diff --git a/c++/src/H5ArrayType.h b/c++/src/H5ArrayType.h index 65917ae..15b6bb3 100644 --- a/c++/src/H5ArrayType.h +++ b/c++/src/H5ArrayType.h @@ -27,39 +27,39 @@ namespace H5 { */ class H5_DLLCPP ArrayType : public DataType { public: - // Constructor that creates a new array data type based on the - // specified base type. - ArrayType(const DataType& base_type, int ndims, const hsize_t* dims); + // Constructor that creates a new array data type based on the + // specified base type. + ArrayType(const DataType& base_type, int ndims, const hsize_t* dims); - // Assignment operator - ArrayType& operator=(const ArrayType& rhs); + // Assignment operator + ArrayType& operator=(const ArrayType& rhs); - // Constructors that open an array datatype, given a location. - ArrayType(const H5Location& loc, const char* name); - ArrayType(const H5Location& loc, const H5std_string& name); + // Constructors that open an array datatype, given a location. + ArrayType(const H5Location& loc, const char* name); + ArrayType(const H5Location& loc, const H5std_string& name); - // Returns the number of dimensions of this array datatype. - int getArrayNDims() const; - //int getArrayNDims(); // removed 1.8.18 and 1.10.1 + // Returns the number of dimensions of this array datatype. + int getArrayNDims() const; + //int getArrayNDims(); // removed 1.8.18 and 1.10.1 - // Returns the sizes of dimensions of this array datatype. - int getArrayDims(hsize_t* dims) const; - //int getArrayDims(hsize_t* dims); // removed 1.8.18 and 1.10.1 + // Returns the sizes of dimensions of this array datatype. + int getArrayDims(hsize_t* dims) const; + //int getArrayDims(hsize_t* dims); // removed 1.8.18 and 1.10.1 - ///\brief Returns this class name. - virtual H5std_string fromClass () const { return("ArrayType"); } + ///\brief Returns this class name. + virtual H5std_string fromClass () const { return("ArrayType"); } - // Copy constructor: makes copy of the original object. - ArrayType( const ArrayType& original ); + // Copy constructor: makes copy of the original object. + ArrayType(const ArrayType& original); - // Constructor that takes an existing id - ArrayType( const hid_t existing_id ); + // Constructor that takes an existing id + ArrayType(const hid_t existing_id); - // Noop destructor - virtual ~ArrayType(); + // Noop destructor + virtual ~ArrayType(); - // Default constructor - ArrayType(); + // Default constructor + ArrayType(); }; } #endif // __H5ArrayType_H diff --git a/c++/src/H5AtomType.cpp b/c++/src/H5AtomType.cpp index 22b163a..0dc2b1e 100644 --- a/c++/src/H5AtomType.cpp +++ b/c++/src/H5AtomType.cpp @@ -31,265 +31,265 @@ namespace H5 { #ifndef DOXYGEN_SHOULD_SKIP_THIS //-------------------------------------------------------------------------- -// Function: AtomType default constructor [protected] -// Purpose Default constructor: creates a stub atomic datatype. -// Programmer Binh-Minh Ribler - 2000 +// Function: AtomType default constructor [protected] +// Purpose Default constructor: creates a stub atomic datatype. +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- AtomType::AtomType() : DataType() {} //-------------------------------------------------------------------------- -// Function: AtomType overloaded constructor [protected] -// Purpose Creates an AtomType object using an existing id. -// Parameter existing_id - IN: Id of an existing datatype -// Exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 +// Function: AtomType overloaded constructor [protected] +// Purpose Creates an AtomType object using an existing id. +// Parameter existing_id - IN: Id of an existing datatype +// Exception H5::DataTypeIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -AtomType::AtomType( const hid_t existing_id ) : DataType( existing_id ) {} +AtomType::AtomType(const hid_t existing_id) : DataType(existing_id) {} //-------------------------------------------------------------------------- -// Function: AtomType copy constructor -///\brief Copy constructor: makes a copy of the original AtomType object. -// Programmer Binh-Minh Ribler - 2000 +// Function: AtomType copy constructor +///\brief Copy constructor: makes a copy of the original AtomType object. +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -AtomType::AtomType( const AtomType& original ) : DataType( original ) {} +AtomType::AtomType(const AtomType& original) : DataType(original) {} #endif // DOXYGEN_SHOULD_SKIP_THIS //-------------------------------------------------------------------------- -// Function: AtomType::setSize -///\brief Sets the total size for an atomic datatype. -///\param size - IN: Size to set -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 +// Function: AtomType::setSize +///\brief Sets the total size for an atomic datatype. +///\param size - IN: Size to set +///\exception H5::DataTypeIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -void AtomType::setSize( size_t size ) const +void AtomType::setSize(size_t size) const { - // Call C routine H5Tset_size to set the total size - herr_t ret_value = H5Tset_size( id, size ); - if( ret_value < 0 ) - { - throw DataTypeIException(inMemFunc("setSize"), "H5Tset_size failed"); - } + // Call C routine H5Tset_size to set the total size + herr_t ret_value = H5Tset_size(id, size); + if (ret_value < 0) + { + throw DataTypeIException(inMemFunc("setSize"), "H5Tset_size failed"); + } } //-------------------------------------------------------------------------- -// Function: AtomType::getOrder -///\brief Returns the byte order of an atomic datatype. -///\return Byte order, which can be: -/// \li \c H5T_ORDER_LE -/// \li \c H5T_ORDER_BE -/// \li \c H5T_ORDER_VAX -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - Mar, 2005 +// Function: AtomType::getOrder +///\brief Returns the byte order of an atomic datatype. +///\return Byte order, which can be: +/// \li \c H5T_ORDER_LE +/// \li \c H5T_ORDER_BE +/// \li \c H5T_ORDER_VAX +///\exception H5::DataTypeIException +// Programmer Binh-Minh Ribler - Mar, 2005 //-------------------------------------------------------------------------- H5T_order_t AtomType::getOrder() const { - // Call C routine to get the byte ordering - H5T_order_t type_order = H5Tget_order( id ); + // Call C routine to get the byte ordering + H5T_order_t type_order = H5Tget_order(id); - // return a byte order constant if successful - if( type_order == H5T_ORDER_ERROR ) - { - throw DataTypeIException(inMemFunc("getOrder"), - "H5Tget_order returns H5T_ORDER_ERROR"); - } - return( type_order ); + // return a byte order constant if successful + if (type_order == H5T_ORDER_ERROR) + { + throw DataTypeIException(inMemFunc("getOrder"), + "H5Tget_order returns H5T_ORDER_ERROR"); + } + return(type_order); } //-------------------------------------------------------------------------- -// Function: AtomType::getOrder -///\brief This is an overloaded member function, provided for convenience. -/// It takes a reference to a \c H5std_string for the buffer that -/// provide the text description of the returned byte order. -/// The text description can be either of the following: -/// "Little endian byte ordering (0)"; -/// "Big endian byte ordering (1)"; -/// "VAX mixed byte ordering (2)"; -///\param order_string - OUT: Text description of the returned byte order -///\return Byte order, which can be: -/// \li \c H5T_ORDER_LE -/// \li \c H5T_ORDER_BE -/// \li \c H5T_ORDER_VAX -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 +// Function: AtomType::getOrder +///\brief This is an overloaded member function, provided for convenience. +/// It takes a reference to a \c H5std_string for the buffer that +/// provide the text description of the returned byte order. +/// The text description can be either of the following: +/// "Little endian byte ordering (0)"; +/// "Big endian byte ordering (1)"; +/// "VAX mixed byte ordering (2)"; +///\param order_string - OUT: Text description of the returned byte order +///\return Byte order, which can be: +/// \li \c H5T_ORDER_LE +/// \li \c H5T_ORDER_BE +/// \li \c H5T_ORDER_VAX +///\exception H5::DataTypeIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -H5T_order_t AtomType::getOrder( H5std_string& order_string ) const +H5T_order_t AtomType::getOrder(H5std_string& order_string) const { - // Call the overloaded to get the type order without text - H5T_order_t type_order = getOrder(); + // Call the overloaded to get the type order without text + H5T_order_t type_order = getOrder(); - // Then provide the text and return the type order - if( type_order == H5T_ORDER_LE ) - order_string = "Little endian byte ordering (0)"; - else if( type_order == H5T_ORDER_BE ) - order_string = "Big endian byte ordering (1)"; - else if( type_order == H5T_ORDER_VAX ) - order_string = "VAX mixed byte ordering (2)"; - return( type_order ); + // Then provide the text and return the type order + if (type_order == H5T_ORDER_LE) + order_string = "Little endian byte ordering (0)"; + else if (type_order == H5T_ORDER_BE) + order_string = "Big endian byte ordering (1)"; + else if (type_order == H5T_ORDER_VAX) + order_string = "VAX mixed byte ordering (2)"; + return(type_order); } //-------------------------------------------------------------------------- -// Function: AtomType::setOrder -///\brief Sets the byte ordering of an atomic datatype. -///\param order - IN: Byte ordering constant, which can be: -/// \li \c H5T_ORDER_LE -/// \li \c H5T_ORDER_BE -/// \li \c H5T_ORDER_VAX -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 +// Function: AtomType::setOrder +///\brief Sets the byte ordering of an atomic datatype. +///\param order - IN: Byte ordering constant, which can be: +/// \li \c H5T_ORDER_LE +/// \li \c H5T_ORDER_BE +/// \li \c H5T_ORDER_VAX +///\exception H5::DataTypeIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -void AtomType::setOrder( H5T_order_t order ) const +void AtomType::setOrder(H5T_order_t order) const { - // Call C routine to set the byte ordering - herr_t ret_value = H5Tset_order( id, order ); - if( ret_value < 0 ) - { - throw DataTypeIException(inMemFunc("setOrder"), "H5Tset_order failed"); - } + // Call C routine to set the byte ordering + herr_t ret_value = H5Tset_order(id, order); + if (ret_value < 0) + { + throw DataTypeIException(inMemFunc("setOrder"), "H5Tset_order failed"); + } } //-------------------------------------------------------------------------- -// Function: AtomType::getPrecision -///\brief Returns the precision of an atomic datatype. -///\return Number of significant bits -///\exception H5::DataTypeIException +// Function: AtomType::getPrecision +///\brief Returns the precision of an atomic datatype. +///\return Number of significant bits +///\exception H5::DataTypeIException ///\par Description -/// The precision is the number of significant bits which, -/// unless padding is present, is 8 times larger than the -/// value returned by \c DataType::getSize(). -// Programmer Binh-Minh Ribler - 2000 +/// The precision is the number of significant bits which, +/// unless padding is present, is 8 times larger than the +/// value returned by \c DataType::getSize(). +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- size_t AtomType::getPrecision() const { - size_t num_signi_bits = H5Tget_precision( id ); // C routine + size_t num_signi_bits = H5Tget_precision(id); // C routine - // returns number of significant bits if successful - if( num_signi_bits == 0 ) - { - throw DataTypeIException(inMemFunc("getPrecision"), - "H5Tget_precision returns invalid number of significant bits"); - } - return( num_signi_bits ); + // returns number of significant bits if successful + if (num_signi_bits == 0) + { + throw DataTypeIException(inMemFunc("getPrecision"), + "H5Tget_precision returns invalid number of significant bits"); + } + return(num_signi_bits); } //-------------------------------------------------------------------------- -// Function: AtomType::setPrecision -///\brief Sets the precision of an atomic datatype. -///\param precision - IN: Number of bits of precision -///\exception H5::DataTypeIException +// Function: AtomType::setPrecision +///\brief Sets the precision of an atomic datatype. +///\param precision - IN: Number of bits of precision +///\exception H5::DataTypeIException ///\par Description -/// For information, please see C layer Reference Manuat at: +/// For information, please see C layer Reference Manuat at: /// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5T.html#Datatype-SetPrecision -// Programmer Binh-Minh Ribler - 2000 +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -void AtomType::setPrecision( size_t precision ) const +void AtomType::setPrecision(size_t precision) const { - // Call C routine to set the datatype precision - herr_t ret_value = H5Tset_precision( id, precision ); - if( ret_value < 0 ) - { - throw DataTypeIException(inMemFunc("setPrecision"), "H5Tset_precision failed"); - } + // Call C routine to set the datatype precision + herr_t ret_value = H5Tset_precision(id, precision); + if (ret_value < 0) + { + throw DataTypeIException(inMemFunc("setPrecision"), "H5Tset_precision failed"); + } } //-------------------------------------------------------------------------- -// Function: AtomType::getOffset -///\brief Retrieves the bit offset of the first significant bit. -///\return Offset value -///\exception H5::DataTypeIException +// Function: AtomType::getOffset +///\brief Retrieves the bit offset of the first significant bit. +///\return Offset value +///\exception H5::DataTypeIException ///\par Description -/// For information, please see C layer Reference Manuat at: +/// For information, please see C layer Reference Manuat at: /// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5T.html#Datatype-GetOffset -// Programmer Binh-Minh Ribler - 2000 +// Programmer Binh-Minh Ribler - 2000 // Modification -// 12/05/00: due to C API change -// - return type changed from size_t to int -// - offset = -1 when failure occurs vs. 0 +// 12/05/00: due to C API change +// - return type changed from size_t to int +// - offset = -1 when failure occurs vs. 0 //-------------------------------------------------------------------------- int AtomType::getOffset() const { - int offset = H5Tget_offset( id ); // C routine + int offset = H5Tget_offset(id); // C routine - // returns a non-negative offset value if successful - if( offset == -1 ) - { - throw DataTypeIException(inMemFunc("getOffset"), - "H5Tget_offset returns a negative offset value"); - } - return( offset ); + // returns a non-negative offset value if successful + if (offset == -1) + { + throw DataTypeIException(inMemFunc("getOffset"), + "H5Tget_offset returns a negative offset value"); + } + return(offset); } //-------------------------------------------------------------------------- -// Function: AtomType::setOffset -///\brief Sets the bit offset of the first significant bit. -///\param offset - IN: Offset of first significant bit -///\exception H5::DataTypeIException +// Function: AtomType::setOffset +///\brief Sets the bit offset of the first significant bit. +///\param offset - IN: Offset of first significant bit +///\exception H5::DataTypeIException ///\par Description -/// For information, please see C layer Reference Manuat at: +/// For information, please see C layer Reference Manuat at: /// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5T.html#Datatype-SetOffset -// Programmer Binh-Minh Ribler - 2000 +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -void AtomType::setOffset( size_t offset ) const +void AtomType::setOffset(size_t offset) const { - // Call C routine to set the bit offset - herr_t ret_value = H5Tset_offset( id, offset ); - if( ret_value < 0 ) - { - throw DataTypeIException(inMemFunc("setOffset"), "H5Tset_offset failed"); - } + // Call C routine to set the bit offset + herr_t ret_value = H5Tset_offset(id, offset); + if (ret_value < 0) + { + throw DataTypeIException(inMemFunc("setOffset"), "H5Tset_offset failed"); + } } //-------------------------------------------------------------------------- -// Function: AtomType::getPad -///\brief Retrieves the padding type of the least and most-significant -/// bit padding. -///\param lsb - OUT: Least-significant bit padding type -///\param msb - OUT: Most-significant bit padding type -///\exception H5::DataTypeIException +// Function: AtomType::getPad +///\brief Retrieves the padding type of the least and most-significant +/// bit padding. +///\param lsb - OUT: Least-significant bit padding type +///\param msb - OUT: Most-significant bit padding type +///\exception H5::DataTypeIException ///\par Description -/// Possible values for \a lsb and \a msb include: -/// \li \c H5T_PAD_ZERO (0) - Set background to zeros. -/// \li \c H5T_PAD_ONE (1) - Set background to ones. -/// \li \c H5T_PAD_BACKGROUND (2) - Leave background alone. -// Programmer Binh-Minh Ribler - 2000 +/// Possible values for \a lsb and \a msb include: +/// \li \c H5T_PAD_ZERO (0) - Set background to zeros. +/// \li \c H5T_PAD_ONE (1) - Set background to ones. +/// \li \c H5T_PAD_BACKGROUND (2) - Leave background alone. +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -void AtomType::getPad( H5T_pad_t& lsb, H5T_pad_t& msb ) const +void AtomType::getPad(H5T_pad_t& lsb, H5T_pad_t& msb) const { - // Call C routine to get the padding type - herr_t ret_value = H5Tget_pad( id, &lsb, &msb ); - if( ret_value < 0 ) - { - throw DataTypeIException(inMemFunc("getPad"), "H5Tget_pad failed"); - } + // Call C routine to get the padding type + herr_t ret_value = H5Tget_pad(id, &lsb, &msb); + if (ret_value < 0) + { + throw DataTypeIException(inMemFunc("getPad"), "H5Tget_pad failed"); + } } //-------------------------------------------------------------------------- -// Function: AtomType::setPad -///\brief Sets the least and most-significant bits padding types. -///\param lsb - IN: Least-significant bit padding type -///\param msb - IN: Most-significant bit padding type -///\exception H5::DataTypeIException +// Function: AtomType::setPad +///\brief Sets the least and most-significant bits padding types. +///\param lsb - IN: Least-significant bit padding type +///\param msb - IN: Most-significant bit padding type +///\exception H5::DataTypeIException ///\par Description -/// Valid values for \a lsb and \a msb include: -/// \li \c H5T_PAD_ZERO (0) - Set background to zeros. -/// \li \c H5T_PAD_ONE (1) - Set background to ones. -/// \li \c H5T_PAD_BACKGROUND (2) - Leave background alone. -// Programmer Binh-Minh Ribler - 2000 +/// Valid values for \a lsb and \a msb include: +/// \li \c H5T_PAD_ZERO (0) - Set background to zeros. +/// \li \c H5T_PAD_ONE (1) - Set background to ones. +/// \li \c H5T_PAD_BACKGROUND (2) - Leave background alone. +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -void AtomType::setPad( H5T_pad_t lsb, H5T_pad_t msb ) const +void AtomType::setPad(H5T_pad_t lsb, H5T_pad_t msb) const { - // Call C routine to set the padding type - herr_t ret_value = H5Tset_pad( id, lsb, msb ); - if( ret_value < 0 ) - { - throw DataTypeIException(inMemFunc("setPad"), "H5Tset_pad failed"); - } + // Call C routine to set the padding type + herr_t ret_value = H5Tset_pad(id, lsb, msb); + if (ret_value < 0) + { + throw DataTypeIException(inMemFunc("setPad"), "H5Tset_pad failed"); + } } #ifndef DOXYGEN_SHOULD_SKIP_THIS //-------------------------------------------------------------------------- -// Function: AtomType destructor -///\brief Noop destructor. -// Programmer Binh-Minh Ribler - 2000 +// Function: AtomType destructor +///\brief Noop destructor. +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- AtomType::~AtomType() {} #endif // DOXYGEN_SHOULD_SKIP_THIS diff --git a/c++/src/H5AtomType.h b/c++/src/H5AtomType.h index d84b53f..a1e0262 100644 --- a/c++/src/H5AtomType.h +++ b/c++/src/H5AtomType.h @@ -30,53 +30,53 @@ namespace H5 { */ class H5_DLLCPP AtomType : public DataType { public: - // Returns the byte order of an atomic datatype. - H5T_order_t getOrder() const; - H5T_order_t getOrder( H5std_string& order_string ) const; + // Returns the byte order of an atomic datatype. + H5T_order_t getOrder() const; + H5T_order_t getOrder(H5std_string& order_string) const; - // Sets the byte ordering of an atomic datatype. - void setOrder( H5T_order_t order ) const; + // Sets the byte ordering of an atomic datatype. + void setOrder(H5T_order_t order) const; - // Retrieves the bit offset of the first significant bit. - // 12/05/00 - changed return type to int from size_t - C API - int getOffset() const; + // Retrieves the bit offset of the first significant bit. + // 12/05/00 - changed return type to int from size_t - C API + int getOffset() const; - // Sets the bit offset of the first significant bit. - void setOffset( size_t offset ) const; + // Sets the bit offset of the first significant bit. + void setOffset(size_t offset) const; - // Retrieves the padding type of the least and most-significant bit padding. - void getPad( H5T_pad_t& lsb, H5T_pad_t& msb ) const; + // Retrieves the padding type of the least and most-significant bit padding. + void getPad(H5T_pad_t& lsb, H5T_pad_t& msb) const; - // Sets the least and most-significant bits padding types - void setPad( H5T_pad_t lsb, H5T_pad_t msb ) const; + // Sets the least and most-significant bits padding types + void setPad(H5T_pad_t lsb, H5T_pad_t msb) const; - // Returns the precision of an atomic datatype. - size_t getPrecision() const; + // Returns the precision of an atomic datatype. + size_t getPrecision() const; - // Sets the precision of an atomic datatype. - void setPrecision( size_t precision ) const; + // Sets the precision of an atomic datatype. + void setPrecision(size_t precision) const; - // Sets the total size for an atomic datatype. - void setSize( size_t size ) const; + // Sets the total size for an atomic datatype. + void setSize(size_t size) const; - ///\brief Returns this class name. - virtual H5std_string fromClass () const { return("AtomType"); } + ///\brief Returns this class name. + virtual H5std_string fromClass () const { return("AtomType"); } #ifndef DOXYGEN_SHOULD_SKIP_THIS - // Copy constructor - makes copy of the original object - AtomType( const AtomType& original ); + // Copy constructor - makes copy of the original object + AtomType(const AtomType& original); - // Noop destructor - virtual ~AtomType(); + // Noop destructor + virtual ~AtomType(); #endif // DOXYGEN_SHOULD_SKIP_THIS protected: #ifndef DOXYGEN_SHOULD_SKIP_THIS - // Default constructor - AtomType(); + // Default constructor + AtomType(); - // Constructor that takes an existing id - AtomType( const hid_t existing_id ); + // Constructor that takes an existing id + AtomType(const hid_t existing_id); #endif // DOXYGEN_SHOULD_SKIP_THIS }; } diff --git a/c++/src/H5Attribute.cpp b/c++/src/H5Attribute.cpp index dfd2b28..6701f6e 100644 --- a/c++/src/H5Attribute.cpp +++ b/c++/src/H5Attribute.cpp @@ -1,7 +1,7 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * * Copyright by the Board of Trustees of the University of Illinois. * - * All rights reserved. * +/* All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * * terms governing use, modification, and redistribution, is contained in * @@ -20,7 +20,7 @@ #endif #include -#include "H5private.h" // for HDfree +#include "H5private.h" // for HDfree #include "H5Include.h" #include "H5Exception.h" #include "H5IdComponent.h" @@ -44,17 +44,17 @@ using std::endl; class H5_DLLCPP H5Object; // forward declaration for UserData4Aiterate //-------------------------------------------------------------------------- -// Function: Attribute default constructor -///\brief Default constructor: Creates a stub attribute -// Programmer Binh-Minh Ribler - May, 2004 +// Function: Attribute default constructor +///\brief Default constructor: Creates a stub attribute +// Programmer Binh-Minh Ribler - May, 2004 //-------------------------------------------------------------------------- Attribute::Attribute() : AbstractDs(), H5Location(), id(H5I_INVALID_HID) {} //-------------------------------------------------------------------------- -// Function: Attribute copy constructor -///\brief Copy constructor: makes a copy of the original Attribute object. -///\param original - IN: Original Attribute object to copy -// Programmer Binh-Minh Ribler - 2000 +// Function: Attribute copy constructor +///\brief Copy constructor: makes a copy of the original Attribute object. +///\param original - IN: Original Attribute object to copy +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- Attribute::Attribute(const Attribute& original) : AbstractDs(), H5Location(), id(original.id) { @@ -62,12 +62,12 @@ Attribute::Attribute(const Attribute& original) : AbstractDs(), H5Location(), id } //-------------------------------------------------------------------------- -// Function: Attribute overloaded constructor -///\brief Creates an Attribute object using the id of an existing -/// attribute. -///\param existing_id - IN: Id of an existing attribute -///\exception H5::AttributeIException -// Programmer Binh-Minh Ribler - 2000 +// Function: Attribute overloaded constructor +///\brief Creates an Attribute object using the id of an existing +/// attribute. +///\param existing_id - IN: Id of an existing attribute +///\exception H5::AttributeIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- Attribute::Attribute(const hid_t existing_id) : AbstractDs(), H5Location(), id(existing_id) { @@ -75,30 +75,30 @@ Attribute::Attribute(const hid_t existing_id) : AbstractDs(), H5Location(), id(e } //-------------------------------------------------------------------------- -// Function: Attribute::write -///\brief Writes data to this attribute. -///\param mem_type - IN: Attribute datatype (in memory) -///\param buf - IN: Data to be written -///\exception H5::AttributeIException -// Programmer Binh-Minh Ribler - 2000 +// Function: Attribute::write +///\brief Writes data to this attribute. +///\param mem_type - IN: Attribute datatype (in memory) +///\param buf - IN: Data to be written +///\exception H5::AttributeIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -void Attribute::write( const DataType& mem_type, const void *buf ) const +void Attribute::write(const DataType& mem_type, const void *buf) const { - herr_t ret_value = H5Awrite( id, mem_type.getId(), buf ); - if( ret_value < 0 ) - { - throw AttributeIException("Attribute::write", "H5Awrite failed"); - } + herr_t ret_value = H5Awrite(id, mem_type.getId(), buf); + if (ret_value < 0) + { + throw AttributeIException("Attribute::write", "H5Awrite failed"); + } } //-------------------------------------------------------------------------- -// Function: Attribute::write -///\brief This is an overloaded member function, provided for convenience. -/// It writes a \a H5std_string to this attribute. -///\param mem_type - IN: Attribute datatype (in memory) -///\param strg - IN: Data to be written -///\exception H5::AttributeIException -// Programmer Binh-Minh Ribler - Apr, 2003 +// Function: Attribute::write +///\brief This is an overloaded member function, provided for convenience. +/// It writes a \a H5std_string to this attribute. +///\param mem_type - IN: Attribute datatype (in memory) +///\param strg - IN: Data to be written +///\exception H5::AttributeIException +// Programmer Binh-Minh Ribler - Apr, 2003 //-------------------------------------------------------------------------- void Attribute::write(const DataType& mem_type, const H5std_string& strg) const { @@ -107,7 +107,7 @@ void Attribute::write(const DataType& mem_type, const H5std_string& strg) const htri_t is_variable_len = H5Tis_variable_str(mem_type.getId()); if (is_variable_len < 0) { - throw AttributeIException("Attribute::write", "H5Tis_variable_str failed"); + throw AttributeIException("Attribute::write", "H5Tis_variable_str failed"); } // Convert string to C-string const char* strg_C; @@ -117,55 +117,55 @@ void Attribute::write(const DataType& mem_type, const H5std_string& strg) const // Pass string in differently depends on variable or fixed length if (!is_variable_len) { - ret_value = H5Awrite(id, mem_type.getId(), strg_C); + ret_value = H5Awrite(id, mem_type.getId(), strg_C); } else { - // passing third argument by address - ret_value = H5Awrite(id, mem_type.getId(), &strg_C); + // passing third argument by address + ret_value = H5Awrite(id, mem_type.getId(), &strg_C); } if (ret_value < 0) { - throw AttributeIException("Attribute::write", "H5Awrite failed"); + throw AttributeIException("Attribute::write", "H5Awrite failed"); } } //-------------------------------------------------------------------------- -// Function: Attribute::read -///\brief Reads data from this attribute. -///\param mem_type - IN: Attribute datatype (in memory) -///\param buf - OUT: Buffer for read data -///\exception H5::AttributeIException -// Programmer Binh-Minh Ribler - 2000 +// Function: Attribute::read +///\brief Reads data from this attribute. +///\param mem_type - IN: Attribute datatype (in memory) +///\param buf - OUT: Buffer for read data +///\exception H5::AttributeIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -void Attribute::read( const DataType& mem_type, void *buf ) const +void Attribute::read(const DataType& mem_type, void *buf) const { - herr_t ret_value = H5Aread( id, mem_type.getId(), buf ); - if( ret_value < 0 ) - { - throw AttributeIException("Attribute::read", "H5Aread failed"); - } + herr_t ret_value = H5Aread(id, mem_type.getId(), buf); + if (ret_value < 0) + { + throw AttributeIException("Attribute::read", "H5Aread failed"); + } } //-------------------------------------------------------------------------- -// Function: Attribute::read -///\brief This is an overloaded member function, provided for convenience. -/// It reads a \a H5std_string from this attribute. -///\param mem_type - IN: Attribute datatype (in memory) -///\param strg - IN: Buffer for read string -///\exception H5::AttributeIException -// Programmer Binh-Minh Ribler - Apr, 2003 +// Function: Attribute::read +///\brief This is an overloaded member function, provided for convenience. +/// It reads a \a H5std_string from this attribute. +///\param mem_type - IN: Attribute datatype (in memory) +///\param strg - IN: Buffer for read string +///\exception H5::AttributeIException +// Programmer Binh-Minh Ribler - Apr, 2003 // Modification -// Mar 2008 -// Corrected a misunderstanding that H5Aread would allocate -// space for the buffer. Obtained the attribute size and -// allocated memory properly. -BMR -// Apr 2009 -// Used getInMemDataSize to get attribute data size. -BMR -// Jul 2009 -// Divided into specific private functions for fixed- and -// variable-len string data: p_read_fixed_len and -// p_read_variable_len. This should improve readability. -BMR +// Mar 2008 +// Corrected a misunderstanding that H5Aread would allocate +// space for the buffer. Obtained the attribute size and +// allocated memory properly. -BMR +// Apr 2009 +// Used getInMemDataSize to get attribute data size. -BMR +// Jul 2009 +// Divided into specific private functions for fixed- and +// variable-len string data: p_read_fixed_len and +// p_read_variable_len. This should improve readability. -BMR //-------------------------------------------------------------------------- void Attribute::read(const DataType& mem_type, H5std_string& strg) const { @@ -188,11 +188,11 @@ void Attribute::read(const DataType& mem_type, H5std_string& strg) const } //-------------------------------------------------------------------------- -// Function: Attribute::getInMemDataSize -///\brief Gets the size in memory of the attribute's data. -///\return Size of data (in memory) -///\exception H5::AttributeIException -// Programmer Binh-Minh Ribler - Apr 2009 +// Function: Attribute::getInMemDataSize +///\brief Gets the size in memory of the attribute's data. +///\return Size of data (in memory) +///\exception H5::AttributeIException +// Programmer Binh-Minh Ribler - Apr 2009 //-------------------------------------------------------------------------- size_t Attribute::getInMemDataSize() const { @@ -200,9 +200,9 @@ size_t Attribute::getInMemDataSize() const // Get the data type of this attribute hid_t mem_type_id = H5Aget_type(id); - if( mem_type_id < 0 ) + if (mem_type_id < 0) { - throw AttributeIException(func, "H5Aget_type failed"); + throw AttributeIException(func, "H5Aget_type failed"); } // Get the data type's size by first getting its native type then getting @@ -210,22 +210,22 @@ size_t Attribute::getInMemDataSize() const hid_t native_type = H5Tget_native_type(mem_type_id, H5T_DIR_DEFAULT); if (native_type < 0) { - throw AttributeIException(func, "H5Tget_native_type failed"); + throw AttributeIException(func, "H5Tget_native_type failed"); } size_t type_size = H5Tget_size(native_type); if (type_size == 0) { - throw AttributeIException(func, "H5Tget_size failed"); + throw AttributeIException(func, "H5Tget_size failed"); } // Close the native type and the datatype of this attribute. if (H5Tclose(native_type) < 0) { - throw DataSetIException(func, "H5Tclose(native_type) failed"); + throw DataSetIException(func, "H5Tclose(native_type) failed"); } if (H5Tclose(mem_type_id) < 0) { - throw DataSetIException(func, "H5Tclose(mem_type_id) failed"); + throw DataSetIException(func, "H5Tclose(mem_type_id) failed"); } // Get number of elements of the attribute by first getting its dataspace @@ -233,18 +233,18 @@ size_t Attribute::getInMemDataSize() const hid_t space_id = H5Aget_space(id); if (space_id < 0) { - throw AttributeIException(func, "H5Aget_space failed"); + throw AttributeIException(func, "H5Aget_space failed"); } hssize_t num_elements = H5Sget_simple_extent_npoints(space_id); if (num_elements < 0) { - throw AttributeIException(func, "H5Sget_simple_extent_npoints failed"); + throw AttributeIException(func, "H5Sget_simple_extent_npoints failed"); } // Close the dataspace if (H5Sclose(space_id) < 0) { - throw DataSetIException(func, "H5Sclose failed"); + throw DataSetIException(func, "H5Sclose failed"); } // Calculate and return the size of the data @@ -253,46 +253,46 @@ size_t Attribute::getInMemDataSize() const } //-------------------------------------------------------------------------- -// Function: Attribute::getSpace -///\brief Gets a copy of the dataspace for this attribute. -///\return Dataspace instance -///\exception H5::AttributeIException -// Programmer Binh-Minh Ribler - 2000 +// Function: Attribute::getSpace +///\brief Gets a copy of the dataspace for this attribute. +///\return Dataspace instance +///\exception H5::AttributeIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- DataSpace Attribute::getSpace() const { // Calls C function H5Aget_space to get the id of the dataspace - hid_t dataspace_id = H5Aget_space( id ); + hid_t dataspace_id = H5Aget_space(id); // If the dataspace id is valid, create and return the DataSpace object - if( dataspace_id > 0 ) - { - DataSpace dataspace; - f_DataSpace_setId(&dataspace, dataspace_id); - return(dataspace); - } + if (dataspace_id > 0) + { + DataSpace dataspace; + f_DataSpace_setId(&dataspace, dataspace_id); + return(dataspace); + } else - { - throw AttributeIException("Attribute::getSpace", "H5Aget_space failed"); - } + { + throw AttributeIException("Attribute::getSpace", "H5Aget_space failed"); + } } //-------------------------------------------------------------------------- -// Function: Attribute::getName -///\brief Gets the name of this attribute, returning its length. -///\param attr_name - OUT: Buffer for the name string as char* -///\param buf_size - IN: Length of the buffer, default to 0 -///\return Actual length of the attribute name -///\exception H5::AttributeIException +// Function: Attribute::getName +///\brief Gets the name of this attribute, returning its length. +///\param attr_name - OUT: Buffer for the name string as char* +///\param buf_size - IN: Length of the buffer, default to 0 +///\return Actual length of the attribute name +///\exception H5::AttributeIException ///\par Description -/// This function retrieves \a buf_size chars of the attribute's -/// name including null termination. Thus, if the actual length -/// of the name is more than buf_size-1, the retrieved name will -/// be truncated to accommodate the null terminator. -/// To get length of the attribute's name for buffer allocation, -/// an application can call this function passing in NULL for the -/// first argument and ignore the second argument. -// Programmer Binh-Minh Ribler - Mar, 2014 +/// This function retrieves \a buf_size chars of the attribute's +/// name including null termination. Thus, if the actual length +/// of the name is more than buf_size-1, the retrieved name will +/// be truncated to accommodate the null terminator. +/// To get length of the attribute's name for buffer allocation, +/// an application can call this function passing in NULL for the +/// first argument and ignore the second argument. +// Programmer Binh-Minh Ribler - Mar, 2014 //-------------------------------------------------------------------------- ssize_t Attribute::getName(char* attr_name, size_t buf_size) const { @@ -302,25 +302,25 @@ ssize_t Attribute::getName(char* attr_name, size_t buf_size) const // If H5Aget_name returns a negative value, raise an exception if (name_size < 0) { - throw AttributeIException("Attribute::getName", "H5Aget_name failed"); + throw AttributeIException("Attribute::getName", "H5Aget_name failed"); } else if (name_size == 0) { - throw AttributeIException("Attribute::getName", "Attribute must have a name, name length is 0"); + throw AttributeIException("Attribute::getName", "Attribute must have a name, name length is 0"); } // Return length of the name return(name_size); } //-------------------------------------------------------------------------- -// Function: Attribute::getName -///\brief Returns the name of this attribute as an \a H5std_string. -///\return Name of the attribute -///\exception H5::AttributeIException -// Programmer Binh-Minh Ribler - May, 2004 +// Function: Attribute::getName +///\brief Returns the name of this attribute as an \a H5std_string. +///\return Name of the attribute +///\exception H5::AttributeIException +// Programmer Binh-Minh Ribler - May, 2004 // Modification -// Mar 2014 - BMR -// Revised to use the modified getName() above +// Mar 2014 - BMR +// Revised to use the modified getName() above //-------------------------------------------------------------------------- H5std_string Attribute::getName() const { @@ -332,11 +332,11 @@ H5std_string Attribute::getName() const // If H5Aget_name failed, throw exception if (name_size < 0) { - throw AttributeIException("Attribute::getName", "H5Aget_name failed"); + throw AttributeIException("Attribute::getName", "H5Aget_name failed"); } else if (name_size == 0) { - throw AttributeIException("Attribute::getName", "Attribute must have a name, name length is 0"); + throw AttributeIException("Attribute::getName", "Attribute must have a name, name length is 0"); } // Attribute's name exists, retrieve it else if (name_size > 0) @@ -359,44 +359,44 @@ H5std_string Attribute::getName() const } //-------------------------------------------------------------------------- -// Function: Attribute::getName -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function in that it takes an integer -/// specifying a desired length to be retrieved of the name. -///\return Name (or part of name) of the attribute -///\param len - IN: Desired length of the name -///\exception H5::AttributeIException -// Programmer Binh-Minh Ribler - 2000 +// Function: Attribute::getName +///\brief This is an overloaded member function, provided for convenience. +/// It differs from the above function in that it takes an integer +/// specifying a desired length to be retrieved of the name. +///\return Name (or part of name) of the attribute +///\param len - IN: Desired length of the name +///\exception H5::AttributeIException +// Programmer Binh-Minh Ribler - 2000 // Modification -// Mar 2014 - BMR -// Revised to use the new getName() below +// Mar 2014 - BMR +// Revised to use the new getName() below //-------------------------------------------------------------------------- H5std_string Attribute::getName(size_t len) const { H5std_string attr_name; ssize_t name_size = getName(attr_name, len); if (name_size < 0) - return(""); + return(""); else - return(attr_name); + return(attr_name); } //-------------------------------------------------------------------------- -// Function: Attribute::getName -///\brief Gets the name of this attribute, returning its length. -///\param attr_name - OUT: Buffer for the name string as \a H5std_string -///\param len - IN: Desired length of the name, default to 0 -///\return Actual length of the attribute name -///\exception H5::AttributeIException +// Function: Attribute::getName +///\brief Gets the name of this attribute, returning its length. +///\param attr_name - OUT: Buffer for the name string as \a H5std_string +///\param len - IN: Desired length of the name, default to 0 +///\return Actual length of the attribute name +///\exception H5::AttributeIException ///\par Description -/// This function retrieves the attribute's name as a string. The -/// buf_size can specify a specific length or default to 0, in -/// which case the entire name will be retrieved. -// Programmer Binh-Minh Ribler - Nov, 2001 +/// This function retrieves the attribute's name as a string. The +/// buf_size can specify a specific length or default to 0, in +/// which case the entire name will be retrieved. +// Programmer Binh-Minh Ribler - Nov, 2001 // Modification -// Mar 2014 - BMR -// Added to replace getName(size_t, H5std_string&) so that it'll -// allow the argument "len" to be skipped. +// Mar 2014 - BMR +// Added to replace getName(size_t, H5std_string&) so that it'll +// allow the argument "len" to be skipped. //-------------------------------------------------------------------------- ssize_t Attribute::getName(H5std_string& attr_name, size_t len) const { @@ -406,7 +406,7 @@ ssize_t Attribute::getName(H5std_string& attr_name, size_t len) const if (len == 0) { attr_name = getName(); - name_size = attr_name.length(); + name_size = attr_name.length(); } // If length is provided, get that number of characters in name else @@ -430,33 +430,33 @@ ssize_t Attribute::getName(H5std_string& attr_name, size_t len) const } //-------------------------------------------------------------------------- -// Function: Attribute::getName -// Purpose This function is replaced by the previous function, which -// provides more convenient prototype. It will be removed -// in future release. -// Param len - IN: Desired length of the name -// Param attr_name - OUT: Buffer for the name string -// Return Actual length of the attribute name -// Exception H5::AttributeIException -// Programmer Binh-Minh Ribler - Nov, 2001 +// Function: Attribute::getName +// Purpose This function is replaced by the previous function, which +// provides more convenient prototype. It will be removed +// in future release. +// Param len - IN: Desired length of the name +// Param attr_name - OUT: Buffer for the name string +// Return Actual length of the attribute name +// Exception H5::AttributeIException +// Programmer Binh-Minh Ribler - Nov, 2001 // Modification -// Modified to call its replacement. -BMR, 2014/04/16 -// Removed from documentation. -BMR, 2016/03/07 1.8.17 and 1.10.0 -// Removed from code. -BMR, 2016/08/11 1.8.18 and 1.10.1 +// Modified to call its replacement. -BMR, 2014/04/16 +// Removed from documentation. -BMR, 2016/03/07 1.8.17 and 1.10.0 +// Removed from code. -BMR, 2016/08/11 1.8.18 and 1.10.1 //-------------------------------------------------------------------------- -//ssize_t Attribute::getName( size_t len, H5std_string& attr_name ) const +//ssize_t Attribute::getName(size_t len, H5std_string& attr_name) const //{ // return (getName(attr_name, len)); //} //-------------------------------------------------------------------------- -// Function: Attribute::getStorageSize -///\brief Returns the amount of storage size required for this attribute. -///\return Size of the storage or 0, for no data -///\exception H5::AttributeIException -// Note: H5Dget_storage_size returns 0 when there is no data. This -// function should have no failure. (from SLU) -// Programmer Binh-Minh Ribler - Mar, 2005 +// Function: Attribute::getStorageSize +///\brief Returns the amount of storage size required for this attribute. +///\return Size of the storage or 0, for no data +///\exception H5::AttributeIException +// Note: H5Dget_storage_size returns 0 when there is no data. This +// function should have no failure. (from SLU) +// Programmer Binh-Minh Ribler - Mar, 2005 //-------------------------------------------------------------------------- hsize_t Attribute::getStorageSize() const { @@ -466,19 +466,19 @@ hsize_t Attribute::getStorageSize() const //-------------------------------------------------------------------------- // Function: Attribute::getId -///\brief Get the id of this attribute -///\return Attribute identifier +///\brief Get the id of this attribute +///\return Attribute identifier // Description: -// Class hierarchy is revised to address bugzilla 1068. Class -// AbstractDS and Attribute are moved out of H5Object. In -// addition, member IdComponent::id is moved into subclasses, and -// IdComponent::getId now becomes pure virtual function. +// Class hierarchy is revised to address bugzilla 1068. Class +// AbstractDS and Attribute are moved out of H5Object. In +// addition, member IdComponent::id is moved into subclasses, and +// IdComponent::getId now becomes pure virtual function. // Programmer Binh-Minh Ribler - May, 2008 // Modification -// Aug 2016 - BMR -// Note that Attribute is now inheriting from H5Location, because -// an attribute id can be used to specify a location in HDF5 -// library. +// Aug 2016 - BMR +// Note that Attribute is now inheriting from H5Location, because +// an attribute id can be used to specify a location in HDF5 +// library. //-------------------------------------------------------------------------- hid_t Attribute::getId() const { @@ -486,36 +486,36 @@ hid_t Attribute::getId() const } //-------------------------------------------------------------------------- -// Function: Attribute::p_get_type (private) -// Purpose Gets the datatype of this attribute. -// Return Id of the datatype -// Exception H5::AttributeIException +// Function: Attribute::p_get_type (private) +// Purpose Gets the datatype of this attribute. +// Return Id of the datatype +// Exception H5::AttributeIException // Description -// This private function is used in AbstractDs. -// Programmer Binh-Minh Ribler - 2000 +// This private function is used in AbstractDs. +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- hid_t Attribute::p_get_type() const { - hid_t type_id = H5Aget_type( id ); - if( type_id > 0 ) - return( type_id ); - else - { - throw AttributeIException("", "H5Aget_type failed"); - } + hid_t type_id = H5Aget_type(id); + if (type_id > 0) + return(type_id); + else + { + throw AttributeIException("", "H5Aget_type failed"); + } } //-------------------------------------------------------------------------- -// Function: Attribute::p_read_fixed_len (private) -// brief Reads a fixed length \a H5std_string from an attribute. -// param mem_type - IN: Attribute datatype (in memory) -// param strg - IN: Buffer for read string -// exception H5::AttributeIException -// Programmer Binh-Minh Ribler - Jul, 2009 +// Function: Attribute::p_read_fixed_len (private) +// brief Reads a fixed length \a H5std_string from an attribute. +// param mem_type - IN: Attribute datatype (in memory) +// param strg - IN: Buffer for read string +// exception H5::AttributeIException +// Programmer Binh-Minh Ribler - Jul, 2009 // Modification -// Jul 2009 -// Separated the fixed length case from the original -// Attribute::read +// Jul 2009 +// Separated the fixed length case from the original +// Attribute::read //-------------------------------------------------------------------------- void Attribute::p_read_fixed_len(const DataType& mem_type, H5std_string& strg) const { @@ -527,31 +527,31 @@ void Attribute::p_read_fixed_len(const DataType& mem_type, H5std_string& strg) c // If there is data, allocate buffer and read it. if (attr_size > 0) { - char *strg_C = new char[attr_size+1]; - herr_t ret_value = H5Aread(id, mem_type.getId(), strg_C); - if( ret_value < 0 ) - { - delete []strg_C; // de-allocate for fixed-len string - throw AttributeIException("Attribute::read", "H5Aread failed"); - } - // Get string from the C char* and release resource allocated locally - strg_C[attr_size] = '\0'; - strg = strg_C; - delete []strg_C; + char *strg_C = new char[attr_size+1]; + herr_t ret_value = H5Aread(id, mem_type.getId(), strg_C); + if (ret_value < 0) + { + delete []strg_C; // de-allocate for fixed-len string + throw AttributeIException("Attribute::read", "H5Aread failed"); + } + // Get string from the C char* and release resource allocated locally + strg_C[attr_size] = '\0'; + strg = strg_C; + delete []strg_C; } } //-------------------------------------------------------------------------- -// Function: Attribute::p_read_variable_len (private) -// brief Reads a variable length \a H5std_string from an attribute. -// param mem_type - IN: Attribute datatype (in memory) -// param strg - IN: Buffer for read string -// exception H5::AttributeIException -// Programmer Binh-Minh Ribler - Jul, 2009 +// Function: Attribute::p_read_variable_len (private) +// brief Reads a variable length \a H5std_string from an attribute. +// param mem_type - IN: Attribute datatype (in memory) +// param strg - IN: Buffer for read string +// exception H5::AttributeIException +// Programmer Binh-Minh Ribler - Jul, 2009 // Modification -// Jul 2009 -// Separated the variable length case from the original -// Attribute::read. -BMR +// Jul 2009 +// Separated the variable length case from the original +// Attribute::read. -BMR //-------------------------------------------------------------------------- void Attribute::p_read_variable_len(const DataType& mem_type, H5std_string& strg) const { @@ -561,9 +561,9 @@ void Attribute::p_read_variable_len(const DataType& mem_type, H5std_string& strg // Read attribute, no allocation for variable-len string; C library will herr_t ret_value = H5Aread(id, mem_type.getId(), &strg_C); - if( ret_value < 0 ) + if (ret_value < 0) { - throw AttributeIException("Attribute::read", "H5Aread failed"); + throw AttributeIException("Attribute::read", "H5Aread failed"); } // Get string from the C char* and release resource allocated by C API @@ -577,65 +577,65 @@ void Attribute::p_read_variable_len(const DataType& mem_type, H5std_string& strg ///\brief Sets the identifier of this object to a new value. /// ///\exception H5::IdComponentException when the attempt to close the HDF5 -/// object fails +/// object fails // Description: -// The underlaying reference counting in the C library ensures -// that the current valid id of this object is properly closed. -// Then the object's id is reset to the new id. +// The underlaying reference counting in the C library ensures +// that the current valid id of this object is properly closed. +// Then the object's id is reset to the new id. // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void Attribute::p_setId(const hid_t new_id) { // handling references to this old id try { - close(); + close(); } catch (Exception& close_error) { - throw AttributeIException("Attribute::p_setId", close_error.getDetailMsg()); + throw AttributeIException("Attribute::p_setId", close_error.getDetailMsg()); } - // reset object's id to the given id - id = new_id; + // reset object's id to the given id + id = new_id; } #endif // DOXYGEN_SHOULD_SKIP_THIS //-------------------------------------------------------------------------- -// Function: Attribute::close -///\brief Closes this attribute. +// Function: Attribute::close +///\brief Closes this attribute. /// -///\exception H5::AttributeIException -// Programmer Binh-Minh Ribler - Mar 9, 2005 +///\exception H5::AttributeIException +// Programmer Binh-Minh Ribler - Mar 9, 2005 //-------------------------------------------------------------------------- void Attribute::close() { if (p_valid_id(id)) { - herr_t ret_value = H5Aclose(id); - if( ret_value < 0 ) - { - throw AttributeIException("Attribute::close", "H5Aclose failed"); - } - // reset the id - id = H5I_INVALID_HID; + herr_t ret_value = H5Aclose(id); + if (ret_value < 0) + { + throw AttributeIException("Attribute::close", "H5Aclose failed"); + } + // reset the id + id = H5I_INVALID_HID; } } //-------------------------------------------------------------------------- -// Function: Attribute destructor -///\brief Properly terminates access to this attribute. -// Programmer Binh-Minh Ribler - 2000 +// Function: Attribute destructor +///\brief Properly terminates access to this attribute. +// Programmer Binh-Minh Ribler - 2000 // Modification -// - Replaced resetIdComponent() with decRefCount() to use C -// library ID reference counting mechanism - BMR, Jun 1, 2004 -// - Replaced decRefCount with close() to let the C library -// handle the reference counting - BMR, Jun 1, 2006 +// - Replaced resetIdComponent() with decRefCount() to use C +// library ID reference counting mechanism - BMR, Jun 1, 2004 +// - Replaced decRefCount with close() to let the C library +// handle the reference counting - BMR, Jun 1, 2006 //-------------------------------------------------------------------------- Attribute::~Attribute() { try { - close(); + close(); } catch (Exception& close_error) { - cerr << "Attribute::~Attribute - " << close_error.getDetailMsg() << endl; + cerr << "Attribute::~Attribute - " << close_error.getDetailMsg() << endl; } } diff --git a/c++/src/H5Attribute.h b/c++/src/H5Attribute.h index c27bbdf..0243cd9 100644 --- a/c++/src/H5Attribute.h +++ b/c++/src/H5Attribute.h @@ -32,74 +32,74 @@ namespace H5 { class H5_DLLCPP Attribute : public AbstractDs, public H5Location { public: - // Copy constructor: makes a copy of an existing Attribute object. - Attribute( const Attribute& original ); + // Copy constructor: makes a copy of an existing Attribute object. + Attribute(const Attribute& original); - // Default constructor - Attribute(); + // Default constructor + Attribute(); - // Creates a copy of an existing attribute using the attribute id - Attribute( const hid_t attr_id ); + // Creates a copy of an existing attribute using the attribute id + Attribute(const hid_t attr_id); - // Closes this attribute. - virtual void close(); + // Closes this attribute. + virtual void close(); - // Gets the name of this attribute. - ssize_t getName(char* attr_name, size_t buf_size = 0) const; - H5std_string getName(size_t len) const; - H5std_string getName() const; - ssize_t getName(H5std_string& attr_name, size_t len = 0) const; - // The overloaded function below is replaced by the one above and it - // is kept for backward compatibility purpose. - ssize_t getName( size_t buf_size, H5std_string& attr_name ) const; + // Gets the name of this attribute. + ssize_t getName(char* attr_name, size_t buf_size = 0) const; + H5std_string getName(size_t len) const; + H5std_string getName() const; + ssize_t getName(H5std_string& attr_name, size_t len = 0) const; + // The overloaded function below is replaced by the one above and it + // is kept for backward compatibility purpose. + ssize_t getName(size_t buf_size, H5std_string& attr_name) const; - // Gets a copy of the dataspace for this attribute. - virtual DataSpace getSpace() const; + // Gets a copy of the dataspace for this attribute. + virtual DataSpace getSpace() const; - // Returns the amount of storage size required for this attribute. - virtual hsize_t getStorageSize() const; + // Returns the amount of storage size required for this attribute. + virtual hsize_t getStorageSize() const; - // Returns the in memory size of this attribute's data. - virtual size_t getInMemDataSize() const; + // Returns the in memory size of this attribute's data. + virtual size_t getInMemDataSize() const; - // Reads data from this attribute. - void read( const DataType& mem_type, void *buf ) const; - void read( const DataType& mem_type, H5std_string& strg ) const; + // Reads data from this attribute. + void read(const DataType& mem_type, void *buf) const; + void read(const DataType& mem_type, H5std_string& strg) const; - // Writes data to this attribute. - void write(const DataType& mem_type, const void *buf ) const; - void write(const DataType& mem_type, const H5std_string& strg ) const; + // Writes data to this attribute. + void write(const DataType& mem_type, const void *buf) const; + void write(const DataType& mem_type, const H5std_string& strg) const; - ///\brief Returns this class name. - virtual H5std_string fromClass () const { return("Attribute"); } + ///\brief Returns this class name. + virtual H5std_string fromClass () const { return("Attribute"); } - // Gets the attribute id. - virtual hid_t getId() const; + // Gets the attribute id. + virtual hid_t getId() const; - // Destructor: properly terminates access to this attribute. - virtual ~Attribute(); + // Destructor: properly terminates access to this attribute. + virtual ~Attribute(); #ifndef DOXYGEN_SHOULD_SKIP_THIS protected: - // Sets the attribute id. - virtual void p_setId(const hid_t new_id); + // Sets the attribute id. + virtual void p_setId(const hid_t new_id); #endif // DOXYGEN_SHOULD_SKIP_THIS private: - hid_t id; // HDF5 attribute id + hid_t id; // HDF5 attribute id - // This function contains the common code that is used by - // getTypeClass and various API functions getXxxType - // defined in AbstractDs for generic datatype and specific - // sub-types - virtual hid_t p_get_type() const; + // This function contains the common code that is used by + // getTypeClass and various API functions getXxxType + // defined in AbstractDs for generic datatype and specific + // sub-types + virtual hid_t p_get_type() const; - // Reads variable or fixed len strings from this attribute. - void p_read_variable_len(const DataType& mem_type, H5std_string& strg) const; - void p_read_fixed_len(const DataType& mem_type, H5std_string& strg) const; + // Reads variable or fixed len strings from this attribute. + void p_read_variable_len(const DataType& mem_type, H5std_string& strg) const; + void p_read_fixed_len(const DataType& mem_type, H5std_string& strg) const; - // Friend function to set Attribute id. For library use only. - friend void f_Attribute_setId(Attribute* attr, hid_t new_id); + // Friend function to set Attribute id. For library use only. + friend void f_Attribute_setId(Attribute* attr, hid_t new_id); }; } diff --git a/c++/src/H5Classes.h b/c++/src/H5Classes.h index 03faa1a..00066fe 100644 --- a/c++/src/H5Classes.h +++ b/c++/src/H5Classes.h @@ -18,31 +18,31 @@ #define __H5Classes_H namespace H5 { - class Exception; - class IdComponent; - class H5Location; - class H5Object; - class PropList; - class FileCreatPropList; - class FileAccPropList; - class LinkAccPropList; - class DSetCreatPropList; - class DSetMemXferPropList; - class DTypePropList; - class DataType; - class DataSpace; - class AtomType; - class PredType; - class EnumType; - class IntType; - class FloatType; - class StrType; - class CompType; - class AbstractDs; - class DataSet; - class Group; - class H5File; - class Attribute; - class H5Library; + class Exception; + class IdComponent; + class H5Location; + class H5Object; + class PropList; + class FileCreatPropList; + class FileAccPropList; + class LinkAccPropList; + class DSetCreatPropList; + class DSetMemXferPropList; + class DTypePropList; + class DataType; + class DataSpace; + class AtomType; + class PredType; + class EnumType; + class IntType; + class FloatType; + class StrType; + class CompType; + class AbstractDs; + class DataSet; + class Group; + class H5File; + class Attribute; + class H5Library; } #endif // __H5Classes_H diff --git a/c++/src/H5CommonFG.cpp b/c++/src/H5CommonFG.cpp index 5f7971f..5c01055 100644 --- a/c++/src/H5CommonFG.cpp +++ b/c++/src/H5CommonFG.cpp @@ -16,7 +16,7 @@ #include #include "H5Include.h" -#include "H5private.h" // for HDstrcpy +#include "H5private.h" // for HDstrcpy #include "H5Exception.h" #include "H5IdComponent.h" #include "H5DataSpace.h" @@ -46,293 +46,292 @@ // December 2000 namespace H5 { -using namespace std; //-------------------------------------------------------------------------- -// Function: CommonFG::openDataType -///\brief Opens the named generic datatype at this location. -///\param name - IN: Name of the datatype to open -///\return DataType instance -///\exception H5::FileIException or H5::GroupIException -// Programmer Binh-Minh Ribler - 2000 +// Function: CommonFG::openDataType +///\brief Opens the named generic datatype at this location. +///\param name - IN: Name of the datatype to open +///\return DataType instance +///\exception H5::FileIException or H5::GroupIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -DataType CommonFG::openDataType( const char* name ) const +DataType CommonFG::openDataType(const char* name) const { - // Call C function H5Topen2 to open the named datatype in this group, - // given either the file or group id - hid_t type_id = H5Topen2(getLocId(), name, H5P_DEFAULT); + // Call C function H5Topen2 to open the named datatype in this group, + // given either the file or group id + hid_t type_id = H5Topen2(getLocId(), name, H5P_DEFAULT); - // If the datatype's opening failed, throw an exception - if( type_id < 0 ) - throwException("openDataType", "H5Topen2 failed"); + // If the datatype's opening failed, throw an exception + if (type_id < 0) + throwException("openDataType", "H5Topen2 failed"); - // No failure, create and return the DataType object - DataType data_type(type_id); - return(data_type); + // No failure, create and return the DataType object + DataType data_type(type_id); + return(data_type); } //-------------------------------------------------------------------------- -// Function: CommonFG::openDataType -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function in that it takes an -/// \c H5std_string for \a name. -// Programmer Binh-Minh Ribler - 2000 +// Function: CommonFG::openDataType +///\brief This is an overloaded member function, provided for convenience. +/// It differs from the above function in that it takes an +/// \c H5std_string for \a name. +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -DataType CommonFG::openDataType( const H5std_string& name ) const +DataType CommonFG::openDataType(const H5std_string& name) const { - return( openDataType( name.c_str()) ); + return(openDataType(name.c_str())); } //-------------------------------------------------------------------------- -// Function: CommonFG::openArrayType -///\brief Opens the named array datatype at this location. -///\param name - IN: Name of the array datatype to open -///\return ArrayType instance -///\exception H5::FileIException or H5::GroupIException -// Programmer Binh-Minh Ribler - Jul, 2005 +// Function: CommonFG::openArrayType +///\brief Opens the named array datatype at this location. +///\param name - IN: Name of the array datatype to open +///\return ArrayType instance +///\exception H5::FileIException or H5::GroupIException +// Programmer Binh-Minh Ribler - Jul, 2005 //-------------------------------------------------------------------------- -ArrayType CommonFG::openArrayType( const char* name ) const +ArrayType CommonFG::openArrayType(const char* name) const { - // Call C function H5Topen2 to open the named datatype in this group, - // given either the file or group id - hid_t type_id = H5Topen2(getLocId(), name, H5P_DEFAULT); - - // If the datatype's opening failed, throw an exception - if( type_id < 0 ) - throwException("openArrayType", "H5Topen2 failed"); - - // No failure, create and return the ArrayType object - ArrayType array_type; - f_DataType_setId(&array_type, type_id); - return(array_type); + // Call C function H5Topen2 to open the named datatype in this group, + // given either the file or group id + hid_t type_id = H5Topen2(getLocId(), name, H5P_DEFAULT); + + // If the datatype's opening failed, throw an exception + if (type_id < 0) + throwException("openArrayType", "H5Topen2 failed"); + + // No failure, create and return the ArrayType object + ArrayType array_type; + f_DataType_setId(&array_type, type_id); + return(array_type); } //-------------------------------------------------------------------------- -// Function: CommonFG::openArrayType -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function in that it takes an -/// \c H5std_string for \a name. -// Programmer Binh-Minh Ribler - Jul, 2005 +// Function: CommonFG::openArrayType +///\brief This is an overloaded member function, provided for convenience. +/// It differs from the above function in that it takes an +/// \c H5std_string for \a name. +// Programmer Binh-Minh Ribler - Jul, 2005 //-------------------------------------------------------------------------- -ArrayType CommonFG::openArrayType( const H5std_string& name ) const +ArrayType CommonFG::openArrayType(const H5std_string& name) const { - return( openArrayType( name.c_str()) ); + return(openArrayType(name.c_str())); } //-------------------------------------------------------------------------- -// Function: CommonFG::openCompType -///\brief Opens the named compound datatype at this location. -///\param name - IN: Name of the compound datatype to open -///\return CompType instance -///\exception H5::FileIException or H5::GroupIException -// Programmer Binh-Minh Ribler - 2000 +// Function: CommonFG::openCompType +///\brief Opens the named compound datatype at this location. +///\param name - IN: Name of the compound datatype to open +///\return CompType instance +///\exception H5::FileIException or H5::GroupIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -CompType CommonFG::openCompType( const char* name ) const +CompType CommonFG::openCompType(const char* name) const { - // Call C function H5Topen2 to open the named datatype in this group, - // given either the file or group id - hid_t type_id = H5Topen2(getLocId(), name, H5P_DEFAULT); - - // If the datatype's opening failed, throw an exception - if( type_id < 0 ) - throwException("openCompType", "H5Topen2 failed"); - - // No failure, create and return the CompType object - CompType comp_type; - f_DataType_setId(&comp_type, type_id); - return(comp_type); + // Call C function H5Topen2 to open the named datatype in this group, + // given either the file or group id + hid_t type_id = H5Topen2(getLocId(), name, H5P_DEFAULT); + + // If the datatype's opening failed, throw an exception + if (type_id < 0) + throwException("openCompType", "H5Topen2 failed"); + + // No failure, create and return the CompType object + CompType comp_type; + f_DataType_setId(&comp_type, type_id); + return(comp_type); } //-------------------------------------------------------------------------- -// Function: CommonFG::openCompType -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function in that it takes an -/// \c H5std_string for \a name. -// Programmer Binh-Minh Ribler - 2000 +// Function: CommonFG::openCompType +///\brief This is an overloaded member function, provided for convenience. +/// It differs from the above function in that it takes an +/// \c H5std_string for \a name. +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -CompType CommonFG::openCompType( const H5std_string& name ) const +CompType CommonFG::openCompType(const H5std_string& name) const { - return( openCompType( name.c_str()) ); + return(openCompType(name.c_str())); } //-------------------------------------------------------------------------- -// Function: CommonFG::openEnumType -///\brief Opens the named enumeration datatype at this location. -///\param name - IN: Name of the enumeration datatype to open -///\return EnumType instance -///\exception H5::FileIException or H5::GroupIException -// Programmer Binh-Minh Ribler - 2000 +// Function: CommonFG::openEnumType +///\brief Opens the named enumeration datatype at this location. +///\param name - IN: Name of the enumeration datatype to open +///\return EnumType instance +///\exception H5::FileIException or H5::GroupIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -EnumType CommonFG::openEnumType( const char* name ) const +EnumType CommonFG::openEnumType(const char* name) const { - // Call C function H5Topen2 to open the named datatype in this group, - // given either the file or group id - hid_t type_id = H5Topen2(getLocId(), name, H5P_DEFAULT); - - // If the datatype's opening failed, throw an exception - if( type_id < 0 ) - throwException("openEnumType", "H5Topen2 failed"); - - // No failure, create and return the EnumType object - EnumType enum_type; - f_DataType_setId(&enum_type, type_id); - return(enum_type); + // Call C function H5Topen2 to open the named datatype in this group, + // given either the file or group id + hid_t type_id = H5Topen2(getLocId(), name, H5P_DEFAULT); + + // If the datatype's opening failed, throw an exception + if (type_id < 0) + throwException("openEnumType", "H5Topen2 failed"); + + // No failure, create and return the EnumType object + EnumType enum_type; + f_DataType_setId(&enum_type, type_id); + return(enum_type); } //-------------------------------------------------------------------------- -// Function: CommonFG::openEnumType -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function in that it takes an -/// \c H5std_string for \a name. -// Programmer Binh-Minh Ribler - 2000 +// Function: CommonFG::openEnumType +///\brief This is an overloaded member function, provided for convenience. +/// It differs from the above function in that it takes an +/// \c H5std_string for \a name. +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -EnumType CommonFG::openEnumType( const H5std_string& name ) const +EnumType CommonFG::openEnumType(const H5std_string& name) const { - return( openEnumType( name.c_str()) ); + return(openEnumType(name.c_str())); } //-------------------------------------------------------------------------- -// Function: CommonFG::openIntType -///\brief Opens the named integer datatype at this location. -///\param name - IN: Name of the integer datatype to open -///\return IntType instance -///\exception H5::FileIException or H5::GroupIException -// Programmer Binh-Minh Ribler - 2000 +// Function: CommonFG::openIntType +///\brief Opens the named integer datatype at this location. +///\param name - IN: Name of the integer datatype to open +///\return IntType instance +///\exception H5::FileIException or H5::GroupIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -IntType CommonFG::openIntType( const char* name ) const +IntType CommonFG::openIntType(const char* name) const { - // Call C function H5Topen2 to open the named datatype in this group, - // given either the file or group id - hid_t type_id = H5Topen2(getLocId(), name, H5P_DEFAULT); - - // If the datatype's opening failed, throw an exception - if( type_id < 0 ) - throwException("openIntType", "H5Topen2 failed"); - - // No failure, create and return the IntType object - IntType int_type; - f_DataType_setId(&int_type, type_id); - return(int_type); + // Call C function H5Topen2 to open the named datatype in this group, + // given either the file or group id + hid_t type_id = H5Topen2(getLocId(), name, H5P_DEFAULT); + + // If the datatype's opening failed, throw an exception + if (type_id < 0) + throwException("openIntType", "H5Topen2 failed"); + + // No failure, create and return the IntType object + IntType int_type; + f_DataType_setId(&int_type, type_id); + return(int_type); } //-------------------------------------------------------------------------- -// Function: CommonFG::openIntType -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function in that it takes an -/// \c H5std_string for \a name. -// Programmer Binh-Minh Ribler - 2000 +// Function: CommonFG::openIntType +///\brief This is an overloaded member function, provided for convenience. +/// It differs from the above function in that it takes an +/// \c H5std_string for \a name. +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -IntType CommonFG::openIntType( const H5std_string& name ) const +IntType CommonFG::openIntType(const H5std_string& name) const { - return( openIntType( name.c_str()) ); + return(openIntType(name.c_str())); } //-------------------------------------------------------------------------- -// Function: CommonFG::openFloatType -///\brief Opens the named floating-point datatype at this location. -///\param name - IN: Name of the floating-point datatype to open -///\return FloatType instance -///\exception H5::FileIException or H5::GroupIException -// Programmer Binh-Minh Ribler - 2000 +// Function: CommonFG::openFloatType +///\brief Opens the named floating-point datatype at this location. +///\param name - IN: Name of the floating-point datatype to open +///\return FloatType instance +///\exception H5::FileIException or H5::GroupIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -FloatType CommonFG::openFloatType( const char* name ) const +FloatType CommonFG::openFloatType(const char* name) const { - // Call C function H5Topen2 to open the named datatype in this group, - // given either the file or group id - hid_t type_id = H5Topen2(getLocId(), name, H5P_DEFAULT); - - // If the datatype's opening failed, throw an exception - if( type_id < 0 ) - throwException("openFloatType", "H5Topen2 failed"); - - // No failure, create and return the FloatType object - FloatType float_type; - f_DataType_setId(&float_type, type_id); - return(float_type); + // Call C function H5Topen2 to open the named datatype in this group, + // given either the file or group id + hid_t type_id = H5Topen2(getLocId(), name, H5P_DEFAULT); + + // If the datatype's opening failed, throw an exception + if (type_id < 0) + throwException("openFloatType", "H5Topen2 failed"); + + // No failure, create and return the FloatType object + FloatType float_type; + f_DataType_setId(&float_type, type_id); + return(float_type); } //-------------------------------------------------------------------------- -// Function: CommonFG::openFloatType -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function in that it takes an -/// \c H5std_string for \a name. -// Programmer Binh-Minh Ribler - 2000 +// Function: CommonFG::openFloatType +///\brief This is an overloaded member function, provided for convenience. +/// It differs from the above function in that it takes an +/// \c H5std_string for \a name. +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -FloatType CommonFG::openFloatType( const H5std_string& name ) const +FloatType CommonFG::openFloatType(const H5std_string& name) const { - return( openFloatType( name.c_str()) ); + return(openFloatType(name.c_str())); } //-------------------------------------------------------------------------- -// Function: CommonFG::openStrType -///\brief Opens the named string datatype at this location. -///\param name - IN: Name of the string datatype to open -///\return StrType instance -///\exception H5::FileIException or H5::GroupIException -// Programmer Binh-Minh Ribler - 2000 +// Function: CommonFG::openStrType +///\brief Opens the named string datatype at this location. +///\param name - IN: Name of the string datatype to open +///\return StrType instance +///\exception H5::FileIException or H5::GroupIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -StrType CommonFG::openStrType( const char* name ) const +StrType CommonFG::openStrType(const char* name) const { - // Call C function H5Topen2 to open the named datatype in this group, - // given either the file or group id - hid_t type_id = H5Topen2(getLocId(), name, H5P_DEFAULT); - - // If the datatype's opening failed, throw an exception - if( type_id < 0 ) - throwException("openStrType", "H5Topen2 failed"); - - // No failure, create and return the StrType object - StrType str_type; - f_DataType_setId(&str_type, type_id); - return(str_type); + // Call C function H5Topen2 to open the named datatype in this group, + // given either the file or group id + hid_t type_id = H5Topen2(getLocId(), name, H5P_DEFAULT); + + // If the datatype's opening failed, throw an exception + if (type_id < 0) + throwException("openStrType", "H5Topen2 failed"); + + // No failure, create and return the StrType object + StrType str_type; + f_DataType_setId(&str_type, type_id); + return(str_type); } //-------------------------------------------------------------------------- -// Function: CommonFG::openStrType -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function in that it takes an -/// \c H5std_string for \a name. -// Programmer Binh-Minh Ribler - 2000 +// Function: CommonFG::openStrType +///\brief This is an overloaded member function, provided for convenience. +/// It differs from the above function in that it takes an +/// \c H5std_string for \a name. +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -StrType CommonFG::openStrType( const H5std_string& name ) const +StrType CommonFG::openStrType(const H5std_string& name) const { - return( openStrType( name.c_str()) ); + return(openStrType(name.c_str())); } //-------------------------------------------------------------------------- -// Function: CommonFG::openVarLenType -///\brief Opens the named variable length datatype at this location. -///\param name - IN: Name of the variable length datatype to open -///\return VarLenType instance -///\exception H5::FileIException or H5::GroupIException -// Programmer Binh-Minh Ribler - Jul, 2005 +// Function: CommonFG::openVarLenType +///\brief Opens the named variable length datatype at this location. +///\param name - IN: Name of the variable length datatype to open +///\return VarLenType instance +///\exception H5::FileIException or H5::GroupIException +// Programmer Binh-Minh Ribler - Jul, 2005 //-------------------------------------------------------------------------- -VarLenType CommonFG::openVarLenType( const char* name ) const +VarLenType CommonFG::openVarLenType(const char* name) const { - // Call C function H5Topen2 to open the named datatype in this group, - // given either the file or group id - hid_t type_id = H5Topen2(getLocId(), name, H5P_DEFAULT); - - // If the datatype's opening failed, throw an exception - if( type_id < 0 ) - throwException("openVarLenType", "H5Topen2 failed"); - - // No failure, create and return the VarLenType object - VarLenType varlen_type; - f_DataType_setId(&varlen_type, type_id); - return(varlen_type); + // Call C function H5Topen2 to open the named datatype in this group, + // given either the file or group id + hid_t type_id = H5Topen2(getLocId(), name, H5P_DEFAULT); + + // If the datatype's opening failed, throw an exception + if (type_id < 0) + throwException("openVarLenType", "H5Topen2 failed"); + + // No failure, create and return the VarLenType object + VarLenType varlen_type; + f_DataType_setId(&varlen_type, type_id); + return(varlen_type); } //-------------------------------------------------------------------------- -// Function: CommonFG::openVarLenType -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function in that it takes an -/// \c H5std_string for \a name. -// Programmer Binh-Minh Ribler - Jul, 2005 +// Function: CommonFG::openVarLenType +///\brief This is an overloaded member function, provided for convenience. +/// It differs from the above function in that it takes an +/// \c H5std_string for \a name. +// Programmer Binh-Minh Ribler - Jul, 2005 //-------------------------------------------------------------------------- -VarLenType CommonFG::openVarLenType( const H5std_string& name ) const +VarLenType CommonFG::openVarLenType(const H5std_string& name) const { - return( openVarLenType( name.c_str()) ); + return(openVarLenType(name.c_str())); } #ifndef DOXYGEN_SHOULD_SKIP_THIS diff --git a/c++/src/H5CommonFG.h b/c++/src/H5CommonFG.h index 59f425c..588d49a 100644 --- a/c++/src/H5CommonFG.h +++ b/c++/src/H5CommonFG.h @@ -32,55 +32,55 @@ class VarLenType; */ class H5_DLLCPP CommonFG { public: - // Opens a generic named datatype in this location. - DataType openDataType(const char* name) const; - DataType openDataType(const H5std_string& name) const; + // Opens a generic named datatype in this location. + DataType openDataType(const char* name) const; + DataType openDataType(const H5std_string& name) const; - // Opens a named array datatype in this location. - ArrayType openArrayType(const char* name) const; - ArrayType openArrayType(const H5std_string& name) const; + // Opens a named array datatype in this location. + ArrayType openArrayType(const char* name) const; + ArrayType openArrayType(const H5std_string& name) const; - // Opens a named compound datatype in this location. - CompType openCompType(const char* name) const; - CompType openCompType(const H5std_string& name) const; + // Opens a named compound datatype in this location. + CompType openCompType(const char* name) const; + CompType openCompType(const H5std_string& name) const; - // Opens a named enumeration datatype in this location. - EnumType openEnumType(const char* name) const; - EnumType openEnumType(const H5std_string& name) const; + // Opens a named enumeration datatype in this location. + EnumType openEnumType(const char* name) const; + EnumType openEnumType(const H5std_string& name) const; - // Opens a named integer datatype in this location. - IntType openIntType(const char* name) const; - IntType openIntType(const H5std_string& name) const; + // Opens a named integer datatype in this location. + IntType openIntType(const char* name) const; + IntType openIntType(const H5std_string& name) const; - // Opens a named floating-point datatype in this location. - FloatType openFloatType(const char* name) const; - FloatType openFloatType(const H5std_string& name) const; + // Opens a named floating-point datatype in this location. + FloatType openFloatType(const char* name) const; + FloatType openFloatType(const H5std_string& name) const; - // Opens a named string datatype in this location. - StrType openStrType(const char* name) const; - StrType openStrType(const H5std_string& name) const; + // Opens a named string datatype in this location. + StrType openStrType(const char* name) const; + StrType openStrType(const H5std_string& name) const; - // Opens a named variable length datatype in this location. - VarLenType openVarLenType(const char* name) const; - VarLenType openVarLenType(const H5std_string& name) const; + // Opens a named variable length datatype in this location. + VarLenType openVarLenType(const char* name) const; + VarLenType openVarLenType(const H5std_string& name) const; #ifndef DOXYGEN_SHOULD_SKIP_THIS - /// For subclasses, H5File and Group, to return the correct - /// object id, i.e. file or group id. - virtual hid_t getLocId() const = 0; + /// For subclasses, H5File and Group, to return the correct + /// object id, i.e. file or group id. + virtual hid_t getLocId() const = 0; - /// For subclasses, H5File and Group, to throw appropriate exception. - virtual void throwException(const H5std_string& func_name, const H5std_string& msg) const = 0; + /// For subclasses, H5File and Group, to throw appropriate exception. + virtual void throwException(const H5std_string& func_name, const H5std_string& msg) const = 0; - // Default constructor. - CommonFG(); + // Default constructor. + CommonFG(); - // Noop destructor. - virtual ~CommonFG(); + // Noop destructor. + virtual ~CommonFG(); protected: - virtual void p_setId(const hid_t new_id) = 0; + virtual void p_setId(const hid_t new_id) = 0; #endif // DOXYGEN_SHOULD_SKIP_THIS diff --git a/c++/src/H5CompType.cpp b/c++/src/H5CompType.cpp index babda34..037527f 100644 --- a/c++/src/H5CompType.cpp +++ b/c++/src/H5CompType.cpp @@ -33,203 +33,203 @@ namespace H5 { //-------------------------------------------------------------------------- -// Function: CompType default constructor -///\brief Default constructor: Creates a stub compound datatype -// Programmer Binh-Minh Ribler - 2000 +// Function: CompType default constructor +///\brief Default constructor: Creates a stub compound datatype +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- CompType::CompType() : DataType() {} //-------------------------------------------------------------------------- -// Function: CompType copy constructor -///\brief Copy constructor: makes copy of the original CompType object -///\param original - IN: Original CompType instance -// Programmer Binh-Minh Ribler - 2000 +// Function: CompType copy constructor +///\brief Copy constructor: makes copy of the original CompType object +///\param original - IN: Original CompType instance +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -CompType::CompType( const CompType& original ) : DataType( original ) {} +CompType::CompType(const CompType& original) : DataType(original) {} //-------------------------------------------------------------------------- -// Function: CompType overloaded constructor -///\brief Creates a CompType object using the id of an existing datatype. -///\param existing_id - IN: Id of an existing compound datatype -// Programmer Binh-Minh Ribler - 2000 +// Function: CompType overloaded constructor +///\brief Creates a CompType object using the id of an existing datatype. +///\param existing_id - IN: Id of an existing compound datatype +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -CompType::CompType( const hid_t existing_id ) : DataType( existing_id ) {} +CompType::CompType(const hid_t existing_id) : DataType(existing_id) {} //-------------------------------------------------------------------------- -// Function: CompType overloaded constructor -///\brief Creates an empty compound datatype given a size, in bytes. -///\param size - IN: Number of bytes in the datatype to create -///\exception H5::DataTypeIException +// Function: CompType overloaded constructor +///\brief Creates an empty compound datatype given a size, in bytes. +///\param size - IN: Number of bytes in the datatype to create +///\exception H5::DataTypeIException // Description -// The DataType constructor calls the C API H5Tcreate to create -// the compound datatype. -// Programmer Binh-Minh Ribler - 2000 +// The DataType constructor calls the C API H5Tcreate to create +// the compound datatype. +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -CompType::CompType( size_t size ) : DataType( H5T_COMPOUND, size ) {} +CompType::CompType(size_t size) : DataType(H5T_COMPOUND, size) {} //-------------------------------------------------------------------------- -// Function: CompType overloaded constructor -///\brief Gets the compound datatype of the specified dataset. -///\param dataset - IN: Dataset that this enum datatype associates with -///\return CompType instance -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 +// Function: CompType overloaded constructor +///\brief Gets the compound datatype of the specified dataset. +///\param dataset - IN: Dataset that this enum datatype associates with +///\return CompType instance +///\exception H5::DataTypeIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -CompType::CompType( const DataSet& dataset ) : DataType() +CompType::CompType(const DataSet& dataset) : DataType() { - // Calls C function H5Dget_type to get the id of the datatype - id = H5Dget_type( dataset.getId() ); - - // If the datatype id is invalid, throw exception - if( id < 0 ) - { - throw DataSetIException("CompType constructor", "H5Dget_type failed"); - } + // Calls C function H5Dget_type to get the id of the datatype + id = H5Dget_type(dataset.getId()); + + // If the datatype id is invalid, throw exception + if (id < 0) + { + throw DataSetIException("CompType constructor", "H5Dget_type failed"); + } } //-------------------------------------------------------------------------- -// Function: CompType overloaded constructor -///\brief Creates an CompType instance by opening an HDF5 compound -/// given its name, provided as a C character string. -///\param dtype_name - IN: Compound type name -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - Dec 2016 +// Function: CompType overloaded constructor +///\brief Creates an CompType instance by opening an HDF5 compound +/// given its name, provided as a C character string. +///\param dtype_name - IN: Compound type name +///\exception H5::DataTypeIException +// Programmer Binh-Minh Ribler - Dec 2016 // Description -// In 1.10.1, this constructor was introduced and will replace the -// existing function CommonFG::openCompType(const char*) to -// improve usability. -// -BMR, Dec 2016 +// In 1.10.1, this constructor was introduced and will replace the +// existing function CommonFG::openCompType(const char*) to +// improve usability. +// -BMR, Dec 2016 //-------------------------------------------------------------------------- CompType::CompType(const H5Location& loc, const char *dtype_name) : DataType() { - id = p_opentype(loc, dtype_name); + id = p_opentype(loc, dtype_name); } //-------------------------------------------------------------------------- -// Function: CompType overloaded constructor -///\brief Creates an CompType instance by opening an HDF5 compound -/// datatype given its name, provided as an \c H5std_string. -///\param dtype_name - IN: Compound type name -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - Dec 2016 +// Function: CompType overloaded constructor +///\brief Creates an CompType instance by opening an HDF5 compound +/// datatype given its name, provided as an \c H5std_string. +///\param dtype_name - IN: Compound type name +///\exception H5::DataTypeIException +// Programmer Binh-Minh Ribler - Dec 2016 // Description -// In 1.10.1, this constructor was introduced and will replace the -// existing function CommonFG::openCompType(const H5Location&) -// to improve usability. -// -BMR, Dec 2016 +// In 1.10.1, this constructor was introduced and will replace the +// existing function CommonFG::openCompType(const H5Location&) +// to improve usability. +// -BMR, Dec 2016 //-------------------------------------------------------------------------- CompType::CompType(const H5Location& loc, const H5std_string& dtype_name) : DataType() { - id = p_opentype(loc, dtype_name.c_str()); + id = p_opentype(loc, dtype_name.c_str()); } //-------------------------------------------------------------------------- -// Function: CompType::getNmembers -///\brief Returns the number of members in this compound datatype. -///\return Number of members -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 +// Function: CompType::getNmembers +///\brief Returns the number of members in this compound datatype. +///\return Number of members +///\exception H5::DataTypeIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- int CompType::getNmembers() const { - int num_members = H5Tget_nmembers( id ); - if( num_members < 0 ) - { - throw DataTypeIException("CompType::getNmembers", - "H5Tget_nmembers returns negative number of members"); - } - return( num_members ); + int num_members = H5Tget_nmembers(id); + if (num_members < 0) + { + throw DataTypeIException("CompType::getNmembers", + "H5Tget_nmembers returns negative number of members"); + } + return(num_members); } //-------------------------------------------------------------------------- -// Function: CompType::getMemberName -///\brief Returns the name of a member in this compound datatype. -///\param member_num - IN: Zero-based index of the member -///\return Name of member -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 +// Function: CompType::getMemberName +///\brief Returns the name of a member in this compound datatype. +///\param member_num - IN: Zero-based index of the member +///\return Name of member +///\exception H5::DataTypeIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -H5std_string CompType::getMemberName( unsigned member_num ) const +H5std_string CompType::getMemberName(unsigned member_num) const { - char* member_name_C = H5Tget_member_name( id, member_num ); - if( member_name_C == NULL ) // NULL means failure + char* member_name_C = H5Tget_member_name(id, member_num); + if (member_name_C == NULL) // NULL means failure { - throw DataTypeIException("CompType::getMemberName", - "H5Tget_member_name returns NULL for member name"); + throw DataTypeIException("CompType::getMemberName", + "H5Tget_member_name returns NULL for member name"); } H5std_string member_name = H5std_string(member_name_C); // convert C string to string H5free_memory(member_name_C); // free the C string - return( member_name ); // return the member name string + return(member_name); // return the member name string } //-------------------------------------------------------------------------- -// Function: CompType::getMemberIndex -///\brief Returns the index of a member in this compound datatype. -///\param name - IN: Name of the member -///\return Index of member -///\exception H5::DataTypeIException +// Function: CompType::getMemberIndex +///\brief Returns the index of a member in this compound datatype. +///\param name - IN: Name of the member +///\return Index of member +///\exception H5::DataTypeIException ///\par Description -/// Members are stored in no particular order with numbers 0 -/// through N-1, where N is the value returned by the member -/// function \c CompType::getNmembers. -// Programmer Binh-Minh Ribler - May 16, 2002 +/// Members are stored in no particular order with numbers 0 +/// through N-1, where N is the value returned by the member +/// function \c CompType::getNmembers. +// Programmer Binh-Minh Ribler - May 16, 2002 //-------------------------------------------------------------------------- int CompType::getMemberIndex(const char* name) const { - int member_index = H5Tget_member_index(id, name); - if( member_index < 0 ) - { - throw DataTypeIException("CompType::getMemberIndex", - "H5Tget_member_index returns negative value"); - } - return( member_index ); + int member_index = H5Tget_member_index(id, name); + if (member_index < 0) + { + throw DataTypeIException("CompType::getMemberIndex", + "H5Tget_member_index returns negative value"); + } + return(member_index); } int CompType::getMemberIndex(const H5std_string& name) const { - return(getMemberIndex(name.c_str())); + return(getMemberIndex(name.c_str())); } //-------------------------------------------------------------------------- -// Function: CompType::getMemberOffset -///\brief Returns the byte offset of the beginning of a member with -/// respect to the beginning of the compound data type datum. -///\param member_num - IN: Zero-based index of the member -///\return Byte offset -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 +// Function: CompType::getMemberOffset +///\brief Returns the byte offset of the beginning of a member with +/// respect to the beginning of the compound data type datum. +///\param member_num - IN: Zero-based index of the member +///\return Byte offset +///\exception H5::DataTypeIException +// Programmer Binh-Minh Ribler - 2000 // Description -/// Members are stored in no particular order with numbers 0 -/// through N-1, where N is the value returned by the member -/// function \c CompType::getNmembers. +/// Members are stored in no particular order with numbers 0 +/// through N-1, where N is the value returned by the member +/// function \c CompType::getNmembers. // -// Note that byte offset being returned as 0 doesn't indicate -// a failure. (According to Quincey) +// Note that byte offset being returned as 0 doesn't indicate +// a failure. (According to Quincey) //-------------------------------------------------------------------------- -size_t CompType::getMemberOffset( unsigned member_num ) const +size_t CompType::getMemberOffset(unsigned member_num) const { - size_t offset = H5Tget_member_offset( id, member_num ); - return( offset ); + size_t offset = H5Tget_member_offset(id, member_num); + return(offset); } //-------------------------------------------------------------------------- -// Function: CompType::getMemberClass -///\brief Gets the type class of the specified member. -///\param member_num - IN: Zero-based index of the member -///\return Type class of the member -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 +// Function: CompType::getMemberClass +///\brief Gets the type class of the specified member. +///\param member_num - IN: Zero-based index of the member +///\return Type class of the member +///\exception H5::DataTypeIException +// Programmer Binh-Minh Ribler - 2000 // Modification -// Modified to use H5Tget_member_class instead. - Jul, 2005 +// Modified to use H5Tget_member_class instead. - Jul, 2005 //-------------------------------------------------------------------------- -H5T_class_t CompType::getMemberClass( unsigned member_num ) const +H5T_class_t CompType::getMemberClass(unsigned member_num) const { - H5T_class_t member_class = H5Tget_member_class(id, member_num); - if( member_class == H5T_NO_CLASS ) - { - throw DataTypeIException("CompType::getMemberClass", - "H5Tget_member_class returns H5T_NO_CLASS"); - } - return(member_class); + H5T_class_t member_class = H5Tget_member_class(id, member_num); + if (member_class == H5T_NO_CLASS) + { + throw DataTypeIException("CompType::getMemberClass", + "H5Tget_member_class returns H5T_NO_CLASS"); + } + return(member_class); } // This private member function calls the C API to get the identifier @@ -238,184 +238,184 @@ H5T_class_t CompType::getMemberClass( unsigned member_num ) const // the sub-types. hid_t CompType::p_get_member_type(unsigned member_num) const { - // get the id of the specified member first - hid_t member_type_id = H5Tget_member_type( id, member_num ); - if( member_type_id > 0 ) - return( member_type_id ); - else - { - // p_get_member_type is private, caller will catch this exception - // then throw another with appropriate API name - throw DataTypeIException("", "H5Tget_member_type failed"); - } + // get the id of the specified member first + hid_t member_type_id = H5Tget_member_type(id, member_num); + if (member_type_id > 0) + return(member_type_id); + else + { + // p_get_member_type is private, caller will catch this exception + // then throw another with appropriate API name + throw DataTypeIException("", "H5Tget_member_type failed"); + } } //-------------------------------------------------------------------------- -// Function: CompType::getMemberDataType -///\brief Returns the generic datatype of the specified member in this -/// compound datatype. -///\param member_num - IN: Zero-based index of the member -///\return DataType instance -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 +// Function: CompType::getMemberDataType +///\brief Returns the generic datatype of the specified member in this +/// compound datatype. +///\param member_num - IN: Zero-based index of the member +///\return DataType instance +///\exception H5::DataTypeIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -DataType CompType::getMemberDataType( unsigned member_num ) const +DataType CompType::getMemberDataType(unsigned member_num) const { - try { - DataType datatype; - f_DataType_setId(&datatype, p_get_member_type(member_num)); - return(datatype); - } - catch (DataTypeIException& E) { - throw DataTypeIException("CompType::getMemberDataType", E.getDetailMsg()); - } + try { + DataType datatype; + f_DataType_setId(&datatype, p_get_member_type(member_num)); + return(datatype); + } + catch (DataTypeIException& E) { + throw DataTypeIException("CompType::getMemberDataType", E.getDetailMsg()); + } } //-------------------------------------------------------------------------- -// Function: CompType::getMemberArrayType -///\brief Returns the array datatype of the specified member in this -/// compound datatype. -///\param member_num - IN: Zero-based index of the member -///\return ArrayType instance -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - Jul, 2005 +// Function: CompType::getMemberArrayType +///\brief Returns the array datatype of the specified member in this +/// compound datatype. +///\param member_num - IN: Zero-based index of the member +///\return ArrayType instance +///\exception H5::DataTypeIException +// Programmer Binh-Minh Ribler - Jul, 2005 //-------------------------------------------------------------------------- -ArrayType CompType::getMemberArrayType( unsigned member_num ) const +ArrayType CompType::getMemberArrayType(unsigned member_num) const { - try { - ArrayType arraytype(p_get_member_type(member_num)); - f_DataType_setId(&arraytype, p_get_member_type(member_num)); - return(arraytype); - } - catch (DataTypeIException& E) { - throw DataTypeIException("CompType::getMemberArrayType", E.getDetailMsg()); - } + try { + ArrayType arraytype(p_get_member_type(member_num)); + f_DataType_setId(&arraytype, p_get_member_type(member_num)); + return(arraytype); + } + catch (DataTypeIException& E) { + throw DataTypeIException("CompType::getMemberArrayType", E.getDetailMsg()); + } } //-------------------------------------------------------------------------- -// Function: CompType::getMemberCompType -///\brief Returns the compound datatype of the specified member in this -/// compound datatype. -///\param member_num - IN: Zero-based index of the member -///\return CompType instance -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 +// Function: CompType::getMemberCompType +///\brief Returns the compound datatype of the specified member in this +/// compound datatype. +///\param member_num - IN: Zero-based index of the member +///\return CompType instance +///\exception H5::DataTypeIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -CompType CompType::getMemberCompType( unsigned member_num ) const +CompType CompType::getMemberCompType(unsigned member_num) const { try { CompType comptype(p_get_member_type(member_num)); - f_DataType_setId(&comptype, p_get_member_type(member_num)); + f_DataType_setId(&comptype, p_get_member_type(member_num)); return(comptype); - } - catch (DataTypeIException& E) { - throw DataTypeIException("CompType::getMemberCompType", E.getDetailMsg()); - } + } + catch (DataTypeIException& E) { + throw DataTypeIException("CompType::getMemberCompType", E.getDetailMsg()); + } } //-------------------------------------------------------------------------- -// Function: CompType::getMemberEnumType -///\brief Returns the enumeration datatype of the specified member in -/// this compound datatype. -///\param member_num - IN: Zero-based index of the member -///\return EnumType instance -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 +// Function: CompType::getMemberEnumType +///\brief Returns the enumeration datatype of the specified member in +/// this compound datatype. +///\param member_num - IN: Zero-based index of the member +///\return EnumType instance +///\exception H5::DataTypeIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -EnumType CompType::getMemberEnumType( unsigned member_num ) const +EnumType CompType::getMemberEnumType(unsigned member_num) const { try { EnumType enumtype(p_get_member_type(member_num)); - f_DataType_setId(&enumtype, p_get_member_type(member_num)); + f_DataType_setId(&enumtype, p_get_member_type(member_num)); return(enumtype); - } - catch (DataTypeIException& E) { - throw DataTypeIException("CompType::getMemberEnumType", E.getDetailMsg()); - } + } + catch (DataTypeIException& E) { + throw DataTypeIException("CompType::getMemberEnumType", E.getDetailMsg()); + } } //-------------------------------------------------------------------------- -// Function: CompType::getMemberIntType -///\brief Returns the integer datatype of the specified member in this -/// compound datatype. -///\param member_num - IN: Zero-based index of the member -///\return IntType instance -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 +// Function: CompType::getMemberIntType +///\brief Returns the integer datatype of the specified member in this +/// compound datatype. +///\param member_num - IN: Zero-based index of the member +///\return IntType instance +///\exception H5::DataTypeIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -IntType CompType::getMemberIntType( unsigned member_num ) const +IntType CompType::getMemberIntType(unsigned member_num) const { try { IntType inttype(p_get_member_type(member_num)); - f_DataType_setId(&inttype, p_get_member_type(member_num)); + f_DataType_setId(&inttype, p_get_member_type(member_num)); return(inttype); - } - catch (DataTypeIException& E) { - throw DataTypeIException("CompType::getMemberIntType", E.getDetailMsg()); - } + } + catch (DataTypeIException& E) { + throw DataTypeIException("CompType::getMemberIntType", E.getDetailMsg()); + } } //-------------------------------------------------------------------------- -// Function: CompType::getMemberFloatType -///\brief Returns the floating-point datatype of the specified member -/// in this compound datatype. -///\param member_num - IN: Zero-based index of the member -///\return FloatType instance -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 +// Function: CompType::getMemberFloatType +///\brief Returns the floating-point datatype of the specified member +/// in this compound datatype. +///\param member_num - IN: Zero-based index of the member +///\return FloatType instance +///\exception H5::DataTypeIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -FloatType CompType::getMemberFloatType( unsigned member_num ) const +FloatType CompType::getMemberFloatType(unsigned member_num) const { try { FloatType floatype(p_get_member_type(member_num)); - f_DataType_setId(&floatype, p_get_member_type(member_num)); + f_DataType_setId(&floatype, p_get_member_type(member_num)); return(floatype); - } - catch (DataTypeIException& E) { - throw DataTypeIException("CompType::getMemberFloatType", E.getDetailMsg()); - } + } + catch (DataTypeIException& E) { + throw DataTypeIException("CompType::getMemberFloatType", E.getDetailMsg()); + } } //-------------------------------------------------------------------------- -// Function: CompType::getMemberStrType -///\brief Returns the string datatype of the specified member in this -/// compound datatype. -///\param member_num - IN: Zero-based index of the member -///\return StrType instance -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 +// Function: CompType::getMemberStrType +///\brief Returns the string datatype of the specified member in this +/// compound datatype. +///\param member_num - IN: Zero-based index of the member +///\return StrType instance +///\exception H5::DataTypeIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -StrType CompType::getMemberStrType( unsigned member_num ) const +StrType CompType::getMemberStrType(unsigned member_num) const { try { StrType strtype(p_get_member_type(member_num)); - f_DataType_setId(&strtype, p_get_member_type(member_num)); + f_DataType_setId(&strtype, p_get_member_type(member_num)); return(strtype); - } - catch (DataTypeIException& E) { - throw DataTypeIException("CompType::getMemberStrType", E.getDetailMsg()); - } + } + catch (DataTypeIException& E) { + throw DataTypeIException("CompType::getMemberStrType", E.getDetailMsg()); + } } //-------------------------------------------------------------------------- -// Function: CompType::getMemberVarLenType -///\brief Returns the variable length datatype of the specified member -/// in this compound datatype. -///\param member_num - IN: Zero-based index of the member -///\return VarLenType instance -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - Jul, 2005 +// Function: CompType::getMemberVarLenType +///\brief Returns the variable length datatype of the specified member +/// in this compound datatype. +///\param member_num - IN: Zero-based index of the member +///\return VarLenType instance +///\exception H5::DataTypeIException +// Programmer Binh-Minh Ribler - Jul, 2005 //-------------------------------------------------------------------------- -VarLenType CompType::getMemberVarLenType( unsigned member_num ) const +VarLenType CompType::getMemberVarLenType(unsigned member_num) const { try { VarLenType varlentype(p_get_member_type(member_num)); - f_DataType_setId(&varlentype, p_get_member_type(member_num)); + f_DataType_setId(&varlentype, p_get_member_type(member_num)); return(varlentype); - } - catch (DataTypeIException& E) { - throw DataTypeIException("CompType::getMemberVarLenType", E.getDetailMsg()); - } + } + catch (DataTypeIException& E) { + throw DataTypeIException("CompType::getMemberVarLenType", E.getDetailMsg()); + } } /* old style of getMemberType - using overloads; new style above @@ -424,27 +424,27 @@ VarLenType CompType::getMemberVarLenType( unsigned member_num ) const May, 2004: These should be reconsidered to provide more convenience. // Returns the datatype of the specified member in this compound datatype. // Several overloading of getMemberType are for different datatypes -void CompType::getMemberType( unsigned member_num, EnumType& enumtype ) const +void CompType::getMemberType(unsigned member_num, EnumType& enumtype) const { p_get_member_type(member_num, enumtype); } -void CompType::getMemberType( unsigned member_num, CompType& comptype ) const +void CompType::getMemberType(unsigned member_num, CompType& comptype) const { p_get_member_type(member_num, comptype); } -void CompType::getMemberType( unsigned member_num, IntType& inttype ) const +void CompType::getMemberType(unsigned member_num, IntType& inttype) const { p_get_member_type(member_num, inttype); } -void CompType::getMemberType( unsigned member_num, FloatType& floatype ) const +void CompType::getMemberType(unsigned member_num, FloatType& floatype) const { p_get_member_type(member_num, floatype); } -void CompType::getMemberType( unsigned member_num, StrType& strtype ) const +void CompType::getMemberType(unsigned member_num, StrType& strtype) const { p_get_member_type(member_num, strtype); } @@ -452,55 +452,55 @@ void CompType::getMemberType( unsigned member_num, StrType& strtype ) const */ //-------------------------------------------------------------------------- -// Function: CompType::insertMember -///\brief Inserts a new member to this compound datatype. -///\param name - IN: Name of the new member -///\param offset - IN: Offset in memory structure of the field to insert -///\param new_member - IN: New member to be inserted -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 +// Function: CompType::insertMember +///\brief Inserts a new member to this compound datatype. +///\param name - IN: Name of the new member +///\param offset - IN: Offset in memory structure of the field to insert +///\param new_member - IN: New member to be inserted +///\exception H5::DataTypeIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -void CompType::insertMember( const H5std_string& name, size_t offset, const DataType& new_member ) const +void CompType::insertMember(const H5std_string& name, size_t offset, const DataType& new_member) const { - // Convert string to C-string - const char* name_C; - name_C = name.c_str(); // name_C refers to the contents of name as a C-str - - hid_t new_member_id = new_member.getId(); // get new_member id for C API - - // Call C routine H5Tinsert to add the new member - herr_t ret_value = H5Tinsert( id, name_C, offset, new_member_id ); - if( ret_value < 0 ) - { - throw DataTypeIException("CompType::insertMember", "H5Tinsert failed"); - } + // Convert string to C-string + const char* name_C; + name_C = name.c_str(); // name_C refers to the contents of name as a C-str + + hid_t new_member_id = new_member.getId(); // get new_member id for C API + + // Call C routine H5Tinsert to add the new member + herr_t ret_value = H5Tinsert(id, name_C, offset, new_member_id); + if (ret_value < 0) + { + throw DataTypeIException("CompType::insertMember", "H5Tinsert failed"); + } } //-------------------------------------------------------------------------- -// Function: CompType::pack -///\brief Recursively removes padding from within a compound datatype. +// Function: CompType::pack +///\brief Recursively removes padding from within a compound datatype. /// -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 +///\exception H5::DataTypeIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void CompType::pack() const { - // Calls C routine H5Tpack to remove padding - herr_t ret_value = H5Tpack( id ); - if( ret_value < 0 ) - { - throw DataTypeIException("CompType::pack", "H5Tpack failed"); - } + // Calls C routine H5Tpack to remove padding + herr_t ret_value = H5Tpack(id); + if (ret_value < 0) + { + throw DataTypeIException("CompType::pack", "H5Tpack failed"); + } } //-------------------------------------------------------------------------- -// Function: CompType::setSize -///\brief Sets the total size for this compound datatype. -///\param size - IN: Size to set -///\exception H5::DataTypeIException +// Function: CompType::setSize +///\brief Sets the total size for this compound datatype. +///\param size - IN: Size to set +///\exception H5::DataTypeIException // Note -// H5Tset_size works on atom datatypes and compound datatypes only -// Programmer Binh-Minh Ribler - 2014 +// H5Tset_size works on atom datatypes and compound datatypes only +// Programmer Binh-Minh Ribler - 2014 //-------------------------------------------------------------------------- void CompType::setSize(size_t size) const { @@ -508,7 +508,7 @@ void CompType::setSize(size_t size) const herr_t ret_value = H5Tset_size(id, size); if (ret_value < 0) { - throw DataTypeIException("CompType::setSize", "H5Tset_size failed"); + throw DataTypeIException("CompType::setSize", "H5Tset_size failed"); } } diff --git a/c++/src/H5CompType.h b/c++/src/H5CompType.h index 3337df7..222044d 100644 --- a/c++/src/H5CompType.h +++ b/c++/src/H5CompType.h @@ -27,94 +27,94 @@ namespace H5 { */ class H5_DLLCPP CompType : public DataType { public: - // Default constructor - CompType(); + // Default constructor + CompType(); - // Creates a compound datatype using an existing id - CompType( const hid_t existing_id ); + // Creates a compound datatype using an existing id + CompType(const hid_t existing_id); - // Creates a new compound datatype, given the type's size - CompType( size_t size ); // H5Tcreate + // Creates a new compound datatype, given the type's size + CompType(size_t size); // H5Tcreate - // Gets the compound datatype of the specified dataset - CompType( const DataSet& dataset ); // H5Dget_type + // Gets the compound datatype of the specified dataset + CompType(const DataSet& dataset); // H5Dget_type - // Copy constructor - makes a copy of original object - CompType( const CompType& original ); + // Copy constructor - makes a copy of original object + CompType(const CompType& original); - // Constructors that open a compound datatype, given a location. - CompType(const H5Location& loc, const char* name); - CompType(const H5Location& loc, const H5std_string& name); + // Constructors that open a compound datatype, given a location. + CompType(const H5Location& loc, const char* name); + CompType(const H5Location& loc, const H5std_string& name); - // Returns the type class of the specified member of this compound - // datatype. It provides to the user a way of knowing what type - // to create another datatype of the same class - H5T_class_t getMemberClass( unsigned member_num ) const; + // Returns the type class of the specified member of this compound + // datatype. It provides to the user a way of knowing what type + // to create another datatype of the same class + H5T_class_t getMemberClass(unsigned member_num) const; - // Returns the index of a member in this compound data type. - int getMemberIndex(const char* name) const; - int getMemberIndex(const H5std_string& name) const; + // Returns the index of a member in this compound data type. + int getMemberIndex(const char* name) const; + int getMemberIndex(const H5std_string& name) const; - // Returns the offset of a member of this compound datatype. - size_t getMemberOffset( unsigned memb_no ) const; + // Returns the offset of a member of this compound datatype. + size_t getMemberOffset(unsigned memb_no) const; - // Returns the name of a member of this compound datatype. - H5std_string getMemberName( unsigned member_num ) const; + // Returns the name of a member of this compound datatype. + H5std_string getMemberName(unsigned member_num) const; - // Returns the generic datatype of the specified member in - // this compound datatype. - DataType getMemberDataType( unsigned member_num ) const; + // Returns the generic datatype of the specified member in + // this compound datatype. + DataType getMemberDataType(unsigned member_num) const; - // Returns the array datatype of the specified member in - // this compound datatype. - ArrayType getMemberArrayType( unsigned member_num ) const; + // Returns the array datatype of the specified member in + // this compound datatype. + ArrayType getMemberArrayType(unsigned member_num) const; - // Returns the compound datatype of the specified member in - // this compound datatype. - CompType getMemberCompType( unsigned member_num ) const; + // Returns the compound datatype of the specified member in + // this compound datatype. + CompType getMemberCompType(unsigned member_num) const; - // Returns the enumeration datatype of the specified member in - // this compound datatype. - EnumType getMemberEnumType( unsigned member_num ) const; + // Returns the enumeration datatype of the specified member in + // this compound datatype. + EnumType getMemberEnumType(unsigned member_num) const; - // Returns the integer datatype of the specified member in - // this compound datatype. - IntType getMemberIntType( unsigned member_num ) const; + // Returns the integer datatype of the specified member in + // this compound datatype. + IntType getMemberIntType(unsigned member_num) const; - // Returns the floating-point datatype of the specified member in - // this compound datatype. - FloatType getMemberFloatType( unsigned member_num ) const; + // Returns the floating-point datatype of the specified member in + // this compound datatype. + FloatType getMemberFloatType(unsigned member_num) const; - // Returns the string datatype of the specified member in - // this compound datatype. - StrType getMemberStrType( unsigned member_num ) const; + // Returns the string datatype of the specified member in + // this compound datatype. + StrType getMemberStrType(unsigned member_num) const; - // Returns the variable length datatype of the specified member in - // this compound datatype. - VarLenType getMemberVarLenType( unsigned member_num ) const; + // Returns the variable length datatype of the specified member in + // this compound datatype. + VarLenType getMemberVarLenType(unsigned member_num) const; - // Returns the number of members in this compound datatype. - int getNmembers() const; + // Returns the number of members in this compound datatype. + int getNmembers() const; - // Adds a new member to this compound datatype. - void insertMember( const H5std_string& name, size_t offset, const DataType& new_member ) const; + // Adds a new member to this compound datatype. + void insertMember(const H5std_string& name, size_t offset, const DataType& new_member) const; - // Recursively removes padding from within this compound datatype. - void pack() const; + // Recursively removes padding from within this compound datatype. + void pack() const; - // Sets the total size for this compound datatype. - void setSize(size_t size) const; + // Sets the total size for this compound datatype. + void setSize(size_t size) const; - ///\brief Returns this class name. - virtual H5std_string fromClass () const { return("CompType"); } + ///\brief Returns this class name. + virtual H5std_string fromClass () const { return("CompType"); } - // Noop destructor. - virtual ~CompType(); + // Noop destructor. + virtual ~CompType(); private: - // Contains common code that is used by the member functions - // getMemberXxxType - hid_t p_get_member_type(unsigned member_num) const; + // Contains common code that is used by the member functions + // getMemberXxxType + hid_t p_get_member_type(unsigned member_num) const; }; } #endif // __H5CompType_H diff --git a/c++/src/H5CppDoc.h b/c++/src/H5CppDoc.h index 2420586..afc6ebf 100644 --- a/c++/src/H5CppDoc.h +++ b/c++/src/H5CppDoc.h @@ -67,34 +67,34 @@ *
*/ -/// This example shows how to create datasets. +/// This example shows how to create datasets. ///\par ///\example create.cpp ///\par -/// This example shows how to write datasets. +/// This example shows how to write datasets. ///\example writedata.cpp ///\par -/// This example shows how to read datasets. +/// This example shows how to read datasets. ///\example readdata.cpp ///\par -/// This example shows how to create a compound datatype, -/// write an array which has the compound datatype to the file, -/// and read back fields' subsets. +/// This example shows how to create a compound datatype, +/// write an array which has the compound datatype to the file, +/// and read back fields' subsets. ///\example compound.cpp ///\par -/// This example shows how to work with extendible datasets. +/// This example shows how to work with extendible datasets. ///\example extend_ds.cpp ///\par -/// This example shows how to read data from a chunked dataset. +/// This example shows how to read data from a chunked dataset. ///\example chunks.cpp ///\par -/// This example shows how to work with groups. +/// This example shows how to work with groups. ///\example h5group.cpp #endif // __H5CppDoc_H diff --git a/c++/src/H5DataSet.cpp b/c++/src/H5DataSet.cpp index 7c5b994..a0db328 100644 --- a/c++/src/H5DataSet.cpp +++ b/c++/src/H5DataSet.cpp @@ -20,7 +20,7 @@ #endif #include -#include "H5private.h" // for HDfree +#include "H5private.h" // for HDfree #include "H5Include.h" #include "H5Exception.h" #include "H5IdComponent.h" @@ -44,23 +44,23 @@ using std::cerr; using std::endl; //-------------------------------------------------------------------------- -// Function: DataSet default constructor -///\brief Default constructor: creates a stub DataSet. -// Programmer Binh-Minh Ribler - 2000 +// Function: DataSet default constructor +///\brief Default constructor: creates a stub DataSet. +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- DataSet::DataSet() : H5Object(), AbstractDs(), id(H5I_INVALID_HID) {} //-------------------------------------------------------------------------- -// Function: DataSet overloaded constructor -///\brief Creates an DataSet object using the id of an existing dataset. -///\param existing_id - IN: Id of an existing dataset -// Programmer Binh-Minh Ribler - 2000 +// Function: DataSet overloaded constructor +///\brief Creates an DataSet object using the id of an existing dataset. +///\param existing_id - IN: Id of an existing dataset +// Programmer Binh-Minh Ribler - 2000 // Description -// incRefCount() is needed here to prevent the id from being closed -// prematurely. That is, when application uses the id of an -// existing DataSet object to create another DataSet object. So, -// when one of those objects is deleted, the id will be closed if -// the reference counter is only 1. +// incRefCount() is needed here to prevent the id from being closed +// prematurely. That is, when application uses the id of an +// existing DataSet object to create another DataSet object. So, +// when one of those objects is deleted, the id will be closed if +// the reference counter is only 1. //-------------------------------------------------------------------------- DataSet::DataSet(const hid_t existing_id) : H5Object(), AbstractDs(), id(existing_id) { @@ -68,10 +68,10 @@ DataSet::DataSet(const hid_t existing_id) : H5Object(), AbstractDs(), id(existin } //-------------------------------------------------------------------------- -// Function: DataSet copy constructor -///\brief Copy constructor: makes a copy of the original DataSet object. -///\param original - IN: DataSet instance to copy -// Programmer Binh-Minh Ribler - 2000 +// Function: DataSet copy constructor +///\brief Copy constructor: makes a copy of the original DataSet object. +///\param original - IN: DataSet instance to copy +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- DataSet::DataSet(const DataSet& original) : H5Object(), AbstractDs(), id(original.id) { @@ -79,22 +79,22 @@ DataSet::DataSet(const DataSet& original) : H5Object(), AbstractDs(), id(origina } //-------------------------------------------------------------------------- -// Function: DataSet overload constructor - dereference -///\brief Given a reference, ref, to an hdf5 location, creates a -/// DataSet object -///\param loc - IN: Dataset reference object is in or location of -/// object that the dataset is located within. -///\param ref - IN: Reference pointer -///\param ref_type - IN: Reference type - default to H5R_OBJECT -///\param plist - IN: Property list - default to PropList::DEFAULT -///\exception H5::DataSetIException +// Function: DataSet overload constructor - dereference +///\brief Given a reference, ref, to an hdf5 location, creates a +/// DataSet object +///\param loc - IN: Dataset reference object is in or location of +/// object that the dataset is located within. +///\param ref - IN: Reference pointer +///\param ref_type - IN: Reference type - default to H5R_OBJECT +///\param plist - IN: Property list - default to PropList::DEFAULT +///\exception H5::DataSetIException ///\par Description -/// \c loc can be DataSet, Group, H5File, or named DataType, that -/// is a datatype that has been named by DataType::commit. -// Programmer Binh-Minh Ribler - Oct, 2006 +/// \c loc can be DataSet, Group, H5File, or named DataType, that +/// is a datatype that has been named by DataType::commit. +// Programmer Binh-Minh Ribler - Oct, 2006 // Modification -// Jul, 2008 -// Added for application convenience. +// Jul, 2008 +// Added for application convenience. //-------------------------------------------------------------------------- DataSet::DataSet(const H5Location& loc, const void* ref, H5R_type_t ref_type, const PropList& plist) : H5Object(), AbstractDs(), id(H5I_INVALID_HID) { @@ -102,18 +102,18 @@ DataSet::DataSet(const H5Location& loc, const void* ref, H5R_type_t ref_type, co } //-------------------------------------------------------------------------- -// Function: DataSet overload constructor - dereference -///\brief Given a reference, ref, to an hdf5 attribute, creates a -/// DataSet object -///\param attr - IN: Specifying location where the referenced object is in -///\param ref - IN: Reference pointer -///\param ref_type - IN: Reference type - default to H5R_OBJECT -///\param plist - IN: Property list - default to PropList::DEFAULT -///\exception H5::ReferenceException -// Programmer Binh-Minh Ribler - Oct, 2006 +// Function: DataSet overload constructor - dereference +///\brief Given a reference, ref, to an hdf5 attribute, creates a +/// DataSet object +///\param attr - IN: Specifying location where the referenced object is in +///\param ref - IN: Reference pointer +///\param ref_type - IN: Reference type - default to H5R_OBJECT +///\param plist - IN: Property list - default to PropList::DEFAULT +///\exception H5::ReferenceException +// Programmer Binh-Minh Ribler - Oct, 2006 // Modification -// Jul, 2008 -// Added for application convenience. +// Jul, 2008 +// Added for application convenience. //-------------------------------------------------------------------------- DataSet::DataSet(const Attribute& attr, const void* ref, H5R_type_t ref_type, const PropList& plist) : H5Object(), AbstractDs(), id(H5I_INVALID_HID) { @@ -121,26 +121,26 @@ DataSet::DataSet(const Attribute& attr, const void* ref, H5R_type_t ref_type, co } //-------------------------------------------------------------------------- -// Function: DataSet::getSpace -///\brief Gets a copy of the dataspace of this dataset. -///\return DataSpace instance -///\exception H5::DataSetIException -// Programmer Binh-Minh Ribler - 2000 +// Function: DataSet::getSpace +///\brief Gets a copy of the dataspace of this dataset. +///\return DataSpace instance +///\exception H5::DataSetIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- DataSpace DataSet::getSpace() const { - // Calls C function H5Dget_space to get the id of the dataspace - hid_t dataspace_id = H5Dget_space( id ); - - // If the dataspace id is invalid, throw an exception - if( dataspace_id < 0 ) - { - throw DataSetIException("DataSet::getSpace", "H5Dget_space failed"); - } - //create dataspace object using the existing id then return the object - DataSpace data_space; - f_DataSpace_setId(&data_space, dataspace_id); - return( data_space ); + // Calls C function H5Dget_space to get the id of the dataspace + hid_t dataspace_id = H5Dget_space(id); + + // If the dataspace id is invalid, throw an exception + if (dataspace_id < 0) + { + throw DataSetIException("DataSet::getSpace", "H5Dget_space failed"); + } + //create dataspace object using the existing id then return the object + DataSpace data_space; + f_DataSpace_setId(&data_space, dataspace_id); + return(data_space); } // This private member function calls the C API to get the identifier @@ -148,57 +148,57 @@ DataSpace DataSet::getSpace() const // by the various AbstractDs functions to get the specific datatype. hid_t DataSet::p_get_type() const { - hid_t type_id = H5Dget_type( id ); - if( type_id > 0 ) - return( type_id ); - else - { - throw DataSetIException("", "H5Dget_type failed"); - } + hid_t type_id = H5Dget_type(id); + if (type_id > 0) + return(type_id); + else + { + throw DataSetIException("", "H5Dget_type failed"); + } } //-------------------------------------------------------------------------- -// Function: DataSet::getCreatePlist -///\brief Gets the dataset creation property list. -///\return DSetCreatPropList instance -///\exception H5::DataSetIException -// Programmer Binh-Minh Ribler - 2000 +// Function: DataSet::getCreatePlist +///\brief Gets the dataset creation property list. +///\return DSetCreatPropList instance +///\exception H5::DataSetIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- DSetCreatPropList DataSet::getCreatePlist() const { - hid_t create_plist_id = H5Dget_create_plist( id ); - if( create_plist_id < 0 ) - { - throw DataSetIException("DataSet::getCreatePlist", "H5Dget_create_plist failed"); - } - - // create and return the DSetCreatPropList object - DSetCreatPropList create_plist; - f_PropList_setId(&create_plist, create_plist_id); - return(create_plist); + hid_t create_plist_id = H5Dget_create_plist(id); + if (create_plist_id < 0) + { + throw DataSetIException("DataSet::getCreatePlist", "H5Dget_create_plist failed"); + } + + // create and return the DSetCreatPropList object + DSetCreatPropList create_plist; + f_PropList_setId(&create_plist, create_plist_id); + return(create_plist); } //-------------------------------------------------------------------------- -// Function: DataSet::getStorageSize -///\brief Returns the amount of storage required for a dataset. -///\return Size of the storage or 0, for no data -///\exception H5::DataSetIException -// Note: H5Dget_storage_size returns 0 when there is no data. This -// function should have no failure. (from SLU) -// Programmer Binh-Minh Ribler - Mar, 2005 +// Function: DataSet::getStorageSize +///\brief Returns the amount of storage required for a dataset. +///\return Size of the storage or 0, for no data +///\exception H5::DataSetIException +// Note: H5Dget_storage_size returns 0 when there is no data. This +// function should have no failure. (from SLU) +// Programmer Binh-Minh Ribler - Mar, 2005 //-------------------------------------------------------------------------- hsize_t DataSet::getStorageSize() const { - hsize_t storage_size = H5Dget_storage_size(id); - return(storage_size); + hsize_t storage_size = H5Dget_storage_size(id); + return(storage_size); } //-------------------------------------------------------------------------- -// Function: DataSet::getInMemDataSize -///\brief Gets the size in memory of the dataset's data. -///\return Size of data (in memory) -///\exception H5::DataSetIException -// Programmer Binh-Minh Ribler - Apr 2009 +// Function: DataSet::getInMemDataSize +///\brief Gets the size in memory of the dataset's data. +///\return Size of data (in memory) +///\exception H5::DataSetIException +// Programmer Binh-Minh Ribler - Apr 2009 //-------------------------------------------------------------------------- size_t DataSet::getInMemDataSize() const { @@ -206,9 +206,9 @@ size_t DataSet::getInMemDataSize() const // Get the data type of this dataset hid_t mem_type_id = H5Dget_type(id); - if( mem_type_id < 0 ) + if (mem_type_id < 0) { - throw DataSetIException(func, "H5Dget_type failed"); + throw DataSetIException(func, "H5Dget_type failed"); } // Get the data type's size by first getting its native type then getting @@ -216,22 +216,22 @@ size_t DataSet::getInMemDataSize() const hid_t native_type = H5Tget_native_type(mem_type_id, H5T_DIR_DEFAULT); if (native_type < 0) { - throw DataSetIException(func, "H5Tget_native_type failed"); + throw DataSetIException(func, "H5Tget_native_type failed"); } size_t type_size = H5Tget_size(native_type); if (type_size == 0) { - throw DataSetIException(func, "H5Tget_size failed"); + throw DataSetIException(func, "H5Tget_size failed"); } // Close the native type and the datatype of this dataset. if (H5Tclose(native_type) < 0) { - throw DataSetIException(func, "H5Tclose(native_type) failed"); + throw DataSetIException(func, "H5Tclose(native_type) failed"); } if (H5Tclose(mem_type_id) < 0) { - throw DataSetIException(func, "H5Tclose(mem_type_id) failed"); + throw DataSetIException(func, "H5Tclose(mem_type_id) failed"); } // Get number of elements of the dataset by first getting its dataspace, @@ -239,18 +239,18 @@ size_t DataSet::getInMemDataSize() const hid_t space_id = H5Dget_space(id); if (space_id < 0) { - throw DataSetIException(func, "H5Dget_space failed"); + throw DataSetIException(func, "H5Dget_space failed"); } hssize_t num_elements = H5Sget_simple_extent_npoints(space_id); if (num_elements < 0) { - throw DataSetIException(func, "H5Sget_simple_extent_npoints failed"); + throw DataSetIException(func, "H5Sget_simple_extent_npoints failed"); } // Close the dataspace if (H5Sclose(space_id) < 0) { - throw DataSetIException(func, "H5Sclose failed"); + throw DataSetIException(func, "H5Sclose failed"); } // Calculate and return the size of the data @@ -259,184 +259,184 @@ size_t DataSet::getInMemDataSize() const } //-------------------------------------------------------------------------- -// Function: DataSet::getOffset -///\brief Returns the address of this dataset in the file. -///\return Address of dataset -///\exception H5::DataSetIException -// Programmer Binh-Minh Ribler - 2000 +// Function: DataSet::getOffset +///\brief Returns the address of this dataset in the file. +///\return Address of dataset +///\exception H5::DataSetIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- haddr_t DataSet::getOffset() const { - haddr_t ds_addr; // for address of dataset - - ds_addr = H5Dget_offset(id); - if( ds_addr == HADDR_UNDEF ) - { - throw DataSetIException("DataSet::getOffset", "H5Dget_offset returned HADDR_UNDEF"); - } - return(ds_addr); + haddr_t ds_addr; // for address of dataset + + ds_addr = H5Dget_offset(id); + if (ds_addr == HADDR_UNDEF) + { + throw DataSetIException("DataSet::getOffset", "H5Dget_offset returned HADDR_UNDEF"); + } + return(ds_addr); } //-------------------------------------------------------------------------- -// Function: DataSet::getSpaceStatus -///\brief Determines whether space has been allocated for a dataset. -///\param status - OUT: Space allocation status -///\exception H5::DataSetIException -// Programmer Binh-Minh Ribler - 2000 +// Function: DataSet::getSpaceStatus +///\brief Determines whether space has been allocated for a dataset. +///\param status - OUT: Space allocation status +///\exception H5::DataSetIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void DataSet::getSpaceStatus(H5D_space_status_t& status) const { - herr_t ret_value = H5Dget_space_status(id, &status); - if( ret_value < 0 ) - { - throw DataSetIException("DataSet::getSpaceStatus", "H5Dget_space_status failed"); - } + herr_t ret_value = H5Dget_space_status(id, &status); + if (ret_value < 0) + { + throw DataSetIException("DataSet::getSpaceStatus", "H5Dget_space_status failed"); + } } //-------------------------------------------------------------------------- -// Function: DataSet::getVlenBufSize -///\brief Returns the number of bytes required to store VL data. -///\param type - IN: Datatype, which is the datatype for the buffer -///\param space - IN: Selection for the memory buffer -///\return Amount of storage -///\exception H5::DataSetIException -// Programmer Binh-Minh Ribler - 2000 +// Function: DataSet::getVlenBufSize +///\brief Returns the number of bytes required to store VL data. +///\param type - IN: Datatype, which is the datatype for the buffer +///\param space - IN: Selection for the memory buffer +///\return Amount of storage +///\exception H5::DataSetIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -hsize_t DataSet::getVlenBufSize(const DataType& type, const DataSpace& space ) const +hsize_t DataSet::getVlenBufSize(const DataType& type, const DataSpace& space) const { - // Obtain identifiers for C API - hid_t type_id = type.getId(); - hid_t space_id = space.getId(); - - hsize_t size; // for amount of storage - - herr_t ret_value = H5Dvlen_get_buf_size( id, type_id, space_id, &size ); - if( ret_value < 0 ) - { - throw DataSetIException("DataSet::getVlenBufSize", "H5Dvlen_get_buf_size failed"); - } - return( size ); + // Obtain identifiers for C API + hid_t type_id = type.getId(); + hid_t space_id = space.getId(); + + hsize_t size; // for amount of storage + + herr_t ret_value = H5Dvlen_get_buf_size(id, type_id, space_id, &size); + if (ret_value < 0) + { + throw DataSetIException("DataSet::getVlenBufSize", "H5Dvlen_get_buf_size failed"); + } + return(size); } //-------------------------------------------------------------------------- -// Function: DataSet::getVlenBufSize -// Purpose This is an overloaded member function, kept for backward -// compatibility. It differs from the above function in that it -// misses const's. This wrapper will be removed in future release. -// Return Amount of storage -// Exception H5::DataSetIException -// Programmer Binh-Minh Ribler - 2000 +// Function: DataSet::getVlenBufSize +// Purpose This is an overloaded member function, kept for backward +// compatibility. It differs from the above function in that it +// misses const's. This wrapper will be removed in future release. +// Return Amount of storage +// Exception H5::DataSetIException +// Programmer Binh-Minh Ribler - 2000 // Modification -// Modified to call its replacement. -BMR, 2014/04/16 -// Removed from documentation. -BMR, 2016/03/07 1.8.17 and 1.10.0 -// Removed from code. -BMR, 2016/08/11 1.8.18 and 1.10.1 +// Modified to call its replacement. -BMR, 2014/04/16 +// Removed from documentation. -BMR, 2016/03/07 1.8.17 and 1.10.0 +// Removed from code. -BMR, 2016/08/11 1.8.18 and 1.10.1 //-------------------------------------------------------------------------- -//hsize_t DataSet::getVlenBufSize( DataType& type, DataSpace& space ) const +//hsize_t DataSet::getVlenBufSize(DataType& type, DataSpace& space) const //{ // return(getVlenBufSize(type, space)); //} //-------------------------------------------------------------------------- -// Function: DataSet::vlenReclaim -///\brief Reclaims VL datatype memory buffers. -///\param type - IN: Datatype, which is the datatype stored in the buffer -///\param space - IN: Selection for the memory buffer to free the -/// VL datatypes within -///\param xfer_plist - IN: Property list used to create the buffer -///\param buf - IN: Pointer to the buffer to be reclaimed -///\exception H5::DataSetIException -// Programmer Binh-Minh Ribler - 2000 +// Function: DataSet::vlenReclaim +///\brief Reclaims VL datatype memory buffers. +///\param type - IN: Datatype, which is the datatype stored in the buffer +///\param space - IN: Selection for the memory buffer to free the +/// VL datatypes within +///\param xfer_plist - IN: Property list used to create the buffer +///\param buf - IN: Pointer to the buffer to be reclaimed +///\exception H5::DataSetIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -void DataSet::vlenReclaim(const DataType& type, const DataSpace& space, const DSetMemXferPropList& xfer_plist, void* buf ) +void DataSet::vlenReclaim(const DataType& type, const DataSpace& space, const DSetMemXferPropList& xfer_plist, void* buf) { - // Obtain identifiers for C API - hid_t type_id = type.getId(); - hid_t space_id = space.getId(); - hid_t xfer_plist_id = xfer_plist.getId(); - - herr_t ret_value = H5Dvlen_reclaim( type_id, space_id, xfer_plist_id, buf ); - if( ret_value < 0 ) - { - throw DataSetIException("DataSet::vlenReclaim", "H5Dvlen_reclaim failed"); - } + // Obtain identifiers for C API + hid_t type_id = type.getId(); + hid_t space_id = space.getId(); + hid_t xfer_plist_id = xfer_plist.getId(); + + herr_t ret_value = H5Dvlen_reclaim(type_id, space_id, xfer_plist_id, buf); + if (ret_value < 0) + { + throw DataSetIException("DataSet::vlenReclaim", "H5Dvlen_reclaim failed"); + } } //-------------------------------------------------------------------------- -// Function: DataSet::vlenReclaim -///\brief Reclaims VL datatype memory buffers. -///\param type - IN: Datatype, which is the datatype stored in the buffer -///\param space - IN: Selection for the memory buffer to free the -/// VL datatypes within -///\param xfer_plist - IN: Property list used to create the buffer -///\param buf - IN: Pointer to the buffer to be reclaimed -///\exception H5::DataSetIException -// Programmer Binh-Minh Ribler - 2000 +// Function: DataSet::vlenReclaim +///\brief Reclaims VL datatype memory buffers. +///\param type - IN: Datatype, which is the datatype stored in the buffer +///\param space - IN: Selection for the memory buffer to free the +/// VL datatypes within +///\param xfer_plist - IN: Property list used to create the buffer +///\param buf - IN: Pointer to the buffer to be reclaimed +///\exception H5::DataSetIException +// Programmer Binh-Minh Ribler - 2000 //\parDescription -// This function has better prototype for the users than the -// other, which might be removed at some point. BMR - 2006/12/20 +// This function has better prototype for the users than the +// other, which might be removed at some point. BMR - 2006/12/20 //-------------------------------------------------------------------------- void DataSet::vlenReclaim(void* buf, const DataType& type, const DataSpace& space, const DSetMemXferPropList& xfer_plist) { - // Obtain identifiers for C API - hid_t type_id = type.getId(); - hid_t space_id = space.getId(); - hid_t xfer_plist_id = xfer_plist.getId(); - - herr_t ret_value = H5Dvlen_reclaim(type_id, space_id, xfer_plist_id, buf); - if (ret_value < 0) - { - throw DataSetIException("DataSet::vlenReclaim", "H5Dvlen_reclaim failed"); - } + // Obtain identifiers for C API + hid_t type_id = type.getId(); + hid_t space_id = space.getId(); + hid_t xfer_plist_id = xfer_plist.getId(); + + herr_t ret_value = H5Dvlen_reclaim(type_id, space_id, xfer_plist_id, buf); + if (ret_value < 0) + { + throw DataSetIException("DataSet::vlenReclaim", "H5Dvlen_reclaim failed"); + } } //-------------------------------------------------------------------------- -// Function: DataSet::read -///\brief Reads raw data from the specified dataset. -///\param buf - IN: Buffer for read data -///\param mem_type - IN: Memory datatype -///\param mem_space - IN: Memory dataspace -///\param file_space - IN: Dataset's dataspace in the file -///\param xfer_plist - IN: Transfer property list for this I/O operation -///\exception H5::DataSetIException +// Function: DataSet::read +///\brief Reads raw data from the specified dataset. +///\param buf - IN: Buffer for read data +///\param mem_type - IN: Memory datatype +///\param mem_space - IN: Memory dataspace +///\param file_space - IN: Dataset's dataspace in the file +///\param xfer_plist - IN: Transfer property list for this I/O operation +///\exception H5::DataSetIException ///\par Description -/// This function reads raw data from this dataset into the -/// buffer \a buf, converting from file datatype and dataspace -/// to memory datatype \a mem_type and dataspace \a mem_space. -// Programmer Binh-Minh Ribler - 2000 +/// This function reads raw data from this dataset into the +/// buffer \a buf, converting from file datatype and dataspace +/// to memory datatype \a mem_type and dataspace \a mem_space. +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -void DataSet::read( void* buf, const DataType& mem_type, const DataSpace& mem_space, const DataSpace& file_space, const DSetMemXferPropList& xfer_plist ) const +void DataSet::read(void* buf, const DataType& mem_type, const DataSpace& mem_space, const DataSpace& file_space, const DSetMemXferPropList& xfer_plist) const { - // Obtain identifiers for C API - hid_t mem_type_id = mem_type.getId(); - hid_t mem_space_id = mem_space.getId(); - hid_t file_space_id = file_space.getId(); - hid_t xfer_plist_id = xfer_plist.getId(); - - herr_t ret_value = H5Dread( id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, buf ); - if( ret_value < 0 ) - { - throw DataSetIException("DataSet::read", "H5Dread failed"); - } + // Obtain identifiers for C API + hid_t mem_type_id = mem_type.getId(); + hid_t mem_space_id = mem_space.getId(); + hid_t file_space_id = file_space.getId(); + hid_t xfer_plist_id = xfer_plist.getId(); + + herr_t ret_value = H5Dread(id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, buf); + if (ret_value < 0) + { + throw DataSetIException("DataSet::read", "H5Dread failed"); + } } //-------------------------------------------------------------------------- -// Function: DataSet::read -///\brief This is an overloaded member function, provided for convenience. -/// It takes a reference to a \c H5std_string for the buffer. -///\param strg - IN: Buffer for read data string -///\param mem_type - IN: Memory datatype -///\param mem_space - IN: Memory dataspace -///\param file_space - IN: Dataset's dataspace in the file -///\param xfer_plist - IN: Transfer property list for this I/O operation -///\exception H5::DataSetIException -// Programmer Binh-Minh Ribler - 2000 +// Function: DataSet::read +///\brief This is an overloaded member function, provided for convenience. +/// It takes a reference to a \c H5std_string for the buffer. +///\param strg - IN: Buffer for read data string +///\param mem_type - IN: Memory datatype +///\param mem_space - IN: Memory dataspace +///\param file_space - IN: Dataset's dataspace in the file +///\param xfer_plist - IN: Transfer property list for this I/O operation +///\exception H5::DataSetIException +// Programmer Binh-Minh Ribler - 2000 // Modification -// Jul 2009 -// Follow the change to Attribute::read and use the following -// private functions to read datasets with fixed- and -// variable-length string: -// DataSet::p_read_fixed_len and -// DataSet::p_read_variable_len +// Jul 2009 +// Follow the change to Attribute::read and use the following +// private functions to read datasets with fixed- and +// variable-length string: +// DataSet::p_read_fixed_len and +// DataSet::p_read_variable_len //-------------------------------------------------------------------------- void DataSet::read(H5std_string& strg, const DataType& mem_type, const DataSpace& mem_space, const DataSpace& file_space, const DSetMemXferPropList& xfer_plist) const { @@ -465,47 +465,47 @@ void DataSet::read(H5std_string& strg, const DataType& mem_type, const DataSpace } //-------------------------------------------------------------------------- -// Function: DataSet::write -///\brief Writes raw data from an application buffer to a dataset. -///\param buf - IN: Buffer containing data to be written -///\param mem_type - IN: Memory datatype -///\param mem_space - IN: Memory dataspace -///\param file_space - IN: Dataset's dataspace in the file -///\param xfer_plist - IN: Transfer property list for this I/O operation -///\exception H5::DataSetIException +// Function: DataSet::write +///\brief Writes raw data from an application buffer to a dataset. +///\param buf - IN: Buffer containing data to be written +///\param mem_type - IN: Memory datatype +///\param mem_space - IN: Memory dataspace +///\param file_space - IN: Dataset's dataspace in the file +///\param xfer_plist - IN: Transfer property list for this I/O operation +///\exception H5::DataSetIException ///\par Description -/// This function writes raw data from an application buffer -/// \a buf to a dataset, converting from memory datatype -/// \a mem_type and dataspace \a mem_space to file datatype -/// and dataspace. -// Programmer Binh-Minh Ribler - 2000 +/// This function writes raw data from an application buffer +/// \a buf to a dataset, converting from memory datatype +/// \a mem_type and dataspace \a mem_space to file datatype +/// and dataspace. +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -void DataSet::write( const void* buf, const DataType& mem_type, const DataSpace& mem_space, const DataSpace& file_space, const DSetMemXferPropList& xfer_plist ) const +void DataSet::write(const void* buf, const DataType& mem_type, const DataSpace& mem_space, const DataSpace& file_space, const DSetMemXferPropList& xfer_plist) const { - // Obtain identifiers for C API - hid_t mem_type_id = mem_type.getId(); - hid_t mem_space_id = mem_space.getId(); - hid_t file_space_id = file_space.getId(); - hid_t xfer_plist_id = xfer_plist.getId(); - - herr_t ret_value = H5Dwrite( id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, buf ); - if( ret_value < 0 ) - { - throw DataSetIException("DataSet::write", "H5Dwrite failed"); - } + // Obtain identifiers for C API + hid_t mem_type_id = mem_type.getId(); + hid_t mem_space_id = mem_space.getId(); + hid_t file_space_id = file_space.getId(); + hid_t xfer_plist_id = xfer_plist.getId(); + + herr_t ret_value = H5Dwrite(id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, buf); + if (ret_value < 0) + { + throw DataSetIException("DataSet::write", "H5Dwrite failed"); + } } //-------------------------------------------------------------------------- -// Function: DataSet::write -///\brief This is an overloaded member function, provided for convenience. -/// It takes a reference to a \c H5std_string for the buffer. -// Programmer Binh-Minh Ribler - 2000 +// Function: DataSet::write +///\brief This is an overloaded member function, provided for convenience. +/// It takes a reference to a \c H5std_string for the buffer. +// Programmer Binh-Minh Ribler - 2000 // Modification -// Jul 2009 -// Modified to pass the buffer into H5Dwrite properly depending -// whether the dataset has variable- or fixed-length string. +// Jul 2009 +// Modified to pass the buffer into H5Dwrite properly depending +// whether the dataset has variable- or fixed-length string. //-------------------------------------------------------------------------- -void DataSet::write( const H5std_string& strg, const DataType& mem_type, const DataSpace& mem_space, const DataSpace& file_space, const DSetMemXferPropList& xfer_plist ) const +void DataSet::write(const H5std_string& strg, const DataType& mem_type, const DataSpace& mem_space, const DataSpace& file_space, const DSetMemXferPropList& xfer_plist) const { // Check if this attribute has variable-len string or fixed-len string and // proceed appropriately. @@ -515,11 +515,11 @@ void DataSet::write( const H5std_string& strg, const DataType& mem_type, const D throw DataSetIException("DataSet::write", "H5Tis_variable_str failed"); } - // Obtain identifiers for C API - hid_t mem_type_id = mem_type.getId(); - hid_t mem_space_id = mem_space.getId(); - hid_t file_space_id = file_space.getId(); - hid_t xfer_plist_id = xfer_plist.getId(); + // Obtain identifiers for C API + hid_t mem_type_id = mem_type.getId(); + hid_t mem_space_id = mem_space.getId(); + hid_t file_space_id = file_space.getId(); + hid_t xfer_plist_id = xfer_plist.getId(); // Convert string to C-string const char* strg_C; @@ -529,12 +529,12 @@ void DataSet::write( const H5std_string& strg, const DataType& mem_type, const D // Pass string in differently depends on variable or fixed length if (!is_variable_len) { - ret_value = H5Dwrite( id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, strg_C ); + ret_value = H5Dwrite(id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, strg_C); } else { // passing string argument by address - ret_value = H5Dwrite( id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, &strg_C ); + ret_value = H5Dwrite(id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, &strg_C); } if (ret_value < 0) { @@ -543,65 +543,65 @@ void DataSet::write( const H5std_string& strg, const DataType& mem_type, const D } //-------------------------------------------------------------------------- -// Function: DataSet::iterateElems -///\brief Iterates over all selected elements in a dataspace. -///\param buf - IN/OUT: Pointer to the buffer in memory containing the -/// elements to iterate over -///\param type - IN: Datatype for the elements stored in \a buf -///\param space - IN: Dataspace for \a buf. Also contains the selection -/// to iterate over. -///\param op - IN: Function pointer to the routine to be called for -/// each element in \a buf iterated over -///\param op_data - IN/OUT: Pointer to any user-defined data associated -/// with the operation -///\exception H5::DataSetIException -///\note This function may not work correctly yet - it's still -/// under development. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -int DataSet::iterateElems( void* buf, const DataType& type, const DataSpace& space, H5D_operator_t op, void* op_data ) +// Function: DataSet::iterateElems +///\brief Iterates over all selected elements in a dataspace. +///\param buf - IN/OUT: Pointer to the buffer in memory containing the +/// elements to iterate over +///\param type - IN: Datatype for the elements stored in \a buf +///\param space - IN: Dataspace for \a buf. Also contains the selection +/// to iterate over. +///\param op - IN: Function pointer to the routine to be called for +/// each element in \a buf iterated over +///\param op_data - IN/OUT: Pointer to any user-defined data associated +/// with the operation +///\exception H5::DataSetIException +///\note This function may not work correctly yet - it's still +/// under development. +// Programmer Binh-Minh Ribler - 2000 +//-------------------------------------------------------------------------- +int DataSet::iterateElems(void* buf, const DataType& type, const DataSpace& space, H5D_operator_t op, void* op_data) { - // Obtain identifiers for C API - hid_t type_id = type.getId(); - hid_t space_id = space.getId(); - herr_t ret_value = H5Diterate( buf, type_id, space_id, op, op_data ); - if( ret_value >= 0 ) - return( ret_value ); - else // raise exception when H5Diterate returns a negative value - { - throw DataSetIException("DataSet::iterateElems", "H5Diterate failed"); - } + // Obtain identifiers for C API + hid_t type_id = type.getId(); + hid_t space_id = space.getId(); + herr_t ret_value = H5Diterate(buf, type_id, space_id, op, op_data); + if (ret_value >= 0) + return(ret_value); + else // raise exception when H5Diterate returns a negative value + { + throw DataSetIException("DataSet::iterateElems", "H5Diterate failed"); + } } //-------------------------------------------------------------------------- -// Function: DataSet::extend -///\brief Extends a dataset with unlimited dimension. -///\param size - IN: Array containing the new magnitude of each dimension -///\exception H5::DataSetIException +// Function: DataSet::extend +///\brief Extends a dataset with unlimited dimension. +///\param size - IN: Array containing the new magnitude of each dimension +///\exception H5::DataSetIException ///\par Description -/// For more information, please see the Description section in -/// C layer Reference Manual at: +/// For more information, please see the Description section in +/// C layer Reference Manual at: ///\par /// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5D.html#Dataset-Extend -// Programmer Binh-Minh Ribler - 2000 +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -void DataSet::extend( const hsize_t* size ) const +void DataSet::extend(const hsize_t* size) const { - herr_t ret_value = H5Dset_extent( id, size ); - if( ret_value < 0 ) // raise exception when H5Dset_extent returns a neg value - throw DataSetIException("DataSet::extend", "H5Dset_extent failed"); + herr_t ret_value = H5Dset_extent(id, size); + if (ret_value < 0) // raise exception when H5Dset_extent returns a neg value + throw DataSetIException("DataSet::extend", "H5Dset_extent failed"); } //-------------------------------------------------------------------------- -// Function: DataSet::fillMemBuf -///\brief Fills a selection in memory with a value. -///\param fill - IN: Pointer to fill value to use - default NULL -///\param fill_type - IN: Datatype of the fill value -///\param buf - IN/OUT: Memory buffer to fill selection within -///\param buf_type - IN: Datatype of the elements in buffer -///\param space - IN: Dataspace describing memory buffer & containing selection to use -///\exception H5::DataSetIException -// Programmer Binh-Minh Ribler - 2014 +// Function: DataSet::fillMemBuf +///\brief Fills a selection in memory with a value. +///\param fill - IN: Pointer to fill value to use - default NULL +///\param fill_type - IN: Datatype of the fill value +///\param buf - IN/OUT: Memory buffer to fill selection within +///\param buf_type - IN: Datatype of the elements in buffer +///\param space - IN: Dataspace describing memory buffer & containing selection to use +///\exception H5::DataSetIException +// Programmer Binh-Minh Ribler - 2014 // Modification //-------------------------------------------------------------------------- void DataSet::fillMemBuf(const void *fill, const DataType& fill_type, void *buf, const DataType& buf_type, const DataSpace& space) const @@ -610,28 +610,28 @@ void DataSet::fillMemBuf(const void *fill, const DataType& fill_type, void *buf, hid_t buf_type_id = buf_type.getId(); hid_t space_id = space.getId(); herr_t ret_value = H5Dfill(fill, fill_type_id, buf, buf_type_id, space_id); - if( ret_value < 0 ) + if (ret_value < 0) { - throw DataSetIException("DataSet::fillMemBuf", "H5Dfill failed"); + throw DataSetIException("DataSet::fillMemBuf", "H5Dfill failed"); } } //-------------------------------------------------------------------------- -// Function: DataSet::fillMemBuf -// Purpose This is an overloaded member function, kept for backward -// compatibility. It differs from the above function in that it -// misses const's. This wrapper will be removed in future release. -// Param fill - IN: Pointer to fill value to use - default NULL -// Param fill_type - IN: Datatype of the fill value -// Param buf - IN/OUT: Memory buffer to fill selection within -// Param buf_type - IN: Datatype of the elements in buffer -// Param space - IN: Dataspace describing memory buffer & containing selection to use -// Exception H5::DataSetIException -// Programmer Binh-Minh Ribler - 2000 +// Function: DataSet::fillMemBuf +// Purpose This is an overloaded member function, kept for backward +// compatibility. It differs from the above function in that it +// misses const's. This wrapper will be removed in future release. +// Param fill - IN: Pointer to fill value to use - default NULL +// Param fill_type - IN: Datatype of the fill value +// Param buf - IN/OUT: Memory buffer to fill selection within +// Param buf_type - IN: Datatype of the elements in buffer +// Param space - IN: Dataspace describing memory buffer & containing selection to use +// Exception H5::DataSetIException +// Programmer Binh-Minh Ribler - 2000 // Modification -// Modified to call its replacement. -BMR, 2014/04/16 -// Removed from documentation. -BMR, 2016/03/07 1.8.17 and 1.10.0 -// Removed from code. -BMR, 2016/08/11 1.8.18 and 1.10.1 +// Modified to call its replacement. -BMR, 2014/04/16 +// Removed from documentation. -BMR, 2016/03/07 1.8.17 and 1.10.0 +// Removed from code. -BMR, 2016/08/11 1.8.18 and 1.10.1 //-------------------------------------------------------------------------- //void DataSet::fillMemBuf(const void *fill, DataType& fill_type, void *buf, DataType& buf_type, DataSpace& space) //{ @@ -639,39 +639,39 @@ void DataSet::fillMemBuf(const void *fill, const DataType& fill_type, void *buf, //} //-------------------------------------------------------------------------- -// Function: DataSet::fillMemBuf -///\brief Fills a selection in memory with 0. -///\param buf - IN/OUT: Memory buffer to fill selection within -///\param buf_type - IN: Datatype of the elements in buffer -///\param space - IN: Dataspace describing memory buffer & containing selection to use -///\exception H5::DataSetIException -// Programmer Binh-Minh Ribler - 2000 +// Function: DataSet::fillMemBuf +///\brief Fills a selection in memory with 0. +///\param buf - IN/OUT: Memory buffer to fill selection within +///\param buf_type - IN: Datatype of the elements in buffer +///\param space - IN: Dataspace describing memory buffer & containing selection to use +///\exception H5::DataSetIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void DataSet::fillMemBuf(void *buf, const DataType& buf_type, const DataSpace& space) const { hid_t buf_type_id = buf_type.getId(); hid_t space_id = space.getId(); herr_t ret_value = H5Dfill(NULL, buf_type_id, buf, buf_type_id, space_id); - if( ret_value < 0 ) + if (ret_value < 0) { - throw DataSetIException("DataSet::fillMemBuf", "H5Dfill failed"); + throw DataSetIException("DataSet::fillMemBuf", "H5Dfill failed"); } } //-------------------------------------------------------------------------- // Function: DataSet::fillMemBuf -// Purpose This is an overloaded member function, kept for backward -// compatibility. It differs from the above function in that it -// misses const's. This wrapper will be removed in future release. +// Purpose This is an overloaded member function, kept for backward +// compatibility. It differs from the above function in that it +// misses const's. This wrapper will be removed in future release. // Param buf - IN/OUT: Memory buffer to fill selection within // Param buf_type - IN: Datatype of the elements in buffer // Param space - IN: Dataspace describing memory buffer & containing selection to use -// Exception H5::DataSetIException +// Exception H5::DataSetIException // Programmer Binh-Minh Ribler - 2000 // Modification -// Modified to call its replacement. -BMR, 2014/04/16 -// Removed from documentation. -BMR, 2016/03/07 1.8.17 and 1.10.0 -// Removed from code. -BMR, 2016/08/11 1.8.18 and 1.10.1 +// Modified to call its replacement. -BMR, 2014/04/16 +// Removed from documentation. -BMR, 2016/03/07 1.8.17 and 1.10.0 +// Removed from code. -BMR, 2016/08/11 1.8.18 and 1.10.1 //-------------------------------------------------------------------------- //void DataSet::fillMemBuf(void *buf, DataType& buf_type, DataSpace& space) //{ @@ -680,8 +680,8 @@ void DataSet::fillMemBuf(void *buf, const DataType& buf_type, const DataSpace& s //-------------------------------------------------------------------------- // Function: DataSet::getId -///\brief Get the id of this dataset. -///\return DataSet identifier +///\brief Get the id of this dataset. +///\return DataSet identifier // Description: // Class hierarchy is revised to address bugzilla 1068. Class // AbstractDs and Attribute are moved out of H5Object. In @@ -691,19 +691,19 @@ void DataSet::fillMemBuf(void *buf, const DataType& buf_type, const DataSpace& s //-------------------------------------------------------------------------- hid_t DataSet::getId() const { - return(id); + return(id); } //-------------------------------------------------------------------------- -// Function: DataSet::p_read_fixed_len (private) -// brief Reads a fixed length \a H5std_string from a dataset. -// param mem_type - IN: DataSet datatype (in memory) -// param strg - IN: Buffer for read string -// exception H5::DataSetIException -// Programmer Binh-Minh Ribler - Jul, 2009 +// Function: DataSet::p_read_fixed_len (private) +// brief Reads a fixed length \a H5std_string from a dataset. +// param mem_type - IN: DataSet datatype (in memory) +// param strg - IN: Buffer for read string +// exception H5::DataSetIException +// Programmer Binh-Minh Ribler - Jul, 2009 // Modification -// Jul 2009 -// Added in follow to the change in Attribute::read +// Jul 2009 +// Added in follow to the change in Attribute::read //-------------------------------------------------------------------------- void DataSet::p_read_fixed_len(const hid_t mem_type_id, const hid_t mem_space_id, const hid_t file_space_id, const hid_t xfer_plist_id, H5std_string& strg) const { @@ -715,33 +715,33 @@ void DataSet::p_read_fixed_len(const hid_t mem_type_id, const hid_t mem_space_id // If there is data, allocate buffer and read it. if (data_size > 0) { - char *strg_C = new char [data_size+1]; - HDmemset(strg_C, 0, data_size+1); // clear buffer + char *strg_C = new char [data_size+1]; + HDmemset(strg_C, 0, data_size+1); // clear buffer - herr_t ret_value = H5Dread(id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, strg_C); + herr_t ret_value = H5Dread(id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, strg_C); - if( ret_value < 0 ) - { - delete []strg_C; // de-allocate for fixed-len string - throw DataSetIException("DataSet::read", "H5Dread failed for fixed length string"); - } + if (ret_value < 0) + { + delete []strg_C; // de-allocate for fixed-len string + throw DataSetIException("DataSet::read", "H5Dread failed for fixed length string"); + } - // Get string from the C char* and release resource allocated locally - strg = strg_C; - delete []strg_C; + // Get string from the C char* and release resource allocated locally + strg = strg_C; + delete []strg_C; } } //-------------------------------------------------------------------------- -// Function: DataSet::p_read_variable_len (private) -// brief Reads a variable length \a H5std_string from an dataset. -// param mem_type - IN: DataSet datatype (in memory) -// param strg - IN: Buffer for read string -// exception H5::DataSetIException -// Programmer Binh-Minh Ribler - Jul, 2009 +// Function: DataSet::p_read_variable_len (private) +// brief Reads a variable length \a H5std_string from an dataset. +// param mem_type - IN: DataSet datatype (in memory) +// param strg - IN: Buffer for read string +// exception H5::DataSetIException +// Programmer Binh-Minh Ribler - Jul, 2009 // Modification -// Jul 2009 -// Added in follow to the change in Attribute::read +// Jul 2009 +// Added in follow to the change in Attribute::read //-------------------------------------------------------------------------- void DataSet::p_read_variable_len(const hid_t mem_type_id, const hid_t mem_space_id, const hid_t file_space_id, const hid_t xfer_plist_id, H5std_string& strg) const { @@ -751,9 +751,9 @@ void DataSet::p_read_variable_len(const hid_t mem_type_id, const hid_t mem_space // Read dataset, no allocation for variable-len string; C library will herr_t ret_value = H5Dread(id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, &strg_C); - if( ret_value < 0 ) + if (ret_value < 0) { - throw DataSetIException("DataSet::read", "H5Dread failed for variable length string"); + throw DataSetIException("DataSet::read", "H5Dread failed for variable length string"); } // Get string from the C char* and release resource allocated by C API @@ -805,43 +805,43 @@ void f_PropList_setId(PropList* plist, hid_t new_id) #endif // DOXYGEN_SHOULD_SKIP_THIS //-------------------------------------------------------------------------- -// Function: DataSet::close -///\brief Closes this dataset. +// Function: DataSet::close +///\brief Closes this dataset. /// -///\exception H5::DataSetIException -// Programmer Binh-Minh Ribler - Mar 9, 2005 +///\exception H5::DataSetIException +// Programmer Binh-Minh Ribler - Mar 9, 2005 //-------------------------------------------------------------------------- void DataSet::close() { if (p_valid_id(id)) { - herr_t ret_value = H5Dclose( id ); - if( ret_value < 0 ) - { - throw DataSetIException("DataSet::close", "H5Dclose failed"); - } - // reset the id - id = H5I_INVALID_HID; + herr_t ret_value = H5Dclose(id); + if (ret_value < 0) + { + throw DataSetIException("DataSet::close", "H5Dclose failed"); + } + // reset the id + id = H5I_INVALID_HID; } } //-------------------------------------------------------------------------- -// Function: DataSet destructor -///\brief Properly terminates access to this dataset. -// Programmer Binh-Minh Ribler - 2000 +// Function: DataSet destructor +///\brief Properly terminates access to this dataset. +// Programmer Binh-Minh Ribler - 2000 // Modification -// - Replaced resetIdComponent() with decRefCount() to use C -// library ID reference counting mechanism - BMR, Jun 1, 2004 -// - Replaced decRefCount with close() to let the C library -// handle the reference counting - BMR, Jun 1, 2006 +// - Replaced resetIdComponent() with decRefCount() to use C +// library ID reference counting mechanism - BMR, Jun 1, 2004 +// - Replaced decRefCount with close() to let the C library +// handle the reference counting - BMR, Jun 1, 2006 //-------------------------------------------------------------------------- DataSet::~DataSet() { try { - close(); + close(); } catch (Exception& close_error) { - cerr << "DataSet::~DataSet - " << close_error.getDetailMsg() << endl; + cerr << "DataSet::~DataSet - " << close_error.getDetailMsg() << endl; } } diff --git a/c++/src/H5DataSet.h b/c++/src/H5DataSet.h index ee9ef28..93f9782 100644 --- a/c++/src/H5DataSet.h +++ b/c++/src/H5DataSet.h @@ -31,82 +31,82 @@ namespace H5 { class H5_DLLCPP DataSet : public H5Object, public AbstractDs { public: - // Close this dataset. - virtual void close(); + // Close this dataset. + virtual void close(); - // Extends the dataset with unlimited dimension. - void extend( const hsize_t* size ) const; + // Extends the dataset with unlimited dimension. + void extend(const hsize_t* size) const; - // Fills a selection in memory with a value - void fillMemBuf(const void *fill, const DataType& fill_type, void *buf, const DataType& buf_type, const DataSpace& space) const; - //void fillMemBuf(const void *fill, DataType& fill_type, void *buf, DataType& buf_type, DataSpace& space); // removed from 1.8.18 and 1.10.1 + // Fills a selection in memory with a value + void fillMemBuf(const void *fill, const DataType& fill_type, void *buf, const DataType& buf_type, const DataSpace& space) const; + //void fillMemBuf(const void *fill, DataType& fill_type, void *buf, DataType& buf_type, DataSpace& space); // removed from 1.8.18 and 1.10.1 - // Fills a selection in memory with zero - void fillMemBuf(void *buf, const DataType& buf_type, const DataSpace& space) const; - //void fillMemBuf(void *buf, DataType& buf_type, DataSpace& space); // removed from 1.8.18 and 1.10.1 + // Fills a selection in memory with zero + void fillMemBuf(void *buf, const DataType& buf_type, const DataSpace& space) const; + //void fillMemBuf(void *buf, DataType& buf_type, DataSpace& space); // removed from 1.8.18 and 1.10.1 - // Gets the creation property list of this dataset. - DSetCreatPropList getCreatePlist() const; + // Gets the creation property list of this dataset. + DSetCreatPropList getCreatePlist() const; - // Returns the address of this dataset in the file. - haddr_t getOffset() const; + // Returns the address of this dataset in the file. + haddr_t getOffset() const; - // Gets the dataspace of this dataset. - virtual DataSpace getSpace() const; + // Gets the dataspace of this dataset. + virtual DataSpace getSpace() const; - // Determines whether space has been allocated for a dataset. - void getSpaceStatus(H5D_space_status_t& status) const; + // Determines whether space has been allocated for a dataset. + void getSpaceStatus(H5D_space_status_t& status) const; - // Returns the amount of storage size required for this dataset. - virtual hsize_t getStorageSize() const; + // Returns the amount of storage size required for this dataset. + virtual hsize_t getStorageSize() const; - // Returns the in memory size of this attribute's data. - virtual size_t getInMemDataSize() const; + // Returns the in memory size of this attribute's data. + virtual size_t getInMemDataSize() const; - // Returns the number of bytes required to store VL data. - hsize_t getVlenBufSize(const DataType& type, const DataSpace& space ) const; - //hsize_t getVlenBufSize(DataType& type, DataSpace& space) const; // removed from 1.8.18 and 1.10.1 + // Returns the number of bytes required to store VL data. + hsize_t getVlenBufSize(const DataType& type, const DataSpace& space) const; + //hsize_t getVlenBufSize(DataType& type, DataSpace& space) const; // removed from 1.8.18 and 1.10.1 - // Reclaims VL datatype memory buffers. - static void vlenReclaim(const DataType& type, const DataSpace& space, const DSetMemXferPropList& xfer_plist, void* buf ); - static void vlenReclaim(void *buf, const DataType& type, const DataSpace& space = DataSpace::ALL, const DSetMemXferPropList& xfer_plist = DSetMemXferPropList::DEFAULT); + // Reclaims VL datatype memory buffers. + static void vlenReclaim(const DataType& type, const DataSpace& space, const DSetMemXferPropList& xfer_plist, void* buf); + static void vlenReclaim(void *buf, const DataType& type, const DataSpace& space = DataSpace::ALL, const DSetMemXferPropList& xfer_plist = DSetMemXferPropList::DEFAULT); - // Reads the data of this dataset and stores it in the provided buffer. - // The memory and file dataspaces and the transferring property list - // can be defaults. - void read( void* buf, const DataType& mem_type, const DataSpace& mem_space = DataSpace::ALL, const DataSpace& file_space = DataSpace::ALL, const DSetMemXferPropList& xfer_plist = DSetMemXferPropList::DEFAULT ) const; - void read( H5std_string& buf, const DataType& mem_type, const DataSpace& mem_space = DataSpace::ALL, const DataSpace& file_space = DataSpace::ALL, const DSetMemXferPropList& xfer_plist = DSetMemXferPropList::DEFAULT ) const; + // Reads the data of this dataset and stores it in the provided buffer. + // The memory and file dataspaces and the transferring property list + // can be defaults. + void read(void* buf, const DataType& mem_type, const DataSpace& mem_space = DataSpace::ALL, const DataSpace& file_space = DataSpace::ALL, const DSetMemXferPropList& xfer_plist = DSetMemXferPropList::DEFAULT) const; + void read(H5std_string& buf, const DataType& mem_type, const DataSpace& mem_space = DataSpace::ALL, const DataSpace& file_space = DataSpace::ALL, const DSetMemXferPropList& xfer_plist = DSetMemXferPropList::DEFAULT) const; - // Writes the buffered data to this dataset. - // The memory and file dataspaces and the transferring property list - // can be defaults. - void write( const void* buf, const DataType& mem_type, const DataSpace& mem_space = DataSpace::ALL, const DataSpace& file_space = DataSpace::ALL, const DSetMemXferPropList& xfer_plist = DSetMemXferPropList::DEFAULT ) const; - void write( const H5std_string& buf, const DataType& mem_type, const DataSpace& mem_space = DataSpace::ALL, const DataSpace& file_space = DataSpace::ALL, const DSetMemXferPropList& xfer_plist = DSetMemXferPropList::DEFAULT ) const; + // Writes the buffered data to this dataset. + // The memory and file dataspaces and the transferring property list + // can be defaults. + void write(const void* buf, const DataType& mem_type, const DataSpace& mem_space = DataSpace::ALL, const DataSpace& file_space = DataSpace::ALL, const DSetMemXferPropList& xfer_plist = DSetMemXferPropList::DEFAULT) const; + void write(const H5std_string& buf, const DataType& mem_type, const DataSpace& mem_space = DataSpace::ALL, const DataSpace& file_space = DataSpace::ALL, const DSetMemXferPropList& xfer_plist = DSetMemXferPropList::DEFAULT) const; - // Iterates the selected elements in the specified dataspace - not implemented in C++ style yet - int iterateElems( void* buf, const DataType& type, const DataSpace& space, H5D_operator_t op, void* op_data = NULL ); + // Iterates the selected elements in the specified dataspace - not implemented in C++ style yet + int iterateElems(void* buf, const DataType& type, const DataSpace& space, H5D_operator_t op, void* op_data = NULL); - ///\brief Returns this class name. - virtual H5std_string fromClass () const { return("DataSet"); } + ///\brief Returns this class name. + virtual H5std_string fromClass () const { return("DataSet"); } - // Creates a dataset by way of dereference. - DataSet(const H5Location& loc, const void* ref, H5R_type_t ref_type = H5R_OBJECT, const PropList& plist = PropList::DEFAULT); - DataSet(const Attribute& attr, const void* ref, H5R_type_t ref_type = H5R_OBJECT, const PropList& plist = PropList::DEFAULT); + // Creates a dataset by way of dereference. + DataSet(const H5Location& loc, const void* ref, H5R_type_t ref_type = H5R_OBJECT, const PropList& plist = PropList::DEFAULT); + DataSet(const Attribute& attr, const void* ref, H5R_type_t ref_type = H5R_OBJECT, const PropList& plist = PropList::DEFAULT); - // Default constructor. - DataSet(); + // Default constructor. + DataSet(); - // Copy constructor. - DataSet( const DataSet& original ); + // Copy constructor. + DataSet(const DataSet& original); - // Creates a copy of an existing DataSet using its id. - DataSet(const hid_t existing_id); + // Creates a copy of an existing DataSet using its id. + DataSet(const hid_t existing_id); // Gets the dataset id. virtual hid_t getId() const; - // Destructor: properly terminates access to this dataset. - virtual ~DataSet(); + // Destructor: properly terminates access to this dataset. + virtual ~DataSet(); protected: #ifndef DOXYGEN_SHOULD_SKIP_THIS @@ -115,20 +115,20 @@ class H5_DLLCPP DataSet : public H5Object, public AbstractDs { #endif // DOXYGEN_SHOULD_SKIP_THIS private: - hid_t id; // HDF5 dataset id + hid_t id; // HDF5 dataset id // This function contains the common code that is used by // getTypeClass and various API functions getXxxType // defined in AbstractDs for generic datatype and specific // sub-types - virtual hid_t p_get_type() const; + virtual hid_t p_get_type() const; - // Reads variable or fixed len strings from this dataset. - void p_read_fixed_len(const hid_t mem_type_id, const hid_t mem_space_id, const hid_t file_space_id, const hid_t xfer_plist_id, H5std_string& strg) const; - void p_read_variable_len(const hid_t mem_type_id, const hid_t mem_space_id, const hid_t file_space_id, const hid_t xfer_plist_id, H5std_string& strg) const; + // Reads variable or fixed len strings from this dataset. + void p_read_fixed_len(const hid_t mem_type_id, const hid_t mem_space_id, const hid_t file_space_id, const hid_t xfer_plist_id, H5std_string& strg) const; + void p_read_variable_len(const hid_t mem_type_id, const hid_t mem_space_id, const hid_t file_space_id, const hid_t xfer_plist_id, H5std_string& strg) const; - // Friend function to set DataSet id. For library use only. - friend void f_DataSet_setId(DataSet* dset, hid_t new_id); + // Friend function to set DataSet id. For library use only. + friend void f_DataSet_setId(DataSet* dset, hid_t new_id); }; } diff --git a/c++/src/H5DataSpace.cpp b/c++/src/H5DataSpace.cpp index cb479e1..2587a72 100644 --- a/c++/src/H5DataSpace.cpp +++ b/c++/src/H5DataSpace.cpp @@ -38,14 +38,14 @@ using std::endl; DataSpace* DataSpace::ALL_ = 0; //-------------------------------------------------------------------------- -// Function: DataSpace::getConstant -// Creates a DataSpace object representing the HDF5 constant -// H5S_ALL, pointed to by DataSpace::ALL_ -// Exception H5::DataSpaceIException +// Function: DataSpace::getConstant +// Creates a DataSpace object representing the HDF5 constant +// H5S_ALL, pointed to by DataSpace::ALL_ +// Exception H5::DataSpaceIException // Description -// If DataSpace::ALL_ already points to an allocated object, throw -// a DataSpaceIException. This scenario should not happen. -// Programmer Binh-Minh Ribler - 2015 +// If DataSpace::ALL_ already points to an allocated object, throw +// a DataSpaceIException. This scenario should not happen. +// Programmer Binh-Minh Ribler - 2015 //-------------------------------------------------------------------------- DataSpace* DataSpace::getConstant() { @@ -78,55 +78,55 @@ void DataSpace::deleteConstants() } //-------------------------------------------------------------------------- -// Purpose Constant for default dataspace. +// Purpose Constant for default dataspace. //-------------------------------------------------------------------------- const DataSpace& DataSpace::ALL = *getConstant(); #endif // DOXYGEN_SHOULD_SKIP_THIS //-------------------------------------------------------------------------- -// Function: DataSpace constructor -///\brief Creates a new dataspace given a dataspace type. -///\param type - IN: Type of the dataspace to be created, which -/// currently can be either \c H5S_SCALAR or \c H5S_SIMPLE; -/// default to \c H5S_SCALAR. -///\exception H5::DataSpaceIException -// Programmer Binh-Minh Ribler - 2000 +// Function: DataSpace constructor +///\brief Creates a new dataspace given a dataspace type. +///\param type - IN: Type of the dataspace to be created, which +/// currently can be either \c H5S_SCALAR or \c H5S_SIMPLE; +/// default to \c H5S_SCALAR. +///\exception H5::DataSpaceIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- DataSpace::DataSpace(H5S_class_t type) : IdComponent() { - id = H5Screate( type ); - if( id < 0 ) - { - throw DataSpaceIException("DataSpace constructor", "H5Screate failed"); - } + id = H5Screate(type); + if (id < 0) + { + throw DataSpaceIException("DataSpace constructor", "H5Screate failed"); + } } //-------------------------------------------------------------------------- -// Function: DataSpace overloaded constructor -///\brief Creates a new simple dataspace. -///\param rank - IN: Number of dimensions of dataspace. -///\param dims - IN: An array of the size of each dimension. -///\param maxdims - IN: An array of the maximum size of each dimension. -///\exception H5::DataSpaceIException -// Programmer Binh-Minh Ribler - 2000 +// Function: DataSpace overloaded constructor +///\brief Creates a new simple dataspace. +///\param rank - IN: Number of dimensions of dataspace. +///\param dims - IN: An array of the size of each dimension. +///\param maxdims - IN: An array of the maximum size of each dimension. +///\exception H5::DataSpaceIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -DataSpace::DataSpace( int rank, const hsize_t * dims, const hsize_t * maxdims) : IdComponent() +DataSpace::DataSpace(int rank, const hsize_t * dims, const hsize_t * maxdims) : IdComponent() { - id = H5Screate_simple( rank, dims, maxdims ); - if( id < 0 ) - { - throw DataSpaceIException("DataSpace constructor", "H5Screate_simple failed"); - } + id = H5Screate_simple(rank, dims, maxdims); + if (id < 0) + { + throw DataSpaceIException("DataSpace constructor", "H5Screate_simple failed"); + } } //-------------------------------------------------------------------------- -// Function: DataSpace overloaded constructor -///\brief Creates a DataSpace object using the id of an existing -/// dataspace. -///\param existing_id - IN: Id of an existing dataspace -///\exception H5::DataSpaceIException -// Programmer Binh-Minh Ribler - 2000 +// Function: DataSpace overloaded constructor +///\brief Creates a DataSpace object using the id of an existing +/// dataspace. +///\param existing_id - IN: Id of an existing dataspace +///\exception H5::DataSpaceIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- DataSpace::DataSpace(const hid_t existing_id) : IdComponent(), id(existing_id) { @@ -134,10 +134,10 @@ DataSpace::DataSpace(const hid_t existing_id) : IdComponent(), id(existing_id) } //-------------------------------------------------------------------------- -// Function: DataSpace copy constructor -///\brief Copy constructor: makes a copy of the original DataSpace object. -///\param original - IN: DataSpace object to copy -// Programmer Binh-Minh Ribler - 2000 +// Function: DataSpace copy constructor +///\brief Copy constructor: makes a copy of the original DataSpace object. +///\param original - IN: DataSpace object to copy +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- DataSpace::DataSpace(const DataSpace& original) : IdComponent(), id(original.id) { @@ -145,48 +145,48 @@ DataSpace::DataSpace(const DataSpace& original) : IdComponent(), id(original.id) } //-------------------------------------------------------------------------- -// Function: DataSpace::copy -///\brief Makes a copy of an existing dataspace. -///\param like_space - IN: Dataspace to be copied -///\exception H5::DataSpaceIException -// Programmer Binh-Minh Ribler - 2000 +// Function: DataSpace::copy +///\brief Makes a copy of an existing dataspace. +///\param like_space - IN: Dataspace to be copied +///\exception H5::DataSpaceIException +// Programmer Binh-Minh Ribler - 2000 // Modification -// - Replaced resetIdComponent() with decRefCount() to use C -// library ID reference counting mechanism - BMR, Jun 1, 2004 -// - Replaced decRefCount with close() to let the C library -// handle the reference counting - BMR, Jun 1, 2006 -//-------------------------------------------------------------------------- -void DataSpace::copy( const DataSpace& like_space ) -{ - // If this object has an hdf5 valid id, close it - if( id != H5S_ALL ) { - try { - close(); - } - catch (Exception& close_error) { +// - Replaced resetIdComponent() with decRefCount() to use C +// library ID reference counting mechanism - BMR, Jun 1, 2004 +// - Replaced decRefCount with close() to let the C library +// handle the reference counting - BMR, Jun 1, 2006 +//-------------------------------------------------------------------------- +void DataSpace::copy(const DataSpace& like_space) +{ + // If this object has an hdf5 valid id, close it + if (id != H5S_ALL) { + try { + close(); + } + catch (Exception& close_error) { throw DataSpaceIException("DataSpace::copy", close_error.getDetailMsg()); - } - } // end if + } + } // end if - // call C routine to copy the dataspace - id = H5Scopy( like_space.getId() ); + // call C routine to copy the dataspace + id = H5Scopy(like_space.getId()); - if( id < 0 ) - throw DataSpaceIException("DataSpace::copy", "H5Scopy failed"); + if (id < 0) + throw DataSpaceIException("DataSpace::copy", "H5Scopy failed"); } //-------------------------------------------------------------------------- -// Function: DataSpace::operator= -///\brief Assignment operator. -///\param rhs - IN: Reference to the existing dataspace -///\return Reference to DataSpace instance -///\exception H5::DataSpaceIException +// Function: DataSpace::operator= +///\brief Assignment operator. +///\param rhs - IN: Reference to the existing dataspace +///\return Reference to DataSpace instance +///\exception H5::DataSpaceIException // Description -// Makes a copy of the type on the right hand side and stores -// the new id in the left hand side object. -// Programmer Binh-Minh Ribler - 2000 +// Makes a copy of the type on the right hand side and stores +// the new id in the left hand side object. +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -DataSpace& DataSpace::operator=( const DataSpace& rhs ) +DataSpace& DataSpace::operator=(const DataSpace& rhs) { if (this != &rhs) copy(rhs); @@ -194,435 +194,434 @@ DataSpace& DataSpace::operator=( const DataSpace& rhs ) } //-------------------------------------------------------------------------- -// Function: DataSpace::isSimple -///\brief Determines whether this dataspace is a simple dataspace. -///\return \c true if the dataspace is a simple dataspace, and \c false, -/// otherwise -///\exception H5::DataSpaceIException -// Programmer Binh-Minh Ribler - 2000 +// Function: DataSpace::isSimple +///\brief Determines whether this dataspace is a simple dataspace. +///\return \c true if the dataspace is a simple dataspace, and \c false, +/// otherwise +///\exception H5::DataSpaceIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- bool DataSpace::isSimple () const { - htri_t simple = H5Sis_simple( id ); - if( simple > 0 ) - return true; - else if( simple == 0 ) - return false; - else - { - throw DataSpaceIException("DataSpace::isSimple", - "H5Sis_simple returns negative value"); - } + htri_t simple = H5Sis_simple(id); + if (simple > 0) + return true; + else if (simple == 0) + return false; + else + { + throw DataSpaceIException("DataSpace::isSimple", + "H5Sis_simple returns negative value"); + } } //-------------------------------------------------------------------------- -// Function: DataSpace::offsetSimple -///\brief Sets the offset of this simple dataspace. -///\param offset - IN: Offset to position the selection at -///\exception H5::DataSpaceIException +// Function: DataSpace::offsetSimple +///\brief Sets the offset of this simple dataspace. +///\param offset - IN: Offset to position the selection at +///\exception H5::DataSpaceIException ///\par Description -/// This function creates an offset for the selection within -/// an extent, allowing the same shaped selection to be moved -/// to different locations within a dataspace without requiring -/// it to be re-defined. -// Programmer Binh-Minh Ribler - 2000 +/// This function creates an offset for the selection within +/// an extent, allowing the same shaped selection to be moved +/// to different locations within a dataspace without requiring +/// it to be re-defined. +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -void DataSpace::offsetSimple ( const hssize_t* offset ) const +void DataSpace::offsetSimple (const hssize_t* offset) const { - herr_t ret_value = H5Soffset_simple( id, offset ); - if( ret_value < 0 ) - { - throw DataSpaceIException("DataSpace::offsetSimple", "H5Soffset_simple failed"); - } + herr_t ret_value = H5Soffset_simple(id, offset); + if (ret_value < 0) + { + throw DataSpaceIException("DataSpace::offsetSimple", "H5Soffset_simple failed"); + } } //-------------------------------------------------------------------------- -// Function: DataSpace::getSimpleExtentDims -///\brief Retrieves dataspace dimension size and maximum size. -///\param dims - IN: Name of the new member -///\param maxdims - IN: Pointer to the value of the new member -///\return Number of dimensions, the same value as returned by -/// \c DataSpace::getSimpleExtentNdims() -///\exception H5::DataSpaceIException -// Programmer Binh-Minh Ribler - 2000 +// Function: DataSpace::getSimpleExtentDims +///\brief Retrieves dataspace dimension size and maximum size. +///\param dims - IN: Name of the new member +///\param maxdims - IN: Pointer to the value of the new member +///\return Number of dimensions, the same value as returned by +/// \c DataSpace::getSimpleExtentNdims() +///\exception H5::DataSpaceIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -int DataSpace::getSimpleExtentDims ( hsize_t *dims, hsize_t *maxdims ) const +int DataSpace::getSimpleExtentDims (hsize_t *dims, hsize_t *maxdims) const { - int ndims = H5Sget_simple_extent_dims( id, dims, maxdims ); - if( ndims < 0 ) - { - throw DataSpaceIException("DataSpace::getSimpleExtentDims", - "H5Sget_simple_extent_dims returns negative number of dimensions"); - } - return( ndims ); + int ndims = H5Sget_simple_extent_dims(id, dims, maxdims); + if (ndims < 0) + { + throw DataSpaceIException("DataSpace::getSimpleExtentDims", + "H5Sget_simple_extent_dims returns negative number of dimensions"); + } + return(ndims); } //-------------------------------------------------------------------------- -// Function: DataSpace::getSimpleExtentNdims -///\brief Returns the dimensionality of a dataspace. -///\return Number of dimensions -///\exception H5::DataSpaceIException -// Programmer Binh-Minh Ribler - 2000 +// Function: DataSpace::getSimpleExtentNdims +///\brief Returns the dimensionality of a dataspace. +///\return Number of dimensions +///\exception H5::DataSpaceIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- int DataSpace::getSimpleExtentNdims () const { - int ndims = H5Sget_simple_extent_ndims( id ); - if( ndims < 0 ) - { - throw DataSpaceIException("DataSpace::getSimpleExtentNdims", - "H5Sget_simple_extent_ndims returns negative value for dimensionality of the dataspace"); - } - return( ndims ); + int ndims = H5Sget_simple_extent_ndims(id); + if (ndims < 0) + { + throw DataSpaceIException("DataSpace::getSimpleExtentNdims", + "H5Sget_simple_extent_ndims returns negative value for dimensionality of the dataspace"); + } + return(ndims); } //-------------------------------------------------------------------------- -// Function: DataSpace::getSimpleExtentNpoints -///\brief Returns the number of elements in a dataspace. -///\return Number of elements -///\exception H5::DataSpaceIException +// Function: DataSpace::getSimpleExtentNpoints +///\brief Returns the number of elements in a dataspace. +///\return Number of elements +///\exception H5::DataSpaceIException // Modification -// 12/05/00: due to C API change -// return type hssize_t vs. hsize_t -// num_elements = -1 when failure occurs vs. 0 -// Programmer Binh-Minh Ribler - 2000 +// 12/05/00: due to C API change +// return type hssize_t vs. hsize_t +// num_elements = -1 when failure occurs vs. 0 +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- hssize_t DataSpace::getSimpleExtentNpoints () const { - hssize_t num_elements = H5Sget_simple_extent_npoints( id ); - - if( num_elements > -1 ) - return( num_elements ); - else - { - throw DataSpaceIException("DataSpace::getSimpleExtentNpoints", - "H5Sget_simple_extent_npoints returns negative value for the number of elements in the dataspace"); - } + hssize_t num_elements = H5Sget_simple_extent_npoints(id); + if (num_elements > -1) + return(num_elements); + else + { + throw DataSpaceIException("DataSpace::getSimpleExtentNpoints", + "H5Sget_simple_extent_npoints returns negative value for the number of elements in the dataspace"); + } } //-------------------------------------------------------------------------- -// Function: DataSpace::getSimpleExtentType -///\brief Returns the current class of a dataspace. -///\return Class of the dataspace -///\exception H5::DataSpaceIException -// Programmer Binh-Minh Ribler - 2000 +// Function: DataSpace::getSimpleExtentType +///\brief Returns the current class of a dataspace. +///\return Class of the dataspace +///\exception H5::DataSpaceIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- H5S_class_t DataSpace::getSimpleExtentType () const { - H5S_class_t class_name = H5Sget_simple_extent_type( id ); - if( class_name == H5S_NO_CLASS ) - { - throw DataSpaceIException("DataSpace::getSimpleExtentType", - "H5Sget_simple_extent_type returns H5S_NO_CLASS"); - } - return( class_name ); + H5S_class_t class_name = H5Sget_simple_extent_type(id); + if (class_name == H5S_NO_CLASS) + { + throw DataSpaceIException("DataSpace::getSimpleExtentType", + "H5Sget_simple_extent_type returns H5S_NO_CLASS"); + } + return(class_name); } //-------------------------------------------------------------------------- -// Function: DataSpace::extentCopy -///\brief Copies the extent of a dataspace. -///\param dest_space - IN: Dataspace to copy from -///\exception H5::DataSpaceIException -// Programmer Binh-Minh Ribler - 2000 +// Function: DataSpace::extentCopy +///\brief Copies the extent of a dataspace. +///\param dest_space - IN: Dataspace to copy from +///\exception H5::DataSpaceIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void DataSpace::extentCopy (const DataSpace& dest_space) const { - hid_t dest_space_id = dest_space.getId(); - herr_t ret_value = H5Sextent_copy( dest_space_id, id ); - if( ret_value < 0 ) - { - throw DataSpaceIException("DataSpace::extentCopy", "H5Sextent_copy failed"); - } + hid_t dest_space_id = dest_space.getId(); + herr_t ret_value = H5Sextent_copy(dest_space_id, id); + if (ret_value < 0) + { + throw DataSpaceIException("DataSpace::extentCopy", "H5Sextent_copy failed"); + } } //-------------------------------------------------------------------------- -// Function: DataSpace::extentCopy -// Purpose This is an overloaded member function, kept for backward -// compatibility. It differs from the above function in that it -// misses const. This wrapper will be removed in future release. -// Param dest_space - IN: Dataspace to copy from -// Exception H5::DataSpaceIException -// Programmer Binh-Minh Ribler - 2000 +// Function: DataSpace::extentCopy +// Purpose This is an overloaded member function, kept for backward +// compatibility. It differs from the above function in that it +// misses const. This wrapper will be removed in future release. +// Param dest_space - IN: Dataspace to copy from +// Exception H5::DataSpaceIException +// Programmer Binh-Minh Ribler - 2000 // Modification -// Modified to call its replacement. -BMR, 2014/04/16 -// Removed from documentation. -BMR, 2016/03/07 1.8.17 and 1.10.0 -// Removed from code. -BMR, 2016/08/11 1.8.18 and 1.10.1 +// Modified to call its replacement. -BMR, 2014/04/16 +// Removed from documentation. -BMR, 2016/03/07 1.8.17 and 1.10.0 +// Removed from code. -BMR, 2016/08/11 1.8.18 and 1.10.1 //-------------------------------------------------------------------------- -//void DataSpace::extentCopy( DataSpace& dest_space ) const +//void DataSpace::extentCopy(DataSpace& dest_space) const //{ // extentCopy(dest_space); //} //-------------------------------------------------------------------------- -// Function: DataSpace::setExtentSimple -///\brief Sets or resets the size of an existing dataspace. -///\param rank - IN: Rank of the dataspace -///\param current_size - IN: Array containing current size of dataspace -///\param maximum_size - IN: Array containing maximum size of dataspace -///\exception H5::DataSpaceIException -// Programmer Binh-Minh Ribler - 2000 +// Function: DataSpace::setExtentSimple +///\brief Sets or resets the size of an existing dataspace. +///\param rank - IN: Rank of the dataspace +///\param current_size - IN: Array containing current size of dataspace +///\param maximum_size - IN: Array containing maximum size of dataspace +///\exception H5::DataSpaceIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -void DataSpace::setExtentSimple( int rank, const hsize_t *current_size, const hsize_t *maximum_size ) const +void DataSpace::setExtentSimple(int rank, const hsize_t *current_size, const hsize_t *maximum_size) const { - herr_t ret_value; - ret_value = H5Sset_extent_simple( id, rank, current_size, maximum_size ); - if( ret_value < 0 ) - { - throw DataSpaceIException("DataSpace::setExtentSimple", "H5Sset_extent_simple failed"); - } + herr_t ret_value; + ret_value = H5Sset_extent_simple(id, rank, current_size, maximum_size); + if (ret_value < 0) + { + throw DataSpaceIException("DataSpace::setExtentSimple", "H5Sset_extent_simple failed"); + } } //-------------------------------------------------------------------------- -// Function: DataSpace::setExtentNone -///\brief Removes the extent from a dataspace. +// Function: DataSpace::setExtentNone +///\brief Removes the extent from a dataspace. /// -///\exception H5::DataSpaceIException -// Programmer Binh-Minh Ribler - 2000 +///\exception H5::DataSpaceIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void DataSpace::setExtentNone () const { - herr_t ret_value = H5Sset_extent_none( id ); - if( ret_value < 0 ) - { - throw DataSpaceIException("DataSpace::setExtentNone", "H5Sset_extent_none failed"); - } + herr_t ret_value = H5Sset_extent_none(id); + if (ret_value < 0) + { + throw DataSpaceIException("DataSpace::setExtentNone", "H5Sset_extent_none failed"); + } } //-------------------------------------------------------------------------- -// Function: DataSpace::getSelectNpoints -///\brief Returns the number of elements in a dataspace selection. -///\return Number of elements -///\exception H5::DataSpaceIException -// Programmer Binh-Minh Ribler - 2000 +// Function: DataSpace::getSelectNpoints +///\brief Returns the number of elements in a dataspace selection. +///\return Number of elements +///\exception H5::DataSpaceIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- hssize_t DataSpace::getSelectNpoints () const { - hssize_t num_elements = H5Sget_select_npoints( id ); - if( num_elements < 0 ) - { - throw DataSpaceIException("DataSpace::getSelectNpoints", - "H5Sget_select_npoints returns negative value for number of elements in the dataspace selection"); - } - return( num_elements ); + hssize_t num_elements = H5Sget_select_npoints(id); + if (num_elements < 0) + { + throw DataSpaceIException("DataSpace::getSelectNpoints", + "H5Sget_select_npoints returns negative value for number of elements in the dataspace selection"); + } + return(num_elements); } //-------------------------------------------------------------------------- -// Function: DataSpace::getSelectHyperNblocks -///\brief Returns number of hyperslab blocks. -///\return Number of hyperslab blocks -///\exception H5::DataSpaceIException -// Programmer Binh-Minh Ribler - 2000 +// Function: DataSpace::getSelectHyperNblocks +///\brief Returns number of hyperslab blocks. +///\return Number of hyperslab blocks +///\exception H5::DataSpaceIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- hssize_t DataSpace::getSelectHyperNblocks () const { - hssize_t num_blocks = H5Sget_select_hyper_nblocks( id ); - if( num_blocks < 0 ) - { - throw DataSpaceIException("DataSpace::getSelectHyperNblocks", - "H5Sget_select_hyper_nblocks returns negative value for the number of hyperslab blocks"); - } - return( num_blocks ); + hssize_t num_blocks = H5Sget_select_hyper_nblocks(id); + if (num_blocks < 0) + { + throw DataSpaceIException("DataSpace::getSelectHyperNblocks", + "H5Sget_select_hyper_nblocks returns negative value for the number of hyperslab blocks"); + } + return(num_blocks); } //-------------------------------------------------------------------------- -// Function: DataSpace::getSelectHyperBlocklist -///\brief Gets the list of hyperslab blocks currently selected -///\param startblock - IN: Hyperslab block to start with -///\param numblocks - IN: Number of hyperslab blocks to get -///\param buf - IN: List of hyperslab blocks selected -///\exception H5::DataSpaceIException -// Programmer Binh-Minh Ribler - 2000 +// Function: DataSpace::getSelectHyperBlocklist +///\brief Gets the list of hyperslab blocks currently selected +///\param startblock - IN: Hyperslab block to start with +///\param numblocks - IN: Number of hyperslab blocks to get +///\param buf - IN: List of hyperslab blocks selected +///\exception H5::DataSpaceIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -void DataSpace::getSelectHyperBlocklist( hsize_t startblock, hsize_t numblocks, hsize_t *buf ) const +void DataSpace::getSelectHyperBlocklist(hsize_t startblock, hsize_t numblocks, hsize_t *buf) const { - herr_t ret_value; - ret_value = H5Sget_select_hyper_blocklist( id, startblock, numblocks, buf ); - if( ret_value < 0 ) - { - throw DataSpaceIException("DataSpace::getSelectHyperBlocklist", - "H5Sget_select_hyper_blocklist failed"); - } + herr_t ret_value; + ret_value = H5Sget_select_hyper_blocklist(id, startblock, numblocks, buf); + if (ret_value < 0) + { + throw DataSpaceIException("DataSpace::getSelectHyperBlocklist", + "H5Sget_select_hyper_blocklist failed"); + } } //-------------------------------------------------------------------------- -// Function: DataSpace::getSelectElemNpoints -///\brief Returns the number of element points in the current selection. -///\return Number of element points -///\exception H5::DataSpaceIException -// Programmer Binh-Minh Ribler - 2000 +// Function: DataSpace::getSelectElemNpoints +///\brief Returns the number of element points in the current selection. +///\return Number of element points +///\exception H5::DataSpaceIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- hssize_t DataSpace::getSelectElemNpoints () const { - hssize_t num_points = H5Sget_select_elem_npoints( id ); - if( num_points < 0 ) - { - throw DataSpaceIException("DataSpace::getSelectElemNpoints", - "H5Sget_select_elem_npoints failed"); - } - return( num_points ); + hssize_t num_points = H5Sget_select_elem_npoints(id); + if (num_points < 0) + { + throw DataSpaceIException("DataSpace::getSelectElemNpoints", + "H5Sget_select_elem_npoints failed"); + } + return(num_points); } //-------------------------------------------------------------------------- -// Function: DataSpace::getSelectElemPointlist -///\brief Gets the list of element points currently selected -///\param startpoint - IN: Element point to start with -///\param numpoints - IN: Number of element points to get -///\param buf - IN: List of element points selected -///\exception H5::DataSpaceIException +// Function: DataSpace::getSelectElemPointlist +///\brief Gets the list of element points currently selected +///\param startpoint - IN: Element point to start with +///\param numpoints - IN: Number of element points to get +///\param buf - IN: List of element points selected +///\exception H5::DataSpaceIException ///\par Description -/// For more information, please refer to the C layer Reference -/// Manual at: +/// For more information, please refer to the C layer Reference +/// Manual at: /// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5S.html#Dataspace-SelectElemPointList -// Programmer Binh-Minh Ribler - 2000 +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -void DataSpace::getSelectElemPointlist ( hsize_t startpoint, hsize_t numpoints, hsize_t *buf ) const +void DataSpace::getSelectElemPointlist (hsize_t startpoint, hsize_t numpoints, hsize_t *buf) const { - herr_t ret_value; - ret_value = H5Sget_select_elem_pointlist( id, startpoint, numpoints, buf ); - if( ret_value < 0 ) - { - throw DataSpaceIException("DataSpace::getSelectElemPointlist", - "H5Sget_select_elem_pointlist failed"); - } + herr_t ret_value; + ret_value = H5Sget_select_elem_pointlist(id, startpoint, numpoints, buf); + if (ret_value < 0) + { + throw DataSpaceIException("DataSpace::getSelectElemPointlist", + "H5Sget_select_elem_pointlist failed"); + } } //-------------------------------------------------------------------------- -// Function: DataSpace::getSelectBounds -///\brief Gets the bounding box containing the current selection. -///\param start - IN: Starting coordinates of the bounding box -///\param end - IN: Ending coordinates of the bounding box, i.e., -/// the coordinates of the diagonally opposite corner -///\exception H5::DataSpaceIException +// Function: DataSpace::getSelectBounds +///\brief Gets the bounding box containing the current selection. +///\param start - IN: Starting coordinates of the bounding box +///\param end - IN: Ending coordinates of the bounding box, i.e., +/// the coordinates of the diagonally opposite corner +///\exception H5::DataSpaceIException ///\par Description -/// For more information, please refer to the C layer Reference -/// Manual at: +/// For more information, please refer to the C layer Reference +/// Manual at: /// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5S.html#Dataspace-SelectBounds -// Programmer Binh-Minh Ribler - 2000 +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -void DataSpace::getSelectBounds ( hsize_t* start, hsize_t* end ) const +void DataSpace::getSelectBounds (hsize_t* start, hsize_t* end) const { - herr_t ret_value = H5Sget_select_bounds( id, start, end ); - if( ret_value < 0 ) - { - throw DataSpaceIException("DataSpace::getSelectBounds", - "H5Sget_select_bounds failed"); - } + herr_t ret_value = H5Sget_select_bounds(id, start, end); + if (ret_value < 0) + { + throw DataSpaceIException("DataSpace::getSelectBounds", + "H5Sget_select_bounds failed"); + } } //-------------------------------------------------------------------------- -// Function: DataSpace::selectElements -///\brief Selects array elements to be included in the selection for -/// this dataspace. -///\param op - IN: Operator specifying how the new selection is to be -/// combined with the existing selection for the dataspace -///\param num_elements - IN: Number of elements to be selected -///\param coord - IN: A 2-dimensional array of 0-based values -/// specifying the coordinates of the elements being selected -///\exception H5::DataSpaceIException +// Function: DataSpace::selectElements +///\brief Selects array elements to be included in the selection for +/// this dataspace. +///\param op - IN: Operator specifying how the new selection is to be +/// combined with the existing selection for the dataspace +///\param num_elements - IN: Number of elements to be selected +///\param coord - IN: A 2-dimensional array of 0-based values +/// specifying the coordinates of the elements being selected +///\exception H5::DataSpaceIException ///\par Description -/// For more information, please refer to the C layer Reference -/// Manual at: +/// For more information, please refer to the C layer Reference +/// Manual at: /// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5S.html#Dataspace-SelectElements -// Programmer Binh-Minh Ribler - 2000 +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -void DataSpace::selectElements ( H5S_seloper_t op, const size_t num_elements, const hsize_t *coord) const +void DataSpace::selectElements (H5S_seloper_t op, const size_t num_elements, const hsize_t *coord) const { - herr_t ret_value; - ret_value = H5Sselect_elements( id, op, num_elements, coord ); - if( ret_value < 0 ) - { - throw DataSpaceIException("DataSpace::selectElements", - "H5Sselect_elements failed"); - } + herr_t ret_value; + ret_value = H5Sselect_elements(id, op, num_elements, coord); + if (ret_value < 0) + { + throw DataSpaceIException("DataSpace::selectElements", + "H5Sselect_elements failed"); + } } //-------------------------------------------------------------------------- -// Function: DataSpace::selectAll -///\brief Selects the entire dataspace. +// Function: DataSpace::selectAll +///\brief Selects the entire dataspace. /// -///\exception H5::DataSpaceIException -// Programmer Binh-Minh Ribler - 2000 +///\exception H5::DataSpaceIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void DataSpace::selectAll () const { - herr_t ret_value = H5Sselect_all( id ); - if( ret_value < 0 ) - { - throw DataSpaceIException("DataSpace::selectAll", "H5Sselect_all failed"); - } + herr_t ret_value = H5Sselect_all(id); + if (ret_value < 0) + { + throw DataSpaceIException("DataSpace::selectAll", "H5Sselect_all failed"); + } } //-------------------------------------------------------------------------- -// Function: DataSpace::selectNone -///\brief Resets the selection region to include no elements. +// Function: DataSpace::selectNone +///\brief Resets the selection region to include no elements. /// -///\exception H5::DataSpaceIException -// Programmer Binh-Minh Ribler - 2000 +///\exception H5::DataSpaceIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void DataSpace::selectNone () const { - herr_t ret_value = H5Sselect_none( id ); - if( ret_value < 0 ) - { - throw DataSpaceIException("DataSpace::selectNone", - "H5Sselect_none failed"); - } + herr_t ret_value = H5Sselect_none(id); + if (ret_value < 0) + { + throw DataSpaceIException("DataSpace::selectNone", + "H5Sselect_none failed"); + } } //-------------------------------------------------------------------------- -// Function: DataSpace::selectValid -///\brief Verifies that the selection is within the extent of the -/// dataspace. -///\return \c true if the selection is within the extent of the -/// dataspace, and \c false, otherwise -///\exception H5::DataSpaceIException -// Programmer Binh-Minh Ribler - 2000 +// Function: DataSpace::selectValid +///\brief Verifies that the selection is within the extent of the +/// dataspace. +///\return \c true if the selection is within the extent of the +/// dataspace, and \c false, otherwise +///\exception H5::DataSpaceIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- bool DataSpace::selectValid () const { - htri_t ret_value = H5Sselect_valid( id ); - if( ret_value > 0 ) - return true; - else if( ret_value == 0 ) - return false; - else - { - throw DataSpaceIException("DataSpace::selectValid", - "H5Sselect_valid returns negative value"); - } -} - -//-------------------------------------------------------------------------- -// Function: DataSpace::selectHyperslab -///\brief Selects a hyperslab region to add to the current selected region. -///\param op - IN: Operation to perform on current selection -///\param count - IN: Number of blocks included in the hyperslab -///\param start - IN: Offset of the start of hyperslab -///\param stride - IN: Hyperslab stride - default to \c NULL -///\param block - IN: Size of block in the hyperslab - default to \c NULL -///\exception H5::DataSpaceIException + htri_t ret_value = H5Sselect_valid(id); + if (ret_value > 0) + return true; + else if (ret_value == 0) + return false; + else + { + throw DataSpaceIException("DataSpace::selectValid", + "H5Sselect_valid returns negative value"); + } +} + +//-------------------------------------------------------------------------- +// Function: DataSpace::selectHyperslab +///\brief Selects a hyperslab region to add to the current selected region. +///\param op - IN: Operation to perform on current selection +///\param count - IN: Number of blocks included in the hyperslab +///\param start - IN: Offset of the start of hyperslab +///\param stride - IN: Hyperslab stride - default to \c NULL +///\param block - IN: Size of block in the hyperslab - default to \c NULL +///\exception H5::DataSpaceIException ///\par Description -/// For more information, please refer to the C layer Reference -/// Manual at: +/// For more information, please refer to the C layer Reference +/// Manual at: /// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5S.html#Dataspace-SelectHyperslab -// Programmer Binh-Minh Ribler - 2000 +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -void DataSpace::selectHyperslab( H5S_seloper_t op, const hsize_t *count, const hsize_t *start, const hsize_t *stride, const hsize_t *block ) const +void DataSpace::selectHyperslab(H5S_seloper_t op, const hsize_t *count, const hsize_t *start, const hsize_t *stride, const hsize_t *block) const { - herr_t ret_value; - ret_value = H5Sselect_hyperslab( id, op, start, stride, count, block ); - if( ret_value < 0 ) - { - throw DataSpaceIException("DataSpace::selectHyperslab", - "H5Sselect_hyperslab failed"); - } + herr_t ret_value; + ret_value = H5Sselect_hyperslab(id, op, start, stride, count, block); + if (ret_value < 0) + { + throw DataSpaceIException("DataSpace::selectHyperslab", + "H5Sselect_hyperslab failed"); + } } //-------------------------------------------------------------------------- // Function: DataSpace::getId -///\brief Get the id of this dataspace -///\return Dataspace identifier +///\brief Get the id of this dataspace +///\return Dataspace identifier // Modification: -// May 2008 - BMR +// May 2008 - BMR // Class hierarchy is revised to address bugzilla 1068. Class // AbstractDS and Attribute are moved out of H5Object. In // addition, member IdComponent::id is moved into subclasses, and @@ -631,7 +630,7 @@ void DataSpace::selectHyperslab( H5S_seloper_t op, const hsize_t *count, const h //-------------------------------------------------------------------------- hid_t DataSpace::getId() const { - return(id); + return(id); } #ifndef DOXYGEN_SHOULD_SKIP_THIS @@ -656,49 +655,49 @@ void DataSpace::p_setId(const hid_t new_id) catch (Exception& close_error) { throw DataSpaceIException(inMemFunc("p_setId"), close_error.getDetailMsg()); } - // reset object's id to the given id - id = new_id; + // reset object's id to the given id + id = new_id; } #endif // DOXYGEN_SHOULD_SKIP_THIS //-------------------------------------------------------------------------- -// Function: DataSpace::close -///\brief Closes this dataspace. +// Function: DataSpace::close +///\brief Closes this dataspace. /// -///\exception H5::DataSpaceIException -// Programmer Binh-Minh Ribler - Mar 9, 2005 +///\exception H5::DataSpaceIException +// Programmer Binh-Minh Ribler - Mar 9, 2005 //-------------------------------------------------------------------------- void DataSpace::close() { // check if id is a valid hdf5 object id before trying to close it if (p_valid_id(id)) { - herr_t ret_value = H5Sclose(id); - if( ret_value < 0 ) - { - throw DataSpaceIException("DataSpace::close", "H5Sclose failed"); - } - // reset the id - id = H5I_INVALID_HID; + herr_t ret_value = H5Sclose(id); + if (ret_value < 0) + { + throw DataSpaceIException("DataSpace::close", "H5Sclose failed"); + } + // reset the id + id = H5I_INVALID_HID; } } //-------------------------------------------------------------------------- -// Function: DataSpace destructor -///\brief Properly terminates access to this dataspace. -// Programmer Binh-Minh Ribler - 2000 +// Function: DataSpace destructor +///\brief Properly terminates access to this dataspace. +// Programmer Binh-Minh Ribler - 2000 // Modification -// - Replaced resetIdComponent() with decRefCount() to use C -// library ID reference counting mechanism - BMR, Jun 1, 2004 -// - Replaced decRefCount with close() to let the C library -// handle the reference counting - BMR, Jun 1, 2006 +// - Replaced resetIdComponent() with decRefCount() to use C +// library ID reference counting mechanism - BMR, Jun 1, 2004 +// - Replaced decRefCount with close() to let the C library +// handle the reference counting - BMR, Jun 1, 2006 //-------------------------------------------------------------------------- DataSpace::~DataSpace() { try { - close(); + close(); } catch (Exception& close_error) { - cerr << "DataSpace::~DataSpace - " << close_error.getDetailMsg() << endl; + cerr << "DataSpace::~DataSpace - " << close_error.getDetailMsg() << endl; } } diff --git a/c++/src/H5DataSpace.h b/c++/src/H5DataSpace.h index e76bc72..969e146 100644 --- a/c++/src/H5DataSpace.h +++ b/c++/src/H5DataSpace.h @@ -27,126 +27,126 @@ namespace H5 { */ class H5_DLLCPP DataSpace : public IdComponent { public: - ///\brief Default DataSpace objects - static const DataSpace& ALL; + ///\brief Default DataSpace objects + static const DataSpace& ALL; - // Creates a dataspace object given the space type - DataSpace(H5S_class_t type = H5S_SCALAR); + // Creates a dataspace object given the space type + DataSpace(H5S_class_t type = H5S_SCALAR); - // Creates a simple dataspace - DataSpace(int rank, const hsize_t * dims, const hsize_t * maxdims = NULL); + // Creates a simple dataspace + DataSpace(int rank, const hsize_t * dims, const hsize_t * maxdims = NULL); - // Creates a DataSpace object using an existing dataspace id. - DataSpace(const hid_t space_id); + // Creates a DataSpace object using an existing dataspace id. + DataSpace(const hid_t space_id); - // Copy constructor: makes a copy of the original DataSpace object. - DataSpace(const DataSpace& original); + // Copy constructor: makes a copy of the original DataSpace object. + DataSpace(const DataSpace& original); - // Assignment operator - DataSpace& operator=( const DataSpace& rhs ); + // Assignment operator + DataSpace& operator=(const DataSpace& rhs); - // Closes this dataspace. - virtual void close(); + // Closes this dataspace. + virtual void close(); - // Makes copy of an existing dataspace. - void copy(const DataSpace& like_space); + // Makes copy of an existing dataspace. + void copy(const DataSpace& like_space); - // Copies the extent of this dataspace. - void extentCopy(const DataSpace& dest_space) const; - // removed from 1.8.18 and 1.10.1 - //void extentCopy(DataSpace& dest_space) const; + // Copies the extent of this dataspace. + void extentCopy(const DataSpace& dest_space) const; + // removed from 1.8.18 and 1.10.1 + //void extentCopy(DataSpace& dest_space) const; - // Gets the bounding box containing the current selection. - void getSelectBounds( hsize_t* start, hsize_t* end ) const; + // Gets the bounding box containing the current selection. + void getSelectBounds(hsize_t* start, hsize_t* end) const; - // Gets the number of element points in the current selection. - hssize_t getSelectElemNpoints() const; + // Gets the number of element points in the current selection. + hssize_t getSelectElemNpoints() const; - // Retrieves the list of element points currently selected. - void getSelectElemPointlist( hsize_t startpoint, hsize_t numpoints, hsize_t *buf ) const; + // Retrieves the list of element points currently selected. + void getSelectElemPointlist(hsize_t startpoint, hsize_t numpoints, hsize_t *buf) const; - // Gets the list of hyperslab blocks currently selected. - void getSelectHyperBlocklist( hsize_t startblock, hsize_t numblocks, hsize_t *buf ) const; + // Gets the list of hyperslab blocks currently selected. + void getSelectHyperBlocklist(hsize_t startblock, hsize_t numblocks, hsize_t *buf) const; - // Get number of hyperslab blocks. - hssize_t getSelectHyperNblocks() const; + // Get number of hyperslab blocks. + hssize_t getSelectHyperNblocks() const; - // Gets the number of elements in this dataspace selection. - hssize_t getSelectNpoints() const; + // Gets the number of elements in this dataspace selection. + hssize_t getSelectNpoints() const; - // Retrieves dataspace dimension size and maximum size. - int getSimpleExtentDims( hsize_t *dims, hsize_t *maxdims = NULL ) const; + // Retrieves dataspace dimension size and maximum size. + int getSimpleExtentDims(hsize_t *dims, hsize_t *maxdims = NULL) const; - // Gets the dimensionality of this dataspace. - int getSimpleExtentNdims() const; + // Gets the dimensionality of this dataspace. + int getSimpleExtentNdims() const; - // Gets the number of elements in this dataspace. - // 12/05/00 - changed return type to hssize_t from hsize_t - C API - hssize_t getSimpleExtentNpoints() const; + // Gets the number of elements in this dataspace. + // 12/05/00 - changed return type to hssize_t from hsize_t - C API + hssize_t getSimpleExtentNpoints() const; - // Gets the current class of this dataspace. - H5S_class_t getSimpleExtentType() const; + // Gets the current class of this dataspace. + H5S_class_t getSimpleExtentType() const; - // Determines if this dataspace is a simple one. - bool isSimple() const; + // Determines if this dataspace is a simple one. + bool isSimple() const; - // Sets the offset of this simple dataspace. - void offsetSimple( const hssize_t* offset ) const; + // Sets the offset of this simple dataspace. + void offsetSimple(const hssize_t* offset) const; - // Selects the entire dataspace. - void selectAll() const; + // Selects the entire dataspace. + void selectAll() const; - // Selects array elements to be included in the selection for - // this dataspace. - void selectElements( H5S_seloper_t op, const size_t num_elements, const hsize_t *coord) const; + // Selects array elements to be included in the selection for + // this dataspace. + void selectElements(H5S_seloper_t op, const size_t num_elements, const hsize_t *coord) const; - // Selects a hyperslab region to add to the current selected region. - void selectHyperslab( H5S_seloper_t op, const hsize_t *count, const hsize_t *start, const hsize_t *stride = NULL, const hsize_t *block = NULL ) const; + // Selects a hyperslab region to add to the current selected region. + void selectHyperslab(H5S_seloper_t op, const hsize_t *count, const hsize_t *start, const hsize_t *stride = NULL, const hsize_t *block = NULL) const; - // Resets the selection region to include no elements. - void selectNone() const; + // Resets the selection region to include no elements. + void selectNone() const; - // Verifies that the selection is within the extent of the dataspace. - bool selectValid() const; + // Verifies that the selection is within the extent of the dataspace. + bool selectValid() const; - // Removes the extent from this dataspace. - void setExtentNone() const; + // Removes the extent from this dataspace. + void setExtentNone() const; - // Sets or resets the size of this dataspace. - void setExtentSimple( int rank, const hsize_t *current_size, const hsize_t *maximum_size = NULL ) const; + // Sets or resets the size of this dataspace. + void setExtentSimple(int rank, const hsize_t *current_size, const hsize_t *maximum_size = NULL) const; - ///\brief Returns this class name. - virtual H5std_string fromClass () const { return("DataSpace"); } + ///\brief Returns this class name. + virtual H5std_string fromClass () const { return("DataSpace"); } - // Gets the dataspace id. - virtual hid_t getId() const; + // Gets the dataspace id. + virtual hid_t getId() const; - // Deletes the global constant - static void deleteConstants(); + // Deletes the global constant + static void deleteConstants(); - // Destructor: properly terminates access to this dataspace. - virtual ~DataSpace(); + // Destructor: properly terminates access to this dataspace. + virtual ~DataSpace(); #ifndef DOXYGEN_SHOULD_SKIP_THIS protected: - // Sets the dataspace id. - virtual void p_setId(const hid_t new_id); + // Sets the dataspace id. + virtual void p_setId(const hid_t new_id); #endif // DOXYGEN_SHOULD_SKIP_THIS private: - hid_t id; // HDF5 dataspace id + hid_t id; // HDF5 dataspace id #ifndef DOXYGEN_SHOULD_SKIP_THIS - static DataSpace* ALL_; + static DataSpace* ALL_; - // Creates the global constant - static DataSpace* getConstant(); + // Creates the global constant + static DataSpace* getConstant(); - // Friend function to set DataSpace id. For library use only. - friend void f_DataSpace_setId(DataSpace *dspace, hid_t new_id); + // Friend function to set DataSpace id. For library use only. + friend void f_DataSpace_setId(DataSpace *dspace, hid_t new_id); #endif // DOXYGEN_SHOULD_SKIP_THIS }; diff --git a/c++/src/H5DataType.cpp b/c++/src/H5DataType.cpp index 372b2c9..ae48d16 100644 --- a/c++/src/H5DataType.cpp +++ b/c++/src/H5DataType.cpp @@ -46,24 +46,24 @@ using std::cerr; using std::endl; //-------------------------------------------------------------------------- -// Function: DataType default constructor -///\brief Default constructor: Creates a stub datatype -// Programmer Binh-Minh Ribler - 2000 +// Function: DataType default constructor +///\brief Default constructor: Creates a stub datatype +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- DataType::DataType() : H5Object(), id(H5I_INVALID_HID) {} //-------------------------------------------------------------------------- -// Function: DataType overloaded constructor -///\brief Creates a datatype using an existing datatype's id -///\param existing_id - IN: Id of the existing datatype +// Function: DataType overloaded constructor +///\brief Creates a datatype using an existing datatype's id +///\param existing_id - IN: Id of the existing datatype // Description -// Constructor creates a copy of an existing DataType using -// its id. -// Programmer Binh-Minh Ribler - 2000 +// Constructor creates a copy of an existing DataType using +// its id. +// Programmer Binh-Minh Ribler - 2000 // Modification -// Dec, 2005 -// Removed second argument, "predefined", after changing to the -// new ref counting mechanism that relies on C's ref counting. +// Dec, 2005 +// Removed second argument, "predefined", after changing to the +// new ref counting mechanism that relies on C's ref counting. //-------------------------------------------------------------------------- DataType::DataType(const hid_t existing_id) : H5Object(), id(existing_id) { @@ -71,36 +71,36 @@ DataType::DataType(const hid_t existing_id) : H5Object(), id(existing_id) } //-------------------------------------------------------------------------- -// Function: DataType overloaded constructor -///\brief Creates a object given its class and size -///\param type_class - IN: Class of datatype to create -///\param size - IN: Number of bytes in the datatype to create -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 +// Function: DataType overloaded constructor +///\brief Creates a object given its class and size +///\param type_class - IN: Class of datatype to create +///\param size - IN: Number of bytes in the datatype to create +///\exception H5::DataTypeIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -DataType::DataType( const H5T_class_t type_class, size_t size ) : H5Object() +DataType::DataType(const H5T_class_t type_class, size_t size) : H5Object() { - // Call C routine to create the new datatype - id = H5Tcreate( type_class, size ); - if( id < 0 ) - { - throw DataTypeIException("DataType constructor", "H5Tcreate failed"); - } + // Call C routine to create the new datatype + id = H5Tcreate(type_class, size); + if (id < 0) + { + throw DataTypeIException("DataType constructor", "H5Tcreate failed"); + } } //-------------------------------------------------------------------------- -// Function: DataType overload constructor - dereference -///\brief Given a reference, ref, to an hdf5 group, creates a -/// DataType object +// Function: DataType overload constructor - dereference +///\brief Given a reference, ref, to an hdf5 group, creates a +/// DataType object ///\param loc - IN: Location referenced object is in -///\param ref - IN: Reference pointer -///\param ref_type - IN: Reference type - default to H5R_OBJECT -///\param plist - IN: Property list - default to PropList::DEFAULT -///\exception H5::ReferenceException -// Programmer Binh-Minh Ribler - Oct, 2006 +///\param ref - IN: Reference pointer +///\param ref_type - IN: Reference type - default to H5R_OBJECT +///\param plist - IN: Property list - default to PropList::DEFAULT +///\exception H5::ReferenceException +// Programmer Binh-Minh Ribler - Oct, 2006 // Modification -// Jul, 2008 -// Added for application convenience. +// Jul, 2008 +// Added for application convenience. //-------------------------------------------------------------------------- DataType::DataType(const H5Location& loc, const void* ref, H5R_type_t ref_type, const PropList& plist) : H5Object() { @@ -108,18 +108,18 @@ DataType::DataType(const H5Location& loc, const void* ref, H5R_type_t ref_type, } //-------------------------------------------------------------------------- -// Function: DataType overload constructor - dereference -///\brief Given a reference, ref, to an hdf5 group, creates a -/// DataType object +// Function: DataType overload constructor - dereference +///\brief Given a reference, ref, to an hdf5 group, creates a +/// DataType object ///\param attr - IN: Specifying location where the referenced object is in -///\param ref - IN: Reference pointer -///\param ref_type - IN: Reference type - default to H5R_OBJECT -///\param plist - IN: Property list - default to PropList::DEFAULT -///\exception H5::ReferenceException -// Programmer Binh-Minh Ribler - Oct, 2006 +///\param ref - IN: Reference pointer +///\param ref_type - IN: Reference type - default to H5R_OBJECT +///\param plist - IN: Property list - default to PropList::DEFAULT +///\exception H5::ReferenceException +// Programmer Binh-Minh Ribler - Oct, 2006 // Modification -// Jul, 2008 -// Added for application convenience. +// Jul, 2008 +// Added for application convenience. //-------------------------------------------------------------------------- /* DataType::DataType(const Attribute& attr, const void* ref, H5R_type_t ref_type, const PropList& plist) : H5Object(), id(H5I_INVALID_HID) { @@ -128,9 +128,9 @@ DataType::DataType(const H5Location& loc, const void* ref, H5R_type_t ref_type, */ //-------------------------------------------------------------------------- -// Function: DataType copy constructor -///\brief Copy constructor: makes a copy of the original DataType object -// Programmer Binh-Minh Ribler - 2000 +// Function: DataType copy constructor +///\brief Copy constructor: makes a copy of the original DataType object +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- DataType::DataType(const DataType& original) : H5Object(), id(original.id) { @@ -144,32 +144,32 @@ DataType::DataType(const DataType& original) : H5Object(), id(original.id) ///\exception H5::DataTypeIException // Programmer Binh-Minh Ribler - 2015 // Description -// Copying the type so that when a predefined type is passed in, -// a copy of it is made, not just a duplicate of the HDF5 id. -// Note: calling DataType::copy will invoke DataType::close() -// unnecessarily and will produce undefined behavior. -// -BMR, Apr 2015 +// Copying the type so that when a predefined type is passed in, +// a copy of it is made, not just a duplicate of the HDF5 id. +// Note: calling DataType::copy will invoke DataType::close() +// unnecessarily and will produce undefined behavior. +// -BMR, Apr 2015 //-------------------------------------------------------------------------- DataType::DataType(const PredType& pred_type) : H5Object() { // Call C routine to copy the datatype - id = H5Tcopy( pred_type.getId() ); + id = H5Tcopy(pred_type.getId()); if (id < 0) - throw DataTypeIException("DataType constructor", "H5Tcopy failed"); + throw DataTypeIException("DataType constructor", "H5Tcopy failed"); } //-------------------------------------------------------------------------- // Function: DataType overloaded constructor ///\brief Creates a DataType instance by opening an HDF5 datatype given -/// its name as a char*. +/// its name as a char*. ///\param dtype_name - IN: Datatype name ///\exception H5::DataTypeIException // Programmer Binh-Minh Ribler - Dec 2016 // Description -// In 1.10.1, this constructor was introduced and will replace the -// existing function CommonFG::openDataType(const char*) to -// improve usability. -// -BMR, Dec 2016 +// In 1.10.1, this constructor was introduced and will replace the +// existing function CommonFG::openDataType(const char*) to +// improve usability. +// -BMR, Dec 2016 //-------------------------------------------------------------------------- DataType::DataType(const H5Location& loc, const char *dtype_name) : H5Object() { @@ -178,16 +178,16 @@ DataType::DataType(const H5Location& loc, const char *dtype_name) : H5Object() //-------------------------------------------------------------------------- // Function: DataType overloaded constructor -///\brief Creates a DataType instance by opening an HDF5 datatype given -/// its name as an \c H5std_string. +///\brief Creates a DataType instance by opening an HDF5 datatype given +/// its name as an \c H5std_string. ///\param dtype_name - IN: Datatype name ///\exception H5::DataTypeIException // Programmer Binh-Minh Ribler - Dec 2016 // Description -// In 1.10.1, this constructor was introduced and will replace the -// existing function CommonFG::openDataType(const H5std_string&) to -// improve usability. -// -BMR, Dec 2016 +// In 1.10.1, this constructor was introduced and will replace the +// existing function CommonFG::openDataType(const H5std_string&) to +// improve usability. +// -BMR, Dec 2016 //-------------------------------------------------------------------------- DataType::DataType(const H5Location& loc, const H5std_string& dtype_name) : H5Object() { @@ -195,108 +195,108 @@ DataType::DataType(const H5Location& loc, const H5std_string& dtype_name) : H5Ob } //-------------------------------------------------------------------------- -// Function: DataType::copy -///\brief Copies an existing datatype to this datatype object -///\param like_type - IN: Datatype to be copied -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 +// Function: DataType::copy +///\brief Copies an existing datatype to this datatype object +///\param like_type - IN: Datatype to be copied +///\exception H5::DataTypeIException +// Programmer Binh-Minh Ribler - 2000 // Modification -// - Replaced resetIdComponent() with decRefCount() to use C -// library ID reference counting mechanism - BMR, Jun 1, 2004 -// - Replaced decRefCount with close() to let the C library -// handle the reference counting - BMR, Jun 1, 2006 +// - Replaced resetIdComponent() with decRefCount() to use C +// library ID reference counting mechanism - BMR, Jun 1, 2004 +// - Replaced decRefCount with close() to let the C library +// handle the reference counting - BMR, Jun 1, 2006 //-------------------------------------------------------------------------- -void DataType::copy( const DataType& like_type ) +void DataType::copy(const DataType& like_type) { // close the current data type before copying like_type to this object try { - close(); + close(); } catch (Exception& close_error) { - throw DataTypeIException(inMemFunc("copy"), close_error.getDetailMsg()); + throw DataTypeIException(inMemFunc("copy"), close_error.getDetailMsg()); } // call C routine to copy the datatype - id = H5Tcopy( like_type.getId() ); - if( id < 0 ) - throw DataTypeIException(inMemFunc("copy"), "H5Tcopy failed"); + id = H5Tcopy(like_type.getId()); + if (id < 0) + throw DataTypeIException(inMemFunc("copy"), "H5Tcopy failed"); } //-------------------------------------------------------------------------- -// Function: DataType::copy -///\brief Copies the datatype of the given dataset to this datatype object -///\param dset - IN: Dataset -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - Jan, 2007 +// Function: DataType::copy +///\brief Copies the datatype of the given dataset to this datatype object +///\param dset - IN: Dataset +///\exception H5::DataTypeIException +// Programmer Binh-Minh Ribler - Jan, 2007 ///\par Description -/// The resulted dataset will be transient and modifiable. +/// The resulted dataset will be transient and modifiable. //-------------------------------------------------------------------------- void DataType::copy(const DataSet& dset) { // close the current data type before copying dset's datatype to this object try { - close(); + close(); } catch (Exception& close_error) { - throw DataTypeIException(inMemFunc("copy"), close_error.getDetailMsg()); + throw DataTypeIException(inMemFunc("copy"), close_error.getDetailMsg()); } // call C routine to copy the datatype - id = H5Tcopy( dset.getId() ); - if( id < 0 ) - throw DataTypeIException(inMemFunc("copy"), "H5Tcopy failed"); + id = H5Tcopy(dset.getId()); + if (id < 0) + throw DataTypeIException(inMemFunc("copy"), "H5Tcopy failed"); } //-------------------------------------------------------------------------- -// Function: DataType::operator= -///\brief Assignment operator -///\param rhs - IN: Reference to the existing datatype -///\return Reference to DataType instance -///\exception H5::DataTypeIException +// Function: DataType::operator= +///\brief Assignment operator +///\param rhs - IN: Reference to the existing datatype +///\return Reference to DataType instance +///\exception H5::DataTypeIException // Description -// Makes a copy of the type on the right hand side and stores -// the new id in the left hand side object. -// Programmer Binh-Minh Ribler - 2000 +// Makes a copy of the type on the right hand side and stores +// the new id in the left hand side object. +// Programmer Binh-Minh Ribler - 2000 // Modification -// Changed operator= to simply copy the id of rhs instead of -// calling H5Tcopy because, when the operator= is invoked, a -// different datatype id is created and it won't have the same -// characteristics as the original one, specifically, if the -// rhs represents a named datatype, "this" would still be a -// transient datatype. -// BMR - Mar, 2015 +// Changed operator= to simply copy the id of rhs instead of +// calling H5Tcopy because, when the operator= is invoked, a +// different datatype id is created and it won't have the same +// characteristics as the original one, specifically, if the +// rhs represents a named datatype, "this" would still be a +// transient datatype. +// BMR - Mar, 2015 //-------------------------------------------------------------------------- -DataType& DataType::operator=( const DataType& rhs ) +DataType& DataType::operator=(const DataType& rhs) { if (this != &rhs) { - setId(rhs.id); + setId(rhs.id); } return(*this); } //-------------------------------------------------------------------------- -// Function: DataType::operator== -///\brief Compares this DataType against the given one to determines -/// whether the two objects refer to the same actual datatype. -///\param compared_type - IN: Reference to the datatype to compare -///\return true if the datatypes are equal, and false, otherwise. -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 +// Function: DataType::operator== +///\brief Compares this DataType against the given one to determines +/// whether the two objects refer to the same actual datatype. +///\param compared_type - IN: Reference to the datatype to compare +///\return true if the datatypes are equal, and false, otherwise. +///\exception H5::DataTypeIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -bool DataType::operator==(const DataType& compared_type ) const +bool DataType::operator==(const DataType& compared_type) const { - // Call C routine H5Tequal to determines whether two datatype - // identifiers refer to the same datatype - htri_t ret_value = H5Tequal( id, compared_type.getId() ); - if( ret_value > 0 ) - return true; - else if( ret_value == 0 ) - return false; - else - { - throw DataTypeIException(inMemFunc("operator=="), "H5Tequal returns negative value"); - } + // Call C routine H5Tequal to determines whether two datatype + // identifiers refer to the same datatype + htri_t ret_value = H5Tequal(id, compared_type.getId()); + if (ret_value > 0) + return true; + else if (ret_value == 0) + return false; + else + { + throw DataTypeIException(inMemFunc("operator=="), "H5Tequal returns negative value"); + } } //-------------------------------------------------------------------------- @@ -306,69 +306,69 @@ bool DataType::operator==(const DataType& compared_type ) const ///\exception H5::DataTypeIException // Programmer Binh-Minh Ribler - Dec 2016 // Description -// This function was introduced in 1.10.1 to be used by the new -// XxxType constructors that were introduced to replace the -// existing functions CommonFG::openXxxType(), which is awkward -// to use. -BMR, Dec 2016 +// This function was introduced in 1.10.1 to be used by the new +// XxxType constructors that were introduced to replace the +// existing functions CommonFG::openXxxType(), which is awkward +// to use. -BMR, Dec 2016 //-------------------------------------------------------------------------- hid_t DataType::p_opentype(const H5Location& loc, const char *dtype_name) const { // Call C function to open the named datatype at this location hid_t ret_value = H5Topen2(loc.getId(), dtype_name, H5P_DEFAULT); if (ret_value < 0) - throw DataTypeIException("DataType constructor", "H5Topen2 failed"); + throw DataTypeIException("DataType constructor", "H5Topen2 failed"); return(ret_value); } //-------------------------------------------------------------------------- -// Function: DataType::p_commit (private) -//\brief Commits a transient datatype to a file, creating a new -// named datatype -//\param loc_id - IN: The id of either a file, group, dataset, named -// datatype, or attribute. -//\param name - IN: Name of the datatype -//\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 +// Function: DataType::p_commit (private) +//\brief Commits a transient datatype to a file, creating a new +// named datatype +//\param loc_id - IN: The id of either a file, group, dataset, named +// datatype, or attribute. +//\param name - IN: Name of the datatype +//\exception H5::DataTypeIException +// Programmer Binh-Minh Ribler - 2000 // Modification: -// Copied from DataType::commit and made into private function -// to be commonly used by several overloads of DataType::commit. -// BMR - Jan, 2007 +// Copied from DataType::commit and made into private function +// to be commonly used by several overloads of DataType::commit. +// BMR - Jan, 2007 //-------------------------------------------------------------------------- void DataType::p_commit(hid_t loc_id, const char* name) { - // Call C routine to commit the transient datatype - herr_t ret_value = H5Tcommit2(loc_id, name, id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if( ret_value < 0 ) - throw DataTypeIException(inMemFunc("p_commit"), "H5Tcommit2 failed"); + // Call C routine to commit the transient datatype + herr_t ret_value = H5Tcommit2(loc_id, name, id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + if (ret_value < 0) + throw DataTypeIException(inMemFunc("p_commit"), "H5Tcommit2 failed"); } //-------------------------------------------------------------------------- -// Function: DataType::commit -///\brief Commits a transient datatype to a file, creating a new -/// named datatype -///\param loc - IN: A location (file, dataset, datatype, or group) -///\param name - IN: Name of the datatype -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - Jan, 2007 +// Function: DataType::commit +///\brief Commits a transient datatype to a file, creating a new +/// named datatype +///\param loc - IN: A location (file, dataset, datatype, or group) +///\param name - IN: Name of the datatype +///\exception H5::DataTypeIException +// Programmer Binh-Minh Ribler - Jan, 2007 //-------------------------------------------------------------------------- void DataType::commit(const H5Location& loc, const char* name) { - p_commit(loc.getId(), name); + p_commit(loc.getId(), name); } //-------------------------------------------------------------------------- -// Function: DataType::commit -// Purpose This is an overloaded member function, kept for backward -// compatibility. It differs from the above function in that it -// misses const's. This wrapper will be removed in future release. -// Param loc - IN: A location (file, dataset, datatype, or group) -// Param name - IN: Name of the datatype -// Exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - Jan, 2007 +// Function: DataType::commit +// Purpose This is an overloaded member function, kept for backward +// compatibility. It differs from the above function in that it +// misses const's. This wrapper will be removed in future release. +// Param loc - IN: A location (file, dataset, datatype, or group) +// Param name - IN: Name of the datatype +// Exception H5::DataTypeIException +// Programmer Binh-Minh Ribler - Jan, 2007 // Modification -// Planned for removal. -BMR, 2014/04/16 -// Removed from documentation. -BMR, 2016/03/07 1.8.17 and 1.10.0 -// Removed from code. -BMR, 2016/08/11 1.8.18 and 1.10.1 +// Planned for removal. -BMR, 2014/04/16 +// Removed from documentation. -BMR, 2016/03/07 1.8.17 and 1.10.0 +// Removed from code. -BMR, 2016/08/11 1.8.18 and 1.10.1 //-------------------------------------------------------------------------- //void DataType::commit(H5Location& loc, const char* name) //{ @@ -376,30 +376,30 @@ void DataType::commit(const H5Location& loc, const char* name) //} //-------------------------------------------------------------------------- -// Function: DataType::commit -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function only in the type of the -/// argument \a name. -// Programmer Binh-Minh Ribler - 2000 +// Function: DataType::commit +///\brief This is an overloaded member function, provided for convenience. +/// It differs from the above function only in the type of the +/// argument \a name. +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void DataType::commit(const H5Location& loc, const H5std_string& name) { - p_commit(loc.getId(), name.c_str()); + p_commit(loc.getId(), name.c_str()); } //-------------------------------------------------------------------------- -// Function: DataType::commit -// Purpose This is an overloaded member function, kept for backward -// compatibility. It differs from the above function in that it -// misses const's. This wrapper will be removed in future release. -// Param loc - IN: A location (file, dataset, datatype, or group) -// Param name - IN: Name of the datatype -// Exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - Jan, 2007 +// Function: DataType::commit +// Purpose This is an overloaded member function, kept for backward +// compatibility. It differs from the above function in that it +// misses const's. This wrapper will be removed in future release. +// Param loc - IN: A location (file, dataset, datatype, or group) +// Param name - IN: Name of the datatype +// Exception H5::DataTypeIException +// Programmer Binh-Minh Ribler - Jan, 2007 // Modification -// Planned for removal. -BMR, 2014/04/16 -// Removed from documentation. -BMR, 2016/03/07 1.8.17 and 1.10.0 -// Removed from code. -BMR, 2016/08/11 1.8.18 and 1.10.1 +// Planned for removal. -BMR, 2014/04/16 +// Removed from documentation. -BMR, 2016/03/07 1.8.17 and 1.10.0 +// Removed from code. -BMR, 2016/08/11 1.8.18 and 1.10.1 //-------------------------------------------------------------------------- //void DataType::commit(H5Location& loc, const H5std_string& name) //{ @@ -407,340 +407,340 @@ void DataType::commit(const H5Location& loc, const H5std_string& name) //} //-------------------------------------------------------------------------- -// Function: DataType::committed -///\brief Determines whether a datatype is a named type or a -/// transient type. -///\return \c true if the datatype is a named type, and \c false, -/// otherwise. -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 +// Function: DataType::committed +///\brief Determines whether a datatype is a named type or a +/// transient type. +///\return \c true if the datatype is a named type, and \c false, +/// otherwise. +///\exception H5::DataTypeIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- bool DataType::committed() const { - // Call C function to determine if a datatype is a named one - htri_t is_committed = H5Tcommitted( id ); - if (is_committed > 0) - return true; - else if (is_committed == 0) - return false; - else - { - throw DataTypeIException(inMemFunc("committed"), "H5Tcommitted return negative value"); - } -} - -//-------------------------------------------------------------------------- -// Function: DataType::find -///\brief Finds a conversion function that can handle a conversion -/// from this datatype to the specified datatype, \a dest. -///\param dest - IN: Destination datatype -///\param pcdata - IN: Pointer to type conversion data -///\return Pointer to a suitable conversion function -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -H5T_conv_t DataType::find( const DataType& dest, H5T_cdata_t **pcdata ) const -{ - // Call C routine to find the conversion function - H5T_conv_t func = H5Tfind( id, dest.getId(), pcdata ); - if( func == NULL ) - { - throw DataTypeIException(inMemFunc("find"), "H5Tfind returns a NULL function"); - } - return( func ); -} - -//-------------------------------------------------------------------------- -// Function: DataType::convert -///\brief Converts data from this datatype to the specified datatypes. -///\param dest - IN: Destination datatype -///\param nelmts - IN: Size of array \a buf -///\param buf - IN/OUT: Array containing pre- and post-conversion -/// values -///\param background - IN: Optional backgroud buffer -///\param plist - IN: Property list - default to PropList::DEFAULT -///\return Pointer to a suitable conversion function -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -void DataType::convert( const DataType& dest, size_t nelmts, void *buf, void *background, const PropList& plist ) const -{ - // Get identifiers for C API - hid_t dest_id = dest.getId(); - hid_t plist_id = plist.getId(); - - // Call C routine H5Tconvert to convert the data - herr_t ret_value; - ret_value = H5Tconvert( id, dest_id, nelmts, buf, background, plist_id ); - if( ret_value < 0 ) - { - throw DataTypeIException(inMemFunc("convert"), "H5Tconvert failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: DataType::lock -///\brief Locks a datatype, making it read-only and non-destructible. + // Call C function to determine if a datatype is a named one + htri_t is_committed = H5Tcommitted(id); + if (is_committed > 0) + return true; + else if (is_committed == 0) + return false; + else + { + throw DataTypeIException(inMemFunc("committed"), "H5Tcommitted return negative value"); + } +} + +//-------------------------------------------------------------------------- +// Function: DataType::find +///\brief Finds a conversion function that can handle a conversion +/// from this datatype to the specified datatype, \a dest. +///\param dest - IN: Destination datatype +///\param pcdata - IN: Pointer to type conversion data +///\return Pointer to a suitable conversion function +///\exception H5::DataTypeIException +// Programmer Binh-Minh Ribler - 2000 +//-------------------------------------------------------------------------- +H5T_conv_t DataType::find(const DataType& dest, H5T_cdata_t **pcdata) const +{ + // Call C routine to find the conversion function + H5T_conv_t func = H5Tfind(id, dest.getId(), pcdata); + if (func == NULL) + { + throw DataTypeIException(inMemFunc("find"), "H5Tfind returns a NULL function"); + } + return(func); +} + +//-------------------------------------------------------------------------- +// Function: DataType::convert +///\brief Converts data from this datatype to the specified datatypes. +///\param dest - IN: Destination datatype +///\param nelmts - IN: Size of array \a buf +///\param buf - IN/OUT: Array containing pre- and post-conversion +/// values +///\param background - IN: Optional backgroud buffer +///\param plist - IN: Property list - default to PropList::DEFAULT +///\return Pointer to a suitable conversion function +///\exception H5::DataTypeIException +// Programmer Binh-Minh Ribler - 2000 +//-------------------------------------------------------------------------- +void DataType::convert(const DataType& dest, size_t nelmts, void *buf, void *background, const PropList& plist) const +{ + // Get identifiers for C API + hid_t dest_id = dest.getId(); + hid_t plist_id = plist.getId(); + + // Call C routine H5Tconvert to convert the data + herr_t ret_value; + ret_value = H5Tconvert(id, dest_id, nelmts, buf, background, plist_id); + if (ret_value < 0) + { + throw DataTypeIException(inMemFunc("convert"), "H5Tconvert failed"); + } +} + +//-------------------------------------------------------------------------- +// Function: DataType::lock +///\brief Locks a datatype, making it read-only and non-destructible. /// -///\exception H5::DataTypeIException +///\exception H5::DataTypeIException ///\par Descrition -/// This is normally done by the library for predefined data -/// types so the application doesn't inadvertently change or -/// delete a predefined type. +/// This is normally done by the library for predefined data +/// types so the application doesn't inadvertently change or +/// delete a predefined type. /// -/// Once a data type is locked it can never be unlocked unless -/// the entire library is closed. -// Programmer Binh-Minh Ribler - 2000 +/// Once a data type is locked it can never be unlocked unless +/// the entire library is closed. +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void DataType::lock() const { - // Call C routine to lock the datatype - herr_t ret_value = H5Tlock( id ); - if( ret_value < 0 ) - { - throw DataTypeIException(inMemFunc("lock"), "H5Tlock failed"); - } + // Call C routine to lock the datatype + herr_t ret_value = H5Tlock(id); + if (ret_value < 0) + { + throw DataTypeIException(inMemFunc("lock"), "H5Tlock failed"); + } } //-------------------------------------------------------------------------- -// Function: DataType::getClass -///\brief Returns the datatype class identifier. -///\return Datatype class identifier -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 +// Function: DataType::getClass +///\brief Returns the datatype class identifier. +///\return Datatype class identifier +///\exception H5::DataTypeIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- H5T_class_t DataType::getClass() const { - H5T_class_t type_class = H5Tget_class( id ); + H5T_class_t type_class = H5Tget_class(id); - // Return datatype class identifier if successful - if( type_class == H5T_NO_CLASS ) - { - throw DataTypeIException(inMemFunc("getClass"), "H5Tget_class returns H5T_NO_CLASS"); - } - return( type_class ); + // Return datatype class identifier if successful + if (type_class == H5T_NO_CLASS) + { + throw DataTypeIException(inMemFunc("getClass"), "H5Tget_class returns H5T_NO_CLASS"); + } + return(type_class); } //-------------------------------------------------------------------------- -// Function: DataType::getSize -///\brief Returns the size of a datatype. -///\return Datatype size in bytes -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 +// Function: DataType::getSize +///\brief Returns the size of a datatype. +///\return Datatype size in bytes +///\exception H5::DataTypeIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- size_t DataType::getSize() const { - // Call C routine to get the datatype size - size_t type_size = H5Tget_size( id ); - if( type_size <= 0 ) // valid data types are never zero size - { - throw DataTypeIException(inMemFunc("getSize"), "H5Tget_size returns invalid datatype size"); - } - return( type_size ); + // Call C routine to get the datatype size + size_t type_size = H5Tget_size(id); + if (type_size <= 0) // valid data types are never zero size + { + throw DataTypeIException(inMemFunc("getSize"), "H5Tget_size returns invalid datatype size"); + } + return(type_size); } //-------------------------------------------------------------------------- -// Function: DataType::getSuper -///\brief Returns the base datatype from which a datatype is derived. -///\return DataType object -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 +// Function: DataType::getSuper +///\brief Returns the base datatype from which a datatype is derived. +///\return DataType object +///\exception H5::DataTypeIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- DataType DataType::getSuper() const { - // Call C routine to get the base datatype from which the specified - // datatype is derived. - hid_t base_type_id = H5Tget_super( id ); - - // If H5Tget_super returns a valid datatype id, create and return - // the base type, otherwise, raise exception - if( base_type_id > 0 ) - { - DataType base_type; - base_type.p_setId(base_type_id); - return(base_type); - } - else - { - throw DataTypeIException(inMemFunc("getSuper"), "H5Tget_super failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: DataType::registerFunc -///\brief Registers the specified conversion function. -///\param pers - IN: Conversion option -/// \li \c H5T_PERS_HARD for hard conversion functions -/// \li \c H5T_PERS_SOFT for soft conversion functions. -///\param name - IN: Name displayed in diagnostic output. -///\param dest - IN: Destination datatype. -///\param func - IN: Function to convert between source and -/// destination datatypes. -///\exception H5::DataTypeIException + // Call C routine to get the base datatype from which the specified + // datatype is derived. + hid_t base_type_id = H5Tget_super(id); + + // If H5Tget_super returns a valid datatype id, create and return + // the base type, otherwise, raise exception + if (base_type_id > 0) + { + DataType base_type; + base_type.p_setId(base_type_id); + return(base_type); + } + else + { + throw DataTypeIException(inMemFunc("getSuper"), "H5Tget_super failed"); + } +} + +//-------------------------------------------------------------------------- +// Function: DataType::registerFunc +///\brief Registers the specified conversion function. +///\param pers - IN: Conversion option +/// \li \c H5T_PERS_HARD for hard conversion functions +/// \li \c H5T_PERS_SOFT for soft conversion functions. +///\param name - IN: Name displayed in diagnostic output. +///\param dest - IN: Destination datatype. +///\param func - IN: Function to convert between source and +/// destination datatypes. +///\exception H5::DataTypeIException ///\par Description -/// For more information, please see: +/// For more information, please see: /// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5T.html#Datatype-Register -// Programmer Binh-Minh Ribler - 2000 +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -void DataType::registerFunc( H5T_pers_t pers, const char* name, const DataType& dest, H5T_conv_t func ) const +void DataType::registerFunc(H5T_pers_t pers, const char* name, const DataType& dest, H5T_conv_t func) const { - hid_t dest_id = dest.getId(); // get id of the destination datatype + hid_t dest_id = dest.getId(); // get id of the destination datatype - // Call C routine H5Tregister to register the conversion function - herr_t ret_value = H5Tregister( pers, name, id, dest_id, func ); - if( ret_value < 0 ) - { - throw DataTypeIException(inMemFunc("registerFunc"), "H5Tregister failed"); - } + // Call C routine H5Tregister to register the conversion function + herr_t ret_value = H5Tregister(pers, name, id, dest_id, func); + if (ret_value < 0) + { + throw DataTypeIException(inMemFunc("registerFunc"), "H5Tregister failed"); + } } //-------------------------------------------------------------------------- -// Function: DataType::registerFunc -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function only in the type of the -/// argument \a name. -// Programmer Binh-Minh Ribler - 2000 +// Function: DataType::registerFunc +///\brief This is an overloaded member function, provided for convenience. +/// It differs from the above function only in the type of the +/// argument \a name. +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -void DataType::registerFunc( H5T_pers_t pers, const H5std_string& name, const DataType& dest, H5T_conv_t func ) const +void DataType::registerFunc(H5T_pers_t pers, const H5std_string& name, const DataType& dest, H5T_conv_t func) const { - registerFunc( pers, name.c_str(), dest, func ); + registerFunc(pers, name.c_str(), dest, func); } //-------------------------------------------------------------------------- -// Function: DataType::unregister -///\brief Removes a conversion function from all conversion paths. -///\param pers - IN: Conversion option -/// \li \c H5T_PERS_HARD for hard conversion functions -/// \li \c H5T_PERS_SOFT for soft conversion functions. -///\param name - IN: Name displayed in diagnostic output. -///\param dest - IN: Destination datatype. -///\param func - IN: Function to convert between source and -/// destination datatypes. -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 +// Function: DataType::unregister +///\brief Removes a conversion function from all conversion paths. +///\param pers - IN: Conversion option +/// \li \c H5T_PERS_HARD for hard conversion functions +/// \li \c H5T_PERS_SOFT for soft conversion functions. +///\param name - IN: Name displayed in diagnostic output. +///\param dest - IN: Destination datatype. +///\param func - IN: Function to convert between source and +/// destination datatypes. +///\exception H5::DataTypeIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -void DataType::unregister( H5T_pers_t pers, const char* name, const DataType& dest, H5T_conv_t func ) const +void DataType::unregister(H5T_pers_t pers, const char* name, const DataType& dest, H5T_conv_t func) const { - hid_t dest_id = dest.getId(); // get id of the dest datatype for C API + hid_t dest_id = dest.getId(); // get id of the dest datatype for C API - // Call C routine H5Tunregister to remove the conversion function - herr_t ret_value = H5Tunregister( pers, name, id, dest_id, func ); - if( ret_value < 0 ) - { - throw DataTypeIException(inMemFunc("unregister"), "H5Tunregister failed"); - } + // Call C routine H5Tunregister to remove the conversion function + herr_t ret_value = H5Tunregister(pers, name, id, dest_id, func); + if (ret_value < 0) + { + throw DataTypeIException(inMemFunc("unregister"), "H5Tunregister failed"); + } } //-------------------------------------------------------------------------- -// Function: DataType::unregister -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function only in the type of the -/// argument \a name. -// Programmer Binh-Minh Ribler - 2000 +// Function: DataType::unregister +///\brief This is an overloaded member function, provided for convenience. +/// It differs from the above function only in the type of the +/// argument \a name. +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -void DataType::unregister( H5T_pers_t pers, const H5std_string& name, const DataType& dest, H5T_conv_t func ) const +void DataType::unregister(H5T_pers_t pers, const H5std_string& name, const DataType& dest, H5T_conv_t func) const { - unregister( pers, name.c_str(), dest, func ); + unregister(pers, name.c_str(), dest, func); } //-------------------------------------------------------------------------- -// Function: DataType::setTag -///\brief Tags an opaque datatype. -///\param tag - IN: Descriptive ASCII string with which the opaque -/// datatype is to be tagged. -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 +// Function: DataType::setTag +///\brief Tags an opaque datatype. +///\param tag - IN: Descriptive ASCII string with which the opaque +/// datatype is to be tagged. +///\exception H5::DataTypeIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -void DataType::setTag( const char* tag ) const +void DataType::setTag(const char* tag) const { - // Call C routine H5Tset_tag to tag an opaque datatype. - herr_t ret_value = H5Tset_tag( id, tag ); - if( ret_value < 0 ) - { - throw DataTypeIException(inMemFunc("setTag"), "H5Tset_tag failed"); - } + // Call C routine H5Tset_tag to tag an opaque datatype. + herr_t ret_value = H5Tset_tag(id, tag); + if (ret_value < 0) + { + throw DataTypeIException(inMemFunc("setTag"), "H5Tset_tag failed"); + } } //-------------------------------------------------------------------------- -// Function: DataType::setTag -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function only in the type of the -/// argument \a name. -// Programmer Binh-Minh Ribler - 2000 +// Function: DataType::setTag +///\brief This is an overloaded member function, provided for convenience. +/// It differs from the above function only in the type of the +/// argument \a name. +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -void DataType::setTag( const H5std_string& tag ) const +void DataType::setTag(const H5std_string& tag) const { - setTag( tag.c_str()); + setTag(tag.c_str()); } //-------------------------------------------------------------------------- -// Function: DataType::getTag -///\brief Gets the tag associated with an opaque datatype. -///\return Tag associated with the opaque datatype -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 +// Function: DataType::getTag +///\brief Gets the tag associated with an opaque datatype. +///\return Tag associated with the opaque datatype +///\exception H5::DataTypeIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- H5std_string DataType::getTag() const { - char* tag_Cstr = H5Tget_tag( id ); + char* tag_Cstr = H5Tget_tag(id); // if the tag C-string returned is not NULL, convert it to C++ string // and return it, otherwise, raise an exception - if( tag_Cstr != NULL ) + if (tag_Cstr != NULL) { - H5std_string tag = H5std_string(tag_Cstr); // C string to string object - H5free_memory(tag_Cstr); // free the C string - return (tag); // return the tag + H5std_string tag = H5std_string(tag_Cstr); // C string to string object + H5free_memory(tag_Cstr); // free the C string + return (tag); // return the tag } else { - throw DataTypeIException(inMemFunc("getTag"), "H5Tget_tag returns NULL for tag"); + throw DataTypeIException(inMemFunc("getTag"), "H5Tget_tag returns NULL for tag"); } } //-------------------------------------------------------------------------- -// Function: DataType::detectClass -///\brief Checks whether a datatype contains (or is) a certain type of -/// datatype. -///\return true if this datatype contains or is the specified type, -/// and false, otherwise. -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - May, 2004 +// Function: DataType::detectClass +///\brief Checks whether a datatype contains (or is) a certain type of +/// datatype. +///\return true if this datatype contains or is the specified type, +/// and false, otherwise. +///\exception H5::DataTypeIException +// Programmer Binh-Minh Ribler - May, 2004 //-------------------------------------------------------------------------- bool DataType::detectClass(H5T_class_t cls) const { - htri_t ret_value = H5Tdetect_class(id, cls); - if( ret_value > 0 ) - return true; - else if( ret_value == 0 ) - return false; - else - { - throw DataTypeIException(inMemFunc("detectClass"), - "H5Tdetect_class returns negative value"); - } + htri_t ret_value = H5Tdetect_class(id, cls); + if (ret_value > 0) + return true; + else if (ret_value == 0) + return false; + else + { + throw DataTypeIException(inMemFunc("detectClass"), + "H5Tdetect_class returns negative value"); + } } //-------------------------------------------------------------------------- -// Function: DataType::isVariableStr -///\brief Check whether this datatype is a variable-length string. -///\return true if this datatype is a variable-length string, and -/// false, otherwise. -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - May, 2004 +// Function: DataType::isVariableStr +///\brief Check whether this datatype is a variable-length string. +///\return true if this datatype is a variable-length string, and +/// false, otherwise. +///\exception H5::DataTypeIException +// Programmer Binh-Minh Ribler - May, 2004 //-------------------------------------------------------------------------- bool DataType::isVariableStr() const { - htri_t is_varlen_str = H5Tis_variable_str(id); - if( is_varlen_str == 1 ) - return true; - else if( is_varlen_str == 0 ) - return false; - else - { - throw DataTypeIException(inMemFunc("isVariableStr"), - "H5Tis_variable_str returns negative value"); - } + htri_t is_varlen_str = H5Tis_variable_str(id); + if (is_varlen_str == 1) + return true; + else if (is_varlen_str == 0) + return false; + else + { + throw DataTypeIException(inMemFunc("isVariableStr"), + "H5Tis_variable_str returns negative value"); + } } //-------------------------------------------------------------------------- @@ -757,7 +757,7 @@ bool DataType::isVariableStr() const //-------------------------------------------------------------------------- hid_t DataType::getId() const { - return(id); + return(id); } #ifndef DOXYGEN_SHOULD_SKIP_THIS @@ -782,58 +782,58 @@ void DataType::p_setId(const hid_t new_id) catch (Exception& close_error) { throw DataTypeIException(inMemFunc("p_setId"), close_error.getDetailMsg()); } - // reset object's id to the given id - id = new_id; + // reset object's id to the given id + id = new_id; } #endif // DOXYGEN_SHOULD_SKIP_THIS //-------------------------------------------------------------------------- -// Function: DataType::close -///\brief Closes the datatype if it is not a predefined type. +// Function: DataType::close +///\brief Closes the datatype if it is not a predefined type. /// -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - Mar 9, 2005 +///\exception H5::DataTypeIException +// Programmer Binh-Minh Ribler - Mar 9, 2005 //-------------------------------------------------------------------------- void DataType::close() { if (p_valid_id(id)) { - herr_t ret_value = H5Tclose(id); - if( ret_value < 0 ) - { - throw DataTypeIException(inMemFunc("close"), "H5Tclose failed"); - } - // reset the id - id = H5I_INVALID_HID; + herr_t ret_value = H5Tclose(id); + if (ret_value < 0) + { + throw DataTypeIException(inMemFunc("close"), "H5Tclose failed"); + } + // reset the id + id = H5I_INVALID_HID; } } //-------------------------------------------------------------------------- -// Function: DataType destructor -///\brief Properly terminates access to this datatype. -// Programmer Binh-Minh Ribler - 2000 +// Function: DataType destructor +///\brief Properly terminates access to this datatype. +// Programmer Binh-Minh Ribler - 2000 // Modification -// - Replaced resetIdComponent() with decRefCount() to use C -// library ID reference counting mechanism - BMR, Jun 1, 2004 -// - Replaced decRefCount with close() to let the C library -// handle the reference counting - BMR, Jun 1, 2006 -// - Added the use of H5CPP_EXITED to terminate the HDF5 library -// and elimiate previous memory leaks. See comments in the -// header file "H5PredType.h" for details. - BMR, Mar 30, 2012 -// - Major re-implementation of the global constants was done -// to avoid relying on the order of the creation and deletion -// of the global constants. Hence, H5CPP_EXITED was removed. -// See Design Notes in "H5PredType.cpp" for details. -// - BMR, Sep 30, 2015 +// - Replaced resetIdComponent() with decRefCount() to use C +// library ID reference counting mechanism - BMR, Jun 1, 2004 +// - Replaced decRefCount with close() to let the C library +// handle the reference counting - BMR, Jun 1, 2006 +// - Added the use of H5CPP_EXITED to terminate the HDF5 library +// and elimiate previous memory leaks. See comments in the +// header file "H5PredType.h" for details. - BMR, Mar 30, 2012 +// - Major re-implementation of the global constants was done +// to avoid relying on the order of the creation and deletion +// of the global constants. Hence, H5CPP_EXITED was removed. +// See Design Notes in "H5PredType.cpp" for details. +// - BMR, Sep 30, 2015 //-------------------------------------------------------------------------- DataType::~DataType() { try { - close(); + close(); } catch (Exception& close_error) { - cerr << inMemFunc("~DataType - ") << close_error.getDetailMsg() << endl; + cerr << inMemFunc("~DataType - ") << close_error.getDetailMsg() << endl; } } } // end namespace diff --git a/c++/src/H5DataType.h b/c++/src/H5DataType.h index 4e904a6..fd9c17d 100644 --- a/c++/src/H5DataType.h +++ b/c++/src/H5DataType.h @@ -30,128 +30,128 @@ namespace H5 { */ class H5_DLLCPP DataType : public H5Object { public: - // Creates a datatype given its class and size - DataType( const H5T_class_t type_class, size_t size ); + // Creates a datatype given its class and size + DataType(const H5T_class_t type_class, size_t size); - // Copy constructor: makes a copy of the original object - DataType( const DataType& original ); + // Copy constructor: makes a copy of the original object + DataType(const DataType& original); - // Creates a copy of a predefined type - DataType(const PredType& pred_type); + // Creates a copy of a predefined type + DataType(const PredType& pred_type); - // Creates a datatype by way of dereference. - DataType(const H5Location& loc, const void* ref, H5R_type_t ref_type = H5R_OBJECT, const PropList& plist = PropList::DEFAULT); -// DataType(const Attribute& attr, const void* ref, H5R_type_t ref_type = H5R_OBJECT, const PropList& plist = PropList::DEFAULT); + // Creates a datatype by way of dereference. + DataType(const H5Location& loc, const void* ref, H5R_type_t ref_type = H5R_OBJECT, const PropList& plist = PropList::DEFAULT); +// DataType(const Attribute& attr, const void* ref, H5R_type_t ref_type = H5R_OBJECT, const PropList& plist = PropList::DEFAULT); - // Closes this datatype. - virtual void close(); + // Closes this datatype. + virtual void close(); - // Copies an existing datatype to this datatype object. - void copy(const DataType& like_type); + // Copies an existing datatype to this datatype object. + void copy(const DataType& like_type); - // Copies the datatype of dset to this datatype object. - void copy(const DataSet& dset); + // Copies the datatype of dset to this datatype object. + void copy(const DataSet& dset); - // Returns the datatype class identifier. - H5T_class_t getClass() const; + // Returns the datatype class identifier. + H5T_class_t getClass() const; - // Commits a transient datatype to a file; this datatype becomes - // a named datatype which can be accessed from the location. - void commit(const H5Location& loc, const char* name); - void commit(const H5Location& loc, const H5std_string& name); + // Commits a transient datatype to a file; this datatype becomes + // a named datatype which can be accessed from the location. + void commit(const H5Location& loc, const char* name); + void commit(const H5Location& loc, const H5std_string& name); - // These two overloaded functions are kept for backward compatibility - // only; they missed the const - removed from 1.8.18 and 1.10.1 - //void commit(H5Location& loc, const char* name); - //void commit(H5Location& loc, const H5std_string& name); + // These two overloaded functions are kept for backward compatibility + // only; they missed the const - removed from 1.8.18 and 1.10.1 + //void commit(H5Location& loc, const char* name); + //void commit(H5Location& loc, const H5std_string& name); - // Determines whether this datatype is a named datatype or - // a transient datatype. - bool committed() const; + // Determines whether this datatype is a named datatype or + // a transient datatype. + bool committed() const; // Finds a conversion function that can handle the conversion // this datatype to the given datatype, dest. - H5T_conv_t find( const DataType& dest, H5T_cdata_t **pcdata ) const; + H5T_conv_t find(const DataType& dest, H5T_cdata_t **pcdata) const; - // Converts data from between specified datatypes. - void convert( const DataType& dest, size_t nelmts, void *buf, void *background, const PropList& plist=PropList::DEFAULT) const; + // Converts data from between specified datatypes. + void convert(const DataType& dest, size_t nelmts, void *buf, void *background, const PropList& plist=PropList::DEFAULT) const; - // Assignment operator - DataType& operator=( const DataType& rhs ); + // Assignment operator + DataType& operator=(const DataType& rhs); - // Determines whether two datatypes are the same. - bool operator==(const DataType& compared_type ) const; + // Determines whether two datatypes are the same. + bool operator==(const DataType& compared_type) const; - // Locks a datatype. - void lock() const; + // Locks a datatype. + void lock() const; - // Returns the size of a datatype. - size_t getSize() const; + // Returns the size of a datatype. + size_t getSize() const; - // Returns the base datatype from which a datatype is derived. - // Note: not quite right for specific types yet??? - DataType getSuper() const; + // Returns the base datatype from which a datatype is derived. + // Note: not quite right for specific types yet??? + DataType getSuper() const; - // Registers a conversion function. - void registerFunc(H5T_pers_t pers, const char* name, const DataType& dest, H5T_conv_t func ) const; - void registerFunc(H5T_pers_t pers, const H5std_string& name, const DataType& dest, H5T_conv_t func ) const; + // Registers a conversion function. + void registerFunc(H5T_pers_t pers, const char* name, const DataType& dest, H5T_conv_t func) const; + void registerFunc(H5T_pers_t pers, const H5std_string& name, const DataType& dest, H5T_conv_t func) const; - // Removes a conversion function from all conversion paths. - void unregister( H5T_pers_t pers, const char* name, const DataType& dest, H5T_conv_t func ) const; - void unregister( H5T_pers_t pers, const H5std_string& name, const DataType& dest, H5T_conv_t func ) const; + // Removes a conversion function from all conversion paths. + void unregister(H5T_pers_t pers, const char* name, const DataType& dest, H5T_conv_t func) const; + void unregister(H5T_pers_t pers, const H5std_string& name, const DataType& dest, H5T_conv_t func) const; - // Tags an opaque datatype. - void setTag( const char* tag ) const; - void setTag( const H5std_string& tag ) const; + // Tags an opaque datatype. + void setTag(const char* tag) const; + void setTag(const H5std_string& tag) const; - // Gets the tag associated with an opaque datatype. - H5std_string getTag() const; + // Gets the tag associated with an opaque datatype. + H5std_string getTag() const; - // Checks whether this datatype contains (or is) a certain type class. - bool detectClass(H5T_class_t cls) const; + // Checks whether this datatype contains (or is) a certain type class. + bool detectClass(H5T_class_t cls) const; - // Checks whether this datatype is a variable-length string. - bool isVariableStr() const; + // Checks whether this datatype is a variable-length string. + bool isVariableStr() const; - ///\brief Returns this class name. - virtual H5std_string fromClass () const { return("DataType"); } + ///\brief Returns this class name. + virtual H5std_string fromClass () const { return("DataType"); } // From CommonFG then H5Location - // Constructors to open a generic named datatype at a given location. - DataType(const H5Location& loc, const char* name); - DataType(const H5Location& loc, const H5std_string& name); + // Constructors to open a generic named datatype at a given location. + DataType(const H5Location& loc, const char* name); + DataType(const H5Location& loc, const H5std_string& name); // End of From CommonFG then H5Location - // Creates a copy of an existing DataType using its id - DataType( const hid_t type_id ); + // Creates a copy of an existing DataType using its id + DataType(const hid_t type_id); - // Default constructor - DataType(); + // Default constructor + DataType(); - // Gets the datatype id. - virtual hid_t getId() const; + // Gets the datatype id. + virtual hid_t getId() const; - // Destructor: properly terminates access to this datatype. - virtual ~DataType(); + // Destructor: properly terminates access to this datatype. + virtual ~DataType(); protected: #ifndef DOXYGEN_SHOULD_SKIP_THIS - hid_t id; // HDF5 datatype id + hid_t id; // HDF5 datatype id - // Sets the datatype id. - virtual void p_setId(const hid_t new_id); + // Sets the datatype id. + virtual void p_setId(const hid_t new_id); - // Opens a datatype and returns the id. - hid_t p_opentype(const H5Location& loc, const char* dtype_name) const; + // Opens a datatype and returns the id. + hid_t p_opentype(const H5Location& loc, const char* dtype_name) const; #endif // DOXYGEN_SHOULD_SKIP_THIS private: - // Friend function to set DataType id. For library use only. - friend void f_DataType_setId(DataType* dtype, hid_t new_id); + // Friend function to set DataType id. For library use only. + friend void f_DataType_setId(DataType* dtype, hid_t new_id); - void p_commit(hid_t loc_id, const char* name); + void p_commit(hid_t loc_id, const char* name); }; } #endif // __H5DataType_H diff --git a/c++/src/H5DcreatProp.cpp b/c++/src/H5DcreatProp.cpp index 8ab38dc..86d4d9c 100644 --- a/c++/src/H5DcreatProp.cpp +++ b/c++/src/H5DcreatProp.cpp @@ -40,7 +40,7 @@ DSetCreatPropList* DSetCreatPropList::DEFAULT_ = 0; // Function: DSetCreatPropList::getConstant // Purpose: Creates a DSetCreatPropList object representing the HDF5 // constant H5P_DATASET_CREATE, pointed to by -// DSetCreatPropList::DEFAULT_ +// DSetCreatPropList::DEFAULT_ // exception H5::PropListIException // Description // If DSetCreatPropList::DEFAULT_ already points to an allocated @@ -80,670 +80,670 @@ void DSetCreatPropList::deleteConstants() } //-------------------------------------------------------------------------- -// Purpose Constant for dataset creation default property +// Purpose Constant for dataset creation default property //-------------------------------------------------------------------------- const DSetCreatPropList& DSetCreatPropList::DEFAULT = *getConstant(); #endif // DOXYGEN_SHOULD_SKIP_THIS //-------------------------------------------------------------------------- -// Function: DSetCreatPropList default constructor -///\brief Default constructor: creates a stub dataset creation property list -// Programmer Binh-Minh Ribler - 2000 +// Function: DSetCreatPropList default constructor +///\brief Default constructor: creates a stub dataset creation property list +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- DSetCreatPropList::DSetCreatPropList() : ObjCreatPropList(H5P_DATASET_CREATE) {} //-------------------------------------------------------------------------- -// Function: DSetCreatPropList copy constructor -///\brief Copy constructor: makes a copy of the original -/// DSetCreatPropList object -// Programmer Binh-Minh Ribler - 2000 +// Function: DSetCreatPropList copy constructor +///\brief Copy constructor: makes a copy of the original +/// DSetCreatPropList object +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -DSetCreatPropList::DSetCreatPropList( const DSetCreatPropList& orig ) : ObjCreatPropList(orig) {} +DSetCreatPropList::DSetCreatPropList(const DSetCreatPropList& orig) : ObjCreatPropList(orig) {} //-------------------------------------------------------------------------- -// Function: DSetCreatPropList overloaded constructor -///\brief Creates a DSetCreatPropList object using the id of an -/// existing dataset creation property list. -// Programmer Binh-Minh Ribler - 2000 +// Function: DSetCreatPropList overloaded constructor +///\brief Creates a DSetCreatPropList object using the id of an +/// existing dataset creation property list. +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- DSetCreatPropList::DSetCreatPropList(const hid_t plist_id) : ObjCreatPropList(plist_id) {} //-------------------------------------------------------------------------- -// Function: DSetCreatPropList::setChunk -///\brief Sets the size of the chunks used to store a chunked layout -/// dataset. -///\param ndims - IN: Number of dimensions of each chunk -///\param dim - IN: Array containing the size of each chunk -///\exception H5::PropListIException +// Function: DSetCreatPropList::setChunk +///\brief Sets the size of the chunks used to store a chunked layout +/// dataset. +///\param ndims - IN: Number of dimensions of each chunk +///\param dim - IN: Array containing the size of each chunk +///\exception H5::PropListIException ///\par Description -/// The \a ndims parameter currently must have the same value as -/// the rank of the dataset. The values of the \a dim array -/// define the size of the chunks to store the dataset's raw -/// data. As a side-effect, the layout of the dataset will be -/// changed to \c H5D_CHUNKED, if it is not so already. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -void DSetCreatPropList::setChunk( int ndims, const hsize_t* dim ) const +/// The \a ndims parameter currently must have the same value as +/// the rank of the dataset. The values of the \a dim array +/// define the size of the chunks to store the dataset's raw +/// data. As a side-effect, the layout of the dataset will be +/// changed to \c H5D_CHUNKED, if it is not so already. +// Programmer Binh-Minh Ribler - 2000 +//-------------------------------------------------------------------------- +void DSetCreatPropList::setChunk(int ndims, const hsize_t* dim) const { - herr_t ret_value = H5Pset_chunk( id, ndims, dim ); - if( ret_value < 0 ) - { - throw PropListIException("DSetCreatPropList::setChunk", "H5Pset_chunk failed"); - } + herr_t ret_value = H5Pset_chunk(id, ndims, dim); + if (ret_value < 0) + { + throw PropListIException("DSetCreatPropList::setChunk", "H5Pset_chunk failed"); + } } //-------------------------------------------------------------------------- -// Function: DSetCreatPropList::getChunk -///\brief Retrieves the size of the chunks used to store a chunked -/// layout dataset. -///\param max_ndims - IN: Size of \a dim array -///\param dim - OUT: Array to store the chunk dimensions -///\exception H5::PropListIException -// Programmer Binh-Minh Ribler - 2000 +// Function: DSetCreatPropList::getChunk +///\brief Retrieves the size of the chunks used to store a chunked +/// layout dataset. +///\param max_ndims - IN: Size of \a dim array +///\param dim - OUT: Array to store the chunk dimensions +///\exception H5::PropListIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -int DSetCreatPropList::getChunk( int max_ndims, hsize_t* dim ) const +int DSetCreatPropList::getChunk(int max_ndims, hsize_t* dim) const { - int chunk_size = H5Pget_chunk( id, max_ndims, dim ); - if( chunk_size < 0 ) - { - throw PropListIException("DSetCreatPropList::getChunk", - "H5Pget_chunk returns negative chunk size"); - } - return( chunk_size ); + int chunk_size = H5Pget_chunk(id, max_ndims, dim); + if (chunk_size < 0) + { + throw PropListIException("DSetCreatPropList::getChunk", + "H5Pget_chunk returns negative chunk size"); + } + return(chunk_size); } //-------------------------------------------------------------------------- -// Function: DSetCreatPropList::setLayout -///\brief Sets the type of storage used store the raw data for a dataset. -///\param layout - IN: Type of storage layout for raw data -///\exception H5::PropListIException +// Function: DSetCreatPropList::setLayout +///\brief Sets the type of storage used store the raw data for a dataset. +///\param layout - IN: Type of storage layout for raw data +///\exception H5::PropListIException ///\par Description -/// For information on valid layout types, please refer to +/// For information on valid layout types, please refer to /// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetLayout -// Programmer Binh-Minh Ribler - 2000 +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void DSetCreatPropList::setLayout(H5D_layout_t layout) const { - herr_t ret_value = H5Pset_layout( id, layout ); - if( ret_value < 0 ) - { - throw PropListIException("DSetCreatPropList::setLayout", - "H5Pset_layout failed"); - } + herr_t ret_value = H5Pset_layout(id, layout); + if (ret_value < 0) + { + throw PropListIException("DSetCreatPropList::setLayout", + "H5Pset_layout failed"); + } } //-------------------------------------------------------------------------- -// Function: DSetCreatPropList::getLayout -///\brief Retrieves the layout type of this property list -///\return Layout type, which can be: -/// \li \c H5D_COMPACT - raw data is stored in the object -/// header in the file. -/// \li \c H5D_CONTIGUOUS - raw data is stored separately from the -/// object header in one contiguous chunk in -/// the file. -/// \li \c H5D_CHUNKED - raw data is stored separately from the -/// object header in chunks in separate locations -/// in the file. -///\exception H5::PropListIException +// Function: DSetCreatPropList::getLayout +///\brief Retrieves the layout type of this property list +///\return Layout type, which can be: +/// \li \c H5D_COMPACT - raw data is stored in the object +/// header in the file. +/// \li \c H5D_CONTIGUOUS - raw data is stored separately from the +/// object header in one contiguous chunk in +/// the file. +/// \li \c H5D_CHUNKED - raw data is stored separately from the +/// object header in chunks in separate locations +/// in the file. +///\exception H5::PropListIException ///\par Description -// Programmer Binh-Minh Ribler - 2000 +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- H5D_layout_t DSetCreatPropList::getLayout() const { - H5D_layout_t layout = H5Pget_layout( id ); - if( layout == H5D_LAYOUT_ERROR ) - { - throw PropListIException("DSetCreatPropList::getLayout", - "H5Pget_layout returns H5D_LAYOUT_ERROR"); - } - return( layout ); + H5D_layout_t layout = H5Pget_layout(id); + if (layout == H5D_LAYOUT_ERROR) + { + throw PropListIException("DSetCreatPropList::getLayout", + "H5Pget_layout returns H5D_LAYOUT_ERROR"); + } + return(layout); } //-------------------------------------------------------------------------- -// Function: DSetCreatPropList::setDeflate -///\brief Sets compression method and compression level -///\param level - IN: Compression level, should [0..9], inclusive -///\exception H5::PropListIException +// Function: DSetCreatPropList::setDeflate +///\brief Sets compression method and compression level +///\param level - IN: Compression level, should [0..9], inclusive +///\exception H5::PropListIException ///\par Description -/// The function sets the compression method for this property -/// list to \c H5D_COMPRESS_DEFLATE and the compression level to -/// \a level. Lower compression levels are faster but result in -/// less compression. -// Programmer Binh-Minh Ribler - 2000 +/// The function sets the compression method for this property +/// list to \c H5D_COMPRESS_DEFLATE and the compression level to +/// \a level. Lower compression levels are faster but result in +/// less compression. +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -void DSetCreatPropList::setDeflate( int level ) const +void DSetCreatPropList::setDeflate(int level) const { - herr_t ret_value = H5Pset_deflate( id, level ); - if( ret_value < 0 ) - { - throw PropListIException("DSetCreatPropList::setDeflate", - "H5Pset_deflate failed"); - } + herr_t ret_value = H5Pset_deflate(id, level); + if (ret_value < 0) + { + throw PropListIException("DSetCreatPropList::setDeflate", + "H5Pset_deflate failed"); + } } //-------------------------------------------------------------------------- -// Function: DSetCreatPropList::setSzip -///\brief Sets up for the use of the SZIP compression filter. -///\param options_mask - IN: A bit-mask conveying the desired SZIP -/// options. Valid values are H5_SZIP_EC_OPTION_MASK -/// and H5_SZIP_NN_OPTION_MASK. -///\param pixels_per_block - IN: Number of pixels or data elements in -/// each data block. -///\exception H5::PropListIException +// Function: DSetCreatPropList::setSzip +///\brief Sets up for the use of the SZIP compression filter. +///\param options_mask - IN: A bit-mask conveying the desired SZIP +/// options. Valid values are H5_SZIP_EC_OPTION_MASK +/// and H5_SZIP_NN_OPTION_MASK. +///\param pixels_per_block - IN: Number of pixels or data elements in +/// each data block. +///\exception H5::PropListIException ///\par Description -/// The associate C function sets an SZIP compression filter, -/// H5Z_FILTER_SZIP, for a dataset. For more information about -/// SZIP and usage, please refer to the C layer Reference -/// Manual at: +/// The associate C function sets an SZIP compression filter, +/// H5Z_FILTER_SZIP, for a dataset. For more information about +/// SZIP and usage, please refer to the C layer Reference +/// Manual at: /// http://hdfgroup.org/HDF5/doc/RM_H5P.html#Property-SetSzip -// Programmer Binh-Minh Ribler - Jan, 2007 +// Programmer Binh-Minh Ribler - Jan, 2007 //-------------------------------------------------------------------------- void DSetCreatPropList::setSzip(unsigned int options_mask, unsigned int pixels_per_block) const { herr_t ret_value = H5Pset_szip(id, options_mask, pixels_per_block); - if( ret_value < 0 ) + if (ret_value < 0) { - throw PropListIException("DSetCreatPropList::setSzip", - "H5Pset_szip failed"); + throw PropListIException("DSetCreatPropList::setSzip", + "H5Pset_szip failed"); } } //-------------------------------------------------------------------------- -// Function: DSetCreatPropList::setNbit -///\brief Sets up for the use of the Nbit compression filter. -///\exception H5::PropListIException +// Function: DSetCreatPropList::setNbit +///\brief Sets up for the use of the Nbit compression filter. +///\exception H5::PropListIException ///\par Description -/// The associate C function sets an Nbit compression filter, -/// H5Z_FILTER_NBIT, for a dataset. For more information about -/// Nbit compression, please refer to the C layer Reference -/// Manual at: +/// The associate C function sets an Nbit compression filter, +/// H5Z_FILTER_NBIT, for a dataset. For more information about +/// Nbit compression, please refer to the C layer Reference +/// Manual at: /// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-setNbit -// Programmer Binh-Minh Ribler - Apr, 2016 +// Programmer Binh-Minh Ribler - Apr, 2016 //-------------------------------------------------------------------------- void DSetCreatPropList::setNbit() const { herr_t ret_value = H5Pset_nbit(id); - if( ret_value < 0 ) + if (ret_value < 0) { - throw PropListIException("DSetCreatPropList::setNbit", - "H5Pset_nbit failed"); + throw PropListIException("DSetCreatPropList::setNbit", + "H5Pset_nbit failed"); } } //-------------------------------------------------------------------------- -// Function: DSetCreatPropList::setFillValue -///\brief Sets a dataset fill value -///\param fvalue_type - IN: Data type for the value passed via \a value -///\param value - IN: Pointer to buffer containing the fill value -///\exception H5::PropListIException +// Function: DSetCreatPropList::setFillValue +///\brief Sets a dataset fill value +///\param fvalue_type - IN: Data type for the value passed via \a value +///\param value - IN: Pointer to buffer containing the fill value +///\exception H5::PropListIException ///\par Description -/// The datatype may differ from that of the dataset, but it must -/// be one that the HDF5 library is able to convert \a value to -/// the dataset datatype when the dataset is created. -/// The default fill value is 0 (zero,) which is interpreted -/// according to the actual dataset datatype. +/// The datatype may differ from that of the dataset, but it must +/// be one that the HDF5 library is able to convert \a value to +/// the dataset datatype when the dataset is created. +/// The default fill value is 0 (zero,) which is interpreted +/// according to the actual dataset datatype. ///\par -/// For information on setting fill value, please refer to the -/// C layer Reference Manual at: +/// For information on setting fill value, please refer to the +/// C layer Reference Manual at: /// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetFillValue -// Programmer Binh-Minh Ribler - 2000 +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -void DSetCreatPropList::setFillValue( const DataType& fvalue_type, const void* value ) const +void DSetCreatPropList::setFillValue(const DataType& fvalue_type, const void* value) const { - herr_t ret_value = H5Pset_fill_value( id, fvalue_type.getId(), value ); - if( ret_value < 0 ) - { - throw PropListIException("DSetCreatPropList::setFillValue", + herr_t ret_value = H5Pset_fill_value(id, fvalue_type.getId(), value); + if (ret_value < 0) + { + throw PropListIException("DSetCreatPropList::setFillValue", "H5Pset_fill_value failed"); - } + } } //-------------------------------------------------------------------------- -// Function: DSetCreatPropList::getFillValue -///\brief Retrieves a dataset fill value -///\param fvalue_type - IN: Data type for the value passed via \a value -///\param value - OUT: Pointer to buffer to hold the retrieved fill value -///\exception H5::PropListIException +// Function: DSetCreatPropList::getFillValue +///\brief Retrieves a dataset fill value +///\param fvalue_type - IN: Data type for the value passed via \a value +///\param value - OUT: Pointer to buffer to hold the retrieved fill value +///\exception H5::PropListIException ///\par Description -/// The fill value is returned through \a value pointer -/// and the memory is allocated by the caller. The fill -/// value will be converted from its current data type to the -/// specified by \a fvalue_type. -// Programmer Binh-Minh Ribler - 2000 +/// The fill value is returned through \a value pointer +/// and the memory is allocated by the caller. The fill +/// value will be converted from its current data type to the +/// specified by \a fvalue_type. +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -void DSetCreatPropList::getFillValue( const DataType& fvalue_type, void* value ) const +void DSetCreatPropList::getFillValue(const DataType& fvalue_type, void* value) const { - herr_t ret_value = H5Pget_fill_value( id, fvalue_type.getId(), value ); - if( ret_value < 0 ) - { - throw PropListIException("DSetCreatPropList::getFillValue", + herr_t ret_value = H5Pget_fill_value(id, fvalue_type.getId(), value); + if (ret_value < 0) + { + throw PropListIException("DSetCreatPropList::getFillValue", "H5Pget_fill_value failed"); - } + } } //-------------------------------------------------------------------------- -// Function: DSetCreatPropList::isFillValueDefined -///\brief Check if fill value has been defined for this property +// Function: DSetCreatPropList::isFillValueDefined +///\brief Check if fill value has been defined for this property ///\return -/// \li \c H5D_FILL_VALUE_UNDEFINED =0, -/// \li \c H5D_FILL_VALUE_DEFAULT =1, -/// \li \c H5D_FILL_VALUE_USER_DEFINED =2 -///\exception H5::PropListIException -// Programmer Binh-Minh Ribler - 2000 +/// \li \c H5D_FILL_VALUE_UNDEFINED =0, +/// \li \c H5D_FILL_VALUE_DEFAULT =1, +/// \li \c H5D_FILL_VALUE_USER_DEFINED =2 +///\exception H5::PropListIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- H5D_fill_value_t DSetCreatPropList::isFillValueDefined() const { - H5D_fill_value_t status; - herr_t ret_value = H5Pfill_value_defined(id, &status); - if( ret_value < 0 ) - { - throw PropListIException("DSetCreatPropList::isFillValueDefined", + H5D_fill_value_t status; + herr_t ret_value = H5Pfill_value_defined(id, &status); + if (ret_value < 0) + { + throw PropListIException("DSetCreatPropList::isFillValueDefined", "H5Pfill_value_defined returned H5D_FILL_VALUE_ERROR (-1)"); - } - else - return (status); + } + else + return (status); } //-------------------------------------------------------------------------- -// Function: DSetCreatPropList::setFilter -///\brief Adds a filter to the filter pipeline -///\param filter_id - IN: Filter to add -///\param flags - IN: Specifies general properties of the filter -///\param cd_nelmts - IN: Number of elements in cd_values -///\param cd_values - IN: Auxiliary data for the filter -///\exception H5::PropListIException +// Function: DSetCreatPropList::setFilter +///\brief Adds a filter to the filter pipeline +///\param filter_id - IN: Filter to add +///\param flags - IN: Specifies general properties of the filter +///\param cd_nelmts - IN: Number of elements in cd_values +///\param cd_values - IN: Auxiliary data for the filter +///\exception H5::PropListIException ///\par Description -/// The \a flags argument is a bit vector of the field: -/// \c H5Z_FLAG_OPTIONAL(0x0001) +/// The \a flags argument is a bit vector of the field: +/// \c H5Z_FLAG_OPTIONAL(0x0001) ///\par -/// If this bit is set then the filter is optional. If the filter -/// fails during a \c DataSet::write() operation then the filter -/// is just excluded from the pipeline for the chunk for which it -/// failed; the filter will not participate in the pipeline -/// during a \c DataSet::read() of the chunk. If this bit is clear -/// and the filter fails then the entire I/O operation fails. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -void DSetCreatPropList::setFilter( H5Z_filter_t filter_id, unsigned int flags, - size_t cd_nelmts, const unsigned int cd_values[] ) const +/// If this bit is set then the filter is optional. If the filter +/// fails during a \c DataSet::write() operation then the filter +/// is just excluded from the pipeline for the chunk for which it +/// failed; the filter will not participate in the pipeline +/// during a \c DataSet::read() of the chunk. If this bit is clear +/// and the filter fails then the entire I/O operation fails. +// Programmer Binh-Minh Ribler - 2000 +//-------------------------------------------------------------------------- +void DSetCreatPropList::setFilter(H5Z_filter_t filter_id, unsigned int flags, + size_t cd_nelmts, const unsigned int cd_values[]) const { - herr_t ret_value = H5Pset_filter( id, filter_id, flags, cd_nelmts, cd_values ); - if( ret_value < 0 ) - { - throw PropListIException("DSetCreatPropList::setFilter", + herr_t ret_value = H5Pset_filter(id, filter_id, flags, cd_nelmts, cd_values); + if (ret_value < 0) + { + throw PropListIException("DSetCreatPropList::setFilter", "H5Pset_filter failed"); - } + } } //-------------------------------------------------------------------------- -// Function: DSetCreatPropList::removeFilter -///\brief Removes one or more filters -///\param filter_id - IN: Filter to remove -///\exception H5::PropListIException +// Function: DSetCreatPropList::removeFilter +///\brief Removes one or more filters +///\param filter_id - IN: Filter to remove +///\exception H5::PropListIException ///\par Description -/// Deletes a filter from the dataset creation property list; -/// deletes all filters if \a filter_id is \c H5Z_FILTER_NONE. -// Programmer Binh-Minh Ribler - 2000 +/// Deletes a filter from the dataset creation property list; +/// deletes all filters if \a filter_id is \c H5Z_FILTER_NONE. +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void DSetCreatPropList::removeFilter(H5Z_filter_t filter_id) const { - herr_t ret_value = H5Premove_filter( id, filter_id); - if( ret_value < 0 ) - { - throw PropListIException("DSetCreatPropList::removeFilter", + herr_t ret_value = H5Premove_filter(id, filter_id); + if (ret_value < 0) + { + throw PropListIException("DSetCreatPropList::removeFilter", "H5Premove_filter failed"); - } + } } //-------------------------------------------------------------------------- -// Function: DSetCreatPropList::getNfilters -///\brief Returns the number of filters in the pipeline -///\return Number of filters -///\exception H5::PropListIException -// Programmer Binh-Minh Ribler - 2000 +// Function: DSetCreatPropList::getNfilters +///\brief Returns the number of filters in the pipeline +///\return Number of filters +///\exception H5::PropListIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- int DSetCreatPropList::getNfilters() const { - int num_filters = H5Pget_nfilters( id ); - if( num_filters < 0 ) - { - throw PropListIException("DSetCreatPropList::getNfilters", + int num_filters = H5Pget_nfilters(id); + if (num_filters < 0) + { + throw PropListIException("DSetCreatPropList::getNfilters", "H5Pget_nfilters returned negative number of filters"); - } - else - return( num_filters ); + } + else + return(num_filters); } //-------------------------------------------------------------------------- -// Function: DSetCreatPropList::getFilter -///\brief Returns information about a filter in a pipeline -///\param filter_number - IN: Filter to get, range [0..N-1], where -/// N is returned by H5Pget_nfilters() -///\param flags - OUT: General properties of the filter -///\param cd_nelmts - IN/OUT: Number of elements in \a cd_values /Number -/// of values defined by the filter -///\param cd_values - OUT: Array to hold the data; allocated by the user -///\param namelen - IN: Length of \a name -///\param name - OUT: Name of the filter -///\param filter_config - OUT: Flags indicating whether filter can encode/decode -///\return Filter id -///\exception H5::PropListIException +// Function: DSetCreatPropList::getFilter +///\brief Returns information about a filter in a pipeline +///\param filter_number - IN: Filter to get, range [0..N-1], where +/// N is returned by H5Pget_nfilters() +///\param flags - OUT: General properties of the filter +///\param cd_nelmts - IN/OUT: Number of elements in \a cd_values /Number +/// of values defined by the filter +///\param cd_values - OUT: Array to hold the data; allocated by the user +///\param namelen - IN: Length of \a name +///\param name - OUT: Name of the filter +///\param filter_config - OUT: Flags indicating whether filter can encode/decode +///\return Filter id +///\exception H5::PropListIException ///\par Description -/// Failure occurs when \a filter_number is out of range. -// Note: the first argument was mistakenly typed as int instead -// of unsigned int, but for backward compatibility, it cannot be -// changed. -BMR (2014/04/15) +/// Failure occurs when \a filter_number is out of range. +// Note: the first argument was mistakenly typed as int instead +// of unsigned int, but for backward compatibility, it cannot be +// changed. -BMR (2014/04/15) //-------------------------------------------------------------------------- H5Z_filter_t DSetCreatPropList::getFilter(int filter_number, - unsigned int &flags, size_t &cd_nelmts, unsigned int* cd_values, - size_t namelen, char name[], unsigned int& filter_config) const + unsigned int &flags, size_t &cd_nelmts, unsigned int* cd_values, + size_t namelen, char name[], unsigned int& filter_config) const { - H5Z_filter_t filter_id; - filter_id = H5Pget_filter2(id, filter_number, &flags, &cd_nelmts, - cd_values, namelen, name, &filter_config); - if( filter_id == H5Z_FILTER_ERROR ) - throw PropListIException("DSetCreatPropList::getFilter", + H5Z_filter_t filter_id; + filter_id = H5Pget_filter2(id, filter_number, &flags, &cd_nelmts, + cd_values, namelen, name, &filter_config); + if (filter_id == H5Z_FILTER_ERROR) + throw PropListIException("DSetCreatPropList::getFilter", "H5Pget_filter2 returned H5Z_FILTER_ERROR"); - else - return(filter_id); + else + return(filter_id); } //-------------------------------------------------------------------------- -// Function: DSetCreatPropList::getFilterById -///\brief Returns information about a filter in a pipeline given the -/// filter id -///\param filter_id - IN: Filter to get -///\param flags - OUT: General properties of the filter -///\param cd_nelmts - IN/OUT: Number of elements in \a cd_values /Number -/// of values defined by the filter -///\param cd_values - OUT: Array to hold the data; allocated by the user -///\param namelen - IN: Length of \a name -///\param name - OUT: Name of the filter -///\param filter_config - OUT: Flags indicating whether filter can encode/decode -///\exception H5::PropListIException -// Programmer Binh-Minh Ribler - 2000 +// Function: DSetCreatPropList::getFilterById +///\brief Returns information about a filter in a pipeline given the +/// filter id +///\param filter_id - IN: Filter to get +///\param flags - OUT: General properties of the filter +///\param cd_nelmts - IN/OUT: Number of elements in \a cd_values /Number +/// of values defined by the filter +///\param cd_values - OUT: Array to hold the data; allocated by the user +///\param namelen - IN: Length of \a name +///\param name - OUT: Name of the filter +///\param filter_config - OUT: Flags indicating whether filter can encode/decode +///\exception H5::PropListIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void DSetCreatPropList::getFilterById(H5Z_filter_t filter_id, - unsigned int &flags, size_t &cd_nelmts, unsigned int* cd_values, - size_t namelen, char name[], unsigned int &filter_config) const + unsigned int &flags, size_t &cd_nelmts, unsigned int* cd_values, + size_t namelen, char name[], unsigned int &filter_config) const { - herr_t ret_value = H5Pget_filter_by_id2(id, filter_id, &flags, &cd_nelmts, - cd_values, namelen, name, &filter_config); - if (ret_value < 0) - throw PropListIException("DSetCreatPropList::getFilterById", + herr_t ret_value = H5Pget_filter_by_id2(id, filter_id, &flags, &cd_nelmts, + cd_values, namelen, name, &filter_config); + if (ret_value < 0) + throw PropListIException("DSetCreatPropList::getFilterById", "H5Pget_filter_by_id2 failed"); } //-------------------------------------------------------------------------- -// Function: DSetCreatPropList::modifyFilter -///\brief Modifies the specified filter -///\param filter_id - IN: Filter to get -///\param flags - OUT: General properties of the filter -///\param cd_nelmts - IN: Number of elements in \a cd_values -/// \n OUT: Number of values defined by the filter -///\param cd_values - OUT: Array to hold the data; allocated by the user -///\exception H5::PropListIException +// Function: DSetCreatPropList::modifyFilter +///\brief Modifies the specified filter +///\param filter_id - IN: Filter to get +///\param flags - OUT: General properties of the filter +///\param cd_nelmts - IN: Number of elements in \a cd_values +/// \n OUT: Number of values defined by the filter +///\param cd_values - OUT: Array to hold the data; allocated by the user +///\exception H5::PropListIException ///\par Description -/// The \a flags argument is a bit vector of the field: -/// \c H5Z_FLAG_OPTIONAL(0x0001) +/// The \a flags argument is a bit vector of the field: +/// \c H5Z_FLAG_OPTIONAL(0x0001) ///\par -/// If this bit is set then the filter is optional. If the filter -/// fails during a DataSet::write() operation then the filter -/// is just excluded from the pipeline for the chunk for which it -/// failed; the filter will not participate in the pipeline -/// during a DataSet::read() of the chunk. If this bit is clear -/// and the filter fails then the entire I/O operation fails. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -void DSetCreatPropList::modifyFilter( H5Z_filter_t filter_id, unsigned int - flags, size_t cd_nelmts, const unsigned int cd_values[] ) const +/// If this bit is set then the filter is optional. If the filter +/// fails during a DataSet::write() operation then the filter +/// is just excluded from the pipeline for the chunk for which it +/// failed; the filter will not participate in the pipeline +/// during a DataSet::read() of the chunk. If this bit is clear +/// and the filter fails then the entire I/O operation fails. +// Programmer Binh-Minh Ribler - 2000 +//-------------------------------------------------------------------------- +void DSetCreatPropList::modifyFilter(H5Z_filter_t filter_id, unsigned int + flags, size_t cd_nelmts, const unsigned int cd_values[]) const { - herr_t ret_value = H5Pmodify_filter(id, filter_id, flags, cd_nelmts, cd_values); - if( ret_value < 0 ) - { - throw PropListIException("DSetCreatPropList::modifyFilter", + herr_t ret_value = H5Pmodify_filter(id, filter_id, flags, cd_nelmts, cd_values); + if (ret_value < 0) + { + throw PropListIException("DSetCreatPropList::modifyFilter", "H5Pmodify_filter failed"); - } + } } //-------------------------------------------------------------------------- -// Function: DSetCreatPropList::allFiltersAvail -///\brief Queries whether all the filters set in this property list -/// are available currently. -///\return true if all filters available, and false if one or more -/// filters not currently available -///\exception H5::PropListIException -// Programmer Binh-Minh Ribler - 2000 +// Function: DSetCreatPropList::allFiltersAvail +///\brief Queries whether all the filters set in this property list +/// are available currently. +///\return true if all filters available, and false if one or more +/// filters not currently available +///\exception H5::PropListIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- bool DSetCreatPropList::allFiltersAvail() const { - htri_t ret_value = H5Pall_filters_avail(id); - if( ret_value > 0 ) - return true; - else if( ret_value == 0 ) - return false; - else // Raise exception when H5Pall_filters_avail returns a negative value - { - throw PropListIException("DSetCreatPropList::allFiltersAvail", "H5Pall_filters_avail returned negative value"); - } + htri_t ret_value = H5Pall_filters_avail(id); + if (ret_value > 0) + return true; + else if (ret_value == 0) + return false; + else // Raise exception when H5Pall_filters_avail returns a negative value + { + throw PropListIException("DSetCreatPropList::allFiltersAvail", "H5Pall_filters_avail returned negative value"); + } } //-------------------------------------------------------------------------- -// Function: DSetCreatPropList::setShuffle -///\brief Sets method of the shuffle filter +// Function: DSetCreatPropList::setShuffle +///\brief Sets method of the shuffle filter /// -///\exception H5::PropListIException +///\exception H5::PropListIException ///\par Description -/// Please refer to the Reference Manual of \c H5Pset_shuffle for -/// details. +/// Please refer to the Reference Manual of \c H5Pset_shuffle for +/// details. /// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetShuffle -// Programmer Binh-Minh Ribler - 2000 +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void DSetCreatPropList::setShuffle() const { - herr_t ret_value = H5Pset_shuffle(id); - if( ret_value < 0 ) - { - throw PropListIException("DSetCreatPropList::setShuffle", + herr_t ret_value = H5Pset_shuffle(id); + if (ret_value < 0) + { + throw PropListIException("DSetCreatPropList::setShuffle", "H5Pset_shuffle failed"); - } + } } //-------------------------------------------------------------------------- -// Function: DSetCreatPropList::getAllocTime -///\brief Get space allocation time for this property. -///\return Space allocation time. -///\exception H5::PropListIException +// Function: DSetCreatPropList::getAllocTime +///\brief Get space allocation time for this property. +///\return Space allocation time. +///\exception H5::PropListIException ///\par Description -/// The values of space allocation time can be one of the -/// followings: -/// \li \c H5D_ALLOC_TIME_DEFAULT -/// \li \c H5D_ALLOC_TIME_EARLY -/// \li \c H5D_ALLOC_TIME_LATE -/// \li \c H5D_ALLOC_TIME_INCR -// Programmer Binh-Minh Ribler - 2000 +/// The values of space allocation time can be one of the +/// followings: +/// \li \c H5D_ALLOC_TIME_DEFAULT +/// \li \c H5D_ALLOC_TIME_EARLY +/// \li \c H5D_ALLOC_TIME_LATE +/// \li \c H5D_ALLOC_TIME_INCR +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- H5D_alloc_time_t DSetCreatPropList::getAllocTime() const { - H5D_alloc_time_t alloc_time; - herr_t ret_value = H5Pget_alloc_time(id, &alloc_time); - if( ret_value < 0 ) - { - throw PropListIException("DSetCreatPropList::getAllocTime", + H5D_alloc_time_t alloc_time; + herr_t ret_value = H5Pget_alloc_time(id, &alloc_time); + if (ret_value < 0) + { + throw PropListIException("DSetCreatPropList::getAllocTime", "H5Pget_alloc_time failed"); - } - else - return (alloc_time); + } + else + return (alloc_time); } //-------------------------------------------------------------------------- -// Function: DSetCreatPropList::getFillTime -///\brief Gets fill value writing time. -///\return Fill value writing time -///\exception H5::PropListIException +// Function: DSetCreatPropList::getFillTime +///\brief Gets fill value writing time. +///\return Fill value writing time +///\exception H5::PropListIException ///\par Description -/// Valid values for fill value writing time include -/// \li \c H5D_FILL_TIME_NEVER -/// \li \c H5D_FILL_TIME_ALLOC. -// Programmer Binh-Minh Ribler - 2000 +/// Valid values for fill value writing time include +/// \li \c H5D_FILL_TIME_NEVER +/// \li \c H5D_FILL_TIME_ALLOC. +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- H5D_fill_time_t DSetCreatPropList::getFillTime() const { - H5D_fill_time_t fill_time; - herr_t ret_value = H5Pget_fill_time(id, &fill_time); - if( ret_value < 0 ) - { - throw PropListIException("DSetCreatPropList::getFillTime", + H5D_fill_time_t fill_time; + herr_t ret_value = H5Pget_fill_time(id, &fill_time); + if (ret_value < 0) + { + throw PropListIException("DSetCreatPropList::getFillTime", "H5Pget_fill_time failed"); - } - else - return (fill_time); + } + else + return (fill_time); } //-------------------------------------------------------------------------- -// Function: DSetCreatPropList::setAllocTime -///\brief Sets space allocation time for dataset during creation. -///\param alloc_time - IN: Allocation time -///\exception H5::PropListIException +// Function: DSetCreatPropList::setAllocTime +///\brief Sets space allocation time for dataset during creation. +///\param alloc_time - IN: Allocation time +///\exception H5::PropListIException ///\par Description -/// Valid values for space allocation time include: -/// \li \c H5D_ALLOC_TIME_DEFAULT -/// \li \c H5D_ALLOC_TIME_EARLY -/// \li \c H5D_ALLOC_TIME_LATE -/// \li \c H5D_ALLOC_TIME_INCR -// Programmer Binh-Minh Ribler - 2000 +/// Valid values for space allocation time include: +/// \li \c H5D_ALLOC_TIME_DEFAULT +/// \li \c H5D_ALLOC_TIME_EARLY +/// \li \c H5D_ALLOC_TIME_LATE +/// \li \c H5D_ALLOC_TIME_INCR +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void DSetCreatPropList::setAllocTime(H5D_alloc_time_t alloc_time) const { - herr_t ret_value = H5Pset_alloc_time(id, alloc_time); - if( ret_value < 0 ) - { - throw PropListIException("DSetCreatPropList::setAllocTime", + herr_t ret_value = H5Pset_alloc_time(id, alloc_time); + if (ret_value < 0) + { + throw PropListIException("DSetCreatPropList::setAllocTime", "H5Pset_alloc_time failed"); - } + } } //-------------------------------------------------------------------------- -// Function: DSetCreatPropList::setFillTime -///\brief Sets fill value writing time for dataset. -///\return Fill value writing time -///\exception H5::PropListIException +// Function: DSetCreatPropList::setFillTime +///\brief Sets fill value writing time for dataset. +///\return Fill value writing time +///\exception H5::PropListIException ///\par Description -/// Valid values for fill value writing time include -/// \li \c H5D_FILL_TIME_NEVER -/// \li \c H5D_FILL_TIME_ALLOC. -// Programmer Binh-Minh Ribler - 2000 +/// Valid values for fill value writing time include +/// \li \c H5D_FILL_TIME_NEVER +/// \li \c H5D_FILL_TIME_ALLOC. +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void DSetCreatPropList::setFillTime(H5D_fill_time_t fill_time) const { - herr_t ret_value = H5Pset_fill_time(id, fill_time); - if( ret_value < 0 ) - { - throw PropListIException("DSetCreatPropList::setFillTime", + herr_t ret_value = H5Pset_fill_time(id, fill_time); + if (ret_value < 0) + { + throw PropListIException("DSetCreatPropList::setFillTime", "H5Pset_fill_time failed"); - } + } } //-------------------------------------------------------------------------- -// Function: DSetCreatPropList::setFletcher32 -///\brief Sets Fletcher32 checksum of EDC for this property list. +// Function: DSetCreatPropList::setFletcher32 +///\brief Sets Fletcher32 checksum of EDC for this property list. /// -///\exception H5::PropListIException -// Programmer Binh-Minh Ribler - 2000 +///\exception H5::PropListIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void DSetCreatPropList::setFletcher32() const { - herr_t ret_value = H5Pset_fletcher32(id); - if( ret_value < 0 ) - { - throw PropListIException("DSetCreatPropList::setFletcher32", + herr_t ret_value = H5Pset_fletcher32(id); + if (ret_value < 0) + { + throw PropListIException("DSetCreatPropList::setFletcher32", "H5Pset_fletcher32 failed"); - } + } } //-------------------------------------------------------------------------- -// Function: DSetCreatPropList::setExternal -///\brief Adds an external file to the list of external files -///\param name - IN: Name of the external file -///\param offset - IN: Location where the data starts in the file -///\param size - IN: Number of bytes reserved in the file for the data -///\exception H5::PropListIException +// Function: DSetCreatPropList::setExternal +///\brief Adds an external file to the list of external files +///\param name - IN: Name of the external file +///\param offset - IN: Location where the data starts in the file +///\param size - IN: Number of bytes reserved in the file for the data +///\exception H5::PropListIException ///\par Description -/// If a dataset is splitted across multiple files then the files -/// should be defined in order. The total size of the dataset is -/// the sum of the \a size arguments for all the external files. If -/// the total size is larger than the size of a dataset then the -/// dataset can be extended (provided the data space also allows -/// the extending). -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -void DSetCreatPropList::setExternal( const char* name, off_t offset, hsize_t size ) const +/// If a dataset is splitted across multiple files then the files +/// should be defined in order. The total size of the dataset is +/// the sum of the \a size arguments for all the external files. If +/// the total size is larger than the size of a dataset then the +/// dataset can be extended (provided the data space also allows +/// the extending). +// Programmer Binh-Minh Ribler - 2000 +//-------------------------------------------------------------------------- +void DSetCreatPropList::setExternal(const char* name, off_t offset, hsize_t size) const { - herr_t ret_value = H5Pset_external( id, name, offset, size ); - if( ret_value < 0 ) - { - throw PropListIException("DSetCreatPropList::setExternal", + herr_t ret_value = H5Pset_external(id, name, offset, size); + if (ret_value < 0) + { + throw PropListIException("DSetCreatPropList::setExternal", "H5Pset_external failed"); - } + } } //-------------------------------------------------------------------------- -// Function: DSetCreatPropList::getExternalCount -///\brief Returns the number of external files for a dataset -///\return Number of external files -///\exception H5::PropListIException -// Programmer Binh-Minh Ribler - 2000 +// Function: DSetCreatPropList::getExternalCount +///\brief Returns the number of external files for a dataset +///\return Number of external files +///\exception H5::PropListIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- int DSetCreatPropList::getExternalCount() const { - int num_ext_files = H5Pget_external_count( id ); - if( num_ext_files < 0 ) - { - throw PropListIException("DSetCreatPropList::getExternalCount", + int num_ext_files = H5Pget_external_count(id); + if (num_ext_files < 0) + { + throw PropListIException("DSetCreatPropList::getExternalCount", "H5Pget_external_count returns negative number of external files"); - } - else - return( num_ext_files ); + } + else + return(num_ext_files); } //-------------------------------------------------------------------------- -// Function: DSetCreatPropList::getExternal -///\brief Returns information about an external file -///\param idx - IN: Index of the external file, ranges [0-(N-1)] and -/// returned by getExternalCount() -///\param name_size - IN: Maximum length of \a name -///\param name - OUT: Name of the external file -///\param offset - OUT: Location to return an offset value -///\param size - OUT: Location to return the size of the external file data -///\exception H5::PropListIException +// Function: DSetCreatPropList::getExternal +///\brief Returns information about an external file +///\param idx - IN: Index of the external file, ranges [0-(N-1)] and +/// returned by getExternalCount() +///\param name_size - IN: Maximum length of \a name +///\param name - OUT: Name of the external file +///\param offset - OUT: Location to return an offset value +///\param size - OUT: Location to return the size of the external file data +///\exception H5::PropListIException ///\par Description -/// The parameter \a idx ranges [0..N-1] where N is returned by -/// getExternalCount(). At most \a name_size characters are copied -/// into the name array. If the external file name is longer than -/// name_size with the null terminator, the return value is not -/// null terminated (similar to strncpy()). -/// If \a name_size is zero or \a name is a null pointer, the -/// external file name will not be returned. If \a offset or -/// \a size are null pointers then the corresponding information -/// will not be returned. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -void DSetCreatPropList::getExternal( unsigned idx, size_t name_size, char* name, off_t& offset, hsize_t& size ) const +/// The parameter \a idx ranges [0..N-1] where N is returned by +/// getExternalCount(). At most \a name_size characters are copied +/// into the name array. If the external file name is longer than +/// name_size with the null terminator, the return value is not +/// null terminated (similar to strncpy()). +/// If \a name_size is zero or \a name is a null pointer, the +/// external file name will not be returned. If \a offset or +/// \a size are null pointers then the corresponding information +/// will not be returned. +// Programmer Binh-Minh Ribler - 2000 +//-------------------------------------------------------------------------- +void DSetCreatPropList::getExternal(unsigned idx, size_t name_size, char* name, off_t& offset, hsize_t& size) const { - herr_t ret_value = H5Pget_external( id, idx, name_size, name, &offset, &size ); - if( ret_value < 0 ) - { - throw PropListIException("DSetCreatPropList::getExternal", + herr_t ret_value = H5Pget_external(id, idx, name_size, name, &offset, &size); + if (ret_value < 0) + { + throw PropListIException("DSetCreatPropList::getExternal", "H5Pget_external failed"); - } + } } //-------------------------------------------------------------------------- -// Function: DSetCreatPropList destructor -///\brief Noop destructor. +// Function: DSetCreatPropList destructor +///\brief Noop destructor. // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -DSetCreatPropList::~DSetCreatPropList () {} +DSetCreatPropList::~DSetCreatPropList() {} } // end namespace diff --git a/c++/src/H5DcreatProp.h b/c++/src/H5DcreatProp.h index 60ce1d5..096a3d3 100644 --- a/c++/src/H5DcreatProp.h +++ b/c++/src/H5DcreatProp.h @@ -29,118 +29,87 @@ class DataType; */ class H5_DLLCPP DSetCreatPropList : public ObjCreatPropList { public: - ///\brief Default dataset creation property list. - static const DSetCreatPropList& DEFAULT; - - // Creates a dataset creation property list. - DSetCreatPropList(); - - // Queries whether all the filters set in this property list are - // available currently. - bool allFiltersAvail() const; - - // Get space allocation time for this property. - H5D_alloc_time_t getAllocTime() const; - - // Set space allocation time for dataset during creation. - void setAllocTime(H5D_alloc_time_t alloc_time) const; - - // Retrieves the size of the chunks used to store a chunked layout dataset. - int getChunk( int max_ndims, hsize_t* dim ) const; - - // Sets the size of the chunks used to store a chunked layout dataset. - void setChunk( int ndims, const hsize_t* dim ) const; - - // Returns information about an external file. - void getExternal( unsigned idx, size_t name_size, char* name, off_t& offset, hsize_t& size ) const; - - // Returns the number of external files for a dataset. - int getExternalCount() const; - - // Gets fill value writing time. - H5D_fill_time_t getFillTime() const; - - // Sets fill value writing time for dataset. - void setFillTime(H5D_fill_time_t fill_time) const; - - // Retrieves a dataset fill value. - void getFillValue( const DataType& fvalue_type, void* value ) const; - - // Sets a dataset fill value. - void setFillValue( const DataType& fvalue_type, const void* value ) const; - - // Returns information about a filter in a pipeline. - H5Z_filter_t getFilter(int filter_number, unsigned int& flags, size_t& cd_nelmts, unsigned int* cd_values, size_t namelen, char name[], unsigned int &filter_config) const; - - // Returns information about a filter in a pipeline given the filter id. - void getFilterById(H5Z_filter_t filter_id, unsigned int &flags, size_t &cd_nelmts, unsigned int* cd_values, size_t namelen, char name[], unsigned int &filter_config) const; - - // Gets the layout of the raw data storage of the data that uses this - // property list. - H5D_layout_t getLayout() const; - - // Sets the type of storage used to store the raw data for the - // dataset that uses this property list. - void setLayout(H5D_layout_t layout) const; - - // Returns the number of filters in the pipeline. - int getNfilters() const; - - // Checks if fill value has been defined for this property. - H5D_fill_value_t isFillValueDefined() const; - - // Modifies the specified filter. - void modifyFilter( H5Z_filter_t filter_id, unsigned int flags, size_t cd_nelmts, const unsigned int cd_values[] ) const; - - // Remove one or all filters from the filter pipeline. - void removeFilter( H5Z_filter_t filter_id) const; - - // Sets compression method and compression level. - void setDeflate( int level ) const; - - // Adds an external file to the list of external files. - void setExternal( const char* name, off_t offset, hsize_t size ) const; - - // Adds a filter to the filter pipeline. - void setFilter( H5Z_filter_t filter, unsigned int flags = 0, size_t cd_nelmts = 0, const unsigned int cd_values[] = NULL) const; - - // Sets Fletcher32 checksum of EDC for this property list. - void setFletcher32() const; - - // Sets method of the shuffle filter. - void setShuffle() const; - - // Sets SZIP compression method. - void setSzip(unsigned int options_mask, unsigned int pixels_per_block) const; - - // Sets N-bit compression method. - void setNbit() const; - - ///\brief Returns this class name. - virtual H5std_string fromClass () const { return("DSetCreatPropList"); } - - // Copy constructor: creates a copy of a DSetCreatPropList object. - DSetCreatPropList(const DSetCreatPropList& orig); - - // Creates a copy of an existing dataset creation property list - // using the property list id. - DSetCreatPropList(const hid_t plist_id); - - // Noop destructor. - virtual ~DSetCreatPropList(); - -#ifndef DOXYGEN_SHOULD_SKIP_THIS - - // Deletes the global constant, should only be used by the library - static void deleteConstants(); - - private: - static DSetCreatPropList* DEFAULT_; - - // Creates the global constant, should only be used by the library - static DSetCreatPropList* getConstant(); - -#endif // DOXYGEN_SHOULD_SKIP_THIS -}; -} -#endif // __H5DSCreatPropList_H + ///\brief Default dataset creation property list. + static const DSetCreatPropList& DEFAULT; + + // Creates a // Creates a dataset creation property list. + DSetCreatPropList(); +hether all the // Queries whether all the filters set in this property list are + // available currently. + bool allFiltersAvail() const; +me for this property. + // Get space allocation time for this property. + H5D_alloc_time_t getAllocTime() const; + creation. + voi // Set space allocation time for dataset during creation. + void setAllocTime(H5D_alloc_time_t alloc_time) const; +ayout dataset. + // Retrieves the size of the chunks used to store a chunked layout dataset. + int getChunk(int max_ndims, hsize_t* dim) const; +d setChunk( i // Sets the size of the chunks used to store a chunked layout dataset. + void setChunk(int ndims, const hsize_t* dim) const; +name_size, ch // Returns information about an external file. + void getExternal(unsigned idx, size_t name_size, char* name, off_t& offset, hsize_t& size) const; +l value writi // Returns the number of external files for a dataset. + int getExternalCount() const; +taset. + void se // Gets fill value writing time. + H5D_fill_time_t getFillTime() const; +l value. + void // Sets fill value writing time for dataset. + void setFillTime(H5D_fill_time_t fill_time) const; +oid setFillValu // Retrieves a dataset fill value. + void getFillValue(const DataType& fvalue_type, void* value) const; +peline. + H5Z_ // Sets a dataset fill value. + void setFillValue(const DataType& fvalue_type, const void* value) const; +_t namelen, c // Returns information about a filter in a pipeline. + H5Z_filter_t getFilter(int filter_number, unsigned int& flags, size_t& cd_nelmts, unsigned int* cd_values, size_t namelen, char name[], unsigned int &filter_config) const; +ues, size_t nam // Returns information about a filter in a pipeline given the filter id. + void getFilterById(H5Z_filter_t filter_id, unsigned int &flags, size_t &cd_nelmts, unsigned int* cd_values, size_t namelen, char name[], unsigned int &filter_config) const; +dataset that us // Gets the layout of the raw data storage of the data that uses this + // property list. + H5D_layout_t getLayout() const; + getNfilters() const; + // Sets the type of storage used to store the raw data for the + // dataset that uses this property list. + void setLayout(H5D_layout_t layout) const; +modifyFilter( H5Z_filt // Returns the number of filters in the pipeline. + int getNfilters() const; +alues[] ) const // Checks if fill value has been defined for this property. + H5D_fill_value_t isFillValueDefined() const; +t; + + // Sets co // Modifies the specified filter. + void modifyFilter(H5Z_filter_t filter_id, unsigned int flags, size_t cd_nelmts, const unsigned int cd_values[]) const; +st char* name // Remove one or all filters from the filter pipeline. + void removeFilter(H5Z_filter_t filter_id) const; +r_t filter, un // Sets compression method and compression level. + void setDeflate(int level) const; +; + + // Sets F // Adds an external file to the list of external files. + void setExternal(const char* name, off_t offset, hsize_t size) const; +uffle() const // Adds a filter to the filter pipeline. + void setFilter(H5Z_filter_t filter, unsigned int flags = 0, size_t cd_nelmts = 0, const unsigned int cd_values[] = NULL) const; +t; + + ///\brief // Sets Fletcher32 checksum of EDC for this property list. + void setFletcher32() const; +pList"); } + + // // Sets method of the shuffle filter. + void setShuffle() const; + DSetCreatPropL // Sets SZIP compression method. + void setSzip(unsigned int options_mask, unsigned int pixels_per_block) const; +he property lis // Sets N-bit compression method. + void setNbit() const; +destructor. + vi ///\brief Returns this class name. + virtual H5std_string fromClass () const { return("DSetCreatPropList"); } +only be used by // Copy constructor: creates a copy of a DSetCreatPropList object. + DSetCreatPropList(const DSetCreatPropList& orig); +tes the global // Creates a copy of an existing dataset creation property list + // using the property list id. + DSetCreatPropList(const hid_t plist_id); +if // __H5DSCreatPropList_H diff --git a/c++/src/H5DxferProp.cpp b/c++/src/H5DxferProp.cpp index 8746d35..e018ff2 100644 --- a/c++/src/H5DxferProp.cpp +++ b/c++/src/H5DxferProp.cpp @@ -15,7 +15,7 @@ #include -#include "H5private.h" // for HDmemset +#include "H5private.h" // for HDmemset #include "H5Include.h" #include "H5Exception.h" #include "H5IdComponent.h" @@ -36,7 +36,7 @@ DSetMemXferPropList* DSetMemXferPropList::DEFAULT_ = 0; // Function: DSetMemXferPropList::getConstant // Creates a DSetMemXferPropList object representing the HDF5 // constant H5P_DATASET_XFER, pointed to by -// DSetMemXferPropList::DEFAULT_ +// DSetMemXferPropList::DEFAULT_ // exception H5::PropListIException // Description // If DSetMemXferPropList::DEFAULT_ already points to an allocated @@ -76,25 +76,25 @@ void DSetMemXferPropList::deleteConstants() } //-------------------------------------------------------------------------- -// Purpose Constant for default dataset memory and transfer property list. +// Purpose Constant for default dataset memory and transfer property list. //-------------------------------------------------------------------------- const DSetMemXferPropList& DSetMemXferPropList::DEFAULT = *getConstant(); #endif // DOXYGEN_SHOULD_SKIP_THIS //-------------------------------------------------------------------------- -// Function DSetMemXferPropList default constructor -///\brief Default constructor: creates a stub dataset memory and -/// transfer property list object. -// Programmer: Binh-Minh Ribler - 2000 +// Function DSetMemXferPropList default constructor +///\brief Default constructor: creates a stub dataset memory and +/// transfer property list object. +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- DSetMemXferPropList::DSetMemXferPropList() : PropList(H5P_DATASET_XFER) {} //-------------------------------------------------------------------------- -// Function DSetMemXferPropList constructor -///\brief Creates a dataset transfer property list with transform -/// expression. -// Programmer: Binh-Minh Ribler - 2000 +// Function DSetMemXferPropList constructor +///\brief Creates a dataset transfer property list with transform +/// expression. +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- DSetMemXferPropList::DSetMemXferPropList(const char* exp) : PropList(H5P_DATASET_XFER) { @@ -102,164 +102,164 @@ DSetMemXferPropList::DSetMemXferPropList(const char* exp) : PropList(H5P_DATASET } //-------------------------------------------------------------------------- -// Function DSetMemXferPropList copy constructor -///\brief Copy constructor: makes a copy of the original -/// DSetMemXferPropList object -///\param original - IN: Original dataset memory and transfer property -/// list object to copy -// Programmer: Binh-Minh Ribler - 2000 +// Function DSetMemXferPropList copy constructor +///\brief Copy constructor: makes a copy of the original +/// DSetMemXferPropList object +///\param original - IN: Original dataset memory and transfer property +/// list object to copy +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -DSetMemXferPropList::DSetMemXferPropList(const DSetMemXferPropList& original ) : PropList( original ) {} +DSetMemXferPropList::DSetMemXferPropList(const DSetMemXferPropList& original) : PropList(original ) {} //-------------------------------------------------------------------------- -// Function DSetMemXferPropList overloaded constructor -///\brief Creates a DSetMemXferPropList object using the id of an -/// existing DSetMemXferPropList. -///\param plist_id - IN: Id of an existing dataset memory and transfer -/// property list -// Programmer: Binh-Minh Ribler - 2000 +// Function DSetMemXferPropList overloaded constructor +///\brief Creates a DSetMemXferPropList object using the id of an +/// existing DSetMemXferPropList. +///\param plist_id - IN: Id of an existing dataset memory and transfer +/// property list +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- DSetMemXferPropList::DSetMemXferPropList(const hid_t plist_id) : PropList(plist_id) {} //-------------------------------------------------------------------------- -// Function: DSetMemXferPropList::setBuffer -///\brief Sets type conversion and background buffers. -///\param size - IN: Size, in bytes, of the type conversion and background buffers -///\param tconv - IN: Pointer to application-allocated type conversion buffer -///\param bkg - IN: Pointer to application-allocated background buffer -///\exception H5::PropListIException -// Programmer: Binh-Minh Ribler - 2000 +// Function: DSetMemXferPropList::setBuffer +///\brief Sets type conversion and background buffers. +///\param size - IN: Size, in bytes, of the type conversion and background buffers +///\param tconv - IN: Pointer to application-allocated type conversion buffer +///\param bkg - IN: Pointer to application-allocated background buffer +///\exception H5::PropListIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -void DSetMemXferPropList::setBuffer( size_t size, void* tconv, void* bkg ) const +void DSetMemXferPropList::setBuffer(size_t size, void* tconv, void* bkg) const { - herr_t ret_value = H5Pset_buffer( id, size, tconv, bkg ); - if( ret_value < 0 ) - { - throw PropListIException("DSetMemXferPropList::setBuffer", - "H5Pset_buffer failed"); - } + herr_t ret_value = H5Pset_buffer(id, size, tconv, bkg); + if(ret_value < 0) + { + throw PropListIException("DSetMemXferPropList::setBuffer", + "H5Pset_buffer failed"); + } } //-------------------------------------------------------------------------- -// Function: DSetMemXferPropList::getBuffer -///\brief Reads buffer settings. -///\param tconv - OUT: Pointer to application-allocated type conversion buf -///\param bkg - OUT: Pointer to application-allocated background buffer -///\return Buffer size, in bytes -///\exception H5::PropListIException -// Programmer: Binh-Minh Ribler - 2000 +// Function: DSetMemXferPropList::getBuffer +///\brief Reads buffer settings. +///\param tconv - OUT: Pointer to application-allocated type conversion buf +///\param bkg - OUT: Pointer to application-allocated background buffer +///\return Buffer size, in bytes +///\exception H5::PropListIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -size_t DSetMemXferPropList::getBuffer( void** tconv, void** bkg ) const +size_t DSetMemXferPropList::getBuffer(void** tconv, void** bkg) const { - size_t buffer_size = H5Pget_buffer( id, tconv, bkg ); - if( buffer_size == 0 ) - { - throw PropListIException("DSetMemXferPropList::getBuffer", - "H5Pget_buffer returned 0 for buffer size - failure"); - } - return( buffer_size ); + size_t buffer_size = H5Pget_buffer(id, tconv, bkg); + if(buffer_size == 0) + { + throw PropListIException("DSetMemXferPropList::getBuffer", + "H5Pget_buffer returned 0 for buffer size - failure"); + } + return(buffer_size); } //-------------------------------------------------------------------------- -// Function: DSetMemXferPropList::setPreserve -///\brief Sets the dataset transfer property list status to true or false. -///\param status - IN: Status to set, true or false -///\exception H5::PropListIException -// Programmer: Binh-Minh Ribler - 2000 +// Function: DSetMemXferPropList::setPreserve +///\brief Sets the dataset transfer property list status to true or false. +///\param status - IN: Status to set, true or false +///\exception H5::PropListIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -void DSetMemXferPropList::setPreserve( bool status ) const +void DSetMemXferPropList::setPreserve(bool status) const { - herr_t ret_value = H5Pset_preserve( id, (hbool_t) status ); - if( ret_value < 0 ) - { - throw PropListIException("DSetMemXferPropList::setPreserve", - "H5Pset_preserve failed"); - } + herr_t ret_value = H5Pset_preserve(id, (hbool_t) status); + if(ret_value < 0) + { + throw PropListIException("DSetMemXferPropList::setPreserve", + "H5Pset_preserve failed"); + } } //-------------------------------------------------------------------------- -// Function: DSetMemXferPropList::getPreserve -///\brief Checks status of the dataset transfer property list. -///\return Status of the dataset transfer property list -///\exception H5::PropListIException -// Programmer: Binh-Minh Ribler - 2000 +// Function: DSetMemXferPropList::getPreserve +///\brief Checks status of the dataset transfer property list. +///\return Status of the dataset transfer property list +///\exception H5::PropListIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- bool DSetMemXferPropList::getPreserve() const { - int ret_value = H5Pget_preserve( id ); - if( ret_value > 0 ) - return true; - else if( ret_value == 0 ) - return false; - else - { - throw PropListIException("DSetMemXferPropList::getPreserve", - "H5Pget_preserve returned negative value for status"); - } + int ret_value = H5Pget_preserve(id); + if(ret_value > 0) + return true; + else if(ret_value == 0) + return false; + else + { + throw PropListIException("DSetMemXferPropList::getPreserve", + "H5Pget_preserve returned negative value for status"); + } } //-------------------------------------------------------------------------- -// Function: DSetMemXferPropList::setBtreeRatios -///\brief Sets B-tree split ratios for a dataset transfer property list. -///\param left - IN: B-tree split ratio for left-most nodes -///\param middle - IN: B-tree split ratio for right-most nodes and lone nodes -///\param right - IN: B-tree split ratio for all other nodes -///\exception H5::PropListIException -// Programmer: Binh-Minh Ribler - 2000 +// Function: DSetMemXferPropList::setBtreeRatios +///\brief Sets B-tree split ratios for a dataset transfer property list. +///\param left - IN: B-tree split ratio for left-most nodes +///\param middle - IN: B-tree split ratio for right-most nodes and lone nodes +///\param right - IN: B-tree split ratio for all other nodes +///\exception H5::PropListIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -void DSetMemXferPropList::setBtreeRatios( double left, double middle, double right ) const +void DSetMemXferPropList::setBtreeRatios(double left, double middle, double right) const { - herr_t ret_value = H5Pset_btree_ratios( id, left, middle, right ); - if( ret_value < 0 ) - { - throw PropListIException("DSetMemXferPropList::setBtreeRatios", - "H5Pset_btree_ratios failed"); - } + herr_t ret_value = H5Pset_btree_ratios(id, left, middle, right); + if(ret_value < 0) + { + throw PropListIException("DSetMemXferPropList::setBtreeRatios", + "H5Pset_btree_ratios failed"); + } } //-------------------------------------------------------------------------- -// Function: DSetMemXferPropList::getBtreeRatios -///\brief Gets B-tree split ratios for a dataset transfer property list. -///\param left - OUT: B-tree split ratio for left-most nodes -///\param middle - OUT: B-tree split ratio for right-most nodes and lone nodes -///\param right - OUT: B-tree split ratio for all other nodes -///\exception H5::PropListIException -// Programmer: Binh-Minh Ribler - 2000 +// Function: DSetMemXferPropList::getBtreeRatios +///\brief Gets B-tree split ratios for a dataset transfer property list. +///\param left - OUT: B-tree split ratio for left-most nodes +///\param middle - OUT: B-tree split ratio for right-most nodes and lone nodes +///\param right - OUT: B-tree split ratio for all other nodes +///\exception H5::PropListIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -void DSetMemXferPropList::getBtreeRatios( double& left, double& middle, double& right ) const +void DSetMemXferPropList::getBtreeRatios(double& left, double& middle, double& right) const { - herr_t ret_value = H5Pget_btree_ratios( id, &left, &middle, &right ); - if( ret_value < 0 ) - { - throw PropListIException("DSetMemXferPropList::getBtreeRatios", - "H5Pget_btree_ratios failed"); - } + herr_t ret_value = H5Pget_btree_ratios(id, &left, &middle, &right); + if(ret_value < 0) + { + throw PropListIException("DSetMemXferPropList::getBtreeRatios", + "H5Pget_btree_ratios failed"); + } } //-------------------------------------------------------------------------- -// Function: DSetMemXferPropList::setDataTransform -///\brief Sets data transform expression. -///\param expression - IN: null-terminated data transform expression (char*) -///\exception H5::PropListIException -// Programmer: Binh-Minh Ribler - Mar, 2014 +// Function: DSetMemXferPropList::setDataTransform +///\brief Sets data transform expression. +///\param expression - IN: null-terminated data transform expression (char*) +///\exception H5::PropListIException +// Programmer Binh-Minh Ribler - Mar, 2014 //-------------------------------------------------------------------------- void DSetMemXferPropList::setDataTransform(const char* expression) const { - herr_t ret_value = H5Pset_data_transform( id, expression); - if( ret_value < 0 ) - { - throw PropListIException("DSetMemXferPropList::setDataTransform", - "H5Pset_data_transform failed"); - } + herr_t ret_value = H5Pset_data_transform(id, expression); + if(ret_value < 0) + { + throw PropListIException("DSetMemXferPropList::setDataTransform", + "H5Pset_data_transform failed"); + } } //-------------------------------------------------------------------------- -// Function: DSetMemXferPropList::setDataTransform -///\brief This is an overloaded member function, provided for convenience. -/// It takes a reference to a \c H5std_string for the expression. -///\param expression - IN: H5std_string data transform expression -///\exception H5::PropListIException -// Programmer: Binh-Minh Ribler - Mar, 2014 +// Function: DSetMemXferPropList::setDataTransform +///\brief This is an overloaded member function, provided for convenience. +/// It takes a reference to a \c H5std_string for the expression. +///\param expression - IN: H5std_string data transform expression +///\exception H5::PropListIException +// Programmer Binh-Minh Ribler - Mar, 2014 //-------------------------------------------------------------------------- void DSetMemXferPropList::setDataTransform(const H5std_string& expression) const { @@ -267,13 +267,13 @@ void DSetMemXferPropList::setDataTransform(const H5std_string& expression) const } //-------------------------------------------------------------------------- -// Function: DSetMemXferPropList::getDataTransform -///\brief Sets data transform expression. -///\param exp - OUT: buffer for data transform expression (char*) -///\param buf_size - IN: size of buffer for expression, including the -/// null terminator -///\exception H5::PropListIException -// Programmer: Binh-Minh Ribler - Mar, 2014 +// Function: DSetMemXferPropList::getDataTransform +///\brief Sets data transform expression. +///\param exp - OUT: buffer for data transform expression (char*) +///\param buf_size - IN: size of buffer for expression, including the +/// null terminator +///\exception H5::PropListIException +// Programmer Binh-Minh Ribler - Mar, 2014 //-------------------------------------------------------------------------- ssize_t DSetMemXferPropList::getDataTransform(char* exp, size_t buf_size) const { @@ -285,8 +285,8 @@ ssize_t DSetMemXferPropList::getDataTransform(char* exp, size_t buf_size) const // H5Pget_data_transform returns a negative value, raise an exception if (exp_len < 0) { - throw PropListIException("DSetMemXferPropList::getDataTransform", - "H5Pget_data_transform failed"); + throw PropListIException("DSetMemXferPropList::getDataTransform", + "H5Pget_data_transform failed"); } // H5Pget_data_transform will put a null terminator at the end of the @@ -298,11 +298,11 @@ ssize_t DSetMemXferPropList::getDataTransform(char* exp, size_t buf_size) const } //-------------------------------------------------------------------------- -// Function: DSetMemXferPropList::getDataTransform -///\brief This is an overloaded member function, provided for convenience. -/// It takes no parameter and returns a \c H5std_string for the expression. -///\exception H5::PropListIException -// Programmer: Binh-Minh Ribler - Mar, 2014 +// Function: DSetMemXferPropList::getDataTransform +///\brief This is an overloaded member function, provided for convenience. +/// It takes no parameter and returns a \c H5std_string for the expression. +///\exception H5::PropListIException +// Programmer Binh-Minh Ribler - Mar, 2014 //-------------------------------------------------------------------------- H5std_string DSetMemXferPropList::getDataTransform() const { @@ -340,226 +340,226 @@ H5std_string DSetMemXferPropList::getDataTransform() const } //-------------------------------------------------------------------------- -// Function: DSetMemXferPropList::getTypeConvCB -///\brief Sets an exception handling callback for datatype conversion -/// for a dataset transfer property list. -///\param op - IN: User's function -///\param user_data - IN: User's data -///\exception H5::PropListIException -// Programmer: Binh-Minh Ribler - April, 2004 +// Function: DSetMemXferPropList::getTypeConvCB +///\brief Sets an exception handling callback for datatype conversion +/// for a dataset transfer property list. +///\param op - IN: User's function +///\param user_data - IN: User's data +///\exception H5::PropListIException +// Programmer Binh-Minh Ribler - April, 2004 //-------------------------------------------------------------------------- -void DSetMemXferPropList::setTypeConvCB( H5T_conv_except_func_t op, void *user_data) const +void DSetMemXferPropList::setTypeConvCB(H5T_conv_except_func_t op, void *user_data) const { - herr_t ret_value = H5Pset_type_conv_cb( id, op, user_data); - if( ret_value < 0 ) - { - throw PropListIException("DSetMemXferPropList::setTypeConvCB", - "H5Pset_type_conv_cb failed"); - } + herr_t ret_value = H5Pset_type_conv_cb(id, op, user_data); + if(ret_value < 0) + { + throw PropListIException("DSetMemXferPropList::setTypeConvCB", + "H5Pset_type_conv_cb failed"); + } } //-------------------------------------------------------------------------- -// Function: DSetMemXferPropList::getTypeConvCB -///\brief Gets the exception handling callback function and data. -///\param op - IN: Retrieved user function -///\param user_data - IN: Retrieved user data -///\exception H5::PropListIException -// Programmer: Binh-Minh Ribler - April, 2004 +// Function: DSetMemXferPropList::getTypeConvCB +///\brief Gets the exception handling callback function and data. +///\param op - IN: Retrieved user function +///\param user_data - IN: Retrieved user data +///\exception H5::PropListIException +// Programmer Binh-Minh Ribler - April, 2004 //-------------------------------------------------------------------------- -void DSetMemXferPropList::getTypeConvCB( H5T_conv_except_func_t *op, void **user_data) const +void DSetMemXferPropList::getTypeConvCB(H5T_conv_except_func_t *op, void **user_data) const { - herr_t ret_value = H5Pget_type_conv_cb( id, op, user_data); - if( ret_value < 0 ) - { - throw PropListIException("DSetMemXferPropList::getTypeConvCB", - "H5Pget_type_conv_cb failed"); - } + herr_t ret_value = H5Pget_type_conv_cb(id, op, user_data); + if(ret_value < 0) + { + throw PropListIException("DSetMemXferPropList::getTypeConvCB", + "H5Pget_type_conv_cb failed"); + } } //-------------------------------------------------------------------------- -// Function: DSetMemXferPropList::setVlenMemManager -///\brief Sets the memory manager for variable-length datatype allocation. -///\param alloc_func - IN: User's allocate routine -///\param alloc_info - IN: User's allocation parameters -///\param free_func - IN: User's free routine -///\param free_info - IN: User's free parameters -///\exception H5::PropListIException -// Programmer: Binh-Minh Ribler - 2000 +// Function: DSetMemXferPropList::setVlenMemManager +///\brief Sets the memory manager for variable-length datatype allocation. +///\param alloc_func - IN: User's allocate routine +///\param alloc_info - IN: User's allocation parameters +///\param free_func - IN: User's free routine +///\param free_info - IN: User's free parameters +///\exception H5::PropListIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -void DSetMemXferPropList::setVlenMemManager( H5MM_allocate_t alloc_func, void* alloc_info, H5MM_free_t free_func, void* free_info ) const +void DSetMemXferPropList::setVlenMemManager(H5MM_allocate_t alloc_func, void* alloc_info, H5MM_free_t free_func, void* free_info) const { - herr_t ret_value = H5Pset_vlen_mem_manager( id, alloc_func, alloc_info, - free_func, free_info ); - if( ret_value < 0 ) - { - throw PropListIException("DSetMemXferPropList::setVlenMemManager", - "H5Pset_vlen_mem_manager failed"); - } + herr_t ret_value = H5Pset_vlen_mem_manager(id, alloc_func, alloc_info, + free_func, free_info); + if(ret_value < 0) + { + throw PropListIException("DSetMemXferPropList::setVlenMemManager", + "H5Pset_vlen_mem_manager failed"); + } } //-------------------------------------------------------------------------- -// Function: DSetMemXferPropList::setVlenMemManager -///\brief Sets the memory manager for variable-length datatype -/// allocation - system \c malloc and \c free will be used. +// Function: DSetMemXferPropList::setVlenMemManager +///\brief Sets the memory manager for variable-length datatype +/// allocation - system \c malloc and \c free will be used. /// -///\exception H5::PropListIException -// Programmer: Binh-Minh Ribler - 2000 +///\exception H5::PropListIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void DSetMemXferPropList::setVlenMemManager() const { - setVlenMemManager( NULL, NULL, NULL, NULL ); + setVlenMemManager(NULL, NULL, NULL, NULL); } //-------------------------------------------------------------------------- -// Function: DSetMemXferPropList::getVlenMemManager -///\brief Gets the memory manager for variable-length datatype allocation -///\param alloc_func - OUT: User's allocate routine -///\param alloc_info - OUT: User's allocation parameters -///\param free_func - OUT: User's free routine -///\param free_info - OUT: User's free parameters -///\exception H5::PropListIException -// Programmer: Binh-Minh Ribler - 2000 +// Function: DSetMemXferPropList::getVlenMemManager +///\brief Gets the memory manager for variable-length datatype allocation +///\param alloc_func - OUT: User's allocate routine +///\param alloc_info - OUT: User's allocation parameters +///\param free_func - OUT: User's free routine +///\param free_info - OUT: User's free parameters +///\exception H5::PropListIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -void DSetMemXferPropList::getVlenMemManager( H5MM_allocate_t& alloc_func, void** alloc_info, H5MM_free_t& free_func, void** free_info ) const +void DSetMemXferPropList::getVlenMemManager(H5MM_allocate_t& alloc_func, void** alloc_info, H5MM_free_t& free_func, void** free_info) const { - herr_t ret_value = H5Pget_vlen_mem_manager( id, &alloc_func, alloc_info, &free_func, free_info ); - if( ret_value < 0 ) - { - throw PropListIException("DSetMemXferPropList::getVlenMemManager", - "H5Pget_vlen_mem_manager failed"); - } + herr_t ret_value = H5Pget_vlen_mem_manager(id, &alloc_func, alloc_info, &free_func, free_info); + if (ret_value < 0) + { + throw PropListIException("DSetMemXferPropList::getVlenMemManager", + "H5Pget_vlen_mem_manager failed"); + } } //-------------------------------------------------------------------------- -// Function: DSetMemXferPropList::setSmallDataBlockSize -///\brief Sets the size of a contiguous block reserved for small data. -///\param size - IN: Maximum size, in bytes, of the small data block. -///\exception H5::PropListIException +// Function: DSetMemXferPropList::setSmallDataBlockSize +///\brief Sets the size of a contiguous block reserved for small data. +///\param size - IN: Maximum size, in bytes, of the small data block. +///\exception H5::PropListIException ///\par Description -/// For detail, please refer to the C layer Reference Manual at: +/// For detail, please refer to the C layer Reference Manual at: /// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetSmallData -// Programmer: Binh-Minh Ribler - April, 2004 +// Programmer Binh-Minh Ribler - April, 2004 //-------------------------------------------------------------------------- void DSetMemXferPropList::setSmallDataBlockSize(hsize_t size) const { - herr_t ret_value = H5Pset_small_data_block_size(id, size); - if (ret_value < 0) - { - throw PropListIException("DSetMemXferPropList::setSmallDataBlockSize", - "H5Pset_small_data_block_size failed"); - } + herr_t ret_value = H5Pset_small_data_block_size(id, size); + if (ret_value < 0) + { + throw PropListIException("DSetMemXferPropList::setSmallDataBlockSize", + "H5Pset_small_data_block_size failed"); + } } //-------------------------------------------------------------------------- -// Function: DSetMemXferPropList::getSmallDataBlockSize -///\brief Returns the current small data block size setting. -///\return Size of the small data block, in bytes -///\exception H5::PropListIException -// Programmer: Binh-Minh Ribler - April, 2004 +// Function: DSetMemXferPropList::getSmallDataBlockSize +///\brief Returns the current small data block size setting. +///\return Size of the small data block, in bytes +///\exception H5::PropListIException +// Programmer Binh-Minh Ribler - April, 2004 //-------------------------------------------------------------------------- hsize_t DSetMemXferPropList::getSmallDataBlockSize() const { - hsize_t size; - herr_t ret_value = H5Pget_small_data_block_size(id, &size); - if (ret_value < 0) - { - throw PropListIException("DSetMemXferPropList::getSmallDataBlockSize", - "H5Pget_small_data_block_size failed"); - } - return(size); + hsize_t size; + herr_t ret_value = H5Pget_small_data_block_size(id, &size); + if (ret_value < 0) + { + throw PropListIException("DSetMemXferPropList::getSmallDataBlockSize", + "H5Pget_small_data_block_size failed"); + } + return(size); } //-------------------------------------------------------------------------- -// Function: DSetMemXferPropList::setHyperVectorSize -///\brief Sets number of I/O vectors to be read/written in hyperslab I/O. +// Function: DSetMemXferPropList::setHyperVectorSize +///\brief Sets number of I/O vectors to be read/written in hyperslab I/O. /// -///\exception H5::PropListIException +///\exception H5::PropListIException ///\par Description -/// For information, please refer to the C layer Reference -/// Manual at: +/// For information, please refer to the C layer Reference +/// Manual at: /// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetHyperVectorSize -// Programmer: Binh-Minh Ribler - April, 2004 +// Programmer Binh-Minh Ribler - April, 2004 //-------------------------------------------------------------------------- void DSetMemXferPropList::setHyperVectorSize(size_t vector_size) const { - herr_t ret_value = H5Pset_hyper_vector_size(id, vector_size); - if (ret_value < 0) - { - throw PropListIException("DSetMemXferPropList::setHyperVectorSize", - "H5Pset_hyper_vector_size failed"); - } + herr_t ret_value = H5Pset_hyper_vector_size(id, vector_size); + if (ret_value < 0) + { + throw PropListIException("DSetMemXferPropList::setHyperVectorSize", + "H5Pset_hyper_vector_size failed"); + } } //-------------------------------------------------------------------------- -// Function: DSetMemXferPropList::getHyperVectorSize -///\brief Returns the number of I/O vectors to be read/written in -/// hyperslab I/O. -///\return Number of I/O vectors -///\exception H5::PropListIException -// Programmer: Binh-Minh Ribler - April, 2004 +// Function: DSetMemXferPropList::getHyperVectorSize +///\brief Returns the number of I/O vectors to be read/written in +/// hyperslab I/O. +///\return Number of I/O vectors +///\exception H5::PropListIException +// Programmer Binh-Minh Ribler - April, 2004 //-------------------------------------------------------------------------- size_t DSetMemXferPropList::getHyperVectorSize() const { - size_t vector_size; - herr_t ret_value = H5Pget_hyper_vector_size(id, &vector_size); - if (ret_value < 0) - { - throw PropListIException("DSetMemXferPropList::getHyperVectorSize", - "H5Pget_hyper_vector_size failed"); - } - return(vector_size); + size_t vector_size; + herr_t ret_value = H5Pget_hyper_vector_size(id, &vector_size); + if (ret_value < 0) + { + throw PropListIException("DSetMemXferPropList::getHyperVectorSize", + "H5Pget_hyper_vector_size failed"); + } + return(vector_size); } //-------------------------------------------------------------------------- -// Function: DSetMemXferPropList::setEDCCheck -///\brief Enables or disables error-detecting for a dataset reading -/// process. -///\param check - IN: Specifies whether error detection is enabled or -/// disabled -///\exception H5::PropListIException +// Function: DSetMemXferPropList::setEDCCheck +///\brief Enables or disables error-detecting for a dataset reading +/// process. +///\param check - IN: Specifies whether error detection is enabled or +/// disabled +///\exception H5::PropListIException ///\par Description -/// The error detection algorithm used is the algorithm previously -/// specified in the corresponding dataset creation property -/// list. This function does not affect the use of error -/// detection in the writing process. +/// The error detection algorithm used is the algorithm previously +/// specified in the corresponding dataset creation property +/// list. This function does not affect the use of error +/// detection in the writing process. ///\par -/// Valid values are as follows: -/// \li \c H5Z_ENABLE_EDC (default) -/// \li \c H5Z_DISABLE_EDC -// Programmer: Binh-Minh Ribler - April, 2004 +/// Valid values are as follows: +/// \li \c H5Z_ENABLE_EDC (default) +/// \li \c H5Z_DISABLE_EDC +// Programmer Binh-Minh Ribler - April, 2004 //-------------------------------------------------------------------------- void DSetMemXferPropList::setEDCCheck(H5Z_EDC_t check) const { - herr_t ret_value = H5Pset_edc_check(id, check); - if (ret_value < 0) - { - throw PropListIException("DSetMemXferPropList::setEDCCheck", - "H5Pset_edc_check failed"); - } + herr_t ret_value = H5Pset_edc_check(id, check); + if (ret_value < 0) + { + throw PropListIException("DSetMemXferPropList::setEDCCheck", + "H5Pset_edc_check failed"); + } } //-------------------------------------------------------------------------- -// Function: DSetMemXferPropList::getEDCCheck -///\brief Determines whether error-detection is enabled for dataset reads. -///\return \c H5Z_ENABLE_EDC or \c H5Z_DISABLE_EDC -///\exception H5::PropListIException -// Programmer: Binh-Minh Ribler - April, 2004 +// Function: DSetMemXferPropList::getEDCCheck +///\brief Determines whether error-detection is enabled for dataset reads. +///\return \c H5Z_ENABLE_EDC or \c H5Z_DISABLE_EDC +///\exception H5::PropListIException +// Programmer Binh-Minh Ribler - April, 2004 //-------------------------------------------------------------------------- H5Z_EDC_t DSetMemXferPropList::getEDCCheck() const { - H5Z_EDC_t check = H5Pget_edc_check(id); - if (check < 0) - { - throw PropListIException("DSetMemXferPropList::getEDCCheck", - "H5Pget_edc_check failed"); - } - return(check); + H5Z_EDC_t check = H5Pget_edc_check(id); + if (check < 0) + { + throw PropListIException("DSetMemXferPropList::getEDCCheck", + "H5Pget_edc_check failed"); + } + return(check); } //-------------------------------------------------------------------------- -// Function: DSetMemXferPropList destructor -///\brief Noop destructor. -// Programmer Binh-Minh Ribler - 2000 +// Function: DSetMemXferPropList destructor +///\brief Noop destructor. +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- DSetMemXferPropList::~DSetMemXferPropList() {} diff --git a/c++/src/H5DxferProp.h b/c++/src/H5DxferProp.h index 42194fb..f1c363f 100644 --- a/c++/src/H5DxferProp.h +++ b/c++/src/H5DxferProp.h @@ -27,93 +27,93 @@ namespace H5 { */ class H5_DLLCPP DSetMemXferPropList : public PropList { public: - ///\brief Default dataset memory and transfer property list. - static const DSetMemXferPropList& DEFAULT; + ///\brief Default dataset memory and transfer property list. + static const DSetMemXferPropList& DEFAULT; - // Creates a dataset memory and transfer property list. - DSetMemXferPropList(); + // Creates a dataset memory and transfer property list. + DSetMemXferPropList(); - // Creates a dataset transform property list. - DSetMemXferPropList(const char* expression); + // Creates a dataset transform property list. + DSetMemXferPropList(const char* expression); - // Sets type conversion and background buffers. - void setBuffer( size_t size, void* tconv, void* bkg ) const; + // Sets type conversion and background buffers. + void setBuffer(size_t size, void* tconv, void* bkg) const; - // Reads buffer settings. - size_t getBuffer( void** tconv, void** bkg ) const; + // Reads buffer settings. + size_t getBuffer(void** tconv, void** bkg) const; - // Sets B-tree split ratios for a dataset transfer property list. - void setBtreeRatios( double left, double middle, double right ) const; + // Sets B-tree split ratios for a dataset transfer property list. + void setBtreeRatios(double left, double middle, double right) const; - // Gets B-tree split ratios for a dataset transfer property list. - void getBtreeRatios( double& left, double& middle, double& right ) const; + // Gets B-tree split ratios for a dataset transfer property list. + void getBtreeRatios(double& left, double& middle, double& right) const; - // Sets data transform expression. - void setDataTransform(const char* expression) const; - void setDataTransform(const H5std_string& expression) const; + // Sets data transform expression. + void setDataTransform(const char* expression) const; + void setDataTransform(const H5std_string& expression) const; - // Gets data transform expression. - ssize_t getDataTransform(char* exp, size_t buf_size=0) const; - H5std_string getDataTransform() const; + // Gets data transform expression. + ssize_t getDataTransform(char* exp, size_t buf_size=0) const; + H5std_string getDataTransform() const; - // Sets the dataset transfer property list status to TRUE or FALSE. - void setPreserve( bool status ) const; + // Sets the dataset transfer property list status to TRUE or FALSE. + void setPreserve(bool status) const; - // Checks status of the dataset transfer property list. - bool getPreserve() const; + // Checks status of the dataset transfer property list. + bool getPreserve() const; - // Sets an exception handling callback for datatype conversion. - void setTypeConvCB( H5T_conv_except_func_t op, void *user_data) const; + // Sets an exception handling callback for datatype conversion. + void setTypeConvCB(H5T_conv_except_func_t op, void *user_data) const; - // Gets the exception handling callback for datatype conversion. - void getTypeConvCB( H5T_conv_except_func_t *op, void **user_data) const; + // Gets the exception handling callback for datatype conversion. + void getTypeConvCB(H5T_conv_except_func_t *op, void **user_data) const; - // Sets the memory manager for variable-length datatype - // allocation in H5Dread and H5Dvlen_reclaim. - void setVlenMemManager( H5MM_allocate_t alloc, void* alloc_info, - H5MM_free_t free, void* free_info ) const; + // Sets the memory manager for variable-length datatype + // allocation in H5Dread and H5Dvlen_reclaim. + void setVlenMemManager(H5MM_allocate_t alloc, void* alloc_info, + H5MM_free_t free, void* free_info) const; - // alloc and free are set to NULL, indicating that system - // malloc and free are to be used. - void setVlenMemManager() const; + // alloc and free are set to NULL, indicating that system + // malloc and free are to be used. + void setVlenMemManager() const; - // Gets the memory manager for variable-length datatype - // allocation in H5Dread and H5Tvlen_reclaim. - void getVlenMemManager( H5MM_allocate_t& alloc, void** alloc_info, - H5MM_free_t& free, void** free_info ) const; + // Gets the memory manager for variable-length datatype + // allocation in H5Dread and H5Tvlen_reclaim. + void getVlenMemManager(H5MM_allocate_t& alloc, void** alloc_info, + H5MM_free_t& free, void** free_info) const; - // Sets the size of a contiguous block reserved for small data. - void setSmallDataBlockSize(hsize_t size) const; + // Sets the size of a contiguous block reserved for small data. + void setSmallDataBlockSize(hsize_t size) const; - // Returns the current small data block size setting. - hsize_t getSmallDataBlockSize() const; + // Returns the current small data block size setting. + hsize_t getSmallDataBlockSize() const; - // Sets number of I/O vectors to be read/written in hyperslab I/O. - void setHyperVectorSize(size_t vector_size) const; + // Sets number of I/O vectors to be read/written in hyperslab I/O. + void setHyperVectorSize(size_t vector_size) const; - // Returns the number of I/O vectors to be read/written in - // hyperslab I/O. - size_t getHyperVectorSize() const; + // Returns the number of I/O vectors to be read/written in + // hyperslab I/O. + size_t getHyperVectorSize() const; - // Enables or disables error-detecting for a dataset reading - // process. - void setEDCCheck(H5Z_EDC_t check) const; + // Enables or disables error-detecting for a dataset reading + // process. + void setEDCCheck(H5Z_EDC_t check) const; - // Determines whether error-detection is enabled for dataset reads. - H5Z_EDC_t getEDCCheck() const; + // Determines whether error-detection is enabled for dataset reads. + H5Z_EDC_t getEDCCheck() const; - ///\brief Returns this class name. - virtual H5std_string fromClass () const { return("DSetMemXferPropList"); } + ///\brief Returns this class name. + virtual H5std_string fromClass () const { return("DSetMemXferPropList"); } - // Copy constructor: makes a copy of a DSetMemXferPropList object. - DSetMemXferPropList(const DSetMemXferPropList& orig); + // Copy constructor: makes a copy of a DSetMemXferPropList object. + DSetMemXferPropList(const DSetMemXferPropList& orig); - // Creates a copy of an existing dataset memory and transfer - // property list using the property list id. - DSetMemXferPropList(const hid_t plist_id); + // Creates a copy of an existing dataset memory and transfer + // property list using the property list id. + DSetMemXferPropList(const hid_t plist_id); - // Noop destructor - virtual ~DSetMemXferPropList(); + // Noop destructor + virtual ~DSetMemXferPropList(); #ifndef DOXYGEN_SHOULD_SKIP_THIS @@ -121,7 +121,7 @@ class H5_DLLCPP DSetMemXferPropList : public PropList { static void deleteConstants(); private: - static DSetMemXferPropList* DEFAULT_; + static DSetMemXferPropList* DEFAULT_; // Creates the global constant, should only be used by the library static DSetMemXferPropList* getConstant(); diff --git a/c++/src/H5EnumType.cpp b/c++/src/H5EnumType.cpp index 5e1f0bd..49f60e6 100644 --- a/c++/src/H5EnumType.cpp +++ b/c++/src/H5EnumType.cpp @@ -15,7 +15,7 @@ #include -#include "H5private.h" // for HDmemset +#include "H5private.h" // for HDmemset #include "H5Include.h" #include "H5Exception.h" #include "H5IdComponent.h" @@ -37,230 +37,230 @@ namespace H5 { //-------------------------------------------------------------------------- -// Function: EnumType default constructor -///\brief Default constructor: Creates a stub datatype -// Programmer Binh-Minh Ribler - 2000 +// Function: EnumType default constructor +///\brief Default constructor: Creates a stub datatype +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- EnumType::EnumType() : DataType() {} //-------------------------------------------------------------------------- -// Function: EnumType overloaded constructor -///\brief Creates an EnumType object using the id of an existing datatype. -///\param existing_id - IN: Id of an existing datatype -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 +// Function: EnumType overloaded constructor +///\brief Creates an EnumType object using the id of an existing datatype. +///\param existing_id - IN: Id of an existing datatype +///\exception H5::DataTypeIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -EnumType::EnumType( const hid_t existing_id ) : DataType( existing_id ) {} +EnumType::EnumType(const hid_t existing_id) : DataType( existing_id ) {} //-------------------------------------------------------------------------- -// Function: EnumType copy constructor -///\brief Copy constructor: makes a copy of the original EnumType object. -// Programmer Binh-Minh Ribler - 2000 +// Function: EnumType copy constructor +///\brief Copy constructor: makes a copy of the original EnumType object. +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -EnumType::EnumType( const EnumType& original ) : DataType( original ) {} +EnumType::EnumType(const EnumType& original) : DataType( original ) {} //-------------------------------------------------------------------------- -// Function: EnumType overloaded constructor -///\brief Creates an empty enumeration datatype given a size, in bytes. -///\param size - IN: Number of bytes in the datatype to create -///\exception H5::DataTypeIException +// Function: EnumType overloaded constructor +///\brief Creates an empty enumeration datatype given a size, in bytes. +///\param size - IN: Number of bytes in the datatype to create +///\exception H5::DataTypeIException // Description -// The DataType constructor calls the C API H5Tcreate to create -// the enum datatype. -// Programmer Binh-Minh Ribler - 2000 +// The DataType constructor calls the C API H5Tcreate to create +// the enum datatype. +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -EnumType::EnumType( size_t size ) : DataType( H5T_ENUM, size ) {} +EnumType::EnumType(size_t size) : DataType( H5T_ENUM, size ) {} //-------------------------------------------------------------------------- -// Function: EnumType overloaded constructor -///\brief Gets the enum datatype of the specified dataset. -///\param dataset - IN: Dataset that this enum datatype associates with -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 +// Function: EnumType overloaded constructor +///\brief Gets the enum datatype of the specified dataset. +///\param dataset - IN: Dataset that this enum datatype associates with +///\exception H5::DataTypeIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -EnumType::EnumType( const DataSet& dataset ) : DataType() +EnumType::EnumType(const DataSet& dataset) : DataType() { - // Calls C function H5Dget_type to get the id of the datatype - id = H5Dget_type( dataset.getId() ); + // Calls C function H5Dget_type to get the id of the datatype + id = H5Dget_type(dataset.getId()); - // If the datatype id is not valid, throw an exception - if( id < 0 ) - { - throw DataSetIException("EnumType constructor", "H5Dget_type failed"); - } + // If the datatype id is not valid, throw an exception + if (id < 0) + { + throw DataSetIException("EnumType constructor", "H5Dget_type failed"); + } } //-------------------------------------------------------------------------- -// Function: EnumType overloaded constructor -///\brief Creates a new enum datatype based on an integer datatype. -///\param data_type - IN: Base datatype -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 +// Function: EnumType overloaded constructor +///\brief Creates a new enum datatype based on an integer datatype. +///\param data_type - IN: Base datatype +///\exception H5::DataTypeIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -EnumType::EnumType( const IntType& data_type ) : DataType() +EnumType::EnumType(const IntType& data_type) : DataType() { - // Calls C function H5Tenum_create to get the id of the datatype - id = H5Tenum_create( data_type.getId() ); + // Calls C function H5Tenum_create to get the id of the datatype + id = H5Tenum_create(data_type.getId()); - // If the datatype id is not valid, throw an exception - if( id < 0 ) - { - throw DataSetIException("EnumType constructor", "H5Tenum_create failed"); - } + // If the datatype id is not valid, throw an exception + if (id < 0) + { + throw DataSetIException("EnumType constructor", "H5Tenum_create failed"); + } } //-------------------------------------------------------------------------- -// Function: EnumType overloaded constructor -///\brief Creates an EnumType instance by opening an HDF5 enum datatype -/// given its name, provided as a C character string. -///\param dtype_name - IN: Enum datatype name -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - Dec 2016 +// Function: EnumType overloaded constructor +///\brief Creates an EnumType instance by opening an HDF5 enum datatype +/// given its name, provided as a C character string. +///\param dtype_name - IN: Enum datatype name +///\exception H5::DataTypeIException +// Programmer Binh-Minh Ribler - Dec 2016 // Description -// In 1.10.1, this constructor was introduced and will replace the -// existing function CommonFG::openEnumType(const char*) to -// improve usability. -// -BMR, Dec 2016 +// In 1.10.1, this constructor was introduced and will replace the +// existing function CommonFG::openEnumType(const char*) to +// improve usability. +// -BMR, Dec 2016 //-------------------------------------------------------------------------- EnumType::EnumType(const H5Location& loc, const char *dtype_name) : DataType() { - id = p_opentype(loc, dtype_name); + id = p_opentype(loc, dtype_name); } //-------------------------------------------------------------------------- -// Function: EnumType overloaded constructor -///\brief Creates an EnumType instance by opening an HDF5 enum datatype -/// given its name, provided as an \c H5std_string. -///\param dtype_name - IN: Enum datatype name -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - Dec 2016 +// Function: EnumType overloaded constructor +///\brief Creates an EnumType instance by opening an HDF5 enum datatype +/// given its name, provided as an \c H5std_string. +///\param dtype_name - IN: Enum datatype name +///\exception H5::DataTypeIException +// Programmer Binh-Minh Ribler - Dec 2016 // Description -// In 1.10.1, this constructor was introduced and will replace the -// existing function CommonFG::openEnumType(const H5std_string&) -// to improve usability. -// -BMR, Dec 2016 +// In 1.10.1, this constructor was introduced and will replace the +// existing function CommonFG::openEnumType(const H5std_string&) +// to improve usability. +// -BMR, Dec 2016 //-------------------------------------------------------------------------- EnumType::EnumType(const H5Location& loc, const H5std_string& dtype_name) : DataType() { - id = p_opentype(loc, dtype_name.c_str()); + id = p_opentype(loc, dtype_name.c_str()); } //-------------------------------------------------------------------------- -// Function: EnumType::insert -///\brief Inserts a new member to this enumeration datatype. -///\param name - IN: Name of the new member -///\param value - IN: Pointer to the value of the new member -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 +// Function: EnumType::insert +///\brief Inserts a new member to this enumeration datatype. +///\param name - IN: Name of the new member +///\param value - IN: Pointer to the value of the new member +///\exception H5::DataTypeIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -void EnumType::insert( const char* name, void *value ) const +void EnumType::insert(const char* name, void *value) const { - // Calls C routine H5Tenum_insert to insert the new enum datatype member. - herr_t ret_value = H5Tenum_insert( id, name, value ); - if( ret_value < 0 ) - { - throw DataTypeIException("EnumType::insert", "H5Tenum_insert failed"); - } + // Calls C routine H5Tenum_insert to insert the new enum datatype member. + herr_t ret_value = H5Tenum_insert(id, name, value); + if (ret_value < 0) + { + throw DataTypeIException("EnumType::insert", "H5Tenum_insert failed"); + } } //-------------------------------------------------------------------------- -// Function: EnumType::insert -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function only in the type of -/// argument \a name. -// Programmer Binh-Minh Ribler - 2000 +// Function: EnumType::insert +///\brief This is an overloaded member function, provided for convenience. +/// It differs from the above function only in the type of +/// argument \a name. +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -void EnumType::insert( const H5std_string& name, void *value ) const +void EnumType::insert(const H5std_string& name, void *value) const { - insert( name.c_str(), value ); + insert(name.c_str(), value); } //-------------------------------------------------------------------------- -// Function: EnumType::nameOf -///\brief Returns the symbol name corresponding to a specified member -/// of this enumeration datatype. -///\param value - IN: Pointer to the value of the enum datatype -///\param size - IN: Size for the name -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 +// Function: EnumType::nameOf +///\brief Returns the symbol name corresponding to a specified member +/// of this enumeration datatype. +///\param value - IN: Pointer to the value of the enum datatype +///\param size - IN: Size for the name +///\exception H5::DataTypeIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -H5std_string EnumType::nameOf( void *value, size_t size ) const +H5std_string EnumType::nameOf(void *value, size_t size) const { - char* name_C = new char[size+1]; // temporary C-string for C API - HDmemset(name_C, 0, size+1); // clear buffer + char* name_C = new char[size+1]; // temporary C-string for C API + HDmemset(name_C, 0, size+1); // clear buffer - // Calls C routine H5Tenum_nameof to get the name of the specified enum type - herr_t ret_value = H5Tenum_nameof( id, value, name_C, size ); + // Calls C routine H5Tenum_nameof to get the name of the specified enum type + herr_t ret_value = H5Tenum_nameof(id, value, name_C, size); - // If H5Tenum_nameof returns a negative value, raise an exception, - if( ret_value < 0 ) - { + // If H5Tenum_nameof returns a negative value, raise an exception, + if (ret_value < 0) + { delete []name_C; - throw DataTypeIException("EnumType::nameOf", "H5Tenum_nameof failed"); - } - // otherwise, create the string to hold the datatype name and return it - H5std_string name(name_C); - delete []name_C; - return( name ); + throw DataTypeIException("EnumType::nameOf", "H5Tenum_nameof failed"); + } + // otherwise, create the string to hold the datatype name and return it + H5std_string name(name_C); + delete []name_C; + return(name); } //-------------------------------------------------------------------------- -// Function: EnumType::valueOf -///\brief Retrieves the value corresponding to a member of this -/// enumeration datatype, given the member's name. -///\param name - IN: Name of the queried member -///\param value - OUT: Pointer to the retrieved value -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 +// Function: EnumType::valueOf +///\brief Retrieves the value corresponding to a member of this +/// enumeration datatype, given the member's name. +///\param name - IN: Name of the queried member +///\param value - OUT: Pointer to the retrieved value +///\exception H5::DataTypeIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -void EnumType::valueOf( const char* name, void *value ) const +void EnumType::valueOf(const char* name, void *value) const { - // Calls C routine H5Tenum_valueof to get the enum datatype value - herr_t ret_value = H5Tenum_valueof( id, name, value ); - if( ret_value < 0 ) - { - throw DataTypeIException("EnumType::valueOf", "H5Tenum_valueof failed"); - } + // Calls C routine H5Tenum_valueof to get the enum datatype value + herr_t ret_value = H5Tenum_valueof(id, name, value); + if (ret_value < 0) + { + throw DataTypeIException("EnumType::valueOf", "H5Tenum_valueof failed"); + } } //-------------------------------------------------------------------------- -// Function: EnumType::valueOf -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function only in the type of -/// argument \a name. -// Programmer Binh-Minh Ribler - 2000 +// Function: EnumType::valueOf +///\brief This is an overloaded member function, provided for convenience. +/// It differs from the above function only in the type of +/// argument \a name. +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -void EnumType::valueOf( const H5std_string& name, void *value ) const +void EnumType::valueOf(const H5std_string& name, void *value) const { - valueOf( name.c_str(), value ); + valueOf(name.c_str(), value); } //-------------------------------------------------------------------------- -// Function: EnumType::getMemberIndex -///\brief Returns the index of a member in this enumeration datatype. -///\param name - IN: Name of the queried member -///\return Index of the member if it exists. Index will have the value -/// between 0 and \c N-1, where \c N is the value returned by the -/// member function \c EnumType::getNmembers. -///\exception H5::DataTypeIException +// Function: EnumType::getMemberIndex +///\brief Returns the index of a member in this enumeration datatype. +///\param name - IN: Name of the queried member +///\return Index of the member if it exists. Index will have the value +/// between 0 and \c N-1, where \c N is the value returned by the +/// member function \c EnumType::getNmembers. +///\exception H5::DataTypeIException // Programmer Binh-Minh Ribler - May 16, 2002 //-------------------------------------------------------------------------- int EnumType::getMemberIndex(const char *name) const { - int member_index = H5Tget_member_index(id, name); - if( member_index < 0 ) - { - throw DataTypeIException("EnumType::getMemberIndex", + int member_index = H5Tget_member_index(id, name); + if (member_index < 0) + { + throw DataTypeIException("EnumType::getMemberIndex", "H5Tget_member_index returns negative value"); - } - return( member_index ); + } + return(member_index); } //-------------------------------------------------------------------------- -// Function: EnumType::getMemberIndex -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function only in the type of -/// argument \a name. +// Function: EnumType::getMemberIndex +///\brief This is an overloaded member function, provided for convenience. +/// It differs from the above function only in the type of +/// argument \a name. // Programmer Binh-Minh Ribler - May 16, 2002 //-------------------------------------------------------------------------- int EnumType::getMemberIndex(const H5std_string& name) const @@ -269,46 +269,46 @@ int EnumType::getMemberIndex(const H5std_string& name) const } //-------------------------------------------------------------------------- -// Function: EnumType::getNmembers -///\brief Returns the number of members in this enumeration datatype. -///\return Number of members -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - May, 2004 +// Function: EnumType::getNmembers +///\brief Returns the number of members in this enumeration datatype. +///\return Number of members +///\exception H5::DataTypeIException +// Programmer Binh-Minh Ribler - May, 2004 //-------------------------------------------------------------------------- int EnumType::getNmembers() const { - int num_members = H5Tget_nmembers( id ); - if( num_members < 0 ) - { - throw DataTypeIException("EnumType::getNmembers", + int num_members = H5Tget_nmembers(id); + if (num_members < 0) + { + throw DataTypeIException("EnumType::getNmembers", "H5Tget_nmembers returns negative number of members"); - } - return( num_members ); + } + return(num_members); } //-------------------------------------------------------------------------- -// Function: EnumType::getMemberValue -///\brief Retrieves the value of a member in this enumeration datatype, -/// given the member's index. -///\param memb_no - IN: Index of the queried member -///\param value - OUT: Pointer to the retrieved value -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 +// Function: EnumType::getMemberValue +///\brief Retrieves the value of a member in this enumeration datatype, +/// given the member's index. +///\param memb_no - IN: Index of the queried member +///\param value - OUT: Pointer to the retrieved value +///\exception H5::DataTypeIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -void EnumType::getMemberValue( unsigned memb_no, void *value ) const +void EnumType::getMemberValue(unsigned memb_no, void *value) const { - // Call C routine H5Tget_member_value to get the datatype member's value - hid_t ret_value = H5Tget_member_value( id, memb_no, value ); - if( ret_value < 0 ) - { - throw DataTypeIException("EnumType::getMemberValue", "H5Tget_member_value failed"); - } + // Call C routine H5Tget_member_value to get the datatype member's value + hid_t ret_value = H5Tget_member_value(id, memb_no, value); + if (ret_value < 0) + { + throw DataTypeIException("EnumType::getMemberValue", "H5Tget_member_value failed"); + } } //-------------------------------------------------------------------------- -// Function: EnumType destructor -///\brief Properly terminates access to this enum datatype. -// Programmer Binh-Minh Ribler - 2000 +// Function: EnumType destructor +///\brief Properly terminates access to this enum datatype. +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- EnumType::~EnumType() {} diff --git a/c++/src/H5EnumType.h b/c++/src/H5EnumType.h index 054811b..2fbe2cd 100644 --- a/c++/src/H5EnumType.h +++ b/c++/src/H5EnumType.h @@ -28,56 +28,56 @@ namespace H5 { class H5_DLLCPP EnumType : public DataType { public: - // Creates an empty enumeration datatype based on a native signed - // integer type, whose size is given by size. - EnumType( size_t size ); + // Creates an empty enumeration datatype based on a native signed + // integer type, whose size is given by size. + EnumType(size_t size); - // Gets the enum datatype of the specified dataset - EnumType( const DataSet& dataset ); // H5Dget_type + // Gets the enum datatype of the specified dataset + EnumType(const DataSet& dataset); // H5Dget_type - // Creates a new enum datatype based on an integer datatype - EnumType( const IntType& data_type ); // H5Tenum_create + // Creates a new enum datatype based on an integer datatype + EnumType(const IntType& data_type); // H5Tenum_create - // Constructors that open an enum datatype, given a location. - EnumType(const H5Location& loc, const char* name); - EnumType(const H5Location& loc, const H5std_string& name); + // Constructors that open an enum datatype, given a location. + EnumType(const H5Location& loc, const char* name); + EnumType(const H5Location& loc, const H5std_string& name); - // Returns the number of members in this enumeration datatype. - int getNmembers () const; + // Returns the number of members in this enumeration datatype. + int getNmembers () const; - // Returns the index of a member in this enumeration data type. - int getMemberIndex(const char* name) const; - int getMemberIndex(const H5std_string& name) const; + // Returns the index of a member in this enumeration data type. + int getMemberIndex(const char* name) const; + int getMemberIndex(const H5std_string& name) const; - // Returns the value of an enumeration datatype member - void getMemberValue( unsigned memb_no, void *value ) const; + // Returns the value of an enumeration datatype member + void getMemberValue(unsigned memb_no, void *value) const; - // Inserts a new member to this enumeration type. - void insert( const char* name, void *value ) const; - void insert( const H5std_string& name, void *value ) const; + // Inserts a new member to this enumeration type. + void insert(const char* name, void *value) const; + void insert(const H5std_string& name, void *value) const; - // Returns the symbol name corresponding to a specified member - // of this enumeration datatype. - H5std_string nameOf( void *value, size_t size ) const; + // Returns the symbol name corresponding to a specified member + // of this enumeration datatype. + H5std_string nameOf(void *value, size_t size) const; - // Returns the value corresponding to a specified member of this - // enumeration datatype. - void valueOf( const char* name, void *value ) const; - void valueOf( const H5std_string& name, void *value ) const; + // Returns the value corresponding to a specified member of this + // enumeration datatype. + void valueOf(const char* name, void *value) const; + void valueOf(const H5std_string& name, void *value) const; - ///\brief Returns this class name. - virtual H5std_string fromClass () const { return("EnumType"); } + ///\brief Returns this class name. + virtual H5std_string fromClass () const { return("EnumType"); } - // Default constructor - EnumType(); + // Default constructor + EnumType(); - // Creates an enumeration datatype using an existing id - EnumType( const hid_t existing_id ); + // Creates an enumeration datatype using an existing id + EnumType(const hid_t existing_id); - // Copy constructor: makes a copy of the original EnumType object. - EnumType( const EnumType& original ); + // Copy constructor: makes a copy of the original EnumType object. + EnumType(const EnumType& original); - virtual ~EnumType(); + virtual ~EnumType(); }; } #endif // __H5EnumType_H diff --git a/c++/src/H5Exception.cpp b/c++/src/H5Exception.cpp index 335bb20..0316f64 100644 --- a/c++/src/H5Exception.cpp +++ b/c++/src/H5Exception.cpp @@ -23,207 +23,207 @@ namespace H5 { const char Exception::DEFAULT_MSG[] = "No detailed information provided"; //-------------------------------------------------------------------------- -// Function: Exception default constructor -///\brief Default constructor. -// Programmer Binh-Minh Ribler - 2000 +// Function: Exception default constructor +///\brief Default constructor. +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- Exception::Exception() : detail_message(""), func_name("") {} //-------------------------------------------------------------------------- -// Function: Exception overloaded constructor -///\brief Creates an exception with the name of the function, -/// in which the failure occurs, and an optional detailed message. -///\param func - IN: Name of the function where failure occurs -///\param message - IN: Message on the failure -// Programmer Binh-Minh Ribler - 2000 +// Function: Exception overloaded constructor +///\brief Creates an exception with the name of the function, +/// in which the failure occurs, and an optional detailed message. +///\param func - IN: Name of the function where failure occurs +///\param message - IN: Message on the failure +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- Exception::Exception(const H5std_string& func, const H5std_string& message) : detail_message(message), func_name(func) {} //-------------------------------------------------------------------------- -// Function: Exception copy constructor -///\brief Copy constructor: makes a copy of the original Exception object. -///\param orig - IN: Exception instance to copy -// Programmer Binh-Minh Ribler - 2000 +// Function: Exception copy constructor +///\brief Copy constructor: makes a copy of the original Exception object. +///\param orig - IN: Exception instance to copy +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -Exception::Exception( const Exception& orig ) : detail_message(orig.detail_message), func_name(orig.func_name) {} +Exception::Exception(const Exception& orig) : detail_message(orig.detail_message), func_name(orig.func_name) {} //-------------------------------------------------------------------------- -// Function: Exception::getMajorString -///\brief Returns a text string that describes the error -/// specified by a major error number. -///\param err_major - IN: Major error number -///\return Major error string +// Function: Exception::getMajorString +///\brief Returns a text string that describes the error +/// specified by a major error number. +///\param err_major - IN: Major error number +///\return Major error string ///\par Description -/// In the failure case, the string "Invalid major error number" -/// will be returned. -// Programmer Binh-Minh Ribler - 2000 +/// In the failure case, the string "Invalid major error number" +/// will be returned. +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -H5std_string Exception::getMajorString( hid_t err_major ) const +H5std_string Exception::getMajorString(hid_t err_major) const { - // Preliminary call to H5Eget_msg() to get the length of the message - ssize_t mesg_size = H5Eget_msg(err_major, NULL, NULL, 0); - - // If H5Eget_msg() returns a negative value, raise an exception, - if( mesg_size < 0 ) - throw IdComponentException("Exception::getMajorString", - "H5Eget_msg failed"); - - // Call H5Eget_msg again to get the actual message - char* mesg_C = new char[mesg_size+1]; // temporary C-string for C API - mesg_size = H5Eget_msg(err_major, NULL, mesg_C, mesg_size+1); - - // Check for failure again - if( mesg_size < 0 ) - { - delete []mesg_C; - throw IdComponentException("Exception::getMajorString", - "H5Eget_msg failed"); - } - - // Convert the C error description and return - H5std_string major_str(mesg_C); - delete []mesg_C; - return( major_str ); + // Preliminary call to H5Eget_msg() to get the length of the message + ssize_t mesg_size = H5Eget_msg(err_major, NULL, NULL, 0); + + // If H5Eget_msg() returns a negative value, raise an exception, + if (mesg_size < 0) + throw IdComponentException("Exception::getMajorString", + "H5Eget_msg failed"); + + // Call H5Eget_msg again to get the actual message + char* mesg_C = new char[mesg_size+1]; // temporary C-string for C API + mesg_size = H5Eget_msg(err_major, NULL, mesg_C, mesg_size+1); + + // Check for failure again + if (mesg_size < 0) + { + delete []mesg_C; + throw IdComponentException("Exception::getMajorString", + "H5Eget_msg failed"); + } + + // Convert the C error description and return + H5std_string major_str(mesg_C); + delete []mesg_C; + return(major_str); } //-------------------------------------------------------------------------- -// Function: Exception::getMinorString -///\brief Returns a text string that describes the error -/// specified by a minor error number. -///\param err_minor - IN: Minor error number -///\return Minor error string +// Function: Exception::getMinorString +///\brief Returns a text string that describes the error +/// specified by a minor error number. +///\param err_minor - IN: Minor error number +///\return Minor error string ///\par Description -/// In the failure case, the string "Invalid minor error number" -/// will be returned. -// Programmer Binh-Minh Ribler - 2000 +/// In the failure case, the string "Invalid minor error number" +/// will be returned. +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -H5std_string Exception::getMinorString( hid_t err_minor ) const +H5std_string Exception::getMinorString(hid_t err_minor) const { - // Preliminary call to H5Eget_msg() to get the length of the message - ssize_t mesg_size = H5Eget_msg(err_minor, NULL, NULL, 0); - - // If H5Eget_msg() returns a negative value, raise an exception, - if( mesg_size < 0 ) - throw IdComponentException("Exception::getMinorString", - "H5Eget_msg failed"); - - // Call H5Eget_msg again to get the actual message - char* mesg_C = new char[mesg_size+1]; // temporary C-string for C API - mesg_size = H5Eget_msg(err_minor, NULL, mesg_C, mesg_size+1); - - // Check for failure again - if( mesg_size < 0 ) - { - delete []mesg_C; - throw IdComponentException("Exception::getMinorString", - "H5Eget_msg failed"); - } - - // Convert the C error description and return - H5std_string minor_str(mesg_C); - delete []mesg_C; - return( minor_str ); + // Preliminary call to H5Eget_msg() to get the length of the message + ssize_t mesg_size = H5Eget_msg(err_minor, NULL, NULL, 0); + + // If H5Eget_msg() returns a negative value, raise an exception, + if (mesg_size < 0) + throw IdComponentException("Exception::getMinorString", + "H5Eget_msg failed"); + + // Call H5Eget_msg again to get the actual message + char* mesg_C = new char[mesg_size+1]; // temporary C-string for C API + mesg_size = H5Eget_msg(err_minor, NULL, mesg_C, mesg_size+1); + + // Check for failure again + if (mesg_size < 0) + { + delete []mesg_C; + throw IdComponentException("Exception::getMinorString", + "H5Eget_msg failed"); + } + + // Convert the C error description and return + H5std_string minor_str(mesg_C); + delete []mesg_C; + return(minor_str); } //-------------------------------------------------------------------------- -// Function: Exception::setAutoPrint -///\brief Turns on the automatic error printing. -///\param func - IN: Function to be called upon an error condition -///\param client_data - IN: Data passed to the error function +// Function: Exception::setAutoPrint +///\brief Turns on the automatic error printing. +///\param func - IN: Function to be called upon an error condition +///\param client_data - IN: Data passed to the error function ///\par Description -/// When the library is first initialized the auto printing -/// function, \a func, is set to the C API \c H5Eprint and -/// \a client_data is the standard error stream pointer, \c stderr. -/// Automatic stack traversal is always in the \c H5E_WALK_DOWNWARD -/// direction. +/// When the library is first initialized the auto printing +/// function, \a func, is set to the C API \c H5Eprint and +/// \a client_data is the standard error stream pointer, \c stderr. +/// Automatic stack traversal is always in the \c H5E_WALK_DOWNWARD +/// direction. ///\par -/// Users are encouraged to write their own more specific error -/// handlers -// Programmer Binh-Minh Ribler - 2000 +/// Users are encouraged to write their own more specific error +/// handlers +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -void Exception::setAutoPrint( H5E_auto2_t& func, void* client_data ) +void Exception::setAutoPrint(H5E_auto2_t& func, void* client_data) { - // calls the C API routine H5Eset_auto to set the auto printing to - // the specified function. - herr_t ret_value = H5Eset_auto2( H5E_DEFAULT, func, client_data ); - if( ret_value < 0 ) - throw Exception( "Exception::setAutoPrint", "H5Eset_auto failed" ); + // calls the C API routine H5Eset_auto to set the auto printing to + // the specified function. + herr_t ret_value = H5Eset_auto2(H5E_DEFAULT, func, client_data); + if (ret_value < 0) + throw Exception("Exception::setAutoPrint", "H5Eset_auto failed"); } //-------------------------------------------------------------------------- -// Function: Exception::dontPrint -///\brief Turns off the automatic error printing from the C library. -// Programmer Binh-Minh Ribler - 2000 +// Function: Exception::dontPrint +///\brief Turns off the automatic error printing from the C library. +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void Exception::dontPrint() { - // calls the C API routine H5Eset_auto with NULL parameters to turn - // off the automatic error printing. - herr_t ret_value = H5Eset_auto2( H5E_DEFAULT, NULL, NULL ); - if( ret_value < 0 ) - throw Exception( "Exception::dontPrint", "H5Eset_auto failed" ); + // calls the C API routine H5Eset_auto with NULL parameters to turn + // off the automatic error printing. + herr_t ret_value = H5Eset_auto2(H5E_DEFAULT, NULL, NULL); + if (ret_value < 0) + throw Exception("Exception::dontPrint", "H5Eset_auto failed"); } //-------------------------------------------------------------------------- -// Function: Exception::getAutoPrint -///\brief Retrieves the current settings for the automatic error -/// stack traversal function and its data. -///\param func - OUT: Current setting for the function to be -/// called upon an error condition -///\param client_data - OUT: Current setting for the data passed to -/// the error function -// Programmer Binh-Minh Ribler - 2000 +// Function: Exception::getAutoPrint +///\brief Retrieves the current settings for the automatic error +/// stack traversal function and its data. +///\param func - OUT: Current setting for the function to be +/// called upon an error condition +///\param client_data - OUT: Current setting for the data passed to +/// the error function +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -void Exception::getAutoPrint( H5E_auto2_t& func, void** client_data ) +void Exception::getAutoPrint(H5E_auto2_t& func, void** client_data) { - // calls the C API routine H5Eget_auto to get the current setting of - // the automatic error printing - herr_t ret_value = H5Eget_auto2( H5E_DEFAULT, &func, client_data ); - if( ret_value < 0 ) - throw Exception( "Exception::getAutoPrint", "H5Eget_auto failed" ); + // calls the C API routine H5Eget_auto to get the current setting of + // the automatic error printing + herr_t ret_value = H5Eget_auto2(H5E_DEFAULT, &func, client_data); + if (ret_value < 0) + throw Exception("Exception::getAutoPrint", "H5Eget_auto failed"); } //-------------------------------------------------------------------------- -// Function: Exception::clearErrorStack -///\brief Clears the error stack for the current thread. +// Function: Exception::clearErrorStack +///\brief Clears the error stack for the current thread. ///\par Description -/// The stack is also cleared whenever a C API function is -/// called, with certain exceptions (for instance, \c H5Eprint). -// Programmer Binh-Minh Ribler - 2000 +/// The stack is also cleared whenever a C API function is +/// called, with certain exceptions (for instance, \c H5Eprint). +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void Exception::clearErrorStack() { - // calls the C API routine H5Eclear to clear the error stack - herr_t ret_value = H5Eclear2(H5E_DEFAULT); - if( ret_value < 0 ) - throw Exception( "Exception::clearErrorStack", "H5Eclear failed" ); + // calls the C API routine H5Eclear to clear the error stack + herr_t ret_value = H5Eclear2(H5E_DEFAULT); + if (ret_value < 0) + throw Exception("Exception::clearErrorStack", "H5Eclear failed"); } //-------------------------------------------------------------------------- -// Function: Exception::walkErrorStack -///\brief Walks the error stack for the current thread, calling the -/// specified function. -///\param direction - IN: Direction in which the error stack is to be walked -///\param func - IN: Function to be called for each error encountered -///\param client_data - IN: Data passed to the error function +// Function: Exception::walkErrorStack +///\brief Walks the error stack for the current thread, calling the +/// specified function. +///\param direction - IN: Direction in which the error stack is to be walked +///\param func - IN: Function to be called for each error encountered +///\param client_data - IN: Data passed to the error function ///\par Description -/// Valid values for \a direction include: -/// \li \c H5E_WALK_UPWARD - begin with the most specific error -/// and end at the API -/// \li \c H5E_WALK_DOWNWARD - begin at the API and end at the -/// inner-most function where the error was first detected +/// Valid values for \a direction include: +/// \li \c H5E_WALK_UPWARD - begin with the most specific error +/// and end at the API +/// \li \c H5E_WALK_DOWNWARD - begin at the API and end at the +/// inner-most function where the error was first detected ///\par -/// The function specified by \a func will be called for each -/// error in the error stack. The \c H5E_walk_t prototype is as -/// follows: +/// The function specified by \a func will be called for each +/// error in the error stack. The \c H5E_walk_t prototype is as +/// follows: ///\code /// typedef herr_t (*H5E_walk_t)(int n, H5E_error_t *err_desc, void *client_data) /// int n - Indexed position of the error in the stack; it begins at zero -/// regardless of stack traversal direction +/// regardless of stack traversal direction /// H5E_error_t *err_desc - Pointer to a data structure describing the -/// error. This structure is listed below. +/// error. This structure is listed below. /// void *client_data - Pointer to client data in the format expected by -/// the user-defined function. +/// the user-defined function. ///\endcode ///\par /// Data structure to describe the error: @@ -238,87 +238,87 @@ void Exception::clearErrorStack() /// const char *desc; //optional supplied description /// } H5E_error2_t; ///\endcode -// Programmer Binh-Minh Ribler - 2000 +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -void Exception::walkErrorStack( H5E_direction_t direction, H5E_walk2_t func, void* client_data ) +void Exception::walkErrorStack(H5E_direction_t direction, H5E_walk2_t func, void* client_data) { - // calls the C API routine H5Ewalk to walk the error stack - herr_t ret_value = H5Ewalk2( H5E_DEFAULT, direction, func, client_data ); - if( ret_value < 0 ) - throw Exception( "Exception::walkErrorStack", "H5Ewalk failed" ); + // calls the C API routine H5Ewalk to walk the error stack + herr_t ret_value = H5Ewalk2(H5E_DEFAULT, direction, func, client_data); + if (ret_value < 0) + throw Exception("Exception::walkErrorStack", "H5Ewalk failed"); } //-------------------------------------------------------------------------- -// Function: Exception::getDetailMsg -///\brief Returns the detailed message set at the time the exception -/// is thrown. -///\return Text message - \c H5std_string -// Programmer Binh-Minh Ribler - 2000 +// Function: Exception::getDetailMsg +///\brief Returns the detailed message set at the time the exception +/// is thrown. +///\return Text message - \c H5std_string +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- H5std_string Exception::getDetailMsg() const { - return(detail_message); + return(detail_message); } //-------------------------------------------------------------------------- -// Function: Exception::getCDetailMsg -///\brief Returns the detailed message set at the time the exception -/// is thrown. -///\return Text message - \c char pointer -// Programmer Binh-Minh Ribler - 2000 +// Function: Exception::getCDetailMsg +///\brief Returns the detailed message set at the time the exception +/// is thrown. +///\return Text message - \c char pointer +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- const char* Exception::getCDetailMsg() const { - return(detail_message.c_str()); + return(detail_message.c_str()); } //-------------------------------------------------------------------------- -// Function: Exception::getFuncName -///\brief Returns the name of the function, where the exception is thrown. -///\return Text message - \c H5std_string -// Programmer Binh-Minh Ribler - 2000 +// Function: Exception::getFuncName +///\brief Returns the name of the function, where the exception is thrown. +///\return Text message - \c H5std_string +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- H5std_string Exception::getFuncName() const { - return(func_name); + return(func_name); } //-------------------------------------------------------------------------- -// Function: Exception::getCFuncName -///\brief Returns the name of the function, where the exception is thrown. -///\return Text message - \c char pointer -// Programmer Binh-Minh Ribler - 2000 +// Function: Exception::getCFuncName +///\brief Returns the name of the function, where the exception is thrown. +///\return Text message - \c char pointer +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- const char* Exception::getCFuncName() const { - return(func_name.c_str()); + return(func_name.c_str()); } //-------------------------------------------------------------------------- -// Function: Exception::printErrorStack (static) -///\brief Prints the error stack in a default manner. -///\param stream - IN: File pointer, default to stderr -///\param err_stack - IN: Error stack ID, default to H5E_DEFAULT(0) -// Programmer Binh-Minh Ribler - 2000 +// Function: Exception::printErrorStack (static) +///\brief Prints the error stack in a default manner. +///\param stream - IN: File pointer, default to stderr +///\param err_stack - IN: Error stack ID, default to H5E_DEFAULT(0) +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void Exception::printErrorStack(FILE* stream, hid_t err_stack) { herr_t ret_value = H5Eprint2(err_stack, stream); - if( ret_value < 0 ) - throw Exception( "Printing error stack", "H5Eprint2 failed" ); + if (ret_value < 0) + throw Exception("Printing error stack", "H5Eprint2 failed"); } //-------------------------------------------------------------------------- -// Function: Exception::printError -// Purpose: Prints the error stack in a default manner. This member -// function is replaced by the static function printErrorStack -// and will be removed from the next major release. -// Parameter stream - IN: File pointer -// Programmer Binh-Minh Ribler - 2000 +// Function: Exception::printError +// Purpose: Prints the error stack in a default manner. This member +// function is replaced by the static function printErrorStack +// and will be removed from the next major release. +// Parameter stream - IN: File pointer +// Programmer Binh-Minh Ribler - 2000 // Description: -// This function can be removed in next major release. -// -BMR, 2014/04/24 -// Removed from documentation. -BMR, 2016/03/23 +// This function can be removed in next major release. +// -BMR, 2014/04/24 +// Removed from documentation. -BMR, 2016/03/23 //-------------------------------------------------------------------------- void Exception::printError(FILE* stream) const { @@ -326,285 +326,285 @@ void Exception::printError(FILE* stream) const } //-------------------------------------------------------------------------- -// Function: Exception destructor -///\brief Noop destructor -// Programmer Binh-Minh Ribler - 2000 +// Function: Exception destructor +///\brief Noop destructor +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- Exception::~Exception() throw() {} //-------------------------------------------------------------------------- -// Subclass: FileIException -// Programmer Binh-Minh Ribler - 2000 +// Subclass: FileIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- //-------------------------------------------------------------------------- -// Function: FileIException default constructor -///\brief Default constructor. +// Function: FileIException default constructor +///\brief Default constructor. //-------------------------------------------------------------------------- FileIException::FileIException():Exception(){} //-------------------------------------------------------------------------- -// Function: FileIException overloaded constructor -///\brief Creates a FileIException with the name of the function, -/// in which the failure occurs, and an optional detailed message. -///\param func - IN: Name of the function where failure occurs -///\param message - IN: Message on the failure +// Function: FileIException overloaded constructor +///\brief Creates a FileIException with the name of the function, +/// in which the failure occurs, and an optional detailed message. +///\param func - IN: Name of the function where failure occurs +///\param message - IN: Message on the failure //-------------------------------------------------------------------------- FileIException::FileIException(const H5std_string& func, const H5std_string& message) : Exception(func, message) {} //-------------------------------------------------------------------------- -// Function: FileIException destructor -///\brief Noop destructor. +// Function: FileIException destructor +///\brief Noop destructor. //-------------------------------------------------------------------------- FileIException::~FileIException() throw() {} //-------------------------------------------------------------------------- -// Subclass: GroupIException -// Programmer Binh-Minh Ribler - 2000 +// Subclass: GroupIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- //-------------------------------------------------------------------------- -// Function: GroupIException default constructor -///\brief Default constructor. +// Function: GroupIException default constructor +///\brief Default constructor. //-------------------------------------------------------------------------- GroupIException::GroupIException():Exception(){} //-------------------------------------------------------------------------- -// Function: GroupIException overloaded constructor -///\brief Creates a GroupIException with the name of the function, -/// in which the failure occurs, and an optional detailed message. -///\param func - IN: Name of the function where failure occurs -///\param message - IN: Message on the failure +// Function: GroupIException overloaded constructor +///\brief Creates a GroupIException with the name of the function, +/// in which the failure occurs, and an optional detailed message. +///\param func - IN: Name of the function where failure occurs +///\param message - IN: Message on the failure //-------------------------------------------------------------------------- GroupIException::GroupIException(const H5std_string& func, const H5std_string& message) : Exception(func, message) {} //-------------------------------------------------------------------------- -// Function: GroupIException destructor -///\brief Noop destructor. +// Function: GroupIException destructor +///\brief Noop destructor. //-------------------------------------------------------------------------- GroupIException::~GroupIException() throw() {} //-------------------------------------------------------------------------- -// Subclass: DataSpaceIException -// Programmer Binh-Minh Ribler - 2000 +// Subclass: DataSpaceIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- //-------------------------------------------------------------------------- -// Function: DataSpaceIException default constructor -///\brief Default constructor. +// Function: DataSpaceIException default constructor +///\brief Default constructor. //-------------------------------------------------------------------------- DataSpaceIException::DataSpaceIException():Exception(){} //-------------------------------------------------------------------------- -// Function: DataSpaceIException overloaded constructor -///\brief Creates a DataSpaceIException with the name of the function, -/// in which the failure occurs, and an optional detailed message. -///\param func - IN: Name of the function where failure occurs -///\param message - IN: Message on the failure +// Function: DataSpaceIException overloaded constructor +///\brief Creates a DataSpaceIException with the name of the function, +/// in which the failure occurs, and an optional detailed message. +///\param func - IN: Name of the function where failure occurs +///\param message - IN: Message on the failure //-------------------------------------------------------------------------- DataSpaceIException::DataSpaceIException(const H5std_string& func, const H5std_string& message) : Exception(func, message) {} //-------------------------------------------------------------------------- -// Function: DataSpaceIException destructor -///\brief Noop destructor. +// Function: DataSpaceIException destructor +///\brief Noop destructor. //-------------------------------------------------------------------------- DataSpaceIException::~DataSpaceIException() throw() {} //-------------------------------------------------------------------------- -// Subclass: DataTypeIException -// Programmer Binh-Minh Ribler - 2000 +// Subclass: DataTypeIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- //-------------------------------------------------------------------------- -// Function: DataTypeIException default constructor -///\brief Default constructor. +// Function: DataTypeIException default constructor +///\brief Default constructor. //-------------------------------------------------------------------------- DataTypeIException::DataTypeIException():Exception(){} //-------------------------------------------------------------------------- -// Function: DataTypeIException overloaded constructor -///\brief Creates a DataTypeIException with the name of the function, -/// in which the failure occurs, and an optional detailed message. -///\param func - IN: Name of the function where failure occurs -///\param message - IN: Message on the failure +// Function: DataTypeIException overloaded constructor +///\brief Creates a DataTypeIException with the name of the function, +/// in which the failure occurs, and an optional detailed message. +///\param func - IN: Name of the function where failure occurs +///\param message - IN: Message on the failure //-------------------------------------------------------------------------- DataTypeIException::DataTypeIException(const H5std_string& func, const H5std_string& message) : Exception(func, message) {} //-------------------------------------------------------------------------- -// Function: DataTypeIException destructor -///\brief Noop destructor. +// Function: DataTypeIException destructor +///\brief Noop destructor. //-------------------------------------------------------------------------- DataTypeIException::~DataTypeIException() throw() {} //-------------------------------------------------------------------------- -// Subclass: ObjHeaderIException -// Programmer Binh-Minh Ribler - 2000 +// Subclass: ObjHeaderIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- //-------------------------------------------------------------------------- -// Function: ObjHeaderIException default constructor -///\brief Default constructor. +// Function: ObjHeaderIException default constructor +///\brief Default constructor. //-------------------------------------------------------------------------- ObjHeaderIException::ObjHeaderIException():Exception(){} //-------------------------------------------------------------------------- -// Function: ObjHeaderIException overloaded constructor -///\brief Creates an ObjHeaderIException with the name of the function, -/// in which the failure occurs, and an optional detailed message. -///\param func - IN: Name of the function where failure occurs -///\param message - IN: Message on the failure +// Function: ObjHeaderIException overloaded constructor +///\brief Creates an ObjHeaderIException with the name of the function, +/// in which the failure occurs, and an optional detailed message. +///\param func - IN: Name of the function where failure occurs +///\param message - IN: Message on the failure //-------------------------------------------------------------------------- ObjHeaderIException::ObjHeaderIException(const H5std_string& func, const H5std_string& message) : Exception(func, message) {} //-------------------------------------------------------------------------- -// Function: ObjHeaderIException destructor -///\brief Noop destructor. +// Function: ObjHeaderIException destructor +///\brief Noop destructor. //-------------------------------------------------------------------------- ObjHeaderIException::~ObjHeaderIException() throw() {} //-------------------------------------------------------------------------- -// Subclass: PropListIException -// Programmer Binh-Minh Ribler - 2000 +// Subclass: PropListIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- //-------------------------------------------------------------------------- -// Function: PropListIException default constructor -///\brief Default constructor. +// Function: PropListIException default constructor +///\brief Default constructor. //-------------------------------------------------------------------------- PropListIException::PropListIException():Exception(){} //-------------------------------------------------------------------------- -// Function: PropListIException overloaded constructor -///\brief Creates a PropListIException with the name of the function, -/// in which the failure occurs, and an optional detailed message. -///\param func - IN: Name of the function where failure occurs -///\param message - IN: Message on the failure +// Function: PropListIException overloaded constructor +///\brief Creates a PropListIException with the name of the function, +/// in which the failure occurs, and an optional detailed message. +///\param func - IN: Name of the function where failure occurs +///\param message - IN: Message on the failure //-------------------------------------------------------------------------- PropListIException::PropListIException(const H5std_string& func, const H5std_string& message) : Exception(func, message) {} //-------------------------------------------------------------------------- -// Function: PropListIException destructor -///\brief Noop destructor. +// Function: PropListIException destructor +///\brief Noop destructor. //-------------------------------------------------------------------------- PropListIException::~PropListIException() throw() {} //-------------------------------------------------------------------------- -// Subclass: DataSetIException -// Programmer Binh-Minh Ribler - 2000 +// Subclass: DataSetIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- //-------------------------------------------------------------------------- -// Function: DataSetIException default constructor -///\brief Default constructor. +// Function: DataSetIException default constructor +///\brief Default constructor. //-------------------------------------------------------------------------- DataSetIException::DataSetIException():Exception(){} //-------------------------------------------------------------------------- -// Function: DataSetIException overloaded constructor -///\brief Creates a DataSetIException with the name of the function, -/// in which the failure occurs, and an optional detailed message. -///\param func - IN: Name of the function where failure occurs -///\param message - IN: Message on the failure +// Function: DataSetIException overloaded constructor +///\brief Creates a DataSetIException with the name of the function, +/// in which the failure occurs, and an optional detailed message. +///\param func - IN: Name of the function where failure occurs +///\param message - IN: Message on the failure //-------------------------------------------------------------------------- DataSetIException::DataSetIException(const H5std_string& func, const H5std_string& message) : Exception(func, message) {} //-------------------------------------------------------------------------- -// Function: DataSetIException destructor -///\brief Noop destructor. +// Function: DataSetIException destructor +///\brief Noop destructor. //-------------------------------------------------------------------------- DataSetIException::~DataSetIException() throw() {} //-------------------------------------------------------------------------- -// Subclass: AttributeIException -// Programmer Binh-Minh Ribler - 2000 +// Subclass: AttributeIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- //-------------------------------------------------------------------------- -// Function: AttributeIException default constructor -///\brief Default constructor. +// Function: AttributeIException default constructor +///\brief Default constructor. //-------------------------------------------------------------------------- AttributeIException::AttributeIException():Exception(){} //-------------------------------------------------------------------------- -// Function: AttributeIException overloaded constructor -///\brief Creates an AttributeIException with the name of the function, -/// in which the failure occurs, and an optional detailed message. -///\param func - IN: Name of the function where failure occurs -///\param message - IN: Message on the failure +// Function: AttributeIException overloaded constructor +///\brief Creates an AttributeIException with the name of the function, +/// in which the failure occurs, and an optional detailed message. +///\param func - IN: Name of the function where failure occurs +///\param message - IN: Message on the failure //-------------------------------------------------------------------------- AttributeIException::AttributeIException(const H5std_string& func, const H5std_string& message) : Exception(func, message) {} //-------------------------------------------------------------------------- -// Function: AttributeIException destructor -///\brief Noop destructor. +// Function: AttributeIException destructor +///\brief Noop destructor. //-------------------------------------------------------------------------- AttributeIException::~AttributeIException() throw() {} //-------------------------------------------------------------------------- -// Subclass: ReferenceException -// Programmer Binh-Minh Ribler - 2000 +// Subclass: ReferenceException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- //-------------------------------------------------------------------------- -// Function: ReferenceException default constructor -///\brief Default constructor. +// Function: ReferenceException default constructor +///\brief Default constructor. //-------------------------------------------------------------------------- ReferenceException::ReferenceException():Exception(){} //-------------------------------------------------------------------------- -// Function: ReferenceException overloaded constructor -///\brief Creates a ReferenceException with the name of the function, -/// in which the failure occurs, and an optional detailed message. -///\param func - IN: Name of the function where failure occurs -///\param message - IN: Message on the failure +// Function: ReferenceException overloaded constructor +///\brief Creates a ReferenceException with the name of the function, +/// in which the failure occurs, and an optional detailed message. +///\param func - IN: Name of the function where failure occurs +///\param message - IN: Message on the failure //-------------------------------------------------------------------------- ReferenceException::ReferenceException(const H5std_string& func, const H5std_string& message) : Exception(func, message) {} //-------------------------------------------------------------------------- -// Function: ReferenceException destructor -///\brief Noop destructor. +// Function: ReferenceException destructor +///\brief Noop destructor. //-------------------------------------------------------------------------- ReferenceException::~ReferenceException() throw() {} //-------------------------------------------------------------------------- -// Subclass: LibraryIException -// Programmer Binh-Minh Ribler - 2000 +// Subclass: LibraryIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- //-------------------------------------------------------------------------- -// Function: LibraryIException default constructor -///\brief Default constructor. +// Function: LibraryIException default constructor +///\brief Default constructor. //-------------------------------------------------------------------------- LibraryIException::LibraryIException():Exception(){} //-------------------------------------------------------------------------- -// Function: LibraryIException overloaded constructor -///\brief Creates a LibraryIException with the name of the function, -/// in which the failure occurs, and an optional detailed message. -///\param func - IN: Name of the function where failure occurs -///\param message - IN: Message on the failure +// Function: LibraryIException overloaded constructor +///\brief Creates a LibraryIException with the name of the function, +/// in which the failure occurs, and an optional detailed message. +///\param func - IN: Name of the function where failure occurs +///\param message - IN: Message on the failure //-------------------------------------------------------------------------- LibraryIException::LibraryIException(const H5std_string& func, const H5std_string& message) : Exception(func, message) {} //-------------------------------------------------------------------------- -// Function: LibraryIException destructor -///\brief Noop destructor. +// Function: LibraryIException destructor +///\brief Noop destructor. //-------------------------------------------------------------------------- LibraryIException::~LibraryIException() throw() {} //-------------------------------------------------------------------------- -// Subclass: LocationException -// Programmer Binh-Minh Ribler - 2014 +// Subclass: LocationException +// Programmer Binh-Minh Ribler - 2014 //-------------------------------------------------------------------------- //-------------------------------------------------------------------------- -// Function: LocationException default constructor -///\brief Default constructor. +// Function: LocationException default constructor +///\brief Default constructor. //-------------------------------------------------------------------------- LocationException::LocationException():Exception(){} //-------------------------------------------------------------------------- -// Function: LocationException overloaded constructor -///\brief Creates a LocationException with the name of the function, -/// in which the failure occurs, and an optional detailed message. -///\param func - IN: Name of the function where failure occurs -///\param message - IN: Message on the failure +// Function: LocationException overloaded constructor +///\brief Creates a LocationException with the name of the function, +/// in which the failure occurs, and an optional detailed message. +///\param func - IN: Name of the function where failure occurs +///\param message - IN: Message on the failure //-------------------------------------------------------------------------- LocationException::LocationException(const H5std_string& func, const H5std_string& message) : Exception(func, message) {} //-------------------------------------------------------------------------- -// Function: LocationException destructor -///\brief Noop destructor. +// Function: LocationException destructor +///\brief Noop destructor. //-------------------------------------------------------------------------- LocationException::~LocationException() throw() {} //-------------------------------------------------------------------------- -// Subclass: IdComponentException -// Programmer Binh-Minh Ribler - 2000 +// Subclass: IdComponentException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- //-------------------------------------------------------------------------- -// Function: IdComponentException default constructor -///\brief Default constructor. +// Function: IdComponentException default constructor +///\brief Default constructor. //-------------------------------------------------------------------------- IdComponentException::IdComponentException(): Exception() {} //-------------------------------------------------------------------------- -// Function: IdComponentException overloaded constructor -///\brief Creates a IdComponentException with the name of the function, -/// in which the failure occurs, and an optional detailed message. -///\param func - IN: Name of the function where failure occurs -///\param message - IN: Message on the failure +// Function: IdComponentException overloaded constructor +///\brief Creates a IdComponentException with the name of the function, +/// in which the failure occurs, and an optional detailed message. +///\param func - IN: Name of the function where failure occurs +///\param message - IN: Message on the failure //-------------------------------------------------------------------------- IdComponentException::IdComponentException(const H5std_string& func, const H5std_string& message) : Exception(func, message) {} //-------------------------------------------------------------------------- -// Function: IdComponentException destructor -///\brief Noop destructor. +// Function: IdComponentException destructor +///\brief Noop destructor. //-------------------------------------------------------------------------- IdComponentException::~IdComponentException() throw() {} diff --git a/c++/src/H5Exception.h b/c++/src/H5Exception.h index 7112995..1f85711 100644 --- a/c++/src/H5Exception.h +++ b/c++/src/H5Exception.h @@ -33,147 +33,147 @@ namespace H5 { */ class H5_DLLCPP Exception { public: - // Creates an exception with a function name where the failure occurs - // and an optional detailed message - Exception(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG); + // Creates an exception with a function name where the failure occurs + // and an optional detailed message + Exception(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG); - // Returns a character string that describes the error specified by - // a major error number. - H5std_string getMajorString( hid_t err_major_id ) const; + // Returns a character string that describes the error specified by + // a major error number. + H5std_string getMajorString(hid_t err_major_id) const; - // Returns a character string that describes the error specified by - // a minor error number. - H5std_string getMinorString( hid_t err_minor_id ) const; + // Returns a character string that describes the error specified by + // a minor error number. + H5std_string getMinorString(hid_t err_minor_id) const; - // Returns the detailed message set at the time the exception is thrown - H5std_string getDetailMsg() const; - const char* getCDetailMsg() const; // C string of detailed message - H5std_string getFuncName() const; // function name as a string object - const char* getCFuncName() const; // function name as a char string + // Returns the detailed message set at the time the exception is thrown + H5std_string getDetailMsg() const; + const char* getCDetailMsg() const; // C string of detailed message + H5std_string getFuncName() const; // function name as a string object + const char* getCFuncName() const; // function name as a char string - // Turns on the automatic error printing. - static void setAutoPrint( H5E_auto2_t& func, void* client_data); + // Turns on the automatic error printing. + static void setAutoPrint(H5E_auto2_t& func, void* client_data); - // Turns off the automatic error printing. - static void dontPrint(); + // Turns off the automatic error printing. + static void dontPrint(); - // Retrieves the current settings for the automatic error stack - // traversal function and its data. - static void getAutoPrint( H5E_auto2_t& func, void** client_data); + // Retrieves the current settings for the automatic error stack + // traversal function and its data. + static void getAutoPrint(H5E_auto2_t& func, void** client_data); - // Clears the error stack for the current thread. - static void clearErrorStack(); + // Clears the error stack for the current thread. + static void clearErrorStack(); - // Walks the error stack for the current thread, calling the - // specified function. - static void walkErrorStack( H5E_direction_t direction, - H5E_walk2_t func, void* client_data); + // Walks the error stack for the current thread, calling the + // specified function. + static void walkErrorStack(H5E_direction_t direction, + H5E_walk2_t func, void* client_data); - // Prints the error stack in a default manner. - static void printErrorStack(FILE* stream = stderr, - hid_t err_stack = H5E_DEFAULT); // Static - virtual void printError(FILE* stream = NULL) const; + // Prints the error stack in a default manner. + static void printErrorStack(FILE* stream = stderr, + hid_t err_stack = H5E_DEFAULT); + virtual void printError(FILE* stream = NULL) const; - // Default constructor - Exception(); + // Default constructor + Exception(); - // copy constructor - Exception( const Exception& orig); + // copy constructor + Exception(const Exception& orig); - // virtual Destructor - virtual ~Exception() throw(); + // virtual Destructor + virtual ~Exception() throw(); protected: - // Default value for detail_message - static const char DEFAULT_MSG[]; + // Default value for detail_message + static const char DEFAULT_MSG[]; private: - H5std_string detail_message; - H5std_string func_name; + H5std_string detail_message; + H5std_string func_name; }; class H5_DLLCPP FileIException : public Exception { public: - FileIException( const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG); - FileIException(); - virtual ~FileIException() throw(); + FileIException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG); + FileIException(); + virtual ~FileIException() throw(); }; class H5_DLLCPP GroupIException : public Exception { public: - GroupIException( const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG); - GroupIException(); - virtual ~GroupIException() throw(); + GroupIException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG); + GroupIException(); + virtual ~GroupIException() throw(); }; class H5_DLLCPP DataSpaceIException : public Exception { public: - DataSpaceIException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG); - DataSpaceIException(); - virtual ~DataSpaceIException() throw(); + DataSpaceIException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG); + DataSpaceIException(); + virtual ~DataSpaceIException() throw(); }; class H5_DLLCPP DataTypeIException : public Exception { public: - DataTypeIException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG); - DataTypeIException(); - virtual ~DataTypeIException() throw(); + DataTypeIException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG); + DataTypeIException(); + virtual ~DataTypeIException() throw(); }; class H5_DLLCPP ObjHeaderIException : public Exception { public: - ObjHeaderIException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG); - ObjHeaderIException(); - virtual ~ObjHeaderIException() throw(); + ObjHeaderIException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG); + ObjHeaderIException(); + virtual ~ObjHeaderIException() throw(); }; class H5_DLLCPP PropListIException : public Exception { public: - PropListIException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG); - PropListIException(); - virtual ~PropListIException() throw(); + PropListIException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG); + PropListIException(); + virtual ~PropListIException() throw(); }; class H5_DLLCPP DataSetIException : public Exception { public: - DataSetIException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG); - DataSetIException(); - virtual ~DataSetIException() throw(); + DataSetIException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG); + DataSetIException(); + virtual ~DataSetIException() throw(); }; class H5_DLLCPP AttributeIException : public Exception { public: - AttributeIException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG); - AttributeIException(); - virtual ~AttributeIException() throw(); + AttributeIException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG); + AttributeIException(); + virtual ~AttributeIException() throw(); }; class H5_DLLCPP ReferenceException : public Exception { public: - ReferenceException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG); - ReferenceException(); - virtual ~ReferenceException() throw(); + ReferenceException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG); + ReferenceException(); + virtual ~ReferenceException() throw(); }; class H5_DLLCPP LibraryIException : public Exception { public: - LibraryIException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG); - LibraryIException(); - virtual ~LibraryIException() throw(); + LibraryIException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG); + LibraryIException(); + virtual ~LibraryIException() throw(); }; class H5_DLLCPP LocationException : public Exception { public: - LocationException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG); - LocationException(); - virtual ~LocationException() throw(); + LocationException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG); + LocationException(); + virtual ~LocationException() throw(); }; class H5_DLLCPP IdComponentException : public Exception { public: - IdComponentException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG); - IdComponentException(); - virtual ~IdComponentException() throw(); + IdComponentException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG); + IdComponentException(); + virtual ~IdComponentException() throw(); }; } diff --git a/c++/src/H5FaccProp.cpp b/c++/src/H5FaccProp.cpp index c3919da..1ab812c 100644 --- a/c++/src/H5FaccProp.cpp +++ b/c++/src/H5FaccProp.cpp @@ -63,7 +63,7 @@ FileAccPropList* FileAccPropList::getConstant() //-------------------------------------------------------------------------- // Function: FileAccPropList::deleteConstants -// Purpose: Deletes the constant object that FileAccPropList::DEFAULT_ +// Purpose Deletes the constant object that FileAccPropList::DEFAULT_ // points to. // exception H5::PropListIException // Programmer Binh-Minh Ribler - 2015 @@ -75,271 +75,271 @@ void FileAccPropList::deleteConstants() } //-------------------------------------------------------------------------- -// Purpose: Constant for default property +// Purpose Constant for default property //-------------------------------------------------------------------------- const FileAccPropList& FileAccPropList::DEFAULT = *getConstant(); #endif // DOXYGEN_SHOULD_SKIP_THIS //-------------------------------------------------------------------------- -// Function: Default Constructor -///\brief Creates a file access property list -// Programmer: Binh-Minh Ribler - 2000 +// Function: Default Constructor +///\brief Creates a file access property list +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -FileAccPropList::FileAccPropList() : PropList( H5P_FILE_ACCESS ) {} +FileAccPropList::FileAccPropList() : PropList(H5P_FILE_ACCESS) {} //-------------------------------------------------------------------------- -// Function: FileAccPropList copy constructor -///\brief Copy Constructor: makes a copy of the original -///\param original - IN: FileAccPropList instance to copy -// Programmer: Binh-Minh Ribler - 2000 +// Function: FileAccPropList copy constructor +///\brief Copy Constructor: makes a copy of the original +///\param original - IN: FileAccPropList instance to copy +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- FileAccPropList::FileAccPropList(const FileAccPropList& original) : PropList(original) {} //-------------------------------------------------------------------------- -// Function: FileAccPropList overloaded constructor -///\brief Creates a file access property list using the id of an -/// existing one. -// Programmer: Binh-Minh Ribler - 2000 +// Function: FileAccPropList overloaded constructor +///\brief Creates a file access property list using the id of an +/// existing one. +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- FileAccPropList::FileAccPropList(const hid_t plist_id) : PropList(plist_id) {} //-------------------------------------------------------------------------- -// Function: FileAccPropList::setStdio -///\brief Modifies this property list to use the \c H5FD_STDIO driver. +// Function: FileAccPropList::setStdio +///\brief Modifies this property list to use the \c H5FD_STDIO driver. /// -///\exception H5::PropListIException -// Programmer: Binh-Minh Ribler - April, 2004 +///\exception H5::PropListIException +// Programmer Binh-Minh Ribler - April, 2004 //-------------------------------------------------------------------------- void FileAccPropList::setStdio() const { - herr_t ret_value = H5Pset_fapl_stdio(id); - if( ret_value < 0 ) - { - throw PropListIException("FileAccPropList::setStdio", "H5Pset_fapl_stdio failed"); - } + herr_t ret_value = H5Pset_fapl_stdio(id); + if (ret_value < 0) + { + throw PropListIException("FileAccPropList::setStdio", "H5Pset_fapl_stdio failed"); + } } //-------------------------------------------------------------------------- -// Function: FileAccPropList::getDriver -///\brief Return the ID of the low-level file driver. -///\return A low-level driver ID which is the same ID used when the -/// driver was set for the property list. The driver ID is -/// only valid as long as the file driver remains registered. -/// Valid driver identifiers can be found at: +// Function: FileAccPropList::getDriver +///\brief Return the ID of the low-level file driver. +///\return A low-level driver ID which is the same ID used when the +/// driver was set for the property list. The driver ID is +/// only valid as long as the file driver remains registered. +/// Valid driver identifiers can be found at: /// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-GetDriver -///\exception H5::PropListIException -// Programmer: Binh-Minh Ribler - April, 2004 +///\exception H5::PropListIException +// Programmer Binh-Minh Ribler - April, 2004 //-------------------------------------------------------------------------- hid_t FileAccPropList::getDriver() const { - hid_t driver = H5Pget_driver(id); - if (driver < 0) - { - throw PropListIException("FileAccPropList::getDriver", "H5Pget_driver failed"); - } + hid_t driver = H5Pget_driver(id); + if (driver < 0) + { + throw PropListIException("FileAccPropList::getDriver", "H5Pget_driver failed"); + } return(driver); } //-------------------------------------------------------------------------- -// Function: FileAccPropList::setDriver -///\brief Set file driver for this property list. -///\param new_driver_id - IN: File driver -///\param new_driver_info - IN: Struct containing the driver-specific properites -///\exception H5::PropListIException +// Function: FileAccPropList::setDriver +///\brief Set file driver for this property list. +///\param new_driver_id - IN: File driver +///\param new_driver_info - IN: Struct containing the driver-specific properites +///\exception H5::PropListIException ///\par Description -/// For a list of valid driver identifiers, please see the C -/// layer Reference Manual at: +/// For a list of valid driver identifiers, please see the C +/// layer Reference Manual at: /// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetDriver -// Programmer: Binh-Minh Ribler - April, 2004 +// Programmer Binh-Minh Ribler - April, 2004 //-------------------------------------------------------------------------- void FileAccPropList::setDriver(hid_t new_driver_id, const void *new_driver_info) const { - herr_t ret_value = H5Pset_driver(id, new_driver_id, new_driver_info); - if (ret_value < 0) - { - throw PropListIException("FileAccPropList::setDriver", "H5Pset_driver failed"); - } + herr_t ret_value = H5Pset_driver(id, new_driver_id, new_driver_info); + if (ret_value < 0) + { + throw PropListIException("FileAccPropList::setDriver", "H5Pset_driver failed"); + } } //-------------------------------------------------------------------------- -// Function: FileAccPropList::setFamilyOffset -///\brief Sets offset for family driver. -///\param offset - IN: offset value -///\exception H5::PropListIException -// Programmer: Binh-Minh Ribler - April, 2004 +// Function: FileAccPropList::setFamilyOffset +///\brief Sets offset for family driver. +///\param offset - IN: offset value +///\exception H5::PropListIException +// Programmer Binh-Minh Ribler - April, 2004 //-------------------------------------------------------------------------- void FileAccPropList::setFamilyOffset(hsize_t offset) const { - herr_t ret_value = H5Pset_family_offset(id, offset); - if (ret_value < 0) - { - throw PropListIException("FileAccPropList::setFamilyOffset", "H5Pset_family_offset failed"); - } + herr_t ret_value = H5Pset_family_offset(id, offset); + if (ret_value < 0) + { + throw PropListIException("FileAccPropList::setFamilyOffset", "H5Pset_family_offset failed"); + } } //-------------------------------------------------------------------------- -// Function: FileAccPropList::getFamilyOffset -///\brief Get offset for family driver. -///\return Offset for family driver -///\exception H5::PropListIException -// Programmer: Binh-Minh Ribler - April, 2004 +// Function: FileAccPropList::getFamilyOffset +///\brief Get offset for family driver. +///\return Offset for family driver +///\exception H5::PropListIException +// Programmer Binh-Minh Ribler - April, 2004 //-------------------------------------------------------------------------- hsize_t FileAccPropList::getFamilyOffset() const { - hsize_t offset; - herr_t ret_value = H5Pget_family_offset(id, &offset); - if (ret_value < 0) - { - throw PropListIException("FileAccPropList::getFamilyOffset", "H5Pget_family_offset failed"); - } + hsize_t offset; + herr_t ret_value = H5Pget_family_offset(id, &offset); + if (ret_value < 0) + { + throw PropListIException("FileAccPropList::getFamilyOffset", "H5Pget_family_offset failed"); + } return(offset); } //-------------------------------------------------------------------------- -// Function: FileAccPropList::setCore -///\brief Modifies this file access property list to use the \c H5FD_CORE -/// driver. -///\param increment - IN: Specifies how much memory to increase each -/// time more memory is needed, in bytes -///\param backing_store - IN: Indicating whether to write the file -/// contents to disk when the file is closed -///\exception H5::PropListIException +// Function: FileAccPropList::setCore +///\brief Modifies this file access property list to use the \c H5FD_CORE +/// driver. +///\param increment - IN: Specifies how much memory to increase each +/// time more memory is needed, in bytes +///\param backing_store - IN: Indicating whether to write the file +/// contents to disk when the file is closed +///\exception H5::PropListIException ///\par Description -/// For more details on the use of \c H5FD_CORE driver, please -/// refer to +/// For more details on the use of \c H5FD_CORE driver, please +/// refer to /// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetFaplCore -// Programmer: Binh-Minh Ribler - April, 2004 +// Programmer Binh-Minh Ribler - April, 2004 //-------------------------------------------------------------------------- void FileAccPropList::setCore (size_t increment, hbool_t backing_store) const { - herr_t ret_value = H5Pset_fapl_core (id, increment, backing_store); - if (ret_value < 0) - { - throw PropListIException ("FileAccPropList::setCore", "H5Pset_fapl_core failed"); - } + herr_t ret_value = H5Pset_fapl_core (id, increment, backing_store); + if (ret_value < 0) + { + throw PropListIException ("FileAccPropList::setCore", "H5Pset_fapl_core failed"); + } } //-------------------------------------------------------------------------- -// Function: FileAccPropList::getCore -///\brief Queries core file driver properties. -///\param increment - OUT: Size of memory increment, in bytes -///\param backing_store - OUT: Indicating whether to write the file -/// contents to disk when the file is closed -///\exception H5::PropListIException -// Programmer: Binh-Minh Ribler - April, 2004 +// Function: FileAccPropList::getCore +///\brief Queries core file driver properties. +///\param increment - OUT: Size of memory increment, in bytes +///\param backing_store - OUT: Indicating whether to write the file +/// contents to disk when the file is closed +///\exception H5::PropListIException +// Programmer Binh-Minh Ribler - April, 2004 //-------------------------------------------------------------------------- void FileAccPropList::getCore (size_t& increment, hbool_t& backing_store) const { - herr_t ret_value = H5Pget_fapl_core(id, &increment, &backing_store); - if( ret_value < 0 ) - { - throw PropListIException("FileAccPropList::getCore", "H5Pget_fapl_core failed"); - } + herr_t ret_value = H5Pget_fapl_core(id, &increment, &backing_store); + if (ret_value < 0) + { + throw PropListIException("FileAccPropList::getCore", "H5Pget_fapl_core failed"); + } } //-------------------------------------------------------------------------- -// Function: FileAccPropList::setFamily -///\brief Sets this file access property list to use the family driver. -///\param memb_size - IN: Size in bytes of each file member -///\param memb_plist - IN: File access property list to be used for -/// each family member -///\exception H5::PropListIException +// Function: FileAccPropList::setFamily +///\brief Sets this file access property list to use the family driver. +///\param memb_size - IN: Size in bytes of each file member +///\param memb_plist - IN: File access property list to be used for +/// each family member +///\exception H5::PropListIException ///\par Description -/// Note that \a memb_size is used only when creating a new file. -// Programmer: Binh-Minh Ribler - April, 2004 +/// Note that \a memb_size is used only when creating a new file. +// Programmer Binh-Minh Ribler - April, 2004 //-------------------------------------------------------------------------- -void FileAccPropList::setFamily( hsize_t memb_size, const FileAccPropList& memb_plist ) const +void FileAccPropList::setFamily(hsize_t memb_size, const FileAccPropList& memb_plist) const { - herr_t ret_value = H5Pset_fapl_family (id, memb_size, memb_plist.getId() ); - if( ret_value < 0 ) - { - throw PropListIException("FileAccPropList::setFamily", "H5Pset_fapl_family failed"); - } + herr_t ret_value = H5Pset_fapl_family (id, memb_size, memb_plist.getId()); + if (ret_value < 0) + { + throw PropListIException("FileAccPropList::setFamily", "H5Pset_fapl_family failed"); + } } //-------------------------------------------------------------------------- -// Function: FileAccPropList::getFamily -///\brief Returns information about the family file access property -/// list. -///\param memb_size - OUT: Size in bytes of each file member -///\param memb_plist - OUT: Retrieved file access property list for each -/// file member -///\exception H5::PropListIException -// Programmer: Binh-Minh Ribler - April, 2004 +// Function: FileAccPropList::getFamily +///\brief Returns information about the family file access property +/// list. +///\param memb_size - OUT: Size in bytes of each file member +///\param memb_plist - OUT: Retrieved file access property list for each +/// file member +///\exception H5::PropListIException +// Programmer Binh-Minh Ribler - April, 2004 //-------------------------------------------------------------------------- void FileAccPropList::getFamily(hsize_t& memb_size, FileAccPropList& memb_plist) const { - hid_t memb_plist_id; - herr_t ret_value = H5Pget_fapl_family( id, &memb_size, &memb_plist_id ); - if( ret_value < 0 ) - { - throw PropListIException("FileAccPropList::getFamily", "H5Pget_fapl_family failed"); - } - memb_plist.p_setId(memb_plist_id); + hid_t memb_plist_id; + herr_t ret_value = H5Pget_fapl_family(id, &memb_size, &memb_plist_id); + if (ret_value < 0) + { + throw PropListIException("FileAccPropList::getFamily", "H5Pget_fapl_family failed"); + } + memb_plist.p_setId(memb_plist_id); } //-------------------------------------------------------------------------- -// Function: FileAccPropList::getFamily -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function only in what arguments it -/// accepts and its return value. -///\param memb_size - OUT: Size in bytes of each file member -///\return The file access property list for each file member -///\exception H5::PropListIException -// Programmer: Binh-Minh Ribler - April, 2004 +// Function: FileAccPropList::getFamily +///\brief This is an overloaded member function, provided for convenience. +/// It differs from the above function only in what arguments it +/// accepts and its return value. +///\param memb_size - OUT: Size in bytes of each file member +///\return The file access property list for each file member +///\exception H5::PropListIException +// Programmer Binh-Minh Ribler - April, 2004 //-------------------------------------------------------------------------- FileAccPropList FileAccPropList::getFamily(hsize_t& memb_size) const { - hid_t memb_plist_id; - herr_t ret_value = H5Pget_fapl_family( id, &memb_size, &memb_plist_id ); - if( ret_value < 0 ) - { - throw PropListIException("FileAccPropList::getFamily", "H5Pget_fapl_family failed"); - } - FileAccPropList memb_plist(memb_plist_id); - return(memb_plist); -} - -//-------------------------------------------------------------------------- -// Function: FileAccPropList::setSplit -///\brief Emulates the old split file driver, which stored meta data -/// in one file and raw data in another file. -///\param meta_plist - IN: File access plist for the metadata file -///\param raw_plist - IN: File access plist for the raw data file -///\param meta_ext - IN: Metadata filename extension as \c char* -///\param raw_ext - IN: Raw data filename extension as \c char* -///\exception H5::PropListIException + hid_t memb_plist_id; + herr_t ret_value = H5Pget_fapl_family(id, &memb_size, &memb_plist_id); + if (ret_value < 0) + { + throw PropListIException("FileAccPropList::getFamily", "H5Pget_fapl_family failed"); + } + FileAccPropList memb_plist(memb_plist_id); + return(memb_plist); +} + +//-------------------------------------------------------------------------- +// Function: FileAccPropList::setSplit +///\brief Emulates the old split file driver, which stored meta data +/// in one file and raw data in another file. +///\param meta_plist - IN: File access plist for the metadata file +///\param raw_plist - IN: File access plist for the raw data file +///\param meta_ext - IN: Metadata filename extension as \c char* +///\param raw_ext - IN: Raw data filename extension as \c char* +///\exception H5::PropListIException ///\par Description -/// Temporary - For information, please refer to: +/// Temporary - For information, please refer to: /// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetFaplSplit -// Programmer: Binh-Minh Ribler - April, 2004 +// Programmer Binh-Minh Ribler - April, 2004 //-------------------------------------------------------------------------- -void FileAccPropList::setSplit(const FileAccPropList& meta_plist, const FileAccPropList& raw_plist, const char* meta_ext, const char* raw_ext ) const -{ - hid_t meta_pid = meta_plist.getId(); - hid_t raw_pid = raw_plist.getId(); - herr_t ret_value = H5Pset_fapl_split( id, meta_ext, meta_pid, raw_ext, raw_pid ); - if( ret_value < 0 ) +void FileAccPropList::setSplit(const FileAccPropList& meta_plist, const FileAccPropList& raw_plist, const char* meta_ext, const char* raw_ext) const { - throw PropListIException("FileAccPropList::setSplit", "H5Pset_fapl_split failed"); - } + hid_t meta_pid = meta_plist.getId(); + hid_t raw_pid = raw_plist.getId(); + herr_t ret_value = H5Pset_fapl_split(id, meta_ext, meta_pid, raw_ext, raw_pid); + if (ret_value < 0) + { + throw PropListIException("FileAccPropList::setSplit", "H5Pset_fapl_split failed"); + } } //-------------------------------------------------------------------------- -// Function: FileAccPropList::setSplit -///\brief This is an overloaded member function, provided for convenience. -/// It takes character arguments as \c H5std_string. -///\param meta_plist - IN: File access plist for the metadata file -///\param raw_plist - IN: File access plist for the raw data file -///\param meta_ext - IN: Metadata filename extension as \c H5std_string -///\param raw_ext - IN: Raw data filename extension as \c H5std_string -///\exception H5::PropListIException -// Programmer: Binh-Minh Ribler - April, 2004 +// Function: FileAccPropList::setSplit +///\brief This is an overloaded member function, provided for convenience. +/// It takes character arguments as \c H5std_string. +///\param meta_plist - IN: File access plist for the metadata file +///\param raw_plist - IN: File access plist for the raw data file +///\param meta_ext - IN: Metadata filename extension as \c H5std_string +///\param raw_ext - IN: Raw data filename extension as \c H5std_string +///\exception H5::PropListIException +// Programmer Binh-Minh Ribler - April, 2004 //-------------------------------------------------------------------------- -void FileAccPropList::setSplit(const FileAccPropList& meta_plist, const FileAccPropList& raw_plist, const H5std_string& meta_ext, const H5std_string& raw_ext ) const +void FileAccPropList::setSplit(const FileAccPropList& meta_plist, const FileAccPropList& raw_plist, const H5std_string& meta_ext, const H5std_string& raw_ext) const { - setSplit( meta_plist, raw_plist, meta_ext.c_str(), raw_ext.c_str() ); + setSplit(meta_plist, raw_plist, meta_ext.c_str(), raw_ext.c_str()); } // Stream Virtual File Driver had been removed from the main library. @@ -347,402 +347,402 @@ void FileAccPropList::setSplit(const FileAccPropList& meta_plist, const FileAccP // -BMR, March, 2012 //-------------------------------------------------------------------------- -// Function: FileAccPropList::getSieveBufSize -///\brief Returns the current settings for the data sieve buffer size -/// property from this property list. -///\return Data sieve buffer size, in bytes -///\exception H5::PropListIException -// Programmer: Binh-Minh Ribler - April, 2004 +// Function: FileAccPropList::getSieveBufSize +///\brief Returns the current settings for the data sieve buffer size +/// property from this property list. +///\return Data sieve buffer size, in bytes +///\exception H5::PropListIException +// Programmer Binh-Minh Ribler - April, 2004 //-------------------------------------------------------------------------- size_t FileAccPropList::getSieveBufSize() const { - size_t bufsize; - herr_t ret_value = H5Pget_sieve_buf_size(id, &bufsize); - if( ret_value < 0 ) - { - throw PropListIException("FileAccPropList::getSieveBufSize", "H5Pget_sieve_buf_size failed"); - } - return(bufsize); + size_t bufsize; + herr_t ret_value = H5Pget_sieve_buf_size(id, &bufsize); + if (ret_value < 0) + { + throw PropListIException("FileAccPropList::getSieveBufSize", "H5Pget_sieve_buf_size failed"); + } + return(bufsize); } //-------------------------------------------------------------------------- -// Function: FileAccPropList::setSieveBufSize -///\brief Sets the maximum size of the data sieve buffer. -///\param bufsize - IN: Maximum size, in bytes, of data sieve buffer -///\exception H5::PropListIException +// Function: FileAccPropList::setSieveBufSize +///\brief Sets the maximum size of the data sieve buffer. +///\param bufsize - IN: Maximum size, in bytes, of data sieve buffer +///\exception H5::PropListIException ///\par Description -/// For detail on data sieving, please refer to +/// For detail on data sieving, please refer to /// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetSieveBufSize -// Programmer: Binh-Minh Ribler - April, 2004 +// Programmer Binh-Minh Ribler - April, 2004 //-------------------------------------------------------------------------- void FileAccPropList::setSieveBufSize(size_t bufsize) const { - herr_t ret_value = H5Pset_sieve_buf_size(id, bufsize); - if( ret_value < 0 ) - { - throw PropListIException("FileAccPropList::getSieveBufSize", "H5Pget_sieve_buf_size failed"); - } + herr_t ret_value = H5Pset_sieve_buf_size(id, bufsize); + if (ret_value < 0) + { + throw PropListIException("FileAccPropList::getSieveBufSize", "H5Pget_sieve_buf_size failed"); + } } //-------------------------------------------------------------------------- -// Function: FileAccPropList::setMetaBlockSize -///\brief Sets the minimum size of metadata block allocations. -///\param block_size - IN: Minimum size, in bytes, of metadata -/// block allocations -///\exception H5::PropListIException +// Function: FileAccPropList::setMetaBlockSize +///\brief Sets the minimum size of metadata block allocations. +///\param block_size - IN: Minimum size, in bytes, of metadata +/// block allocations +///\exception H5::PropListIException ///\par Description -/// For more detail, please see the C layer Reference Manual at: +/// For more detail, please see the C layer Reference Manual at: /// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetMetaBlockSize -// Programmer: Binh-Minh Ribler - April, 2004 +// Programmer Binh-Minh Ribler - April, 2004 //-------------------------------------------------------------------------- void FileAccPropList::setMetaBlockSize(hsize_t &block_size) const { - herr_t ret_value = H5Pset_meta_block_size(id, block_size); - if( ret_value < 0 ) - { - throw PropListIException("FileAccPropList::setMetaBlockSize", "H5Pset_meta_block_size failed"); - } + herr_t ret_value = H5Pset_meta_block_size(id, block_size); + if (ret_value < 0) + { + throw PropListIException("FileAccPropList::setMetaBlockSize", "H5Pset_meta_block_size failed"); + } } //-------------------------------------------------------------------------- -// Function: FileAccPropList::getMetaBlockSize -///\brief Returns the current metadata block size setting. -///\return Metadata block size -///\exception H5::PropListIException -// Programmer: Binh-Minh Ribler - April, 2004 +// Function: FileAccPropList::getMetaBlockSize +///\brief Returns the current metadata block size setting. +///\return Metadata block size +///\exception H5::PropListIException +// Programmer Binh-Minh Ribler - April, 2004 //-------------------------------------------------------------------------- hsize_t FileAccPropList::getMetaBlockSize() const { - hsize_t block_size; - herr_t ret_value = H5Pget_meta_block_size(id, &block_size); - if( ret_value < 0 ) - { - throw PropListIException("FileAccPropList::getMetaBlockSize", "H5Pget_meta_block_size failed"); - } - return(block_size); + hsize_t block_size; + herr_t ret_value = H5Pget_meta_block_size(id, &block_size); + if (ret_value < 0) + { + throw PropListIException("FileAccPropList::getMetaBlockSize", "H5Pget_meta_block_size failed"); + } + return(block_size); } //-------------------------------------------------------------------------- -// Function: FileAccPropList::setLog -///\brief Modifies this file access property list to use the logging -/// driver. -///\param logfile - IN: Name of the log file -///\param flags - IN: Flags specifying the types of logging activity -///\param buf_size - IN: Size of the logging buffer -///\exception H5::PropListIException +// Function: FileAccPropList::setLog +///\brief Modifies this file access property list to use the logging +/// driver. +///\param logfile - IN: Name of the log file +///\param flags - IN: Flags specifying the types of logging activity +///\param buf_size - IN: Size of the logging buffer +///\exception H5::PropListIException ///\par Description -/// For detail on \a flags, please refer to +/// For detail on \a flags, please refer to /// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetFaplLog -// Programmer: Binh-Minh Ribler - April, 2004 +// Programmer Binh-Minh Ribler - April, 2004 //-------------------------------------------------------------------------- void FileAccPropList::setLog(const char *logfile, unsigned flags, size_t buf_size) const { - herr_t ret_value = H5Pset_fapl_log(id, logfile, flags, buf_size); - if( ret_value < 0 ) - { - throw PropListIException("FileAccPropList::setLog", "H5Pset_fapl_log failed"); - } + herr_t ret_value = H5Pset_fapl_log(id, logfile, flags, buf_size); + if (ret_value < 0) + { + throw PropListIException("FileAccPropList::setLog", "H5Pset_fapl_log failed"); + } } //-------------------------------------------------------------------------- -// Function: FileAccPropList::setLog -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function only in what arguments it -/// accepts. -///\param logfile - IN: Name of the log file - string -///\param flags - IN: Flags specifying the types of logging activity -///\param buf_size - IN: Size of the logging buffer -// Programmer: Binh-Minh Ribler - April, 2004 +// Function: FileAccPropList::setLog +///\brief This is an overloaded member function, provided for convenience. +/// It differs from the above function only in what arguments it +/// accepts. +///\param logfile - IN: Name of the log file - string +///\param flags - IN: Flags specifying the types of logging activity +///\param buf_size - IN: Size of the logging buffer +// Programmer Binh-Minh Ribler - April, 2004 //-------------------------------------------------------------------------- void FileAccPropList::setLog(const H5std_string& logfile, unsigned flags, size_t buf_size) const { - setLog(logfile.c_str(), flags, buf_size); + setLog(logfile.c_str(), flags, buf_size); } //-------------------------------------------------------------------------- -// Function: FileAccPropList::setSec2 -///\brief Modifies this file access property list to use the sec2 -/// driver. +// Function: FileAccPropList::setSec2 +///\brief Modifies this file access property list to use the sec2 +/// driver. /// -///\exception H5::PropListIException -// Programmer: Binh-Minh Ribler - April, 2004 +///\exception H5::PropListIException +// Programmer Binh-Minh Ribler - April, 2004 //-------------------------------------------------------------------------- void FileAccPropList::setSec2() const { - herr_t ret_value = H5Pset_fapl_sec2(id); - if( ret_value < 0 ) - { - throw PropListIException("FileAccPropList::setSec2", "H5Pset_fapl_sec2 failed"); - } + herr_t ret_value = H5Pset_fapl_sec2(id); + if (ret_value < 0) + { + throw PropListIException("FileAccPropList::setSec2", "H5Pset_fapl_sec2 failed"); + } } //-------------------------------------------------------------------------- -// Function: FileAccPropList::setAlignment -///\brief Sets the alignment properties of this property list. -///\param threshold - IN: Threshold value for file object size -///\param alignment - IN: Alignment value -///\exception H5::PropListIException +// Function: FileAccPropList::setAlignment +///\brief Sets the alignment properties of this property list. +///\param threshold - IN: Threshold value for file object size +///\param alignment - IN: Alignment value +///\exception H5::PropListIException ///\par Description -/// The parameter \a threshold must have a non-negative value. -/// Note that setting the threshold value to 0 (zero) has the -/// effect of a special case, forcing everything to be aligned. -/// The parameter \a alignment must have a positive value. +/// The parameter \a threshold must have a non-negative value. +/// Note that setting the threshold value to 0 (zero) has the +/// effect of a special case, forcing everything to be aligned. +/// The parameter \a alignment must have a positive value. /// -/// For detail on \a setting alignment, please refer to +/// For detail on \a setting alignment, please refer to /// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetAlignment -// Programmer: Binh-Minh Ribler - 2000 +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -void FileAccPropList::setAlignment( hsize_t threshold, hsize_t alignment ) const +void FileAccPropList::setAlignment(hsize_t threshold, hsize_t alignment) const { - herr_t ret_value = H5Pset_alignment( id, threshold, alignment ); - if( ret_value < 0 ) - { - throw PropListIException("FileAccPropList::setAlignment", "H5Pset_alignment failed"); - } + herr_t ret_value = H5Pset_alignment(id, threshold, alignment); + if (ret_value < 0) + { + throw PropListIException("FileAccPropList::setAlignment", "H5Pset_alignment failed"); + } } //-------------------------------------------------------------------------- -// Function: FileAccPropList::getAlignment -///\brief Returns the current settings for alignment properties from -/// this property list. -///\param threshold - OUT: Retrieved threshold value for file object size -///\param alignment - OUT: Retrieved alignment value -///\exception H5::PropListIException -// Programmer: Binh-Minh Ribler - 2000 +// Function: FileAccPropList::getAlignment +///\brief Returns the current settings for alignment properties from +/// this property list. +///\param threshold - OUT: Retrieved threshold value for file object size +///\param alignment - OUT: Retrieved alignment value +///\exception H5::PropListIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -void FileAccPropList::getAlignment( hsize_t &threshold, hsize_t &alignment ) const +void FileAccPropList::getAlignment(hsize_t &threshold, hsize_t &alignment) const { - herr_t ret_value = H5Pget_alignment( id, &threshold, &alignment ); - if( ret_value < 0 ) - { - throw PropListIException("FileAccPropList::getAlignment", "H5Pget_alignment failed"); - } + herr_t ret_value = H5Pget_alignment(id, &threshold, &alignment); + if (ret_value < 0) + { + throw PropListIException("FileAccPropList::getAlignment", "H5Pget_alignment failed"); + } } //-------------------------------------------------------------------------- -// Function: FileAccPropList::setMultiType -///\brief Sets data type for \c MULTI driver. -///\param dtype - IN: Type of data -///\exception H5::PropListIException +// Function: FileAccPropList::setMultiType +///\brief Sets data type for \c MULTI driver. +///\param dtype - IN: Type of data +///\exception H5::PropListIException ///\par Description -/// More details and valid values for \a dtype can be found at: +/// More details and valid values for \a dtype can be found at: /// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetMultiType -// Programmer: Binh-Minh Ribler - April, 2004 +// Programmer Binh-Minh Ribler - April, 2004 //-------------------------------------------------------------------------- void FileAccPropList::setMultiType(H5FD_mem_t dtype) const { - herr_t ret_value = H5Pset_multi_type(id, dtype); - if( ret_value < 0 ) - { - throw PropListIException("FileAccPropList::setMultiType", "H5Pset_multi_type failed"); - } + herr_t ret_value = H5Pset_multi_type(id, dtype); + if (ret_value < 0) + { + throw PropListIException("FileAccPropList::setMultiType", "H5Pset_multi_type failed"); + } } //-------------------------------------------------------------------------- -// Function: FileAccPropList::getMultiType -///\brief Returns the data type property for \c MULTI driver. -///\return The data type property -///\exception H5::PropListIException +// Function: FileAccPropList::getMultiType +///\brief Returns the data type property for \c MULTI driver. +///\return The data type property +///\exception H5::PropListIException ///\par Description -/// More details and possible returned values can be found at: +/// More details and possible returned values can be found at: /// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-GetMultiType -// Programmer: Binh-Minh Ribler - April, 2004 +// Programmer Binh-Minh Ribler - April, 2004 //-------------------------------------------------------------------------- H5FD_mem_t FileAccPropList::getMultiType() const { - H5FD_mem_t dtype; - herr_t ret_value = H5Pget_multi_type(id, &dtype); - if( ret_value < 0 ) - { - throw PropListIException("FileAccPropList::getMultiType", "H5Pget_multi_type failed"); - } - return(dtype); + H5FD_mem_t dtype; + herr_t ret_value = H5Pget_multi_type(id, &dtype); + if (ret_value < 0) + { + throw PropListIException("FileAccPropList::getMultiType", "H5Pget_multi_type failed"); + } + return(dtype); } //-------------------------------------------------------------------------- -// Function: FileAccPropList::setCache -///\brief Sets the meta data cache and raw data chunk cache parameters. -///\param mdc_nelmts - IN: Number of elements in the meta data cache -///\param rdcc_nelmts - IN: Number of elements in the raw data chunk cache -///\param rdcc_nbytes - IN: Total size of the raw data chunk cache, in bytes -///\param rdcc_w0 - IN: Preemption policy -///\exception H5::PropListIException +// Function: FileAccPropList::setCache +///\brief Sets the meta data cache and raw data chunk cache parameters. +///\param mdc_nelmts - IN: Number of elements in the meta data cache +///\param rdcc_nelmts - IN: Number of elements in the raw data chunk cache +///\param rdcc_nbytes - IN: Total size of the raw data chunk cache, in bytes +///\param rdcc_w0 - IN: Preemption policy +///\exception H5::PropListIException ///\par Description -/// The argument \a rdcc_w0 should hold a value between 0 and 1 -/// inclusive. This value indicates how much chunks that have -/// been fully read are favored for preemption. A value of zero -/// means fully read chunks are treated no differently than other -/// chunks (the preemption is strictly LRU) while a value of one -/// means fully read chunks are always preempted before other chunks. -// Programmer: Binh-Minh Ribler - 2000 +/// The argument \a rdcc_w0 should hold a value between 0 and 1 +/// inclusive. This value indicates how much chunks that have +/// been fully read are favored for preemption. A value of zero +/// means fully read chunks are treated no differently than other +/// chunks (the preemption is strictly LRU) while a value of one +/// means fully read chunks are always preempted before other chunks. +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -void FileAccPropList::setCache( int mdc_nelmts, size_t rdcc_nelmts, size_t rdcc_nbytes, double rdcc_w0 ) const +void FileAccPropList::setCache(int mdc_nelmts, size_t rdcc_nelmts, size_t rdcc_nbytes, double rdcc_w0) const { - herr_t ret_value = H5Pset_cache( id, mdc_nelmts, rdcc_nelmts, rdcc_nbytes, rdcc_w0 ); - if( ret_value < 0 ) - { - throw PropListIException("FileAccPropList::setCache", "H5Pset_cache failed"); - } + herr_t ret_value = H5Pset_cache(id, mdc_nelmts, rdcc_nelmts, rdcc_nbytes, rdcc_w0); + if (ret_value < 0) + { + throw PropListIException("FileAccPropList::setCache", "H5Pset_cache failed"); + } } //-------------------------------------------------------------------------- -// Function: FileAccPropList::getCache -///\brief Queries the meta data cache and raw data chunk cache parameters. -///\param mdc_nelmts - OUT: Number of elements in the meta data cache -///\param rdcc_nelmts - OUT: Number of elements in the raw data chunk cache -///\param rdcc_nbytes - OUT: Total size of the raw data chunk cache, in bytes -///\param rdcc_w0 - OUT: Preemption policy -///\exception H5::PropListIException -// Programmer: Binh-Minh Ribler - 2000 +// Function: FileAccPropList::getCache +///\brief Queries the meta data cache and raw data chunk cache parameters. +///\param mdc_nelmts - OUT: Number of elements in the meta data cache +///\param rdcc_nelmts - OUT: Number of elements in the raw data chunk cache +///\param rdcc_nbytes - OUT: Total size of the raw data chunk cache, in bytes +///\param rdcc_w0 - OUT: Preemption policy +///\exception H5::PropListIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -void FileAccPropList::getCache( int& mdc_nelmts, size_t& rdcc_nelmts, size_t& rdcc_nbytes, double& rdcc_w0 ) const +void FileAccPropList::getCache(int& mdc_nelmts, size_t& rdcc_nelmts, size_t& rdcc_nbytes, double& rdcc_w0) const { - herr_t ret_value = H5Pget_cache( id, &mdc_nelmts, &rdcc_nelmts, &rdcc_nbytes, &rdcc_w0 ); - if( ret_value < 0 ) - { - throw PropListIException("FileAccPropList::getCache", "H5Pget_cache failed"); - } + herr_t ret_value = H5Pget_cache(id, &mdc_nelmts, &rdcc_nelmts, &rdcc_nbytes, &rdcc_w0); + if (ret_value < 0) + { + throw PropListIException("FileAccPropList::getCache", "H5Pget_cache failed"); + } } //-------------------------------------------------------------------------- -// Function: FileAccPropList::setFcloseDegree -///\brief Sets the degree for the file close behavior. -///\param degree - IN: -///\exception H5::PropListIException -// Programmer: Binh-Minh Ribler - April, 2004 +// Function: FileAccPropList::setFcloseDegree +///\brief Sets the degree for the file close behavior. +///\param degree - IN: +///\exception H5::PropListIException +// Programmer Binh-Minh Ribler - April, 2004 //-------------------------------------------------------------------------- void FileAccPropList::setFcloseDegree(H5F_close_degree_t degree) const { - herr_t ret_value = H5Pset_fclose_degree(id, degree); - if( ret_value < 0 ) - { - throw PropListIException("FileAccPropList::setFcloseDegree", "H5Pset_fclose_degree failed"); - } + herr_t ret_value = H5Pset_fclose_degree(id, degree); + if (ret_value < 0) + { + throw PropListIException("FileAccPropList::setFcloseDegree", "H5Pset_fclose_degree failed"); + } } //-------------------------------------------------------------------------- -// Function: FileAccPropList::getFcloseDegree -///\brief Returns the degree for the file close behavior. -///\return The degree for the file close behavior -///\exception H5::PropListIException -// Programmer: Binh-Minh Ribler - April, 2004 +// Function: FileAccPropList::getFcloseDegree +///\brief Returns the degree for the file close behavior. +///\return The degree for the file close behavior +///\exception H5::PropListIException +// Programmer Binh-Minh Ribler - April, 2004 //-------------------------------------------------------------------------- H5F_close_degree_t FileAccPropList::getFcloseDegree() const { - H5F_close_degree_t degree; - herr_t ret_value = H5Pget_fclose_degree(id, °ree); - if( ret_value < 0 ) - { - throw PropListIException("FileAccPropList::getFcloseDegree", "H5Pget_fclose_degree failed"); - } - return(degree); + H5F_close_degree_t degree; + herr_t ret_value = H5Pget_fclose_degree(id, °ree); + if (ret_value < 0) + { + throw PropListIException("FileAccPropList::getFcloseDegree", "H5Pget_fclose_degree failed"); + } + return(degree); } //-------------------------------------------------------------------------- -// Function: FileAccPropList::setGcReferences -///\brief Sets garbage collecting references flag. -///\param gc_ref - IN: Flag setting reference garbage collection to -/// on (1) or off (0). -///\exception H5::PropListIException +// Function: FileAccPropList::setGcReferences +///\brief Sets garbage collecting references flag. +///\param gc_ref - IN: Flag setting reference garbage collection to +/// on (1) or off (0). +///\exception H5::PropListIException ///\par Description -/// For detail on \a fapl, please refer to +/// For detail on \a fapl, please refer to /// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetGCReferences -// Programmer: Binh-Minh Ribler - 2000 +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -void FileAccPropList::setGcReferences( unsigned gc_ref ) const +void FileAccPropList::setGcReferences(unsigned gc_ref) const { - herr_t ret_value = H5Pset_gc_references( id, gc_ref ); - if( ret_value < 0 ) - { - throw PropListIException("FileAccPropList::setGcReferences", "H5Pset_gc_references failed"); - } + herr_t ret_value = H5Pset_gc_references(id, gc_ref); + if (ret_value < 0) + { + throw PropListIException("FileAccPropList::setGcReferences", "H5Pset_gc_references failed"); + } } //-------------------------------------------------------------------------- -// Function: FileAccPropList::getGcReferences -///\brief Returns the garbage collecting references setting. -///\return Garbage collecting references setting, 0 (off) or 1 (on) -///\exception H5::PropListIException -// Programmer: Binh-Minh Ribler - 2000 +// Function: FileAccPropList::getGcReferences +///\brief Returns the garbage collecting references setting. +///\return Garbage collecting references setting, 0 (off) or 1 (on) +///\exception H5::PropListIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- unsigned FileAccPropList::getGcReferences() const { - unsigned gc_ref; + unsigned gc_ref; - // the name of this routine will be changed to H5Pget_gc_references??? - herr_t ret_value = H5Pget_gc_references( id, &gc_ref ); - if( ret_value < 0 ) - { - throw PropListIException("FileAccPropList::getGcReferences", "H5Pget_gc_references failed"); - } - return( gc_ref ); + // the name of this routine will be changed to H5Pget_gc_references??? + herr_t ret_value = H5Pget_gc_references(id, &gc_ref); + if (ret_value < 0) + { + throw PropListIException("FileAccPropList::getGcReferences", "H5Pget_gc_references failed"); + } + return(gc_ref); } //-------------------------------------------------------------------------- -// Function: FileAccPropList::setLibverBounds -///\brief Sets bounds on versions of library format to be used when creating -/// or writing objects. -///\param libver_low - IN: Earliest version of the library that will be -/// used for creating or writing objects -///\param libver_high - IN: Latest version of the library that will be -///\exception H5::PropListIException +// Function: FileAccPropList::setLibverBounds +///\brief Sets bounds on versions of library format to be used when creating +/// or writing objects. +///\param libver_low - IN: Earliest version of the library that will be +/// used for creating or writing objects +///\param libver_high - IN: Latest version of the library that will be +///\exception H5::PropListIException ///\par Description -/// Valid values of \a libver_low are as follows: -/// \li \c H5F_LIBVER_EARLIEST (Default) -/// \li \c H5F_LIBVER_18 -/// \li \c H5F_LIBVER_LATEST +/// Valid values of \a libver_low are as follows: +/// \li \c H5F_LIBVER_EARLIEST (Default) +/// \li \c H5F_LIBVER_18 +/// \li \c H5F_LIBVER_LATEST /// -/// Valid values of \a libver_high are as follows: -/// \li \c H5F_LIBVER_18 -/// \li \c H5F_LIBVER_LATEST (Default) +/// Valid values of \a libver_high are as follows: +/// \li \c H5F_LIBVER_18 +/// \li \c H5F_LIBVER_LATEST (Default) /// -/// For more details, please refer to +/// For more details, please refer to /// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetLibverBounds -// Programmer: Binh-Minh Ribler - March, 2015 +// Programmer Binh-Minh Ribler - March, 2015 //-------------------------------------------------------------------------- void FileAccPropList::setLibverBounds(H5F_libver_t libver_low, H5F_libver_t libver_high) const { herr_t ret_value = H5Pset_libver_bounds(id, libver_low, libver_high); if (ret_value < 0) { - throw PropListIException("FileAccPropList::setLibverBounds", "H5Pset_libver_bounds failed"); + throw PropListIException("FileAccPropList::setLibverBounds", "H5Pset_libver_bounds failed"); } } //-------------------------------------------------------------------------- -// Function: FileAccPropList::getLibverBounds -///\brief Gets the current settings for the library version format bounds -/// from a file access property list. -///\param libver_low - OUT: Earliest version of the library that will be -/// used for creating or writing objects -///\param libver_high - OUT: Latest version of the library that will be -/// used for creating or writing objects -///\exception H5::PropListIException +// Function: FileAccPropList::getLibverBounds +///\brief Gets the current settings for the library version format bounds +/// from a file access property list. +///\param libver_low - OUT: Earliest version of the library that will be +/// used for creating or writing objects +///\param libver_high - OUT: Latest version of the library that will be +/// used for creating or writing objects +///\exception H5::PropListIException ///\par Description -/// On success, the argument \a libver_low can have the following -/// values: -/// \li \c H5F_LIBVER_EARLIEST -/// \li \c H5F_LIBVER_18 -/// \li \c H5F_LIBVER_LATEST +/// On success, the argument \a libver_low can have the following +/// values: +/// \li \c H5F_LIBVER_EARLIEST +/// \li \c H5F_LIBVER_18 +/// \li \c H5F_LIBVER_LATEST /// -/// and \a libver_high: -/// \li \c H5F_LIBVER_18 -/// \li \c H5F_LIBVER_LATEST -// Programmer: Binh-Minh Ribler - March, 2015 +/// and \a libver_high: +/// \li \c H5F_LIBVER_18 +/// \li \c H5F_LIBVER_LATEST +// Programmer Binh-Minh Ribler - March, 2015 //-------------------------------------------------------------------------- void FileAccPropList::getLibverBounds(H5F_libver_t& libver_low, H5F_libver_t& libver_high) const { herr_t ret_value = H5Pget_libver_bounds(id, &libver_low, &libver_high); - if( ret_value < 0 ) + if (ret_value < 0) { - throw PropListIException("FileAccPropList::getLibverBounds", "H5Pget_libver_bounds failed"); + throw PropListIException("FileAccPropList::getLibverBounds", "H5Pget_libver_bounds failed"); } } //-------------------------------------------------------------------------- -// Function: FileAccPropList destructor -///\brief Noop destructor -// Programmer Binh-Minh Ribler - 2000 +// Function: FileAccPropList destructor +///\brief Noop destructor +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- FileAccPropList::~FileAccPropList() {} diff --git a/c++/src/H5FaccProp.h b/c++/src/H5FaccProp.h index aec5fcc..ae7c7f9 100644 --- a/c++/src/H5FaccProp.h +++ b/c++/src/H5FaccProp.h @@ -27,121 +27,121 @@ namespace H5 { */ class H5_DLLCPP FileAccPropList : public PropList { public: - ///\brief Default file access property list. - static const FileAccPropList& DEFAULT; + ///\brief Default file access property list. + static const FileAccPropList& DEFAULT; - // Creates a file access property list. - FileAccPropList(); + // Creates a file access property list. + FileAccPropList(); - // Modifies this property list to use the H5FD_STDIO driver - void setStdio() const; + // Modifies this property list to use the H5FD_STDIO driver + void setStdio() const; - // Set file driver for this property list - void setDriver(hid_t new_driver_id, const void *new_driver_info) const; + // Set file driver for this property list + void setDriver(hid_t new_driver_id, const void *new_driver_info) const; - // Returns a low-level file driver identifier. - hid_t getDriver() const; + // Returns a low-level file driver identifier. + hid_t getDriver() const; - // Sets offset for family driver. - void setFamilyOffset(hsize_t offset) const; + // Sets offset for family driver. + void setFamilyOffset(hsize_t offset) const; - // Gets offset for family driver. - hsize_t getFamilyOffset() const; + // Gets offset for family driver. + hsize_t getFamilyOffset() const; - // Modifies this file access property list to use the sec2 driver. - void setSec2() const; + // Modifies this file access property list to use the sec2 driver. + void setSec2() const; - // Modifies this file access property list to use the H5FD_CORE - // driver. - void setCore (size_t increment, hbool_t backing_store) const; + // Modifies this file access property list to use the H5FD_CORE + // driver. + void setCore (size_t increment, hbool_t backing_store) const; - // Queries H5FD_CORE driver properties. - void getCore (size_t& increment, hbool_t& backing_store) const; + // Queries H5FD_CORE driver properties. + void getCore (size_t& increment, hbool_t& backing_store) const; - // Sets this file access properties list to the family driver. - void setFamily( hsize_t memb_size, const FileAccPropList& memb_plist ) const; + // Sets this file access properties list to the family driver. + void setFamily(hsize_t memb_size, const FileAccPropList& memb_plist) const; - // Returns information about the family file access property list. - void getFamily(hsize_t& memb_size, FileAccPropList& memb_plist) const; - FileAccPropList getFamily(hsize_t& memb_size) const; + // Returns information about the family file access property list. + void getFamily(hsize_t& memb_size, FileAccPropList& memb_plist) const; + FileAccPropList getFamily(hsize_t& memb_size) const; - // Emulates the old split file driver, - void setSplit(const FileAccPropList& meta_plist, - const FileAccPropList& raw_plist, - const char* meta_ext = ".meta", - const char* raw_ext = ".raw" ) const; - void setSplit(const FileAccPropList& meta_plist, - const FileAccPropList& raw_plist, - const H5std_string& meta_ext = ".meta", - const H5std_string& raw_ext = ".raw") const; + // Emulates the old split file driver, + void setSplit(const FileAccPropList& meta_plist, + const FileAccPropList& raw_plist, + const char* meta_ext = ".meta", + const char* raw_ext = ".raw") const; + void setSplit(const FileAccPropList& meta_plist, + const FileAccPropList& raw_plist, + const H5std_string& meta_ext = ".meta", + const H5std_string& raw_ext = ".raw") const; - // Sets the maximum size of the data sieve buffer. - void setSieveBufSize(size_t bufsize) const; + // Sets the maximum size of the data sieve buffer. + void setSieveBufSize(size_t bufsize) const; - // Returns the current settings for the data sieve buffer size - // property - size_t getSieveBufSize() const; + // Returns the current settings for the data sieve buffer size + // property + size_t getSieveBufSize() const; - // Sets the minimum size of metadata block allocations. - void setMetaBlockSize(hsize_t &block_size) const; + // Sets the minimum size of metadata block allocations. + void setMetaBlockSize(hsize_t &block_size) const; - // Returns the current metadata block size setting. - hsize_t getMetaBlockSize() const; + // Returns the current metadata block size setting. + hsize_t getMetaBlockSize() const; - // Modifies this file access property list to use the logging driver. - void setLog(const char *logfile, unsigned flags, size_t buf_size) const; - void setLog(const H5std_string& logfile, unsigned flags, size_t buf_size) const; + // Modifies this file access property list to use the logging driver. + void setLog(const char *logfile, unsigned flags, size_t buf_size) const; + void setLog(const H5std_string& logfile, unsigned flags, size_t buf_size) const; - // Sets alignment properties of this file access property list - void setAlignment( hsize_t threshold = 1, hsize_t alignment = 1 ) const; + // Sets alignment properties of this file access property list + void setAlignment(hsize_t threshold = 1, hsize_t alignment = 1) const; - // Retrieves the current settings for alignment properties from - // this property list. - void getAlignment( hsize_t& threshold, hsize_t& alignment ) const; + // Retrieves the current settings for alignment properties from + // this property list. + void getAlignment(hsize_t& threshold, hsize_t& alignment) const; - // Sets data type for multi driver. - void setMultiType(H5FD_mem_t dtype) const; + // Sets data type for multi driver. + void setMultiType(H5FD_mem_t dtype) const; - // Returns the data type property for MULTI driver. - H5FD_mem_t getMultiType() const; + // Returns the data type property for MULTI driver. + H5FD_mem_t getMultiType() const; - // Sets the meta data cache and raw data chunk cache parameters. - void setCache( int mdc_nelmts, size_t rdcc_nelmts, size_t rdcc_nbytes, double rdcc_w0 ) const; + // Sets the meta data cache and raw data chunk cache parameters. + void setCache(int mdc_nelmts, size_t rdcc_nelmts, size_t rdcc_nbytes, double rdcc_w0) const; - // Queries the meta data cache and raw data chunk cache parameters. - void getCache( int& mdc_nelmts, size_t& rdcc_nelmts, size_t& rdcc_nbytes, double& rdcc_w0 ) const; + // Queries the meta data cache and raw data chunk cache parameters. + void getCache(int& mdc_nelmts, size_t& rdcc_nelmts, size_t& rdcc_nbytes, double& rdcc_w0) const; - // Sets the degree for the file close behavior. - void setFcloseDegree(H5F_close_degree_t degree) const; + // Sets the degree for the file close behavior. + void setFcloseDegree(H5F_close_degree_t degree) const; - // Returns the degree for the file close behavior. - H5F_close_degree_t getFcloseDegree() const; + // Returns the degree for the file close behavior. + H5F_close_degree_t getFcloseDegree() const; - // Sets garbage collecting references flag. - void setGcReferences( unsigned gc_ref = 0 ) const; + // Sets garbage collecting references flag. + void setGcReferences(unsigned gc_ref = 0) const; - // Returns garbage collecting references setting. - unsigned getGcReferences() const; + // Returns garbage collecting references setting. + unsigned getGcReferences() const; - // Sets bounds on versions of library format to be used when creating - // or writing objects. - void setLibverBounds(H5F_libver_t libver_low, H5F_libver_t libver_high) const; + // Sets bounds on versions of library format to be used when creating + // or writing objects. + void setLibverBounds(H5F_libver_t libver_low, H5F_libver_t libver_high) const; - // Gets the current settings for the library version format bounds. - void getLibverBounds(H5F_libver_t& libver_low, H5F_libver_t& libver_high) const; + // Gets the current settings for the library version format bounds. + void getLibverBounds(H5F_libver_t& libver_low, H5F_libver_t& libver_high) const; - ///\brief Returns this class name. - virtual H5std_string fromClass () const { return("FileAccPropList"); } + ///\brief Returns this class name. + virtual H5std_string fromClass () const { return("FileAccPropList"); } - // Copy constructor: creates a copy of a FileAccPropList object. - FileAccPropList( const FileAccPropList& original ); + // Copy constructor: creates a copy of a FileAccPropList object. + FileAccPropList(const FileAccPropList& original); - // Creates a copy of an existing file access property list - // using the property list id. - FileAccPropList (const hid_t plist_id); + // Creates a copy of an existing file access property list + // using the property list id. + FileAccPropList (const hid_t plist_id); - // Noop destructor - virtual ~FileAccPropList(); + // Noop destructor + virtual ~FileAccPropList(); #ifndef DOXYGEN_SHOULD_SKIP_THIS diff --git a/c++/src/H5FcreatProp.cpp b/c++/src/H5FcreatProp.cpp index 5a99dba..c490f26 100644 --- a/c++/src/H5FcreatProp.cpp +++ b/c++/src/H5FcreatProp.cpp @@ -33,7 +33,7 @@ FileCreatPropList* FileCreatPropList::DEFAULT_ = 0; //-------------------------------------------------------------------------- // Function: FileCreatPropList::getConstant -// Purpose: Creates a FileCreatPropList object representing the HDF5 +// Purpose Creates a FileCreatPropList object representing the HDF5 // constant H5P_FILE_ACCESS, pointed to by FileCreatPropList::DEFAULT_ // exception H5::PropListIException // Description @@ -62,7 +62,7 @@ FileCreatPropList* FileCreatPropList::getConstant() //-------------------------------------------------------------------------- // Function: FileCreatPropList::deleteConstants -// Purpose: Deletes the constant object that FileCreatPropList::DEFAULT_ +// Purpose Deletes the constant object that FileCreatPropList::DEFAULT_ // points to. // Programmer Binh-Minh Ribler - 2015 //-------------------------------------------------------------------------- @@ -73,231 +73,302 @@ void FileCreatPropList::deleteConstants() } //-------------------------------------------------------------------------- -// Purpose Constant for default property +// Purpose Constant for default property //-------------------------------------------------------------------------- const FileCreatPropList& FileCreatPropList::DEFAULT = *getConstant(); #endif // DOXYGEN_SHOULD_SKIP_THIS //-------------------------------------------------------------------------- -// Function: FileCreatPropList default constructor -///\brief Default constructor: Creates a file create property list -// Programmer Binh-Minh Ribler - 2000 +// Function: FileCreatPropList default constructor +///\brief Default constructor: Creates a file create property list +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -FileCreatPropList::FileCreatPropList() : PropList( H5P_FILE_CREATE ) {} +FileCreatPropList::FileCreatPropList() : PropList(H5P_FILE_CREATE) {} //-------------------------------------------------------------------------- -// Function: FileCreatPropList copy constructor -///\brief Copy constructor: makes a copy of the original -/// FileCreatPropList object. -///\param original - IN: FileCreatPropList instance to copy -// Programmer Binh-Minh Ribler - 2000 +// Function: FileCreatPropList copy constructor +///\brief Copy constructor: makes a copy of the original +/// FileCreatPropList object. +///\param original - IN: FileCreatPropList instance to copy +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -FileCreatPropList::FileCreatPropList( const FileCreatPropList& original ) : PropList( original ) {} +FileCreatPropList::FileCreatPropList(const FileCreatPropList& original) : PropList( original ) {} //-------------------------------------------------------------------------- -// Function: FileCreatPropList overloaded constructor -///\brief Creates a file creation property list using the id of an -/// existing one. -///\param plist_id - IN: FileCreatPropList id to use -// Programmer Binh-Minh Ribler - 2000 +// Function: FileCreatPropList overloaded constructor +///\brief Creates a file creation property list using the id of an +/// existing one. +///\param plist_id - IN: FileCreatPropList id to use +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- FileCreatPropList::FileCreatPropList(const hid_t plist_id) : PropList(plist_id) {} #ifndef H5_NO_DEPRECATED_SYMBOLS //-------------------------------------------------------------------------- -// Function: FileCreatPropList::getVersion -///\brief Retrieves version information for various parts of a file. -///\param super - OUT: The file super block. -///\param freelist - OUT: The global free list. -///\param stab - OUT: The root symbol table entry. -///\param shhdr - OUT: Shared object headers. -///\exception H5::PropListIException +// Function: FileCreatPropList::getVersion +///\brief Retrieves version information for various parts of a file. +///\param super - OUT: The file super block. +///\param freelist - OUT: The global free list. +///\param stab - OUT: The root symbol table entry. +///\param shhdr - OUT: Shared object headers. +///\exception H5::PropListIException ///\par Description -/// Any (or even all) of the output arguments can be null pointers. -// Programmer Binh-Minh Ribler - 2000 +/// Any (or even all) of the output arguments can be null pointers. +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void FileCreatPropList::getVersion(unsigned& super, unsigned& freelist, unsigned& stab, unsigned& shhdr) const { - herr_t ret_value = H5Pget_version( id, &super, &freelist, &stab, &shhdr ); - if( ret_value < 0 ) - { - throw PropListIException("FileCreatPropList::getVersion", - "H5Pget_version failed"); - } + herr_t ret_value = H5Pget_version(id, &super, &freelist, &stab, &shhdr); + if (ret_value < 0) + { + throw PropListIException("FileCreatPropList::getVersion", + "H5Pget_version failed"); + } } #endif /* H5_NO_DEPRECATED_SYMBOLS */ //-------------------------------------------------------------------------- -// Function: FileCreatPropList::setUserblock -///\brief Sets the user block size field of this file creation property list. -///\param size - IN: User block size to be set, in bytes -///\exception H5::PropListIException +// Function: FileCreatPropList::setUserblock +///\brief Sets the user block size field of this file creation property list. +///\param size - IN: User block size to be set, in bytes +///\exception H5::PropListIException ///\par Description -/// The default user block size is 0; it may be set to any power -/// of 2 equal to 512 or greater (512, 1024, 2048, etc.) -// Programmer Binh-Minh Ribler - 2000 +/// The default user block size is 0; it may be set to any power +/// of 2 equal to 512 or greater (512, 1024, 2048, etc.) +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -void FileCreatPropList::setUserblock( hsize_t size ) const +void FileCreatPropList::setUserblock(hsize_t size) const { - herr_t ret_value = H5Pset_userblock( id, size); - if( ret_value < 0 ) - { - throw PropListIException("FileCreatPropList::setUserblock", - "H5Pset_userblock failed"); - } + herr_t ret_value = H5Pset_userblock(id, size); + if (ret_value < 0) + { + throw PropListIException("FileCreatPropList::setUserblock", + "H5Pset_userblock failed"); + } } //-------------------------------------------------------------------------- -// Function: FileCreatPropList::getUserblock -///\brief Returns the user block size of this file creation property list. -///\return User block size -///\exception H5::PropListIException -// Programmer Binh-Minh Ribler - 2000 +// Function: FileCreatPropList::getUserblock +///\brief Returns the user block size of this file creation property list. +///\return User block size +///\exception H5::PropListIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- hsize_t FileCreatPropList::getUserblock() const { - hsize_t userblock_size; - herr_t ret_value = H5Pget_userblock( id, &userblock_size ); - if( ret_value < 0 ) - { - throw PropListIException("FileCreatPropList::getUserblock", - "H5Pget_userblock failed"); - } - return( userblock_size ); + hsize_t userblock_size; + herr_t ret_value = H5Pget_userblock(id, &userblock_size); + if (ret_value < 0) + { + throw PropListIException("FileCreatPropList::getUserblock", + "H5Pget_userblock failed"); + } + return(userblock_size); } //-------------------------------------------------------------------------- -// Function: FileCreatPropList::setSizes -///\brief Sets the byte size of the offsets and lengths used to -/// address objects in an HDF5 file. -///\param sizeof_addr - IN: Size of an object offset in bytes -///\param sizeof_size - IN: Size of an object length in bytes. -///\exception H5::PropListIException +// Function: FileCreatPropList::setSizes +///\brief Sets the byte size of the offsets and lengths used to +/// address objects in an HDF5 file. +///\param sizeof_addr - IN: Size of an object offset in bytes +///\param sizeof_size - IN: Size of an object length in bytes. +///\exception H5::PropListIException ///\par Description -/// For information on setting sizes, please refer to the -/// C layer Reference Manual at: +/// For information on setting sizes, please refer to the +/// C layer Reference Manual at: /// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetSizes -// Programmer Binh-Minh Ribler - 2000 +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -void FileCreatPropList::setSizes( size_t sizeof_addr, size_t sizeof_size ) const +void FileCreatPropList::setSizes(size_t sizeof_addr, size_t sizeof_size) const { - herr_t ret_value = H5Pset_sizes( id, sizeof_addr, sizeof_size ); - if( ret_value < 0 ) - { - throw PropListIException("FileCreatPropList::setSizes", - "H5Pset_sizes failed"); - } + herr_t ret_value = H5Pset_sizes(id, sizeof_addr, sizeof_size); + if (ret_value < 0) + { + throw PropListIException("FileCreatPropList::setSizes", + "H5Pset_sizes failed"); + } } //-------------------------------------------------------------------------- -// Function: FileCreatPropList::getSizes -///\brief Retrieves the size of the offsets and lengths used in an -/// HDF5 file. +// Function: FileCreatPropList::getSizes +///\brief Retrieves the size of the offsets and lengths used in an +/// HDF5 file. /// -///\exception H5::PropListIException -// Programmer Binh-Minh Ribler - 2000 +///\exception H5::PropListIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -void FileCreatPropList::getSizes( size_t& sizeof_addr, size_t& sizeof_size ) const +void FileCreatPropList::getSizes(size_t& sizeof_addr, size_t& sizeof_size) const { - herr_t ret_value = H5Pget_sizes( id, &sizeof_addr, &sizeof_size ); - if( ret_value < 0 ) - { - throw PropListIException("FileCreatPropList::getSizes", - "H5Pget_sizes failed"); - } + herr_t ret_value = H5Pget_sizes(id, &sizeof_addr, &sizeof_size); + if (ret_value < 0) + { + throw PropListIException("FileCreatPropList::getSizes", + "H5Pget_sizes failed"); + } } //-------------------------------------------------------------------------- -// Function: FileCreatPropList::setSymk -///\brief Sets the size of parameters used to control the symbol table -/// nodes. -///\param ik - IN: Symbol table tree rank -///\param lk - IN: Symbol table node size -///\exception H5::PropListIException +// Function: FileCreatPropList::setSymk +///\brief Sets the size of parameters used to control the symbol table +/// nodes. +///\param ik - IN: Symbol table tree rank +///\param lk - IN: Symbol table node size +///\exception H5::PropListIException ///\par Description -/// For information, please see the C layer Reference Manual at: +/// For information, please see the C layer Reference Manual at: /// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetSymK -// Programmer Binh-Minh Ribler - 2000 +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -void FileCreatPropList::setSymk( unsigned ik, unsigned lk ) const +void FileCreatPropList::setSymk(unsigned ik, unsigned lk) const { - herr_t ret_value = H5Pset_sym_k( id, ik, lk ); - if( ret_value < 0 ) - { - throw PropListIException("FileCreatPropList::setSymk", - "H5Pset_sym_k failed"); - } + herr_t ret_value = H5Pset_sym_k(id, ik, lk); + if (ret_value < 0) + { + throw PropListIException("FileCreatPropList::setSymk", + "H5Pset_sym_k failed"); + } } //-------------------------------------------------------------------------- -// Function: FileCreatPropList::getSymk -///\brief Retrieves the size of the symbol table B-tree 1/2 rank and -/// the symbol table leaf node 1/2 size. +// Function: FileCreatPropList::getSymk +///\brief Retrieves the size of the symbol table B-tree 1/2 rank and +/// the symbol table leaf node 1/2 size. /// -///\exception H5::PropListIException +///\exception H5::PropListIException ///\par Description -/// For information, please see +/// For information, please see /// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-GetSymK -// Programmer Binh-Minh Ribler - 2000 +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -void FileCreatPropList::getSymk( unsigned& ik, unsigned& lk ) const +void FileCreatPropList::getSymk(unsigned& ik, unsigned& lk) const { - herr_t ret_value = H5Pget_sym_k( id, &ik, &lk ); - if( ret_value < 0 ) - { - throw PropListIException("FileCreatPropList::getSymk", - "H5Pget_sym_k failed"); - } + herr_t ret_value = H5Pget_sym_k(id, &ik, &lk); + if (ret_value < 0) + { + throw PropListIException("FileCreatPropList::getSymk", + "H5Pget_sym_k failed"); + } } //-------------------------------------------------------------------------- -// Function: FileCreatPropList::setIstorek -///\brief Sets the size of the parameter used to control the B-trees -/// for indexing chunked datasets. -///\param ik - IN: 1/2 rank of chunked storage B-tree -///\exception H5::PropListIException +// Function: FileCreatPropList::setIstorek +///\brief Sets the size of the parameter used to control the B-trees +/// for indexing chunked datasets. +///\param ik - IN: 1/2 rank of chunked storage B-tree +///\exception H5::PropListIException ///\par Description -/// For information, please see the C layer Reference Manual at: +/// For information, please see the C layer Reference Manual at: /// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetIstoreK -// Programmer Binh-Minh Ribler - 2000 +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -void FileCreatPropList::setIstorek( unsigned ik ) const +void FileCreatPropList::setIstorek(unsigned ik) const { - herr_t ret_value = H5Pset_istore_k( id, ik ); - if( ret_value < 0 ) - { - throw PropListIException("FileCreatPropList::setIstorek", - "H5Pset_istore_k failed"); - } + herr_t ret_value = H5Pset_istore_k(id, ik); + if (ret_value < 0) + { + throw PropListIException("FileCreatPropList::setIstorek", + "H5Pset_istore_k failed"); + } } //-------------------------------------------------------------------------- -// Function: FileCreatPropList::getIstorek -///\brief Returns the 1/2 rank of an indexed storage B-tree. -///\return 1/2 rank of chunked storage B-tree -///\exception H5::PropListIException +// Function: FileCreatPropList::getIstorek +///\brief Returns the 1/2 rank of an indexed storage B-tree. +///\return 1/2 rank of chunked storage B-tree +///\exception H5::PropListIException ///\par Description -/// For information, please see +/// For information, please see /// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-GetIstoreK -// Programmer Binh-Minh Ribler - 2000 +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- unsigned FileCreatPropList::getIstorek() const { - unsigned ik; - herr_t ret_value = H5Pget_istore_k( id, &ik ); - if( ret_value < 0 ) - { - throw PropListIException("FileCreatPropList::getIstorek", - "H5Pget_istore_k failed"); - } - return( ik ); + unsigned ik; + herr_t ret_value = H5Pget_istore_k(id, &ik); + if (ret_value < 0) + { + throw PropListIException("FileCreatPropList::getIstorek", + "H5Pget_istore_k failed"); + } + return(ik); +} + +//-------------------------------------------------------------------------- +// Function: FileCreatPropList::setFileSpace +///\brief Sets the strategy and the threshold value that the library +/// will employ in managing file space. +///\param strategy - IN: Strategy for file space management +///\param threshold - IN: Free-space section threshold. The library +/// default is 1, which is to track all free-space sections. +///\exception H5::PropListIException +///\par Description +/// If the given strategy is zero, the property will not be +/// changed and the existing strategy will be retained. +/// If the given threshold value is zero, the property will not be +/// changed and the existing threshold will be retained. +/// Valid values of \a libver_low are as follows: +/// \li \c H5F_FILE_SPACE_ALL (Default) +/// \li \c H5F_FILE_SPACE_ALL_PERSIST +/// \li \c H5F_FILE_SPACE_AGGR_VFD +/// \li \c H5F_FILE_SPACE_VFD +/// For information, please see the C layer Reference Manual at: +/// https://support.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetFileSpace +// Programmer Binh-Minh Ribler - Feb, 2017 +//-------------------------------------------------------------------------- +void FileCreatPropList::setFileSpace(H5F_file_space_type_t strategy, hsize_t threshold) const +{ + herr_t ret_value = H5Pset_file_space(id, strategy, threshold); + if (ret_value < 0) + { + throw PropListIException("FileCreatPropList::setFileSpace", + "H5Pset_file_space failed"); + } +} + +//-------------------------------------------------------------------------- +// Function: FileCreatPropList::getFileSpaceStrategy +///\brief Returns the strategy that the library uses in managing file space. +///\return The strategy value +///\exception H5::PropListIException +// Programmer Binh-Minh Ribler - Feb, 2017 +//-------------------------------------------------------------------------- +H5F_file_space_type_t FileCreatPropList::getFileSpaceStrategy() const +{ + H5F_file_space_type_t strategy = H5F_FILE_SPACE_ALL; + herr_t ret_value = H5Pget_file_space(id, &strategy, NULL); + if (ret_value < 0) + { + throw PropListIException("FileCreatPropList::getFileSpaceStrategy", + "H5Pget_file_space for strategy failed"); + } + return(strategy); +} + +//-------------------------------------------------------------------------- +// Function: FileCreatPropList::getFileSpaceThreshold +///\brief Returns the threshold value that the library uses in tracking +/// free space sections. +///\return The threshold value +///\exception H5::PropListIException +// Programmer Binh-Minh Ribler - Feb, 2017 +//-------------------------------------------------------------------------- +hsize_t FileCreatPropList::getFileSpaceThreshold() const +{ + hsize_t threshold = 0; + herr_t ret_value = H5Pget_file_space(id, NULL, &threshold); + if (ret_value < 0) + { + throw PropListIException("FileCreatPropList::getFileSpaceThreshold", + "H5Pget_file_space for threshold failed"); + } + return(threshold); } //-------------------------------------------------------------------------- -// Function: FileCreatPropList destructor -///\brief Noop destructor. -// Programmer Binh-Minh Ribler - 2000 +// Function: FileCreatPropList destructor +///\brief Noop destructor. +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- FileCreatPropList::~FileCreatPropList() {} diff --git a/c++/src/H5FcreatProp.h b/c++/src/H5FcreatProp.h index 1ac925e..1bbaabf 100644 --- a/c++/src/H5FcreatProp.h +++ b/c++/src/H5FcreatProp.h @@ -27,67 +27,78 @@ namespace H5 { */ class H5_DLLCPP FileCreatPropList : public PropList { public: - ///\brief Default file creation property list. - static const FileCreatPropList& DEFAULT; + ///\brief Default file creation property list. + static const FileCreatPropList& DEFAULT; - // Creates a file create property list. - FileCreatPropList(); + // Creates a file create property list. + FileCreatPropList(); #ifndef H5_NO_DEPRECATED_SYMBOLS - // Retrieves version information for various parts of a file. - void getVersion( unsigned& super, unsigned& freelist, unsigned& stab, unsigned& shhdr ) const; + // Retrieves version information for various parts of a file. + void getVersion(unsigned& super, unsigned& freelist, unsigned& stab, unsigned& shhdr) const; #endif /* H5_NO_DEPRECATED_SYMBOLS */ - // Sets the userblock size field of a file creation property list. - void setUserblock( hsize_t size ) const; + // Sets the userblock size field of a file creation property list. + void setUserblock(hsize_t size) const; - // Gets the size of a user block in this file creation property list. - hsize_t getUserblock() const; + // Gets the size of a user block in this file creation property list. + hsize_t getUserblock() const; - // Retrieves the size-of address and size quantities stored in a - // file according to this file creation property list. - void getSizes( size_t& sizeof_addr, size_t& sizeof_size ) const; + // Retrieves the size-of address and size quantities stored in a + // file according to this file creation property list. + void getSizes(size_t& sizeof_addr, size_t& sizeof_size) const; - // Sets file size-of addresses and sizes. - void setSizes( size_t sizeof_addr = 4, size_t sizeof_size = 4 ) const; + // Sets file size-of addresses and sizes. + void setSizes(size_t sizeof_addr = 4, size_t sizeof_size = 4) const; - // Retrieves the size of the symbol table B-tree 1/2 rank and the - // symbol table leaf node 1/2 size. - void getSymk( unsigned& int_nodes_k, unsigned& leaf_nodes_k ) const; + // Retrieves the size of the symbol table B-tree 1/2 rank and the + // symbol table leaf node 1/2 size. + void getSymk(unsigned& int_nodes_k, unsigned& leaf_nodes_k) const; - // Sets the size of parameters used to control the symbol table nodes. - void setSymk( unsigned int_nodes_k, unsigned leaf_nodes_k ) const; + // Sets the size of parameters used to control the symbol table nodes. + void setSymk(unsigned int_nodes_k, unsigned leaf_nodes_k) const; - // Returns the 1/2 rank of an indexed storage B-tree. - unsigned getIstorek() const; + // Returns the 1/2 rank of an indexed storage B-tree. + unsigned getIstorek() const; - // Sets the size of parameter used to control the B-trees for - // indexing chunked datasets. - void setIstorek( unsigned ik ) const; + // Sets the size of parameter used to control the B-trees for + // indexing chunked datasets. + void setIstorek(unsigned ik) const; - ///\brief Returns this class name. - virtual H5std_string fromClass () const { return("FileCreatPropList"); } + // Sets the strategy and the threshold value that the library will + // will employ in managing file space. + void setFileSpace(H5F_file_space_type_t strategy, hsize_t threshold) const; - // Copy constructor: creates a copy of a FileCreatPropList object. - FileCreatPropList(const FileCreatPropList& orig); + // Returns the strategy that the library uses in managing file space. + H5F_file_space_type_t getFileSpaceStrategy() const; - // Creates a copy of an existing file create property list - // using the property list id. - FileCreatPropList (const hid_t plist_id); + // Returns the threshold value that the library uses in tracking free + // space sections. + hsize_t getFileSpaceThreshold() const; - // Noop destructor - virtual ~FileCreatPropList(); + ///\brief Returns this class name. + virtual H5std_string fromClass() const { return("FileCreatPropList"); } + + // Copy constructor: creates a copy of a FileCreatPropList object. + FileCreatPropList(const FileCreatPropList& orig); + + // Creates a copy of an existing file create property list + // using the property list id. + FileCreatPropList(const hid_t plist_id); + + // Noop destructor + virtual ~FileCreatPropList(); #ifndef DOXYGEN_SHOULD_SKIP_THIS - // Deletes the global constant, should only be used by the library - static void deleteConstants(); + // Deletes the global constant, should only be used by the library + static void deleteConstants(); private: - static FileCreatPropList* DEFAULT_; + static FileCreatPropList* DEFAULT_; - // Creates the global constant, should only be used by the library - static FileCreatPropList* getConstant(); + // Creates the global constant, should only be used by the library + static FileCreatPropList* getConstant(); #endif // DOXYGEN_SHOULD_SKIP_THIS diff --git a/c++/src/H5File.cpp b/c++/src/H5File.cpp index fcf4e1c..cdb5837 100644 --- a/c++/src/H5File.cpp +++ b/c++/src/H5File.cpp @@ -46,43 +46,43 @@ namespace H5 { //-------------------------------------------------------------------------- // Function H5File default constructor -///\brief Default constructor: creates a stub H5File object. -// Programmer Binh-Minh Ribler - 2000 +///\brief Default constructor: creates a stub H5File object. +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- H5File::H5File() : Group(), id(H5I_INVALID_HID) {} //-------------------------------------------------------------------------- -// Function: H5File overloaded constructor -///\brief Creates or opens an HDF5 file depending on the parameter flags. -///\param name - IN: Name of the file -///\param flags - IN: File access flags -///\param create_plist - IN: File creation property list, used when -/// modifying default file meta-data. Default to -/// FileCreatPropList::DEFAULT -///\param access_plist - IN: File access property list. Default to -/// FileAccPropList::DEFAULT +// Function: H5File overloaded constructor +///\brief Creates or opens an HDF5 file depending on the parameter flags. +///\param name - IN: Name of the file +///\param flags - IN: File access flags +///\param create_plist - IN: File creation property list, used when +/// modifying default file meta-data. Default to +/// FileCreatPropList::DEFAULT +///\param access_plist - IN: File access property list. Default to +/// FileAccPropList::DEFAULT ///\par Description -/// Valid values of \a flags include: -/// \li \c H5F_ACC_TRUNC - Truncate file, if it already exists, -/// erasing all data previously stored in -/// the file. -/// \li \c H5F_ACC_EXCL - Fail if file already exists. -/// \c H5F_ACC_TRUNC and \c H5F_ACC_EXCL are mutually exclusive -/// \li \c H5F_ACC_RDONLY - Open file as read-only, if it already -/// exists, and fail, otherwise -/// \li \c H5F_ACC_RDWR - Open file for read/write, if it already -/// exists, and fail, otherwise +/// Valid values of \a flags include: +/// \li \c H5F_ACC_TRUNC - Truncate file, if it already exists, +/// erasing all data previously stored in +/// the file. +/// \li \c H5F_ACC_EXCL - Fail if file already exists. +/// \c H5F_ACC_TRUNC and \c H5F_ACC_EXCL are mutually exclusive +/// \li \c H5F_ACC_RDONLY - Open file as read-only, if it already +/// exists, and fail, otherwise +/// \li \c H5F_ACC_RDWR - Open file for read/write, if it already +/// exists, and fail, otherwise ///\par -/// For info on file creation in the case of an already-open file, -/// please refer to the \b Special \b case section in the C layer -/// Reference Manual at: +/// For info on file creation in the case of an already-open file, +/// please refer to the \b Special \b case section in the C layer +/// Reference Manual at: /// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5F.html#File-Create // Notes With a PGI compiler (~2012-2013), the exception thrown by p_get_file -// could not be caught in the applications. Added try block here -// to catch then re-throw it. -BMR 2013/03/21 -// Programmer Binh-Minh Ribler - 2000 +// could not be caught in the applications. Added try block here +// to catch then re-throw it. -BMR 2013/03/21 +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -H5File::H5File( const char* name, unsigned int flags, const FileCreatPropList& create_plist, const FileAccPropList& access_plist ) : Group(), id(H5I_INVALID_HID) +H5File::H5File(const char* name, unsigned int flags, const FileCreatPropList& create_plist, const FileAccPropList& access_plist) : Group(), id(H5I_INVALID_HID) { try { p_get_file(name, flags, create_plist, access_plist); @@ -92,22 +92,22 @@ H5File::H5File( const char* name, unsigned int flags, const FileCreatPropList& c } //-------------------------------------------------------------------------- -// Function: H5File overloaded constructor -///\brief This is another overloaded constructor. It differs from the -/// above constructor only in the type of the \a name argument. -///\param name - IN: Name of the file - \c H5std_string -///\param flags - IN: File access flags -///\param create_plist - IN: File creation property list, used when -/// modifying default file meta-data. Default to -/// FileCreatPropList::DEFAULT -///\param access_plist - IN: File access property list. Default to -/// FileAccPropList::DEFAULT +// Function: H5File overloaded constructor +///\brief This is another overloaded constructor. It differs from the +/// above constructor only in the type of the \a name argument. +///\param name - IN: Name of the file - \c H5std_string +///\param flags - IN: File access flags +///\param create_plist - IN: File creation property list, used when +/// modifying default file meta-data. Default to +/// FileCreatPropList::DEFAULT +///\param access_plist - IN: File access property list. Default to +/// FileAccPropList::DEFAULT // Notes With a PGI compiler (~2012-2013), the exception thrown by p_get_file -// could not be caught in the applications. Added try block here -// to catch then re-throw it. -BMR 2013/03/21 -// Programmer Binh-Minh Ribler - 2000 +// could not be caught in the applications. Added try block here +// to catch then re-throw it. -BMR 2013/03/21 +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -H5File::H5File( const H5std_string& name, unsigned int flags, const FileCreatPropList& create_plist, const FileAccPropList& access_plist ) : Group(), id(H5I_INVALID_HID) +H5File::H5File(const H5std_string& name, unsigned int flags, const FileCreatPropList& create_plist, const FileAccPropList& access_plist) : Group(), id(H5I_INVALID_HID) { try { p_get_file(name.c_str(), flags, create_plist, access_plist); @@ -120,21 +120,21 @@ H5File::H5File( const H5std_string& name, unsigned int flags, const FileCreatPro //-------------------------------------------------------------------------- // This function is private and contains common code between the // constructors taking a string or a char* -// Programmer Binh-Minh Ribler - 2000 +// Programmer Binh-Minh Ribler - 2000 // Modification -// - removed H5F_ACC_CREAT because H5Fcreate will fail with -// H5F_ACC_CREAT. - BMR, Sep 17, 2014 +// - removed H5F_ACC_CREAT because H5Fcreate will fail with +// H5F_ACC_CREAT. - BMR, Sep 17, 2014 //-------------------------------------------------------------------------- void H5File::p_get_file(const char* name, unsigned int flags, const FileCreatPropList& create_plist, const FileAccPropList& access_plist) { // These bits only set for creation, so if any of them are set, // create the file. - if( flags & (H5F_ACC_EXCL|H5F_ACC_TRUNC)) + if (flags & (H5F_ACC_EXCL|H5F_ACC_TRUNC)) { hid_t create_plist_id = create_plist.getId(); hid_t access_plist_id = access_plist.getId(); - id = H5Fcreate( name, flags, create_plist_id, access_plist_id ); - if( id < 0 ) // throw an exception when open/create fail + id = H5Fcreate(name, flags, create_plist_id, access_plist_id); + if (id < 0) // throw an exception when open/create fail { throw FileIException("H5File constructor", "H5Fcreate failed"); } @@ -143,8 +143,8 @@ void H5File::p_get_file(const char* name, unsigned int flags, const FileCreatPro else { hid_t access_plist_id = access_plist.getId(); - id = H5Fopen( name, flags, access_plist_id ); - if( id < 0 ) // throw an exception when open/create fail + id = H5Fopen(name, flags, access_plist_id); + if (id < 0) // throw an exception when open/create fail { throw FileIException("H5File constructor", "H5Fopen failed"); } @@ -152,17 +152,17 @@ void H5File::p_get_file(const char* name, unsigned int flags, const FileCreatPro } //-------------------------------------------------------------------------- -// Function: H5File overloaded constructor -///\brief Creates an H5File object using an existing file id. -///\param existing_id - IN: Id of an existing file -// Programmer Binh-Minh Ribler - 2015 +// Function: H5File overloaded constructor +///\brief Creates an H5File object using an existing file id. +///\param existing_id - IN: Id of an existing file +// Programmer Binh-Minh Ribler - 2015 // Description // Mar 29, 2015 -// Added in responding to a request from user Jason Newton. -// However, it is not recommended to use the private member "id" -// in applications. Unlike other situations, where similar -// constructor is needed by the library in order to return -// an object, H5File doesn't need it. -BMR (HDFFV-8766 partially) +// Added in responding to a request from user Jason Newton. +// However, it is not recommended to use the private member "id" +// in applications. Unlike other situations, where similar +// constructor is needed by the library in order to return +// an object, H5File doesn't need it. -BMR (HDFFV-8766 partially) //-------------------------------------------------------------------------- H5File::H5File(hid_t existing_id) : Group() { @@ -173,11 +173,11 @@ H5File::H5File(hid_t existing_id) : Group() #endif // DOXYGEN_SHOULD_SKIP_THIS //-------------------------------------------------------------------------- -// Function: H5File copy constructor -///\brief Copy constructor: makes a copy of the original -/// H5File object. -///\param original - IN: H5File instance to copy -// Programmer Binh-Minh Ribler - 2000 +// Function: H5File copy constructor +///\brief Copy constructor: makes a copy of the original +/// H5File object. +///\param original - IN: H5File instance to copy +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- H5File::H5File(const H5File& original) : Group() { @@ -186,57 +186,57 @@ H5File::H5File(const H5File& original) : Group() } //-------------------------------------------------------------------------- -// Function: H5File::isHdf5 (static) -///\brief Determines whether a file in HDF5 format. (Static) -///\param name - IN: Name of the file -///\return true if the file is in HDF5 format, and false, otherwise -///\exception H5::FileIException -// Programmer Binh-Minh Ribler - 2000 +// Function: H5File::isHdf5 (static) +///\brief Determines whether a file in HDF5 format. (Static) +///\param name - IN: Name of the file +///\return true if the file is in HDF5 format, and false, otherwise +///\exception H5::FileIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- bool H5File::isHdf5(const char* name) { - // Calls C routine H5Fis_hdf5 to determine whether the file is in - // HDF5 format. It returns positive value, 0, or negative value - htri_t ret_value = H5Fis_hdf5( name ); - if( ret_value > 0 ) - return true; - else if( ret_value == 0 ) - return false; - else // Raise exception when H5Fis_hdf5 returns a negative value - { - throw FileIException("H5File::isHdf5", "H5Fis_hdf5 returned negative value"); - } + // Calls C routine H5Fis_hdf5 to determine whether the file is in + // HDF5 format. It returns positive value, 0, or negative value + htri_t ret_value = H5Fis_hdf5(name); + if (ret_value > 0) + return true; + else if (ret_value == 0) + return false; + else // Raise exception when H5Fis_hdf5 returns a negative value + { + throw FileIException("H5File::isHdf5", "H5Fis_hdf5 returned negative value"); + } } //-------------------------------------------------------------------------- -// Function: H5File::isHdf5 (static) -///\brief This is an overloaded member function, provided for convenience. -/// It takes an \c H5std_string for \a name. (Static) -///\param name - IN: Name of the file - \c H5std_string -// Programmer Binh-Minh Ribler - 2000 +// Function: H5File::isHdf5 (static) +///\brief This is an overloaded member function, provided for convenience. +/// It takes an \c H5std_string for \a name. (Static) +///\param name - IN: Name of the file - \c H5std_string +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -bool H5File::isHdf5(const H5std_string& name ) +bool H5File::isHdf5(const H5std_string& name) { - return( isHdf5( name.c_str()) ); + return(isHdf5( name.c_str())); } //-------------------------------------------------------------------------- -// Function: openFile -///\brief Opens an HDF5 file -///\param name - IN: Name of the file -///\param flags - IN: File access flags -///\param access_plist - IN: File access property list. Default to -/// FileAccPropList::DEFAULT +// Function: openFile +///\brief Opens an HDF5 file +///\param name - IN: Name of the file +///\param flags - IN: File access flags +///\param access_plist - IN: File access property list. Default to +/// FileAccPropList::DEFAULT ///\par Description -/// Valid values of \a flags include: -/// H5F_ACC_RDWR: Open with read/write access. If the file is -/// currently open for read-only access then it -/// will be reopened. Absence of this flag -/// implies read-only access. +/// Valid values of \a flags include: +/// H5F_ACC_RDWR: Open with read/write access. If the file is +/// currently open for read-only access then it +/// will be reopened. Absence of this flag +/// implies read-only access. /// -/// H5F_ACC_RDONLY: Open with read only access. - default +/// H5F_ACC_RDONLY: Open with read only access. - default /// -// Programmer Binh-Minh Ribler - Oct, 2005 +// Programmer Binh-Minh Ribler - Oct, 2005 //-------------------------------------------------------------------------- void H5File::openFile(const char* name, unsigned int flags, const FileAccPropList& access_plist) { @@ -256,14 +256,14 @@ void H5File::openFile(const char* name, unsigned int flags, const FileAccPropLis } //-------------------------------------------------------------------------- -// Function: H5File::openFile -///\brief This is an overloaded member function, provided for convenience. -/// It takes an \c H5std_string for \a name. -///\param name - IN: Name of the file - \c H5std_string -///\param flags - IN: File access flags -///\param access_plist - IN: File access property list. Default to -/// FileAccPropList::DEFAULT -// Programmer Binh-Minh Ribler - 2000 +// Function: H5File::openFile +///\brief This is an overloaded member function, provided for convenience. +/// It takes an \c H5std_string for \a name. +///\param name - IN: Name of the file - \c H5std_string +///\param flags - IN: File access flags +///\param access_plist - IN: File access property list. Default to +/// FileAccPropList::DEFAULT +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void H5File::openFile(const H5std_string& name, unsigned int flags, const FileAccPropList& access_plist) { @@ -271,21 +271,21 @@ void H5File::openFile(const H5std_string& name, unsigned int flags, const FileAc } //-------------------------------------------------------------------------- -// Function: H5File::reOpen -///\brief Reopens this file. +// Function: H5File::reOpen +///\brief Reopens this file. /// -///\exception H5::FileIException +///\exception H5::FileIException // Description -// If this object has represented another HDF5 file, the previous -// HDF5 file need to be closed first. -// Programmer Binh-Minh Ribler - 2000 +// If this object has represented another HDF5 file, the previous +// HDF5 file need to be closed first. +// Programmer Binh-Minh Ribler - 2000 // Note: This wrapper doesn't seem right regarding the 'id' and should // be investigated. BMR - 2/20/2005 // Modification -// - Replaced resetIdComponent() with decRefCount() to use C -// library ID reference counting mechanism - BMR, Feb 20, 2005 -// - Replaced decRefCount with close() to let the C library -// handle the reference counting - BMR, Jun 1, 2006 +// - Replaced resetIdComponent() with decRefCount() to use C +// library ID reference counting mechanism - BMR, Feb 20, 2005 +// - Replaced decRefCount with close() to let the C library +// handle the reference counting - BMR, Jun 1, 2006 //-------------------------------------------------------------------------- void H5File::reOpen() { @@ -296,129 +296,148 @@ void H5File::reOpen() throw FileIException("H5File::reOpen", close_error.getDetailMsg()); } - // call C routine to reopen the file - Note: not sure about this, - // which id to be the parameter when closing? - id = H5Freopen( id ); - if( id < 0 ) // Raise exception when H5Freopen returns a neg value - throw FileIException("H5File::reOpen", "H5Freopen failed"); + // call C routine to reopen the file - Note: not sure about this, + // which id to be the parameter when closing? + id = H5Freopen(id); + if (id < 0) // Raise exception when H5Freopen returns a neg value + throw FileIException("H5File::reOpen", "H5Freopen failed"); } //-------------------------------------------------------------------------- -// Function: H5File::getCreatePlist -///\brief Returns the creation property list of this file -///\return FileCreatPropList object -///\exception H5::FileIException -// Programmer Binh-Minh Ribler - 2000 +// Function: H5File::getCreatePlist +///\brief Returns the creation property list of this file +///\return FileCreatPropList object +///\exception H5::FileIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- FileCreatPropList H5File::getCreatePlist() const { - hid_t create_plist_id = H5Fget_create_plist( id ); - - // if H5Fget_create_plist returns a valid id, create and return - // the FileCreatPropList object for this property list - if( create_plist_id > 0 ) - { - FileCreatPropList create_plist( create_plist_id ); - return( create_plist ); - } - else - { - throw FileIException("H5File::getCreatePlist", "H5Fget_create_plist failed"); - } + hid_t create_plist_id = H5Fget_create_plist(id); + + // if H5Fget_create_plist returns a valid id, create and return + // the FileCreatPropList object for this property list + if (create_plist_id > 0) + { + FileCreatPropList create_plist(create_plist_id); + return(create_plist); + } + else + { + throw FileIException("H5File::getCreatePlist", "H5Fget_create_plist failed"); + } } //-------------------------------------------------------------------------- -// Function: H5File::getAccessPlist -///\brief Returns the access property list of this file -///\return FileAccPropList object -///\exception H5::FileIException -// Programmer Binh-Minh Ribler - 2000 +// Function: H5File::getAccessPlist +///\brief Returns the access property list of this file +///\return FileAccPropList object +///\exception H5::FileIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- FileAccPropList H5File::getAccessPlist() const { - hid_t access_plist_id = H5Fget_access_plist( id ); + hid_t access_plist_id = H5Fget_access_plist(id); - // if H5Fget_access_plist returns a valid id, create and return - // the FileAccPropList object for this property list - if( access_plist_id > 0 ) - { - FileAccPropList access_plist( access_plist_id ); + // if H5Fget_access_plist returns a valid id, create and return + // the FileAccPropList object for this property list + if (access_plist_id > 0) + { + FileAccPropList access_plist(access_plist_id); return access_plist; - } - else // Raise an exception - { - throw FileIException("H5File::getAccessPlist", "H5Fget_access_plist failed"); - } + } + else // Raise an exception + { + throw FileIException("H5File::getAccessPlist", "H5Fget_access_plist failed"); + } } //-------------------------------------------------------------------------- -// Function: H5File::getFreeSpace -///\brief Returns the amount of free space in the file. -///\return Amount of free space -///\exception H5::FileIException +// Function: H5File::getFileInfo +///\brief Retrieves the general information of this file. +/// +///\exception H5::FileIException +///\par Description +/// The retrieved information may include information about +/// superblock extension, free space management, and shared object +// Programmer Binh-Minh Ribler - February 2017 +//-------------------------------------------------------------------------- +void H5File::getFileInfo(H5F_info2_t& file_info) const +{ + herr_t ret_value = H5Fget_info2(id, &file_info); + if (ret_value < 0) + { + throw FileIException("H5File::getFileInfo", "H5Fget_info2 failed"); + } +} + +//-------------------------------------------------------------------------- +// Function: H5File::getFreeSpace +///\brief Returns the amount of free space in the file. +///\return Amount of free space +///\exception H5::FileIException // Programmer Binh-Minh Ribler - May 2004 //-------------------------------------------------------------------------- hssize_t H5File::getFreeSpace() const { - hssize_t free_space = H5Fget_freespace(id); - if( free_space < 0 ) - { - throw FileIException("H5File::getFreeSpace", "H5Fget_freespace failed"); - } - return (free_space); + hssize_t free_space = H5Fget_freespace(id); + if (free_space < 0) + { + throw FileIException("H5File::getFreeSpace", "H5Fget_freespace failed"); + } + return (free_space); } //-------------------------------------------------------------------------- -// Function: H5File::getObjCount -///\brief Returns the number of opened object IDs (files, datasets, -/// groups and datatypes) in the same file. -///\param types - Type of object to retrieve the count -///\return Number of opened object IDs -///\exception H5::FileIException +// Function: H5File::getObjCount +///\brief Returns the number of opened object IDs (files, datasets, +/// groups and datatypes) in the same file. +///\param types - Type of object to retrieve the count +///\return Number of opened object IDs +///\exception H5::FileIException ///\par Description -/// The valid values for \a types include: -/// \li \c H5F_OBJ_FILE - Files only -/// \li \c H5F_OBJ_DATASET - Datasets only -/// \li \c H5F_OBJ_GROUP - Groups only -/// \li \c H5F_OBJ_DATATYPE - Named datatypes only -/// \li \c H5F_OBJ_ATTR - Attributes only -/// \li \c H5F_OBJ_ALL - All of the above, i.e., \c H5F_OBJ_FILE -/// | \c H5F_OBJ_DATASET | \c H5F_OBJ_GROUP -/// | \c H5F_OBJ_DATATYPE | \c H5F_OBJ_ATTR +/// The valid values for \a types include: +/// \li \c H5F_OBJ_FILE - Files only +/// \li \c H5F_OBJ_DATASET - Datasets only +/// \li \c H5F_OBJ_GROUP - Groups only +/// \li \c H5F_OBJ_DATATYPE - Named datatypes only +/// \li \c H5F_OBJ_ATTR - Attributes only +/// \li \c H5F_OBJ_ALL - All of the above, i.e., \c H5F_OBJ_FILE +/// | \c H5F_OBJ_DATASET | \c H5F_OBJ_GROUP +/// | \c H5F_OBJ_DATATYPE | \c H5F_OBJ_ATTR ///\par /// Multiple object types can be combined with the logical OR operator (|). // Programmer Binh-Minh Ribler - May 2004 //-------------------------------------------------------------------------- ssize_t H5File::getObjCount(unsigned types) const { - ssize_t num_objs = H5Fget_obj_count(id, types); - if( num_objs < 0 ) - { - throw FileIException("H5File::getObjCount", "H5Fget_obj_count failed"); - } - return (num_objs); + ssize_t num_objs = H5Fget_obj_count(id, types); + if (num_objs < 0) + { + throw FileIException("H5File::getObjCount", "H5Fget_obj_count failed"); + } + return (num_objs); } //-------------------------------------------------------------------------- -// Function: H5File::getObjIDs -///\brief Retrieves a list of opened object IDs (files, datasets, -/// groups and datatypes) in the same file. -///\param types - Type of object to retrieve the count -///\param max_objs - Maximum number of object identifiers to place -/// into obj_id_list. -///\param oid_list - List of open object identifiers -///\exception H5::FileIException +// Function: H5File::getObjIDs +///\brief Retrieves a list of opened object IDs (files, datasets, +/// groups and datatypes) in the same file. +///\param types - Type of object to retrieve the count +///\param max_objs - Maximum number of object identifiers to place +/// into obj_id_list. +///\param oid_list - List of open object identifiers +///\exception H5::FileIException ///\par Description -/// The valid values for \a types include: -/// \li \c H5F_OBJ_FILE - Files only -/// \li \c H5F_OBJ_DATASET - Datasets only -/// \li \c H5F_OBJ_GROUP - Groups only -/// \li \c H5F_OBJ_DATATYPE - Named datatypes only -/// \li \c H5F_OBJ_ATTR - Attributes only -/// \li \c H5F_OBJ_ALL - All of the above, i.e., \c H5F_OBJ_FILE -/// | \c H5F_OBJ_DATASET | \c H5F_OBJ_GROUP -/// | \c H5F_OBJ_DATATYPE | \c H5F_OBJ_ATTR +/// The valid values for \a types include: +/// \li \c H5F_OBJ_FILE - Files only +/// \li \c H5F_OBJ_DATASET - Datasets only +/// \li \c H5F_OBJ_GROUP - Groups only +/// \li \c H5F_OBJ_DATATYPE - Named datatypes only +/// \li \c H5F_OBJ_ATTR - Attributes only +/// \li \c H5F_OBJ_ALL - All of the above, i.e., \c H5F_OBJ_FILE +/// | \c H5F_OBJ_DATASET | \c H5F_OBJ_GROUP +/// | \c H5F_OBJ_DATATYPE | \c H5F_OBJ_ATTR ///\par /// Multiple object types can be combined with the logical OR operator (|). // @@ -427,56 +446,56 @@ ssize_t H5File::getObjCount(unsigned types) const //-------------------------------------------------------------------------- void H5File::getObjIDs(unsigned types, size_t max_objs, hid_t *oid_list) const { - ssize_t ret_value = H5Fget_obj_ids(id, types, max_objs, oid_list); - if( ret_value < 0 ) - { - throw FileIException("H5File::getObjIDs", "H5Fget_obj_ids failed"); - } + ssize_t ret_value = H5Fget_obj_ids(id, types, max_objs, oid_list); + if (ret_value < 0) + { + throw FileIException("H5File::getObjIDs", "H5Fget_obj_ids failed"); + } } //-------------------------------------------------------------------------- -// Function: H5File::getVFDHandle -///\brief Returns the pointer to the file handle of the low-level file -/// driver. -///\param fapl - File access property list -///\param file_handle - Pointer to the file handle being used by -/// the low-level virtual file driver -///\exception H5::FileIException +// Function: H5File::getVFDHandle +///\brief Returns the pointer to the file handle of the low-level file +/// driver. +///\param fapl - File access property list +///\param file_handle - Pointer to the file handle being used by +/// the low-level virtual file driver +///\exception H5::FileIException ///\par Description -/// For the \c FAMILY or \c MULTI drivers, \a fapl should be -/// defined through the property list functions: -/// \c FileAccPropList::setFamilyOffset for the \c FAMILY driver -/// and \c FileAccPropList::setMultiType for the \c MULTI driver. +/// For the \c FAMILY or \c MULTI drivers, \a fapl should be +/// defined through the property list functions: +/// \c FileAccPropList::setFamilyOffset for the \c FAMILY driver +/// and \c FileAccPropList::setMultiType for the \c MULTI driver. /// -/// The obtained file handle is dynamic and is valid only while -/// the file remains open; it will be invalid if the file is -/// closed and reopened or opened during a subsequent session. +/// The obtained file handle is dynamic and is valid only while +/// the file remains open; it will be invalid if the file is +/// closed and reopened or opened during a subsequent session. // Programmer Binh-Minh Ribler - May 2004 //-------------------------------------------------------------------------- void H5File::getVFDHandle(const FileAccPropList& fapl, void **file_handle) const { - hid_t fapl_id = fapl.getId(); - herr_t ret_value = H5Fget_vfd_handle(id, fapl_id, file_handle); - if( ret_value < 0 ) - { - throw FileIException("H5File::getVFDHandle", "H5Fget_vfd_handle failed"); - } + hid_t fapl_id = fapl.getId(); + herr_t ret_value = H5Fget_vfd_handle(id, fapl_id, file_handle); + if (ret_value < 0) + { + throw FileIException("H5File::getVFDHandle", "H5Fget_vfd_handle failed"); + } } //-------------------------------------------------------------------------- -// Function: H5File::getVFDHandle -// Purpose This is an overloaded member function, kept for backward -// compatibility. It differs from the above function in that it -// misses const's. This wrapper will be removed in future release. +// Function: H5File::getVFDHandle +// Purpose This is an overloaded member function, kept for backward +// compatibility. It differs from the above function in that it +// misses const's. This wrapper will be removed in future release. // Param fapl - File access property list // Param file_handle - Pointer to the file handle being used by -// the low-level virtual file driver +// the low-level virtual file driver // Exception H5::FileIException // Programmer Binh-Minh Ribler - May 2004 // Modification -// Planned for removal. -BMR, 2014/04/16 -// Removed from documentation. -BMR, 2016/03/07 1.8.17 and 1.10.0 -// Removed from code. -BMR, 2016/08/11 1.8.18 and 1.10.1 +// Planned for removal. -BMR, 2014/04/16 +// Removed from documentation. -BMR, 2016/03/07 1.8.17 and 1.10.0 +// Removed from code. -BMR, 2016/08/11 1.8.18 and 1.10.1 //-------------------------------------------------------------------------- //void H5File::getVFDHandle(FileAccPropList& fapl, void **file_handle) const //{ @@ -484,103 +503,103 @@ void H5File::getVFDHandle(const FileAccPropList& fapl, void **file_handle) const //} //-------------------------------------------------------------------------- -// Function: H5File::getVFDHandle -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function only in what arguments it -/// accepts. -///\param file_handle - Pointer to the file handle being used by -/// the low-level virtual file driver -///\exception H5::FileIException +// Function: H5File::getVFDHandle +///\brief This is an overloaded member function, provided for convenience. +/// It differs from the above function only in what arguments it +/// accepts. +///\param file_handle - Pointer to the file handle being used by +/// the low-level virtual file driver +///\exception H5::FileIException // Programmer Binh-Minh Ribler - May 2004 //-------------------------------------------------------------------------- void H5File::getVFDHandle(void **file_handle) const { - herr_t ret_value = H5Fget_vfd_handle(id, H5P_DEFAULT, file_handle); - if( ret_value < 0 ) - { - throw FileIException("H5File::getVFDHandle", "H5Fget_vfd_handle failed"); - } + herr_t ret_value = H5Fget_vfd_handle(id, H5P_DEFAULT, file_handle); + if (ret_value < 0) + { + throw FileIException("H5File::getVFDHandle", "H5Fget_vfd_handle failed"); + } } //-------------------------------------------------------------------------- -// Function: H5File::getFileSize -///\brief Returns the file size of the HDF5 file. -///\return File size -///\exception H5::FileIException +// Function: H5File::getFileSize +///\brief Returns the file size of the HDF5 file. +///\return File size +///\exception H5::FileIException ///\par Description -/// This function is called after an existing file is opened in -/// order to learn the true size of the underlying file. +/// This function is called after an existing file is opened in +/// order to learn the true size of the underlying file. // Programmer Raymond Lu - June 24, 2004 //-------------------------------------------------------------------------- hsize_t H5File::getFileSize() const { - hsize_t file_size; - herr_t ret_value = H5Fget_filesize(id, &file_size); - if (ret_value < 0) - { - throw FileIException("H5File::getFileSize", "H5Fget_filesize failed"); - } - return (file_size); + hsize_t file_size; + herr_t ret_value = H5Fget_filesize(id, &file_size); + if (ret_value < 0) + { + throw FileIException("H5File::getFileSize", "H5Fget_filesize failed"); + } + return (file_size); } //-------------------------------------------------------------------------- -// Function: H5File::getId -///\brief Get the id of this file -///\return File identifier -// Modification: +// Function: H5File::getId +///\brief Get the id of this file +///\return File identifier +// Modification // May 2008 - BMR -// Class hierarchy is revised to address bugzilla 1068. Class -// AbstractDS and Attribute are moved out of H5Object. In -// addition, member IdComponent::id is moved into subclasses, and -// IdComponent::getId now becomes pure virtual function. -// Programmer Binh-Minh Ribler - May, 2008 +// Class hierarchy is revised to address bugzilla 1068. Class +// AbstractDS and Attribute are moved out of H5Object. In +// addition, member IdComponent::id is moved into subclasses, and +// IdComponent::getId now becomes pure virtual function. +// Programmer Binh-Minh Ribler - May, 2008 //-------------------------------------------------------------------------- hid_t H5File::getId() const { - return(id); + return(id); } #ifndef DOXYGEN_SHOULD_SKIP_THIS //-------------------------------------------------------------------------- -// Function: H5File::reopen -// Purpose: Reopens this file. +// Function: H5File::reopen +// Purpose Reopens this file. // Exception H5::FileIException // Description -// This function is replaced by the above function reOpen. -// Programmer Binh-Minh Ribler - 2000 +// This function is replaced by the above function reOpen. +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void H5File::reopen() { - H5File::reOpen(); + H5File::reOpen(); } //-------------------------------------------------------------------------- -// Function: H5File::getLocId -// Purpose: Get the id of this file +// Function: H5File::getLocId +// Purpose Get the id of this file // Description -// This function is a redefinition of CommonFG::getLocId. It -// is used by CommonFG member functions to get the file id. -// Programmer Binh-Minh Ribler - 2000 +// This function is a redefinition of CommonFG::getLocId. It +// is used by CommonFG member functions to get the file id. +// Programmer Binh-Minh Ribler - 2000 // Deprecated: // After HDFFV-9920, the Group's methods can use getId() and getLocId() // is kept for backward compatibility. Aug 18, 2016 -BMR //-------------------------------------------------------------------------- hid_t H5File::getLocId() const { - return( getId() ); + return(getId()); } //-------------------------------------------------------------------------- -// Function: H5File::p_setId (protected) -///\brief Sets the identifier of this object to a new value. +// Function: H5File::p_setId (protected) +///\brief Sets the identifier of this object to a new value. /// -///\exception H5::IdComponentException when the attempt to close the HDF5 -/// object fails -// Description: -// The underlaying reference counting in the C library ensures -// that the current valid id of this object is properly closed. -// Then the object's id is reset to the new id. -// Programmer Binh-Minh Ribler - 2000 +///\exception H5::IdComponentException when the attempt to close the HDF5 +/// object fails +// Description +// The underlaying reference counting in the C library ensures +// that the current valid id of this object is properly closed. +// Then the object's id is reset to the new id. +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void H5File::p_setId(const hid_t new_id) { @@ -591,24 +610,24 @@ void H5File::p_setId(const hid_t new_id) catch (Exception& E) { throw FileIException("H5File::p_setId", E.getDetailMsg()); } - // reset object's id to the given id - id = new_id; + // reset object's id to the given id + id = new_id; } #endif // DOXYGEN_SHOULD_SKIP_THIS //-------------------------------------------------------------------------- -// Function: H5File::close -///\brief Closes this HDF5 file. +// Function: H5File::close +///\brief Closes this HDF5 file. /// -///\exception H5::FileIException -// Programmer Binh-Minh Ribler - Mar 9, 2005 +///\exception H5::FileIException +// Programmer Binh-Minh Ribler - Mar 9, 2005 //-------------------------------------------------------------------------- void H5File::close() { if (p_valid_id(id)) { - herr_t ret_value = H5Fclose( id ); - if( ret_value < 0 ) + herr_t ret_value = H5Fclose(id); + if (ret_value < 0) { throw FileIException("H5File::close", "H5Fclose failed"); } @@ -618,34 +637,34 @@ void H5File::close() } //-------------------------------------------------------------------------- -// Function: H5File::throwException -///\brief Throws file exception - initially implemented for CommonFG -///\param func_name - Name of the function where failure occurs -///\param msg - Message describing the failure -///\exception H5::FileIException +// Function: H5File::throwException +///\brief Throws file exception - initially implemented for CommonFG +///\param func_name - Name of the function where failure occurs +///\param msg - Message describing the failure +///\exception H5::FileIException // Description // This function is also used in H5Location implementation so that -// proper exception can be thrown for file or group. The -// "H5File::" will be inserted to indicate the function called is -// an implementation of H5File. -// Programmer Binh-Minh Ribler - 2000 +// proper exception can be thrown for file or group. The +// "H5File::" will be inserted to indicate the function called is +// an implementation of H5File. +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void H5File::throwException(const H5std_string& func_name, const H5std_string& msg) const { - H5std_string full_name = func_name; - full_name.insert(0, "H5File::"); - throw FileIException(full_name, msg); + H5std_string full_name = func_name; + full_name.insert(0, "H5File::"); + throw FileIException(full_name, msg); } //-------------------------------------------------------------------------- -// Function: H5File destructor -///\brief Properly terminates access to this file. -// Programmer Binh-Minh Ribler - 2000 +// Function: H5File destructor +///\brief Properly terminates access to this file. +// Programmer Binh-Minh Ribler - 2000 // Modification -// - Replaced resetIdComponent() with decRefCount() to use C -// library ID reference counting mechanism - BMR, Feb 20, 2005 -// - Replaced decRefCount with close() to let the C library -// handle the reference counting - BMR, Jun 1, 2006 +// - Replaced resetIdComponent() with decRefCount() to use C +// library ID reference counting mechanism - BMR, Feb 20, 2005 +// - Replaced decRefCount with close() to let the C library +// handle the reference counting - BMR, Jun 1, 2006 //-------------------------------------------------------------------------- H5File::~H5File() { diff --git a/c++/src/H5File.h b/c++/src/H5File.h index dca6c67..5ac9118 100644 --- a/c++/src/H5File.h +++ b/c++/src/H5File.h @@ -28,97 +28,100 @@ namespace H5 { */ class H5_DLLCPP H5File : public Group { public: - // Creates or opens an HDF5 file. - H5File( const char* name, unsigned int flags, - const FileCreatPropList& create_plist = FileCreatPropList::DEFAULT, - const FileAccPropList& access_plist = FileAccPropList::DEFAULT ); - H5File( const H5std_string& name, unsigned int flags, - const FileCreatPropList& create_plist = FileCreatPropList::DEFAULT, - const FileAccPropList& access_plist = FileAccPropList::DEFAULT ); + // Creates or opens an HDF5 file. + H5File(const char* name, unsigned int flags, + const FileCreatPropList& create_plist = FileCreatPropList::DEFAULT, + const FileAccPropList& access_plist = FileAccPropList::DEFAULT); + H5File(const H5std_string& name, unsigned int flags, + const FileCreatPropList& create_plist = FileCreatPropList::DEFAULT, + const FileAccPropList& access_plist = FileAccPropList::DEFAULT); - // Open the file - void openFile(const H5std_string& name, unsigned int flags, - const FileAccPropList& access_plist = FileAccPropList::DEFAULT); - void openFile(const char* name, unsigned int flags, - const FileAccPropList& access_plist = FileAccPropList::DEFAULT); + // Open the file + void openFile(const H5std_string& name, unsigned int flags, + const FileAccPropList& access_plist = FileAccPropList::DEFAULT); + void openFile(const char* name, unsigned int flags, + const FileAccPropList& access_plist = FileAccPropList::DEFAULT); - // Close this file. - virtual void close(); + // Close this file. + virtual void close(); - // Gets the access property list of this file. - FileAccPropList getAccessPlist() const; + // Gets the access property list of this file. + FileAccPropList getAccessPlist() const; - // Gets the creation property list of this file. - FileCreatPropList getCreatePlist() const; + // Gets the creation property list of this file. + FileCreatPropList getCreatePlist() const; - // Retrieves the file size of an opened file. - hsize_t getFileSize() const; + // Gets general information about this file. + void getFileInfo(H5F_info2_t& file_info) const; - // Returns the amount of free space in the file. - hssize_t getFreeSpace() const; + // Returns the amount of free space in the file. + hssize_t getFreeSpace() const; - // Returns the number of opened object IDs (files, datasets, groups - // and datatypes) in the same file. - ssize_t getObjCount(unsigned types = H5F_OBJ_ALL) const; + // Returns the number of opened object IDs (files, datasets, groups + // and datatypes) in the same file. + ssize_t getObjCount(unsigned types = H5F_OBJ_ALL) const; - // Retrieves a list of opened object IDs (files, datasets, groups - // and datatypes) in the same file. - void getObjIDs(unsigned types, size_t max_objs, hid_t *oid_list) const; + // Retrieves a list of opened object IDs (files, datasets, groups + // and datatypes) in the same file. + void getObjIDs(unsigned types, size_t max_objs, hid_t *oid_list) const; - // Returns the pointer to the file handle of the low-level file driver. - void getVFDHandle(void **file_handle) const; - void getVFDHandle(const FileAccPropList& fapl, void **file_handle) const; - //void getVFDHandle(FileAccPropList& fapl, void **file_handle) const; // removed from 1.8.18 and 1.10.1 + // Returns the pointer to the file handle of the low-level file driver. + void getVFDHandle(void **file_handle) const; + void getVFDHandle(const FileAccPropList& fapl, void **file_handle) const; + //void getVFDHandle(FileAccPropList& fapl, void **file_handle) const; // removed from 1.8.18 and 1.10.1 - // Determines if a file, specified by its name, is in HDF5 format - static bool isHdf5(const char* name ); - static bool isHdf5(const H5std_string& name ); + // Returns the file size of the HDF5 file. + hsize_t getFileSize() const; - // Reopens this file. - void reOpen(); // added for better name + // Determines if a file, specified by its name, is in HDF5 format + static bool isHdf5(const char* name); + static bool isHdf5(const H5std_string& name); + + // Reopens this file. + void reOpen(); // added for better name #ifndef DOXYGEN_SHOULD_SKIP_THIS - void reopen(); // obsolete in favor of reOpen() + void reopen(); // obsolete in favor of reOpen() - // Creates an H5File using an existing file id. Not recommended - // in applications. - H5File(hid_t existing_id); + // Creates an H5File using an existing file id. Not recommended + // in applications. + H5File(hid_t existing_id); #endif // DOXYGEN_SHOULD_SKIP_THIS - ///\brief Returns this class name. - virtual H5std_string fromClass () const { return("H5File"); } + ///\brief Returns this class name. + virtual H5std_string fromClass () const { return("H5File"); } - // Throw file exception. - virtual void throwException(const H5std_string& func_name, const H5std_string& msg) const; + // Throw file exception. + virtual void throwException(const H5std_string& func_name, const H5std_string& msg) const; - // for CommonFG to get the file id. - virtual hid_t getLocId() const; + // for CommonFG to get the file id. + virtual hid_t getLocId() const; - // Default constructor - H5File(); + // Default constructor + H5File(); - // Copy constructor: makes a copy of the original H5File object. - H5File(const H5File& original); + // Copy constructor: makes a copy of the original H5File object. + H5File(const H5File& original); - // Gets the HDF5 file id. - virtual hid_t getId() const; + // Gets the HDF5 file id. + virtual hid_t getId() const; - // H5File destructor. - virtual ~H5File(); + // H5File destructor. + virtual ~H5File(); protected: #ifndef DOXYGEN_SHOULD_SKIP_THIS - // Sets the HDF5 file id. - virtual void p_setId(const hid_t new_id); + // Sets the HDF5 file id. + virtual void p_setId(const hid_t new_id); #endif // DOXYGEN_SHOULD_SKIP_THIS private: - hid_t id; // HDF5 file id + hid_t id; // HDF5 file id - // This function is private and contains common code between the - // constructors taking a string or a char* - void p_get_file( const char* name, unsigned int flags, const FileCreatPropList& create_plist, const FileAccPropList& access_plist ); + // This function is private and contains common code between the + // constructors taking a string or a char* + void p_get_file(const char* name, unsigned int flags, const FileCreatPropList& create_plist, const FileAccPropList& access_plist); }; } diff --git a/c++/src/H5FloatType.cpp b/c++/src/H5FloatType.cpp index 73e8072..5902cbe 100644 --- a/c++/src/H5FloatType.cpp +++ b/c++/src/H5FloatType.cpp @@ -36,73 +36,73 @@ namespace H5 { //-------------------------------------------------------------------------- -// Function: FloatType default constructor -///\brief Default constructor: Creates a stub floating-point datatype -// Programmer Binh-Minh Ribler - 2000 +// Function: FloatType default constructor +///\brief Default constructor: Creates a stub floating-point datatype +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- FloatType::FloatType() {} //-------------------------------------------------------------------------- -// Function: FloatType overloaded constructor -///\brief Creates a floating-point datatype using a predefined type. -///\param pred_type - IN: Predefined datatype -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 +// Function: FloatType overloaded constructor +///\brief Creates a floating-point datatype using a predefined type. +///\param pred_type - IN: Predefined datatype +///\exception H5::DataTypeIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -FloatType::FloatType( const PredType& pred_type ) : AtomType() +FloatType::FloatType(const PredType& pred_type) : AtomType() { - // use DataType::copy to make a copy of this predefined type - copy( pred_type ); + // use DataType::copy to make a copy of this predefined type + copy(pred_type); } //-------------------------------------------------------------------------- -// Function: FloatType overloaded constructor -///\brief Creates an FloatType object using the id of an existing -/// datatype. -///\param existing_id - IN: Id of an existing datatype -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 +// Function: FloatType overloaded constructor +///\brief Creates an FloatType object using the id of an existing +/// datatype. +///\param existing_id - IN: Id of an existing datatype +///\exception H5::DataTypeIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -FloatType::FloatType( const hid_t existing_id ) : AtomType( existing_id ) {} +FloatType::FloatType(const hid_t existing_id) : AtomType( existing_id ) {} //-------------------------------------------------------------------------- -// Function: FloatType copy constructor -///\brief Copy constructor: makes a copy of the original FloatType object. -// Programmer Binh-Minh Ribler - 2000 +// Function: FloatType copy constructor +///\brief Copy constructor: makes a copy of the original FloatType object. +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -FloatType::FloatType( const FloatType& original ) : AtomType( original ){} +FloatType::FloatType(const FloatType& original) : AtomType( original ){} //-------------------------------------------------------------------------- -// Function: EnumType overloaded constructor -///\brief Gets the floating-point datatype of the specified dataset -///\param dataset - IN: Dataset that this floating-point datatype -/// associates with -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 +// Function: EnumType overloaded constructor +///\brief Gets the floating-point datatype of the specified dataset +///\param dataset - IN: Dataset that this floating-point datatype +/// associates with +///\exception H5::DataTypeIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -FloatType::FloatType( const DataSet& dataset ) : AtomType() +FloatType::FloatType(const DataSet& dataset) : AtomType() { - // Calls C function H5Dget_type to get the id of the datatype - id = H5Dget_type( dataset.getId() ); + // Calls C function H5Dget_type to get the id of the datatype + id = H5Dget_type(dataset.getId()); - if( id < 0 ) - { - throw DataSetIException("FloatType constructor", "H5Dget_type failed"); - } + if (id < 0) + { + throw DataSetIException("FloatType constructor", "H5Dget_type failed"); + } } //-------------------------------------------------------------------------- -// Function: FloatType overloaded constructor -///\brief Creates an FloatType instance by opening an HDF5 float datatype -/// given its name, provided as a C character string. -///\param dtype_name - IN: Float type name -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - Dec 2016 +// Function: FloatType overloaded constructor +///\brief Creates an FloatType instance by opening an HDF5 float datatype +/// given its name, provided as a C character string. +///\param dtype_name - IN: Float type name +///\exception H5::DataTypeIException +// Programmer Binh-Minh Ribler - Dec 2016 // Description -// In 1.10.1, this constructor was introduced and will replace the -// existing function CommonFG::openFloatType(const char*) -// to improve usability. -// -BMR, Dec 2016 +// In 1.10.1, this constructor was introduced and will replace the +// existing function CommonFG::openFloatType(const char*) +// to improve usability. +// -BMR, Dec 2016 //-------------------------------------------------------------------------- FloatType::FloatType(const H5Location& loc, const char *dtype_name) : AtomType() { @@ -110,213 +110,213 @@ FloatType::FloatType(const H5Location& loc, const char *dtype_name) : AtomType() } //-------------------------------------------------------------------------- -// Function: FloatType overloaded constructor -///\brief Creates an FloatType instance by opening an HDF5 float datatype -/// given its name, provided as an \c H5std_string. -///\param dtype_name - IN: Float type name -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - Dec 2016 +// Function: FloatType overloaded constructor +///\brief Creates an FloatType instance by opening an HDF5 float datatype +/// given its name, provided as an \c H5std_string. +///\param dtype_name - IN: Float type name +///\exception H5::DataTypeIException +// Programmer Binh-Minh Ribler - Dec 2016 // Description -// In 1.10.1, this constructor was introduced and will replace the -// existing function CommonFG::openFloatType(const H5std_string&) -// to improve usability. -// -BMR, Dec 2016 +// In 1.10.1, this constructor was introduced and will replace the +// existing function CommonFG::openFloatType(const H5std_string&) +// to improve usability. +// -BMR, Dec 2016 //-------------------------------------------------------------------------- FloatType::FloatType(const H5Location& loc, const H5std_string& dtype_name) : AtomType() { - id = p_opentype(loc, dtype_name.c_str()); + id = p_opentype(loc, dtype_name.c_str()); } //-------------------------------------------------------------------------- -// Function: FloatType::getFields -///\brief Retrieves floating point datatype bit field information. -///\param spos - OUT: Retrieved floating-point sign bit -///\param epos - OUT: Retrieved exponent bit-position -///\param esize - OUT: Retrieved size of exponent, in bits -///\param mpos - OUT: Retrieved mantissa bit-position -///\param msize - OUT: Retrieved size of mantissa, in bits -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -void FloatType::getFields( size_t& spos, size_t& epos, size_t& esize, size_t& mpos, size_t& msize ) const +// Function: FloatType::getFields +///\brief Retrieves floating point datatype bit field information. +///\param spos - OUT: Retrieved floating-point sign bit +///\param epos - OUT: Retrieved exponent bit-position +///\param esize - OUT: Retrieved size of exponent, in bits +///\param mpos - OUT: Retrieved mantissa bit-position +///\param msize - OUT: Retrieved size of mantissa, in bits +///\exception H5::DataTypeIException +// Programmer Binh-Minh Ribler - 2000 +//-------------------------------------------------------------------------- +void FloatType::getFields(size_t& spos, size_t& epos, size_t& esize, size_t& mpos, size_t& msize) const { - herr_t ret_value = H5Tget_fields( id, &spos, &epos, &esize, &mpos, &msize ); - if( ret_value < 0 ) - { - throw DataTypeIException("FloatType::getFields", "H5Tget_fields failed"); - } + herr_t ret_value = H5Tget_fields(id, &spos, &epos, &esize, &mpos, &msize); + if (ret_value < 0) + { + throw DataTypeIException("FloatType::getFields", "H5Tget_fields failed"); + } } //-------------------------------------------------------------------------- -// Function: FloatType::setFields -///\brief Sets locations and sizes of floating point bit fields. -///\param spos - OUT: Sign position, i.e., the bit offset of the -/// floating-point sign bit. -///\param epos - OUT: Exponent bit position -///\param esize - OUT: Size of exponent, in bits -///\param mpos - OUT: Mantissa bit-position -///\param msize - OUT: Size of mantissa, in bits -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -void FloatType::setFields( size_t spos, size_t epos, size_t esize, size_t mpos, size_t msize ) const +// Function: FloatType::setFields +///\brief Sets locations and sizes of floating point bit fields. +///\param spos - OUT: Sign position, i.e., the bit offset of the +/// floating-point sign bit. +///\param epos - OUT: Exponent bit position +///\param esize - OUT: Size of exponent, in bits +///\param mpos - OUT: Mantissa bit-position +///\param msize - OUT: Size of mantissa, in bits +///\exception H5::DataTypeIException +// Programmer Binh-Minh Ribler - 2000 +//-------------------------------------------------------------------------- +void FloatType::setFields(size_t spos, size_t epos, size_t esize, size_t mpos, size_t msize) const { - herr_t ret_value = H5Tset_fields( id, spos, epos, esize, mpos, msize ); - if( ret_value < 0 ) - { - throw DataTypeIException("FloatType::setFields", "H5Tset_fields failed"); - } + herr_t ret_value = H5Tset_fields(id, spos, epos, esize, mpos, msize); + if (ret_value < 0) + { + throw DataTypeIException("FloatType::setFields", "H5Tset_fields failed"); + } } //-------------------------------------------------------------------------- -// Function: FloatType::getEbias -///\brief Retrieves the exponent bias of a floating-point type. -///\return Exponent bias -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 +// Function: FloatType::getEbias +///\brief Retrieves the exponent bias of a floating-point type. +///\return Exponent bias +///\exception H5::DataTypeIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- size_t FloatType::getEbias() const { - size_t ebias = H5Tget_ebias( id ); - // Returns the bias if successful - if( ebias == 0 ) - { - throw DataTypeIException("FloatType::getEbias", "H5Tget_ebias failed - returned exponent bias as 0"); - } - return( ebias ); + size_t ebias = H5Tget_ebias(id); + // Returns the bias if successful + if (ebias == 0) + { + throw DataTypeIException("FloatType::getEbias", "H5Tget_ebias failed - returned exponent bias as 0"); + } + return(ebias); } //-------------------------------------------------------------------------- -// Function: FloatType::setEbias -///\brief Sets the exponent bias of a floating-point type. -///\param ebias - Exponent bias value -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 +// Function: FloatType::setEbias +///\brief Sets the exponent bias of a floating-point type. +///\param ebias - Exponent bias value +///\exception H5::DataTypeIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -void FloatType::setEbias( size_t ebias ) const +void FloatType::setEbias(size_t ebias) const { - herr_t ret_value = H5Tset_ebias( id, ebias ); - if( ret_value < 0 ) - { - throw DataTypeIException("FloatType::setEbias", "H5Tset_ebias failed"); - } + herr_t ret_value = H5Tset_ebias(id, ebias); + if (ret_value < 0) + { + throw DataTypeIException("FloatType::setEbias", "H5Tset_ebias failed"); + } } //-------------------------------------------------------------------------- -// Function: FloatType::getNorm -///\brief Retrieves mantissa normalization of a floating-point datatype. -///\param norm_string - OUT: Text string of the normalization type -///\return Valid normalization type, which can be: -/// \li \c H5T_NORM_IMPLIED (0) - MSB of mantissa is not stored -/// \li \c H5T_NORM_MSBSET (1) - MSB of mantissa is always 1 -/// \li \c H5T_NORM_NONE (2) - Mantissa is not normalized -///\exception H5::DataTypeIException +// Function: FloatType::getNorm +///\brief Retrieves mantissa normalization of a floating-point datatype. +///\param norm_string - OUT: Text string of the normalization type +///\return Valid normalization type, which can be: +/// \li \c H5T_NORM_IMPLIED (0) - MSB of mantissa is not stored +/// \li \c H5T_NORM_MSBSET (1) - MSB of mantissa is always 1 +/// \li \c H5T_NORM_NONE (2) - Mantissa is not normalized +///\exception H5::DataTypeIException ///\par Description -/// For your convenience, this function also provides the text -/// string of the returned normalization type, via parameter -/// \a norm_string. -// Programmer Binh-Minh Ribler - 2000 +/// For your convenience, this function also provides the text +/// string of the returned normalization type, via parameter +/// \a norm_string. +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -H5T_norm_t FloatType::getNorm( H5std_string& norm_string ) const +H5T_norm_t FloatType::getNorm(H5std_string& norm_string) const { - H5T_norm_t norm = H5Tget_norm( id ); // C routine - // Returns a valid normalization type if successful - if( norm == H5T_NORM_ERROR ) - { - throw DataTypeIException("FloatType::getNorm", "H5Tget_norm failed - returned H5T_NORM_ERROR"); - } - if( norm == H5T_NORM_IMPLIED ) - norm_string = "H5T_NORM_IMPLIED (0)"; - else if( norm == H5T_NORM_MSBSET ) - norm_string = "H5T_NORM_MSBSET (1)"; - else if( norm == H5T_NORM_NONE ) - norm_string = "H5T_NORM_NONE (2)"; - return( norm ); + H5T_norm_t norm = H5Tget_norm(id); // C routine + // Returns a valid normalization type if successful + if (norm == H5T_NORM_ERROR) + { + throw DataTypeIException("FloatType::getNorm", "H5Tget_norm failed - returned H5T_NORM_ERROR"); + } + if (norm == H5T_NORM_IMPLIED) + norm_string = "H5T_NORM_IMPLIED (0)"; + else if (norm == H5T_NORM_MSBSET) + norm_string = "H5T_NORM_MSBSET (1)"; + else if (norm == H5T_NORM_NONE) + norm_string = "H5T_NORM_NONE (2)"; + return(norm); } //-------------------------------------------------------------------------- -// Function: FloatType::setNorm -///\brief Sets the mantissa normalization of a floating-point datatype. -///\param norm - IN: Mantissa normalization type -///\exception H5::DataTypeIException +// Function: FloatType::setNorm +///\brief Sets the mantissa normalization of a floating-point datatype. +///\param norm - IN: Mantissa normalization type +///\exception H5::DataTypeIException ///\par Description -/// Valid values for normalization type include: -/// \li \c H5T_NORM_IMPLIED (0) - MSB of mantissa is not stored -/// \li \c H5T_NORM_MSBSET (1) - MSB of mantissa is always 1 -/// \li \c H5T_NORM_NONE (2) - Mantissa is not normalized -// Programmer Binh-Minh Ribler - 2000 +/// Valid values for normalization type include: +/// \li \c H5T_NORM_IMPLIED (0) - MSB of mantissa is not stored +/// \li \c H5T_NORM_MSBSET (1) - MSB of mantissa is always 1 +/// \li \c H5T_NORM_NONE (2) - Mantissa is not normalized +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -void FloatType::setNorm( H5T_norm_t norm ) const +void FloatType::setNorm(H5T_norm_t norm) const { - herr_t ret_value = H5Tset_norm( id, norm ); - if( ret_value < 0 ) - { - throw DataTypeIException("FloatType::setNorm", "H5Tset_norm failed"); - } + herr_t ret_value = H5Tset_norm(id, norm); + if (ret_value < 0) + { + throw DataTypeIException("FloatType::setNorm", "H5Tset_norm failed"); + } } //-------------------------------------------------------------------------- -// Function: FloatType::getInpad -///\brief Retrieves the internal padding type for unused bits in -/// this floating-point datatypes. -///\return Internal padding type, which can be: -/// \li \c H5T_PAD_ZERO (0) - Set background to zeros -/// \li \c H5T_PAD_ONE (1) - Set background to ones -/// \li \c H5T_PAD_BACKGROUND (2) - Leave background alone -///\exception H5::DataTypeIException +// Function: FloatType::getInpad +///\brief Retrieves the internal padding type for unused bits in +/// this floating-point datatypes. +///\return Internal padding type, which can be: +/// \li \c H5T_PAD_ZERO (0) - Set background to zeros +/// \li \c H5T_PAD_ONE (1) - Set background to ones +/// \li \c H5T_PAD_BACKGROUND (2) - Leave background alone +///\exception H5::DataTypeIException ///\par Description -/// For your convenience, this function also provides the text -/// string of the returned internal padding type, via parameter -/// \a pad_string. -// Programmer Binh-Minh Ribler - 2000 +/// For your convenience, this function also provides the text +/// string of the returned internal padding type, via parameter +/// \a pad_string. +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -H5T_pad_t FloatType::getInpad( H5std_string& pad_string ) const +H5T_pad_t FloatType::getInpad(H5std_string& pad_string) const { - H5T_pad_t pad_type = H5Tget_inpad( id ); - // Returns a valid padding type if successful - if( pad_type == H5T_PAD_ERROR ) - { - throw DataTypeIException("FloatType::getInpad", "H5Tget_inpad failed - returned H5T_PAD_ERROR"); - } - if( pad_type == H5T_PAD_ZERO ) - pad_string = "H5T_PAD_ZERO (0)"; - else if( pad_type == H5T_PAD_ONE ) - pad_string = "H5T_PAD_ONE (1)"; - else if( pad_type == H5T_PAD_BACKGROUND ) - pad_string = "H5T_PAD_BACKGROUD (2)"; - return( pad_type ); + H5T_pad_t pad_type = H5Tget_inpad(id); + // Returns a valid padding type if successful + if (pad_type == H5T_PAD_ERROR) + { + throw DataTypeIException("FloatType::getInpad", "H5Tget_inpad failed - returned H5T_PAD_ERROR"); + } + if (pad_type == H5T_PAD_ZERO) + pad_string = "H5T_PAD_ZERO (0)"; + else if (pad_type == H5T_PAD_ONE) + pad_string = "H5T_PAD_ONE (1)"; + else if (pad_type == H5T_PAD_BACKGROUND) + pad_string = "H5T_PAD_BACKGROUD (2)"; + return(pad_type); } //-------------------------------------------------------------------------- -// Function: FloatType::setInpad -///\brief Fills unused internal floating point bits. -///\param inpad - IN: Internal padding type -///\exception H5::DataTypeIException +// Function: FloatType::setInpad +///\brief Fills unused internal floating point bits. +///\param inpad - IN: Internal padding type +///\exception H5::DataTypeIException ///\par Description -/// If any internal bits of a floating point type are unused -/// (that is, those significant bits which are not part of the -/// sign, exponent, or mantissa), then they will be filled -/// according to the padding value provided by \a inpad. +/// If any internal bits of a floating point type are unused +/// (that is, those significant bits which are not part of the +/// sign, exponent, or mantissa), then they will be filled +/// according to the padding value provided by \a inpad. ///\par -/// Valid values for normalization type include: -/// \li \c H5T_PAD_ZERO (0) - Set background to zeros -/// \li \c H5T_PAD_ONE (1) - Set background to ones -/// \li \c H5T_PAD_BACKGROUND (2) - Leave background alone -// Programmer Binh-Minh Ribler - 2000 +/// Valid values for normalization type include: +/// \li \c H5T_PAD_ZERO (0) - Set background to zeros +/// \li \c H5T_PAD_ONE (1) - Set background to ones +/// \li \c H5T_PAD_BACKGROUND (2) - Leave background alone +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -void FloatType::setInpad( H5T_pad_t inpad ) const +void FloatType::setInpad(H5T_pad_t inpad) const { - herr_t ret_value = H5Tset_inpad( id, inpad ); - if( ret_value < 0 ) - { - throw DataTypeIException("FloatType::setInpad", "H5Tset_inpad failed"); - } + herr_t ret_value = H5Tset_inpad(id, inpad); + if (ret_value < 0) + { + throw DataTypeIException("FloatType::setInpad", "H5Tset_inpad failed"); + } } //-------------------------------------------------------------------------- -// Function: FloatType destructor -///\brief Noop destructor. -// Programmer Binh-Minh Ribler - 2000 +// Function: FloatType destructor +///\brief Noop destructor. +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- FloatType::~FloatType() {} diff --git a/c++/src/H5FloatType.h b/c++/src/H5FloatType.h index 1f4b227..2c925de 100644 --- a/c++/src/H5FloatType.h +++ b/c++/src/H5FloatType.h @@ -27,54 +27,54 @@ namespace H5 { */ class H5_DLLCPP FloatType : public AtomType { public: - // Creates a floating-point type using a predefined type. - FloatType( const PredType& pred_type ); + // Creates a floating-point type using a predefined type. + FloatType(const PredType& pred_type); - // Gets the floating-point datatype of the specified dataset. - FloatType( const DataSet& dataset ); + // Gets the floating-point datatype of the specified dataset. + FloatType(const DataSet& dataset); - // Constructors that open an HDF5 float datatype, given a location. - FloatType(const H5Location& loc, const char* name); - FloatType(const H5Location& loc, const H5std_string& name); + // Constructors that open an HDF5 float datatype, given a location. + FloatType(const H5Location& loc, const char* name); + FloatType(const H5Location& loc, const H5std_string& name); - // Retrieves the exponent bias of a floating-point type. - size_t getEbias() const; + // Retrieves the exponent bias of a floating-point type. + size_t getEbias() const; - // Sets the exponent bias of a floating-point type. - void setEbias( size_t ebias ) const; + // Sets the exponent bias of a floating-point type. + void setEbias(size_t ebias) const; - // Retrieves floating point datatype bit field information. - void getFields( size_t& spos, size_t& epos, size_t& esize, size_t& mpos, size_t& msize ) const; + // Retrieves floating point datatype bit field information. + void getFields(size_t& spos, size_t& epos, size_t& esize, size_t& mpos, size_t& msize) const; - // Sets locations and sizes of floating point bit fields. - void setFields( size_t spos, size_t epos, size_t esize, size_t mpos, size_t msize ) const; + // Sets locations and sizes of floating point bit fields. + void setFields(size_t spos, size_t epos, size_t esize, size_t mpos, size_t msize) const; - // Retrieves the internal padding type for unused bits in floating-point datatypes. - H5T_pad_t getInpad( H5std_string& pad_string ) const; + // Retrieves the internal padding type for unused bits in floating-point datatypes. + H5T_pad_t getInpad(H5std_string& pad_string) const; - // Fills unused internal floating point bits. - void setInpad( H5T_pad_t inpad ) const; + // Fills unused internal floating point bits. + void setInpad(H5T_pad_t inpad) const; - // Retrieves mantissa normalization of a floating-point datatype. - H5T_norm_t getNorm( H5std_string& norm_string ) const; + // Retrieves mantissa normalization of a floating-point datatype. + H5T_norm_t getNorm(H5std_string& norm_string) const; - // Sets the mantissa normalization of a floating-point datatype. - void setNorm( H5T_norm_t norm ) const; + // Sets the mantissa normalization of a floating-point datatype. + void setNorm(H5T_norm_t norm) const; - ///\brief Returns this class name. - virtual H5std_string fromClass () const { return("FloatType"); } + ///\brief Returns this class name. + virtual H5std_string fromClass () const { return("FloatType"); } - // Default constructor - FloatType(); + // Default constructor + FloatType(); - // Creates a floating-point datatype using an existing id. - FloatType( const hid_t existing_id ); + // Creates a floating-point datatype using an existing id. + FloatType(const hid_t existing_id); - // Copy constructor: makes a copy of the original FloatType object. - FloatType( const FloatType& original ); + // Copy constructor: makes a copy of the original FloatType object. + FloatType(const FloatType& original); - // Noop destructor. - virtual ~FloatType(); + // Noop destructor. + virtual ~FloatType(); }; } #endif // __H5FloatType_H diff --git a/c++/src/H5Group.cpp b/c++/src/H5Group.cpp index c976b00..6b143b5 100644 --- a/c++/src/H5Group.cpp +++ b/c++/src/H5Group.cpp @@ -46,17 +46,17 @@ namespace H5 { using std::endl; //-------------------------------------------------------------------------- -// Function: Group default constructor -///\brief Default constructor: creates a stub Group. -// Programmer Binh-Minh Ribler - 2000 +// Function: Group default constructor +///\brief Default constructor: creates a stub Group. +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- Group::Group() : H5Object(), CommonFG(), id(H5I_INVALID_HID) {} //-------------------------------------------------------------------------- -// Function: Group copy constructor -///\brief Copy constructor: makes a copy of the original Group object. -///\param original - IN: Original group to copy -// Programmer Binh-Minh Ribler - 2000 +// Function: Group copy constructor +///\brief Copy constructor: makes a copy of the original Group object. +///\param original - IN: Original group to copy +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- Group::Group(const Group& original) : H5Object(), CommonFG(), id(original.id) { @@ -64,26 +64,26 @@ Group::Group(const Group& original) : H5Object(), CommonFG(), id(original.id) } //-------------------------------------------------------------------------- -// Function: Group::getLocId +// Function: Group::getLocId // Purpose: Get the id of this group -// Programmer Binh-Minh Ribler - 2000 +// Programmer Binh-Minh Ribler - 2000 // Description -// This function is a redefinition of CommonFG::getLocId. It -// is used by CommonFG member functions to get the file id. +// This function is a redefinition of CommonFG::getLocId. It +// is used by CommonFG member functions to get the file id. // Deprecated: // After HDFFV-9920, the Group's methods can use getId() and getLocId() // is kept for backward compatibility. Aug 18, 2016 -BMR //-------------------------------------------------------------------------- hid_t Group::getLocId() const { - return( getId() ); + return(getId()); } //-------------------------------------------------------------------------- -// Function: Group overloaded constructor -///\brief Creates a Group object using the id of an existing group. -///\param existing_id - IN: Id of an existing group -// Programmer Binh-Minh Ribler - 2000 +// Function: Group overloaded constructor +///\brief Creates a Group object using the id of an existing group. +///\param existing_id - IN: Id of an existing group +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- Group::Group(const hid_t existing_id) : H5Object(), CommonFG(), id(existing_id) { @@ -91,17 +91,17 @@ Group::Group(const hid_t existing_id) : H5Object(), CommonFG(), id(existing_id) } //-------------------------------------------------------------------------- -// Function: Group overload constructor - dereference -///\brief Given a reference, ref, to an hdf5 group, creates a Group object -///\param loc - IN: Specifying location referenced object is in -///\param ref - IN: Reference pointer -///\param ref_type - IN: Reference type - default to H5R_OBJECT -///\param plist - IN: Property list - default to PropList::DEFAULT -///\exception H5::ReferenceException +// Function: Group overload constructor - dereference +///\brief Given a reference, ref, to an hdf5 group, creates a Group object +///\param loc - IN: Specifying location referenced object is in +///\param ref - IN: Reference pointer +///\param ref_type - IN: Reference type - default to H5R_OBJECT +///\param plist - IN: Property list - default to PropList::DEFAULT +///\exception H5::ReferenceException ///\par Description -/// \c obj can be DataSet, Group, or named DataType, that -/// is a datatype that has been named by DataType::commit. -// Programmer Binh-Minh Ribler - Oct, 2006 +/// \c obj can be DataSet, Group, or named DataType, that +/// is a datatype that has been named by DataType::commit. +// Programmer Binh-Minh Ribler - Oct, 2006 //-------------------------------------------------------------------------- Group::Group(const H5Location& loc, const void* ref, H5R_type_t ref_type, const PropList& plist) : H5Object(), CommonFG(), id(H5I_INVALID_HID) { @@ -109,14 +109,14 @@ Group::Group(const H5Location& loc, const void* ref, H5R_type_t ref_type, const } //-------------------------------------------------------------------------- -// Function: Group overload constructor - dereference -///\brief Given a reference, ref, to an hdf5 group, creates a Group object -///\param attr - IN: Specifying location where the referenced object is in -///\param ref - IN: Reference pointer -///\param ref_type - IN: Reference type - default to H5R_OBJECT -///\param plist - IN: Property list - default to PropList::DEFAULT -///\exception H5::ReferenceException -// Programmer Binh-Minh Ribler - Oct, 2006 +// Function: Group overload constructor - dereference +///\brief Given a reference, ref, to an hdf5 group, creates a Group object +///\param attr - IN: Specifying location where the referenced object is in +///\param ref - IN: Reference pointer +///\param ref_type - IN: Reference type - default to H5R_OBJECT +///\param plist - IN: Property list - default to PropList::DEFAULT +///\exception H5::ReferenceException +// Programmer Binh-Minh Ribler - Oct, 2006 //-------------------------------------------------------------------------- /* Group::Group(const Attribute& attr, const void* ref, H5R_type_t ref_type, const PropList& plist) : H5Object(), id(H5I_INVALID_HID) { @@ -126,19 +126,19 @@ Group::Group(const H5Location& loc, const void* ref, H5R_type_t ref_type, const //-------------------------------------------------------------------------- // Function: Group::getId -///\brief Get the id of this group -///\return Group identifier +///\brief Get the id of this group +///\return Group identifier // Modification: // May 2008 - BMR -// Class hierarchy is revised to address bugzilla 1068. Class -// AbstractDS and Attribute are moved out of H5Object. In -// addition, member IdComponent::id is moved into subclasses, and -// IdComponent::getId now becomes pure virtual function. +// Class hierarchy is revised to address bugzilla 1068. Class +// AbstractDS and Attribute are moved out of H5Object. In +// addition, member IdComponent::id is moved into subclasses, and +// IdComponent::getId now becomes pure virtual function. // Programmer Binh-Minh Ribler - May, 2008 //-------------------------------------------------------------------------- hid_t Group::getId() const { - return(id); + return(id); } #ifndef DOXYGEN_SHOULD_SKIP_THIS @@ -147,11 +147,11 @@ hid_t Group::getId() const ///\brief Sets the identifier of this object to a new value. /// ///\exception H5::IdComponentException when the attempt to close the HDF5 -/// object fails +/// object fails // Description: -// The underlaying reference counting in the C library ensures -// that the current valid id of this object is properly closed. -// Then the object's id is reset to the new id. +// The underlaying reference counting in the C library ensures +// that the current valid id of this object is properly closed. +// Then the object's id is reset to the new id. // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void Group::p_setId(const hid_t new_id) @@ -163,24 +163,24 @@ void Group::p_setId(const hid_t new_id) catch (Exception& close_error) { throwException("Group::p_setId", close_error.getDetailMsg()); } - // reset object's id to the given id - id = new_id; + // reset object's id to the given id + id = new_id; } #endif // DOXYGEN_SHOULD_SKIP_THIS //-------------------------------------------------------------------------- -// Function: Group::close -///\brief Closes this group. +// Function: Group::close +///\brief Closes this group. /// -///\exception H5::GroupIException -// Programmer Binh-Minh Ribler - Mar 9, 2005 +///\exception H5::GroupIException +// Programmer Binh-Minh Ribler - Mar 9, 2005 //-------------------------------------------------------------------------- void Group::close() { if (p_valid_id(id)) { - herr_t ret_value = H5Gclose( id ); - if( ret_value < 0 ) + herr_t ret_value = H5Gclose(id); + if (ret_value < 0) { throwException("Group::close", "H5Gclose failed"); } @@ -190,34 +190,34 @@ void Group::close() } //-------------------------------------------------------------------------- -// Function: Group::throwException -///\brief Throws H5::GroupIException. -///\param func_name - Name of the function where failure occurs -///\param msg - Message describing the failure -///\exception H5::GroupIException +// Function: Group::throwException +///\brief Throws H5::GroupIException. +///\param func_name - Name of the function where failure occurs +///\param msg - Message describing the failure +///\exception H5::GroupIException // Description -// This function is also used in H5Location's methods so that -// proper exception can be thrown for file or group. The -// "Group::" will be inserted to indicate the function called is -// an implementation of Group. -// Programmer Binh-Minh Ribler - 2000 +// This function is also used in H5Location's methods so that +// proper exception can be thrown for file or group. The +// "Group::" will be inserted to indicate the function called is +// an implementation of Group. +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void Group::throwException(const H5std_string& func_name, const H5std_string& msg) const { - H5std_string full_name = func_name; - full_name.insert(0, "Group::"); - throw GroupIException(full_name, msg); + H5std_string full_name = func_name; + full_name.insert(0, "Group::"); + throw GroupIException(full_name, msg); } //-------------------------------------------------------------------------- -// Function: Group destructor -///\brief Properly terminates access to this group. -// Programmer Binh-Minh Ribler - 2000 +// Function: Group destructor +///\brief Properly terminates access to this group. +// Programmer Binh-Minh Ribler - 2000 // Modification -// - Replaced resetIdComponent() with decRefCount() to use C -// library ID reference counting mechanism - BMR, Feb 20, 2005 -// - Replaced decRefCount with close() to let the C library -// handle the reference counting - BMR, Jun 1, 2006 +// - Replaced resetIdComponent() with decRefCount() to use C +// library ID reference counting mechanism - BMR, Feb 20, 2005 +// - Replaced decRefCount with close() to let the C library +// handle the reference counting - BMR, Jun 1, 2006 //-------------------------------------------------------------------------- Group::~Group() { diff --git a/c++/src/H5Group.h b/c++/src/H5Group.h index 0a9e975..96dc5c1 100644 --- a/c++/src/H5Group.h +++ b/c++/src/H5Group.h @@ -30,53 +30,53 @@ class VarLenType; class H5_DLLCPP Group : public H5Object, public CommonFG { public: - // Group constructor to create a group or file (aka root group). - Group(const char* name, size_t size_hint = 0); - Group(const H5std_string& name, size_t size_hint = 0); + // Group constructor to create a group or file (aka root group). + Group(const char* name, size_t size_hint = 0); + Group(const H5std_string& name, size_t size_hint = 0); - // Group constructor to open a group or file (aka root group). - Group(const char* name); - Group(const H5std_string& name); + // Group constructor to open a group or file (aka root group). + Group(const char* name); + Group(const H5std_string& name); - // Close this group. - virtual void close(); + // Close this group. + virtual void close(); - ///\brief Returns this class name. - virtual H5std_string fromClass () const { return("Group"); } + ///\brief Returns this class name. + virtual H5std_string fromClass () const { return("Group"); } - // Throw group exception. - virtual void throwException(const H5std_string& func_name, const H5std_string& msg) const; + // Throw group exception. + virtual void throwException(const H5std_string& func_name, const H5std_string& msg) const; - // for CommonFG to get the file id. - virtual hid_t getLocId() const; + // for CommonFG to get the file id. + virtual hid_t getLocId() const; - // Creates a group by way of dereference. - Group(const H5Location& loc, const void* ref, H5R_type_t ref_type = H5R_OBJECT, const PropList& plist = PropList::DEFAULT); + // Creates a group by way of dereference. + Group(const H5Location& loc, const void* ref, H5R_type_t ref_type = H5R_OBJECT, const PropList& plist = PropList::DEFAULT); // Group(const Attribute& attr, const void* ref, H5R_type_t ref_type = H5R_OBJECT, const PropList& plist = PropList::DEFAULT); - // default constructor - Group(); + // default constructor + Group(); - // Copy constructor: makes a copy of the original object - Group(const Group& original); + // Copy constructor: makes a copy of the original object + Group(const Group& original); - // Gets the group id. - virtual hid_t getId() const; + // Gets the group id. + virtual hid_t getId() const; - // Destructor - virtual ~Group(); + // Destructor + virtual ~Group(); - // Creates a copy of an existing group using its id. - Group( const hid_t group_id ); + // Creates a copy of an existing group using its id. + Group(const hid_t group_id); protected: #ifndef DOXYGEN_SHOULD_SKIP_THIS - // Sets the group id. - virtual void p_setId(const hid_t new_id); + // Sets the group id. + virtual void p_setId(const hid_t new_id); #endif // DOXYGEN_SHOULD_SKIP_THIS private: - hid_t id; // HDF5 group id + hid_t id; // HDF5 group id }; } diff --git a/c++/src/H5IdComponent.cpp b/c++/src/H5IdComponent.cpp index f3d916a..574b28a 100644 --- a/c++/src/H5IdComponent.cpp +++ b/c++/src/H5IdComponent.cpp @@ -15,7 +15,7 @@ #include -#include "H5private.h" // for HDmemset +#include "H5private.h" // for HDmemset #include "H5Include.h" #include "H5Exception.h" #include "H5Library.h" @@ -34,21 +34,21 @@ bool IdComponent::H5cppinit = false; bool IdComponent::H5dontAtexit_called = false; //-------------------------------------------------------------------------- -// Function: IdComponent::incRefCount -///\brief Increment reference counter for a given id. -// Programmer Binh-Minh Ribler - May 2005 +// Function: IdComponent::incRefCount +///\brief Increment reference counter for a given id. +// Programmer Binh-Minh Ribler - May 2005 //-------------------------------------------------------------------------- void IdComponent::incRefCount(const hid_t obj_id) const { if (p_valid_id(obj_id)) - if (H5Iinc_ref(obj_id) < 0) - throw IdComponentException(inMemFunc("incRefCount"), "incrementing object ref count failed"); + if (H5Iinc_ref(obj_id) < 0) + throw IdComponentException(inMemFunc("incRefCount"), "incrementing object ref count failed"); } //-------------------------------------------------------------------------- -// Function: IdComponent::incRefCount -///\brief Increment reference counter for the id of this object. -// Programmer Binh-Minh Ribler - 2000 +// Function: IdComponent::incRefCount +///\brief Increment reference counter for the id of this object. +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void IdComponent::incRefCount() const { @@ -56,31 +56,31 @@ void IdComponent::incRefCount() const } //-------------------------------------------------------------------------- -// Function: IdComponent::decRefCount -///\brief Decrement reference counter for a given id. -// Programmer Binh-Minh Ribler - May 2005 +// Function: IdComponent::decRefCount +///\brief Decrement reference counter for a given id. +// Programmer Binh-Minh Ribler - May 2005 // Modification: -// Added the check for ref counter to give a little more info -// on why H5Idec_ref fails in some cases - BMR 5/19/2005 +// Added the check for ref counter to give a little more info +// on why H5Idec_ref fails in some cases - BMR 5/19/2005 //-------------------------------------------------------------------------- void IdComponent::decRefCount(const hid_t obj_id) const { if (p_valid_id(obj_id)) - if (H5Idec_ref(obj_id) < 0) - { - if (H5Iget_ref(obj_id) <= 0) - throw IdComponentException(inMemFunc("decRefCount"), - "object ref count is 0 or negative"); - else - throw IdComponentException(inMemFunc("decRefCount"), - "decrementing object ref count failed"); - } + if (H5Idec_ref(obj_id) < 0) + { + if (H5Iget_ref(obj_id) <= 0) + throw IdComponentException(inMemFunc("decRefCount"), + "object ref count is 0 or negative"); + else + throw IdComponentException(inMemFunc("decRefCount"), + "decrementing object ref count failed"); + } } //-------------------------------------------------------------------------- -// Function: IdComponent::decRefCount -///\brief Decrement reference counter for the id of this object. -// Programmer Binh-Minh Ribler - 2000 +// Function: IdComponent::decRefCount +///\brief Decrement reference counter for the id of this object. +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void IdComponent::decRefCount() const { @@ -88,28 +88,28 @@ void IdComponent::decRefCount() const } //-------------------------------------------------------------------------- -// Function: IdComponent::getCounter -///\brief Returns the reference counter for a given id. -///\return Reference count -// Programmer Binh-Minh Ribler - May 2005 +// Function: IdComponent::getCounter +///\brief Returns the reference counter for a given id. +///\return Reference count +// Programmer Binh-Minh Ribler - May 2005 //-------------------------------------------------------------------------- int IdComponent::getCounter(const hid_t obj_id) const { int counter = 0; if (p_valid_id(obj_id)) { - counter = H5Iget_ref(obj_id); - if (counter < 0) - throw IdComponentException(inMemFunc("incRefCount"), "getting object ref count failed - negative"); + counter = H5Iget_ref(obj_id); + if (counter < 0) + throw IdComponentException(inMemFunc("incRefCount"), "getting object ref count failed - negative"); } return (counter); } //-------------------------------------------------------------------------- -// Function: IdComponent::getCounter -///\brief Returns the reference counter for the id of this object. -///\return Reference count -// Programmer Binh-Minh Ribler - 2000 +// Function: IdComponent::getCounter +///\brief Returns the reference counter for the id of this object. +///\return Reference count +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- int IdComponent::getCounter() const { @@ -117,43 +117,43 @@ int IdComponent::getCounter() const } //-------------------------------------------------------------------------- -// Function: getHDFObjType (static) -///\brief Given an id, returns the type of the object. -///\return a valid HDF object type, which may be one of the following: -/// \li \c H5I_FILE -/// \li \c H5I_GROUP -/// \li \c H5I_DATATYPE -/// \li \c H5I_DATASPACE -/// \li \c H5I_DATASET -/// \li \c H5I_ATTR -/// \li or \c H5I_BADID, if no valid type can be determined or the -/// input object id is invalid. +// Function: getHDFObjType (static) +///\brief Given an id, returns the type of the object. +///\return a valid HDF object type, which may be one of the following: +/// \li \c H5I_FILE +/// \li \c H5I_GROUP +/// \li \c H5I_DATATYPE +/// \li \c H5I_DATASPACE +/// \li \c H5I_DATASET +/// \li \c H5I_ATTR +/// \li or \c H5I_BADID, if no valid type can be determined or the +/// input object id is invalid. // Programmer Binh-Minh Ribler - Jul, 2005 //-------------------------------------------------------------------------- H5I_type_t IdComponent::getHDFObjType(const hid_t obj_id) { if (obj_id <= 0) - return H5I_BADID; // invalid + return H5I_BADID; // invalid H5I_type_t id_type = H5Iget_type(obj_id); if (id_type <= H5I_BADID || id_type >= H5I_NTYPES) - return H5I_BADID; // invalid + return H5I_BADID; // invalid else - return id_type; // valid type + return id_type; // valid type } //-------------------------------------------------------------------------- -// Function: getHDFObjType -///\brief Returns the type of the object. It is an overloaded function -/// of the above function. -///\return a valid HDF object type, which may be one of the following: -/// \li \c H5I_FILE -/// \li \c H5I_GROUP -/// \li \c H5I_DATATYPE -/// \li \c H5I_DATASPACE -/// \li \c H5I_DATASET -/// \li \c H5I_ATTR -/// \li or \c H5I_BADID, if no valid type can be determined or the -/// input object id is invalid. +// Function: getHDFObjType +///\brief Returns the type of the object. It is an overloaded function +/// of the above function. +///\return a valid HDF object type, which may be one of the following: +/// \li \c H5I_FILE +/// \li \c H5I_GROUP +/// \li \c H5I_DATATYPE +/// \li \c H5I_DATASPACE +/// \li \c H5I_DATASET +/// \li \c H5I_ATTR +/// \li or \c H5I_BADID, if no valid type can be determined or the +/// input object id is invalid. // Programmer Binh-Minh Ribler - Mar, 2014 //-------------------------------------------------------------------------- H5I_type_t IdComponent::getHDFObjType() const @@ -162,74 +162,140 @@ H5I_type_t IdComponent::getHDFObjType() const } //-------------------------------------------------------------------------- -// Function: IdComponent::operator= -///\brief Assignment operator. -///\param rhs - IN: Reference to the existing object -///\return Reference to IdComponent instance -///\exception H5::IdComponentException when attempt to close the HDF5 -/// object fails +// Function: getNumMembers (static) +///\brief Returns the number of members of the given type. +///\return Number of members +///\Description +/// If there is no member of the given type, getNumMembers will +/// return 0. Valid types are: +/// \li \c H5I_FILE (= 1) +/// \li \c H5I_GROUP +/// \li \c H5I_DATATYPE +/// \li \c H5I_DATASPACE +/// \li \c H5I_DATASET +/// \li \c H5I_ATTR +/// \li \c H5I_REFERENCE +/// \li \c H5I_VFL +/// \li \c H5I_GENPROP_CLS +/// \li \c H5I_GENPROP_LST +/// \li \c H5I_ERROR_CLASS +/// \li \c H5I_ERROR_MSG +/// \li \c H5I_ERROR_STACK +// Programmer Binh-Minh Ribler - Feb, 2017 +//-------------------------------------------------------------------------- +hsize_t IdComponent::getNumMembers(H5I_type_t type) +{ + hsize_t nmembers = 0; + herr_t ret_value = H5Inmembers(type, &nmembers); + if (ret_value < 0) + throw IdComponentException("getNumMembers", "H5Inmembers failed"); + else + return(nmembers); +} + +//-------------------------------------------------------------------------- +// Function: typeExists (static) +///\brief Queries if a given type is currently registered with the +/// library. +///\return true if the given type exists, and false, otherwise. +///\Description +/// Valid types are: +/// \li \c H5I_FILE (= 1) +/// \li \c H5I_GROUP +/// \li \c H5I_DATATYPE +/// \li \c H5I_DATASPACE +/// \li \c H5I_DATASET +/// \li \c H5I_ATTR +/// \li \c H5I_REFERENCE +/// \li \c H5I_VFL +/// \li \c H5I_GENPROP_CLS +/// \li \c H5I_GENPROP_LST +/// \li \c H5I_ERROR_CLASS +/// \li \c H5I_ERROR_MSG +/// \li \c H5I_ERROR_STACK +// Programmer Binh-Minh Ribler - Feb, 2017 +//-------------------------------------------------------------------------- +bool IdComponent::typeExists(H5I_type_t type) +{ + // Call C function + htri_t ret_value = H5Itype_exists(type); + if (ret_value > 0) + return true; + else if (ret_value == 0) + return false; + else // Raise exception when H5Itype_exists returns a negative value + throw IdComponentException("typeExists", "H5Itype_exists failed"); +} + +//-------------------------------------------------------------------------- +// Function: IdComponent::operator= +///\brief Assignment operator. +///\param rhs - IN: Reference to the existing object +///\return Reference to IdComponent instance +///\exception H5::IdComponentException when attempt to close the HDF5 +/// object fails // Description -// First, close the current valid id of this object. Then -// copy the id from rhs to this object, and increment the -// reference counter of the id to indicate that another object -// is referencing that id. +// First, close the current valid id of this object. Then +// copy the id from rhs to this object, and increment the +// reference counter of the id to indicate that another object +// is referencing that id. // Modification -// 2010/5/9 - BMR -// Removed close() and incRefCount() because setId/p_setId takes -// care of close() and setId takes care incRefCount(). -// Programmer Binh-Minh Ribler - 2000 +// 2010/5/9 - BMR +// Removed close() and incRefCount() because setId/p_setId takes +// care of close() and setId takes care incRefCount(). +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -IdComponent& IdComponent::operator=( const IdComponent& rhs ) +IdComponent& IdComponent::operator=(const IdComponent& rhs) { if (this != &rhs) { - // handling references to this id - try { - setId(rhs.getId()); - // Note: a = b, so there are two objects with the same hdf5 id - // that's why incRefCount is needed, and it is called by setId - } - catch (Exception& close_error) { - throw FileIException(inMemFunc("operator="), close_error.getDetailMsg()); - } + // handling references to this id + try { + setId(rhs.getId()); + // Note: a = b, so there are two objects with the same hdf5 id + // that's why incRefCount is needed, and it is called by setId + } + catch (Exception& close_error) { + throw FileIException(inMemFunc("operator="), close_error.getDetailMsg()); + } } return *this; } //-------------------------------------------------------------------------- -// Function: IdComponent::setId -///\brief Sets the identifier of this object to a new value. -///\param new_id - IN: New identifier to be set to -///\exception H5::IdComponentException when the attempt to close the HDF5 -/// object fails +// Function: IdComponent::setId +///\brief Sets the identifier of this object to a new value. +///\param new_id - IN: New identifier to be set to +///\exception H5::IdComponentException when the attempt to close the HDF5 +/// object fails // Description: -// p_setId ensures that the current valid id of this object is -// properly closed before resetting the object's id to the new id. -// Programmer Binh-Minh Ribler - 2000 +// p_setId ensures that the current valid id of this object is +// properly closed before resetting the object's id to the new id. +// Programmer Binh-Minh Ribler - 2000 // Modification -// 2008/7/23 - BMR -// Changed all subclasses' setId to p_setId and put back setId -// here. p_setId is used in the library where the id provided -// by a C API passed on to user's application in the form of a -// C++ API object, which will be destroyed properly, and so -// p_setId does not call incRefCount. On the other hand, the -// public version setId is used by other applications, in which -// the id passed to setId is that of another C++ API object, so -// setId must call incRefCount. +// 2008/7/23 - BMR +// Changed all subclasses' setId to p_setId and put back setId +// here. p_setId is used in the library where the id provided +// by a C API passed on to user's application in the form of a +// C++ API object, which will be destroyed properly, and so +// p_setId does not call incRefCount. On the other hand, the +// public version setId is used by other applications, in which +// the id passed to setId is that of another C++ API object, so +// setId must call incRefCount. //-------------------------------------------------------------------------- void IdComponent::setId(const hid_t new_id) { - // set to new_id - p_setId(new_id); + // set to new_id + p_setId(new_id); - // increment the reference counter of the new id - incRefCount(); + // increment the reference counter of the new id + incRefCount(); } //-------------------------------------------------------------------------- -// Function: IdComponent destructor -///\brief Noop destructor. -// Programmer Binh-Minh Ribler - 2000 +// Function: IdComponent destructor +///\brief Noop destructor. +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- IdComponent::~IdComponent() {} @@ -240,29 +306,29 @@ IdComponent::~IdComponent() {} #ifndef DOXYGEN_SHOULD_SKIP_THIS //-------------------------------------------------------------------------- -// Function: IdComponent::inMemFunc -///\brief Makes and returns string "::" -///\param func_name - Name of the function where failure occurs +// Function: IdComponent::inMemFunc +///\brief Makes and returns string "::" +///\param func_name - Name of the function where failure occurs // Description -/// Concatenates the class name of this object with the -/// passed-in function name to create a string that indicates -/// where the failure occurs. The class-name is provided by -/// fromClass(). This string will be used by a base class when -/// an exception is thrown. -// Programmer Binh-Minh Ribler - Aug 6, 2005 +/// Concatenates the class name of this object with the +/// passed-in function name to create a string that indicates +/// where the failure occurs. The class-name is provided by +/// fromClass(). This string will be used by a base class when +/// an exception is thrown. +// Programmer Binh-Minh Ribler - Aug 6, 2005 //-------------------------------------------------------------------------- H5std_string IdComponent::inMemFunc(const char* func_name) const { - H5std_string full_name = func_name; - full_name.insert(0, "::"); - full_name.insert(0, fromClass()); - return (full_name); + H5std_string full_name = func_name; + full_name.insert(0, "::"); + full_name.insert(0, fromClass()); + return (full_name); } //-------------------------------------------------------------------------- -// Function: IdComponent default constructor - private -///\brief Default constructor. -// Programmer Binh-Minh Ribler - 2000 +// Function: IdComponent default constructor - private +///\brief Default constructor. +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- IdComponent::IdComponent() { @@ -276,45 +342,45 @@ IdComponent::IdComponent() } //-------------------------------------------------------------------------- -// Function: IdComponent::p_get_file_name (protected) -// Purpose: Gets the name of the file, in which this object belongs. -// Exception: H5::IdComponentException +// Function: IdComponent::p_get_file_name (protected) +// Purpose Gets the name of the file, in which this object belongs. +// Exception: H5::IdComponentException // Description: -// This function is protected so that the user applications can -// only have access to its code via allowable classes, namely, -// Attribute and H5Location subclasses. -// Programmer Binh-Minh Ribler - Jul, 2004 +// This function is protected so that the user applications can +// only have access to its code via allowable classes, namely, +// Attribute and H5Location subclasses. +// Programmer Binh-Minh Ribler - Jul, 2004 //-------------------------------------------------------------------------- H5std_string IdComponent::p_get_file_name() const { - hid_t temp_id = getId(); + hid_t temp_id = getId(); - // Preliminary call to H5Fget_name to get the length of the file name - ssize_t name_size = H5Fget_name(temp_id, NULL, 0); + // Preliminary call to H5Fget_name to get the length of the file name + ssize_t name_size = H5Fget_name(temp_id, NULL, 0); - // If H5Aget_name returns a negative value, raise an exception, - if( name_size < 0 ) - { - throw IdComponentException("", "H5Fget_name failed"); - } + // If H5Aget_name returns a negative value, raise an exception, + if (name_size < 0) + { + throw IdComponentException("", "H5Fget_name failed"); + } - // Call H5Fget_name again to get the actual file name - char* name_C = new char[name_size+1]; // temporary C-string for C API - HDmemset(name_C, 0, name_size+1); // clear buffer + // Call H5Fget_name again to get the actual file name + char* name_C = new char[name_size+1]; // temporary C-string for C API + HDmemset(name_C, 0, name_size+1); // clear buffer - name_size = H5Fget_name(temp_id, name_C, name_size+1); + name_size = H5Fget_name(temp_id, name_C, name_size+1); - // Check for failure again - if( name_size < 0 ) - { + // Check for failure again + if (name_size < 0) + { delete []name_C; - throw IdComponentException("", "H5Fget_name failed"); - } + throw IdComponentException("", "H5Fget_name failed"); + } - // Convert the C file name and return - H5std_string file_name(name_C); - delete []name_C; - return(file_name); + // Convert the C file name and return + H5std_string file_name(name_C); + delete []name_C; + return(file_name); } // @@ -322,22 +388,22 @@ H5std_string IdComponent::p_get_file_name() const // //-------------------------------------------------------------------------- -// Function: p_valid_id -// Purpose: Verifies that the given id is a valid id so it can be passed -// into an H5I C function. -// Return true if id is valid, false, otherwise -// Programmer Binh-Minh Ribler - May, 2005 +// Function: p_valid_id +// Purpose Verifies that the given id is a valid id so it can be passed +// into an H5I C function. +// Return true if id is valid, false, otherwise +// Programmer Binh-Minh Ribler - May, 2005 //-------------------------------------------------------------------------- bool IdComponent::p_valid_id(const hid_t obj_id) { if (obj_id <= 0) - return false; + return false; H5I_type_t id_type = H5Iget_type(obj_id); if (id_type <= H5I_BADID || id_type >= H5I_NTYPES) - return false; + return false; else - return true; + return true; } // Notes about IdComponent::id diff --git a/c++/src/H5IdComponent.h b/c++/src/H5IdComponent.h index d3d9b9f..6f57364 100644 --- a/c++/src/H5IdComponent.h +++ b/c++/src/H5IdComponent.h @@ -30,86 +30,92 @@ class DataSpace; class H5_DLLCPP IdComponent { public: - // Increment reference counter. - void incRefCount(const hid_t obj_id) const; - void incRefCount() const; + // Increment reference counter. + void incRefCount(const hid_t obj_id) const; + void incRefCount() const; - // Decrement reference counter. - void decRefCount(const hid_t obj_id) const; - void decRefCount() const; + // Decrement reference counter. + void decRefCount(const hid_t obj_id) const; + void decRefCount() const; - // Get the reference counter to this identifier. - int getCounter(const hid_t obj_id) const; - int getCounter() const; + // Get the reference counter to this identifier. + int getCounter(const hid_t obj_id) const; + int getCounter() const; - // Returns an HDF5 object type, given the object id. - static H5I_type_t getHDFObjType(const hid_t obj_id); + // Returns an HDF5 object type, given the object id. + static H5I_type_t getHDFObjType(const hid_t obj_id); - // Returns an HDF5 object type of this object. - H5I_type_t getHDFObjType() const; + // Returns an HDF5 object type of this object. + H5I_type_t getHDFObjType() const; - // Assignment operator. - IdComponent& operator=( const IdComponent& rhs ); + // Returns the number of members in a type. + static hsize_t getNumMembers(H5I_type_t type); - // Sets the identifier of this object to a new value. - void setId(const hid_t new_id); + // Determines if an type exists. + static bool typeExists(H5I_type_t type); - // *** Deprecation warning *** - // The following two constructors are no longer appropriate after the - // data member "id" had been moved to the sub-classes. - // The copy constructor is a noop and is removed in 1.8.15 and the - // other will be removed from 1.10 release, and then from 1.8 if its - // removal does not raise any problems in two 1.10 releases. + // Assignment operator. + IdComponent& operator=(const IdComponent& rhs); - // Creates an object to hold an HDF5 identifier. - IdComponent( const hid_t h5_id ); + // Sets the identifier of this object to a new value. + void setId(const hid_t new_id); + + // *** Deprecation warning *** + // The following two constructors are no longer appropriate after the + // data member "id" had been moved to the sub-classes. + // The copy constructor is a noop and is removed in 1.8.15 and the + // other will be removed from 1.10 release, and then from 1.8 if its + // removal does not raise any problems in two 1.10 releases. + + // Creates an object to hold an HDF5 identifier. + // IdComponent(const hid_t h5_id); - removed from 1.10.1 #ifndef DOXYGEN_SHOULD_SKIP_THIS - // Copy constructor: makes copy of the original IdComponent object. - // IdComponent( const IdComponent& original ); - removed from 1.8.15 + // Copy constructor: makes copy of the original IdComponent object. + // IdComponent(const IdComponent& original); - removed from 1.8.15 - // Gets the identifier of this object. - virtual hid_t getId () const = 0; + // Gets the identifier of this object. + virtual hid_t getId () const = 0; - // Pure virtual function for there are various H5*close for the - // subclasses. - virtual void close() = 0; + // Pure virtual function for there are various H5*close for the + // subclasses. + virtual void close() = 0; - // Makes and returns the string "::"; - // is returned by fromClass(). - H5std_string inMemFunc(const char* func_name) const; + // Makes and returns the string "::"; + // is returned by fromClass(). + H5std_string inMemFunc(const char* func_name) const; - ///\brief Returns this class name. - virtual H5std_string fromClass() const { return("IdComponent");} + ///\brief Returns this class name. + virtual H5std_string fromClass() const { return("IdComponent");} #endif // DOXYGEN_SHOULD_SKIP_THIS - // Destructor - virtual ~IdComponent(); + // Destructor + virtual ~IdComponent(); #ifndef DOXYGEN_SHOULD_SKIP_THIS protected: - // Default constructor. - IdComponent(); + // Default constructor. + IdComponent(); - // Gets the name of the file, in which an HDF5 object belongs. - H5std_string p_get_file_name() const; + // Gets the name of the file, in which an HDF5 object belongs. + H5std_string p_get_file_name() const; - // Verifies that the given id is valid. - static bool p_valid_id(const hid_t obj_id); + // Verifies that the given id is valid. + static bool p_valid_id(const hid_t obj_id); - // Sets the identifier of this object to a new value. - this one - // doesn't increment reference count - virtual void p_setId(const hid_t new_id) = 0; + // Sets the identifier of this object to a new value. - this one + // doesn't increment reference count + virtual void p_setId(const hid_t new_id) = 0; - // This flag is used to decide whether H5dont_atexit should be called - static bool H5dontAtexit_called; + // This flag is used to decide whether H5dont_atexit should be called + static bool H5dontAtexit_called; private: - // This flag indicates whether H5Library::initH5cpp has been called - // to register various terminating functions with atexit() + // This flag indicates whether H5Library::initH5cpp has been called + // to register various terminating functions with atexit() static bool H5cppinit; #endif // DOXYGEN_SHOULD_SKIP_THIS diff --git a/c++/src/H5Include.h b/c++/src/H5Include.h index 1e0e952..ba82d78 100644 --- a/c++/src/H5Include.h +++ b/c++/src/H5Include.h @@ -33,10 +33,10 @@ const bool true = 1; // so re-define them here for now. /* Initial version of the object header format */ -#define H5O_VERSION_1 1 +#define H5O_VERSION_1 1 /* Revised version - leaves out reserved bytes and alignment padding, and adds * magic number as prefix and checksum as suffix for all chunks. */ -#define H5O_VERSION_2 2 +#define H5O_VERSION_2 2 diff --git a/c++/src/H5IntType.cpp b/c++/src/H5IntType.cpp index 38e2a7d..c64dae9 100644 --- a/c++/src/H5IntType.cpp +++ b/c++/src/H5IntType.cpp @@ -36,72 +36,72 @@ namespace H5 { //-------------------------------------------------------------------------- -// Function: IntType default constructor -///\brief Default constructor: Creates a stub integer datatype -// Programmer Binh-Minh Ribler - 2000 +// Function: IntType default constructor +///\brief Default constructor: Creates a stub integer datatype +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- IntType::IntType() {} //-------------------------------------------------------------------------- -// Function: IntType copy constructor -///\brief Copy constructor: makes a copy of the original IntType object. -// Programmer Binh-Minh Ribler - 2000 +// Function: IntType copy constructor +///\brief Copy constructor: makes a copy of the original IntType object. +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -IntType::IntType( const IntType& original ) : AtomType( original ) {} +IntType::IntType(const IntType& original) : AtomType( original ) {} //-------------------------------------------------------------------------- -// Function: IntType overloaded constructor -///\brief Creates a integer type using a predefined type -///\param pred_type - IN: Predefined datatype -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 +// Function: IntType overloaded constructor +///\brief Creates a integer type using a predefined type +///\param pred_type - IN: Predefined datatype +///\exception H5::DataTypeIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -IntType::IntType( const PredType& pred_type ) : AtomType() +IntType::IntType(const PredType& pred_type) : AtomType() { - // use DataType::copy to make a copy of this predefined type - copy( pred_type ); + // use DataType::copy to make a copy of this predefined type + copy(pred_type); } //-------------------------------------------------------------------------- -// Function: IntType overloaded constructor -///\brief Creates an integer datatype using the id of an existing -/// datatype. -///\param existing_id - IN: Id of an existing datatype -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 +// Function: IntType overloaded constructor +///\brief Creates an integer datatype using the id of an existing +/// datatype. +///\param existing_id - IN: Id of an existing datatype +///\exception H5::DataTypeIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -IntType::IntType( const hid_t existing_id ) : AtomType( existing_id ) {} +IntType::IntType(const hid_t existing_id) : AtomType( existing_id ) {} //-------------------------------------------------------------------------- -// Function: IntType overloaded constructor -///\brief Gets the integer datatype of the specified dataset. -///\param dataset - IN: Dataset that this integer datatype associates with -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 +// Function: IntType overloaded constructor +///\brief Gets the integer datatype of the specified dataset. +///\param dataset - IN: Dataset that this integer datatype associates with +///\exception H5::DataTypeIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -IntType::IntType( const DataSet& dataset ) : AtomType() +IntType::IntType(const DataSet& dataset) : AtomType() { - // Calls C function H5Dget_type to get the id of the datatype - id = H5Dget_type( dataset.getId() ); - - if( id < 0 ) - { - throw DataSetIException("IntType constructor", "H5Dget_type failed"); - } + // Calls C function H5Dget_type to get the id of the datatype + id = H5Dget_type(dataset.getId()); + + if (id < 0) + { + throw DataSetIException("IntType constructor", "H5Dget_type failed"); + } } //-------------------------------------------------------------------------- -// Function: IntType overloaded constructor -///\brief Creates a IntType instance by opening an HDF5 integer datatype -/// given its name as a char*. -///\param dtype_name - IN: Integer type name -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - Dec 2016 +// Function: IntType overloaded constructor +///\brief Creates a IntType instance by opening an HDF5 integer datatype +/// given its name as a char*. +///\param dtype_name - IN: Integer type name +///\exception H5::DataTypeIException +// Programmer Binh-Minh Ribler - Dec 2016 // Description -// In 1.10.1, this constructor was introduced and will replace the -// existing function CommonFG::openIntType(const char*) to -// improve usability. -// -BMR, Dec 2016 +// In 1.10.1, this constructor was introduced and will replace the +// existing function CommonFG::openIntType(const char*) to +// improve usability. +// -BMR, Dec 2016 //-------------------------------------------------------------------------- IntType::IntType(const H5Location& loc, const char *dtype_name) : AtomType() { @@ -109,17 +109,17 @@ IntType::IntType(const H5Location& loc, const char *dtype_name) : AtomType() } //-------------------------------------------------------------------------- -// Function: IntType overloaded constructor -///\brief Creates a IntType instance by opening an HDF5 integer datatype -/// given its name, provided as an \c H5std_string. -///\param dtype_name - IN: Integer type name -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - Dec 2016 +// Function: IntType overloaded constructor +///\brief Creates a IntType instance by opening an HDF5 integer datatype +/// given its name, provided as an \c H5std_string. +///\param dtype_name - IN: Integer type name +///\exception H5::DataTypeIException +// Programmer Binh-Minh Ribler - Dec 2016 // Description -// In 1.10.1, this constructor was introduced and will replace the -// existing function CommonFG::openArrayType(const H5std_string&) -// to improve usability. -// -BMR, Dec 2016 +// In 1.10.1, this constructor was introduced and will replace the +// existing function CommonFG::openArrayType(const H5std_string&) +// to improve usability. +// -BMR, Dec 2016 //-------------------------------------------------------------------------- IntType::IntType(const H5Location& loc, const H5std_string& dtype_name) : AtomType() { @@ -127,46 +127,46 @@ IntType::IntType(const H5Location& loc, const H5std_string& dtype_name) : AtomTy } //-------------------------------------------------------------------------- -// Function: IntType::getSign -///\brief Retrieves the sign type for an integer type. -///\return Valid sign type -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 +// Function: IntType::getSign +///\brief Retrieves the sign type for an integer type. +///\return Valid sign type +///\exception H5::DataTypeIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- H5T_sign_t IntType::getSign() const { - H5T_sign_t type_sign = H5Tget_sign( id ); // C routine - - // Returns a valid sign type if no errors - if( type_sign == H5T_SGN_ERROR ) - { - throw DataTypeIException("IntType::getSign", - "H5Tget_sign failed - returned H5T_SGN_ERROR for the sign type"); - } - return( type_sign ); + H5T_sign_t type_sign = H5Tget_sign(id); // C routine + + // Returns a valid sign type if no errors + if (type_sign == H5T_SGN_ERROR) + { + throw DataTypeIException("IntType::getSign", + "H5Tget_sign failed - returned H5T_SGN_ERROR for the sign type"); + } + return(type_sign); } //-------------------------------------------------------------------------- -// Function: IntType::getSign -///\brief Sets the sign property for an integer type. -///\param sign - IN: Sign type -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 +// Function: IntType::getSign +///\brief Sets the sign property for an integer type. +///\param sign - IN: Sign type +///\exception H5::DataTypeIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -void IntType::setSign( H5T_sign_t sign ) const +void IntType::setSign(H5T_sign_t sign) const { - // Call C routine to set the sign property - herr_t ret_value = H5Tset_sign( id, sign ); - if( ret_value < 0 ) - { - throw DataTypeIException("IntType::setSign", "H5Tset_sign failed"); - } + // Call C routine to set the sign property + herr_t ret_value = H5Tset_sign(id, sign); + if (ret_value < 0) + { + throw DataTypeIException("IntType::setSign", "H5Tset_sign failed"); + } } //-------------------------------------------------------------------------- -// Function: IntType destructor -///\brief Noop destructor. -// Programmer Binh-Minh Ribler - 2000 +// Function: IntType destructor +///\brief Noop destructor. +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- IntType::~IntType() {} diff --git a/c++/src/H5IntType.h b/c++/src/H5IntType.h index 74786b9..ae4b3df 100644 --- a/c++/src/H5IntType.h +++ b/c++/src/H5IntType.h @@ -27,36 +27,36 @@ namespace H5 { */ class H5_DLLCPP IntType : public AtomType { public: - // Creates an integer type using a predefined type - IntType(const PredType& pred_type); + // Creates an integer type using a predefined type + IntType(const PredType& pred_type); - // Gets the integer datatype of the specified dataset - IntType(const DataSet& dataset); + // Gets the integer datatype of the specified dataset + IntType(const DataSet& dataset); - // Constructors that open an HDF5 integer datatype, given a location. - IntType(const H5Location& loc, const char* name); - IntType(const H5Location& loc, const H5std_string& name); + // Constructors that open an HDF5 integer datatype, given a location. + IntType(const H5Location& loc, const char* name); + IntType(const H5Location& loc, const H5std_string& name); - // Retrieves the sign type for an integer type - H5T_sign_t getSign() const; + // Retrieves the sign type for an integer type + H5T_sign_t getSign() const; - // Sets the sign proprety for an integer type. - void setSign( H5T_sign_t sign ) const; + // Sets the sign proprety for an integer type. + void setSign(H5T_sign_t sign) const; - ///\brief Returns this class name. - virtual H5std_string fromClass () const { return("IntType"); } + ///\brief Returns this class name. + virtual H5std_string fromClass () const { return("IntType"); } - // Default constructor - IntType(); + // Default constructor + IntType(); - // Creates a integer datatype using an existing id - IntType(const hid_t existing_id); + // Creates a integer datatype using an existing id + IntType(const hid_t existing_id); - // Copy constructor: makes copy of IntType object - IntType(const IntType& original); + // Copy constructor: makes copy of IntType object + IntType(const IntType& original); - // Noop destructor. - virtual ~IntType(); + // Noop destructor. + virtual ~IntType(); }; } #endif // __H5IntType_H diff --git a/c++/src/H5LaccProp.cpp b/c++/src/H5LaccProp.cpp index e225b36..e9adb12 100644 --- a/c++/src/H5LaccProp.cpp +++ b/c++/src/H5LaccProp.cpp @@ -47,7 +47,7 @@ LinkAccPropList* LinkAccPropList::getConstant() // Tell the C library not to clean up, H5Library::termH5cpp will call // H5close - more dependency if use H5Library::dontAtExit() if (!IdComponent::H5dontAtexit_called) - { + { (void) H5dont_atexit(); IdComponent::H5dontAtexit_called = true; } @@ -75,39 +75,39 @@ void LinkAccPropList::deleteConstants() } //-------------------------------------------------------------------------- -// Purpose: Constant for default property +// Purpose: Constant for default property //-------------------------------------------------------------------------- const LinkAccPropList& LinkAccPropList::DEFAULT = *getConstant(); #endif // DOXYGEN_SHOULD_SKIP_THIS //-------------------------------------------------------------------------- -// Function: Default Constructor -///\brief Creates a file access property list -// Programmer: Binh-Minh Ribler - 2000 +// Function: Default Constructor +///\brief Creates a file access property list +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -LinkAccPropList::LinkAccPropList() : PropList( H5P_LINK_ACCESS ) {} +LinkAccPropList::LinkAccPropList() : PropList(H5P_LINK_ACCESS) {} //-------------------------------------------------------------------------- -// Function: LinkAccPropList copy constructor -///\brief Copy Constructor: makes a copy of the original -///\param original - IN: LinkAccPropList instance to copy -// Programmer: Binh-Minh Ribler - 2000 +// Function: LinkAccPropList copy constructor +///\brief Copy Constructor: makes a copy of the original +///\param original - IN: LinkAccPropList instance to copy +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- LinkAccPropList::LinkAccPropList(const LinkAccPropList& original) : PropList(original) {} //-------------------------------------------------------------------------- -// Function: LinkAccPropList overloaded constructor -///\brief Creates a file access property list using the id of an -/// existing one. -// Programmer: Binh-Minh Ribler - 2000 +// Function: LinkAccPropList overloaded constructor +///\brief Creates a file access property list using the id of an +/// existing one. +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- LinkAccPropList::LinkAccPropList(const hid_t plist_id) : PropList(plist_id) {} //-------------------------------------------------------------------------- -// Function: LinkAccPropList destructor -///\brief Noop destructor -// Programmer Binh-Minh Ribler - 2000 +// Function: LinkAccPropList destructor +///\brief Noop destructor +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- LinkAccPropList::~LinkAccPropList() {} diff --git a/c++/src/H5LaccProp.h b/c++/src/H5LaccProp.h index 2a84ffb..8bcdd64 100644 --- a/c++/src/H5LaccProp.h +++ b/c++/src/H5LaccProp.h @@ -30,24 +30,24 @@ namespace H5 { */ class H5_DLLCPP LinkAccPropList : public PropList { public: - ///\brief Default file access property list. - static const LinkAccPropList& DEFAULT; + ///\brief Default file access property list. + static const LinkAccPropList& DEFAULT; - // Creates a file access property list. - LinkAccPropList(); + // Creates a file access property list. + LinkAccPropList(); - ///\brief Returns this class name. - virtual H5std_string fromClass () const { return("LinkAccPropList"); } + ///\brief Returns this class name. + virtual H5std_string fromClass () const { return("LinkAccPropList"); } - // Copy constructor: creates a copy of a LinkAccPropList object. - LinkAccPropList( const LinkAccPropList& original ); + // Copy constructor: creates a copy of a LinkAccPropList object. + LinkAccPropList(const LinkAccPropList& original); - // Creates a copy of an existing file access property list - // using the property list id. - LinkAccPropList (const hid_t plist_id); + // Creates a copy of an existing file access property list + // using the property list id. + LinkAccPropList (const hid_t plist_id); - // Noop destructor - virtual ~LinkAccPropList(); + // Noop destructor + virtual ~LinkAccPropList(); #ifndef DOXYGEN_SHOULD_SKIP_THIS diff --git a/c++/src/H5Library.cpp b/c++/src/H5Library.cpp index 0ee6b4d..dc453b7 100644 --- a/c++/src/H5Library.cpp +++ b/c++/src/H5Library.cpp @@ -38,46 +38,46 @@ namespace H5 { //-------------------------------------------------------------------------- -// Function: H5Library::open (static) -///\brief Initializes the HDF5 library. +// Function: H5Library::open (static) +///\brief Initializes the HDF5 library. /// -///\exception H5::LibraryIException -// Programmer Binh-Minh Ribler - 2000 +///\exception H5::LibraryIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void H5Library::open() { - herr_t ret_value = H5open(); - if( ret_value < 0 ) - { - throw LibraryIException("H5Library::open", "H5open failed"); - } + herr_t ret_value = H5open(); + if (ret_value < 0) + { + throw LibraryIException("H5Library::open", "H5open failed"); + } } //-------------------------------------------------------------------------- -// Function: H5Library::close (static) -///\brief Flushes all data to disk, closes files, and cleans up memory. +// Function: H5Library::close (static) +///\brief Flushes all data to disk, closes files, and cleans up memory. /// -///\exception H5::LibraryIException -// Programmer Binh-Minh Ribler - 2000 +///\exception H5::LibraryIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void H5Library::close() { - herr_t ret_value = H5close(); - if( ret_value < 0 ) - { - throw LibraryIException("H5Library::close", "H5close failed"); - } + herr_t ret_value = H5close(); + if (ret_value < 0) + { + throw LibraryIException("H5Library::close", "H5close failed"); + } } //-------------------------------------------------------------------------- -// Function: H5Library::dontAtExit (static) -///\brief Instructs library not to install the C \c atexit cleanup routine +// Function: H5Library::dontAtExit (static) +///\brief Instructs library not to install the C \c atexit cleanup routine /// -///\exception H5::LibraryIException -// Programmer Binh-Minh Ribler - 2000 +///\exception H5::LibraryIException +// Programmer Binh-Minh Ribler - 2000 // Modification -// Removed the check for failure returned from H5dont_atexit. -// will be fixed to not fail (HDFFV-9540) +// Removed the check for failure returned from H5dont_atexit. +// will be fixed to not fail (HDFFV-9540) //-------------------------------------------------------------------------- void H5Library::dontAtExit() { @@ -85,80 +85,80 @@ void H5Library::dontAtExit() } //-------------------------------------------------------------------------- -// Function: H5Library::getLibVersion (static) -///\brief Returns the HDF library release number. -///\param majnum - OUT: Major version of the library -///\param minnum - OUT: Minor version of the library -///\param relnum - OUT: Release number of the library -///\exception H5::LibraryIException -// Programmer Binh-Minh Ribler - 2000 +// Function: H5Library::getLibVersion (static) +///\brief Returns the HDF library release number. +///\param majnum - OUT: Major version of the library +///\param minnum - OUT: Minor version of the library +///\param relnum - OUT: Release number of the library +///\exception H5::LibraryIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -void H5Library::getLibVersion( unsigned& majnum, unsigned& minnum, unsigned& relnum ) +void H5Library::getLibVersion(unsigned& majnum, unsigned& minnum, unsigned& relnum) { - herr_t ret_value = H5get_libversion( &majnum, &minnum, &relnum ); - if( ret_value < 0 ) - { - throw LibraryIException("H5Library::getLibVersion", "H5get_libversion failed"); - } + herr_t ret_value = H5get_libversion(&majnum, &minnum, &relnum); + if (ret_value < 0) + { + throw LibraryIException("H5Library::getLibVersion", "H5get_libversion failed"); + } } //-------------------------------------------------------------------------- -// Function: H5Library::checkVersion (static) -///\brief Verifies that the arguments match the version numbers -/// compiled into the library -///\param majnum - IN: Major version of the library -///\param minnum - IN: Minor version of the library -///\param relnum - IN: Release number of the library -///\exception H5::LibraryIException +// Function: H5Library::checkVersion (static) +///\brief Verifies that the arguments match the version numbers +/// compiled into the library +///\param majnum - IN: Major version of the library +///\param minnum - IN: Minor version of the library +///\param relnum - IN: Release number of the library +///\exception H5::LibraryIException ///\par Description -/// For information about library version, please refer to -/// the C layer Reference Manual at: +/// For information about library version, please refer to +/// the C layer Reference Manual at: /// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5.html#Library-VersCheck -// Programmer Binh-Minh Ribler - 2000 +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void H5Library::checkVersion(unsigned majnum, unsigned minnum, unsigned relnum) { - herr_t ret_value = H5check_version(majnum, minnum, relnum); - if( ret_value < 0 ) - { - throw LibraryIException("H5Library::checkVersion", "H5check_version failed"); - } + herr_t ret_value = H5check_version(majnum, minnum, relnum); + if (ret_value < 0) + { + throw LibraryIException("H5Library::checkVersion", "H5check_version failed"); + } } //-------------------------------------------------------------------------- -// Function: H5Library::garbageCollect (static) -///\brief Walks through all the garbage collection routines for the -/// library, which are supposed to free any unused memory they -/// have allocated. +// Function: H5Library::garbageCollect (static) +///\brief Walks through all the garbage collection routines for the +/// library, which are supposed to free any unused memory they +/// have allocated. /// -///\exception H5::LibraryIException +///\exception H5::LibraryIException ///\par Description -/// It is not required that H5Library::garbageCollect be called -/// at any particular time; it is only necessary in certain -/// situations, such as when the application has performed actions -/// that cause the library to allocate many objects. The -/// application should call H5Library::garbageCollect if it -/// eventually releases those objects and wants to reduce the -/// memory used by the library from the peak usage required. +/// It is not required that H5Library::garbageCollect be called +/// at any particular time; it is only necessary in certain +/// situations, such as when the application has performed actions +/// that cause the library to allocate many objects. The +/// application should call H5Library::garbageCollect if it +/// eventually releases those objects and wants to reduce the +/// memory used by the library from the peak usage required. ///\par -/// The library automatically garbage collects all the free -/// lists when the application ends. -// Programmer Binh-Minh Ribler - May, 2004 +/// The library automatically garbage collects all the free +/// lists when the application ends. +// Programmer Binh-Minh Ribler - May, 2004 //-------------------------------------------------------------------------- void H5Library::garbageCollect() { - herr_t ret_value = H5garbage_collect(); - if( ret_value < 0 ) - { - throw LibraryIException("H5Library::garbageCollect", "H5garbage_collect failed"); - } + herr_t ret_value = H5garbage_collect(); + if (ret_value < 0) + { + throw LibraryIException("H5Library::garbageCollect", "H5garbage_collect failed"); + } } //-------------------------------------------------------------------------- // Function: H5Library::initH5cpp (static) ///\brief Initializes C++ library and registers terminating functions at -/// exit. Only for the library functions, not for user-defined -/// functions. +/// exit. Only for the library functions, not for user-defined +/// functions. // Description // initH5cpp registers the following functions with std::atexit(): // termH5cpp() - calls H5close() after all cleanup in @@ -231,45 +231,45 @@ void H5Library::termH5cpp() } //-------------------------------------------------------------------------- -// Function: H5Library::setFreeListLimits (static) -///\brief Sets limits on the different kinds of free lists. -///\param reg_global_lim - IN: Limit on all "regular" free list memory used -///\param reg_list_lim - IN: Limit on memory used in each "regular" free list -///\param arr_global_lim - IN: Limit on all "array" free list memory used -///\param arr_list_lim - IN: Limit on memory used in each "array" free list -///\param blk_global_lim - IN: Limit on all "block" free list memory used -///\param blk_list_lim - IN: Limit on memory used in each "block" free list -///\exception H5::LibraryIException +// Function: H5Library::setFreeListLimits (static) +///\brief Sets limits on the different kinds of free lists. +///\param reg_global_lim - IN: Limit on all "regular" free list memory used +///\param reg_list_lim - IN: Limit on memory used in each "regular" free list +///\param arr_global_lim - IN: Limit on all "array" free list memory used +///\param arr_list_lim - IN: Limit on memory used in each "array" free list +///\param blk_global_lim - IN: Limit on all "block" free list memory used +///\param blk_list_lim - IN: Limit on memory used in each "block" free list +///\exception H5::LibraryIException ///\par Description -/// Setting a value of -1 for a limit means no limit of that type. -/// For more information on free list limits, please refer to C -/// layer Reference Manual at: +/// Setting a value of -1 for a limit means no limit of that type. +/// For more information on free list limits, please refer to C +/// layer Reference Manual at: /// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5.html#Library-SetFreeListLimits -// Programmer Binh-Minh Ribler - May, 2004 +// Programmer Binh-Minh Ribler - May, 2004 //-------------------------------------------------------------------------- void H5Library::setFreeListLimits(int reg_global_lim, int reg_list_lim, - int arr_global_lim, int arr_list_lim, int blk_global_lim, - int blk_list_lim) + int arr_global_lim, int arr_list_lim, int blk_global_lim, + int blk_list_lim) { - herr_t ret_value = H5set_free_list_limits(reg_global_lim, reg_list_lim, arr_global_lim, arr_list_lim, blk_global_lim, blk_list_lim); - if( ret_value < 0 ) - { - throw LibraryIException("H5Library::setFreeListLimits", "H5set_free_list_limits failed"); - } + herr_t ret_value = H5set_free_list_limits(reg_global_lim, reg_list_lim, arr_global_lim, arr_list_lim, blk_global_lim, blk_list_lim); + if (ret_value < 0) + { + throw LibraryIException("H5Library::setFreeListLimits", "H5set_free_list_limits failed"); + } } #ifndef DOXYGEN_SHOULD_SKIP_THIS //-------------------------------------------------------------------------- -// Function: H5Library default constructor - private -///\brief Default constructor: Creates a stub H5Library object -// Programmer Binh-Minh Ribler - 2000 +// Function: H5Library default constructor - private +///\brief Default constructor: Creates a stub H5Library object +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- H5Library::H5Library(){} //-------------------------------------------------------------------------- -// Function: H5Library destructor -///\brief Noop destructor -// Programmer Binh-Minh Ribler - 2000 +// Function: H5Library destructor +///\brief Noop destructor +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- H5Library::~H5Library(){} #endif // DOXYGEN_SHOULD_SKIP_THIS diff --git a/c++/src/H5Library.h b/c++/src/H5Library.h index 694b052..018ba38 100644 --- a/c++/src/H5Library.h +++ b/c++/src/H5Library.h @@ -27,32 +27,32 @@ namespace H5 { */ class H5_DLLCPP H5Library { public: - // Initializes the HDF5 library. - static void open(); + // Initializes the HDF5 library. + static void open(); - // Flushes all data to disk, closes files, and cleans up memory. - static void close(); + // Flushes all data to disk, closes files, and cleans up memory. + static void close(); - // Instructs library not to install atexit cleanup routine - static void dontAtExit(); + // Instructs library not to install atexit cleanup routine + static void dontAtExit(); - // Returns the HDF library release number. - static void getLibVersion( unsigned& majnum, unsigned& minnum, unsigned& relnum ); + // Returns the HDF library release number. + static void getLibVersion(unsigned& majnum, unsigned& minnum, unsigned& relnum); - // Verifies that the arguments match the version numbers compiled - // into the library - static void checkVersion( unsigned majnum, unsigned minnum, unsigned relnum ); + // Verifies that the arguments match the version numbers compiled + // into the library + static void checkVersion(unsigned majnum, unsigned minnum, unsigned relnum); - // Walks through all the garbage collection routines for the library, - // which are supposed to free any unused memory they have allocated. - static void garbageCollect(); + // Walks through all the garbage collection routines for the library, + // which are supposed to free any unused memory they have allocated. + static void garbageCollect(); - // Sets limits on the different kinds of free lists. - static void setFreeListLimits(int reg_global_lim, int reg_list_lim, int - arr_global_lim, int arr_list_lim, int blk_global_lim, int blk_list_lim); + // Sets limits on the different kinds of free lists. + static void setFreeListLimits(int reg_global_lim, int reg_list_lim, int + arr_global_lim, int arr_list_lim, int blk_global_lim, int blk_list_lim); // Initializes C++ library and registers terminating functions at exit. - // Only for the library functions, not for user-defined functions. + // Only for the library functions, not for user-defined functions. static void initH5cpp(void); // Sends request for terminating the HDF5 library. diff --git a/c++/src/H5Location.cpp b/c++/src/H5Location.cpp index a3e6738..5a0bb73 100644 --- a/c++/src/H5Location.cpp +++ b/c++/src/H5Location.cpp @@ -15,7 +15,7 @@ #include -#include "H5private.h" // for HDmemset +#include "H5private.h" // for HDmemset #include "H5Include.h" #include "H5Exception.h" #include "H5IdComponent.h" @@ -40,17 +40,17 @@ namespace H5 { #ifndef DOXYGEN_SHOULD_SKIP_THIS //-------------------------------------------------------------------------- -// Function: H5Location default constructor (protected) -// Programmer Binh-Minh Ribler - 2000 +// Function: H5Location default constructor (protected) +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- H5Location::H5Location() : IdComponent() {} //-------------------------------------------------------------------------- -// Function: H5Location overloaded constructor (protected) -// Purpose Creates an H5Location object using the id of an existing HDF5 -// object. -// Parameters object_id - IN: Id of an existing HDF5 object -// Programmer Binh-Minh Ribler - 2000 +// Function: H5Location overloaded constructor (protected) +// Purpose Creates an H5Location object using the id of an existing HDF5 +// object. +// Parameters object_id - IN: Id of an existing HDF5 object +// Programmer Binh-Minh Ribler - 2000 // *** Deprecation warning *** // This constructor is no longer appropriate because the data member "id" had @@ -62,11 +62,11 @@ H5Location::H5Location() : IdComponent() {} // H5Location::H5Location(const hid_t object_id) : IdComponent() {} //-------------------------------------------------------------------------- -// Function: H5Location copy constructor -// Purpose: This noop copy constructor is removed as a result of the data -// member "id" being moved down to sub-classes. (Mar 2015) -///\param original - IN: H5Location instance to copy -// Programmer Binh-Minh Ribler - 2000 +// Function: H5Location copy constructor +// Purpose This noop copy constructor is removed as a result of the data +// member "id" being moved down to sub-classes. (Mar 2015) +///\param original - IN: H5Location instance to copy +// Programmer Binh-Minh Ribler - 2000 // // *** Deprecation warning *** // This constructor is no longer appropriate because the data member "id" had @@ -78,34 +78,34 @@ H5Location::H5Location() : IdComponent() {} #endif // DOXYGEN_SHOULD_SKIP_THIS //-------------------------------------------------------------------------- -// Function: H5Location::exists -///\brief Checks if a link of a given name exists in a location -///\param name - IN: Searched name -///\param lapl - IN: Link access property list -///\exception H5::LocationException -// Programmer Binh-Minh Ribler - Nov, 2016 +// Function: H5Location::exists +///\brief Checks if a link of a given name exists in a location +///\param name - IN: Searched name +///\param lapl - IN: Link access property list +///\exception H5::LocationException +// Programmer Binh-Minh Ribler - Nov, 2016 // Modification //-------------------------------------------------------------------------- bool H5Location::exists(const char* name, const LinkAccPropList& lapl) const { htri_t ret_value = H5Lexists(getId(), name, lapl.getId()); if (ret_value > 0) - return true; + return true; else if (ret_value == 0) - return false; + return false; else // Raise exception when H5Lexists returns a negative value { - throwException("exists", "H5Lexists failed"); + throwException("exists", "H5Lexists failed"); } } //-------------------------------------------------------------------------- -// Function: H5Location::exists -///\brief Checks if a link of a given name exists in a location -///\param name - IN: Searched name -///\param lapl - IN: Link access property list -///\exception H5::LocationException -// Programmer Binh-Minh Ribler - Dec, 2016 +// Function: H5Location::exists +///\brief Checks if a link of a given name exists in a location +///\param name - IN: Searched name +///\param lapl - IN: Link access property list +///\exception H5::LocationException +// Programmer Binh-Minh Ribler - Dec, 2016 // Modification //-------------------------------------------------------------------------- bool H5Location::exists(const H5std_string& name, const LinkAccPropList& lapl) const @@ -114,156 +114,156 @@ bool H5Location::exists(const H5std_string& name, const LinkAccPropList& lapl) c } //-------------------------------------------------------------------------- -// Function: H5Location::flush -///\brief Flushes all buffers associated with a location to disk. -///\param scope - IN: Specifies the scope of the flushing action, -/// which can be either of these values: -/// \li \c H5F_SCOPE_GLOBAL - Flushes the entire virtual file -/// \li \c H5F_SCOPE_LOCAL - Flushes only the specified file -///\exception H5::Exception +// Function: H5Location::flush +///\brief Flushes all buffers associated with a location to disk. +///\param scope - IN: Specifies the scope of the flushing action, +/// which can be either of these values: +/// \li \c H5F_SCOPE_GLOBAL - Flushes the entire virtual file +/// \li \c H5F_SCOPE_LOCAL - Flushes only the specified file +///\exception H5::Exception ///\par Description -/// This location is used to identify the file to be flushed. -// Programmer Binh-Minh Ribler - 2012 +/// This location is used to identify the file to be flushed. +// Programmer Binh-Minh Ribler - 2012 // Modification -// Sep 2012 - BMR -// Moved from H5File/H5Object +// Sep 2012 - BMR +// Moved from H5File/H5Object //-------------------------------------------------------------------------- void H5Location::flush(H5F_scope_t scope) const { - herr_t ret_value = H5Fflush(getId(), scope); - if( ret_value < 0 ) - { - throw LocationException(inMemFunc("flush"), "H5Fflush failed"); - } + herr_t ret_value = H5Fflush(getId(), scope); + if (ret_value < 0) + { + throw LocationException(inMemFunc("flush"), "H5Fflush failed"); + } } //-------------------------------------------------------------------------- -// Function: H5Location::getFileName -///\brief Gets the name of the file, in which this HDF5 object belongs. -///\return File name -///\exception H5::LocationException -// Programmer Binh-Minh Ribler - Jul, 2004 +// Function: H5Location::getFileName +///\brief Gets the name of the file, in which this HDF5 object belongs. +///\return File name +///\exception H5::LocationException +// Programmer Binh-Minh Ribler - Jul, 2004 //-------------------------------------------------------------------------- H5std_string H5Location::getFileName() const { - try { + try { return(p_get_file_name()); - } - catch (LocationException& E) { - throw FileIException(inMemFunc("getFileName"), E.getDetailMsg()); - } -} - -//-------------------------------------------------------------------------- -// Function: H5Location::setComment -///\brief Sets or resets the comment for an object specified by its name. -///\param name - IN: Name of the object -///\param comment - IN: New comment -///\exception H5::LocationException -///\par Description -/// If \a comment is an empty string or a null pointer, the comment -/// message is removed from the object. -/// Comments should be relatively short, null-terminated, ASCII -/// strings. They can be attached to any object that has an -/// object header, e.g., data sets, groups, named data types, -/// and data spaces, but not symbolic links. -// Programmer Binh-Minh Ribler - 2000 (moved from CommonFG, Sep 2013) + } + catch (LocationException& E) { + throw FileIException(inMemFunc("getFileName"), E.getDetailMsg()); + } +} + +//-------------------------------------------------------------------------- +// Function: H5Location::setComment +///\brief Sets or resets the comment for an object specified by its name. +///\param name - IN: Name of the object +///\param comment - IN: New comment +///\exception H5::LocationException +///\par Description +/// If \a comment is an empty string or a null pointer, the comment +/// message is removed from the object. +/// Comments should be relatively short, null-terminated, ASCII +/// strings. They can be attached to any object that has an +/// object header, e.g., data sets, groups, named data types, +/// and data spaces, but not symbolic links. +// Programmer Binh-Minh Ribler - 2000 (moved from CommonFG, Sep 2013) // Modification -// 2007: QAK modified to use H5O APIs; however the first parameter is -// no longer just file or group, this function should be moved -// to another class to accommodate attribute, dataset, and named -// datatype. - BMR +// 2007: QAK modified to use H5O APIs; however the first parameter is +// no longer just file or group, this function should be moved +// to another class to accommodate attribute, dataset, and named +// datatype. - BMR //-------------------------------------------------------------------------- void H5Location::setComment(const char* name, const char* comment) const { - herr_t ret_value = H5Oset_comment_by_name(getId(), name, comment, H5P_DEFAULT); - if( ret_value < 0 ) - throw LocationException(inMemFunc("setComment"), "H5Oset_comment_by_name failed"); + herr_t ret_value = H5Oset_comment_by_name(getId(), name, comment, H5P_DEFAULT); + if (ret_value < 0) + throw LocationException(inMemFunc("setComment"), "H5Oset_comment_by_name failed"); } //-------------------------------------------------------------------------- -// Function: H5Location::setComment -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function in that it takes an -/// \c H5std_string for \a name and \a comment. -// Programmer Binh-Minh Ribler - 2000 (moved from CommonFG, Sep 2013) +// Function: H5Location::setComment +///\brief This is an overloaded member function, provided for convenience. +/// It differs from the above function in that it takes an +/// \c H5std_string for \a name and \a comment. +// Programmer Binh-Minh Ribler - 2000 (moved from CommonFG, Sep 2013) //-------------------------------------------------------------------------- void H5Location::setComment(const H5std_string& name, const H5std_string& comment) const { - setComment(name.c_str(), comment.c_str()); + setComment(name.c_str(), comment.c_str()); } //-------------------------------------------------------------------------- -// Function: H5Location::setComment -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function in that it doesn't take -/// an object name. -// Programmer Binh-Minh Ribler - Sep 2013 +// Function: H5Location::setComment +///\brief This is an overloaded member function, provided for convenience. +/// It differs from the above function in that it doesn't take +/// an object name. +// Programmer Binh-Minh Ribler - Sep 2013 // Modification //-------------------------------------------------------------------------- void H5Location::setComment(const char* comment) const { - herr_t ret_value = H5Oset_comment_by_name(getId(), ".", comment, H5P_DEFAULT); - if( ret_value < 0 ) - throw LocationException(inMemFunc("setComment"), "H5Oset_comment_by_name failed"); + herr_t ret_value = H5Oset_comment_by_name(getId(), ".", comment, H5P_DEFAULT); + if (ret_value < 0) + throw LocationException(inMemFunc("setComment"), "H5Oset_comment_by_name failed"); } //-------------------------------------------------------------------------- -// Function: H5Location::setComment -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function in that it takes an -/// \c H5std_string for \a comment. -// Programmer Binh-Minh Ribler - Sep 2013 +// Function: H5Location::setComment +///\brief This is an overloaded member function, provided for convenience. +/// It differs from the above function in that it takes an +/// \c H5std_string for \a comment. +// Programmer Binh-Minh Ribler - Sep 2013 //-------------------------------------------------------------------------- void H5Location::setComment(const H5std_string& comment) const { - setComment(comment.c_str()); + setComment(comment.c_str()); } //-------------------------------------------------------------------------- -// Function: H5Location::removeComment -///\brief Removes the comment from an object specified by its name. -///\param name - IN: Name of the object -///\exception H5::LocationException -// Programmer Binh-Minh Ribler - May 2005 (moved from CommonFG, Sep 2013) -// 2007: QAK modified to use H5O APIs; however the first parameter is -// no longer just file or group, this function should be moved -// to another class to accommodate attribute, dataset, and named -// datatype. - BMR +// Function: H5Location::removeComment +///\brief Removes the comment from an object specified by its name. +///\param name - IN: Name of the object +///\exception H5::LocationException +// Programmer Binh-Minh Ribler - May 2005 (moved from CommonFG, Sep 2013) +// 2007: QAK modified to use H5O APIs; however the first parameter is +// no longer just file or group, this function should be moved +// to another class to accommodate attribute, dataset, and named +// datatype. - BMR //-------------------------------------------------------------------------- void H5Location::removeComment(const char* name) const { - herr_t ret_value = H5Oset_comment_by_name(getId(), name, NULL, H5P_DEFAULT); - if( ret_value < 0 ) - throw LocationException(inMemFunc("removeComment"), "H5Oset_comment_by_name failed"); + herr_t ret_value = H5Oset_comment_by_name(getId(), name, NULL, H5P_DEFAULT); + if (ret_value < 0) + throw LocationException(inMemFunc("removeComment"), "H5Oset_comment_by_name failed"); } //-------------------------------------------------------------------------- -// Function: H5Location::removeComment -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function in that it takes an -/// \c H5std_string for \a name. -// Programmer Binh-Minh Ribler - May 2005 (moved from CommonFG, Sep 2013) +// Function: H5Location::removeComment +///\brief This is an overloaded member function, provided for convenience. +/// It differs from the above function in that it takes an +/// \c H5std_string for \a name. +// Programmer Binh-Minh Ribler - May 2005 (moved from CommonFG, Sep 2013) //-------------------------------------------------------------------------- void H5Location::removeComment(const H5std_string& name) const { - removeComment (name.c_str()); + removeComment (name.c_str()); } //-------------------------------------------------------------------------- -// Function: H5Location::getComment -///\brief Retrieves the comment for this location, returning its length. -///\param name - IN: Name of the object -///\param buf_size - IN: Length of the comment to retrieve -///\param comment - OUT: Retrieved comment -///\return Actual length of the comment -///\exception H5::LocationException +// Function: H5Location::getComment +///\brief Retrieves the comment for this location, returning its length. +///\param name - IN: Name of the object +///\param buf_size - IN: Length of the comment to retrieve +///\param comment - OUT: Retrieved comment +///\return Actual length of the comment +///\exception H5::LocationException ///\par Description -/// This function retrieves \a buf_size characters of the comment -/// including the null terminator. Thus, if the actual length -/// of the comment is more than buf_size-1, the retrieved comment -/// will be truncated to accommodate the null terminator. -// Programmer Binh-Minh Ribler - Mar 2014 +/// This function retrieves \a buf_size characters of the comment +/// including the null terminator. Thus, if the actual length +/// of the comment is more than buf_size-1, the retrieved comment +/// will be truncated to accommodate the null terminator. +// Programmer Binh-Minh Ribler - Mar 2014 //-------------------------------------------------------------------------- ssize_t H5Location::getComment(const char* name, size_t buf_size, char* comment) const { @@ -274,27 +274,27 @@ ssize_t H5Location::getComment(const char* name, size_t buf_size, char* comment) // If H5Oget_comment_by_name returns a negative value, raise an exception if (comment_len < 0) - { + { throw LocationException("H5Location::getComment", "H5Oget_comment_by_name failed"); } // If the comment is longer than the provided buffer size, the C library // will not null terminate it if (static_cast(comment_len) >= buf_size) - comment[buf_size-1] = '\0'; + comment[buf_size-1] = '\0'; // Return the actual comment length, which might be different from buf_size return(comment_len); } //-------------------------------------------------------------------------- -// Function: H5Location::getComment -///\brief Returns the comment as \a string for this location, -/// returning its length. -///\param name - IN: Name of the object -///\param buf_size - IN: Length of the comment to retrieve, default to 0 -///\return Comment string -///\exception H5::LocationException -// Programmer Binh-Minh Ribler - 2000 (moved from CommonFG, Sep 2013) +// Function: H5Location::getComment +///\brief Returns the comment as \a string for this location, +/// returning its length. +///\param name - IN: Name of the object +///\param buf_size - IN: Length of the comment to retrieve, default to 0 +///\return Comment string +///\exception H5::LocationException +// Programmer Binh-Minh Ribler - 2000 (moved from CommonFG, Sep 2013) //-------------------------------------------------------------------------- H5std_string H5Location::getComment(const char* name, size_t buf_size) const { @@ -307,36 +307,36 @@ H5std_string H5Location::getComment(const char* name, size_t buf_size) const // If H5Oget_comment_by_name returns a negative value, raise an exception if (comment_len < 0) - { + { throw LocationException("H5Location::getComment", "H5Oget_comment_by_name failed"); } // If comment exists, calls C routine again to get it else if (comment_len > 0) - { - size_t tmp_len = buf_size; - - // If buffer size is not provided, use comment length - if (tmp_len == 0) - tmp_len = comment_len; - - // Temporary buffer for char* comment - char* comment_C = new char[tmp_len+1]; - HDmemset(comment_C, 0, tmp_len+1); // clear buffer - - // Used overloaded function - ssize_t temp_len = getComment(name, tmp_len+1, comment_C); - if (temp_len < 0) - { - delete []comment_C; - throw LocationException("H5Location::getComment", "H5Oget_comment_by_name failed"); - } - - // Convert the C comment to return - comment = comment_C; - - // Clean up resource - delete []comment_C; + { + size_t tmp_len = buf_size; + + // If buffer size is not provided, use comment length + if (tmp_len == 0) + tmp_len = comment_len; + + // Temporary buffer for char* comment + char* comment_C = new char[tmp_len+1]; + HDmemset(comment_C, 0, tmp_len+1); // clear buffer + + // Used overloaded function + ssize_t temp_len = getComment(name, tmp_len+1, comment_C); + if (temp_len < 0) + { + delete []comment_C; + throw LocationException("H5Location::getComment", "H5Oget_comment_by_name failed"); + } + + // Convert the C comment to return + comment = comment_C; + + // Clean up resource + delete []comment_C; } // Return the string comment @@ -344,11 +344,11 @@ H5std_string H5Location::getComment(const char* name, size_t buf_size) const } //-------------------------------------------------------------------------- -// Function: H5Location::getComment -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function in that it takes an -/// \c H5std_string for \a name. -// Programmer Binh-Minh Ribler - 2000 (moved from CommonFG, Sep 2013) +// Function: H5Location::getComment +///\brief This is an overloaded member function, provided for convenience. +/// It differs from the above function in that it takes an +/// \c H5std_string for \a name. +// Programmer Binh-Minh Ribler - 2000 (moved from CommonFG, Sep 2013) //-------------------------------------------------------------------------- H5std_string H5Location::getComment(const H5std_string& name, size_t buf_size) const { @@ -357,112 +357,112 @@ H5std_string H5Location::getComment(const H5std_string& name, size_t buf_size) c #ifndef DOXYGEN_SHOULD_SKIP_THIS //-------------------------------------------------------------------------- -// Function: H5Location::p_reference (protected) -// Purpose Creates a reference to an HDF5 object or a dataset region. +// Function: H5Location::p_reference (protected) +// Purpose Creates a reference to an HDF5 object or a dataset region. // Parameters -// name - IN: Name of the object to be referenced -// dataspace - IN: Dataspace with selection -// ref_type - IN: Type of reference; default to \c H5R_DATASET_REGION -// Exception H5::ReferenceException -// Programmer Binh-Minh Ribler - May, 2004 +// name - IN: Name of the object to be referenced +// dataspace - IN: Dataspace with selection +// ref_type - IN: Type of reference; default to \c H5R_DATASET_REGION +// Exception H5::ReferenceException +// Programmer Binh-Minh Ribler - May, 2004 //-------------------------------------------------------------------------- void H5Location::p_reference(void* ref, const char* name, hid_t space_id, H5R_type_t ref_type) const { - herr_t ret_value = H5Rcreate(ref, getId(), name, ref_type, space_id); - if (ret_value < 0) - { - throw ReferenceException(inMemFunc("reference"), "H5Rcreate failed"); - } + herr_t ret_value = H5Rcreate(ref, getId(), name, ref_type, space_id); + if (ret_value < 0) + { + throw ReferenceException(inMemFunc("reference"), "H5Rcreate failed"); + } } #endif // DOXYGEN_SHOULD_SKIP_THIS //-------------------------------------------------------------------------- -// Function: H5Location::reference -///\brief Creates a reference to an HDF5 object or a dataset region. -///\param ref - IN: Reference pointer -///\param name - IN: Name of the object to be referenced -///\param dataspace - IN: Dataspace with selection -///\param ref_type - IN: Type of reference to query, valid values are: -/// \li \c H5R_OBJECT - Reference is an object reference. -/// \li \c H5R_DATASET_REGION - Reference is a dataset region -/// reference. (default) -///\exception H5::ReferenceException -///\note This method is more suitable for a dataset region reference. -// Programmer Binh-Minh Ribler - May, 2004 +// Function: H5Location::reference +///\brief Creates a reference to an HDF5 object or a dataset region. +///\param ref - IN: Reference pointer +///\param name - IN: Name of the object to be referenced +///\param dataspace - IN: Dataspace with selection +///\param ref_type - IN: Type of reference to query, valid values are: +/// \li \c H5R_OBJECT - Reference is an object reference. +/// \li \c H5R_DATASET_REGION - Reference is a dataset region +/// reference. (default) +///\exception H5::ReferenceException +///\note This method is more suitable for a dataset region reference. +// Programmer Binh-Minh Ribler - May, 2004 //-------------------------------------------------------------------------- void H5Location::reference(void* ref, const char* name, const DataSpace& dataspace, H5R_type_t ref_type) const { - try { - p_reference(ref, name, dataspace.getId(), ref_type); - } - catch (ReferenceException& E) { - throw ReferenceException(inMemFunc("reference"), E.getDetailMsg()); - } -} - -//-------------------------------------------------------------------------- -// Function: H5Location::reference -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function in that it takes an -/// \c H5std_string for \a name. -///\param ref - IN: Reference pointer -///\param name - IN: Name of the object to be referenced -///\param dataspace - IN: Dataspace with selection -///\param ref_type - IN: Type of reference to query, valid values are: -/// \li \c H5R_OBJECT - Reference is an object reference. -/// \li \c H5R_DATASET_REGION - Reference is a dataset region -/// reference. (default) -///\exception H5::ReferenceException -///\note This method is more suitable for a dataset region reference. -// Programmer Binh-Minh Ribler - May, 2004 + try { + p_reference(ref, name, dataspace.getId(), ref_type); + } + catch (ReferenceException& E) { + throw ReferenceException(inMemFunc("reference"), E.getDetailMsg()); + } +} + +//-------------------------------------------------------------------------- +// Function: H5Location::reference +///\brief This is an overloaded member function, provided for convenience. +/// It differs from the above function in that it takes an +/// \c H5std_string for \a name. +///\param ref - IN: Reference pointer +///\param name - IN: Name of the object to be referenced +///\param dataspace - IN: Dataspace with selection +///\param ref_type - IN: Type of reference to query, valid values are: +/// \li \c H5R_OBJECT - Reference is an object reference. +/// \li \c H5R_DATASET_REGION - Reference is a dataset region +/// reference. (default) +///\exception H5::ReferenceException +///\note This method is more suitable for a dataset region reference. +// Programmer Binh-Minh Ribler - May, 2004 //-------------------------------------------------------------------------- void H5Location::reference(void* ref, const H5std_string& name, const DataSpace& dataspace, H5R_type_t ref_type) const { - try { - p_reference(ref, name.c_str(), dataspace.getId(), ref_type); - } - catch (ReferenceException& E) { - throw ReferenceException(inMemFunc("reference"), E.getDetailMsg()); - } + try { + p_reference(ref, name.c_str(), dataspace.getId(), ref_type); + } + catch (ReferenceException& E) { + throw ReferenceException(inMemFunc("reference"), E.getDetailMsg()); + } } //-------------------------------------------------------------------------- -// Function: H5Location::reference -///\brief This is an overloaded function, provided for your convenience. -/// It differs from the above function in that it does not take -/// a DataSpace object and the reference type must be specified. -///\param ref - IN: Reference pointer -///\param name - IN: Name of the object to be referenced -///\param ref_type - IN: Type of reference to query, valid values are: -/// \li \c H5R_OBJECT - Reference is an object reference (default) -/// \li \c H5R_DATASET_REGION - Reference is a dataset region -///\exception H5::ReferenceException -///\note This method is more suitable for an object reference. -// Programmer Binh-Minh Ribler - May, 2004 +// Function: H5Location::reference +///\brief This is an overloaded function, provided for your convenience. +/// It differs from the above function in that it does not take +/// a DataSpace object and the reference type must be specified. +///\param ref - IN: Reference pointer +///\param name - IN: Name of the object to be referenced +///\param ref_type - IN: Type of reference to query, valid values are: +/// \li \c H5R_OBJECT - Reference is an object reference (default) +/// \li \c H5R_DATASET_REGION - Reference is a dataset region +///\exception H5::ReferenceException +///\note This method is more suitable for an object reference. +// Programmer Binh-Minh Ribler - May, 2004 //-------------------------------------------------------------------------- void H5Location::reference(void* ref, const char* name, H5R_type_t ref_type) const { - try { - p_reference(ref, name, -1, ref_type); - } - catch (ReferenceException& E) { - throw ReferenceException(inMemFunc("reference"), E.getDetailMsg()); - } + try { + p_reference(ref, name, -1, ref_type); + } + catch (ReferenceException& E) { + throw ReferenceException(inMemFunc("reference"), E.getDetailMsg()); + } } //-------------------------------------------------------------------------- -// Function: H5Location::reference -///\brief This is an overloaded function, provided for your convenience. -/// It differs from the above function in that it takes an -/// \c H5std_string for the object's name. -///\param ref - IN: Reference pointer -///\param name - IN: Name of the object to be referenced - \c H5std_string -///\param ref_type - IN: Type of reference to query, valid values are: -/// \li \c H5R_OBJECT - Reference is an object reference (default) -/// \li \c H5R_DATASET_REGION - Reference is a dataset region -///\note This method is more suitable for an object reference. -// Programmer Binh-Minh Ribler - May, 2004 +// Function: H5Location::reference +///\brief This is an overloaded function, provided for your convenience. +/// It differs from the above function in that it takes an +/// \c H5std_string for the object's name. +///\param ref - IN: Reference pointer +///\param name - IN: Name of the object to be referenced - \c H5std_string +///\param ref_type - IN: Type of reference to query, valid values are: +/// \li \c H5R_OBJECT - Reference is an object reference (default) +/// \li \c H5R_DATASET_REGION - Reference is a dataset region +///\note This method is more suitable for an object reference. +// Programmer Binh-Minh Ribler - May, 2004 //-------------------------------------------------------------------------- void H5Location::reference(void* ref, const H5std_string& name, H5R_type_t ref_type) const { @@ -471,69 +471,69 @@ void H5Location::reference(void* ref, const H5std_string& name, H5R_type_t ref_t #ifndef DOXYGEN_SHOULD_SKIP_THIS //-------------------------------------------------------------------------- -// Function: H5Location::p_dereference (protected) -// Purpose Dereference a ref into an hdf5 object. +// Function: H5Location::p_dereference (protected) +// Purpose Dereference a ref into an hdf5 object. // Parameters -// loc_id - IN: An hdf5 identifier specifying the location of the -// referenced object -// ref - IN: Reference pointer -// ref_type - IN: Reference type -// plist - IN: Property list - default to PropList::DEFAULT -// from_func - IN: Name of the calling function -// Exception H5::ReferenceException -// Programmer Binh-Minh Ribler - Oct, 2006 +// loc_id - IN: An hdf5 identifier specifying the location of the +// referenced object +// ref - IN: Reference pointer +// ref_type - IN: Reference type +// plist - IN: Property list - default to PropList::DEFAULT +// from_func - IN: Name of the calling function +// Exception H5::ReferenceException +// Programmer Binh-Minh Ribler - Oct, 2006 // Modification -// May 2008 - BMR -// Moved from IdComponent. +// May 2008 - BMR +// Moved from IdComponent. //-------------------------------------------------------------------------- hid_t H5Location::p_dereference(hid_t loc_id, const void* ref, H5R_type_t ref_type, const PropList& plist, const char* from_func) { - hid_t plist_id; - if (p_valid_id(plist.getId())) - plist_id = plist.getId(); - else - plist_id = H5P_DEFAULT; + hid_t plist_id; + if (p_valid_id(plist.getId())) + plist_id = plist.getId(); + else + plist_id = H5P_DEFAULT; - hid_t temp_id = H5Rdereference2(loc_id, plist_id, ref_type, ref); - if (temp_id < 0) - { - throw ReferenceException(inMemFunc(from_func), "H5Rdereference failed"); - } + hid_t temp_id = H5Rdereference2(loc_id, plist_id, ref_type, ref); + if (temp_id < 0) + { + throw ReferenceException(inMemFunc(from_func), "H5Rdereference failed"); + } - return(temp_id); + return(temp_id); } #endif // DOXYGEN_SHOULD_SKIP_THIS //-------------------------------------------------------------------------- -// Function: H5Location::dereference -///\brief Dereferences a reference into an HDF5 object, given an HDF5 object. -///\param loc - IN: Location of the referenced object -///\param ref - IN: Reference pointer -///\param ref_type - IN: Reference type -///\param plist - IN: Property list - default to PropList::DEFAULT -///\exception H5::ReferenceException -// Programmer Binh-Minh Ribler - Oct, 2006 +// Function: H5Location::dereference +///\brief Dereferences a reference into an HDF5 object, given an HDF5 object. +///\param loc - IN: Location of the referenced object +///\param ref - IN: Reference pointer +///\param ref_type - IN: Reference type +///\param plist - IN: Property list - default to PropList::DEFAULT +///\exception H5::ReferenceException +// Programmer Binh-Minh Ribler - Oct, 2006 // Modification -// May, 2008 -// Corrected missing parameters. - BMR +// May, 2008 +// Corrected missing parameters. - BMR //-------------------------------------------------------------------------- void H5Location::dereference(const H5Location& loc, const void* ref, H5R_type_t ref_type, const PropList& plist) { - p_setId(p_dereference(loc.getId(), ref, ref_type, plist, "dereference")); + p_setId(p_dereference(loc.getId(), ref, ref_type, plist, "dereference")); } //-------------------------------------------------------------------------- -// Function: H5Location::dereference -///\brief Dereferences a reference into an HDF5 object, given an attribute. -///\param attr - IN: Attribute specifying the location of the referenced object -///\param ref - IN: Reference pointer -///\param ref_type - IN: Reference type -///\param plist - IN: Property list - default to PropList::DEFAULT -///\exception H5::ReferenceException -// Programmer Binh-Minh Ribler - Oct, 2006 +// Function: H5Location::dereference +///\brief Dereferences a reference into an HDF5 object, given an attribute. +///\param attr - IN: Attribute specifying the location of the referenced object +///\param ref - IN: Reference pointer +///\param ref_type - IN: Reference type +///\param plist - IN: Property list - default to PropList::DEFAULT +///\exception H5::ReferenceException +// Programmer Binh-Minh Ribler - Oct, 2006 // Modification -// May, 2008 -// Corrected missing parameters. - BMR +// May, 2008 +// Corrected missing parameters. - BMR //-------------------------------------------------------------------------- /* void H5Location::dereference(const Attribute& attr, const void* ref, H5R_type_t ref_type, const PropList& plist) { @@ -543,153 +543,152 @@ void H5Location::dereference(const H5Location& loc, const void* ref, H5R_type_t #ifndef H5_NO_DEPRECATED_SYMBOLS //-------------------------------------------------------------------------- -// Function: H5Location::getObjType -///\brief Retrieves the type of object that an object reference points to. -///\param ref_type - IN: Type of reference to query, valid values are: -/// \li \c H5R_OBJECT - Reference is an object reference. -/// \li \c H5R_DATASET_REGION - Reference is a dataset region reference. -///\param ref - IN: Reference to query -///\return An object type, which can be one of the following: -/// \li \c H5G_UNKNOWN - A failure occurs. (-1) -/// \li \c H5G_GROUP - Object is a group. -/// \li \c H5G_DATASET - Object is a dataset. -/// \li \c H5G_TYPE Object - is a named datatype -/// \li \c H5G_LINK - Object is a symbolic link. -/// \li \c H5G_UDLINK - Object is a user-defined link. -///\exception H5::ReferenceException -// Programmer Binh-Minh Ribler - May, 2004 +// Function: H5Location::getObjType +///\brief Retrieves the type of object that an object reference points to. +///\param ref_type - IN: Type of reference to query, valid values are: +/// \li \c H5R_OBJECT - Reference is an object reference. +/// \li \c H5R_DATASET_REGION - Reference is a dataset region reference. +///\param ref - IN: Reference to query +///\return An object type, which can be one of the following: +/// \li \c H5G_UNKNOWN - A failure occurs. (-1) +/// \li \c H5G_GROUP - Object is a group. +/// \li \c H5G_DATASET - Object is a dataset. +/// \li \c H5G_TYPE Object - is a named datatype +/// \li \c H5G_LINK - Object is a symbolic link. +/// \li \c H5G_UDLINK - Object is a user-defined link. +///\exception H5::ReferenceException +// Programmer Binh-Minh Ribler - May, 2004 // Modification -// Sep 2012: Moved up from H5File, Group, DataSet, and DataType +// Sep 2012: Moved up from H5File, Group, DataSet, and DataType //-------------------------------------------------------------------------- H5G_obj_t H5Location::getObjType(void *ref, H5R_type_t ref_type) const { - try { - return(p_get_obj_type(ref, ref_type)); - } - catch (ReferenceException& E) { - throw ReferenceException(inMemFunc("getObjType"), E.getDetailMsg()); - } + try { + return(p_get_obj_type(ref, ref_type)); + } + catch (ReferenceException& E) { + throw ReferenceException(inMemFunc("getObjType"), E.getDetailMsg()); + } } #ifndef DOXYGEN_SHOULD_SKIP_THIS //-------------------------------------------------------------------------- -// Function: H5Location::p_get_obj_type (protected) -// Purpose Retrieves the type of object that an object reference points to. +// Function: H5Location::p_get_obj_type (protected) +// Purpose Retrieves the type of object that an object reference points to. // Parameters -// ref - IN: Reference to query -// ref_type - IN: Type of reference to query -// Return An object type, which can be one of the following: -// H5G_UNKNOWN \tFailure occurs (-1) -// H5G_GROUP \tObject is a group. -// H5G_DATASET \tObject is a dataset. -// H5G_TYPE Object \tis a named datatype. -// H5G_LINK \tObject is a symbolic link. -// H5G_UDLINK \tObject is a user-defined link. -// Exception H5::ReferenceException -// Programmer Binh-Minh Ribler - May, 2004 +// ref - IN: Reference to query +// ref_type - IN: Type of reference to query +// Return An object type, which can be one of the following: +// H5G_UNKNOWN \tFailure occurs (-1) +// H5G_GROUP \tObject is a group. +// H5G_DATASET \tObject is a dataset. +// H5G_TYPE Object \tis a named datatype. +// H5G_LINK \tObject is a symbolic link. +// H5G_UDLINK \tObject is a user-defined link. +// Exception H5::ReferenceException +// Programmer Binh-Minh Ribler - May, 2004 //-------------------------------------------------------------------------- H5G_obj_t H5Location::p_get_obj_type(void *ref, H5R_type_t ref_type) const { H5G_obj_t obj_type = H5Rget_obj_type1(getId(), ref_type, ref); - if (obj_type == H5G_UNKNOWN) - { - throw ReferenceException(inMemFunc("getObjType"), "H5Rget_obj_type1 failed"); - } + { + throw ReferenceException(inMemFunc("getObjType"), "H5Rget_obj_type1 failed"); + } return(obj_type); } #endif // DOXYGEN_SHOULD_SKIP_THIS #endif /* H5_NO_DEPRECATED_SYMBOLS */ //-------------------------------------------------------------------------- -// Function: H5Location::getRefObjType -///\brief Retrieves the type of object that an object reference points to. -///\param ref - IN: Reference to query -///\param ref_type - IN: Type of reference to query, valid values are: -/// \li \c H5R_OBJECT - Reference is an object reference. -/// \li \c H5R_DATASET_REGION - Reference is a dataset region reference. -///\return An object type, which can be one of the following: -/// \li \c H5O_TYPE_UNKNOWN - Unknown object type (-1) -/// \li \c H5O_TYPE_GROUP - Object is a group -/// \li \c H5O_TYPE_DATASET - Object is a dataset -/// \li \c H5O_TYPE_NAMED_DATATYPE - Object is a named datatype -/// \li \c H5O_TYPE_NTYPES - Number of different object types -///\exception H5::ReferenceException -// Programmer Binh-Minh Ribler - May, 2004 +// Function: H5Location::getRefObjType +///\brief Retrieves the type of object that an object reference points to. +///\param ref - IN: Reference to query +///\param ref_type - IN: Type of reference to query, valid values are: +/// \li \c H5R_OBJECT - Reference is an object reference. +/// \li \c H5R_DATASET_REGION - Reference is a dataset region reference. +///\return An object type, which can be one of the following: +/// \li \c H5O_TYPE_UNKNOWN - Unknown object type (-1) +/// \li \c H5O_TYPE_GROUP - Object is a group +/// \li \c H5O_TYPE_DATASET - Object is a dataset +/// \li \c H5O_TYPE_NAMED_DATATYPE - Object is a named datatype +/// \li \c H5O_TYPE_NTYPES - Number of different object types +///\exception H5::ReferenceException +// Programmer Binh-Minh Ribler - May, 2004 //-------------------------------------------------------------------------- H5O_type_t H5Location::getRefObjType(void *ref, H5R_type_t ref_type) const { - try { + try { return(p_get_ref_obj_type(ref, ref_type)); - } - catch (ReferenceException& E) { - throw ReferenceException(inMemFunc("getRefObjType"), E.getDetailMsg()); - } + } + catch (ReferenceException& E) { + throw ReferenceException(inMemFunc("getRefObjType"), E.getDetailMsg()); + } } #ifndef DOXYGEN_SHOULD_SKIP_THIS //-------------------------------------------------------------------------- -// Function: H5Location::p_get_ref_obj_type (protected) -// Purpose Retrieves the type of object that an object reference points to. +// Function: H5Location::p_get_ref_obj_type (protected) +// Purpose Retrieves the type of object that an object reference points to. // Parameters -// ref - IN: Reference to query -// ref_type - IN: Type of reference to query -// Return An object type, which can be one of the following: -// H5O_TYPE_UNKNOWN - Unknown object type (-1) -// H5O_TYPE_GROUP - Object is a group -// H5O_TYPE_DATASET - Object is a dataset -// H5O_TYPE_NAMED_DATATYPE - Object is a named datatype -// H5O_TYPE_NTYPES - Number of object types -// Exception H5::ReferenceException -// Programmer Binh-Minh Ribler - May, 2004 +// ref - IN: Reference to query +// ref_type - IN: Type of reference to query +// Return An object type, which can be one of the following: +// H5O_TYPE_UNKNOWN - Unknown object type (-1) +// H5O_TYPE_GROUP - Object is a group +// H5O_TYPE_DATASET - Object is a dataset +// H5O_TYPE_NAMED_DATATYPE - Object is a named datatype +// H5O_TYPE_NTYPES - Number of object types +// Exception H5::ReferenceException +// Programmer Binh-Minh Ribler - May, 2004 //-------------------------------------------------------------------------- H5O_type_t H5Location::p_get_ref_obj_type(void *ref, H5R_type_t ref_type) const { - H5O_type_t obj_type = H5O_TYPE_UNKNOWN; - herr_t ret_value = H5Rget_obj_type2(getId(), ref_type, ref, &obj_type); - if (ret_value < 0) - { - throw ReferenceException(inMemFunc("getRefObjType"), "H5Rget_obj_type2 failed"); - } - if (obj_type == H5O_TYPE_UNKNOWN || obj_type >= H5O_TYPE_NTYPES) - { - throw ReferenceException(inMemFunc("getRefObjType"), "H5Rget_obj_type2 returned invalid type"); - } - return(obj_type); + H5O_type_t obj_type = H5O_TYPE_UNKNOWN; + herr_t ret_value = H5Rget_obj_type2(getId(), ref_type, ref, &obj_type); + if (ret_value < 0) + { + throw ReferenceException(inMemFunc("getRefObjType"), "H5Rget_obj_type2 failed"); + } + if (obj_type == H5O_TYPE_UNKNOWN || obj_type >= H5O_TYPE_NTYPES) + { + throw ReferenceException(inMemFunc("getRefObjType"), "H5Rget_obj_type2 returned invalid type"); + } + return(obj_type); } //-------------------------------------------------------------------------- -// Function: H5Location::getRegion -///\brief Retrieves a dataspace with the region pointed to selected. -///\param ref - IN: Reference to get region of -///\param ref_type - IN: Type of reference to get region of - default -// to H5R_DATASET_REGION -///\return DataSpace object -///\exception H5::ReferenceException -// Programmer Binh-Minh Ribler - May, 2004 +// Function: H5Location::getRegion +///\brief Retrieves a dataspace with the region pointed to selected. +///\param ref - IN: Reference to get region of +///\param ref_type - IN: Type of reference to get region of - default +// to H5R_DATASET_REGION +///\return DataSpace object +///\exception H5::ReferenceException +// Programmer Binh-Minh Ribler - May, 2004 // Modification -// Mar 29, 2015 -// Used friend function to set id for DataSpace instead of the -// existing id constructor or the setId method to avoid incrementing -// ref count, as a work-around for a problem described in the JIRA -// issue HDFFV-7947. -BMR +// Mar 29, 2015 +// Used friend function to set id for DataSpace instead of the +// existing id constructor or the setId method to avoid incrementing +// ref count, as a work-around for a problem described in the JIRA +// issue HDFFV-7947. -BMR //-------------------------------------------------------------------------- DataSpace H5Location::getRegion(void *ref, H5R_type_t ref_type) const { - hid_t space_id = H5Rget_region(getId(), ref_type, ref); - if (space_id < 0) - { - throw ReferenceException(inMemFunc("getRegion"), "H5Rget_region failed"); - } - try { - DataSpace dataspace; - f_DataSpace_setId(&dataspace, space_id); - return(dataspace); - } - catch (DataSpaceIException& E) { - throw ReferenceException(inMemFunc("getRegion"), E.getDetailMsg()); - } + hid_t space_id = H5Rget_region(getId(), ref_type, ref); + if (space_id < 0) + { + throw ReferenceException(inMemFunc("getRegion"), "H5Rget_region failed"); + } + try { + DataSpace dataspace; + f_DataSpace_setId(&dataspace, space_id); + return(dataspace); + } + catch (DataSpaceIException& E) { + throw ReferenceException(inMemFunc("getRegion"), E.getDetailMsg()); + } } @@ -705,11 +704,11 @@ DataSpace H5Location::getRegion(void *ref, H5R_type_t ref_type) const // to call the right getId() - although, as the structure of the // library at this time, getId() is basically the IdComponent::getId() // ***Updated: after the classes are rearranged (HDFFV-9920), functions -// in CommonFG are moved to Group, and they can call getId() -// instead of getLocId(). getLocId() is kept for backward -// compatibility on user applications. Aug 18, 2016 -BMR +// in CommonFG are moved to Group, and they can call getId() +// instead of getLocId(). getLocId() is kept for backward +// compatibility on user applications. Aug 18, 2016 -BMR // ***Updated: Moving to Group was a mistake, now to H5Location -// Aug 24, 2016 -BMR +// Aug 24, 2016 -BMR // - when a failure returned by the C API, the functions will call // throwException, which is a pure virtual function and is implemented // by H5File to throw a FileIException and by Group to throw a @@ -722,29 +721,29 @@ DataSpace H5Location::getRegion(void *ref, H5R_type_t ref_type) const // is kept in those methods as well. Sep 17, 2016 -BMR //-------------------------------------------------------------------------- -// Function: H5Location::createGroup -///\brief Creates a new group at this location which can be a file -/// or another group. -///\param name - IN: Name of the group to create -///\param size_hint - IN: Indicates the number of bytes to reserve for -/// the names that will appear in the group -///\return Group instance -///\exception H5::FileIException or H5::GroupIException +// Function: H5Location::createGroup +///\brief Creates a new group at this location which can be a file +/// or another group. +///\param name - IN: Name of the group to create +///\param size_hint - IN: Indicates the number of bytes to reserve for +/// the names that will appear in the group +///\return Group instance +///\exception H5::FileIException or H5::GroupIException ///\par Description -/// The optional \a size_hint specifies how much file space to -/// reserve for storing the names that will appear in this new -/// group. If a non-positive value is provided for the \a size_hint -/// then a default size is chosen. -// Programmer Binh-Minh Ribler - 2000 +/// The optional \a size_hint specifies how much file space to +/// reserve for storing the names that will appear in this new +/// group. If a non-positive value is provided for the \a size_hint +/// then a default size is chosen. +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -Group H5Location::createGroup( const char* name, size_t size_hint ) const +Group H5Location::createGroup(const char* name, size_t size_hint) const { // Group creation property list for size hint hid_t gcpl_id = 0; // Set the local heap size hint if (size_hint > 0) - { + { // If the creation of the property list failed, throw an exception if ((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0) throwException("createGroup", "H5Pcreate failed"); @@ -755,351 +754,351 @@ Group H5Location::createGroup( const char* name, size_t size_hint ) const } } - // Call C routine H5Gcreate2 to create the named group, giving the - // location id which can be a file id or a group id - hid_t group_id = H5Gcreate2(getId(), name, H5P_DEFAULT, gcpl_id, H5P_DEFAULT ); + // Call C routine H5Gcreate2 to create the named group, giving the + // location id which can be a file id or a group id + hid_t group_id = H5Gcreate2(getId(), name, H5P_DEFAULT, gcpl_id, H5P_DEFAULT); - // Close the group creation property list, if necessary - if(gcpl_id > 0) + // Close the group creation property list, if necessary + if(gcpl_id > 0) H5Pclose(gcpl_id); - // If the creation of the group failed, throw an exception - if( group_id < 0 ) - throwException("createGroup", "H5Gcreate2 failed"); + // If the creation of the group failed, throw an exception + if (group_id < 0) + throwException("createGroup", "H5Gcreate2 failed"); - // No failure, create and return the Group object - Group group; - //group.p_setId(group_id); - H5Location *ptr = &group; - ptr->p_setId(group_id); - return( group ); + // No failure, create and return the Group object + Group group; + //group.p_setId(group_id); + H5Location *ptr = &group; + ptr->p_setId(group_id); + return(group); } //-------------------------------------------------------------------------- -// Function: H5Location::createGroup -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function in that it takes an -/// \c H5std_string for \a name. -// Programmer Binh-Minh Ribler - 2000 +// Function: H5Location::createGroup +///\brief This is an overloaded member function, provided for convenience. +/// It differs from the above function in that it takes an +/// \c H5std_string for \a name. +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -Group H5Location::createGroup( const H5std_string& name, size_t size_hint ) const +Group H5Location::createGroup(const H5std_string& name, size_t size_hint) const { - return( createGroup( name.c_str(), size_hint )); + return(createGroup( name.c_str(), size_hint)); } //-------------------------------------------------------------------------- -// Function: H5Location::openGroup -///\brief Opens an existing group in a location which can be a file -/// or another group. -///\param name - IN: Name of the group to open -///\return Group instance -///\exception H5::FileIException or H5::GroupIException -// Programmer Binh-Minh Ribler - 2000 +// Function: H5Location::openGroup +///\brief Opens an existing group in a location which can be a file +/// or another group. +///\param name - IN: Name of the group to open +///\return Group instance +///\exception H5::FileIException or H5::GroupIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -Group H5Location::openGroup( const char* name ) const +Group H5Location::openGroup(const char* name) const { - // Call C routine H5Gopen2 to open the named group, giving the - // location id which can be a file id or a group id - hid_t group_id = H5Gopen2(getId(), name, H5P_DEFAULT ); + // Call C routine H5Gopen2 to open the named group, giving the + // location id which can be a file id or a group id + hid_t group_id = H5Gopen2(getId(), name, H5P_DEFAULT); - // If the opening of the group failed, throw an exception - if( group_id < 0 ) - throwException("openGroup", "H5Gopen2 failed"); + // If the opening of the group failed, throw an exception + if (group_id < 0) + throwException("openGroup", "H5Gopen2 failed"); - // No failure, create and return the Group object - Group group; - //group.p_setId(group_id); - H5Location *ptr = &group; - ptr->p_setId(group_id); - return( group ); + // No failure, create and return the Group object + Group group; + //group.p_setId(group_id); + H5Location *ptr = &group; + ptr->p_setId(group_id); + return(group); } //-------------------------------------------------------------------------- -// Function: H5Location::openGroup -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function in that it takes an -/// \c H5std_string for \a name. -// Programmer Binh-Minh Ribler - 2000 +// Function: H5Location::openGroup +///\brief This is an overloaded member function, provided for convenience. +/// It differs from the above function in that it takes an +/// \c H5std_string for \a name. +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -Group H5Location::openGroup( const H5std_string& name ) const +Group H5Location::openGroup(const H5std_string& name) const { - return( openGroup( name.c_str() )); + return(openGroup( name.c_str())); } //-------------------------------------------------------------------------- -// Function: H5Location::createDataSet -///\brief Creates a new dataset at this location. -///\param name - IN: Name of the dataset to create -///\param data_type - IN: Datatype of the dataset -///\param data_space - IN: Dataspace for the dataset -///\param create_plist - IN: Creation properly list for the dataset -///\return DataSet instance -///\exception H5::FileIException or H5::GroupIException -// Programmer Binh-Minh Ribler - 2000 +// Function: H5Location::createDataSet +///\brief Creates a new dataset at this location. +///\param name - IN: Name of the dataset to create +///\param data_type - IN: Datatype of the dataset +///\param data_space - IN: Dataspace for the dataset +///\param create_plist - IN: Creation properly list for the dataset +///\return DataSet instance +///\exception H5::FileIException or H5::GroupIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -DataSet H5Location::createDataSet( const char* name, const DataType& data_type, const DataSpace& data_space, const DSetCreatPropList& create_plist ) const +DataSet H5Location::createDataSet(const char* name, const DataType& data_type, const DataSpace& data_space, const DSetCreatPropList& create_plist) const { // Obtain identifiers for C API - hid_t type_id = data_type.getId(); - hid_t space_id = data_space.getId(); - hid_t create_plist_id = create_plist.getId(); + hid_t type_id = data_type.getId(); + hid_t space_id = data_space.getId(); + hid_t create_plist_id = create_plist.getId(); - // Call C routine H5Dcreate2 to create the named dataset - hid_t dataset_id = H5Dcreate2(getId(), name, type_id, space_id, H5P_DEFAULT, create_plist_id, H5P_DEFAULT ); + // Call C routine H5Dcreate2 to create the named dataset + hid_t dataset_id = H5Dcreate2(getId(), name, type_id, space_id, H5P_DEFAULT, create_plist_id, H5P_DEFAULT); - // If the creation of the dataset failed, throw an exception - if( dataset_id < 0 ) - throwException("createDataSet", "H5Dcreate2 failed"); + // If the creation of the dataset failed, throw an exception + if (dataset_id < 0) + throwException("createDataSet", "H5Dcreate2 failed"); - // No failure, create and return the DataSet object - DataSet dataset; - f_DataSet_setId(&dataset, dataset_id); - return( dataset ); + // No failure, create and return the DataSet object + DataSet dataset; + f_DataSet_setId(&dataset, dataset_id); + return(dataset); } //-------------------------------------------------------------------------- -// Function: H5Location::createDataSet -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function in that it takes an -/// \c H5std_string for \a name. -// Programmer Binh-Minh Ribler - 2000 +// Function: H5Location::createDataSet +///\brief This is an overloaded member function, provided for convenience. +/// It differs from the above function in that it takes an +/// \c H5std_string for \a name. +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -DataSet H5Location::createDataSet( const H5std_string& name, const DataType& data_type, const DataSpace& data_space, const DSetCreatPropList& create_plist ) const +DataSet H5Location::createDataSet(const H5std_string& name, const DataType& data_type, const DataSpace& data_space, const DSetCreatPropList& create_plist) const { - return( createDataSet( name.c_str(), data_type, data_space, create_plist )); + return(createDataSet( name.c_str(), data_type, data_space, create_plist)); } //-------------------------------------------------------------------------- -// Function: H5Location::openDataSet -///\brief Opens an existing dataset at this location. -///\param name - IN: Name of the dataset to open -///\return DataSet instance -///\exception H5::FileIException or H5::GroupIException -// Programmer Binh-Minh Ribler - 2000 +// Function: H5Location::openDataSet +///\brief Opens an existing dataset at this location. +///\param name - IN: Name of the dataset to open +///\return DataSet instance +///\exception H5::FileIException or H5::GroupIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -DataSet H5Location::openDataSet( const char* name ) const +DataSet H5Location::openDataSet(const char* name) const { - // Call C function H5Dopen2 to open the specified dataset, giving - // the location id and the dataset's name - hid_t dataset_id = H5Dopen2(getId(), name, H5P_DEFAULT ); + // Call C function H5Dopen2 to open the specified dataset, giving + // the location id and the dataset's name + hid_t dataset_id = H5Dopen2(getId(), name, H5P_DEFAULT); - // If the dataset's opening failed, throw an exception - if(dataset_id < 0) - throwException("openDataSet", "H5Dopen2 failed"); + // If the dataset's opening failed, throw an exception + if(dataset_id < 0) + throwException("openDataSet", "H5Dopen2 failed"); - // No failure, create and return the DataSet object - DataSet dataset; - f_DataSet_setId(&dataset, dataset_id); - return( dataset ); + // No failure, create and return the DataSet object + DataSet dataset; + f_DataSet_setId(&dataset, dataset_id); + return(dataset); } //-------------------------------------------------------------------------- -// Function: H5Location::openDataSet -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function in that it takes an -/// \c H5std_string for \a name. -// Programmer Binh-Minh Ribler - 2000 +// Function: H5Location::openDataSet +///\brief This is an overloaded member function, provided for convenience. +/// It differs from the above function in that it takes an +/// \c H5std_string for \a name. +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -DataSet H5Location::openDataSet( const H5std_string& name ) const +DataSet H5Location::openDataSet(const H5std_string& name) const { - return( openDataSet( name.c_str() )); + return(openDataSet( name.c_str())); } //-------------------------------------------------------------------------- -// Function: H5Location::link -///\brief Creates a link of the specified type from \a new_name to -/// \a curr_name. -///\param link_type - IN: Link type; possible values are -/// \li \c H5G_LINK_HARD -/// \li \c H5G_LINK_SOFT -///\param curr_name - IN: Name of the existing object if link is a hard -/// link; can be anything for the soft link -///\param new_name - IN: New name for the object -///\exception H5::FileIException or H5::GroupIException +// Function: H5Location::link +///\brief Creates a link of the specified type from \a new_name to +/// \a curr_name. +///\param link_type - IN: Link type; possible values are +/// \li \c H5G_LINK_HARD +/// \li \c H5G_LINK_SOFT +///\param curr_name - IN: Name of the existing object if link is a hard +/// link; can be anything for the soft link +///\param new_name - IN: New name for the object +///\exception H5::FileIException or H5::GroupIException ///\par Description -/// Note that both names are interpreted relative to the -/// specified location. -/// For information on creating hard link and soft link, please -/// refer to the C layer Reference Manual at: +/// Note that both names are interpreted relative to the +/// specified location. +/// For information on creating hard link and soft link, please +/// refer to the C layer Reference Manual at: /// http://hdfgroup.org/HDF5/doc/RM/RM_H5L.html#Link-CreateHard and /// http://hdfgroup.org/HDF5/doc/RM/RM_H5L.html#Link-CreateSoft -// Programmer Binh-Minh Ribler - 2000 +// Programmer Binh-Minh Ribler - 2000 // Modification -// 2007: QAK modified to use H5L APIs - BMR +// 2007: QAK modified to use H5L APIs - BMR //-------------------------------------------------------------------------- -void H5Location::link( H5L_type_t link_type, const char* curr_name, const char* new_name ) const +void H5Location::link(H5L_type_t link_type, const char* curr_name, const char* new_name) const { herr_t ret_value = -1; switch(link_type) { case H5L_TYPE_HARD: - ret_value = H5Lcreate_hard(getId(), curr_name, H5L_SAME_LOC, new_name, H5P_DEFAULT, H5P_DEFAULT ); + ret_value = H5Lcreate_hard(getId(), curr_name, H5L_SAME_LOC, new_name, H5P_DEFAULT, H5P_DEFAULT); break; case H5L_TYPE_SOFT: - ret_value = H5Lcreate_soft( curr_name,getId(), new_name, H5P_DEFAULT, H5P_DEFAULT ); + ret_value = H5Lcreate_soft(curr_name,getId(), new_name, H5P_DEFAULT, H5P_DEFAULT); break; - case H5L_TYPE_ERROR: - case H5L_TYPE_EXTERNAL: - case H5L_TYPE_MAX: + case H5L_TYPE_ERROR: + case H5L_TYPE_EXTERNAL: + case H5L_TYPE_MAX: default: throwException("link", "unknown link type"); break; } /* end switch */ - if( ret_value < 0 ) - throwException("link", "creating link failed"); + if (ret_value < 0) + throwException("link", "creating link failed"); } //-------------------------------------------------------------------------- -// Function: H5Location::link -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function in that it takes an -/// \c H5std_string for \a curr_name and \a new_name. -// Programmer Binh-Minh Ribler - 2000 +// Function: H5Location::link +///\brief This is an overloaded member function, provided for convenience. +/// It differs from the above function in that it takes an +/// \c H5std_string for \a curr_name and \a new_name. +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -void H5Location::link( H5L_type_t link_type, const H5std_string& curr_name, const H5std_string& new_name ) const +void H5Location::link(H5L_type_t link_type, const H5std_string& curr_name, const H5std_string& new_name) const { - link( link_type, curr_name.c_str(), new_name.c_str() ); + link(link_type, curr_name.c_str(), new_name.c_str()); } //-------------------------------------------------------------------------- -// Function: H5Location::unlink -///\brief Removes the specified name at this location. -///\param name - IN: Name of the object to be removed -///\exception H5::FileIException or H5::GroupIException -// Programmer Binh-Minh Ribler - 2000 +// Function: H5Location::unlink +///\brief Removes the specified name at this location. +///\param name - IN: Name of the object to be removed +///\exception H5::FileIException or H5::GroupIException +// Programmer Binh-Minh Ribler - 2000 // Modification -// 2007: QAK modified to use H5L APIs - BMR +// 2007: QAK modified to use H5L APIs - BMR //-------------------------------------------------------------------------- -void H5Location::unlink( const char* name ) const +void H5Location::unlink(const char* name) const { - herr_t ret_value = H5Ldelete(getId(), name, H5P_DEFAULT ); - if( ret_value < 0 ) - throwException("unlink", "H5Ldelete failed"); + herr_t ret_value = H5Ldelete(getId(), name, H5P_DEFAULT); + if (ret_value < 0) + throwException("unlink", "H5Ldelete failed"); } //-------------------------------------------------------------------------- -// Function: H5Location::unlink -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function in that it takes an -/// \c H5std_string for \a name. -// Programmer Binh-Minh Ribler - 2000 +// Function: H5Location::unlink +///\brief This is an overloaded member function, provided for convenience. +/// It differs from the above function in that it takes an +/// \c H5std_string for \a name. +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -void H5Location::unlink( const H5std_string& name ) const +void H5Location::unlink(const H5std_string& name) const { - unlink( name.c_str() ); + unlink(name.c_str()); } //-------------------------------------------------------------------------- -// Function: H5Location::move -///\brief Renames an object at this location. -///\param src - IN: Object's original name -///\param dst - IN: Object's new name -///\exception H5::FileIException or H5::GroupIException +// Function: H5Location::move +///\brief Renames an object at this location. +///\param src - IN: Object's original name +///\param dst - IN: Object's new name +///\exception H5::FileIException or H5::GroupIException ///\note -/// Exercise care in moving groups as it is possible to render -/// data in a file inaccessible with H5Location::move. Please refer -/// to the Group Interface in the HDF5 User's Guide for details at: +/// Exercise care in moving groups as it is possible to render +/// data in a file inaccessible with H5Location::move. Please refer +/// to the Group Interface in the HDF5 User's Guide for details at: /// https://www.hdfgroup.org/HDF5/doc/UG/HDF5_Users_Guide-Responsive%20HTML5/index.html#t=HDF5_Users_Guide%2FGroups%2FHDF5_Groups.htm -// Programmer Binh-Minh Ribler - 2000 +// Programmer Binh-Minh Ribler - 2000 // Modification -// 2007: QAK modified to use H5L APIs - BMR +// 2007: QAK modified to use H5L APIs - BMR //-------------------------------------------------------------------------- -void H5Location::move( const char* src, const char* dst ) const +void H5Location::move(const char* src, const char* dst) const { - herr_t ret_value = H5Lmove(getId(), src, H5L_SAME_LOC, dst, H5P_DEFAULT, H5P_DEFAULT ); - if( ret_value < 0 ) - throwException("move", "H5Lmove failed"); + herr_t ret_value = H5Lmove(getId(), src, H5L_SAME_LOC, dst, H5P_DEFAULT, H5P_DEFAULT); + if (ret_value < 0) + throwException("move", "H5Lmove failed"); } //-------------------------------------------------------------------------- -// Function: H5Location::move -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function in that it takes an -/// \c H5std_string for \a src and \a dst. -// Programmer Binh-Minh Ribler - 2000 +// Function: H5Location::move +///\brief This is an overloaded member function, provided for convenience. +/// It differs from the above function in that it takes an +/// \c H5std_string for \a src and \a dst. +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -void H5Location::move( const H5std_string& src, const H5std_string& dst ) const +void H5Location::move(const H5std_string& src, const H5std_string& dst) const { - move( src.c_str(), dst.c_str() ); + move(src.c_str(), dst.c_str()); } #ifndef H5_NO_DEPRECATED_SYMBOLS //-------------------------------------------------------------------------- -// Function: H5Location::getObjinfo -///\brief Returns information about an object. -///\param name - IN: Name of the object -///\param follow_link - IN: Link flag -///\param statbuf - OUT: Buffer to return information about the object -///\exception H5::FileIException or H5::GroupIException +// Function: H5Location::getObjinfo +///\brief Returns information about an object. +///\param name - IN: Name of the object +///\param follow_link - IN: Link flag +///\param statbuf - OUT: Buffer to return information about the object +///\exception H5::FileIException or H5::GroupIException ///\par Description -/// For more information, please refer to the C layer Reference -/// Manual at: +/// For more information, please refer to the C layer Reference +/// Manual at: /// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5G.html#Group-GetObjinfo -// Programmer Binh-Minh Ribler - 2000 +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -void H5Location::getObjinfo( const char* name, hbool_t follow_link, H5G_stat_t& statbuf ) const +void H5Location::getObjinfo(const char* name, hbool_t follow_link, H5G_stat_t& statbuf) const { - herr_t ret_value = H5Gget_objinfo(getId(), name, follow_link, &statbuf ); - if( ret_value < 0 ) - throwException("getObjinfo", "H5Gget_objinfo failed"); + herr_t ret_value = H5Gget_objinfo(getId(), name, follow_link, &statbuf); + if (ret_value < 0) + throwException("getObjinfo", "H5Gget_objinfo failed"); } //-------------------------------------------------------------------------- -// Function: H5Location::getObjinfo -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function in that it takes an -/// \c H5std_string for \a name. -// Programmer Binh-Minh Ribler - 2000 +// Function: H5Location::getObjinfo +///\brief This is an overloaded member function, provided for convenience. +/// It differs from the above function in that it takes an +/// \c H5std_string for \a name. +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -void H5Location::getObjinfo( const H5std_string& name, hbool_t follow_link, H5G_stat_t& statbuf ) const +void H5Location::getObjinfo(const H5std_string& name, hbool_t follow_link, H5G_stat_t& statbuf) const { - getObjinfo( name.c_str(), follow_link, statbuf ); + getObjinfo(name.c_str(), follow_link, statbuf); } //-------------------------------------------------------------------------- -// Function: H5Location::getObjinfo -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above functions in that it doesn't have -/// the paramemter \a follow_link. -// Programmer Binh-Minh Ribler - Nov, 2005 +// Function: H5Location::getObjinfo +///\brief This is an overloaded member function, provided for convenience. +/// It differs from the above functions in that it doesn't have +/// the paramemter \a follow_link. +// Programmer Binh-Minh Ribler - Nov, 2005 // Note: need to modify to use H5Oget_info and H5Lget_info - BMR //-------------------------------------------------------------------------- -void H5Location::getObjinfo( const char* name, H5G_stat_t& statbuf ) const +void H5Location::getObjinfo(const char* name, H5G_stat_t& statbuf) const { - herr_t ret_value = H5Gget_objinfo(getId(), name, 0, &statbuf ); - if( ret_value < 0 ) - throwException("getObjinfo", "H5Gget_objinfo failed"); + herr_t ret_value = H5Gget_objinfo(getId(), name, 0, &statbuf); + if (ret_value < 0) + throwException("getObjinfo", "H5Gget_objinfo failed"); } //-------------------------------------------------------------------------- -// Function: H5Location::getObjinfo -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function in that it takes an -/// \c H5std_string for \a name. -// Programmer Binh-Minh Ribler - Nov, 2005 +// Function: H5Location::getObjinfo +///\brief This is an overloaded member function, provided for convenience. +/// It differs from the above function in that it takes an +/// \c H5std_string for \a name. +// Programmer Binh-Minh Ribler - Nov, 2005 //-------------------------------------------------------------------------- -void H5Location::getObjinfo( const H5std_string& name, H5G_stat_t& statbuf ) const +void H5Location::getObjinfo(const H5std_string& name, H5G_stat_t& statbuf) const { - getObjinfo( name.c_str(), statbuf ); + getObjinfo(name.c_str(), statbuf); } #endif /* H5_NO_DEPRECATED_SYMBOLS */ //-------------------------------------------------------------------------- -// Function: H5Location::getLinkval -///\brief Returns the name of the object that the symbolic link points to. -///\param name - IN: Symbolic link to the object -///\param size - IN: Maximum number of characters of value to be returned -///\return Name of the object -///\exception H5::FileIException or H5::GroupIException -// Programmer Binh-Minh Ribler - 2000 +// Function: H5Location::getLinkval +///\brief Returns the name of the object that the symbolic link points to. +///\param name - IN: Symbolic link to the object +///\param size - IN: Maximum number of characters of value to be returned +///\return Name of the object +///\exception H5::FileIException or H5::GroupIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -H5std_string H5Location::getLinkval( const char* name, size_t size ) const +H5std_string H5Location::getLinkval(const char* name, size_t size) const { H5L_info_t linkinfo; - char *value_C; // value in C string + char *value_C; // value in C string size_t val_size = size; H5std_string value = ""; herr_t ret_value; @@ -1107,81 +1106,81 @@ H5std_string H5Location::getLinkval( const char* name, size_t size ) const // if user doesn't provide buffer size, determine it if (size == 0) { - ret_value = H5Lget_info(getId(), name, &linkinfo, H5P_DEFAULT); - if( ret_value < 0 ) - throwException("getLinkval", "H5Lget_info to find buffer size failed"); + ret_value = H5Lget_info(getId(), name, &linkinfo, H5P_DEFAULT); + if (ret_value < 0) + throwException("getLinkval", "H5Lget_info to find buffer size failed"); - val_size = linkinfo.u.val_size; + val_size = linkinfo.u.val_size; } // if link has value, retrieve the value, otherwise, return null string if (val_size > 0) { - value_C = new char[val_size+1]; // temporary C-string for C API - HDmemset(value_C, 0, val_size+1); // clear buffer - - ret_value = H5Lget_val(getId(), name, value_C, val_size, H5P_DEFAULT); - if( ret_value < 0 ) - { - delete []value_C; - throwException("getLinkval", "H5Lget_val failed"); - } - - value = H5std_string(value_C); - delete []value_C; + value_C = new char[val_size+1]; // temporary C-string for C API + HDmemset(value_C, 0, val_size+1); // clear buffer + + ret_value = H5Lget_val(getId(), name, value_C, val_size, H5P_DEFAULT); + if (ret_value < 0) + { + delete []value_C; + throwException("getLinkval", "H5Lget_val failed"); + } + + value = H5std_string(value_C); + delete []value_C; } return(value); } //-------------------------------------------------------------------------- -// Function: H5Location::getLinkval -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function in that it takes an -/// \c H5std_string for \a name. -// Programmer Binh-Minh Ribler - 2000 +// Function: H5Location::getLinkval +///\brief This is an overloaded member function, provided for convenience. +/// It differs from the above function in that it takes an +/// \c H5std_string for \a name. +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -H5std_string H5Location::getLinkval( const H5std_string& name, size_t size ) const +H5std_string H5Location::getLinkval(const H5std_string& name, size_t size) const { - return( getLinkval( name.c_str(), size )); + return(getLinkval( name.c_str(), size)); } //-------------------------------------------------------------------------- -// Function: H5Location::mount -///\brief Mounts the file \a child onto this group. -///\param name - IN: Name of the group -///\param child - IN: File to mount -///\param plist - IN: Property list to use -///\exception H5::FileIException or H5::GroupIException -// Programmer Binh-Minh Ribler - 2014 (original 2000) +// Function: H5Location::mount +///\brief Mounts the file \a child onto this group. +///\param name - IN: Name of the group +///\param child - IN: File to mount +///\param plist - IN: Property list to use +///\exception H5::FileIException or H5::GroupIException +// Programmer Binh-Minh Ribler - 2014 (original 2000) //-------------------------------------------------------------------------- -void H5Location::mount(const char* name, const H5File& child, const PropList& plist ) const +void H5Location::mount(const char* name, const H5File& child, const PropList& plist) const { - // Obtain identifiers for C API - hid_t plist_id = plist.getId(); - hid_t child_id = child.getId(); + // Obtain identifiers for C API + hid_t plist_id = plist.getId(); + hid_t child_id = child.getId(); - // Call C routine H5Fmount to do the mouting - herr_t ret_value = H5Fmount(getId(), name, child_id, plist_id ); + // Call C routine H5Fmount to do the mouting + herr_t ret_value = H5Fmount(getId(), name, child_id, plist_id); - // Raise exception if H5Fmount returns negative value - if( ret_value < 0 ) - throwException("mount", "H5Fmount failed"); + // Raise exception if H5Fmount returns negative value + if (ret_value < 0) + throwException("mount", "H5Fmount failed"); } //-------------------------------------------------------------------------- -// Function: H5Location::mount -// Purpose This is an overloaded member function, kept for backward -// compatibility. It differs from the above function in that it -// misses const's. This wrapper will be removed in future release. -// Param name - IN: Name of the group -// Param child - IN: File to mount -// Param plist - IN: Property list to use -// Exception H5::FileIException or H5::GroupIException -// Programmer Binh-Minh Ribler - 2000 +// Function: H5Location::mount +// Purpose This is an overloaded member function, kept for backward +// compatibility. It differs from the above function in that it +// misses const's. This wrapper will be removed in future release. +// Param name - IN: Name of the group +// Param child - IN: File to mount +// Param plist - IN: Property list to use +// Exception H5::FileIException or H5::GroupIException +// Programmer Binh-Minh Ribler - 2000 // Modification -// Modified to call its replacement. -BMR, 2014/04/16 -// Removed from documentation. -BMR, 2016/03/07 1.8.17 and 1.10.0 -// Removed from code. -BMR, 2016/08/11 1.8.18 and 1.10.1 +// Modified to call its replacement. -BMR, 2014/04/16 +// Removed from documentation. -BMR, 2016/03/07 1.8.17 and 1.10.0 +// Removed from code. -BMR, 2016/08/11 1.8.18 and 1.10.1 //-------------------------------------------------------------------------- //void H5Location::mount(const char* name, H5File& child, PropList& plist) const //{ @@ -1189,26 +1188,26 @@ void H5Location::mount(const char* name, const H5File& child, const PropList& pl //} //-------------------------------------------------------------------------- -// Function: H5Location::mount -///\brief This is an overloaded member function, provided for convenience. -/// It takes an \c H5std_string for \a name. -// Programmer Binh-Minh Ribler - 2000 +// Function: H5Location::mount +///\brief This is an overloaded member function, provided for convenience. +/// It takes an \c H5std_string for \a name. +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void H5Location::mount(const H5std_string& name, const H5File& child, const PropList& plist) const { - mount(name.c_str(), child, plist); + mount(name.c_str(), child, plist); } //-------------------------------------------------------------------------- -// Function: H5Location::mount -// Purpose This is an overloaded member function, kept for backward -// compatibility. It differs from the above function in that it -// misses const's. This wrapper will be removed in future release. -// Programmer Binh-Minh Ribler - 2014 +// Function: H5Location::mount +// Purpose This is an overloaded member function, kept for backward +// compatibility. It differs from the above function in that it +// misses const's. This wrapper will be removed in future release. +// Programmer Binh-Minh Ribler - 2014 // Modification -// Modified to call its replacement. -BMR, 2014/04/16 -// Removed from documentation. -BMR, 2016/03/07 1.8.17 and 1.10.0 -// Removed from code. -BMR, 2016/08/11 1.8.18 and 1.10.1 +// Modified to call its replacement. -BMR, 2014/04/16 +// Removed from documentation. -BMR, 2016/03/07 1.8.17 and 1.10.0 +// Removed from code. -BMR, 2016/08/11 1.8.18 and 1.10.1 //-------------------------------------------------------------------------- //void H5Location::mount(const H5std_string& name, H5File& child, PropList& plist) const //{ @@ -1216,109 +1215,109 @@ void H5Location::mount(const H5std_string& name, const H5File& child, const Prop //} //-------------------------------------------------------------------------- -// Function: H5Location::unmount -///\brief Unmounts the specified file. -///\param name - IN: Name of the file to unmount -///\exception H5::FileIException or H5::GroupIException -// Programmer Binh-Minh Ribler - 2000 +// Function: H5Location::unmount +///\brief Unmounts the specified file. +///\param name - IN: Name of the file to unmount +///\exception H5::FileIException or H5::GroupIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -void H5Location::unmount( const char* name ) const +void H5Location::unmount(const char* name) const { - // Call C routine H5Fmount to do the mouting - herr_t ret_value = H5Funmount(getId(), name ); + // Call C routine H5Fmount to do the mouting + herr_t ret_value = H5Funmount(getId(), name); - // Raise exception if H5Funmount returns negative value - if( ret_value < 0 ) - throwException("unmount", "H5Funmount failed"); + // Raise exception if H5Funmount returns negative value + if (ret_value < 0) + throwException("unmount", "H5Funmount failed"); } //-------------------------------------------------------------------------- -// Function: H5Location::unmount -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function in that it takes an -/// \c H5std_string for \a name. -// Programmer Binh-Minh Ribler - 2000 +// Function: H5Location::unmount +///\brief This is an overloaded member function, provided for convenience. +/// It differs from the above function in that it takes an +/// \c H5std_string for \a name. +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -void H5Location::unmount( const H5std_string& name ) const +void H5Location::unmount(const H5std_string& name) const { - unmount( name.c_str() ); + unmount(name.c_str()); } #ifndef H5_NO_DEPRECATED_SYMBOLS //-------------------------------------------------------------------------- -// Function: H5Location::iterateElems -///\brief Iterates a user's function over the entries of a group. -///\param name - IN : Name of group to iterate over -///\param idx - IN/OUT: Starting (IN) and ending (OUT) entry indices -///\param op - IN : User's function to operate on each entry -///\param op_data - IN/OUT: Data associated with the operation -///\return The return value of the first operator that returns non-zero, -/// or zero if all members were processed with no operator -/// returning non-zero. -///\exception H5::FileIException or H5::GroupIException -// Programmer Binh-Minh Ribler - 2000 +// Function: H5Location::iterateElems +///\brief Iterates a user's function over the entries of a group. +///\param name - IN : Name of group to iterate over +///\param idx - IN/OUT: Starting (IN) and ending (OUT) entry indices +///\param op - IN : User's function to operate on each entry +///\param op_data - IN/OUT: Data associated with the operation +///\return The return value of the first operator that returns non-zero, +/// or zero if all members were processed with no operator +/// returning non-zero. +///\exception H5::FileIException or H5::GroupIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -int H5Location::iterateElems( const char* name, int *idx, H5G_iterate_t op , void* op_data ) +int H5Location::iterateElems(const char* name, int *idx, H5G_iterate_t op , void* op_data) { - int ret_value = H5Giterate(getId(), name, idx, op, op_data ); - if( ret_value < 0 ) - { - throwException("iterateElems", "H5Giterate failed"); - } - return( ret_value ); + int ret_value = H5Giterate(getId(), name, idx, op, op_data); + if (ret_value < 0) + { + throwException("iterateElems", "H5Giterate failed"); + } + return(ret_value); } //-------------------------------------------------------------------------- -// Function: H5Location::iterateElems -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function in that it takes an -/// \c H5std_string for \a name. -// Programmer Binh-Minh Ribler - 2000 +// Function: H5Location::iterateElems +///\brief This is an overloaded member function, provided for convenience. +/// It differs from the above function in that it takes an +/// \c H5std_string for \a name. +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -int H5Location::iterateElems( const H5std_string& name, int *idx, H5G_iterate_t op , void* op_data ) +int H5Location::iterateElems(const H5std_string& name, int *idx, H5G_iterate_t op , void* op_data) { - return( iterateElems( name.c_str(), idx, op, op_data )); + return(iterateElems( name.c_str(), idx, op, op_data)); } #endif /* H5_NO_DEPRECATED_SYMBOLS */ //-------------------------------------------------------------------------- -// Function: H5Location::getNumObjs -///\brief Returns the number of objects in this group. -///\return Number of objects -///\exception H5::FileIException or H5::GroupIException -// Programmer Binh-Minh Ribler - January, 2003 +// Function: H5Location::getNumObjs +///\brief Returns the number of objects in this group. +///\return Number of objects +///\exception H5::FileIException or H5::GroupIException +// Programmer Binh-Minh Ribler - January, 2003 //-------------------------------------------------------------------------- hsize_t H5Location::getNumObjs() const { - H5G_info_t ginfo; /* Group information */ + H5G_info_t ginfo; // Group information - herr_t ret_value = H5Gget_info(getId(), &ginfo); - if(ret_value < 0) - throwException("getNumObjs", "H5Gget_info failed"); - return (ginfo.nlinks); + herr_t ret_value = H5Gget_info(getId(), &ginfo); + if(ret_value < 0) + throwException("getNumObjs", "H5Gget_info failed"); + return (ginfo.nlinks); } //-------------------------------------------------------------------------- -// Function: H5Location::getObjnameByIdx -///\brief Returns the name of an object in this group, given the -/// object's index. -///\param idx - IN: Transient index of the object -///\return Object name -///\exception H5::FileIException or H5::GroupIException +// Function: H5Location::getObjnameByIdx +///\brief Returns the name of an object in this group, given the +/// object's index. +///\param idx - IN: Transient index of the object +///\return Object name +///\exception H5::FileIException or H5::GroupIException ///\par Description -/// The value of idx can be any nonnegative number less than the -/// total number of objects in the group, which is returned by -/// the function \c H5Location::getNumObjs. Note that this is a -/// transient index; thus, an object may have a different index -/// each time the group is opened. -// Programmer Binh-Minh Ribler - Mar, 2005 +/// The value of idx can be any nonnegative number less than the +/// total number of objects in the group, which is returned by +/// the function \c H5Location::getNumObjs. Note that this is a +/// transient index; thus, an object may have a different index +/// each time the group is opened. +// Programmer Binh-Minh Ribler - Mar, 2005 //-------------------------------------------------------------------------- H5std_string H5Location::getObjnameByIdx(hsize_t idx) const { // call H5Lget_name_by_idx with name as NULL to get its length ssize_t name_len = H5Lget_name_by_idx(getId(), ".", H5_INDEX_NAME, H5_ITER_INC, idx, NULL, 0, H5P_DEFAULT); if(name_len < 0) - throwException("getObjnameByIdx", "H5Lget_name_by_idx failed"); + throwException("getObjnameByIdx", "H5Lget_name_by_idx failed"); // now, allocate C buffer to get the name char* name_C = new char[name_len+1]; @@ -1328,8 +1327,8 @@ H5std_string H5Location::getObjnameByIdx(hsize_t idx) const if (name_len < 0) { - delete []name_C; - throwException("getObjnameByIdx", "H5Lget_name_by_idx failed"); + delete []name_C; + throwException("getObjnameByIdx", "H5Lget_name_by_idx failed"); } // clean up and return the string @@ -1339,74 +1338,74 @@ H5std_string H5Location::getObjnameByIdx(hsize_t idx) const } //-------------------------------------------------------------------------- -// Function: H5Location::getObjnameByIdx -///\brief Retrieves the name of an object in this group, given the -/// object's index. -///\param idx - IN: Transient index of the object -///\param name - IN/OUT: Retrieved name of the object -///\param size - IN: Length to retrieve -///\return Actual size of the object name or 0, if object has no name -///\exception H5::FileIException or H5::GroupIException +// Function: H5Location::getObjnameByIdx +///\brief Retrieves the name of an object in this group, given the +/// object's index. +///\param idx - IN: Transient index of the object +///\param name - IN/OUT: Retrieved name of the object +///\param size - IN: Length to retrieve +///\return Actual size of the object name or 0, if object has no name +///\exception H5::FileIException or H5::GroupIException ///\par Description -/// The value of idx can be any nonnegative number less than the -/// total number of objects in the group, which is returned by -/// the function \c H5Location::getNumObjs. Note that this is a -/// transient index; thus, an object may have a different index -/// each time the group is opened. -// Programmer Binh-Minh Ribler - January, 2003 +/// The value of idx can be any nonnegative number less than the +/// total number of objects in the group, which is returned by +/// the function \c H5Location::getNumObjs. Note that this is a +/// transient index; thus, an object may have a different index +/// each time the group is opened. +// Programmer Binh-Minh Ribler - January, 2003 //-------------------------------------------------------------------------- ssize_t H5Location::getObjnameByIdx(hsize_t idx, char* name, size_t size) const { - ssize_t name_len = H5Lget_name_by_idx(getId(), ".", H5_INDEX_NAME, H5_ITER_INC, idx, name, size, H5P_DEFAULT); - if(name_len < 0) - throwException("getObjnameByIdx", "H5Lget_name_by_idx failed"); + ssize_t name_len = H5Lget_name_by_idx(getId(), ".", H5_INDEX_NAME, H5_ITER_INC, idx, name, size, H5P_DEFAULT); + if(name_len < 0) + throwException("getObjnameByIdx", "H5Lget_name_by_idx failed"); - return (name_len); + return (name_len); } //-------------------------------------------------------------------------- -// Function: H5Location::getObjnameByIdx -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function in that it takes an -/// \c H5std_string for \a name. -// Programmer Binh-Minh Ribler - January, 2003 +// Function: H5Location::getObjnameByIdx +///\brief This is an overloaded member function, provided for convenience. +/// It differs from the above function in that it takes an +/// \c H5std_string for \a name. +// Programmer Binh-Minh Ribler - January, 2003 //-------------------------------------------------------------------------- ssize_t H5Location::getObjnameByIdx(hsize_t idx, H5std_string& name, size_t size) const { - char* name_C = new char[size+1]; // temporary C-string for object name - HDmemset(name_C, 0, size+1); // clear buffer + char* name_C = new char[size+1]; // temporary C-string for object name + HDmemset(name_C, 0, size+1); // clear buffer - // call overloaded function to get the name - ssize_t name_len = getObjnameByIdx(idx, name_C, size+1); - if(name_len < 0) - { + // call overloaded function to get the name + ssize_t name_len = getObjnameByIdx(idx, name_C, size+1); + if(name_len < 0) + { delete []name_C; - throwException("getObjnameByIdx", "H5Lget_name_by_idx failed"); - } - - // clean up and return the string - name = H5std_string(name_C); - delete []name_C; - return (name_len); -} - -//-------------------------------------------------------------------------- -// Function: H5Location::childObjType -///\brief Returns the type of an object in this file/group, given the -/// object's name. -///\param objname - IN: Name of the object -///\return Object type, which can have the following values for group, -/// dataset, and named datatype -/// \li \c H5O_TYPE_GROUP -/// \li \c H5O_TYPE_DATASET -/// \li \c H5O_TYPE_NAMED_DATATYPE -/// Refer to the C API documentation for more details: -/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5O.html#Object-GetInfo -///\exception H5::FileIException or H5::GroupIException -/// Exception will be thrown when: -/// - an error returned by the C API -/// - object type is not one of the valid values above -// Programmer Binh-Minh Ribler - April, 2014 + throwException("getObjnameByIdx", "H5Lget_name_by_idx failed"); + } + + // clean up and return the string + name = H5std_string(name_C); + delete []name_C; + return (name_len); +} + +//-------------------------------------------------------------------------- +// Function: H5Location::childObjType +///\brief Returns the type of an object in this file/group, given the +/// object's name. +///\param objname - IN: Name of the object +///\return Object type, which can have the following values for group, +/// dataset, and named datatype +/// \li \c H5O_TYPE_GROUP +/// \li \c H5O_TYPE_DATASET +/// \li \c H5O_TYPE_NAMED_DATATYPE +/// Refer to the C API documentation for more details: +/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5O.html#Object-GetInfo +///\exception H5::FileIException or H5::GroupIException +/// Exception will be thrown when: +/// - an error returned by the C API +/// - object type is not one of the valid values above +// Programmer Binh-Minh Ribler - April, 2014 //-------------------------------------------------------------------------- H5O_type_t H5Location::childObjType(const char* objname) const { @@ -1418,33 +1417,33 @@ H5O_type_t H5Location::childObjType(const char* objname) const // Throw exception if C API returns failure if (ret_value < 0) - throwException("childObjType", "H5Oget_info_by_name failed"); + throwException("childObjType", "H5Oget_info_by_name failed"); // Return a valid type or throw an exception for unknown type else - switch (objinfo.type) - { - case H5O_TYPE_GROUP: - case H5O_TYPE_DATASET: - case H5O_TYPE_NAMED_DATATYPE: - objtype = objinfo.type; - break; - case H5O_TYPE_UNKNOWN: - case H5O_TYPE_NTYPES: - default: - throwException("childObjType", "Unknown type of object"); - } + switch (objinfo.type) + { + case H5O_TYPE_GROUP: + case H5O_TYPE_DATASET: + case H5O_TYPE_NAMED_DATATYPE: + objtype = objinfo.type; + break; + case H5O_TYPE_UNKNOWN: + case H5O_TYPE_NTYPES: + default: + throwException("childObjType", "Unknown type of object"); + } return(objtype); } //-------------------------------------------------------------------------- -// Function: H5Location::childObjType -///\brief This is an overloaded member function, provided for convenience. -/// It takes an \a H5std_string for the object's name. -///\brief Returns the type of an object in this group, given the -/// object's name. -///\param objname - IN: Name of the object (H5std_string&) -///\exception H5::FileIException or H5::GroupIException -// Programmer Binh-Minh Ribler - April, 2014 +// Function: H5Location::childObjType +///\brief This is an overloaded member function, provided for convenience. +/// It takes an \a H5std_string for the object's name. +///\brief Returns the type of an object in this group, given the +/// object's name. +///\param objname - IN: Name of the object (H5std_string&) +///\exception H5::FileIException or H5::GroupIException +// Programmer Binh-Minh Ribler - April, 2014 //-------------------------------------------------------------------------- H5O_type_t H5Location::childObjType(const H5std_string& objname) const { @@ -1454,33 +1453,33 @@ H5O_type_t H5Location::childObjType(const H5std_string& objname) const } //-------------------------------------------------------------------------- -// Function: H5Location::childObjType -///\brief Returns the type of an object in this file/group, given the -/// object's index and its type and order. -///\param index - IN: Position of the object -///\param index_type - IN: Type of the index, default to H5_INDEX_NAME -///\param order - IN: Traversing order, default to H5_ITER_INC -///\param objname - IN: Name of the object, default to "." -///\return Object type, which can have the following values for group, -/// dataset, and named datatype -/// \li \c H5O_TYPE_GROUP -/// \li \c H5O_TYPE_DATASET -/// \li \c H5O_TYPE_NAMED_DATATYPE -/// Refer to the C API documentation for more details: -/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5O.html#Object-GetInfo -///\exception H5::FileIException or H5::GroupIException -/// Exception will be thrown when: -/// - an error returned by the C API -/// - object type is not one of the valid values above +// Function: H5Location::childObjType +///\brief Returns the type of an object in this file/group, given the +/// object's index and its type and order. +///\param index - IN: Position of the object +///\param index_type - IN: Type of the index, default to H5_INDEX_NAME +///\param order - IN: Traversing order, default to H5_ITER_INC +///\param objname - IN: Name of the object, default to "." +///\return Object type, which can have the following values for group, +/// dataset, and named datatype +/// \li \c H5O_TYPE_GROUP +/// \li \c H5O_TYPE_DATASET +/// \li \c H5O_TYPE_NAMED_DATATYPE +/// Refer to the C API documentation for more details: +/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5O.html#Object-GetInfo +///\exception H5::FileIException or H5::GroupIException +/// Exception will be thrown when: +/// - an error returned by the C API +/// - object type is not one of the valid values above // Developer's Notes: -// - this overload uses H5Oget_info_by_idx instead of H5Oget_info_by_name -// like the previous childObjType() -// - index is the required argument so, first -// - objname is last because it's more likely the location is already -// fully specified -// - Leave property list out for now because C API is not using it, it -// can be added later when needed. -// Programmer Binh-Minh Ribler - April, 2014 +// - this overload uses H5Oget_info_by_idx instead of H5Oget_info_by_name +// like the previous childObjType() +// - index is the required argument so, first +// - objname is last because it's more likely the location is already +// fully specified +// - Leave property list out for now because C API is not using it, it +// can be added later when needed. +// Programmer Binh-Minh Ribler - April, 2014 //-------------------------------------------------------------------------- H5O_type_t H5Location::childObjType(hsize_t index, H5_index_t index_type, H5_iter_order_t order, const char* objname) const { @@ -1493,37 +1492,37 @@ H5O_type_t H5Location::childObjType(hsize_t index, H5_index_t index_type, H5_ite // Throw exception if C API returns failure if (ret_value < 0) - throwException("childObjType", "H5Oget_info_by_idx failed"); + throwException("childObjType", "H5Oget_info_by_idx failed"); // Return a valid type or throw an exception for unknown type else - switch (objinfo.type) - { - case H5O_TYPE_GROUP: - case H5O_TYPE_DATASET: - case H5O_TYPE_NAMED_DATATYPE: - objtype = objinfo.type; - break; - case H5O_TYPE_UNKNOWN: - case H5O_TYPE_NTYPES: - default: - throwException("childObjType", "Unknown type of object"); - } + switch (objinfo.type) + { + case H5O_TYPE_GROUP: + case H5O_TYPE_DATASET: + case H5O_TYPE_NAMED_DATATYPE: + objtype = objinfo.type; + break; + case H5O_TYPE_UNKNOWN: + case H5O_TYPE_NTYPES: + default: + throwException("childObjType", "Unknown type of object"); + } return(objtype); } //-------------------------------------------------------------------------- -// Function: H5Location::childObjVersion -///\brief Returns the object header version of an object in this file/group, -/// given the object's name. -///\param objname - IN: Name of the object -///\return Object version, which can have the following values: -/// \li \c H5O_VERSION_1 -/// \li \c H5O_VERSION_2 -///\exception H5::FileIException or H5::GroupIException -/// Exception will be thrown when: -/// - an error returned by the C API -/// - version number is not one of the valid values above -// Programmer Binh-Minh Ribler - April, 2014 +// Function: H5Location::childObjVersion +///\brief Returns the object header version of an object in this file/group, +/// given the object's name. +///\param objname - IN: Name of the object +///\return Object version, which can have the following values: +/// \li \c H5O_VERSION_1 +/// \li \c H5O_VERSION_2 +///\exception H5::FileIException or H5::GroupIException +/// Exception will be thrown when: +/// - an error returned by the C API +/// - version number is not one of the valid values above +// Programmer Binh-Minh Ribler - April, 2014 //-------------------------------------------------------------------------- unsigned H5Location::childObjVersion(const char* objname) const { @@ -1535,26 +1534,26 @@ unsigned H5Location::childObjVersion(const char* objname) const // Throw exception if C API returns failure if (ret_value < 0) - throwException("childObjVersion", "H5Oget_info_by_name failed"); + throwException("childObjVersion", "H5Oget_info_by_name failed"); // Return a valid version or throw an exception for invalid value else { - version = objinfo.hdr.version; - if (version != H5O_VERSION_1 && version != H5O_VERSION_2) - throwException("childObjVersion", "Invalid version for object"); + version = objinfo.hdr.version; + if (version != H5O_VERSION_1 && version != H5O_VERSION_2) + throwException("childObjVersion", "Invalid version for object"); } return(version); } //-------------------------------------------------------------------------- -// Function: H5Location::childObjVersion -///\brief This is an overloaded member function, provided for convenience. -/// It takes an \a H5std_string for the object's name. -///\brief Returns the type of an object in this group, given the -/// object's name. -///\param objname - IN: Name of the object (H5std_string&) -///\exception H5::FileIException or H5::GroupIException -// Programmer Binh-Minh Ribler - April, 2014 +// Function: H5Location::childObjVersion +///\brief This is an overloaded member function, provided for convenience. +/// It takes an \a H5std_string for the object's name. +///\brief Returns the type of an object in this group, given the +/// object's name. +///\param objname - IN: Name of the object (H5std_string&) +///\exception H5::FileIException or H5::GroupIException +// Programmer Binh-Minh Ribler - April, 2014 //-------------------------------------------------------------------------- unsigned H5Location::childObjVersion(const H5std_string& objname) const { @@ -1566,35 +1565,35 @@ unsigned H5Location::childObjVersion(const H5std_string& objname) const #ifndef H5_NO_DEPRECATED_SYMBOLS #ifndef DOXYGEN_SHOULD_SKIP_THIS //-------------------------------------------------------------------------- -// Function: H5Location::getObjTypeByIdx -///\brief Returns the type of an object in this group, given the -/// object's index. -///\param idx - IN: Transient index of the object -///\return Object type -///\exception H5::FileIException or H5::GroupIException -// Programmer Binh-Minh Ribler - January, 2003 +// Function: H5Location::getObjTypeByIdx +///\brief Returns the type of an object in this group, given the +/// object's index. +///\param idx - IN: Transient index of the object +///\return Object type +///\exception H5::FileIException or H5::GroupIException +// Programmer Binh-Minh Ribler - January, 2003 //-------------------------------------------------------------------------- H5G_obj_t H5Location::getObjTypeByIdx(hsize_t idx) const { H5G_obj_t obj_type = H5Gget_objtype_by_idx(getId(), idx); if (obj_type == H5G_UNKNOWN) - throwException("getObjTypeByIdx", "H5Gget_objtype_by_idx failed"); + throwException("getObjTypeByIdx", "H5Gget_objtype_by_idx failed"); return (obj_type); } //-------------------------------------------------------------------------- -// Function: H5Location::getObjTypeByIdx -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function because it also provides -/// the returned object type in text (char*) -///\param idx - IN: Transient index of the object -///\param type_name - OUT: Object type in text -///\return Object type -///\exception H5::FileIException or H5::GroupIException -// Programmer Binh-Minh Ribler - May, 2010 +// Function: H5Location::getObjTypeByIdx +///\brief This is an overloaded member function, provided for convenience. +/// It differs from the above function because it also provides +/// the returned object type in text (char*) +///\param idx - IN: Transient index of the object +///\param type_name - OUT: Object type in text +///\return Object type +///\exception H5::FileIException or H5::GroupIException +// Programmer Binh-Minh Ribler - May, 2010 // Modification -// Modified to use the other function. -BMR, 2016/03/07 +// Modified to use the other function. -BMR, 2016/03/07 //-------------------------------------------------------------------------- H5G_obj_t H5Location::getObjTypeByIdx(hsize_t idx, char* type_name) const { @@ -1602,32 +1601,32 @@ H5G_obj_t H5Location::getObjTypeByIdx(hsize_t idx, char* type_name) const return(getObjTypeByIdx(idx, stype_name)); } //-------------------------------------------------------------------------- -// Function: H5Location::getObjTypeByIdx -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function because it also provides -/// the returned object type in text (H5std_string&) -///\param idx - IN: Transient index of the object -///\param type_name - OUT: Object type in text -///\return Object type -///\exception H5::FileIException or H5::GroupIException -// Programmer Binh-Minh Ribler - January, 2003 +// Function: H5Location::getObjTypeByIdx +///\brief This is an overloaded member function, provided for convenience. +/// It differs from the above function because it also provides +/// the returned object type in text (H5std_string&) +///\param idx - IN: Transient index of the object +///\param type_name - OUT: Object type in text +///\return Object type +///\exception H5::FileIException or H5::GroupIException +// Programmer Binh-Minh Ribler - January, 2003 //-------------------------------------------------------------------------- H5G_obj_t H5Location::getObjTypeByIdx(hsize_t idx, H5std_string& type_name) const { H5G_obj_t obj_type = H5Gget_objtype_by_idx(getId(), idx); switch (obj_type) { - case H5G_LINK: type_name = H5std_string("symbolic link"); break; - case H5G_GROUP: type_name = H5std_string("group"); break; - case H5G_DATASET: type_name = H5std_string("dataset"); break; - case H5G_TYPE: type_name = H5std_string("datatype"); break; - case H5G_UNKNOWN: - case H5G_UDLINK: - case H5G_RESERVED_5: - case H5G_RESERVED_6: - case H5G_RESERVED_7: - default: - throwException("getObjTypeByIdx", "H5Gget_objtype_by_idx failed"); + case H5G_LINK: type_name = H5std_string("symbolic link"); break; + case H5G_GROUP: type_name = H5std_string("group"); break; + case H5G_DATASET: type_name = H5std_string("dataset"); break; + case H5G_TYPE: type_name = H5std_string("datatype"); break; + case H5G_UNKNOWN: + case H5G_UDLINK: + case H5G_RESERVED_5: + case H5G_RESERVED_6: + case H5G_RESERVED_7: + default: + throwException("getObjTypeByIdx", "H5Gget_objtype_by_idx failed"); } return (obj_type); } @@ -1645,34 +1644,34 @@ H5G_obj_t H5Location::getObjTypeByIdx(hsize_t idx, H5std_string& type_name) cons //-------------------------------------------------------------------------- void H5Location::throwException(const H5std_string& func_name, const H5std_string& msg) const { - throwException(func_name, msg); + throwException(func_name, msg); } //-------------------------------------------------------------------------- -// Function: f_DataSet_setId - friend +// Function: f_DataSet_setId - friend // Modification: -// Moved to H5CommonFG.cpp after the rearrangement of classes -// -BMR, Dec 2016 +// Moved to H5CommonFG.cpp after the rearrangement of classes +// -BMR, Dec 2016 //-------------------------------------------------------------------------- // end of From H5CommonFG.cpp //-------------------------------------------------------------------------- -// Function: f_Attribute_setId - friend +// Function: f_Attribute_setId - friend // Modification: -// Moved to H5Object.cpp after the rearrangement of classes -// -BMR, Dec 2016 +// Moved to H5Object.cpp after the rearrangement of classes +// -BMR, Dec 2016 //-------------------------------------------------------------------------- //-------------------------------------------------------------------------- -// Function: f_DataSpace_setId - friend -// Purpose: This function is friend to class H5::DataSpace so that it can -// can set DataSpace::id in order to work around a problem -// described in the JIRA issue HDFFV-7947. -// Applications shouldn't need to use it. -// param dspace - IN/OUT: DataSpace object to be changed -// param new_id - IN: New id to set -// Programmer Binh-Minh Ribler - 2015 +// Function: f_DataSpace_setId - friend +// Purpose This function is friend to class H5::DataSpace so that it can +// can set DataSpace::id in order to work around a problem +// described in the JIRA issue HDFFV-7947. +// Applications shouldn't need to use it. +// param dspace - IN/OUT: DataSpace object to be changed +// param new_id - IN: New id to set +// Programmer Binh-Minh Ribler - 2015 //-------------------------------------------------------------------------- void f_DataSpace_setId(DataSpace* dspace, hid_t new_id) { @@ -1680,9 +1679,9 @@ void f_DataSpace_setId(DataSpace* dspace, hid_t new_id) } //-------------------------------------------------------------------------- -// Function: H5Location destructor -///\brief Noop destructor. -// Programmer Binh-Minh Ribler - 2000 +// Function: H5Location destructor +///\brief Noop destructor. +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- H5Location::~H5Location() {} diff --git a/c++/src/H5Location.h b/c++/src/H5Location.h index 6a449dc..337a2b3 100644 --- a/c++/src/H5Location.h +++ b/c++/src/H5Location.h @@ -17,7 +17,7 @@ #ifndef __H5Location_H #define __H5Location_H -#include "H5Classes.h" // constains forward class declarations +#include "H5Classes.h" // constains forward class declarations namespace H5 { @@ -37,188 +37,188 @@ class H5_DLLCPP LinkAccPropList; class H5_DLLCPP VarLenType; class H5_DLLCPP H5Location : public IdComponent { public: - // Checks if a link of a given name exists in a location - bool exists(const char* name, const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const; - bool exists(const H5std_string& name, const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const; + // Checks if a link of a given name exists in a location + bool exists(const char* name, const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const; + bool exists(const H5std_string& name, const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const; - // Flushes all buffers associated with this location to disk. - void flush( H5F_scope_t scope ) const; + // Flushes all buffers associated with this location to disk. + void flush(H5F_scope_t scope) const; - // Gets the name of the file, specified by this location. - H5std_string getFileName() const; + // Gets the name of the file, specified by this location. + H5std_string getFileName() const; #ifndef H5_NO_DEPRECATED_SYMBOLS - // Retrieves the type of object that an object reference points to. - H5G_obj_t getObjType(void *ref, H5R_type_t ref_type = H5R_OBJECT) const; + // Retrieves the type of object that an object reference points to. + H5G_obj_t getObjType(void *ref, H5R_type_t ref_type = H5R_OBJECT) const; #endif /* H5_NO_DEPRECATED_SYMBOLS */ - // Retrieves the type of object that an object reference points to. - H5O_type_t getRefObjType(void *ref, H5R_type_t ref_type = H5R_OBJECT) const; - // Note: getRefObjType deprecates getObjType, but getObjType's name is - // misleading, so getRefObjType is used in the new function instead. - - // Sets the comment for an HDF5 object specified by its name. - void setComment(const char* name, const char* comment) const; - void setComment(const H5std_string& name, const H5std_string& comment) const; - void setComment(const char* comment) const; - void setComment(const H5std_string& comment) const; - - // Retrieves comment for the HDF5 object specified by its name. - ssize_t getComment(const char* name, size_t buf_size, char* comment) const; - H5std_string getComment(const char* name, size_t buf_size=0) const; - H5std_string getComment(const H5std_string& name, size_t buf_size=0) const; - - // Removes the comment for the HDF5 object specified by its name. - void removeComment(const char* name) const; - void removeComment(const H5std_string& name) const; - - // Creates a reference to a named object or to a dataset region - // in this object. - void reference(void* ref, const char* name, - H5R_type_t ref_type = H5R_OBJECT) const; - void reference(void* ref, const H5std_string& name, - H5R_type_t ref_type = H5R_OBJECT) const; - void reference(void* ref, const char* name, const DataSpace& dataspace, - H5R_type_t ref_type = H5R_DATASET_REGION) const; - void reference(void* ref, const H5std_string& name, const DataSpace& dataspace, - H5R_type_t ref_type = H5R_DATASET_REGION) const; - - // Open a referenced object whose location is specified by either - // a file, an HDF5 object, or an attribute. - void dereference(const H5Location& loc, const void* ref, H5R_type_t ref_type = H5R_OBJECT, const PropList& plist = PropList::DEFAULT); - //void dereference(const Attribute& attr, const void* ref, H5R_type_t ref_type = H5R_OBJECT, const PropList& plist = PropList::DEFAULT); - - // Retrieves a dataspace with the region pointed to selected. - DataSpace getRegion(void *ref, H5R_type_t ref_type = H5R_DATASET_REGION) const; + // Retrieves the type of object that an object reference points to. + H5O_type_t getRefObjType(void *ref, H5R_type_t ref_type = H5R_OBJECT) const; + // Note: getRefObjType deprecates getObjType, but getObjType's name is + // misleading, so getRefObjType is used in the new function instead. + + // Sets the comment for an HDF5 object specified by its name. + void setComment(const char* name, const char* comment) const; + void setComment(const H5std_string& name, const H5std_string& comment) const; + void setComment(const char* comment) const; + void setComment(const H5std_string& comment) const; + + // Retrieves comment for the HDF5 object specified by its name. + ssize_t getComment(const char* name, size_t buf_size, char* comment) const; + H5std_string getComment(const char* name, size_t buf_size=0) const; + H5std_string getComment(const H5std_string& name, size_t buf_size=0) const; + + // Removes the comment for the HDF5 object specified by its name. + void removeComment(const char* name) const; + void removeComment(const H5std_string& name) const; + + // Creates a reference to a named object or to a dataset region + // in this object. + void reference(void* ref, const char* name, + H5R_type_t ref_type = H5R_OBJECT) const; + void reference(void* ref, const H5std_string& name, + H5R_type_t ref_type = H5R_OBJECT) const; + void reference(void* ref, const char* name, const DataSpace& dataspace, + H5R_type_t ref_type = H5R_DATASET_REGION) const; + void reference(void* ref, const H5std_string& name, const DataSpace& dataspace, + H5R_type_t ref_type = H5R_DATASET_REGION) const; + + // Open a referenced object whose location is specified by either + // a file, an HDF5 object, or an attribute. + void dereference(const H5Location& loc, const void* ref, H5R_type_t ref_type = H5R_OBJECT, const PropList& plist = PropList::DEFAULT); + //void dereference(const Attribute& attr, const void* ref, H5R_type_t ref_type = H5R_OBJECT, const PropList& plist = PropList::DEFAULT); + + // Retrieves a dataspace with the region pointed to selected. + DataSpace getRegion(void *ref, H5R_type_t ref_type = H5R_DATASET_REGION) const; // From CommonFG - // Creates a new group at this location which can be a file - // or another group. - Group createGroup(const char* name, size_t size_hint = 0) const; - Group createGroup(const H5std_string& name, size_t size_hint = 0) const; - - // Opens an existing group in a location which can be a file - // or another group. - Group openGroup(const char* name) const; - Group openGroup(const H5std_string& name) const; - - // Creates a new dataset in this group. - DataSet createDataSet(const char* name, const DataType& data_type, const DataSpace& data_space, const DSetCreatPropList& create_plist = DSetCreatPropList::DEFAULT) const; - DataSet createDataSet(const H5std_string& name, const DataType& data_type, const DataSpace& data_space, const DSetCreatPropList& create_plist = DSetCreatPropList::DEFAULT) const; - - // Opens an existing dataset at this location. - DataSet openDataSet(const char* name) const; - DataSet openDataSet(const H5std_string& name) const; - - // Returns the value of a symbolic link. - H5std_string getLinkval(const char* link_name, size_t size=0) const; - H5std_string getLinkval(const H5std_string& link_name, size_t size=0) const; - - // Returns the number of objects in this group. - hsize_t getNumObjs() const; - - // Retrieves the name of an object in this group, given the - // object's index. - H5std_string getObjnameByIdx(hsize_t idx) const; - ssize_t getObjnameByIdx(hsize_t idx, char* name, size_t size) const; - ssize_t getObjnameByIdx(hsize_t idx, H5std_string& name, size_t size) const; - - // Retrieves the type of an object in this file or group, given the - // object's name - H5O_type_t childObjType(const H5std_string& objname) const; - H5O_type_t childObjType(const char* objname) const; - H5O_type_t childObjType(hsize_t index, H5_index_t index_type=H5_INDEX_NAME, H5_iter_order_t order=H5_ITER_INC, const char* objname=".") const; - - // Returns the object header version of an object in this file or group, - // given the object's name. - unsigned childObjVersion(const char* objname) const; - unsigned childObjVersion(const H5std_string& objname) const; + // Creates a new group at this location which can be a file + // or another group. + Group createGroup(const char* name, size_t size_hint = 0) const; + Group createGroup(const H5std_string& name, size_t size_hint = 0) const; + + // Opens an existing group in a location which can be a file + // or another group. + Group openGroup(const char* name) const; + Group openGroup(const H5std_string& name) const; + + // Creates a new dataset in this group. + DataSet createDataSet(const char* name, const DataType& data_type, const DataSpace& data_space, const DSetCreatPropList& create_plist = DSetCreatPropList::DEFAULT) const; + DataSet createDataSet(const H5std_string& name, const DataType& data_type, const DataSpace& data_space, const DSetCreatPropList& create_plist = DSetCreatPropList::DEFAULT) const; + + // Opens an existing dataset at this location. + DataSet openDataSet(const char* name) const; + DataSet openDataSet(const H5std_string& name) const; + + // Returns the value of a symbolic link. + H5std_string getLinkval(const char* link_name, size_t size=0) const; + H5std_string getLinkval(const H5std_string& link_name, size_t size=0) const; + + // Returns the number of objects in this group. + hsize_t getNumObjs() const; + + // Retrieves the name of an object in this group, given the + // object's index. + H5std_string getObjnameByIdx(hsize_t idx) const; + ssize_t getObjnameByIdx(hsize_t idx, char* name, size_t size) const; + ssize_t getObjnameByIdx(hsize_t idx, H5std_string& name, size_t size) const; + + // Retrieves the type of an object in this file or group, given the + // object's name + H5O_type_t childObjType(const H5std_string& objname) const; + H5O_type_t childObjType(const char* objname) const; + H5O_type_t childObjType(hsize_t index, H5_index_t index_type=H5_INDEX_NAME, H5_iter_order_t order=H5_ITER_INC, const char* objname=".") const; + + // Returns the object header version of an object in this file or group, + // given the object's name. + unsigned childObjVersion(const char* objname) const; + unsigned childObjVersion(const H5std_string& objname) const; #ifndef H5_NO_DEPRECATED_SYMBOLS - // Returns the type of an object in this group, given the - // object's index. - H5G_obj_t getObjTypeByIdx(hsize_t idx) const; - H5G_obj_t getObjTypeByIdx(hsize_t idx, char* type_name) const; - H5G_obj_t getObjTypeByIdx(hsize_t idx, H5std_string& type_name) const; - - // Returns information about an HDF5 object, given by its name, - // at this location. - void getObjinfo(const char* name, hbool_t follow_link, H5G_stat_t& statbuf) const; - void getObjinfo(const H5std_string& name, hbool_t follow_link, H5G_stat_t& statbuf) const; - void getObjinfo(const char* name, H5G_stat_t& statbuf) const; - void getObjinfo(const H5std_string& name, H5G_stat_t& statbuf) const; - - // Iterates over the elements of this group - not implemented in - // C++ style yet. - int iterateElems(const char* name, int *idx, H5G_iterate_t op, void *op_data); - int iterateElems(const H5std_string& name, int *idx, H5G_iterate_t op, void *op_data); + // Returns the type of an object in this group, given the + // object's index. + H5G_obj_t getObjTypeByIdx(hsize_t idx) const; + H5G_obj_t getObjTypeByIdx(hsize_t idx, char* type_name) const; + H5G_obj_t getObjTypeByIdx(hsize_t idx, H5std_string& type_name) const; + + // Returns information about an HDF5 object, given by its name, + // at this location. + void getObjinfo(const char* name, hbool_t follow_link, H5G_stat_t& statbuf) const; + void getObjinfo(const H5std_string& name, hbool_t follow_link, H5G_stat_t& statbuf) const; + void getObjinfo(const char* name, H5G_stat_t& statbuf) const; + void getObjinfo(const H5std_string& name, H5G_stat_t& statbuf) const; + + // Iterates over the elements of this group - not implemented in + // C++ style yet. + int iterateElems(const char* name, int *idx, H5G_iterate_t op, void *op_data); + int iterateElems(const H5std_string& name, int *idx, H5G_iterate_t op, void *op_data); #endif /* H5_NO_DEPRECATED_SYMBOLS */ - // Creates a link of the specified type from new_name to current_name; - // both names are interpreted relative to the specified location id. - void link(H5L_type_t link_type, const char* curr_name, const char* new_name) const; - void link(H5L_type_t link_type, const H5std_string& curr_name, const H5std_string& new_name) const; + // Creates a link of the specified type from new_name to current_name; + // both names are interpreted relative to the specified location id. + void link(H5L_type_t link_type, const char* curr_name, const char* new_name) const; + void link(H5L_type_t link_type, const H5std_string& curr_name, const H5std_string& new_name) const; - // Removes the specified name at this location. - void unlink(const char* name) const; - void unlink(const H5std_string& name) const; + // Removes the specified name at this location. + void unlink(const char* name) const; + void unlink(const H5std_string& name) const; - // Mounts the file 'child' onto this location. - void mount(const char* name, const H5File& child, const PropList& plist) const; - //void mount(const char* name, H5File& child, PropList& plist) const; // removed from 1.8.18 and 1.10.1 - void mount(const H5std_string& name, const H5File& child, const PropList& plist) const; - //void mount(const H5std_string& name, H5File& child, PropList& plist) const; // removed from 1.8.18 and 1.10.1 + // Mounts the file 'child' onto this location. + void mount(const char* name, const H5File& child, const PropList& plist) const; + //void mount(const char* name, H5File& child, PropList& plist) const; // removed from 1.8.18 and 1.10.1 + void mount(const H5std_string& name, const H5File& child, const PropList& plist) const; + //void mount(const H5std_string& name, H5File& child, PropList& plist) const; // removed from 1.8.18 and 1.10.1 - // Unmounts the file named 'name' from this parent location. - void unmount(const char* name) const; - void unmount(const H5std_string& name) const; + // Unmounts the file named 'name' from this parent location. + void unmount(const char* name) const; + void unmount(const H5std_string& name) const; - // Renames an object at this location. - void move(const char* src, const char* dst) const; - void move(const H5std_string& src, const H5std_string& dst) const; + // Renames an object at this location. + void move(const char* src, const char* dst) const; + void move(const H5std_string& src, const H5std_string& dst) const; // end From CommonFG - /// For subclasses, H5File and Group, to throw appropriate exception. - virtual void throwException(const H5std_string& func_name, const H5std_string& msg) const; + /// For subclasses, H5File and Group, to throw appropriate exception. + virtual void throwException(const H5std_string& func_name, const H5std_string& msg) const; - // Default constructor - H5Location(); + // Default constructor + H5Location(); protected: #ifndef DOXYGEN_SHOULD_SKIP_THIS - // *** Deprecation warning *** - // The following two constructors are no longer appropriate after the - // data member "id" had been moved to the sub-classes. - // The copy constructor is a noop and is removed in 1.8.15 and the - // other will be removed from 1.10 release, and then from 1.8 if its - // removal does not raise any problems in two 1.10 releases. + // *** Deprecation warning *** + // The following two constructors are no longer appropriate after the + // data member "id" had been moved to the sub-classes. + // The copy constructor is a noop and is removed in 1.8.15 and the + // other will be removed from 1.10 release, and then from 1.8 if its + // removal does not raise any problems in two 1.10 releases. - // Creates a copy of an existing object giving the location id. - H5Location(const hid_t loc_id); + // Creates a copy of an existing object giving the location id. + H5Location(const hid_t loc_id); - // Creates a reference to an HDF5 object or a dataset region. - void p_reference(void* ref, const char* name, hid_t space_id, H5R_type_t ref_type) const; + // Creates a reference to an HDF5 object or a dataset region. + void p_reference(void* ref, const char* name, hid_t space_id, H5R_type_t ref_type) const; - // Dereferences a ref into an HDF5 id. - hid_t p_dereference(hid_t loc_id, const void* ref, H5R_type_t ref_type, const PropList& plist, const char* from_func); + // Dereferences a ref into an HDF5 id. + hid_t p_dereference(hid_t loc_id, const void* ref, H5R_type_t ref_type, const PropList& plist, const char* from_func); #ifndef H5_NO_DEPRECATED_SYMBOLS - // Retrieves the type of object that an object reference points to. - H5G_obj_t p_get_obj_type(void *ref, H5R_type_t ref_type) const; + // Retrieves the type of object that an object reference points to. + H5G_obj_t p_get_obj_type(void *ref, H5R_type_t ref_type) const; #endif /* H5_NO_DEPRECATED_SYMBOLS */ - // Retrieves the type of object that an object reference points to. - H5O_type_t p_get_ref_obj_type(void *ref, H5R_type_t ref_type) const; + // Retrieves the type of object that an object reference points to. + H5O_type_t p_get_ref_obj_type(void *ref, H5R_type_t ref_type) const; - // Sets the identifier of this object to a new value. - this one - // doesn't increment reference count - //virtual void p_setId(const hid_t new_id); + // Sets the identifier of this object to a new value. - this one + // doesn't increment reference count + //virtual void p_setId(const hid_t new_id); #endif // DOXYGEN_SHOULD_SKIP_THIS - // Noop destructor. - virtual ~H5Location(); + // Noop destructor. + virtual ~H5Location(); }; /* end class H5Location */ diff --git a/c++/src/H5Object.cpp b/c++/src/H5Object.cpp index 48d81f8..b5d0f88 100644 --- a/c++/src/H5Object.cpp +++ b/c++/src/H5Object.cpp @@ -15,7 +15,7 @@ #include -#include "H5private.h" // for HDmemset +#include "H5private.h" // for HDmemset #include "H5Include.h" #include "H5Exception.h" #include "H5IdComponent.h" @@ -46,25 +46,25 @@ namespace H5 { extern "C" herr_t userAttrOpWrpr(hid_t loc_id, const char *attr_name, const H5A_info_t *ainfo, void *op_data) { - H5std_string s_attr_name = H5std_string( attr_name ); + H5std_string s_attr_name = H5std_string(attr_name); UserData4Aiterate* myData = reinterpret_cast (op_data); - myData->op( *myData->location, s_attr_name, myData->opData ); + myData->op(*myData->location, s_attr_name, myData->opData); return 0; } #endif //-------------------------------------------------------------------------- -// Function: H5Object default constructor (protected) -// Programmer Binh-Minh Ribler - 2000 +// Function: H5Object default constructor (protected) +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- H5Object::H5Object() : H5Location() {} //-------------------------------------------------------------------------- -// Function: H5Object overloaded constructor (protected) -// Purpose Creates an H5Object object using the id of an existing HDF5 -// object. -// Parameters object_id - IN: Id of an existing HDF5 object -// Programmer Binh-Minh Ribler - 2000 +// Function: H5Object overloaded constructor (protected) +// Purpose Creates an H5Object object using the id of an existing HDF5 +// object. +// Parameters object_id - IN: Id of an existing HDF5 object +// Programmer Binh-Minh Ribler - 2000 // *** Deprecation warning *** // This constructor is no longer appropriate because the data member "id" had // been moved to the sub-classes. It will be removed in 1.10 release. If its @@ -75,11 +75,11 @@ H5Object::H5Object() : H5Location() {} //H5Object::H5Object(const hid_t object_id) : H5Location() {} //-------------------------------------------------------------------------- -// Function: H5Object copy constructor -///\brief Copy constructor: makes a copy of the original H5Object -/// instance. -///\param original - IN: H5Object instance to copy -// Programmer Binh-Minh Ribler - 2000 +// Function: H5Object copy constructor +///\brief Copy constructor: makes a copy of the original H5Object +/// instance. +///\param original - IN: H5Object instance to copy +// Programmer Binh-Minh Ribler - 2000 // *** Deprecation warning *** // This constructor is no longer appropriate because the data member "id" had // been moved to the sub-classes. It is removed from 1.8.15 because it is @@ -103,158 +103,157 @@ void f_Attribute_setId(Attribute* attr, hid_t new_id) } //-------------------------------------------------------------------------- -// Function: H5Object::createAttribute -///\brief Creates an attribute for a group, dataset, or named datatype. -///\param name - IN: Name of the attribute -///\param data_type - IN: Datatype for the attribute -///\param data_space - IN: Dataspace for the attribute - only simple -/// dataspaces are allowed at this time -///\param create_plist - IN: Creation property list - default to -/// PropList::DEFAULT -///\return Attribute instance -///\exception H5::AttributeIException +// Function: H5Object::createAttribute +///\brief Creates an attribute for a group, dataset, or named datatype. +///\param name - IN: Name of the attribute +///\param data_type - IN: Datatype for the attribute +///\param data_space - IN: Dataspace for the attribute - only simple +/// dataspaces are allowed at this time +///\param create_plist - IN: Creation property list - default to +/// PropList::DEFAULT +///\return Attribute instance +///\exception H5::AttributeIException ///\par Description -/// The attribute name specified in \a name must be unique. -/// Attempting to create an attribute with the same name as an -/// existing attribute will raise an exception, leaving the -/// pre-existing attribute intact. To overwrite an existing -/// attribute with a new attribute of the same name, first -/// delete the existing one with \c H5Object::removeAttr, then -/// recreate it with this function. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -Attribute H5Object::createAttribute( const char* name, const DataType& data_type, const DataSpace& data_space, const PropList& create_plist ) const +/// The attribute name specified in \a name must be unique. +/// Attempting to create an attribute with the same name as an +/// existing attribute will raise an exception, leaving the +/// pre-existing attribute intact. To overwrite an existing +/// attribute with a new attribute of the same name, first +/// delete the existing one with \c H5Object::removeAttr, then +/// recreate it with this function. +// Programmer Binh-Minh Ribler - 2000 +//-------------------------------------------------------------------------- +Attribute H5Object::createAttribute(const char* name, const DataType& data_type, const DataSpace& data_space, const PropList& create_plist) const { - hid_t type_id = data_type.getId(); - hid_t space_id = data_space.getId(); - hid_t plist_id = create_plist.getId(); - hid_t attr_id = H5Acreate2(getId(), name, type_id, space_id, plist_id, H5P_DEFAULT ); - - // If the attribute id is valid, create and return the Attribute object - if( attr_id > 0 ) - { - Attribute attr; - f_Attribute_setId(&attr, attr_id); - return( attr ); - } - else - throw AttributeIException(inMemFunc("createAttribute"), "H5Acreate2 failed"); + hid_t type_id = data_type.getId(); + hid_t space_id = data_space.getId(); + hid_t plist_id = create_plist.getId(); + hid_t attr_id = H5Acreate2(getId(), name, type_id, space_id, plist_id, H5P_DEFAULT); + + // If the attribute id is valid, create and return the Attribute object + if (attr_id > 0) + { + Attribute attr; + f_Attribute_setId(&attr, attr_id); + return(attr); + } + else + throw AttributeIException(inMemFunc("createAttribute"), "H5Acreate2 failed"); } //-------------------------------------------------------------------------- -// Function: H5Object::createAttribute -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function in that it takes -/// a reference to an \c H5std_string for \a name. -// Programmer Binh-Minh Ribler - 2000 +// Function: H5Object::createAttribute +///\brief This is an overloaded member function, provided for convenience. +/// It differs from the above function in that it takes +/// a reference to an \c H5std_string for \a name. +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -Attribute H5Object::createAttribute( const H5std_string& name, const DataType& data_type, const DataSpace& data_space, const PropList& create_plist ) const +Attribute H5Object::createAttribute(const H5std_string& name, const DataType& data_type, const DataSpace& data_space, const PropList& create_plist) const { - return( createAttribute( name.c_str(), data_type, data_space, create_plist )); + return(createAttribute( name.c_str(), data_type, data_space, create_plist)); } //-------------------------------------------------------------------------- -// Function: H5Object::openAttribute -///\brief Opens an attribute given its name. -///\param name - IN: Name of the attribute -///\return Attribute instance -///\exception H5::AttributeIException -// Programmer Binh-Minh Ribler - 2000 +// Function: H5Object::openAttribute +///\brief Opens an attribute given its name. +///\param name - IN: Name of the attribute +///\return Attribute instance +///\exception H5::AttributeIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -Attribute H5Object::openAttribute( const char* name ) const +Attribute H5Object::openAttribute(const char* name) const { - hid_t attr_id = H5Aopen(getId(), name, H5P_DEFAULT); - if( attr_id > 0 ) - { - Attribute attr; - f_Attribute_setId(&attr, attr_id); - return( attr ); - } - else - { - throw AttributeIException(inMemFunc("openAttribute"), "H5Aopen failed"); - } + hid_t attr_id = H5Aopen(getId(), name, H5P_DEFAULT); + if (attr_id > 0) + { + Attribute attr; + f_Attribute_setId(&attr, attr_id); + return(attr); + } + else + { + throw AttributeIException(inMemFunc("openAttribute"), "H5Aopen failed"); + } } //-------------------------------------------------------------------------- -// Function: H5Object::openAttribute -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function in that it takes -/// a reference to an \c H5std_string for \a name. -// Programmer Binh-Minh Ribler - 2000 +// Function: H5Object::openAttribute +///\brief This is an overloaded member function, provided for convenience. +/// It differs from the above function in that it takes +/// a reference to an \c H5std_string for \a name. +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -Attribute H5Object::openAttribute( const H5std_string& name ) const +Attribute H5Object::openAttribute(const H5std_string& name) const { - return( openAttribute( name.c_str()) ); + return(openAttribute( name.c_str())); } //-------------------------------------------------------------------------- -// Function: H5Object::openAttribute -///\brief Opens an attribute given its index. -///\param idx - IN: Index of the attribute, a 0-based, non-negative integer -///\return Attribute instance -///\exception H5::AttributeIException -// Programmer Binh-Minh Ribler - 2000 +// Function: H5Object::openAttribute +///\brief Opens an attribute given its index. +///\param idx - IN: Index of the attribute, a 0-based, non-negative integer +///\return Attribute instance +///\exception H5::AttributeIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -Attribute H5Object::openAttribute( const unsigned int idx ) const +Attribute H5Object::openAttribute(const unsigned int idx) const { - hid_t attr_id = H5Aopen_by_idx(getId(), ".", H5_INDEX_CRT_ORDER, - H5_ITER_INC, static_cast(idx), H5P_DEFAULT, H5P_DEFAULT); - if( attr_id > 0 ) - { - Attribute attr; - f_Attribute_setId(&attr, attr_id); - return(attr); - } - else - { - throw AttributeIException(inMemFunc("openAttribute"), "H5Aopen_by_idx failed"); - } + hid_t attr_id = H5Aopen_by_idx(getId(), ".", H5_INDEX_CRT_ORDER, + H5_ITER_INC, static_cast(idx), H5P_DEFAULT, H5P_DEFAULT); + if (attr_id > 0) + { + Attribute attr; + f_Attribute_setId(&attr, attr_id); + return(attr); + } + else + { + throw AttributeIException(inMemFunc("openAttribute"), "H5Aopen_by_idx failed"); + } } //-------------------------------------------------------------------------- -// Function: H5Object::iterateAttrs -///\brief Iterates a user's function over all the attributes of an H5 -/// object, which may be a group, dataset or named datatype. -///\param user_op - IN: User's function to operate on each attribute -///\param _idx - IN/OUT: Starting (IN) and ending (OUT) attribute indices -///\param op_data - IN: User's data to pass to user's operator function -///\return Returned value of the last operator if it was non-zero, or -/// zero if all attributes were processed -///\exception H5::AttributeIException +// Function: H5Object::iterateAttrs +///\brief Iterates a user's function over all the attributes of an H5 +/// object, which may be a group, dataset or named datatype. +///\param user_op - IN: User's function to operate on each attribute +///\param _idx - IN/OUT: Starting (IN) and ending (OUT) attribute indices +///\param op_data - IN: User's data to pass to user's operator function +///\return Returned value of the last operator if it was non-zero, or +/// zero if all attributes were processed +///\exception H5::AttributeIException ///\par Description -/// The signature of user_op is -/// void (*)(H5::H5Location&, H5std_string, void*). -/// For information, please refer to the C layer Reference Manual -/// at: +/// The signature of user_op is +/// void (*)(H5::H5Location&, H5std_string, void*). +/// For information, please refer to the C layer Reference Manual +/// at: /// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5A.html#Annot-Iterate -// Programmer Binh-Minh Ribler - 2000 +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -int H5Object::iterateAttrs( attr_operator_t user_op, unsigned *_idx, void *op_data ) +int H5Object::iterateAttrs(attr_operator_t user_op, unsigned *_idx, void *op_data) { - // store the user's function and data - UserData4Aiterate* userData = new UserData4Aiterate; - userData->opData = op_data; - userData->op = user_op; - userData->location = this; - - // call the C library routine H5Aiterate2 to iterate the attributes - hsize_t idx = _idx ? static_cast(*_idx) : 0; - int ret_value = H5Aiterate2(getId(), H5_INDEX_NAME, H5_ITER_INC, &idx, - userAttrOpWrpr, reinterpret_cast(userData)); - - // release memory - delete userData; - - if( ret_value >= 0 ) { - /* Pass back update index value to calling code */ - if (_idx) - *_idx = static_cast(idx); - - return( ret_value ); - } - else // raise exception when H5Aiterate returns a negative value - throw AttributeIException(inMemFunc("iterateAttrs"), "H5Aiterate2 failed"); + // store the user's function and data + UserData4Aiterate* userData = new UserData4Aiterate; + userData->opData = op_data; + userData->op = user_op; + userData->location = this; + + // call the C library routine H5Aiterate2 to iterate the attributes + hsize_t idx = _idx ? static_cast(*_idx) : 0; + int ret_value = H5Aiterate2(getId(), H5_INDEX_NAME, H5_ITER_INC, &idx, + userAttrOpWrpr, reinterpret_cast(userData)); + + // release memory + delete userData; + + if (ret_value >= 0) { + /* Pass back update index value to calling code */ + if (_idx) + *_idx = static_cast(idx); + return(ret_value); + } + else // raise exception when H5Aiterate returns a negative value + throw AttributeIException(inMemFunc("iterateAttrs"), "H5Aiterate2 failed"); } //-------------------------------------------------------------------------- @@ -291,106 +290,106 @@ unsigned H5Object::objVersion() const } //-------------------------------------------------------------------------- -// Function: H5Object::getNumAttrs -///\brief Returns the number of attributes attached to this HDF5 object. -///\return Number of attributes -///\exception H5::AttributeIException -// Programmer Binh-Minh Ribler - 2000 +// Function: H5Object::getNumAttrs +///\brief Returns the number of attributes attached to this HDF5 object. +///\return Number of attributes +///\exception H5::AttributeIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- int H5Object::getNumAttrs() const { - H5O_info_t oinfo; /* Object info */ + H5O_info_t oinfo; /* Object info */ - if(H5Oget_info(getId(), &oinfo) < 0) - throw AttributeIException(inMemFunc("getNumAttrs"), "H5Oget_info failed"); - else - return(static_cast(oinfo.num_attrs)); + if(H5Oget_info(getId(), &oinfo) < 0) + throw AttributeIException(inMemFunc("getNumAttrs"), "H5Oget_info failed"); + else + return(static_cast(oinfo.num_attrs)); } //-------------------------------------------------------------------------- -// Function: H5Object::attrExists -///\brief Checks whether the named attribute exists at this location. -///\param name - IN: Name of the attribute to be queried -///\exception H5::AttributeIException -// Programmer Binh-Minh Ribler - 2013 +// Function: H5Object::attrExists +///\brief Checks whether the named attribute exists at this location. +///\param name - IN: Name of the attribute to be queried +///\exception H5::AttributeIException +// Programmer Binh-Minh Ribler - 2013 //-------------------------------------------------------------------------- bool H5Object::attrExists(const char* name) const { - // Call C routine H5Aexists to determine whether an attribute exists - // at this location, which could be specified by a file, group, dataset, - // or named datatype. - herr_t ret_value = H5Aexists(getId(), name); - if( ret_value > 0 ) - return true; - else if(ret_value == 0) - return false; - else // Raise exception when H5Aexists returns a negative value - throw AttributeIException(inMemFunc("attrExists"), "H5Aexists failed"); + // Call C routine H5Aexists to determine whether an attribute exists + // at this location, which could be specified by a file, group, dataset, + // or named datatype. + herr_t ret_value = H5Aexists(getId(), name); + if (ret_value > 0) + return true; + else if(ret_value == 0) + return false; + else // Raise exception when H5Aexists returns a negative value + throw AttributeIException(inMemFunc("attrExists"), "H5Aexists failed"); } //-------------------------------------------------------------------------- -// Function: H5Object::attrExists -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function in that it takes -/// a reference to an \c H5std_string for \a name. -// Programmer Binh-Minh Ribler - 2000 +// Function: H5Object::attrExists +///\brief This is an overloaded member function, provided for convenience. +/// It differs from the above function in that it takes +/// a reference to an \c H5std_string for \a name. +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- bool H5Object::attrExists(const H5std_string& name) const { - return(attrExists(name.c_str())); + return(attrExists(name.c_str())); } //-------------------------------------------------------------------------- -// Function: H5Object::removeAttr -///\brief Removes the named attribute from this object. -///\param name - IN: Name of the attribute to be removed -///\exception H5::AttributeIException -// Programmer Binh-Minh Ribler - 2000 +// Function: H5Object::removeAttr +///\brief Removes the named attribute from this object. +///\param name - IN: Name of the attribute to be removed +///\exception H5::AttributeIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -void H5Object::removeAttr( const char* name ) const +void H5Object::removeAttr(const char* name) const { - herr_t ret_value = H5Adelete(getId(), name); - if( ret_value < 0 ) - throw AttributeIException(inMemFunc("removeAttr"), "H5Adelete failed"); + herr_t ret_value = H5Adelete(getId(), name); + if (ret_value < 0) + throw AttributeIException(inMemFunc("removeAttr"), "H5Adelete failed"); } //-------------------------------------------------------------------------- -// Function: H5Object::removeAttr -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function in that it takes -/// a reference to an \c H5std_string for \a name. -// Programmer Binh-Minh Ribler - 2000 +// Function: H5Object::removeAttr +///\brief This is an overloaded member function, provided for convenience. +/// It differs from the above function in that it takes +/// a reference to an \c H5std_string for \a name. +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -void H5Object::removeAttr( const H5std_string& name ) const +void H5Object::removeAttr(const H5std_string& name) const { - removeAttr( name.c_str() ); + removeAttr(name.c_str()); } //-------------------------------------------------------------------------- -// Function: H5Object::renameAttr -///\brief Renames the named attribute from this object. -///\param oldname - IN: Name of the attribute to be renamed -///\param newname - IN: New name ame of the attribute -///\exception H5::AttributeIException -// Programmer Binh-Minh Ribler - Mar, 2005 +// Function: H5Object::renameAttr +///\brief Renames the named attribute from this object. +///\param oldname - IN: Name of the attribute to be renamed +///\param newname - IN: New name ame of the attribute +///\exception H5::AttributeIException +// Programmer Binh-Minh Ribler - Mar, 2005 //-------------------------------------------------------------------------- void H5Object::renameAttr(const char* oldname, const char* newname) const { - herr_t ret_value = H5Arename(getId(), oldname, newname); - if (ret_value < 0) - throw AttributeIException(inMemFunc("renameAttr"), "H5Arename failed"); + herr_t ret_value = H5Arename(getId(), oldname, newname); + if (ret_value < 0) + throw AttributeIException(inMemFunc("renameAttr"), "H5Arename failed"); } //-------------------------------------------------------------------------- -// Function: H5Object::renameAttr -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function in that it takes -/// a reference to an \c H5std_string for the names. -// Programmer Binh-Minh Ribler - Mar, 2005 +// Function: H5Object::renameAttr +///\brief This is an overloaded member function, provided for convenience. +/// It differs from the above function in that it takes +/// a reference to an \c H5std_string for the names. +// Programmer Binh-Minh Ribler - Mar, 2005 //-------------------------------------------------------------------------- void H5Object::renameAttr(const H5std_string& oldname, const H5std_string& newname) const { - renameAttr (oldname.c_str(), newname.c_str()); + renameAttr (oldname.c_str(), newname.c_str()); } //-------------------------------------------------------------------------- // Function: getObjName @@ -405,11 +404,11 @@ ssize_t H5Object::getObjName(char *obj_name, size_t buf_size) const // If H5Iget_name returns a negative value, raise an exception if (name_size < 0) - { + { throw Exception(inMemFunc("getObjName"), "H5Iget_name failed"); } else if (name_size == 0) - { + { throw Exception(inMemFunc("getObjName"), "Object must have a name, but name length is 0"); } // Return length of the name @@ -433,16 +432,16 @@ H5std_string H5Object::getObjName() const // If H5Iget_name failed, throw exception if (name_size < 0) - { + { throw Exception(inMemFunc("getObjName"), "H5Iget_name failed"); } else if (name_size == 0) - { + { throw Exception(inMemFunc("getObjName"), "Object must have a name, but name length is 0"); } // Object's name exists, retrieve it else if (name_size > 0) - { + { char* name_C = new char[name_size+1]; // temporary C-string HDmemset(name_C, 0, name_size+1); // clear buffer @@ -478,13 +477,13 @@ ssize_t H5Object::getObjName(H5std_string& obj_name, size_t len) const // If no length is provided, get the entire object name if (len == 0) - { + { obj_name = getObjName(); name_size = obj_name.length(); } // If length is provided, get that number of characters in name else - { + { char* name_C = new char[len+1]; // temporary C-string HDmemset(name_C, 0, len+1); // clear buffer @@ -505,9 +504,9 @@ ssize_t H5Object::getObjName(H5std_string& obj_name, size_t len) const #ifndef DOXYGEN_SHOULD_SKIP_THIS //-------------------------------------------------------------------------- -// Function: H5Object destructor -///\brief Noop destructor. -// Programmer Binh-Minh Ribler - 2000 +// Function: H5Object destructor +///\brief Noop destructor. +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- H5Object::~H5Object() {} #endif // DOXYGEN_SHOULD_SKIP_THIS diff --git a/c++/src/H5Object.h b/c++/src/H5Object.h index 5ea8937..866d739 100644 --- a/c++/src/H5Object.h +++ b/c++/src/H5Object.h @@ -24,20 +24,20 @@ namespace H5 { and Group. Modification: - Sept 18, 2012: Added class H5Location in between IdComponent and - H5Object. An H5File now inherits from H5Location. All HDF5 - wrappers in H5Object are moved up to H5Location. H5Object - is left mostly empty for future wrappers that are only for - group, dataset, and named datatype. Note that the reason for - adding H5Location instead of simply moving H5File to be under - H5Object is H5File is not an HDF5 object, and renaming H5Object - to H5Location will risk breaking user applications. - -BMR - Apr 2, 2014: Added wrapper getObjName for H5Iget_name - Sep 21, 2016: Rearranging classes (HDFFV-9920) moved H5A wrappers back - into H5Object. This way, C functions that takes attribute id - can be in H5Location and those that cannot take attribute id - can be in H5Object. + Sept 18, 2012: Added class H5Location in between IdComponent and + H5Object. An H5File now inherits from H5Location. All HDF5 + wrappers in H5Object are moved up to H5Location. H5Object + is left mostly empty for future wrappers that are only for + group, dataset, and named datatype. Note that the reason for + adding H5Location instead of simply moving H5File to be under + H5Object is H5File is not an HDF5 object, and renaming H5Object + to H5Location will risk breaking user applications. + -BMR + Apr 2, 2014: Added wrapper getObjName for H5Iget_name + Sep 21, 2016: Rearranging classes (HDFFV-9920) moved H5A wrappers back + into H5Object. This way, C functions that takes attribute id + can be in H5Location and those that cannot take attribute id + can be in H5Object. Inheritance: H5Location -> IdComponent */ @@ -46,88 +46,88 @@ class H5_DLLCPP H5Object; class H5_DLLCPP Attribute; // Define the operator function pointer for H5Aiterate(). -typedef void (*attr_operator_t)( H5Object& loc/*in*/, +typedef void (*attr_operator_t)(H5Object& loc/*in*/, const H5std_string attr_name/*in*/, void *operator_data/*in,out*/); // User data for attribute iteration class UserData4Aiterate { public: - attr_operator_t op; - void* opData; - H5Object* location; + attr_operator_t op; + void* opData; + H5Object* location; }; class H5_DLLCPP H5Object : public H5Location { public: - // Creates an attribute for the specified object - // PropList is currently not used, so always be default. - Attribute createAttribute( const char* name, const DataType& type, const DataSpace& space, const PropList& create_plist = PropList::DEFAULT ) const; - Attribute createAttribute( const H5std_string& name, const DataType& type, const DataSpace& space, const PropList& create_plist = PropList::DEFAULT ) const; + // Creates an attribute for the specified object + // PropList is currently not used, so always be default. + Attribute createAttribute(const char* name, const DataType& type, const DataSpace& space, const PropList& create_plist = PropList::DEFAULT) const; + Attribute createAttribute(const H5std_string& name, const DataType& type, const DataSpace& space, const PropList& create_plist = PropList::DEFAULT) const; - // Given its name, opens the attribute that belongs to an object at - // this location. - Attribute openAttribute( const char* name ) const; - Attribute openAttribute( const H5std_string& name ) const; + // Given its name, opens the attribute that belongs to an object at + // this location. + Attribute openAttribute(const char* name) const; + Attribute openAttribute(const H5std_string& name) const; - // Given its index, opens the attribute that belongs to an object at - // this location. - Attribute openAttribute( const unsigned int idx ) const; + // Given its index, opens the attribute that belongs to an object at + // this location. + Attribute openAttribute(const unsigned int idx) const; - // Iterate user's function over the attributes of this object. - int iterateAttrs(attr_operator_t user_op, unsigned* idx = NULL, void* op_data = NULL); + // Iterate user's function over the attributes of this object. + int iterateAttrs(attr_operator_t user_op, unsigned* idx = NULL, void* op_data = NULL); - // Returns the object header version of an object - unsigned objVersion() const; + // Returns the object header version of an object + unsigned objVersion() const; - // Determines the number of attributes belong to this object. - int getNumAttrs() const; + // Determines the number of attributes belong to this object. + int getNumAttrs() const; - // Checks whether the named attribute exists for this object. - bool attrExists(const char* name) const; - bool attrExists(const H5std_string& name) const; + // Checks whether the named attribute exists for this object. + bool attrExists(const char* name) const; + bool attrExists(const H5std_string& name) const; - // Renames the named attribute to a new name. - void renameAttr(const char* oldname, const char* newname) const; - void renameAttr(const H5std_string& oldname, const H5std_string& newname) const; + // Renames the named attribute to a new name. + void renameAttr(const char* oldname, const char* newname) const; + void renameAttr(const H5std_string& oldname, const H5std_string& newname) const; - // Removes the named attribute from this object. - void removeAttr(const char* name) const; - void removeAttr(const H5std_string& name) const; + // Removes the named attribute from this object. + void removeAttr(const char* name) const; + void removeAttr(const H5std_string& name) const; - // Returns an identifier. - virtual hid_t getId() const = 0; + // Returns an identifier. + virtual hid_t getId() const = 0; #ifndef DOXYGEN_SHOULD_SKIP_THIS - // Gets the name of this HDF5 object, i.e., Group, DataSet, or - // DataType. These should have const but are retiring anyway. - ssize_t getObjName(char *obj_name, size_t buf_size = 0) const; - ssize_t getObjName(H5std_string& obj_name, size_t len = 0) const; - H5std_string getObjName() const; + // Gets the name of this HDF5 object, i.e., Group, DataSet, or + // DataType. These should have const but are retiring anyway. + ssize_t getObjName(char *obj_name, size_t buf_size = 0) const; + ssize_t getObjName(H5std_string& obj_name, size_t len = 0) const; + H5std_string getObjName() const; protected: - // Default constructor - H5Object(); + // Default constructor + H5Object(); - // *** Deprecation warning *** - // The following two constructors are no longer appropriate after the - // data member "id" had been moved to the sub-classes. - // The copy constructor is a noop and is removed in 1.8.15 and the - // other will be removed from 1.10 release, and then from 1.8 if its - // removal does not raise any problems in two 1.10 releases. + // *** Deprecation warning *** + // The following two constructors are no longer appropriate after the + // data member "id" had been moved to the sub-classes. + // The copy constructor is a noop and is removed in 1.8.15 and the + // other will be removed from 1.10 release, and then from 1.8 if its + // removal does not raise any problems in two 1.10 releases. - // Creates a copy of an existing object giving the object id - H5Object( const hid_t object_id ); + // Creates a copy of an existing object giving the object id + H5Object(const hid_t object_id); - // Copy constructor: makes copy of an H5Object object. - // H5Object(const H5Object& original); + // Copy constructor: makes copy of an H5Object object. + // H5Object(const H5Object& original); - // Sets the identifier of this object to a new value. - this one - // doesn't increment reference count - virtual void p_setId(const hid_t new_id) = 0; + // Sets the identifier of this object to a new value. - this one + // doesn't increment reference count + virtual void p_setId(const hid_t new_id) = 0; - // Noop destructor. - virtual ~H5Object(); + // Noop destructor. + virtual ~H5Object(); #endif // DOXYGEN_SHOULD_SKIP_THIS diff --git a/c++/src/H5OcreatProp.cpp b/c++/src/H5OcreatProp.cpp index 397a96f..6fdd9dc 100644 --- a/c++/src/H5OcreatProp.cpp +++ b/c++/src/H5OcreatProp.cpp @@ -75,49 +75,49 @@ void ObjCreatPropList::deleteConstants() } //-------------------------------------------------------------------------- -// Purpose: Constant for default property +// Purpose: Constant for default property //-------------------------------------------------------------------------- const ObjCreatPropList& ObjCreatPropList::DEFAULT = *getConstant(); #endif // DOXYGEN_SHOULD_SKIP_THIS //-------------------------------------------------------------------------- -// Function: Default Constructor -///\brief Creates a file access property list -// Programmer: Binh-Minh Ribler - 2000 +// Function: Default Constructor +///\brief Creates a file access property list +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- ObjCreatPropList::ObjCreatPropList() : PropList(H5P_OBJECT_CREATE) {} //-------------------------------------------------------------------------- -// Function: ObjCreatPropList copy constructor -///\brief Copy Constructor: makes a copy of the original -///\param original - IN: ObjCreatPropList instance to copy -// Programmer: Binh-Minh Ribler - 2000 +// Function: ObjCreatPropList copy constructor +///\brief Copy Constructor: makes a copy of the original +///\param original - IN: ObjCreatPropList instance to copy +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- ObjCreatPropList::ObjCreatPropList(const ObjCreatPropList& original) : PropList(original) {} //-------------------------------------------------------------------------- -// Function: ObjCreatPropList overloaded constructor -///\brief Creates a file access property list using the id of an -/// existing one. -// Programmer: Binh-Minh Ribler - 2000 +// Function: ObjCreatPropList overloaded constructor +///\brief Creates a file access property list using the id of an +/// existing one. +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- ObjCreatPropList::ObjCreatPropList(const hid_t plist_id) : PropList(plist_id) {} //-------------------------------------------------------------------------- -// Function: ObjCreatPropList::setAttrPhaseChange -///\brief Sets attribute storage phase change thresholds. -///\param max_compact - IN: Maximum number of attributes to be stored in -/// compact storage. Default to 8 -///\param min_dense - IN: Minimum number of attributes to be stored in -/// dense storage. Default to 6 -///\exception H5::PropListIException +// Function: ObjCreatPropList::setAttrPhaseChange +///\brief Sets attribute storage phase change thresholds. +///\param max_compact - IN: Maximum number of attributes to be stored in +/// compact storage. Default to 8 +///\param min_dense - IN: Minimum number of attributes to be stored in +/// dense storage. Default to 6 +///\exception H5::PropListIException ///\par Description -/// If \c max_compact is set to 0, dense storage will be used. -/// For more detail about on attribute storage, please refer to the -/// C layer Reference Manual at: +/// If \c max_compact is set to 0, dense storage will be used. +/// For more detail about on attribute storage, please refer to the +/// C layer Reference Manual at: /// https://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetAttrPhaseChange -// Programmer: Binh-Minh Ribler - September 2015 +// Programmer Binh-Minh Ribler - September 2015 //-------------------------------------------------------------------------- void ObjCreatPropList::setAttrPhaseChange(unsigned max_compact, unsigned min_dense) const { @@ -129,19 +129,19 @@ void ObjCreatPropList::setAttrPhaseChange(unsigned max_compact, unsigned min_den } //-------------------------------------------------------------------------- -// Function: ObjCreatPropList::getAttrPhaseChange -///\brief Gets attribute storage phase change thresholds. -///\param max_compact - OUT: Maximum number of attributes to be stored in -/// compact storage. -///\param min_dense - OUT: Minimum number of attributes to be stored in -/// dense storage. -///\exception H5::PropListIException +// Function: ObjCreatPropList::getAttrPhaseChange +///\brief Gets attribute storage phase change thresholds. +///\param max_compact - OUT: Maximum number of attributes to be stored in +/// compact storage. +///\param min_dense - OUT: Minimum number of attributes to be stored in +/// dense storage. +///\exception H5::PropListIException ///\par Description -/// If \c max_compact is set to 0, dense storage will be used. -/// For more detail about on attribute storage, please refer to the -/// C layer Reference Manual at: +/// If \c max_compact is set to 0, dense storage will be used. +/// For more detail about on attribute storage, please refer to the +/// C layer Reference Manual at: /// https://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-GetAttrPhaseChange -// Programmer: Binh-Minh Ribler - September 2015 +// Programmer Binh-Minh Ribler - September 2015 //-------------------------------------------------------------------------- void ObjCreatPropList::getAttrPhaseChange(unsigned& max_compact, unsigned& min_dense) const { @@ -154,23 +154,23 @@ void ObjCreatPropList::getAttrPhaseChange(unsigned& max_compact, unsigned& min_d } //-------------------------------------------------------------------------- -// Function: ObjCreatPropList::setAttrCrtOrder -///\brief Sets tracking and indexing of attribute creation order. -///\param crt_order_flags - IN: Flags specifying whether to track and -/// index attribute creation order. Default: No flag set -///\exception H5::PropListIException +// Function: ObjCreatPropList::setAttrCrtOrder +///\brief Sets tracking and indexing of attribute creation order. +///\param crt_order_flags - IN: Flags specifying whether to track and +/// index attribute creation order. Default: No flag set +///\exception H5::PropListIException ///\par Description -/// Valid flags are: -/// \li \c H5P_CRT_ORDER_TRACKED - Attribute creation order is tracked -/// \li \c H5P_CRT_ORDER_INDEXED - Attribute creation order is -/// indexed (requires H5P_CRT_ORDER_TRACKED). -/// When no flag is set, attribute creation order is neither -/// tracked not indexed. Note that HDF5 currently provides no -/// mechanism to turn on attribute creation order tracking at object -/// creation time and to build the index later. -/// The C layer Reference Manual at can be found at: +/// Valid flags are: +/// \li \c H5P_CRT_ORDER_TRACKED - Attribute creation order is tracked +/// \li \c H5P_CRT_ORDER_INDEXED - Attribute creation order is +/// indexed (requires H5P_CRT_ORDER_TRACKED). +/// When no flag is set, attribute creation order is neither +/// tracked not indexed. Note that HDF5 currently provides no +/// mechanism to turn on attribute creation order tracking at object +/// creation time and to build the index later. +/// The C layer Reference Manual at can be found at: /// https://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetAttrCreationOrder -// Programmer: Binh-Minh Ribler - September 2015 +// Programmer Binh-Minh Ribler - September 2015 //-------------------------------------------------------------------------- void ObjCreatPropList::setAttrCrtOrder(unsigned crt_order_flags) const { @@ -182,18 +182,18 @@ void ObjCreatPropList::setAttrCrtOrder(unsigned crt_order_flags) const } //-------------------------------------------------------------------------- -// Function: ObjCreatPropList::getAttrCrtOrder -///\brief Gets tracking and indexing settings for attribute -/// creation order. -///\param crt_order_flags - OUT: Flags specifying whether to track and -/// index attribute creation order -///\exception H5::PropListIException +// Function: ObjCreatPropList::getAttrCrtOrder +///\brief Gets tracking and indexing settings for attribute +/// creation order. +///\param crt_order_flags - OUT: Flags specifying whether to track and +/// index attribute creation order +///\exception H5::PropListIException ///\par Description -/// When no flag is set, i.e. crt_order_flags = 0, attribute -/// creation order is neither tracked not indexed. -/// The C layer Reference Manual at can be found at: +/// When no flag is set, i.e. crt_order_flags = 0, attribute +/// creation order is neither tracked not indexed. +/// The C layer Reference Manual at can be found at: /// https://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-GetAttrCreationOrder -// Programmer: Binh-Minh Ribler - September 2015 +// Programmer Binh-Minh Ribler - September 2015 //-------------------------------------------------------------------------- unsigned ObjCreatPropList::getAttrCrtOrder() const { @@ -208,9 +208,9 @@ unsigned ObjCreatPropList::getAttrCrtOrder() const } //-------------------------------------------------------------------------- -// Function: ObjCreatPropList destructor -///\brief Noop destructor -// Programmer Binh-Minh Ribler - 2000 +// Function: ObjCreatPropList destructor +///\brief Noop destructor +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- ObjCreatPropList::~ObjCreatPropList() {} diff --git a/c++/src/H5OcreatProp.h b/c++/src/H5OcreatProp.h index bfba1c4..4858e07 100644 --- a/c++/src/H5OcreatProp.h +++ b/c++/src/H5OcreatProp.h @@ -27,37 +27,37 @@ namespace H5 { */ class H5_DLLCPP ObjCreatPropList : public PropList { public: - ///\brief Default object creation property list. - static const ObjCreatPropList& DEFAULT; + ///\brief Default object creation property list. + static const ObjCreatPropList& DEFAULT; - // Creates a object creation property list. - ObjCreatPropList(); + // Creates a object creation property list. + ObjCreatPropList(); - // Sets attribute storage phase change thresholds. - void setAttrPhaseChange(unsigned max_compact = 8, unsigned min_dense = 6) const; + // Sets attribute storage phase change thresholds. + void setAttrPhaseChange(unsigned max_compact = 8, unsigned min_dense = 6) const; - // Gets attribute storage phase change thresholds. - void getAttrPhaseChange(unsigned& max_compact, unsigned& min_dense) const; + // Gets attribute storage phase change thresholds. + void getAttrPhaseChange(unsigned& max_compact, unsigned& min_dense) const; - // Sets tracking and indexing of attribute creation order. - void setAttrCrtOrder(unsigned crt_order_flags) const; + // Sets tracking and indexing of attribute creation order. + void setAttrCrtOrder(unsigned crt_order_flags) const; - // Gets tracking and indexing settings for attribute creation order. - unsigned getAttrCrtOrder() const; + // Gets tracking and indexing settings for attribute creation order. + unsigned getAttrCrtOrder() const; - ///\brief Returns this class name. - virtual H5std_string fromClass () const { return("ObjCreatPropList"); } + ///\brief Returns this class name. + virtual H5std_string fromClass () const { return("ObjCreatPropList"); } - // Copy constructor: creates a copy of a ObjCreatPropList object. - ObjCreatPropList( const ObjCreatPropList& original ); + // Copy constructor: creates a copy of a ObjCreatPropList object. + ObjCreatPropList(const ObjCreatPropList& original); - // Creates a copy of an existing object creation property list - // using the property list id. - ObjCreatPropList (const hid_t plist_id); + // Creates a copy of an existing object creation property list + // using the property list id. + ObjCreatPropList (const hid_t plist_id); - // Noop destructor - virtual ~ObjCreatPropList(); + // Noop destructor + virtual ~ObjCreatPropList(); #ifndef DOXYGEN_SHOULD_SKIP_THIS diff --git a/c++/src/H5PredType.cpp b/c++/src/H5PredType.cpp index e2eed18..03327c8 100644 --- a/c++/src/H5PredType.cpp +++ b/c++/src/H5PredType.cpp @@ -32,14 +32,14 @@ namespace H5 { #ifndef DOXYGEN_SHOULD_SKIP_THIS //-------------------------------------------------------------------------- -// Function: PredType overloaded constructor -///\brief Creates a PredType object using the id of an existing -/// predefined datatype. -///\param predtype_id - IN: Id of a predefined datatype +// Function: PredType overloaded constructor +///\brief Creates a PredType object using the id of an existing +/// predefined datatype. +///\param predtype_id - IN: Id of a predefined datatype // Description -// This constructor creates a PredType object by copying -// the provided HDF5 predefined datatype. -// Programmer Binh-Minh Ribler - 2000 +// This constructor creates a PredType object by copying +// the provided HDF5 predefined datatype. +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- PredType::PredType(const hid_t predtype_id) : AtomType(predtype_id) { @@ -47,69 +47,69 @@ PredType::PredType(const hid_t predtype_id) : AtomType(predtype_id) } //-------------------------------------------------------------------------- -// Function: PredType default constructor -///\brief Default constructor: Creates a stub predefined datatype -// Programmer Binh-Minh Ribler - 2000 +// Function: PredType default constructor +///\brief Default constructor: Creates a stub predefined datatype +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- PredType::PredType() : AtomType() {} #endif // DOXYGEN_SHOULD_SKIP_THIS //-------------------------------------------------------------------------- -// Function: PredType copy constructor -///\brief Copy constructor: makes a copy of the original PredType object. -///\param original - IN: PredType instance to copy -// Programmer Binh-Minh Ribler - 2000 +// Function: PredType copy constructor +///\brief Copy constructor: makes a copy of the original PredType object. +///\param original - IN: PredType instance to copy +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- PredType::PredType(const PredType& original) : AtomType(original) {} //-------------------------------------------------------------------------- -// Function: PredType::operator= -///\brief Assignment operator. -///\param rhs - IN: Reference to the predefined datatype -///\return Reference to PredType instance -///\exception H5::DataTypeIException +// Function: PredType::operator= +///\brief Assignment operator. +///\param rhs - IN: Reference to the predefined datatype +///\return Reference to PredType instance +///\exception H5::DataTypeIException // Description -// Makes a copy of the type on the right hand side and stores -// the new id in the left hand side object. -// Programmer Binh-Minh Ribler - 2000 +// Makes a copy of the type on the right hand side and stores +// the new id in the left hand side object. +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -PredType& PredType::operator=( const PredType& rhs ) +PredType& PredType::operator=(const PredType& rhs) { if (this != &rhs) - copy(rhs); + copy(rhs); return(*this); } #ifndef DOXYGEN_SHOULD_SKIP_THIS // These dummy functions do not inherit from DataType - they'll // throw an DataTypeIException if invoked. -void PredType::commit(H5Location& loc, const char* name ) +void PredType::commit(H5Location& loc, const char* name) { - throw DataTypeIException("PredType::commit", "Error: Attempted to commit a predefined datatype. Invalid operation!" ); + throw DataTypeIException("PredType::commit", "Error: Attempted to commit a predefined datatype. Invalid operation!"); } -void PredType::commit(H5Location& loc, const H5std_string& name ) +void PredType::commit(H5Location& loc, const H5std_string& name) { - commit( loc, name.c_str()); + commit(loc, name.c_str()); } bool PredType::committed() { - throw DataTypeIException("PredType::committed", "Error: Attempting to check for commit status on a predefined datatype." ); + throw DataTypeIException("PredType::committed", "Error: Attempting to check for commit status on a predefined datatype."); } #endif // DOXYGEN_SHOULD_SKIP_THIS // Default destructor //-------------------------------------------------------------------------- -// Function: PredType destructor -///\brief Noop destructor. -// Programmer Binh-Minh Ribler - 2000 +// Function: PredType destructor +///\brief Noop destructor. +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- PredType::~PredType() {} /***************************************************************************** - The following section is regarding the global constants PredType, - DataSpace, and PropList. + The following section is regarding the global constants PredType, + DataSpace, and PropList. *****************************************************************************/ @@ -292,18 +292,18 @@ PredType* PredType::NATIVE_UINT_FAST64_; #endif /* H5_SIZEOF_UINT_FAST64_T */ //-------------------------------------------------------------------------- -// Function: PredType::getPredTypes -// Purpose: Returns the dummy PredType constant object pointer -// Return: PredType object pointer +// Function: PredType::getPredTypes +// Purpose Returns the dummy PredType constant object pointer +// Return: PredType object pointer // Description -// If the dummy constant PREDTYPE_CONST_ is not allocated yet, -// call makePredTypes() to allocate all of the PredType constants. -// Otherwise, just simply return the object pointer PREDTYPE_CONST_. +// If the dummy constant PREDTYPE_CONST_ is not allocated yet, +// call makePredTypes() to allocate all of the PredType constants. +// Otherwise, just simply return the object pointer PREDTYPE_CONST_. // -// Note that, there is a similar function to getPredTypes() in -// other classes, that have global constants, is called getConstant(). +// Note that, there is a similar function to getPredTypes() in +// other classes, that have global constants, is called getConstant(). // -// Programmer Binh-Minh Ribler - September 2015 +// Programmer Binh-Minh Ribler - September 2015 //-------------------------------------------------------------------------- PredType* PredType::getPredTypes() { @@ -318,16 +318,16 @@ PredType* PredType::getPredTypes() // If the dummy constant pointer is not allocated, allocate all PredType // constant pointers. Otherwise, throw because it shouldn't be. if (PREDTYPE_CONST_ == 0) - makePredTypes(); + makePredTypes(); else - throw H5::DataTypeIException("PredType::getPredTypes", "PredType::getPredTypes is being invoked on an allocated PREDTYPE_CONST_"); + throw H5::DataTypeIException("PredType::getPredTypes", "PredType::getPredTypes is being invoked on an allocated PREDTYPE_CONST_"); return PREDTYPE_CONST_; } //-------------------------------------------------------------------------- -// Function: PredType::makePredTypes -// Purpose: Allocate all PredType constants. -// Programmer Binh-Minh Ribler - September 2015 +// Function: PredType::makePredTypes +// Purpose Allocate all PredType constants. +// Programmer Binh-Minh Ribler - September 2015 //-------------------------------------------------------------------------- void PredType::makePredTypes() { @@ -515,9 +515,9 @@ void PredType::makePredTypes() //-------------------------------------------------------------------------- -// Function: PredType::deleteConstants -// Purpose: Deletes all PredType constant pointers. -// Programmer Binh-Minh Ribler - September 2015 +// Function: PredType::deleteConstants +// Purpose Deletes all PredType constant pointers. +// Programmer Binh-Minh Ribler - September 2015 //-------------------------------------------------------------------------- void PredType::deleteConstants() { @@ -891,206 +891,205 @@ const PredType& PredType::NATIVE_UINT_FAST64 = *NATIVE_UINT_FAST64_; } // end namespace /*************************************************************************** - Design Note - =========== + Design Note + =========== September 2015: - The C++ library has several types of global constants from different - classes, such as PropList, PredType, DataSpace, etc... Previously, - these global constants were declared statically and the C++ library used - a constant, called PredType::AtExit, to detect when all the global - contants are destroyed then close the C library (H5close). This method - relied on the order of the constants being created and destroyed and - that PredType constants be the last to be destroyed. In September - 2015, it was recognized that the order in which the global constants were - created and destroyed was actually undefined, thus can be different - between different compilers. This resulted in failure when compilers - destroy PredType constants before others because when PredType::AtExit - was destroyed, the C library was closed, so when the constants of other - classes such as PropList or DataSpace were being deleted, the C library - would not be available. - - These are the classes that have global constants: - + PredType - + DataSpace - + PropList (and its subclasses below) - + FileAccPropList - + FileCreatPropList - + DSetMemXferPropList - + DSetCreatPropList - - - The new method includes these main points: - - - The C++ library uses dynamically allocated constants to have the - control in which order the global constants are created/destroyed. - - - The previous static constants are changed to be the references to - the dynamically allocated constants to avoid impact on applications. - - - The first time an IdComponent default constructor is invoked, it - will call the function H5Library::initH5cpp which registers the - terminating functions from each class that has the global constants - so that these functions can destroy those constants at the exit of the - application. IdComponent is a baseclass of any object class that has - an identifier, such as Group, DataSet, DataType,... The classes which - have the global constants are all derived from IdComponent. - - - At the normal termination of the application, each registered function - for each constant type will delete all the allocated constants in - that type class, then a different terminating function, which was also - registered with atexit() by initH5cpp, will call H5close to close the - C library. - - The following list presents the differences between the old and new - methods and the changes implemented for the new method. - - 1. The following items are added to class H5Library: - // Private instance to be created by H5Library only - static H5Library* instance; - - // Returns a singleton H5Library to initialize the global - // constants, invoked in IdComponent default constructor - static H5Library* getInstance(); // public - - // Registers cleanup and terminating functions with atexit(), - // called in IdComponent default constructor - static void initH5cpp(void); // public - - // Calls H5close to terminate the library, registered with - // atexit(), as the last thing to be done. - static void termH5cpp(void); // public - - 2. The following shows the differences between the old and new methods - for allocating the PredType constants. There are more than 100 - constants, but only one is shown here for examples. - - Old Method: - ---------- - // Declaration of the constant - in "H5PredType.h" - static const PredType NATIVE_INT; - - // Definition of the constant - in "H5PredType.cpp" - const PredType PredType::NATIVE_INT(H5T_NATIVE_INT); - - New Method: - ---------- - // Declare pointer for a constant - in "H5PredType.h" - static PredType* NATIVE_INT_; // "H5PredType.h" - - // Change previous constant to reference - in "H5PredType.h" - static const PredType& NATIVE_INT; - - // The assignment of the first static constant, named - // PREDTYPE_CONST, calls makePredTypes() which allocates the - // dynamic memory for every PredType constant. - - // Creates a dynamic PredType object representing a C constant - // - in makePredTypes() - NATIVE_INT_ = new PredType(H5T_NATIVE_INT); - - // Assign the constant reference to the dynamic object - // - in "H5PredType.cpp" - const PredType& PredType::NATIVE_INT = *NATIVE_INT_; - - Functions added to class PredType: - - // Creates the constants - static void makePredTypes(); // private - - // Calls makePredTypes to create the constants and returns - // the dummy constant PREDTYPE_CONST; - static PredType* getPredTypes(); // private - - // Deletes the constants - static void deleteConstants(); // public - - 3. This section shows the differences between the old and new methods - for allocating the DataSpace constant, DataSpace::ALL. + The C++ library has several types of global constants from different + classes, such as PropList, PredType, DataSpace, etc... Previously, + these global constants were declared statically and the C++ library used + a constant, called PredType::AtExit, to detect when all the global + contants are destroyed then close the C library (H5close). This method + relied on the order of the constants being created and destroyed and + that PredType constants be the last to be destroyed. In September + 2015, it was recognized that the order in which the global constants were + created and destroyed was actually undefined, thus can be different + between different compilers. This resulted in failure when compilers + destroy PredType constants before others because when PredType::AtExit + was destroyed, the C library was closed, so when the constants of other + classes such as PropList or DataSpace were being deleted, the C library + would not be available. + + These are the classes that have global constants: + + PredType + + DataSpace + + PropList (and its subclasses below) + + FileAccPropList + + FileCreatPropList + + DSetMemXferPropList + + DSetCreatPropList + + The new method includes these main points: + + - The C++ library uses dynamically allocated constants to have the + control in which order the global constants are created/destroyed. + + - The previous static constants are changed to be the references to + the dynamically allocated constants to avoid impact on applications. + + - The first time an IdComponent default constructor is invoked, it + will call the function H5Library::initH5cpp which registers the + terminating functions from each class that has the global constants + so that these functions can destroy those constants at the exit of the + application. IdComponent is a baseclass of any object class that has + an identifier, such as Group, DataSet, DataType,... The classes which + have the global constants are all derived from IdComponent. + + - At the normal termination of the application, each registered function + for each constant type will delete all the allocated constants in + that type class, then a different terminating function, which was also + registered with atexit() by initH5cpp, will call H5close to close the + C library. + + The following list presents the differences between the old and new + methods and the changes implemented for the new method. + + 1. The following items are added to class H5Library: + // Private instance to be created by H5Library only + static H5Library* instance; + + // Returns a singleton H5Library to initialize the global + // constants, invoked in IdComponent default constructor + static H5Library* getInstance(); // public + + // Registers cleanup and terminating functions with atexit(), + // called in IdComponent default constructor + static void initH5cpp(void); // public + + // Calls H5close to terminate the library, registered with + // atexit(), as the last thing to be done. + static void termH5cpp(void); // public + + 2. The following shows the differences between the old and new methods + for allocating the PredType constants. There are more than 100 + constants, but only one is shown here for examples. + + Old Method: + ---------- + // Declaration of the constant - in "H5PredType.h" + static const PredType NATIVE_INT; + + // Definition of the constant - in "H5PredType.cpp" + const PredType PredType::NATIVE_INT(H5T_NATIVE_INT); + + New Method: + ---------- + // Declare pointer for a constant - in "H5PredType.h" + static PredType* NATIVE_INT_; // "H5PredType.h" + + // Change previous constant to reference - in "H5PredType.h" + static const PredType& NATIVE_INT; + + // The assignment of the first static constant, named + // PREDTYPE_CONST, calls makePredTypes() which allocates the + // dynamic memory for every PredType constant. + + // Creates a dynamic PredType object representing a C constant + // - in makePredTypes() + NATIVE_INT_ = new PredType(H5T_NATIVE_INT); + + // Assign the constant reference to the dynamic object + // - in "H5PredType.cpp" + const PredType& PredType::NATIVE_INT = *NATIVE_INT_; + + Functions added to class PredType: + + // Creates the constants + static void makePredTypes(); // private + + // Calls makePredTypes to create the constants and returns + // the dummy constant PREDTYPE_CONST; + static PredType* getPredTypes(); // private + + // Deletes the constants + static void deleteConstants(); // public + + 3. This section shows the differences between the old and new methods + for allocating the DataSpace constant, DataSpace::ALL. - Old Method: - ---------- - // Declaration of the constant - in "H5DataSpace.h" - static const DataSpace ALL; + Old Method: + ---------- + // Declaration of the constant - in "H5DataSpace.h" + static const DataSpace ALL; - // Definition of the constant - in "H5DataSpace.cpp" - const DataSpace DataSpace::ALL(H5S_ALL); + // Definition of the constant - in "H5DataSpace.cpp" + const DataSpace DataSpace::ALL(H5S_ALL); - New Method: - ---------- - // Declare pointer for a constant - in "H5DataSpace.h" - static DataSpace* ALL_; // "H5DataSpace.h" + New Method: + ---------- + // Declare pointer for a constant - in "H5DataSpace.h" + static DataSpace* ALL_; // "H5DataSpace.h" - // Change previous constant to reference - in "H5DataSpace.h" - static const DataSpace& ALL; + // Change previous constant to reference - in "H5DataSpace.h" + static const DataSpace& ALL; - // Creates a dynamic DataSpace object representing the C constant - // - in "H5DataSpace.cpp" - ALL_ = new DataSpace(H5S_ALL); + // Creates a dynamic DataSpace object representing the C constant + // - in "H5DataSpace.cpp" + ALL_ = new DataSpace(H5S_ALL); - // Assign the constant reference to the dynamic object - // - in "H5DataSpace.cpp" - const DataSpace& DataSpace::ALL = *ALL_; + // Assign the constant reference to the dynamic object + // - in "H5DataSpace.cpp" + const DataSpace& DataSpace::ALL = *ALL_; - Functions added to class DataSpace: + Functions added to class DataSpace: - // Creates the constant - static DataSpace* getConstant(); // private + // Creates the constant + static DataSpace* getConstant(); // private - // Deletes the constant - static void deleteConstants(); // public + // Deletes the constant + static void deleteConstants(); // public - 4. This section shows the differences between the old and new methods - for allocating the following constants - - PropList constant, PropList::DEFAULT. - - DSetCreatPropList constant, DSetCreatPropList::DEFAULT. - - DSetMemXferPropList constant, DSetMemXferPropList::DEFAULT. - - FileCreatPropList constant, FileCreatPropList::DEFAULT. - - FileAccPropList constant, FileAccPropList::DEFAULT. + 4. This section shows the differences between the old and new methods + for allocating the following constants + - PropList constant, PropList::DEFAULT. + - DSetCreatPropList constant, DSetCreatPropList::DEFAULT. + - DSetMemXferPropList constant, DSetMemXferPropList::DEFAULT. + - FileCreatPropList constant, FileCreatPropList::DEFAULT. + - FileAccPropList constant, FileAccPropList::DEFAULT. - For these constants, the library has the same changes, except the - class names and the HDF5 corresponding constants. Only the items - of PropList are listed, and "PropList" can be replaced by any of - DSetCreatPropList, DSetMemXferPropList, FileCreatPropList, - FileAccPropList for those classes. The HDF5 C constant "H5P_DEFAULT" - can be replaced by any of these respectively: H5P_DATASET_CREATE, - H5P_DATASET_XFER, H5P_FILE_CREATE, and H5P_FILE_ACCESS. + For these constants, the library has the same changes, except the + class names and the HDF5 corresponding constants. Only the items + of PropList are listed, and "PropList" can be replaced by any of + DSetCreatPropList, DSetMemXferPropList, FileCreatPropList, + FileAccPropList for those classes. The HDF5 C constant "H5P_DEFAULT" + can be replaced by any of these respectively: H5P_DATASET_CREATE, + H5P_DATASET_XFER, H5P_FILE_CREATE, and H5P_FILE_ACCESS. - Old Method: - ---------- - // Declaration of the constant - in "H5PropList.h" - static const PropList DEFAULT; + Old Method: + ---------- + // Declaration of the constant - in "H5PropList.h" + static const PropList DEFAULT; - // Definition of the constant - in "H5PropList.cpp" - const PropList PropList::DEFAULT(H5P_DEFAULT); + // Definition of the constant - in "H5PropList.cpp" + const PropList PropList::DEFAULT(H5P_DEFAULT); - New Method: - ---------- - // Declare pointer for a constant - in "H5PropList.h" - static PropList* DEFAULT_; // "H5PropList.h" + New Method: + ---------- + // Declare pointer for a constant - in "H5PropList.h" + static PropList* DEFAULT_; // "H5PropList.h" - // Change previous constant to reference - in "H5PropList.h" - static const PropList& DEFAULT; + // Change previous constant to reference - in "H5PropList.h" + static const PropList& DEFAULT; - // Creates a dynamic PropList object representing the C constant - // - in "H5PropList.cpp" - DEFAULT_ = new PropList(H5P_DEFAULT); + // Creates a dynamic PropList object representing the C constant + // - in "H5PropList.cpp" + DEFAULT_ = new PropList(H5P_DEFAULT); - // Assign the constant reference to the dynamic object - // - in "H5PropList.cpp" - const PropList& PropList::DEFAULT = *DEFAULT_; + // Assign the constant reference to the dynamic object + // - in "H5PropList.cpp" + const PropList& PropList::DEFAULT = *DEFAULT_; - Functions added to class PropList: + Functions added to class PropList: - // Creates the constant - static PropList* getConstant(); // private + // Creates the constant + static PropList* getConstant(); // private - // Deletes the constants - static void deleteConstants(); // public + // Deletes the constants + static void deleteConstants(); // public - The same functions are added to the subclasses of PropList instead of - using PropList's because of the class types and in favor of clarity. + The same functions are added to the subclasses of PropList instead of + using PropList's because of the class types and in favor of clarity. ****************************************************************************/ diff --git a/c++/src/H5PredType.h b/c++/src/H5PredType.h index 750902e..a8d6e37 100644 --- a/c++/src/H5PredType.h +++ b/c++/src/H5PredType.h @@ -30,207 +30,207 @@ namespace H5 { */ class H5_DLLCPP PredType : public AtomType { public: - ///\brief Returns this class name. - virtual H5std_string fromClass () const { return("PredType"); } - - // Makes a copy of the predefined type and stores the new - // id in the left hand side object. - PredType& operator=( const PredType& rhs ); - - // Copy constructor - makes copy of the original object - PredType( const PredType& original ); - - // Noop destructor - virtual ~PredType(); - - /*! \brief This dummy function do not inherit from DataType - it will - throw a DataTypeIException if invoked. - */ - void commit(H5Location& loc, const H5std_string& name ); - /*! \brief This dummy function do not inherit from DataType - it will - throw a DataTypeIException if invoked. - */ - void commit(H5Location& loc, const char* name ); - /*! \brief This dummy function do not inherit from DataType - it will - throw a DataTypeIException if invoked. - */ - bool committed(); - - ///\brief PredType constants - static const PredType& STD_I8BE; - static const PredType& STD_I8LE; - static const PredType& STD_I16BE; - static const PredType& STD_I16LE; - static const PredType& STD_I32BE; - static const PredType& STD_I32LE; - static const PredType& STD_I64BE; - static const PredType& STD_I64LE; - static const PredType& STD_U8BE; - static const PredType& STD_U8LE; - static const PredType& STD_U16BE; - static const PredType& STD_U16LE; - static const PredType& STD_U32BE; - static const PredType& STD_U32LE; - static const PredType& STD_U64BE; - static const PredType& STD_U64LE; - static const PredType& STD_B8BE; - static const PredType& STD_B8LE; - static const PredType& STD_B16BE; - static const PredType& STD_B16LE; - static const PredType& STD_B32BE; - static const PredType& STD_B32LE; - static const PredType& STD_B64BE; - static const PredType& STD_B64LE; - static const PredType& STD_REF_OBJ; - static const PredType& STD_REF_DSETREG; - - static const PredType& C_S1; - static const PredType& FORTRAN_S1; - - static const PredType& IEEE_F32BE; - static const PredType& IEEE_F32LE; - static const PredType& IEEE_F64BE; - static const PredType& IEEE_F64LE; - - static const PredType& UNIX_D32BE; - static const PredType& UNIX_D32LE; - static const PredType& UNIX_D64BE; - static const PredType& UNIX_D64LE; - - static const PredType& INTEL_I8; - static const PredType& INTEL_I16; - static const PredType& INTEL_I32; - static const PredType& INTEL_I64; - static const PredType& INTEL_U8; - static const PredType& INTEL_U16; - static const PredType& INTEL_U32; - static const PredType& INTEL_U64; - static const PredType& INTEL_B8; - static const PredType& INTEL_B16; - static const PredType& INTEL_B32; - static const PredType& INTEL_B64; - static const PredType& INTEL_F32; - static const PredType& INTEL_F64; - - static const PredType& ALPHA_I8; - static const PredType& ALPHA_I16; - static const PredType& ALPHA_I32; - static const PredType& ALPHA_I64; - static const PredType& ALPHA_U8; - static const PredType& ALPHA_U16; - static const PredType& ALPHA_U32; - static const PredType& ALPHA_U64; - static const PredType& ALPHA_B8; - static const PredType& ALPHA_B16; - static const PredType& ALPHA_B32; - static const PredType& ALPHA_B64; - static const PredType& ALPHA_F32; - static const PredType& ALPHA_F64; - - static const PredType& MIPS_I8; - static const PredType& MIPS_I16; - static const PredType& MIPS_I32; - static const PredType& MIPS_I64; - static const PredType& MIPS_U8; - static const PredType& MIPS_U16; - static const PredType& MIPS_U32; - static const PredType& MIPS_U64; - static const PredType& MIPS_B8; - static const PredType& MIPS_B16; - static const PredType& MIPS_B32; - static const PredType& MIPS_B64; - static const PredType& MIPS_F32; - static const PredType& MIPS_F64; - - static const PredType& NATIVE_CHAR; - static const PredType& NATIVE_SCHAR; - static const PredType& NATIVE_UCHAR; - static const PredType& NATIVE_SHORT; - static const PredType& NATIVE_USHORT; - static const PredType& NATIVE_INT; - static const PredType& NATIVE_UINT; - static const PredType& NATIVE_LONG; - static const PredType& NATIVE_ULONG; - static const PredType& NATIVE_LLONG; - static const PredType& NATIVE_ULLONG; - static const PredType& NATIVE_FLOAT; - static const PredType& NATIVE_DOUBLE; - static const PredType& NATIVE_LDOUBLE; - static const PredType& NATIVE_B8; - static const PredType& NATIVE_B16; - static const PredType& NATIVE_B32; - static const PredType& NATIVE_B64; - static const PredType& NATIVE_OPAQUE; - static const PredType& NATIVE_HSIZE; - static const PredType& NATIVE_HSSIZE; - static const PredType& NATIVE_HERR; - static const PredType& NATIVE_HBOOL; - - static const PredType& NATIVE_INT8; - static const PredType& NATIVE_UINT8; - static const PredType& NATIVE_INT16; - static const PredType& NATIVE_UINT16; - static const PredType& NATIVE_INT32; - static const PredType& NATIVE_UINT32; - static const PredType& NATIVE_INT64; - static const PredType& NATIVE_UINT64; + ///\brief Returns this class name. + virtual H5std_string fromClass () const { return("PredType"); } + + // Makes a copy of the predefined type and stores the new + // id in the left hand side object. + PredType& operator=(const PredType& rhs); + + // Copy constructor - makes copy of the original object + PredType(const PredType& original); + + // Noop destructor + virtual ~PredType(); + + /*! \brief This dummy function do not inherit from DataType - it will + throw a DataTypeIException if invoked. + */ + void commit(H5Location& loc, const H5std_string& name); + /*! \brief This dummy function do not inherit from DataType - it will + throw a DataTypeIException if invoked. + */ + void commit(H5Location& loc, const char* name); + /*! \brief This dummy function do not inherit from DataType - it will + throw a DataTypeIException if invoked. + */ + bool committed(); + + ///\brief PredType constants + static const PredType& STD_I8BE; + static const PredType& STD_I8LE; + static const PredType& STD_I16BE; + static const PredType& STD_I16LE; + static const PredType& STD_I32BE; + static const PredType& STD_I32LE; + static const PredType& STD_I64BE; + static const PredType& STD_I64LE; + static const PredType& STD_U8BE; + static const PredType& STD_U8LE; + static const PredType& STD_U16BE; + static const PredType& STD_U16LE; + static const PredType& STD_U32BE; + static const PredType& STD_U32LE; + static const PredType& STD_U64BE; + static const PredType& STD_U64LE; + static const PredType& STD_B8BE; + static const PredType& STD_B8LE; + static const PredType& STD_B16BE; + static const PredType& STD_B16LE; + static const PredType& STD_B32BE; + static const PredType& STD_B32LE; + static const PredType& STD_B64BE; + static const PredType& STD_B64LE; + static const PredType& STD_REF_OBJ; + static const PredType& STD_REF_DSETREG; + + static const PredType& C_S1; + static const PredType& FORTRAN_S1; + + static const PredType& IEEE_F32BE; + static const PredType& IEEE_F32LE; + static const PredType& IEEE_F64BE; + static const PredType& IEEE_F64LE; + + static const PredType& UNIX_D32BE; + static const PredType& UNIX_D32LE; + static const PredType& UNIX_D64BE; + static const PredType& UNIX_D64LE; + + static const PredType& INTEL_I8; + static const PredType& INTEL_I16; + static const PredType& INTEL_I32; + static const PredType& INTEL_I64; + static const PredType& INTEL_U8; + static const PredType& INTEL_U16; + static const PredType& INTEL_U32; + static const PredType& INTEL_U64; + static const PredType& INTEL_B8; + static const PredType& INTEL_B16; + static const PredType& INTEL_B32; + static const PredType& INTEL_B64; + static const PredType& INTEL_F32; + static const PredType& INTEL_F64; + + static const PredType& ALPHA_I8; + static const PredType& ALPHA_I16; + static const PredType& ALPHA_I32; + static const PredType& ALPHA_I64; + static const PredType& ALPHA_U8; + static const PredType& ALPHA_U16; + static const PredType& ALPHA_U32; + static const PredType& ALPHA_U64; + static const PredType& ALPHA_B8; + static const PredType& ALPHA_B16; + static const PredType& ALPHA_B32; + static const PredType& ALPHA_B64; + static const PredType& ALPHA_F32; + static const PredType& ALPHA_F64; + + static const PredType& MIPS_I8; + static const PredType& MIPS_I16; + static const PredType& MIPS_I32; + static const PredType& MIPS_I64; + static const PredType& MIPS_U8; + static const PredType& MIPS_U16; + static const PredType& MIPS_U32; + static const PredType& MIPS_U64; + static const PredType& MIPS_B8; + static const PredType& MIPS_B16; + static const PredType& MIPS_B32; + static const PredType& MIPS_B64; + static const PredType& MIPS_F32; + static const PredType& MIPS_F64; + + static const PredType& NATIVE_CHAR; + static const PredType& NATIVE_SCHAR; + static const PredType& NATIVE_UCHAR; + static const PredType& NATIVE_SHORT; + static const PredType& NATIVE_USHORT; + static const PredType& NATIVE_INT; + static const PredType& NATIVE_UINT; + static const PredType& NATIVE_LONG; + static const PredType& NATIVE_ULONG; + static const PredType& NATIVE_LLONG; + static const PredType& NATIVE_ULLONG; + static const PredType& NATIVE_FLOAT; + static const PredType& NATIVE_DOUBLE; + static const PredType& NATIVE_LDOUBLE; + static const PredType& NATIVE_B8; + static const PredType& NATIVE_B16; + static const PredType& NATIVE_B32; + static const PredType& NATIVE_B64; + static const PredType& NATIVE_OPAQUE; + static const PredType& NATIVE_HSIZE; + static const PredType& NATIVE_HSSIZE; + static const PredType& NATIVE_HERR; + static const PredType& NATIVE_HBOOL; + + static const PredType& NATIVE_INT8; + static const PredType& NATIVE_UINT8; + static const PredType& NATIVE_INT16; + static const PredType& NATIVE_UINT16; + static const PredType& NATIVE_INT32; + static const PredType& NATIVE_UINT32; + static const PredType& NATIVE_INT64; + static const PredType& NATIVE_UINT64; // LEAST types #if H5_SIZEOF_INT_LEAST8_T != 0 - static const PredType& NATIVE_INT_LEAST8; + static const PredType& NATIVE_INT_LEAST8; #endif /* H5_SIZEOF_INT_LEAST8_T */ #if H5_SIZEOF_UINT_LEAST8_T != 0 - static const PredType& NATIVE_UINT_LEAST8; + static const PredType& NATIVE_UINT_LEAST8; #endif /* H5_SIZEOF_UINT_LEAST8_T */ #if H5_SIZEOF_INT_LEAST16_T != 0 - static const PredType& NATIVE_INT_LEAST16; + static const PredType& NATIVE_INT_LEAST16; #endif /* H5_SIZEOF_INT_LEAST16_T */ #if H5_SIZEOF_UINT_LEAST16_T != 0 - static const PredType& NATIVE_UINT_LEAST16; + static const PredType& NATIVE_UINT_LEAST16; #endif /* H5_SIZEOF_UINT_LEAST16_T */ #if H5_SIZEOF_INT_LEAST32_T != 0 - static const PredType& NATIVE_INT_LEAST32; + static const PredType& NATIVE_INT_LEAST32; #endif /* H5_SIZEOF_INT_LEAST32_T */ #if H5_SIZEOF_UINT_LEAST32_T != 0 - static const PredType& NATIVE_UINT_LEAST32; + static const PredType& NATIVE_UINT_LEAST32; #endif /* H5_SIZEOF_UINT_LEAST32_T */ #if H5_SIZEOF_INT_LEAST64_T != 0 - static const PredType& NATIVE_INT_LEAST64; + static const PredType& NATIVE_INT_LEAST64; #endif /* H5_SIZEOF_INT_LEAST64_T */ #if H5_SIZEOF_UINT_LEAST64_T != 0 - static const PredType& NATIVE_UINT_LEAST64; + static const PredType& NATIVE_UINT_LEAST64; #endif /* H5_SIZEOF_UINT_LEAST64_T */ // FAST types #if H5_SIZEOF_INT_FAST8_T != 0 - static const PredType& NATIVE_INT_FAST8; + static const PredType& NATIVE_INT_FAST8; #endif /* H5_SIZEOF_INT_FAST8_T */ #if H5_SIZEOF_UINT_FAST8_T != 0 - static const PredType& NATIVE_UINT_FAST8; + static const PredType& NATIVE_UINT_FAST8; #endif /* H5_SIZEOF_UINT_FAST8_T */ #if H5_SIZEOF_INT_FAST16_T != 0 - static const PredType& NATIVE_INT_FAST16; + static const PredType& NATIVE_INT_FAST16; #endif /* H5_SIZEOF_INT_FAST16_T */ #if H5_SIZEOF_UINT_FAST16_T != 0 - static const PredType& NATIVE_UINT_FAST16; + static const PredType& NATIVE_UINT_FAST16; #endif /* H5_SIZEOF_UINT_FAST16_T */ #if H5_SIZEOF_INT_FAST32_T != 0 - static const PredType& NATIVE_INT_FAST32; + static const PredType& NATIVE_INT_FAST32; #endif /* H5_SIZEOF_INT_FAST32_T */ #if H5_SIZEOF_UINT_FAST32_T != 0 - static const PredType& NATIVE_UINT_FAST32; + static const PredType& NATIVE_UINT_FAST32; #endif /* H5_SIZEOF_UINT_FAST32_T */ #if H5_SIZEOF_INT_FAST64_T != 0 - static const PredType& NATIVE_INT_FAST64; + static const PredType& NATIVE_INT_FAST64; #endif /* H5_SIZEOF_INT_FAST64_T */ #if H5_SIZEOF_UINT_FAST64_T != 0 - static const PredType& NATIVE_UINT_FAST64; + static const PredType& NATIVE_UINT_FAST64; #endif /* H5_SIZEOF_UINT_FAST64_T */ #ifndef DOXYGEN_SHOULD_SKIP_THIS @@ -242,11 +242,11 @@ class H5_DLLCPP PredType : public AtomType { static const PredType& PREDTYPE_CONST; // dummy constant protected: - // Default constructor - PredType(); + // Default constructor + PredType(); - // Creates a pre-defined type using an HDF5 pre-defined constant - PredType( const hid_t predtype_id ); // used by the library only + // Creates a pre-defined type using an HDF5 pre-defined constant + PredType(const hid_t predtype_id); // used by the library only private: // Activates the creation of the PredType global constants diff --git a/c++/src/H5PropList.cpp b/c++/src/H5PropList.cpp index f0eb847..c4176c2 100644 --- a/c++/src/H5PropList.cpp +++ b/c++/src/H5PropList.cpp @@ -21,7 +21,7 @@ #include -#include "H5private.h" // for HDmemset +#include "H5private.h" // for HDmemset #include "H5Include.h" #include "H5Exception.h" #include "H5IdComponent.h" @@ -42,7 +42,7 @@ PropList* PropList::DEFAULT_ = 0; //-------------------------------------------------------------------------- // Function: PropList::getConstant -// Purpose: Creates a PropList object representing the HDF5 constant +// Purpose Creates a PropList object representing the HDF5 constant // H5P_DEFAULT, pointed to by PropList::DEFAULT_. // Exception H5::PropListIException // Description @@ -71,7 +71,7 @@ PropList* PropList::getConstant() //-------------------------------------------------------------------------- // Function: PropList::deleteConstants -// Purpose: Deletes the constant object that PropList::DEFAULT_ points to. +// Purpose Deletes the constant object that PropList::DEFAULT_ points to. // Programmer Binh-Minh Ribler - 2015 //-------------------------------------------------------------------------- void PropList::deleteConstants() @@ -81,24 +81,24 @@ void PropList::deleteConstants() } //-------------------------------------------------------------------------- -// Purpose Constant for default property. +// Purpose Constant for default property. //-------------------------------------------------------------------------- const PropList& PropList::DEFAULT = *getConstant(); #endif // DOXYGEN_SHOULD_SKIP_THIS //-------------------------------------------------------------------------- -// Function Default constructor -///\brief Default constructor: creates a stub property list object. -// Programmer Binh-Minh Ribler - 2000 +// Function: Default constructor +///\brief Default constructor: creates a stub property list object. +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- PropList::PropList() : IdComponent(), id(H5P_DEFAULT) {} //-------------------------------------------------------------------------- -// Function: PropList copy constructor -///\brief Copy constructor -///\param original - IN: The original property list to copy -// Programmer Binh-Minh Ribler - 2000 +// Function: PropList copy constructor +///\brief Copy constructor +///\param original - IN: The original property list to copy +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- PropList::PropList(const PropList& original) : IdComponent(), id(original.id) { @@ -106,166 +106,166 @@ PropList::PropList(const PropList& original) : IdComponent(), id(original.id) } //-------------------------------------------------------------------------- -// Function: PropList overloaded constructor -///\brief Creates a property list using the id of an existing property. -///\param plist_id - IN: Id of the existing property list -///\exception H5::PropListIException +// Function: PropList overloaded constructor +///\brief Creates a property list using the id of an existing property. +///\param plist_id - IN: Id of the existing property list +///\exception H5::PropListIException // Description -// This function creates a new property list if a property -// class is provided or makes a copy of a property list if one -// is given. If the given id is anything else, then set this -// property's id to H5P_DEFAULT. -// Programmer Binh-Minh Ribler - 2000 +// This function creates a new property list if a property +// class is provided or makes a copy of a property list if one +// is given. If the given id is anything else, then set this +// property's id to H5P_DEFAULT. +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -PropList::PropList( const hid_t plist_id ) : IdComponent() +PropList::PropList(const hid_t plist_id) : IdComponent() { if (plist_id <= 0) - id = H5P_DEFAULT; + id = H5P_DEFAULT; H5I_type_t id_type = H5Iget_type(plist_id); switch (id_type) { - case H5I_GENPROP_CLS: - // call C routine to create a new property from the given prop class - id = H5Pcreate(plist_id); - if( id < 0 ) - { - throw PropListIException("PropList constructor", "H5Pcreate failed"); - } - break; - case H5I_GENPROP_LST: - // call C routine to make a copy of the given property list - id = H5Pcopy(plist_id); - if( id < 0 ) - { - throw PropListIException("PropList constructor", "H5Pcopy failed"); - } - break; - default: - id = H5P_DEFAULT; - break; + case H5I_GENPROP_CLS: + // call C routine to create a new property from the given prop class + id = H5Pcreate(plist_id); + if (id < 0) + { + throw PropListIException("PropList constructor", "H5Pcreate failed"); + } + break; + case H5I_GENPROP_LST: + // call C routine to make a copy of the given property list + id = H5Pcopy(plist_id); + if (id < 0) + { + throw PropListIException("PropList constructor", "H5Pcopy failed"); + } + break; + default: + id = H5P_DEFAULT; + break; } } //-------------------------------------------------------------------------- -// Function: PropList::copy -///\brief Makes a copy of an existing property list. -///\param like_plist - IN: Reference to the existing property list -///\exception H5::PropListIException -// Programmer Binh-Minh Ribler - 2000 +// Function: PropList::copy +///\brief Makes a copy of an existing property list. +///\param like_plist - IN: Reference to the existing property list +///\exception H5::PropListIException +// Programmer Binh-Minh Ribler - 2000 // Modification -// - Replaced resetIdComponent() with decRefCount() to use C -// library ID reference counting mechanism - BMR, Jun 1, 2004 -// - Replaced decRefCount with close() to let the C library -// handle the reference counting - BMR, Jun 1, 2006 +// - Replaced resetIdComponent() with decRefCount() to use C +// library ID reference counting mechanism - BMR, Jun 1, 2004 +// - Replaced decRefCount with close() to let the C library +// handle the reference counting - BMR, Jun 1, 2006 //-------------------------------------------------------------------------- -void PropList::copy( const PropList& like_plist ) +void PropList::copy(const PropList& like_plist) { // If this object is representing an hdf5 object, close it before // copying like_plist to it try { - close(); + close(); } catch (Exception& close_error) { - throw PropListIException(inMemFunc("copy"), close_error.getDetailMsg()); + throw PropListIException(inMemFunc("copy"), close_error.getDetailMsg()); } // call C routine to copy the property list - id = H5Pcopy( like_plist.getId() ); - if( id < 0 ) - throw PropListIException(inMemFunc("copy"), "H5Pcopy failed"); + id = H5Pcopy(like_plist.getId()); + if (id < 0) + throw PropListIException(inMemFunc("copy"), "H5Pcopy failed"); } //-------------------------------------------------------------------------- -// Function: PropList::operator= -///\brief Assignment operator. -///\param rhs - IN: Reference to the existing property list -///\return Reference to PropList instance -///\exception H5::PropListIException +// Function: PropList::operator= +///\brief Assignment operator. +///\param rhs - IN: Reference to the existing property list +///\return Reference to PropList instance +///\exception H5::PropListIException // Description -// Makes a copy of the property list on the right hand side -// and stores the new id in the left hand side object. -// Programmer Binh-Minh Ribler - 2000 +// Makes a copy of the property list on the right hand side +// and stores the new id in the left hand side object. +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -PropList& PropList::operator=( const PropList& rhs ) +PropList& PropList::operator=(const PropList& rhs) { if (this != &rhs) - copy(rhs); + copy(rhs); return(*this); } //-------------------------------------------------------------------------- -// Function: PropList::copyProp -///\brief Copies a property from this property list or class to another -///\param dest - IN: Destination property list or class -///\param name - IN: Name of the property to copy - \c char pointer -///\exception H5::PropListIException -// Programmer Binh-Minh Ribler - Jul, 2005 +// Function: PropList::copyProp +///\brief Copies a property from this property list or class to another +///\param dest - IN: Destination property list or class +///\param name - IN: Name of the property to copy - \c char pointer +///\exception H5::PropListIException +// Programmer Binh-Minh Ribler - Jul, 2005 //-------------------------------------------------------------------------- void PropList::copyProp(PropList& dest, const char *name) const { - hid_t dst_id = dest.getId(); - herr_t ret_value = H5Pcopy_prop(dst_id, id, name); - if( ret_value < 0 ) - { - throw PropListIException(inMemFunc("copyProp"), "H5Pcopy_prop failed"); - } + hid_t dst_id = dest.getId(); + herr_t ret_value = H5Pcopy_prop(dst_id, id, name); + if (ret_value < 0) + { + throw PropListIException(inMemFunc("copyProp"), "H5Pcopy_prop failed"); + } } //-------------------------------------------------------------------------- -// Function: PropList::copyProp -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function only in what arguments it -/// accepts. -///\param dest - IN: Destination property list or class -///\param name - IN: Name of the property to copy - \c H5std_string -// Programmer Binh-Minh Ribler - Jul, 2005 +// Function: PropList::copyProp +///\brief This is an overloaded member function, provided for convenience. +/// It differs from the above function only in what arguments it +/// accepts. +///\param dest - IN: Destination property list or class +///\param name - IN: Name of the property to copy - \c H5std_string +// Programmer Binh-Minh Ribler - Jul, 2005 //-------------------------------------------------------------------------- -void PropList::copyProp( PropList& dest, const H5std_string& name ) const +void PropList::copyProp(PropList& dest, const H5std_string& name) const { - copyProp( dest, name.c_str()); + copyProp(dest, name.c_str()); } //-------------------------------------------------------------------------- -// Function: PropList::copyProp -///\brief Copies a property from one list or class to another - Obsolete -///\param dest - IN: Destination property list or class -///\param src - IN: Source property list or class -///\param name - IN: Name of the property to copy - \c char pointer -///\note This member function will be removed in the next release -///\exception H5::PropListIException -// Programmer Binh-Minh Ribler - 2000 +// Function: PropList::copyProp +///\brief Copies a property from one list or class to another - Obsolete +///\param dest - IN: Destination property list or class +///\param src - IN: Source property list or class +///\param name - IN: Name of the property to copy - \c char pointer +///\note This member function will be removed in the next release +///\exception H5::PropListIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -void PropList::copyProp( PropList& dest, PropList& src, const char *name ) const +void PropList::copyProp(PropList& dest, PropList& src, const char *name) const { - hid_t dst_id = dest.getId(); - hid_t src_id = src.getId(); - herr_t ret_value = H5Pcopy_prop(dst_id, src_id, name); - if( ret_value < 0 ) - { - throw PropListIException(inMemFunc("copyProp"), "H5Pcopy_prop failed"); - } + hid_t dst_id = dest.getId(); + hid_t src_id = src.getId(); + herr_t ret_value = H5Pcopy_prop(dst_id, src_id, name); + if (ret_value < 0) + { + throw PropListIException(inMemFunc("copyProp"), "H5Pcopy_prop failed"); + } } //-------------------------------------------------------------------------- -// Function: PropList::copyProp -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function only in what arguments it -/// accepts. - Obsolete -///\param dest - IN: Destination property list or class -///\param src - IN: Source property list or class -///\param name - IN: Name of the property to copy - \c H5std_string -// Programmer Binh-Minh Ribler - 2000 +// Function: PropList::copyProp +///\brief This is an overloaded member function, provided for convenience. +/// It differs from the above function only in what arguments it +/// accepts. - Obsolete +///\param dest - IN: Destination property list or class +///\param src - IN: Source property list or class +///\param name - IN: Name of the property to copy - \c H5std_string +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -void PropList::copyProp( PropList& dest, PropList& src, const H5std_string& name ) const +void PropList::copyProp(PropList& dest, PropList& src, const H5std_string& name) const { - copyProp( dest, src, name.c_str()); + copyProp(dest, src, name.c_str()); } //-------------------------------------------------------------------------- // Function: PropList::getId -///\brief Get the id of this property list -///\return Property list identifier +///\brief Get the id of this property list +///\return Property list identifier // Description: // Class hierarchy is revised to address bugzilla 1068. Class // AbstractDS and Attribute are moved out of H5Object. In @@ -275,7 +275,7 @@ void PropList::copyProp( PropList& dest, PropList& src, const H5std_string& name //-------------------------------------------------------------------------- hid_t PropList::getId() const { - return(id); + return(id); } #ifndef DOXYGEN_SHOULD_SKIP_THIS @@ -307,444 +307,441 @@ void PropList::p_setId(const hid_t new_id) #endif // DOXYGEN_SHOULD_SKIP_THIS //-------------------------------------------------------------------------- -// Function: PropList::close -///\brief Closes the property list if it is not a default one. +// Function: PropList::close +///\brief Closes the property list if it is not a default one. /// -///\exception H5::PropListIException -// Programmer Binh-Minh Ribler - Mar 9, 2005 +///\exception H5::PropListIException +// Programmer Binh-Minh Ribler - Mar 9, 2005 //-------------------------------------------------------------------------- void PropList::close() { if (p_valid_id(id)) { - herr_t ret_value = H5Pclose( id ); - if( ret_value < 0 ) - { - throw PropListIException(inMemFunc("close"), "H5Pclose failed"); - } - // reset the id - id = H5I_INVALID_HID; + herr_t ret_value = H5Pclose(id); + if (ret_value < 0) + { + throw PropListIException(inMemFunc("close"), "H5Pclose failed"); + } + // reset the id + id = H5I_INVALID_HID; } } //-------------------------------------------------------------------------- -// Function: PropList::getClass -///\brief Returns the class of this property list, i.e. \c H5P_FILE_CREATE... -///\return The property list class if it is not equal to \c H5P_ROOT -///\exception H5::PropListIException -// Programmer Binh-Minh Ribler - April, 2004 +// Function: PropList::getClass +///\brief Returns the class of this property list, i.e. \c H5P_FILE_CREATE... +///\return The property list class if it is not equal to \c H5P_ROOT +///\exception H5::PropListIException +// Programmer Binh-Minh Ribler - April, 2004 //-------------------------------------------------------------------------- hid_t PropList::getClass() const { - hid_t plist_class = H5Pget_class( id ); - if( plist_class == H5P_ROOT ) - { - throw PropListIException(inMemFunc("getClass"), - "H5Pget_class failed - returned H5P_ROOT"); - } - return( plist_class ); + hid_t plist_class = H5Pget_class(id); + if (plist_class == H5P_ROOT) + { + throw PropListIException(inMemFunc("getClass"), + "H5Pget_class failed - returned H5P_ROOT"); + } + return(plist_class); } //-------------------------------------------------------------------------- -// Function: PropList::propExist -///\brief Query the existance of a property in a property object. -///\param name - IN: Name of property to check for - \c char pointer -///\return true if the property exists in the property object, and -/// false, otherwise. -///\exception H5::PropListIException +// Function: PropList::propExist +///\brief Queries the existence of a property in a property object. +///\param name - IN: Name of property to check for - \c char pointer +///\return true if the property exists in the property object, and +/// false, otherwise. +///\exception H5::PropListIException ///\par Description -/// This routine checks if a property exists within a property -/// list or class. +/// This routine checks if a property exists within a property +/// list or class. // Programmer: Binh-Minh Ribler - April, 2004 //-------------------------------------------------------------------------- -bool PropList::propExist(const char* name ) const -{ - // Calls C routine H5Pexist to determine whether a property exists - // within a property list or class. It returns a positive value, 0, - // or a negative value - htri_t ret_value = H5Pexist(id, name); - if( ret_value > 0 ) - return true; - else if( ret_value == 0 ) - return false; - else // Raise exception when H5Pexist returns a negative value - { - throw PropListIException(inMemFunc("propExist"), "H5Pexist failed"); - } -} -//-------------------------------------------------------------------------- -// Function: PropList::propExist -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function only in what arguments it -/// accepts. -///\param name - IN: Name of property to check for - \c H5std_string +bool PropList::propExist(const char* name) const +{ + // Calls C routine H5Pexist to determine whether a property exists + // within a property list or class. It returns a positive value, 0, + // or a negative value + htri_t ret_value = H5Pexist(id, name); + if (ret_value > 0) + return true; + else if (ret_value == 0) + return false; + else // Raise exception when H5Pexist returns a negative value + { + throw PropListIException(inMemFunc("propExist"), "H5Pexist failed"); + } +} +//-------------------------------------------------------------------------- +// Function: PropList::propExist +///\brief This is an overloaded member function, provided for convenience. +/// It differs from the above function only in what arguments it +/// accepts. +///\param name - IN: Name of property to check for - \c H5std_string // Programmer: Binh-Minh Ribler - April, 2004 //-------------------------------------------------------------------------- -bool PropList::propExist(const H5std_string& name ) const +bool PropList::propExist(const H5std_string& name) const { - return( propExist( name.c_str()) ); + return(propExist( name.c_str())); } //-------------------------------------------------------------------------- -// Function: PropList::closeClass -///\brief Close a property list class. +// Function: PropList::closeClass +///\brief Close a property list class. /// -///\exception H5::PropListIException +///\exception H5::PropListIException ///\par Description -/// Releases memory and detaches a class from the property -/// list class hierarchy. +/// Releases memory and detaches a class from the property +/// list class hierarchy. // Programmer: Binh-Minh Ribler - April, 2004 //-------------------------------------------------------------------------- void PropList::closeClass() const { - herr_t ret_value = H5Pclose_class(id); - if( ret_value < 0 ) - { - throw PropListIException(inMemFunc("closeClass"), "H5Pclose_class failed"); - } + herr_t ret_value = H5Pclose_class(id); + if (ret_value < 0) + { + throw PropListIException(inMemFunc("closeClass"), "H5Pclose_class failed"); + } } //-------------------------------------------------------------------------- -// Function: PropList::getProperty -///\brief Query the value of a property in a property list. -///\param name - IN: Name of property to query - \c char pointer -///\param value - OUT: Pointer to the buffer for the property value -///\exception H5::PropListIException +// Function: PropList::getProperty +///\brief Query the value of a property in a property list. +///\param name - IN: Name of property to query - \c char pointer +///\param value - OUT: Pointer to the buffer for the property value +///\exception H5::PropListIException ///\par Description -/// Retrieves a copy of the value for a property in a property -/// list. The property name must exist or this routine will -/// throw an exception. +/// Retrieves a copy of the value for a property in a property +/// list. The property name must exist or this routine will +/// throw an exception. // Programmer: Binh-Minh Ribler - April, 2004 //-------------------------------------------------------------------------- void PropList::getProperty(const char* name, void* value) const { - herr_t ret_value = H5Pget(id, name, value); - if (ret_value < 0) - { - throw PropListIException(inMemFunc("getProperty"), "H5Pget failed"); - } + herr_t ret_value = H5Pget(id, name, value); + if (ret_value < 0) + { + throw PropListIException(inMemFunc("getProperty"), "H5Pget failed"); + } } //-------------------------------------------------------------------------- -// Function: PropList::getProperty -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function only in what arguments it -/// accepts. -///\param name - IN: Name of property to query - \c char pointer -///\return The property that is a \c H5std_string. -///\exception H5::PropListIException +// Function: PropList::getProperty +///\brief This is an overloaded member function, provided for convenience. +/// It differs from the above function only in what arguments it +/// accepts. +///\param name - IN: Name of property to query - \c char pointer +///\return The property that is a \c H5std_string. +///\exception H5::PropListIException // Programmer: Binh-Minh Ribler - April, 2004 //-------------------------------------------------------------------------- H5std_string PropList::getProperty(const char* name) const { - // Get property size first - size_t size = getPropSize(name); + // Get property size first + size_t size = getPropSize(name); - // Allocate buffer then get the property - char* prop_strg_C = new char[size+1]; // temporary C-string for C API - HDmemset(prop_strg_C, 0, size+1); // clear buffer + // Allocate buffer then get the property + char* prop_strg_C = new char[size+1]; // temporary C-string for C API + HDmemset(prop_strg_C, 0, size+1); // clear buffer - herr_t ret_value = H5Pget(id, name, prop_strg_C); // call C API + herr_t ret_value = H5Pget(id, name, prop_strg_C); // call C API - // Throw exception if H5Pget returns failure - if (ret_value < 0) - { + // Throw exception if H5Pget returns failure + if (ret_value < 0) + { delete []prop_strg_C; - throw PropListIException(inMemFunc("getProperty"), "H5Pget failed"); - } + throw PropListIException(inMemFunc("getProperty"), "H5Pget failed"); + } - // Return propety value as a string after deleting temp C-string - H5std_string prop_strg(prop_strg_C); - delete []prop_strg_C; - return (prop_strg); + // Return propety value as a string after deleting temp C-string + H5std_string prop_strg(prop_strg_C); + delete []prop_strg_C; + return (prop_strg); } //-------------------------------------------------------------------------- -// Function: PropList::getProperty -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function only in what arguments it -/// accepts. -///\param name - IN: Name of property to query - \c H5std_string -///\param value - OUT: Pointer to the buffer for the property value +// Function: PropList::getProperty +///\brief This is an overloaded member function, provided for convenience. +/// It differs from the above function only in what arguments it +/// accepts. +///\param name - IN: Name of property to query - \c H5std_string +///\param value - OUT: Pointer to the buffer for the property value // Programmer: Binh-Minh Ribler - April, 2004 //-------------------------------------------------------------------------- void PropList::getProperty(const H5std_string& name, void* value) const { - getProperty(name.c_str(), value); + getProperty(name.c_str(), value); } //-------------------------------------------------------------------------- -// Function: PropList::getProperty -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function only in what arguments it -/// accepts. -///\param name - IN: Name of property to query - \c H5std_string -///\return The property that is a \c H5std_string. +// Function: PropList::getProperty +///\brief This is an overloaded member function, provided for convenience. +/// It differs from the above function only in what arguments it +/// accepts. +///\param name - IN: Name of property to query - \c H5std_string +///\return The property that is a \c H5std_string. // Programmer: Binh-Minh Ribler - April, 2004 //-------------------------------------------------------------------------- H5std_string PropList::getProperty(const H5std_string& name) const { - return (getProperty(name.c_str())); + return (getProperty(name.c_str())); } //-------------------------------------------------------------------------- -// Function: PropList::getPropSize -///\brief Query the size of a property in a property list or class. -///\param name - IN: Name of property to query -///\return Size of the property -///\exception H5::PropListIException +// Function: PropList::getPropSize +///\brief Query the size of a property in a property list or class. +///\param name - IN: Name of property to query +///\return Size of the property +///\exception H5::PropListIException ///\par Description -/// This routine retrieves the size of a property's value -/// in bytes. Zero-sized properties are allowed and the return -/// value will be of 0. This function works for both property -/// lists and classes. +/// This routine retrieves the size of a property's value +/// in bytes. Zero-sized properties are allowed and the return +/// value will be of 0. This function works for both property +/// lists and classes. // Programmer: Binh-Minh Ribler - April, 2004 //-------------------------------------------------------------------------- size_t PropList::getPropSize(const char *name) const { - size_t prop_size; - herr_t ret_value = H5Pget_size(id, name, &prop_size); - if (ret_value < 0) - { - throw PropListIException(inMemFunc("getPropSize"), "H5Pget_size failed"); - } - return(prop_size); + size_t prop_size; + herr_t ret_value = H5Pget_size(id, name, &prop_size); + if (ret_value < 0) + { + throw PropListIException(inMemFunc("getPropSize"), "H5Pget_size failed"); + } + return(prop_size); } //-------------------------------------------------------------------------- -// Function: PropList::getPropSize -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function only in what arguments it -/// accepts. -///\param name - IN: Name of property to query - \c H5std_string +// Function: PropList::getPropSize +///\brief This is an overloaded member function, provided for convenience. +/// It differs from the above function only in what arguments it +/// accepts. +///\param name - IN: Name of property to query - \c H5std_string /// // Programmer: Binh-Minh Ribler - April, 2004 //-------------------------------------------------------------------------- size_t PropList::getPropSize(const H5std_string& name) const { - return (getPropSize(name.c_str())); + return (getPropSize(name.c_str())); } //-------------------------------------------------------------------------- -// Function: PropList::getClassName -///\brief Return the name of a generic property list class. -///\return A string containing the class name, if success, otherwise, -/// a NULL string. +// Function: PropList::getClassName +///\brief Return the name of a generic property list class. +///\return A string containing the class name, if success, otherwise, +/// a NULL string. // Programmer: Binh-Minh Ribler - April, 2004 //-------------------------------------------------------------------------- H5std_string PropList::getClassName() const { - char* temp_str; - temp_str = H5Pget_class_name(id); // this API specified that temp_str must - // be freed. - - if (temp_str != NULL) - { - H5std_string class_name(temp_str); - H5free_memory(temp_str); - return(class_name); - } - else - return 0; + char* temp_str; + temp_str = H5Pget_class_name(id); + if (temp_str != NULL) + { + H5std_string class_name(temp_str); + H5free_memory(temp_str); + return(class_name); + } + else + return 0; } //-------------------------------------------------------------------------- -// Function: PropList::getNumProps -///\brief Returns the number of properties in this property list or class. -///\return Size of the property. -///\exception H5::PropListIException +// Function: PropList::getNumProps +///\brief Returns the number of properties in this property list or class. +///\return Size of the property. +///\exception H5::PropListIException // Programmer: Binh-Minh Ribler - April, 2004 //-------------------------------------------------------------------------- size_t PropList::getNumProps() const { - size_t nprops; - herr_t ret_value = H5Pget_nprops (id, &nprops); - if (ret_value < 0) - { - throw PropListIException(inMemFunc("getNumProps"), "H5Pget_nprops failed"); - } - return (nprops); + size_t nprops; + herr_t ret_value = H5Pget_nprops (id, &nprops); + if (ret_value < 0) + { + throw PropListIException(inMemFunc("getNumProps"), "H5Pget_nprops failed"); + } + return (nprops); } //-------------------------------------------------------------------------- -// Function: PropList::setProperty -///\brief Set a property's value in a property list. -///\param name - IN: Name of property to set - \c char pointer -///\param value - IN: Void pointer to the value for the property -///\exception H5::PropListIException +// Function: PropList::setProperty +///\brief Set a property's value in a property list. +///\param name - IN: Name of property to set - \c char pointer +///\param value - IN: Void pointer to the value for the property +///\exception H5::PropListIException // Programmer: Binh-Minh Ribler - April, 2004 //-------------------------------------------------------------------------- void PropList::setProperty(const char* name, void* value) const { - herr_t ret_value = H5Pset(id, name, value); - if (ret_value < 0) - { - throw PropListIException(inMemFunc("setProperty"), "H5Pset failed"); - } + herr_t ret_value = H5Pset(id, name, value); + if (ret_value < 0) + { + throw PropListIException(inMemFunc("setProperty"), "H5Pset failed"); + } } //-------------------------------------------------------------------------- -// Function: PropList::setProperty -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function only in what arguments it -/// accepts. -///\param name - IN: Name of property to set - \c char pointer -///\param charptr - IN: Char pointer to the value for the property +// Function: PropList::setProperty +///\brief This is an overloaded member function, provided for convenience. +/// It differs from the above function only in what arguments it +/// accepts. +///\param name - IN: Name of property to set - \c char pointer +///\param charptr - IN: Char pointer to the value for the property // Programmer: Binh-Minh Ribler - April, 2004 //-------------------------------------------------------------------------- void PropList::setProperty(const char* name, const char* charptr) const { - herr_t ret_value = H5Pset(id, name, (void*)charptr); - if (ret_value < 0) - { - throw PropListIException(inMemFunc("setProperty"), "H5Pset failed"); - } + herr_t ret_value = H5Pset(id, name, (void*)charptr); + if (ret_value < 0) + { + throw PropListIException(inMemFunc("setProperty"), "H5Pset failed"); + } } //-------------------------------------------------------------------------- -// Function: PropList::setProperty -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function only in what arguments it -/// accepts. -///\param name - IN: Name of property to set - \c char pointer -///\param strg - IN: Value for the property is a \c H5std_string +// Function: PropList::setProperty +///\brief This is an overloaded member function, provided for convenience. +/// It differs from the above function only in what arguments it +/// accepts. +///\param name - IN: Name of property to set - \c char pointer +///\param strg - IN: Value for the property is a \c H5std_string // Programmer: Binh-Minh Ribler - April, 2004 //-------------------------------------------------------------------------- void PropList::setProperty(const char* name, H5std_string& strg) const { - setProperty(name, strg.c_str()); + setProperty(name, strg.c_str()); } //-------------------------------------------------------------------------- -// Function: PropList::setProperty -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function only in what arguments it -/// accepts. -///\param name - IN: Name of property to set - \c H5std_string -///\param value - IN: Void pointer to the value for the property +// Function: PropList::setProperty +///\brief This is an overloaded member function, provided for convenience. +/// It differs from the above function only in what arguments it +/// accepts. +///\param name - IN: Name of property to set - \c H5std_string +///\param value - IN: Void pointer to the value for the property // Programmer: Binh-Minh Ribler - April, 2004 //-------------------------------------------------------------------------- void PropList::setProperty(const H5std_string& name, void* value) const { - setProperty(name.c_str(), value); + setProperty(name.c_str(), value); } //-------------------------------------------------------------------------- -// Function: PropList::setProperty -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function only in what arguments it -/// accepts. -///\param name - IN: Name of property to set - \c H5std_string -///\param strg - IN: Value for the property is a \c H5std_string +// Function: PropList::setProperty +///\brief This is an overloaded member function, provided for convenience. +/// It differs from the above function only in what arguments it +/// accepts. +///\param name - IN: Name of property to set - \c H5std_string +///\param strg - IN: Value for the property is a \c H5std_string // Programmer: Binh-Minh Ribler - April, 2004 //-------------------------------------------------------------------------- void PropList::setProperty(const H5std_string& name, H5std_string& strg) const { - setProperty(name.c_str(), strg.c_str()); + setProperty(name.c_str(), strg.c_str()); } //-------------------------------------------------------------------------- -// Function: PropList::isAClass -///\brief Determines whether a property list is a certain class. -///\param prop_class - IN: Property class to query -///\return true if the property list is a member of the property list -/// class, and false, otherwise. -///\exception H5::PropListIException +// Function: PropList::isAClass +///\brief Determines whether a property list is a certain class. +///\param prop_class - IN: Property class to query +///\return true if the property list is a member of the property list +/// class, and false, otherwise. +///\exception H5::PropListIException // Programmer: Binh-Minh Ribler - April, 2004 //-------------------------------------------------------------------------- bool PropList::isAClass(const PropList& prop_class) const { - htri_t ret_value = H5Pisa_class(id, prop_class.getId()); - if( ret_value > 0 ) - return true; - else if( ret_value == 0 ) - return false; - else // Raise exception when H5Pisa_class returns a negative value - { - throw PropListIException(inMemFunc("isAClass"), "H5Pisa_class failed"); - } - + htri_t ret_value = H5Pisa_class(id, prop_class.getId()); + if (ret_value > 0) + return true; + else if (ret_value == 0) + return false; + else // Raise exception when H5Pisa_class returns a negative value + { + throw PropListIException(inMemFunc("isAClass"), "H5Pisa_class failed"); + } } //-------------------------------------------------------------------------- -// Function: PropList::removeProp -///\brief Removes a property from a property list. -///\param name - IN: Name of property to remove - \c char pointer -///\exception H5::PropListIException +// Function: PropList::removeProp +///\brief Removes a property from a property list. +///\param name - IN: Name of property to remove - \c char pointer +///\exception H5::PropListIException // Programmer: Binh-Minh Ribler - April, 2004 //-------------------------------------------------------------------------- void PropList::removeProp(const char *name) const { - herr_t ret_value = H5Premove(id, name); - if (ret_value < 0) - { - throw PropListIException(inMemFunc("removeProp"), "H5Premove failed"); - } + herr_t ret_value = H5Premove(id, name); + if (ret_value < 0) + { + throw PropListIException(inMemFunc("removeProp"), "H5Premove failed"); + } } //-------------------------------------------------------------------------- -// Function: PropList::removeProp -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function only in what arguments it -/// accepts. -///\param name - IN: Name of property to remove - \c H5std_string +// Function: PropList::removeProp +///\brief This is an overloaded member function, provided for convenience. +/// It differs from the above function only in what arguments it +/// accepts. +///\param name - IN: Name of property to remove - \c H5std_string // Programmer: Binh-Minh Ribler - April, 2004 //-------------------------------------------------------------------------- void PropList::removeProp(const H5std_string& name) const { - removeProp(name.c_str()); + removeProp(name.c_str()); } //-------------------------------------------------------------------------- -// Function: PropList::operator== -///\brief Compares this property list or class against the given list or class. -///\param rhs - IN: Reference to the property list to compare -///\return true if the property lists or classes are equal, and -/// false, otherwise. -///\exception H5::PropListIException +// Function: PropList::operator== +///\brief Compares this property list or class against the given list or class. +///\param rhs - IN: Reference to the property list to compare +///\return true if the property lists or classes are equal, and +/// false, otherwise. +///\exception H5::PropListIException // Programmer: Binh-Minh Ribler - April, 2004 //-------------------------------------------------------------------------- bool PropList::operator==(const PropList& rhs) const { - htri_t ret_value = H5Pequal(id, rhs.getId()); - if( ret_value > 0 ) - return true; - else if( ret_value == 0 ) - return false; - else // Raise exception when H5Pequal returns a negative value - { - throw PropListIException(inMemFunc("operator=="), "H5Pequal failed"); - } + htri_t ret_value = H5Pequal(id, rhs.getId()); + if (ret_value > 0) + return true; + else if (ret_value == 0) + return false; + else // Raise exception when H5Pequal returns a negative value + { + throw PropListIException(inMemFunc("operator=="), "H5Pequal failed"); + } } //-------------------------------------------------------------------------- -// Function: PropList::getClassParent -///\brief Returns the parent class of a generic property class -///\return The parent class of a property class -///\exception H5::PropListIException +// Function: PropList::getClassParent +///\brief Returns the parent class of a generic property class +///\return The parent class of a property class +///\exception H5::PropListIException // Programmer: Binh-Minh Ribler - April, 2004 //-------------------------------------------------------------------------- PropList PropList::getClassParent() const { - hid_t class_id = H5Pget_class_parent(id); - if (class_id < 0) - { - throw PropListIException(inMemFunc("getClassParent"), "H5Pget_class_parent failed"); - } - PropList pclass(class_id); - return(pclass); + hid_t class_id = H5Pget_class_parent(id); + if (class_id < 0) + { + throw PropListIException(inMemFunc("getClassParent"), "H5Pget_class_parent failed"); + } + PropList pclass(class_id); + return(pclass); } //-------------------------------------------------------------------------- -// Function: PropList destructor -///\brief Properly terminates access to this property list. -// Programmer Binh-Minh Ribler - 2000 +// Function: PropList destructor +///\brief Properly terminates access to this property list. +// Programmer Binh-Minh Ribler - 2000 // Modification -// - Replaced resetIdComponent() with decRefCount() to use C -// library ID reference counting mechanism - BMR, Jun 1, 2004 -// - Replaced decRefCount with close() to let the C library -// handle the reference counting - BMR, Jun 1, 2006 +// - Replaced resetIdComponent() with decRefCount() to use C +// library ID reference counting mechanism - BMR, Jun 1, 2004 +// - Replaced decRefCount with close() to let the C library +// handle the reference counting - BMR, Jun 1, 2006 //-------------------------------------------------------------------------- PropList::~PropList() { try { - close(); + close(); } catch (Exception& close_error) { - cerr << "PropList::~PropList - " << close_error.getDetailMsg() << endl; + cerr << "PropList::~PropList - " << close_error.getDetailMsg() << endl; } } diff --git a/c++/src/H5PropList.h b/c++/src/H5PropList.h index faaf68d..3977774 100644 --- a/c++/src/H5PropList.h +++ b/c++/src/H5PropList.h @@ -28,111 +28,111 @@ namespace H5 { */ class H5_DLLCPP PropList : public IdComponent { public: - ///\brief Default property list + ///\brief Default property list static const PropList& DEFAULT; - // Creates a property list of a given type or creates a copy of an - // existing property list giving the property list id. - PropList(const hid_t plist_id); + // Creates a property list of a given type or creates a copy of an + // existing property list giving the property list id. + PropList(const hid_t plist_id); - // Make a copy of the given property list using assignment statement - PropList& operator=( const PropList& rhs ); + // Make a copy of the given property list using assignment statement + PropList& operator=(const PropList& rhs); - // Compares this property list or class against the given list or class. - bool operator==(const PropList& rhs) const; + // Compares this property list or class against the given list or class. + bool operator==(const PropList& rhs) const; - // Close this property list. - virtual void close(); + // Close this property list. + virtual void close(); - // Close a property list class. - void closeClass() const; + // Close a property list class. + void closeClass() const; - // Makes a copy of the given property list. - void copy( const PropList& like_plist ); + // Makes a copy of the given property list. + void copy(const PropList& like_plist); - // Copies a property from this property list or class to another - void copyProp( PropList& dest, const char* name) const; - void copyProp( PropList& dest, const H5std_string& name) const; + // Copies a property from this property list or class to another + void copyProp(PropList& dest, const char* name) const; + void copyProp(PropList& dest, const H5std_string& name) const; - // Copies a property from one property list or property class to another - void copyProp( PropList& dest, PropList& src, const char* name) const; - void copyProp( PropList& dest, PropList& src, const H5std_string& name) const; + // Copies a property from one property list or property class to another + void copyProp(PropList& dest, PropList& src, const char* name) const; + void copyProp(PropList& dest, PropList& src, const H5std_string& name) const; - // Gets the class of this property list, i.e. H5P_FILE_CREATE, - // H5P_FILE_ACCESS, ... - hid_t getClass() const; + // Gets the class of this property list, i.e. H5P_FILE_CREATE, + // H5P_FILE_ACCESS, ... + hid_t getClass() const; - // Return the name of a generic property list class. - H5std_string getClassName() const; + // Return the name of a generic property list class. + H5std_string getClassName() const; - // Returns the parent class of a generic property class. - PropList getClassParent() const; + // Returns the parent class of a generic property class. + PropList getClassParent() const; - // Returns the number of properties in this property list or class. - size_t getNumProps() const; + // Returns the number of properties in this property list or class. + size_t getNumProps() const; - // Query the value of a property in a property list. - void getProperty(const char* name, void* value) const; - void getProperty(const H5std_string& name, void* value) const; - H5std_string getProperty(const char* name) const; - H5std_string getProperty(const H5std_string& name) const; + // Query the value of a property in a property list. + void getProperty(const char* name, void* value) const; + void getProperty(const H5std_string& name, void* value) const; + H5std_string getProperty(const char* name) const; + H5std_string getProperty(const H5std_string& name) const; - // Set a property's value in a property list. - void setProperty(const char* name, void* value) const; - void setProperty(const char* name, const char* charptr) const; - void setProperty(const char* name, H5std_string& strg) const; - void setProperty(const H5std_string& name, void* value) const; - void setProperty(const H5std_string& name, H5std_string& strg) const; + // Set a property's value in a property list. + void setProperty(const char* name, void* value) const; + void setProperty(const char* name, const char* charptr) const; + void setProperty(const char* name, H5std_string& strg) const; + void setProperty(const H5std_string& name, void* value) const; + void setProperty(const H5std_string& name, H5std_string& strg) const; - // Query the size of a property in a property list or class. - size_t getPropSize(const char *name) const; - size_t getPropSize(const H5std_string& name) const; + // Query the size of a property in a property list or class. + size_t getPropSize(const char *name) const; + size_t getPropSize(const H5std_string& name) const; - // Determines whether a property list is a certain class. - bool isAClass(const PropList& prop_class) const; + // Determines whether a property list is a certain class. + bool isAClass(const PropList& prop_class) const; - /// Query the existance of a property in a property object. - bool propExist(const char* name) const; - bool propExist(const H5std_string& name) const; + /// Query the existance of a property in a property object. + bool propExist(const char* name) const; + bool propExist(const H5std_string& name) const; - // Removes a property from a property list. - void removeProp(const char *name) const; - void removeProp(const H5std_string& name) const; + // Removes a property from a property list. + void removeProp(const char *name) const; + void removeProp(const H5std_string& name) const; - ///\brief Returns this class name. - virtual H5std_string fromClass () const { return("PropList"); } + ///\brief Returns this class name. + virtual H5std_string fromClass () const { return("PropList"); } - // Default constructor: creates a stub PropList object. - PropList(); + // Default constructor: creates a stub PropList object. + PropList(); - // Copy constructor: creates a copy of a PropList object. - PropList(const PropList& original); + // Copy constructor: creates a copy of a PropList object. + PropList(const PropList& original); - // Gets the property list id. - virtual hid_t getId() const; + // Gets the property list id. + virtual hid_t getId() const; - // Destructor: properly terminates access to this property list. - virtual ~PropList(); + // Destructor: properly terminates access to this property list. + virtual ~PropList(); #ifndef DOXYGEN_SHOULD_SKIP_THIS - // Deletes the PropList global constant - static void deleteConstants(); + // Deletes the PropList global constant + static void deleteConstants(); protected: - hid_t id; // HDF5 property list id + hid_t id; // HDF5 property list id - // Sets the property list id. - virtual void p_setId(const hid_t new_id); + // Sets the property list id. + virtual void p_setId(const hid_t new_id); private: - static PropList* DEFAULT_; + static PropList* DEFAULT_; - // Dynamically allocates the PropList global constant - static PropList* getConstant(); + // Dynamically allocates the PropList global constant + static PropList* getConstant(); - // Friend function to set PropList id. For library use only. - friend void f_PropList_setId(PropList* plist, hid_t new_id); + // Friend function to set PropList id. For library use only. + friend void f_PropList_setId(PropList* plist, hid_t new_id); #endif // DOXYGEN_SHOULD_SKIP_THIS }; diff --git a/c++/src/H5StrType.cpp b/c++/src/H5StrType.cpp index 50c9e45..54981ab 100644 --- a/c++/src/H5StrType.cpp +++ b/c++/src/H5StrType.cpp @@ -36,249 +36,247 @@ namespace H5 { //-------------------------------------------------------------------------- -// Function: StrType default constructor -///\brief Default constructor: Creates a stub string datatype -// Programmer Binh-Minh Ribler - 2000 +// Function: StrType default constructor +///\brief Default constructor: Creates a stub string datatype +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- StrType::StrType() : AtomType() {} //-------------------------------------------------------------------------- -// Function: StrType overloaded constructor -///\brief Creates a string datatype using a predefined type. -///\param pred_type - IN: Predefined datatype -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 +// Function: StrType overloaded constructor +///\brief Creates a string datatype using a predefined type. +///\param pred_type - IN: Predefined datatype +///\exception H5::DataTypeIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -StrType::StrType( const PredType& pred_type ) : AtomType() +StrType::StrType(const PredType& pred_type) : AtomType() { - // use DataType::copy to make a copy of this predefined type - copy( pred_type ); + // use DataType::copy to make a copy of this predefined type + copy(pred_type); } //-------------------------------------------------------------------------- -// Function: StrType overloaded constructor -// Purpose Creates a string datatype with a specified length -// Param pred_type - IN: String predefined type to replicate. -// Param size - IN: Length of the new string type -// Exception H5::DataTypeIException +// Function: StrType overloaded constructor +// Purpose Creates a string datatype with a specified length +// Param pred_type - IN: String predefined type to replicate. +// Param size - IN: Length of the new string type +// Exception H5::DataTypeIException // Description -// The 1st argument could have been skipped, but this -// constructor will collide with the one that takes an -// existing id. +// The 1st argument could have been skipped, but this +// constructor will collide with the one that takes an +// existing id. // -// Update: replacing the 1st argument with a dummy 0 to -// avoid the clashing problem, that doesn't eliminate the -// the 1st argument but it's simpler for the user to type -// a '0' than PredType::C_S1. - Dec 2, 2005 +// Update: replacing the 1st argument with a dummy 0 to +// avoid the clashing problem, that doesn't eliminate the +// the 1st argument but it's simpler for the user to type +// a '0' than PredType::C_S1. - Dec 2, 2005 // Note -// The use of this constructor can be shortened by using -// its overloaded below as StrType(0, size). -// Programmer Binh-Minh Ribler - 2000 +// The use of this constructor can be shortened by using +// its overloaded below as StrType(0, size). +// Programmer Binh-Minh Ribler - 2000 // Modification -// Planned for removal. -BMR, 2005/12/02 -// Removed from documentation. -BMR, 2016/03/07 +// Planned for removal. -BMR, 2005/12/02 +// Removed from documentation. -BMR, 2016/03/07 //-------------------------------------------------------------------------- -StrType::StrType( const PredType& pred_type, const size_t& size ) : AtomType() +StrType::StrType(const PredType& pred_type, const size_t& size) : AtomType() { - // use DataType::copy to make a copy of the string predefined type - // then set its length - copy(pred_type); - setSize(size); + // use DataType::copy to make a copy of the string predefined type + // then set its length + copy(pred_type); + setSize(size); } //-------------------------------------------------------------------------- -// Function: StrType overloaded constructor -///\brief Creates a string datatype with a specified length -///\param dummy - IN: To simplify calling the previous constructor -/// and avoid prototype clash with another constructor -///\param size - IN: Length of the new string type -///\exception H5::DataTypeIException +// Function: StrType overloaded constructor +///\brief Creates a string datatype with a specified length +///\param dummy - IN: To simplify calling the previous constructor +/// and avoid prototype clash with another constructor +///\param size - IN: Length of the new string type +///\exception H5::DataTypeIException ///\par Description -/// The 1st argument is just a dummy to simplify calling the -/// previous constructor, such as: -/// StrType atype(0, size) instead of -/// StrType atype(PredType::C_S1, size) +/// The 1st argument is just a dummy to simplify calling the +/// previous constructor, such as: +/// StrType atype(0, size) instead of +/// StrType atype(PredType::C_S1, size) // Note -// This constructor replaced the previous one. -// Programmer Binh-Minh Ribler - Nov 28, 2005 +// This constructor replaced the previous one. +// Programmer Binh-Minh Ribler - Nov 28, 2005 //-------------------------------------------------------------------------- -StrType::StrType( const int dummy, const size_t& size ) : AtomType() +StrType::StrType(const int dummy, const size_t& size) : AtomType() { - // use DataType::copy to make a copy of the string predefined type - // then set its length - copy(PredType::C_S1); - setSize(size); + // use DataType::copy to make a copy of the string predefined type + // then set its length + copy(PredType::C_S1); + setSize(size); } //-------------------------------------------------------------------------- -// Function: StrType overloaded constructor -///\brief Creates an StrType object using the id of an existing datatype. -///\param existing_id - IN: Id of an existing datatype -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 +// Function: StrType overloaded constructor +///\brief Creates an StrType object using the id of an existing datatype. +///\param existing_id - IN: Id of an existing datatype +///\exception H5::DataTypeIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -StrType::StrType( const hid_t existing_id ) : AtomType( existing_id ) {} +StrType::StrType(const hid_t existing_id) : AtomType( existing_id ) {} //-------------------------------------------------------------------------- -// Function: StrType copy constructor -///\brief Copy constructor: makes a copy of the original StrType object. -// Programmer Binh-Minh Ribler - 2000 +// Function: StrType copy constructor +///\brief Copy constructor: makes a copy of the original StrType object. +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -StrType::StrType( const StrType& original ) : AtomType ( original ) {} +StrType::StrType(const StrType& original) : AtomType ( original ) {} //-------------------------------------------------------------------------- -// Function: StrType overloaded constructor -///\brief Gets the string datatype of the specified dataset -///\param dataset - IN: Dataset that this string datatype associates with -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 +// Function: StrType overloaded constructor +///\brief Gets the string datatype of the specified dataset +///\param dataset - IN: Dataset that this string datatype associates with +///\exception H5::DataTypeIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -StrType::StrType( const DataSet& dataset ) : AtomType () +StrType::StrType(const DataSet& dataset) : AtomType () { - // Calls C function H5Dget_type to get the id of the datatype - id = H5Dget_type( dataset.getId() ); + // Calls C function H5Dget_type to get the id of the datatype + id = H5Dget_type(dataset.getId()); - if( id < 0 ) - { - throw DataSetIException("StrType constructor", "H5Dget_type failed"); - } + if (id < 0) + { + throw DataSetIException("StrType constructor", "H5Dget_type failed"); + } } //-------------------------------------------------------------------------- -// Function: StrType overloaded constructor -///\brief Creates an StrType instance by opening an HDF5 string datatype -/// given its name, provided as a C character string. -///\param dtype_name - IN: String type name -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - Dec 2016 +// Function: StrType overloaded constructor +///\brief Creates an StrType instance by opening an HDF5 string datatype +/// given its name, provided as a C character string. +///\param dtype_name - IN: String type name +///\exception H5::DataTypeIException +// Programmer Binh-Minh Ribler - Dec 2016 // Description -// In 1.10.1, this constructor was introduced and will replace the -// existing function CommonFG::openStrType(const char*) to -// improve usability. -// -BMR, Dec 2016 +// In 1.10.1, this constructor was introduced and will replace the +// existing function CommonFG::openStrType(const char*) to +// improve usability. +// -BMR, Dec 2016 //-------------------------------------------------------------------------- StrType::StrType(const H5Location& loc, const char *dtype_name) : AtomType() { - id = p_opentype(loc, dtype_name); + id = p_opentype(loc, dtype_name); } //-------------------------------------------------------------------------- -// Function: StrType overloaded constructor -///\brief Creates an StrType instance by opening an HDF5 string datatype -/// given its name, provided as an \c H5std_string. -///\param dtype_name - IN: String type name -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - Dec 2016 +// Function: StrType overloaded constructor +///\brief Creates an StrType instance by opening an HDF5 string datatype +/// given its name, provided as an \c H5std_string. +///\param dtype_name - IN: String type name +///\exception H5::DataTypeIException +// Programmer Binh-Minh Ribler - Dec 2016 // Description -// In 1.10.1, this constructor was introduced and will replace the -// existing function CommonFG::openStrType(const H5std_string&) -// to improve usability. -// -BMR, Dec 2016 +// In 1.10.1, this constructor was introduced and will replace the +// existing function CommonFG::openStrType(const H5std_string&) +// to improve usability. +// -BMR, Dec 2016 //-------------------------------------------------------------------------- StrType::StrType(const H5Location& loc, const H5std_string& dtype_name) : AtomType() { - id = p_opentype(loc, dtype_name.c_str()); + id = p_opentype(loc, dtype_name.c_str()); } //-------------------------------------------------------------------------- -// Function: StrType::getCset -///\brief Retrieves the character set type of this string datatype. -///\return Character set type, which can be: -/// \li \c H5T_CSET_ASCII (0) - Character set is US ASCII. +// Function: StrType::getCset +///\brief Retrieves the character set type of this string datatype. +///\return Character set type, which can be: +/// \li \c H5T_CSET_ASCII (0) - Character set is US ASCII. ///\note -/// ASCII and UTF-8 Unicode are the only currently supported character -/// encodings. Extended ASCII encodings (for example, ISO 8859) are not -/// supported. This encoding policy is not enforced by the HDF5 Library. -/// Using encodings other than ASCII and UTF-8 can lead to compatibility -/// and usability problems. See the C API entry H5Pset_char_encoding for -/// more information. -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 +/// ASCII and UTF-8 Unicode are the only currently supported character +/// encodings. Extended ASCII encodings (for example, ISO 8859) are not +/// supported. This encoding policy is not enforced by the HDF5 Library. +/// Using encodings other than ASCII and UTF-8 can lead to compatibility +/// and usability problems. See the C API entry H5Pset_char_encoding for +/// more information. +///\exception H5::DataTypeIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- H5T_cset_t StrType::getCset() const { - H5T_cset_t cset = H5Tget_cset( id ); + H5T_cset_t cset = H5Tget_cset(id); - // Returns a valid character set type if successful - if( cset == H5T_CSET_ERROR ) - { - throw DataTypeIException("StrType::getCset", "H5Tget_cset failed"); - } - return( cset ); + // Returns a valid character set type if successful + if (cset == H5T_CSET_ERROR) + { + throw DataTypeIException("StrType::getCset", "H5Tget_cset failed"); + } + return(cset); } //-------------------------------------------------------------------------- -// Function: StrType::setCset -///\brief Sets character set to be used. -///\param cset - IN: character set type, which can be: -/// \li \c H5T_CSET_ASCII (0) - Character set is US ASCII. +// Function: StrType::setCset +///\brief Sets character set to be used. +///\param cset - IN: character set type, which can be: +/// \li \c H5T_CSET_ASCII (0) - Character set is US ASCII. ///\note -/// ASCII and UTF-8 Unicode are the only currently supported character -/// encodings. Extended ASCII encodings (for example, ISO 8859) are not -/// supported. This encoding policy is not enforced by the HDF5 Library. -/// Using encodings other than ASCII and UTF-8 can lead to compatibility -/// and usability problems. See the C API entry H5Pset_char_encoding for -/// more information. -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 +/// ASCII and UTF-8 Unicode are the only currently supported character +/// encodings. Extended ASCII encodings (for example, ISO 8859) are not +/// supported. This encoding policy is not enforced by the HDF5 Library. +/// Using encodings other than ASCII and UTF-8 can lead to compatibility +/// and usability problems. See the C API entry H5Pset_char_encoding for +/// more information. +///\exception H5::DataTypeIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -void StrType::setCset( H5T_cset_t cset ) const +void StrType::setCset(H5T_cset_t cset) const { - herr_t ret_value = H5Tset_cset( id, cset ); - - if( ret_value < 0 ) - { - throw DataTypeIException("StrType::setCset", "H5Tset_cset failed"); - } + herr_t ret_value = H5Tset_cset(id, cset); + if (ret_value < 0) + { + throw DataTypeIException("StrType::setCset", "H5Tset_cset failed"); + } } //-------------------------------------------------------------------------- -// Function: StrType::getStrpad -///\brief Retrieves the storage mechanism for of this string datatype. -///\return String storage mechanism, which can be: -/// \li \c H5T_STR_NULLTERM (0) - Null terminate (as C does) -/// \li \c H5T_STR_NULLPAD (0) - Pad with zeros -/// \li \c H5T_STR_SPACEPAD (0) - pad with spaces (as FORTRAN does) -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 +// Function: StrType::getStrpad +///\brief Retrieves the storage mechanism for of this string datatype. +///\return String storage mechanism, which can be: +/// \li \c H5T_STR_NULLTERM (0) - Null terminate (as C does) +/// \li \c H5T_STR_NULLPAD (0) - Pad with zeros +/// \li \c H5T_STR_SPACEPAD (0) - pad with spaces (as FORTRAN does) +///\exception H5::DataTypeIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- H5T_str_t StrType::getStrpad() const { - H5T_str_t strpad = H5Tget_strpad( id ); + H5T_str_t strpad = H5Tget_strpad(id); - // Returns a valid string padding type if successful - if( strpad == H5T_STR_ERROR ) - { - throw DataTypeIException("StrType::getStrpad", - "H5Tget_strpad failed - returned H5T_STR_ERROR"); - } - return( strpad ); + // Returns a valid string padding type if successful + if (strpad == H5T_STR_ERROR) + { + throw DataTypeIException("StrType::getStrpad", + "H5Tget_strpad failed - returned H5T_STR_ERROR"); + } + return(strpad); } //-------------------------------------------------------------------------- -// Function: StrType::setStrpad -///\brief Defines the storage mechanism for this string datatype. -///\param strpad - IN: String padding type -///\exception H5::DataTypeIException +// Function: StrType::setStrpad +///\brief Defines the storage mechanism for this string datatype. +///\param strpad - IN: String padding type +///\exception H5::DataTypeIException ///\par Description -/// For detail, please refer to the C layer Reference Manual at: +/// For detail, please refer to the C layer Reference Manual at: /// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5T.html#Datatype-SetStrpad -// Programmer Binh-Minh Ribler - 2000 +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -void StrType::setStrpad( H5T_str_t strpad ) const +void StrType::setStrpad(H5T_str_t strpad) const { - herr_t ret_value = H5Tset_strpad( id, strpad ); - - if( ret_value < 0 ) - { - throw DataTypeIException("StrType::setStrpad", "H5Tset_strpad failed"); - } + herr_t ret_value = H5Tset_strpad(id, strpad); + if (ret_value < 0) + { + throw DataTypeIException("StrType::setStrpad", "H5Tset_strpad failed"); + } } //-------------------------------------------------------------------------- -// Function: StrType destructor -///\brief Properly terminates access to this string datatype. -// Programmer Binh-Minh Ribler - 2000 +// Function: StrType destructor +///\brief Properly terminates access to this string datatype. +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- StrType::~StrType() {} diff --git a/c++/src/H5StrType.h b/c++/src/H5StrType.h index b920a3b..3272ad3 100644 --- a/c++/src/H5StrType.h +++ b/c++/src/H5StrType.h @@ -27,48 +27,48 @@ namespace H5 { */ class H5_DLLCPP StrType : public AtomType { public: - // Creates a string type using a predefined type - StrType(const PredType& pred_type); + // Creates a string type using a predefined type + StrType(const PredType& pred_type); - // Creates a string type with specified length - may be obsolete - StrType(const PredType& pred_type, const size_t& size); + // Creates a string type with specified length - may be obsolete + StrType(const PredType& pred_type, const size_t& size); - // Creates a string type with specified length - StrType(const int dummy, const size_t& size); + // Creates a string type with specified length + StrType(const int dummy, const size_t& size); // Gets the string datatype of the specified dataset - StrType(const DataSet& dataset); + StrType(const DataSet& dataset); - // Constructors that open an HDF5 string datatype, given a location. - StrType(const H5Location& loc, const char* name); - StrType(const H5Location& loc, const H5std_string& name); + // Constructors that open an HDF5 string datatype, given a location. + StrType(const H5Location& loc, const char* name); + StrType(const H5Location& loc, const H5std_string& name); - // Retrieves the character set type of this string datatype. - H5T_cset_t getCset() const; + // Retrieves the character set type of this string datatype. + H5T_cset_t getCset() const; - // Sets character set to be used. - void setCset(H5T_cset_t cset) const; + // Sets character set to be used. + void setCset(H5T_cset_t cset) const; - // Retrieves the string padding method for this string datatype. - H5T_str_t getStrpad() const; + // Retrieves the string padding method for this string datatype. + H5T_str_t getStrpad() const; - // Defines the storage mechanism for character strings. - void setStrpad(H5T_str_t strpad) const; + // Defines the storage mechanism for character strings. + void setStrpad(H5T_str_t strpad) const; - ///\brief Returns this class name. - virtual H5std_string fromClass () const { return("StrType"); } + ///\brief Returns this class name. + virtual H5std_string fromClass () const { return("StrType"); } - // default constructor - StrType(); + // default constructor + StrType(); - // Creates a string datatype using an existing id - StrType(const hid_t existing_id); + // Creates a string datatype using an existing id + StrType(const hid_t existing_id); - // Copy constructor - makes a copy of the original object - StrType(const StrType& original); + // Copy constructor - makes a copy of the original object + StrType(const StrType& original); - // Noop destructor. - virtual ~StrType(); + // Noop destructor. + virtual ~StrType(); }; } #endif // __H5StrType_H diff --git a/c++/src/H5VarLenType.cpp b/c++/src/H5VarLenType.cpp index 5ecc39b..7f50b9a 100644 --- a/c++/src/H5VarLenType.cpp +++ b/c++/src/H5VarLenType.cpp @@ -30,88 +30,88 @@ namespace H5 { //-------------------------------------------------------------------------- -// Function: VarLenType default constructor -///\brief Default constructor: Creates a stub variable-length datatype. +// Function: VarLenType default constructor +///\brief Default constructor: Creates a stub variable-length datatype. //-------------------------------------------------------------------------- VarLenType::VarLenType() : DataType() {} //-------------------------------------------------------------------------- -// Function: VarLenType overloaded constructor -///\brief Creates an VarLenType object using an existing id. -///\param existing_id - IN: Id of an existing datatype -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - May, 2004 +// Function: VarLenType overloaded constructor +///\brief Creates an VarLenType object using an existing id. +///\param existing_id - IN: Id of an existing datatype +///\exception H5::DataTypeIException +// Programmer Binh-Minh Ribler - May, 2004 //-------------------------------------------------------------------------- VarLenType::VarLenType(const hid_t existing_id) : DataType(existing_id) {} //-------------------------------------------------------------------------- -// Function: VarLenType copy constructor -///\brief Copy constructor: makes a copy of the original VarLenType object. -// Programmer Binh-Minh Ribler - May, 2004 +// Function: VarLenType copy constructor +///\brief Copy constructor: makes a copy of the original VarLenType object. +// Programmer Binh-Minh Ribler - May, 2004 //-------------------------------------------------------------------------- VarLenType::VarLenType(const VarLenType& original) : DataType(original) {} //-------------------------------------------------------------------------- -// Function: VarLenType overloaded constructor -///\brief Creates a new variable-length datatype based on the specified -/// \a base_type. -///\param base_type - IN: Pointer to existing datatype -///\exception H5::DataTypeIException +// Function: VarLenType overloaded constructor +///\brief Creates a new variable-length datatype based on the specified +/// \a base_type. +///\param base_type - IN: Pointer to existing datatype +///\exception H5::DataTypeIException // Description -// DataType passed by pointer to avoid clashing with copy -// constructor. -// Programmer Binh-Minh Ribler - May, 2004 +// DataType passed by pointer to avoid clashing with copy +// constructor. +// Programmer Binh-Minh Ribler - May, 2004 //-------------------------------------------------------------------------- VarLenType::VarLenType(const DataType* base_type) : DataType() { - id = H5Tvlen_create(base_type->getId()); - if (id < 0) - { - throw DataTypeIException("VarLenType constructor", + id = H5Tvlen_create(base_type->getId()); + if (id < 0) + { + throw DataTypeIException("VarLenType constructor", "H5Tvlen_create returns negative value"); - } + } } //-------------------------------------------------------------------------- -// Function: VarLenType overloaded constructor -///\brief Creates an VarLenType instance by opening an HDF5 variable -/// length datatype given its name, provided as a C char*. -///\param dtype_name - IN: Variable length type name -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - Dec 2016 +// Function: VarLenType overloaded constructor +///\brief Creates an VarLenType instance by opening an HDF5 variable +/// length datatype given its name, provided as a C char*. +///\param dtype_name - IN: Variable length type name +///\exception H5::DataTypeIException +// Programmer Binh-Minh Ribler - Dec 2016 // Description -// In 1.10.1, this constructor was introduced and will replace the -// existing function CommonFG::openVarLenType(const char*) to -// improve usability. -// -BMR, Dec 2016 +// In 1.10.1, this constructor was introduced and will replace the +// existing function CommonFG::openVarLenType(const char*) to +// improve usability. +// -BMR, Dec 2016 //-------------------------------------------------------------------------- VarLenType::VarLenType(const H5Location& loc, const char *dtype_name) : DataType() { - id = p_opentype(loc, dtype_name); + id = p_opentype(loc, dtype_name); } //-------------------------------------------------------------------------- -// Function: VarLenType overloaded constructor -///\brief Creates an VarLenType instance by opening an HDF5 variable -/// length datatype given its name, provided as an \c H5std_string. -///\param dtype_name - IN: Variable length type name -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - Dec 2016 +// Function: VarLenType overloaded constructor +///\brief Creates an VarLenType instance by opening an HDF5 variable +/// length datatype given its name, provided as an \c H5std_string. +///\param dtype_name - IN: Variable length type name +///\exception H5::DataTypeIException +// Programmer Binh-Minh Ribler - Dec 2016 // Description -// In 1.10.1, this constructor was introduced and will replace the -// existing function CommonFG::openVarLenType(const H5std_string&) -// to improve usability. -// -BMR, Dec 2016 +// In 1.10.1, this constructor was introduced and will replace the +// existing function CommonFG::openVarLenType(const H5std_string&) +// to improve usability. +// -BMR, Dec 2016 //-------------------------------------------------------------------------- VarLenType::VarLenType(const H5Location& loc, const H5std_string& dtype_name) : DataType() { - id = p_opentype(loc, dtype_name.c_str()); + id = p_opentype(loc, dtype_name.c_str()); } //-------------------------------------------------------------------------- -// Function: VarLenType destructor -///\brief Properly terminates access to this datatype. -// Programmer Binh-Minh Ribler - May, 2004 +// Function: VarLenType destructor +///\brief Properly terminates access to this datatype. +// Programmer Binh-Minh Ribler - May, 2004 //-------------------------------------------------------------------------- VarLenType::~VarLenType() {} diff --git a/c++/src/H5VarLenType.h b/c++/src/H5VarLenType.h index af4f7b7..a93f44d 100644 --- a/c++/src/H5VarLenType.h +++ b/c++/src/H5VarLenType.h @@ -27,28 +27,28 @@ namespace H5 { */ class H5_DLLCPP VarLenType : public DataType { public: - // Constructor that creates a variable-length datatype based - // on the specified base type. - VarLenType(const DataType* base_type); + // Constructor that creates a variable-length datatype based + // on the specified base type. + VarLenType(const DataType* base_type); - ///\brief Returns this class name. - virtual H5std_string fromClass () const { return("VarLenType"); } + ///\brief Returns this class name. + virtual H5std_string fromClass () const { return("VarLenType"); } - // Copy constructor: makes copy of the original object. - VarLenType( const VarLenType& original ); + // Copy constructor: makes copy of the original object. + VarLenType(const VarLenType& original); - // Constructor that takes an existing id - VarLenType( const hid_t existing_id ); + // Constructor that takes an existing id + VarLenType(const hid_t existing_id); - // Constructors that open a variable-length datatype, given a location. - VarLenType(const H5Location& loc, const char* name); - VarLenType(const H5Location& loc, const H5std_string& name); + // Constructors that open a variable-length datatype, given a location. + VarLenType(const H5Location& loc, const char* name); + VarLenType(const H5Location& loc, const H5std_string& name); - // Noop destructor - virtual ~VarLenType(); + // Noop destructor + virtual ~VarLenType(); - // Default constructor - VarLenType(); + // Default constructor + VarLenType(); }; } #endif // __H5VarLenType_H diff --git a/c++/test/CMakeLists.txt b/c++/test/CMakeLists.txt index 75ea500..65815f9 100644 --- a/c++/test/CMakeLists.txt +++ b/c++/test/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 3.1.0) +cmake_minimum_required (VERSION 3.2.2) PROJECT (HDF5_CPP_TEST) # -------------------------------------------------------------------- # Notes: When creating unit test executables they should be prefixed diff --git a/c++/test/CMakeTests.cmake b/c++/test/CMakeTests.cmake index 9bcc706..d23a80b 100644 --- a/c++/test/CMakeTests.cmake +++ b/c++/test/CMakeTests.cmake @@ -20,7 +20,20 @@ add_test ( titerate.h5 ) -add_test (NAME CPP_testhdf5 COMMAND $) +if (HDF5_ENABLE_USING_MEMCHECKER) + add_test (NAME CPP_testhdf5 COMMAND $) +else () + add_test (NAME CPP_testhdf5 COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$" + -D "TEST_ARGS:STRING=" + -D "TEST_EXPECT=0" + -D "TEST_SKIP_COMPARE=TRUE" + -D "TEST_OUTPUT=cpp_testhdf5.txt" + #-D "TEST_REFERENCE=cpp_testhdf5.out" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) +endif () set_tests_properties (CPP_testhdf5 PROPERTIES DEPENDS CPP_testhdf5-clear-objects) if (HDF5_TEST_VFD) @@ -36,9 +49,9 @@ if (HDF5_TEST_VFD) if (DIRECT_VFD) set (VFD_LIST ${VFD_LIST} direct) - endif (DIRECT_VFD) + endif () - MACRO (ADD_VFD_TEST vfdname resultcode) + macro (ADD_VFD_TEST vfdname resultcode) if (NOT HDF5_ENABLE_USING_MEMCHECKER) file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/${vfdname}") add_test ( @@ -66,12 +79,12 @@ if (HDF5_TEST_VFD) ) set_tests_properties (CPP_VFD-${vfdname}-cpp_testhdf5 PROPERTIES DEPENDS CPP_VFD-${vfdname}-cpp_testhdf5-clear-objects) set_tests_properties (CPP_VFD-${vfdname}-cpp_testhdf5 PROPERTIES TIMEOUT 30) - endif (NOT HDF5_ENABLE_USING_MEMCHECKER) - ENDMACRO (ADD_VFD_TEST) + endif () + endmacro () # Run test with different Virtual File Driver foreach (vfd ${VFD_LIST}) ADD_VFD_TEST (${vfd} 0) - endforeach (vfd ${VFD_LIST}) + endforeach () -endif (HDF5_TEST_VFD) +endif () diff --git a/c++/test/dsets.cpp b/c++/test/dsets.cpp index 8752744..48a0c4d 100644 --- a/c++/test/dsets.cpp +++ b/c++/test/dsets.cpp @@ -16,12 +16,12 @@ /***************************************************************************** FILE dsets.cpp - HDF5 C++ testing the functionalities associated with the - C dataset interface (H5D) + C dataset interface (H5D) EXTERNAL ROUTINES/VARIABLES: These routines are in the test directory of the C library: - h5_reset() -- in h5test.c, resets the library by closing it - h5_fileaccess() -- in h5test.c, returns a file access template + h5_reset() -- in h5test.c, resets the library by closing it + h5_fileaccess() -- in h5test.c, returns a file access template ***************************************************************************/ @@ -34,20 +34,20 @@ using std::cerr; using std::endl; #include -#include "H5Cpp.h" // C++ API header file +#include "H5Cpp.h" // C++ API header file using namespace H5; #include "h5test.h" -#include "h5cpputil.h" // C++ utilility header file +#include "h5cpputil.h" // C++ utilility header file -const H5std_string FILE1("dataset.h5"); -const H5std_string DSET_DEFAULT_NAME("default"); -const H5std_string DSET_DEFAULT_NAME_PATH("/default"); -const H5std_string DSET_CHUNKED_NAME("chunked"); -const H5std_string DSET_SIMPLE_IO_NAME("simple_io"); -const H5std_string DSET_TCONV_NAME ("tconv"); -const H5std_string DSET_COMPRESS_NAME("compressed"); -const H5std_string DSET_BOGUS_NAME ("bogus"); +const H5std_string FILE1("dataset.h5"); +const H5std_string DSET_DEFAULT_NAME("default"); +const H5std_string DSET_DEFAULT_NAME_PATH("/default"); +const H5std_string DSET_CHUNKED_NAME("chunked"); +const H5std_string DSET_SIMPLE_IO_NAME("simple_io"); +const H5std_string DSET_TCONV_NAME("tconv"); +const H5std_string DSET_COMPRESS_NAME("compressed"); +const H5std_string DSET_BOGUS_NAME("bogus"); /* Temporary filter IDs used for testing */ const int H5Z_FILTER_BOGUS = 305; @@ -58,16 +58,16 @@ static size_t filter_bogus(unsigned int flags, size_t cd_nelmts, /*------------------------------------------------------------------------- - * Function: test_create + * Function: test_create * - * Purpose: Attempts to create a dataset. + * Purpose Attempts to create a dataset. * - * Return: Success: 0 + * Return Success: 0 * - * Failure: -1 + * Failure: -1 * - * Programmer: Binh-Minh Ribler (using C version) - * Friday, January 5, 2001 + * Programmer Binh-Minh Ribler (using C version) + * Friday, January 5, 2001 * * Modifications: * @@ -81,125 +81,125 @@ test_create( H5File& file) // Setting this to NULL for cleaning up in failure situations DataSet *dataset = NULL; try { - // Create a data space - hsize_t dims[2]; - dims[0] = 256; - dims[1] = 512; - DataSpace space (2, dims, NULL); - - // Create a dataset using the default dataset creation properties. - // We're not sure what they are, so we won't check. - dataset = new DataSet (file.createDataSet - (DSET_DEFAULT_NAME, PredType::NATIVE_DOUBLE, space)); - - - // Add a comment to the dataset - file.setComment (DSET_DEFAULT_NAME, "This is a dataset"); - - // Close the dataset - delete dataset; - dataset = NULL; - - // Try creating a dataset that already exists. This should fail since a - // dataset can only be created once. If an exception is not thrown for - // this action by createDataSet, then throw an invalid action exception. - try { - dataset = new DataSet (file.createDataSet - (DSET_DEFAULT_NAME, PredType::NATIVE_DOUBLE, space)); - - // continuation here, that means no exception has been thrown - throw InvalidActionException("H5File::createDataSet", "Library allowed overwrite of existing dataset"); - } - catch (FileIException& E) // catching invalid creating dataset - {} // do nothing, exception expected - - // Open the dataset we created above and then close it. This is one - // way to open an existing dataset for accessing. - dataset = new DataSet (file.openDataSet (DSET_DEFAULT_NAME)); - - // Get and verify the name of this dataset, using - // H5std_string getObjName() - H5std_string ds_name = dataset->getObjName(); - verify_val(ds_name, DSET_DEFAULT_NAME_PATH, "DataSet::getObjName", __LINE__, __FILE__); - - // Get and verify the comment from this dataset, using - // H5std_string getComment(const H5std_string& name, ) - H5std_string comment = file.getComment(DSET_DEFAULT_NAME); - verify_val(comment, "This is a dataset", "DataSet::getComment", __LINE__, __FILE__); - - // Close the dataset when accessing is completed - delete dataset; - - // This is another way to open an existing dataset for accessing. - DataSet another_dataset(file.openDataSet (DSET_DEFAULT_NAME)); - - // Try opening a non-existent dataset. This should fail so if an - // exception is not thrown for this action by openDataSet, then - // display failure information and throw an exception. - try { - dataset = new DataSet (file.openDataSet( "does_not_exist" )); - - // continuation here, that means no exception has been thrown - throw InvalidActionException("H5File::openDataSet", "Attempted to open a non-existent dataset"); - } - catch (FileIException& E ) // catching creating non-existent dataset - {} // do nothing, exception expected - - // Create a new dataset that uses chunked storage instead of the default - // layout. - DSetCreatPropList create_parms; - hsize_t csize[2]; - csize[0] = 5; - csize[1] = 100; - create_parms.setChunk( 2, csize ); - - dataset = new DataSet (file.createDataSet - (DSET_CHUNKED_NAME, PredType::NATIVE_DOUBLE, space, create_parms)); - // Note: this one has no error message in C when failure occurs? - - // clean up and return with success - delete dataset; - - PASSED(); - return 0; - } // outer most try block + // Create a data space + hsize_t dims[2]; + dims[0] = 256; + dims[1] = 512; + DataSpace space (2, dims, NULL); + + // Create a dataset using the default dataset creation properties. + // We're not sure what they are, so we won't check. + dataset = new DataSet (file.createDataSet + (DSET_DEFAULT_NAME, PredType::NATIVE_DOUBLE, space)); + + + // Add a comment to the dataset + file.setComment (DSET_DEFAULT_NAME, "This is a dataset"); + + // Close the dataset + delete dataset; + dataset = NULL; + + // Try creating a dataset that already exists. This should fail since a + // dataset can only be created once. If an exception is not thrown for + // this action by createDataSet, then throw an invalid action exception. + try { + dataset = new DataSet (file.createDataSet + (DSET_DEFAULT_NAME, PredType::NATIVE_DOUBLE, space)); + + // continuation here, that means no exception has been thrown + throw InvalidActionException("H5File::createDataSet", "Library allowed overwrite of existing dataset"); + } + catch (FileIException& E) // catching invalid creating dataset + {} // do nothing, exception expected + + // Open the dataset we created above and then close it. This is one + // way to open an existing dataset for accessing. + dataset = new DataSet (file.openDataSet (DSET_DEFAULT_NAME)); + + // Get and verify the name of this dataset, using + // H5std_string getObjName() + H5std_string ds_name = dataset->getObjName(); + verify_val(ds_name, DSET_DEFAULT_NAME_PATH, "DataSet::getObjName", __LINE__, __FILE__); + + // Get and verify the comment from this dataset, using + // H5std_string getComment(const H5std_string& name, ) + H5std_string comment = file.getComment(DSET_DEFAULT_NAME); + verify_val(comment, "This is a dataset", "DataSet::getComment", __LINE__, __FILE__); + + // Close the dataset when accessing is completed + delete dataset; + + // This is another way to open an existing dataset for accessing. + DataSet another_dataset(file.openDataSet (DSET_DEFAULT_NAME)); + + // Try opening a non-existent dataset. This should fail so if an + // exception is not thrown for this action by openDataSet, then + // display failure information and throw an exception. + try { + dataset = new DataSet (file.openDataSet( "does_not_exist" )); + + // continuation here, that means no exception has been thrown + throw InvalidActionException("H5File::openDataSet", "Attempted to open a non-existent dataset"); + } + catch (FileIException& E ) // catching creating non-existent dataset + {} // do nothing, exception expected + + // Create a new dataset that uses chunked storage instead of the default + // layout. + DSetCreatPropList create_parms; + hsize_t csize[2]; + csize[0] = 5; + csize[1] = 100; + create_parms.setChunk( 2, csize ); + + dataset = new DataSet (file.createDataSet(DSET_CHUNKED_NAME, + PredType::NATIVE_DOUBLE, space, create_parms)); + // Note: this one has no error message in C when failure occurs? + + // clean up and return with success + delete dataset; + + PASSED(); + return 0; + } // outer most try block catch (InvalidActionException& E) { - cerr << " FAILED" << endl; - cerr << " <<< " << E.getDetailMsg() << " >>>" << endl << endl; + cerr << " FAILED" << endl; + cerr << " <<< " << E.getDetailMsg() << " >>>" << endl << endl; - // clean up and return with failure - if (dataset != NULL) - delete dataset; - return -1; + // clean up and return with failure + if (dataset != NULL) + delete dataset; + return -1; } // catch all other exceptions catch (Exception& E) { - issue_fail_msg("test_create", __LINE__, __FILE__); + issue_fail_msg("test_create", __LINE__, __FILE__); - // clean up and return with failure - if (dataset != NULL) - delete dataset; - return -1; + // clean up and return with failure + if (dataset != NULL) + delete dataset; + return -1; } } // test_create /*------------------------------------------------------------------------- - * Function: test_simple_io + * Function: test_simple_io * - * Purpose: Tests simple I/O. That is, reading and writing a complete - * multi-dimensional array without data type or data space - * conversions, without compression, and stored contiguously. + * Purpose Tests simple I/O. That is, reading and writing a complete + * multi-dimensional array without data type or data space + * conversions, without compression, and stored contiguously. * - * Return: Success: 0 + * Return Success: 0 * - * Failure: -1 + * Failure: -1 * - * Programmer: Binh-Minh Ribler (using C version) - * Friday, January 5, 2001 + * Programmer Binh-Minh Ribler (using C version) + * Friday, January 5, 2001 * * Modifications: * @@ -211,81 +211,81 @@ test_simple_io( H5File& file) SUBTEST("Simple I/O"); - int points[100][200]; - int check[100][200]; - int i, j, n; + int points[100][200]; + int check[100][200]; + int i, j, n; // Initialize the dataset for (i = n = 0; i < 100; i++) { - for (j = 0; j < 200; j++) { - points[i][j] = n++; - } + for (j = 0; j < 200; j++) { + points[i][j] = n++; + } } char* tconv_buf = new char [1000]; try { - // Create the data space - hsize_t dims[2]; - dims[0] = 100; - dims[1] = 200; - DataSpace space (2, dims, NULL); - - // Create a small conversion buffer to test strip mining - DSetMemXferPropList xfer; - - xfer.setBuffer (1000, tconv_buf, NULL); - - // Create the dataset - DataSet dataset (file.createDataSet (DSET_SIMPLE_IO_NAME, PredType::NATIVE_INT, space)); - - // Write the data to the dataset - dataset.write(static_cast(points), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer); - - // Read the dataset back - dataset.read (static_cast(check), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer); - - // Check that the values read are the same as the values written - for (i = 0; i < 100; i++) - for (j = 0; j < 200; j++) - { - int status = check_values (i, j, points[i][j], check[i][j]); - if (status == -1) - throw Exception("DataSet::read"); - } - - // clean up and return with success - delete [] tconv_buf; - PASSED(); - return 0; + // Create the data space + hsize_t dims[2]; + dims[0] = 100; + dims[1] = 200; + DataSpace space (2, dims, NULL); + + // Create a small conversion buffer to test strip mining + DSetMemXferPropList xfer; + + xfer.setBuffer (1000, tconv_buf, NULL); + + // Create the dataset + DataSet dataset (file.createDataSet (DSET_SIMPLE_IO_NAME, PredType::NATIVE_INT, space)); + + // Write the data to the dataset + dataset.write(static_cast(points), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer); + + // Read the dataset back + dataset.read (static_cast(check), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer); + + // Check that the values read are the same as the values written + for (i = 0; i < 100; i++) + for (j = 0; j < 200; j++) + { + int status = check_values (i, j, points[i][j], check[i][j]); + if (status == -1) + throw Exception("DataSet::read"); + } + + // clean up and return with success + delete [] tconv_buf; + PASSED(); + return 0; } // end try // catch all dataset, space, plist exceptions catch (Exception& E) { - cerr << " FAILED" << endl; - cerr << " <<< " << E.getDetailMsg() << " >>>" << endl << endl; + cerr << " FAILED" << endl; + cerr << " <<< " << E.getDetailMsg() << " >>>" << endl << endl; - // clean up and return with failure - if (tconv_buf) - delete [] tconv_buf; - return -1; + // clean up and return with failure + if (tconv_buf) + delete [] tconv_buf; + return -1; } } // test_simple_io /*------------------------------------------------------------------------- - * Function: test_datasize + * Function: test_datasize * - * Purpose: Tests DataSet::getInMemDataSize(). + * Purpose Tests DataSet::getInMemDataSize(). * - * Return: Success: 0 + * Return Success: 0 * - * Failure: -1 + * Failure: -1 * - * Programmer: Binh-Minh Ribler - * Thursday, March 22, 2012 + * Programmer Binh-Minh Ribler + * Thursday, March 22, 2012 * * Modifications: * @@ -297,65 +297,65 @@ test_datasize(FileAccPropList &fapl) SUBTEST("DataSet::getInMemDataSize()"); try { - // Open FILE1. - H5File file(FILE1, H5F_ACC_RDWR, FileCreatPropList::DEFAULT, fapl); - - // Open dataset DSET_SIMPLE_IO_NAME. - DataSet dset = file.openDataSet (DSET_SIMPLE_IO_NAME); - - // Get the dataset's dataspace to calculate the size for verification. - DataSpace space(dset.getSpace()); - - // Get the dimension sizes. - hsize_t dims[2]; - int n_dims = space.getSimpleExtentDims(dims); - if (n_dims < 0) - { - throw Exception("test_compression", "DataSpace::getSimpleExtentDims() failed"); - } - - // Calculate the supposed size. Size of each value is int (4), from - // test_simple_io. - size_t expected_size = 4 * dims[0] * dims[1]; - - // getInMemDataSize() returns the in memory size of the data. - size_t ds_size = dset.getInMemDataSize(); - - // Verify the data size. - if (ds_size != expected_size) - { - H5_FAILED(); - cerr << " Expected data size = " << expected_size; - cerr << " but dset.getInMemDataSize() returned " << ds_size << endl; - throw Exception("test_compression", "Failed in testing DataSet::getInMemDataSize()"); - } - - PASSED(); - return 0; + // Open FILE1. + H5File file(FILE1, H5F_ACC_RDWR, FileCreatPropList::DEFAULT, fapl); + + // Open dataset DSET_SIMPLE_IO_NAME. + DataSet dset = file.openDataSet (DSET_SIMPLE_IO_NAME); + + // Get the dataset's dataspace to calculate the size for verification. + DataSpace space(dset.getSpace()); + + // Get the dimension sizes. + hsize_t dims[2]; + int n_dims = space.getSimpleExtentDims(dims); + if (n_dims < 0) + { + throw Exception("test_compression", "DataSpace::getSimpleExtentDims() failed"); + } + + // Calculate the supposed size. Size of each value is int (4), from + // test_simple_io. + size_t expected_size = 4 * dims[0] * dims[1]; + + // getInMemDataSize() returns the in memory size of the data. + size_t ds_size = dset.getInMemDataSize(); + + // Verify the data size. + if (ds_size != expected_size) + { + H5_FAILED(); + cerr << " Expected data size = " << expected_size; + cerr << " but dset.getInMemDataSize() returned " << ds_size << endl; + throw Exception("test_compression", "Failed in testing DataSet::getInMemDataSize()"); + } + + PASSED(); + return 0; } // end try // catch all dataset, space, plist exceptions catch (Exception& E) { - cerr << " FAILED" << endl; - cerr << " <<< " << E.getDetailMsg() << " >>>" << endl << endl; + cerr << " FAILED" << endl; + cerr << " <<< " << E.getDetailMsg() << " >>>" << endl << endl; - return -1; + return -1; } } // test_datasize /*------------------------------------------------------------------------- - * Function: test_tconv + * Function: test_tconv * - * Purpose: Test some simple data type conversion stuff. + * Purpose Test some simple data type conversion stuff. * - * Return: Success: 0 + * Return Success: 0 * - * Failure: -1 + * Failure: -1 * - * Programmer: Binh-Minh Ribler (using C version) - * Friday, January 5, 2001 + * Programmer Binh-Minh Ribler (using C version) + * Friday, January 5, 2001 * * Modifications: * @@ -365,7 +365,7 @@ static herr_t test_tconv(H5File& file) { // Prepare buffers for input/output - char *out=NULL, *in=NULL; + char *out=NULL, *in=NULL; out = new char [4*1000000]; // assert (out); - should use exception handler for new - BMR in = new char [4*1000000]; @@ -375,81 +375,81 @@ test_tconv(H5File& file) // Initialize the dataset for (int i = 0; i < 1000000; i++) { - out[i*4+0] = 0x11; - out[i*4+1] = 0x22; - out[i*4+2] = 0x33; - out[i*4+3] = 0x44; + out[i*4+0] = 0x11; + out[i*4+1] = 0x22; + out[i*4+2] = 0x33; + out[i*4+3] = 0x44; } try { - // Create the data space - hsize_t dims[1]; - dims[0] = 1000000; - DataSpace space (1, dims, NULL); - - // Create the data set - DataSet dataset (file.createDataSet (DSET_TCONV_NAME, PredType::STD_I32LE, space)); - - // Write the data to the dataset - dataset.write (static_cast(out), PredType::STD_I32LE); - - // Read data with byte order conversion - dataset.read (static_cast(in), PredType::STD_I32BE); - - // Check - for (int i = 0; i < 1000000; i++) { - if (in[4*i+0]!=out[4*i+3] || - in[4*i+1]!=out[4*i+2] || - in[4*i+2]!=out[4*i+1] || - in[4*i+3]!=out[4*i+0]) - { - throw Exception("DataSet::read", "Read with byte order conversion failed"); - } - } - - // clean up and return with success - delete [] out; - delete [] in; - PASSED(); - return 0; + // Create the data space + hsize_t dims[1]; + dims[0] = 1000000; + DataSpace space (1, dims, NULL); + + // Create the data set + DataSet dataset (file.createDataSet (DSET_TCONV_NAME, PredType::STD_I32LE, space)); + + // Write the data to the dataset + dataset.write (static_cast(out), PredType::STD_I32LE); + + // Read data with byte order conversion + dataset.read (static_cast(in), PredType::STD_I32BE); + + // Check + for (int i = 0; i < 1000000; i++) { + if (in[4*i+0]!=out[4*i+3] || + in[4*i+1]!=out[4*i+2] || + in[4*i+2]!=out[4*i+1] || + in[4*i+3]!=out[4*i+0]) + { + throw Exception("DataSet::read", "Read with byte order conversion failed"); + } + } + + // clean up and return with success + delete [] out; + delete [] in; + PASSED(); + return 0; } // end try // catch all dataset and space exceptions catch (Exception& E) { - cerr << " FAILED" << endl; - cerr << " <<< " << E.getDetailMsg() << " >>>" << endl << endl; + cerr << " FAILED" << endl; + cerr << " <<< " << E.getDetailMsg() << " >>>" << endl << endl; - // clean up and return with failure - delete [] out; - delete [] in; - return -1; + // clean up and return with failure + delete [] out; + delete [] in; + return -1; } } // test_tconv /* This message derives from H5Z */ const H5Z_class2_t H5Z_BOGUS[1] = {{ - H5Z_CLASS_T_VERS, /* H5Z_class_t version number */ - H5Z_FILTER_BOGUS, /* Filter id number */ - 1, 1, /* Encode and decode enabled */ - "bogus", /* Filter name for debugging */ + H5Z_CLASS_T_VERS, /* H5Z_class_t version number */ + H5Z_FILTER_BOGUS, /* Filter id number */ + 1, 1, /* Encode and decode enabled */ + "bogus", /* Filter name for debugging */ NULL, /* The "can apply" callback */ NULL, /* The "set local" callback */ - (H5Z_func_t)filter_bogus, /* The actual filter function */ + (H5Z_func_t)filter_bogus, /* The actual filter function */ }}; /*------------------------------------------------------------------------- - * Function: bogus + * Function: bogus * - * Purpose: A bogus compression method that doesn't do anything. + * Purpose A bogus compression method that doesn't do anything. * - * Return: Success: Data chunk size + * Return Success: Data chunk size * - * Failure: 0 + * Failure: 0 * - * Programmer: Robb Matzke - * Tuesday, April 21, 1998 + * Programmer Robb Matzke + * Tuesday, April 21, 1998 * * Modifications: * @@ -466,19 +466,19 @@ filter_bogus(unsigned int flags, size_t cd_nelmts, /*------------------------------------------------------------------------- - * Function: test_compression + * Function: test_compression * - * Purpose: Tests dataset compression. If compression is requested when - * it hasn't been compiled into the library (such as when - * updating an existing compressed dataset) then data is sent to - * the file uncompressed but no errors are returned. + * Purpose Tests dataset compression. If compression is requested when + * it hasn't been compiled into the library (such as when + * updating an existing compressed dataset) then data is sent to + * the file uncompressed but no errors are returned. * - * Return: Success: 0 + * Return Success: 0 * - * Failure: -1 + * Failure: -1 * - * Programmer: Binh-Minh Ribler (using C version) - * Friday, January 5, 2001 + * Programmer Binh-Minh Ribler (using C version) + * Friday, January 5, 2001 * * Modifications: * @@ -488,266 +488,266 @@ static herr_t test_compression(H5File& file) { #ifndef H5_HAVE_FILTER_DEFLATE - const char *not_supported; + const char *not_supported; not_supported = " Deflate compression is not enabled."; #endif /* H5_HAVE_FILTER_DEFLATE */ - int points[100][200]; - int check[100][200]; - hsize_t i, j, n; + int points[100][200]; + int check[100][200]; + hsize_t i, j, n; // Initialize the dataset for (i = n = 0; i < 100; i++) { - for (j = 0; j < 200; j++) { - points[i][j] = static_cast(n++); - } + for (j = 0; j < 200; j++) { + points[i][j] = static_cast(n++); + } } char* tconv_buf = new char [1000]; DataSet* dataset = NULL; try { - const hsize_t size[2] = {100, 200}; - // Create the data space - DataSpace space1(2, size, NULL); + const hsize_t size[2] = {100, 200}; + // Create the data space + DataSpace space1(2, size, NULL); - // Create a small conversion buffer to test strip mining - DSetMemXferPropList xfer; + // Create a small conversion buffer to test strip mining + DSetMemXferPropList xfer; - xfer.setBuffer (1000, tconv_buf, NULL); + xfer.setBuffer (1000, tconv_buf, NULL); - // Use chunked storage with compression - DSetCreatPropList dscreatplist; + // Use chunked storage with compression + DSetCreatPropList dscreatplist; - const hsize_t chunk_size[2] = {2, 25}; - dscreatplist.setChunk (2, chunk_size); - dscreatplist.setDeflate (6); + const hsize_t chunk_size[2] = {2, 25}; + dscreatplist.setChunk (2, chunk_size); + dscreatplist.setDeflate (6); #ifdef H5_HAVE_FILTER_DEFLATE - SUBTEST("Compression (setup)"); - - // Create the dataset - dataset = new DataSet (file.createDataSet - (DSET_COMPRESS_NAME, PredType::NATIVE_INT, space1, dscreatplist)); - - PASSED(); - - /*---------------------------------------------------------------------- - * STEP 1: Read uninitialized data. It should be zero. - *---------------------------------------------------------------------- - */ - SUBTEST("Compression (uninitialized read)"); - - dataset->read (static_cast(check), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer); - - for (i=0; i(i) << "," << - static_cast(j) << endl; - throw Exception("test_compression", "Failed in uninitialized read"); - } - } - } - PASSED(); - - /*---------------------------------------------------------------------- - * STEP 2: Test compression by setting up a chunked dataset and writing - * to it. - *---------------------------------------------------------------------- - */ - SUBTEST("Compression (write)"); - - for (i=n=0; i(n++); - } - } - - dataset->write (static_cast(points), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer); - - PASSED(); - - /*---------------------------------------------------------------------- - * STEP 3: Try to read the data we just wrote. - *---------------------------------------------------------------------- - */ - SUBTEST("Compression (read)"); - - // Read the dataset back - dataset->read (static_cast(check), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer); - - // Check that the values read are the same as the values written - for (i = 0; i < size[0]; i++) - for (j = 0; j < size[1]; j++) - { - int status = check_values (i, j, points[i][j], check[i][j]); - if (status == -1) - throw Exception("test_compression", "Failed in read"); - } - - PASSED(); - - /*---------------------------------------------------------------------- - * STEP 4: Write new data over the top of the old data. The new data is - * random thus not very compressible, and will cause the chunks to move - * around as they grow. We only change values for the left half of the - * dataset although we rewrite the whole thing. - *---------------------------------------------------------------------- - */ - SUBTEST("Compression (modify)"); - - for (i=0; iwrite (static_cast(points), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer); - - // Read the dataset back and check it - dataset->read (static_cast(check), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer); - - // Check that the values read are the same as the values written - for (i = 0; i < size[0]; i++) - for (j = 0; j < size[1]; j++) - { - int status = check_values (i, j, points[i][j], check[i][j]); - if (status == -1) - throw Exception("test_compression", "Failed in modify"); - } - - PASSED(); - - /*---------------------------------------------------------------------- - * STEP 5: Close the dataset and then open it and read it again. This - * insures that the compression message is picked up properly from the - * object header. - *---------------------------------------------------------------------- - */ - SUBTEST("Compression (re-open)"); - - // close this dataset to reuse the var - delete dataset; - - dataset = new DataSet (file.openDataSet (DSET_COMPRESS_NAME)); - dataset->read (static_cast(check), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer); - - // Check that the values read are the same as the values written - for (i = 0; i < size[0]; i++) - for (j = 0; j < size[1]; j++) - { - int status = check_values (i, j, points[i][j], check[i][j]); - if (status == -1) - throw Exception("test_compression", "Failed in re-open"); - } - - PASSED(); - - - /*---------------------------------------------------------------------- - * STEP 6: Test partial I/O by writing to and then reading from a - * hyperslab of the dataset. The hyperslab does not line up on chunk - * boundaries (we know that case already works from above tests). - *---------------------------------------------------------------------- - */ - SUBTEST("Compression (partial I/O)"); - - const hsize_t hs_size[2] = {4, 50}; - const hsize_t hs_offset[2] = {7, 30}; - for (i = 0; i < hs_size[0]; i++) { - for (j = 0; j < hs_size[1]; j++) { - points[hs_offset[0]+i][hs_offset[1]+j] = rand (); - } - } - space1.selectHyperslab( H5S_SELECT_SET, hs_size, hs_offset ); - dataset->write (static_cast(points), PredType::NATIVE_INT, space1, space1, xfer); - dataset->read (static_cast(check), PredType::NATIVE_INT, space1, space1, xfer); - - // Check that the values read are the same as the values written - for (i=0; i((hs_offset[0]+i)) << - "," << static_cast((hs_offset[1]+j)) << endl; - - cerr << " At original: " << static_cast(points[hs_offset[0]+i][hs_offset[1]+j]) << endl; - cerr << " At returned: " << static_cast(check[hs_offset[0]+i][hs_offset[1]+j]) << endl; - throw Exception("test_compression", "Failed in partial I/O"); - } - } // for j - } // for i - - delete dataset; - dataset = NULL; - - PASSED(); + SUBTEST("Compression (setup)"); + + // Create the dataset + dataset = new DataSet (file.createDataSet + (DSET_COMPRESS_NAME, PredType::NATIVE_INT, space1, dscreatplist)); + + PASSED(); + + /*---------------------------------------------------------------------- + * STEP 1: Read uninitialized data. It should be zero. + *---------------------------------------------------------------------- + */ + SUBTEST("Compression (uninitialized read)"); + + dataset->read (static_cast(check), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer); + + for (i=0; i(i) + << "," << static_cast(j) << endl; + throw Exception("test_compression", "Failed in uninitialized read"); + } + } + } + PASSED(); + + /*---------------------------------------------------------------------- + * STEP 2: Test compression by setting up a chunked dataset and writing + * to it. + *---------------------------------------------------------------------- + */ + SUBTEST("Compression (write)"); + + for (i=n=0; i(n++); + } + } + + dataset->write (static_cast(points), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer); + + PASSED(); + + /*---------------------------------------------------------------------- + * STEP 3: Try to read the data we just wrote. + *---------------------------------------------------------------------- + */ + SUBTEST("Compression (read)"); + + // Read the dataset back + dataset->read (static_cast(check), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer); + + // Check that the values read are the same as the values written + for (i = 0; i < size[0]; i++) + for (j = 0; j < size[1]; j++) + { + int status = check_values (i, j, points[i][j], check[i][j]); + if (status == -1) + throw Exception("test_compression", "Failed in read"); + } + + PASSED(); + + /*---------------------------------------------------------------------- + * STEP 4: Write new data over the top of the old data. The new data is + * random thus not very compressible, and will cause the chunks to move + * around as they grow. We only change values for the left half of the + * dataset although we rewrite the whole thing. + *---------------------------------------------------------------------- + */ + SUBTEST("Compression (modify)"); + + for (i=0; iwrite (static_cast(points), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer); + + // Read the dataset back and check it + dataset->read (static_cast(check), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer); + + // Check that the values read are the same as the values written + for (i = 0; i < size[0]; i++) + for (j = 0; j < size[1]; j++) + { + int status = check_values (i, j, points[i][j], check[i][j]); + if (status == -1) + throw Exception("test_compression", "Failed in modify"); + } + + PASSED(); + + /*---------------------------------------------------------------------- + * STEP 5: Close the dataset and then open it and read it again. This + * insures that the compression message is picked up properly from the + * object header. + *---------------------------------------------------------------------- + */ + SUBTEST("Compression (re-open)"); + + // close this dataset to reuse the var + delete dataset; + + dataset = new DataSet (file.openDataSet (DSET_COMPRESS_NAME)); + dataset->read (static_cast(check), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer); + + // Check that the values read are the same as the values written + for (i = 0; i < size[0]; i++) + for (j = 0; j < size[1]; j++) + { + int status = check_values (i, j, points[i][j], check[i][j]); + if (status == -1) + throw Exception("test_compression", "Failed in re-open"); + } + + PASSED(); + + + /*---------------------------------------------------------------------- + * STEP 6: Test partial I/O by writing to and then reading from a + * hyperslab of the dataset. The hyperslab does not line up on chunk + * boundaries (we know that case already works from above tests). + *---------------------------------------------------------------------- + */ + SUBTEST("Compression (partial I/O)"); + + const hsize_t hs_size[2] = {4, 50}; + const hsize_t hs_offset[2] = {7, 30}; + for (i = 0; i < hs_size[0]; i++) { + for (j = 0; j < hs_size[1]; j++) { + points[hs_offset[0]+i][hs_offset[1]+j] = rand (); + } + } + space1.selectHyperslab( H5S_SELECT_SET, hs_size, hs_offset ); + dataset->write (static_cast(points), PredType::NATIVE_INT, space1, space1, xfer); + dataset->read (static_cast(check), PredType::NATIVE_INT, space1, space1, xfer); + + // Check that the values read are the same as the values written + for (i=0; i((hs_offset[0]+i)) << + "," << static_cast((hs_offset[1]+j)) << endl; + + cerr << " At original: " << static_cast(points[hs_offset[0]+i][hs_offset[1]+j]) << endl; + cerr << " At returned: " << static_cast(check[hs_offset[0]+i][hs_offset[1]+j]) << endl; + throw Exception("test_compression", "Failed in partial I/O"); + } + } // for j + } // for i + + delete dataset; + dataset = NULL; + + PASSED(); #else - SUBTEST("deflate filter"); - SKIPPED(); - cerr << not_supported << endl; + SUBTEST("deflate filter"); + SKIPPED(); + cerr << not_supported << endl; #endif - /*---------------------------------------------------------------------- - * STEP 7: Register an application-defined compression method and use it - * to write and then read the dataset. - *---------------------------------------------------------------------- - */ - SUBTEST("Compression (app-defined method)"); + /*---------------------------------------------------------------------- + * STEP 7: Register an application-defined compression method and use it + * to write and then read the dataset. + *---------------------------------------------------------------------- + */ + SUBTEST("Compression (app-defined method)"); if (H5Zregister (H5Z_BOGUS)<0) - throw Exception("test_compression", "Failed in app-defined method"); - if (H5Pset_filter (dscreatplist.getId(), H5Z_FILTER_BOGUS, 0, 0, NULL)<0) - throw Exception("test_compression", "Failed in app-defined method"); - dscreatplist.setFilter (H5Z_FILTER_BOGUS, 0, 0, NULL); - - DataSpace space2 (2, size, NULL); - dataset = new DataSet (file.createDataSet (DSET_BOGUS_NAME, PredType::NATIVE_INT, space2, dscreatplist)); - - dataset->write (static_cast(points), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer); - dataset->read (static_cast(check), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer); - - // Check that the values read are the same as the values written - for (i = 0; i < size[0]; i++) - for (j = 0; j < size[1]; j++) - { - int status = check_values (i, j, points[i][j], check[i][j]); - if (status == -1) - throw Exception("test_compression", "Failed in app-defined method"); - } - - PASSED(); - - /*---------------------------------------------------------------------- - * Cleanup - *---------------------------------------------------------------------- - */ - delete dataset; - delete [] tconv_buf; - return 0; + throw Exception("test_compression", "Failed in app-defined method"); + if (H5Pset_filter (dscreatplist.getId(), H5Z_FILTER_BOGUS, 0, 0, NULL)<0) + throw Exception("test_compression", "Failed in app-defined method"); + dscreatplist.setFilter (H5Z_FILTER_BOGUS, 0, 0, NULL); + + DataSpace space2 (2, size, NULL); + dataset = new DataSet (file.createDataSet (DSET_BOGUS_NAME, PredType::NATIVE_INT, space2, dscreatplist)); + + dataset->write (static_cast(points), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer); + dataset->read (static_cast(check), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer); + + // Check that the values read are the same as the values written + for (i = 0; i < size[0]; i++) + for (j = 0; j < size[1]; j++) + { + int status = check_values (i, j, points[i][j], check[i][j]); + if (status == -1) + throw Exception("test_compression", "Failed in app-defined method"); + } + + PASSED(); + + /*---------------------------------------------------------------------- + * Cleanup + *---------------------------------------------------------------------- + */ + delete dataset; + delete [] tconv_buf; + return 0; } // end try // catch all dataset, file, space, and plist exceptions catch (Exception& E) { - cerr << " FAILED" << endl; - cerr << " <<< " << E.getDetailMsg() << " >>>" << endl << endl; - - // clean up and return with failure - if (dataset != NULL) - delete dataset; - if (tconv_buf) - delete [] tconv_buf; - return -1; + cerr << " FAILED" << endl; + cerr << " <<< " << E.getDetailMsg() << " >>>" << endl << endl; + + // clean up and return with failure + if (dataset != NULL) + delete dataset; + if (tconv_buf) + delete [] tconv_buf; + return -1; } } // test_compression @@ -755,18 +755,18 @@ test_compression(H5File& file) /*------------------------------------------------------------------------- * Function: test_nbit_methods * - * Purpose: Tests setting nbit compression methods. + * Purpose Tests setting nbit compression methods. * - * Return: Success: 0 + * Return Success: 0 * - * Failure: -1 + * Failure: -1 * - * Programmer: Binh-Minh Ribler - * Friday, April 22, 2016 + * Programmer Binh-Minh Ribler + * Friday, April 22, 2016 * *------------------------------------------------------------------------- */ -const H5std_string DSET_NBIT_NAME("nbit_dataset"); +const H5std_string DSET_NBIT_NAME("nbit_dataset"); const hsize_t DIM1 = 2; const hsize_t DIM2 = 5; static herr_t test_nbit_compression(H5File& file) @@ -787,101 +787,101 @@ static herr_t test_nbit_compression(H5File& file) try { - // Define datatypes of members of compound datatype - IntType i_type(PredType::NATIVE_INT); - IntType c_type(PredType::NATIVE_CHAR); - IntType s_type(PredType::NATIVE_SHORT); - - // Create a dataset compound datatype - CompType cmpd(sizeof(s1_t)); - cmpd.insertMember("i", HOFFSET(s1_t, i), i_type); - cmpd.insertMember("c", HOFFSET(s1_t, c), c_type); - cmpd.insertMember("s", HOFFSET(s1_t, s), s_type); - - // Create a memory compound datatype - CompType mem_cmpd(sizeof(s1_t)); - mem_cmpd.insertMember("i", HOFFSET(s1_t, i), i_type); - mem_cmpd.insertMember("c", HOFFSET(s1_t, c), c_type); - mem_cmpd.insertMember("s", HOFFSET(s1_t, s), s_type); - - // Set order of dataset compound datatype - //cmpd.setOrder(H5T_ORDER_BE); only for atomic type? - - // Create the data space - DataSpace space(2, size); - - // Use nbit filter - DSetCreatPropList dscreat; - dscreat.setChunk(2, chunk_size); - dscreat.setNbit(); - - // Create the dataset - DataSet dataset(file.createDataSet(DSET_NBIT_NAME, cmpd, space, dscreat)); - - // Initialize data, assuming size of long long >= size of member datatypes - for (i = 0; i < size[0]; i++) - for (j = 0; j < size[1]; j++) - { - orig_data[i][j].i = static_cast(i * j); - orig_data[i][j].c = static_cast('a' + i); - orig_data[i][j].s = static_cast(i + j); - - // Some even-numbered integer values are negative - if ((i*size[1]+j+1)%2 == 0) { - orig_data[i][j].i = -orig_data[i][j].i; - orig_data[i][j].s = static_cast(-orig_data[i][j].s); - } - } - - // Write to the dataset - dataset.write(static_cast(orig_data), mem_cmpd); - - // Read the dataset back */ - dataset.read(static_cast(new_data), mem_cmpd); - - // Check that the values read are the same as the values written. - for (i = 0; i < size[0]; i++) - for (j = 0; j < size[1]; j++) - { - if((new_data[i][j].i != orig_data[i][j].i) || - (new_data[i][j].c != orig_data[i][j].c) || - (new_data[i][j].s != orig_data[i][j].s)) - { - H5_FAILED(); - printf(" Read different values than written.\n"); - printf(" At index %lu,%lu\n", static_cast(i), static_cast(j)); - } + // Define datatypes of members of compound datatype + IntType i_type(PredType::NATIVE_INT); + IntType c_type(PredType::NATIVE_CHAR); + IntType s_type(PredType::NATIVE_SHORT); + + // Create a dataset compound datatype + CompType cmpd(sizeof(s1_t)); + cmpd.insertMember("i", HOFFSET(s1_t, i), i_type); + cmpd.insertMember("c", HOFFSET(s1_t, c), c_type); + cmpd.insertMember("s", HOFFSET(s1_t, s), s_type); + + // Create a memory compound datatype + CompType mem_cmpd(sizeof(s1_t)); + mem_cmpd.insertMember("i", HOFFSET(s1_t, i), i_type); + mem_cmpd.insertMember("c", HOFFSET(s1_t, c), c_type); + mem_cmpd.insertMember("s", HOFFSET(s1_t, s), s_type); + + // Set order of dataset compound datatype + //cmpd.setOrder(H5T_ORDER_BE); only for atomic type? + + // Create the data space + DataSpace space(2, size); + + // Use nbit filter + DSetCreatPropList dscreat; + dscreat.setChunk(2, chunk_size); + dscreat.setNbit(); + + // Create the dataset + DataSet dataset(file.createDataSet(DSET_NBIT_NAME, cmpd, space, dscreat)); + + // Initialize data, assuming size of long long >= size of member datatypes + for (i = 0; i < size[0]; i++) + for (j = 0; j < size[1]; j++) + { + orig_data[i][j].i = static_cast(i * j); + orig_data[i][j].c = static_cast('a' + i); + orig_data[i][j].s = static_cast(i + j); + + // Some even-numbered integer values are negative + if ((i*size[1]+j+1)%2 == 0) { + orig_data[i][j].i = -orig_data[i][j].i; + orig_data[i][j].s = static_cast(-orig_data[i][j].s); + } + } + + // Write to the dataset + dataset.write(static_cast(orig_data), mem_cmpd); + + // Read the dataset back */ + dataset.read(static_cast(new_data), mem_cmpd); + + // Check that the values read are the same as the values written. + for (i = 0; i < size[0]; i++) + for (j = 0; j < size[1]; j++) + { + if((new_data[i][j].i != orig_data[i][j].i) || + (new_data[i][j].c != orig_data[i][j].c) || + (new_data[i][j].s != orig_data[i][j].s)) + { + H5_FAILED(); + printf(" Read different values than written.\n"); + printf(" At index %lu,%lu\n", static_cast(i), static_cast(j)); + } } - PASSED(); - return 0; + PASSED(); + return 0; } // end try block // catch all dataset, file, space, and plist exceptions catch (Exception& E) { - cerr << " FAILED" << endl; - cerr << " <<< " << E.getDetailMsg() << " >>>" << endl << endl; + cerr << " FAILED" << endl; + cerr << " <<< " << E.getDetailMsg() << " >>>" << endl << endl; - return -1; + return -1; } } // test_nbit_compression /*------------------------------------------------------------------------- - * Function: test_multiopen + * Function: test_multiopen * - * Purpose: Tests that a bug no longer exists. If a dataset is opened - * twice and one of the handles is used to extend the dataset, - * then the other handle should return the new size when - * queried. + * Purpose Tests that a bug no longer exists. If a dataset is opened + * twice and one of the handles is used to extend the dataset, + * then the other handle should return the new size when + * queried. * - * Return: Success: 0 + * Return Success: 0 * - * Failure: -1 + * Failure: -1 * - * Programmer: Binh-Minh Ribler (using C version) - * Saturday, February 17, 2001 + * Programmer Binh-Minh Ribler (using C version) + * Saturday, February 17, 2001 * * Modifications: * @@ -896,74 +896,75 @@ test_multiopen (H5File& file) DataSpace* space = NULL; try { - // Create a dataset creation property list - DSetCreatPropList dcpl; + // Create a dataset creation property list + DSetCreatPropList dcpl; - // Set chunk size to given size - hsize_t cur_size[1] = {10}; - dcpl.setChunk (1, cur_size); + // Set chunk size to given size + hsize_t cur_size[1] = {10}; + dcpl.setChunk (1, cur_size); - // Create a simple data space with unlimited size - hsize_t max_size[1] = {H5S_UNLIMITED}; - space = new DataSpace (1, cur_size, max_size); + // Create a simple data space with unlimited size + hsize_t max_size[1] = {H5S_UNLIMITED}; + space = new DataSpace (1, cur_size, max_size); - // Create first dataset - DataSet dset1 = file.createDataSet ("multiopen", PredType::NATIVE_INT, *space, dcpl); + // Create first dataset + DataSet dset1 = file.createDataSet ("multiopen", PredType::NATIVE_INT, *space, dcpl); - // Open again the first dataset from the file to another DataSet object. - DataSet dset2 = file.openDataSet ("multiopen"); + // Open again the first dataset from the file to another DataSet object. + DataSet dset2 = file.openDataSet ("multiopen"); - // Relieve the dataspace - delete space; - space = NULL; + // Relieve the dataspace + delete space; + space = NULL; - // Extend the dimensionality of the first dataset - cur_size[0] = 20; - dset1.extend (cur_size); + // Extend the dimensionality of the first dataset + cur_size[0] = 20; + dset1.extend (cur_size); - // Get the size from the second handle - space = new DataSpace (dset2.getSpace()); + // Get the size from the second handle + space = new DataSpace (dset2.getSpace()); - hsize_t tmp_size[1]; - space->getSimpleExtentDims (tmp_size); - if (cur_size[0]!=tmp_size[0]) - { - cerr << " Got " << static_cast(tmp_size[0]) << " instead of " - << static_cast(cur_size[0]) << "!" << endl; - throw Exception("test_multiopen", "Failed in multi-open with extending"); - } + hsize_t tmp_size[1]; + space->getSimpleExtentDims (tmp_size); + if (cur_size[0]!=tmp_size[0]) + { + cerr << " Got " << static_cast(tmp_size[0]) + << " instead of " << static_cast(cur_size[0]) + << "!" << endl; + throw Exception("test_multiopen", "Failed in multi-open with extending"); + } - // clean up and return with success - delete space; - PASSED(); - return 0; + // clean up and return with success + delete space; + PASSED(); + return 0; } // end try block // catch all dataset, file, space, and plist exceptions catch (Exception& E) { - cerr << " FAILED" << endl; - cerr << " <<< " << E.getDetailMsg() << " >>>" << endl << endl; + cerr << " FAILED" << endl; + cerr << " <<< " << E.getDetailMsg() << " >>>" << endl << endl; - // clean up and return with failure - if (space != NULL) - delete space; - return -1; + // clean up and return with failure + if (space != NULL) + delete space; + return -1; } } // test_multiopen /*------------------------------------------------------------------------- - * Function: test_types + * Function: test_types * - * Purpose: Test various types - should be moved to dtypes.cpp + * Purpose Test various types - should be moved to dtypes.cpp * - * Return: Success: 0 + * Return Success: 0 * - * Failure: -1 + * Failure: -1 * - * Programmer: Binh-Minh Ribler (using C version) - * February 17, 2001 + * Programmer Binh-Minh Ribler (using C version) + * February 17, 2001 * * Modifications: * @@ -974,239 +975,238 @@ test_types(H5File& file) { SUBTEST("Various datatypes"); - size_t i; + size_t i; DataSet* dset = NULL; try { - // Create a group in the file that was passed in from the caller - Group grp = file.createGroup ("typetests"); - - /* bitfield_1 */ - unsigned char buf[32]; - hsize_t nelmts = sizeof(buf); - DataType type; - try { // block of bitfield_1 - // test copying a predefined type - type.copy (PredType::STD_B8LE); - - // Test copying a user-defined type using DataType::copy - DataType copied_type; - copied_type.copy(type); - - // Test copying a user-defined type using DataType::operator= - DataType another_copied_type; - another_copied_type = type; - - // Test copying a user-defined int type using DataType::operator= - IntType orig_int(PredType::STD_B8LE); - DataType generic_type; - generic_type = orig_int; - - // Test copying an integer predefined type - IntType new_int_type(PredType::STD_B8LE); - - // Test copying an int predefined type using DataType::operator= - IntType another_int_type; - another_int_type = new_int_type; - - DataSpace space (1, &nelmts); - dset = new DataSet(grp.createDataSet("bitfield_1", type, space)); - - // Fill buffer - for (i=0; i(0xff) ^ static_cast(i); - - // Write data from buf using all default dataspaces and property list - dset->write (buf, type); - - // no failure in bitfield_1, close this dataset - delete dset; - } // end try block of bitfield_1 - - // catch exceptions thrown in try block of bitfield_1 - catch (Exception& E) - { - cerr << " FAILED" << endl; - cerr << " <<< " << "bitfield_1: " << E.getFuncName() - << " - " << E.getDetailMsg() << " >>>" << endl << endl; - if (dset != NULL) - delete dset; - return -1; - } - - /* bitfield_2 */ - nelmts = sizeof(buf)/2; - try { // bitfield_2 block - type.copy (PredType::STD_B16LE); - DataSpace space (1, &nelmts); - dset = new DataSet(grp.createDataSet("bitfield_2", type, space)); - - // Fill buffer - for (i=0; i(0xff) ^ static_cast(i); - - // Write data from buf using all default dataspaces and property - // list; if writing fails, deallocate dset and return. - dset->write (buf, type); - - // no failure in bitfield_2, close this dataset and reset for - // variable reuse - delete dset; - dset = NULL; - } // end try block of bitfield_2 - - // catch exceptions thrown in try block of bitfield_2 - catch (Exception& E) - { - cerr << " FAILED" << endl; - cerr << " <<< " << "bitfield_2: " << E.getFuncName() - << " - " << E.getDetailMsg() << " >>>" << endl << endl; - if (dset != NULL) - delete dset; - throw E; // propagate the exception - } - - /* opaque_1 */ - DataType* optype = NULL; - try { // opaque_1 block - optype = new DataType(H5T_OPAQUE, 1); - nelmts = sizeof(buf); - DataSpace space (1, &nelmts); - optype->setTag ("testing 1-byte opaque type"); - dset = new DataSet(grp.createDataSet("opaque_1", *optype, space)); - - // Fill buffer - for (i=0; i(0xff) ^ static_cast(i); - - // Write data from buf using all default dataspaces and property - // list; if writing fails, deallocate dset and return. - dset->write (buf, *optype); - - // no failure in opaque_1 - delete dset; dset = NULL; - delete optype; optype = NULL; - } // end try block of opaque_1 - - // catch exceptions thrown in try block of opaque_1 - catch (Exception& E) - { - cerr << " FAILED" << endl; - cerr << " <<< " << "opaque_1: " << E.getFuncName() - << " - " << E.getDetailMsg() << " >>>" << endl << endl; - if (dset != NULL) - delete dset; - if (optype != NULL) - delete optype; - throw E; // propagate the exception - } - - /* opaque_2 */ - try { // block opaque_2 - nelmts = sizeof(buf)/4; - DataSpace space (1, &nelmts); - optype = new DataType(H5T_OPAQUE, 4); - optype->setTag ("testing 4-byte opaque type"); - dset = new DataSet(grp.createDataSet("opaque_2", *optype, space)); - - // Fill buffer - for (i=0; i(0xff) ^ static_cast(i); - - // Write data from buf using all default dataspaces and property - // list; if writing fails, deallocate dset and return. - dset->write (buf, *optype); - - // no failure in opaque_1 - delete dset; dset = NULL; - delete optype; optype = NULL; - } //end try block of opaque_2 - - // catch exceptions thrown in try block of opaque_2 - catch (Exception& E) - { - cerr << " FAILED" << endl; - cerr << " <<< " << "opaque_2: " << E.getFuncName() - << " - " << E.getDetailMsg() << " >>>" << endl << endl; - if (dset != NULL) - delete dset; - if (optype != NULL) - delete optype; - throw E; // propagate the exception - } - - PASSED(); - return 0; + // Create a group in the file that was passed in from the caller + Group grp = file.createGroup ("typetests"); + + /* bitfield_1 */ + unsigned char buf[32]; + hsize_t nelmts = sizeof(buf); + DataType type; + try { // block of bitfield_1 + // test copying a predefined type + type.copy (PredType::STD_B8LE); + + // Test copying a user-defined type using DataType::copy + DataType copied_type; + copied_type.copy(type); + + // Test copying a user-defined type using DataType::operator= + DataType another_copied_type; + another_copied_type = type; + + // Test copying a user-defined int type using DataType::operator= + IntType orig_int(PredType::STD_B8LE); + DataType generic_type; + generic_type = orig_int; + + // Test copying an integer predefined type + IntType new_int_type(PredType::STD_B8LE); + + // Test copying an int predefined type using DataType::operator= + IntType another_int_type; + another_int_type = new_int_type; + + DataSpace space (1, &nelmts); + dset = new DataSet(grp.createDataSet("bitfield_1", type, space)); + + // Fill buffer + for (i=0; i(0xff) ^ static_cast(i); + + // Write data from buf using all default dataspaces and property list + dset->write (buf, type); + + // no failure in bitfield_1, close this dataset + delete dset; + } // end try block of bitfield_1 + + // catch exceptions thrown in try block of bitfield_1 + catch (Exception& E) + { + cerr << " FAILED" << endl; + cerr << " <<< " << "bitfield_1: " << E.getFuncName() + << " - " << E.getDetailMsg() << " >>>" << endl << endl; + if (dset != NULL) + delete dset; + return -1; + } + + /* bitfield_2 */ + nelmts = sizeof(buf)/2; + try { // bitfield_2 block + type.copy (PredType::STD_B16LE); + DataSpace space (1, &nelmts); + dset = new DataSet(grp.createDataSet("bitfield_2", type, space)); + + // Fill buffer + for (i=0; i(0xff) ^ static_cast(i); + + // Write data from buf using all default dataspaces and property + // list; if writing fails, deallocate dset and return. + dset->write (buf, type); + + // no failure in bitfield_2, close this dataset and reset for + // variable reuse + delete dset; + dset = NULL; + } // end try block of bitfield_2 + + // catch exceptions thrown in try block of bitfield_2 + catch (Exception& E) + { + cerr << " FAILED" << endl; + cerr << " <<< " << "bitfield_2: " << E.getFuncName() + << " - " << E.getDetailMsg() << " >>>" << endl << endl; + if (dset != NULL) + delete dset; + throw E; // propagate the exception + } + + /* opaque_1 */ + DataType* optype = NULL; + try { // opaque_1 block + optype = new DataType(H5T_OPAQUE, 1); + nelmts = sizeof(buf); + DataSpace space (1, &nelmts); + optype->setTag ("testing 1-byte opaque type"); + dset = new DataSet(grp.createDataSet("opaque_1", *optype, space)); + + // Fill buffer + for (i=0; i(0xff) ^ static_cast(i); + + // Write data from buf using all default dataspaces and property + // list; if writing fails, deallocate dset and return. + dset->write (buf, *optype); + + // no failure in opaque_1 + delete dset; dset = NULL; + delete optype; optype = NULL; + } // end try block of opaque_1 + + // catch exceptions thrown in try block of opaque_1 + catch (Exception& E) + { + cerr << " FAILED" << endl; + cerr << " <<< " << "opaque_1: " << E.getFuncName() + << " - " << E.getDetailMsg() << " >>>" << endl << endl; + if (dset != NULL) + delete dset; + if (optype != NULL) + delete optype; + throw E; // propagate the exception + } + + /* opaque_2 */ + try { // block opaque_2 + nelmts = sizeof(buf)/4; + DataSpace space (1, &nelmts); + optype = new DataType(H5T_OPAQUE, 4); + optype->setTag ("testing 4-byte opaque type"); + dset = new DataSet(grp.createDataSet("opaque_2", *optype, space)); + + // Fill buffer + for (i=0; i(0xff) ^ static_cast(i); + + // Write data from buf using all default dataspaces and property + // list; if writing fails, deallocate dset and return. + dset->write (buf, *optype); + + // no failure in opaque_1 + delete dset; dset = NULL; + delete optype; optype = NULL; + } //end try block of opaque_2 + + // catch exceptions thrown in try block of opaque_2 + catch (Exception& E) + { + cerr << " FAILED" << endl; + cerr << " <<< " << "opaque_2: " << E.getFuncName() + << " - " << E.getDetailMsg() << " >>>" << endl << endl; + if (dset != NULL) + delete dset; + if (optype != NULL) + delete optype; + throw E; // propagate the exception + } + + PASSED(); + return 0; } // end top try block catch (Exception& E) { - return -1; + return -1; } } // test_types /*------------------------------------------------------------------------- - * Function: test_dset + * Function: test_dset * - * Purpose: Tests the dataset interface (H5D) + * Purpose Tests the dataset interface (H5D) * - * Return: Success: 0 + * Return Success: 0 * - * Failure: -1 + * Failure: -1 * - * Programmer: Binh-Minh Ribler (using C version) - * Friday, January 5, 2001 + * Programmer Binh-Minh Ribler (using C version) + * Friday, January 5, 2001 * * Modifications: - * Nov 12, 01: - * - moved h5_cleanup to outside of try block because - * dataset.h5 cannot be removed until "file" is out of - * scope and dataset.h5 is closed. - * Feb 20, 05: - * - cleanup_dsets took care of the cleanup now. + * Nov 12, 01: + * - moved h5_cleanup to outside of try block because + * dataset.h5 cannot be removed until "file" is out of + * scope and dataset.h5 is closed. + * Feb 20, 05: + * - cleanup_dsets took care of the cleanup now. * *------------------------------------------------------------------------- */ extern "C" void test_dset() { - hid_t fapl_id; + hid_t fapl_id; fapl_id = h5_fileaccess(); // in h5test.c, returns a file access template - - int nerrors=0; // keep track of number of failures occurr + int nerrors=0; // keep track of number of failures occur try { - // Use the file access template id to create a file access prop. - // list object to pass in H5File::H5File - FileAccPropList fapl(fapl_id); + // Use the file access template id to create a file access prop. + // list object to pass in H5File::H5File + FileAccPropList fapl(fapl_id); - H5File file(FILE1, H5F_ACC_TRUNC, FileCreatPropList::DEFAULT, fapl); + H5File file(FILE1, H5F_ACC_TRUNC, FileCreatPropList::DEFAULT, fapl); - // Cause the library to emit initial messages - Group grp = file.createGroup( "emit diagnostics", 0); - grp.setComment("Causes diagnostic messages to be emitted"); + // Cause the library to emit initial messages + Group grp = file.createGroup( "emit diagnostics", 0); + grp.setComment("Causes diagnostic messages to be emitted"); - nerrors += test_create(file) < 0 ? 1:0; - nerrors += test_simple_io(file) < 0 ? 1:0; - nerrors += test_tconv(file) < 0 ? 1:0; - nerrors += test_compression(file) < 0 ? 1:0; - nerrors += test_nbit_compression(file) < 0 ? 1:0; - nerrors += test_multiopen (file) < 0 ? 1:0; - nerrors += test_types(file) < 0 ? 1:0; + nerrors += test_create(file) < 0 ? 1:0; + nerrors += test_simple_io(file) < 0 ? 1:0; + nerrors += test_tconv(file) < 0 ? 1:0; + nerrors += test_compression(file) < 0 ? 1:0; + nerrors += test_nbit_compression(file) < 0 ? 1:0; + nerrors += test_multiopen (file) < 0 ? 1:0; + nerrors += test_types(file) < 0 ? 1:0; - // Close group "emit diagnostics". - grp.close(); + // Close group "emit diagnostics". + grp.close(); - // Close the file before testing data size. - file.close(); + // Close the file before testing data size. + file.close(); - nerrors += test_datasize(fapl) <0 ? 1:0; + nerrors += test_datasize(fapl) <0 ? 1:0; } catch (Exception& E) { - test_report(nerrors, H5std_string(" Dataset")); + test_report(nerrors, H5std_string(" Dataset")); } // Clean up data file @@ -1216,11 +1216,11 @@ void test_dset() /*------------------------------------------------------------------------- * Function: cleanup_dsets * - * Purpose: Cleanup temporary test files + * Purpose Cleanup temporary test files * - * Return: none + * Return none * - * Programmer: (use C version) + * Programmer (use C version) * * Modifications: * diff --git a/c++/test/h5cpputil.cpp b/c++/test/h5cpputil.cpp index 95d29a8..cf7fc2c 100644 --- a/c++/test/h5cpputil.cpp +++ b/c++/test/h5cpputil.cpp @@ -37,18 +37,18 @@ using namespace H5; #include "h5cpputil.h" // C++ utilility header file /*------------------------------------------------------------------------- - * Function: test_report + * Function: test_report * - * Purpose: Prints out the number of errors for the tests indicated - * by 'testname,' if there were any failures occurred. If - * no failure, test_report prints out the tests passed message. + * Purpose Prints out the number of errors for the tests indicated + * by 'testname,' if there were any failures occurred. If + * no failure, test_report prints out the tests passed message. * - * Return: if any failure has occurred: 1 + * Return if any failure has occurred: 1 * - * if no failure occurs: 0 + * if no failure occurs: 0 * - * Programmer: Binh-Minh Ribler (using C code segment for reporting tests) - * Friday, February 6, 2001 + * Programmer Binh-Minh Ribler (using C code segment for reporting tests) + * Friday, February 6, 2001 * * Modifications: * @@ -59,12 +59,12 @@ int test_report( int nerrors, const H5std_string& testname ) if (nerrors) { nerrors = MAX(1, nerrors); - if (1 == nerrors) - cerr << "***** " << nerrors << testname - << " TEST FAILED! *****" << endl; - else - cerr << "***** " << nerrors << testname - << " TESTS FAILED! *****" << endl; + if (1 == nerrors) + cerr << "***** " << nerrors << testname + << " TEST FAILED! *****" << endl; + else + cerr << "***** " << nerrors << testname + << " TESTS FAILED! *****" << endl; return 1; } else @@ -75,68 +75,68 @@ int test_report( int nerrors, const H5std_string& testname ) } /*------------------------------------------------------------------------- - * Function: issue_fail_msg + * Function: issue_fail_msg * - * Purpose: Displays that a function has failed with its location. + * Purpose Displays that a function has failed with its location. * - * Return: None + * Return None * - * Programmer: Binh-Minh Ribler (copied and modified macro CHECK from C) - * Monday, December 20, 2004 + * Programmer Binh-Minh Ribler (copied and modified macro CHECK from C) + * Monday, December 20, 2004 * *------------------------------------------------------------------------- */ void issue_fail_msg(const char* where, int line, const char* file_name, - const char* message) + const char* message) { if (GetTestVerbosity()>=VERBO_HI) { - cerr << endl; + cerr << endl; cerr << ">>> FAILED in " << where << " at line " << line << " in " << file_name << " - " << message << endl << endl; } } /*------------------------------------------------------------------------- - * Function: issue_fail_msg + * Function: issue_fail_msg * - * Purpose: Displays that a function has failed with its location. + * Purpose Displays that a function has failed with its location. * - * Return: None + * Return None * - * Programmer: Binh-Minh Ribler (copied and modified macro CHECK from C) - * Monday, December 20, 2004 + * Programmer Binh-Minh Ribler (copied and modified macro CHECK from C) + * Monday, December 20, 2004 * *------------------------------------------------------------------------- */ void issue_fail_msg(const char* where, int line, const char* file_name, - const char* func_name, const char* message) + const char* func_name, const char* message) { if (GetTestVerbosity()>=VERBO_HI) { - cerr << endl; + cerr << endl; cerr << ">>> FAILED in " << where << ": " << func_name << endl << - " at line " << line << " in " << file_name << endl << - " C library detail: " << message << endl << endl; + " at line " << line << " in " << file_name << endl << + " C library detail: " << message << endl << endl; } } /*------------------------------------------------------------------------- - * Function: check_values + * Function: check_values * - * Purpose: Checks a read value against the written value. If they are - * different, the function will print out a message and the - * different values. This function is made to reuse the code - * segment that is used in various places throughout - * the test code. Where the C version of this code segment - * "goto error," this function will return -1. + * Purpose Checks a read value against the written value. If they are + * different, the function will print out a message and the + * different values. This function is made to reuse the code + * segment that is used in various places throughout + * the test code. Where the C version of this code segment + * "goto error," this function will return -1. * - * Return: Success: 0 + * Return Success: 0 * - * Failure: -1 + * Failure: -1 * - * Programmer: Binh-Minh Ribler (using C code segment for checking values) - * Friday, February 6, 2001 + * Programmer Binh-Minh Ribler (using C code segment for checking values) + * Friday, February 6, 2001 * * Modifications: * @@ -146,26 +146,26 @@ int check_values (hsize_t i, hsize_t j, int apoint, int acheck) { if (apoint != acheck) { - cerr << " Read different values than written.\n" << endl; - cerr << " At index " << static_cast(i) << "," << - static_cast(j) << endl; - return -1; + cerr << " Read different values than written.\n" << endl; + cerr << " At index " << static_cast(i) << "," << + static_cast(j) << endl; + return -1; } return 0; } // check_values /*------------------------------------------------------------------------- - * Function: check_values + * Function: check_values * - * Purpose: Checks a char string pointer for NULL. If it is NULL, - * the function will print out a message + * Purpose Checks a char string pointer for NULL. If it is NULL, + * the function will print out a message * - * Return: Success: 0 + * Return Success: 0 * - * Failure: -1 + * Failure: -1 * - * Programmer: Binh-Minh Ribler (using C code segment for checking values) - * Friday, September 16, 2016 + * Programmer Binh-Minh Ribler (using C code segment for checking values) + * Friday, September 16, 2016 * *------------------------------------------------------------------------- */ @@ -173,26 +173,26 @@ void check_values(const char *value, const char* msg, int line, const char* file { if (value == NULL) { - cerr << endl; + cerr << endl; cerr << "*** ERROR: " << msg << ", at line " << line << endl; - IncTestNumErrs(); - throw TestFailedException(file_name, msg); + IncTestNumErrs(); + throw TestFailedException(file_name, msg); } } /*------------------------------------------------------------------------- - * Function: verify_val (const char*, const char*,...) + * Function: verify_val (const char*, const char*,...) * - * Purpose: Compares two character strings. If they are - * different, the function will print out a message and the - * different values. + * Purpose Compares two character strings. If they are + * different, the function will print out a message and the + * different values. * - * Return: Success: 0 + * Return Success: 0 * - * Failure: -1 + * Failure: -1 * - * Programmer: Binh-Minh Ribler - * May 2, 2010 + * Programmer Binh-Minh Ribler + * May 2, 2010 * * Modifications: * @@ -225,12 +225,12 @@ InvalidActionException::InvalidActionException():Exception(){} //-------------------------------------------------------------------------- // Function: InvalidActionException overloaded constructor // -// Purpose: Creates an InvalidActionException with the name of the function, +// Purpose Creates an InvalidActionException with the name of the function, // which the failure should have occurred but didn't, and a -// message explaining why it should fail. +// message explaining why it should fail. // Parameters -// func - IN: Name of the function where failure should occur -// message - IN: Message +// func - IN: Name of the function where failure should occur +// message - IN: Message //-------------------------------------------------------------------------- InvalidActionException::InvalidActionException(const H5std_string func, const H5std_string message) : Exception(func, message) {} @@ -247,12 +247,12 @@ TestFailedException::TestFailedException():Exception(){} //-------------------------------------------------------------------------- // Function: TestFailedException overloaded constructor // -// Purpose: Creates an TestFailedException with the name of the function, +// Purpose Creates an TestFailedException with the name of the function, // which the failure should have occurred but didn't, and a -// message explaining why it should fail. +// message explaining why it should fail. // Parameters -// func - IN: Name of the function where failure should occur -// message - IN: Message +// func - IN: Name of the function where failure should occur +// message - IN: Message //-------------------------------------------------------------------------- TestFailedException::TestFailedException(const H5std_string func, const H5std_string message) : Exception(func, message) {} diff --git a/c++/test/h5cpputil.h b/c++/test/h5cpputil.h index f8aaec7..7f92e60 100644 --- a/c++/test/h5cpputil.h +++ b/c++/test/h5cpputil.h @@ -37,22 +37,22 @@ int check_values (hsize_t i, hsize_t j, int apoint, int acheck); void check_values(const char *value, const char* msg, int line, const char* file_name); int test_report (int, const H5std_string&); void issue_fail_msg(const char* where, int line, const char* file_name, - const char* message=""); + const char* message=""); void issue_fail_msg(const char* where, int line, const char* file_name, - const char* func_name, const char* message); + const char* func_name, const char* message); class InvalidActionException : public Exception { public: - InvalidActionException(const H5std_string func_name, const H5std_string message = DEFAULT_MSG); - InvalidActionException(); - virtual ~InvalidActionException() throw(); + InvalidActionException(const H5std_string func_name, const H5std_string message = DEFAULT_MSG); + InvalidActionException(); + virtual ~InvalidActionException() throw(); }; class TestFailedException : public Exception { public: - TestFailedException(const H5std_string func_name, const H5std_string message = DEFAULT_MSG); - TestFailedException(); - virtual ~TestFailedException() throw(); + TestFailedException(const H5std_string func_name, const H5std_string message = DEFAULT_MSG); + TestFailedException(); + virtual ~TestFailedException() throw(); }; // Overloaded/Template functions to verify values and display proper info @@ -65,18 +65,18 @@ template { if (GetTestVerbosity()>=VERBO_HI) { - cerr << endl; + cerr << endl; cerr << " Call to routine: " << where << " at line " << line - << " in " << file_name << " had value " << x << endl; + << " in " << file_name << " had value " << x << endl; } if (x != value) { - cerr << endl; + cerr << endl; cerr << "*** UNEXPECTED VALUE from " << where << " should be " - << value << ", but is " << x << " at line " << line - << " in " << file_name << endl; - IncTestNumErrs(); - throw TestFailedException(where, ""); + << value << ", but is " << x << " at line " << line + << " in " << file_name << endl; + IncTestNumErrs(); + throw TestFailedException(where, ""); } } @@ -85,12 +85,12 @@ template { if (x != value) { - cerr << endl; + cerr << endl; cerr << "*** UNEXPECTED VALUE: " << file_name << ":line " << line - << ": " << msg << " different: " << x << ", should be " << value - << endl; - IncTestNumErrs(); - throw TestFailedException(file_name, msg); + << ": " << msg << " different: " << x << ", should be " << value + << endl; + IncTestNumErrs(); + throw TestFailedException(file_name, msg); } } @@ -99,17 +99,17 @@ template { if (GetTestVerbosity()>=VERBO_HI) { - cerr << endl; + cerr << endl; cerr << " Call to routine: " << where << " at line " << line - << " in " << file_name << " had value " << x << endl; + << " in " << file_name << " had value " << x << endl; } if (x == value) { - cerr << endl; + cerr << endl; cerr << "*** UNEXPECTED VALUE from " << where << " should not be " - << value << " at line " << line << " in " << file_name << endl; - IncTestNumErrs(); - throw TestFailedException(where, ""); + << value << " at line " << line << " in " << file_name << endl; + IncTestNumErrs(); + throw TestFailedException(where, ""); } } @@ -118,10 +118,10 @@ template { if (x == value) { - cerr << endl; + cerr << endl; cerr << "*** Function " << msg << " FAILED at line " << line << endl; - IncTestNumErrs(); - throw TestFailedException(file_name, msg); + IncTestNumErrs(); + throw TestFailedException(file_name, msg); } } @@ -130,12 +130,12 @@ template { if (x == value) { - cerr << endl; - cerr << "*** UNEXPECTED FLOAT VALUE: " << file_name << ":line " << line - << ": " << msg << " different: " << x << ", should be " << value - << " (epsilon=" << epsilon << ")" << endl; - IncTestNumErrs(); - throw TestFailedException(file_name, msg); + cerr << endl; + cerr << "*** UNEXPECTED FLOAT VALUE: " << file_name << ":line " << line + << ": " << msg << " different: " << x << ", should be " << value + << " (epsilon=" << epsilon << ")" << endl; + IncTestNumErrs(); + throw TestFailedException(file_name, msg); } } diff --git a/c++/test/tarray.cpp b/c++/test/tarray.cpp index f10016f..490772f 100644 --- a/c++/test/tarray.cpp +++ b/c++/test/tarray.cpp @@ -53,12 +53,12 @@ typedef enum int_t { /*------------------------------------------------------------------------- * Function: test_array_compound_array * - * Purpose: Tests 1-D array of compound datatypes (with array fields) + * Purpose Tests 1-D array of compound datatypes (with array fields) * - * Return: None. + * Return None. * - * Programmer: Binh-Minh Ribler (using C version) - * January, 2016 + * Programmer Binh-Minh Ribler (using C version) + * January, 2016 * * Modifications: * @@ -76,7 +76,7 @@ static void test_array_compound_array() hsize_t sdims1[] = {SPACE1_DIM1}; hsize_t tdims1[] = {ARRAY1_DIM1}; int nmemb; // Number of compound members - int ii; // counting variables + int ii; // counting variables hsize_t idxi, idxj, idxk; // dimension indicing variables H5T_class_t mclass; // Datatype class for field @@ -85,193 +85,193 @@ static void test_array_compound_array() for (idxj = 0; idxj < ARRAY1_DIM1; idxj++) { wdata[idxi][idxj].i = idxi * 10 + idxj; for(idxk = 0; idxk < ARRAY1_DIM1; idxk++) - { + { float temp = idxi * 10.0 + idxj * 2.5 + idxk; wdata[idxi][idxj].f[idxk] = temp; - } + } } // end for try { - // Create File - H5File file1(FILENAME, H5F_ACC_TRUNC); + // Create File + H5File file1(FILENAME, H5F_ACC_TRUNC); - // Create dataspace for datasets - DataSpace space(SPACE1_RANK, sdims1, NULL); + // Create dataspace for datasets + DataSpace space(SPACE1_RANK, sdims1, NULL); - /* - * Create an array datatype of compounds, arrtype. Each compound - * datatype, comptype, contains an integer and an array of floats, - * arrfltype. - */ + /* + * Create an array datatype of compounds, arrtype. Each compound + * datatype, comptype, contains an integer and an array of floats, + * arrfltype. + */ - // Create a compound datatype - CompType comptype(sizeof(s1_t)); + // Create a compound datatype + CompType comptype(sizeof(s1_t)); - // Insert integer field - comptype.insertMember("i", HOFFSET(s1_t, i), PredType::NATIVE_INT); + // Insert integer field + comptype.insertMember("i", HOFFSET(s1_t, i), PredType::NATIVE_INT); - // Create an array of floats datatype - ArrayType arrfltype(PredType::NATIVE_FLOAT, ARRAY1_RANK, tdims1); + // Create an array of floats datatype + ArrayType arrfltype(PredType::NATIVE_FLOAT, ARRAY1_RANK, tdims1); - // Insert float array field - comptype.insertMember("f", HOFFSET(s1_t, f), arrfltype); + // Insert float array field + comptype.insertMember("f", HOFFSET(s1_t, f), arrfltype); - // Close array of floats field datatype - arrfltype.close(); + // Close array of floats field datatype + arrfltype.close(); - // Create an array datatype of the compound datatype - ArrayType arrtype(comptype, ARRAY1_RANK, tdims1); + // Create an array datatype of the compound datatype + ArrayType arrtype(comptype, ARRAY1_RANK, tdims1); - // Close compound datatype comptype - comptype.close(); + // Close compound datatype comptype + comptype.close(); - // Create a dataset - DataSet dataset = file1.createDataSet("Dataset1", arrtype, space); + // Create a dataset + DataSet dataset = file1.createDataSet("Dataset1", arrtype, space); - // Write dataset to disk - dataset.write(wdata, arrtype); + // Write dataset to disk + dataset.write(wdata, arrtype); - // Test opening ArrayType with opening constructor (Dec 2016) + // Test opening ArrayType with opening constructor (Dec 2016) - // Commit the arrtype to give it a name - arrtype.commit(file1, ARRAYTYPE_NAME); + // Commit the arrtype to give it a name + arrtype.commit(file1, ARRAYTYPE_NAME); - // Close it, then re-open with the opening constructor - arrtype.close(); - ArrayType named_type(file1, ARRAYTYPE_NAME); + // Close it, then re-open with the opening constructor + arrtype.close(); + ArrayType named_type(file1, ARRAYTYPE_NAME); - // Get and verify the type's name - H5std_string type_name = named_type.getObjName(); - verify_val(type_name, ARRAYTYPE_NAME, "DataType::getObjName tests constructor", __LINE__, __FILE__); - named_type.close(); + // Get and verify the type's name + H5std_string type_name = named_type.getObjName(); + verify_val(type_name, ARRAYTYPE_NAME, "DataType::getObjName tests constructor", __LINE__, __FILE__); + named_type.close(); - // Close all - dataset.close(); - space.close(); - file1.close(); + // Close all + dataset.close(); + space.close(); + file1.close(); - // Re-open file - file1.openFile(FILENAME, H5F_ACC_RDONLY); + // Re-open file + file1.openFile(FILENAME, H5F_ACC_RDONLY); - // Open the dataset - dataset = file1.openDataSet("Dataset1"); + // Open the dataset + dataset = file1.openDataSet("Dataset1"); - /* - * Check the datatype array of compounds - */ + /* + * Check the datatype array of compounds + */ - // Verify that it is an array of compounds - DataType dstype = dataset.getDataType(); - mclass = dstype.getClass(); - verify_val(mclass==H5T_ARRAY, true, "f2_type.getClass", __LINE__, __FILE__); + // Verify that it is an array of compounds + DataType dstype = dataset.getDataType(); + mclass = dstype.getClass(); + verify_val(mclass==H5T_ARRAY, true, "f2_type.getClass", __LINE__, __FILE__); - dstype.close(); + dstype.close(); - // Get the array datatype to check - ArrayType atype_check = dataset.getArrayType(); + // Get the array datatype to check + ArrayType atype_check = dataset.getArrayType(); - // Check the array rank - int ndims = atype_check.getArrayNDims(); - verify_val(ndims, ARRAY1_RANK, "atype_check.getArrayNDims", __LINE__, __FILE__); + // Check the array rank + int ndims = atype_check.getArrayNDims(); + verify_val(ndims, ARRAY1_RANK, "atype_check.getArrayNDims", __LINE__, __FILE__); - // Get the array dimensions - hsize_t rdims1[H5S_MAX_RANK]; - atype_check.getArrayDims(rdims1); + // Get the array dimensions + hsize_t rdims1[H5S_MAX_RANK]; + atype_check.getArrayDims(rdims1); - // Check the array dimensions - for (ii =0; ii FP_EPSILON) - verify_val(read_data2, attr_data5, FP_EPSILON, "Attribute::read", __LINE__, __FILE__); + // Read attribute information + float read_data2=0.0; // Buffer for reading 1st attribute + ds_attr.read(PredType::NATIVE_FLOAT,&read_data2); + if (HDfabs(read_data2 - attr_data5) > FP_EPSILON) + verify_val(read_data2, attr_data5, FP_EPSILON, "Attribute::read", __LINE__, __FILE__); - // Get the dataspace of the attribute - DataSpace att_space = ds_attr.getSpace(); + // Get the dataspace of the attribute + DataSpace att_space = ds_attr.getSpace(); - // Make certain the dataspace is scalar - H5S_class_t space_type = att_space.getSimpleExtentType(); - verify_val(space_type, H5S_SCALAR, "DataSpace::getSimpleExtentType", __LINE__, __FILE__); + // Make certain the dataspace is scalar + H5S_class_t space_type = att_space.getSimpleExtentType(); + verify_val(space_type, H5S_SCALAR, "DataSpace::getSimpleExtentType", __LINE__, __FILE__); - PASSED(); + PASSED(); } // end try block catch (Exception& E) { - issue_fail_msg("test_attr_scalar_read()", __LINE__, __FILE__, E.getCDetailMsg()); + issue_fail_msg("test_attr_scalar_read()", __LINE__, __FILE__, E.getCDetailMsg()); } } // test_attr_scalar_read() @@ -877,65 +877,65 @@ static void test_attr_mult_write() SUBTEST("Multiple Attribute Writing Functions"); try { - // Create file - H5File fid1 (FILE_MULTI, H5F_ACC_TRUNC); + // Create file + H5File fid1 (FILE_MULTI, H5F_ACC_TRUNC); - // Create dataspace for dataset - hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3}; - DataSpace ds_space (SPACE1_RANK, dims1); + // Create dataspace for dataset + hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3}; + DataSpace ds_space (SPACE1_RANK, dims1); - // Create a dataset - DataSet dataset = fid1.createDataSet(DSET1_NAME, PredType::NATIVE_UCHAR, ds_space); + // Create a dataset + DataSet dataset = fid1.createDataSet(DSET1_NAME, PredType::NATIVE_UCHAR, ds_space); - // Create dataspace for 1st attribute - hsize_t dims2[] = {ATTR1_DIM1}; - DataSpace att_space (ATTR1_RANK, dims2); + // Create dataspace for 1st attribute + hsize_t dims2[] = {ATTR1_DIM1}; + DataSpace att_space (ATTR1_RANK, dims2); - // Create 1st attribute for the dataset - Attribute ds_attr = dataset.createAttribute (ATTR1_NAME, PredType::NATIVE_INT, att_space); + // Create 1st attribute for the dataset + Attribute ds_attr = dataset.createAttribute (ATTR1_NAME, PredType::NATIVE_INT, att_space); - // Write attribute information - ds_attr.write (PredType::NATIVE_INT, attr_data1); + // Write attribute information + ds_attr.write (PredType::NATIVE_INT, attr_data1); - // Create dataspace for 2nd attribute - hsize_t dims3[] = {ATTR2_DIM1,ATTR2_DIM2}; - DataSpace att2_space (ATTR2_RANK, dims3); + // Create dataspace for 2nd attribute + hsize_t dims3[] = {ATTR2_DIM1,ATTR2_DIM2}; + DataSpace att2_space (ATTR2_RANK, dims3); - // Create 2nd attribute for the dataset - Attribute ds_attr2 = dataset.createAttribute (ATTR2_NAME, PredType::NATIVE_INT, att2_space); + // Create 2nd attribute for the dataset + Attribute ds_attr2 = dataset.createAttribute (ATTR2_NAME, PredType::NATIVE_INT, att2_space); - // Write 2nd attribute information - ds_attr2.write (PredType::NATIVE_INT, attr_data2); + // Write 2nd attribute information + ds_attr2.write (PredType::NATIVE_INT, attr_data2); - // Create dataspace for 3rd attribute - hsize_t dims4[] = {ATTR3_DIM1,ATTR3_DIM2,ATTR3_DIM3}; - DataSpace att3_space (ATTR3_RANK, dims4); + // Create dataspace for 3rd attribute + hsize_t dims4[] = {ATTR3_DIM1,ATTR3_DIM2,ATTR3_DIM3}; + DataSpace att3_space (ATTR3_RANK, dims4); - // Create 3rd attribute for the dataset - Attribute ds_attr3 = dataset.createAttribute (ATTR3_NAME, PredType::NATIVE_DOUBLE, att3_space); + // Create 3rd attribute for the dataset + Attribute ds_attr3 = dataset.createAttribute (ATTR3_NAME, PredType::NATIVE_DOUBLE, att3_space); - // Try creating an attribute that already exists. This should fail - // since two attributes cannot have the same name. If an exception - // is not thrown for this action by createAttribute, then throw an - // invalid action exception. - try { - Attribute invalid_attr = dataset.createAttribute (ATTR3_NAME, PredType::NATIVE_DOUBLE, att3_space); + // Try creating an attribute that already exists. This should fail + // since two attributes cannot have the same name. If an exception + // is not thrown for this action by createAttribute, then throw an + // invalid action exception. + try { + Attribute invalid_attr = dataset.createAttribute (ATTR3_NAME, PredType::NATIVE_DOUBLE, att3_space); - // continuation here, that means no exception has been thrown - throw InvalidActionException("DataSet::createAttribute", "Attempting to create a duplicate attribute"); - } - catch (AttributeIException& E) // catching invalid creating attribute + // continuation here, that means no exception has been thrown + throw InvalidActionException("DataSet::createAttribute", "Attempting to create a duplicate attribute"); + } + catch (AttributeIException& E) // catching invalid creating attribute {} // do nothing, exception expected - // Write 3rd attribute information - ds_attr3.write (PredType::NATIVE_DOUBLE, attr_data3); + // Write 3rd attribute information + ds_attr3.write (PredType::NATIVE_DOUBLE, attr_data3); - PASSED(); + PASSED(); } // end try block catch (Exception& E) { - issue_fail_msg("test_attr_mult_write()", __LINE__, __FILE__, E.getCDetailMsg()); + issue_fail_msg("test_attr_mult_write()", __LINE__, __FILE__, E.getCDetailMsg()); } } // test_attr_mult_write() @@ -951,39 +951,39 @@ static void test_attr_mult_read() double read_data3[ATTR3_DIM1][ATTR3_DIM2][ATTR3_DIM3]={{{0}}}; // Buffer for reading 3rd attribute hsize_t i,j,k; - // Output message about test being performed + // Output message about test being performed SUBTEST("Multiple Attribute Reading Functions"); try { - // Open file - H5File fid1(FILE_MULTI, H5F_ACC_RDWR); + // Open file + H5File fid1(FILE_MULTI, H5F_ACC_RDWR); - // Open the dataset - DataSet dataset = fid1.openDataSet(DSET1_NAME); + // Open the dataset + DataSet dataset = fid1.openDataSet(DSET1_NAME); - // Verify the correct number of attributes - int num_attrs = dataset.getNumAttrs(); - verify_val(num_attrs, 3, "DataSet::getNumAttrs", __LINE__, __FILE__); + // Verify the correct number of attributes + int num_attrs = dataset.getNumAttrs(); + verify_val(num_attrs, 3, "DataSet::getNumAttrs", __LINE__, __FILE__); - // Open 1st attribute for the dataset - Attribute attr = dataset.openAttribute((unsigned)0); + // Open 1st attribute for the dataset + Attribute attr = dataset.openAttribute((unsigned)0); - /* Verify Dataspace */ + /* Verify Dataspace */ - // Get the dataspace of the attribute - DataSpace space = attr.getSpace(); + // Get the dataspace of the attribute + DataSpace space = attr.getSpace(); - // Get the rank of the dataspace and verify it - int rank = space.getSimpleExtentNdims(); - verify_val(rank, ATTR1_RANK, "DataSpace::getSimpleExtentNdims", __LINE__, __FILE__); + // Get the rank of the dataspace and verify it + int rank = space.getSimpleExtentNdims(); + verify_val(rank, ATTR1_RANK, "DataSpace::getSimpleExtentNdims", __LINE__, __FILE__); - // Get the dims of the dataspace and verify them - hsize_t dims[ATTR_MAX_DIMS]; // Attribute dimensions - int ndims = space.getSimpleExtentDims(dims); - if ((long)dims[0] != (long)ATTR1_DIM1) - TestErrPrintf("%d:attribute dimensions different: dims[0]=%d, should be %d\n",__LINE__,(int)dims[0],ATTR1_DIM1); + // Get the dims of the dataspace and verify them + hsize_t dims[ATTR_MAX_DIMS]; // Attribute dimensions + int ndims = space.getSimpleExtentDims(dims); + if ((long)dims[0] != (long)ATTR1_DIM1) + TestErrPrintf("%d:attribute dimensions different: dims[0]=%d, should be %d\n",__LINE__,(int)dims[0],ATTR1_DIM1); - /* Verify Datatype */ + /* Verify Datatype */ // Get the class of the datatype that is used by attr H5T_class_t type_class = attr.getTypeClass(); @@ -991,51 +991,51 @@ static void test_attr_mult_read() // Verify that the type is of integer datatype verify_val(type_class, H5T_INTEGER, "Attribute::getTypeClass", __LINE__, __FILE__); - // Get the integer datatype + // Get the integer datatype IntType i_type1 = attr.getIntType(); - // Get and verify the order of this type - H5T_order_t order = i_type1.getOrder(); - verify_val(order, PredType::NATIVE_INT.getOrder(), "DataType::getOrder", __LINE__, __FILE__); + // Get and verify the order of this type + H5T_order_t order = i_type1.getOrder(); + verify_val(order, PredType::NATIVE_INT.getOrder(), "DataType::getOrder", __LINE__, __FILE__); - // Get and verify the size of this type - size_t size = i_type1.getSize(); - verify_val(size, PredType::NATIVE_INT.getSize(), "DataType::getSize", __LINE__, __FILE__); + // Get and verify the size of this type + size_t size = i_type1.getSize(); + verify_val(size, PredType::NATIVE_INT.getSize(), "DataType::getSize", __LINE__, __FILE__); - // Read attribute information - attr.read(PredType::NATIVE_INT, read_data1); + // Read attribute information + attr.read(PredType::NATIVE_INT, read_data1); - // Verify values read in - for(i=0; iopenAttribute(ATTR1_NAME)); + // Open attribute + Attribute *attr2 = new Attribute (dset2->openAttribute(ATTR1_NAME)); - // Read data from the attribute - attr2->read(PredType::NATIVE_INT, &rdata); - verify_val(data, rdata, "Attribute::read", __LINE__, __FILE__); + // Read data from the attribute + attr2->read(PredType::NATIVE_INT, &rdata); + verify_val(data, rdata, "Attribute::read", __LINE__, __FILE__); - // Close attribute and dataset - delete attr2; - delete dset2; + // Close attribute and dataset + delete attr2; + delete dset2; #ifndef H5_NO_DEPRECATED_SYMBOLS - // Check reference count on named datatype - fid1.getObjinfo(TYPE1_NAME, statbuf); - verify_val((int)statbuf.nlink, 3, "DataSet::openAttribute", __LINE__, __FILE__); + // Check reference count on named datatype + fid1.getObjinfo(TYPE1_NAME, statbuf); + verify_val((int)statbuf.nlink, 3, "DataSet::openAttribute", __LINE__, __FILE__); #endif /* H5_NO_DEPRECATED_SYMBOLS */ - } // end of second enclosing + } // end of second enclosing - // Unlink the dataset - fid1.unlink(DSET1_NAME); + // Unlink the dataset + fid1.unlink(DSET1_NAME); #ifndef H5_NO_DEPRECATED_SYMBOLS - // Check reference count on named datatype - fid1.getObjinfo(TYPE1_NAME, statbuf); - verify_val((int)statbuf.nlink, 1, "H5File::unlink", __LINE__, __FILE__); + // Check reference count on named datatype + fid1.getObjinfo(TYPE1_NAME, statbuf); + verify_val((int)statbuf.nlink, 1, "H5File::unlink", __LINE__, __FILE__); #endif /* H5_NO_DEPRECATED_SYMBOLS */ - // Unlink the named datatype - fid1.unlink(TYPE1_NAME); + // Unlink the named datatype + fid1.unlink(TYPE1_NAME); - // Close file - fid1.close(); + // Close file + fid1.close(); - // Check size of file - filesize = h5_get_file_size(FILE_DTYPE.c_str(), H5P_DEFAULT); - verify_val((long)filesize, (long)empty_filesize, "Checking file size", __LINE__, __FILE__); + // Check size of file + filesize = h5_get_file_size(FILE_DTYPE.c_str(), H5P_DEFAULT); + verify_val((long)filesize, (long)empty_filesize, "Checking file size", __LINE__, __FILE__); - PASSED(); + PASSED(); } // end try block catch (Exception& E) { - issue_fail_msg("test_attr_dtype_shared()", __LINE__, __FILE__, E.getCDetailMsg()); + issue_fail_msg("test_attr_dtype_shared()", __LINE__, __FILE__, E.getCDetailMsg()); } } // test_attr_dtype_shared() @@ -1424,116 +1424,116 @@ static void test_string_attr() SUBTEST("I/O on FL and VL String Attributes"); try { - // Create file - H5File fid1(FILE_BASIC, H5F_ACC_RDWR); - - // - // Fixed-lenth string attributes - // - // Create a fixed-length string datatype to refer to. - StrType fls_type(0, ATTR_LEN); - - // Open the root group. - Group root = fid1.openGroup("/"); - - // Create dataspace for the attribute. - DataSpace att_space (H5S_SCALAR); - - /* Test Attribute::write(...,const void *buf) with Fixed len string */ - - // Create an attribute for the root group. - Attribute gr_flattr1 = root.createAttribute(ATTR1_FL_STR_NAME, fls_type, att_space); - - // Write data to the attribute. - gr_flattr1.write(fls_type, ATTRSTR_DATA.c_str()); - - /* Test Attribute::write(...,const H5std_string& strg) with FL string */ - - // Create an attribute for the root group. - Attribute gr_flattr2 = root.createAttribute(ATTR2_FL_STR_NAME, fls_type, att_space); - - // Write data to the attribute. - gr_flattr2.write(fls_type, ATTRSTR_DATA); - - /* Test Attribute::read(...,void *buf) with FL string */ - - // Read and verify the attribute string as a string of chars. - char flstring_att_check[ATTR_LEN]; - gr_flattr1.read(fls_type, flstring_att_check); - if(HDstrcmp(flstring_att_check, ATTRSTR_DATA.c_str())!=0) - TestErrPrintf("Line %d: Attribute data different: ATTRSTR_DATA=%s,flstring_att_check=%s\n",__LINE__, ATTRSTR_DATA.c_str(), flstring_att_check); - - // Read and verify the attribute string as a string of chars; buffer - // is dynamically allocated. - size_t attr_size = gr_flattr1.getInMemDataSize(); - char *fl_dyn_string_att_check; - fl_dyn_string_att_check = new char[attr_size+1]; - gr_flattr1.read(fls_type, fl_dyn_string_att_check); - if(HDstrcmp(fl_dyn_string_att_check, ATTRSTR_DATA.c_str())!=0) - TestErrPrintf("Line %d: Attribute data different: ATTRSTR_DATA=%s,flstring_att_check=%s\n",__LINE__, ATTRSTR_DATA.c_str(), fl_dyn_string_att_check); - delete []fl_dyn_string_att_check; - - /* Test Attribute::read(...,H5std_string& strg) with FL string */ - - // Read and verify the attribute string as an std::string. - H5std_string read_flstr1; - gr_flattr1.read(fls_type, read_flstr1); - if (read_flstr1 != ATTRSTR_DATA) - TestErrPrintf("Line %d: Attribute data different: ATTRSTR_DATA=%s,read_flstr1=%s\n",__LINE__, ATTRSTR_DATA.c_str(), read_flstr1.c_str()); - - // Read and verify the attribute string as a string of chars. - HDstrcpy(flstring_att_check, ""); - gr_flattr2.read(fls_type, flstring_att_check); - if(HDstrcmp(flstring_att_check, ATTRSTR_DATA.c_str())!=0) - TestErrPrintf("Line %d: Attribute data different: ATTRSTR_DATA=%s,flstring_att_check=%s\n",__LINE__, ATTRSTR_DATA.c_str(), flstring_att_check); - - /* Test Attribute::read(...,H5std_string& strg) with FL string */ - - // Read and verify the attribute string as an std::string. - H5std_string read_flstr2; - gr_flattr2.read(fls_type, read_flstr2); - if (read_flstr2 != ATTRSTR_DATA) - TestErrPrintf("Line %d: Attribute data different: ATTRSTR_DATA=%s,read_flstr2=%s\n",__LINE__, ATTRSTR_DATA.c_str(), read_flstr2.c_str()); - - // - // Variable-lenth string attributes - // - // Create a variable length string datatype to refer to. - StrType vls_type(0, H5T_VARIABLE); - - // Create an attribute for the root group. - Attribute gr_vlattr = root.createAttribute(ATTR_VL_STR_NAME, vls_type, att_space); - - // Write data to the attribute. - gr_vlattr.write(vls_type, ATTRSTR_DATA); - - /* Test Attribute::read(...,void *buf) with Variable len string */ - // Read and verify the attribute string as a string of chars. - char *string_att_check; - gr_vlattr.read(vls_type, &string_att_check); - if(HDstrcmp(string_att_check, ATTRSTR_DATA.c_str())!=0) - TestErrPrintf("Line %d: Attribute data different: ATTRSTR_DATA=%s,string_att_check=%s\n",__LINE__, ATTRSTR_DATA.c_str(), string_att_check); - HDfree(string_att_check); - - /* Test Attribute::read(...,H5std_string& strg) with VL string */ - // Read and verify the attribute string as an std::string. - H5std_string read_str; - gr_vlattr.read(vls_type, read_str); - if (read_str != ATTRSTR_DATA) - TestErrPrintf("Line %d: Attribute data different: ATTRSTR_DATA=%s,read_str=%s\n",__LINE__, ATTRSTR_DATA.c_str(), read_str.c_str()); - PASSED(); + // Create file + H5File fid1(FILE_BASIC, H5F_ACC_RDWR); + + // + // Fixed-lenth string attributes + // + // Create a fixed-length string datatype to refer to. + StrType fls_type(0, ATTR_LEN); + + // Open the root group. + Group root = fid1.openGroup("/"); + + // Create dataspace for the attribute. + DataSpace att_space (H5S_SCALAR); + + /* Test Attribute::write(...,const void *buf) with Fixed len string */ + + // Create an attribute for the root group. + Attribute gr_flattr1 = root.createAttribute(ATTR1_FL_STR_NAME, fls_type, att_space); + + // Write data to the attribute. + gr_flattr1.write(fls_type, ATTRSTR_DATA.c_str()); + + /* Test Attribute::write(...,const H5std_string& strg) with FL string */ + + // Create an attribute for the root group. + Attribute gr_flattr2 = root.createAttribute(ATTR2_FL_STR_NAME, fls_type, att_space); + + // Write data to the attribute. + gr_flattr2.write(fls_type, ATTRSTR_DATA); + + /* Test Attribute::read(...,void *buf) with FL string */ + + // Read and verify the attribute string as a string of chars. + char flstring_att_check[ATTR_LEN]; + gr_flattr1.read(fls_type, flstring_att_check); + if(HDstrcmp(flstring_att_check, ATTRSTR_DATA.c_str())!=0) + TestErrPrintf("Line %d: Attribute data different: ATTRSTR_DATA=%s,flstring_att_check=%s\n",__LINE__, ATTRSTR_DATA.c_str(), flstring_att_check); + + // Read and verify the attribute string as a string of chars; buffer + // is dynamically allocated. + size_t attr_size = gr_flattr1.getInMemDataSize(); + char *fl_dyn_string_att_check; + fl_dyn_string_att_check = new char[attr_size+1]; + gr_flattr1.read(fls_type, fl_dyn_string_att_check); + if(HDstrcmp(fl_dyn_string_att_check, ATTRSTR_DATA.c_str())!=0) + TestErrPrintf("Line %d: Attribute data different: ATTRSTR_DATA=%s,flstring_att_check=%s\n",__LINE__, ATTRSTR_DATA.c_str(), fl_dyn_string_att_check); + delete []fl_dyn_string_att_check; + + /* Test Attribute::read(...,H5std_string& strg) with FL string */ + + // Read and verify the attribute string as an std::string. + H5std_string read_flstr1; + gr_flattr1.read(fls_type, read_flstr1); + if (read_flstr1 != ATTRSTR_DATA) + TestErrPrintf("Line %d: Attribute data different: ATTRSTR_DATA=%s,read_flstr1=%s\n",__LINE__, ATTRSTR_DATA.c_str(), read_flstr1.c_str()); + + // Read and verify the attribute string as a string of chars. + HDstrcpy(flstring_att_check, ""); + gr_flattr2.read(fls_type, flstring_att_check); + if(HDstrcmp(flstring_att_check, ATTRSTR_DATA.c_str())!=0) + TestErrPrintf("Line %d: Attribute data different: ATTRSTR_DATA=%s,flstring_att_check=%s\n",__LINE__, ATTRSTR_DATA.c_str(), flstring_att_check); + + /* Test Attribute::read(...,H5std_string& strg) with FL string */ + + // Read and verify the attribute string as an std::string. + H5std_string read_flstr2; + gr_flattr2.read(fls_type, read_flstr2); + if (read_flstr2 != ATTRSTR_DATA) + TestErrPrintf("Line %d: Attribute data different: ATTRSTR_DATA=%s,read_flstr2=%s\n",__LINE__, ATTRSTR_DATA.c_str(), read_flstr2.c_str()); + + // + // Variable-lenth string attributes + // + // Create a variable length string datatype to refer to. + StrType vls_type(0, H5T_VARIABLE); + + // Create an attribute for the root group. + Attribute gr_vlattr = root.createAttribute(ATTR_VL_STR_NAME, vls_type, att_space); + + // Write data to the attribute. + gr_vlattr.write(vls_type, ATTRSTR_DATA); + + /* Test Attribute::read(...,void *buf) with Variable len string */ + // Read and verify the attribute string as a string of chars. + char *string_att_check; + gr_vlattr.read(vls_type, &string_att_check); + if(HDstrcmp(string_att_check, ATTRSTR_DATA.c_str())!=0) + TestErrPrintf("Line %d: Attribute data different: ATTRSTR_DATA=%s,string_att_check=%s\n",__LINE__, ATTRSTR_DATA.c_str(), string_att_check); + HDfree(string_att_check); + + /* Test Attribute::read(...,H5std_string& strg) with VL string */ + // Read and verify the attribute string as an std::string. + H5std_string read_str; + gr_vlattr.read(vls_type, read_str); + if (read_str != ATTRSTR_DATA) + TestErrPrintf("Line %d: Attribute data different: ATTRSTR_DATA=%s,read_str=%s\n",__LINE__, ATTRSTR_DATA.c_str(), read_str.c_str()); + PASSED(); } // end try block catch (Exception& E) { - issue_fail_msg("test_string_attr()", __LINE__, __FILE__, E.getCDetailMsg()); + issue_fail_msg("test_string_attr()", __LINE__, __FILE__, E.getCDetailMsg()); } } // test_string_attr() /**************************************************************** ** ** test_attr_exists(): Test checking for attribute existence. -** (additional attrExists tests are in test_attr_rename()) +** (additional attrExists tests are in test_attr_rename()) ** ****************************************************************/ static void test_attr_exists() @@ -1542,40 +1542,40 @@ static void test_attr_exists() SUBTEST("Check Attribute Existence"); try { - // Open file. - H5File fid1(FILE_BASIC, H5F_ACC_RDWR); + // Open file. + H5File fid1(FILE_BASIC, H5F_ACC_RDWR); - // Open the root group. - Group root = fid1.openGroup("/"); + // Open the root group. + Group root = fid1.openGroup("/"); - // Check for existence of attribute - bool attr_exists = fid1.attrExists(ATTR1_FL_STR_NAME); - if (attr_exists == false) - throw InvalidActionException("H5File::attrExists", "fid1, ATTR1_FL_STR_NAMEAttribute should exist but does not"); + // Check for existence of attribute + bool attr_exists = fid1.attrExists(ATTR1_FL_STR_NAME); + if (attr_exists == false) + throw InvalidActionException("H5File::attrExists", "fid1, ATTR1_FL_STR_NAMEAttribute should exist but does not"); - // Check for existence of attribute - attr_exists = fid1.attrExists(FATTR1_NAME); - if (attr_exists == false) - throw InvalidActionException("H5File::attrExists", "fid1,FATTR2_NAMEAttribute should exist but does not"); + // Check for existence of attribute + attr_exists = fid1.attrExists(FATTR1_NAME); + if (attr_exists == false) + throw InvalidActionException("H5File::attrExists", "fid1,FATTR2_NAMEAttribute should exist but does not"); - // Open a group. - Group group = fid1.openGroup(GROUP1_NAME); + // Open a group. + Group group = fid1.openGroup(GROUP1_NAME); - // Check for existence of attribute - attr_exists = group.attrExists(ATTR2_NAME); - if (attr_exists == false) - throw InvalidActionException("H5File::attrExists", "group, ATTR2_NAMEAttribute should exist but does not"); + // Check for existence of attribute + attr_exists = group.attrExists(ATTR2_NAME); + if (attr_exists == false) + throw InvalidActionException("H5File::attrExists", "group, ATTR2_NAMEAttribute should exist but does not"); - PASSED(); + PASSED(); } // end try block catch (InvalidActionException& E) { - issue_fail_msg("test_attr_exists()", __LINE__, __FILE__, E.getCDetailMsg()); + issue_fail_msg("test_attr_exists()", __LINE__, __FILE__, E.getCDetailMsg()); } catch (Exception& E) { - issue_fail_msg("test_attr_exists()", __LINE__, __FILE__, E.getCDetailMsg()); + issue_fail_msg("test_attr_exists()", __LINE__, __FILE__, E.getCDetailMsg()); } } // test_attr_exists() @@ -1591,100 +1591,100 @@ const unsigned MAX_COMPACT_DEF = 8; const unsigned MIN_DENSE_DEF = 6; static void test_attr_dense_create(FileCreatPropList& fcpl, - FileAccPropList& fapl) + FileAccPropList& fapl) { // Output message about test being performed SUBTEST("Dense Attribute Storage Creation"); try { - // Create file - H5File fid1 (FILE_CRTPROPS, H5F_ACC_TRUNC, fcpl, fapl); + // Create file + H5File fid1 (FILE_CRTPROPS, H5F_ACC_TRUNC, fcpl, fapl); - // Close file - fid1.close(); + // Close file + fid1.close(); - // Get size of file - h5_stat_size_t empty_filesize; // Size of empty file - empty_filesize = h5_get_file_size(FILE_CRTPROPS.c_str(), fapl.getId()); - if (empty_filesize < 0) + // Get size of file + h5_stat_size_t empty_filesize; // Size of empty file + empty_filesize = h5_get_file_size(FILE_CRTPROPS.c_str(), fapl.getId()); + if (empty_filesize < 0) TestErrPrintf("Line %d: file size wrong!\n", __LINE__); - // Re-open file - fid1.openFile(FILE_CRTPROPS, H5F_ACC_RDWR, fapl); + // Re-open file + fid1.openFile(FILE_CRTPROPS, H5F_ACC_RDWR, fapl); - // Create dataspace for dataset - DataSpace ds_space(H5S_SCALAR); + // Create dataspace for dataset + DataSpace ds_space(H5S_SCALAR); - // Create dataset creation property list. - DSetCreatPropList dcpl; + // Create dataset creation property list. + DSetCreatPropList dcpl; - // Create a dataset - DataSet dataset = fid1.createDataSet(DSET1_NAME, PredType::NATIVE_UCHAR, ds_space, dcpl); + // Create a dataset + DataSet dataset = fid1.createDataSet(DSET1_NAME, PredType::NATIVE_UCHAR, ds_space, dcpl); - unsigned max_compact = 0, min_dense = 0; + unsigned max_compact = 0, min_dense = 0; - // Retrieve limits for compact/dense attribute storage - dcpl.getAttrPhaseChange(max_compact, min_dense); - verify_val(max_compact, MAX_COMPACT_DEF, "DSetCreatPropList::getAttrPhaseChange",__LINE__,__FILE__); - verify_val(min_dense, MIN_DENSE_DEF, "DSetCreatPropList::getAttrPhaseChange",__LINE__,__FILE__); + // Retrieve limits for compact/dense attribute storage + dcpl.getAttrPhaseChange(max_compact, min_dense); + verify_val(max_compact, MAX_COMPACT_DEF, "DSetCreatPropList::getAttrPhaseChange",__LINE__,__FILE__); + verify_val(min_dense, MIN_DENSE_DEF, "DSetCreatPropList::getAttrPhaseChange",__LINE__,__FILE__); - // Set new compact/dense attribute storage limits to some random numbers - dcpl.setAttrPhaseChange(7, 5); + // Set new compact/dense attribute storage limits to some random numbers + dcpl.setAttrPhaseChange(7, 5); - // Retrieve limits for compact/dense attribute storage and verify them - dcpl.getAttrPhaseChange(max_compact, min_dense); - verify_val(max_compact, static_cast(7), "DSetCreatPropList::getAttrPhaseChange",__LINE__,__FILE__); - verify_val(min_dense, static_cast(5), "DSetCreatPropList::getAttrPhaseChange",__LINE__,__FILE__); + // Retrieve limits for compact/dense attribute storage and verify them + dcpl.getAttrPhaseChange(max_compact, min_dense); + verify_val(max_compact, static_cast(7), "DSetCreatPropList::getAttrPhaseChange",__LINE__,__FILE__); + verify_val(min_dense, static_cast(5), "DSetCreatPropList::getAttrPhaseChange",__LINE__,__FILE__); - // Close property list - dcpl.close(); + // Close property list + dcpl.close(); - // H5O_is_attr_dense_test - un-usable + // H5O_is_attr_dense_test - un-usable - // Add attributes, until just before converting to dense storage - char attr_name[NAME_BUF_SIZE]; - unsigned attr_num; - for (attr_num = 0; attr_num < max_compact; attr_num++) - { - // Create attribute - sprintf(attr_name, "attr %02u", attr_num); - Attribute attr = dataset.createAttribute(attr_name, PredType::NATIVE_UINT, ds_space); + // Add attributes, until just before converting to dense storage + char attr_name[NAME_BUF_SIZE]; + unsigned attr_num; + for (attr_num = 0; attr_num < max_compact; attr_num++) + { + // Create attribute + sprintf(attr_name, "attr %02u", attr_num); + Attribute attr = dataset.createAttribute(attr_name, PredType::NATIVE_UINT, ds_space); - // Write data to the attribute - attr.write(PredType::NATIVE_UINT, &attr_num); - } // end for + // Write data to the attribute + attr.write(PredType::NATIVE_UINT, &attr_num); + } // end for - // H5O_is_attr_dense_test - un-usable + // H5O_is_attr_dense_test - un-usable - { // Add one more attribute, to push into "dense" storage + { // Add one more attribute, to push into "dense" storage - // Create another attribute - sprintf(attr_name, "attr %02u", attr_num); - Attribute attr = dataset.createAttribute(attr_name, PredType::NATIVE_UINT, ds_space); + // Create another attribute + sprintf(attr_name, "attr %02u", attr_num); + Attribute attr = dataset.createAttribute(attr_name, PredType::NATIVE_UINT, ds_space); - // Write data to the attribute - attr.write(PredType::NATIVE_UINT, &attr_num); - } + // Write data to the attribute + attr.write(PredType::NATIVE_UINT, &attr_num); + } - // Attempt to add attribute again, which should fail - try - { - // Create another attribute - sprintf(attr_name, "attr %02u", attr_num); - Attribute attr = dataset.createAttribute(attr_name, PredType::NATIVE_UINT, ds_space); + // Attempt to add attribute again, which should fail + try + { + // Create another attribute + sprintf(attr_name, "attr %02u", attr_num); + Attribute attr = dataset.createAttribute(attr_name, PredType::NATIVE_UINT, ds_space); - // continuation here, that means no exception has been thrown - throw InvalidActionException("DataSet::createAttribute", "Maximum number of attributes has been reached"); - } - catch (AttributeIException& E) // catching invalid action + // continuation here, that means no exception has been thrown + throw InvalidActionException("DataSet::createAttribute", "Maximum number of attributes has been reached"); + } + catch (AttributeIException& E) // catching invalid action {} // do nothing, exception expected - PASSED(); + PASSED(); } // end try block catch (Exception& E) { - issue_fail_msg("test_attr_dense_create()", __LINE__, __FILE__, E.getCDetailMsg()); + issue_fail_msg("test_attr_dense_create()", __LINE__, __FILE__, E.getCDetailMsg()); } } // test_attr_dense_create() @@ -1695,81 +1695,81 @@ static void test_attr_dense_create(FileCreatPropList& fcpl, ** ****************************************************************/ static void test_attr_corder_create_basic(FileCreatPropList& fcpl, - FileAccPropList& fapl) + FileAccPropList& fapl) { // Output message about test being performed SUBTEST("Basic Code for Attributes with Creation Order Info"); try { - // Create file - H5File fid1 (FILE_CRTPROPS, H5F_ACC_TRUNC, fcpl, fapl); - - // Create dataset creation property list. - DSetCreatPropList dcpl; - - // Get creation order indexing on object - unsigned crt_order_flags = 0; - crt_order_flags = dcpl.getAttrCrtOrder(); - verify_val(crt_order_flags, (unsigned)0, "DSetCreatPropList::getAttrCrtOrder",__LINE__,__FILE__); - - // Setting invalid combination of a attribute order creation order - // indexing on should fail - try { - dcpl.setAttrCrtOrder(H5P_CRT_ORDER_INDEXED); - - // continuation here, that means no exception has been thrown - throw InvalidActionException("DSetCreatPropList::getAttrCrtOrder", "Indexing cannot be set alone, order tracking is required"); - } - catch (PropListIException& E) // catching invalid action + // Create file + H5File fid1 (FILE_CRTPROPS, H5F_ACC_TRUNC, fcpl, fapl); + + // Create dataset creation property list. + DSetCreatPropList dcpl; + + // Get creation order indexing on object + unsigned crt_order_flags = 0; + crt_order_flags = dcpl.getAttrCrtOrder(); + verify_val(crt_order_flags, (unsigned)0, "DSetCreatPropList::getAttrCrtOrder",__LINE__,__FILE__); + + // Setting invalid combination of a attribute order creation order + // indexing on should fail + try { + dcpl.setAttrCrtOrder(H5P_CRT_ORDER_INDEXED); + + // continuation here, that means no exception has been thrown + throw InvalidActionException("DSetCreatPropList::getAttrCrtOrder", "Indexing cannot be set alone, order tracking is required"); + } + catch (PropListIException& E) // catching invalid action {} // do nothing, exception expected - // Set attribute creation order tracking & indexing for object then - // verify them - dcpl.setAttrCrtOrder(H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED); - crt_order_flags = dcpl.getAttrCrtOrder(); - verify_val(crt_order_flags, (unsigned)(H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED), "DSetCreatPropList::getAttrCrtOrder",__LINE__,__FILE__); + // Set attribute creation order tracking & indexing for object then + // verify them + dcpl.setAttrCrtOrder(H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED); + crt_order_flags = dcpl.getAttrCrtOrder(); + verify_val(crt_order_flags, (unsigned)(H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED), "DSetCreatPropList::getAttrCrtOrder",__LINE__,__FILE__); - // Create dataspace for dataset - DataSpace ds_space(H5S_SCALAR); + // Create dataspace for dataset + DataSpace ds_space(H5S_SCALAR); - // Create a dataset - DataSet dataset = fid1.createDataSet(DSET1_NAME, PredType::NATIVE_UCHAR, ds_space, dcpl); + // Create a dataset + DataSet dataset = fid1.createDataSet(DSET1_NAME, PredType::NATIVE_UCHAR, ds_space, dcpl); - // Close dataspace - ds_space.close(); + // Close dataspace + ds_space.close(); - // Check on dataset's attribute storage status. - // NOTE: Wrappers not available yet (H5O_is_attr_empty_test - // and H5O_is_attr_dense_test) + // Check on dataset's attribute storage status. + // NOTE: Wrappers not available yet (H5O_is_attr_empty_test + // and H5O_is_attr_dense_test) - // Close dataset - dataset.close(); + // Close dataset + dataset.close(); - // Close property list - dcpl.close(); + // Close property list + dcpl.close(); - // Close file - fid1.close(); + // Close file + fid1.close(); - // Re-open file - fid1.openFile(FILE_CRTPROPS, H5F_ACC_RDWR, fapl); + // Re-open file + fid1.openFile(FILE_CRTPROPS, H5F_ACC_RDWR, fapl); - // Open dataset created previously - dataset = fid1.openDataSet(DSET1_NAME); + // Open dataset created previously + dataset = fid1.openDataSet(DSET1_NAME); - // Retrieve dataset creation property list for the dataset - dcpl = dataset.getCreatePlist(); + // Retrieve dataset creation property list for the dataset + dcpl = dataset.getCreatePlist(); - // Query the attribute creation properties - crt_order_flags = dcpl.getAttrCrtOrder(); - verify_val(crt_order_flags, (unsigned)(H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED), "DSetCreatPropList::getAttrCrtOrder",__LINE__,__FILE__); + // Query the attribute creation properties + crt_order_flags = dcpl.getAttrCrtOrder(); + verify_val(crt_order_flags, (unsigned)(H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED), "DSetCreatPropList::getAttrCrtOrder",__LINE__,__FILE__); - PASSED(); + PASSED(); } // end try block catch (Exception& E) { - issue_fail_msg("test_attr_corder_create_basic()", __LINE__, __FILE__, E.getCDetailMsg()); + issue_fail_msg("test_attr_corder_create_basic()", __LINE__, __FILE__, E.getCDetailMsg()); } } // test_attr_corder_create_basic() @@ -1814,42 +1814,42 @@ void test_attr() // Set the file access proplist for the type of format if (new_format) { - MESSAGE(7, ("testing with new file format\n")); - curr_fapl = fapl_new; + MESSAGE(7, ("testing with new file format\n")); + curr_fapl = fapl_new; } else { - MESSAGE(7, ("testing with old file format\n")); - curr_fapl = fapl; + MESSAGE(7, ("testing with old file format\n")); + curr_fapl = fapl; } - test_attr_basic_write(); // Test basic H5A writing code - test_attr_getname(); // Test overloads of Attribute::getName - test_attr_rename(); // Test renaming attribute - test_attr_basic_read(); // Test basic H5A reading code + test_attr_basic_write(); // Test basic H5A writing code + test_attr_getname(); // Test overloads of Attribute::getName + test_attr_rename(); // Test renaming attribute + test_attr_basic_read(); // Test basic H5A reading code - test_attr_compound_write(); // Test complex datatype H5A writing code - test_attr_compound_read(); // Test complex datatype H5A reading code + test_attr_compound_write(); // Test complex datatype H5A writing code + test_attr_compound_read(); // Test complex datatype H5A reading code - test_attr_scalar_write(); // Test scalar dataspace H5A writing code - test_attr_scalar_read(); // Test scalar dataspace H5A reading code + test_attr_scalar_write(); // Test scalar dataspace H5A writing code + test_attr_scalar_read(); // Test scalar dataspace H5A reading code - test_attr_mult_write(); // Test writing multiple attributes - test_attr_mult_read(); // Test reading multiple attributes - test_attr_delete(); // Test deleting attributes + test_attr_mult_write(); // Test writing multiple attributes + test_attr_mult_read(); // Test reading multiple attributes + test_attr_delete(); // Test deleting attributes - test_attr_dtype_shared(); // Test using shared datatypes in attributes + test_attr_dtype_shared(); // Test using shared datatypes in attributes - test_string_attr(); // Test read/write string attribute - test_attr_exists(); // Test H5Location::attrExists + test_string_attr(); // Test read/write string attribute + test_attr_exists(); // Test H5Location::attrExists // Test with new format if (new_format) { - // Test dense attribute storage creation + // Test dense attribute storage creation test_attr_dense_create(fcpl, curr_fapl); - // Test create objects with attribute creation info + // Test create objects with attribute creation info test_attr_corder_create_basic(fcpl, curr_fapl); } } // end for @@ -1857,18 +1857,18 @@ void test_attr() catch (Exception& E) { - issue_fail_msg("test_attr()", __LINE__, __FILE__, E.getCDetailMsg()); + issue_fail_msg("test_attr()", __LINE__, __FILE__, E.getCDetailMsg()); } } // test_attr() /*------------------------------------------------------------------------- - * Function: cleanup_attr + * Function cleanup_attr * - * Purpose: Cleanup temporary test files + * Purpose Cleanup temporary test files * - * Return: none + * Return none * - * Programmer: Albert Cheng + * Programmer Albert Cheng * July 2, 1998 * * Modifications: diff --git a/c++/test/tcompound.cpp b/c++/test/tcompound.cpp index f49ebb2..ee634c2 100644 --- a/c++/test/tcompound.cpp +++ b/c++/test/tcompound.cpp @@ -34,7 +34,7 @@ using namespace H5; #include "h5cpputil.h" // C++ utilility header file /* Number of elements in each test */ -#define NTESTELEM 100000 +#define NTESTELEM 100000 typedef struct complex_t { double re; @@ -45,11 +45,11 @@ typedef struct complex_t { /*------------------------------------------------------------------------- * Function: test_compound_1 * - * Purpose: Tests various things about compound data types. + * Purpose Tests various things about compound data types. * - * Return: None + * Return None * - * Programmer: Binh-Minh Ribler (using C version) + * Programmer Binh-Minh Ribler (using C version) * January, 2007 * * Modifications: @@ -61,13 +61,13 @@ static void test_compound_1() // Output message about test being performed SUBTEST("Compound Data Types"); try { - // Create an empty compound datatype - CompType complex_type(sizeof(complex_t)); + // Create an empty compound datatype + CompType complex_type(sizeof(complex_t)); - // Add a couple of fields - complex_type.insertMember("real", HOFFSET(complex_t, re), PredType::NATIVE_DOUBLE); - complex_type.insertMember("imaginary", HOFFSET(complex_t, im), PredType::NATIVE_DOUBLE); - PASSED(); + // Add a couple of fields + complex_type.insertMember("real", HOFFSET(complex_t, re), PredType::NATIVE_DOUBLE); + complex_type.insertMember("imaginary", HOFFSET(complex_t, im), PredType::NATIVE_DOUBLE); + PASSED(); } // end of try block catch (Exception& E) @@ -78,15 +78,15 @@ static void test_compound_1() /*------------------------------------------------------------------------- - * Function: test_compound_2 + * Function: test_compound_2 * - * Purpose: Tests a compound type conversion where the source and - * destination are the same except for the order of the - * elements. + * Purpose Tests a compound type conversion where the source and + * destination are the same except for the order of the + * elements. * - * Return: None + * Return None * - * Programmer: Binh-Minh Ribler (use C version) + * Programmer Binh-Minh Ribler (use C version) * January, 2007 * * Modifications: @@ -96,100 +96,100 @@ static void test_compound_1() static void test_compound_2() { typedef struct { - int a, b, c[4], d, e; + int a, b, c[4], d, e; } src_typ_t; typedef struct { - int e, d, c[4], b, a; + int e, d, c[4], b, a; } dst_typ_t; - src_typ_t *s_ptr; - dst_typ_t *d_ptr; - const int nelmts = NTESTELEM; + src_typ_t *s_ptr; + dst_typ_t *d_ptr; + const int nelmts = NTESTELEM; const hsize_t four = 4; - int i; + int i; unsigned char *buf = NULL, *orig = NULL, *bkg = NULL; ArrayType *array_dt = NULL; // Output message about test being performed SUBTEST("Compound Element Reordering"); try { - // Sizes should be the same, but be careful just in case - buf = (unsigned char*)HDmalloc(nelmts * MAX(sizeof(src_typ_t), sizeof(dst_typ_t))); - bkg = (unsigned char*)HDmalloc(nelmts * sizeof(dst_typ_t)); - orig = (unsigned char*)HDmalloc(nelmts * sizeof(src_typ_t)); - for (i=0; ia = i*8+0; - s_ptr->b = i*8+1; - s_ptr->c[0] = i*8+2; - s_ptr->c[1] = i*8+3; - s_ptr->c[2] = i*8+4; - s_ptr->c[3] = i*8+5; - s_ptr->d = i*8+6; - s_ptr->e = i*8+7; - } - memcpy(buf, orig, nelmts*sizeof(src_typ_t)); - - // Build hdf5 datatypes - array_dt = new ArrayType(PredType::NATIVE_INT, 1, &four); - - // Create an empty compound datatype - CompType st(sizeof(src_typ_t)); - st.insertMember("a", HOFFSET(src_typ_t, a), PredType::NATIVE_INT); - st.insertMember("b", HOFFSET(src_typ_t, b), PredType::NATIVE_INT); - st.insertMember("c", HOFFSET(src_typ_t, c), *array_dt); - st.insertMember("d", HOFFSET(src_typ_t, d), PredType::NATIVE_INT); - st.insertMember("e", HOFFSET(src_typ_t, e), PredType::NATIVE_INT); - array_dt->close(); + // Sizes should be the same, but be careful just in case + buf = (unsigned char*)HDmalloc(nelmts * MAX(sizeof(src_typ_t), sizeof(dst_typ_t))); + bkg = (unsigned char*)HDmalloc(nelmts * sizeof(dst_typ_t)); + orig = (unsigned char*)HDmalloc(nelmts * sizeof(src_typ_t)); + for (i=0; ia = i*8+0; + s_ptr->b = i*8+1; + s_ptr->c[0] = i*8+2; + s_ptr->c[1] = i*8+3; + s_ptr->c[2] = i*8+4; + s_ptr->c[3] = i*8+5; + s_ptr->d = i*8+6; + s_ptr->e = i*8+7; + } + memcpy(buf, orig, nelmts*sizeof(src_typ_t)); + + // Build hdf5 datatypes + array_dt = new ArrayType(PredType::NATIVE_INT, 1, &four); + + // Create an empty compound datatype + CompType st(sizeof(src_typ_t)); + st.insertMember("a", HOFFSET(src_typ_t, a), PredType::NATIVE_INT); + st.insertMember("b", HOFFSET(src_typ_t, b), PredType::NATIVE_INT); + st.insertMember("c", HOFFSET(src_typ_t, c), *array_dt); + st.insertMember("d", HOFFSET(src_typ_t, d), PredType::NATIVE_INT); + st.insertMember("e", HOFFSET(src_typ_t, e), PredType::NATIVE_INT); + array_dt->close(); delete array_dt; - array_dt = new ArrayType(PredType::NATIVE_INT, 1, &four); - - // Create an empty compound datatype - CompType dt(sizeof(dst_typ_t)); - dt.insertMember("a", HOFFSET(dst_typ_t, a), PredType::NATIVE_INT); - dt.insertMember("b", HOFFSET(dst_typ_t, b), PredType::NATIVE_INT); - dt.insertMember("c", HOFFSET(dst_typ_t, c), *array_dt); - dt.insertMember("d", HOFFSET(dst_typ_t, d), PredType::NATIVE_INT); - dt.insertMember("e", HOFFSET(dst_typ_t, e), PredType::NATIVE_INT); - array_dt->close(); - - // Perform the conversion - st.convert(dt, (size_t)nelmts, buf, bkg); - - // Compare results - for (i=0; ia != d_ptr->a || - s_ptr->b != d_ptr->b || - s_ptr->c[0] != d_ptr->c[0] || - s_ptr->c[1] != d_ptr->c[1] || - s_ptr->c[2] != d_ptr->c[2] || - s_ptr->c[3] != d_ptr->c[3] || - s_ptr->d != d_ptr->d || - s_ptr->e != d_ptr->e) { - H5_FAILED(); - cerr << " i=" << i << endl; - cerr << " src={a=" << s_ptr->a << ", b=" << s_ptr->b - << "c=[" << s_ptr->c[0] << "," << s_ptr->c[1] << "," - << s_ptr->c[2] << "," << s_ptr->c[3] << ", d=" - << s_ptr->d << ", e=" << s_ptr->e << "}" << endl; - cerr << " dst={a=" << s_ptr->a << ", b=" << s_ptr->b - << "c=[" << s_ptr->c[0] << "," << s_ptr->c[1] << "," - << s_ptr->c[2] << "," << s_ptr->c[3] << ", d=" - << s_ptr->d << ", e=" << s_ptr->e << "}" << endl; - } - } - // Release resources - HDfree(buf); - HDfree(bkg); - HDfree(orig); - s_ptr = NULL; - d_ptr = NULL; - st.close(); - dt.close(); - PASSED(); + array_dt = new ArrayType(PredType::NATIVE_INT, 1, &four); + + // Create an empty compound datatype + CompType dt(sizeof(dst_typ_t)); + dt.insertMember("a", HOFFSET(dst_typ_t, a), PredType::NATIVE_INT); + dt.insertMember("b", HOFFSET(dst_typ_t, b), PredType::NATIVE_INT); + dt.insertMember("c", HOFFSET(dst_typ_t, c), *array_dt); + dt.insertMember("d", HOFFSET(dst_typ_t, d), PredType::NATIVE_INT); + dt.insertMember("e", HOFFSET(dst_typ_t, e), PredType::NATIVE_INT); + array_dt->close(); + + // Perform the conversion + st.convert(dt, (size_t)nelmts, buf, bkg); + + // Compare results + for (i=0; ia != d_ptr->a || + s_ptr->b != d_ptr->b || + s_ptr->c[0] != d_ptr->c[0] || + s_ptr->c[1] != d_ptr->c[1] || + s_ptr->c[2] != d_ptr->c[2] || + s_ptr->c[3] != d_ptr->c[3] || + s_ptr->d != d_ptr->d || + s_ptr->e != d_ptr->e) { + H5_FAILED(); + cerr << " i=" << i << endl; + cerr << " src={a=" << s_ptr->a << ", b=" << s_ptr->b + << "c=[" << s_ptr->c[0] << "," << s_ptr->c[1] << "," + << s_ptr->c[2] << "," << s_ptr->c[3] << ", d=" + << s_ptr->d << ", e=" << s_ptr->e << "}" << endl; + cerr << " dst={a=" << s_ptr->a << ", b=" << s_ptr->b + << "c=[" << s_ptr->c[0] << "," << s_ptr->c[1] << "," + << s_ptr->c[2] << "," << s_ptr->c[3] << ", d=" + << s_ptr->d << ", e=" << s_ptr->e << "}" << endl; + } + } + // Release resources + HDfree(buf); + HDfree(bkg); + HDfree(orig); + s_ptr = NULL; + d_ptr = NULL; + st.close(); + dt.close(); + PASSED(); } // end of try block catch (Exception& E) @@ -203,15 +203,15 @@ static void test_compound_2() /*------------------------------------------------------------------------- - * Function: test_compound_3 + * Function: test_compound_3 * - * Purpose: Tests compound conversions where the source and destination - * are the same except the destination is missing a couple - * members which appear in the source. + * Purpose Tests compound conversions where the source and destination + * are the same except the destination is missing a couple + * members which appear in the source. * - * Return: None + * Return None * - * Programmer: Binh-Minh Ribler (use C version) + * Programmer Binh-Minh Ribler (use C version) * January, 2007 * * Modifications: @@ -221,16 +221,16 @@ static void test_compound_2() static void test_compound_3() { typedef struct { - int a, b, c[4], d, e; + int a, b, c[4], d, e; } src_typ_t; typedef struct { - int a, c[4], e; + int a, c[4], e; } dst_typ_t; - src_typ_t *s_ptr; - dst_typ_t *d_ptr; - int i; - const int nelmts = NTESTELEM; + src_typ_t *s_ptr; + dst_typ_t *d_ptr; + int i; + const int nelmts = NTESTELEM; const hsize_t four = 4; unsigned char *buf = NULL, *orig = NULL, *bkg = NULL; ArrayType* array_dt = NULL; @@ -238,85 +238,85 @@ static void test_compound_3() // Output message about test being performed SUBTEST("Compound Datatype Subset Conversions"); try { - /* Initialize */ - buf = (unsigned char*)HDmalloc(nelmts * MAX(sizeof(src_typ_t), sizeof(dst_typ_t))); - bkg = (unsigned char*)HDmalloc(nelmts * sizeof(dst_typ_t)); - orig = (unsigned char*)HDmalloc(nelmts * sizeof(src_typ_t)); - for (i=0; ia = i*8+0; - s_ptr->b = i*8+1; - s_ptr->c[0] = i*8+2; - s_ptr->c[1] = i*8+3; - s_ptr->c[2] = i*8+4; - s_ptr->c[3] = i*8+5; - s_ptr->d = i*8+6; - s_ptr->e = i*8+7; - } - memcpy(buf, orig, nelmts*sizeof(src_typ_t)); - - /* Build hdf5 datatypes */ - array_dt = new ArrayType(PredType::NATIVE_INT, 1, &four); - - // Create an empty compound datatype - CompType st(sizeof(src_typ_t)); - st.insertMember("a", HOFFSET(src_typ_t, a), PredType::NATIVE_INT); - st.insertMember("b", HOFFSET(src_typ_t, b), PredType::NATIVE_INT); - st.insertMember("c", HOFFSET(src_typ_t, c), *array_dt); - st.insertMember("d", HOFFSET(src_typ_t, d), PredType::NATIVE_INT); - st.insertMember("e", HOFFSET(src_typ_t, e), PredType::NATIVE_INT); - array_dt->close(); + /* Initialize */ + buf = (unsigned char*)HDmalloc(nelmts * MAX(sizeof(src_typ_t), sizeof(dst_typ_t))); + bkg = (unsigned char*)HDmalloc(nelmts * sizeof(dst_typ_t)); + orig = (unsigned char*)HDmalloc(nelmts * sizeof(src_typ_t)); + for (i=0; ia = i*8+0; + s_ptr->b = i*8+1; + s_ptr->c[0] = i*8+2; + s_ptr->c[1] = i*8+3; + s_ptr->c[2] = i*8+4; + s_ptr->c[3] = i*8+5; + s_ptr->d = i*8+6; + s_ptr->e = i*8+7; + } + memcpy(buf, orig, nelmts*sizeof(src_typ_t)); + + /* Build hdf5 datatypes */ + array_dt = new ArrayType(PredType::NATIVE_INT, 1, &four); + + // Create an empty compound datatype + CompType st(sizeof(src_typ_t)); + st.insertMember("a", HOFFSET(src_typ_t, a), PredType::NATIVE_INT); + st.insertMember("b", HOFFSET(src_typ_t, b), PredType::NATIVE_INT); + st.insertMember("c", HOFFSET(src_typ_t, c), *array_dt); + st.insertMember("d", HOFFSET(src_typ_t, d), PredType::NATIVE_INT); + st.insertMember("e", HOFFSET(src_typ_t, e), PredType::NATIVE_INT); + array_dt->close(); delete array_dt; - array_dt = new ArrayType(PredType::NATIVE_INT, 1, &four); - - // Create an empty compound datatype - CompType dt(sizeof(dst_typ_t)); - dt.insertMember("a", HOFFSET(dst_typ_t, a), PredType::NATIVE_INT); - dt.insertMember("c", HOFFSET(dst_typ_t, c), *array_dt); - dt.insertMember("e", HOFFSET(dst_typ_t, e), PredType::NATIVE_INT); - array_dt->close(); - - /* Perform the conversion */ - st.convert(dt, (size_t)nelmts, buf, bkg); - - /* Compare results */ - for (i=0; ia != d_ptr->a || - s_ptr->c[0] != d_ptr->c[0] || - s_ptr->c[1] != d_ptr->c[1] || - s_ptr->c[2] != d_ptr->c[2] || - s_ptr->c[3] != d_ptr->c[3] || - s_ptr->e != d_ptr->e) { - H5_FAILED(); - cerr << " i=" << i << endl; - cerr << " src={a=" << s_ptr->a << ", b=" << s_ptr->b - << ", c=[" << s_ptr->c[0] << "," << s_ptr->c[1] << "," - << s_ptr->c[2] << "," << s_ptr->c[3] << "], d=" - << s_ptr->d << ", e=" << s_ptr->e << "}" << endl; - cerr << " dst={a=" << d_ptr->a - << ", c=[" << d_ptr->c[0] << "," << d_ptr->c[1] << "," - << d_ptr->c[2] << "," << d_ptr->c[3] << "], e=" - << d_ptr->e << "}" << endl; - } // if - } // for - - /* Release resources */ - HDfree(buf); - HDfree(bkg); - HDfree(orig); - s_ptr = NULL; - d_ptr = NULL; - st.close(); - dt.close(); - PASSED(); + array_dt = new ArrayType(PredType::NATIVE_INT, 1, &four); + + // Create an empty compound datatype + CompType dt(sizeof(dst_typ_t)); + dt.insertMember("a", HOFFSET(dst_typ_t, a), PredType::NATIVE_INT); + dt.insertMember("c", HOFFSET(dst_typ_t, c), *array_dt); + dt.insertMember("e", HOFFSET(dst_typ_t, e), PredType::NATIVE_INT); + array_dt->close(); + + /* Perform the conversion */ + st.convert(dt, (size_t)nelmts, buf, bkg); + + /* Compare results */ + for (i=0; ia != d_ptr->a || + s_ptr->c[0] != d_ptr->c[0] || + s_ptr->c[1] != d_ptr->c[1] || + s_ptr->c[2] != d_ptr->c[2] || + s_ptr->c[3] != d_ptr->c[3] || + s_ptr->e != d_ptr->e) { + H5_FAILED(); + cerr << " i=" << i << endl; + cerr << " src={a=" << s_ptr->a << ", b=" << s_ptr->b + << ", c=[" << s_ptr->c[0] << "," << s_ptr->c[1] << "," + << s_ptr->c[2] << "," << s_ptr->c[3] << "], d=" + << s_ptr->d << ", e=" << s_ptr->e << "}" << endl; + cerr << " dst={a=" << d_ptr->a + << ", c=[" << d_ptr->c[0] << "," << d_ptr->c[1] << "," + << d_ptr->c[2] << "," << d_ptr->c[3] << "], e=" + << d_ptr->e << "}" << endl; + } // if + } // for + + /* Release resources */ + HDfree(buf); + HDfree(bkg); + HDfree(orig); + s_ptr = NULL; + d_ptr = NULL; + st.close(); + dt.close(); + PASSED(); } // end of try block catch (Exception& E) { - issue_fail_msg(E.getCFuncName(), __LINE__, __FILE__, E.getCDetailMsg()); + issue_fail_msg(E.getCFuncName(), __LINE__, __FILE__, E.getCDetailMsg()); } if(array_dt) @@ -325,16 +325,16 @@ static void test_compound_3() /*------------------------------------------------------------------------- - * Function: test_compound_4 + * Function: test_compound_4 * - * Purpose: Tests compound conversions when the destination has the same - * fields as the source but one or more of the fields are - * smaller. + * Purpose Tests compound conversions when the destination has the same + * fields as the source but one or more of the fields are + * smaller. * - * Return: None + * Return None * - * Programmer: Binh-Minh Ribler (use C version) - * January, 2007 + * Programmer Binh-Minh Ribler (use C version) + * January, 2007 * * Modifications: * @@ -344,20 +344,20 @@ static void test_compound_4() { typedef struct { - int a, b, c[4], d, e; + int a, b, c[4], d, e; } src_typ_t; typedef struct { - short b; - int a, c[4]; - short d; - int e; + short b; + int a, c[4]; + short d; + int e; } dst_typ_t; - src_typ_t *s_ptr; - dst_typ_t *d_ptr; - int i; - const int nelmts = NTESTELEM; + src_typ_t *s_ptr; + dst_typ_t *d_ptr; + int i; + const int nelmts = NTESTELEM; const hsize_t four = 4; unsigned char *buf = NULL, *orig = NULL, *bkg = NULL; ArrayType* array_dt = NULL; @@ -365,85 +365,85 @@ static void test_compound_4() // Output message about test being performed SUBTEST("Compound Element Shrinking & Reordering"); try { - /* Sizes should be the same, but be careful just in case */ - buf = (unsigned char*)HDmalloc(nelmts * MAX(sizeof(src_typ_t), sizeof(dst_typ_t))); - bkg = (unsigned char*)HDmalloc(nelmts * sizeof(dst_typ_t)); - orig = (unsigned char*)HDmalloc(nelmts * sizeof(src_typ_t)); - for (i=0; ia = i*8+0; - s_ptr->b = (i*8+1) & 0x7fff; - s_ptr->c[0] = i*8+2; - s_ptr->c[1] = i*8+3; - s_ptr->c[2] = i*8+4; - s_ptr->c[3] = i*8+5; - s_ptr->d = (i*8+6) & 0x7fff; - s_ptr->e = i*8+7; - } - memcpy(buf, orig, nelmts*sizeof(src_typ_t)); - - /* Build hdf5 datatypes */ - array_dt = new ArrayType(PredType::NATIVE_INT, 1, &four); - - // Create an empty compound datatype - CompType st(sizeof(src_typ_t)); - st.insertMember("a", HOFFSET(src_typ_t, a), PredType::NATIVE_INT); - st.insertMember("b", HOFFSET(src_typ_t, b), PredType::NATIVE_INT); - st.insertMember("c", HOFFSET(src_typ_t, c), *array_dt); - st.insertMember("d", HOFFSET(src_typ_t, d), PredType::NATIVE_INT); - st.insertMember("e", HOFFSET(src_typ_t, e), PredType::NATIVE_INT); - array_dt->close(); + /* Sizes should be the same, but be careful just in case */ + buf = (unsigned char*)HDmalloc(nelmts * MAX(sizeof(src_typ_t), sizeof(dst_typ_t))); + bkg = (unsigned char*)HDmalloc(nelmts * sizeof(dst_typ_t)); + orig = (unsigned char*)HDmalloc(nelmts * sizeof(src_typ_t)); + for (i=0; ia = i*8+0; + s_ptr->b = (i*8+1) & 0x7fff; + s_ptr->c[0] = i*8+2; + s_ptr->c[1] = i*8+3; + s_ptr->c[2] = i*8+4; + s_ptr->c[3] = i*8+5; + s_ptr->d = (i*8+6) & 0x7fff; + s_ptr->e = i*8+7; + } + memcpy(buf, orig, nelmts*sizeof(src_typ_t)); + + /* Build hdf5 datatypes */ + array_dt = new ArrayType(PredType::NATIVE_INT, 1, &four); + + // Create an empty compound datatype + CompType st(sizeof(src_typ_t)); + st.insertMember("a", HOFFSET(src_typ_t, a), PredType::NATIVE_INT); + st.insertMember("b", HOFFSET(src_typ_t, b), PredType::NATIVE_INT); + st.insertMember("c", HOFFSET(src_typ_t, c), *array_dt); + st.insertMember("d", HOFFSET(src_typ_t, d), PredType::NATIVE_INT); + st.insertMember("e", HOFFSET(src_typ_t, e), PredType::NATIVE_INT); + array_dt->close(); delete array_dt; - array_dt = new ArrayType(PredType::NATIVE_INT, 1, &four); - - // Create an empty compound datatype - CompType dt(sizeof(dst_typ_t)); - dt.insertMember("a", HOFFSET(dst_typ_t, a), PredType::NATIVE_INT); - dt.insertMember("b", HOFFSET(dst_typ_t, b), PredType::NATIVE_SHORT); - dt.insertMember("c", HOFFSET(dst_typ_t, c), *array_dt); - dt.insertMember("d", HOFFSET(dst_typ_t, d), PredType::NATIVE_SHORT); - dt.insertMember("e", HOFFSET(dst_typ_t, e), PredType::NATIVE_INT); - array_dt->close(); - - /* Perform the conversion */ - st.convert(dt, (size_t)nelmts, buf, bkg); - - /* Compare results */ - for (i=0; ia != d_ptr->a || - s_ptr->b != d_ptr->b || - s_ptr->c[0] != d_ptr->c[0] || - s_ptr->c[1] != d_ptr->c[1] || - s_ptr->c[2] != d_ptr->c[2] || - s_ptr->c[3] != d_ptr->c[3] || - s_ptr->d != d_ptr->d || - s_ptr->e != d_ptr->e) - { - H5_FAILED(); - cerr << " i=" << i << endl; - cerr << " src={a=" << s_ptr->a << ", b=" << s_ptr->b - << "c=[" << s_ptr->c[0] << "," << s_ptr->c[1] << "," - << s_ptr->c[2] << "," << s_ptr->c[3] << ", d=" - << s_ptr->d << ", e=" << s_ptr->e << "}" << endl; - cerr << " dst={a=" << d_ptr->a << ", b=" << d_ptr->b - << "c=[" << d_ptr->c[0] << "," << d_ptr->c[1] << "," - << d_ptr->c[2] << "," << d_ptr->c[3] << ", d=" - << d_ptr->d << ", e=" << d_ptr->e << "}" << endl; - } // if - } // for - - /* Release resources */ - HDfree(buf); - HDfree(bkg); - HDfree(orig); - s_ptr = NULL; - d_ptr = NULL; - st.close(); - dt.close(); - PASSED(); + array_dt = new ArrayType(PredType::NATIVE_INT, 1, &four); + + // Create an empty compound datatype + CompType dt(sizeof(dst_typ_t)); + dt.insertMember("a", HOFFSET(dst_typ_t, a), PredType::NATIVE_INT); + dt.insertMember("b", HOFFSET(dst_typ_t, b), PredType::NATIVE_SHORT); + dt.insertMember("c", HOFFSET(dst_typ_t, c), *array_dt); + dt.insertMember("d", HOFFSET(dst_typ_t, d), PredType::NATIVE_SHORT); + dt.insertMember("e", HOFFSET(dst_typ_t, e), PredType::NATIVE_INT); + array_dt->close(); + + /* Perform the conversion */ + st.convert(dt, (size_t)nelmts, buf, bkg); + + /* Compare results */ + for (i=0; ia != d_ptr->a || + s_ptr->b != d_ptr->b || + s_ptr->c[0] != d_ptr->c[0] || + s_ptr->c[1] != d_ptr->c[1] || + s_ptr->c[2] != d_ptr->c[2] || + s_ptr->c[3] != d_ptr->c[3] || + s_ptr->d != d_ptr->d || + s_ptr->e != d_ptr->e) + { + H5_FAILED(); + cerr << " i=" << i << endl; + cerr << " src={a=" << s_ptr->a << ", b=" << s_ptr->b + << "c=[" << s_ptr->c[0] << "," << s_ptr->c[1] << "," + << s_ptr->c[2] << "," << s_ptr->c[3] << ", d=" + << s_ptr->d << ", e=" << s_ptr->e << "}" << endl; + cerr << " dst={a=" << d_ptr->a << ", b=" << d_ptr->b + << "c=[" << d_ptr->c[0] << "," << d_ptr->c[1] << "," + << d_ptr->c[2] << "," << d_ptr->c[3] << ", d=" + << d_ptr->d << ", e=" << d_ptr->e << "}" << endl; + } // if + } // for + + /* Release resources */ + HDfree(buf); + HDfree(bkg); + HDfree(orig); + s_ptr = NULL; + d_ptr = NULL; + st.close(); + dt.close(); + PASSED(); } // end of try block catch (Exception& E) @@ -457,17 +457,17 @@ static void test_compound_4() /*------------------------------------------------------------------------- - * Function: test_compound_5 + * Function: test_compound_5 * - * Purpose: Many versions of HDF5 have a bug in the optimized compound + * Purpose Many versions of HDF5 have a bug in the optimized compound * datatype conversion function, H5T_conv_struct_opt(), which * is triggered when the top-level type contains a struct * which must undergo a conversion. * - * Return: None + * Return None * - * Programmer: Binh-Minh Ribler (use C version) - * January, 2007 + * Programmer Binh-Minh Ribler (use C version) + * January, 2007 * * Modifications: * @@ -499,55 +499,55 @@ static void test_compound_5() SUBTEST("Optimized Struct Converter"); try { - /* Build datatypes */ - array_dt = new ArrayType(PredType::NATIVE_SHORT, 1, dims); - CompType short_array(4*sizeof(short)); - short_array.insertMember("_", 0, *array_dt); - array_dt->close(); + /* Build datatypes */ + array_dt = new ArrayType(PredType::NATIVE_SHORT, 1, dims); + CompType short_array(4*sizeof(short)); + short_array.insertMember("_", 0, *array_dt); + array_dt->close(); delete array_dt; - CompType int_array(4*sizeof(int)); - array_dt = new ArrayType(PredType::NATIVE_INT, 1, dims); - int_array.insertMember("_", 0, *array_dt); - array_dt->close(); - - StrType strg(PredType::C_S1, 16); - CompType src_type(sizeof(src_typ_t)); - src_type.insertMember("name", HOFFSET(src_typ_t, name), strg); - src_type.insertMember("tdim", HOFFSET(src_typ_t, tdim), PredType::NATIVE_SHORT); - src_type.insertMember("coll_ids", HOFFSET(src_typ_t, coll_ids), short_array); - - CompType dst_type(sizeof(dst_typ_t)); - dst_type.insertMember("name", HOFFSET(dst_typ_t, name), strg); - dst_type.insertMember("tdim", HOFFSET(dst_typ_t, tdim), PredType::NATIVE_SHORT); - dst_type.insertMember("coll_ids", HOFFSET(dst_typ_t, coll_ids), int_array); - - /* Convert data */ - memcpy(buf, src, sizeof(src)); - src_type.convert(dst_type, (size_t)2, buf, bkg); - dst = (dst_typ_t*)buf; - - /* Cleanup */ - src_type.close(); - dst_type.close(); - strg.close(); - short_array.close(); - int_array.close(); - - /* Check results */ - if (memcmp(src[1].name, dst[1].name, sizeof(src[1].name)) || - src[1].tdim!=dst[1].tdim || - src[1].coll_ids[0]!=dst[1].coll_ids[0] || - src[1].coll_ids[1]!=dst[1].coll_ids[1] || - src[1].coll_ids[2]!=dst[1].coll_ids[2] || - src[1].coll_ids[3]!=dst[1].coll_ids[3]) - { H5_FAILED(); } - - /* Free memory buffers */ - HDfree(buf); - HDfree(bkg); - dst = NULL; - PASSED(); + CompType int_array(4*sizeof(int)); + array_dt = new ArrayType(PredType::NATIVE_INT, 1, dims); + int_array.insertMember("_", 0, *array_dt); + array_dt->close(); + + StrType strg(PredType::C_S1, 16); + CompType src_type(sizeof(src_typ_t)); + src_type.insertMember("name", HOFFSET(src_typ_t, name), strg); + src_type.insertMember("tdim", HOFFSET(src_typ_t, tdim), PredType::NATIVE_SHORT); + src_type.insertMember("coll_ids", HOFFSET(src_typ_t, coll_ids), short_array); + + CompType dst_type(sizeof(dst_typ_t)); + dst_type.insertMember("name", HOFFSET(dst_typ_t, name), strg); + dst_type.insertMember("tdim", HOFFSET(dst_typ_t, tdim), PredType::NATIVE_SHORT); + dst_type.insertMember("coll_ids", HOFFSET(dst_typ_t, coll_ids), int_array); + + /* Convert data */ + memcpy(buf, src, sizeof(src)); + src_type.convert(dst_type, (size_t)2, buf, bkg); + dst = (dst_typ_t*)buf; + + /* Cleanup */ + src_type.close(); + dst_type.close(); + strg.close(); + short_array.close(); + int_array.close(); + + /* Check results */ + if (memcmp(src[1].name, dst[1].name, sizeof(src[1].name)) || + src[1].tdim!=dst[1].tdim || + src[1].coll_ids[0]!=dst[1].coll_ids[0] || + src[1].coll_ids[1]!=dst[1].coll_ids[1] || + src[1].coll_ids[2]!=dst[1].coll_ids[2] || + src[1].coll_ids[3]!=dst[1].coll_ids[3]) + { H5_FAILED(); } + + /* Free memory buffers */ + HDfree(buf); + HDfree(bkg); + dst = NULL; + PASSED(); } // end of try block catch (Exception& E) @@ -561,16 +561,16 @@ static void test_compound_5() /*------------------------------------------------------------------------- - * Function: test_compound_6 + * Function: test_compound_6 * - * Purpose: Tests compound conversions when the destination has the same - * fields as the source but one or more of the fields are - * larger. + * Purpose Tests compound conversions when the destination has the same + * fields as the source but one or more of the fields are + * larger. * - * Return: None + * Return None * - * Programmer: Binh-Minh Ribler (use C version) - * January, 2007 + * Programmer Binh-Minh Ribler (use C version) + * January, 2007 * * Modifications: * @@ -579,72 +579,72 @@ static void test_compound_5() static void test_compound_6() { typedef struct { - short b; - short d; + short b; + short d; } src_typ_t; typedef struct { - long b; - long d; + long b; + long d; } dst_typ_t; - src_typ_t *s_ptr; - dst_typ_t *d_ptr; - int i; - const int nelmts = NTESTELEM; + src_typ_t *s_ptr; + dst_typ_t *d_ptr; + int i; + const int nelmts = NTESTELEM; unsigned char *buf=NULL, *orig=NULL, *bkg=NULL; // Output message about test being performed SUBTEST("Compound Element Growing"); try { - /* Sizes should be the same, but be careful just in case */ - buf = (unsigned char*)HDmalloc(nelmts * MAX(sizeof(src_typ_t), sizeof(dst_typ_t))); - bkg = (unsigned char*)HDmalloc(nelmts * sizeof(dst_typ_t)); - orig = (unsigned char*)HDmalloc(nelmts * sizeof(src_typ_t)); - for (i=0; ib = (i*8+1) & 0x7fff; - s_ptr->d = (i*8+6) & 0x7fff; - } - memcpy(buf, orig, nelmts*sizeof(src_typ_t)); - - /* Build hdf5 datatypes */ - CompType st(sizeof(src_typ_t)); - st.insertMember("b", HOFFSET(src_typ_t, b), PredType::NATIVE_SHORT); - st.insertMember("d", HOFFSET(src_typ_t, d), PredType::NATIVE_SHORT); - - CompType dt(sizeof(dst_typ_t)); - dt.insertMember("b", HOFFSET(dst_typ_t, b), PredType::NATIVE_LONG); - dt.insertMember("d", HOFFSET(dst_typ_t, d), PredType::NATIVE_LONG); - - /* Perform the conversion */ - st.convert(dt, (size_t)nelmts, buf, bkg); - - /* Compare results */ - for (i=0; ib != d_ptr->b || - s_ptr->d != d_ptr->d) - { - H5_FAILED(); - cerr << " i=" << i << endl; - cerr << " src={b=" << s_ptr->b << ", d=" << s_ptr->d - << "}" << endl; - cerr << " dst={b=" << d_ptr->b << ", d=" << d_ptr->d - << "}" << endl; - } // if - } // for - - /* Release resources */ - HDfree(buf); - HDfree(bkg); - HDfree(orig); - s_ptr = NULL; - d_ptr = NULL; - st.close(); - dt.close(); - PASSED(); + /* Sizes should be the same, but be careful just in case */ + buf = (unsigned char*)HDmalloc(nelmts * MAX(sizeof(src_typ_t), sizeof(dst_typ_t))); + bkg = (unsigned char*)HDmalloc(nelmts * sizeof(dst_typ_t)); + orig = (unsigned char*)HDmalloc(nelmts * sizeof(src_typ_t)); + for (i=0; ib = (i*8+1) & 0x7fff; + s_ptr->d = (i*8+6) & 0x7fff; + } + memcpy(buf, orig, nelmts*sizeof(src_typ_t)); + + /* Build hdf5 datatypes */ + CompType st(sizeof(src_typ_t)); + st.insertMember("b", HOFFSET(src_typ_t, b), PredType::NATIVE_SHORT); + st.insertMember("d", HOFFSET(src_typ_t, d), PredType::NATIVE_SHORT); + + CompType dt(sizeof(dst_typ_t)); + dt.insertMember("b", HOFFSET(dst_typ_t, b), PredType::NATIVE_LONG); + dt.insertMember("d", HOFFSET(dst_typ_t, d), PredType::NATIVE_LONG); + + /* Perform the conversion */ + st.convert(dt, (size_t)nelmts, buf, bkg); + + /* Compare results */ + for (i=0; ib != d_ptr->b || + s_ptr->d != d_ptr->d) + { + H5_FAILED(); + cerr << " i=" << i << endl; + cerr << " src={b=" << s_ptr->b << ", d=" << s_ptr->d + << "}" << endl; + cerr << " dst={b=" << d_ptr->b << ", d=" << d_ptr->d + << "}" << endl; + } // if + } // for + + /* Release resources */ + HDfree(buf); + HDfree(bkg); + HDfree(orig); + s_ptr = NULL; + d_ptr = NULL; + st.close(); + dt.close(); + PASSED(); } // end of try block catch (Exception& E) @@ -654,15 +654,15 @@ static void test_compound_6() } // test_compound_6() /*------------------------------------------------------------------------- - * Function: test_compound_7 + * Function: test_compound_7 * - * Purpose: Tests inserting fields into compound datatypes when the field - * overlaps the end of the compound datatype. + * Purpose Tests inserting fields into compound datatypes when the field + * overlaps the end of the compound datatype. * - * Return: None + * Return None * - * Programmer: Binh-Minh Ribler (use C version) - * January, 2007 + * Programmer Binh-Minh Ribler (use C version) + * January, 2007 * * Modifications: * @@ -671,47 +671,47 @@ static void test_compound_6() static void test_compound_7() { typedef struct { - int a; - float b; - long c; + int a; + float b; + long c; } s1_typ_t; typedef struct { - int a; - float b; - long c; - double d; + int a; + float b; + long c; + double d; } s2_typ_t; // Output message about test being performed SUBTEST("Compound Element Insertion"); try { - CompType tid1(sizeof(s1_typ_t)); + CompType tid1(sizeof(s1_typ_t)); - tid1.insertMember("a", HOFFSET(s1_typ_t,a),PredType::NATIVE_INT); - tid1.insertMember("b", HOFFSET(s1_typ_t,b),PredType::NATIVE_FLOAT); - tid1.insertMember("c", HOFFSET(s1_typ_t,c),PredType::NATIVE_LONG); + tid1.insertMember("a", HOFFSET(s1_typ_t,a),PredType::NATIVE_INT); + tid1.insertMember("b", HOFFSET(s1_typ_t,b),PredType::NATIVE_FLOAT); + tid1.insertMember("c", HOFFSET(s1_typ_t,c),PredType::NATIVE_LONG); - size_t type_size = tid1.getSize(); - verify_val(type_size, sizeof(s1_typ_t), "DataType::getSize", __LINE__, __FILE__); + size_t type_size = tid1.getSize(); + verify_val(type_size, sizeof(s1_typ_t), "DataType::getSize", __LINE__, __FILE__); - CompType tid2; - tid2.copy(tid1); + CompType tid2; + tid2.copy(tid1); - type_size = tid2.getSize(); - verify_val_noteq(type_size, sizeof(s2_typ_t), "DataType::getSize", __LINE__, __FILE__); + type_size = tid2.getSize(); + verify_val_noteq(type_size, sizeof(s2_typ_t), "DataType::getSize", __LINE__, __FILE__); - /* Should not be able to insert field past end of compound datatype */ - try { - tid2.insertMember("d", HOFFSET(s2_typ_t, d), PredType::NATIVE_DOUBLE); - // Should FAIL but didn't, so throw an invalid action exception - throw InvalidActionException("CompType::insertMember", "Attempted to insert field past end of compound data type."); - } catch (DataTypeIException& err) {} + /* Should not be able to insert field past end of compound datatype */ + try { + tid2.insertMember("d", HOFFSET(s2_typ_t, d), PredType::NATIVE_DOUBLE); + // Should FAIL but didn't, so throw an invalid action exception + throw InvalidActionException("CompType::insertMember", "Attempted to insert field past end of compound data type."); + } catch (DataTypeIException& err) {} - /* Release resources */ - tid1.close(); - tid2.close(); - PASSED(); + /* Release resources */ + tid1.close(); + tid2.close(); + PASSED(); } // end of try block catch (Exception& E) @@ -721,13 +721,13 @@ static void test_compound_7() } // test_compound_7() /*------------------------------------------------------------------------- - * Function: test_compound_set_size + * Function: test_compound_set_size * - * Purpose: Tests member function setSize() on compound datatype + * Purpose Tests member function setSize() on compound datatype * - * Return: None + * Return None * - * Programmer: Binh-Minh Ribler (use partial C version test_ooo_order) + * Programmer Binh-Minh Ribler (use partial C version test_ooo_order) * March, 2014 * * Modifications: @@ -738,7 +738,7 @@ const H5std_string COMPFILE("tcompound_types.h5"); static void test_compound_set_size() { typedef struct { - int a, b, c[4], d, e; + int a, b, c[4], d, e; } src_typ_t; // Output message about test being performed @@ -755,53 +755,53 @@ static void test_compound_set_size() dtype.insertMember("c", HOFFSET(src_typ_t, c), PredType::NATIVE_LONG); dtype.insertMember("d", HOFFSET(src_typ_t, d), PredType::NATIVE_DOUBLE); - // Verify that the compound is not packed - // bool packed = dtype.packed(); // not until C library provides API - // verify_val(packed, FALSE, "DataType::packed", __LINE__, __FILE__); + // Verify that the compound is not packed + // bool packed = dtype.packed(); // not until C library provides API + // verify_val(packed, FALSE, "DataType::packed", __LINE__, __FILE__); - dtype.commit(file, "dtype"); + dtype.commit(file, "dtype"); - // Close the type and file - dtype.close(); - file.close(); + // Close the type and file + dtype.close(); + file.close(); - // Open the file for read/write - file.openFile(COMPFILE, H5F_ACC_RDWR); + // Open the file for read/write + file.openFile(COMPFILE, H5F_ACC_RDWR); - // Open the data type "dtype" - CompType dtype_tmp = file.openCompType("dtype"); + // Open the data type "dtype" + CompType dtype_tmp = file.openCompType("dtype"); - // Make a copy of the data type - dtype.copy(dtype_tmp); + // Make a copy of the data type + dtype.copy(dtype_tmp); - // Verify that the compound is not packed - // packed = dtype_tmp.packed(); // not until C library provides API - // verify_val(packed, FALSE, "DataType::packed", __LINE__, __FILE__); + // Verify that the compound is not packed + // packed = dtype_tmp.packed(); // not until C library provides API + // verify_val(packed, FALSE, "DataType::packed", __LINE__, __FILE__); - // Expand the type, and verify that it became unpacked - dtype.setSize((size_t)33); - // packed = dtype.packed(); // not until C library provides API - // verify_val(packed, FALSE, "DataType::packed", __LINE__, __FILE__); + // Expand the type, and verify that it became unpacked + dtype.setSize((size_t)33); + // packed = dtype.packed(); // not until C library provides API + // verify_val(packed, FALSE, "DataType::packed", __LINE__, __FILE__); - // Verify setSize() actually set size - size_t new_size = dtype.getSize(); - verify_val(new_size, (size_t)33, "DataType::getSize", __LINE__, __FILE__); + // Verify setSize() actually set size + size_t new_size = dtype.getSize(); + verify_val(new_size, (size_t)33, "DataType::getSize", __LINE__, __FILE__); - // Shrink the type, and verify that it became packed - dtype.setSize((size_t)32); - // packed = dtype.packed(); // not until C library provides API - // verify_val(packed, TRUE, "DataType::packed", __LINE__, __FILE__); + // Shrink the type, and verify that it became packed + dtype.setSize((size_t)32); + // packed = dtype.packed(); // not until C library provides API + // verify_val(packed, TRUE, "DataType::packed", __LINE__, __FILE__); - // Verify setSize() actually set size again - new_size = dtype.getSize(); - verify_val(new_size, (size_t)32, "DataType::getSize", __LINE__, __FILE__); + // Verify setSize() actually set size again + new_size = dtype.getSize(); + verify_val(new_size, (size_t)32, "DataType::getSize", __LINE__, __FILE__); - /* Close types and file */ - dtype_tmp.close(); - dtype.close(); - file.close(); + /* Close types and file */ + dtype_tmp.close(); + dtype.close(); + file.close(); - PASSED(); + PASSED(); } // end of try block catch (Exception& E) @@ -811,14 +811,14 @@ static void test_compound_set_size() } // test_compound_set_size() /*------------------------------------------------------------------------- - * Function: test_compound + * Function: test_compound * - * Purpose: Main compound datatype testing routine + * Purpose Main compound datatype testing routine * - * Return: None + * Return None * - * Programmer: Binh-Minh Ribler - * January 2007 + * Programmer Binh-Minh Ribler + * January 2007 * * Modifications: * @@ -830,23 +830,23 @@ void test_compound() // Output message about test being performed MESSAGE(5, ("Testing Compound Data Type operations\n")); - test_compound_1(); // various things about compound data types - test_compound_2(); // compound element reordering - test_compound_3(); // compound datatype subset conversions - test_compound_4(); // compound element shrinking & reordering - test_compound_5(); // optimized struct converter - test_compound_6(); // compound element growing - test_compound_7(); // compound element insertion - test_compound_set_size(); // set size on compound data types + test_compound_1(); // various things about compound data types + test_compound_2(); // compound element reordering + test_compound_3(); // compound datatype subset conversions + test_compound_4(); // compound element shrinking & reordering + test_compound_5(); // optimized struct converter + test_compound_6(); // compound element growing + test_compound_7(); // compound element insertion + test_compound_set_size(); // set size on compound data types } // test_compound() /*------------------------------------------------------------------------- - * Function: cleanup_compound + * Function: cleanup_compound * - * Purpose: Cleanup temporary test files - nothing at this time. + * Purpose Cleanup temporary test files - nothing at this time. * - * Return: none + * Return none * * Modifications: * diff --git a/c++/test/tdspl.cpp b/c++/test/tdspl.cpp index d733ffe..f39694b 100644 --- a/c++/test/tdspl.cpp +++ b/c++/test/tdspl.cpp @@ -16,7 +16,7 @@ /***************************************************************************** FILE tdspl.cpp - HDF5 C++ testing the dataset memory and transfer property - list functionality + list functionality ***************************************************************************/ #ifdef OLD_HEADER_FILENAME @@ -45,70 +45,70 @@ static void test_transfplist() SUBTEST("DSetMemXferPropList::set/getDataTransform()"); try { - // Create various data set prop lists and set data transform expression. - DSetMemXferPropList dxpl_c_to_f(c_to_f); - - DSetMemXferPropList dxpl_simple; - dxpl_simple.setDataTransform(simple); - - DSetMemXferPropList dxpl_utrans_inv; - dxpl_utrans_inv.setDataTransform(utrans_inv); - - // - // Make a copy of one of those prop lists then read the data transform - // expression and verify that it's the same as the original. - // - - // Copy the prop list. - DSetMemXferPropList dxpl_c_to_f_copy; - dxpl_c_to_f_copy.copy(dxpl_c_to_f); - - // Find out the length of the transform expression, allocate the buffer - // for it, then read and verify the expression from the copied plist - ssize_t tran_len = dxpl_c_to_f_copy.getDataTransform(NULL); - char *c_to_f_read = (char *)HDmalloc(tran_len+1); - HDmemset(c_to_f_read, 0, tran_len+1); - dxpl_c_to_f_copy.getDataTransform(c_to_f_read, tran_len+1); - verify_val((const char*)c_to_f_read, (const char*)c_to_f, - "DSetMemXferPropList::getDataTransform", __LINE__, __FILE__); - HDfree(c_to_f_read); - - // - // Read the expression of each of the prop lists and verify the read - // expression - // - - // Get and verify the expression with: - // ssize_t getDataTransform(char* exp, const size_t buf_size [default=0]) - tran_len = dxpl_c_to_f.getDataTransform(NULL); - c_to_f_read = (char *)HDmalloc(tran_len+1); - HDmemset(c_to_f_read, 0, tran_len+1); - dxpl_c_to_f.getDataTransform(c_to_f_read, tran_len+1); - verify_val((const char*)c_to_f_read, (const char*)c_to_f, - "DSetMemXferPropList::getDataTransform", __LINE__, __FILE__); - HDfree(c_to_f_read); - - // Get and verify the expression with: - // H5std_string DSetMemXferPropList::getDataTransform() - H5std_string simple_read = dxpl_simple.getDataTransform(); - verify_val((const char*)simple_read.c_str(), (const char*)simple, - "DSetMemXferPropList::getDataTransform", __LINE__, __FILE__); - - // Get and verify the expression with: - // ssize_t getDataTransform(char* exp, const size_t buf_size) - tran_len = dxpl_utrans_inv.getDataTransform(NULL, 0); - char *utrans_inv_read = (char *)HDmalloc(tran_len+1); - HDmemset(utrans_inv_read, 0, tran_len+1); - dxpl_utrans_inv.getDataTransform(utrans_inv_read, tran_len+1); - verify_val((const char*)utrans_inv_read, (const char*)utrans_inv, - "DSetMemXferPropList::getDataTransform", __LINE__, __FILE__); - HDfree(utrans_inv_read); - - PASSED(); + // Create various data set prop lists and set data transform expression. + DSetMemXferPropList dxpl_c_to_f(c_to_f); + + DSetMemXferPropList dxpl_simple; + dxpl_simple.setDataTransform(simple); + + DSetMemXferPropList dxpl_utrans_inv; + dxpl_utrans_inv.setDataTransform(utrans_inv); + + // + // Make a copy of one of those prop lists then read the data transform + // expression and verify that it's the same as the original. + // + + // Copy the prop list. + DSetMemXferPropList dxpl_c_to_f_copy; + dxpl_c_to_f_copy.copy(dxpl_c_to_f); + + // Find out the length of the transform expression, allocate the buffer + // for it, then read and verify the expression from the copied plist + ssize_t tran_len = dxpl_c_to_f_copy.getDataTransform(NULL); + char *c_to_f_read = (char *)HDmalloc(tran_len+1); + HDmemset(c_to_f_read, 0, tran_len+1); + dxpl_c_to_f_copy.getDataTransform(c_to_f_read, tran_len+1); + verify_val((const char*)c_to_f_read, (const char*)c_to_f, + "DSetMemXferPropList::getDataTransform", __LINE__, __FILE__); + HDfree(c_to_f_read); + + // + // Read the expression of each of the prop lists and verify the read + // expression + // + + // Get and verify the expression with: + // ssize_t getDataTransform(char* exp, const size_t buf_size [default=0]) + tran_len = dxpl_c_to_f.getDataTransform(NULL); + c_to_f_read = (char *)HDmalloc(tran_len+1); + HDmemset(c_to_f_read, 0, tran_len+1); + dxpl_c_to_f.getDataTransform(c_to_f_read, tran_len+1); + verify_val((const char*)c_to_f_read, (const char*)c_to_f, + "DSetMemXferPropList::getDataTransform", __LINE__, __FILE__); + HDfree(c_to_f_read); + + // Get and verify the expression with: + // H5std_string DSetMemXferPropList::getDataTransform() + H5std_string simple_read = dxpl_simple.getDataTransform(); + verify_val((const char*)simple_read.c_str(), (const char*)simple, + "DSetMemXferPropList::getDataTransform", __LINE__, __FILE__); + + // Get and verify the expression with: + // ssize_t getDataTransform(char* exp, const size_t buf_size) + tran_len = dxpl_utrans_inv.getDataTransform(NULL, 0); + char *utrans_inv_read = (char *)HDmalloc(tran_len+1); + HDmemset(utrans_inv_read, 0, tran_len+1); + dxpl_utrans_inv.getDataTransform(utrans_inv_read, tran_len+1); + verify_val((const char*)utrans_inv_read, (const char*)utrans_inv, + "DSetMemXferPropList::getDataTransform", __LINE__, __FILE__); + HDfree(utrans_inv_read); + + PASSED(); } catch (Exception& E) { - issue_fail_msg("test_transfplist", __LINE__, __FILE__, E.getCDetailMsg()); + issue_fail_msg("test_transfplist", __LINE__, __FILE__, E.getCDetailMsg()); } } diff --git a/c++/test/testhdf5.cpp b/c++/test/testhdf5.cpp index 28ede6b..779c931 100644 --- a/c++/test/testhdf5.cpp +++ b/c++/test/testhdf5.cpp @@ -28,16 +28,16 @@ base functionality testing. EXTERNAL ROUTINES/VARIABLES: - TestInit(...) -- Initialize testing framework - TestInfo(...) -- Print test info - AddTest(...) -- Setup a test function and add it to the list of tests - TestParseCmdLine(...) -- Parse command line arguments - PerformTests() -- Perform requested testing - GetTestSummary() -- Retrieve Summary request value - TestSummary() -- Display test summary - GetTestCleanup() -- Retrieve Cleanup request value - TestCleanup() -- Clean up files from testing - GetTestNumErrs() -- Retrieve the number of testing errors + TestInit(...) -- Initialize testing framework + TestInfo(...) -- Print test info + AddTest(...) -- Setup a test function and add it to the list of tests + TestParseCmdLine(...) -- Parse command line arguments + PerformTests() -- Perform requested testing + GetTestSummary() -- Retrieve Summary request value + TestSummary() -- Display test summary + GetTestCleanup() -- Retrieve Cleanup request value + TestCleanup() -- Clean up files from testing + GetTestNumErrs() -- Retrieve the number of testing errors ***************************************************************************/ #ifdef OLD_HEADER_FILENAME @@ -60,47 +60,47 @@ main(int argc, char *argv[]) { try { - // Turn of the auto-printing when failure occurs so that we can - // handle the errors appropriately since sometime failures are - // caused deliberately and expected. - Exception::dontPrint(); - /* Initialize testing framework */ - TestInit(argv[0], NULL, NULL); - - // testing file creation and opening in tfile.cpp - AddTest("tfile", test_file, cleanup_file, "File I/O Operations", NULL); - // testing dataset functionalities in dset.cpp - AddTest("dsets", test_dset, cleanup_dsets, "Dataset I/O Operations", NULL); - // testing dataspace functionalities in th5s.cpp - AddTest("th5s", test_h5s, cleanup_h5s, "Dataspaces", NULL); - // testing attribute functionalities in tattr.cpp - AddTest("tattr", test_attr, cleanup_attr, "Attributes", NULL); - // testing object functionalities in tobject.cpp - AddTest("tobject", test_object, cleanup_object, "Objects", NULL); - // testing reference functionalities in trefer.cpp - AddTest("trefer", test_reference, cleanup_reference, "References", NULL); - // testing variable-length strings in tvlstr.cpp - AddTest("tvlstr", test_vlstrings, cleanup_vlstrings, "Variable-Length Strings", NULL); - AddTest("ttypes", test_types, cleanup_types, "Generic Data Types", NULL); - AddTest("tarray", test_array, cleanup_array, "Array Datatypes", NULL); - AddTest("tcompound", test_compound, cleanup_compound, "Compound Data Types", NULL); - AddTest("tdspl", test_dsproplist, cleanup_dsproplist, "Dataset Property List", NULL); - AddTest("tfilter", test_filters, cleanup_filters, "Various Filters", NULL); - AddTest("tlinks", test_links, cleanup_links, "Various Links", NULL); + // Turn of the auto-printing when failure occurs so that we can + // handle the errors appropriately since sometime failures are + // caused deliberately and expected. + Exception::dontPrint(); + /* Initialize testing framework */ + TestInit(argv[0], NULL, NULL); + + // testing file creation and opening in tfile.cpp + AddTest("tfile", test_file, cleanup_file, "File I/O Operations", NULL); + // testing dataset functionalities in dset.cpp + AddTest("dsets", test_dset, cleanup_dsets, "Dataset I/O Operations", NULL); + // testing dataspace functionalities in th5s.cpp + AddTest("th5s", test_h5s, cleanup_h5s, "Dataspaces", NULL); + // testing attribute functionalities in tattr.cpp + AddTest("tattr", test_attr, cleanup_attr, "Attributes", NULL); + // testing object functionalities in tobject.cpp + AddTest("tobject", test_object, cleanup_object, "Objects", NULL); + // testing reference functionalities in trefer.cpp + AddTest("trefer", test_reference, cleanup_reference, "References", NULL); + // testing variable-length strings in tvlstr.cpp + AddTest("tvlstr", test_vlstrings, cleanup_vlstrings, "Variable-Length Strings", NULL); + AddTest("ttypes", test_types, cleanup_types, "Generic Data Types", NULL); + AddTest("tarray", test_array, cleanup_array, "Array Datatypes", NULL); + AddTest("tcompound", test_compound, cleanup_compound, "Compound Data Types", NULL); + AddTest("tdspl", test_dsproplist, cleanup_dsproplist, "Dataset Property List", NULL); + AddTest("tfilter", test_filters, cleanup_filters, "Various Filters", NULL); + AddTest("tlinks", test_links, cleanup_links, "Various Links", NULL); /* Comment out tests that are not done yet. - BMR, Feb 2001 - AddTest("select", test_select, cleanup_select, "Selections", NULL); - AddTest("time", test_time, cleanup_time, "Time Datatypes", NULL); - AddTest("vltypes", test_vltypes, cleanup_vltypes, "Variable-Length Datatypes", NULL); + AddTest("select", test_select, cleanup_select, "Selections", NULL); + AddTest("time", test_time, cleanup_time, "Time Datatypes", NULL); + AddTest("vltypes", test_vltypes, cleanup_vltypes, "Variable-Length Datatypes", NULL); */ - AddTest("iterate", test_iterate, cleanup_iterate, "Group & Attribute Iteration", NULL); + AddTest("iterate", test_iterate, cleanup_iterate, "Group & Attribute Iteration", NULL); /* - AddTest("genprop", test_genprop, cleanup_genprop, "Generic Properties", NULL); - AddTest("id", test_ids, NULL, "User-Created Identifiers", NULL); + AddTest("genprop", test_genprop, cleanup_genprop, "Generic Properties", NULL); + AddTest("id", test_ids, NULL, "User-Created Identifiers", NULL); Comment out tests that are not done yet */ /* Tentative - BMR 2007/1/12 - AddTest("enum", test_enum, cleanup_enum, "Enum Data Types", NULL); + AddTest("enum", test_enum, cleanup_enum, "Enum Data Types", NULL); */ } catch (Exception& E) diff --git a/c++/test/tfile.cpp b/c++/test/tfile.cpp index c7ed933..261beab 100644 --- a/c++/test/tfile.cpp +++ b/c++/test/tfile.cpp @@ -49,6 +49,7 @@ const size_t F2_OFFSET_SIZE = 8; const size_t F2_LENGTH_SIZE = 8; const unsigned F2_SYM_LEAF_K = 8; const unsigned F2_SYM_INTERN_K = 32; +const unsigned F2_ISTORE = 64; const H5std_string FILE2("tfile2.h5"); const hsize_t F3_USERBLOCK_SIZE = (hsize_t)0; @@ -65,20 +66,20 @@ const H5std_string FILE4("tfile4.h5"); /*------------------------------------------------------------------------- * Function: test_file_create * - * Purpose: Test file and template creations + * Purpose Test file and template creations * - * Return: None + * Return None * - * Programmer: Binh-Minh Ribler (use C version) + * Programmer Binh-Minh Ribler (use C version) * January, 2001 * * Modifications: - * January, 2005: C tests' macro VERIFY casts values to 'long' for all - * cases. Since there are no operator<< for 'long long' - * or int64 in VS C++ ostream, I casted the hsize_t values - * passed to verify_val to 'long' as well. If problems - * arises later, this will have to be specificly handled - * with a special routine. + * January, 2005: C tests' macro VERIFY casts values to 'long' for all + * cases. Since there are no operator<< for 'long long' + * or int64 in VS C++ ostream, I casted the hsize_t values + * passed to verify_val to 'long' as well. If problems + * arises later, this will have to be specificly handled + * with a special routine. * *------------------------------------------------------------------------- */ @@ -97,81 +98,81 @@ static void test_file_create() // Setting this to NULL for cleaning up in failure situations H5File* file1 = NULL; try { - // Create file FILE1 - file1 = new H5File (FILE1, H5F_ACC_EXCL); - - // Try to create the same file with H5F_ACC_TRUNC. This should fail - // because file1 is the same file and is currently open. - try { - H5File file2 (FILE1, H5F_ACC_TRUNC); // should throw E - - // Should FAIL but didn't, so throw an invalid action exception - throw InvalidActionException("H5File constructor", "Attempted to create an existing file."); - } - catch (FileIException& E) // catch truncating existing file - {} // do nothing, FAIL expected - - // Close file1 - delete file1; - file1 = NULL; - - // Try again with H5F_ACC_EXCL. This should fail because the file - // already exists from the previous steps. - try { - H5File file2(FILE1, H5F_ACC_EXCL); // should throw E - - // Should FAIL but didn't, so throw an invalid action exception - throw InvalidActionException("H5File constructor", "File already exists."); - } - catch (FileIException& E) // catching creating existing file - {} // do nothing, FAIL expected - - // Test create with H5F_ACC_TRUNC. This will truncate the existing file. - file1 = new H5File (FILE1, H5F_ACC_TRUNC); - - // Try to create first file again. This should fail because file1 - // is the same file and is currently open. - try { - H5File file2 (FILE1, H5F_ACC_TRUNC); // should throw E - - // Should FAIL but didn't, so throw an invalid action exception - throw InvalidActionException("H5File constructor", "H5F_ACC_TRUNC attempt on an opened file."); - } - catch (FileIException& E) // catching truncating opened file - {} // do nothing, FAIL expected - - // Try with H5F_ACC_EXCL. This should fail too because the file already - // exists. - try { - H5File file3 (FILE1, H5F_ACC_EXCL); // should throw E - - // Should FAIL but didn't, so throw an invalid action exception - throw InvalidActionException("H5File constructor", "H5F_ACC_EXCL attempt on an existing file."); - } - catch (FileIException& E) // catching H5F_ACC_EXCL on existing file - {} // do nothing, FAIL expected - - // Get the file-creation template - FileCreatPropList tmpl1 = file1->getCreatePlist(); - - hsize_t ublock = tmpl1.getUserblock(); - verify_val((long)ublock, (long)F1_USERBLOCK_SIZE, "FileCreatPropList::getUserblock", __LINE__, __FILE__); - - size_t parm1, parm2; // file-creation parameters - tmpl1.getSizes( parm1, parm2); - verify_val(parm1, F1_OFFSET_SIZE, "FileCreatPropList::getSizes", __LINE__, __FILE__); - verify_val(parm2, F1_LENGTH_SIZE, "FileCreatPropList::getSizes", __LINE__, __FILE__); + // Create file FILE1 + file1 = new H5File (FILE1, H5F_ACC_EXCL); + + // Try to create the same file with H5F_ACC_TRUNC. This should fail + // because file1 is the same file and is currently open. + try { + H5File file2 (FILE1, H5F_ACC_TRUNC); // should throw E + + // Should FAIL but didn't, so throw an invalid action exception + throw InvalidActionException("H5File constructor", "Attempted to create an existing file."); + } + catch (FileIException& E) // catch truncating existing file + {} // do nothing, FAIL expected + + // Close file1 + delete file1; + file1 = NULL; + + // Try again with H5F_ACC_EXCL. This should fail because the file + // already exists from the previous steps. + try { + H5File file2(FILE1, H5F_ACC_EXCL); // should throw E + + // Should FAIL but didn't, so throw an invalid action exception + throw InvalidActionException("H5File constructor", "File already exists."); + } + catch (FileIException& E) // catching creating existing file + {} // do nothing, FAIL expected + + // Test create with H5F_ACC_TRUNC. This will truncate the existing file. + file1 = new H5File (FILE1, H5F_ACC_TRUNC); + + // Try to create first file again. This should fail because file1 + // is the same file and is currently open. + try { + H5File file2 (FILE1, H5F_ACC_TRUNC); // should throw E + + // Should FAIL but didn't, so throw an invalid action exception + throw InvalidActionException("H5File constructor", "H5F_ACC_TRUNC attempt on an opened file."); + } + catch (FileIException& E) // catching truncating opened file + {} // do nothing, FAIL expected + + // Try with H5F_ACC_EXCL. This should fail too because the file already + // exists. + try { + H5File file3 (FILE1, H5F_ACC_EXCL); // should throw E + + // Should FAIL but didn't, so throw an invalid action exception + throw InvalidActionException("H5File constructor", "H5F_ACC_EXCL attempt on an existing file."); + } + catch (FileIException& E) // catching H5F_ACC_EXCL on existing file + {} // do nothing, FAIL expected + + // Get the file-creation template + FileCreatPropList tmpl1 = file1->getCreatePlist(); + + hsize_t ublock = tmpl1.getUserblock(); + verify_val((long)ublock, (long)F1_USERBLOCK_SIZE, "FileCreatPropList::getUserblock", __LINE__, __FILE__); + + size_t parm1, parm2; // file-creation parameters + tmpl1.getSizes( parm1, parm2); + verify_val(parm1, F1_OFFSET_SIZE, "FileCreatPropList::getSizes", __LINE__, __FILE__); + verify_val(parm2, F1_LENGTH_SIZE, "FileCreatPropList::getSizes", __LINE__, __FILE__); unsigned iparm1,iparm2; // file-creation parameters tmpl1.getSymk( iparm1, iparm2); verify_val(iparm1, F1_SYM_INTERN_K, "FileCreatPropList::getSymk", __LINE__, __FILE__); verify_val(iparm2, F1_SYM_LEAF_K, "FileCreatPropList::getSymk", __LINE__, __FILE__); - // tmpl1 is automatically closed; if error occurs, it'll be - // caught in the catch block + // tmpl1 is automatically closed; if error occurs, it'll be + // caught in the catch block - // Close first file - delete file1; + // Close first file + delete file1; } catch (InvalidActionException& E) { @@ -183,7 +184,7 @@ static void test_file_create() // catch all other exceptions catch (Exception& E) { - issue_fail_msg("test_file_create()", __LINE__, __FILE__, E.getCDetailMsg()); + issue_fail_msg("test_file_create()", __LINE__, __FILE__, E.getCDetailMsg()); if (file1 != NULL) // clean up delete file1; } @@ -192,79 +193,79 @@ static void test_file_create() FileCreatPropList* tmpl1 = NULL; try { - // Create a new file with a non-standard file-creation template - tmpl1 = new FileCreatPropList; + // Create a new file with a non-standard file-creation template + tmpl1 = new FileCreatPropList; - // Set the new file-creation parameters - tmpl1->setUserblock (F2_USERBLOCK_SIZE); - tmpl1->setSizes( F2_OFFSET_SIZE, F2_LENGTH_SIZE ); - tmpl1->setSymk( F2_SYM_INTERN_K, F2_SYM_LEAF_K ); + // Set the new file-creation parameters + tmpl1->setUserblock (F2_USERBLOCK_SIZE); + tmpl1->setSizes( F2_OFFSET_SIZE, F2_LENGTH_SIZE ); + tmpl1->setSymk( F2_SYM_INTERN_K, F2_SYM_LEAF_K ); - // Try to create second file, with non-standard file-creation template - // params. - H5File file2( FILE2, H5F_ACC_TRUNC, *tmpl1 ); + // Try to create second file, with non-standard file-creation template + // params. + H5File file2( FILE2, H5F_ACC_TRUNC, *tmpl1 ); - // Release file-creation template - delete tmpl1; - tmpl1 = NULL; + // Release file-creation template + delete tmpl1; + tmpl1 = NULL; - // Get the file-creation template - tmpl1 = new FileCreatPropList (file2.getCreatePlist()); + // Get the file-creation template + tmpl1 = new FileCreatPropList (file2.getCreatePlist()); - // Get the file-creation parameters - hsize_t ublock = tmpl1->getUserblock(); - verify_val((long)ublock, (long)F2_USERBLOCK_SIZE, "FileCreatPropList::getUserblock", __LINE__, __FILE__); + // Get the file-creation parameters + hsize_t ublock = tmpl1->getUserblock(); + verify_val((long)ublock, (long)F2_USERBLOCK_SIZE, "FileCreatPropList::getUserblock", __LINE__, __FILE__); - size_t parm1, parm2; // file-creation parameters - tmpl1->getSizes( parm1, parm2); - verify_val(parm1, F2_OFFSET_SIZE, "FileCreatPropList::getSizes", __LINE__, __FILE__); - verify_val(parm2, F2_LENGTH_SIZE, "FileCreatPropList::getSizes", __LINE__, __FILE__); + size_t parm1, parm2; // file-creation parameters + tmpl1->getSizes( parm1, parm2); + verify_val(parm1, F2_OFFSET_SIZE, "FileCreatPropList::getSizes", __LINE__, __FILE__); + verify_val(parm2, F2_LENGTH_SIZE, "FileCreatPropList::getSizes", __LINE__, __FILE__); - unsigned iparm1,iparm2; // file-creation parameters + unsigned iparm1,iparm2; // file-creation parameters tmpl1->getSymk( iparm1, iparm2); verify_val(iparm1, F2_SYM_INTERN_K, "FileCreatPropList::getSymk", __LINE__, __FILE__); verify_val(iparm2, F2_SYM_LEAF_K, "FileCreatPropList::getSymk", __LINE__, __FILE__); - // Clone the file-creation template - FileCreatPropList tmpl2; - tmpl2.copy (*tmpl1); + // Clone the file-creation template + FileCreatPropList tmpl2; + tmpl2.copy (*tmpl1); - // Release file-creation template - delete tmpl1; - tmpl1 = NULL; + // Release file-creation template + delete tmpl1; + tmpl1 = NULL; - // Set the new file-creation parameter - tmpl2.setUserblock( F3_USERBLOCK_SIZE ); + // Set the new file-creation parameter + tmpl2.setUserblock( F3_USERBLOCK_SIZE ); - // Try to create second file, with non-standard file-creation template - // params - H5File file3( FILE3, H5F_ACC_TRUNC, tmpl2 ); + // Try to create second file, with non-standard file-creation template + // params + H5File file3( FILE3, H5F_ACC_TRUNC, tmpl2 ); - // Get the file-creation template - tmpl1 = new FileCreatPropList (file3.getCreatePlist()); + // Get the file-creation template + tmpl1 = new FileCreatPropList (file3.getCreatePlist()); - // Get the file-creation parameters - ublock = tmpl1->getUserblock(); - verify_val((long)ublock, (long)F3_USERBLOCK_SIZE, "FileCreatPropList::getUserblock", __LINE__, __FILE__); + // Get the file-creation parameters + ublock = tmpl1->getUserblock(); + verify_val((long)ublock, (long)F3_USERBLOCK_SIZE, "FileCreatPropList::getUserblock", __LINE__, __FILE__); - tmpl1->getSizes( parm1, parm2); - verify_val(parm1, F3_OFFSET_SIZE, "FileCreatPropList::getSizes", __LINE__, __FILE__); - verify_val(parm2, F3_LENGTH_SIZE, "FileCreatPropList::getSizes", __LINE__, __FILE__); + tmpl1->getSizes( parm1, parm2); + verify_val(parm1, F3_OFFSET_SIZE, "FileCreatPropList::getSizes", __LINE__, __FILE__); + verify_val(parm2, F3_LENGTH_SIZE, "FileCreatPropList::getSizes", __LINE__, __FILE__); - tmpl1->getSymk( iparm1, iparm2); - verify_val(iparm1, F3_SYM_INTERN_K, "FileCreatPropList::getSymk", __LINE__, __FILE__); - verify_val(iparm2, F3_SYM_LEAF_K, "FileCreatPropList::getSymk", __LINE__, __FILE__); + tmpl1->getSymk( iparm1, iparm2); + verify_val(iparm1, F3_SYM_INTERN_K, "FileCreatPropList::getSymk", __LINE__, __FILE__); + verify_val(iparm2, F3_SYM_LEAF_K, "FileCreatPropList::getSymk", __LINE__, __FILE__); - // Release file-creation template - delete tmpl1; - PASSED(); + // Release file-creation template + delete tmpl1; + PASSED(); } // catch all exceptions catch (Exception& E) { - issue_fail_msg("test_file_create()", __LINE__, __FILE__, E.getCDetailMsg()); - if (tmpl1 != NULL) // clean up - delete tmpl1; + issue_fail_msg("test_file_create()", __LINE__, __FILE__, E.getCDetailMsg()); + if (tmpl1 != NULL) // clean up + delete tmpl1; } } // test_file_create() @@ -272,20 +273,20 @@ static void test_file_create() /*------------------------------------------------------------------------- * Function: test_file_open * - * Purpose: Test file accesses + * Purpose Test file accesses * - * Return: None + * Return None * - * Programmer: Binh-Minh Ribler (use C version) + * Programmer Binh-Minh Ribler (use C version) * January, 2001 * * Modifications: - * January, 2005: C tests' macro VERIFY casts values to 'long' for all - * cases. Since there are no operator<< for 'long long' - * or int64 in VS C++ ostream, I casted the hsize_t values - * passed to verify_val to 'long' as well. If problems - * arises later, this will have to be specificly handled - * with a special routine. + * January, 2005: C tests' macro VERIFY casts values to 'long' for all + * cases. Since there are no operator<< for 'long long' + * or int64 in VS C++ ostream, I casted the hsize_t values + * passed to verify_val to 'long' as well. If problems + * arises later, this will have to be specificly handled + * with a special routine. * *------------------------------------------------------------------------- */ @@ -296,53 +297,53 @@ static void test_file_open() try { - // Open first file - H5File file1 (FILE2, H5F_ACC_RDWR ); + // Open first file + H5File file1 (FILE2, H5F_ACC_RDWR ); - // Get the file-creation template - FileCreatPropList tmpl1 = file1.getCreatePlist(); + // Get the file-creation template + FileCreatPropList tmpl1 = file1.getCreatePlist(); - // Get the file-creation parameters - hsize_t ublock = tmpl1.getUserblock(); - verify_val((long)ublock, (long)F2_USERBLOCK_SIZE, "FileCreatPropList::getUserblock", __LINE__, __FILE__); + // Get the file-creation parameters + hsize_t ublock = tmpl1.getUserblock(); + verify_val((long)ublock, (long)F2_USERBLOCK_SIZE, "FileCreatPropList::getUserblock", __LINE__, __FILE__); - size_t parm1, parm2; // file-creation parameters - tmpl1.getSizes( parm1, parm2); - verify_val(parm1, F2_OFFSET_SIZE, "FileCreatPropList::getSizes", __LINE__, __FILE__); - verify_val(parm2, F2_LENGTH_SIZE, "FileCreatPropList::getSizes", __LINE__, __FILE__); + size_t parm1, parm2; // file-creation parameters + tmpl1.getSizes( parm1, parm2); + verify_val(parm1, F2_OFFSET_SIZE, "FileCreatPropList::getSizes", __LINE__, __FILE__); + verify_val(parm2, F2_LENGTH_SIZE, "FileCreatPropList::getSizes", __LINE__, __FILE__); unsigned iparm1,iparm2; // file-creation parameters tmpl1.getSymk( iparm1, iparm2); verify_val(iparm1, F2_SYM_INTERN_K, "FileCreatPropList::getSymk", __LINE__, __FILE__); verify_val(iparm2, F2_SYM_LEAF_K, "FileCreatPropList::getSymk", __LINE__, __FILE__); - // Test H5File constructor with existing file id - H5File file2(file1.getId()); - file1.close(); + // Test H5File constructor with existing file id + H5File file2(file1.getId()); + file1.close(); - // Try truncating the file, and it should fail because the file is - // still opened with file2. - try { - H5File file3 (FILE2, H5F_ACC_TRUNC); // should throw E + // Try truncating the file, and it should fail because the file is + // still opened with file2. + try { + H5File file3 (FILE2, H5F_ACC_TRUNC); // should throw E - // Should FAIL but didn't, so throw an invalid action exception - throw InvalidActionException("H5File constructor", "Attempt truncating an opened file."); - } - catch (FileIException& E) // catching H5F_ACC_TRUNC on opened file - {} // do nothing, FAIL expected + // Should FAIL but didn't, so throw an invalid action exception + throw InvalidActionException("H5File constructor", "Attempt truncating an opened file."); + } + catch (FileIException& E) // catching H5F_ACC_TRUNC on opened file + {} // do nothing, FAIL expected - // Now, really close the file. - file2.close(); + // Now, really close the file. + file2.close(); - // Truncating should succeed now. - H5File file3(FILE2, H5F_ACC_TRUNC); + // Truncating should succeed now. + H5File file3(FILE2, H5F_ACC_TRUNC); - // Opening another file to file3 object, FILE2 should be closed, so - // the next attempt to truncate FILE2 should succeed. - file3.openFile(FILE1, H5F_ACC_RDONLY); - H5File file4(FILE2, H5F_ACC_TRUNC); + // Opening another file to file3 object, FILE2 should be closed, so + // the next attempt to truncate FILE2 should succeed. + file3.openFile(FILE1, H5F_ACC_RDONLY); + H5File file4(FILE2, H5F_ACC_TRUNC); - PASSED(); + PASSED(); } // end of try block catch (Exception& E) @@ -355,11 +356,11 @@ static void test_file_open() /*------------------------------------------------------------------------- * Function: test_file_size * - * Purpose: Test file size. + * Purpose Test file size. * - * Return: None + * Return None * - * Programmer: Raymond Lu + * Programmer Raymond Lu * June, 2004 * * Modifications: @@ -371,7 +372,7 @@ static void test_file_size() // Output message about test being performed SUBTEST("File Size"); - hid_t fapl_id; + hid_t fapl_id; fapl_id = h5_fileaccess(); // in h5test.c, returns a file access template try { @@ -379,13 +380,13 @@ static void test_file_size() // list object to pass in H5File::H5File FileAccPropList fapl(fapl_id); - // Set to sec2 driver. Do we want to test other file drivers? + // Set to sec2 driver. Do we want to test other file drivers? // They're not tested in C++. // File drivers seem not implemented. - // fapl.setSec2(); + // fapl.setSec2(); // Create a file - H5File file4( FILE4, H5F_ACC_TRUNC, FileCreatPropList::DEFAULT, fapl); + H5File file4( FILE4, H5F_ACC_TRUNC, FileCreatPropList::DEFAULT, fapl); // Get file size hsize_t file_size = file4.getFileSize(); @@ -394,14 +395,14 @@ static void test_file_size() if (file_size < 1*KB || file_size > 4*KB) issue_fail_msg("test_file_size()", __LINE__, __FILE__, "getFileSize() returned unreasonable value"); - // Get the amount of free space in the file - hssize_t free_space = file4.getFreeSpace(); + // Get the amount of free space in the file + hssize_t free_space = file4.getFreeSpace(); - // Check if it's reasonable. It's 0 now. - if (free_space < 0 || free_space > 4*KB) - issue_fail_msg("test_file_size()", __LINE__, __FILE__, "getFreeSpace returned unreasonable value"); + // Check if it's reasonable. It's 0 now. + if (free_space < 0 || free_space > 4*KB) + issue_fail_msg("test_file_size()", __LINE__, __FILE__, "getFreeSpace returned unreasonable value"); - PASSED(); + PASSED(); } // end of try block catch (Exception& E) @@ -410,7 +411,9 @@ static void test_file_size() } // use C test utility routine to close property list. - H5Pclose(fapl_id); + herr_t ret = H5Pclose(fapl_id); + if (ret < 0) + issue_fail_msg("test_file_size()", __LINE__, __FILE__, "H5Pclose failed"); } // test_file_size() @@ -418,25 +421,25 @@ static void test_file_size() /*------------------------------------------------------------------------- * Function: test_file_name * - * Purpose: Test getting file's name. + * Purpose Test getting file's name. * - * Return: None + * Return None * - * Programmer: Binh-Minh Ribler + * Programmer Binh-Minh Ribler * July, 2004 * * Modifications: * *------------------------------------------------------------------------- */ -const int RANK = 2; -const int NX = 4; -const int NY = 5; -const H5std_string GROUPNAME ("group"); -const H5std_string DSETNAME ("dataset"); -const H5std_string DATTRNAME ("dataset attribute"); -const H5std_string FATTRNAME ("file attribute"); -const H5std_string DTYPENAME ("compound"); +const int RANK = 2; +const int NX = 4; +const int NY = 5; +const H5std_string GROUPNAME ("group"); +const H5std_string DSETNAME ("dataset"); +const H5std_string DATTRNAME ("dataset attribute"); +const H5std_string FATTRNAME ("file attribute"); +const H5std_string DTYPENAME ("compound"); // Compound datatype typedef struct s1_t { @@ -452,68 +455,67 @@ static void test_file_name() H5std_string file_name; try { // Create a file using default properties. - H5File file4(FILE4, H5F_ACC_TRUNC); + H5File file4(FILE4, H5F_ACC_TRUNC); // Get file name from the file instance. file_name = file4.getFileName(); - verify_val(file_name, FILE4, "H5File::getFileName", __LINE__, __FILE__); + verify_val(file_name, FILE4, "H5File::getFileName", __LINE__, __FILE__); - // Create a group in the root group. - Group group(file4.createGroup(GROUPNAME, 0)); + // Create a group in the root group. + Group group(file4.createGroup(GROUPNAME, 0)); - // Get and verify file name via a group. - file_name = group.getFileName(); - verify_val(file_name, FILE4, "Group::getFileName", __LINE__, __FILE__); + // Get and verify file name via a group. + file_name = group.getFileName(); + verify_val(file_name, FILE4, "Group::getFileName", __LINE__, __FILE__); - // Create the data space. - hsize_t dims[RANK] = {NX, NY}; - DataSpace space(RANK, dims); + // Create the data space. + hsize_t dims[RANK] = {NX, NY}; + DataSpace space(RANK, dims); - // Create a new dataset. - DataSet dataset(file4.createDataSet (DSETNAME, PredType::NATIVE_INT, space)); + // Create a new dataset. + DataSet dataset(file4.createDataSet (DSETNAME, PredType::NATIVE_INT, space)); - // Get and verify file name via a dataset. - file_name = dataset.getFileName(); - verify_val(file_name, FILE4, "DataSet::getFileName", __LINE__, __FILE__); + // Get and verify file name via a dataset. + file_name = dataset.getFileName(); + verify_val(file_name, FILE4, "DataSet::getFileName", __LINE__, __FILE__); - // Create an attribute for the dataset. - Attribute attr(dataset.createAttribute(DATTRNAME, PredType::NATIVE_INT, space)); + // Create an attribute for the dataset. + Attribute attr(dataset.createAttribute(DATTRNAME, PredType::NATIVE_INT, space)); - // Get and verify file name via an attribute. - file_name = attr.getFileName(); - verify_val(file_name, FILE4, "Attribute::getFileName", __LINE__, __FILE__); + // Get and verify file name via an attribute. + file_name = attr.getFileName(); + verify_val(file_name, FILE4, "Attribute::getFileName", __LINE__, __FILE__); - // Create a compound datatype. - CompType comp_type (sizeof(s1_t)); + // Create a compound datatype. + CompType comp_type (sizeof(s1_t)); - // Insert fields. - comp_type.insertMember("a", HOFFSET(s1_t, a), PredType::NATIVE_INT); - comp_type.insertMember("b", HOFFSET(s1_t, b), PredType::NATIVE_FLOAT); + // Insert fields. + comp_type.insertMember("a", HOFFSET(s1_t, a), PredType::NATIVE_INT); + comp_type.insertMember("b", HOFFSET(s1_t, b), PredType::NATIVE_FLOAT); - // Save it on file. - comp_type.commit(file4, DTYPENAME); + // Save it on file. + comp_type.commit(file4, DTYPENAME); - // Get and verify file name via a committed datatype. - comp_type.getFileName(); - verify_val(file_name, FILE4, "CompType::getFileName", __LINE__, __FILE__); - PASSED(); + // Get and verify file name via a committed datatype. + comp_type.getFileName(); + verify_val(file_name, FILE4, "CompType::getFileName", __LINE__, __FILE__); + PASSED(); } // end of try block catch (Exception& E) { issue_fail_msg("test_file_name()", __LINE__, __FILE__, E.getCDetailMsg()); } - } // test_file_name() -const int RANK1 = 1; -const int ATTR1_DIM1 = 3; -const H5std_string FILE5("tfattrs.h5"); -const H5std_string FATTR1_NAME ("file attribute 1"); -const H5std_string FATTR2_NAME ("file attribute 2"); -int fattr_data[ATTR1_DIM1]={512,-234,98123}; /* Test data for file attribute */ -int dattr_data[ATTR1_DIM1]={256,-123,1000}; /* Test data for dataset attribute */ +const int RANK1 = 1; +const int ATTR1_DIM1 = 3; +const H5std_string FILE5("tfattrs.h5"); +const H5std_string FATTR1_NAME ("file attribute 1"); +const H5std_string FATTR2_NAME ("file attribute 2"); +int fattr_data[ATTR1_DIM1]={512,-234,98123}; // Test data for file attribute +int dattr_data[ATTR1_DIM1]={256,-123,1000}; // Test data for dataset attribute static void test_file_attribute() { @@ -526,89 +528,89 @@ static void test_file_attribute() H5std_string file_name; try { // Create a file using default properties. - H5File file5(FILE5, H5F_ACC_TRUNC); + H5File file5(FILE5, H5F_ACC_TRUNC); - // Create the data space - hsize_t dims[RANK1] = {ATTR1_DIM1}; - DataSpace space(RANK1, dims); + // Create the data space + hsize_t dims[RANK1] = {ATTR1_DIM1}; + DataSpace space(RANK1, dims); - // Create two attributes for the file - Attribute fattr1(file5.createAttribute(FATTR1_NAME, PredType::NATIVE_FLOAT, space)); - Attribute fattr2(file5.createAttribute(FATTR2_NAME, PredType::NATIVE_INT, space)); + // Create two attributes for the file + Attribute fattr1(file5.createAttribute(FATTR1_NAME, PredType::NATIVE_FLOAT, space)); + Attribute fattr2(file5.createAttribute(FATTR2_NAME, PredType::NATIVE_INT, space)); - fattr2.write(PredType::NATIVE_INT, fattr_data); + fattr2.write(PredType::NATIVE_INT, fattr_data); - try { - // Try to create the same attribute again (should fail) - Attribute fattr_dup(file5.createAttribute(FATTR2_NAME, PredType::NATIVE_INT, space)); - // Should FAIL but didn't, so throw an invalid action exception - throw InvalidActionException("H5File createAttribute", "Attempted to create an existing attribute."); - } - catch (AttributeIException& E) // catch creating existing attribute - {} // do nothing, FAIL expected + try { + // Try to create the same attribute again (should fail) + Attribute fattr_dup(file5.createAttribute(FATTR2_NAME, PredType::NATIVE_INT, space)); + // Should FAIL but didn't, so throw an invalid action exception + throw InvalidActionException("H5File createAttribute", "Attempted to create an existing attribute."); + } + catch (AttributeIException& E) // catch creating existing attribute + {} // do nothing, FAIL expected - // Create a new dataset - DataSet dataset(file5.createDataSet (DSETNAME, PredType::NATIVE_INT, space)); + // Create a new dataset + DataSet dataset(file5.createDataSet (DSETNAME, PredType::NATIVE_INT, space)); - // Create an attribute for the dataset - Attribute dattr(dataset.createAttribute(DATTRNAME, PredType::NATIVE_INT, space)); + // Create an attribute for the dataset + Attribute dattr(dataset.createAttribute(DATTRNAME, PredType::NATIVE_INT, space)); - // Write data to the second file attribute - dattr.write(PredType::NATIVE_INT, dattr_data); + // Write data to the second file attribute + dattr.write(PredType::NATIVE_INT, dattr_data); - // Test flushing out the data from the attribute object + // Test flushing out the data from the attribute object dattr.flush(H5F_SCOPE_GLOBAL); - // Get and verify the number of all objects in the file - // Current: 1 file, 2 file attr, 1 ds, and 1 ds attr. - ssize_t num_objs = file5.getObjCount(H5F_OBJ_ALL); - verify_val(num_objs, 5, "H5File::getObjCount", __LINE__, __FILE__); - - num_objs = file5.getObjCount(H5F_OBJ_GROUP); - verify_val(num_objs, 0, "H5File::getObjCount(H5F_OBJ_GROUP)", __LINE__, __FILE__); - num_objs = file5.getObjCount(H5F_OBJ_DATASET); - verify_val(num_objs, 1, "H5File::getObjCount(H5F_OBJ_DATASET)", __LINE__, __FILE__); - num_objs = file5.getObjCount(H5F_OBJ_ATTR); - verify_val(num_objs, 3, "H5File::getObjCount(H5F_OBJ_ATTR)", __LINE__, __FILE__); - num_objs = file5.getObjCount(H5F_OBJ_DATATYPE); - verify_val(num_objs, 0, "H5File::getObjCount(H5F_OBJ_DATATYPE)", __LINE__, __FILE__); - num_objs = file5.getObjCount(H5F_OBJ_FILE); - verify_val(num_objs, 1, "H5File::getObjCount(H5F_OBJ_FILE)", __LINE__, __FILE__); - - // Get the file name using the attributes - H5std_string fname = fattr1.getFileName(); - verify_val(fname, FILE5, "H5File::getFileName()", __LINE__, __FILE__); - - fname.clear(); - fname = dattr.getFileName(); - verify_val(fname, FILE5, "H5File::getFileName()", __LINE__, __FILE__); - - // Get the class of a file attribute's datatype - H5T_class_t atclass = fattr1.getTypeClass(); - verify_val(atclass, H5T_FLOAT, "Attribute::getTypeClass()", __LINE__, __FILE__); - - // Get and verify the number of attributes attached to a file - int n_attrs = file5.getNumAttrs(); - verify_val(n_attrs, 2, "H5File::getNumAttrs()", __LINE__, __FILE__); - - // Get and verify the number of attributes attached to a dataset - n_attrs = 0; - n_attrs = dataset.getNumAttrs(); - verify_val(n_attrs, 1, "DataSet::getNumAttrs()", __LINE__, __FILE__); - - // Read back attribute's data - HDmemset(rdata, 0, sizeof(rdata)); + // Get and verify the number of all objects in the file + // Current: 1 file, 2 file attr, 1 ds, and 1 ds attr. + ssize_t num_objs = file5.getObjCount(H5F_OBJ_ALL); + verify_val(num_objs, 5, "H5File::getObjCount", __LINE__, __FILE__); + + num_objs = file5.getObjCount(H5F_OBJ_GROUP); + verify_val(num_objs, 0, "H5File::getObjCount(H5F_OBJ_GROUP)", __LINE__, __FILE__); + num_objs = file5.getObjCount(H5F_OBJ_DATASET); + verify_val(num_objs, 1, "H5File::getObjCount(H5F_OBJ_DATASET)", __LINE__, __FILE__); + num_objs = file5.getObjCount(H5F_OBJ_ATTR); + verify_val(num_objs, 3, "H5File::getObjCount(H5F_OBJ_ATTR)", __LINE__, __FILE__); + num_objs = file5.getObjCount(H5F_OBJ_DATATYPE); + verify_val(num_objs, 0, "H5File::getObjCount(H5F_OBJ_DATATYPE)", __LINE__, __FILE__); + num_objs = file5.getObjCount(H5F_OBJ_FILE); + verify_val(num_objs, 1, "H5File::getObjCount(H5F_OBJ_FILE)", __LINE__, __FILE__); + + // Get the file name using the attributes + H5std_string fname = fattr1.getFileName(); + verify_val(fname, FILE5, "H5File::getFileName()", __LINE__, __FILE__); + + fname.clear(); + fname = dattr.getFileName(); + verify_val(fname, FILE5, "H5File::getFileName()", __LINE__, __FILE__); + + // Get the class of a file attribute's datatype + H5T_class_t atclass = fattr1.getTypeClass(); + verify_val(atclass, H5T_FLOAT, "Attribute::getTypeClass()", __LINE__, __FILE__); + + // Get and verify the number of attributes attached to a file + int n_attrs = file5.getNumAttrs(); + verify_val(n_attrs, 2, "H5File::getNumAttrs()", __LINE__, __FILE__); + + // Get and verify the number of attributes attached to a dataset + n_attrs = 0; + n_attrs = dataset.getNumAttrs(); + verify_val(n_attrs, 1, "DataSet::getNumAttrs()", __LINE__, __FILE__); + + // Read back attribute's data + HDmemset(rdata, 0, sizeof(rdata)); dattr.read(PredType::NATIVE_INT, rdata); /* Check results */ for (i = 0; i < ATTR1_DIM1; i++) { if (rdata[i] != dattr_data[i]) { H5_FAILED(); - cerr << endl; + cerr << endl; cerr << "element [" << i << "] is " << rdata[i] << - "but should have been " << dattr_data[i] << endl; + "but should have been " << dattr_data[i] << endl; } } - PASSED(); + PASSED(); } // end of try block catch (Exception& E) @@ -616,29 +618,30 @@ static void test_file_attribute() issue_fail_msg("test_file_attribute()", __LINE__, __FILE__, E.getCDetailMsg()); } } // test_file_attribute() + -const H5std_string FILE6("tfile5.h5"); -const H5std_string ROOTGROUP("/"); -const H5std_string GROUP1("/G1"); -const H5std_string SUBGROUP3("/G1/G3"); +const H5std_string FILE6("tfile5.h5"); +const H5std_string ROOTGROUP("/"); +const H5std_string GROUP1("/G1"); +const H5std_string SUBGROUP3("/G1/G3"); /*------------------------------------------------------------------------- - * Function: test_libver_bounds_real + * Function: test_libver_bounds_real * - * Purpose: Verify that a file created and modified with the - * specified libver bounds has the specified object header - * versions for the right objects. + * Purpose Verify that a file created and modified with the + * specified libver bounds has the specified object header + * versions for the right objects. * - * Return: None + * Return None * - * Programmer: Binh-Minh Ribler (use C version) - * March, 2015 + * Programmer Binh-Minh Ribler (use C version) + * March, 2015 * *------------------------------------------------------------------------- */ static void test_libver_bounds_real( - H5F_libver_t libver_create, unsigned oh_vers_create, - H5F_libver_t libver_mod, unsigned oh_vers_mod) + H5F_libver_t libver_create, unsigned oh_vers_create, + H5F_libver_t libver_mod, unsigned oh_vers_mod) { try { @@ -710,12 +713,12 @@ static void test_libver_bounds_real( * * Function: test_libver_bounds * - * Purpose: Verify that a file created and modified with various - * libver bounds is handled correctly. + * Purpose Verify that a file created and modified with various + * libver bounds is handled correctly. * - * Return: None + * Return None * - * Programmer: Binh-Minh Ribler (use C version) + * Programmer Binh-Minh Ribler (use C version) * March 2015 * *------------------------------------------------------------------------- @@ -732,16 +735,14 @@ static void test_libver_bounds() } /* end test_libver_bounds() */ /*------------------------------------------------------------------------- - * Function: test_commonfg + * Function: test_commonfg * - * Purpose: Verify that a file created and modified with the - * specified libver bounds has the specified object header - * versions for the right objects. + * Purpose Verify that H5File works as a root group. * - * Return: None + * Return None * - * Programmer: Binh-Minh Ribler (use C version) - * March, 2015 + * Programmer Binh-Minh Ribler (use C version) + * March, 2015 * *------------------------------------------------------------------------- */ @@ -752,40 +753,40 @@ static void test_commonfg() try { // Create a file using default properties. - H5File file4(FILE4, H5F_ACC_TRUNC); + H5File file4(FILE4, H5F_ACC_TRUNC); - // Try opening the root group. - Group rootgroup(file4.openGroup(ROOTGROUP)); + // Try opening the root group. + Group rootgroup(file4.openGroup(ROOTGROUP)); - // Create a group in the root group. - Group group(rootgroup.createGroup(GROUPNAME, 0)); + // Create a group in the root group. + Group group(rootgroup.createGroup(GROUPNAME, 0)); - // Create the data space. - hsize_t dims[RANK] = {NX, NY}; - DataSpace space(RANK, dims); + // Create the data space. + hsize_t dims[RANK] = {NX, NY}; + DataSpace space(RANK, dims); - // Create a new dataset. - DataSet dataset(group.createDataSet (DSETNAME, PredType::NATIVE_INT, space)); + // Create a new dataset. + DataSet dataset(group.createDataSet (DSETNAME, PredType::NATIVE_INT, space)); - // Get and verify file name via a dataset. - H5std_string file_name = dataset.getFileName(); - verify_val(file_name, FILE4, "DataSet::getFileName", __LINE__, __FILE__); + // Get and verify file name via a dataset. + H5std_string file_name = dataset.getFileName(); + verify_val(file_name, FILE4, "DataSet::getFileName", __LINE__, __FILE__); - // Create an attribute for the dataset. - Attribute attr(dataset.createAttribute(DATTRNAME, PredType::NATIVE_INT, space)); + // Create an attribute for the dataset. + Attribute attr(dataset.createAttribute(DATTRNAME, PredType::NATIVE_INT, space)); - // Get and verify file name via an attribute. - file_name = attr.getFileName(); - verify_val(file_name, FILE4, "Attribute::getFileName", __LINE__, __FILE__); + // Get and verify file name via an attribute. + file_name = attr.getFileName(); + verify_val(file_name, FILE4, "Attribute::getFileName", __LINE__, __FILE__); - // Create an attribute for the file via root group. - Attribute rootg_attr(rootgroup.createAttribute(FATTRNAME, PredType::NATIVE_INT, space)); + // Create an attribute for the file via root group. + Attribute rootg_attr(rootgroup.createAttribute(FATTRNAME, PredType::NATIVE_INT, space)); - // Get and verify file name via an attribute. - file_name = attr.getFileName(); - verify_val(file_name, FILE4, "Attribute::getFileName", __LINE__, __FILE__); + // Get and verify file name via an attribute. + file_name = attr.getFileName(); + verify_val(file_name, FILE4, "Attribute::getFileName", __LINE__, __FILE__); - PASSED(); + PASSED(); } // end of try block catch (Exception& E) @@ -795,14 +796,133 @@ static void test_commonfg() } /* end test_commonfg() */ +const H5std_string FILE7("tfile7.h5"); + +/*------------------------------------------------------------------------- + * Function: test_file_info + * + * Purpose Verify that various properties in a file creation property + * lists are stored correctly in the file and can be retrieved + * when the file is re-opened. + * + * Return None + * + * Programmer Binh-Minh Ribler + * February, 2017 + * + *------------------------------------------------------------------------- + */ +static void test_file_info() +{ + // Output message about test being performed + SUBTEST("File general information"); + + hsize_t in_threshold = 2; // Free space section threshold to set */ + hsize_t out_threshold = 0; // Free space section threshold to get */ + // File space handling strategy + H5F_file_space_type_t in_strategy = H5F_FILE_SPACE_ALL; + // File space handling strategy + H5F_file_space_type_t out_strategy = H5F_FILE_SPACE_DEFAULT; + + try { + // Create a file using default properties. + H5File tempfile(FILE7, H5F_ACC_TRUNC); + + // Get the file's version information. + H5F_info2_t finfo; + tempfile.getFileInfo(finfo); + verify_val(finfo.super.version, 0, "H5File::getFileInfo", __LINE__, __FILE__); + verify_val(finfo.free.version, 0, "H5File::getFileInfo", __LINE__, __FILE__); + verify_val(finfo.sohm.version, 0, "H5File::getFileInfo", __LINE__, __FILE__); + + // Close the file. + tempfile.close(); + + // Create file creation property list. + FileCreatPropList fcpl; + + // Set various file information. + fcpl.setUserblock(F2_USERBLOCK_SIZE); + fcpl.setSizes(F2_OFFSET_SIZE, F2_LENGTH_SIZE); + fcpl.setSymk(F2_SYM_INTERN_K, F2_SYM_LEAF_K); + fcpl.setIstorek(F2_ISTORE); + fcpl.setFileSpace(in_strategy, in_threshold); + + // Creating a file with the non-default file creation property list + // should create a version 1 superblock + + // Create file with custom file creation property list. + H5File file7(FILE7, H5F_ACC_TRUNC, fcpl); + + // Close the file creation property list. + fcpl.close(); + + // Get the file's version information. + file7.getFileInfo(finfo); + verify_val(finfo.super.version, 2, "H5File::getFileInfo", __LINE__, __FILE__); + verify_val(finfo.free.version, 0, "H5File::getFileInfo", __LINE__, __FILE__); + verify_val(finfo.sohm.version, 0, "H5File::getFileInfo", __LINE__, __FILE__); + + // Close the file. + file7.close(); + + // Re-open the file. + file7.openFile(FILE7, H5F_ACC_RDONLY); + + // Get the file's creation property list. + FileCreatPropList fcpl2 = file7.getCreatePlist(); + + // Get the file's version information. + file7.getFileInfo(finfo); + verify_val(finfo.super.version, 2, "H5File::getFileInfo", __LINE__, __FILE__); + verify_val(finfo.free.version, 0, "H5File::getFileInfo", __LINE__, __FILE__); + verify_val(finfo.sohm.version, 0, "H5File::getFileInfo", __LINE__, __FILE__); + + // Retrieve the property values & check them. + hsize_t userblock = fcpl2.getUserblock(); + verify_val(userblock, F2_USERBLOCK_SIZE, "FileCreatPropList::getUserblock", __LINE__, __FILE__); + + size_t off_size = 0, len_size = 0; + fcpl2.getSizes(off_size, len_size); + verify_val(off_size, F2_OFFSET_SIZE, "FileCreatPropList::getSizes", __LINE__, __FILE__); + verify_val(len_size, F2_LENGTH_SIZE, "FileCreatPropList::getSizes", __LINE__, __FILE__); + + unsigned sym_ik = 0, sym_lk = 0; + fcpl2.getSymk(sym_ik, sym_lk); + verify_val(sym_ik, F2_SYM_INTERN_K, "FileCreatPropList::getSymk", __LINE__, __FILE__); + verify_val(sym_lk, F2_SYM_LEAF_K, "FileCreatPropList::getSymk", __LINE__, __FILE__); + + unsigned istore_ik = fcpl2.getIstorek(); + verify_val(istore_ik, F2_ISTORE, "FileCreatPropList::getIstorek", __LINE__, __FILE__); + + /* ret=H5Pget_shared_mesg_nindexes(fcpl2,&nindexes); + CHECK(ret, FAIL, "H5Pget_shared_mesg_nindexes"); + VERIFY(nindexes, MISC11_NINDEXES, "H5Pget_shared_mesg_nindexes"); + */ + + // Get and verify the file space info from the creation property list */ + out_strategy = fcpl2.getFileSpaceStrategy(); + verify_val(static_cast(out_strategy), static_cast(in_strategy), "FileCreatPropList::getFileSpaceStrategy", __LINE__, __FILE__); + + out_threshold = fcpl2.getFileSpaceThreshold(); + verify_val(static_cast(out_threshold), static_cast(in_threshold), "FileCreatPropList::getFileSpaceThreshold", __LINE__, __FILE__); + + PASSED(); + } // end of try block + catch (Exception& E) + { + issue_fail_msg("test_filespace_info()", __LINE__, __FILE__, E.getCDetailMsg()); + } +} /* test_file_info() */ + /*------------------------------------------------------------------------- * Function: test_file * - * Purpose: Main file testing routine + * Purpose Main file testing routine * - * Return: None + * Return None * - * Programmer: Binh-Minh Ribler (use C version) + * Programmer Binh-Minh Ribler (use C version) * January 2001 * * Modifications: @@ -815,24 +935,25 @@ void test_file() // Output message about test being performed MESSAGE(5, ("Testing File I/O Operations\n")); - test_file_create(); // Test file creation (also creation templates) - test_file_open(); // Test file opening - test_file_size(); // Test file size - test_file_name(); // Test getting file's name - test_file_attribute(); // Test file attribute feature - test_libver_bounds(); // Test format version - test_commonfg(); + test_file_create(); // Test file creation (also creation templates) + test_file_open(); // Test file opening + test_file_size(); // Test file size + test_file_name(); // Test getting file's name + test_file_attribute(); // Test file attribute feature + test_libver_bounds(); // Test format version + test_commonfg(); // Test H5File as a root group + test_file_info(); // Test various file info } // test_file() /*------------------------------------------------------------------------- - * Function: cleanup_file + * Function: cleanup_file * - * Purpose: Cleanup temporary test files + * Purpose Cleanup temporary test files * - * Return: none + * Return none * - * Programmer: (use C version) + * Programmer (use C version) * * Modifications: * @@ -846,7 +967,8 @@ void cleanup_file() HDremove(FILE1.c_str()); HDremove(FILE2.c_str()); HDremove(FILE3.c_str()); -// HDremove(FILE4.c_str()); + HDremove(FILE4.c_str()); HDremove(FILE5.c_str()); HDremove(FILE6.c_str()); + HDremove(FILE7.c_str()); } // cleanup_file diff --git a/c++/test/tfilter.cpp b/c++/test/tfilter.cpp index ee78fe1..19f5b5a 100644 --- a/c++/test/tfilter.cpp +++ b/c++/test/tfilter.cpp @@ -33,15 +33,15 @@ using namespace H5; #include "h5test.h" #include "h5cpputil.h" // C++ utilility header file -#define DSET_DIM1 100 -#define DSET_DIM2 200 +#define DSET_DIM1 100 +#define DSET_DIM2 200 #define FILTER_CHUNK_DIM1 2 #define FILTER_CHUNK_DIM2 25 // will do this function later or use it as guideline - BMR - 2007/01/26 #if 0 static herr_t test_filter_internal(hid_t fid, const char *name, hid_t dcpl, - int if_fletcher32, int corrupted, hsize_t *dset_size) + int if_fletcher32, int corrupted, hsize_t *dset_size) { cerr << "do nothing right now" << endl; return(0); @@ -58,25 +58,25 @@ static size_t filter_bogus(unsigned int flags, size_t cd_nelmts, static size_t filter_bogus(size_t nbytes); /* This message derives from H5Z */ const H5Z_class2_t H5Z_BOGUS[1] = {{ - H5Z_CLASS_T_VERS, /* H5Z_class_t version */ - H5Z_FILTER_BOGUS, /* Filter id number */ - 1, 1, /* Encoding and decoding enabled */ - "bogus", /* Filter name for debugging */ - NULL, /* The "can apply" callback */ - NULL, /* The "set local" callback */ + H5Z_CLASS_T_VERS, /* H5Z_class_t version */ + H5Z_FILTER_BOGUS, /* Filter id number */ + 1, 1, /* Encoding and decoding enabled */ + "bogus", /* Filter name for debugging */ + NULL, /* The "can apply" callback */ + NULL, /* The "set local" callback */ (H5Z_func_t)filter_bogus, /* The actual filter function */ }}; /*------------------------------------------------------------------------- * Function: filter_bogus * - * Purpose: A bogus compression method that doesn't do anything. + * Purpose A bogus compression method that doesn't do anything. * - * Return: Success: Data chunk size + * Return Success: Data chunk size * - * Failure: 0 + * Failure: 0 * - * Programmer: Robb Matzke + * Programmer Robb Matzke * Tuesday, April 21, 1998 * * Modifications: @@ -95,17 +95,17 @@ filter_bogus(size_t nbytes) } /*------------------------------------------------------------------------- - * Function: test_null_filter + * Function: test_null_filter * - * Purpose: Test null I/O filter by itself. + * Purpose Test null I/O filter by itself. * - * Return: None + * Return None * - * Programmer: Binh-Minh Ribler (use C version, from dsets.c/test_filters) - * January, 2007 + * Programmer Binh-Minh Ribler (use C version, from dsets.c/test_filters) + * January, 2007 * * Modifications: - * Note: H5Z interface is not implemented yet. + * Note: H5Z interface is not implemented yet. * *------------------------------------------------------------------------- */ @@ -118,25 +118,25 @@ static void test_null_filter() // Output message about test being performed SUBTEST("'Null' filter"); try { - //hsize_t null_size; // Size of dataset with null filter + //hsize_t null_size; // Size of dataset with null filter - // Prepare dataset create property list - DSetCreatPropList dsplist; - dsplist.setChunk(2, chunk_size); + // Prepare dataset create property list + DSetCreatPropList dsplist; + dsplist.setChunk(2, chunk_size); - if (H5Zregister (H5Z_BOGUS)<0) + if (H5Zregister (H5Z_BOGUS)<0) throw Exception("test_null_filter", "H5Zregister failed"); - // Set some pretent filter - dsplist.setFilter(H5Z_FILTER_BOGUS); + // Set some pretent filter + dsplist.setFilter(H5Z_FILTER_BOGUS); - // this function is just a stub right now; will work on it later - BMR - //if(test_filter_internal(file,DSET_BOGUS_NAME,dc,DISABLE_FLETCHER32,DATA_NOT_CORRUPTED,&null_size)<0) + // this function is just a stub right now; will work on it later - BMR + //if(test_filter_internal(file,DSET_BOGUS_NAME,dc,DISABLE_FLETCHER32,DATA_NOT_CORRUPTED,&null_size)<0) // throw Exception("test_null_filter", "test_filter_internal failed"); - // Close objects. - dsplist.close(); - PASSED(); + // Close objects. + dsplist.close(); + PASSED(); } // end of try // catch all other exceptions @@ -147,17 +147,17 @@ static void test_null_filter() } // test_null_filter /*------------------------------------------------------------------------- - * Function: test_szip_filter + * Function: test_szip_filter * - * Purpose: Test SZIP filter by itself. + * Purpose Test SZIP filter by itself. * - * Return: None + * Return None * - * Programmer: Binh-Minh Ribler (partly from dsets.c/test_filters) - * January, 2007 + * Programmer Binh-Minh Ribler (partly from dsets.c/test_filters) + * January, 2007 * * Modifications: - * Note: H5Z interface is not implemented yet. + * Note: H5Z interface is not implemented yet. * *------------------------------------------------------------------------- */ @@ -232,7 +232,7 @@ static void test_szip_filter(H5File& file1) delete[] tconv_buf; } // if szip presents else { - SKIPPED(); + SKIPPED(); } #else /* H5_HAVE_FILTER_SZIP */ @@ -266,9 +266,9 @@ void test_filters() H5File file1(FILE1, H5F_ACC_TRUNC, FileCreatPropList::DEFAULT, fapl); - // Test basic VL string datatype - test_null_filter(); - test_szip_filter(file1); + // Test basic VL string datatype + test_null_filter(); + test_szip_filter(file1); } catch (Exception& E) { @@ -277,13 +277,13 @@ void test_filters() } // test_filters() /*------------------------------------------------------------------------- - * Function: cleanup_filters + * Function: cleanup_filters * - * Purpose: Cleanup temporary test files + * Purpose Cleanup temporary test files * - * Return: none + * Return none * - * Programmer: Quincey Koziol + * Programmer Quincey Koziol * September 10, 1999 * * Modifications: diff --git a/c++/test/th5s.cpp b/c++/test/th5s.cpp index c795c08..a3aafb3 100644 --- a/c++/test/th5s.cpp +++ b/c++/test/th5s.cpp @@ -35,7 +35,7 @@ using namespace H5; #include "h5test.h" #include "h5cpputil.h" // C++ utilility header file -#include "H5srcdir.h" // srcdir querying header file +#include "H5srcdir.h" // srcdir querying header file const H5std_string TESTFILE("th5s.h5"); const H5std_string DATAFILE("th5s1.h5"); @@ -86,124 +86,123 @@ int space5_data = 7; /*------------------------------------------------------------------------- * - * Function: test_h5s_basic + * Function: test_h5s_basic * - * Purpose: Test basic H5S (dataspace) code + * Purpose Test basic H5S (dataspace) code * - * Return: none + * Return none * - * Programmer: Binh-Minh Ribler (using C version) + * Programmer Binh-Minh Ribler (using C version) * Mar 2001 * * Modifications: * January, 2005: C tests' macro VERIFY casts values to 'long' for all - * cases. Since there are no operator<< for 'long long' - * or int64 in VS C++ ostream, I casted the hssize_t values - * passed to verify_val to 'long' as well. If problems - * arises later, this will have to be specificly handled - * with a special routine. + * cases. Since there are no operator<< for 'long long' + * or int64 in VS C++ ostream, I casted the hssize_t values + * passed to verify_val to 'long' as well. If problems + * arises later, this will have to be specificly handled + * with a special routine. * April 12, 2011: Raymond Lu - * Starting from the 1.8.7 release, we allow dimension - * size to be zero. So I took out the test against it. + * Starting from the 1.8.7 release, we allow dimension + * size to be zero. So I took out the test against it. *------------------------------------------------------------------------- */ static void test_h5s_basic() { - hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3}; - hsize_t dims2[] = {SPACE2_DIM1, SPACE2_DIM2, SPACE2_DIM3, - SPACE2_DIM4}; - hsize_t dims3[H5S_MAX_RANK+1]; - hsize_t tmax[4]; + hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3}; + hsize_t dims2[] = {SPACE2_DIM1, SPACE2_DIM2, SPACE2_DIM3, SPACE2_DIM4}; + hsize_t dims3[H5S_MAX_RANK+1]; + hsize_t tmax[4]; // Output message about test being performed SUBTEST("Dataspace Manipulation"); try { - // Create simple dataspace sid1 - DataSpace sid1 (SPACE1_RANK, dims1 ); - - // Get simple extent npoints of the dataspace sid1 and verify it - hssize_t n; // Number of dataspace elements - n = sid1.getSimpleExtentNpoints(); - verify_val((long)n, (long)(SPACE1_DIM1 * SPACE1_DIM2 * SPACE1_DIM3), - "DataSpace::getSimpleExtentNpoints", __LINE__, __FILE__); - - // Get the logical rank of dataspace sid1 and verify it - int rank; // Logical rank of dataspace - rank = sid1.getSimpleExtentNdims(); - verify_val(rank, SPACE1_RANK, "DataSpace::getSimpleExtentNdims", __LINE__, __FILE__); - - // Retrieves dimension size of dataspace sid1 and verify it - int ndims; // Number of dimensions - hsize_t tdims[4]; // Dimension array to test with - ndims = sid1.getSimpleExtentDims( tdims ); - verify_val(ndims, SPACE1_RANK, "DataSpace::getSimpleExtentDims", __LINE__, __FILE__); - verify_val(HDmemcmp(tdims, dims1, SPACE1_RANK * sizeof(unsigned)), 0, - "DataSpace::getSimpleExtentDims", __LINE__, __FILE__); - - // Create simple dataspace sid2 - hsize_t max2[] = {SPACE2_MAX1, SPACE2_MAX2, SPACE2_MAX3, SPACE2_MAX4}; - DataSpace sid2 (SPACE2_RANK, dims2, max2); - - // Get simple extent npoints of dataspace sid2 and verify it - n = sid2.getSimpleExtentNpoints(); - verify_val((long)n, (long)(SPACE2_DIM1 * SPACE2_DIM2 * SPACE2_DIM3 * SPACE2_DIM4), - "DataSpace::getSimpleExtentNpoints", __LINE__, __FILE__); - - // Get the logical rank of dataspace sid2 and verify it - rank = sid2.getSimpleExtentNdims(); - verify_val(rank, SPACE2_RANK, "DataSpace::getSimpleExtentNdims", __LINE__, __FILE__); - - // Retrieves dimension size and max size of dataspace sid2 and - // verify them - ndims = sid2.getSimpleExtentDims( tdims, tmax ); - verify_val(HDmemcmp(tdims, dims2, SPACE2_RANK * sizeof(unsigned)), 0, - "DataSpace::getSimpleExtentDims", __LINE__, __FILE__); - verify_val(HDmemcmp(tmax, max2, SPACE2_RANK * sizeof(unsigned)), 0, - "DataSpace::getSimpleExtentDims", __LINE__, __FILE__); - - // Check to be sure we can't create a simple data space that has too - // many dimensions. - try { - DataSpace manydims_ds(H5S_MAX_RANK+1, dims3, NULL); - - // Should FAIL but didn't, so throw an invalid action exception - throw InvalidActionException("DataSpace constructor", "Library allowed overwrite of existing dataset"); - } - catch (DataSpaceIException& E) // Simple data space with too many dims - {} // do nothing, exception expected + // Create simple dataspace sid1 + DataSpace sid1 (SPACE1_RANK, dims1 ); + + // Get simple extent npoints of the dataspace sid1 and verify it + hssize_t n; // Number of dataspace elements + n = sid1.getSimpleExtentNpoints(); + verify_val((long)n, (long)(SPACE1_DIM1 * SPACE1_DIM2 * SPACE1_DIM3), + "DataSpace::getSimpleExtentNpoints", __LINE__, __FILE__); + + // Get the logical rank of dataspace sid1 and verify it + int rank; // Logical rank of dataspace + rank = sid1.getSimpleExtentNdims(); + verify_val(rank, SPACE1_RANK, "DataSpace::getSimpleExtentNdims", __LINE__, __FILE__); + + // Retrieves dimension size of dataspace sid1 and verify it + int ndims; // Number of dimensions + hsize_t tdims[4]; // Dimension array to test with + ndims = sid1.getSimpleExtentDims( tdims ); + verify_val(ndims, SPACE1_RANK, "DataSpace::getSimpleExtentDims", __LINE__, __FILE__); + verify_val(HDmemcmp(tdims, dims1, SPACE1_RANK * sizeof(unsigned)), 0, + "DataSpace::getSimpleExtentDims", __LINE__, __FILE__); + + // Create simple dataspace sid2 + hsize_t max2[] = {SPACE2_MAX1, SPACE2_MAX2, SPACE2_MAX3, SPACE2_MAX4}; + DataSpace sid2 (SPACE2_RANK, dims2, max2); + + // Get simple extent npoints of dataspace sid2 and verify it + n = sid2.getSimpleExtentNpoints(); + verify_val((long)n, (long)(SPACE2_DIM1 * SPACE2_DIM2 * SPACE2_DIM3 * SPACE2_DIM4), + "DataSpace::getSimpleExtentNpoints", __LINE__, __FILE__); + + // Get the logical rank of dataspace sid2 and verify it + rank = sid2.getSimpleExtentNdims(); + verify_val(rank, SPACE2_RANK, "DataSpace::getSimpleExtentNdims", __LINE__, __FILE__); + + // Retrieves dimension size and max size of dataspace sid2 and + // verify them + ndims = sid2.getSimpleExtentDims( tdims, tmax ); + verify_val(HDmemcmp(tdims, dims2, SPACE2_RANK * sizeof(unsigned)), 0, + "DataSpace::getSimpleExtentDims", __LINE__, __FILE__); + verify_val(HDmemcmp(tmax, max2, SPACE2_RANK * sizeof(unsigned)), 0, + "DataSpace::getSimpleExtentDims", __LINE__, __FILE__); + + // Check to be sure we can't create a simple data space that has too + // many dimensions. + try { + DataSpace manydims_ds(H5S_MAX_RANK+1, dims3, NULL); + + // Should FAIL but didn't, so throw an invalid action exception + throw InvalidActionException("DataSpace constructor", "Library allowed overwrite of existing dataset"); + } + catch (DataSpaceIException& E) // Simple data space with too many dims + {} // do nothing, exception expected /* - * Try reading a file that has been prepared that has a dataset with a - * higher dimensionality than what the library can handle. - * - * If this test fails and the H5S_MAX_RANK variable has changed, follow - * the instructions in space_overflow.c for regenating the th5s.h5 file. - */ - char *tmp_str = new char[TESTFILE.length()+1]; - strcpy(tmp_str, TESTFILE.c_str()); - const char *testfile = H5_get_srcdir_filename(tmp_str); - delete []tmp_str; - - // Create file - H5File fid1(testfile, H5F_ACC_RDONLY); - - // Try to open the dataset that has higher dimensionality than - // what the library can handle and this operation should fail. - try { - DataSet dset1 = fid1.openDataSet( "dset" ); - - // Should FAIL but didn't, so throw an invalid action exception - throw InvalidActionException("H5File::openDataSet", "Opening a dataset with higher dimensionality than what the library can handle"); - } - catch (FileIException& E) // catching higher dimensionality dataset - {} // do nothing, exception expected + * Try reading a file that has been prepared that has a dataset with a + * higher dimensionality than what the library can handle. + * + * If this test fails and the H5S_MAX_RANK variable has changed, follow + * the instructions in space_overflow.c for regenating the th5s.h5 file. + */ + char *tmp_str = new char[TESTFILE.length()+1]; + strcpy(tmp_str, TESTFILE.c_str()); + const char *testfile = H5_get_srcdir_filename(tmp_str); + delete []tmp_str; + + // Create file + H5File fid1(testfile, H5F_ACC_RDONLY); + + // Try to open the dataset that has higher dimensionality than + // what the library can handle and this operation should fail. + try { + DataSet dset1 = fid1.openDataSet( "dset" ); + + // Should FAIL but didn't, so throw an invalid action exception + throw InvalidActionException("H5File::openDataSet", "Opening a dataset with higher dimensionality than what the library can handle"); + } + catch (FileIException& E) // catching higher dimensionality dataset + {} // do nothing, exception expected // CHECK_I(ret, "H5Fclose"); // leave this here, later, fake a failure - // in the p_close see how this will handle it. - BMR + // in the p_close see how this will handle it. - BMR - PASSED(); - } // end of try block + PASSED(); + } // end of try block catch (InvalidActionException& E) { @@ -219,22 +218,22 @@ static void test_h5s_basic() /*------------------------------------------------------------------------- * - * Function: test_h5s_scalar_write + * Function: test_h5s_scalar_write * - * Purpose: Test scalar H5S (dataspace) writing code + * Purpose Test scalar H5S (dataspace) writing code * - * Return: none + * Return none * - * Programmer: Binh-Minh Ribler (using C version) + * Programmer Binh-Minh Ribler (using C version) * Mar 2001 * * Modifications: * January, 2005: C tests' macro VERIFY casts values to 'long' for all - * cases. Since there are no operator<< for 'long long' - * or int64 in VS C++ ostream, I casted the hssize_t values - * passed to verify_val to 'long' as well. If problems - * arises later, this will have to be specificly handled - * with a special routine. + * cases. Since there are no operator<< for 'long long' + * or int64 in VS C++ ostream, I casted the hssize_t values + * passed to verify_val to 'long' as well. If problems + * arises later, this will have to be specificly handled + * with a special routine. *------------------------------------------------------------------------- */ static void test_h5s_scalar_write() @@ -243,124 +242,124 @@ static void test_h5s_scalar_write() SUBTEST("Scalar Dataspace Writing"); try { - // Create file - H5File fid1(DATAFILE, H5F_ACC_TRUNC); + // Create file + H5File fid1(DATAFILE, H5F_ACC_TRUNC); - // Create scalar dataspace - DataSpace sid1(SPACE3_RANK, NULL); + // Create scalar dataspace + DataSpace sid1(SPACE3_RANK, NULL); - //n = H5Sget_simple_extent_npoints(sid1); - hssize_t n; // Number of dataspace elements - n = sid1.getSimpleExtentNpoints(); - verify_val((long)n, 1, "DataSpace::getSimpleExtentNpoints", __LINE__, __FILE__); + //n = H5Sget_simple_extent_npoints(sid1); + hssize_t n; // Number of dataspace elements + n = sid1.getSimpleExtentNpoints(); + verify_val((long)n, 1, "DataSpace::getSimpleExtentNpoints", __LINE__, __FILE__); - int rank; // Logical rank of dataspace - rank = sid1.getSimpleExtentNdims(); - verify_val(rank, SPACE3_RANK, "DataSpace::getSimpleExtentNdims", __LINE__, __FILE__); + int rank; // Logical rank of dataspace + rank = sid1.getSimpleExtentNdims(); + verify_val(rank, SPACE3_RANK, "DataSpace::getSimpleExtentNdims", __LINE__, __FILE__); - // Retrieves dimension size of dataspace sid1 and verify it - int ndims; // Number of dimensions - hsize_t tdims[4]; // Dimension array to test with - ndims = sid1.getSimpleExtentDims( tdims ); - verify_val(ndims, 0, "DataSpace::getSimpleExtentDims", __LINE__, __FILE__); + // Retrieves dimension size of dataspace sid1 and verify it + int ndims; // Number of dimensions + hsize_t tdims[4]; // Dimension array to test with + ndims = sid1.getSimpleExtentDims( tdims ); + verify_val(ndims, 0, "DataSpace::getSimpleExtentDims", __LINE__, __FILE__); - // Verify extent type - H5S_class_t ext_type; // Extent type - ext_type = sid1.getSimpleExtentType(); - verify_val(ext_type, H5S_SCALAR, "DataSpace::getSimpleExtentType", __LINE__, __FILE__); + // Verify extent type + H5S_class_t ext_type; // Extent type + ext_type = sid1.getSimpleExtentType(); + verify_val(ext_type, H5S_SCALAR, "DataSpace::getSimpleExtentType", __LINE__, __FILE__); - // Create and write a dataset - DataSet dataset = fid1.createDataSet("Dataset1", PredType::NATIVE_UINT,sid1); - dataset.write(&space3_data, PredType::NATIVE_UINT); + // Create and write a dataset + DataSet dataset = fid1.createDataSet("Dataset1", PredType::NATIVE_UINT,sid1); + dataset.write(&space3_data, PredType::NATIVE_UINT); - PASSED(); + PASSED(); } // end of try block catch (Exception& E) { - issue_fail_msg("test_h5s_scalar_write()", __LINE__, __FILE__, E.getCDetailMsg()); + issue_fail_msg("test_h5s_scalar_write()", __LINE__, __FILE__, E.getCDetailMsg()); } } // test_h5s_scalar_write() /*------------------------------------------------------------------------- * - * Function: test_h5s_scalar_read + * Function: test_h5s_scalar_read * - * Purpose: Test scalar H5S (dataspace) reading code + * Purpose Test scalar H5S (dataspace) reading code * - * Return: none + * Return none * - * Programmer: Binh-Minh Ribler (using C version) + * Programmer Binh-Minh Ribler (using C version) * Mar 2001 * * Modifications: * January, 2005: C tests' macro VERIFY casts values to 'long' for all - * cases. Since there are no operator<< for 'long long' - * or int64 in VS C++ ostream, I casted the hssize_t values - * passed to verify_val to 'long' as well. If problems - * arises later, this will have to be specificly handled - * with a special routine. + * cases. Since there are no operator<< for 'long long' + * or int64 in VS C++ ostream, I casted the hssize_t values + * passed to verify_val to 'long' as well. If problems + * arises later, this will have to be specificly handled + * with a special routine. *------------------------------------------------------------------------- */ static void test_h5s_scalar_read() { - hsize_t tdims[4]; // Dimension array to test with + hsize_t tdims[4]; // Dimension array to test with // Output message about test being performed SUBTEST("Scalar Dataspace Reading"); try { - // Open file - H5File fid1(DATAFILE, H5F_ACC_RDWR); + // Open file + H5File fid1(DATAFILE, H5F_ACC_RDWR); - // Create a dataset - DataSet dataset = fid1.openDataSet("Dataset1"); + // Create a dataset + DataSet dataset = fid1.openDataSet("Dataset1"); - DataSpace sid1 = dataset.getSpace(); + DataSpace sid1 = dataset.getSpace(); - // Get the number of dataspace elements - hssize_t n = sid1.getSimpleExtentNpoints(); - verify_val((long)n, 1, "DataSpace::getSimpleExtentNpoints", __LINE__, __FILE__); + // Get the number of dataspace elements + hssize_t n = sid1.getSimpleExtentNpoints(); + verify_val((long)n, 1, "DataSpace::getSimpleExtentNpoints", __LINE__, __FILE__); - // Get the logical rank of the dataspace - int ndims = sid1.getSimpleExtentNdims(); - verify_val(ndims, SPACE3_RANK, "DataSpace::getSimpleExtentNdims", __LINE__, __FILE__); + // Get the logical rank of the dataspace + int ndims = sid1.getSimpleExtentNdims(); + verify_val(ndims, SPACE3_RANK, "DataSpace::getSimpleExtentNdims", __LINE__, __FILE__); - ndims = sid1.getSimpleExtentDims(tdims); - verify_val(ndims, 0, "DataSpace::getSimpleExtentDims", __LINE__, __FILE__); + ndims = sid1.getSimpleExtentDims(tdims); + verify_val(ndims, 0, "DataSpace::getSimpleExtentDims", __LINE__, __FILE__); - // Read data back and verify it - unsigned rdata; // Scalar data read in - dataset.read(&rdata, PredType::NATIVE_UINT); - verify_val(rdata, space3_data, "DataSet::read", __LINE__, __FILE__); + // Read data back and verify it + unsigned rdata; // Scalar data read in + dataset.read(&rdata, PredType::NATIVE_UINT); + verify_val(rdata, space3_data, "DataSet::read", __LINE__, __FILE__); - PASSED(); + PASSED(); } // end of try block catch (Exception& E) { - // all the exceptions caused by negative returned values by C APIs - issue_fail_msg("test_h5s_scalar_read()", __LINE__, __FILE__, E.getCDetailMsg()); + // all the exceptions caused by negative returned values by C APIs + issue_fail_msg("test_h5s_scalar_read()", __LINE__, __FILE__, E.getCDetailMsg()); } } // test_h5s_scalar_read() /*------------------------------------------------------------------------- * - * Function: test_h5s_null + * Function: test_h5s_null * - * Purpose: Test null H5S (dataspace) code + * Purpose Test null H5S (dataspace) code * - * Return: none + * Return none * - * Programmer: Raymond Lu (using C version) + * Programmer Raymond Lu (using C version) * May 18, 2004 * * Modifications: * January, 2005: C tests' macro VERIFY casts values to 'long' for all - * cases. Since there are no operator<< for 'long long' - * or int64 in VS C++ ostream, I casted the hssize_t values - * passed to verify_val to 'long' as well. If problems - * arises later, this will have to be specificly handled - * with a special routine. + * cases. Since there are no operator<< for 'long long' + * or int64 in VS C++ ostream, I casted the hssize_t values + * passed to verify_val to 'long' as well. If problems + * arises later, this will have to be specificly handled + * with a special routine. *------------------------------------------------------------------------- */ static void test_h5s_null() @@ -369,53 +368,53 @@ static void test_h5s_null() SUBTEST("Null Dataspace Writing"); try { - // Create file - H5File fid1(DATAFILE, H5F_ACC_TRUNC); + // Create file + H5File fid1(DATAFILE, H5F_ACC_TRUNC); - // Create scalar dataspace - DataSpace sid1(H5S_NULL); + // Create scalar dataspace + DataSpace sid1(H5S_NULL); - hssize_t n; // Number of dataspace elements - n = sid1.getSimpleExtentNpoints(); - verify_val((long)n, 0, "DataSpace::getSimpleExtentNpoints", __LINE__, __FILE__); + hssize_t n; // Number of dataspace elements + n = sid1.getSimpleExtentNpoints(); + verify_val((long)n, 0, "DataSpace::getSimpleExtentNpoints", __LINE__, __FILE__); - // Create a dataset - DataSet dataset = fid1.createDataSet("Dataset1", PredType::NATIVE_UINT,sid1); + // Create a dataset + DataSet dataset = fid1.createDataSet("Dataset1", PredType::NATIVE_UINT,sid1); // Try to write nothing to the dataset - dataset.write(&space5_data, PredType::NATIVE_INT); + dataset.write(&space5_data, PredType::NATIVE_INT); // Read the data. Make sure no change to the buffer - dataset.read(&space5_data, PredType::NATIVE_INT); - verify_val(space5_data, 7, "DataSet::read", __LINE__, __FILE__); + dataset.read(&space5_data, PredType::NATIVE_INT); + verify_val(space5_data, 7, "DataSet::read", __LINE__, __FILE__); - PASSED(); + PASSED(); } // end of try block catch (Exception& E) { - issue_fail_msg("test_h5s_null()", __LINE__, __FILE__, E.getCDetailMsg()); + issue_fail_msg("test_h5s_null()", __LINE__, __FILE__, E.getCDetailMsg()); } } // test_h5s_null() /*------------------------------------------------------------------------- * - * Function: test_h5s_compound_scalar_write + * Function: test_h5s_compound_scalar_write * - * Purpose: Test scalar H5S (dataspace) writing for compound - * datatypes + * Purpose Test scalar H5S (dataspace) writing for compound + * datatypes * - * Return: none + * Return none * - * Programmer: Binh-Minh Ribler (using C version) + * Programmer Binh-Minh Ribler (using C version) * Mar 2001 * * Modifications: * January, 2005: C tests' macro VERIFY casts values to 'long' for all - * cases. Since there are no operator<< for 'long long' - * or int64 in VS C++ ostream, I casted the hssize_t values - * passed to verify_val to 'long' as well. If problems - * arises later, this will have to be specificly handled - * with a special routine. + * cases. Since there are no operator<< for 'long long' + * or int64 in VS C++ ostream, I casted the hssize_t values + * passed to verify_val to 'long' as well. If problems + * arises later, this will have to be specificly handled + * with a special routine. *------------------------------------------------------------------------- */ static void test_h5s_compound_scalar_write() @@ -424,135 +423,135 @@ static void test_h5s_compound_scalar_write() SUBTEST("Compound Dataspace Writing"); try { - // Create file - H5File fid1(DATAFILE, H5F_ACC_TRUNC); - - // Create the compound datatype. - CompType tid1(sizeof(struct space4_struct)); - space4_field1_off=HOFFSET(struct space4_struct, c1); - tid1.insertMember(SPACE4_FIELDNAME1, space4_field1_off, - PredType::NATIVE_SCHAR); - space4_field2_off=HOFFSET(struct space4_struct, u); - tid1.insertMember(SPACE4_FIELDNAME2, space4_field2_off, - PredType::NATIVE_UINT); - space4_field3_off=HOFFSET(struct space4_struct, f); - tid1.insertMember(SPACE4_FIELDNAME3, space4_field3_off, - PredType::NATIVE_FLOAT); - space4_field4_off=HOFFSET(struct space4_struct, c2); - tid1.insertMember(SPACE4_FIELDNAME4, space4_field4_off, - PredType::NATIVE_SCHAR); - - // Create scalar dataspace - DataSpace sid1(SPACE3_RANK, NULL); - - // Get the number of dataspace elements - hssize_t n = sid1.getSimpleExtentNpoints(); - verify_val((long)n, 1, "DataSpace::getSimpleExtentNpoints", __LINE__, __FILE__); - - // Get the logical rank of the dataspace - int ndims = sid1.getSimpleExtentNdims(); - verify_val(ndims, SPACE3_RANK, "DataSpace::getSimpleExtentNdims", __LINE__, __FILE__); - - hsize_t tdims[4]; // Dimension array to test with - ndims = sid1.getSimpleExtentDims(tdims); - verify_val(ndims, 0, "DataSpace::getSimpleExtentDims", __LINE__, __FILE__); - - // Create and write a dataset - DataSet dataset = fid1.createDataSet("Dataset1", tid1, sid1); - dataset.write(&space4_data, tid1); - - PASSED(); - } // end of try block + // Create file + H5File fid1(DATAFILE, H5F_ACC_TRUNC); + + // Create the compound datatype. + CompType tid1(sizeof(struct space4_struct)); + space4_field1_off=HOFFSET(struct space4_struct, c1); + tid1.insertMember(SPACE4_FIELDNAME1, space4_field1_off, + PredType::NATIVE_SCHAR); + space4_field2_off=HOFFSET(struct space4_struct, u); + tid1.insertMember(SPACE4_FIELDNAME2, space4_field2_off, + PredType::NATIVE_UINT); + space4_field3_off=HOFFSET(struct space4_struct, f); + tid1.insertMember(SPACE4_FIELDNAME3, space4_field3_off, + PredType::NATIVE_FLOAT); + space4_field4_off=HOFFSET(struct space4_struct, c2); + tid1.insertMember(SPACE4_FIELDNAME4, space4_field4_off, + PredType::NATIVE_SCHAR); + + // Create scalar dataspace + DataSpace sid1(SPACE3_RANK, NULL); + + // Get the number of dataspace elements + hssize_t n = sid1.getSimpleExtentNpoints(); + verify_val((long)n, 1, "DataSpace::getSimpleExtentNpoints", __LINE__, __FILE__); + + // Get the logical rank of the dataspace + int ndims = sid1.getSimpleExtentNdims(); + verify_val(ndims, SPACE3_RANK, "DataSpace::getSimpleExtentNdims", __LINE__, __FILE__); + + hsize_t tdims[4]; // Dimension array to test with + ndims = sid1.getSimpleExtentDims(tdims); + verify_val(ndims, 0, "DataSpace::getSimpleExtentDims", __LINE__, __FILE__); + + // Create and write a dataset + DataSet dataset = fid1.createDataSet("Dataset1", tid1, sid1); + dataset.write(&space4_data, tid1); + + PASSED(); + } // end of try block catch (Exception& E) { - // all the exceptions caused by negative returned values by C APIs - issue_fail_msg("test_h5s_compound_scalar_write()", __LINE__, __FILE__, E.getCDetailMsg()); + // all the exceptions caused by negative returned values by C APIs + issue_fail_msg("test_h5s_compound_scalar_write()", __LINE__, __FILE__, E.getCDetailMsg()); } } // test_h5s_compound_scalar_write() /*------------------------------------------------------------------------- * - * Function: test_h5s_compound_scalar_read + * Function: test_h5s_compound_scalar_read * - * Purpose: Test scalar H5S (dataspace) reading for compound - * datatypes + * Purpose Test scalar H5S (dataspace) reading for compound + * datatypes * - * Return: none + * Return none * - * Programmer: Binh-Minh Ribler (using C version) + * Programmer Binh-Minh Ribler (using C version) * Mar 2001 * * Modifications: * January, 2005: C tests' macro VERIFY casts values to 'long' for all - * cases. Since there are no operator<< for 'long long' - * or int64 in VS C++ ostream, I casted the hssize_t values - * passed to verify_val to 'long' as well. If problems - * arises later, this will have to be specificly handled - * with a special routine. + * cases. Since there are no operator<< for 'long long' + * or int64 in VS C++ ostream, I casted the hssize_t values + * passed to verify_val to 'long' as well. If problems + * arises later, this will have to be specificly handled + * with a special routine. *------------------------------------------------------------------------- */ static void test_h5s_compound_scalar_read() { - hsize_t tdims[4]; // Dimension array to test with + hsize_t tdims[4]; // Dimension array to test with // Output message about test being performed SUBTEST("Compound Dataspace Reading"); try { - // Open file - H5File fid1(DATAFILE, H5F_ACC_RDWR); + // Open file + H5File fid1(DATAFILE, H5F_ACC_RDWR); - // Create a dataset - DataSet dataset = fid1.openDataSet("Dataset1"); + // Create a dataset + DataSet dataset = fid1.openDataSet("Dataset1"); - DataSpace sid1 = dataset.getSpace(); + DataSpace sid1 = dataset.getSpace(); - // Get the number of dataspace elements - hssize_t n = sid1.getSimpleExtentNpoints(); - verify_val((long)n, 1, "DataSpace::getSimpleExtentNpoints", __LINE__, __FILE__); + // Get the number of dataspace elements + hssize_t n = sid1.getSimpleExtentNpoints(); + verify_val((long)n, 1, "DataSpace::getSimpleExtentNpoints", __LINE__, __FILE__); - // Get the logical rank of the dataspace - int ndims = sid1.getSimpleExtentNdims(); - verify_val(ndims, SPACE3_RANK, "DataSpace::getSimpleExtentNdims", __LINE__, __FILE__); + // Get the logical rank of the dataspace + int ndims = sid1.getSimpleExtentNdims(); + verify_val(ndims, SPACE3_RANK, "DataSpace::getSimpleExtentNdims", __LINE__, __FILE__); - ndims = sid1.getSimpleExtentDims(tdims); - verify_val(ndims, 0, "DataSpace::getSimpleExtentDims", __LINE__, __FILE__); + ndims = sid1.getSimpleExtentDims(tdims); + verify_val(ndims, 0, "DataSpace::getSimpleExtentDims", __LINE__, __FILE__); - // Get the datatype of this dataset. - CompType type(dataset); + // Get the datatype of this dataset. + CompType type(dataset); - struct space4_struct rdata; // Scalar data read in - dataset.read(&rdata, type); + struct space4_struct rdata; // Scalar data read in + dataset.read(&rdata, type); - // Verify read data - if(HDmemcmp(&space4_data,&rdata,sizeof(struct space4_struct))) - { + // Verify read data + if(HDmemcmp(&space4_data,&rdata,sizeof(struct space4_struct))) + { cerr << "scalar data different: space4_data.c1=" - << space4_data.c1 << ", read_data4.c1=" << rdata.c1 << endl; + << space4_data.c1 << ", read_data4.c1=" << rdata.c1 << endl; cerr << "scalar data different: space4_data.u=" - << space4_data.u << ", read_data4.u=" << rdata.u << endl; + << space4_data.u << ", read_data4.u=" << rdata.u << endl; cerr << "scalar data different: space4_data.f=" - << space4_data.f << ", read_data4.f=" << rdata.f << endl; + << space4_data.f << ", read_data4.f=" << rdata.f << endl; TestErrPrintf("scalar data different: space4_data.c1=%c, read_data4.c1=%c\n", - space4_data.c1, rdata.c2); - } // end if - PASSED(); + space4_data.c1, rdata.c2); + } // end if + PASSED(); } // end of try block catch (Exception& E) { - // all the exceptions caused by negative returned values by C APIs - issue_fail_msg("test_h5s_compound_scalar_read()", __LINE__, __FILE__, E.getCDetailMsg()); + // all the exceptions caused by negative returned values by C APIs + issue_fail_msg("test_h5s_compound_scalar_read()", __LINE__, __FILE__, E.getCDetailMsg()); } } // test_h5s_compound_scalar_read() /*------------------------------------------------------------------------- * - * Function: test_h5s + * Function: test_h5s * - * Purpose: Main dataspace testing routine + * Purpose Main dataspace testing routine * - * Return: none + * Return none * - * Programmer: Binh-Minh Ribler (using C version) + * Programmer Binh-Minh Ribler (using C version) * Mar 2001 * * Modifications: @@ -564,23 +563,23 @@ void test_h5s() // Output message about test being performed MESSAGE(5, ("Testing Dataspaces\n")); - test_h5s_basic(); // Test basic H5S code - test_h5s_scalar_write(); // Test scalar H5S writing code - test_h5s_scalar_read(); // Test scalar H5S reading code - test_h5s_null(); // Test null H5S code - test_h5s_compound_scalar_write(); // Test compound datatype scalar H5S writing code - test_h5s_compound_scalar_read(); // Test compound datatype scalar H5S reading code + test_h5s_basic(); // Test basic H5S code + test_h5s_scalar_write(); // Test scalar H5S writing code + test_h5s_scalar_read(); // Test scalar H5S reading code + test_h5s_null(); // Test null H5S code + test_h5s_compound_scalar_write(); // Test compound datatype scalar H5S writing code + test_h5s_compound_scalar_read(); // Test compound datatype scalar H5S reading code } // test_h5s() /*------------------------------------------------------------------------- - * Function: cleanup_h5s + * Function: cleanup_h5s * - * Purpose: Cleanup temporary test files + * Purpose Cleanup temporary test files * - * Return: none + * Return none * - * Programmer: Albert Cheng + * Programmer Albert Cheng * July 2, 1998 * * Modifications: diff --git a/c++/test/titerate.cpp b/c++/test/titerate.cpp index 7ee2b53..fce42fa 100644 --- a/c++/test/titerate.cpp +++ b/c++/test/titerate.cpp @@ -49,20 +49,20 @@ using namespace H5; //#define SPACE1_RANK 1 //#define SPACE1_DIM1 4 -const H5std_string FILE_ITERATE("titerate.h5"); -const H5std_string GROUP1("Top Group"); -const H5std_string GROUP1_PATH("/Top Group"); -const H5std_string GROUP1_1("Sub-Group 1.1"); -const H5std_string GROUP1_1_PATH("/Top Group/Sub-Group 1.1"); -const H5std_string GROUP1_2("Sub-Group 1.2"); -const H5std_string GROUP1_2_PATH("/Top Group/Sub-Group 1.2"); -const H5std_string DSET_DEFAULT_NAME("default"); -const H5std_string DSET_IN_FILE("Dataset in File"); -const H5std_string DSET_IN_FILE_PATH("/Dataset in File"); -const H5std_string DSET_IN_GRP1("Dataset in Group 1"); -const H5std_string DSET_IN_GRP1_PATH("/Top Group/Dataset in Group 1"); -const H5std_string DSET_IN_GRP1_2("Dataset in Group 1.2"); -const H5std_string DSET_IN_GRP1_2_PATH("/Top Group/Sub-Group 1.2/Dataset in Group 1.2"); +const H5std_string FILE_ITERATE("titerate.h5"); +const H5std_string GROUP1("Top Group"); +const H5std_string GROUP1_PATH("/Top Group"); +const H5std_string GROUP1_1("Sub-Group 1.1"); +const H5std_string GROUP1_1_PATH("/Top Group/Sub-Group 1.1"); +const H5std_string GROUP1_2("Sub-Group 1.2"); +const H5std_string GROUP1_2_PATH("/Top Group/Sub-Group 1.2"); +const H5std_string DSET_DEFAULT_NAME("default"); +const H5std_string DSET_IN_FILE("Dataset in File"); +const H5std_string DSET_IN_FILE_PATH("/Dataset in File"); +const H5std_string DSET_IN_GRP1("Dataset in Group 1"); +const H5std_string DSET_IN_GRP1_PATH("/Top Group/Dataset in Group 1"); +const H5std_string DSET_IN_GRP1_2("Dataset in Group 1.2"); +const H5std_string DSET_IN_GRP1_2_PATH("/Top Group/Sub-Group 1.2/Dataset in Group 1.2"); typedef enum { RET_ZERO, @@ -127,15 +127,15 @@ liter_cb(hid_t H5_ATTR_UNUSED group, const char *name, const H5L_info_t H5_ATTR_ } /* end liter_cb() */ /*------------------------------------------------------------------------- - * Function: test_iter_group + * Function: test_iter_group * - * Purpose: Tests group iteration + * Purpose Tests group iteration * - * Return: Success: 0 - * Failure: -1 + * Return Success: 0 + * Failure: -1 * - * Programmer: Binh-Minh Ribler - * Friday, September 9, 2016 + * Programmer Binh-Minh Ribler + * Friday, September 9, 2016 * * Modifications: * @@ -148,142 +148,142 @@ static void test_iter_group(FileAccPropList& fapl) char name[NAMELEN]; /* temporary name buffer */ char *lnames[NDATASETS + 2];/* Names of the links created */ iter_info info; /* Custom iteration information */ - herr_t ret; /* Generic return value */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ SUBTEST("Group Iteration"); /* Create the test file with the datasets */ try { - // Create file - H5File file(FILE_ITERATE, H5F_ACC_TRUNC, FileCreatPropList::DEFAULT, fapl); + // Create file + H5File file(FILE_ITERATE, H5F_ACC_TRUNC, FileCreatPropList::DEFAULT, fapl); - /* Test iterating over empty group */ - info.command = RET_ZERO; - idx = 0; - ret = H5Literate(file.getId(), H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info); - verify_val(ret, SUCCEED, "H5Literate", __LINE__, __FILE__); + /* Test iterating over empty group */ + info.command = RET_ZERO; + idx = 0; + ret = H5Literate(file.getId(), H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info); + verify_val(ret, SUCCEED, "H5Literate", __LINE__, __FILE__); - DataType datatype(PredType::NATIVE_INT); + DataType datatype(PredType::NATIVE_INT); - // Create a scalar file space - DataSpace filespace; + // Create a scalar file space + DataSpace filespace; - for (i=0; i< NDATASETS; i++) - { + for (i=0; i< NDATASETS; i++) + { sprintf(name, "Dataset %d", i); - // Create a dataset in the file - DataSet dataset = file.createDataSet(name, datatype, filespace); + // Create a dataset in the file + DataSet dataset = file.createDataSet(name, datatype, filespace); /* Keep a copy of the dataset names */ lnames[i] = HDstrdup(name); check_values(lnames[i], "HDstrdup returns NULL", __LINE__, __FILE__); - } /* end for */ + } /* end for */ - /* Create a group and named datatype under root group for testing */ - Group grp(file.createGroup(GROUP1, 0)); - lnames[NDATASETS] = HDstrdup("grp"); - check_values(lnames[NDATASETS], "HDstrdup returns NULL", __LINE__, __FILE__); + /* Create a group and named datatype under root group for testing */ + Group grp(file.createGroup(GROUP1, 0)); + lnames[NDATASETS] = HDstrdup("grp"); + check_values(lnames[NDATASETS], "HDstrdup returns NULL", __LINE__, __FILE__); - datatype.commit(file, "dtype"); - lnames[NDATASETS + 1] = HDstrdup("dtype"); - check_values(lnames[NDATASETS], "HDstrdup returns NULL", __LINE__, __FILE__); + datatype.commit(file, "dtype"); + lnames[NDATASETS + 1] = HDstrdup("dtype"); + check_values(lnames[NDATASETS], "HDstrdup returns NULL", __LINE__, __FILE__); - /* Sort the dataset names */ - HDqsort(lnames, (size_t)(NDATASETS + 2), sizeof(char *), iter_strcmp); + /* Sort the dataset names */ + HDqsort(lnames, (size_t)(NDATASETS + 2), sizeof(char *), iter_strcmp); - /* Iterate through the datasets in the root group in various ways */ + /* Iterate through the datasets in the root group in various ways */ - // Open data file to read - file.openFile(FILE_ITERATE, H5F_ACC_RDONLY, fapl); + // Open data file to read + file.openFile(FILE_ITERATE, H5F_ACC_RDONLY, fapl); - // Open the root group - Group root_group(file.openGroup("/")); + // Open the root group + Group root_group(file.openGroup("/")); - // Get the number of object in the root group - hsize_t nobjs = root_group.getNumObjs(); - verify_val(nobjs, (hsize_t)(NDATASETS + 2), "H5Gget_info", __LINE__, __FILE__); + // Get the number of object in the root group + hsize_t nobjs = root_group.getNumObjs(); + verify_val(nobjs, (hsize_t)(NDATASETS + 2), "H5Gget_info", __LINE__, __FILE__); - H5std_string obj_name; - for (i = 0; i < nobjs; i++) - { - //H5O_info_t oinfo; /* Object info */ + H5std_string obj_name; + for (i = 0; i < nobjs; i++) + { + //H5O_info_t oinfo; /* Object info */ - obj_name = root_group.getObjnameByIdx(i); + obj_name = root_group.getObjnameByIdx(i); //ret = (herr_t)H5Lget_name_by_idx(root_group, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)i, dataset_name, (size_t)NAMELEN, H5P_DEFAULT); - //oinfo = root_group.childObjType((hsize_t)i, H5_INDEX_NAME, H5_ITER_INC, "."); + //oinfo = root_group.childObjType((hsize_t)i, H5_INDEX_NAME, H5_ITER_INC, "."); //ret = H5Oget_info_by_idx(root_group, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)i, &oinfo, H5P_DEFAULT); - } /* end for */ - - // Attempted to iterate with invalid index, should fail - try { - obj_name = root_group.getObjnameByIdx(NDATASETS + 3); - - // Should FAIL but didn't, so throw an invalid action exception - throw InvalidActionException("Group::getObjnameByIdx", "Attempt to iterate with invalid index"); - } - catch (GroupIException& invalid_action) // invalid index - {} // do nothing, exception expected - - // Attempted to iterate with negative index, should fail - try { - info.command = RET_ZERO; - idx = (hsize_t)-1; - obj_name = root_group.getObjnameByIdx(idx); - - // Should FAIL but didn't, so throw an invalid action exception - throw InvalidActionException("Group::getObjnameByIdx", "Attempt to iterate with negative index"); - } - catch (FileIException& invalid_action) // invalid index - {} // do nothing, exception expected - catch (GroupIException& invalid_action) // invalid index - {} // do nothing, exception expected - - /* Test skipping exactly as many entries as in the group */ - try { - info.command = RET_ZERO; - idx = NDATASETS + 2; - obj_name = root_group.getObjnameByIdx(idx); - - // Should FAIL but didn't, so throw an invalid action exception - throw InvalidActionException("Group::getObjnameByIdx", "Attempt to iterate with negative index"); - } - catch (FileIException& invalid_action) // invalid index - {} // do nothing, exception expected - catch (GroupIException& invalid_action) // invalid index - {} // do nothing, exception expected - - /* Test skipping more entries than are in the group */ - try { - info.command = RET_ZERO; - idx = NDATASETS + 3; - obj_name = root_group.getObjnameByIdx(idx); - - // Should FAIL but didn't, so throw an invalid action exception - throw InvalidActionException("Group::getObjnameByIdx", "Attempt to iterate with negative index"); - } - catch (FileIException& invalid_action) // invalid index - {} // do nothing, exception expected - catch (GroupIException& invalid_action) // invalid index - {} // do nothing, exception expected - - /* Free the dataset names */ - for(i = 0; i< (NDATASETS + 2); i++) - HDfree(lnames[i]); - - // Everything will be closed as they go out of scope - - PASSED(); - } // try block + } /* end for */ + + // Attempted to iterate with invalid index, should fail + try { + obj_name = root_group.getObjnameByIdx(NDATASETS + 3); + + // Should FAIL but didn't, so throw an invalid action exception + throw InvalidActionException("Group::getObjnameByIdx", "Attempt to iterate with invalid index"); + } + catch (GroupIException& invalid_action) // invalid index + {} // do nothing, exception expected + + // Attempted to iterate with negative index, should fail + try { + info.command = RET_ZERO; + idx = (hsize_t)-1; + obj_name = root_group.getObjnameByIdx(idx); + + // Should FAIL but didn't, so throw an invalid action exception + throw InvalidActionException("Group::getObjnameByIdx", "Attempt to iterate with negative index"); + } + catch (FileIException& invalid_action) // invalid index + {} // do nothing, exception expected + catch (GroupIException& invalid_action) // invalid index + {} // do nothing, exception expected + + /* Test skipping exactly as many entries as in the group */ + try { + info.command = RET_ZERO; + idx = NDATASETS + 2; + obj_name = root_group.getObjnameByIdx(idx); + + // Should FAIL but didn't, so throw an invalid action exception + throw InvalidActionException("Group::getObjnameByIdx", "Attempt to iterate with negative index"); + } + catch (FileIException& invalid_action) // invalid index + {} // do nothing, exception expected + catch (GroupIException& invalid_action) // invalid index + {} // do nothing, exception expected + + /* Test skipping more entries than are in the group */ + try { + info.command = RET_ZERO; + idx = NDATASETS + 3; + obj_name = root_group.getObjnameByIdx(idx); + + // Should FAIL but didn't, so throw an invalid action exception + throw InvalidActionException("Group::getObjnameByIdx", "Attempt to iterate with negative index"); + } + catch (FileIException& invalid_action) // invalid index + {} // do nothing, exception expected + catch (GroupIException& invalid_action) // invalid index + {} // do nothing, exception expected + + /* Free the dataset names */ + for(i = 0; i< (NDATASETS + 2); i++) + HDfree(lnames[i]); + + // Everything will be closed as they go out of scope + + PASSED(); + } // try block // catch all other exceptions catch (Exception& E) { - issue_fail_msg("test_iter_group", __LINE__, __FILE__); + issue_fail_msg("test_iter_group", __LINE__, __FILE__); } #if 0 @@ -355,59 +355,59 @@ static void test_iter_group(FileAccPropList& fapl) /**************************************************************** ** ** printelems(): Open an attribute and verify that it has a -** the correct name +** the correct name ** ****************************************************************/ -const H5std_string FILE_NAME("titerate.h5"); -const H5std_string GRP_NAME("/Group_A"); -const H5std_string FDATASET_NAME( "file dset" ); -const H5std_string GDATASET_NAME( "group dset" ); -const H5std_string ATTR_NAME( "Units" ); -const H5std_string FATTR_NAME( "F attr" ); -const H5std_string GATTR_NAME( "G attr" ); -const int DIM1 = 2; +const H5std_string FILE_NAME("titerate.h5"); +const H5std_string GRP_NAME("/Group_A"); +const H5std_string FDATASET_NAME("file dset"); +const H5std_string GDATASET_NAME("group dset"); +const H5std_string ATTR_NAME("Units"); +const H5std_string FATTR_NAME("F attr"); +const H5std_string GATTR_NAME("G attr"); +const int DIM1 = 2; void printelems(const Group& group, const H5std_string& dsname, const H5std_string& atname) { try { - DataSet d1(group.openDataSet(dsname)); - DataSpace s1 = d1.getSpace(); - s1.close(); - d1.close(); - - unsigned idx = 0; - Attribute a1(group.openAttribute(idx)); - H5std_string aname = a1.getName(); + DataSet d1(group.openDataSet(dsname)); + DataSpace s1 = d1.getSpace(); + s1.close(); + d1.close(); + + unsigned idx = 0; + Attribute a1(group.openAttribute(idx)); + H5std_string aname = a1.getName(); verify_val(aname, atname, "printelems", __LINE__, __FILE__); - a1.close(); + a1.close(); } // catch failure caused by the DataSpace operations catch( DataSpaceIException error ) { - error.printError(); + error.printError(); } // catch failure caused by the Group operations catch( GroupIException error ) { - error.printError(); + error.printError(); } // catch failure caused by the DataSet operations catch( DataSetIException error ) { - error.printError(); + error.printError(); } } /*------------------------------------------------------------------------- - * Function: test_HDFFV_9920 + * Function: test_HDFFV_9920 * - * Purpose: Tests the fix for HDFFV-9920 + * Purpose Tests the fix for HDFFV-9920 * - * Programmer: Binh-Minh Ribler - * Friday, September 9, 2016 + * Programmer Binh-Minh Ribler + * Friday, September 9, 2016 * * Modifications: * @@ -420,74 +420,74 @@ static void test_HDFFV_9920() try { - // Create a new file and a group in it - H5File file( FILE_NAME, H5F_ACC_TRUNC ); + // Create a new file and a group in it + H5File file( FILE_NAME, H5F_ACC_TRUNC ); - Group gr1(file.createGroup(GRP_NAME)); + Group gr1(file.createGroup(GRP_NAME)); - // Create the data space for the attribute. - DataSpace dspace = DataSpace (1, dims ); + // Create the data space for the attribute. + DataSpace dspace = DataSpace (1, dims ); - DataSet fds = file.createDataSet(FDATASET_NAME, PredType::STD_I32BE, dspace); - DataSet gds = gr1.createDataSet(GDATASET_NAME, PredType::STD_I32BE, dspace); + DataSet fds = file.createDataSet(FDATASET_NAME, PredType::STD_I32BE, dspace); + DataSet gds = gr1.createDataSet(GDATASET_NAME, PredType::STD_I32BE, dspace); - // Create a file attribute and a group attribute. - Attribute fa1 = file.createAttribute(FATTR_NAME, PredType::STD_I32BE, - dspace); - Attribute ga1 = gr1.createAttribute(GATTR_NAME, PredType::STD_I32BE, - dspace); + // Create a file attribute and a group attribute. + Attribute fa1 = file.createAttribute(FATTR_NAME, PredType::STD_I32BE, + dspace); + Attribute ga1 = gr1.createAttribute(GATTR_NAME, PredType::STD_I32BE, + dspace); - // Write the attribute data. - fa1.write( PredType::NATIVE_INT, attr_data); - ga1.write( PredType::NATIVE_INT, attr_data); + // Write the attribute data. + fa1.write( PredType::NATIVE_INT, attr_data); + ga1.write( PredType::NATIVE_INT, attr_data); - fa1.close(); - ga1.close(); - fds.close(); - gds.close(); + fa1.close(); + ga1.close(); + fds.close(); + gds.close(); - // Verify the attributes have correct names. - printelems(file, FDATASET_NAME, FATTR_NAME); - printelems(gr1, GDATASET_NAME, GATTR_NAME); + // Verify the attributes have correct names. + printelems(file, FDATASET_NAME, FATTR_NAME); + printelems(gr1, GDATASET_NAME, GATTR_NAME); } // end of try block // catch failure caused by the H5File operations catch( DataSpaceIException error ) { - error.printError(); + error.printError(); } // catch failure caused by the H5File operations catch( AttributeIException error ) { - error.printError(); + error.printError(); } // catch failure caused by the H5File operations catch( FileIException error ) { - error.printError(); + error.printError(); } // catch failure caused by the DataSet operations catch( DataSetIException error ) { - error.printError(); + error.printError(); } } /*------------------------------------------------------------------------- - * Function: test_iterate + * Function: test_iterate * - * Purpose: Tests iterate functionality + * Purpose Tests iterate functionality * - * Return: Success: 0 - * Failure: -1 + * Return Success: 0 + * Failure: -1 * - * Programmer: Binh-Minh Ribler - * Tuesday, September 6, 2016 + * Programmer Binh-Minh Ribler + * Tuesday, September 6, 2016 * * Modifications: * @@ -503,20 +503,20 @@ void test_iterate() FileAccPropList fapl; fapl.setLibverBounds(H5F_LIBVER_LATEST, H5F_LIBVER_LATEST); - test_iter_group(fapl); // Test iterating groups - test_HDFFV_9920(); // Test the fix of HDFFV-9920 - //test_iter_attr(fapl); // Test iterating attributes + test_iter_group(fapl); // Test iterating groups + test_HDFFV_9920(); // Test the fix of HDFFV-9920 + //test_iter_attr(fapl); // Test iterating attributes } // test_iterate /*------------------------------------------------------------------------- * Function: cleanup_iterate * - * Purpose: Cleanup temporary test files + * Purpose Cleanup temporary test files * - * Return: none + * Return none * - * Programmer: (use C version) + * Programmer (use C version) * * Modifications: * diff --git a/c++/test/tlinks.cpp b/c++/test/tlinks.cpp index 3acf4e1..c217718 100644 --- a/c++/test/tlinks.cpp +++ b/c++/test/tlinks.cpp @@ -43,9 +43,9 @@ using namespace H5; //#define H5G_TESTING //#include "h5test.h" -//#include "H5Gpkg.h" /* Groups */ -//#include "H5Iprivate.h" /* IDs */ -//#include "H5Lprivate.h" /* Links */ +//#include "H5Gpkg.h" /* Groups */ +//#include "H5Iprivate.h" /* IDs */ +//#include "H5Lprivate.h" /* Links */ /* File for external link test. Created with gen_udlinks.c */ #define LINKED_FILE "be_extlink2.h5" @@ -64,39 +64,39 @@ const char *FILENAME[] = { "links6", /* 9 */ "links7", /* 10 */ "links8", /* 11 */ - "extlinks0", /* 12: main files */ - "tmp/extlinks0", /* 13: */ - "extlinks1", /* 14: target files */ - "tmp/extlinks1", /* 15: */ - "extlinks2", /* 16: */ - "tmp/extlinks2", /* 17: */ - "extlinks3", /* 18: */ - "tmp/extlinks3", /* 19: */ - "extlinks4", /* 20: */ - "tmp/extlinks4", /* 21: */ - "extlinks5", /* 22: */ - "tmp/extlinks6", /* 23: */ - "extlinks7", /* 24: */ - "tmp/extlinks7", /* 25: */ - "tmp/extlinks8", /* 26: */ - "extlinks9", /* 27: */ - "tmp/extlinks9", /* 28: */ - "extlinks10", /* 29: */ /* TESTS for windows */ - "tmp/extlinks10", /* 30: */ - "tmp/extlinks11", /* 31: */ - "tmp/extlinks12", /* 32: */ - "extlinks13", /* 33: */ - "tmp/extlinks13", /* 34: */ - "tmp/extlinks14", /* 35: */ - "tmp/extlinks15", /* 36: */ - "extlinks16A", /* 37: */ /* TESTS for H5P_set_elink_fapl */ - "extlinks16B", /* 38: */ - "extlinks17", /* 39: */ - "extlinks18A", /* 40: */ - "extlinks18B", /* 41: */ - "extlinks19A", /* 42: */ - "extlinks19B", /* 43: */ - "extlinks20", /* 44: */ + "extlinks0", /* 12: main files */ + "tmp/extlinks0", /* 13: */ + "extlinks1", /* 14: target files */ + "tmp/extlinks1", /* 15: */ + "extlinks2", /* 16: */ + "tmp/extlinks2", /* 17: */ + "extlinks3", /* 18: */ + "tmp/extlinks3", /* 19: */ + "extlinks4", /* 20: */ + "tmp/extlinks4", /* 21: */ + "extlinks5", /* 22: */ + "tmp/extlinks6", /* 23: */ + "extlinks7", /* 24: */ + "tmp/extlinks7", /* 25: */ + "tmp/extlinks8", /* 26: */ + "extlinks9", /* 27: */ + "tmp/extlinks9", /* 28: */ + "extlinks10", /* 29: */ /* TESTS for windows */ + "tmp/extlinks10", /* 30: */ + "tmp/extlinks11", /* 31: */ + "tmp/extlinks12", /* 32: */ + "extlinks13", /* 33: */ + "tmp/extlinks13", /* 34: */ + "tmp/extlinks14", /* 35: */ + "tmp/extlinks15", /* 36: */ + "extlinks16A", /* 37: */ /* TESTS for H5P_set_elink_fapl */ + "extlinks16B", /* 38: */ + "extlinks17", /* 39: */ + "extlinks18A", /* 40: */ + "extlinks18B", /* 41: */ + "extlinks19A", /* 42: */ + "extlinks19B", /* 43: */ + "extlinks20", /* 44: */ NULL }; @@ -104,12 +104,12 @@ const char *FILENAME[] = { #define TMPDIR "tmp" -#define FAMILY_SIZE 1024 +#define FAMILY_SIZE 1024 #define CORE_INCREMENT 1024 -#define NUM400 400 +#define NUM400 400 /* do not do check_all_closed() for "ext*" files and "tmp/ext*" */ -#define EXTSTOP 12 +#define EXTSTOP 12 #define LINK_BUF_SIZE 1024 #define NAME_BUF_SIZE 1024 @@ -323,16 +323,16 @@ static const char *FILENAME[] = { /*------------------------------------------------------------------------- - * Function: test_basic_links + * Function: test_basic_links * - * Purpose: Test building a file with assorted links. + * Purpose Test building a file with assorted links. * - * Return: Success: 0 + * Return Success: 0 * - * Failure: -1 + * Failure: -1 * - * Programmer: Binh-Minh Ribler - * October 16, 2009 + * Programmer Binh-Minh Ribler + * October 16, 2009 * * Modifications: * @@ -340,114 +340,114 @@ static const char *FILENAME[] = { */ static void test_basic_links(hid_t fapl_id, hbool_t new_format) { - hsize_t size[1] = {1}; - char filename[NAME_BUF_SIZE]; + hsize_t size[1] = {1}; + char filename[NAME_BUF_SIZE]; // Use the file access template id to create a file access prop. list. FileAccPropList fapl(fapl_id); try { - if(new_format) - SUBTEST("Link creation (w/new group format)") - else - SUBTEST("Link creation") + if(new_format) + SUBTEST("Link creation (w/new group format)") + else + SUBTEST("Link creation") - h5_fixname(FILENAME[0], fapl_id, filename, sizeof filename); - H5File file(filename, H5F_ACC_TRUNC, FileCreatPropList::DEFAULT, fapl); + h5_fixname(FILENAME[0], fapl_id, filename, sizeof filename); + H5File file(filename, H5F_ACC_TRUNC, FileCreatPropList::DEFAULT, fapl); - // Create simple dataspace - DataSpace scalar (1, size, size); + // Create simple dataspace + DataSpace scalar (1, size, size); - // Create a group then close it by letting the object go out of scope - { - Group group(file.createGroup("grp1", 0)); - } + // Create a group then close it by letting the object go out of scope + { + Group group(file.createGroup("grp1", 0)); + } - // Create a dataset then close it by letting the object go out of scope - { - DataSet dset1(file.createDataSet("dset1", PredType::NATIVE_INT, scalar)); - } + // Create a dataset then close it by letting the object go out of scope + { + DataSet dset1(file.createDataSet("dset1", PredType::NATIVE_INT, scalar)); + } - hid_t file_id = file.getId(); + hid_t file_id = file.getId(); - // Because these are not implemented in the C++ API yet, they are - // used so CommonFG::getLinkval can be tested. - // Create a hard link - if(H5Lcreate_hard( - file_id, "dset1", H5L_SAME_LOC, "grp1/hard1", - H5P_DEFAULT, H5P_DEFAULT) < 0) - throw Exception("test_basic_links", "H5Lcreate_hard failed"); + // Because these are not implemented in the C++ API yet, they are + // used so CommonFG::getLinkval can be tested. + // Create a hard link + if(H5Lcreate_hard( + file_id, "dset1", H5L_SAME_LOC, "grp1/hard1", + H5P_DEFAULT, H5P_DEFAULT) < 0) + throw Exception("test_basic_links", "H5Lcreate_hard failed"); - // Create a symbolic link - if(H5Lcreate_soft( - "/dset1", file_id, "grp1/soft", H5P_DEFAULT, H5P_DEFAULT) < 0) - throw Exception("test_basic_links", "H5Lcreate_soft failed"); + // Create a symbolic link + if(H5Lcreate_soft( + "/dset1", file_id, "grp1/soft", H5P_DEFAULT, H5P_DEFAULT) < 0) + throw Exception("test_basic_links", "H5Lcreate_soft failed"); - // Create a symbolic link to something that doesn't exist - if(H5Lcreate_soft( - "foobar", file_id, "grp1/dangle", H5P_DEFAULT, H5P_DEFAULT) < 0) - throw Exception("test_basic_links", "H5Lcreate_soft failed"); + // Create a symbolic link to something that doesn't exist + if(H5Lcreate_soft( + "foobar", file_id, "grp1/dangle", H5P_DEFAULT, H5P_DEFAULT) < 0) + throw Exception("test_basic_links", "H5Lcreate_soft failed"); - // Create a recursive symbolic link - if(H5Lcreate_soft( - "/grp1/recursive", file_id, "/grp1/recursive", - H5P_DEFAULT, H5P_DEFAULT) < 0) - throw Exception("test_basic_links", "H5Lcreate_soft failed"); + // Create a recursive symbolic link + if(H5Lcreate_soft( + "/grp1/recursive", file_id, "/grp1/recursive", + H5P_DEFAULT, H5P_DEFAULT) < 0) + throw Exception("test_basic_links", "H5Lcreate_soft failed"); - // Verify link values before closing the file + // Verify link values before closing the file - H5std_string softlink_val = file.getLinkval("grp1/soft"); - verify_val(softlink_val, "/dset1", "H5File::getLinkval grp1/soft", __LINE__, __FILE__); + H5std_string softlink_val = file.getLinkval("grp1/soft"); + verify_val(softlink_val, "/dset1", "H5File::getLinkval grp1/soft", __LINE__, __FILE__); - H5std_string dngllink_val = file.getLinkval("grp1/dangle"); - verify_val(dngllink_val, "foobar", "H5File::getLinkval grp1/dangle", __LINE__, __FILE__); + H5std_string dngllink_val = file.getLinkval("grp1/dangle"); + verify_val(dngllink_val, "foobar", "H5File::getLinkval grp1/dangle", __LINE__, __FILE__); - H5std_string reclink_val = file.getLinkval("grp1/recursive"); - verify_val(reclink_val, "/grp1/recursive", "H5File::getLinkval grp1/recursive", __LINE__, __FILE__); + H5std_string reclink_val = file.getLinkval("grp1/recursive"); + verify_val(reclink_val, "/grp1/recursive", "H5File::getLinkval grp1/recursive", __LINE__, __FILE__); } // end of try block catch (Exception& E) { - issue_fail_msg("test_basic_links()", __LINE__, __FILE__, E.getCDetailMsg()); + issue_fail_msg("test_basic_links()", __LINE__, __FILE__, E.getCDetailMsg()); } // Open the file and check on the links in it try { - // Open the file above - H5File file(filename, H5F_ACC_RDWR, FileCreatPropList::DEFAULT, fapl); + // Open the file above + H5File file(filename, H5F_ACC_RDWR, FileCreatPropList::DEFAULT, fapl); - // Verify link existence - if(file.exists("dset1", LinkAccPropList::DEFAULT) != TRUE) - throw InvalidActionException("H5File::exists", "dset1 doesn't exist"); - if(file.exists("grp1/soft", LinkAccPropList::DEFAULT) != TRUE) - throw InvalidActionException("H5File::exists", "grp1/soft doesn't exist"); + // Verify link existence + if(file.exists("dset1", LinkAccPropList::DEFAULT) != TRUE) + throw InvalidActionException("H5File::exists", "dset1 doesn't exist"); + if(file.exists("grp1/soft", LinkAccPropList::DEFAULT) != TRUE) + throw InvalidActionException("H5File::exists", "grp1/soft doesn't exist"); - // Verify link values - H5std_string softlink_val = file.getLinkval("grp1/soft"); - verify_val(softlink_val, "/dset1", "H5File::getLinkval grp1/soft", __LINE__, __FILE__); + // Verify link values + H5std_string softlink_val = file.getLinkval("grp1/soft"); + verify_val(softlink_val, "/dset1", "H5File::getLinkval grp1/soft", __LINE__, __FILE__); - H5std_string reclink_val = file.getLinkval("grp1/recursive"); - verify_val(reclink_val, "/grp1/recursive", "H5File::getLinkval grp1/recursive", __LINE__, __FILE__); + H5std_string reclink_val = file.getLinkval("grp1/recursive"); + verify_val(reclink_val, "/grp1/recursive", "H5File::getLinkval grp1/recursive", __LINE__, __FILE__); - PASSED(); + PASSED(); } // end of try block catch (Exception& E) { - issue_fail_msg("test_basic_links()", __LINE__, __FILE__, E.getCDetailMsg()); + issue_fail_msg("test_basic_links()", __LINE__, __FILE__, E.getCDetailMsg()); } } /*------------------------------------------------------------------------- - * Function: test_links + * Function: test_links * - * Purpose: Test links + * Purpose Test links * - * Return: None + * Return None * - * Programmer: Binh-Minh Ribler + * Programmer Binh-Minh Ribler * October 16, 2009 * *------------------------------------------------------------------------- @@ -455,7 +455,7 @@ static void test_basic_links(hid_t fapl_id, hbool_t new_format) extern "C" void test_links() { - hid_t fapl_id, fapl2_id; /* File access property lists */ + hid_t fapl_id, fapl2_id; /* File access property lists */ unsigned new_format; /* Whether to use the new format or not */ const char *envval; @@ -469,40 +469,40 @@ void test_links() MESSAGE(5, ("Testing Various Links\n")); try { - /* Copy the file access property list */ - if((fapl2_id = H5Pcopy(fapl_id)) < 0) - throw Exception("test_links", "H5Pcopy failed"); - - /* Set the "use the latest version of the format" bounds for creating objects in the file */ - if(H5Pset_libver_bounds(fapl2_id, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) - throw Exception("test_links", "H5Pset_libver_bounds failed"); - - /* Loop over using new group format */ - for(new_format = FALSE; new_format <= TRUE; new_format++) - { - hid_t my_fapl_id; - - /* Check for FAPL to use */ - if(new_format) - my_fapl_id = fapl2_id; - else - my_fapl_id = fapl_id; - - /* General tests... (on both old & new format groups */ - // FileAccPropList may be passed in instead of fapl id - test_basic_links(my_fapl_id, new_format); + /* Copy the file access property list */ + if((fapl2_id = H5Pcopy(fapl_id)) < 0) + throw Exception("test_links", "H5Pcopy failed"); + + /* Set the "use the latest version of the format" bounds for creating objects in the file */ + if(H5Pset_libver_bounds(fapl2_id, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) + throw Exception("test_links", "H5Pset_libver_bounds failed"); + + /* Loop over using new group format */ + for(new_format = FALSE; new_format <= TRUE; new_format++) + { + hid_t my_fapl_id; + + /* Check for FAPL to use */ + if(new_format) + my_fapl_id = fapl2_id; + else + my_fapl_id = fapl_id; + + /* General tests... (on both old & new format groups */ + // FileAccPropList may be passed in instead of fapl id + test_basic_links(my_fapl_id, new_format); #if 0 // these tests are from the C test links.c and left here for future // implementation of H5L API - nerrors += test_basic_links(fapl_id, new_format) < 0 ? 1 : 0; - nerrors += cklinks(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += new_links(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += ck_new_links(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += long_links(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += toomany(my_fapl, new_format) < 0 ? 1 : 0; - - /* Test new H5L link creation routine */ - nerrors += test_lcpl(my_fapl, new_format); + nerrors += test_basic_links(fapl_id, new_format) < 0 ? 1 : 0; + nerrors += cklinks(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += new_links(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += ck_new_links(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += long_links(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += toomany(my_fapl, new_format) < 0 ? 1 : 0; + + /* Test new H5L link creation routine */ + nerrors += test_lcpl(my_fapl, new_format); nerrors += test_move(my_fapl, new_format); nerrors += test_copy(my_fapl, new_format); nerrors += test_move_preserves(my_fapl, new_format); @@ -579,7 +579,7 @@ void test_links() /* do not do this for files used by external link tests */ nerrors += check_all_closed(my_fapl, new_format, EXTSTOP) < 0 ? 1 : 0; #endif // 0 - } /* end for */ + } /* end for */ #if 0 /* New group revision feature tests */ @@ -609,33 +609,33 @@ void test_links() nerrors += group_info_old(fapl) < 0 ? 1 : 0; #endif - /* Close 2nd FAPL */ - H5Pclose(fapl2_id); + /* Close 2nd FAPL */ + H5Pclose(fapl2_id); - h5_clean_files(FILENAME, fapl_id); + h5_clean_files(FILENAME, fapl_id); - /* Test that external links can be used after a library reset. MUST be - * called last so the reset doesn't interfere with the property lists. This - * routine will delete its own file. */ - /* nerrors += external_reset_register() < 0 ? 1 : 0; + /* Test that external links can be used after a library reset. MUST be + * called last so the reset doesn't interfere with the property lists. This + * routine will delete its own file. */ + /* nerrors += external_reset_register() < 0 ? 1 : 0; */ } catch (Exception& E) { - issue_fail_msg("test_links()", __LINE__, __FILE__, E.getCDetailMsg()); + issue_fail_msg("test_links()", __LINE__, __FILE__, E.getCDetailMsg()); } } /*------------------------------------------------------------------------- - * Function: cleanup_links + * Function: cleanup_links * - * Purpose: Cleanup temporary test files + * Purpose Cleanup temporary test files * - * Return: none + * Return none * - * Programmer: Binh-Minh Ribler - * October 16, 2009 + * Programmer Binh-Minh Ribler + * October 16, 2009 * * Modifications: * diff --git a/c++/test/tobject.cpp b/c++/test/tobject.cpp index 325b2b0..6003dd6 100644 --- a/c++/test/tobject.cpp +++ b/c++/test/tobject.cpp @@ -31,41 +31,41 @@ using namespace H5; #include "h5test.h" #include "h5cpputil.h" // C++ utilility header file -const H5std_string FILE_OBJECTS("tobjects.h5"); -const H5std_string GROUP1("Top Group"); -const H5std_string GROUP1_PATH("/Top Group"); -const H5std_string GROUP1_1("Sub-Group 1.1"); -const H5std_string GROUP1_1_PATH("/Top Group/Sub-Group 1.1"); -const H5std_string GROUP1_2("Sub-Group 1.2"); -const H5std_string GROUP1_2_PATH("/Top Group/Sub-Group 1.2"); -const H5std_string DSET_DEFAULT_NAME("default"); -const H5std_string DSET_IN_FILE("Dataset in File"); -const H5std_string DSET_IN_FILE_PATH("/Dataset in File"); -const H5std_string DSET_IN_GRP1("Dataset_in_Group_1"); -const H5std_string DSET_IN_GRP1_PATH("/Top Group/Dataset_in_Group_1"); -const H5std_string DSET_IN_GRP1_2("Dataset_in_Group_1.2"); -const H5std_string DSET_IN_GRP1_2_PATH("/Top Group/Sub-Group 1.2/Dataset_in_Group_1.2"); +const H5std_string FILE_OBJECTS("tobjects.h5"); +const H5std_string GROUP1("Top Group"); +const H5std_string GROUP1_PATH("/Top Group"); +const H5std_string GROUP1_1("Sub-Group 1.1"); +const H5std_string GROUP1_1_PATH("/Top Group/Sub-Group 1.1"); +const H5std_string GROUP1_2("Sub-Group 1.2"); +const H5std_string GROUP1_2_PATH("/Top Group/Sub-Group 1.2"); +const H5std_string DSET_DEFAULT_NAME("default"); +const H5std_string DSET_IN_FILE("Dataset in File"); +const H5std_string DSET_IN_FILE_PATH("/Dataset in File"); +const H5std_string DSET_IN_GRP1("Dataset_in_Group_1"); +const H5std_string DSET_IN_GRP1_PATH("/Top Group/Dataset_in_Group_1"); +const H5std_string DSET_IN_GRP1_2("Dataset_in_Group_1.2"); +const H5std_string DSET_IN_GRP1_2_PATH("/Top Group/Sub-Group 1.2/Dataset_in_Group_1.2"); /*------------------------------------------------------------------------- - * Function: test_get_objname + * Function: test_get_objname * - * Purpose: Tests getting object name of groups and datasets. + * Purpose Tests getting object name of groups and datasets. * * Description: - * File structure: - * GROUP1 - * GROUP1_1 - * GROUP1_2 - * DSET_IN_GRP1_2 - * DSET_IN_GRP1 - * DSET_IN_FILE + * File structure: + * GROUP1 + * GROUP1_1 + * GROUP1_2 + * DSET_IN_GRP1_2 + * DSET_IN_GRP1 + * DSET_IN_FILE * * - * Return: Success: 0 - * Failure: -1 + * Return Success: 0 + * Failure: -1 * - * Programmer: Binh-Minh Ribler - * Friday, March 4, 2014 + * Programmer Binh-Minh Ribler + * Friday, March 4, 2014 * * Modifications: * @@ -76,104 +76,104 @@ static void test_get_objname() SUBTEST("H5Object::getObjName on Groups and Datasets"); try { - // Create file - H5File file(FILE_OBJECTS, H5F_ACC_TRUNC); + // Create file + H5File file(FILE_OBJECTS, H5F_ACC_TRUNC); - // Create a top group and 2 subgroups - Group grp1 = file.createGroup(GROUP1, 0); - Group grp1_1 = grp1.createGroup(GROUP1_1, 0); - Group grp1_2 = grp1.createGroup(GROUP1_2, 0); + // Create a top group and 2 subgroups + Group grp1 = file.createGroup(GROUP1, 0); + Group grp1_1 = grp1.createGroup(GROUP1_1, 0); + Group grp1_2 = grp1.createGroup(GROUP1_2, 0); - // Get part of the group's name, random length using - // ssize_t getObjName(char* comment, size_t buf_size) + // Get part of the group's name, random length using + // ssize_t getObjName(char* comment, size_t buf_size) - // Get the length of the group's name first - ssize_t name_len = grp1.getObjName(NULL); + // Get the length of the group's name first + ssize_t name_len = grp1.getObjName(NULL); - // Random length is 4 - if (name_len > 4) - { - char* grp1_name = new char[5]; - name_len = grp1.getObjName(grp1_name, 5); - verify_val((const char*)grp1_name, "/Top", "Group::getObjName", __LINE__, __FILE__); - delete []grp1_name; - } + // Random length is 4 + if (name_len > 4) + { + char* grp1_name = new char[5]; + name_len = grp1.getObjName(grp1_name, 5); + verify_val((const char*)grp1_name, "/Top", "Group::getObjName", __LINE__, __FILE__); + delete []grp1_name; + } - // Create a data space - hsize_t dims[2]; - dims[0] = 2; - dims[1] = 5; - DataSpace space (2, dims, NULL); + // Create a data space + hsize_t dims[2]; + dims[0] = 2; + dims[1] = 5; + DataSpace space (2, dims, NULL); - // Create a dataset in the file - DataSet dsinfile = file.createDataSet(DSET_IN_FILE, - PredType::NATIVE_DOUBLE, space); + // Create a dataset in the file + DataSet dsinfile = file.createDataSet(DSET_IN_FILE, + PredType::NATIVE_DOUBLE, space); - // Create a dataset in the group - DataSet dsingrp = grp1.createDataSet(DSET_IN_GRP1, - PredType::NATIVE_INT, space); + // Create a dataset in the group + DataSet dsingrp = grp1.createDataSet(DSET_IN_GRP1, + PredType::NATIVE_INT, space); - // Get and verify the name of each dataset, using - // H5std_string getObjName() and - // ssize_t getObjName(H5std_string& obj_name, size_t len = 0) - H5std_string ds_name = dsinfile.getObjName(); - verify_val(ds_name, DSET_IN_FILE_PATH, "DataSet::getObjName", __LINE__, __FILE__); + // Get and verify the name of each dataset, using + // H5std_string getObjName() and + // ssize_t getObjName(H5std_string& obj_name, size_t len = 0) + H5std_string ds_name = dsinfile.getObjName(); + verify_val(ds_name, DSET_IN_FILE_PATH, "DataSet::getObjName", __LINE__, __FILE__); - name_len = dsingrp.getObjName(ds_name); // default len - verify_val(ds_name, DSET_IN_GRP1_PATH, "DataSet::getObjName", __LINE__, __FILE__); + name_len = dsingrp.getObjName(ds_name); // default len + verify_val(ds_name, DSET_IN_GRP1_PATH, "DataSet::getObjName", __LINE__, __FILE__); - // Close dataset - dsingrp.close(); + // Close dataset + dsingrp.close(); - // Create a dataset in sub-group 1.2 - dsingrp = grp1_2.createDataSet(DSET_IN_GRP1_2, PredType::NATIVE_INT, space); + // Create a dataset in sub-group 1.2 + dsingrp = grp1_2.createDataSet(DSET_IN_GRP1_2, PredType::NATIVE_INT, space); - // Get and verify the name of the dataset that belongs to subgroup - // 1.2, using H5std_string getObjName() - ds_name = dsingrp.getObjName(); - verify_val(ds_name, DSET_IN_GRP1_2_PATH, "DataSet::getObjName", __LINE__, __FILE__); + // Get and verify the name of the dataset that belongs to subgroup + // 1.2, using H5std_string getObjName() + ds_name = dsingrp.getObjName(); + verify_val(ds_name, DSET_IN_GRP1_2_PATH, "DataSet::getObjName", __LINE__, __FILE__); - // Close dataset - dsingrp.close(); + // Close dataset + dsingrp.close(); - // Reopen that same dataset then check the name again with another - // overload: ssize_t getObjName(H5std_string& obj_name, size_t len = 0) - dsingrp = grp1_2.openDataSet(DSET_IN_GRP1_2); - name_len = dsingrp.getObjName(ds_name); - verify_val(ds_name, DSET_IN_GRP1_2_PATH, "DataSet::getObjName", __LINE__, __FILE__); + // Reopen that same dataset then check the name again with another + // overload: ssize_t getObjName(H5std_string& obj_name, size_t len = 0) + dsingrp = grp1_2.openDataSet(DSET_IN_GRP1_2); + name_len = dsingrp.getObjName(ds_name); + verify_val(ds_name, DSET_IN_GRP1_2_PATH, "DataSet::getObjName", __LINE__, __FILE__); - // Everything will be closed as they go out of scope + // Everything will be closed as they go out of scope - PASSED(); - } // try block + PASSED(); + } // try block // catch all other exceptions catch (Exception& E) { - issue_fail_msg("test_get_objname", __LINE__, __FILE__); + issue_fail_msg("test_get_objname", __LINE__, __FILE__); } } // test_get_objname /*------------------------------------------------------------------------- - * Function: test_existance + * Function: test_existance * - * Purpose: Tests getting object name of groups and datasets. + * Purpose Tests getting object name of groups and datasets. * * Description: - * File structure: - * GROUP1 - * GROUP1_1 - * GROUP1_2 - * DSET_IN_GRP1_2 - * DSET_IN_GRP1 - * DSET_IN_FILE + * File structure: + * GROUP1 + * GROUP1_1 + * GROUP1_2 + * DSET_IN_GRP1_2 + * DSET_IN_GRP1 + * DSET_IN_FILE * * - * Return: Success: 0 - * Failure: -1 + * Return Success: 0 + * Failure: -1 * - * Programmer: Binh-Minh Ribler - * Friday, March 4, 2014 + * Programmer Binh-Minh Ribler + * Friday, March 4, 2014 * * Modifications: * @@ -184,62 +184,62 @@ static void test_existance() SUBTEST("H5File::exists and Group::exists"); try { - // Open file - H5File file(FILE_OBJECTS, H5F_ACC_RDONLY); + // Open file + H5File file(FILE_OBJECTS, H5F_ACC_RDONLY); - // Check if GROUP1 exists in the file - bool exists = file.exists(GROUP1); + // Check if GROUP1 exists in the file + bool exists = file.exists(GROUP1); - // Open GROUP1 - Group grp1 = file.openGroup(GROUP1); + // Open GROUP1 + Group grp1 = file.openGroup(GROUP1); - // Check if GROUP1_1 and GROUP1_2 exist in GROUP1 - exists = grp1.exists(GROUP1_1); - verify_val(exists, TRUE, "Group::exists GROUP1_1", __LINE__, __FILE__); - exists = grp1.exists(GROUP1_2); - verify_val(exists, TRUE, "Group::exists GROUP1_2", __LINE__, __FILE__); + // Check if GROUP1_1 and GROUP1_2 exist in GROUP1 + exists = grp1.exists(GROUP1_1); + verify_val(exists, TRUE, "Group::exists GROUP1_1", __LINE__, __FILE__); + exists = grp1.exists(GROUP1_2); + verify_val(exists, TRUE, "Group::exists GROUP1_2", __LINE__, __FILE__); - // Check if DSET_IN_GRP1 exists in GROUP1 - exists = grp1.exists(DSET_IN_GRP1); - verify_val(exists, TRUE, "Group::exists DSET_IN_GRP1", __LINE__, __FILE__); + // Check if DSET_IN_GRP1 exists in GROUP1 + exists = grp1.exists(DSET_IN_GRP1); + verify_val(exists, TRUE, "Group::exists DSET_IN_GRP1", __LINE__, __FILE__); - // Open GROUP1_2 - Group grp1_2 = grp1.openGroup(GROUP1_2); + // Open GROUP1_2 + Group grp1_2 = grp1.openGroup(GROUP1_2); - // Check if DSET_IN_GRP1_2 exists in GROUP1_2 - exists = grp1_2.exists(DSET_IN_GRP1_2); - verify_val(exists, TRUE, "Group::exists DSET_IN_GRP1_2", __LINE__, __FILE__); + // Check if DSET_IN_GRP1_2 exists in GROUP1_2 + exists = grp1_2.exists(DSET_IN_GRP1_2); + verify_val(exists, TRUE, "Group::exists DSET_IN_GRP1_2", __LINE__, __FILE__); - // Check if a dataset exists given dataset as location with full path name - DataSet dset1 = file.openDataSet(DSET_IN_FILE); - exists = dset1.exists("/Top Group/Dataset_in_Group_1"); - verify_val(exists, TRUE, "Group::exists given dataset with full path name", __LINE__, __FILE__); + // Check if a dataset exists given dataset as location with full path name + DataSet dset1 = file.openDataSet(DSET_IN_FILE); + exists = dset1.exists("/Top Group/Dataset_in_Group_1"); + verify_val(exists, TRUE, "Group::exists given dataset with full path name", __LINE__, __FILE__); - exists = grp1_2.exists(DSET_IN_GRP1); - verify_val(exists, FALSE, "Group::exists DSET_IN_GRP1", __LINE__, __FILE__); + exists = grp1_2.exists(DSET_IN_GRP1); + verify_val(exists, FALSE, "Group::exists DSET_IN_GRP1", __LINE__, __FILE__); - // Everything will be closed as they go out of scope + // Everything will be closed as they go out of scope - PASSED(); - } // try block + PASSED(); + } // try block // catch all other exceptions catch (Exception& E) { - issue_fail_msg("test_existance", __LINE__, __FILE__); + issue_fail_msg("test_existance", __LINE__, __FILE__); } } // test_existance /*------------------------------------------------------------------------- - * Function: test_get_objname_ontypes + * Function: test_get_objname_ontypes * - * Purpose: Test getting object name from various committed types. + * Purpose Test getting object name from various committed types. * - * Return: Success: 0 - * Failure: -1 + * Return Success: 0 + * Failure: -1 * - * Programmer: Binh-Minh Ribler - * March 4, 2014 + * Programmer Binh-Minh Ribler + * March 4, 2014 * * Modifications: * @@ -250,97 +250,97 @@ static void test_get_objname_ontypes() SUBTEST("H5Object::getObjName on Committed Datatypes"); try { - // Create a file with default prop lists - H5File file(FILE_OBJECTS, H5F_ACC_RDWR); - - // Create a group - Group grp = file.createGroup ("typetests"); - - // Create a datatype and save it - IntType inttype(PredType::STD_B8LE); - inttype.commit(file, "INT type of STD_B8LE"); - - // Close the type then open it again to test getting its name - inttype.close(); - inttype = file.openIntType("INT type of STD_B8LE"); // deprecated - - // Get and verify its name - H5std_string inttype_name = inttype.getObjName(); - verify_val(inttype_name, "/INT type of STD_B8LE", "DataType::getObjName", __LINE__, __FILE__); - - // Close the type then open it again to test getting its name, but - // with the constructor this time - inttype.close(); - IntType std_b8le(file, "INT type of STD_B8LE"); - - // Get and verify its name - H5std_string std_b8le_name = std_b8le.getObjName(); - verify_val(std_b8le_name, "/INT type of STD_B8LE", "DataType::getObjName", __LINE__, __FILE__); - - // Make copy of a predefined type and save it - DataType dtype(PredType::STD_B8LE); - dtype.commit(file, "STD_B8LE"); - - // Close the data type and file - dtype.close(); - file.close(); - - // Re-open the file and the data type to test getting its name - file.openFile(FILE_OBJECTS, H5F_ACC_RDWR); - dtype = file.openDataType("STD_B8LE"); // deprecated - - // Get and verify its name - H5std_string type_name = dtype.getObjName(); - verify_val(type_name, "/STD_B8LE", "DataType::getObjName", __LINE__, __FILE__); - - // Close the type and open it again with the constructor then test - // getting its name - dtype.close(); - DataType dtype2(file, "STD_B8LE"); - type_name = dtype2.getObjName(); - verify_val(type_name, "/STD_B8LE", "DataType::getObjName", __LINE__, __FILE__); - - // Test getting type's name from copied type - DataType copied_type; - copied_type.copy(dtype2); - copied_type.commit(file, "copy of STD_B8LE"); - type_name = copied_type.getObjName(); - verify_val(type_name, "/copy of STD_B8LE", "DataType::getObjName", __LINE__, __FILE__); - - // Test copying an integer predefined type - IntType new_int_type(PredType::NATIVE_INT); - - // Name this datatype - new_int_type.commit(grp, "IntType NATIVE_INT"); - ssize_t name_len = new_int_type.getObjName(type_name); // default len - verify_val(name_len, (ssize_t)HDstrlen("/typetests/IntType NATIVE_INT"), "DataType::getObjName", __LINE__, __FILE__); - verify_val(type_name, "/typetests/IntType NATIVE_INT", "DataType::getObjName", __LINE__, __FILE__); - - // Close everything or they can be closed when objects go out of scope - dtype2.close(); - copied_type.close(); - new_int_type.close(); - grp.close(); - - PASSED(); + // Create a file with default prop lists + H5File file(FILE_OBJECTS, H5F_ACC_RDWR); + + // Create a group + Group grp = file.createGroup ("typetests"); + + // Create a datatype and save it + IntType inttype(PredType::STD_B8LE); + inttype.commit(file, "INT type of STD_B8LE"); + + // Close the type then open it again to test getting its name + inttype.close(); + inttype = file.openIntType("INT type of STD_B8LE"); // deprecated + + // Get and verify its name + H5std_string inttype_name = inttype.getObjName(); + verify_val(inttype_name, "/INT type of STD_B8LE", "DataType::getObjName", __LINE__, __FILE__); + + // Close the type then open it again to test getting its name, but + // with the constructor this time + inttype.close(); + IntType std_b8le(file, "INT type of STD_B8LE"); + + // Get and verify its name + H5std_string std_b8le_name = std_b8le.getObjName(); + verify_val(std_b8le_name, "/INT type of STD_B8LE", "DataType::getObjName", __LINE__, __FILE__); + + // Make copy of a predefined type and save it + DataType dtype(PredType::STD_B8LE); + dtype.commit(file, "STD_B8LE"); + + // Close the data type and file + dtype.close(); + file.close(); + + // Re-open the file and the data type to test getting its name + file.openFile(FILE_OBJECTS, H5F_ACC_RDWR); + dtype = file.openDataType("STD_B8LE"); // deprecated + + // Get and verify its name + H5std_string type_name = dtype.getObjName(); + verify_val(type_name, "/STD_B8LE", "DataType::getObjName", __LINE__, __FILE__); + + // Close the type and open it again with the constructor then test + // getting its name + dtype.close(); + DataType dtype2(file, "STD_B8LE"); + type_name = dtype2.getObjName(); + verify_val(type_name, "/STD_B8LE", "DataType::getObjName", __LINE__, __FILE__); + + // Test getting type's name from copied type + DataType copied_type; + copied_type.copy(dtype2); + copied_type.commit(file, "copy of STD_B8LE"); + type_name = copied_type.getObjName(); + verify_val(type_name, "/copy of STD_B8LE", "DataType::getObjName", __LINE__, __FILE__); + + // Test copying an integer predefined type + IntType new_int_type(PredType::NATIVE_INT); + + // Name this datatype + new_int_type.commit(grp, "IntType NATIVE_INT"); + ssize_t name_len = new_int_type.getObjName(type_name); // default len + verify_val(name_len, (ssize_t)HDstrlen("/typetests/IntType NATIVE_INT"), "DataType::getObjName", __LINE__, __FILE__); + verify_val(type_name, "/typetests/IntType NATIVE_INT", "DataType::getObjName", __LINE__, __FILE__); + + // Close everything or they can be closed when objects go out of scope + dtype2.close(); + copied_type.close(); + new_int_type.close(); + grp.close(); + + PASSED(); } // end top try block catch (Exception& E) { - issue_fail_msg("test_get_objname_ontypes", __LINE__, __FILE__); + issue_fail_msg("test_get_objname_ontypes", __LINE__, __FILE__); } } // test_get_objname_ontypes /*------------------------------------------------------------------------- - * Function: test_get_objtype + * Function: test_get_objtype * - * Purpose: Tests getting object type + * Purpose Tests getting object type * - * Return: Success: 0 - * Failure: -1 + * Return Success: 0 + * Failure: -1 * - * Programmer: Binh-Minh Ribler - * Friday, March 4, 2014 + * Programmer Binh-Minh Ribler + * Friday, March 4, 2014 * * Modifications: * @@ -351,61 +351,61 @@ static void test_get_objtype() SUBTEST("H5File::childObjType and H5Group::childObjType"); try { - // Open file - H5File file(FILE_OBJECTS, H5F_ACC_RDWR); + // Open file + H5File file(FILE_OBJECTS, H5F_ACC_RDWR); - // Open the top group - Group grp1 = file.openGroup(GROUP1); + // Open the top group + Group grp1 = file.openGroup(GROUP1); - // Create a datatype and save it - DataType dtype(PredType::STD_I32LE); - dtype.commit(grp1, "STD_I32LE"); + // Create a datatype and save it + DataType dtype(PredType::STD_I32LE); + dtype.commit(grp1, "STD_I32LE"); - // Get and verify object type with - // H5O_type_t childObjType(const H5std_string& objname) - H5O_type_t objtype = file.childObjType(DSET_IN_FILE); - verify_val(objtype, H5O_TYPE_DATASET, "DataSet::childObjType", __LINE__, __FILE__); + // Get and verify object type with + // H5O_type_t childObjType(const H5std_string& objname) + H5O_type_t objtype = file.childObjType(DSET_IN_FILE); + verify_val(objtype, H5O_TYPE_DATASET, "DataSet::childObjType", __LINE__, __FILE__); - // Get and verify object type with - // H5O_type_t childObjType(const char* objname) - objtype = grp1.childObjType(GROUP1_1.c_str()); - verify_val(objtype, H5O_TYPE_GROUP, "DataSet::childObjType", __LINE__, __FILE__); + // Get and verify object type with + // H5O_type_t childObjType(const char* objname) + objtype = grp1.childObjType(GROUP1_1.c_str()); + verify_val(objtype, H5O_TYPE_GROUP, "DataSet::childObjType", __LINE__, __FILE__); - // Get and verify object type with - // H5O_type_t childObjType(hsize_t index, H5_index_t index_type, - // H5_iter_order_t order, const char* objname=".") - objtype = grp1.childObjType((hsize_t)1, H5_INDEX_NAME, H5_ITER_INC); - verify_val(objtype, H5O_TYPE_NAMED_DATATYPE, "DataSet::childObjType", __LINE__, __FILE__); + // Get and verify object type with + // H5O_type_t childObjType(hsize_t index, H5_index_t index_type, + // H5_iter_order_t order, const char* objname=".") + objtype = grp1.childObjType((hsize_t)1, H5_INDEX_NAME, H5_ITER_INC); + verify_val(objtype, H5O_TYPE_NAMED_DATATYPE, "DataSet::childObjType", __LINE__, __FILE__); - // Get and verify object type with - // H5O_type_t childObjType(hsize_t index, - // H5_index_t index_type=H5_INDEX_NAME, - // H5_iter_order_t order=H5_ITER_INC, const char* objname=".") - objtype = grp1.childObjType((hsize_t)2); - verify_val(objtype, H5O_TYPE_GROUP, "DataSet::childObjType", __LINE__, __FILE__); + // Get and verify object type with + // H5O_type_t childObjType(hsize_t index, + // H5_index_t index_type=H5_INDEX_NAME, + // H5_iter_order_t order=H5_ITER_INC, const char* objname=".") + objtype = grp1.childObjType((hsize_t)2); + verify_val(objtype, H5O_TYPE_GROUP, "DataSet::childObjType", __LINE__, __FILE__); - // Everything will be closed as they go out of scope + // Everything will be closed as they go out of scope - PASSED(); - } // try block + PASSED(); + } // try block // catch all other exceptions catch (Exception& E) { - issue_fail_msg("test_get_objtype", __LINE__, __FILE__); + issue_fail_msg("test_get_objtype", __LINE__, __FILE__); } } // test_get_objtype /*------------------------------------------------------------------------- - * Function: test_objects + * Function: test_objects * - * Purpose: Tests HDF5 object related functionality + * Purpose Tests HDF5 object related functionality * - * Return: Success: 0 - * Failure: -1 + * Return Success: 0 + * Failure: -1 * - * Programmer: Binh-Minh Ribler - * Friday, Mar 4, 2014 + * Programmer Binh-Minh Ribler + * Friday, Mar 4, 2014 * * Modifications: * @@ -419,7 +419,7 @@ void test_object() test_get_objname(); // Test get object name from groups/datasets test_existance(); // Test check for object existance - test_get_objname_ontypes(); // Test get object name from types + test_get_objname_ontypes(); // Test get object name from types test_get_objtype(); // Test get object type } // test_objects @@ -427,11 +427,11 @@ void test_object() /*------------------------------------------------------------------------- * Function: cleanup_objects * - * Purpose: Cleanup temporary test files + * Purpose Cleanup temporary test files * - * Return: none + * Return none * - * Programmer: (use C version) + * Programmer (use C version) * * Modifications: * diff --git a/c++/test/trefer.cpp b/c++/test/trefer.cpp index 9bc2eb0..d8a0d5f 100644 --- a/c++/test/trefer.cpp +++ b/c++/test/trefer.cpp @@ -16,7 +16,7 @@ /***************************************************************************** FILE trefer.cpp - HDF5 C++ testing the functionalities associated with the C - Reference interface (H5R) + Reference interface (H5R) ***************************************************************************/ #ifdef OLD_HEADER_FILENAME @@ -79,100 +79,100 @@ test_reference_params(void) H5File* file1 = NULL; try { - hobj_ref_t *wbuf, // buffer to write to disk - *rbuf, // buffer read from disk - *tbuf; // temp. buffer read from disk + hobj_ref_t *wbuf, // buffer to write to disk + *rbuf, // buffer read from disk + *tbuf; // temp. buffer read from disk - // Allocate write & read buffers - int temp_size = MAX(sizeof(unsigned),sizeof(hobj_ref_t)); - wbuf=(hobj_ref_t*)HDmalloc(temp_size*SPACE1_DIM1); - rbuf=(hobj_ref_t*)HDmalloc(temp_size*SPACE1_DIM1); - tbuf=(hobj_ref_t*)HDmalloc(temp_size*SPACE1_DIM1); + // Allocate write & read buffers + int temp_size = MAX(sizeof(unsigned),sizeof(hobj_ref_t)); + wbuf=(hobj_ref_t*)HDmalloc(temp_size*SPACE1_DIM1); + rbuf=(hobj_ref_t*)HDmalloc(temp_size*SPACE1_DIM1); + tbuf=(hobj_ref_t*)HDmalloc(temp_size*SPACE1_DIM1); // Create file FILE1 file1 = new H5File (FILE1, H5F_ACC_TRUNC); - // Create dataspace for datasets - hsize_t dims1[] = {SPACE1_DIM1}; - DataSpace sid1(SPACE1_RANK, dims1); - - // Create a group - Group group = file1->createGroup("Group1"); - - // Set group's comment - group.setComment(".", write_comment); - - // Create a dataset (inside /Group1) - DataSet dataset = group.createDataSet(DSET1_NAME, PredType::NATIVE_UINT, sid1); - - unsigned *tu32; // Temporary pointer to uint32 data - int i; - for (tu32=(unsigned *)wbuf, i=0; icreateDataSet("Dataset3", PredType::STD_REF_OBJ, sid1); - - /* Test parameters to H5Location::reference */ - try { - file1->reference(NULL, "/Group1/Dataset1"); - } catch (ReferenceException& E) {} // We expect this to fail - try { - file1->reference(&wbuf[0], NULL); - } catch (ReferenceException& E) {} // We expect this to fail - try { - file1->reference(&wbuf[0], ""); - } catch (ReferenceException& E) {} // We expect this to fail - try { - file1->reference(&wbuf[0], "/Group1/Dataset1", H5R_MAXTYPE); - } catch (ReferenceException& E) {} // We expect this to fail - try { - file1->reference(&wbuf[0], "/Group1/Dataset1", H5R_DATASET_REGION); - } catch (ReferenceException& E) {} // We expect this to fail - - // Close resources - dataset.close(); - file1->close(); - // Let sid1 go out of scope - - // Free memory buffers - HDfree(wbuf); - HDfree(rbuf); - HDfree(tbuf); - - PASSED(); + // Create dataspace for datasets + hsize_t dims1[] = {SPACE1_DIM1}; + DataSpace sid1(SPACE1_RANK, dims1); + + // Create a group + Group group = file1->createGroup("Group1"); + + // Set group's comment + group.setComment(".", write_comment); + + // Create a dataset (inside /Group1) + DataSet dataset = group.createDataSet(DSET1_NAME, PredType::NATIVE_UINT, sid1); + + unsigned *tu32; // Temporary pointer to uint32 data + int i; + for (tu32=(unsigned *)wbuf, i=0; icreateDataSet("Dataset3", PredType::STD_REF_OBJ, sid1); + + /* Test parameters to H5Location::reference */ + try { + file1->reference(NULL, "/Group1/Dataset1"); + } catch (ReferenceException& E) {} // We expect this to fail + try { + file1->reference(&wbuf[0], NULL); + } catch (ReferenceException& E) {} // We expect this to fail + try { + file1->reference(&wbuf[0], ""); + } catch (ReferenceException& E) {} // We expect this to fail + try { + file1->reference(&wbuf[0], "/Group1/Dataset1", H5R_MAXTYPE); + } catch (ReferenceException& E) {} // We expect this to fail + try { + file1->reference(&wbuf[0], "/Group1/Dataset1", H5R_DATASET_REGION); + } catch (ReferenceException& E) {} // We expect this to fail + + // Close resources + dataset.close(); + file1->close(); + // Let sid1 go out of scope + + // Free memory buffers + HDfree(wbuf); + HDfree(rbuf); + HDfree(tbuf); + + PASSED(); } // end try catch (Exception& E) { - issue_fail_msg("test_reference_param()",__LINE__,__FILE__, - E.getCFuncName(), E.getCDetailMsg()); + issue_fail_msg("test_reference_param()",__LINE__,__FILE__, + E.getCFuncName(), E.getCDetailMsg()); } if(file1) @@ -182,7 +182,7 @@ test_reference_params(void) /**************************************************************** ** ** test_reference_obj(): Test basic object reference functions -** to various kinds of objects +** to various kinds of objects ** ****************************************************************/ static void test_reference_obj(void) @@ -195,176 +195,176 @@ static void test_reference_obj(void) H5File* file1 = NULL; try { - hobj_ref_t *wbuf, // buffer to write to disk - *rbuf, // buffer read from disk - *tbuf; // temp. buffer read from disk + hobj_ref_t *wbuf, // buffer to write to disk + *rbuf, // buffer read from disk + *tbuf; // temp. buffer read from disk - // Allocate write & read buffers - int temp_size = MAX(sizeof(unsigned),sizeof(hobj_ref_t)); - wbuf=(hobj_ref_t*)HDmalloc(temp_size*SPACE1_DIM1); - rbuf=(hobj_ref_t*)HDmalloc(temp_size*SPACE1_DIM1); - tbuf=(hobj_ref_t*)HDmalloc(temp_size*SPACE1_DIM1); + // Allocate write & read buffers + int temp_size = MAX(sizeof(unsigned),sizeof(hobj_ref_t)); + wbuf=(hobj_ref_t*)HDmalloc(temp_size*SPACE1_DIM1); + rbuf=(hobj_ref_t*)HDmalloc(temp_size*SPACE1_DIM1); + tbuf=(hobj_ref_t*)HDmalloc(temp_size*SPACE1_DIM1); // Create file FILE1 file1 = new H5File (FILE1, H5F_ACC_TRUNC); - // Create dataspace for datasets - hsize_t dims1[] = {SPACE1_DIM1}; - DataSpace sid1(SPACE1_RANK, dims1); + // Create dataspace for datasets + hsize_t dims1[] = {SPACE1_DIM1}; + DataSpace sid1(SPACE1_RANK, dims1); - // Create dataset access property list - PropList dapl(H5P_DATASET_ACCESS); + // Create dataset access property list + PropList dapl(H5P_DATASET_ACCESS); - // Create a group - Group group = file1->createGroup("Group1"); + // Create a group + Group group = file1->createGroup("Group1"); - // Set group's comment - group.setComment(".", write_comment); + // Set group's comment + group.setComment(".", write_comment); - // Create a dataset (inside /Group1) - DataSet dataset = group.createDataSet(DSET1_NAME, PredType::NATIVE_UINT, sid1); + // Create a dataset (inside /Group1) + DataSet dataset = group.createDataSet(DSET1_NAME, PredType::NATIVE_UINT, sid1); - unsigned *tu32; // Temporary pointer to uint32 data - for (tu32 = (unsigned *)wbuf, i = 0; i < SPACE1_DIM1; i++) - *tu32++=i*3; // from C test + unsigned *tu32; // Temporary pointer to uint32 data + for (tu32 = (unsigned *)wbuf, i = 0; i < SPACE1_DIM1; i++) + *tu32++=i*3; // from C test - // Write selection to disk - dataset.write(wbuf, PredType::NATIVE_UINT); + // Write selection to disk + dataset.write(wbuf, PredType::NATIVE_UINT); - // Close Dataset - dataset.close(); + // Close Dataset + dataset.close(); - // Create another dataset (inside /Group1) - dataset = group.createDataSet("Dataset2", PredType::NATIVE_UCHAR, sid1); + // Create another dataset (inside /Group1) + dataset = group.createDataSet("Dataset2", PredType::NATIVE_UCHAR, sid1); - // Close Dataset - dataset.close(); + // Close Dataset + dataset.close(); - // Create a datatype to refer to - CompType dtype1(sizeof(s1_t)); + // Create a datatype to refer to + CompType dtype1(sizeof(s1_t)); - // Insert fields - dtype1.insertMember(MEMBER1, HOFFSET(s1_t, a), PredType::NATIVE_INT); - dtype1.insertMember(MEMBER2, HOFFSET(s1_t, b), PredType::NATIVE_INT); - dtype1.insertMember(MEMBER3, HOFFSET(s1_t, c), PredType::NATIVE_FLOAT); + // Insert fields + dtype1.insertMember(MEMBER1, HOFFSET(s1_t, a), PredType::NATIVE_INT); + dtype1.insertMember(MEMBER2, HOFFSET(s1_t, b), PredType::NATIVE_INT); + dtype1.insertMember(MEMBER3, HOFFSET(s1_t, c), PredType::NATIVE_FLOAT); - // Save datatype for later - dtype1.commit(group, "Datatype1"); + // Save datatype for later + dtype1.commit(group, "Datatype1"); - // Close datatype and group - dtype1.close(); - group.close(); + // Close datatype and group + dtype1.close(); + group.close(); - // Create a dataset - dataset = file1->createDataSet("Dataset3", PredType::STD_REF_OBJ, sid1); + // Create a dataset + dataset = file1->createDataSet("Dataset3", PredType::STD_REF_OBJ, sid1); - // Create reference to dataset and test getRefObjType - file1->reference(&wbuf[0], "/Group1/Dataset1"); - H5O_type_t refobj_type = dataset.getRefObjType(&wbuf[0], H5R_OBJECT); - verify_val(refobj_type, H5O_TYPE_DATASET, "DataSet::getRefObjType",__LINE__,__FILE__); + // Create reference to dataset and test getRefObjType + file1->reference(&wbuf[0], "/Group1/Dataset1"); + H5O_type_t refobj_type = dataset.getRefObjType(&wbuf[0], H5R_OBJECT); + verify_val(refobj_type, H5O_TYPE_DATASET, "DataSet::getRefObjType",__LINE__,__FILE__); - // Create reference to dataset and test getRefObjType - file1->reference(&wbuf[1], "/Group1/Dataset2"); - refobj_type = dataset.getRefObjType(&wbuf[1], H5R_OBJECT); - verify_val(refobj_type, H5O_TYPE_DATASET, "DataSet::getRefObjType",__LINE__,__FILE__); + // Create reference to dataset and test getRefObjType + file1->reference(&wbuf[1], "/Group1/Dataset2"); + refobj_type = dataset.getRefObjType(&wbuf[1], H5R_OBJECT); + verify_val(refobj_type, H5O_TYPE_DATASET, "DataSet::getRefObjType",__LINE__,__FILE__); - // Create reference to group - file1->reference(&wbuf[2], "/Group1"); - refobj_type = dataset.getRefObjType(&wbuf[2], H5R_OBJECT); - verify_val(refobj_type, H5O_TYPE_GROUP, "DataSet::getRefObjType",__LINE__,__FILE__); + // Create reference to group + file1->reference(&wbuf[2], "/Group1"); + refobj_type = dataset.getRefObjType(&wbuf[2], H5R_OBJECT); + verify_val(refobj_type, H5O_TYPE_GROUP, "DataSet::getRefObjType",__LINE__,__FILE__); - // Create reference to named datatype - file1->reference(&wbuf[3], "/Group1/Datatype1"); - refobj_type = dataset.getRefObjType(&wbuf[3], H5R_OBJECT); - verify_val(refobj_type, H5O_TYPE_NAMED_DATATYPE, "DataSet::getRefObjType",__LINE__,__FILE__); + // Create reference to named datatype + file1->reference(&wbuf[3], "/Group1/Datatype1"); + refobj_type = dataset.getRefObjType(&wbuf[3], H5R_OBJECT); + verify_val(refobj_type, H5O_TYPE_NAMED_DATATYPE, "DataSet::getRefObjType",__LINE__,__FILE__); - // Write selection to disk - dataset.write(wbuf, PredType::STD_REF_OBJ); + // Write selection to disk + dataset.write(wbuf, PredType::STD_REF_OBJ); - // Close disk dataspace, dataset, and file - sid1.close(); - dataset.close(); - delete file1; + // Close disk dataspace, dataset, and file + sid1.close(); + dataset.close(); + delete file1; - // Re-open the file - file1 = new H5File(FILE1, H5F_ACC_RDWR); + // Re-open the file + file1 = new H5File(FILE1, H5F_ACC_RDWR); - // Open the dataset - dataset = file1->openDataSet("/Dataset3"); + // Open the dataset + dataset = file1->openDataSet("/Dataset3"); - // Read selection from disk - dataset.read(rbuf, PredType::STD_REF_OBJ); + // Read selection from disk + dataset.read(rbuf, PredType::STD_REF_OBJ); - // Dereference dataset object by ctor, from the location where - // 'dataset' is located - DataSet dset2(dataset, &rbuf[0], H5R_OBJECT, dapl); + // Dereference dataset object by ctor, from the location where + // 'dataset' is located + DataSet dset2(dataset, &rbuf[0], H5R_OBJECT, dapl); - // Check information in the referenced dataset - sid1 = dset2.getSpace(); - hssize_t n_elements = sid1.getSimpleExtentNpoints(); - verify_val((long)n_elements, 4, "DataSpace::getSimpleExtentNpoints",__LINE__,__FILE__); + // Check information in the referenced dataset + sid1 = dset2.getSpace(); + hssize_t n_elements = sid1.getSimpleExtentNpoints(); + verify_val((long)n_elements, 4, "DataSpace::getSimpleExtentNpoints",__LINE__,__FILE__); - // Read from disk - dset2.read(tbuf, PredType::NATIVE_UINT); + // Read from disk + dset2.read(tbuf, PredType::NATIVE_UINT); - for(tu32 = (unsigned *)tbuf, i = 0; i < SPACE1_DIM1; i++, tu32++) - verify_val(*tu32, (uint32_t)(i*3), "DataSpace::getSimpleExtentNpoints",__LINE__,__FILE__); + for(tu32 = (unsigned *)tbuf, i = 0; i < SPACE1_DIM1; i++, tu32++) + verify_val(*tu32, (uint32_t)(i*3), "DataSpace::getSimpleExtentNpoints",__LINE__,__FILE__); - // Close dereferenced dataset - dset2.close(); + // Close dereferenced dataset + dset2.close(); - // Dereference group object from the location where 'dataset' is located - group.dereference(dataset, &rbuf[2]); + // Dereference group object from the location where 'dataset' is located + group.dereference(dataset, &rbuf[2]); - // Get group's comment using - // H5std_string getComment(const char* name, ) - H5std_string read_comment1 = group.getComment(".", 10); - verify_val(read_comment1.c_str(), write_comment, "Group::getComment",__LINE__,__FILE__); + // Get group's comment using + // H5std_string getComment(const char* name, ) + H5std_string read_comment1 = group.getComment(".", 10); + verify_val(read_comment1.c_str(), write_comment, "Group::getComment",__LINE__,__FILE__); - // Test with the old default value - read_comment1 = group.getComment(".", 256); - verify_val(read_comment1.c_str(), write_comment, "Group::getComment",__LINE__,__FILE__); + // Test with the old default value + read_comment1 = group.getComment(".", 256); + verify_val(read_comment1.c_str(), write_comment, "Group::getComment",__LINE__,__FILE__); - // Test that getComment handles failures gracefully, using - // H5std_string getComment(const char* name, ) - try { - H5std_string read_comment_tmp = group.getComment(NULL); - } - catch (Exception& E) {} // We expect this to fail + // Test that getComment handles failures gracefully, using + // H5std_string getComment(const char* name, ) + try { + H5std_string read_comment_tmp = group.getComment(NULL); + } + catch (Exception& E) {} // We expect this to fail - // Close group - group.close(); + // Close group + group.close(); - /* - * Verify correct referenced datatype - */ - // Open datatype object - dtype1.dereference(dataset, &rbuf[3]); + /* + * Verify correct referenced datatype + */ + // Open datatype object + dtype1.dereference(dataset, &rbuf[3]); - // Verify correct datatype + // Verify correct datatype H5T_class_t tclass; tclass = dtype1.getClass(); - verify_val(tclass, H5T_COMPOUND, "DataType::getClass",__LINE__,__FILE__); - int n_members = dtype1.getNmembers(); + verify_val(tclass, H5T_COMPOUND, "DataType::getClass",__LINE__,__FILE__); + int n_members = dtype1.getNmembers(); verify_val(n_members, 3, "CompType::getNmembers",__LINE__,__FILE__); - // Close all objects and file - dtype1.close(); - dataset.close(); - file1->close(); + // Close all objects and file + dtype1.close(); + dataset.close(); + file1->close(); - // Free allocated buffers - HDfree(wbuf); - HDfree(rbuf); - HDfree(tbuf); + // Free allocated buffers + HDfree(wbuf); + HDfree(rbuf); + HDfree(tbuf); - PASSED(); + PASSED(); } // end try catch (Exception& E) { - issue_fail_msg("test_reference_obj()",__LINE__,__FILE__, - E.getCFuncName(), E.getCDetailMsg()); + issue_fail_msg("test_reference_obj()",__LINE__,__FILE__, + E.getCFuncName(), E.getCDetailMsg()); } if(file1) @@ -376,7 +376,7 @@ static void test_reference_obj(void) ** ** test_reference_group(): Test object reference functionality ** Tests for correct behavior of various routines on -** dereferenced group +** dereferenced group ** ****************************************************************/ #define GROUPNAME "/group" @@ -389,8 +389,8 @@ static void test_reference_obj(void) static void test_reference_group(void) { - hobj_ref_t wref; /* Reference to write */ - hobj_ref_t rref; /* Reference to read */ + hobj_ref_t wref; /* Reference to write */ + hobj_ref_t rref; /* Reference to read */ const H5std_string write_comment="Foo!"; // Comments for group // Output message about test being performed @@ -398,102 +398,102 @@ test_reference_group(void) H5File* file1 = NULL; try { - /* - * Create file with a group and a dataset containing an object - * reference to the group - */ + /* + * Create file with a group and a dataset containing an object + * reference to the group + */ // Create file FILE1 file1 = new H5File (FILE1, H5F_ACC_TRUNC); - // Create scalar dataspace - DataSpace sid1; + // Create scalar dataspace + DataSpace sid1; - // Create a group - Group group = file1->createGroup(GROUPNAME); + // Create a group + Group group = file1->createGroup(GROUPNAME); - /* Create nested groups */ - Group group2 = group.createGroup(GROUPNAME2); - group2.close(); - group2 = group.createGroup(GROUPNAME3); - group2.close(); + /* Create nested groups */ + Group group2 = group.createGroup(GROUPNAME2); + group2.close(); + group2 = group.createGroup(GROUPNAME3); + group2.close(); - // Create bottom dataset - DataSet dset1 = group.createDataSet(DSETNAME2, PredType::NATIVE_INT, sid1); - dset1.close(); + // Create bottom dataset + DataSet dset1 = group.createDataSet(DSETNAME2, PredType::NATIVE_INT, sid1); + dset1.close(); - // Close group 1 - group.close(); + // Close group 1 + group.close(); - // Create dataset - DataSet dset2 = file1->createDataSet(DSETNAME, PredType::STD_REF_OBJ, sid1); + // Create dataset + DataSet dset2 = file1->createDataSet(DSETNAME, PredType::STD_REF_OBJ, sid1); - file1->reference(&wref, GROUPNAME); + file1->reference(&wref, GROUPNAME); - // Write selection to disk - dset2.write(&wref, PredType::STD_REF_OBJ); + // Write selection to disk + dset2.write(&wref, PredType::STD_REF_OBJ); - // Close resources - dset2.close(); - sid1.close(); - file1->close(); + // Close resources + dset2.close(); + sid1.close(); + file1->close(); - /* - * Re-open the file and test deferencing group - */ + /* + * Re-open the file and test deferencing group + */ - // Re-open file + // Re-open file file1->openFile(FILE1, H5F_ACC_RDWR); - // Re-open dataset - dset1 = file1->openDataSet(DSETNAME); + // Re-open dataset + dset1 = file1->openDataSet(DSETNAME); - // Read in the reference - dset1.read(&rref, PredType::STD_REF_OBJ); + // Read in the reference + dset1.read(&rref, PredType::STD_REF_OBJ); - // Dereference to get the group - Group refgroup(dset1, &rref); + // Dereference to get the group + Group refgroup(dset1, &rref); - // Dereference group object the other way - group.dereference(dset1, &rref); + // Dereference group object the other way + group.dereference(dset1, &rref); - /* - * Various queries on the group opened - */ + /* + * Various queries on the group opened + */ - // Check number of objects in the group dereferenced by constructor - hsize_t nobjs = refgroup.getNumObjs(); - verify_val(nobjs, (hsize_t)3, "H5Group::getNumObjs",__LINE__,__FILE__); + // Check number of objects in the group dereferenced by constructor + hsize_t nobjs = refgroup.getNumObjs(); + verify_val(nobjs, (hsize_t)3, "H5Group::getNumObjs",__LINE__,__FILE__); - // Check number of objects in the group dereferenced by ::reference - nobjs = group.getNumObjs(); - verify_val(nobjs, (hsize_t)3, "H5Group::getNumObjs",__LINE__,__FILE__); + // Check number of objects in the group dereferenced by ::reference + nobjs = group.getNumObjs(); + verify_val(nobjs, (hsize_t)3, "H5Group::getNumObjs",__LINE__,__FILE__); - // Check getting file name given the group dereferenced via constructor - H5std_string fname = refgroup.getFileName(); - verify_val(fname, FILE1, "H5Group::getFileName",__LINE__,__FILE__); + // Check getting file name given the group dereferenced via constructor + H5std_string fname = refgroup.getFileName(); + verify_val(fname, FILE1, "H5Group::getFileName",__LINE__,__FILE__); - // Check getting file name given the group dereferenced by ::reference - fname = group.getFileName(); - verify_val(fname, FILE1, "H5Group::getFileName",__LINE__,__FILE__); - - // Unlink one of the objects in the dereferenced group, and re-check - refgroup.unlink(GROUPNAME2); - nobjs = refgroup.getNumObjs(); - verify_val(nobjs, (hsize_t)2, "H5Group::getNumObjs",__LINE__,__FILE__); - - // Close resources - group.close(); - refgroup.close(); - dset1.close(); - file1->close(); - - PASSED(); + // Check getting file name given the group dereferenced by ::reference + fname = group.getFileName(); + verify_val(fname, FILE1, "H5Group::getFileName",__LINE__,__FILE__); + + // Unlink one of the objects in the dereferenced group, and re-check + refgroup.unlink(GROUPNAME2); + nobjs = refgroup.getNumObjs(); + verify_val(nobjs, (hsize_t)2, "H5Group::getNumObjs",__LINE__,__FILE__); + + // Close resources + group.close(); + refgroup.close(); + dset1.close(); + file1->close(); + + PASSED(); } // end try catch (Exception& E) { - issue_fail_msg("test_reference_group()",__LINE__,__FILE__, - E.getCFuncName(), E.getCDetailMsg()); + issue_fail_msg("test_reference_group()",__LINE__,__FILE__, + E.getCFuncName(), E.getCDetailMsg()); } if(file1) @@ -509,283 +509,283 @@ test_reference_group(void) static void test_reference_region_1D(void) { - hsize_t start[SPACE3_RANK]; /* Starting location of hyperslab */ - hsize_t stride[SPACE3_RANK]; /* Stride of hyperslab */ - hsize_t count[SPACE3_RANK]; /* Element count of hyperslab */ - hsize_t block[SPACE3_RANK]; /* Block size of hyperslab */ - hsize_t coord1[POINT1_NPOINTS][SPACE3_RANK]; /* Coordinates for point selection */ + hsize_t start[SPACE3_RANK]; /* Starting location of hyperslab */ + hsize_t stride[SPACE3_RANK]; /* Stride of hyperslab */ + hsize_t count[SPACE3_RANK]; /* Element count of hyperslab */ + hsize_t block[SPACE3_RANK]; /* Block size of hyperslab */ + hsize_t coord1[POINT1_NPOINTS][SPACE3_RANK]; /* Coordinates for point selection */ hsize_t * coords; /* Coordinate buffer */ - hsize_t low[SPACE3_RANK]; /* Selection bounds */ - hsize_t high[SPACE3_RANK]; /* Selection bounds */ + hsize_t low[SPACE3_RANK]; /* Selection bounds */ + hsize_t high[SPACE3_RANK]; /* Selection bounds */ int i; /* counting variables */ // Output message about test being performed SUBTEST("1-D Dataset Region Reference Functions"); try { - hdset_reg_ref_t *wbuf, // buffer to write to disk - *rbuf; // buffer read from disk - uint8_t *dwbuf, // Buffer for writing numeric data to disk - *drbuf; // Buffer for reading numeric data from disk + hdset_reg_ref_t *wbuf, // buffer to write to disk + *rbuf; // buffer read from disk + uint8_t *dwbuf, // Buffer for writing numeric data to disk + *drbuf; // Buffer for reading numeric data from disk - // Allocate write & read buffers - wbuf = (hdset_reg_ref_t *)HDcalloc(sizeof(hdset_reg_ref_t), (size_t)SPACE1_DIM1); - rbuf = (hdset_reg_ref_t *)HDmalloc(sizeof(hdset_reg_ref_t) * SPACE1_DIM1); - dwbuf = (uint8_t *)HDmalloc(sizeof(uint8_t) * SPACE3_DIM1); - drbuf = (uint8_t *)HDcalloc(sizeof(uint8_t), (size_t)SPACE3_DIM1); + // Allocate write & read buffers + wbuf = (hdset_reg_ref_t *)HDcalloc(sizeof(hdset_reg_ref_t), (size_t)SPACE1_DIM1); + rbuf = (hdset_reg_ref_t *)HDmalloc(sizeof(hdset_reg_ref_t) * SPACE1_DIM1); + dwbuf = (uint8_t *)HDmalloc(sizeof(uint8_t) * SPACE3_DIM1); + drbuf = (uint8_t *)HDcalloc(sizeof(uint8_t), (size_t)SPACE3_DIM1); // Create file FILE1 H5File file1(FILE2, H5F_ACC_TRUNC); - // Create dataspace for datasets - hsize_t dims3[] = {SPACE3_DIM1}; - DataSpace sid3(SPACE3_RANK, dims3); + // Create dataspace for datasets + hsize_t dims3[] = {SPACE3_DIM1}; + DataSpace sid3(SPACE3_RANK, dims3); - // Create dataset access property list - PropList dapl(H5P_DATASET_ACCESS); + // Create dataset access property list + PropList dapl(H5P_DATASET_ACCESS); - // Create a dataset - DataSet dset3 = file1.createDataSet(DSET2_NAME, PredType::STD_U8LE, sid3); + // Create a dataset + DataSet dset3 = file1.createDataSet(DSET2_NAME, PredType::STD_U8LE, sid3); - uint8_t *tu8; // Temporary pointer to uint8 data - for (tu8 = dwbuf, i = 0; i < SPACE3_DIM1; i++) - *tu8++ = i * 3; // from C test + uint8_t *tu8; // Temporary pointer to uint8 data + for (tu8 = dwbuf, i = 0; i < SPACE3_DIM1; i++) + *tu8++ = i * 3; // from C test - // Write selection to disk - dset3.write(dwbuf, PredType::STD_U8LE); + // Write selection to disk + dset3.write(dwbuf, PredType::STD_U8LE); - // Close Dataset - dset3.close(); + // Close Dataset + dset3.close(); - // Create dataspace for datasets - hsize_t dims1[] = {SPACE1_DIM1}; - DataSpace sid1(SPACE1_RANK, dims1); + // Create dataspace for datasets + hsize_t dims1[] = {SPACE1_DIM1}; + DataSpace sid1(SPACE1_RANK, dims1); - // Create a dataset - DataSet dset1 = file1.createDataSet(DSET1_NAME, PredType::STD_REF_DSETREG, sid1); + // Create a dataset + DataSet dset1 = file1.createDataSet(DSET1_NAME, PredType::STD_REF_DSETREG, sid1); - /* - * Create references and prepare for testing - */ + /* + * Create references and prepare for testing + */ - /* Select 15 2x1 hyperslabs for first reference */ - start[0] = 2; - stride[0] = 5; - count[0] = 15; - block[0] = 2; + /* Select 15 2x1 hyperslabs for first reference */ + start[0] = 2; + stride[0] = 5; + count[0] = 15; + block[0] = 2; - // Select a hyperslab region to add to the current selected region - sid3.selectHyperslab(H5S_SELECT_SET, count, start, stride, block); + // Select a hyperslab region to add to the current selected region + sid3.selectHyperslab(H5S_SELECT_SET, count, start, stride, block); - // Get and verify the number of elements in a dataspace selection - hssize_t nelms = sid3.getSelectNpoints(); - verify_val(nelms, 30, "DataSet::getRefObjType",__LINE__,__FILE__); + // Get and verify the number of elements in a dataspace selection + hssize_t nelms = sid3.getSelectNpoints(); + verify_val(nelms, 30, "DataSet::getRefObjType",__LINE__,__FILE__); - // Store first dataset region - file1.reference(&wbuf[0], "/Dataset2", sid3); + // Store first dataset region + file1.reference(&wbuf[0], "/Dataset2", sid3); - // Get and verify object type - H5O_type_t obj_type = dset1.getRefObjType(&wbuf[0], H5R_DATASET_REGION); - verify_val(obj_type, H5O_TYPE_DATASET, "DataSet::getRefObjType",__LINE__,__FILE__); + // Get and verify object type + H5O_type_t obj_type = dset1.getRefObjType(&wbuf[0], H5R_DATASET_REGION); + verify_val(obj_type, H5O_TYPE_DATASET, "DataSet::getRefObjType",__LINE__,__FILE__); - /* Select sequence of ten points for second reference */ - coord1[0][0] = 16; - coord1[1][0] = 22; - coord1[2][0] = 38; - coord1[3][0] = 41; - coord1[4][0] = 52; - coord1[5][0] = 63; - coord1[6][0] = 70; - coord1[7][0] = 89; - coord1[8][0] = 97; - coord1[9][0] = 3; - - // Selects array elements to be included in the selection for sid3 - sid3.selectElements(H5S_SELECT_SET, (size_t)POINT1_NPOINTS, (const hsize_t *)coord1); - - // Get and verify the number of elements in a dataspace selection - nelms = sid3.getSelectNpoints(); - verify_val(nelms, 10, "DataSet::getRefObjType",__LINE__,__FILE__); - - // Store first dataset region - file1.reference(&wbuf[1], "/Dataset2", sid3); - - // Write selection to disk - dset1.write(wbuf, PredType::STD_REF_DSETREG); - - // Close disk dataspace, dataset, and file - sid1.close(); - dset1.close(); - sid3.close(); - file1.close(); - - /* - * Testing various dereference functions - */ - - // Re-open the file - file1.openFile(FILE2, H5F_ACC_RDWR); - - // Open the dataset - dset1 = file1.openDataSet("/Dataset1"); - - // Read selection from disk - dset1.read(rbuf, PredType::STD_REF_DSETREG); - - { // Test DataSet::dereference - dset3.dereference(dset1, &rbuf[0], H5R_DATASET_REGION, dapl); - - // Get and verify object type - obj_type = dset1.getRefObjType(&rbuf[0], H5R_DATASET_REGION); - verify_val(obj_type, H5O_TYPE_DATASET, "DataSet::getRefObjType",__LINE__,__FILE__); - - // Get dataspace of dset3 the verify number of elements - sid1 = dset3.getSpace(); - nelms = sid1.getSimpleExtentNpoints(); - verify_val((long)nelms, 100, "DataSpace::getSimpleExtentNpoints",__LINE__,__FILE__); - } // End of test DataSet::dereference - - { // Test DataSet constructor -by dereference - // Dereference dataset object by ctor, from the location where - // 'dset1' is located - DataSet newds(dset1, &rbuf[0], H5R_DATASET_REGION, dapl); - - // Get dataspace of newds then verify number of elements - sid1 = newds.getSpace(); - nelms = sid1.getSimpleExtentNpoints(); - verify_val((long)nelms, 100, "DataSpace::getSimpleExtentNpoints",__LINE__,__FILE__); - - // Close objects for this mini test - newds.close(); - sid1.close(); - } // End of test DataSet constructor -by dereference - - // Read from disk - dset3.read(drbuf, PredType::STD_U8LE); - - for(tu8 = (uint8_t *)drbuf, i = 0; i < SPACE3_DIM1; i++, tu8++) - verify_val(*tu8, (uint8_t)(i * 3), "DataSpace::getSimpleExtentNpoints",__LINE__,__FILE__); - - /* - * Test getting the referenced region - */ - - // Get region - DataSpace reg_sp = dset1.getRegion(&rbuf[0]); - - // Get and verify number of elements in a dataspace selection - nelms = reg_sp.getSelectNpoints(); - verify_val((long)nelms, 30, "DataSpace::getSelectNpoints",__LINE__,__FILE__); - - // Get and verify number of hyperslab blocks - nelms = reg_sp.getSelectHyperNblocks(); - verify_val((long)nelms, 15, "DataSpace::getSelectNpoints",__LINE__,__FILE__); - - /* Allocate space for the hyperslab blocks */ - coords = (hsize_t *)HDmalloc(nelms * SPACE3_RANK * sizeof(hsize_t) * 2); - - // Get the list of hyperslab blocks currently selected - reg_sp.getSelectHyperBlocklist((hsize_t)0, (hsize_t)nelms, coords); - - // Verify values in the list - verify_val(coords[0], (hsize_t)2, "Hyperslab Coordinates",__LINE__,__FILE__); - verify_val(coords[1], (hsize_t)3, "Hyperslab Coordinates",__LINE__,__FILE__); - verify_val(coords[2], (hsize_t)7, "Hyperslab Coordinates",__LINE__,__FILE__); - verify_val(coords[3], (hsize_t)8, "Hyperslab Coordinates",__LINE__,__FILE__); - verify_val(coords[4],(hsize_t)12, "Hyperslab Coordinates",__LINE__,__FILE__); - verify_val(coords[5],(hsize_t)13, "Hyperslab Coordinates",__LINE__,__FILE__); - verify_val(coords[6],(hsize_t)17, "Hyperslab Coordinates",__LINE__,__FILE__); - verify_val(coords[7],(hsize_t)18, "Hyperslab Coordinates",__LINE__,__FILE__); - verify_val(coords[8],(hsize_t)22, "Hyperslab Coordinates",__LINE__,__FILE__); - verify_val(coords[9],(hsize_t)23, "Hyperslab Coordinates",__LINE__,__FILE__); - verify_val(coords[10],(hsize_t)27, "Hyperslab Coordinates",__LINE__,__FILE__); - verify_val(coords[11],(hsize_t)28, "Hyperslab Coordinates",__LINE__,__FILE__); - verify_val(coords[12],(hsize_t)32, "Hyperslab Coordinates",__LINE__,__FILE__); - verify_val(coords[13],(hsize_t)33, "Hyperslab Coordinates",__LINE__,__FILE__); - verify_val(coords[14],(hsize_t)37, "Hyperslab Coordinates",__LINE__,__FILE__); - verify_val(coords[15],(hsize_t)38, "Hyperslab Coordinates",__LINE__,__FILE__); - verify_val(coords[16],(hsize_t)42, "Hyperslab Coordinates",__LINE__,__FILE__); - verify_val(coords[17],(hsize_t)43, "Hyperslab Coordinates",__LINE__,__FILE__); - verify_val(coords[18],(hsize_t)47, "Hyperslab Coordinates",__LINE__,__FILE__); - verify_val(coords[19],(hsize_t)48, "Hyperslab Coordinates",__LINE__,__FILE__); - verify_val(coords[20],(hsize_t)52, "Hyperslab Coordinates",__LINE__,__FILE__); - verify_val(coords[21],(hsize_t)53, "Hyperslab Coordinates",__LINE__,__FILE__); - verify_val(coords[22],(hsize_t)57, "Hyperslab Coordinates",__LINE__,__FILE__); - verify_val(coords[23],(hsize_t)58, "Hyperslab Coordinates",__LINE__,__FILE__); - verify_val(coords[24],(hsize_t)62, "Hyperslab Coordinates",__LINE__,__FILE__); - verify_val(coords[25],(hsize_t)63, "Hyperslab Coordinates",__LINE__,__FILE__); - verify_val(coords[26],(hsize_t)67, "Hyperslab Coordinates",__LINE__,__FILE__); - verify_val(coords[27],(hsize_t)68, "Hyperslab Coordinates",__LINE__,__FILE__); - verify_val(coords[28],(hsize_t)72, "Hyperslab Coordinates",__LINE__,__FILE__); - verify_val(coords[29],(hsize_t)73, "Hyperslab Coordinates",__LINE__,__FILE__); - - HDfree(coords); - - // Check boundaries - reg_sp.getSelectBounds(low, high); - verify_val(low[0],(hsize_t)2, "DataSpace::getSelectBounds",__LINE__,__FILE__); - verify_val(high[0],(hsize_t)73, "DataSpace::getSelectBounds",__LINE__,__FILE__); - - /* Close region space */ - reg_sp.close(); - - /* - * Another test on getting the referenced region - */ - - // Get region - DataSpace elm_sp = dset1.getRegion(&rbuf[1]); - - // Get and verify number of element points in the current selection - hssize_t nelmspts = elm_sp.getSelectElemNpoints(); - verify_val((long)nelmspts, 10, "DataSpace::getSelectNpoints",__LINE__,__FILE__); - - /* Allocate space for the hyperslab blocks */ - coords = (hsize_t *)HDmalloc(nelmspts * SPACE3_RANK * sizeof(hsize_t)); - - // Get the list of element points currently selected - elm_sp.getSelectElemPointlist((hsize_t)0, (hsize_t)nelmspts, coords); - - // Verify points - verify_val(coords[0], coord1[0][0], "Element Coordinates",__LINE__,__FILE__); - verify_val(coords[1], coord1[1][0], "Element Coordinates",__LINE__,__FILE__); - verify_val(coords[2], coord1[2][0], "Element Coordinates",__LINE__,__FILE__); - verify_val(coords[3], coord1[3][0], "Element Coordinates",__LINE__,__FILE__); - verify_val(coords[4], coord1[4][0], "Element Coordinates",__LINE__,__FILE__); - verify_val(coords[5], coord1[5][0], "Element Coordinates",__LINE__,__FILE__); - verify_val(coords[6], coord1[6][0], "Element Coordinates",__LINE__,__FILE__); - verify_val(coords[7], coord1[7][0], "Element Coordinates",__LINE__,__FILE__); - verify_val(coords[8], coord1[8][0], "Element Coordinates",__LINE__,__FILE__); - verify_val(coords[9], coord1[9][0], "Element Coordinates",__LINE__,__FILE__); - - HDfree(coords); - - // Check boundaries - elm_sp.getSelectBounds(low, high); - verify_val(low[0],(hsize_t)3, "DataSpace::getSelectBounds",__LINE__,__FILE__); - verify_val(high[0],(hsize_t)97, "DataSpace::getSelectBounds",__LINE__,__FILE__); - - // Close element space - elm_sp.close(); - - // Close resources - sid1.close(); - dset3.close(); - dset1.close(); - file1.close(); - - // Free memory buffers - HDfree(wbuf); - HDfree(rbuf); - HDfree(dwbuf); - HDfree(drbuf); - - PASSED(); + /* Select sequence of ten points for second reference */ + coord1[0][0] = 16; + coord1[1][0] = 22; + coord1[2][0] = 38; + coord1[3][0] = 41; + coord1[4][0] = 52; + coord1[5][0] = 63; + coord1[6][0] = 70; + coord1[7][0] = 89; + coord1[8][0] = 97; + coord1[9][0] = 3; + + // Selects array elements to be included in the selection for sid3 + sid3.selectElements(H5S_SELECT_SET, (size_t)POINT1_NPOINTS, (const hsize_t *)coord1); + + // Get and verify the number of elements in a dataspace selection + nelms = sid3.getSelectNpoints(); + verify_val(nelms, 10, "DataSet::getRefObjType",__LINE__,__FILE__); + + // Store first dataset region + file1.reference(&wbuf[1], "/Dataset2", sid3); + + // Write selection to disk + dset1.write(wbuf, PredType::STD_REF_DSETREG); + + // Close disk dataspace, dataset, and file + sid1.close(); + dset1.close(); + sid3.close(); + file1.close(); + + /* + * Testing various dereference functions + */ + + // Re-open the file + file1.openFile(FILE2, H5F_ACC_RDWR); + + // Open the dataset + dset1 = file1.openDataSet("/Dataset1"); + + // Read selection from disk + dset1.read(rbuf, PredType::STD_REF_DSETREG); + + { // Test DataSet::dereference + dset3.dereference(dset1, &rbuf[0], H5R_DATASET_REGION, dapl); + + // Get and verify object type + obj_type = dset1.getRefObjType(&rbuf[0], H5R_DATASET_REGION); + verify_val(obj_type, H5O_TYPE_DATASET, "DataSet::getRefObjType",__LINE__,__FILE__); + + // Get dataspace of dset3 the verify number of elements + sid1 = dset3.getSpace(); + nelms = sid1.getSimpleExtentNpoints(); + verify_val((long)nelms, 100, "DataSpace::getSimpleExtentNpoints",__LINE__,__FILE__); + } // End of test DataSet::dereference + + { // Test DataSet constructor -by dereference + // Dereference dataset object by ctor, from the location where + // 'dset1' is located + DataSet newds(dset1, &rbuf[0], H5R_DATASET_REGION, dapl); + + // Get dataspace of newds then verify number of elements + sid1 = newds.getSpace(); + nelms = sid1.getSimpleExtentNpoints(); + verify_val((long)nelms, 100, "DataSpace::getSimpleExtentNpoints",__LINE__,__FILE__); + + // Close objects for this mini test + newds.close(); + sid1.close(); + } // End of test DataSet constructor -by dereference + + // Read from disk + dset3.read(drbuf, PredType::STD_U8LE); + + for(tu8 = (uint8_t *)drbuf, i = 0; i < SPACE3_DIM1; i++, tu8++) + verify_val(*tu8, (uint8_t)(i * 3), "DataSpace::getSimpleExtentNpoints",__LINE__,__FILE__); + + /* + * Test getting the referenced region + */ + + // Get region + DataSpace reg_sp = dset1.getRegion(&rbuf[0]); + + // Get and verify number of elements in a dataspace selection + nelms = reg_sp.getSelectNpoints(); + verify_val((long)nelms, 30, "DataSpace::getSelectNpoints",__LINE__,__FILE__); + + // Get and verify number of hyperslab blocks + nelms = reg_sp.getSelectHyperNblocks(); + verify_val((long)nelms, 15, "DataSpace::getSelectNpoints",__LINE__,__FILE__); + + /* Allocate space for the hyperslab blocks */ + coords = (hsize_t *)HDmalloc(nelms * SPACE3_RANK * sizeof(hsize_t) * 2); + + // Get the list of hyperslab blocks currently selected + reg_sp.getSelectHyperBlocklist((hsize_t)0, (hsize_t)nelms, coords); + + // Verify values in the list + verify_val(coords[0], (hsize_t)2, "Hyperslab Coordinates",__LINE__,__FILE__); + verify_val(coords[1], (hsize_t)3, "Hyperslab Coordinates",__LINE__,__FILE__); + verify_val(coords[2], (hsize_t)7, "Hyperslab Coordinates",__LINE__,__FILE__); + verify_val(coords[3], (hsize_t)8, "Hyperslab Coordinates",__LINE__,__FILE__); + verify_val(coords[4],(hsize_t)12, "Hyperslab Coordinates",__LINE__,__FILE__); + verify_val(coords[5],(hsize_t)13, "Hyperslab Coordinates",__LINE__,__FILE__); + verify_val(coords[6],(hsize_t)17, "Hyperslab Coordinates",__LINE__,__FILE__); + verify_val(coords[7],(hsize_t)18, "Hyperslab Coordinates",__LINE__,__FILE__); + verify_val(coords[8],(hsize_t)22, "Hyperslab Coordinates",__LINE__,__FILE__); + verify_val(coords[9],(hsize_t)23, "Hyperslab Coordinates",__LINE__,__FILE__); + verify_val(coords[10],(hsize_t)27, "Hyperslab Coordinates",__LINE__,__FILE__); + verify_val(coords[11],(hsize_t)28, "Hyperslab Coordinates",__LINE__,__FILE__); + verify_val(coords[12],(hsize_t)32, "Hyperslab Coordinates",__LINE__,__FILE__); + verify_val(coords[13],(hsize_t)33, "Hyperslab Coordinates",__LINE__,__FILE__); + verify_val(coords[14],(hsize_t)37, "Hyperslab Coordinates",__LINE__,__FILE__); + verify_val(coords[15],(hsize_t)38, "Hyperslab Coordinates",__LINE__,__FILE__); + verify_val(coords[16],(hsize_t)42, "Hyperslab Coordinates",__LINE__,__FILE__); + verify_val(coords[17],(hsize_t)43, "Hyperslab Coordinates",__LINE__,__FILE__); + verify_val(coords[18],(hsize_t)47, "Hyperslab Coordinates",__LINE__,__FILE__); + verify_val(coords[19],(hsize_t)48, "Hyperslab Coordinates",__LINE__,__FILE__); + verify_val(coords[20],(hsize_t)52, "Hyperslab Coordinates",__LINE__,__FILE__); + verify_val(coords[21],(hsize_t)53, "Hyperslab Coordinates",__LINE__,__FILE__); + verify_val(coords[22],(hsize_t)57, "Hyperslab Coordinates",__LINE__,__FILE__); + verify_val(coords[23],(hsize_t)58, "Hyperslab Coordinates",__LINE__,__FILE__); + verify_val(coords[24],(hsize_t)62, "Hyperslab Coordinates",__LINE__,__FILE__); + verify_val(coords[25],(hsize_t)63, "Hyperslab Coordinates",__LINE__,__FILE__); + verify_val(coords[26],(hsize_t)67, "Hyperslab Coordinates",__LINE__,__FILE__); + verify_val(coords[27],(hsize_t)68, "Hyperslab Coordinates",__LINE__,__FILE__); + verify_val(coords[28],(hsize_t)72, "Hyperslab Coordinates",__LINE__,__FILE__); + verify_val(coords[29],(hsize_t)73, "Hyperslab Coordinates",__LINE__,__FILE__); + + HDfree(coords); + + // Check boundaries + reg_sp.getSelectBounds(low, high); + verify_val(low[0],(hsize_t)2, "DataSpace::getSelectBounds",__LINE__,__FILE__); + verify_val(high[0],(hsize_t)73, "DataSpace::getSelectBounds",__LINE__,__FILE__); + + /* Close region space */ + reg_sp.close(); + + /* + * Another test on getting the referenced region + */ + + // Get region + DataSpace elm_sp = dset1.getRegion(&rbuf[1]); + + // Get and verify number of element points in the current selection + hssize_t nelmspts = elm_sp.getSelectElemNpoints(); + verify_val((long)nelmspts, 10, "DataSpace::getSelectNpoints",__LINE__,__FILE__); + + /* Allocate space for the hyperslab blocks */ + coords = (hsize_t *)HDmalloc(nelmspts * SPACE3_RANK * sizeof(hsize_t)); + + // Get the list of element points currently selected + elm_sp.getSelectElemPointlist((hsize_t)0, (hsize_t)nelmspts, coords); + + // Verify points + verify_val(coords[0], coord1[0][0], "Element Coordinates",__LINE__,__FILE__); + verify_val(coords[1], coord1[1][0], "Element Coordinates",__LINE__,__FILE__); + verify_val(coords[2], coord1[2][0], "Element Coordinates",__LINE__,__FILE__); + verify_val(coords[3], coord1[3][0], "Element Coordinates",__LINE__,__FILE__); + verify_val(coords[4], coord1[4][0], "Element Coordinates",__LINE__,__FILE__); + verify_val(coords[5], coord1[5][0], "Element Coordinates",__LINE__,__FILE__); + verify_val(coords[6], coord1[6][0], "Element Coordinates",__LINE__,__FILE__); + verify_val(coords[7], coord1[7][0], "Element Coordinates",__LINE__,__FILE__); + verify_val(coords[8], coord1[8][0], "Element Coordinates",__LINE__,__FILE__); + verify_val(coords[9], coord1[9][0], "Element Coordinates",__LINE__,__FILE__); + + HDfree(coords); + + // Check boundaries + elm_sp.getSelectBounds(low, high); + verify_val(low[0],(hsize_t)3, "DataSpace::getSelectBounds",__LINE__,__FILE__); + verify_val(high[0],(hsize_t)97, "DataSpace::getSelectBounds",__LINE__,__FILE__); + + // Close element space + elm_sp.close(); + + // Close resources + sid1.close(); + dset3.close(); + dset1.close(); + file1.close(); + + // Free memory buffers + HDfree(wbuf); + HDfree(rbuf); + HDfree(dwbuf); + HDfree(drbuf); + + PASSED(); } // end try catch (Exception& E) { - issue_fail_msg("test_reference_region_1D()",__LINE__,__FILE__, - E.getCFuncName(), E.getCDetailMsg()); + issue_fail_msg("test_reference_region_1D()",__LINE__,__FILE__, + E.getCFuncName(), E.getCDetailMsg()); } } /* test_reference_region_1D() */ @@ -823,9 +823,9 @@ void test_reference(void) /**************************************************************** -** Function: cleanup_reference -** Purpose: Cleanup temporary test files -** Return: none +** Function: cleanup_reference +** Purpose Cleanup temporary test files +** Return none ****************************************************************/ extern "C" void cleanup_reference(void) diff --git a/c++/test/ttypes.cpp b/c++/test/ttypes.cpp index 6605c03..0cc8918 100644 --- a/c++/test/ttypes.cpp +++ b/c++/test/ttypes.cpp @@ -37,7 +37,7 @@ using namespace H5; * Offset from alinged memory returned by malloc(). This can be used to test * that type conversions handle non-aligned buffers correctly. */ -#define ALIGNMENT 1 +#define ALIGNMENT 1 /* * Define if you want to test alignment code on a machine that doesn't @@ -70,7 +70,7 @@ const char *FILENAME[] = { * endian. If local variable `endian' is H5T_ORDER_BE then the result will * be I, otherwise the result will be Z-(I+1). */ -#define ENDIAN(Z,I) (H5T_ORDER_BE==endian?(I):(Z)-((I)+1)) +#define ENDIAN(Z,I) (H5T_ORDER_BE==endian?(I):(Z)-((I)+1)) typedef enum flt_t { @@ -86,12 +86,12 @@ typedef enum int_t { /*------------------------------------------------------------------------- * Function: test_classes * - * Purpose: Test type classes + * Purpose Test type classes * - * Return: None. + * Return None. * - * Programmer: Binh-Minh Ribler (using C version) - * January, 2007 + * Programmer Binh-Minh Ribler (using C version) + * January, 2007 * * Modifications: * @@ -101,38 +101,38 @@ static void test_classes() { SUBTEST("PredType::getClass()"); try { - // maybe later, int curr_nerrors = GetTestNumErrs(); - - // PredType::NATIVE_INT should be in H5T_INTEGER class - H5T_class_t tcls = PredType::NATIVE_INT.getClass(); - if (H5T_INTEGER!=tcls) { - puts(" Invalid type class for H5T_NATIVE_INT"); - } - - // PredType::NATIVE_DOUBLE should be in H5T_FLOAT class - tcls = PredType::NATIVE_DOUBLE.getClass(); - if (H5T_FLOAT!=tcls) { - verify_val(tcls, H5T_FLOAT, "test_class: invalid type class for NATIVE_DOUBLE -", __LINE__, __FILE__); - } - PASSED(); + // maybe later, int curr_nerrors = GetTestNumErrs(); + + // PredType::NATIVE_INT should be in H5T_INTEGER class + H5T_class_t tcls = PredType::NATIVE_INT.getClass(); + if (H5T_INTEGER!=tcls) { + puts(" Invalid type class for H5T_NATIVE_INT"); + } + + // PredType::NATIVE_DOUBLE should be in H5T_FLOAT class + tcls = PredType::NATIVE_DOUBLE.getClass(); + if (H5T_FLOAT!=tcls) { + verify_val(tcls, H5T_FLOAT, "test_class: invalid type class for NATIVE_DOUBLE -", __LINE__, __FILE__); + } + PASSED(); } // end of try block catch (Exception& E) { - issue_fail_msg("test_classes", __LINE__, __FILE__, E.getCDetailMsg()); + issue_fail_msg("test_classes", __LINE__, __FILE__, E.getCDetailMsg()); } } /*------------------------------------------------------------------------- * Function: test_copy * - * Purpose: Test datatype copy functionality + * Purpose Test datatype copy functionality * - * Return: Success: 0 + * Return Success: 0 * - * Failure: number of errors + * Failure: number of errors * - * Programmer: Binh-Minh Ribler (using C version) - * January, 2007 + * Programmer Binh-Minh Ribler (using C version) + * January, 2007 * * Modifications: * @@ -143,21 +143,21 @@ static void test_copy() SUBTEST("DataType::copy() and DataType::operator="); try { - // Test copying from a predefined datatype using DataType::operator= - DataType assigned_type; - assigned_type = PredType::NATIVE_SHORT; + // Test copying from a predefined datatype using DataType::operator= + DataType assigned_type; + assigned_type = PredType::NATIVE_SHORT; // Test copying a predefined type using DataType::copy - DataType copied_type; + DataType copied_type; copied_type.copy (PredType::STD_B8LE); - // Test copying a user-defined type using DataType::operator= - DataType assigned_usertype; - assigned_usertype = copied_type; + // Test copying a user-defined type using DataType::operator= + DataType assigned_usertype; + assigned_usertype = copied_type; - // Test copying from a user-defined datatype using DataType::copy - DataType copied_usertype; - copied_usertype.copy(copied_type); + // Test copying from a user-defined datatype using DataType::copy + DataType copied_usertype; + copied_usertype.copy(copied_type); // Test copying a user-defined int type using DataType::operator= IntType orig_int(PredType::STD_B8LE); @@ -171,26 +171,26 @@ static void test_copy() IntType another_int_type; another_int_type = new_int_type; - PASSED(); + PASSED(); } catch (Exception& E) { - issue_fail_msg("test_copy", __LINE__, __FILE__, E.getCDetailMsg()); + issue_fail_msg("test_copy", __LINE__, __FILE__, E.getCDetailMsg()); } } /*------------------------------------------------------------------------- - * Function: test_query + * Function: test_query * - * Purpose: Tests query functions of compound and enumeration types. + * Purpose Tests query functions of compound and enumeration types. * - * Return: Success: 0 + * Return Success: 0 * - * Failure: number of errors + * Failure: number of errors * - * Programmer: Binh-Minh Ribler (use C version) - * January, 2007 + * Programmer Binh-Minh Ribler (use C version) + * January, 2007 * * Modifications: * @@ -203,113 +203,113 @@ const H5std_string EnumT_NAME("Enum_type"); static void test_query() { typedef struct { - int a; - float b; - long c; - double d; + int a; + float b; + long c; + double d; } src_typ_t; - short enum_val; + short enum_val; // Output message about test being performed SUBTEST("Query functions of compound and enumeration types"); try { - // Create File - H5File file(FILENAME[2], H5F_ACC_TRUNC); - - // Create a compound datatype - CompType tid1(sizeof(src_typ_t)); - - tid1.insertMember("a", HOFFSET(src_typ_t, a), PredType::NATIVE_INT); - tid1.insertMember("b", HOFFSET(src_typ_t, b), PredType::NATIVE_FLOAT); - tid1.insertMember("c", HOFFSET(src_typ_t, c), PredType::NATIVE_LONG); - tid1.insertMember("d", HOFFSET(src_typ_t, d), PredType::NATIVE_DOUBLE); - - // Create a enumerate datatype - EnumType tid2(sizeof(short)); - - tid2.insert("RED", (enum_val=0,&enum_val)); - tid2.insert("GREEN", (enum_val=1,&enum_val)); - tid2.insert("BLUE", (enum_val=2,&enum_val)); - tid2.insert("ORANGE", (enum_val=3,&enum_val)); - tid2.insert("YELLOW", (enum_val=4,&enum_val)); - - // Query member number and member index by name, for compound type - int nmembs = tid1.getNmembers(); - verify_val(nmembs, 4, "CompType::getNmembers()", __LINE__, __FILE__); - - int index = tid1.getMemberIndex("c"); - verify_val(index, 2, "CompType::getMemberIndex()", __LINE__, __FILE__); - - // Query member number and member index by name, for enumeration type. - nmembs = tid2.getNmembers(); - verify_val(nmembs, 5, "EnumType::getNmembers()", __LINE__, __FILE__); - - index = tid2.getMemberIndex("ORANGE"); - verify_val(index, 3, "EnumType::getMemberIndex()", __LINE__, __FILE__); - - // Commit compound datatype and close it - tid1.commit(file, CompT_NAME); - tid1.close(); - - // Commit enumeration datatype and close it - tid2.commit(file, EnumT_NAME); - tid2.close(); - - // Open the datatypes for query - - // Deprecated functions - tid1 = file.openCompType(CompT_NAME); - tid1.close(); - tid2 = file.openEnumType(EnumT_NAME); - tid2.close(); - - CompType comptype(file, CompT_NAME); - EnumType enumtype(file, EnumT_NAME); - - // Query member number and member index by name, for compound type - nmembs = comptype.getNmembers(); - verify_val(nmembs, 4, "CompType::getNmembers()", __LINE__, __FILE__); - index = comptype.getMemberIndex("c"); - verify_val(index, 2, "CompType::getMemberIndex()", __LINE__, __FILE__); - - // Query member number and member index by name, for enumeration type - nmembs = enumtype.getNmembers(); - verify_val(nmembs, 5, "EnumType::getNmembers()", __LINE__, __FILE__); - index = enumtype.getMemberIndex("ORANGE"); - verify_val(index, 3, "EnumType::getMemberIndex()", __LINE__, __FILE__); - - // Close datatypes and file - comptype.close(); - enumtype.close(); - file.close(); - - // Try truncating the file to make sure reference counting is good. - // If any references to ids of the accessed types are left unterminated, - // the truncating will fail, because the file will not be closed in - // the file.close() above. - H5File file1(FILENAME[2], H5F_ACC_TRUNC); - - PASSED(); + // Create File + H5File file(FILENAME[2], H5F_ACC_TRUNC); + + // Create a compound datatype + CompType tid1(sizeof(src_typ_t)); + + tid1.insertMember("a", HOFFSET(src_typ_t, a), PredType::NATIVE_INT); + tid1.insertMember("b", HOFFSET(src_typ_t, b), PredType::NATIVE_FLOAT); + tid1.insertMember("c", HOFFSET(src_typ_t, c), PredType::NATIVE_LONG); + tid1.insertMember("d", HOFFSET(src_typ_t, d), PredType::NATIVE_DOUBLE); + + // Create a enumerate datatype + EnumType tid2(sizeof(short)); + + tid2.insert("RED", (enum_val=0,&enum_val)); + tid2.insert("GREEN", (enum_val=1,&enum_val)); + tid2.insert("BLUE", (enum_val=2,&enum_val)); + tid2.insert("ORANGE", (enum_val=3,&enum_val)); + tid2.insert("YELLOW", (enum_val=4,&enum_val)); + + // Query member number and member index by name, for compound type + int nmembs = tid1.getNmembers(); + verify_val(nmembs, 4, "CompType::getNmembers()", __LINE__, __FILE__); + + int index = tid1.getMemberIndex("c"); + verify_val(index, 2, "CompType::getMemberIndex()", __LINE__, __FILE__); + + // Query member number and member index by name, for enumeration type. + nmembs = tid2.getNmembers(); + verify_val(nmembs, 5, "EnumType::getNmembers()", __LINE__, __FILE__); + + index = tid2.getMemberIndex("ORANGE"); + verify_val(index, 3, "EnumType::getMemberIndex()", __LINE__, __FILE__); + + // Commit compound datatype and close it + tid1.commit(file, CompT_NAME); + tid1.close(); + + // Commit enumeration datatype and close it + tid2.commit(file, EnumT_NAME); + tid2.close(); + + // Open the datatypes for query + + // Deprecated functions + tid1 = file.openCompType(CompT_NAME); + tid1.close(); + tid2 = file.openEnumType(EnumT_NAME); + tid2.close(); + + CompType comptype(file, CompT_NAME); + EnumType enumtype(file, EnumT_NAME); + + // Query member number and member index by name, for compound type + nmembs = comptype.getNmembers(); + verify_val(nmembs, 4, "CompType::getNmembers()", __LINE__, __FILE__); + index = comptype.getMemberIndex("c"); + verify_val(index, 2, "CompType::getMemberIndex()", __LINE__, __FILE__); + + // Query member number and member index by name, for enumeration type + nmembs = enumtype.getNmembers(); + verify_val(nmembs, 5, "EnumType::getNmembers()", __LINE__, __FILE__); + index = enumtype.getMemberIndex("ORANGE"); + verify_val(index, 3, "EnumType::getMemberIndex()", __LINE__, __FILE__); + + // Close datatypes and file + comptype.close(); + enumtype.close(); + file.close(); + + // Try truncating the file to make sure reference counting is good. + // If any references to ids of the accessed types are left unterminated, + // the truncating will fail, because the file will not be closed in + // the file.close() above. + H5File file1(FILENAME[2], H5F_ACC_TRUNC); + + PASSED(); } // end of try block catch (Exception& E) { - issue_fail_msg("test_query", __LINE__, __FILE__, E.getCDetailMsg()); + issue_fail_msg("test_query", __LINE__, __FILE__, E.getCDetailMsg()); } } // test_query /*------------------------------------------------------------------------- - * Function: test_transient + * Function: test_transient * - * Purpose: Tests transient datatypes. + * Purpose Tests transient datatypes. * - * Return: Success: 0 + * Return Success: 0 * - * Failure: number of errors + * Failure: number of errors * - * Programmer: Binh-Minh Ribler (use C version) - * January, 2007 + * Programmer Binh-Minh Ribler (use C version) + * January, 2007 * * Modifications: * @@ -318,58 +318,58 @@ static void test_query() const char* filename1 = "dtypes1.h5"; static void test_transient () { - static hsize_t ds_size[2] = {10, 20}; + static hsize_t ds_size[2] = {10, 20}; SUBTEST("Transient datatypes"); try { - // Create the file and the dataspace. - H5File file(filename1, H5F_ACC_TRUNC); - DataSpace space(2, ds_size, ds_size); - - // Copying a predefined type results in a modifiable copy - IntType type(PredType::NATIVE_INT); - type.setPrecision(256); - - // It should not be possible to create an attribute for a transient type - try { - Attribute attr(type.createAttribute("attr1", PredType::NATIVE_INT, space)); - // Should FAIL but didn't, so throw an invalid action exception - throw InvalidActionException("H5Object::createAttribute", "Attempted to commit a predefined datatype."); - } catch (AttributeIException& err) {} // do nothing, failure expected - - // Create a dataset from a transient datatype - // type.close(); - put trace in H5Tclose to make sure it's closed - type.copy(PredType::NATIVE_INT); - DataSet dset(file.createDataSet("dset1", type, space)); - - // The type returned from a dataset should not be modifiable - IntType itype(dset); - try { - itype.setPrecision(256); - - // Should FAIL but didn't, so throw an invalid action exception - throw InvalidActionException("PredType::setPrecision", "Dataset datatypes should not be modifiable!"); - } catch (DataTypeIException& err) {} - itype.close(); - - // Get a copy of the dataset's datatype by applying DataType::copy() - // to the dataset. The resulted datatype should be modifiable. - itype.copy(dset); - itype.setPrecision(256); - itype.close(); - - // Close the dataset and reopen it, testing that its type is still - // read-only. (Note that a copy of it is modifiable.) - dset.close(); - dset = file.openDataSet("dset1"); - - // Close objects and file. - dset.close(); - file.close(); - type.close(); - space.close(); - PASSED(); + // Create the file and the dataspace. + H5File file(filename1, H5F_ACC_TRUNC); + DataSpace space(2, ds_size, ds_size); + + // Copying a predefined type results in a modifiable copy + IntType type(PredType::NATIVE_INT); + type.setPrecision(256); + + // It should not be possible to create an attribute for a transient type + try { + Attribute attr(type.createAttribute("attr1", PredType::NATIVE_INT, space)); + // Should FAIL but didn't, so throw an invalid action exception + throw InvalidActionException("H5Object::createAttribute", "Attempted to commit a predefined datatype."); + } catch (AttributeIException& err) {} // do nothing, failure expected + + // Create a dataset from a transient datatype + // type.close(); - put trace in H5Tclose to make sure it's closed + type.copy(PredType::NATIVE_INT); + DataSet dset(file.createDataSet("dset1", type, space)); + + // The type returned from a dataset should not be modifiable + IntType itype(dset); + try { + itype.setPrecision(256); + + // Should FAIL but didn't, so throw an invalid action exception + throw InvalidActionException("PredType::setPrecision", "Dataset datatypes should not be modifiable!"); + } catch (DataTypeIException& err) {} + itype.close(); + + // Get a copy of the dataset's datatype by applying DataType::copy() + // to the dataset. The resulted datatype should be modifiable. + itype.copy(dset); + itype.setPrecision(256); + itype.close(); + + // Close the dataset and reopen it, testing that its type is still + // read-only. (Note that a copy of it is modifiable.) + dset.close(); + dset = file.openDataSet("dset1"); + + // Close objects and file. + dset.close(); + file.close(); + type.close(); + space.close(); + PASSED(); } // end of try block catch (Exception& E) { @@ -379,16 +379,16 @@ static void test_transient () /*------------------------------------------------------------------------- - * Function: test_named + * Function: test_named * - * Purpose: Tests named datatypes. + * Purpose Tests named datatypes. * - * Return: Success: 0 + * Return Success: 0 * - * Failure: number of errors + * Failure: number of errors * - * Programmer: Binh-Minh Ribler (use C version) - * January, 2007 + * Programmer Binh-Minh Ribler (use C version) + * January, 2007 * * Modifications: * @@ -397,141 +397,141 @@ static void test_transient () const H5std_string filename2("dtypes2.h5"); static void test_named () { - static hsize_t ds_size[2] = {10, 20}; - hsize_t i; - unsigned attr_data[10][20]; - DataType *ds_type = NULL; + static hsize_t ds_size[2] = {10, 20}; + hsize_t i; + unsigned attr_data[10][20]; + DataType *ds_type = NULL; SUBTEST("Named datatypes"); try { - // Create the file. - H5File file(filename2, H5F_ACC_TRUNC); + // Create the file. + H5File file(filename2, H5F_ACC_TRUNC); - // Create a simple dataspace. - DataSpace space(2, ds_size, ds_size); + // Create a simple dataspace. + DataSpace space(2, ds_size, ds_size); - // Predefined types cannot be committed. - try { - PredType nativeint(PredType::NATIVE_INT); - nativeint.commit(file, "test_named_1 (should not exist)"); + // Predefined types cannot be committed. + try { + PredType nativeint(PredType::NATIVE_INT); + nativeint.commit(file, "test_named_1 (should not exist)"); - // Should FAIL but didn't, so throw an invalid action exception - throw InvalidActionException("PredType::commit", "Attempted to commit a predefined datatype."); - } catch (DataTypeIException& err) {} + // Should FAIL but didn't, so throw an invalid action exception + throw InvalidActionException("PredType::commit", "Attempted to commit a predefined datatype."); + } catch (DataTypeIException& err) {} - // Copy a predefined datatype and commit the copy. + // Copy a predefined datatype and commit the copy. IntType itype(PredType::NATIVE_INT); itype.commit(file, "native-int"); - // Test commit passing in const H5File& for prototype with const - try - { - // Create random char type - IntType atype(PredType::NATIVE_UCHAR); + // Test commit passing in const H5File& for prototype with const + try + { + // Create random char type + IntType atype(PredType::NATIVE_UCHAR); - // Creating group, declared as const - const Group const_grp = file.createGroup("GR as loc"); + // Creating group, declared as const + const Group const_grp = file.createGroup("GR as loc"); - // Commit type passing in const group; compilation would fail if - // no matching prototype - atype.commit(const_grp, "random uchar"); - } // end of try block - catch (Exception& E) + // Commit type passing in const group; compilation would fail if + // no matching prototype + atype.commit(const_grp, "random uchar"); + } // end of try block + catch (Exception& E) { - issue_fail_msg("test_named", __LINE__, __FILE__, "Commit at const group"); - } - - // Check that it is committed. - if (itype.committed() == false) - cerr << "IntType::committed() returned false" << endl; - - // We should not be able to modify a type after it has been committed. - try { - itype.setPrecision(256); // attempt an invalid action... - - // Should FAIL but didn't, so throw an invalid action exception - throw InvalidActionException("IntType::setPrecision", "Attempted to modify a committed datatype."); - } catch (DataTypeIException& err) {} - - // We should not be able to re-commit a committed type - try { - itype.commit(file, "test_named_2 (should not exist)"); - - // Should FAIL but didn't, so throw an invalid action exception - throw InvalidActionException("IntType::commit", "Attempted to re-commit a committed datatype."); - } catch (DataTypeIException& err) {} // do nothing, failure expected - - // It should be possible to define an attribute for the named type - Attribute attr1 = itype.createAttribute("attr1", PredType::NATIVE_UCHAR, space); - for (i=0; icommitted(); - if (!iscommitted) - throw InvalidActionException("IntType::committed()", "Dataset type should be named type!"); - dset.close(); - ds_type->close(); + issue_fail_msg("test_named", __LINE__, __FILE__, "Commit at const group"); + } + + // Check that it is committed. + if (itype.committed() == false) + cerr << "IntType::committed() returned false" << endl; + + // We should not be able to modify a type after it has been committed. + try { + itype.setPrecision(256); // attempt an invalid action... + + // Should FAIL but didn't, so throw an invalid action exception + throw InvalidActionException("IntType::setPrecision", "Attempted to modify a committed datatype."); + } catch (DataTypeIException& err) {} + + // We should not be able to re-commit a committed type + try { + itype.commit(file, "test_named_2 (should not exist)"); + + // Should FAIL but didn't, so throw an invalid action exception + throw InvalidActionException("IntType::commit", "Attempted to re-commit a committed datatype."); + } catch (DataTypeIException& err) {} // do nothing, failure expected + + // It should be possible to define an attribute for the named type + Attribute attr1 = itype.createAttribute("attr1", PredType::NATIVE_UCHAR, space); + for (i=0; icommitted(); + if (!iscommitted) + throw InvalidActionException("IntType::committed()", "Dataset type should be named type!"); + dset.close(); + ds_type->close(); delete ds_type; - // Reopen the dataset and its type, then make sure the type is - // a named type. - dset = file.openDataSet("dset1"); - ds_type = new DataType(dset.getDataType()); - iscommitted = ds_type->committed(); - if (!iscommitted) - throw InvalidActionException("IntType::committed()", "Dataset type should be named type!"); - - // Close the dataset and create another with the type returned from - // the first dataset. - dset.close(); - dset = file.createDataSet("dset2", *ds_type, space); - ds_type->close(); - dset.close(); + // Reopen the dataset and its type, then make sure the type is + // a named type. + dset = file.openDataSet("dset1"); + ds_type = new DataType(dset.getDataType()); + iscommitted = ds_type->committed(); + if (!iscommitted) + throw InvalidActionException("IntType::committed()", "Dataset type should be named type!"); + + // Close the dataset and create another with the type returned from + // the first dataset. + dset.close(); + dset = file.createDataSet("dset2", *ds_type, space); + ds_type->close(); + dset.close(); delete ds_type; - // Reopen the second dataset and make sure the type is shared - dset = file.openDataSet("dset2"); - ds_type = new DataType(dset.getDataType()); - iscommitted = ds_type->committed(); - if (!iscommitted) - throw InvalidActionException("DataType::iscommitted()", "Dataset type should be named type!"); - ds_type->close(); - - // Get the dataset datatype by applying DataType::copy() to the - // dataset. The resulted datatype should be modifiable. - IntType copied_type; - copied_type.copy(dset); - copied_type.setPrecision(256); - copied_type.close(); - - // Clean up - dset.close(); - itype.close(); - space.close(); - file.close(); - PASSED(); + // Reopen the second dataset and make sure the type is shared + dset = file.openDataSet("dset2"); + ds_type = new DataType(dset.getDataType()); + iscommitted = ds_type->committed(); + if (!iscommitted) + throw InvalidActionException("DataType::iscommitted()", "Dataset type should be named type!"); + ds_type->close(); + + // Get the dataset datatype by applying DataType::copy() to the + // dataset. The resulted datatype should be modifiable. + IntType copied_type; + copied_type.copy(dset); + copied_type.setPrecision(256); + copied_type.close(); + + // Clean up + dset.close(); + itype.close(); + space.close(); + file.close(); + PASSED(); } // end of try block catch (Exception& E) { @@ -565,14 +565,14 @@ void test_types() /*------------------------------------------------------------------------- - * Function: cleanup_types + * Function: cleanup_types * - * Purpose: Cleanup temporary test files + * Purpose Cleanup temporary test files * - * Return: none + * Return none * - * Programmer: Quincey Koziol - * September 10, 1999 + * Programmer Quincey Koziol + * September 10, 1999 * * Modifications: * @@ -582,5 +582,5 @@ extern "C" void cleanup_types() { for (int i = 0; i < 3; i++) - HDremove(FILENAME[i]); + HDremove(FILENAME[i]); } // cleanup_types diff --git a/c++/test/tvlstr.cpp b/c++/test/tvlstr.cpp index 43dcc0b..5dee1a2 100644 --- a/c++/test/tvlstr.cpp +++ b/c++/test/tvlstr.cpp @@ -45,9 +45,9 @@ const hsize_t SPACE1_DIM1 = 4; /**************************************************************** ** ** test_vlstr_alloc_custom(): Test VL datatype custom memory -** allocation routines. This routine just uses malloc to -** allocate the memory and increments the amount of memory -** allocated. It is passed into setVlenMemManager. +** allocation routines. This routine just uses malloc to +** allocate the memory and increments the amount of memory +** allocated. It is passed into setVlenMemManager. ** ** Note: exact copy from the C version. ** (Not used now) @@ -55,9 +55,9 @@ const hsize_t SPACE1_DIM1 = 4; #if 0 // not used now static void *test_vlstr_alloc_custom(size_t size, void *info) { - void *ret_value=NULL; // Pointer to return + void *ret_value=NULL; // Pointer to return size_t *mem_used=(size_t *)info; // Get the pointer to the memory used - size_t extra; // Extra space needed + size_t extra; // Extra space needed /* * This weird contortion is required on the DEC Alpha to keep the @@ -67,8 +67,8 @@ static void *test_vlstr_alloc_custom(size_t size, void *info) extra=MAX(sizeof(void *),sizeof(size_t)); if((ret_value=HDmalloc(extra+size))!=NULL) { - *(size_t *)ret_value=size; - *mem_used+=size; + *(size_t *)ret_value=size; + *mem_used+=size; } // end if ret_value = ((unsigned char *)ret_value) + extra; @@ -79,9 +79,9 @@ static void *test_vlstr_alloc_custom(size_t size, void *info) /**************************************************************** ** ** test_vlstr_free_custom(): Test VL datatype custom memory -** allocation routines. This routine just uses free to -** release the memory and decrements the amount of memory -** allocated. It is passed into setVlenMemManager. +** allocation routines. This routine just uses free to +** release the memory and decrements the amount of memory +** allocated. It is passed into setVlenMemManager. ** ** Note: exact copy from the C version. ** (Not used now) @@ -91,7 +91,7 @@ static void test_vlstr_free_custom(void *_mem, void *info) { unsigned char *mem; size_t *mem_used=(size_t *)info; // Get the pointer to the memory used - size_t extra; // Extra space needed + size_t extra; // Extra space needed /* * This weird contortion is required on the DEC Alpha to keep the @@ -109,14 +109,14 @@ static void test_vlstr_free_custom(void *_mem, void *info) #endif /*------------------------------------------------------------------------- - * Function: test_vlstring_dataset + * Function: test_vlstring_dataset * - * Purpose: Test writing/reading VL strings on datasets. + * Purpose Test writing/reading VL strings on datasets. * - * Return: None + * Return None * - * Programmer: Binh-Minh Ribler (use C version) - * January, 2007 + * Programmer Binh-Minh Ribler (use C version) + * January, 2007 * *------------------------------------------------------------------------- */ @@ -136,89 +136,89 @@ static void test_vlstring_dataset() SUBTEST("VL String on Datasets"); try { - // Open the file - H5File file1(FILENAME, H5F_ACC_TRUNC); + // Open the file + H5File file1(FILENAME, H5F_ACC_TRUNC); - // Create a datatype to refer to. - StrType vlst(0, H5T_VARIABLE); + // Create a datatype to refer to. + StrType vlst(0, H5T_VARIABLE); - // Open the root group. - Group root = file1.openGroup("/"); + // Open the root group. + Group root = file1.openGroup("/"); - // Create dataspace for the dataset. - DataSpace ds_space (H5S_SCALAR); + // Create dataspace for the dataset. + DataSpace ds_space (H5S_SCALAR); - // Create an dataset in the root group. - DataSet dset1 = root.createDataSet(DSET1_NAME, vlst, ds_space); + // Create an dataset in the root group. + DataSet dset1 = root.createDataSet(DSET1_NAME, vlst, ds_space); - // Write data to the dataset. - dset1.write(DSET1_DATA, vlst); + // Write data to the dataset. + dset1.write(DSET1_DATA, vlst); - // Read and verify the dataset string as a string of chars. - dset1.read(&string_ds_check, vlst); - if(HDstrcmp(string_ds_check, DSET1_DATA.c_str())!=0) - TestErrPrintf("Line %d: Attribute data different: DSET1_DATA=%s,string_ds_check=%s\n",__LINE__, DSET1_DATA.c_str(), string_ds_check); + // Read and verify the dataset string as a string of chars. + dset1.read(&string_ds_check, vlst); + if(HDstrcmp(string_ds_check, DSET1_DATA.c_str())!=0) + TestErrPrintf("Line %d: Attribute data different: DSET1_DATA=%s,string_ds_check=%s\n",__LINE__, DSET1_DATA.c_str(), string_ds_check); - HDfree(string_ds_check); // note: no need for std::string test + HDfree(string_ds_check); // note: no need for std::string test string_ds_check = NULL; - // Read and verify the dataset string as an std::string. - H5std_string read_str; - dset1.read(read_str, vlst); - if (read_str != DSET1_DATA) - TestErrPrintf("Line %d: Attribute data different: DSET1_DATA=%s,read_str=%s\n",__LINE__, DSET1_DATA.c_str(), read_str.c_str()); + // Read and verify the dataset string as an std::string. + H5std_string read_str; + dset1.read(read_str, vlst); + if (read_str != DSET1_DATA) + TestErrPrintf("Line %d: Attribute data different: DSET1_DATA=%s,read_str=%s\n",__LINE__, DSET1_DATA.c_str(), read_str.c_str()); - // Close the dataset. - dset1.close(); + // Close the dataset. + dset1.close(); - // Test scalar type dataset with 1 value. - dset1 = root.createDataSet("test_scalar_small", vlst, ds_space); + // Test scalar type dataset with 1 value. + dset1 = root.createDataSet("test_scalar_small", vlst, ds_space); - dynstring_ds_write = (char*)HDcalloc(1, sizeof(char)); - HDmemset(dynstring_ds_write, 'A', 1); + dynstring_ds_write = (char*)HDcalloc(1, sizeof(char)); + HDmemset(dynstring_ds_write, 'A', 1); - // Write data to the dataset, then read it back. - dset1.write(&dynstring_ds_write, vlst); - dset1.read(&string_ds_check, vlst); + // Write data to the dataset, then read it back. + dset1.write(&dynstring_ds_write, vlst); + dset1.read(&string_ds_check, vlst); - // Verify data read. - if(HDstrcmp(string_ds_check,dynstring_ds_write)!=0) - TestErrPrintf("VL string datasets don't match!, dynstring_ds_write=%s, string_ds_check=%s\n",dynstring_ds_write,string_ds_check); - HDfree(string_ds_check); + // Verify data read. + if(HDstrcmp(string_ds_check,dynstring_ds_write)!=0) + TestErrPrintf("VL string datasets don't match!, dynstring_ds_write=%s, string_ds_check=%s\n",dynstring_ds_write,string_ds_check); + HDfree(string_ds_check); string_ds_check = NULL; - dset1.close(); + dset1.close(); - // Open dataset DSET1_NAME again. - dset1 = root.openDataSet(DSET1_NAME); + // Open dataset DSET1_NAME again. + dset1 = root.openDataSet(DSET1_NAME); - // Close dataset and file - dset1.close(); - file1.close(); + // Close dataset and file + dset1.close(); + file1.close(); - PASSED(); + PASSED(); } // end try block // Catch all exceptions. catch (Exception& E) { - issue_fail_msg("test_vlstring_dataset()", __LINE__, __FILE__, E.getCDetailMsg()); + issue_fail_msg("test_vlstring_dataset()", __LINE__, __FILE__, E.getCDetailMsg()); } if(dynstring_ds_write) HDfree(dynstring_ds_write); if(string_ds_check) - HDfree(string_ds_check); + HDfree(string_ds_check); } // test_vlstring_dataset() /*------------------------------------------------------------------------- - * Function: test_vlstring_array_dataset + * Function: test_vlstring_array_dataset * - * Purpose: Test writing/reading VL string array to/from datasets. + * Purpose Test writing/reading VL string array to/from datasets. * - * Return: None + * Return None * - * Programmer: Binh-Minh Ribler - * July, 2009 + * Programmer Binh-Minh Ribler + * July, 2009 * *------------------------------------------------------------------------- */ @@ -235,89 +235,89 @@ static void test_vlstring_array_dataset() H5File* file1 = NULL; try { // Create file. - file1 = new H5File(FILENAME, H5F_ACC_RDWR); + file1 = new H5File(FILENAME, H5F_ACC_RDWR); // Create dataspace for datasets. hsize_t dims1[] = {SPACE1_DIM1}; DataSpace ds_space(SPACE1_RANK, dims1); - // Create a datatype to refer to. - StrType vlst(0, H5T_VARIABLE); - - // Create and write a dataset. - DataSet dataset(file1->createDataSet(DSSTRARR_NAME, vlst, ds_space)); - dataset.write(string_ds_array, vlst); - - // Read and verify the dataset using strings of chars as buffer. - // Note: reading by array of H5std_string doesn't work yet. - char *string_ds_check[SPACE1_DIM1]; - dataset.read(string_ds_check, vlst); - - hsize_t ii; - for (ii = 0; ii < SPACE1_DIM1; ii++) - { - if(HDstrcmp(string_ds_check[ii], string_ds_array[ii])!=0) - TestErrPrintf("Line %d: Dataset data different: written=%s,read=%s\n",__LINE__, string_ds_array[ii], string_ds_check[ii]); - - HDfree(string_ds_check[ii]); - } - - // Close objects that are no longer needed. - dataset.close(); - ds_space.close(); - - // - // Test with scalar data space. - // - - // Create H5S_SCALAR data space. - DataSpace scalar_space; - - // Create and write another dataset. - DataSet dataset2(file1->createDataSet("Dataset2", vlst, scalar_space)); - char *wdata2 = (char*)HDcalloc(65534, sizeof(char)); - HDmemset(wdata2, 'A', 65533); - dataset2.write(&wdata2, vlst); - - char *rdata2; - dataset2.read(&rdata2, vlst); - if (HDstrcmp(wdata2, rdata2)!=0) - TestErrPrintf("Line %d: Dataset data different: written=%s,read=%s\n",__LINE__, wdata2, rdata2); - - // Release resources from second dataset operation. - scalar_space.close(); - dataset2.close(); - HDfree(wdata2); - HDfree(rdata2); - - // Close objects and file. - dataset2.close(); - vlst.close(); - file1->close(); - - PASSED(); + // Create a datatype to refer to. + StrType vlst(0, H5T_VARIABLE); + + // Create and write a dataset. + DataSet dataset(file1->createDataSet(DSSTRARR_NAME, vlst, ds_space)); + dataset.write(string_ds_array, vlst); + + // Read and verify the dataset using strings of chars as buffer. + // Note: reading by array of H5std_string doesn't work yet. + char *string_ds_check[SPACE1_DIM1]; + dataset.read(string_ds_check, vlst); + + hsize_t ii; + for (ii = 0; ii < SPACE1_DIM1; ii++) + { + if(HDstrcmp(string_ds_check[ii], string_ds_array[ii])!=0) + TestErrPrintf("Line %d: Dataset data different: written=%s,read=%s\n",__LINE__, string_ds_array[ii], string_ds_check[ii]); + + HDfree(string_ds_check[ii]); + } + + // Close objects that are no longer needed. + dataset.close(); + ds_space.close(); + + // + // Test with scalar data space. + // + + // Create H5S_SCALAR data space. + DataSpace scalar_space; + + // Create and write another dataset. + DataSet dataset2(file1->createDataSet("Dataset2", vlst, scalar_space)); + char *wdata2 = (char*)HDcalloc(65534, sizeof(char)); + HDmemset(wdata2, 'A', 65533); + dataset2.write(&wdata2, vlst); + + char *rdata2; + dataset2.read(&rdata2, vlst); + if (HDstrcmp(wdata2, rdata2)!=0) + TestErrPrintf("Line %d: Dataset data different: written=%s,read=%s\n",__LINE__, wdata2, rdata2); + + // Release resources from second dataset operation. + scalar_space.close(); + dataset2.close(); + HDfree(wdata2); + HDfree(rdata2); + + // Close objects and file. + dataset2.close(); + vlst.close(); + file1->close(); + + PASSED(); } // end try // Catch all exceptions. catch (Exception& E) { - issue_fail_msg("test_vlstring_array_dataset()", __LINE__, __FILE__, E.getCDetailMsg()); + issue_fail_msg("test_vlstring_array_dataset()", __LINE__, __FILE__, E.getCDetailMsg()); } if(file1) - delete file1; + delete file1; } // end test_vlstring_array_dataset() /*------------------------------------------------------------------------- - * Function: test_vlstrings_special + * Function: test_vlstrings_special * - * Purpose: Test VL string code for special string cases, nil and - * zero-sized. + * Purpose Test VL string code for special string cases, nil and + * zero-sized. * - * Return: None + * Return None * - * Programmer: Binh-Minh Ribler (use C version) - * January, 2007 + * Programmer Binh-Minh Ribler (use C version) + * January, 2007 * *------------------------------------------------------------------------- */ @@ -331,110 +331,110 @@ static void test_vlstrings_special() SUBTEST("Special VL Strings"); try { - // Create file. - H5File file1(FILENAME, H5F_ACC_TRUNC); + // Create file. + H5File file1(FILENAME, H5F_ACC_TRUNC); // Create dataspace for datasets. hsize_t dims1[] = {SPACE1_DIM1}; DataSpace sid1(SPACE1_RANK, dims1); - // Create a datatype to refer to. - StrType vlst(0, H5T_VARIABLE); - - // Create a dataset. - DataSet dataset(file1.createDataSet("Dataset3", vlst, sid1)); - - // Read from the dataset before writing data. - dataset.read(rdata, vlst); - - // Check data read in. - hsize_t ii; // counting variable - for (ii=0; iiopenStrType(VLSTR_TYPE); // deprecated + // Try opening datatype again. + vlst = file1->openStrType(VLSTR_TYPE); // deprecated - // Close again and reopen with constructor. - vlst.close(); - StrType vlst1(*file1, VLSTR_TYPE); + // Close again and reopen with constructor. + vlst.close(); + StrType vlst1(*file1, VLSTR_TYPE); - // Close datatype and file. - vlst1.close(); - file1->close(); + // Close datatype and file. + vlst1.close(); + file1->close(); delete file1; - // Open file. - file1 = new H5File(FILENAME, H5F_ACC_RDWR); + // Open file. + file1 = new H5File(FILENAME, H5F_ACC_RDWR); - // Open the variable-length string datatype just created - StrType vlst2(*file1, VLSTR_TYPE); + // Open the variable-length string datatype just created + StrType vlst2(*file1, VLSTR_TYPE); - // Verify character set and padding - cset = vlst2.getCset(); - verify_val(cset, H5T_CSET_ASCII, "StrType::getCset", __LINE__, __FILE__); - pad = vlst2.getStrpad(); - verify_val(pad, H5T_STR_NULLPAD, "StrType::getStrpad", __LINE__, __FILE__); + // Verify character set and padding + cset = vlst2.getCset(); + verify_val(cset, H5T_CSET_ASCII, "StrType::getCset", __LINE__, __FILE__); + pad = vlst2.getStrpad(); + verify_val(pad, H5T_STR_NULLPAD, "StrType::getStrpad", __LINE__, __FILE__); - // Close datatype and file - vlst2.close(); - file1->close(); + // Close datatype and file + vlst2.close(); + file1->close(); - PASSED(); + PASSED(); } // end try block // Catch all exceptions. @@ -516,18 +516,18 @@ static void test_vlstring_type() } if(file1) - delete file1; + delete file1; } // end test_vlstring_type() /*------------------------------------------------------------------------- - * Function: test_compact_vlstring + * Function: test_compact_vlstring * - * Purpose: Test storing VL strings in compact datasets. + * Purpose Test storing VL strings in compact datasets. * - * Return: None + * Return None * - * Programmer: Binh-Minh Ribler (use C version) - * January, 2007 + * Programmer Binh-Minh Ribler (use C version) + * January, 2007 * *------------------------------------------------------------------------- */ @@ -537,55 +537,55 @@ static void test_compact_vlstring() SUBTEST("VL Strings on Compact Dataset"); try { - // Create file - H5File file1(FILENAME, H5F_ACC_TRUNC); + // Create file + H5File file1(FILENAME, H5F_ACC_TRUNC); - // Create dataspace for datasets + // Create dataspace for datasets hsize_t dims1[] = {SPACE1_DIM1}; DataSpace sid1(SPACE1_RANK, dims1); - // Create a datatype to refer to - StrType vlst(0, H5T_VARIABLE); - - // Create dataset create property list and set layout - DSetCreatPropList plist; - plist.setLayout(H5D_COMPACT); - - // Create a dataset - DataSet dataset(file1.createDataSet("Dataset5", vlst, sid1, plist)); - - // Write dataset to disk - const char *wdata[SPACE1_DIM1] = {"one", "two", "three", "four"}; - dataset.write(wdata, vlst); - - // Read dataset from disk - char *rdata[SPACE1_DIM1]; // Information read in - dataset.read(rdata, vlst); - - // Compare data read in - hsize_t i; - for (i=0; i ${TEST}") TRY_RUN (${TEST}_RUN ${TEST}_COMPILE @@ -177,41 +177,41 @@ MACRO (H5ConversionTests TEST msg) OUTPUT_VARIABLE OUTPUT ) if (${TEST}_COMPILE) - if (${TEST}_RUN MATCHES 0) + if (${TEST}_RUN MATCHES 0) set (${TEST} 1 CACHE INTERNAL ${msg}) message (STATUS "${msg}... yes") - else (${TEST}_RUN MATCHES 0) + else () set (${TEST} "" CACHE INTERNAL ${msg}) message (STATUS "${msg}... no") file (APPEND ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeError.log "Test ${TEST} Run failed with the following output and exit code:\n ${OUTPUT}\n" ) - endif (${TEST}_RUN MATCHES 0) - else (${TEST}_COMPILE ) + endif () + else () set (${TEST} "" CACHE INTERNAL ${msg}) message (STATUS "${msg}... no") file (APPEND ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeError.log "Test ${TEST} Compile failed with the following output:\n ${OUTPUT}\n" ) - endif (${TEST}_COMPILE) + endif () - endif ("${TEST}" MATCHES "^${TEST}$") -ENDMACRO (H5ConversionTests) + endif () +endmacro () #----------------------------------------------------------------------------- # Macro to make some of the conversion tests easier to write/read #----------------------------------------------------------------------------- -MACRO (H5MiscConversionTest VAR TEST msg) +macro (H5MiscConversionTest VAR TEST msg) if ("${TEST}" MATCHES "^${TEST}$") if (${VAR}) set (${TEST} 1 CACHE INTERNAL ${msg}) message (STATUS "${msg}... yes") - else (${VAR}) + else () set (${TEST} "" CACHE INTERNAL ${msg}) message (STATUS "${msg}... no") - endif (${VAR}) - endif ("${TEST}" MATCHES "^${TEST}$") -ENDMACRO (H5MiscConversionTest) + endif () + endif () +endmacro () #----------------------------------------------------------------------------- # Check various conversion capabilities @@ -219,9 +219,9 @@ ENDMACRO (H5MiscConversionTest) # ---------------------------------------------------------------------- # Set the flag to indicate that the machine is using a special algorithm to convert -# 'long double' to '(unsigned) long' values. (This flag should only be set for -# the IBM Power6 Linux. When the bit sequence of long double is -# 0x4351ccf385ebc8a0bfcc2a3c3d855620, the converted value of (unsigned)long +# 'long double' to '(unsigned) long' values. (This flag should only be set for +# the IBM Power6 Linux. When the bit sequence of long double is +# 0x4351ccf385ebc8a0bfcc2a3c3d855620, the converted value of (unsigned)long # is 0x004733ce17af227f, not the same as the library's conversion to 0x004733ce17af2282. # The machine's conversion gets the correct value. We define the macro and disable # this kind of test until we figure out what algorithm they use. @@ -229,10 +229,10 @@ ENDMACRO (H5MiscConversionTest) H5ConversionTests (H5_LDOUBLE_TO_LONG_SPECIAL "Checking IF your system converts long double to (unsigned) long values with special algorithm") # ---------------------------------------------------------------------- # Set the flag to indicate that the machine is using a special algorithm -# to convert some values of '(unsigned) long' to 'long double' values. -# (This flag should be off for all machines, except for IBM Power6 Linux, -# when the bit sequences are 003fff..., 007fff..., 00ffff..., 01ffff..., -# ..., 7fffff..., the compiler uses a unknown algorithm. We define a +# to convert some values of '(unsigned) long' to 'long double' values. +# (This flag should be off for all machines, except for IBM Power6 Linux, +# when the bit sequences are 003fff..., 007fff..., 00ffff..., 01ffff..., +# ..., 7fffff..., the compiler uses a unknown algorithm. We define a # macro and skip the test for now until we know about the algorithm. # H5ConversionTests (H5_LONG_TO_LDOUBLE_SPECIAL "Checking IF your system can convert (unsigned) long to long double values with special algorithm") @@ -261,7 +261,7 @@ H5ConversionTests (H5_NO_ALIGNMENT_RESTRICTIONS "Checking IF alignment restricti # ----------------------------------------------------------------------- # wrapper script variables -# +# set (prefix ${CMAKE_INSTALL_PREFIX}) set (exec_prefix "\${prefix}") set (libdir "${exec_prefix}/lib") @@ -272,4 +272,4 @@ set (CXX ${CMAKE_CXX_COMPILER}) set (FC ${CMAKE_Fortran_COMPILER}) foreach (LINK_LIB ${LINK_LIBS}) set (LIBS "${LIBS} -l${LINK_LIB}") -endforeach (LINK_LIB ${LINK_LIBS}) +endforeach () diff --git a/config/cmake/FindHDFJAVA.cmake.in b/config/cmake/FindHDFJAVA.cmake.in index b822280..25057e6 100644 --- a/config/cmake/FindHDFJAVA.cmake.in +++ b/config/cmake/FindHDFJAVA.cmake.in @@ -4,18 +4,18 @@ # # Find the HDFJAVA includes and get all installed hdf-java library settings from -# HDFJAVA-config.cmake file : Requires a CMake compatible hdf-java-@HDFJAVA_PACKAGE_VERSION@ or later +# HDFJAVA-config.cmake file : Requires a CMake compatible hdf-java-@HDFJAVA_PACKAGE_VERSION@ or later # for this feature to work. The following vars are set if hdf-java is found. # # HDFJAVA_FOUND - True if found, otherwise all other vars are undefined # HDFJAVA_VERSION_STRING - full version (e.g. @HDFJAVA_PACKAGE_VERSION@) # HDFJAVA_VERSION_MAJOR - major part of version (e.g. @HDFJAVA_PACKAGE_VERSION_MAJOR@) # HDFJAVA_VERSION_MINOR - minor part (e.g. @HDFJAVA_PACKAGE_VERSION_MINOR@) -# +# # Target names that are valid (depending on enabled options) # will be the following # -# +# # To aid in finding HDFJAVA as part of a subproject set # HDFJAVA_ROOT_DIR_HINT to the location where @HDFJAVA_PACKAGE@@HDF_PACKAGE_EXT@-config.cmake lies @@ -60,9 +60,9 @@ if (HDFJAVA_ROOT_DIR) set (HDFJAVA_FOUND "YES") INCLUDE (${HDFJAVA_ROOT_DIR}/@HDFJAVA_PACKAGE@@HDF_PACKAGE_EXT@-config.cmake) set (HDFJAVA_LIBRARIES "${HDFJAVA_LIBRARY}") - set (HDFJAVA_INCLUDE_DIRS + set (HDFJAVA_INCLUDE_DIRS ${HDFJAVA_LIBRARY}/jarhdf-@HDFJAVA_PACKAGE_VERSION@.jar ${HDFJAVA_LIBRARY}/jarhdf5-@HDFJAVA_PACKAGE_VERSION@.jar ) - -endif (HDFJAVA_ROOT_DIR) + +endif () diff --git a/config/cmake/FindJNI.cmake b/config/cmake/FindJNI.cmake index 9d755fc..baab2ea 100644 --- a/config/cmake/FindJNI.cmake +++ b/config/cmake/FindJNI.cmake @@ -147,8 +147,6 @@ JAVA_APPEND_LIBRARY_DIRECTORIES(JAVA_AWT_LIBRARY_DIRECTORIES /usr/lib/jvm/java-1.5.0-sun/jre/lib/{libarch} /usr/lib/jvm/java-6-sun-1.6.0.00/jre/lib/{libarch} # can this one be removed according to #8821 ? Alex /usr/lib/jvm/java-6-openjdk/jre/lib/{libarch} - /usr/lib/jvm/java-7-openjdk/jre/lib/{libarch} - /usr/lib/jvm/java-7-openjdk-{libarch}/jre/lib/{libarch} /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0/jre/lib/{libarch} # fedora # Debian specific paths for default JVM /usr/lib/jvm/default-java/jre/lib/{libarch} diff --git a/config/cmake/HDF518_Examples.cmake.in b/config/cmake/HDF518_Examples.cmake.in index e1cb781..6aa5e1f 100644 --- a/config/cmake/HDF518_Examples.cmake.in +++ b/config/cmake/HDF518_Examples.cmake.in @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.1.0 FATAL_ERROR) +cmake_minimum_required(VERSION 3.2.2 FATAL_ERROR) ############################################################################################################### # This script will build and run the examples from a folder # Execute from a command line: @@ -12,7 +12,7 @@ set(CTEST_DASHBOARD_ROOT ${CTEST_SCRIPT_DIRECTORY}) #INSTALLDIR - HDF5-1.8 root folder #CTEST_CONFIGURATION_TYPE - Release, Debug, RelWithDebInfo #CTEST_SOURCE_NAME - name of source folder; HDF4Examples -#STATIC_LIBRARIES - Default is YES +#STATIC_ONLY - Default is YES #FORTRAN_LIBRARIES - Default is NO ##NO_MAC_FORTRAN - set to TRUE to allow shared libs on a Mac) if(DEFINED CTEST_SCRIPT_ARG) @@ -23,61 +23,61 @@ if(DEFINED CTEST_SCRIPT_ARG) foreach(current_var ${script_args}) if ("${current_var}" MATCHES "^([^=]+)=(.+)$") set("${CMAKE_MATCH_1}" "${CMAKE_MATCH_2}") - endif() - endforeach() -endif() + endif () + endforeach () +endif () if(NOT DEFINED INSTALLDIR) set(INSTALLDIR "@CMAKE_INSTALL_PREFIX@") -endif() +endif () if(NOT DEFINED CTEST_CONFIGURATION_TYPE) set(CTEST_CONFIGURATION_TYPE "Release") -endif() +endif () if(NOT DEFINED CTEST_SOURCE_NAME) set(CTEST_SOURCE_NAME "HDF5Examples") -endif() -if(NOT DEFINED STATIC_LIBRARIES) - set(STATICLIBRARIES "YES") -else(NOT DEFINED STATIC_LIBRARIES) - set(STATICLIBRARIES "NO") -endif() +endif () +if(NOT DEFINED STATIC_ONLY) + set(STATICONLYLIBRARIES "YES") +else(NOT DEFINED STATIC_ONLY) + set(STATICONLYLIBRARIES "NO") +endif () if(NOT DEFINED FORTRAN_LIBRARIES) set(FORTRANLIBRARIES "NO") else(NOT DEFINED FORTRAN_LIBRARIES) set(FORTRANLIBRARIES "YES") -endif() +endif () if(NOT DEFINED HDF_LOCAL) set(CDASH_LOCAL "NO") else(NOT HDF_LOCAL) set(CDASH_LOCAL "YES") -endif() +endif () if(NOT DEFINED CTEST_SITE) set(CTEST_SITE "local") -endif() +endif () if(NOT DEFINED CTEST_BUILD_NAME) set(CTEST_BUILD_NAME "examples") -endif() +endif () set(BUILD_OPTIONS "${BUILD_OPTIONS} -DSITE:STRING=${CTEST_SITE} -DBUILDNAME:STRING=${CTEST_BUILD_NAME}") #TAR_SOURCE - name of tarfile #if(NOT DEFINED TAR_SOURCE) # set(CTEST_USE_TAR_SOURCE "HDF5Examples-1.2.1-Source") -#endif() +#endif () ############################################################################################################### # Adjust the following SET Commands as needed ############################################################################################################### if(WIN32) - if(${STATICLIBRARIES}) + if(${STATICONLYLIBRARIES}) set(BUILD_OPTIONS "${BUILD_OPTIONS} -DBUILD_SHARED_LIBS:BOOL=OFF") - endif() + endif () set(ENV{HDF5_DIR} "${INSTALLDIR}/cmake") set(CTEST_BINARY_NAME ${CTEST_SOURCE_NAME}\\build) set(CTEST_SOURCE_DIRECTORY "${CTEST_DASHBOARD_ROOT}\\${CTEST_SOURCE_NAME}") set(CTEST_BINARY_DIRECTORY "${CTEST_DASHBOARD_ROOT}\\${CTEST_BINARY_NAME}") else(WIN32) - if(${STATICLIBRARIES}) + if(${STATICONLYLIBRARIES}) set(BUILD_OPTIONS "${BUILD_OPTIONS} -DBUILD_SHARED_LIBS:BOOL=OFF -DCMAKE_ANSI_CFLAGS:STRING=-fPIC") - endif() + endif () set(ENV{HDF5_DIR} "${INSTALLDIR}/share/cmake") set(ENV{LD_LIBRARY_PATH} "${INSTALLDIR}/lib") set(CTEST_BINARY_NAME ${CTEST_SOURCE_NAME}/build) @@ -86,12 +86,12 @@ else(WIN32) endif(WIN32) if(${FORTRANLIBRARIES}) set(BUILD_OPTIONS "${BUILD_OPTIONS} -DHDF_BUILD_FORTRAN:BOOL=ON") -else() +else () set(BUILD_OPTIONS "${BUILD_OPTIONS} -DHDF_BUILD_FORTRAN:BOOL=OFF") -endif() +endif () if(${CDASH_LOCAL}) set(BUILD_OPTIONS "${BUILD_OPTIONS} -DCDASH_LOCAL:BOOL=ON") -endif() +endif () set(BUILD_OPTIONS "${BUILD_OPTIONS} -DHDF5_PACKAGE_NAME:STRING=@HDF5_PACKAGE@@HDF_PACKAGE_EXT@") ############################################################################################################### @@ -111,11 +111,11 @@ if(APPLE) if(NOT NO_MAC_FORTRAN) # Shared fortran is not supported, build static set(BUILD_OPTIONS "${BUILD_OPTIONS} -DBUILD_SHARED_LIBS:BOOL=OFF -DCMAKE_ANSI_CFLAGS:STRING=-fPIC") - else() + else () set(BUILD_OPTIONS "${BUILD_OPTIONS} -DHDF_BUILD_FORTRAN:BOOL=OFF") - endif() + endif () set(BUILD_OPTIONS "${BUILD_OPTIONS} -DCTEST_USE_LAUNCHERS:BOOL=ON -DCMAKE_BUILD_WITH_INSTALL_RPATH:BOOL=OFF") -endif() +endif () #----------------------------------------------------------------------------- set(CTEST_CMAKE_COMMAND "\"${CMAKE_COMMAND}\"") @@ -126,16 +126,16 @@ if(CTEST_USE_TAR_SOURCE) if(WIN32) message(STATUS "extracting... [${CMAKE_EXECUTABLE_NAME} -E tar -xvf ${CTEST_USE_TAR_SOURCE}.zip]") execute_process(COMMAND ${CMAKE_EXECUTABLE_NAME} -E tar -xvf ${CTEST_DASHBOARD_ROOT}\\${CTEST_USE_TAR_SOURCE}.zip RESULT_VARIABLE rv) - else() + else () message(STATUS "extracting... [${CMAKE_EXECUTABLE_NAME} -E tar -xvf ${CTEST_USE_TAR_SOURCE}.tar]") execute_process(COMMAND ${CMAKE_EXECUTABLE_NAME} -E tar -xvf ${CTEST_DASHBOARD_ROOT}/${CTEST_USE_TAR_SOURCE}.tar RESULT_VARIABLE rv) - endif() + endif () if(NOT rv EQUAL 0) message(STATUS "extracting... [error-(${rv}) clean up]") file(REMOVE_RECURSE "${CTEST_SOURCE_DIRECTORY}") message(FATAL_ERROR "error: extract of ${CTEST_SOURCE_NAME} failed") - endif() + endif () endif(CTEST_USE_TAR_SOURCE) #----------------------------------------------------------------------------- @@ -154,9 +154,9 @@ ProcessorCount(N) if(NOT N EQUAL 0) if(NOT WIN32) set(CTEST_BUILD_FLAGS -j${N}) - endif() + endif () set(ctest_test_args ${ctest_test_args} PARALLEL_LEVEL ${N}) -endif() +endif () set (CTEST_CONFIGURE_COMMAND "${CTEST_CMAKE_COMMAND} -C \"${CTEST_SOURCE_DIRECTORY}/config/cmake/cacheinit.cmake\" -DCMAKE_BUILD_TYPE:STRING=${CTEST_CONFIGURATION_TYPE} ${BUILD_OPTIONS} \"-G${CTEST_CMAKE_GENERATOR}\" \"${CTEST_SOURCE_DIRECTORY}\"" ) @@ -174,27 +174,27 @@ ctest_start (Experimental) ctest_configure (BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) if(${res} LESS 0 OR ${res} GREATER 0) file(APPEND ${CTEST_SCRIPT_DIRECTORY}/FailedCTest.txt "Failed Configure: ${res}\n") -endif() +endif () if(LOCAL_SUBMIT) ctest_submit (PARTS Configure Notes) -endif() +endif () ctest_build (BUILD "${CTEST_BINARY_DIRECTORY}" APPEND APPEND RETURN_VALUE res NUMBER_ERRORS errval) if(${res} LESS 0 OR ${res} GREATER 0 OR ${errval} GREATER 0) file(APPEND ${CTEST_SCRIPT_DIRECTORY}/FailedCTest.txt "Failed ${errval} Build: ${res}\n") -endif() +endif () if(LOCAL_SUBMIT) ctest_submit (PARTS Build) -endif() +endif () ctest_test (BUILD "${CTEST_BINARY_DIRECTORY}" APPEND ${ctest_test_args} RETURN_VALUE res) if(${res} LESS 0 OR ${res} GREATER 0) file(APPEND ${CTEST_SCRIPT_DIRECTORY}/FailedCTest.txt "Failed Tests: ${res}\n") -endif() +endif () if(LOCAL_SUBMIT) ctest_submit (PARTS Test) -endif() +endif () if(${res} LESS 0 OR ${res} GREATER 0) message (FATAL_ERROR "tests FAILED") -endif() +endif () #----------------------------------------------------------------------------- ############################################################################################################## message(STATUS "DONE") \ No newline at end of file diff --git a/config/cmake/HDF5Macros.cmake b/config/cmake/HDF5Macros.cmake index d88e672..747e043 100644 --- a/config/cmake/HDF5Macros.cmake +++ b/config/cmake/HDF5Macros.cmake @@ -5,21 +5,21 @@ macro (H5_SET_LIB_OPTIONS libtarget libname libtype) if (${libtype} MATCHES "SHARED") if (ARGN) set (PACKAGE_SOVERSION ${ARGN}) - else (ARGN) + else () set (PACKAGE_SOVERSION ${HDF5_PACKAGE_SOVERSION}) - endif (ARGN) + endif () if (WIN32) set (LIBHDF_VERSION ${HDF5_PACKAGE_VERSION_MAJOR}) - else (WIN32) + else () set (LIBHDF_VERSION ${HDF5_PACKAGE_VERSION}) - endif (WIN32) + endif () set_target_properties (${libtarget} PROPERTIES VERSION ${LIBHDF_VERSION}) if (WIN32) set (${LIB_OUT_NAME} "${LIB_OUT_NAME}-${PACKAGE_SOVERSION}") - else (WIN32) + else () set_target_properties (${libtarget} PROPERTIES SOVERSION ${PACKAGE_SOVERSION}) - endif (WIN32) - endif (${libtype} MATCHES "SHARED") + endif () + endif () HDF_SET_LIB_OPTIONS (${libtarget} ${LIB_OUT_NAME} ${libtype}) #-- Apple Specific install_name for libraries @@ -31,7 +31,7 @@ macro (H5_SET_LIB_OPTIONS libtarget libname libtype) INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/lib" BUILD_WITH_INSTALL_RPATH ${HDF5_BUILD_WITH_INSTALL_NAME} ) - endif (HDF5_BUILD_WITH_INSTALL_NAME) + endif () if (HDF5_BUILD_FRAMEWORKS) if (${libtype} MATCHES "SHARED") # adapt target to build frameworks instead of dylibs @@ -42,8 +42,8 @@ macro (H5_SET_LIB_OPTIONS libtarget libname libtype) MACOSX_FRAMEWORK_IDENTIFIER org.hdfgroup.${libtarget} MACOSX_FRAMEWORK_SHORT_VERSION_STRING ${HDF5_PACKAGE_VERSION_MAJOR} MACOSX_FRAMEWORK_BUNDLE_VERSION ${HDF5_PACKAGE_VERSION_MAJOR}) - endif (${libtype} MATCHES "SHARED") - endif (HDF5_BUILD_FRAMEWORKS) - endif (APPLE) + endif () + endif () + endif () -endmacro (H5_SET_LIB_OPTIONS) +endmacro () diff --git a/config/cmake/HDF5UseFortran.cmake b/config/cmake/HDF5UseFortran.cmake index eba448c..a419950 100644 --- a/config/cmake/HDF5UseFortran.cmake +++ b/config/cmake/HDF5UseFortran.cmake @@ -7,7 +7,7 @@ if (${C_HAVE_QUADMATH}) set(HAVE_QUADMATH 1) else () set(HAVE_QUADMATH 0) -endif() +endif () # # This file provides functions for HDF5 specific Fortran support. @@ -18,16 +18,16 @@ ENABLE_LANGUAGE (Fortran) # The provided CMake Fortran macros don't provide a general compile/run function # so this one is used. #----------------------------------------------------------------------------- -MACRO (FORTRAN_RUN FUNCTION CODE RUN_RESULT_VAR1 COMPILE_RESULT_VAR RETURN) +macro (FORTRAN_RUN FUNCTION CODE RUN_RESULT_VAR1 COMPILE_RESULT_VAR RETURN) # -# if (NOT DEFINED ${RUN_RESULT_VAR}) +# if (NOT DEFINED ${RUN_RESULT_VAR}) message (STATUS "Detecting Fortran ${FUNCTION}") if (CMAKE_REQUIRED_LIBRARIES) set (CHECK_FUNCTION_EXISTS_ADD_LIBRARIES "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}") - else (CMAKE_REQUIRED_LIBRARIES) + else () set (CHECK_FUNCTION_EXISTS_ADD_LIBRARIES) - endif (CMAKE_REQUIRED_LIBRARIES) + endif () file (WRITE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testFortranCompiler1.f90 "${CODE}" @@ -40,7 +40,7 @@ MACRO (FORTRAN_RUN FUNCTION CODE RUN_RESULT_VAR1 COMPILE_RESULT_VAR RETURN) ) set(${RETURN} ${OUTPUT}) - + #message ( "Test result1 ${RETURN} ") #message ( "Test result3 ${RESULT} ") #message ( "Test result2 ${CMAKE_MATCH_0} ") @@ -65,15 +65,15 @@ MACRO (FORTRAN_RUN FUNCTION CODE RUN_RESULT_VAR1 COMPILE_RESULT_VAR RETURN) "${OUTPUT}\n\n") endif () endif () -# endif (NOT DEFINED ${RUN_RESULT_VAR}) -ENDMACRO (FORTRAN_RUN) +# endif () +endmacro () # Read source line beginning at the line matching Input:"START" and ending at the line matching Input:"END" -MACRO (READ_SOURCE START END RETURN) - file(READ "${HDF5_SOURCE_DIR}/m4/aclocal_fc.f90" CODE) - string(REGEX MATCH "${START}[\\\t\\\n\\\r[].+]*${END}" CODE ${CODE}) - set(RETURN "${CODE}") -ENDMACRO (READ_SOURCE START END RETURN) +macro (READ_SOURCE START END RETURN) + file (READ "${HDF5_SOURCE_DIR}/m4/aclocal_fc.f90" CODE) + string (REGEX MATCH "${START}[\\\t\\\n\\\r[].+]*${END}" CODE ${CODE}) + set (RETURN "${CODE}") +endmacro () #----------------------------------------------------------------------------- # Check to see C_LONG_DOUBLE is available @@ -85,10 +85,10 @@ CHECK_FORTRAN_FEATURE(c_long_double ) if (${FORTRAN_HAVE_C_LONG_DOUBLE}) - set(FORTRAN_HAVE_C_LONG_DOUBLE 1) + set (FORTRAN_HAVE_C_LONG_DOUBLE 1) else () - set(FORTRAN_HAVE_C_LONG_DOUBLE 0) -endif() + set (FORTRAN_HAVE_C_LONG_DOUBLE 0) +endif () # Check to see C_LONG_DOUBLE is different from C_DOUBLE @@ -98,30 +98,30 @@ CHECK_FORTRAN_FEATURE(c_long_double FORTRAN_C_LONG_DOUBLE_IS_UNIQUE ) if (${FORTRAN_C_LONG_DOUBLE_IS_UNIQUE}) - set(FORTRAN_C_LONG_DOUBLE_IS_UNIQUE 1) + set (FORTRAN_C_LONG_DOUBLE_IS_UNIQUE 1) else () - set(FORTRAN_C_LONG_DOUBLE_IS_UNIQUE 0) -endif() + set (FORTRAN_C_LONG_DOUBLE_IS_UNIQUE 0) +endif () ## Set the sizeof function for use later in the fortran tests -if(FORTRAN_HAVE_STORAGE_SIZE) - set(FC_SIZEOF_A "STORAGE_SIZE(a, c_size_t)/STORAGE_SIZE(c_char_'a',c_size_t)") - set(FC_SIZEOF_B "STORAGE_SIZE(b, c_size_t)/STORAGE_SIZE(c_char_'a',c_size_t)") - set(FC_SIZEOF_C "STORAGE_SIZE(c, c_size_t)/STORAGE_SIZE(c_char_'a',c_size_t)") -elseif(FORTRAN_HAVE_C_SIZEOF) - set(FC_SIZEOF_A "SIZEOF(a)") - set(FC_SIZEOF_B "SIZEOF(b)") - set(FC_SIZEOF_C "SIZEOF(c)") -else(FORTRAN_HAVE_STORAGE_SIZE) +if (FORTRAN_HAVE_STORAGE_SIZE) + set (FC_SIZEOF_A "STORAGE_SIZE(a, c_size_t)/STORAGE_SIZE(c_char_'a',c_size_t)") + set (FC_SIZEOF_B "STORAGE_SIZE(b, c_size_t)/STORAGE_SIZE(c_char_'a',c_size_t)") + set (FC_SIZEOF_C "STORAGE_SIZE(c, c_size_t)/STORAGE_SIZE(c_char_'a',c_size_t)") +elseif (FORTRAN_HAVE_C_SIZEOF) + set (FC_SIZEOF_A "SIZEOF(a)") + set (FC_SIZEOF_B "SIZEOF(b)") + set (FC_SIZEOF_C "SIZEOF(c)") +else () message (FATAL_ERROR "Fortran compiler requires either intrinsic functions SIZEOF or STORAGE_SIZE") -endif(FORTRAN_HAVE_STORAGE_SIZE) +endif () #----------------------------------------------------------------------------- # Determine the available KINDs for REALs and INTEGERs #----------------------------------------------------------------------------- -READ_SOURCE("PROGRAM FC_AVAIL_KINDS" "END PROGRAM FC_AVAIL_KINDS" CODE) -FORTRAN_RUN("REAL and INTEGER KINDs" +READ_SOURCE ("PROGRAM FC_AVAIL_KINDS" "END PROGRAM FC_AVAIL_KINDS" CODE) +FORTRAN_RUN ("REAL and INTEGER KINDs" "${CODE}" XX YY @@ -134,35 +134,35 @@ FORTRAN_RUN("REAL and INTEGER KINDs" # dnl -- LINE 4 -- number of valid integer kinds # dnl -- LINE 5 -- number of valid real kinds -file(READ "${CMAKE_BINARY_DIR}/pac_fconftest.out" PROG_OUTPUT) +file (READ "${CMAKE_BINARY_DIR}/pac_fconftest.out" PROG_OUTPUT) # Convert the string to a list of strings by replacing the carriage return with a semicolon -string(REGEX REPLACE "\n" ";" PROG_OUTPUT "${PROG_OUTPUT}") +string (REGEX REPLACE "\n" ";" PROG_OUTPUT "${PROG_OUTPUT}") -list(GET PROG_OUTPUT 0 pac_validIntKinds) -list(GET PROG_OUTPUT 1 pac_validRealKinds) -list(GET PROG_OUTPUT 2 H5_PAC_FC_MAX_REAL_PRECISION) +list (GET PROG_OUTPUT 0 pac_validIntKinds) +list (GET PROG_OUTPUT 1 pac_validRealKinds) +list (GET PROG_OUTPUT 2 H5_PAC_FC_MAX_REAL_PRECISION) # If the lists are empty then something went wrong. -if( NOT pac_validIntKinds) +if (NOT pac_validIntKinds) message (FATAL_ERROR "Failed to find available INTEGER KINDs for Fortran") -endif() -if( NOT pac_validRealKinds) +endif () +if (NOT pac_validRealKinds) message (FATAL_ERROR "Failed to find available REAL KINDs for Fortran") -endif() -if( NOT H5_PAC_FC_MAX_REAL_PRECISION) +endif () +if (NOT H5_PAC_FC_MAX_REAL_PRECISION) message (FATAL_ERROR "No output from Fortran decimal precision program") -endif() +endif () -set(PAC_FC_ALL_INTEGER_KINDS "\{${pac_validIntKinds}\}") -set(PAC_FC_ALL_REAL_KINDS "\{${pac_validRealKinds}\}") +set (PAC_FC_ALL_INTEGER_KINDS "\{${pac_validIntKinds}\}") +set (PAC_FC_ALL_REAL_KINDS "\{${pac_validRealKinds}\}") -list(GET PROG_OUTPUT 3 NUM_IKIND) -list(GET PROG_OUTPUT 4 NUM_RKIND) +list (GET PROG_OUTPUT 3 NUM_IKIND) +list (GET PROG_OUTPUT 4 NUM_RKIND) -set(PAC_FORTRAN_NUM_INTEGER_KINDS "${NUM_IKIND}") +set (PAC_FORTRAN_NUM_INTEGER_KINDS "${NUM_IKIND}") -set(H5CONFIG_F_NUM_IKIND "INTEGER, PARAMETER :: num_ikinds = ${NUM_IKIND}") -set(H5CONFIG_F_IKIND "INTEGER, DIMENSION(1:num_ikinds) :: ikind = (/${pac_validIntKinds}/)") +set (H5CONFIG_F_NUM_IKIND "INTEGER, PARAMETER :: num_ikinds = ${NUM_IKIND}") +set (H5CONFIG_F_IKIND "INTEGER, DIMENSION(1:num_ikinds) :: ikind = (/${pac_validIntKinds}/)") message (STATUS "....NUMBER OF INTEGER KINDS FOUND ${PAC_FORTRAN_NUM_INTEGER_KINDS}") message (STATUS "....REAL KINDS FOUND ${PAC_FC_ALL_REAL_KINDS}") @@ -175,10 +175,10 @@ message (STATUS "....MAX DECIMAL PRECISION ${H5_PAC_FC_MAX_REAL_PRECISION}") # ********** # INTEGERS # ********** -string(REGEX REPLACE "," ";" VAR "${pac_validIntKinds}") +string (REGEX REPLACE "," ";" VAR "${pac_validIntKinds}") -foreach( KIND ${VAR} ) - set(PROG_SRC +foreach (KIND ${VAR} ) + set (PROG_SRC " PROGRAM main USE ISO_C_BINDING @@ -193,37 +193,36 @@ foreach( KIND ${VAR} ) YY PROG_OUTPUT1 ) - string(REGEX REPLACE "\n" "" PROG_OUTPUT1 "${PROG_OUTPUT1}") - set(pack_int_sizeof "${pack_int_sizeof} ${PROG_OUTPUT1},") -endforeach(KIND) + string (REGEX REPLACE "\n" "" PROG_OUTPUT1 "${PROG_OUTPUT1}") + set (pack_int_sizeof "${pack_int_sizeof} ${PROG_OUTPUT1},") +endforeach () if (pack_int_sizeof STREQUAL "") message (FATAL_ERROR "Failed to find available INTEGER KINDs for Fortran") -endif() - -string(STRIP ${pack_int_sizeof} pack_int_sizeof) +endif () +string (STRIP ${pack_int_sizeof} pack_int_sizeof) #Remove trailing comma -string(REGEX REPLACE ",$" "" pack_int_sizeof "${pack_int_sizeof}") +string (REGEX REPLACE ",$" "" pack_int_sizeof "${pack_int_sizeof}") #Remove spaces -string(REGEX REPLACE " " "" pack_int_sizeof "${pack_int_sizeof}") +string (REGEX REPLACE " " "" pack_int_sizeof "${pack_int_sizeof}") -set(PAC_FC_ALL_INTEGER_KINDS_SIZEOF "\{${pack_int_sizeof}\}") +set (PAC_FC_ALL_INTEGER_KINDS_SIZEOF "\{${pack_int_sizeof}\}") -message(STATUS "....FOUND SIZEOF for INTEGER KINDs ${PAC_FC_ALL_INTEGER_KINDS_SIZEOF}") +message (STATUS "....FOUND SIZEOF for INTEGER KINDs ${PAC_FC_ALL_INTEGER_KINDS_SIZEOF}") # ********** # REALS # ********** -string(REGEX REPLACE "," ";" VAR "${pac_validRealKinds}") +string (REGEX REPLACE "," ";" VAR "${pac_validRealKinds}") #find the maximum kind of the real -list(LENGTH VAR LEN_VAR) -MATH (EXPR _LEN "${LEN_VAR}-1") -list(GET VAR ${_LEN} max_real_fortran_kind) +list (LENGTH VAR LEN_VAR) +math (EXPR _LEN "${LEN_VAR}-1") +list (GET VAR ${_LEN} max_real_fortran_kind) -foreach( KIND ${VAR} ) - set(PROG_SRC +foreach (KIND ${VAR} ) + set (PROG_SRC " PROGRAM main USE ISO_C_BINDING @@ -233,42 +232,42 @@ foreach( KIND ${VAR} ) END " ) - FORTRAN_RUN("REAL KIND SIZEOF" ${PROG_SRC} + FORTRAN_RUN ("REAL KIND SIZEOF" ${PROG_SRC} XX YY PROG_OUTPUT1 ) - string(REGEX REPLACE "\n" "" PROG_OUTPUT1 "${PROG_OUTPUT1}") - set(pack_real_sizeof "${pack_real_sizeof} ${PROG_OUTPUT1},") -endforeach(KIND) + string (REGEX REPLACE "\n" "" PROG_OUTPUT1 "${PROG_OUTPUT1}") + set (pack_real_sizeof "${pack_real_sizeof} ${PROG_OUTPUT1},") +endforeach () if (pack_int_sizeof STREQUAL "") message (FATAL_ERROR "Failed to find available REAL KINDs for Fortran") -endif() +endif () string(STRIP ${pack_real_sizeof} pack_real_sizeof) #Remove trailing comma -string(REGEX REPLACE ",$" "" pack_real_sizeof "${pack_real_sizeof}") +string (REGEX REPLACE ",$" "" pack_real_sizeof "${pack_real_sizeof}") #Remove spaces -string(REGEX REPLACE " " "" pack_real_sizeof "${pack_real_sizeof}") +string (REGEX REPLACE " " "" pack_real_sizeof "${pack_real_sizeof}") -set(H5CONFIG_F_RKIND_SIZEOF "INTEGER, DIMENSION(1:num_rkinds) :: rkind_sizeof = (/${pack_real_sizeof}/)") +set (H5CONFIG_F_RKIND_SIZEOF "INTEGER, DIMENSION(1:num_rkinds) :: rkind_sizeof = (/${pack_real_sizeof}/)") -message(STATUS "....FOUND SIZEOF for REAL KINDs \{${pack_real_sizeof}\}") +message (STATUS "....FOUND SIZEOF for REAL KINDs \{${pack_real_sizeof}\}") -set(PAC_FC_ALL_REAL_KINDS_SIZEOF "\{${pack_real_sizeof}\}") +set (PAC_FC_ALL_REAL_KINDS_SIZEOF "\{${pack_real_sizeof}\}") #find the maximum kind of the real -string(REGEX REPLACE "," ";" VAR "${pack_real_sizeof}") -list(LENGTH VAR LEN_VAR) -MATH (EXPR _LEN "${LEN_VAR}-1") -list(GET VAR ${_LEN} max_real_fortran_sizeof) +string (REGEX REPLACE "," ";" VAR "${pack_real_sizeof}") +list (LENGTH VAR LEN_VAR) +math (EXPR _LEN "${LEN_VAR}-1") +list (GET VAR ${_LEN} max_real_fortran_sizeof) #----------------------------------------------------------------------------- # Find sizeof of native kinds #----------------------------------------------------------------------------- -FORTRAN_RUN("SIZEOF NATIVE KINDs" +FORTRAN_RUN ("SIZEOF NATIVE KINDs" " PROGRAM main USE ISO_C_BINDING @@ -277,9 +276,9 @@ FORTRAN_RUN("SIZEOF NATIVE KINDs" REAL b DOUBLE PRECISION c WRITE(*,*) ${FC_SIZEOF_A} - WRITE(*,*) kind(a) - WRITE(*,*) ${FC_SIZEOF_B} - WRITE(*,*) kind(b) + WRITE(*,*) kind(a) + WRITE(*,*) ${FC_SIZEOF_B} + WRITE(*,*) kind(b) WRITE(*,*) ${FC_SIZEOF_C} WRITE(*,*) kind(c) END @@ -297,63 +296,63 @@ FORTRAN_RUN("SIZEOF NATIVE KINDs" # dnl -- LINE 6 -- kind of DOUBLE PRECISION # Convert the string to a list of strings by replacing the carriage return with a semicolon -string(REGEX REPLACE "\n" ";" PROG_OUTPUT "${PROG_OUTPUT}") +string (REGEX REPLACE "\n" ";" PROG_OUTPUT "${PROG_OUTPUT}") -list(GET PROG_OUTPUT 0 PAC_FORTRAN_NATIVE_INTEGER_SIZEOF) -list(GET PROG_OUTPUT 1 PAC_FORTRAN_NATIVE_INTEGER_KIND) -list(GET PROG_OUTPUT 2 PAC_FORTRAN_NATIVE_REAL_SIZEOF) -list(GET PROG_OUTPUT 3 PAC_FORTRAN_NATIVE_REAL_KIND) -list(GET PROG_OUTPUT 4 PAC_FORTRAN_NATIVE_DOUBLE_SIZEOF) -list(GET PROG_OUTPUT 5 PAC_FORTRAN_NATIVE_DOUBLE_KIND) +list (GET PROG_OUTPUT 0 PAC_FORTRAN_NATIVE_INTEGER_SIZEOF) +list (GET PROG_OUTPUT 1 PAC_FORTRAN_NATIVE_INTEGER_KIND) +list (GET PROG_OUTPUT 2 PAC_FORTRAN_NATIVE_REAL_SIZEOF) +list (GET PROG_OUTPUT 3 PAC_FORTRAN_NATIVE_REAL_KIND) +list (GET PROG_OUTPUT 4 PAC_FORTRAN_NATIVE_DOUBLE_SIZEOF) +list (GET PROG_OUTPUT 5 PAC_FORTRAN_NATIVE_DOUBLE_KIND) if (NOT PAC_FORTRAN_NATIVE_INTEGER_SIZEOF) message (FATAL_ERROR "Failed to find SIZEOF NATIVE INTEGER KINDs for Fortran") -endif() +endif () if (NOT PAC_FORTRAN_NATIVE_REAL_SIZEOF) message (FATAL_ERROR "Failed to find SIZEOF NATIVE REAL KINDs for Fortran") -endif() +endif () if (NOT PAC_FORTRAN_NATIVE_DOUBLE_SIZEOF) message (FATAL_ERROR "Failed to find SIZEOF NATIVE DOUBLE KINDs for Fortran") -endif() +endif () if (NOT PAC_FORTRAN_NATIVE_INTEGER_KIND) message (FATAL_ERROR "Failed to find KIND of NATIVE INTEGER for Fortran") -endif() +endif () if (NOT PAC_FORTRAN_NATIVE_REAL_KIND) message (FATAL_ERROR "Failed to find KIND of NATIVE REAL for Fortran") -endif() +endif () if (NOT PAC_FORTRAN_NATIVE_DOUBLE_KIND) message (FATAL_ERROR "Failed to find KIND of NATIVE DOUBLE for Fortran") -endif() +endif () -set(FORTRAN_SIZEOF_LONG_DOUBLE ${${HDF_PREFIX}_SIZEOF_LONG_DOUBLE}) -#set(H5_SIZEOF_LONG_DOUBLE ${${HDF_PREFIX}_SIZEOF_LONG_DOUBLE}) +set (FORTRAN_SIZEOF_LONG_DOUBLE ${${HDF_PREFIX}_SIZEOF_LONG_DOUBLE}) +#set (H5_SIZEOF_LONG_DOUBLE ${${HDF_PREFIX}_SIZEOF_LONG_DOUBLE}) # remove the invalid kind from the list -if(NOT(${SIZEOF___FLOAT128} EQUAL 0)) - if(NOT(${SIZEOF___FLOAT128} EQUAL ${max_real_fortran_sizeof}) - AND NOT(${FORTRAN_SIZEOF_LONG_DOUBLE} EQUAL ${max_real_fortran_sizeof}) - # account for the fact that the C compiler can have 16-byte __float128 and the fortran compiler only has 8-byte doubles, - # so we don't want to remove the 8-byte fortran doubles. - AND NOT(${PAC_FORTRAN_NATIVE_DOUBLE_SIZEOF} EQUAL ${max_real_fortran_sizeof})) - message(WARNING " +if (NOT(${SIZEOF___FLOAT128} EQUAL 0)) + if (NOT(${SIZEOF___FLOAT128} EQUAL ${max_real_fortran_sizeof}) + AND NOT(${FORTRAN_SIZEOF_LONG_DOUBLE} EQUAL ${max_real_fortran_sizeof}) + # account for the fact that the C compiler can have 16-byte __float128 and the fortran compiler only has 8-byte doubles, + # so we don't want to remove the 8-byte fortran doubles. + AND NOT(${PAC_FORTRAN_NATIVE_DOUBLE_SIZEOF} EQUAL ${max_real_fortran_sizeof})) + message (WARNING " Fortran REAL(KIND=${max_real_fortran_kind}) is $max_real_fortran_sizeof Bytes, but no corresponding C float type exists of that size !!! Fortran interfaces will not be generated for REAL(KIND=${max_real_fortran_kind}) !!!") - string(REGEX REPLACE ",[0-9]+}" "}" PAC_FC_ALL_REAL_KINDS ${PAC_FC_ALL_REAL_KINDS}) - string(REGEX REPLACE ",[0-9]+}" "}" PAC_FC_ALL_REAL_KINDS_SIZEOF ${PAC_FC_ALL_REAL_KINDS_SIZEOF}) - MATH (EXPR NUM_RKIND "${NUM_RKIND} - 1") - endif() -endif(NOT(${SIZEOF___FLOAT128} EQUAL 0)) + string (REGEX REPLACE ",[0-9]+}" "}" PAC_FC_ALL_REAL_KINDS ${PAC_FC_ALL_REAL_KINDS}) + string (REGEX REPLACE ",[0-9]+}" "}" PAC_FC_ALL_REAL_KINDS_SIZEOF ${PAC_FC_ALL_REAL_KINDS_SIZEOF}) + math (EXPR NUM_RKIND "${NUM_RKIND} - 1") + endif () +endif () -set(H5CONFIG_F_NUM_RKIND "INTEGER, PARAMETER :: num_rkinds = ${NUM_RKIND}") +set (H5CONFIG_F_NUM_RKIND "INTEGER, PARAMETER :: num_rkinds = ${NUM_RKIND}") -string(REGEX REPLACE "{" "" OUT_VAR ${PAC_FC_ALL_REAL_KINDS}) -string(REGEX REPLACE "}" "" OUT_VAR ${OUT_VAR}) -set(H5CONFIG_F_RKIND "INTEGER, DIMENSION(1:num_rkinds) :: rkind = (/${OUT_VAR}/)") +string (REGEX REPLACE "{" "" OUT_VAR ${PAC_FC_ALL_REAL_KINDS}) +string (REGEX REPLACE "}" "" OUT_VAR ${OUT_VAR}) +set (H5CONFIG_F_RKIND "INTEGER, DIMENSION(1:num_rkinds) :: rkind = (/${OUT_VAR}/)") -string(REGEX REPLACE "{" "" OUT_VAR ${PAC_FC_ALL_REAL_KINDS_SIZEOF}) -string(REGEX REPLACE "}" "" OUT_VAR ${OUT_VAR}) -set(H5CONFIG_F_RKIND_SIZEOF "INTEGER, DIMENSION(1:num_rkinds) :: rkind_sizeof = (/${OUT_VAR}/)") +string (REGEX REPLACE "{" "" OUT_VAR ${PAC_FC_ALL_REAL_KINDS_SIZEOF}) +string (REGEX REPLACE "}" "" OUT_VAR ${OUT_VAR}) +set (H5CONFIG_F_RKIND_SIZEOF "INTEGER, DIMENSION(1:num_rkinds) :: rkind_sizeof = (/${OUT_VAR}/)") ENABLE_LANGUAGE (C) @@ -361,14 +360,14 @@ ENABLE_LANGUAGE (C) # The provided CMake C macros don't provide a general compile/run function # so this one is used. #----------------------------------------------------------------------------- -MACRO (C_RUN FUNCTION CODE RETURN) +macro (C_RUN FUNCTION CODE RETURN) message (STATUS "Detecting C ${FUNCTION}") if (CMAKE_REQUIRED_LIBRARIES) set (CHECK_FUNCTION_EXISTS_ADD_LIBRARIES "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}") - else (CMAKE_REQUIRED_LIBRARIES) + else () set (CHECK_FUNCTION_EXISTS_ADD_LIBRARIES) - endif (CMAKE_REQUIRED_LIBRARIES) + endif () file (WRITE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testCCompiler1.c ${CODE} @@ -380,8 +379,8 @@ MACRO (C_RUN FUNCTION CODE RETURN) RUN_OUTPUT_VARIABLE OUTPUT ) - set(${RETURN} ${OUTPUT}) - + set (${RETURN} ${OUTPUT}) + #message ( "* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ") #message ( "Test COMPILE_RESULT_VAR ${COMPILE_RESULT_VAR} ") #message ( "* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ") @@ -405,10 +404,10 @@ MACRO (C_RUN FUNCTION CODE RETURN) endif () else () message (FATAL_ERROR "Compilation of C ${FUNCTION} - Failed") - endif() -ENDMACRO (C_RUN) + endif () +endmacro () -set(PROG_SRC +set (PROG_SRC " #include #include @@ -426,7 +425,7 @@ set(PROG_SRC #define C_FLT128_DIG 0 #endif #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L -#define C_LDBL_DIG DECIMAL_DIG +#define C_LDBL_DIG DECIMAL_DIG #else #define C_LDBL_DIG LDBL_DIG #endif @@ -435,33 +434,33 @@ set(PROG_SRC return 1\\\; } " - ) +) -C_RUN("maximum decimal precision for C" ${PROG_SRC} PROG_OUTPUT) +C_RUN ("maximum decimal precision for C" ${PROG_SRC} PROG_OUTPUT) # dnl The output from the above program will be: # dnl -- LINE 1 -- long double decimal precision # dnl -- LINE 2 -- __float128 decimal precision # Convert the string to a list of strings by replacing the carriage return with a semicolon -string(REGEX REPLACE "\n" ";" PROG_OUTPUT "${PROG_OUTPUT}") +string (REGEX REPLACE "\n" ";" PROG_OUTPUT "${PROG_OUTPUT}") -list(GET PROG_OUTPUT 0 LDBL_DIG) -list(GET PROG_OUTPUT 1 FLT128_DIG) +list (GET PROG_OUTPUT 0 LDBL_DIG) +list (GET PROG_OUTPUT 1 FLT128_DIG) -if(SIZEOF___FLOAT128 EQUAL 0 OR FLT128_DIG EQUAL 0) - SET(H5_HAVE_FLOAT128 0) - SET(SIZEOF___FLOAT128 0) - set(H5_PAC_C_MAX_REAL_PRECISION ${LDBL_DIG}) +if (SIZEOF___FLOAT128 EQUAL 0 OR FLT128_DIG EQUAL 0) + set (H5_HAVE_FLOAT128 0) + set (SIZEOF___FLOAT128 0) + set (H5_PAC_C_MAX_REAL_PRECISION ${LDBL_DIG}) else () set(H5_PAC_C_MAX_REAL_PRECISION ${FLT128_DIG}) -endif() +endif () # Setting definition if there is a 16 byte fortran integer -string(FIND ${PAC_FC_ALL_INTEGER_KINDS_SIZEOF} "16" pos) -if(${pos} EQUAL -1) - set(HAVE_Fortran_INTEGER_SIZEOF_16 0) +string (FIND ${PAC_FC_ALL_INTEGER_KINDS_SIZEOF} "16" pos) +if (${pos} EQUAL -1) + set (HAVE_Fortran_INTEGER_SIZEOF_16 0) else () - set(HAVE_Fortran_INTEGER_SIZEOF_16 1) + set (HAVE_Fortran_INTEGER_SIZEOF_16 1) endif () diff --git a/config/cmake/HDF5_Examples.cmake.in b/config/cmake/HDF5_Examples.cmake.in index 058dd7a..eadff5f 100644 --- a/config/cmake/HDF5_Examples.cmake.in +++ b/config/cmake/HDF5_Examples.cmake.in @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.1.0 FATAL_ERROR) +cmake_minimum_required(VERSION 3.2.2 FATAL_ERROR) ############################################################################################################### # This script will build and run the examples from a folder # Execute from a command line: @@ -12,98 +12,98 @@ set(CTEST_DASHBOARD_ROOT ${CTEST_SCRIPT_DIRECTORY}) #INSTALLDIR - HDF5 root folder #CTEST_CONFIGURATION_TYPE - Release, Debug, RelWithDebInfo #CTEST_SOURCE_NAME - name of source folder; HDF4Examples -#STATIC_LIBRARIES - Default is YES +#STATIC_ONLY - Default is YES #FORTRAN_LIBRARIES - Default is NO #JAVA_LIBRARIES - Default is NO ##NO_MAC_FORTRAN - set to TRUE to allow shared libs on a Mac) -if(DEFINED CTEST_SCRIPT_ARG) +if (DEFINED CTEST_SCRIPT_ARG) # transform ctest script arguments of the form # script.ctest,var1=value1,var2=value2 # to variables with the respective names set to the respective values - string(REPLACE "," ";" script_args "${CTEST_SCRIPT_ARG}") - foreach(current_var ${script_args}) + string (REPLACE "," ";" script_args "${CTEST_SCRIPT_ARG}") + foreach (current_var ${script_args}) if ("${current_var}" MATCHES "^([^=]+)=(.+)$") - set("${CMAKE_MATCH_1}" "${CMAKE_MATCH_2}") - endif() - endforeach() -endif() -if(NOT DEFINED INSTALLDIR) - set(INSTALLDIR "@CMAKE_INSTALL_PREFIX@") -endif() -if(NOT DEFINED CTEST_CONFIGURATION_TYPE) - set(CTEST_CONFIGURATION_TYPE "Release") -endif() -if(NOT DEFINED CTEST_SOURCE_NAME) - set(CTEST_SOURCE_NAME "HDF5Examples") -endif() -if(NOT DEFINED STATIC_LIBRARIES) - set(STATICLIBRARIES "YES") -else(NOT DEFINED STATIC_LIBRARIES) - set(STATICLIBRARIES "NO") -endif() -if(NOT DEFINED FORTRAN_LIBRARIES) - set(FORTRANLIBRARIES "NO") -else(NOT DEFINED FORTRAN_LIBRARIES) - set(FORTRANLIBRARIES "YES") -endif() -if(NOT DEFINED JAVA_LIBRARIES) - set(JAVALIBRARIES "NO") -else(NOT DEFINED JAVA_LIBRARIES) - set(JAVALIBRARIES "YES") -endif() -if(NOT DEFINED HDF_LOCAL) - set(CDASH_LOCAL "NO") -else(NOT HDF_LOCAL) - set(CDASH_LOCAL "YES") -endif() + set ("${CMAKE_MATCH_1}" "${CMAKE_MATCH_2}") + endif () + endforeach () +endif () +if (NOT DEFINED INSTALLDIR) + set (INSTALLDIR "@CMAKE_INSTALL_PREFIX@") +endif () +if (NOT DEFINED CTEST_CONFIGURATION_TYPE) + set (CTEST_CONFIGURATION_TYPE "Release") +endif () +if (NOT DEFINED CTEST_SOURCE_NAME) + set (CTEST_SOURCE_NAME "HDF5Examples") +endif () +if (NOT DEFINED STATIC_ONLY) + set (STATICONLYLIBRARIES "YES") +else () + set (STATICONLYLIBRARIES "NO") +endif () +if (NOT DEFINED FORTRAN_LIBRARIES) + set (FORTRANLIBRARIES "NO") +else () + set (FORTRANLIBRARIES "YES") +endif () +if (NOT DEFINED JAVA_LIBRARIES) + set (JAVALIBRARIES "NO") +else () + set (JAVALIBRARIES "YES") +endif () +if (NOT DEFINED HDF_LOCAL) + set (CDASH_LOCAL "NO") +else () + set (CDASH_LOCAL "YES") +endif () if(NOT DEFINED CTEST_SITE) - set(CTEST_SITE "local") -endif() + set (CTEST_SITE "local") +endif () if(NOT DEFINED CTEST_BUILD_NAME) - set(CTEST_BUILD_NAME "examples") -endif() -set(BUILD_OPTIONS "${BUILD_OPTIONS} -DSITE:STRING=${CTEST_SITE} -DBUILDNAME:STRING=${CTEST_BUILD_NAME}") + set (CTEST_BUILD_NAME "examples") +endif () +set (BUILD_OPTIONS "${BUILD_OPTIONS} -DSITE:STRING=${CTEST_SITE} -DBUILDNAME:STRING=${CTEST_BUILD_NAME}") #TAR_SOURCE - name of tarfile -#if(NOT DEFINED TAR_SOURCE) -# set(CTEST_USE_TAR_SOURCE "HDF5Examples-1.10.1-Source") -#endif() +#if (NOT DEFINED TAR_SOURCE) +# set (CTEST_USE_TAR_SOURCE "HDF5Examples-1.10.1-Source") +#endif () ############################################################################################################### # Adjust the following SET Commands as needed ############################################################################################################### -if(WIN32) - if(${STATICLIBRARIES}) - set(BUILD_OPTIONS "${BUILD_OPTIONS} -DBUILD_SHARED_LIBS:BOOL=OFF") - endif() - set(ENV{HDF5_DIR} "${INSTALLDIR}/cmake") - set(CTEST_BINARY_NAME ${CTEST_SOURCE_NAME}\\build) - set(CTEST_SOURCE_DIRECTORY "${CTEST_DASHBOARD_ROOT}\\${CTEST_SOURCE_NAME}") - set(CTEST_BINARY_DIRECTORY "${CTEST_DASHBOARD_ROOT}\\${CTEST_BINARY_NAME}") -else(WIN32) - if(${STATICLIBRARIES}) - set(BUILD_OPTIONS "${BUILD_OPTIONS} -DBUILD_SHARED_LIBS:BOOL=OFF -DCMAKE_ANSI_CFLAGS:STRING=-fPIC") - endif() - set(ENV{HDF5_DIR} "${INSTALLDIR}/share/cmake") - set(ENV{LD_LIBRARY_PATH} "${INSTALLDIR}/lib") - set(CTEST_BINARY_NAME ${CTEST_SOURCE_NAME}/build) - set(CTEST_SOURCE_DIRECTORY "${CTEST_DASHBOARD_ROOT}/${CTEST_SOURCE_NAME}") - set(CTEST_BINARY_DIRECTORY "${CTEST_DASHBOARD_ROOT}/${CTEST_BINARY_NAME}") -endif(WIN32) -if(${FORTRANLIBRARIES}) - set(BUILD_OPTIONS "${BUILD_OPTIONS} -DHDF_BUILD_FORTRAN:BOOL=ON") -else() - set(BUILD_OPTIONS "${BUILD_OPTIONS} -DHDF_BUILD_FORTRAN:BOOL=OFF") -endif() +if (WIN32) + if (${STATICONLYLIBRARIES}) + set (BUILD_OPTIONS "${BUILD_OPTIONS} -DBUILD_SHARED_LIBS:BOOL=OFF") + endif () + set (ENV{HDF5_DIR} "${INSTALLDIR}/cmake") + set (CTEST_BINARY_NAME ${CTEST_SOURCE_NAME}\\build) + set (CTEST_SOURCE_DIRECTORY "${CTEST_DASHBOARD_ROOT}\\${CTEST_SOURCE_NAME}") + set (CTEST_BINARY_DIRECTORY "${CTEST_DASHBOARD_ROOT}\\${CTEST_BINARY_NAME}") +else () + if (${STATICONLYLIBRARIES}) + set (BUILD_OPTIONS "${BUILD_OPTIONS} -DBUILD_SHARED_LIBS:BOOL=OFF -DCMAKE_ANSI_CFLAGS:STRING=-fPIC") + endif () + set (ENV{HDF5_DIR} "${INSTALLDIR}/share/cmake") + set (ENV{LD_LIBRARY_PATH} "${INSTALLDIR}/lib") + set (CTEST_BINARY_NAME ${CTEST_SOURCE_NAME}/build) + set (CTEST_SOURCE_DIRECTORY "${CTEST_DASHBOARD_ROOT}/${CTEST_SOURCE_NAME}") + set (CTEST_BINARY_DIRECTORY "${CTEST_DASHBOARD_ROOT}/${CTEST_BINARY_NAME}") +endif () +if (${FORTRANLIBRARIES}) + set (BUILD_OPTIONS "${BUILD_OPTIONS} -DHDF_BUILD_FORTRAN:BOOL=ON") +else () + set (BUILD_OPTIONS "${BUILD_OPTIONS} -DHDF_BUILD_FORTRAN:BOOL=OFF") +endif () if(${JAVALIBRARIES}) - set(BUILD_OPTIONS "${BUILD_OPTIONS} -DHDF_BUILD_JAVA:BOOL=ON") -else() - set(BUILD_OPTIONS "${BUILD_OPTIONS} -DHDF_BUILD_JAVA:BOOL=OFF") -endif() + set (BUILD_OPTIONS "${BUILD_OPTIONS} -DHDF_BUILD_JAVA:BOOL=ON") +else () + set (BUILD_OPTIONS "${BUILD_OPTIONS} -DHDF_BUILD_JAVA:BOOL=OFF") +endif () if(${CDASH_LOCAL}) - set(BUILD_OPTIONS "${BUILD_OPTIONS} -DCDASH_LOCAL:BOOL=ON") -endif() -set(BUILD_OPTIONS "${BUILD_OPTIONS} -DHDF5_PACKAGE_NAME:STRING=@HDF5_PACKAGE@@HDF_PACKAGE_EXT@") + set (BUILD_OPTIONS "${BUILD_OPTIONS} -DCDASH_LOCAL:BOOL=ON") +endif () +set (BUILD_OPTIONS "${BUILD_OPTIONS} -DHDF5_PACKAGE_NAME:STRING=@HDF5_PACKAGE@@HDF_PACKAGE_EXT@") ############################################################################################################### # For any comments please contact cdashhelp@hdfgroup.org @@ -113,99 +113,99 @@ set(BUILD_OPTIONS "${BUILD_OPTIONS} -DHDF5_PACKAGE_NAME:STRING=@HDF5_PACKAGE@@HD #----------------------------------------------------------------------------- # MAC machines need special option #----------------------------------------------------------------------------- -if(APPLE) +if (APPLE) # Compiler choice - execute_process(COMMAND xcrun --find cc OUTPUT_VARIABLE XCODE_CC OUTPUT_STRIP_TRAILING_WHITESPACE) - execute_process(COMMAND xcrun --find c++ OUTPUT_VARIABLE XCODE_CXX OUTPUT_STRIP_TRAILING_WHITESPACE) - set(ENV{CC} "${XCODE_CC}") - set(ENV{CXX} "${XCODE_CXX}") - if(NOT NO_MAC_FORTRAN) + execute_process (COMMAND xcrun --find cc OUTPUT_VARIABLE XCODE_CC OUTPUT_STRIP_TRAILING_WHITESPACE) + execute_process (COMMAND xcrun --find c++ OUTPUT_VARIABLE XCODE_CXX OUTPUT_STRIP_TRAILING_WHITESPACE) + set (ENV{CC} "${XCODE_CC}") + set (ENV{CXX} "${XCODE_CXX}") + if (NOT NO_MAC_FORTRAN) # Shared fortran is not supported, build static - set(BUILD_OPTIONS "${BUILD_OPTIONS} -DBUILD_SHARED_LIBS:BOOL=OFF -DCMAKE_ANSI_CFLAGS:STRING=-fPIC") - else() - set(BUILD_OPTIONS "${BUILD_OPTIONS} -DHDF_BUILD_FORTRAN:BOOL=OFF") - endif() - set(BUILD_OPTIONS "${BUILD_OPTIONS} -DCTEST_USE_LAUNCHERS:BOOL=ON -DCMAKE_BUILD_WITH_INSTALL_RPATH:BOOL=OFF") -endif() + set (BUILD_OPTIONS "${BUILD_OPTIONS} -DBUILD_SHARED_LIBS:BOOL=OFF -DCMAKE_ANSI_CFLAGS:STRING=-fPIC") + else () + set (BUILD_OPTIONS "${BUILD_OPTIONS} -DHDF_BUILD_FORTRAN:BOOL=OFF") + endif () + set (BUILD_OPTIONS "${BUILD_OPTIONS} -DCTEST_USE_LAUNCHERS:BOOL=ON -DCMAKE_BUILD_WITH_INSTALL_RPATH:BOOL=OFF") +endif () #----------------------------------------------------------------------------- -set(CTEST_CMAKE_COMMAND "\"${CMAKE_COMMAND}\"") +set (CTEST_CMAKE_COMMAND "\"${CMAKE_COMMAND}\"") ## -------------------------- -if(CTEST_USE_TAR_SOURCE) +if (CTEST_USE_TAR_SOURCE) ## Uncompress source if tar or zip file provided ## -------------------------- - if(WIN32) - message(STATUS "extracting... [${CMAKE_EXECUTABLE_NAME} -E tar -xvf ${CTEST_USE_TAR_SOURCE}.zip]") - execute_process(COMMAND ${CMAKE_EXECUTABLE_NAME} -E tar -xvf ${CTEST_DASHBOARD_ROOT}\\${CTEST_USE_TAR_SOURCE}.zip RESULT_VARIABLE rv) - else() - message(STATUS "extracting... [${CMAKE_EXECUTABLE_NAME} -E tar -xvf ${CTEST_USE_TAR_SOURCE}.tar]") - execute_process(COMMAND ${CMAKE_EXECUTABLE_NAME} -E tar -xvf ${CTEST_DASHBOARD_ROOT}/${CTEST_USE_TAR_SOURCE}.tar RESULT_VARIABLE rv) - endif() + if (WIN32) + message (STATUS "extracting... [${CMAKE_EXECUTABLE_NAME} -E tar -xvf ${CTEST_USE_TAR_SOURCE}.zip]") + execute_process (COMMAND ${CMAKE_EXECUTABLE_NAME} -E tar -xvf ${CTEST_DASHBOARD_ROOT}\\${CTEST_USE_TAR_SOURCE}.zip RESULT_VARIABLE rv) + else () + message (STATUS "extracting... [${CMAKE_EXECUTABLE_NAME} -E tar -xvf ${CTEST_USE_TAR_SOURCE}.tar]") + execute_process (COMMAND ${CMAKE_EXECUTABLE_NAME} -E tar -xvf ${CTEST_DASHBOARD_ROOT}/${CTEST_USE_TAR_SOURCE}.tar RESULT_VARIABLE rv) + endif () - if(NOT rv EQUAL 0) - message(STATUS "extracting... [error-(${rv}) clean up]") - file(REMOVE_RECURSE "${CTEST_SOURCE_DIRECTORY}") - message(FATAL_ERROR "error: extract of ${CTEST_SOURCE_NAME} failed") - endif() -endif(CTEST_USE_TAR_SOURCE) + if (NOT rv EQUAL 0) + message (STATUS "extracting... [error-(${rv}) clean up]") + file (REMOVE_RECURSE "${CTEST_SOURCE_DIRECTORY}") + message (FATAL_ERROR "error: extract of ${CTEST_SOURCE_NAME} failed") + endif () +endif() #----------------------------------------------------------------------------- ## Clear the build directory ## -------------------------- -set(CTEST_START_WITH_EMPTY_BINARY_DIRECTORY TRUE) +set (CTEST_START_WITH_EMPTY_BINARY_DIRECTORY TRUE) if (EXISTS "${CTEST_BINARY_DIRECTORY}" AND IS_DIRECTORY "${CTEST_BINARY_DIRECTORY}") - ctest_empty_binary_directory(${CTEST_BINARY_DIRECTORY}) + ctest_empty_binary_directory (${CTEST_BINARY_DIRECTORY}) else () - file(MAKE_DIRECTORY "${CTEST_BINARY_DIRECTORY}") + file (MAKE_DIRECTORY "${CTEST_BINARY_DIRECTORY}") endif () # Use multiple CPU cores to build -include(ProcessorCount) -ProcessorCount(N) -if(NOT N EQUAL 0) - if(NOT WIN32) - set(CTEST_BUILD_FLAGS -j${N}) - endif() - set(ctest_test_args ${ctest_test_args} PARALLEL_LEVEL ${N}) -endif() +include (ProcessorCount) +ProcessorCount (N) +if (NOT N EQUAL 0) + if (NOT WIN32) + set (CTEST_BUILD_FLAGS -j${N}) + endif () + set (ctest_test_args ${ctest_test_args} PARALLEL_LEVEL ${N}) +endif () set (CTEST_CONFIGURE_COMMAND "${CTEST_CMAKE_COMMAND} -C \"${CTEST_SOURCE_DIRECTORY}/config/cmake/cacheinit.cmake\" -DCMAKE_BUILD_TYPE:STRING=${CTEST_CONFIGURATION_TYPE} ${BUILD_OPTIONS} \"-G${CTEST_CMAKE_GENERATOR}\" \"${CTEST_SOURCE_DIRECTORY}\"" ) #----------------------------------------------------------------------------- ## -- set output to english -set($ENV{LC_MESSAGES} "en_EN") +set ($ENV{LC_MESSAGES} "en_EN") #----------------------------------------------------------------------------- -configure_file(${CTEST_SOURCE_DIRECTORY}/config/cmake/CTestCustom.cmake ${CTEST_BINARY_DIRECTORY}/CTestCustom.cmake) +configure_file (${CTEST_SOURCE_DIRECTORY}/config/cmake/CTestCustom.cmake ${CTEST_BINARY_DIRECTORY}/CTestCustom.cmake) ctest_read_custom_files ("${CTEST_BINARY_DIRECTORY}") ## NORMAL process ## -------------------------- ctest_start (Experimental) ctest_configure (BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) -if(${res} LESS 0 OR ${res} GREATER 0) - file(APPEND ${CTEST_SCRIPT_DIRECTORY}/FailedCTest.txt "Failed Configure: ${res}\n") -endif() -if(LOCAL_SUBMIT) +if (${res} LESS 0 OR ${res} GREATER 0) + file (APPEND ${CTEST_SCRIPT_DIRECTORY}/FailedCTest.txt "Failed Configure: ${res}\n") +endif () +if (LOCAL_SUBMIT) ctest_submit (PARTS Configure Notes) -endif() +endif () ctest_build (BUILD "${CTEST_BINARY_DIRECTORY}" APPEND APPEND RETURN_VALUE res NUMBER_ERRORS errval) -if(${res} LESS 0 OR ${res} GREATER 0 OR ${errval} GREATER 0) +if (${res} LESS 0 OR ${res} GREATER 0 OR ${errval} GREATER 0) file(APPEND ${CTEST_SCRIPT_DIRECTORY}/FailedCTest.txt "Failed ${errval} Build: ${res}\n") -endif() -if(LOCAL_SUBMIT) +endif () +if (LOCAL_SUBMIT) ctest_submit (PARTS Build) -endif() +endif () ctest_test (BUILD "${CTEST_BINARY_DIRECTORY}" APPEND ${ctest_test_args} RETURN_VALUE res) -if(${res} LESS 0 OR ${res} GREATER 0) +if (${res} LESS 0 OR ${res} GREATER 0) file(APPEND ${CTEST_SCRIPT_DIRECTORY}/FailedCTest.txt "Failed Tests: ${res}\n") -endif() -if(LOCAL_SUBMIT) +endif () +if (LOCAL_SUBMIT) ctest_submit (PARTS Test) -endif() -if(${res} LESS 0 OR ${res} GREATER 0) +endif () +if (${res} LESS 0 OR ${res} GREATER 0) message (FATAL_ERROR "tests FAILED") -endif() +endif () #----------------------------------------------------------------------------- ############################################################################################################## -message(STATUS "DONE") \ No newline at end of file +message (STATUS "DONE") diff --git a/config/cmake/HDF5_Process_Flex_Files.cmake b/config/cmake/HDF5_Process_Flex_Files.cmake index 2306e93..667ad31 100644 --- a/config/cmake/HDF5_Process_Flex_Files.cmake +++ b/config/cmake/HDF5_Process_Flex_Files.cmake @@ -49,7 +49,7 @@ if (FILE_PARSE) message (STATUS "processed pragma in ${FILE_PARSE}") file (READ ${GEN_DIR}/${FILE_PARSE}.h TEST_STREAM) file (WRITE ${FILE_PARSE}.h "${TEST_STREAM}") -endif (FILE_PARSE) +endif () if (FILE_ANALYZE) # Add code that disables warnings in the flex/bison-generated code. @@ -81,4 +81,4 @@ if (FILE_ANALYZE) ") file (APPEND ${FILE_ANALYZE} "${TEST_STREAM}") message (STATUS "processed pragma in ${FILE_ANALYZE}") -endif (FILE_ANALYZE) +endif () diff --git a/config/cmake/HDFCompilerFlags.cmake b/config/cmake/HDFCompilerFlags.cmake index 665db32..238e363 100644 --- a/config/cmake/HDFCompilerFlags.cmake +++ b/config/cmake/HDFCompilerFlags.cmake @@ -12,21 +12,21 @@ if (CMAKE_COMPILER_IS_GNUCC) if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 5.0) set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fstdarg-opt") endif () - endif (CMAKE_BUILD_TYPE MATCHES Debug) -endif (CMAKE_COMPILER_IS_GNUCC) -if (CMAKE_COMPILER_IS_GNUCXX) + endif () +endif () +if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_LOADED) if (CMAKE_BUILD_TYPE MATCHES Debug) set (CMAKE_CXX_FLAGS "${CMAKE_ANSI_CFLAGS} ${CMAKE_CXX_FLAGS}") if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0) set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Og -ftrapv -fno-common") endif () - else (CMAKE_BUILD_TYPE MATCHES Debug) + else () set (CMAKE_CXX_FLAGS "${CMAKE_ANSI_CFLAGS} ${CMAKE_CXX_FLAGS}") if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0) set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fstdarg-opt") endif () - endif (CMAKE_BUILD_TYPE MATCHES Debug) -endif (CMAKE_COMPILER_IS_GNUCXX) + endif () +endif () #----------------------------------------------------------------------------- # Option to allow the user to disable compiler warnings @@ -41,22 +41,22 @@ if (HDF5_DISABLE_COMPILER_WARNINGS) set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /w") string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /w") - endif (MSVC) + endif () if (WIN32) add_definitions (-D_CRT_SECURE_NO_WARNINGS) - endif (WIN32) + endif () # Borland uses -w- to suppress warnings. if (BORLAND) set (HDF5_WARNINGS_BLOCKED 1) set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -w-") - endif (BORLAND) + endif () # Most compilers use -w to suppress warnings. if (NOT HDF5_WARNINGS_BLOCKED) set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -w") set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -w") - endif (NOT HDF5_WARNINGS_BLOCKED) -endif (HDF5_DISABLE_COMPILER_WARNINGS) + endif () +endif () #----------------------------------------------------------------------------- # CDash is configured to only allow 3000 warnings, so @@ -64,10 +64,22 @@ endif (HDF5_DISABLE_COMPILER_WARNINGS) #----------------------------------------------------------------------------- if (NOT MSVC AND CMAKE_COMPILER_IS_GNUCC) if (NOT ${CMAKE_SYSTEM_NAME} MATCHES "SunOS") - set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wundef -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-qual -Wcast-align -Wwrite-strings -Wconversion -Waggregate-return -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls -Wnested-externs -Winline") - else (NOT ${CMAKE_SYSTEM_NAME} MATCHES "SunOS") + set (CMAKE_C_FLAGS_5 "${CMAKE_C_FLAGS_5} -Wcast-qual") + set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wundef -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-align -Wwrite-strings -Wconversion -Waggregate-return -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls -Wnested-externs") + else () set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -erroff=%none -DBSD_COMP") - endif (NOT ${CMAKE_SYSTEM_NAME} MATCHES "SunOS") + endif () + + #----------------------------------------------------------------------------- + # Option to allow the user to enable developer warnings + #----------------------------------------------------------------------------- + option (HDF5_ENABLE_DEV_WARNINGS "Enable HDF5 developer group warnings" OFF) + if (HDF5_ENABLE_DEV_WARNINGS) + set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Winline -Waggregate-return") + else () + set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-parameter -Wno-inline -Wno-aggregate-return") + endif () + # Append warning flags # Don't use the '-Wtraditional' flag, we're way past having K&R C code # set (H5_CFLAGS "${H5_CFLAGS} -Wtraditional") @@ -83,75 +95,102 @@ if (NOT MSVC AND CMAKE_COMPILER_IS_GNUCC) set (H5_CFLAGS1 "${H5_CFLAGS1} -Wfloat-equal -Wmissing-format-attribute") # Append warning flags from gcc-3.2* case - set (H5_CFLAGS1 "${H5_CFLAGS1} -Wmissing-noreturn -Wpacked -Wdisabled-optimization") + set (H5_CFLAGS1 "${H5_CFLAGS1} -Wpacked -Wdisabled-optimization") + if (HDF5_ENABLE_DEV_WARNINGS) + set (H5_CFLAGS1 "${H5_CFLAGS1} -Wmissing-noreturn") + else () + set (H5_CFLAGS1 "${H5_CFLAGS1} -Wno-missing-noreturn") + endif () # Enable more format checking flags, beyond the basic -Wformat included # in -Wall - set (H5_CFLAGS1 "${H5_CFLAGS1} -Wformat=2") - - # The "unreachable code" warning appears to be reliable now... - # (this warning was removed in gcc 4.5+) - if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.7) - set (H5_CFLAGS1 "${H5_CFLAGS1} -Wunreachable-code") - endif() + set (H5_CFLAGS1_5 "${H5_CFLAGS1_5} -Wformat=2") # Append warning flags from gcc-3.3* case set (H5_CFLAGS1 "${H5_CFLAGS1} -Wendif-labels") # Append warning flags from gcc-3.4* case - set (H5_CFLAGS2 "${H5_CFLAGS2} -Wdeclaration-after-statement -Wold-style-definition -Winvalid-pch") + set (H5_CFLAGS1 "${H5_CFLAGS1} -Wdeclaration-after-statement -Wold-style-definition -Winvalid-pch") # Append more extra warning flags that only gcc4.0+ know about set (H5_CFLAGS2 "${H5_CFLAGS2} -Wvariadic-macros -Winit-self -Wmissing-include-dirs -Wswitch-default -Wswitch-enum -Wunused-macros") # Append more extra warning flags that only gcc 4.1+ know about - set (H5_CFLAGS3 "${H5_CFLAGS3} -Wunsafe-loop-optimizations -Wc++-compat") + set (H5_CFLAGS2_5 "${H5_CFLAGS2_5} -Wunsafe-loop-optimizations") + set (H5_CFLAGS2 "${H5_CFLAGS2} -Wc++-compat") # Append more extra warning flags that only gcc 4.2+ know about - set (H5_CFLAGS3 "${H5_CFLAGS3} -Wstrict-overflow") + set (H5_CFLAGS2_5 "${H5_CFLAGS2_5} -Wstrict-overflow") + set (H5_CFLAGS2 "${H5_CFLAGS2} -Wno-strict-overflow") # Append more extra warning flags that only gcc 4.3+ know about # # Technically, variable-length arrays are part of the C99 standard, but # we should approach them a bit cautiously... -QAK - set (H5_CFLAGS3 "${H5_CFLAGS3} -Wlogical-op -Wlarger-than=2048 -Wvla") + set (H5_CFLAGS2 "${H5_CFLAGS2} -Wlogical-op -Wlarger-than=2048 -Wvla") # Append more extra warning flags that only gcc 4.4+ know about - set (H5_CFLAGS4 "${H5_CFLAGS4} -Wsync-nand -Wframe-larger-than=16384 -Wpacked-bitfield-compat") + set (H5_CFLAGS2 "${H5_CFLAGS2} -Wsync-nand -Wframe-larger-than=16384 -Wpacked-bitfield-compat") # Append more extra warning flags that only gcc 4.5+ know about if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.5) - set (H5_CFLAGS4 "${H5_CFLAGS4} -Wstrict-overflow=5 -Wjump-misses-init -Wunsuffixed-float-constants") - endif() + set (H5_CFLAGS2_5 "${H5_CFLAGS2_5} -Wstrict-overflow=5 -Wjump-misses-init -Wunsuffixed-float-constants") + set (H5_CFLAGS2 "${H5_CFLAGS2} -Wjump-misses-init -Wunsuffixed-float-constants") + endif () # Append more extra warning flags that only gcc 4.6+ know about if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.6) - set (H5_CFLAGS5 "${H5_CFLAGS5} -Wdouble-promotion -Wsuggest-attribute=const -Wtrampolines") - endif() + set (H5_CFLAGS2 "${H5_CFLAGS2} -Wdouble-promotion -Wtrampolines") + if (HDF5_ENABLE_DEV_WARNINGS) + set (H5_CFLAGS2 "${H5_CFLAGS2} -Wsuggest-attribute=const") + else () + set (H5_CFLAGS2 "${H5_CFLAGS2} -Wno-suggest-attribute=const") + endif () + endif () + + # The "unreachable code" warning appears to be reliable now... + # (this warning was removed in gcc 4.5+) + if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.7) + set (H5_CFLAGS2 "${H5_CFLAGS2} -Wunreachable-code") + endif () # Append more extra warning flags that only gcc 4.7+ know about if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.7) - set (H5_CFLAGS5 "${H5_CFLAGS5} -Wstack-usage=8192 -Wvector-operation-performance -Wsuggest-attribute=pure -Wsuggest-attribute=noreturn") - endif() + set (H5_CFLAGS2 "${H5_CFLAGS2} -Wstack-usage=8192 -Wvector-operation-performance") + if (HDF5_ENABLE_DEV_WARNINGS) + set (H5_CFLAGS2 "${H5_CFLAGS2} -Wsuggest-attribute=pure -Wsuggest-attribute=noreturn") + else () + set (H5_CFLAGS2 "${H5_CFLAGS2} -Wno-suggest-attribute=pure -Wno-suggest-attribute=noreturn") + endif () + endif () # Append more extra warning flags that only gcc 4.8+ know about if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.8) - set (H5_CFLAGS5 "${H5_CFLAGS5} -Wsuggest-attribute=format") - endif() + if (HDF5_ENABLE_DEV_WARNINGS) + set (H5_CFLAGS2 "${H5_CFLAGS2} -Wsuggest-attribute=format") + else () + set (H5_CFLAGS2 "${H5_CFLAGS2} -Wno-suggest-attribute=format") + endif () + endif () # Append more extra warning flags that only gcc 4.9+ know about if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.9) - set (H5_CFLAGS5 "${H5_CFLAGS5} -Wdate-time -Wopenmp-simd") - endif() + set (H5_CFLAGS2 "${H5_CFLAGS2} -Wdate-time -Wopenmp-simd") + endif () # (There was no release of gcc 5.0) # Append more extra warning flags that only gcc 5.1+ know about if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 5.1) - set (H5_CFLAGS6 "${H5_CFLAGS6} -Warray-bounds=2 -Wc99-c11-compat") - endif() + set (H5_CFLAGS3 "${H5_CFLAGS3} -Warray-bounds=2 -Wc99-c11-compat") + endif () + + # Append more extra warning flags that only gcc 6.x+ know about + if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 6.0) + set (H5_CFLAGS4 "${H5_CFLAGS4} -Wnull-dereference -Wunused-const-variable -Wduplicated-cond -Whsa") + endif () -endif (NOT MSVC AND CMAKE_COMPILER_IS_GNUCC) +endif () #----------------------------------------------------------------------------- # Option to allow the user to enable all warnings @@ -159,16 +198,23 @@ endif (NOT MSVC AND CMAKE_COMPILER_IS_GNUCC) option (HDF5_ENABLE_ALL_WARNINGS "Enable all warnings" OFF) if (HDF5_ENABLE_ALL_WARNINGS) if (MSVC) - string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") - set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /Wall") - string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") - set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Wall") - else (MSVC) + if (HDF5_ENABLE_DEV_WARNINGS) + string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") + set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /Wall /wd4668") + string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") + set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Wall /wd4668") + else () + string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") + set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W3") + string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") + set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W3") + endif () + else () if (CMAKE_COMPILER_IS_GNUCC) - set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -pedantic ${H5_CFLAGS1} ${H5_CFLAGS2} ${H5_CFLAGS3} ${H5_CFLAGS4}") - endif (CMAKE_COMPILER_IS_GNUCC) - endif (MSVC) -endif (HDF5_ENABLE_ALL_WARNINGS) + set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -pedantic ${H5_CFLAGS1} ${H5_CFLAGS2}") + endif () + endif () +endif () #----------------------------------------------------------------------------- # Option to allow the user to enable warnings by groups @@ -180,12 +226,12 @@ if (HDF5_ENABLE_GROUPZERO_WARNINGS) set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W1") string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W1") - else (MSVC) + else () if (CMAKE_COMPILER_IS_GNUCC) set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -pedantic") - endif (CMAKE_COMPILER_IS_GNUCC) - endif (MSVC) -endif (HDF5_ENABLE_GROUPZERO_WARNINGS) + endif () + endif () +endif () #----------------------------------------------------------------------------- # Option to allow the user to enable warnings by groups @@ -197,10 +243,10 @@ if (HDF5_ENABLE_GROUPONE_WARNINGS) set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W2") string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W2") - else (MSVC) + else () set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${H5_CFLAGS1}") - endif (MSVC) -endif (HDF5_ENABLE_GROUPONE_WARNINGS) + endif () +endif () #----------------------------------------------------------------------------- # Option to allow the user to enable warnings by groups @@ -212,10 +258,10 @@ if (HDF5_ENABLE_GROUPTWO_WARNINGS) set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W3") string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W3") - else (MSVC) + else () set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${H5_CFLAGS2}") - endif (MSVC) -endif (HDF5_ENABLE_GROUPTWO_WARNINGS) + endif () +endif () #----------------------------------------------------------------------------- # Option to allow the user to enable warnings by groups @@ -227,10 +273,10 @@ if (HDF5_ENABLE_GROUPTHREE_WARNINGS) set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W4") string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4") - else (MSVC) + else () set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${H5_CFLAGS3}") - endif (MSVC) -endif (HDF5_ENABLE_GROUPTHREE_WARNINGS) + endif () +endif () #----------------------------------------------------------------------------- # Option to allow the user to enable warnings by groups @@ -239,28 +285,8 @@ option (HDF5_ENABLE_GROUPFOUR_WARNINGS "Enable group four warnings" OFF) if (HDF5_ENABLE_GROUPFOUR_WARNINGS) if (NOT MSVC) set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${H5_CFLAGS4}") - endif (NOT MSVC) -endif (HDF5_ENABLE_GROUPFOUR_WARNINGS) - -#----------------------------------------------------------------------------- -# Option to allow the user to enable warnings by groups -#----------------------------------------------------------------------------- -option (HDF5_ENABLE_GROUPFIVE_WARNINGS "Enable group five warnings" OFF) -if (HDF5_ENABLE_GROUPFIVE_WARNINGS) - if (NOT MSVC) - set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${H5_CFLAGS5}") - endif (NOT MSVC) -endif (HDF5_ENABLE_GROUPFIVE_WARNINGS) - -#----------------------------------------------------------------------------- -# Option to allow the user to enable warnings by groups -#----------------------------------------------------------------------------- -option (HDF5_ENABLE_GROUPSIX_WARNINGS "Enable group six warnings" OFF) -if (HDF5_ENABLE_GROUPSIX_WARNINGS) - if (NOT MSVC) - set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${H5_CFLAGS6}") - endif (NOT MSVC) -endif (HDF5_ENABLE_GROUPSIX_WARNINGS) + endif () +endif () #----------------------------------------------------------------------------- # This is in here to help some of the GCC based IDES like Eclipse @@ -268,7 +294,7 @@ endif (HDF5_ENABLE_GROUPSIX_WARNINGS) #----------------------------------------------------------------------------- if (CMAKE_COMPILER_IS_GNUCC) set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fmessage-length=0") -endif (CMAKE_COMPILER_IS_GNUCC) -if (CMAKE_COMPILER_IS_GNUCXX) +endif () +if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_LOADED) set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fmessage-length=0") -endif (CMAKE_COMPILER_IS_GNUCXX) +endif () diff --git a/config/cmake/README.txt.cmake.in b/config/cmake/README.txt.cmake.in index 7ab3c35..1d6ef45 100644 --- a/config/cmake/README.txt.cmake.in +++ b/config/cmake/README.txt.cmake.in @@ -43,7 +43,7 @@ To test the installation with the examples; with the CTEST_CONFIGURATION_TYPE script option. Note that this must be the same as the value used with the -C command line option. The default build configuration is defined to build and use static libraries. - Shared libraries can be used with the STATICLIBRARIES script option set to "NO". + Shared libraries can be used with the STATICONLYLIBRARIES script option set to "NO". Other options can be changed by editing the HDF5_Examples.cmake file. If the defaults are okay, execute from this directory: diff --git a/config/cmake/UseJava.cmake b/config/cmake/UseJava.cmake index 6391c63..3e74d4f 100644 --- a/config/cmake/UseJava.cmake +++ b/config/cmake/UseJava.cmake @@ -1250,7 +1250,7 @@ function(create_javadoc _target) else () set(_overview ${_overview}:${_path}) endif () - endforeach() + endforeach () set(_javadoc_options ${_javadoc_options} -overview ${_overview}) endif () diff --git a/config/cmake/UserMacros/Windows_MT.cmake b/config/cmake/UserMacros/Windows_MT.cmake index a54f22c..216a014 100644 --- a/config/cmake/UserMacros/Windows_MT.cmake +++ b/config/cmake/UserMacros/Windows_MT.cmake @@ -3,14 +3,14 @@ ######################################################## # To use this option, copy both the macro and option code -# into the root UserMacros.cmake file. +# into the root UserMacros.cmake file. # OR add an include to the root UserMacros.cmake file: # INCLUDE(path_to_file/WINDOWS_MT.cmake) #----------------------------------------------------------------------------- # Option to Build with Static CRT libraries on Windows #------------------------------------------------------------------------------- -MACRO (TARGET_STATIC_CRT_FLAGS) +macro (TARGET_STATIC_CRT_FLAGS) if (MSVC AND NOT BUILD_SHARED_LIBS) foreach (flag_var CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE @@ -19,23 +19,22 @@ MACRO (TARGET_STATIC_CRT_FLAGS) CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO) if (${flag_var} MATCHES "/MD") string (REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}") - endif (${flag_var} MATCHES "/MD") - endforeach (flag_var) + endif () + endforeach () foreach (flag_var CMAKE_Fortran_FLAGS CMAKE_Fortran_FLAGS_DEBUG CMAKE_Fortran_FLAGS_RELEASE CMAKE_Fortran_FLAGS_MINSIZEREL CMAKE_Fortran_FLAGS_RELWITHDEBINFO) if (${flag_var} MATCHES "/libs:dll") string (REGEX REPLACE "/libs:dll" "/libs:static" ${flag_var} "${${flag_var}}") - endif (${flag_var} MATCHES "/libs:dll") - endforeach (flag_var) + endif () + endforeach () set (WIN_COMPILE_FLAGS "") set (WIN_LINK_FLAGS "/NODEFAULTLIB:MSVCRT") - endif (MSVC AND NOT BUILD_SHARED_LIBS) -ENDMACRO (TARGET_STATIC_CRT_FLAGS) + endif () +endmacro () #----------------------------------------------------------------------------- option (BUILD_STATIC_CRT_LIBS "Build With Static CRT Libraries" OFF) if (BUILD_STATIC_CRT_LIBS) TARGET_STATIC_CRT_FLAGS () -endif (BUILD_STATIC_CRT_LIBS) - \ No newline at end of file +endif () diff --git a/config/cmake/cacheinit.cmake b/config/cmake/cacheinit.cmake index 24ae95c..5901a78 100644 --- a/config/cmake/cacheinit.cmake +++ b/config/cmake/cacheinit.cmake @@ -42,6 +42,8 @@ set (HDF5_MEMORY_ALLOC_SANITY_CHECK OFF CACHE BOOL "Indicate that internal memor set (HDF5_DISABLE_COMPILER_WARNINGS OFF CACHE BOOL "Disable compiler warnings" FORCE) +set (HDF5_ENABLE_ALL_WARNINGS ON CACHE BOOL "Enable all warnings" FORCE) + set (HDF5_USE_FOLDERS ON CACHE BOOL "Enable folder grouping of projects in IDEs." FORCE) set (HDF5_USE_16_API_DEFAULT OFF CACHE BOOL "Use the HDF5 1.6.x API by default" FORCE) diff --git a/config/cmake/hdf5-config-version.cmake.in b/config/cmake/hdf5-config-version.cmake.in index 5911fa7..ad1b96d 100644 --- a/config/cmake/hdf5-config-version.cmake.in +++ b/config/cmake/hdf5-config-version.cmake.in @@ -12,36 +12,36 @@ set (PACKAGE_VERSION "@HDF5_VERSION_STRING@") if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}" ) set(PACKAGE_VERSION_COMPATIBLE FALSE) -else() +else () if ("${PACKAGE_FIND_VERSION_MAJOR}" STREQUAL "@H5_VERS_MAJOR@") - + # exact match for version @H5_VERS_MAJOR@.@H5_VERS_MINOR@ if ("${PACKAGE_FIND_VERSION_MINOR}" STREQUAL "@H5_VERS_MINOR@") - + # compatible with any version @H5_VERS_MAJOR@.@H5_VERS_MINOR@.x - set (PACKAGE_VERSION_COMPATIBLE TRUE) - + set (PACKAGE_VERSION_COMPATIBLE TRUE) + if ("${PACKAGE_FIND_VERSION_PATCH}" STREQUAL "@H5_VERS_RELEASE@") set (PACKAGE_VERSION_EXACT TRUE) - + if ("${PACKAGE_FIND_VERSION_TWEAK}" STREQUAL "@H5_VERS_SUBRELEASE@") # not using this yet - endif ("${PACKAGE_FIND_VERSION_TWEAK}" STREQUAL "@H5_VERS_SUBRELEASE@") - endif ("${PACKAGE_FIND_VERSION_PATCH}" STREQUAL "@H5_VERS_RELEASE@") - else ("${PACKAGE_FIND_VERSION_MINOR}" STREQUAL "@H5_VERS_MINOR@") - set (PACKAGE_VERSION_COMPATIBLE FALSE) - endif ("${PACKAGE_FIND_VERSION_MINOR}" STREQUAL "@H5_VERS_MINOR@") - endif ("${PACKAGE_FIND_VERSION_MAJOR}" STREQUAL "@H5_VERS_MAJOR@") -endif() + endif () + endif () + else () + set (PACKAGE_VERSION_COMPATIBLE FALSE) + endif () + endif () +endif () # if the installed or the using project don't have CMAKE_SIZEOF_VOID_P set, ignore it: if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "" OR "@CMAKE_SIZEOF_VOID_P@" STREQUAL "") return() -endif() +endif () # check that the installed version has the same 32/64bit-ness as the one which is currently searching: if(NOT "${CMAKE_SIZEOF_VOID_P}" STREQUAL "@CMAKE_SIZEOF_VOID_P@") math(EXPR installedBits "@CMAKE_SIZEOF_VOID_P@ * 8") set(PACKAGE_VERSION "${PACKAGE_VERSION} (${installedBits}bit)") set(PACKAGE_VERSION_UNSUITABLE TRUE) -endif() +endif () diff --git a/config/cmake/hdf5-config.cmake.in b/config/cmake/hdf5-config.cmake.in index 41fc726..6dffa6c 100644 --- a/config/cmake/hdf5-config.cmake.in +++ b/config/cmake/hdf5-config.cmake.in @@ -50,7 +50,7 @@ if (${HDF5_PACKAGE_NAME}_BUILD_JAVA) ) set (${HDF5_PACKAGE_NAME}_JAVA_LIBRARY "@PACKAGE_CURRENT_BUILD_DIR@/lib") set (${HDF5_PACKAGE_NAME}_JAVA_LIBRARIES "${${HDF5_PACKAGE_NAME}_JAVA_LIBRARY}") -endif() +endif () #----------------------------------------------------------------------------- # Directories diff --git a/config/cmake/jrunTest.cmake b/config/cmake/jrunTest.cmake index 59f4c7b..0e0106f 100644 --- a/config/cmake/jrunTest.cmake +++ b/config/cmake/jrunTest.cmake @@ -5,44 +5,44 @@ cmake_policy(SET CMP0007 NEW) # arguments checking if (NOT TEST_TESTER) message (FATAL_ERROR "Require TEST_TESTER to be defined") -endif (NOT TEST_TESTER) +endif () if (NOT TEST_PROGRAM) message (FATAL_ERROR "Require TEST_PROGRAM to be defined") -endif (NOT TEST_PROGRAM) +endif () if (NOT TEST_LIBRARY_DIRECTORY) message (STATUS "Require TEST_LIBRARY_DIRECTORY to be defined") -endif (NOT TEST_LIBRARY_DIRECTORY) +endif () if (NOT TEST_FOLDER) message ( FATAL_ERROR "Require TEST_FOLDER to be defined") -endif (NOT TEST_FOLDER) +endif () if (NOT TEST_OUTPUT) message (FATAL_ERROR "Require TEST_OUTPUT to be defined") -endif (NOT TEST_OUTPUT) +endif () if (NOT TEST_CLASSPATH) message (STATUS "Require TEST_CLASSPATH to be defined") -endif (NOT TEST_CLASSPATH) +endif () if (NOT TEST_REFERENCE) message (FATAL_ERROR "Require TEST_REFERENCE to be defined") -endif (NOT TEST_REFERENCE) +endif () if (NOT TEST_ERRREF) if (NOT SKIP_APPEND) # append error file since skip was not defined set (ERROR_APPEND 1) - endif(NOT SKIP_APPEND) -endif (NOT TEST_ERRREF) + endif () +endif () if (NOT TEST_LOG_LEVEL) set (LOG_LEVEL "info") -else (NOT TEST_LOG_LEVEL) +else () set (LOG_LEVEL "${TEST_LOG_LEVEL}") -endif (NOT TEST_LOG_LEVEL) +endif () message (STATUS "COMMAND: ${TEST_TESTER} -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=${LOG_LEVEL} -Djava.library.path=\"${TEST_LIBRARY_DIRECTORY}\" -cp \"${TEST_CLASSPATH}\" ${TEST_ARGS} ${TEST_PROGRAM} ${ARGN}") if (WIN32 AND NOT MINGW) set (ENV{PATH} "$ENV{PATH}\\;${TEST_LIBRARY_DIRECTORY}") -endif (WIN32 AND NOT MINGW) +endif () # run the test program, capture the stdout/stderr and the result var execute_process ( @@ -64,25 +64,25 @@ if (EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}.err) file (READ ${TEST_FOLDER}/${TEST_OUTPUT}.err TEST_STREAM) if (TEST_MASK_FILE) STRING(REGEX REPLACE "CurrentDir is [^\n]+\n" "CurrentDir is (dir name)\n" TEST_STREAM "${TEST_STREAM}") - endif (TEST_MASK_FILE) + endif () if (NOT ERROR_APPEND) # append error output to the stdout output file file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT}.err "${TEST_STREAM}") - else (NOT ERROR_APPEND) + else () # write back to original .err file file (APPEND ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_STREAM}") - endif (NOT ERROR_APPEND) -endif (EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}.err) + endif () +endif () if (TEST_MASK_ERROR) if (NOT TEST_ERRREF) # the error stack has been appended to the output file file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM) - else (NOT TEST_ERRREF) + else () # the error stack remains in the .err file file (READ ${TEST_FOLDER}/${TEST_OUTPUT}.err TEST_STREAM) - endif (NOT TEST_ERRREF) + endif () string (REGEX REPLACE "Time:[^\n]+\n" "Time: XXXX\n" TEST_STREAM "${TEST_STREAM}") string (REGEX REPLACE "thread [0-9]*:" "thread (IDs):" TEST_STREAM "${TEST_STREAM}") string (REGEX REPLACE ": ([^\n]*)[.]c " ": (file name) " TEST_STREAM "${TEST_STREAM}") @@ -94,16 +94,16 @@ if (TEST_MASK_ERROR) # write back the changes to the original files if (NOT TEST_ERRREF) file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_STREAM}") - else (NOT TEST_ERRREF) + else () file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT}.err "${TEST_STREAM}") - endif (NOT TEST_ERRREF) -endif (TEST_MASK_ERROR) + endif () +endif () # if the return value is !=0 bail out if (NOT ${TEST_RESULT} STREQUAL ${TEST_EXPECT}) message (STATUS "ERROR OUTPUT: ${TEST_STREAM}") message (FATAL_ERROR "Failed: Test program ${TEST_PROGRAM} exited != 0.\n${TEST_ERROR}") -endif (NOT ${TEST_RESULT} STREQUAL ${TEST_EXPECT}) +endif () message (STATUS "COMMAND Error: ${TEST_ERROR}") @@ -112,7 +112,7 @@ if (NOT TEST_SKIP_COMPARE) if (WIN32 AND NOT MINGW) file (READ ${TEST_FOLDER}/${TEST_REFERENCE} TEST_STREAM) file (WRITE ${TEST_FOLDER}/${TEST_REFERENCE} "${TEST_STREAM}") - endif (WIN32 AND NOT MINGW) + endif () # now compare the output with the reference execute_process ( @@ -120,42 +120,42 @@ if (NOT TEST_SKIP_COMPARE) RESULT_VARIABLE TEST_RESULT ) if (NOT ${TEST_RESULT} STREQUAL 0) - set (TEST_RESULT 0) - file (STRINGS ${TEST_FOLDER}/${TEST_OUTPUT} test_act) - list (LENGTH test_act len_act) - file (STRINGS ${TEST_FOLDER}/${TEST_REFERENCE} test_ref) - list (LENGTH test_ref len_ref) - if (NOT ${len_act} STREQUAL "0") - MATH (EXPR _FP_LEN "${len_ref} - 1") - foreach (line RANGE 0 ${_FP_LEN}) - list (GET test_act ${line} str_act) - list (GET test_ref ${line} str_ref) - if (NOT "${str_act}" STREQUAL "${str_ref}") - if (NOT "${str_act}" STREQUAL "") - set (TEST_RESULT 1) - message ("line = ${line}\n***ACTUAL: ${str_act}\n****REFER: ${str_ref}\n") - endif (NOT "${str_act}" STREQUAL "") - endif (NOT "${str_act}" STREQUAL "${str_ref}") - endforeach (line RANGE 0 ${_FP_LEN}) - endif (NOT ${len_act} STREQUAL "0") - if (NOT ${len_act} STREQUAL ${len_ref}) - set (TEST_RESULT 1) - endif (NOT ${len_act} STREQUAL ${len_ref}) - endif (NOT ${TEST_RESULT} STREQUAL 0) + set (TEST_RESULT 0) + file (STRINGS ${TEST_FOLDER}/${TEST_OUTPUT} test_act) + list (LENGTH test_act len_act) + file (STRINGS ${TEST_FOLDER}/${TEST_REFERENCE} test_ref) + list (LENGTH test_ref len_ref) + if (NOT ${len_act} STREQUAL "0") + math (EXPR _FP_LEN "${len_ref} - 1") + foreach (line RANGE 0 ${_FP_LEN}) + list (GET test_act ${line} str_act) + list (GET test_ref ${line} str_ref) + if (NOT "${str_act}" STREQUAL "${str_ref}") + if (NOT "${str_act}" STREQUAL "") + set (TEST_RESULT 1) + message ("line = ${line}\n***ACTUAL: ${str_act}\n****REFER: ${str_ref}\n") + endif () + endif () + endforeach () + endif () + if (NOT ${len_act} STREQUAL ${len_ref}) + set (TEST_RESULT 1) + endif () + endif () message (STATUS "COMPARE Result: ${TEST_RESULT}") # again, if return value is !=0 scream and shout if (NOT ${TEST_RESULT} STREQUAL 0) message (FATAL_ERROR "Failed: The output of ${TEST_OUTPUT} did not match ${TEST_REFERENCE}") - endif (NOT ${TEST_RESULT} STREQUAL 0) + endif () # now compare the .err file with the error reference, if supplied if (TEST_ERRREF) if (WIN32 AND NOT MINGW) file (READ ${TEST_FOLDER}/${TEST_ERRREF} TEST_STREAM) file (WRITE ${TEST_FOLDER}/${TEST_ERRREF} "${TEST_STREAM}") - endif (WIN32 AND NOT MINGW) + endif () # now compare the error output with the error reference execute_process ( @@ -163,38 +163,38 @@ if (NOT TEST_SKIP_COMPARE) RESULT_VARIABLE TEST_RESULT ) if (NOT ${TEST_RESULT} STREQUAL 0) - set (TEST_RESULT 0) - file (STRINGS ${TEST_FOLDER}/${TEST_OUTPUT}.err test_act) - list (LENGTH test_act len_act) - file (STRINGS ${TEST_FOLDER}/${TEST_ERRREF} test_ref) - list (LENGTH test_ref len_ref) - MATH (EXPR _FP_LEN "${len_ref} - 1") - if (NOT ${len_act} STREQUAL "0") - MATH (EXPR _FP_LEN "${len_ref} - 1") - foreach (line RANGE 0 ${_FP_LEN}) - list (GET test_act ${line} str_act) - list (GET test_ref ${line} str_ref) - if (NOT "${str_act}" STREQUAL "${str_ref}") - if (NOT "${str_act}" STREQUAL "") - set (TEST_RESULT 1) - message ("line = ${line}\n***ACTUAL: ${str_act}\n****REFER: ${str_ref}\n") - endif (NOT "${str_act}" STREQUAL "") - endif (NOT "${str_act}" STREQUAL "${str_ref}") - endforeach (line RANGE 0 ${_FP_LEN}) - endif (NOT ${len_act} STREQUAL "0") - if (NOT ${len_act} STREQUAL ${len_ref}) - set (TEST_RESULT 1) - endif (NOT ${len_act} STREQUAL ${len_ref}) - endif (NOT ${TEST_RESULT} STREQUAL 0) + set (TEST_RESULT 0) + file (STRINGS ${TEST_FOLDER}/${TEST_OUTPUT}.err test_act) + list (LENGTH test_act len_act) + file (STRINGS ${TEST_FOLDER}/${TEST_ERRREF} test_ref) + list (LENGTH test_ref len_ref) + math (EXPR _FP_LEN "${len_ref} - 1") + if (NOT ${len_act} STREQUAL "0") + math (EXPR _FP_LEN "${len_ref} - 1") + foreach (line RANGE 0 ${_FP_LEN}) + list (GET test_act ${line} str_act) + list (GET test_ref ${line} str_ref) + if (NOT "${str_act}" STREQUAL "${str_ref}") + if (NOT "${str_act}" STREQUAL "") + set (TEST_RESULT 1) + message ("line = ${line}\n***ACTUAL: ${str_act}\n****REFER: ${str_ref}\n") + endif () + endif () + endforeach () + endif () + if (NOT ${len_act} STREQUAL ${len_ref}) + set (TEST_RESULT 1) + endif () + endif () message (STATUS "COMPARE Result: ${TEST_RESULT}") # again, if return value is !=0 scream and shout if (NOT ${TEST_RESULT} STREQUAL 0) message (FATAL_ERROR "Failed: The error output of ${TEST_OUTPUT}.err did not match ${TEST_ERRREF}") - endif (NOT ${TEST_RESULT} STREQUAL 0) - endif (TEST_ERRREF) -endif (NOT TEST_SKIP_COMPARE) + endif () + endif () +endif () if (TEST_GREP_COMPARE) # now grep the output with the reference @@ -205,7 +205,7 @@ if (TEST_GREP_COMPARE) string (COMPARE EQUAL "${TEST_REFERENCE}" "${TEST_MATCH}" TEST_RESULT) if (${TEST_RESULT} STREQUAL "0") message (FATAL_ERROR "Failed: The output of ${TEST_PROGRAM} did not contain ${TEST_REFERENCE}") - endif (${TEST_RESULT} STREQUAL "0") + endif () string (REGEX MATCH "${TEST_FILTER}" TEST_MATCH ${TEST_STREAM}) if (${TEST_EXPECT} STREQUAL "1") @@ -213,9 +213,9 @@ if (TEST_GREP_COMPARE) string (LENGTH "${TEST_MATCH}" TEST_RESULT) if (NOT ${TEST_RESULT} STREQUAL "0") message (FATAL_ERROR "Failed: The output of ${TEST_PROGRAM} did contain ${TEST_FILTER}") - endif (NOT ${TEST_RESULT} STREQUAL "0") - endif (${TEST_EXPECT} STREQUAL "0") -endif (TEST_GREP_COMPARE) + endif () + endif () +endif () # everything went fine... message ("${TEST_PROGRAM} Passed") diff --git a/config/cmake/scripts/CTestScript.cmake b/config/cmake/scripts/CTestScript.cmake index f2675c3..dca9631 100755 --- a/config/cmake/scripts/CTestScript.cmake +++ b/config/cmake/scripts/CTestScript.cmake @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.1.0 FATAL_ERROR) +cmake_minimum_required (VERSION 3.2.2 FATAL_ERROR) ######################################################## # This dashboard is maintained by The HDF Group # For any comments please contact cdashhelp@hdfgroup.org @@ -7,225 +7,204 @@ cmake_minimum_required(VERSION 3.1.0 FATAL_ERROR) # ----------------------------------------------------------- # -- Get environment # ----------------------------------------------------------- -if(NOT SITE_OS_NAME) +if (NOT SITE_OS_NAME) ## machine name not provided - attempt to discover with uname ## -- set hostname ## -------------------------- - find_program(HOSTNAME_CMD NAMES hostname) - exec_program(${HOSTNAME_CMD} ARGS OUTPUT_VARIABLE HOSTNAME) - set(CTEST_SITE "${HOSTNAME}${CTEST_SITE_EXT}") - find_program(UNAME NAMES uname) - macro(getuname name flag) - exec_program("${UNAME}" ARGS "${flag}" OUTPUT_VARIABLE "${name}") - endmacro(getuname) + find_program (HOSTNAME_CMD NAMES hostname) + exec_program (${HOSTNAME_CMD} ARGS OUTPUT_VARIABLE HOSTNAME) + set (CTEST_SITE "${HOSTNAME}${CTEST_SITE_EXT}") + find_program (UNAME NAMES uname) + macro (getuname name flag) + exec_program ("${UNAME}" ARGS "${flag}" OUTPUT_VARIABLE "${name}") + endmacro () - getuname(osname -s) - getuname(osrel -r) - getuname(cpu -m) - message(STATUS "Dashboard script uname output: ${osname}-${osrel}-${cpu}\n") + getuname (osname -s) + getuname (osrel -r) + getuname (cpu -m) + message (STATUS "Dashboard script uname output: ${osname}-${osrel}-${cpu}\n") - set(CTEST_BUILD_NAME "${osname}-${osrel}-${cpu}") - if(USE_AUTOTOOLS) - set(CTEST_BUILD_NAME "AT-${CTEST_BUILD_NAME}") - endif() - if(SITE_BUILDNAME_SUFFIX) - set(CTEST_BUILD_NAME "${CTEST_BUILD_NAME}-${SITE_BUILDNAME_SUFFIX}") - endif() - set(BUILD_OPTIONS "${ADD_BUILD_OPTIONS}") -else(NOT SITE_OS_NAME) + set (CTEST_BUILD_NAME "${osname}-${osrel}-${cpu}") + if (SITE_BUILDNAME_SUFFIX) + set (CTEST_BUILD_NAME "${SITE_BUILDNAME_SUFFIX}-${CTEST_BUILD_NAME}") + endif () + set (BUILD_OPTIONS "${ADD_BUILD_OPTIONS}") +else () ## machine name provided ## -------------------------- - if(CMAKE_HOST_UNIX) + if (CMAKE_HOST_UNIX) set(CTEST_BUILD_NAME "${SITE_OS_NAME}-${SITE_OS_VERSION}-${SITE_OS_BITS}-${SITE_COMPILER_NAME}-${SITE_COMPILER_VERSION}") - else() + else () set(CTEST_BUILD_NAME "${SITE_OS_NAME}-${SITE_OS_VERSION}-${SITE_COMPILER_NAME}") - endif() - if(SITE_BUILDNAME_SUFFIX) + endif () + if (SITE_BUILDNAME_SUFFIX) set(CTEST_BUILD_NAME "${CTEST_BUILD_NAME}-${SITE_BUILDNAME_SUFFIX}") - endif() - set(BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DSITE:STRING=${CTEST_SITE} -DBUILDNAME:STRING=${CTEST_BUILD_NAME}") -endif(NOT SITE_OS_NAME) + endif () + set (BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DSITE:STRING=${CTEST_SITE} -DBUILDNAME:STRING=${CTEST_BUILD_NAME}") +endif () #----------------------------------------------------------------------------- # MAC machines need special option #----------------------------------------------------------------------------- -if(APPLE) +if (APPLE) # Compiler choice - execute_process(COMMAND xcrun --find cc OUTPUT_VARIABLE XCODE_CC OUTPUT_STRIP_TRAILING_WHITESPACE) - execute_process(COMMAND xcrun --find c++ OUTPUT_VARIABLE XCODE_CXX OUTPUT_STRIP_TRAILING_WHITESPACE) - set(ENV{CC} "${XCODE_CC}") - set(ENV{CXX} "${XCODE_CXX}") + execute_process (COMMAND xcrun --find cc OUTPUT_VARIABLE XCODE_CC OUTPUT_STRIP_TRAILING_WHITESPACE) + execute_process (COMMAND xcrun --find c++ OUTPUT_VARIABLE XCODE_CXX OUTPUT_STRIP_TRAILING_WHITESPACE) + set (ENV{CC} "${XCODE_CC}") + set (ENV{CXX} "${XCODE_CXX}") - if(NOT NO_MAC_FORTRAN) - # Shared fortran is not supported, build static - set(BUILD_OPTIONS "${BUILD_OPTIONS} -DBUILD_SHARED_LIBS:BOOL=OFF -DCMAKE_ANSI_CFLAGS:STRING=-fPIC") - else(NOT NO_MAC_FORTRAN) - set(BUILD_OPTIONS "${BUILD_OPTIONS} -DHDF5_BUILD_FORTRAN:BOOL=OFF") - endif(NOT NO_MAC_FORTRAN) + if (NOT NO_MAC_FORTRAN) + # Shared fortran is not supported, build static + set (BUILD_OPTIONS "${BUILD_OPTIONS} -DBUILD_SHARED_LIBS:BOOL=OFF -DCMAKE_ANSI_CFLAGS:STRING=-fPIC") + else () + set (BUILD_OPTIONS "${BUILD_OPTIONS} -DHDF5_BUILD_FORTRAN:BOOL=OFF") + endif () - set(BUILD_OPTIONS "${BUILD_OPTIONS} -DCTEST_USE_LAUNCHERS:BOOL=ON -DCMAKE_BUILD_WITH_INSTALL_RPATH:BOOL=OFF") -endif(APPLE) + set (BUILD_OPTIONS "${BUILD_OPTIONS} -DCTEST_USE_LAUNCHERS:BOOL=ON -DCMAKE_BUILD_WITH_INSTALL_RPATH:BOOL=OFF") +endif () #----------------------------------------------------------------------------- -set(NEED_REPOSITORY_CHECKOUT 0) -set(CTEST_CMAKE_COMMAND "\"${CMAKE_COMMAND}\"") -if(CTEST_USE_TAR_SOURCE) +set (NEED_REPOSITORY_CHECKOUT 0) +set (CTEST_CMAKE_COMMAND "\"${CMAKE_COMMAND}\"") +if (CTEST_USE_TAR_SOURCE) ## Uncompress source if tar file provided ## -------------------------- - if(WIN32) - message(STATUS "extracting... [${CMAKE_EXECUTABLE_NAME} x ${CTEST_USE_TAR_SOURCE}.zip]") - execute_process(COMMAND ${CMAKE_EXECUTABLE_NAME} -E tar -xvf ${CTEST_DASHBOARD_ROOT}\\${CTEST_USE_TAR_SOURCE}.zip RESULT_VARIABLE rv) - else() - message(STATUS "extracting... [${CMAKE_EXECUTABLE_NAME} -E tar -xvf ${CTEST_USE_TAR_SOURCE}.tar]") - execute_process(COMMAND ${CMAKE_EXECUTABLE_NAME} -E tar -xvf ${CTEST_DASHBOARD_ROOT}/${CTEST_USE_TAR_SOURCE}.tar RESULT_VARIABLE rv) - endif() + if (WIN32) + message (STATUS "extracting... [${CMAKE_EXECUTABLE_NAME} x ${CTEST_DASHBOARD_ROOT}\\${CTEST_USE_TAR_SOURCE}.zip]") + execute_process (COMMAND ${CMAKE_EXECUTABLE_NAME} -E tar -xvf ${CTEST_DASHBOARD_ROOT}\\${CTEST_USE_TAR_SOURCE}.zip RESULT_VARIABLE rv) + else () + message (STATUS "extracting... [${CMAKE_EXECUTABLE_NAME} -E tar -xvf ${CTEST_DASHBOARD_ROOT}/${CTEST_USE_TAR_SOURCE}.tar]") + execute_process (COMMAND ${CMAKE_EXECUTABLE_NAME} -E tar -xvf ${CTEST_DASHBOARD_ROOT}/${CTEST_USE_TAR_SOURCE}.tar RESULT_VARIABLE rv) + endif () - if(NOT rv EQUAL 0) - message(STATUS "extracting... [error-(${rv}) clean up]") - file(REMOVE_RECURSE "${CTEST_SOURCE_DIRECTORY}") - message(FATAL_ERROR "error: extract of ${CTEST_USE_TAR_SOURCE} failed") - endif() + if (NOT rv EQUAL 0) + message (STATUS "extracting... [error-(${rv}) clean up]") + file (REMOVE_RECURSE "${CTEST_SOURCE_DIRECTORY}") + message (FATAL_ERROR "error: extract of ${CTEST_USE_TAR_SOURCE} failed") + endif () - file(RENAME ${CTEST_DASHBOARD_ROOT}/${CTEST_USE_TAR_SOURCE} ${CTEST_SOURCE_DIRECTORY}) - set(LOCAL_SKIP_UPDATE "TRUE") -else(CTEST_USE_TAR_SOURCE) - if(LOCAL_UPDATE) - if(CTEST_USE_GIT_SOURCE) - find_program(CTEST_GIT_COMMAND NAMES git git.cmd) - set(CTEST_GIT_UPDATE_OPTIONS) + file (RENAME ${CTEST_DASHBOARD_ROOT}/${CTEST_USE_TAR_SOURCE} ${CTEST_SOURCE_DIRECTORY}) + set (LOCAL_SKIP_UPDATE "TRUE") +else () + if (LOCAL_UPDATE) + if (CTEST_USE_GIT_SOURCE) + find_program (CTEST_GIT_COMMAND NAMES git git.cmd) + set (CTEST_GIT_UPDATE_OPTIONS) - if(NOT EXISTS "${CTEST_SOURCE_DIRECTORY}") - set(NEED_REPOSITORY_CHECKOUT 1) - endif() + if (NOT EXISTS "${CTEST_SOURCE_DIRECTORY}") + set (NEED_REPOSITORY_CHECKOUT 1) + endif () - if(${NEED_REPOSITORY_CHECKOUT}) - if(REPOSITORY_BRANCH) - set(CTEST_GIT_options "clone \"${REPOSITORY_URL}\" --branch \"${REPOSITORY_BRANCH}\" --single-branch \"${CTEST_SOURCE_DIRECTORY}\" --recurse-submodules") - else() - set(CTEST_GIT_options "clone \"${REPOSITORY_URL}\" \"${CTEST_SOURCE_DIRECTORY}\" --recurse-submodules") - endif() - set(CTEST_CHECKOUT_COMMAND "${CTEST_GIT_COMMAND} ${CTEST_GIT_options}") - else() - set(CTEST_GIT_options "pull") - endif() - set(CTEST_UPDATE_COMMAND "${CTEST_GIT_COMMAND}") - else(CTEST_USE_GIT_SOURCE) + if (${NEED_REPOSITORY_CHECKOUT}) + if (REPOSITORY_BRANCH) + set (CTEST_GIT_options "clone \"${REPOSITORY_URL}\" --branch \"${REPOSITORY_BRANCH}\" --single-branch \"${CTEST_SOURCE_DIRECTORY}\" --recurse-submodules") + else () + set (CTEST_GIT_options "clone \"${REPOSITORY_URL}\" \"${CTEST_SOURCE_DIRECTORY}\" --recurse-submodules") + endif () + set (CTEST_CHECKOUT_COMMAND "${CTEST_GIT_COMMAND} ${CTEST_GIT_options}") + else () + set (CTEST_GIT_options "pull") + endif () + set (CTEST_UPDATE_COMMAND "${CTEST_GIT_COMMAND}") + else () ## -------------------------- ## use subversion to get source #----------------------------------------------------------------------------- ## cygwin does not handle the find_package() call ## -------------------------- - set(CTEST_UPDATE_COMMAND "SVNCommand") - if(NOT SITE_CYGWIN}) + set (CTEST_UPDATE_COMMAND "SVNCommand") + if (NOT SITE_CYGWIN}) find_package (Subversion) - set(CTEST_SVN_COMMAND "${Subversion_SVN_EXECUTABLE}") - set(CTEST_UPDATE_COMMAND "${Subversion_SVN_EXECUTABLE}") - else() - set(CTEST_SVN_COMMAND "/usr/bin/svn") - set(CTEST_UPDATE_COMMAND "/usr/bin/svn") - endif() + set (CTEST_SVN_COMMAND "${Subversion_SVN_EXECUTABLE}") + set (CTEST_UPDATE_COMMAND "${Subversion_SVN_EXECUTABLE}") + else () + set (CTEST_SVN_COMMAND "/usr/bin/svn") + set (CTEST_UPDATE_COMMAND "/usr/bin/svn") + endif () - if(NOT EXISTS "${CTEST_SOURCE_DIRECTORY}") - set(NEED_REPOSITORY_CHECKOUT 1) - endif() + if (NOT EXISTS "${CTEST_SOURCE_DIRECTORY}") + set (NEED_REPOSITORY_CHECKOUT 1) + endif () - if(NOT CTEST_REPO_VERSION) - set(CTEST_REPO_VERSION "HEAD") - endif() - if(${NEED_REPOSITORY_CHECKOUT}) - set(CTEST_CHECKOUT_COMMAND + if (NOT CTEST_REPO_VERSION) + set (CTEST_REPO_VERSION "HEAD") + endif () + if (${NEED_REPOSITORY_CHECKOUT}) + set (CTEST_CHECKOUT_COMMAND "\"${CTEST_SVN_COMMAND}\" co ${REPOSITORY_URL} \"${CTEST_SOURCE_DIRECTORY}\" -r ${CTEST_REPO_VERSION}") - else() - if(CTEST_REPO_VERSION) - set(CTEST_SVN_UPDATE_OPTIONS "-r ${CTEST_REPO_VERSION}") - endif() - endif() - endif(CTEST_USE_GIT_SOURCE) - endif(LOCAL_UPDATE) -endif(CTEST_USE_TAR_SOURCE) + else () + if (CTEST_REPO_VERSION) + set (CTEST_SVN_UPDATE_OPTIONS "-r ${CTEST_REPO_VERSION}") + endif () + endif () + endif () + endif () +endif () #----------------------------------------------------------------------------- ## Clear the build directory ## -------------------------- -set(CTEST_START_WITH_EMPTY_BINARY_DIRECTORY TRUE) -if(NOT EXISTS "${CTEST_BINARY_DIRECTORY}") - file(MAKE_DIRECTORY "${CTEST_BINARY_DIRECTORY}") -else() - ctest_empty_binary_directory(${CTEST_BINARY_DIRECTORY}) -endif() +set (CTEST_START_WITH_EMPTY_BINARY_DIRECTORY TRUE) +if (NOT EXISTS "${CTEST_BINARY_DIRECTORY}") + file (MAKE_DIRECTORY "${CTEST_BINARY_DIRECTORY}") +else () + ctest_empty_binary_directory (${CTEST_BINARY_DIRECTORY}) +endif () # Use multiple CPU cores to build -include(ProcessorCount) -ProcessorCount(N) -if(NOT N EQUAL 0) - if(NOT WIN32) - set(CTEST_BUILD_FLAGS -j${N}) - endif() - set(ctest_test_args ${ctest_test_args} PARALLEL_LEVEL ${N}) -endif() +include (ProcessorCount) +ProcessorCount (N) +if (NOT N EQUAL 0) + if (NOT WIN32) + set (CTEST_BUILD_FLAGS -j${N}) + endif () + set (ctest_test_args ${ctest_test_args} PARALLEL_LEVEL ${N}) +endif () #----------------------------------------------------------------------------- # Send the main script as a note. -if(USE_AUTOTOOLS) - ## autotools builds need to use make and does not use the cacheinit.cmake file - ## -- make command - ## ----------------- - find_program(MAKE NAMES make) - list(APPEND CTEST_NOTES_FILES - "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}" - "${CMAKE_CURRENT_LIST_FILE}" - ) -else() - list(APPEND CTEST_NOTES_FILES - "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}" - "${CMAKE_CURRENT_LIST_FILE}" - "${CTEST_SOURCE_DIRECTORY}/config/cmake/cacheinit.cmake" - ) -endif() +list (APPEND CTEST_NOTES_FILES + "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}" + "${CMAKE_CURRENT_LIST_FILE}" + "${CTEST_SOURCE_DIRECTORY}/config/cmake/cacheinit.cmake" +) #----------------------------------------------------------------------------- # Check for required variables. # -------------------------- -foreach(req +foreach (req CTEST_CMAKE_GENERATOR CTEST_SITE CTEST_BUILD_NAME ) - if(NOT DEFINED ${req}) - message(FATAL_ERROR "The containing script must set ${req}") - endif() -endforeach(req) + if (NOT DEFINED ${req}) + message (FATAL_ERROR "The containing script must set ${req}") + endif () +endforeach () #----------------------------------------------------------------------------- # Initialize the CTEST commands #------------------------------ -if(USE_AUTOTOOLS) - set(CTEST_CONFIGURE_COMMAND "${CTEST_SOURCE_DIRECTORY}/configure ${ADD_BUILD_OPTIONS}") - set(CTEST_BUILD_COMMAND "${MAKE} ${CTEST_BUILD_FLAGS}") - configure_file(${CTEST_SOURCE_DIRECTORY}/config/cmake/CTestCustom.cmake ${CTEST_BINARY_DIRECTORY}/CTestCustom.cmake) - file(WRITE ${CTEST_BINARY_DIRECTORY}/CTestTestfile.cmake "ADD_TEST(makecheck \"${MAKE}\" \"${CTEST_BUILD_FLAGS}\" \"-i\" \"check\")") -else(USE_AUTOTOOLS) - if(LOCAL_MEMCHECK_TEST) - find_program(CTEST_MEMORYCHECK_COMMAND NAMES valgrind) - set (CTEST_CONFIGURE_COMMAND - "${CTEST_CMAKE_COMMAND} -C \"${CTEST_SOURCE_DIRECTORY}/config/cmake/mccacheinit.cmake\" -DCMAKE_BUILD_TYPE:STRING=${CTEST_CONFIGURATION_TYPE} ${BUILD_OPTIONS} \"-G${CTEST_CMAKE_GENERATOR}\" \"${CTEST_SOURCE_DIRECTORY}\"" - ) - else() - if(LOCAL_COVERAGE_TEST) - find_program(CTEST_COVERAGE_COMMAND NAMES gcov) - endif() - set (CTEST_CONFIGURE_COMMAND - "${CTEST_CMAKE_COMMAND} -C \"${CTEST_SOURCE_DIRECTORY}/config/cmake/cacheinit.cmake\" -DCMAKE_BUILD_TYPE:STRING=${CTEST_CONFIGURATION_TYPE} ${BUILD_OPTIONS} \"-G${CTEST_CMAKE_GENERATOR}\" \"${CTEST_SOURCE_DIRECTORY}\"" - ) - endif() -endif() - +if (LOCAL_MEMCHECK_TEST) + find_program (CTEST_MEMORYCHECK_COMMAND NAMES valgrind) + set (CTEST_CONFIGURE_COMMAND + "${CTEST_CMAKE_COMMAND} -C \"${CTEST_SOURCE_DIRECTORY}/config/cmake/mccacheinit.cmake\" -DCMAKE_BUILD_TYPE:STRING=${CTEST_CONFIGURATION_TYPE} ${BUILD_OPTIONS} \"-G${CTEST_CMAKE_GENERATOR}\" \"${CTEST_SOURCE_DIRECTORY}\"" + ) +else () + if (LOCAL_COVERAGE_TEST) + find_program (CTEST_COVERAGE_COMMAND NAMES gcov) + endif () + set (CTEST_CONFIGURE_COMMAND + "${CTEST_CMAKE_COMMAND} -C \"${CTEST_SOURCE_DIRECTORY}/config/cmake/cacheinit.cmake\" -DCMAKE_BUILD_TYPE:STRING=${CTEST_CONFIGURATION_TYPE} ${BUILD_OPTIONS} \"-G${CTEST_CMAKE_GENERATOR}\" \"${CTEST_SOURCE_DIRECTORY}\"" + ) +endif () + #----------------------------------------------------------------------------- ## -- set output to english -set($ENV{LC_MESSAGES} "en_EN") +set ($ENV{LC_MESSAGES} "en_EN") # Print summary information. -foreach(v +foreach (v CTEST_SITE CTEST_BUILD_NAME CTEST_SOURCE_DIRECTORY @@ -238,9 +217,9 @@ foreach(v CTEST_SCRIPT_DIRECTORY CTEST_USE_LAUNCHERS ) - set(vars "${vars} ${v}=[${${v}}]\n") -endforeach(v) -message(STATUS "Dashboard script configuration:\n${vars}\n") + set (vars "${vars} ${v}=[${${v}}]\n") +endforeach () +message (STATUS "Dashboard script configuration:\n${vars}\n") #----------------------------------------------------------------------------- #----------------------------------------------------------------------------- @@ -252,63 +231,63 @@ message(STATUS "Dashboard script configuration:\n${vars}\n") ## -- LOCAL_COVERAGE_TEST executes code coverage process ## -------------------------- ctest_start (${MODEL} TRACK ${MODEL}) - if(LOCAL_UPDATE) + if (LOCAL_UPDATE) ctest_update (SOURCE "${CTEST_SOURCE_DIRECTORY}") - endif() - configure_file(${CTEST_SOURCE_DIRECTORY}/config/cmake/CTestCustom.cmake ${CTEST_BINARY_DIRECTORY}/CTestCustom.cmake) + endif () + configure_file (${CTEST_SOURCE_DIRECTORY}/config/cmake/CTestCustom.cmake ${CTEST_BINARY_DIRECTORY}/CTestCustom.cmake) ctest_read_custom_files ("${CTEST_BINARY_DIRECTORY}") ctest_configure (BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) - if(LOCAL_SUBMIT) + if (LOCAL_SUBMIT) ctest_submit (PARTS Update Configure Notes) - endif() - if(${res} LESS 0 OR ${res} GREATER 0) - file(APPEND ${CTEST_SCRIPT_DIRECTORY}/FailedCTest.txt "Failed Configure: ${res}\n") - endif() + endif () + if (${res} LESS 0 OR ${res} GREATER 0) + file (APPEND ${CTEST_SCRIPT_DIRECTORY}/FailedCTest.txt "Failed Configure: ${res}\n") + endif () ctest_build (BUILD "${CTEST_BINARY_DIRECTORY}" APPEND RETURN_VALUE res NUMBER_ERRORS errval) - if(LOCAL_SUBMIT) + if (LOCAL_SUBMIT) ctest_submit (PARTS Build) - endif() - if(${res} LESS 0 OR ${res} GREATER 0 OR ${errval} GREATER 0) - file(APPEND ${CTEST_SCRIPT_DIRECTORY}/FailedCTest.txt "Failed ${errval} Build: ${res}\n") - endif() + endif () + if (${res} LESS 0 OR ${res} GREATER 0 OR ${errval} GREATER 0) + file (APPEND ${CTEST_SCRIPT_DIRECTORY}/FailedCTest.txt "Failed ${errval} Build: ${res}\n") + endif () - if(NOT LOCAL_SKIP_TEST) - if(NOT LOCAL_MEMCHECK_TEST) + if (NOT LOCAL_SKIP_TEST) + if (NOT LOCAL_MEMCHECK_TEST) ctest_test (BUILD "${CTEST_BINARY_DIRECTORY}" APPEND ${ctest_test_args} RETURN_VALUE res) - if(LOCAL_SUBMIT) + if (LOCAL_SUBMIT) ctest_submit (PARTS Test) - endif() - if(${res} LESS 0 OR ${res} GREATER 0) - file(APPEND ${CTEST_SCRIPT_DIRECTORY}/FailedCTest.txt "Failed Tests: ${res}\n") - endif() - else() + endif () + if (${res} LESS 0 OR ${res} GREATER 0) + file (APPEND ${CTEST_SCRIPT_DIRECTORY}/FailedCTest.txt "Failed Tests: ${res}\n") + endif () + else () ctest_memcheck (BUILD "${CTEST_BINARY_DIRECTORY}" APPEND ${ctest_test_args}) - if(LOCAL_SUBMIT) + if (LOCAL_SUBMIT) ctest_submit (PARTS MemCheck) - endif() - endif() - if(LOCAL_COVERAGE_TEST) + endif () + endif () + if (LOCAL_COVERAGE_TEST) ctest_coverage (BUILD "${CTEST_BINARY_DIRECTORY}" APPEND) - if(LOCAL_SUBMIT) + if (LOCAL_SUBMIT) ctest_submit (PARTS Coverage) - endif() - endif() - endif(NOT LOCAL_SKIP_TEST) + endif () + endif () + endif () - if(NOT LOCAL_MEMCHECK_TEST AND NOT LOCAL_NO_PACKAGE AND NOT LOCAL_SKIP_BUILD) + if (NOT LOCAL_MEMCHECK_TEST AND NOT LOCAL_NO_PACKAGE AND NOT LOCAL_SKIP_BUILD) ##----------------------------------------------- ## Package the product ##----------------------------------------------- - execute_process(COMMAND cpack -C ${CTEST_CONFIGURATION_TYPE} -V + execute_process (COMMAND cpack -C ${CTEST_CONFIGURATION_TYPE} -V WORKING_DIRECTORY ${CTEST_BINARY_DIRECTORY} RESULT_VARIABLE cpackResult OUTPUT_VARIABLE cpackLog ERROR_VARIABLE cpackLog.err ) - file(WRITE ${CTEST_BINARY_DIRECTORY}/cpack.log "${cpackLog.err}" "${cpackLog}") - if(cpackResult GREATER 0) - file(APPEND ${CTEST_SCRIPT_DIRECTORY}/FailedCTest.txt "Failed packaging: ${cpackResult}:${cpackLog.err} \n") - endif() - endif() + file (WRITE ${CTEST_BINARY_DIRECTORY}/cpack.log "${cpackLog.err}" "${cpackLog}") + if (cpackResult GREATER 0) + file (APPEND ${CTEST_SCRIPT_DIRECTORY}/FailedCTest.txt "Failed packaging: ${cpackResult}:${cpackLog.err} \n") + endif () + endif () #----------------------------------------------------------------------------- diff --git a/config/cmake/scripts/HDF5config.cmake b/config/cmake/scripts/HDF5config.cmake index 2b1b097..55fecfb 100755 --- a/config/cmake/scripts/HDF5config.cmake +++ b/config/cmake/scripts/HDF5config.cmake @@ -1,10 +1,10 @@ ############################################################################################# ### ${CTEST_SCRIPT_ARG} is of the form OPTION=VALUE ### ### BUILD_GENERATOR required [Unix, VS2015, VS201564, VS2013, VS201364, VS2012, VS201264] ### -### ctest -S HDF5config.cmake,BUILD_GENERATOR=VS201264 -C Release -V -O hdf5.log ### +### ctest -S HDF5config.cmake,BUILD_GENERATOR=VS201264 -C Release -VV -O hdf5.log ### ############################################################################################# -cmake_minimum_required(VERSION 3.1.0 FATAL_ERROR) +cmake_minimum_required(VERSION 3.2.2 FATAL_ERROR) ############################################################################ # Usage: # ctest -S HDF5config.cmake,OPTION=VALUE -C Release -VV -O test.log @@ -21,13 +21,13 @@ cmake_minimum_required(VERSION 3.1.0 FATAL_ERROR) # INSTALLDIR - root folder where hdf5 is installed # CTEST_CONFIGURATION_TYPE - Release, Debug, etc # CTEST_SOURCE_NAME - source folder -# STATIC_LIBRARIES - Build/use static libraries +# STATIC_ONLY - Build/use static libraries # FORTRAN_LIBRARIES - Build/use fortran libraries # JAVA_LIBRARIES - Build/use java libraries # NO_MAC_FORTRAN - Yes to be SHARED on a Mac ############################################################################## -set(CTEST_SOURCE_VERSION 1.10.0) +set(CTEST_SOURCE_VERSION 1.10.1) set(CTEST_SOURCE_VERSEXT "") ############################################################################## @@ -36,7 +36,7 @@ set(CTEST_SOURCE_VERSEXT "") #INSTALLDIR - HDF5-1.10.0 root folder #CTEST_CONFIGURATION_TYPE - Release, Debug, RelWithDebInfo #CTEST_SOURCE_NAME - name of source folder; HDF5-1.10.0 -#STATIC_LIBRARIES - Default is YES +#STATIC_ONLY - Default is YES #FORTRAN_LIBRARIES - Default is NO #JAVA_LIBRARIES - Default is NO #NO_MAC_FORTRAN - set to TRUE to allow shared libs on a Mac @@ -48,14 +48,14 @@ if(DEFINED CTEST_SCRIPT_ARG) foreach(current_var ${script_args}) if ("${current_var}" MATCHES "^([^=]+)=(.+)$") set("${CMAKE_MATCH_1}" "${CMAKE_MATCH_2}") - endif() - endforeach() -endif() + endif () + endforeach () +endif () # build generator must be defined if(NOT DEFINED BUILD_GENERATOR) message(FATAL_ERROR "BUILD_GENERATOR must be defined - Unix, VS2015, VS201564, VS2013, VS201364, VS2012, or VS201264") -else() +else () if(${BUILD_GENERATOR} STREQUAL "Unix") set(CTEST_CMAKE_GENERATOR "Unix Makefiles") elseif(${BUILD_GENERATOR} STREQUAL "VS2015") @@ -70,10 +70,10 @@ else() set(CTEST_CMAKE_GENERATOR "Visual Studio 11 2012") elseif(${BUILD_GENERATOR} STREQUAL "VS201264") set(CTEST_CMAKE_GENERATOR "Visual Studio 11 2012 Win64") - else() + else () message(FATAL_ERROR "Invalid BUILD_GENERATOR must be - Unix, VS2015, VS201564, VS2013, VS201364, VS2012, or VS201264") - endif() -endif() + endif () +endif () ################################################################### ### Following Line is one of [Release, RelWithDebInfo, Debug] ##### @@ -83,41 +83,41 @@ set(CTEST_CONFIGURATION_TYPE "$ENV{CMAKE_CONFIG_TYPE}") if(NOT DEFINED INSTALLDIR) if(WIN32) set(INSTALLDIR "C:/Program Files/HDF_Group/HDF5/${CTEST_SOURCE_VERSION}") - else() + else () set(INSTALLDIR "${CTEST_SCRIPT_DIRECTORY}/HDF_Group/HDF5/${CTEST_SOURCE_VERSION}") - endif() -endif() + endif () +endif () if(NOT DEFINED CTEST_CONFIGURATION_TYPE) set(CTEST_CONFIGURATION_TYPE "Release") -endif() +endif () if(NOT DEFINED CTEST_SOURCE_NAME) set(CTEST_SOURCE_NAME "hdf5-${CTEST_SOURCE_VERSION}${CTEST_SOURCE_VERSEXT}") -endif() -if(NOT DEFINED STATIC_LIBRARIES) - set(STATICLIBRARIES "YES") -else() - set(STATICLIBRARIES "NO") -endif() +endif () +if(NOT DEFINED STATIC_ONLY) + set(STATICONLYLIBRARIES "YES") +else () + set(STATICONLYLIBRARIES "NO") +endif () if(NOT DEFINED FORTRAN_LIBRARIES) set(FORTRANLIBRARIES "NO") -else() +else () set(FORTRANLIBRARIES "YES") -endif() +endif () if(NOT DEFINED JAVA_LIBRARIES) set(JAVALIBRARIES "NO") -else() +else () set(JAVALIBRARIES "YES") -endif() +endif () set(CTEST_BINARY_NAME "build") set(CTEST_DASHBOARD_ROOT "${CTEST_SCRIPT_DIRECTORY}") if(WIN32) set(CTEST_SOURCE_DIRECTORY "${CTEST_DASHBOARD_ROOT}\\${CTEST_SOURCE_NAME}") set(CTEST_BINARY_DIRECTORY "${CTEST_DASHBOARD_ROOT}\\${CTEST_BINARY_NAME}") -else() +else () set(CTEST_SOURCE_DIRECTORY "${CTEST_DASHBOARD_ROOT}/${CTEST_SOURCE_NAME}") set(CTEST_BINARY_DIRECTORY "${CTEST_DASHBOARD_ROOT}/${CTEST_BINARY_NAME}") -endif() +endif () ################################################################### ######### Following describes compiler ############ @@ -148,17 +148,33 @@ if(WIN32) set(SITE_OS_BITS "32") set(SITE_COMPILER_NAME "vs2012") set(SITE_COMPILER_VERSION "11") - endif() + endif () ## Set the following to unique id your computer ## set(CTEST_SITE "WIN7${BUILD_GENERATOR}.XXXX") -else() +else () + set(CTEST_CMAKE_GENERATOR "Unix Makefiles") ## Set the following to unique id your computer ## if(APPLE) set(CTEST_SITE "MAC.XXXX") - else() + else () set(CTEST_SITE "LINUX.XXXX") - endif() -endif() + endif () + if(APPLE) + execute_process(COMMAND xcrun --find cc OUTPUT_VARIABLE XCODE_CC OUTPUT_STRIP_TRAILING_WHITESPACE) + execute_process(COMMAND xcrun --find c++ OUTPUT_VARIABLE XCODE_CXX OUTPUT_STRIP_TRAILING_WHITESPACE) + set(ENV{CC} "${XCODE_CC}") + set(ENV{CXX} "${XCODE_CXX}") + set(CTEST_USE_LAUNCHERS 1) + set(RR_WARNINGS_COMMON "-Wno-format-nonliteral -Wno-cast-align -Wno-unused -Wno-unused-variable -Wno-unused-function -Wno-self-assign -Wno-unused-parameter -Wno-sign-compare") + set(RR_WARNINGS_C "${RR_WARNINGS_COMMON} -Wno-deprecated-declarations -Wno-uninitialized") + set(RR_WARNINGS_CXX "${RR_WARNINGS_COMMON} -Woverloaded-virtual -Wshadow -Wwrite-strings -Wc++11-compat") + set(RR_FLAGS_COMMON "-g -O0 -fstack-protector-all -D_FORTIFY_SOURCE=2") + set(RR_FLAGS_C "${RR_FLAGS_COMMON}") + set(RR_FLAGS_CXX "${RR_FLAGS_COMMON}") + set(ENV{CFLAGS} "${RR_WARNINGS_C} ${RR_FLAGS_C}") + set(ENV{CXXFLAGS} "${RR_WARNINGS_CXX} ${RR_FLAGS_CXX}") + endif () +endif () ################################################################### ################################################################### @@ -178,103 +194,86 @@ set(MODEL "Experimental") #set(LOCAL_NO_PACKAGE "TRUE") ##### Following controls source update ##### #set(LOCAL_UPDATE "TRUE") -set(REPOSITORY_URL "http://svn.hdfgroup.uiuc.edu/hdf5/trunk") +set(REPOSITORY_URL "https://git@bitbucket.hdfgroup.org/scm/hdffv/hdf5.git") +set(REPOSITORY_BRANCH "develop") + #uncomment to use a compressed source file: *.tar on linux or mac *.zip on windows #set(CTEST_USE_TAR_SOURCE "${CTEST_SOURCE_VERSION}") ################################################################### ################################################################### -#### Change default configuration of options in config/cmake/cacheinit.cmake file ### -#### format: set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DXXX:YY=ZZZZ") - -################################################################### -if(${STATICLIBRARIES}) +if(${STATICONLYLIBRARIES}) set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DBUILD_SHARED_LIBS:BOOL=OFF") ######### Following describes computer ############ ## following is optional to describe build ## set(SITE_BUILDNAME_SUFFIX "STATIC") -endif() +endif () ################################################################### - -### uncomment/comment and change the following lines for other configuration options - -#### ext libraries #### -### ext libs from tgz -set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ALLOW_EXTERNAL_SUPPORT:STRING=TGZ -DTGZPATH:PATH=${CTEST_SCRIPT_DIRECTORY}") -### ext libs from svn -#set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ALLOW_EXTERNAL_SUPPORT:STRING=SVN") -### ext libs on system -#set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DZLIB_LIBRARY:FILEPATH=some_location/lib/zlib.lib -DZLIB_INCLUDE_DIR:PATH=some_location/include") -#set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DSZIP_LIBRARY:FILEPATH=some_location/lib/szlib.lib -DSZIP_INCLUDE_DIR:PATH=some_location/include") -### disable ext libs building -#set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_Z_LIB_SUPPORT:BOOL=OFF") -#set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_SZIP_SUPPORT:BOOL=OFF") -#set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_SZIP_ENCODING:BOOL=OFF") #### fortran #### if(${FORTRANLIBRARIES}) set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_FORTRAN:BOOL=ON") -else() + ### enable Fortran 2003 depends on HDF5_BUILD_FORTRAN + set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_F2003:BOOL=ON") +else () set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_FORTRAN:BOOL=OFF") -endif() + ### enable Fortran 2003 depends on HDF5_BUILD_FORTRAN + set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_F2003:BOOL=OFF") +endif () #### java #### if(${JAVALIBRARIES}) set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_JAVA:BOOL=ON") -else() +else () set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_JAVA:BOOL=OFF") -endif() - -### disable test program builds -#set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DBUILD_TESTING:BOOL=OFF") - -### disable packaging -#set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_NO_PACKAGES:BOOL=ON") -### Create install package with external libraries (szip, zlib, jpeg) -set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_PACKAGE_EXTLIBS:BOOL=ON") +endif () ### change install prefix -set(BUILD_OPTIONS "${BUILD_OPTIONS} -DCMAKE_INSTALL_PREFIX:PATH=${INSTALLDIR}") -set(BUILD_OPTIONS "${BUILD_OPTIONS} -DCTEST_CONFIGURATION_TYPE:STRING=$ENV{CMAKE_CONFIG_TYPE}") +set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DCMAKE_INSTALL_PREFIX:PATH=${INSTALLDIR}") +set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DCTEST_CONFIGURATION_TYPE:STRING=$ENV{CMAKE_CONFIG_TYPE}") ################################################################### if(WIN32) + set(BINFILEBASE "HDF5-${CTEST_SOURCE_VERSION}${CTEST_SOURCE_VERSEXT}-win${SITE_OS_BITS}") + include(${CTEST_SCRIPT_DIRECTORY}\\HDF5options.cmake) include(${CTEST_SCRIPT_DIRECTORY}\\CTestScript.cmake) - if(EXISTS "${CTEST_BINARY_DIRECTORY}\\HDF5-${CTEST_SOURCE_VERSION}${CTEST_SOURCE_VERSEXT}-win${SITE_OS_BITS}.exe") - file(COPY "${CTEST_BINARY_DIRECTORY}\\HDF5-${CTEST_SOURCE_VERSION}${CTEST_SOURCE_VERSEXT}-win${SITE_OS_BITS}.exe" DESTINATION ${CTEST_SCRIPT_DIRECTORY}) - endif() - if(EXISTS "${CTEST_BINARY_DIRECTORY}\\HDF5-${CTEST_SOURCE_VERSION}${CTEST_SOURCE_VERSEXT}-win${SITE_OS_BITS}.msi") - file(COPY "${CTEST_BINARY_DIRECTORY}\\HDF5-${CTEST_SOURCE_VERSION}${CTEST_SOURCE_VERSEXT}-win${SITE_OS_BITS}.msi" DESTINATION ${CTEST_SCRIPT_DIRECTORY}) - endif() - if(EXISTS "${CTEST_BINARY_DIRECTORY}\\HDF5-${CTEST_SOURCE_VERSION}${CTEST_SOURCE_VERSEXT}-win${SITE_OS_BITS}.zip") - file(COPY "${CTEST_BINARY_DIRECTORY}\\HDF5-${CTEST_SOURCE_VERSION}${CTEST_SOURCE_VERSEXT}-win${SITE_OS_BITS}.zip" DESTINATION ${CTEST_SCRIPT_DIRECTORY}) - endif() -else() + if(EXISTS "${CTEST_BINARY_DIRECTORY}\\${BINFILEBASE}.exe") + file(COPY "${CTEST_BINARY_DIRECTORY}\\${BINFILEBASE}.exe" DESTINATION ${CTEST_SCRIPT_DIRECTORY}) + endif () + if(EXISTS "${CTEST_BINARY_DIRECTORY}\\${BINFILEBASE}.msi") + file(COPY "${CTEST_BINARY_DIRECTORY}\\${BINFILEBASE}.msi" DESTINATION ${CTEST_SCRIPT_DIRECTORY}) + endif () + if(EXISTS "${CTEST_BINARY_DIRECTORY}\\${BINFILEBASE}.zip") + file(COPY "${CTEST_BINARY_DIRECTORY}\\${BINFILEBASE}.zip" DESTINATION ${CTEST_SCRIPT_DIRECTORY}) + endif () +else () + set(BINFILEBASE "HDF5-${CTEST_SOURCE_VERSION}${CTEST_SOURCE_VERSEXT}") + include(${CTEST_SCRIPT_DIRECTORY}/HDF5options.cmake) include(${CTEST_SCRIPT_DIRECTORY}/CTestScript.cmake) if(APPLE) - if(EXISTS "${CTEST_BINARY_DIRECTORY}/HDF5-${CTEST_SOURCE_VERSION}${CTEST_SOURCE_VERSEXT}-Darwin.dmg") - file(COPY "${CTEST_BINARY_DIRECTORY}/HDF5-${CTEST_SOURCE_VERSION}${CTEST_SOURCE_VERSEXT}-Darwin.dmg" DESTINATION ${CTEST_SCRIPT_DIRECTORY}) - endif() - if(EXISTS "${CTEST_BINARY_DIRECTORY}/HDF5-${CTEST_SOURCE_VERSION}${CTEST_SOURCE_VERSEXT}-Darwin.tar.gz") - file(COPY "${CTEST_BINARY_DIRECTORY}/HDF5-${CTEST_SOURCE_VERSION}${CTEST_SOURCE_VERSEXT}-Darwin.tar.gz" DESTINATION ${CTEST_SCRIPT_DIRECTORY}) - endif() - if(EXISTS "${CTEST_BINARY_DIRECTORY}/HDF5-${CTEST_SOURCE_VERSION}${CTEST_SOURCE_VERSEXT}-Darwin.sh") - file(COPY "${CTEST_BINARY_DIRECTORY}/HDF5-${CTEST_SOURCE_VERSION}${CTEST_SOURCE_VERSEXT}-Darwin.sh" DESTINATION ${CTEST_SCRIPT_DIRECTORY}) - endif() - else() + if(EXISTS "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-Darwin.dmg") + file(COPY "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-Darwin.dmg" DESTINATION ${CTEST_SCRIPT_DIRECTORY}) + endif () + if(EXISTS "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-Darwin.tar.gz") + file(COPY "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-Darwin.tar.gz" DESTINATION ${CTEST_SCRIPT_DIRECTORY}) + endif () + if(EXISTS "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-Darwin.sh") + file(COPY "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-Darwin.sh" DESTINATION ${CTEST_SCRIPT_DIRECTORY}) + endif () + else () if(CYGWIN) - if(EXISTS "${CTEST_BINARY_DIRECTORY}/HDF5-${CTEST_SOURCE_VERSION}${CTEST_SOURCE_VERSEXT}-CYGWIN.sh") - file(COPY "${CTEST_BINARY_DIRECTORY}/HDF5-${CTEST_SOURCE_VERSION}${CTEST_SOURCE_VERSEXT}-CYGWIN.sh" DESTINATION ${CTEST_SCRIPT_DIRECTORY}) - endif() - if(EXISTS "${CTEST_BINARY_DIRECTORY}/HDF5-${CTEST_SOURCE_VERSION}${CTEST_SOURCE_VERSEXT}-CYGWIN.tar.gz") - file(COPY "${CTEST_BINARY_DIRECTORY}/HDF5-${CTEST_SOURCE_VERSION}${CTEST_SOURCE_VERSEXT}-CYGWIN.tar.gz" DESTINATION ${CTEST_SCRIPT_DIRECTORY}) - endif() - else() - if(EXISTS "${CTEST_BINARY_DIRECTORY}/HDF5-${CTEST_SOURCE_VERSION}${CTEST_SOURCE_VERSEXT}-Linux.sh") - file(COPY "${CTEST_BINARY_DIRECTORY}/HDF5-${CTEST_SOURCE_VERSION}${CTEST_SOURCE_VERSEXT}-Linux.sh" DESTINATION ${CTEST_SCRIPT_DIRECTORY}) - endif() - if(EXISTS "${CTEST_BINARY_DIRECTORY}/HDF5-${CTEST_SOURCE_VERSION}${CTEST_SOURCE_VERSEXT}-Linux.tar.gz") - file(COPY "${CTEST_BINARY_DIRECTORY}/HDF5-${CTEST_SOURCE_VERSION}${CTEST_SOURCE_VERSEXT}-Linux.tar.gz" DESTINATION ${CTEST_SCRIPT_DIRECTORY}) - endif() - endif() - endif() -endif() + if(EXISTS "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-CYGWIN.sh") + file(COPY "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-CYGWIN.sh" DESTINATION ${CTEST_SCRIPT_DIRECTORY}) + endif () + if(EXISTS "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-CYGWIN.tar.gz") + file(COPY "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-CYGWIN.tar.gz" DESTINATION ${CTEST_SCRIPT_DIRECTORY}) + endif () + else () + if(EXISTS "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-Linux.sh") + file(COPY "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-Linux.sh" DESTINATION ${CTEST_SCRIPT_DIRECTORY}) + endif () + if(EXISTS "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-Linux.tar.gz") + file(COPY "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-Linux.tar.gz" DESTINATION ${CTEST_SCRIPT_DIRECTORY}) + endif () + endif () + endif () +endif () diff --git a/config/cmake/userblockTest.cmake b/config/cmake/userblockTest.cmake index 0775cbe..5095b33 100644 --- a/config/cmake/userblockTest.cmake +++ b/config/cmake/userblockTest.cmake @@ -4,28 +4,28 @@ # arguments checking if (NOT TEST_PROGRAM) message (FATAL_ERROR "Require TEST_PROGRAM tellub to be defined") -endif (NOT TEST_PROGRAM) +endif () if (NOT TEST_GET_PROGRAM) message (FATAL_ERROR "Require TEST_GET_PROGRAM getub to be defined") -endif (NOT TEST_GET_PROGRAM) +endif () if (NOT TEST_FOLDER) message ( FATAL_ERROR "Require TEST_FOLDER to be defined") -endif (NOT TEST_FOLDER) +endif () if (NOT TEST_HFILE) message (FATAL_ERROR "Require TEST_HFILE the hdf file to be defined") -endif (NOT TEST_HFILE) +endif () if (NOT TEST_UFILE) message (FATAL_ERROR "Require TEST_UFILE the ub file to be defined") -endif (NOT TEST_UFILE) +endif () if (NOT TEST_CHECKUB) message (STATUS "Require TEST_CHECKUB - YES or NO - to be defined") -endif (NOT TEST_CHECKUB) +endif () #if (NOT TEST_EXPECT) # message (STATUS "Require TEST_EXPECT to be defined") -#endif (NOT TEST_EXPECT) +#endif () #if (NOT TEST_OFILE) # message (FATAL_ERROR "Require TEST_OFILE the original hdf file to be defined") -#endif (NOT TEST_OFILE) +#endif () set (TEST_U_STRING_LEN 0) set (TEST_O_STRING_LEN 0) @@ -53,11 +53,11 @@ if (TEST_CHECKUB STREQUAL "YES") ) if (NOT ${TEST_RESULT} STREQUAL "0") message (FATAL_ERROR "Failed: The output of ${TEST_PROGRAM} ${TEST_OFILE} is: ${TEST_ERROR}") - endif (NOT ${TEST_RESULT} STREQUAL "0") + endif () file (READ ${TEST_HFILE}.len.txt TEST_O_STRING_LEN) - endif (TEST_OFILE) + endif () - MATH( EXPR TEST_STRING_SIZE "${TEST_U_STRING_LEN} + ${TEST_O_STRING_LEN}" ) + math( EXPR TEST_STRING_SIZE "${TEST_U_STRING_LEN} + ${TEST_O_STRING_LEN}" ) if (NOT TEST_O_STRING_LEN STREQUAL "0") #$JAM_BIN/getub -c $s2 $origfile > $cmpfile @@ -73,10 +73,10 @@ if (TEST_CHECKUB STREQUAL "YES") #cat $ufile >> $cmpfile file (STRINGS ${TEST_UFILE} TEST_STREAM NEWLINE_CONSUME) file (APPEND ${TEST_HFILE}-ub.cmp "${TEST_STREAM}") - else (NOT TEST_O_STRING_LEN STREQUAL "0") + else () file (STRINGS ${TEST_UFILE} TEST_STREAM NEWLINE_CONSUME) file (WRITE ${TEST_HFILE}-ub.cmp ${TEST_STREAM}) - endif (NOT TEST_O_STRING_LEN STREQUAL "0") + endif () #$JAM_BIN/getub -c $size $hfile > $tfile EXECUTE_PROCESS ( @@ -99,8 +99,8 @@ if (TEST_CHECKUB STREQUAL "YES") # if the return value is !=${TEST_EXPECT} bail out if (NOT ${TEST_RESULT} STREQUAL ${TEST_EXPECT}) message (FATAL_ERROR "Failed: The output of ${TEST_HFILE}-ub did not match ${TEST_HFILE}.\n${TEST_ERROR}") - endif (NOT ${TEST_RESULT} STREQUAL ${TEST_EXPECT}) -else (TEST_CHECKUB STREQUAL "YES") + endif () +else () # call 'ubsize' to get the size of the user block #ubsize=`$JAM_BIN/tellub $hfile` EXECUTE_PROCESS ( @@ -112,8 +112,8 @@ else (TEST_CHECKUB STREQUAL "YES") ) if (NOT TEST_H_STRING_LEN STREQUAL "0") message (FATAL_ERROR "Failed: The output of ${TEST_HFILE} was NOT empty") - endif (NOT TEST_H_STRING_LEN STREQUAL "0") -endif (TEST_CHECKUB STREQUAL "YES") + endif () +endif () # everything went fine... message ("Passed: The output of CHECK matched expectation") diff --git a/config/cmake/vfdTest.cmake b/config/cmake/vfdTest.cmake index 10f0a7b..c9b4ecc 100644 --- a/config/cmake/vfdTest.cmake +++ b/config/cmake/vfdTest.cmake @@ -4,29 +4,36 @@ # arguments checking if (NOT TEST_PROGRAM) message (FATAL_ERROR "Require TEST_PROGRAM to be defined") -endif (NOT TEST_PROGRAM) -#if (NOT TEST_ARGS) -# message (STATUS "Require TEST_ARGS to be defined") -#endif (NOT TEST_ARGS) -#if (NOT TEST_EXPECT) -# message (STATUS "Require TEST_EXPECT to be defined") -#endif (NOT TEST_EXPECT) +endif () if (NOT TEST_FOLDER) message ( FATAL_ERROR "Require TEST_FOLDER to be defined") -endif (NOT TEST_FOLDER) +endif () if (NOT TEST_VFD) message (FATAL_ERROR "Require TEST_VFD to be defined") -endif (NOT TEST_VFD) +endif () -set (ERROR_APPEND 1) +if (EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}) + file (REMOVE ${TEST_FOLDER}/${TEST_OUTPUT}) +endif () + +if (EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}.err) + file (REMOVE ${TEST_FOLDER}/${TEST_OUTPUT}.err) +endif () + +# if there is not an error reference file add the error output to the stdout file +if (NOT TEST_ERRREF) + set (ERROR_APPEND 1) +endif () message (STATUS "USING ${TEST_VFD} ON COMMAND: ${TEST_PROGRAM} ${TEST_ARGS}") set (ENV{HDF5_DRIVER} "${TEST_VFD}") + # run the test program, capture the stdout/stderr and the result var -EXECUTE_PROCESS ( +execute_process ( COMMAND ${TEST_PROGRAM} ${TEST_ARGS} WORKING_DIRECTORY ${TEST_FOLDER} + RESULT_VARIABLE TEST_RESULT OUTPUT_FILE ${TEST_OUTPUT}_${TEST_VFD}.out ERROR_FILE ${TEST_OUTPUT}_${TEST_VFD}.err OUTPUT_VARIABLE TEST_OUT @@ -35,16 +42,24 @@ EXECUTE_PROCESS ( message (STATUS "COMMAND Result: ${TEST_RESULT}") +# if the .err file exists and ERRROR_APPEND is enabled if (ERROR_APPEND AND EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}_${TEST_VFD}.err) file (READ ${TEST_FOLDER}/${TEST_OUTPUT}_${TEST_VFD}.err TEST_STREAM) file (APPEND ${TEST_FOLDER}/${TEST_OUTPUT}_${TEST_VFD}.out "${TEST_STREAM}") -endif (ERROR_APPEND AND EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}_${TEST_VFD}.err) +endif () # if the return value is !=${TEST_EXPECT} bail out if (NOT ${TEST_RESULT} STREQUAL ${TEST_EXPECT}) - message ( FATAL_ERROR "Failed: Test program ${TEST_PROGRAM} exited != ${TEST_EXPECT}.\n${TEST_ERROR}") -endif (NOT ${TEST_RESULT} STREQUAL ${TEST_EXPECT}) + if (NOT TEST_NOERRDISPLAY) + if (EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}_${TEST_VFD}.out) + file (READ ${TEST_FOLDER}/${TEST_OUTPUT}_${TEST_VFD}.out TEST_STREAM) + message (STATUS "Output USING ${TEST_VFD}:\n${TEST_STREAM}") + endif () + endif () + message (FATAL_ERROR "Failed: Test program ${TEST_PROGRAM} exited != ${TEST_EXPECT}.\n${TEST_ERROR}") +endif () + +message (STATUS "COMMAND Error: ${TEST_ERROR}") # everything went fine... message ("Passed: The ${TEST_PROGRAM} program used vfd ${TEST_VFD}") - diff --git a/config/cmake_ext_mod/CheckTypeSize.cmake b/config/cmake_ext_mod/CheckTypeSize.cmake index 5095a27..d217ac5 100644 --- a/config/cmake_ext_mod/CheckTypeSize.cmake +++ b/config/cmake_ext_mod/CheckTypeSize.cmake @@ -7,24 +7,24 @@ # HAVE_${VARIABLE} - does the variable exists or not # -MACRO (HDF_CHECK_TYPE_SIZE TYPE VARIABLE) +macro (HDF_CHECK_TYPE_SIZE TYPE VARIABLE) set (CMAKE_ALLOW_UNKNOWN_VARIABLE_READ_ACCESS 1) if ("HAVE_${VARIABLE}" MATCHES "^HAVE_${VARIABLE}$") - set (MACRO_CHECK_TYPE_SIZE_FLAGS + set (MACRO_CHECK_TYPE_SIZE_FLAGS "-DCHECK_TYPE_SIZE_TYPE=\"${TYPE}\" ${CMAKE_REQUIRED_FLAGS}" ) foreach (def HAVE_SYS_TYPES_H HAVE_STDINT_H HAVE_STDDEF_H HAVE_INTTYPES_H) if ("${def}") set (MACRO_CHECK_TYPE_SIZE_FLAGS "${MACRO_CHECK_TYPE_SIZE_FLAGS} -D${def}") - endif ("${def}") - endforeach (def) + endif () + endforeach () message (STATUS "Check size of ${TYPE}") if (CMAKE_REQUIRED_LIBRARIES) - set (CHECK_TYPE_SIZE_ADD_LIBRARIES + set (CHECK_TYPE_SIZE_ADD_LIBRARIES "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}" ) - endif (CMAKE_REQUIRED_LIBRARIES) + endif () try_run (${VARIABLE} HAVE_${VARIABLE} ${CMAKE_BINARY_DIR} ${HDF_RESOURCES_EXT_DIR}/CheckTypeSize.c @@ -35,16 +35,16 @@ MACRO (HDF_CHECK_TYPE_SIZE TYPE VARIABLE) if (HAVE_${VARIABLE}) message (STATUS "Check size of ${TYPE} - done") file (APPEND - ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeOutput.log + ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeOutput.log "Determining size of ${TYPE} passed with the following output:\n${OUTPUT}\n\n" ) - else (HAVE_${VARIABLE}) + else () message (STATUS "Check size of ${TYPE} - failed") file (APPEND - ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeError.log + ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeError.log "Determining size of ${TYPE} failed with the following output:\n${OUTPUT}\n\n" ) - endif (HAVE_${VARIABLE}) - endif ("HAVE_${VARIABLE}" MATCHES "^HAVE_${VARIABLE}$") + endif () + endif () set (CMAKE_ALLOW_UNKNOWN_VARIABLE_READ_ACCESS) -ENDMACRO (HDF_CHECK_TYPE_SIZE) +endmacro () diff --git a/config/cmake_ext_mod/ConfigureChecks.cmake b/config/cmake_ext_mod/ConfigureChecks.cmake index 5a14990..2e99c94 100644 --- a/config/cmake_ext_mod/ConfigureChecks.cmake +++ b/config/cmake_ext_mod/ConfigureChecks.cmake @@ -11,9 +11,9 @@ include (${CMAKE_ROOT}/Modules/CheckTypeSize.cmake) include (${CMAKE_ROOT}/Modules/CheckVariableExists.cmake) include (${CMAKE_ROOT}/Modules/CheckFortranFunctionExists.cmake) include (${CMAKE_ROOT}/Modules/TestBigEndian.cmake) -if(CMAKE_CXX_COMPILER) +if (CMAKE_CXX_COMPILER AND CMAKE_CXX_COMPILER_LOADED) include (${CMAKE_ROOT}/Modules/TestForSTDNamespace.cmake) -endif(CMAKE_CXX_COMPILER) +endif () #----------------------------------------------------------------------------- # APPLE/Darwin setup @@ -28,29 +28,29 @@ if (APPLE) "variable has been set to a blank value which will build the default architecture for this system.") endif () set (${HDF_PREFIX}_AC_APPLE_UNIVERSAL_BUILD 0) -endif (APPLE) +endif () # Check for Darwin (not just Apple - we also want to catch OpenDarwin) if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") set (${HDF_PREFIX}_HAVE_DARWIN 1) -endif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") +endif () # Check for Solaris if (${CMAKE_SYSTEM_NAME} MATCHES "SunOS") set (${HDF_PREFIX}_HAVE_SOLARIS 1) -endif (${CMAKE_SYSTEM_NAME} MATCHES "SunOS") +endif () #----------------------------------------------------------------------------- # This MACRO checks IF the symbol exists in the library and IF it # does, it appends library to the list. #----------------------------------------------------------------------------- set (LINK_LIBS "") -MACRO (CHECK_LIBRARY_EXISTS_CONCAT LIBRARY SYMBOL VARIABLE) +macro (CHECK_LIBRARY_EXISTS_CONCAT LIBRARY SYMBOL VARIABLE) CHECK_LIBRARY_EXISTS ("${LIBRARY};${LINK_LIBS}" ${SYMBOL} "" ${VARIABLE}) if (${VARIABLE}) set (LINK_LIBS ${LINK_LIBS} ${LIBRARY}) - endif (${VARIABLE}) -ENDMACRO (CHECK_LIBRARY_EXISTS_CONCAT) + endif () +endmacro () # ---------------------------------------------------------------------- # WINDOWS Hard code Values @@ -62,7 +62,7 @@ if (WIN32) set (${HDF_PREFIX}_HAVE_MINGW 1) set (WINDOWS 1) # MinGW tries to imitate Windows set (CMAKE_REQUIRED_FLAGS "-DWIN32_LEAN_AND_MEAN=1 -DNOGDI=1") - endif (MINGW) + endif () set (${HDF_PREFIX}_HAVE_WIN32_API 1) set (CMAKE_REQUIRED_LIBRARIES "ws2_32.lib;wsock32.lib") if (NOT UNIX AND NOT MINGW) @@ -70,9 +70,9 @@ if (WIN32) set (CMAKE_REQUIRED_FLAGS "/DWIN32_LEAN_AND_MEAN=1 /DNOGDI=1") if (MSVC) set (${HDF_PREFIX}_HAVE_VISUAL_STUDIO 1) - endif (MSVC) - endif (NOT UNIX AND NOT MINGW) -endif (WIN32) + endif () + endif () +endif () if (WINDOWS) set (${HDF_PREFIX}_HAVE_STDDEF_H 1) @@ -84,20 +84,20 @@ if (WINDOWS) set (${HDF_PREFIX}_HAVE_LONGJMP 1) if (NOT MINGW) set (${HDF_PREFIX}_HAVE_GETHOSTNAME 1) - endif (NOT MINGW) + endif () if (NOT UNIX AND NOT CYGWIN AND NOT MINGW) set (${HDF_PREFIX}_HAVE_GETCONSOLESCREENBUFFERINFO 1) - endif (NOT UNIX AND NOT CYGWIN AND NOT MINGW) + endif () set (${HDF_PREFIX}_HAVE_FUNCTION 1) set (${HDF_PREFIX}_GETTIMEOFDAY_GIVES_TZ 1) set (${HDF_PREFIX}_HAVE_TIMEZONE 1) set (${HDF_PREFIX}_HAVE_GETTIMEOFDAY 1) if (MINGW) set (${HDF_PREFIX}_HAVE_WINSOCK2_H 1) - endif (MINGW) + endif () set (${HDF_PREFIX}_HAVE_LIBWS2_32 1) set (${HDF_PREFIX}_HAVE_LIBWSOCK32 1) -endif (WINDOWS) +endif () # ---------------------------------------------------------------------- # END of WINDOWS Hard code Values @@ -105,7 +105,7 @@ endif (WINDOWS) if (CYGWIN) set (${HDF_PREFIX}_HAVE_LSEEK64 0) -endif (CYGWIN) +endif () #----------------------------------------------------------------------------- # Check for the math library "m" @@ -115,7 +115,7 @@ if (NOT WINDOWS) CHECK_LIBRARY_EXISTS_CONCAT ("dl" dlopen ${HDF_PREFIX}_HAVE_LIBDL) CHECK_LIBRARY_EXISTS_CONCAT ("ws2_32" WSAStartup ${HDF_PREFIX}_HAVE_LIBWS2_32) CHECK_LIBRARY_EXISTS_CONCAT ("wsock32" gethostbyname ${HDF_PREFIX}_HAVE_LIBWSOCK32) -endif (NOT WINDOWS) +endif () # UCB (BSD) compatibility library CHECK_LIBRARY_EXISTS_CONCAT ("ucb" gethostname ${HDF_PREFIX}_HAVE_LIBUCB) @@ -126,20 +126,20 @@ set (CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${LINK_LIBS}) set (USE_INCLUDES "") if (WINDOWS) set (USE_INCLUDES ${USE_INCLUDES} "windows.h") -endif (WINDOWS) +endif () if (NOT WINDOWS) TEST_BIG_ENDIAN (${HDF_PREFIX}_WORDS_BIGENDIAN) -endif (NOT WINDOWS) +endif () # For other specific tests, use this MACRO. -MACRO (HDF_FUNCTION_TEST OTHER_TEST) +macro (HDF_FUNCTION_TEST OTHER_TEST) if ("${HDF_PREFIX}_${OTHER_TEST}" MATCHES "^${HDF_PREFIX}_${OTHER_TEST}$") set (MACRO_CHECK_FUNCTION_DEFINITIONS "-D${OTHER_TEST} ${CMAKE_REQUIRED_FLAGS}") set (OTHER_TEST_ADD_LIBRARIES) if (CMAKE_REQUIRED_LIBRARIES) set (OTHER_TEST_ADD_LIBRARIES "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}") - endif (CMAKE_REQUIRED_LIBRARIES) + endif () foreach (def HAVE_SYS_TIME_H @@ -149,14 +149,14 @@ MACRO (HDF_FUNCTION_TEST OTHER_TEST) ) if ("${${HDF_PREFIX}_${def}}") set (MACRO_CHECK_FUNCTION_DEFINITIONS "${MACRO_CHECK_FUNCTION_DEFINITIONS} -D${def}") - endif ("${${HDF_PREFIX}_${def}}") - endforeach (def) + endif () + endforeach () if (LARGEFILE) set (MACRO_CHECK_FUNCTION_DEFINITIONS "${MACRO_CHECK_FUNCTION_DEFINITIONS} -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE" ) - endif (LARGEFILE) + endif () #message (STATUS "Performing ${OTHER_TEST}") TRY_COMPILE (${OTHER_TEST} @@ -169,16 +169,16 @@ MACRO (HDF_FUNCTION_TEST OTHER_TEST) if (${OTHER_TEST}) set (${HDF_PREFIX}_${OTHER_TEST} 1 CACHE INTERNAL "Other test ${FUNCTION}") message (STATUS "Performing Other Test ${OTHER_TEST} - Success") - else (${OTHER_TEST}) + else () message (STATUS "Performing Other Test ${OTHER_TEST} - Failed") set (${HDF_PREFIX}_${OTHER_TEST} "" CACHE INTERNAL "Other test ${FUNCTION}") file (APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log "Performing Other Test ${OTHER_TEST} failed with the following output:\n" "${OUTPUT}\n" ) - endif (${OTHER_TEST}) - endif ("${HDF_PREFIX}_${OTHER_TEST}" MATCHES "^${HDF_PREFIX}_${OTHER_TEST}$") -ENDMACRO (HDF_FUNCTION_TEST) + endif () + endif () +endmacro () #----------------------------------------------------------------------------- # Check for these functions before the time headers are checked @@ -188,12 +188,12 @@ HDF_FUNCTION_TEST (STDC_HEADERS) #----------------------------------------------------------------------------- # Check IF header file exists and add it to the list. #----------------------------------------------------------------------------- -MACRO (CHECK_INCLUDE_FILE_CONCAT FILE VARIABLE) +macro (CHECK_INCLUDE_FILE_CONCAT FILE VARIABLE) CHECK_INCLUDE_FILES ("${USE_INCLUDES};${FILE}" ${VARIABLE}) if (${VARIABLE}) set (USE_INCLUDES ${USE_INCLUDES} ${FILE}) - endif (${VARIABLE}) -ENDMACRO (CHECK_INCLUDE_FILE_CONCAT) + endif () +endmacro () #----------------------------------------------------------------------------- # Check for the existence of certain header files @@ -219,8 +219,8 @@ if (${HDF_PREFIX}_HAVE_STDINT_H AND CMAKE_CXX_COMPILER_LOADED) if (NOT ${HDF_PREFIX}_HAVE_STDINT_H_CXX) set (${HDF_PREFIX}_HAVE_STDINT_H "" CACHE INTERNAL "Have includes HAVE_STDINT_H") set (USE_INCLUDES ${USE_INCLUDES} "stdint.h") - endif (NOT ${HDF_PREFIX}_HAVE_STDINT_H_CXX) -endif (${HDF_PREFIX}_HAVE_STDINT_H AND CMAKE_CXX_COMPILER_LOADED) + endif () +endif () # Darwin CHECK_INCLUDE_FILE_CONCAT ("mach/mach_time.h" ${HDF_PREFIX}_HAVE_MACH_MACH_TIME_H) @@ -229,16 +229,16 @@ CHECK_INCLUDE_FILE_CONCAT ("mach/mach_time.h" ${HDF_PREFIX}_HAVE_MACH_MACH_TIME_ CHECK_INCLUDE_FILE_CONCAT ("io.h" ${HDF_PREFIX}_HAVE_IO_H) if (NOT CYGWIN) CHECK_INCLUDE_FILE_CONCAT ("winsock2.h" ${HDF_PREFIX}_HAVE_WINSOCK2_H) -endif (NOT CYGWIN) +endif () CHECK_INCLUDE_FILE_CONCAT ("sys/timeb.h" ${HDF_PREFIX}_HAVE_SYS_TIMEB_H) if (CMAKE_SYSTEM_NAME MATCHES "OSF") CHECK_INCLUDE_FILE_CONCAT ("sys/sysinfo.h" ${HDF_PREFIX}_HAVE_SYS_SYSINFO_H) CHECK_INCLUDE_FILE_CONCAT ("sys/proc.h" ${HDF_PREFIX}_HAVE_SYS_PROC_H) -else (CMAKE_SYSTEM_NAME MATCHES "OSF") +else () set (${HDF_PREFIX}_HAVE_SYS_SYSINFO_H "" CACHE INTERNAL "" FORCE) set (${HDF_PREFIX}_HAVE_SYS_PROC_H "" CACHE INTERNAL "" FORCE) -endif (CMAKE_SYSTEM_NAME MATCHES "OSF") +endif () CHECK_INCLUDE_FILE_CONCAT ("globus/common.h" ${HDF_PREFIX}_HAVE_GLOBUS_COMMON_H) CHECK_INCLUDE_FILE_CONCAT ("pdb.h" ${HDF_PREFIX}_HAVE_PDB_H) @@ -295,29 +295,29 @@ if (NOT WINDOWS) # check should be generalized for all POSIX systems as it # is in the Autotools. if (TEST_LFS_WORKS_COMPILE) - if (TEST_LFS_WORKS_RUN MATCHES 0) + if (TEST_LFS_WORKS_RUN MATCHES 0) set (TEST_LFS_WORKS 1 CACHE INTERNAL ${msg}) set (LARGEFILE 1) set (HDF_EXTRA_FLAGS ${HDF_EXTRA_FLAGS} -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE) message (STATUS "${msg}... yes") - else (TEST_LFS_WORKS_RUN MATCHES 0) + else () set (TEST_LFS_WORKS "" CACHE INTERNAL ${msg}) message (STATUS "${msg}... no") file (APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log "Test TEST_LFS_WORKS Run failed with the following output and exit code:\n ${OUTPUT}\n" ) - endif (TEST_LFS_WORKS_RUN MATCHES 0) - else (TEST_LFS_WORKS_COMPILE ) + endif () + else () set (TEST_LFS_WORKS "" CACHE INTERNAL ${msg}) message (STATUS "${msg}... no") file (APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log "Test TEST_LFS_WORKS Compile failed with the following output:\n ${OUTPUT}\n" ) - endif (TEST_LFS_WORKS_COMPILE) - endif (HDF_ENABLE_LARGE_FILE) + endif () + endif () set (CMAKE_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} ${HDF_EXTRA_FLAGS}) - endif (NOT ${HDF_PREFIX}_HAVE_SOLARIS AND NOT ${HDF_PREFIX}_HAVE_DARWIN) -endif (NOT WINDOWS) + endif () +endif () add_definitions (${HDF_EXTRA_FLAGS}) @@ -331,7 +331,7 @@ if (NOT WINDOWS OR MINGW) CHECK_FUNCTION_EXISTS (fseeko64 ${HDF_PREFIX}_HAVE_FSEEKO64) CHECK_FUNCTION_EXISTS (ftello64 ${HDF_PREFIX}_HAVE_FTELLO64) CHECK_FUNCTION_EXISTS (ftruncate64 ${HDF_PREFIX}_HAVE_FTRUNCATE64) - endif (${HDF_PREFIX}_HAVE_OFF64_T) + endif () CHECK_FUNCTION_EXISTS (fseeko ${HDF_PREFIX}_HAVE_FSEEKO) CHECK_FUNCTION_EXISTS (ftello ${HDF_PREFIX}_HAVE_FTELLO) @@ -340,13 +340,13 @@ if (NOT WINDOWS OR MINGW) if (HAVE_STAT64_STRUCT) CHECK_FUNCTION_EXISTS (fstat64 ${HDF_PREFIX}_HAVE_FSTAT64) CHECK_FUNCTION_EXISTS (stat64 ${HDF_PREFIX}_HAVE_STAT64) - endif (HAVE_STAT64_STRUCT) -endif (NOT WINDOWS OR MINGW) + endif () +endif () #----------------------------------------------------------------------------- # Check the size in bytes of all the int and float types #----------------------------------------------------------------------------- -MACRO (HDF_CHECK_TYPE_SIZE type var) +macro (HDF_CHECK_TYPE_SIZE type var) set (aType ${type}) set (aVar ${var}) # message (STATUS "Checking size of ${aType} and storing into ${aVar}") @@ -354,8 +354,8 @@ MACRO (HDF_CHECK_TYPE_SIZE type var) if (NOT ${aVar}) set (${aVar} 0 CACHE INTERNAL "SizeOf for ${aType}") # message (STATUS "Size of ${aType} was NOT Found") - endif (NOT ${aVar}) -ENDMACRO (HDF_CHECK_TYPE_SIZE) + endif () +endmacro () HDF_CHECK_TYPE_SIZE (char ${HDF_PREFIX}_SIZEOF_CHAR) HDF_CHECK_TYPE_SIZE (short ${HDF_PREFIX}_SIZEOF_SHORT) @@ -363,12 +363,12 @@ HDF_CHECK_TYPE_SIZE (int ${HDF_PREFIX}_SIZEOF_INT) HDF_CHECK_TYPE_SIZE (unsigned ${HDF_PREFIX}_SIZEOF_UNSIGNED) if (NOT APPLE) HDF_CHECK_TYPE_SIZE (long ${HDF_PREFIX}_SIZEOF_LONG) -endif (NOT APPLE) +endif () HDF_CHECK_TYPE_SIZE ("long long" ${HDF_PREFIX}_SIZEOF_LONG_LONG) HDF_CHECK_TYPE_SIZE (__int64 ${HDF_PREFIX}_SIZEOF___INT64) if (NOT ${HDF_PREFIX}_SIZEOF___INT64) set (${HDF_PREFIX}_SIZEOF___INT64 0) -endif (NOT ${HDF_PREFIX}_SIZEOF___INT64) +endif () HDF_CHECK_TYPE_SIZE (float ${HDF_PREFIX}_SIZEOF_FLOAT) HDF_CHECK_TYPE_SIZE (double ${HDF_PREFIX}_SIZEOF_DOUBLE) @@ -407,17 +407,17 @@ if (NOT APPLE) HDF_CHECK_TYPE_SIZE (ssize_t ${HDF_PREFIX}_SIZEOF_SSIZE_T) if (NOT ${HDF_PREFIX}_SIZEOF_SSIZE_T) set (${HDF_PREFIX}_SIZEOF_SSIZE_T 0) - endif (NOT ${HDF_PREFIX}_SIZEOF_SSIZE_T) + endif () if (NOT WINDOWS) HDF_CHECK_TYPE_SIZE (ptrdiff_t ${HDF_PREFIX}_SIZEOF_PTRDIFF_T) - endif (NOT WINDOWS) -endif (NOT APPLE) + endif () +endif () HDF_CHECK_TYPE_SIZE (off_t ${HDF_PREFIX}_SIZEOF_OFF_T) HDF_CHECK_TYPE_SIZE (off64_t ${HDF_PREFIX}_SIZEOF_OFF64_T) if (NOT ${HDF_PREFIX}_SIZEOF_OFF64_T) set (${HDF_PREFIX}_SIZEOF_OFF64_T 0) -endif (NOT ${HDF_PREFIX}_SIZEOF_OFF64_T) +endif () #----------------------------------------------------------------------------- # Extra C99 types @@ -428,9 +428,9 @@ CHECK_INCLUDE_FILE_CONCAT (stdbool.h ${HDF_PREFIX}_HAVE_STDBOOL_H) if (HAVE_STDBOOL_H) set (CMAKE_EXTRA_INCLUDE_FILES stdbool.h) HDF_CHECK_TYPE_SIZE (bool ${HDF_PREFIX}_SIZEOF_BOOL) -else (HAVE_STDBOOL_H) +else () HDF_CHECK_TYPE_SIZE (_Bool ${HDF_PREFIX}_SIZEOF_BOOL) -endif (HAVE_STDBOOL_H) +endif () if (NOT WINDOWS) #----------------------------------------------------------------------------- @@ -459,11 +459,11 @@ if (NOT WINDOWS) HAVE_STRUCT_TM_TM_ZONE ) HDF_FUNCTION_TEST (${test}) - endforeach (test) + endforeach () if (NOT CYGWIN AND NOT MINGW) HDF_FUNCTION_TEST (HAVE_TIMEZONE) # HDF_FUNCTION_TEST (HAVE_STAT_ST_BLOCKS) - endif (NOT CYGWIN AND NOT MINGW) + endif () # ---------------------------------------------------------------------- # Does the struct stat have the st_blocks field? This field is not Posix. @@ -481,7 +481,7 @@ if (NOT WINDOWS) CHECK_FUNCTION_EXISTS (_scrsize ${HDF_PREFIX}_HAVE__SCRSIZE) if (NOT CYGWIN AND NOT MINGW) CHECK_FUNCTION_EXISTS (GetConsoleScreenBufferInfo ${HDF_PREFIX}_HAVE_GETCONSOLESCREENBUFFERINFO) - endif (NOT CYGWIN AND NOT MINGW) + endif () CHECK_SYMBOL_EXISTS (TIOCGWINSZ "sys/ioctl.h" ${HDF_PREFIX}_HAVE_TIOCGWINSZ) CHECK_SYMBOL_EXISTS (TIOCGETD "sys/ioctl.h" ${HDF_PREFIX}_HAVE_TIOCGETD) @@ -490,8 +490,8 @@ if (NOT WINDOWS) # if (NOT CYGWIN AND NOT MINGW) CHECK_FUNCTION_EXISTS (getpwuid ${HDF_PREFIX}_HAVE_GETPWUID) - endif (NOT CYGWIN AND NOT MINGW) -endif (NOT WINDOWS) + endif () +endif () #----------------------------------------------------------------------------- # Check for some functions that are used @@ -539,8 +539,8 @@ CHECK_FUNCTION_EXISTS (vsnprintf ${HDF_PREFIX}_HAVE_VSNPRINTF) if (NOT WINDOWS) if (${HDF_PREFIX}_HAVE_VSNPRINTF) HDF_FUNCTION_TEST (VSNPRINTF_WORKS) - endif (${HDF_PREFIX}_HAVE_VSNPRINTF) -endif (NOT WINDOWS) + endif () +endif () #----------------------------------------------------------------------------- # sigsetjmp is special; may actually be a macro @@ -550,9 +550,9 @@ if (NOT ${HDF_PREFIX}_HAVE_SIGSETJMP) CHECK_SYMBOL_EXISTS (sigsetjmp "setjmp.h" ${HDF_PREFIX}_HAVE_MACRO_SIGSETJMP) if (${HDF_PREFIX}_HAVE_MACRO_SIGSETJMP) set (${HDF_PREFIX}_HAVE_SIGSETJMP 1) - endif (${HDF_PREFIX}_HAVE_MACRO_SIGSETJMP) - endif (${HDF_PREFIX}_HAVE_SETJMP_H) -endif (NOT ${HDF_PREFIX}_HAVE_SIGSETJMP) + endif () + endif () +endif () #----------------------------------------------------------------------------- # Check a bunch of other functions @@ -568,17 +568,17 @@ if (NOT WINDOWS) HAVE_SOCKLEN_T ) HDF_FUNCTION_TEST (${test}) - endforeach (test) -endif (NOT WINDOWS) + endforeach () +endif () # For other CXX specific tests, use this MACRO. -MACRO (HDF_CXX_FUNCTION_TEST OTHER_TEST) +macro (HDF_CXX_FUNCTION_TEST OTHER_TEST) if ("${OTHER_TEST}" MATCHES "^${OTHER_TEST}$") set (MACRO_CHECK_FUNCTION_DEFINITIONS "-D${OTHER_TEST} ${CMAKE_REQUIRED_FLAGS}") set (OTHER_TEST_ADD_LIBRARIES) if (CMAKE_REQUIRED_LIBRARIES) set (OTHER_TEST_ADD_LIBRARIES "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}") - endif (CMAKE_REQUIRED_LIBRARIES) + endif () foreach (def HAVE_SYS_TIME_H @@ -588,14 +588,14 @@ MACRO (HDF_CXX_FUNCTION_TEST OTHER_TEST) ) if ("${${HDF_PREFIX}_${def}}") set (MACRO_CHECK_FUNCTION_DEFINITIONS "${MACRO_CHECK_FUNCTION_DEFINITIONS} -D${def}") - endif ("${${HDF_PREFIX}_${def}}") - endforeach (def) + endif () + endforeach () if (LARGEFILE) set (MACRO_CHECK_FUNCTION_DEFINITIONS "${MACRO_CHECK_FUNCTION_DEFINITIONS} -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE" ) - endif (LARGEFILE) + endif () #message (STATUS "Performing ${OTHER_TEST}") TRY_COMPILE (${OTHER_TEST} @@ -608,16 +608,16 @@ MACRO (HDF_CXX_FUNCTION_TEST OTHER_TEST) if (${OTHER_TEST} EQUAL 0) set (${OTHER_TEST} 1 CACHE INTERNAL "CXX test ${FUNCTION}") message (STATUS "Performing CXX Test ${OTHER_TEST} - Success") - else (${OTHER_TEST} EQUAL 0) + else () message (STATUS "Performing CXX Test ${OTHER_TEST} - Failed") set (${OTHER_TEST} "" CACHE INTERNAL "CXX test ${FUNCTION}") file (APPEND ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeError.log "Performing CXX Test ${OTHER_TEST} failed with the following output:\n" "${OUTPUT}\n" ) - endif (${OTHER_TEST} EQUAL 0) - endif ("${OTHER_TEST}" MATCHES "^${OTHER_TEST}$") -ENDMACRO (HDF_CXX_FUNCTION_TEST) + endif () + endif () +endmacro () #----------------------------------------------------------------------------- # Check a bunch of cxx functions @@ -632,8 +632,8 @@ if (CMAKE_CXX_COMPILER_LOADED) CXX_HAVE_OFFSETOF ) HDF_CXX_FUNCTION_TEST (${test}) - endforeach (test) -endif (CMAKE_CXX_COMPILER_LOADED) + endforeach () +endif () #----------------------------------------------------------------------------- # Check if InitOnceExecuteOnce is available @@ -646,21 +646,21 @@ if (WINDOWS) set (CMAKE_REQUIRED_DEFINITIONS "${CURRENT_TEST_DEFINITIONS} -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE" ) - endif (LARGEFILE) + endif () set (MACRO_CHECK_FUNCTION_DEFINITIONS "-DHAVE_IOEO ${CMAKE_REQUIRED_FLAGS}") if (CMAKE_REQUIRED_LIBRARIES) set (CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}") - else (CMAKE_REQUIRED_LIBRARIES) + else () set (CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES) - endif (CMAKE_REQUIRED_LIBRARIES) + endif () if (CMAKE_REQUIRED_INCLUDES) set (CHECK_C_SOURCE_COMPILES_ADD_INCLUDES "-DINCLUDE_DIRECTORIES:STRING=${CMAKE_REQUIRED_INCLUDES}") - else (CMAKE_REQUIRED_INCLUDES) + else () set (CHECK_C_SOURCE_COMPILES_ADD_INCLUDES) - endif (CMAKE_REQUIRED_INCLUDES) + endif () TRY_RUN(HAVE_IOEO_EXITCODE HAVE_IOEO_COMPILED ${CMAKE_BINARY_DIR} @@ -674,7 +674,7 @@ if (WINDOWS) # if it did not compile make the return value fail code of 1 if (NOT HAVE_IOEO_COMPILED) set (HAVE_IOEO_EXITCODE 1) - endif (NOT HAVE_IOEO_COMPILED) + endif () # if the return value was 0 then it worked if ("${HAVE_IOEO_EXITCODE}" EQUAL 0) set (${HDF_PREFIX}_HAVE_IOEO 1 CACHE INTERNAL "Test InitOnceExecuteOnce") @@ -683,22 +683,22 @@ if (WINDOWS) "Performing C SOURCE FILE Test InitOnceExecuteOnce succeded with the following output:\n" "${OUTPUT}\n" "Return value: ${HAVE_IOEO}\n") - else ("${HAVE_IOEO_EXITCODE}" EQUAL 0) + else () if (CMAKE_CROSSCOMPILING AND "${HAVE_IOEO_EXITCODE}" MATCHES "FAILED_TO_RUN") set (${HDF_PREFIX}_HAVE_IOEO "${HAVE_IOEO_EXITCODE}") - else (CMAKE_CROSSCOMPILING AND "${HAVE_IOEO_EXITCODE}" MATCHES "FAILED_TO_RUN") + else () set (${HDF_PREFIX}_HAVE_IOEO "" CACHE INTERNAL "Test InitOnceExecuteOnce") - endif (CMAKE_CROSSCOMPILING AND "${HAVE_IOEO_EXITCODE}" MATCHES "FAILED_TO_RUN") + endif () message (STATUS "Performing Test InitOnceExecuteOnce - Failed") file (APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log "Performing InitOnceExecuteOnce Test failed with the following output:\n" "${OUTPUT}\n" "Return value: ${HAVE_IOEO_EXITCODE}\n") - endif ("${HAVE_IOEO_EXITCODE}" EQUAL 0) - endif ("${${HDF_PREFIX}_HAVE_IOEO}" MATCHES "^${${HDF_PREFIX}_HAVE_IOEO}$") - endif (NOT HDF_NO_IOEO_TEST) -endif (WINDOWS) + endif () + endif () + endif () +endif () #----------------------------------------------------------------------------- # Determine how 'inline' is used @@ -706,7 +706,7 @@ endif (WINDOWS) foreach (inline_test inline __inline__ __inline) string (TOUPPER ${inline_test} INLINE_TEST_MACRO) HDF_FUNCTION_TEST (HAVE_${INLINE_TEST_MACRO}) -endforeach (inline_test) +endforeach () #----------------------------------------------------------------------------- # Check how to print a Long Long integer @@ -717,7 +717,7 @@ if (NOT ${HDF_PREFIX}_PRINTF_LL_WIDTH OR ${HDF_PREFIX}_PRINTF_LL_WIDTH MATCHES " set (CURRENT_TEST_DEFINITIONS "-DPRINTF_LL_WIDTH") if (${HDF_PREFIX}_SIZEOF_LONG_LONG) set (CURRENT_TEST_DEFINITIONS "${CURRENT_TEST_DEFINITIONS} -DHAVE_LONG_LONG") - endif (${HDF_PREFIX}_SIZEOF_LONG_LONG) + endif () TRY_RUN (${HDF_PREFIX}_PRINTF_LL_TEST_RUN ${HDF_PREFIX}_PRINTF_LL_TEST_COMPILE ${CMAKE_BINARY_DIR} ${HDF_RESOURCES_EXT_DIR}/HDFTests.c @@ -729,24 +729,24 @@ if (NOT ${HDF_PREFIX}_PRINTF_LL_WIDTH OR ${HDF_PREFIX}_PRINTF_LL_WIDTH MATCHES " string(REGEX REPLACE ".*PRINTF_LL_WIDTH=\\[(.*)\\].*" "\\1" ${HDF_PREFIX}_PRINTF_LL "${OUTPUT}") set (${HDF_PREFIX}_PRINTF_LL_WIDTH "\"${${HDF_PREFIX}_PRINTF_LL}\"" CACHE INTERNAL "Width for printf for type `long long' or `__int64', us. `ll") set (PRINT_LL_FOUND 1) - else (${HDF_PREFIX}_PRINTF_LL_TEST_RUN MATCHES 0) + else () message ("Width test failed with result: ${${HDF_PREFIX}_PRINTF_LL_TEST_RUN}") - endif (${HDF_PREFIX}_PRINTF_LL_TEST_RUN MATCHES 0) - else (${HDF_PREFIX}_PRINTF_LL_TEST_COMPILE) + endif () + else () file (APPEND ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeError.log "Test ${HDF_PREFIX}_PRINTF_LL_WIDTH failed with the following output:\n ${OUTPUT}\n" ) - endif (${HDF_PREFIX}_PRINTF_LL_TEST_COMPILE) + endif () if (PRINT_LL_FOUND) message (STATUS "Checking for appropriate format for 64 bit long: found ${${HDF_PREFIX}_PRINTF_LL_WIDTH}") - else (PRINT_LL_FOUND) + else () message (STATUS "Checking for appropriate format for 64 bit long: not found") set (${HDF_PREFIX}_PRINTF_LL_WIDTH "\"unknown\"" CACHE INTERNAL "Width for printf for type `long long' or `__int64', us. `ll" ) - endif (PRINT_LL_FOUND) -endif (NOT ${HDF_PREFIX}_PRINTF_LL_WIDTH OR ${HDF_PREFIX}_PRINTF_LL_WIDTH MATCHES "unknown") + endif () +endif () # ---------------------------------------------------------------------- # Set the flag to indicate that the machine can handle converting diff --git a/config/cmake_ext_mod/FindMPI.cmake b/config/cmake_ext_mod/FindMPI.cmake index 1a02f82..ff1ead2 100644 --- a/config/cmake_ext_mod/FindMPI.cmake +++ b/config/cmake_ext_mod/FindMPI.cmake @@ -114,9 +114,10 @@ include(GetPrerequisites) # # Start out with the generic MPI compiler names, as these are most commonly used. -set(_MPI_C_COMPILER_NAMES mpicc mpcc mpicc_r mpcc_r) +set(_MPI_C_COMPILER_NAMES mpicc mpcc mpicc_r mpcc_r mpicc.bat) set(_MPI_CXX_COMPILER_NAMES mpicxx mpiCC mpcxx mpCC mpic++ mpc++ - mpicxx_r mpiCC_r mpcxx_r mpCC_r mpic++_r mpc++_r) + mpicxx_r mpiCC_r mpcxx_r mpCC_r mpic++_r mpc++_r + mpicxx.bat) set(_MPI_Fortran_COMPILER_NAMES mpif95 mpif95_r mpf95 mpf95_r mpif90 mpif90_r mpf90 mpf90_r mpif77 mpif77_r mpf77 mpf77_r) @@ -128,9 +129,9 @@ set(_MPI_GNU_Fortran_COMPILER_NAMES mpigfortran mpgfortran mpigfortran_r mpig77 mpig77_r mpg77 mpg77_r) # Intel MPI compiler names -set(_MPI_Intel_C_COMPILER_NAMES mpiicc) -set(_MPI_Intel_CXX_COMPILER_NAMES mpiicpc mpiicxx mpiic++ mpiiCC) -set(_MPI_Intel_Fortran_COMPILER_NAMES mpiifort mpiif95 mpiif90 mpiif77) +set(_MPI_Intel_C_COMPILER_NAMES mpiicc mpiicc.bat) +set(_MPI_Intel_CXX_COMPILER_NAMES mpiicpc mpiicxx mpiic++ mpiiCC mpiicpc.bat) +set(_MPI_Intel_Fortran_COMPILER_NAMES mpiifort mpiif95 mpiif90 mpiif77 mpiifort.bat) # PGI compiler names set(_MPI_PGI_C_COMPILER_NAMES mpipgcc mppgcc) @@ -314,8 +315,9 @@ function (interrogate_mpi_compiler lang try_libs) set(MPI_COMPILE_FLAGS_WORK) foreach(FLAG ${MPI_ALL_COMPILE_FLAGS}) + string(REGEX REPLACE "^ " "" FLAG ${FLAG}) if (MPI_COMPILE_FLAGS_WORK) - string(APPEND MPI_COMPILE_FLAGS_WORK " ${FLAG}") + set(MPI_COMPILE_FLAGS_WORK "${MPI_COMPILE_FLAGS_WORK} ${FLAG}") else() set(MPI_COMPILE_FLAGS_WORK ${FLAG}) endif() @@ -323,9 +325,13 @@ function (interrogate_mpi_compiler lang try_libs) # Extract include paths from compile command line string(REGEX MATCHALL "(^| )-I([^\" ]+|\"[^\"]+\")" MPI_ALL_INCLUDE_PATHS "${MPI_COMPILE_CMDLINE}") + set(MPI_INCLUDE_PATH_WORK) + foreach(IPATH ${MPI_ALL_INCLUDE_PATHS}) string(REGEX REPLACE "^ ?-I" "" IPATH ${IPATH}) string(REPLACE "//" "/" IPATH ${IPATH}) + string(REPLACE "\"" "" IPATH ${IPATH}) + file(TO_CMAKE_PATH "${IPATH}" IPATH) list(APPEND MPI_INCLUDE_PATH_WORK ${IPATH}) endforeach() @@ -363,8 +369,9 @@ function (interrogate_mpi_compiler lang try_libs) string(REGEX MATCHALL "(^| )(-Wl,|-Xlinker )([^\" ]+|\"[^\"]+\")" MPI_ALL_LINK_FLAGS "${MPI_LINK_CMDLINE}") set(MPI_LINK_FLAGS_WORK) foreach(FLAG ${MPI_ALL_LINK_FLAGS}) + string(REGEX REPLACE "^ " "" FLAG ${FLAG}) if (MPI_LINK_FLAGS_WORK) - string(APPEND MPI_LINK_FLAGS_WORK " ${FLAG}") + set(MPI_LINK_FLAGS_WORK "${MPI_LINK_FLAGS_WORK} ${FLAG}") else() set(MPI_LINK_FLAGS_WORK ${FLAG}) endif() @@ -386,8 +393,7 @@ function (interrogate_mpi_compiler lang try_libs) # in the showme list that can only be found in the implicit # link directories of the compiler. if (DEFINED CMAKE_${lang}_IMPLICIT_LINK_DIRECTORIES) - string(APPEND MPI_LINK_PATH - ";${CMAKE_${lang}_IMPLICIT_LINK_DIRECTORIES}") + set(MPI_LINK_PATH "${MPI_LINK_PATH};${CMAKE_${lang}_IMPLICIT_LINK_DIRECTORIES}") endif () # Determine full path names for all of the libraries that one needs @@ -462,11 +468,11 @@ function (interrogate_mpi_compiler lang try_libs) set(MPI_HEADER_PATH "MPI_HEADER_PATH-NOTFOUND" CACHE FILEPATH "Cleared" FORCE) find_path(MPI_HEADER_PATH mpifptr.h HINTS ${_MPI_BASE_DIR} ${_MPI_PREFIX_PATH} - PATH_SUFFIXES include include/${MS_MPI_ARCH_DIR} include/${MS_MPI_ARCH_DIR2} Inc Inc/${MS_MPI_ARCH_DIR} Inc/${MS_MPI_ARCH_DIR2}) + PATH_SUFFIXES include Include include/${MS_MPI_ARCH_DIR} Include/${MS_MPI_ARCH_DIR2} Include/${MS_MPI_ARCH_DIR} include/${MS_MPI_ARCH_DIR2} Inc Inc/${MS_MPI_ARCH_DIR} Inc/${MS_MPI_ARCH_DIR2}) if (MPI_INCLUDE_PATH_WORK AND MPI_HEADER_PATH) list(APPEND MPI_INCLUDE_PATH_WORK ${MPI_HEADER_PATH}) - endif() - + endif () + set(MPI_LIB "MPI_LIB-NOTFOUND" CACHE FILEPATH "Cleared" FORCE) find_library(MPI_LIB NAMES fmpi fmpich fmpich2 fmpich2g msmpifec msmpifmc @@ -474,8 +480,8 @@ function (interrogate_mpi_compiler lang try_libs) PATH_SUFFIXES lib lib/${MS_MPI_ARCH_DIR} Lib Lib/${MS_MPI_ARCH_DIR}) if (MPI_LIBRARIES_WORK AND MPI_LIB) list(APPEND MPI_LIBRARIES_WORK ${MPI_LIB}) - endif() - endif() + endif () + endif () if (NOT MPI_LIBRARIES_WORK) set(MPI_LIBRARIES_WORK "MPI_${lang}_LIBRARIES-NOTFOUND") @@ -624,6 +630,9 @@ foreach (lang C CXX Fortran) try_regular_compiler(${lang} regular_compiler_worked) endif() + # add fortran mpi module path if ENV VAR exists + set (MPI_${lang}_INCLUDE_PATH "${MPI_${lang}_INCLUDE_PATH};$ENV{MPI_FORTRAN_MOD_DIR}") + set(MPI_${lang}_FIND_QUIETLY ${MPI_FIND_QUIETLY}) set(MPI_${lang}_FIND_REQUIRED ${MPI_FIND_REQUIRED}) set(MPI_${lang}_FIND_VERSION ${MPI_FIND_VERSION}) diff --git a/config/cmake_ext_mod/FindSZIP.cmake b/config/cmake_ext_mod/FindSZIP.cmake index 5f0f031..bb5f8d6 100644 --- a/config/cmake_ext_mod/FindSZIP.cmake +++ b/config/cmake_ext_mod/FindSZIP.cmake @@ -24,7 +24,7 @@ # made to remove references to Qt and make this file more generally applicable ######################################################################### -MACRO (SZIP_ADJUST_LIB_VARS basename) +macro (SZIP_ADJUST_LIB_VARS basename) if (${basename}_INCLUDE_DIR) # if only the release version was found, set the debug variable also to the release version @@ -32,38 +32,37 @@ MACRO (SZIP_ADJUST_LIB_VARS basename) set (${basename}_LIBRARY_DEBUG ${${basename}_LIBRARY_RELEASE}) set (${basename}_LIBRARY ${${basename}_LIBRARY_RELEASE}) set (${basename}_LIBRARIES ${${basename}_LIBRARY_RELEASE}) - endif (${basename}_LIBRARY_RELEASE AND NOT ${basename}_LIBRARY_DEBUG) + endif () # if only the debug version was found, set the release variable also to the debug version if (${basename}_LIBRARY_DEBUG AND NOT ${basename}_LIBRARY_RELEASE) set (${basename}_LIBRARY_RELEASE ${${basename}_LIBRARY_DEBUG}) set (${basename}_LIBRARY ${${basename}_LIBRARY_DEBUG}) set (${basename}_LIBRARIES ${${basename}_LIBRARY_DEBUG}) - endif (${basename}_LIBRARY_DEBUG AND NOT ${basename}_LIBRARY_RELEASE) + endif () if (${basename}_LIBRARY_DEBUG AND ${basename}_LIBRARY_RELEASE) # if the generator supports configuration types then set # optimized and debug libraries, or if the CMAKE_BUILD_TYPE has a value if (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE) set (${basename}_LIBRARY optimized ${${basename}_LIBRARY_RELEASE} debug ${${basename}_LIBRARY_DEBUG}) - else (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE) + else () # if there are no configuration types and CMAKE_BUILD_TYPE has no value # then just use the release libraries set (${basename}_LIBRARY ${${basename}_LIBRARY_RELEASE} ) - endif (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE) + endif () set (${basename}_LIBRARIES optimized ${${basename}_LIBRARY_RELEASE} debug ${${basename}_LIBRARY_DEBUG}) - endif (${basename}_LIBRARY_DEBUG AND ${basename}_LIBRARY_RELEASE) + endif () set (${basename}_LIBRARY ${${basename}_LIBRARY} CACHE FILEPATH "The ${basename} library") if (${basename}_LIBRARY) set (${basename}_FOUND 1) - endif (${basename}_LIBRARY) - - endif (${basename}_INCLUDE_DIR ) + endif () + endif () # Make variables changeble to the advanced user MARK_AS_ADVANCED (${basename}_LIBRARY ${basename}_LIBRARY_RELEASE ${basename}_LIBRARY_DEBUG ${basename}_INCLUDE_DIR ) -ENDMACRO (SZIP_ADJUST_LIB_VARS) +endmacro () # Look for the header file. @@ -93,10 +92,10 @@ FIND_PATH (SZIP_INCLUDE_DIR if (WIN32) set (SZIP_SEARCH_DEBUG_NAMES "sz_d;libsz_d") set (SZIP_SEARCH_RELEASE_NAMES "sz;libsz;libszip") -else (WIN32) +else () set (SZIP_SEARCH_DEBUG_NAMES "sz_d") set (SZIP_SEARCH_RELEASE_NAMES "sz;szip") -endif (WIN32) +endif () # Look for the library. FIND_LIBRARY (SZIP_LIBRARY_DEBUG @@ -120,16 +119,15 @@ if (SZIP_INCLUDE_DIR AND SZIP_LIBRARY) if (SZIP_LIBRARY_DEBUG) get_filename_component (SZIP_LIBRARY_PATH ${SZIP_LIBRARY_DEBUG} PATH) set (SZIP_LIB_DIR ${SZIP_LIBRARY_PATH}) - elseif (SZIP_LIBRARY_RELEASE) + elseif () get_filename_component (SZIP_LIBRARY_PATH ${SZIP_LIBRARY_RELEASE} PATH) set (SZIP_LIB_DIR ${SZIP_LIBRARY_PATH}) - endif (SZIP_LIBRARY_DEBUG) - -else (SZIP_INCLUDE_DIR AND SZIP_LIBRARY) + endif () +else () set (SZIP_FOUND 0) set (SZIP_LIBRARIES) set (SZIP_INCLUDE_DIRS) -endif (SZIP_INCLUDE_DIR AND SZIP_LIBRARY) +endif () # Report the results. if (NOT SZIP_FOUND) @@ -138,12 +136,12 @@ if (NOT SZIP_FOUND) ) if (NOT SZIP_FIND_QUIETLY) message (STATUS "${SZIP_DIR_MESSAGE}") - else (NOT SZIP_FIND_QUIETLY) + else () if (SZIP_FIND_REQUIRED) message (FATAL_ERROR "SZip was NOT found and is Required by this project") - endif (SZIP_FIND_REQUIRED) - endif (NOT SZIP_FIND_QUIETLY) -endif (NOT SZIP_FOUND) + endif () + endif () +endif () if (SZIP_FOUND) include (CheckSymbolExists) @@ -161,7 +159,7 @@ if (SZIP_FOUND) set (CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS_SAVE}) # ############################################# -endif (SZIP_FOUND) +endif () if (FIND_SZIP_DEBUG) message (STATUS "SZIP_INCLUDE_DIR: ${SZIP_INCLUDE_DIR}") @@ -169,4 +167,4 @@ if (FIND_SZIP_DEBUG) message (STATUS "SZIP_LIBRARY_DEBUG: ${SZIP_LIBRARY_DEBUG}") message (STATUS "SZIP_LIBRARY_RELEASE: ${SZIP_LIBRARY_RELEASE}") message (STATUS "CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}") -endif (FIND_SZIP_DEBUG) +endif () diff --git a/config/cmake_ext_mod/HDFLibMacros.cmake b/config/cmake_ext_mod/HDFLibMacros.cmake index 2145a3d..9d50f50 100644 --- a/config/cmake_ext_mod/HDFLibMacros.cmake +++ b/config/cmake_ext_mod/HDFLibMacros.cmake @@ -17,6 +17,7 @@ macro (EXTERNAL_JPEG_LIBRARY compress_type jpeg_pic) -DCMAKE_RUNTIME_OUTPUT_DIRECTORY:PATH=${CMAKE_RUNTIME_OUTPUT_DIRECTORY} -DCMAKE_LIBRARY_OUTPUT_DIRECTORY:PATH=${CMAKE_LIBRARY_OUTPUT_DIRECTORY} -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY:PATH=${CMAKE_ARCHIVE_OUTPUT_DIRECTORY} + -DCMAKE_PDB_OUTPUT_DIRECTORY:PATH=${CMAKE_PDB_OUTPUT_DIRECTORY} -DCMAKE_ANSI_CFLAGS:STRING=${jpeg_pic} ) elseif (${compress_type} MATCHES "GIT") @@ -33,6 +34,7 @@ macro (EXTERNAL_JPEG_LIBRARY compress_type jpeg_pic) -DCMAKE_RUNTIME_OUTPUT_DIRECTORY:PATH=${CMAKE_RUNTIME_OUTPUT_DIRECTORY} -DCMAKE_LIBRARY_OUTPUT_DIRECTORY:PATH=${CMAKE_LIBRARY_OUTPUT_DIRECTORY} -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY:PATH=${CMAKE_ARCHIVE_OUTPUT_DIRECTORY} + -DCMAKE_PDB_OUTPUT_DIRECTORY:PATH=${CMAKE_PDB_OUTPUT_DIRECTORY} -DCMAKE_ANSI_CFLAGS:STRING=${jpeg_pic} ) elseif (${compress_type} MATCHES "TGZ") @@ -49,9 +51,10 @@ macro (EXTERNAL_JPEG_LIBRARY compress_type jpeg_pic) -DCMAKE_RUNTIME_OUTPUT_DIRECTORY:PATH=${CMAKE_RUNTIME_OUTPUT_DIRECTORY} -DCMAKE_LIBRARY_OUTPUT_DIRECTORY:PATH=${CMAKE_LIBRARY_OUTPUT_DIRECTORY} -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY:PATH=${CMAKE_ARCHIVE_OUTPUT_DIRECTORY} + -DCMAKE_PDB_OUTPUT_DIRECTORY:PATH=${CMAKE_PDB_OUTPUT_DIRECTORY} -DCMAKE_ANSI_CFLAGS:STRING=${jpeg_pic} ) - endif (${compress_type} MATCHES "SVN") + endif () externalproject_get_property (JPEG BINARY_DIR SOURCE_DIR) ##include (${BINARY_DIR}/${JPEG_PACKAGE_NAME}${HDF_PACKAGE_EXT}-targets.cmake) @@ -68,13 +71,13 @@ macro (EXTERNAL_JPEG_LIBRARY compress_type jpeg_pic) add_dependencies (JPEG jpeg-shared) set (JPEG_SHARED_LIBRARY "jpeg-shared") set (JPEG_LIBRARIES ${JPEG_LIBRARIES} ${JPEG_shared_LIBRARY}) - endif (BUILD_SHARED_LIBS) + endif () set (JPEG_INCLUDE_DIR_GEN "${BINARY_DIR}") set (JPEG_INCLUDE_DIR "${SOURCE_DIR}/src") set (JPEG_FOUND 1) set (JPEG_INCLUDE_DIRS ${JPEG_INCLUDE_DIR_GEN} ${JPEG_INCLUDE_DIR}) -endmacro (EXTERNAL_JPEG_LIBRARY) +endmacro () #------------------------------------------------------------------------------- macro (PACKAGE_JPEG_LIBRARY compress_type) @@ -85,8 +88,8 @@ macro (PACKAGE_JPEG_LIBRARY compress_type) set (EXTERNAL_HEADER_LIST ${EXTERNAL_HEADER_LIST} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/jconfig.h) if (${compress_type} MATCHES "GIT" OR ${compress_type} MATCHES "SVN" OR ${compress_type} MATCHES "TGZ") add_dependencies (JPEG-GenHeader-Copy JPEG) - endif (${compress_type} MATCHES "GIT" OR ${compress_type} MATCHES "SVN" OR ${compress_type} MATCHES "TGZ") -endmacro (PACKAGE_JPEG_LIBRARY) + endif () +endmacro () #------------------------------------------------------------------------------- macro (EXTERNAL_SZIP_LIBRARY compress_type encoding) @@ -104,6 +107,7 @@ macro (EXTERNAL_SZIP_LIBRARY compress_type encoding) -DCMAKE_RUNTIME_OUTPUT_DIRECTORY:PATH=${CMAKE_RUNTIME_OUTPUT_DIRECTORY} -DCMAKE_LIBRARY_OUTPUT_DIRECTORY:PATH=${CMAKE_LIBRARY_OUTPUT_DIRECTORY} -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY:PATH=${CMAKE_ARCHIVE_OUTPUT_DIRECTORY} + -DCMAKE_PDB_OUTPUT_DIRECTORY:PATH=${CMAKE_PDB_OUTPUT_DIRECTORY} -DCMAKE_ANSI_CFLAGS:STRING=${CMAKE_ANSI_CFLAGS} -DSZIP_ENABLE_ENCODING:BOOL=${encoding} ) @@ -121,6 +125,7 @@ macro (EXTERNAL_SZIP_LIBRARY compress_type encoding) -DCMAKE_RUNTIME_OUTPUT_DIRECTORY:PATH=${CMAKE_RUNTIME_OUTPUT_DIRECTORY} -DCMAKE_LIBRARY_OUTPUT_DIRECTORY:PATH=${CMAKE_LIBRARY_OUTPUT_DIRECTORY} -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY:PATH=${CMAKE_ARCHIVE_OUTPUT_DIRECTORY} + -DCMAKE_PDB_OUTPUT_DIRECTORY:PATH=${CMAKE_PDB_OUTPUT_DIRECTORY} -DCMAKE_ANSI_CFLAGS:STRING=${CMAKE_ANSI_CFLAGS} -DSZIP_ENABLE_ENCODING:BOOL=${encoding} ) @@ -138,10 +143,11 @@ macro (EXTERNAL_SZIP_LIBRARY compress_type encoding) -DCMAKE_RUNTIME_OUTPUT_DIRECTORY:PATH=${CMAKE_RUNTIME_OUTPUT_DIRECTORY} -DCMAKE_LIBRARY_OUTPUT_DIRECTORY:PATH=${CMAKE_LIBRARY_OUTPUT_DIRECTORY} -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY:PATH=${CMAKE_ARCHIVE_OUTPUT_DIRECTORY} + -DCMAKE_PDB_OUTPUT_DIRECTORY:PATH=${CMAKE_PDB_OUTPUT_DIRECTORY} -DCMAKE_ANSI_CFLAGS:STRING=${CMAKE_ANSI_CFLAGS} -DSZIP_ENABLE_ENCODING:BOOL=${encoding} ) - endif (${compress_type} MATCHES "SVN") + endif () externalproject_get_property (SZIP BINARY_DIR SOURCE_DIR) ##include (${BINARY_DIR}/${SZIP_PACKAGE_NAME}${HDF_PACKAGE_EXT}-targets.cmake) @@ -158,13 +164,13 @@ macro (EXTERNAL_SZIP_LIBRARY compress_type encoding) add_dependencies (SZIP szip-shared) set (SZIP_SHARED_LIBRARY "szip-shared") set (SZIP_LIBRARIES ${SZIP_LIBRARIES} ${SZIP_shared_LIBRARY}) - endif (BUILD_SHARED_LIBS) + endif () set (SZIP_INCLUDE_DIR_GEN "${BINARY_DIR}") set (SZIP_INCLUDE_DIR "${SOURCE_DIR}/src") set (SZIP_FOUND 1) set (SZIP_INCLUDE_DIRS ${SZIP_INCLUDE_DIR_GEN} ${SZIP_INCLUDE_DIR}) -endmacro (EXTERNAL_SZIP_LIBRARY) +endmacro () #------------------------------------------------------------------------------- macro (PACKAGE_SZIP_LIBRARY compress_type) @@ -175,8 +181,8 @@ macro (PACKAGE_SZIP_LIBRARY compress_type) set (EXTERNAL_HEADER_LIST ${EXTERNAL_HEADER_LIST} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/SZconfig.h) if (${compress_type} MATCHES "GIT" OR ${compress_type} MATCHES "SVN" OR ${compress_type} MATCHES "TGZ") add_dependencies (SZIP-GenHeader-Copy SZIP) - endif (${compress_type} MATCHES "GIT" OR ${compress_type} MATCHES "SVN" OR ${compress_type} MATCHES "TGZ") -endmacro (PACKAGE_SZIP_LIBRARY) + endif () +endmacro () #------------------------------------------------------------------------------- macro (EXTERNAL_ZLIB_LIBRARY compress_type) @@ -194,6 +200,7 @@ macro (EXTERNAL_ZLIB_LIBRARY compress_type) -DCMAKE_RUNTIME_OUTPUT_DIRECTORY:PATH=${CMAKE_RUNTIME_OUTPUT_DIRECTORY} -DCMAKE_LIBRARY_OUTPUT_DIRECTORY:PATH=${CMAKE_LIBRARY_OUTPUT_DIRECTORY} -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY:PATH=${CMAKE_ARCHIVE_OUTPUT_DIRECTORY} + -DCMAKE_PDB_OUTPUT_DIRECTORY:PATH=${CMAKE_PDB_OUTPUT_DIRECTORY} -DCMAKE_ANSI_CFLAGS:STRING=${CMAKE_ANSI_CFLAGS} ) elseif (${compress_type} MATCHES "GIT") @@ -210,6 +217,7 @@ macro (EXTERNAL_ZLIB_LIBRARY compress_type) -DCMAKE_RUNTIME_OUTPUT_DIRECTORY:PATH=${CMAKE_RUNTIME_OUTPUT_DIRECTORY} -DCMAKE_LIBRARY_OUTPUT_DIRECTORY:PATH=${CMAKE_LIBRARY_OUTPUT_DIRECTORY} -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY:PATH=${CMAKE_ARCHIVE_OUTPUT_DIRECTORY} + -DCMAKE_PDB_OUTPUT_DIRECTORY:PATH=${CMAKE_PDB_OUTPUT_DIRECTORY} -DCMAKE_ANSI_CFLAGS:STRING=${CMAKE_ANSI_CFLAGS} ) elseif (${compress_type} MATCHES "TGZ") @@ -226,16 +234,17 @@ macro (EXTERNAL_ZLIB_LIBRARY compress_type) -DCMAKE_RUNTIME_OUTPUT_DIRECTORY:PATH=${CMAKE_RUNTIME_OUTPUT_DIRECTORY} -DCMAKE_LIBRARY_OUTPUT_DIRECTORY:PATH=${CMAKE_LIBRARY_OUTPUT_DIRECTORY} -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY:PATH=${CMAKE_ARCHIVE_OUTPUT_DIRECTORY} + -DCMAKE_PDB_OUTPUT_DIRECTORY:PATH=${CMAKE_PDB_OUTPUT_DIRECTORY} -DCMAKE_ANSI_CFLAGS:STRING=${CMAKE_ANSI_CFLAGS} ) - endif (${compress_type} MATCHES "SVN") + endif () externalproject_get_property (ZLIB BINARY_DIR SOURCE_DIR) if (WIN32) set (ZLIB_LIB_NAME "zlib") - else (WIN32) + else () set (ZLIB_LIB_NAME "z") - endif (WIN32) + endif () ##include (${BINARY_DIR}/${ZLIB_PACKAGE_NAME}${HDF_PACKAGE_EXT}-targets.cmake) # Create imported target zlib-static add_library(zlib-static STATIC IMPORTED) @@ -250,13 +259,13 @@ macro (EXTERNAL_ZLIB_LIBRARY compress_type) add_dependencies (ZLIB zlib-shared) set (ZLIB_SHARED_LIBRARY "zlib-shared") set (ZLIB_LIBRARIES ${ZLIB_LIBRARIES} ${ZLIB_SHARED_LIBRARY}) - endif (BUILD_SHARED_LIBS) + endif () set (ZLIB_INCLUDE_DIR_GEN "${BINARY_DIR}") set (ZLIB_INCLUDE_DIR "${SOURCE_DIR}") set (ZLIB_FOUND 1) set (ZLIB_INCLUDE_DIRS ${ZLIB_INCLUDE_DIR_GEN} ${ZLIB_INCLUDE_DIR}) -endmacro (EXTERNAL_ZLIB_LIBRARY) +endmacro () #------------------------------------------------------------------------------- macro (PACKAGE_ZLIB_LIBRARY compress_type) @@ -267,5 +276,5 @@ macro (PACKAGE_ZLIB_LIBRARY compress_type) set (EXTERNAL_HEADER_LIST ${EXTERNAL_HEADER_LIST} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/zconf.h) if (${compress_type} MATCHES "GIT" OR ${compress_type} MATCHES "SVN" OR ${compress_type} MATCHES "TGZ") add_dependencies (ZLIB-GenHeader-Copy ZLIB) - endif (${compress_type} MATCHES "GIT" OR ${compress_type} MATCHES "SVN" OR ${compress_type} MATCHES "TGZ") -endmacro (PACKAGE_ZLIB_LIBRARY) + endif () +endmacro () diff --git a/config/cmake_ext_mod/HDFMacros.cmake b/config/cmake_ext_mod/HDFMacros.cmake index 1d6b49a..ecf3be0 100644 --- a/config/cmake_ext_mod/HDFMacros.cmake +++ b/config/cmake_ext_mod/HDFMacros.cmake @@ -1,7 +1,7 @@ #------------------------------------------------------------------------------- macro (SET_GLOBAL_VARIABLE name value) set (${name} ${value} CACHE INTERNAL "Used to pass variables between directories" FORCE) -endmacro (SET_GLOBAL_VARIABLE) +endmacro () #------------------------------------------------------------------------------- macro (IDE_GENERATED_PROPERTIES SOURCE_PATH HEADERS SOURCES) @@ -14,7 +14,7 @@ macro (IDE_GENERATED_PROPERTIES SOURCE_PATH HEADERS SOURCES) #set_property (SOURCE ${HEADERS} # PROPERTY MACOSX_PACKAGE_LOCATION Headers/${NAME} #) -endmacro (IDE_GENERATED_PROPERTIES) +endmacro () #------------------------------------------------------------------------------- macro (IDE_SOURCE_PROPERTIES SOURCE_PATH HEADERS SOURCES) @@ -31,45 +31,49 @@ macro (IDE_SOURCE_PROPERTIES SOURCE_PATH HEADERS SOURCES) #set_property (SOURCE ${HEADERS} # PROPERTY MACOSX_PACKAGE_LOCATION Headers/${NAME} #) -endmacro (IDE_SOURCE_PROPERTIES) +endmacro () #------------------------------------------------------------------------------- macro (TARGET_NAMING libtarget libtype) if (${libtype} MATCHES "SHARED") set_target_properties (${libtarget} PROPERTIES OUTPUT_NAME "${libtarget}${ARGN}") - endif (${libtype} MATCHES "SHARED") -endmacro (TARGET_NAMING) + endif () +endmacro () #------------------------------------------------------------------------------- macro (INSTALL_TARGET_PDB libtarget targetdestination targetcomponent) if (WIN32 AND MSVC) - get_target_property (target_name ${libtarget} OUTPUT_NAME_RELWITHDEBINFO) + get_target_property (target_type ${libtarget} TYPE) + if (${libtype} MATCHES "SHARED") + set (targetfilename $) + else () + get_property (target_name TARGET ${libtarget} PROPERTY OUTPUT_NAME_RELWITHDEBINFO) + set (targetfilename $/${target_name}.pdb) + endif () install ( FILES - ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_BUILD_TYPE}/${CMAKE_IMPORT_LIBRARY_PREFIX}${target_name}.pdb + ${targetfilename} DESTINATION ${targetdestination} CONFIGURATIONS RelWithDebInfo COMPONENT ${targetcomponent} ) - endif (WIN32 AND MSVC) -endmacro (INSTALL_TARGET_PDB) + endif () +endmacro () #------------------------------------------------------------------------------- macro (INSTALL_PROGRAM_PDB progtarget targetdestination targetcomponent) if (WIN32 AND MSVC) - get_target_property (target_name ${progtarget} OUTPUT_NAME_RELWITHDEBINFO) - get_target_property (target_prefix ${progtarget} PREFIX) install ( FILES - ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_BUILD_TYPE}/${target_prefix}${target_name}.pdb + $ DESTINATION ${targetdestination} CONFIGURATIONS RelWithDebInfo COMPONENT ${targetcomponent} ) - endif (WIN32 AND MSVC) -endmacro (INSTALL_PROGRAM_PDB) + endif () +endmacro () #------------------------------------------------------------------------------- macro (HDF_SET_LIB_OPTIONS libtarget libname libtype) @@ -77,19 +81,19 @@ macro (HDF_SET_LIB_OPTIONS libtarget libname libtype) if (WIN32) set (LIB_RELEASE_NAME "${libname}") set (LIB_DEBUG_NAME "${libname}_D") - else (WIN32) + else () set (LIB_RELEASE_NAME "${libname}") set (LIB_DEBUG_NAME "${libname}_debug") - endif (WIN32) - else (${libtype} MATCHES "SHARED") + endif () + else () if (WIN32) set (LIB_RELEASE_NAME "lib${libname}") set (LIB_DEBUG_NAME "lib${libname}_D") - else (WIN32) + else () set (LIB_RELEASE_NAME "${libname}") set (LIB_DEBUG_NAME "${libname}_debug") - endif (WIN32) - endif (${libtype} MATCHES "SHARED") + endif () + endif () set_target_properties (${libtarget} PROPERTIES @@ -98,6 +102,18 @@ macro (HDF_SET_LIB_OPTIONS libtarget libname libtype) OUTPUT_NAME_MINSIZEREL ${LIB_RELEASE_NAME} OUTPUT_NAME_RELWITHDEBINFO ${LIB_RELEASE_NAME} ) + if (${libtype} MATCHES "STATIC") + if (WIN32) + set_target_properties (${libtarget} + PROPERTIES + COMPILE_PDB_NAME_DEBUG ${LIB_DEBUG_NAME} + COMPILE_PDB_NAME_RELEASE ${LIB_RELEASE_NAME} + COMPILE_PDB_NAME_MINSIZEREL ${LIB_RELEASE_NAME} + COMPILE_PDB_NAME_RELWITHDEBINFO ${LIB_RELEASE_NAME} + COMPILE_PDB_OUTPUT_DIRECTORY "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}" + ) + endif () + endif () #----- Use MSVC Naming conventions for Shared Libraries if (MINGW AND ${libtype} MATCHES "SHARED") @@ -107,9 +123,8 @@ macro (HDF_SET_LIB_OPTIONS libtarget libname libtype) IMPORT_PREFIX "" PREFIX "" ) - endif (MINGW AND ${libtype} MATCHES "SHARED") - -endmacro (HDF_SET_LIB_OPTIONS) + endif () +endmacro () #------------------------------------------------------------------------------- macro (HDF_IMPORT_SET_LIB_OPTIONS libtarget libname libtype libversion) @@ -117,12 +132,12 @@ macro (HDF_IMPORT_SET_LIB_OPTIONS libtarget libname libtype libversion) if (${importtype} MATCHES "IMPORT") set (importprefix "${CMAKE_STATIC_LIBRARY_PREFIX}") - endif (${importtype} MATCHES "IMPORT") + endif () if (${CMAKE_BUILD_TYPE} MATCHES "Debug") set (IMPORT_LIB_NAME ${LIB_DEBUG_NAME}) - else (${CMAKE_BUILD_TYPE} MATCHES "Debug") + else () set (IMPORT_LIB_NAME ${LIB_RELEASE_NAME}) - endif (${CMAKE_BUILD_TYPE} MATCHES "Debug") + endif () if (${libtype} MATCHES "SHARED") if (WIN32) @@ -131,91 +146,74 @@ macro (HDF_IMPORT_SET_LIB_OPTIONS libtarget libname libtype libversion) IMPORTED_IMPLIB "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${IMPORT_LIB_NAME}.lib" IMPORTED_LOCATION "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${IMPORT_LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}" ) - else (MINGW) + else () set_target_properties (${libtarget} PROPERTIES IMPORTED_IMPLIB "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_BUILD_TYPE}/${CMAKE_IMPORT_LIBRARY_PREFIX}${IMPORT_LIB_NAME}${CMAKE_IMPORT_LIBRARY_SUFFIX}" IMPORTED_LOCATION "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_BUILD_TYPE}/${CMAKE_IMPORT_LIBRARY_PREFIX}${IMPORT_LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}" - ) - endif (MINGW) - else (WIN32) + ) + endif () + else () if (CYGWIN) set_target_properties (${libtarget} PROPERTIES IMPORTED_IMPLIB "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_IMPORT_LIBRARY_PREFIX}${IMPORT_LIB_NAME}${CMAKE_IMPORT_LIBRARY_SUFFIX}" IMPORTED_LOCATION "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_IMPORT_LIBRARY_PREFIX}${IMPORT_LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}" ) - else (CYGWIN) + else () set_target_properties (${libtarget} PROPERTIES IMPORTED_LOCATION "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_SHARED_LIBRARY_PREFIX}${IMPORT_LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}" IMPORTED_SONAME "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_SHARED_LIBRARY_PREFIX}${IMPORT_LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}.${libversion}" SOVERSION "${libversion}" ) - endif (CYGWIN) - endif (WIN32) - else (${libtype} MATCHES "SHARED") + endif () + endif () + else () if (WIN32 AND NOT MINGW) set_target_properties (${libtarget} PROPERTIES IMPORTED_LOCATION "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_BUILD_TYPE}/${IMPORT_LIB_NAME}${CMAKE_STATIC_LIBRARY_SUFFIX}" IMPORTED_LINK_INTERFACE_LANGUAGES "C" ) - else (WIN32 AND NOT MINGW) + else () set_target_properties (${libtarget} PROPERTIES IMPORTED_LOCATION "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_STATIC_LIBRARY_PREFIX}${IMPORT_LIB_NAME}${CMAKE_STATIC_LIBRARY_SUFFIX}" IMPORTED_LINK_INTERFACE_LANGUAGES "C" ) - endif (WIN32 AND NOT MINGW) - endif (${libtype} MATCHES "SHARED") - -endmacro (HDF_IMPORT_SET_LIB_OPTIONS) + endif () + endif () +endmacro () #------------------------------------------------------------------------------- macro (TARGET_C_PROPERTIES wintarget libtype addcompileflags addlinkflags) if (MSVC) TARGET_MSVC_PROPERTIES (${wintarget} ${libtype} "${addcompileflags} ${WIN_COMPILE_FLAGS}" "${addlinkflags} ${WIN_LINK_FLAGS}") - else (MSVC) - set_target_properties (${wintarget} - PROPERTIES - COMPILE_FLAGS "${addcompileflags}" - LINK_FLAGS "${addlinkflags}" - ) - endif (MSVC) -endmacro (TARGET_C_PROPERTIES) + else () + set_target_properties (${wintarget} PROPERTIES COMPILE_FLAGS "${addcompileflags}" LINK_FLAGS "${addlinkflags}") + endif () +endmacro () #------------------------------------------------------------------------------- macro (TARGET_MSVC_PROPERTIES wintarget libtype addcompileflags addlinkflags) if (MSVC) - set_target_properties (${wintarget} - PROPERTIES - COMPILE_FLAGS "${addcompileflags}" - LINK_FLAGS "${addlinkflags}" - ) - endif (MSVC) -endmacro (TARGET_MSVC_PROPERTIES) + set_target_properties (${wintarget} PROPERTIES COMPILE_FLAGS "${addcompileflags}" LINK_FLAGS "${addlinkflags}") + endif () +endmacro () #------------------------------------------------------------------------------- macro (TARGET_FORTRAN_PROPERTIES forttarget libtype addcompileflags addlinkflags) if (WIN32) TARGET_FORTRAN_WIN_PROPERTIES (${forttarget} ${libtype} "${addcompileflags} ${WIN_COMPILE_FLAGS}" "${addlinkflags} ${WIN_LINK_FLAGS}") - endif (WIN32) -endmacro (TARGET_FORTRAN_PROPERTIES) + endif () +endmacro () #------------------------------------------------------------------------------- macro (TARGET_FORTRAN_WIN_PROPERTIES forttarget libtype addcompileflags addlinkflags) if (MSVC) if (${libtype} MATCHES "SHARED") - set_target_properties (${forttarget} - PROPERTIES - COMPILE_FLAGS "/dll ${addcompileflags}" - LINK_FLAGS "/SUBSYSTEM:CONSOLE ${addlinkflags}" - ) - else (${libtype} MATCHES "SHARED") - set_target_properties (${forttarget} - PROPERTIES - COMPILE_FLAGS "${addcompileflags}" - LINK_FLAGS "/SUBSYSTEM:CONSOLE ${addlinkflags}" - ) - endif (${libtype} MATCHES "SHARED") - endif (MSVC) -endmacro (TARGET_FORTRAN_WIN_PROPERTIES) + set_target_properties (${forttarget} PROPERTIES COMPILE_FLAGS "/dll ${addcompileflags}" LINK_FLAGS "/SUBSYSTEM:CONSOLE ${addlinkflags}") + else () + set_target_properties (${forttarget} PROPERTIES COMPILE_FLAGS "${addcompileflags}" LINK_FLAGS "/SUBSYSTEM:CONSOLE ${addlinkflags}") + endif () + endif () +endmacro () #----------------------------------------------------------------------------- # Configure the README.txt file for the binary package @@ -228,16 +226,16 @@ macro (HDF_README_PROPERTIES target_fortran) set (BINARY_INSTALL_ENDING "msi") if (CMAKE_CL_64) set (BINARY_SYSTEM_NAME "win64") - else (CMAKE_CL_64) + else () set (BINARY_SYSTEM_NAME "win32") - endif (CMAKE_CL_64) + endif () if (${CMAKE_SYSTEM_VERSION} MATCHES "6.1") set (BINARY_PLATFORM "${BINARY_PLATFORM} 7") elseif (${CMAKE_SYSTEM_VERSION} MATCHES "6.2") set (BINARY_PLATFORM "${BINARY_PLATFORM} 8") elseif (${CMAKE_SYSTEM_VERSION} MATCHES "6.3") set (BINARY_PLATFORM "${BINARY_PLATFORM} 10") - endif (${CMAKE_SYSTEM_VERSION} MATCHES "6.1") + endif () set (BINARY_PLATFORM "${BINARY_PLATFORM} ${MSVC_C_ARCHITECTURE_ID}") if (${CMAKE_C_COMPILER_VERSION} MATCHES "16.*") set (BINARY_PLATFORM "${BINARY_PLATFORM}, using VISUAL STUDIO 2010") @@ -249,36 +247,36 @@ macro (HDF_README_PROPERTIES target_fortran) set (BINARY_PLATFORM "${BINARY_PLATFORM}, using VISUAL STUDIO 2013") elseif (${CMAKE_C_COMPILER_VERSION} MATCHES "19.*") set (BINARY_PLATFORM "${BINARY_PLATFORM}, using VISUAL STUDIO 2015") - else (${CMAKE_C_COMPILER_VERSION} MATCHES "16.*") + else () set (BINARY_PLATFORM "${BINARY_PLATFORM}, using VISUAL STUDIO ${CMAKE_C_COMPILER_VERSION}") - endif (${CMAKE_C_COMPILER_VERSION} MATCHES "16.*") + endif () elseif (APPLE) set (BINARY_EXAMPLE_ENDING "tar.gz") set (BINARY_INSTALL_ENDING "dmg") set (BINARY_PLATFORM "${BINARY_PLATFORM} ${CMAKE_SYSTEM_VERSION} ${CMAKE_SYSTEM_PROCESSOR}") set (BINARY_PLATFORM "${BINARY_PLATFORM}, using ${CMAKE_C_COMPILER_ID} C ${CMAKE_C_COMPILER_VERSION}") - else (WIN32) + else () set (BINARY_EXAMPLE_ENDING "tar.gz") set (BINARY_INSTALL_ENDING "sh") set (BINARY_PLATFORM "${BINARY_PLATFORM} ${CMAKE_SYSTEM_VERSION} ${CMAKE_SYSTEM_PROCESSOR}") set (BINARY_PLATFORM "${BINARY_PLATFORM}, using ${CMAKE_C_COMPILER_ID} C ${CMAKE_C_COMPILER_VERSION}") - endif (WIN32) + endif () if (target_fortran) set (BINARY_PLATFORM "${BINARY_PLATFORM} / ${CMAKE_Fortran_COMPILER_ID} Fortran") - endif (target_fortran) + endif () if (BUILD_SHARED_LIBS) set (LIB_TYPE "Static and Shared") - else (BUILD_SHARED_LIBS) + else () set (LIB_TYPE "Static") - endif (BUILD_SHARED_LIBS) + endif () configure_file ( ${HDF_RESOURCES_DIR}/README.txt.cmake.in ${CMAKE_BINARY_DIR}/README.txt @ONLY ) -endmacro (HDF_README_PROPERTIES) +endmacro () macro (HDFTEST_COPY_FILE src dest target) add_custom_command( diff --git a/config/cmake_ext_mod/HDFUseFortran.cmake b/config/cmake_ext_mod/HDFUseFortran.cmake index 275f2ea..bf254a1 100644 --- a/config/cmake_ext_mod/HDFUseFortran.cmake +++ b/config/cmake_ext_mod/HDFUseFortran.cmake @@ -26,14 +26,14 @@ set (H5_FC_FUNC_ "H5_FC_FUNC_(name,NAME) ${CMAKE_MATCH_1}") # The provided CMake Fortran macros don't provide a general check function # so this one is used for a sizeof test. #----------------------------------------------------------------------------- -MACRO (CHECK_FORTRAN_FEATURE FUNCTION CODE VARIABLE) +macro (CHECK_FORTRAN_FEATURE FUNCTION CODE VARIABLE) message (STATUS "Testing Fortran ${FUNCTION}") if (CMAKE_REQUIRED_LIBRARIES) set (CHECK_FUNCTION_EXISTS_ADD_LIBRARIES "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}") - else (CMAKE_REQUIRED_LIBRARIES) + else () set (CHECK_FUNCTION_EXISTS_ADD_LIBRARIES) - endif (CMAKE_REQUIRED_LIBRARIES) + endif () file (WRITE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testFortranCompiler.f90 "${CODE}" @@ -63,8 +63,7 @@ MACRO (CHECK_FORTRAN_FEATURE FUNCTION CODE VARIABLE) "Determining if the Fortran ${FUNCTION} exists failed with the following output:\n" "${OUTPUT}\n\n") endif () - -ENDMACRO (CHECK_FORTRAN_FEATURE) +endmacro () #----------------------------------------------------------------------------- # Configure Checks which require Fortran compilation must go in here @@ -75,7 +74,7 @@ ENDMACRO (CHECK_FORTRAN_FEATURE) #----------------------------------------------------------------------------- # Check for Non-standard extension intrinsic function SIZEOF -set(FORTRAN_HAVE_SIZEOF FALSE) +set (FORTRAN_HAVE_SIZEOF FALSE) CHECK_FORTRAN_FEATURE(sizeof " PROGRAM main @@ -86,7 +85,7 @@ CHECK_FORTRAN_FEATURE(sizeof ) # Check for F2008 standard intrinsic function C_SIZEOF -set(FORTRAN_HAVE_C_SIZEOF FALSE) +set (FORTRAN_HAVE_C_SIZEOF FALSE) CHECK_FORTRAN_FEATURE(c_sizeof " PROGRAM main @@ -112,7 +111,7 @@ CHECK_FORTRAN_FEATURE(storage_size ) # Check for F2008 standard intrinsic module "ISO_FORTRAN_ENV" -set(HAVE_ISO_FORTRAN_ENV FALSE) +set (HAVE_ISO_FORTRAN_ENV FALSE) CHECK_FORTRAN_FEATURE(ISO_FORTRAN_ENV " PROGRAM main @@ -122,7 +121,7 @@ CHECK_FORTRAN_FEATURE(ISO_FORTRAN_ENV HAVE_ISO_FORTRAN_ENV ) -set(FORTRAN_DEFAULT_REAL_NOT_DOUBLE FALSE) +set (FORTRAN_DEFAULT_REAL_NOT_DOUBLE FALSE) CHECK_FORTRAN_FEATURE(RealIsNotDouble " MODULE type_mod @@ -152,7 +151,7 @@ CHECK_FORTRAN_FEATURE(RealIsNotDouble #----------------------------------------------------------------------------- # Checks if the ISO_C_BINDING module meets all the requirements #----------------------------------------------------------------------------- -set(FORTRAN_HAVE_ISO_C_BINDING FALSE) +set (FORTRAN_HAVE_ISO_C_BINDING FALSE) CHECK_FORTRAN_FEATURE(iso_c_binding " PROGRAM main @@ -175,5 +174,5 @@ if (CMAKE_Fortran_COMPILER MATCHES ifort) if (WIN32) set (CMAKE_Fortran_FLAGS_DEBUG "/debug:full /dbglibs " CACHE "flags" STRING FORCE) set (CMAKE_EXE_LINKER_FLAGS_DEBUG "/DEBUG" CACHE "flags" STRING FORCE) - endif (WIN32) -endif (CMAKE_Fortran_COMPILER MATCHES ifort) + endif () +endif () diff --git a/config/cmake_ext_mod/grepTest.cmake b/config/cmake_ext_mod/grepTest.cmake index a090057..31c8421 100644 --- a/config/cmake_ext_mod/grepTest.cmake +++ b/config/cmake_ext_mod/grepTest.cmake @@ -4,25 +4,25 @@ # arguments checking if (NOT TEST_PROGRAM) message (FATAL_ERROR "Require TEST_PROGRAM to be defined") -endif (NOT TEST_PROGRAM) +endif () #if (NOT TEST_ARGS) # message (STATUS "Require TEST_ARGS to be defined") -#endif (NOT TEST_ARGS) +#endif () if (NOT TEST_FOLDER) message ( FATAL_ERROR "Require TEST_FOLDER to be defined") -endif (NOT TEST_FOLDER) +endif () if (NOT TEST_OUTPUT) message (FATAL_ERROR "Require TEST_OUTPUT to be defined") -endif (NOT TEST_OUTPUT) +endif () #if (NOT TEST_EXPECT) # message (STATUS "Require TEST_EXPECT to be defined") -#endif (NOT TEST_EXPECT) +#endif () if (NOT TEST_FILTER) message (STATUS "Require TEST_FILTER to be defined") -endif (NOT TEST_FILTER) +endif () if (NOT TEST_REFERENCE) message (FATAL_ERROR "Require TEST_REFERENCE to be defined") -endif (NOT TEST_REFERENCE) +endif () message (STATUS "COMMAND: ${TEST_PROGRAM} ${TEST_ARGS}") @@ -48,7 +48,7 @@ string (REGEX MATCH "${TEST_REFERENCE}" TEST_MATCH ${TEST_STREAM}) string (COMPARE EQUAL "${TEST_REFERENCE}" "${TEST_MATCH}" TEST_RESULT) if (${TEST_RESULT} STREQUAL "0") message (FATAL_ERROR "Failed: The output of ${TEST_PROGRAM} did not contain ${TEST_REFERENCE}") -endif (${TEST_RESULT} STREQUAL "0") +endif () string (REGEX MATCH "${TEST_FILTER}" TEST_MATCH ${TEST_STREAM}) if (${TEST_EXPECT} STREQUAL "1") @@ -56,8 +56,8 @@ if (${TEST_EXPECT} STREQUAL "1") string (LENGTH "${TEST_MATCH}" TEST_RESULT) if (NOT ${TEST_RESULT} STREQUAL "0") message (FATAL_ERROR "Failed: The output of ${TEST_PROGRAM} did contain ${TEST_FILTER}") - endif (NOT ${TEST_RESULT} STREQUAL "0") -endif (${TEST_EXPECT} STREQUAL "1") + endif () +endif () # everything went fine... message ("Passed: The output of ${TEST_PROGRAM} matched") diff --git a/config/cmake_ext_mod/prunTest.cmake b/config/cmake_ext_mod/prunTest.cmake deleted file mode 100644 index 38ecb7e..0000000 --- a/config/cmake_ext_mod/prunTest.cmake +++ /dev/null @@ -1,145 +0,0 @@ -# runTest.cmake executes a command and captures the output in a file. File is then compared -# against a reference file. Exit status of command can also be compared. -cmake_policy(SET CMP0007 NEW) - -# arguments checking -if (NOT TEST_PROGRAM) - message (FATAL_ERROR "Require TEST_PROGRAM to be defined") -endif (NOT TEST_PROGRAM) -#if (NOT TEST_ARGS) -# message (STATUS "Require TEST_ARGS to be defined") -#endif (NOT TEST_ARGS) -if (NOT TEST_FOLDER) - message ( FATAL_ERROR "Require TEST_FOLDER to be defined") -endif (NOT TEST_FOLDER) -if (NOT TEST_OUTPUT) - message (FATAL_ERROR "Require TEST_OUTPUT to be defined") -endif (NOT TEST_OUTPUT) -#if (NOT TEST_EXPECT) -# message (STATUS "Require TEST_EXPECT to be defined") -#endif (NOT TEST_EXPECT) -#if (NOT TEST_FILTER) -# message (STATUS "Require TEST_FILTER to be defined") -#endif (NOT TEST_FILTER) -if (NOT TEST_SKIP_COMPARE AND NOT TEST_REFERENCE) - message (FATAL_ERROR "Require TEST_REFERENCE to be defined") -endif (NOT TEST_SKIP_COMPARE AND NOT TEST_REFERENCE) - -set (ERROR_APPEND 1) - -message (STATUS "COMMAND: ${TEST_PROGRAM} ${TEST_ARGS}") - -if (TEST_ENV_VAR) - set (ENV{${TEST_ENV_VAR}} "${TEST_ENV_VALUE}") -endif (TEST_ENV_VAR) - -# run the test program, capture the stdout/stderr and the result var -EXECUTE_PROCESS ( - COMMAND ${TEST_PROGRAM} ${TEST_ARGS} - WORKING_DIRECTORY ${TEST_FOLDER} - RESULT_VARIABLE TEST_RESULT - OUTPUT_FILE ${TEST_OUTPUT} - ERROR_FILE ${TEST_OUTPUT}.err - OUTPUT_VARIABLE TEST_OUT - ERROR_VARIABLE TEST_ERROR -) - -message (STATUS "COMMAND Result: ${TEST_RESULT}") - -file (READ ${TEST_FOLDER}/${TEST_REFERENCE} TEST_STREAM) -file (WRITE ${TEST_FOLDER}/P_${TEST_REFERENCE} "${TEST_STREAM}") - -if (ERROR_APPEND AND EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}.err) - file (READ ${TEST_FOLDER}/${TEST_OUTPUT}.err TEST_STREAM) - file (APPEND ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_STREAM}") -endif (ERROR_APPEND AND EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}.err) - -if (TEST_APPEND) - file (APPEND ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_APPEND} ${TEST_ERROR}\n") -endif (TEST_APPEND) - -message (STATUS "COMMAND Error: ${TEST_ERROR}") - -if (TEST_MASK) - file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM) - STRING(REGEX REPLACE "Storage:[^\n]+\n" "Storage:
\n" TEST_STREAM "${TEST_STREAM}") - file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_STREAM}") -endif (TEST_MASK) - -if (TEST_MASK_MOD) - file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM) - STRING(REGEX REPLACE "Modified:[^\n]+\n" "Modified: XXXX-XX-XX XX:XX:XX XXX\n" TEST_STREAM "${TEST_STREAM}") - file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_STREAM}") -endif (TEST_MASK_MOD) - -if (TEST_MASK_ERROR) - file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM) - STRING(REGEX REPLACE "thread [0-9]*:" "thread (IDs):" TEST_STREAM "${TEST_STREAM}") - STRING(REGEX REPLACE ": ([^\n]*)[.]c " ": (file name) " TEST_STREAM "${TEST_STREAM}") - STRING(REGEX REPLACE " line [0-9]*" " line (number)" TEST_STREAM "${TEST_STREAM}") - STRING(REGEX REPLACE "v[1-9]*[.][0-9]*[.]" "version (number)." TEST_STREAM "${TEST_STREAM}") - STRING(REGEX REPLACE "[1-9]*[.][0-9]*[.][0-9]*[^)]*" "version (number)" TEST_STREAM "${TEST_STREAM}") - STRING(REGEX REPLACE "H5Eget_auto[1-2]*" "H5Eget_auto(1 or 2)" TEST_STREAM "${TEST_STREAM}") - STRING(REGEX REPLACE "H5Eset_auto[1-2]*" "H5Eset_auto(1 or 2)" TEST_STREAM "${TEST_STREAM}") - file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_STREAM}") -endif (TEST_MASK_ERROR) - -if (TEST_FILTER) - file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM) - STRING(REGEX REPLACE "${TEST_FILTER}" "" TEST_STREAM "${TEST_STREAM}") - file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_STREAM}") -endif (TEST_FILTER) - -#if (TEST_REF_FILTER) -# message (STATUS "TEST_REF_FILTER: ${TEST_APPEND}${TEST_REF_FILTER}") -# file (READ ${TEST_FOLDER}/P_${TEST_REFERENCE} TEST_STREAM) -# STRING(REGEX REPLACE "${TEST_APPEND}" "${TEST_REF_FILTER}" TEST_STREAM "${TEST_STREAM}") -# file (WRITE ${TEST_FOLDER}/P_${TEST_REFERENCE} "${TEST_STREAM}") -#endif (TEST_REF_FILTER) - -if (NOT TEST_SKIP_COMPARE) - if (WIN32 AND NOT MINGW) - file (READ ${TEST_FOLDER}/P_${TEST_REFERENCE} TEST_STREAM) - file (WRITE ${TEST_FOLDER}/P_${TEST_REFERENCE} "${TEST_STREAM}") - endif (WIN32 AND NOT MINGW) - - # now compare the output with the reference - EXECUTE_PROCESS ( - COMMAND ${CMAKE_COMMAND} -E compare_files ${TEST_FOLDER}/${TEST_OUTPUT} ${TEST_FOLDER}/P_${TEST_REFERENCE} - RESULT_VARIABLE TEST_RESULT - ) - if (NOT ${TEST_RESULT} STREQUAL 0) - set (TEST_RESULT 0) - file (STRINGS ${TEST_FOLDER}/${TEST_OUTPUT} test_act) - LIST (LENGTH test_act len_act) - file (STRINGS ${TEST_FOLDER}/P_${TEST_REFERENCE} test_ref) - LIST (LENGTH test_ref len_ref) - if (NOT ${len_act} STREQUAL "0") - MATH (EXPR _FP_LEN "${len_ref} - 1") - foreach (line RANGE 0 ${_FP_LEN}) - LIST (GET test_act ${line} str_act) - LIST (GET test_ref ${line} str_ref) - if (NOT "${str_act}" STREQUAL "${str_ref}") - if (NOT "${str_act}" STREQUAL "") - set (TEST_RESULT 1) - message ("line = ${line}\n***ACTUAL: ${str_act}\n****REFER: ${str_ref}\n") - endif (NOT "${str_act}" STREQUAL "") - endif (NOT "${str_act}" STREQUAL "${str_ref}") - endforeach (line RANGE 0 ${_FP_LEN}) - endif (NOT ${len_act} STREQUAL "0") - if (NOT ${len_act} STREQUAL ${len_ref}) - set (TEST_RESULT 1) - endif (NOT ${len_act} STREQUAL ${len_ref}) - endif (NOT ${TEST_RESULT} STREQUAL 0) - - message (STATUS "COMPARE Result: ${TEST_RESULT}") - - # again, if return value is !=0 scream and shout - if (NOT ${TEST_RESULT} STREQUAL 0) - message (FATAL_ERROR "Failed: The output of ${TEST_OUTPUT} did not match P_${TEST_REFERENCE}") - endif (NOT ${TEST_RESULT} STREQUAL 0) -endif (NOT TEST_SKIP_COMPARE) - -# everything went fine... -message ("Passed: The output of ${TEST_PROGRAM} matches P_${TEST_REFERENCE}") - diff --git a/config/cmake_ext_mod/runTest.cmake b/config/cmake_ext_mod/runTest.cmake index 48e9d03..9a2236e 100644 --- a/config/cmake_ext_mod/runTest.cmake +++ b/config/cmake_ext_mod/runTest.cmake @@ -6,9 +6,6 @@ cmake_policy(SET CMP0007 NEW) if (NOT TEST_PROGRAM) message (FATAL_ERROR "Require TEST_PROGRAM to be defined") endif () -#if (NOT TEST_ARGS) -# message (STATUS "Require TEST_ARGS to be defined") -#endif () if (NOT TEST_FOLDER) message ( FATAL_ERROR "Require TEST_FOLDER to be defined") endif () @@ -18,20 +15,17 @@ endif () if (NOT TEST_EXPECT) message (STATUS "Require TEST_EXPECT to be defined") endif () -#if (NOT TEST_FILTER) -# message (STATUS "Require TEST_FILTER to be defined") -#endif () if (NOT TEST_SKIP_COMPARE AND NOT TEST_REFERENCE) message (FATAL_ERROR "Require TEST_REFERENCE to be defined") -endif (NOT TEST_SKIP_COMPARE AND NOT TEST_REFERENCE) +endif () if (EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}) file (REMOVE ${TEST_FOLDER}/${TEST_OUTPUT}) -endif (EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}) +endif () if (EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}.err) file (REMOVE ${TEST_FOLDER}/${TEST_OUTPUT}.err) -endif (EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}.err) +endif () # if there is not an error reference file add the error output to the stdout file if (NOT TEST_ERRREF) @@ -40,6 +34,14 @@ endif () message (STATUS "COMMAND: ${TEST_PROGRAM} ${TEST_ARGS}") +if (TEST_LIBRARY_DIRECTORY) + if (WIN32 AND NOT MINGW) + set (ENV{PATH} "$ENV{PATH};${TEST_LIBRARY_DIRECTORY}") + else () + set (ENV{LD_LIBRARY_PATH} "$ENV{LD_LIBRARY_PATH}:${TEST_LIBRARY_DIRECTORY}") + endif () +endif () + if (TEST_ENV_VAR) set (ENV{${TEST_ENV_VAR}} "${TEST_ENV_VALUE}") endif () @@ -69,6 +71,16 @@ else () ) endif () +if (TEST_REGEX) + # TEST_REGEX should always be matched + file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM) + string (REGEX MATCH "${TEST_REGEX}" REGEX_MATCH ${TEST_STREAM}) + string (COMPARE EQUAL "${REGEX_MATCH}" "${TEST_MATCH}" REGEX_RESULT) + if (${REGEX_RESULT} STREQUAL "0") + message (STATUS "Failed: The output of ${TEST_PROGRAM} did not contain ${TEST_MATCH}") + endif () +endif () + message (STATUS "COMMAND Result: ${TEST_RESULT}") # if the .err file exists and ERRROR_APPEND is enabled @@ -84,7 +96,13 @@ endif () # if the return value is !=${TEST_EXPECT} bail out if (NOT ${TEST_RESULT} STREQUAL ${TEST_EXPECT}) - message ( FATAL_ERROR "Failed: Test program ${TEST_PROGRAM} exited != ${TEST_EXPECT}.\n${TEST_ERROR}") + if (NOT TEST_NOERRDISPLAY) + if (EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}) + file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM) + message (STATUS "Output :\n${TEST_STREAM}") + endif () + endif () + message (FATAL_ERROR "Failed: Test program ${TEST_PROGRAM} exited != ${TEST_EXPECT}.\n${TEST_ERROR}") endif () message (STATUS "COMMAND Error: ${TEST_ERROR}") @@ -125,15 +143,22 @@ if (TEST_MASK_ERROR) else () file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT}.err "${TEST_STREAM}") endif () -endif (TEST_MASK_ERROR) +endif () # remove text from the output file if (TEST_FILTER) file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM) - string (REGEX REPLACE "${TEST_FILTER}" "" TEST_STREAM "${TEST_STREAM}") + string (REGEX REPLACE "${TEST_FILTER}" "${TEST_FILTER_REPLACE}" TEST_STREAM "${TEST_STREAM}") file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_STREAM}") endif () +if (TEST_REF_FILTER) + #message (STATUS "TEST_REF_FILTER: ${TEST_APPEND}${TEST_REF_FILTER}") + file (READ ${TEST_FOLDER}/${TEST_REFERENCE} TEST_STREAM) + STRING(REGEX REPLACE "${TEST_REF_APPEND}" "${TEST_REF_FILTER}" TEST_STREAM "${TEST_STREAM}") + file (WRITE ${TEST_FOLDER}/${TEST_REFERENCE} "${TEST_STREAM}") +endif () + # compare output files to references unless this must be skipped if (NOT TEST_SKIP_COMPARE) if (WIN32 AND NOT MINGW) @@ -141,11 +166,22 @@ if (NOT TEST_SKIP_COMPARE) file (WRITE ${TEST_FOLDER}/${TEST_REFERENCE} "${TEST_STREAM}") endif () - # now compare the output with the reference - execute_process ( - COMMAND ${CMAKE_COMMAND} -E compare_files ${TEST_FOLDER}/${TEST_OUTPUT} ${TEST_FOLDER}/${TEST_REFERENCE} - RESULT_VARIABLE TEST_RESULT - ) + if (NOT TEST_SORT_COMPARE) + # now compare the output with the reference + execute_process ( + COMMAND ${CMAKE_COMMAND} -E compare_files ${TEST_FOLDER}/${TEST_OUTPUT} ${TEST_FOLDER}/${TEST_REFERENCE} + RESULT_VARIABLE TEST_RESULT + ) + else () + file (STRINGS ${TEST_FOLDER}/${TEST_OUTPUT} v1) + file (STRINGS ${TEST_FOLDER}/${TEST_REFERENCE} v2) + list (SORT v1) + list (SORT v2) + if (NOT v1 STREQUAL v2) + set(TEST_RESULT 1) + endif () + endif () + if (NOT ${TEST_RESULT} STREQUAL 0) set (TEST_RESULT 0) file (STRINGS ${TEST_FOLDER}/${TEST_OUTPUT} test_act) @@ -175,7 +211,7 @@ if (NOT TEST_SKIP_COMPARE) if (NOT ${len_act} STREQUAL ${len_ref}) set (TEST_RESULT 1) endif () - endif (NOT ${TEST_RESULT} STREQUAL 0) + endif () message (STATUS "COMPARE Result: ${TEST_RESULT}") @@ -214,7 +250,7 @@ if (NOT TEST_SKIP_COMPARE) message ("line = ${line}\n***ACTUAL: ${str_act}\n****REFER: ${str_ref}\n") endif () endif () - endforeach (line RANGE 0 ${_FP_LEN}) + endforeach () else () if (${len_act} STREQUAL "0") message (STATUS "COMPARE Failed: ${TEST_FOLDER}/${TEST_OUTPUT}.err is empty") @@ -222,7 +258,7 @@ if (NOT TEST_SKIP_COMPARE) if (${len_ref} STREQUAL "0") message (STATUS "COMPARE Failed: ${TEST_FOLDER}/${TEST_ERRREF} is empty") endif () - endif() + endif () if (NOT ${len_act} STREQUAL ${len_ref}) set (TEST_RESULT 1) endif () @@ -234,8 +270,8 @@ if (NOT TEST_SKIP_COMPARE) if (NOT ${TEST_RESULT} STREQUAL 0) message (FATAL_ERROR "Failed: The error output of ${TEST_OUTPUT}.err did not match ${TEST_ERRREF}") endif () - endif (TEST_ERRREF) -endif (NOT TEST_SKIP_COMPARE) + endif () +endif () # everything went fine... message ("Passed: The output of ${TEST_PROGRAM} matches ${TEST_REFERENCE}") diff --git a/configure.ac b/configure.ac index 9f84b0f..2af7988 100644 --- a/configure.ac +++ b/configure.ac @@ -37,7 +37,7 @@ AC_CONFIG_MACRO_DIR([m4]) ## AM_INIT_AUTOMAKE takes a list of options that should be applied to ## every Makefile.am when automake is run. AM_INIT_AUTOMAKE([foreign subdir-objects]) -AM_SILENT_RULES([yes]) +m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) # use silent rules where available - automake 1.11 ## AM_MAINTAINER_MODE turns off "rebuild rules" that contain dependencies ## for Makefiles, configure, src/H5config.h, etc. If AM_MAINTAINER_MODE @@ -3359,11 +3359,14 @@ AC_CONFIG_FILES([src/libhdf5.settings test/Makefile test/testcheck_version.sh test/testerror.sh - test/testflushrefresh.sh + test/testflushrefresh.sh test/H5srcdir_str.h test/testlibinfo.sh test/testlinks_env.sh + test/testswmr.sh test/test_plugin.sh + test/test_usecases.sh + test/testvdsswmr.sh testpar/Makefile tools/Makefile tools/lib/Makefile @@ -3380,16 +3383,19 @@ AC_CONFIG_FILES([src/libhdf5.settings tools/src/h5stat/Makefile tools/test/Makefile tools/test/h5dump/Makefile + tools/test/h5dump/h5dump_plugin.sh tools/test/h5dump/testh5dump.sh tools/test/h5dump/testh5dumppbits.sh tools/test/h5dump/testh5dumpvds.sh tools/test/h5dump/testh5dumpxml.sh tools/test/h5ls/Makefile + tools/test/h5ls/h5ls_plugin.sh tools/test/h5ls/testh5ls.sh tools/test/h5ls/testh5lsvds.sh tools/test/h5import/Makefile tools/test/h5import/h5importtestutil.sh tools/test/h5diff/Makefile + tools/test/h5diff/h5diff_plugin.sh tools/test/h5diff/testh5diff.sh tools/test/h5diff/testph5diff.sh tools/src/h5format_convert/Makefile @@ -3403,7 +3409,7 @@ AC_CONFIG_FILES([src/libhdf5.settings tools/test/h5copy/Makefile tools/test/h5copy/testh5copy.sh tools/test/misc/Makefile - tools/test/misc/testh5clear.sh + tools/test/misc/testh5clear.sh tools/test/misc/testh5mkgrp.sh tools/test/misc/testh5repart.sh tools/test/misc/vds/Makefile @@ -3451,7 +3457,7 @@ AC_CONFIG_FILES([src/libhdf5.settings hl/tools/Makefile hl/tools/gif2h5/Makefile hl/tools/gif2h5/h52giftest.sh - hl/tools/h5watch/Makefile + hl/tools/h5watch/Makefile hl/tools/h5watch/testh5watch.sh hl/examples/Makefile hl/examples/run-hlc-ex.sh diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 8849ce7..d8eb1a2 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 3.1.0) +cmake_minimum_required (VERSION 3.2.2) PROJECT (HDF5_EXAMPLES) #----------------------------------------------------------------------------- @@ -56,8 +56,8 @@ foreach (example ${examples}) TARGET_C_PROPERTIES (${example}-shared SHARED " " " ") target_link_libraries (${example}-shared ${HDF5_LIBSH_TARGET}) set_target_properties (${example}-shared PROPERTIES FOLDER examples) - endif (BUILD_SHARED_LIBS) -endforeach (example ${examples}) + endif () +endforeach () if (H5_HAVE_PARALLEL) add_executable (ph5example ${HDF5_EXAMPLES_SOURCE_DIR}/ph5example.c) @@ -71,9 +71,9 @@ if (H5_HAVE_PARALLEL) TARGET_C_PROPERTIES (ph5example-shared SHARED " " " ") target_link_libraries (ph5example-shared ${HDF5_LIBSH_TARGET}) set_target_properties (ph5example-shared PROPERTIES FOLDER examples) - endif (BUILD_SHARED_LIBS) -endif (H5_HAVE_PARALLEL) + endif () +endif () if (BUILD_TESTING) include (CMakeTests.cmake) -endif (BUILD_TESTING) +endif () diff --git a/examples/CMakeTests.cmake b/examples/CMakeTests.cmake index 4a4728e..3412b22 100644 --- a/examples/CMakeTests.cmake +++ b/examples/CMakeTests.cmake @@ -8,19 +8,19 @@ if (BUILD_SHARED_LIBS) file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/H5EX-shared") file (MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/H5EX-shared/red ${PROJECT_BINARY_DIR}/H5EX-shared/blue ${PROJECT_BINARY_DIR}/H5EX-shared/u2w) - endif (BUILD_SHARED_LIBS) + endif () # Remove any output file left over from previous test run add_test ( NAME EXAMPLES-clear-objects COMMAND ${CMAKE_COMMAND} - -E remove + -E remove Attributes.h5 btrees_file.h5 cmprss.h5 default_file.h5 dset.h5 - extend.h5 + extend.h5 extlink_prefix_source.h5 extlink_source.h5 extlink_target.h5 @@ -62,29 +62,42 @@ ) if (NOT "${last_test}" STREQUAL "") set_tests_properties (EXAMPLES-clear-objects PROPERTIES DEPENDS ${last_test}) - endif (NOT "${last_test}" STREQUAL "") + endif () set (last_test "EXAMPLES-clear-objects") foreach (example ${examples}) - add_test (NAME EXAMPLES-${example} COMMAND $) + if (HDF5_ENABLE_USING_MEMCHECKER) + add_test (NAME EXAMPLES-${example} COMMAND $) + else () + add_test (NAME EXAMPLES-${example} COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$" + -D "TEST_ARGS:STRING=" + -D "TEST_EXPECT=0" + -D "TEST_SKIP_COMPARE=TRUE" + -D "TEST_OUTPUT=${example}.txt" + #-D "TEST_REFERENCE=${example}.out" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) + endif () if (NOT "${last_test}" STREQUAL "") set_tests_properties (EXAMPLES-${example} PROPERTIES DEPENDS ${last_test}) - endif (NOT "${last_test}" STREQUAL "") + endif () set (last_test "EXAMPLES-${example}") - endforeach (example ${examples}) + endforeach () if (BUILD_SHARED_LIBS) # Remove any output file left over from previous test run add_test ( NAME EXAMPLES-shared-clear-objects COMMAND ${CMAKE_COMMAND} - -E remove + -E remove Attributes.h5 btrees_file.h5 cmprss.h5 default_file.h5 dset.h5 - extend.h5 + extend.h5 extlink_prefix_source.h5 extlink_source.h5 extlink_target.h5 @@ -128,32 +141,71 @@ ) if (NOT "${last_test}" STREQUAL "") set_tests_properties (EXAMPLES-shared-clear-objects PROPERTIES DEPENDS ${last_test}) - endif (NOT "${last_test}" STREQUAL "") + endif () set (last_test "EXAMPLES-shared-clear-objects") foreach (example ${examples}) - add_test (NAME EXAMPLES-shared-${example} COMMAND $) + if (HDF5_ENABLE_USING_MEMCHECKER) + add_test (NAME EXAMPLES-shared-${example} COMMAND $) + else () + add_test (NAME EXAMPLES-shared-${example} COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$" + -D "TEST_ARGS:STRING=" + -D "TEST_EXPECT=0" + -D "TEST_SKIP_COMPARE=TRUE" + -D "TEST_OUTPUT=${example}.txt" + #-D "TEST_REFERENCE=${example}.out" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/H5EX-shared" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) + endif () set_tests_properties (EXAMPLES-shared-${example} PROPERTIES WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/H5EX-shared) if (NOT "${last_test}" STREQUAL "") set_tests_properties (EXAMPLES-shared-${example} PROPERTIES DEPENDS ${last_test}) - endif (NOT "${last_test}" STREQUAL "") + endif () set (last_test "EXAMPLES-shared-${example}") - endforeach (example ${examples}) - endif (BUILD_SHARED_LIBS) + endforeach () + endif () ### Windows pops up a modal permission dialog on this test if (H5_HAVE_PARALLEL AND NOT WIN32) - add_test (NAME EXAMPLES-ph5example COMMAND $) + if (HDF5_ENABLE_USING_MEMCHECKER) + add_test (NAME EXAMPLES-ph5example COMMAND $) + else () + add_test (NAME EXAMPLES-ph5example COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$" + -D "TEST_ARGS:STRING=" + -D "TEST_EXPECT=0" + -D "TEST_SKIP_COMPARE=TRUE" + -D "TEST_OUTPUT=ph5example.txt" + #-D "TEST_REFERENCE=ph5example.out" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) + endif () if (NOT "${last_test}" STREQUAL "") set_tests_properties (EXAMPLES-ph5example PROPERTIES DEPENDS ${last_test}) - endif (NOT "${last_test}" STREQUAL "") + endif () set (last_test "EXAMPLES-ph5example") if (BUILD_SHARED_LIBS) - add_test (NAME EXAMPLES-shared-ph5example COMMAND $) + if (HDF5_ENABLE_USING_MEMCHECKER) + add_test (NAME EXAMPLES-shared-ph5example COMMAND $) + else () + add_test (NAME EXAMPLES-shared-ph5example COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$" + -D "TEST_ARGS:STRING=" + -D "TEST_EXPECT=0" + -D "TEST_SKIP_COMPARE=TRUE" + -D "TEST_OUTPUT=ph5example-shared.txt" + #-D "TEST_REFERENCE=ph5example-shared.out" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/H5EX-shared" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) + endif () set_tests_properties (EXAMPLES-shared-ph5example PROPERTIES WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/H5EX-shared) if (NOT "${last_test}" STREQUAL "") set_tests_properties (EXAMPLES-shared-ph5example PROPERTIES DEPENDS ${last_test}) - endif (NOT "${last_test}" STREQUAL "") + endif () set (last_test "EXAMPLES-shared-ph5example") - endif (BUILD_SHARED_LIBS) - endif (H5_HAVE_PARALLEL AND NOT WIN32) + endif () + endif () diff --git a/fortran/CMakeLists.txt b/fortran/CMakeLists.txt index c725047..f7179cf 100644 --- a/fortran/CMakeLists.txt +++ b/fortran/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 3.1.0) +cmake_minimum_required (VERSION 3.2.2) PROJECT (HDF5_F90 C CXX Fortran) if (H5_HAVE_PARALLEL) @@ -6,8 +6,8 @@ if (H5_HAVE_PARALLEL) set (LINK_LIBS ${LINK_LIBS} ${MPI_Fortran_LIBRARIES}) if (MPI_Fortran_LINK_FLAGS) set (CMAKE_EXE_LINKER_FLAGS "${MPI_Fortran_LINK_FLAGS} ${CMAKE_EXE_LINKER_FLAGS}") - endif (MPI_Fortran_LINK_FLAGS) -endif (H5_HAVE_PARALLEL) + endif () +endif () #----------------------------------------------------------------------------- # Traverse source subdirectory @@ -19,7 +19,7 @@ add_subdirectory (${HDF5_F90_SOURCE_DIR}/src ${HDF5_F90_BINARY_DIR}/src) #----------------------------------------------------------------------------- if (HDF5_BUILD_EXAMPLES) add_subdirectory (${HDF5_F90_SOURCE_DIR}/examples ${HDF5_F90_BINARY_DIR}/examples) -endif (HDF5_BUILD_EXAMPLES) +endif () #----------------------------------------------------------------------------- # Testing @@ -28,5 +28,5 @@ if (BUILD_TESTING) add_subdirectory (${HDF5_F90_SOURCE_DIR}/test ${HDF5_F90_BINARY_DIR}/test) if (MPI_Fortran_FOUND) add_subdirectory (${HDF5_F90_SOURCE_DIR}/testpar ${HDF5_F90_BINARY_DIR}/testpar) - endif (MPI_Fortran_FOUND) -endif (BUILD_TESTING) + endif () +endif () diff --git a/fortran/examples/CMakeLists.txt b/fortran/examples/CMakeLists.txt index aad5f33..a5c3422 100644 --- a/fortran/examples/CMakeLists.txt +++ b/fortran/examples/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 3.1.0) +cmake_minimum_required (VERSION 3.2.2) PROJECT (HDF5_F90_EXAMPLES C CXX Fortran) # -------------------------------------------------------------------- # Notes: When creating examples they should be prefixed @@ -66,8 +66,8 @@ foreach (example ${examples}) FOLDER examples/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared ) - endif (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) -endforeach (example ${examples}) + endif () +endforeach () foreach (example ${F2003_examples}) add_executable (f03_ex_${example} ${HDF5_F90_EXAMPLES_SOURCE_DIR}/${example}.f90) @@ -97,8 +97,8 @@ foreach (example ${F2003_examples}) FOLDER examples/fortran03 Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared ) - endif (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) -endforeach (example ${F2003_examples}) + endif () +endforeach () if (H5_HAVE_PARALLEL AND MPI_Fortran_FOUND) add_executable (f90_ex_ph5example ${HDF5_F90_EXAMPLES_SOURCE_DIR}/ph5example.f90) @@ -130,9 +130,9 @@ if (H5_HAVE_PARALLEL AND MPI_Fortran_FOUND) FOLDER examples/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared ) - endif (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) -endif (H5_HAVE_PARALLEL AND MPI_Fortran_FOUND) + endif () +endif () if (BUILD_TESTING) include (CMakeTests.cmake) -endif (BUILD_TESTING) +endif () diff --git a/fortran/examples/CMakeTests.cmake b/fortran/examples/CMakeTests.cmake index 34230c8..5665a2f 100644 --- a/fortran/examples/CMakeTests.cmake +++ b/fortran/examples/CMakeTests.cmake @@ -28,7 +28,7 @@ ) if (NOT "${last_test}" STREQUAL "") set_tests_properties (f90_ex-clear-objects PROPERTIES DEPENDS ${last_test}) - endif (NOT "${last_test}" STREQUAL "") + endif () set (last_test "f90_ex-clear-objects") if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) add_test ( @@ -53,45 +53,97 @@ ) if (NOT "${last_test}" STREQUAL "") set_tests_properties (f90_ex-shared-clear-objects PROPERTIES DEPENDS ${last_test}) - endif (NOT "${last_test}" STREQUAL "") + endif () set (last_test "f90_ex-shared-clear-objects") - endif (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) + endif () foreach (example ${examples}) - add_test (NAME f90_ex_${example} COMMAND $) + if (HDF5_ENABLE_USING_MEMCHECKER) + add_test (NAME f90_ex_${example} COMMAND $) + else () + add_test (NAME f90_ex_${example} COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$" + -D "TEST_ARGS:STRING=" + -D "TEST_EXPECT=0" + -D "TEST_SKIP_COMPARE=TRUE" + -D "TEST_OUTPUT=f90_ex_${example}.txt" + #-D "TEST_REFERENCE=f90_ex_${example}.out" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) + endif () if (NOT "${last_test}" STREQUAL "") set_tests_properties (f90_ex_${example} PROPERTIES DEPENDS ${last_test}) - endif (NOT "${last_test}" STREQUAL "") + endif () set (last_test "f90_ex_${example}") if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) - add_test (NAME f90_ex-shared_${example} COMMAND $) + if (HDF5_ENABLE_USING_MEMCHECKER) + add_test (NAME f90_ex-shared_${example} COMMAND $) + else () + add_test (NAME f90_ex-shared_${example} COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$" + -D "TEST_ARGS:STRING=" + -D "TEST_EXPECT=0" + -D "TEST_SKIP_COMPARE=TRUE" + -D "TEST_OUTPUT=f90_ex_${example}-shared.txt" + #-D "TEST_REFERENCE=f90_ex_${example}-shared.out" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) + endif () if (NOT "${last_test}" STREQUAL "") set_tests_properties (f90_ex-shared_${example} PROPERTIES DEPENDS ${last_test}) - endif (NOT "${last_test}" STREQUAL "") + endif () set (last_test "f90_ex-shared_${example}") - endif (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) -endforeach (example ${examples}) + endif () +endforeach () if (HDF5_ENABLE_F2003) foreach (example ${F2003_examples}) - add_test (NAME f03_ex_${example} COMMAND $) + if (HDF5_ENABLE_USING_MEMCHECKER) + add_test (NAME f03_ex_${example} COMMAND $) + else () + add_test (NAME f03_ex_${example} COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$" + -D "TEST_ARGS:STRING=" + -D "TEST_EXPECT=0" + -D "TEST_SKIP_COMPARE=TRUE" + -D "TEST_OUTPUT=f03_ex_${example}.txt" + #-D "TEST_REFERENCE=f03_ex_${example}.out" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) + endif () if (NOT "${last_test}" STREQUAL "") set_tests_properties (f03_ex_${example} PROPERTIES DEPENDS ${last_test}) - endif (NOT "${last_test}" STREQUAL "") + endif () set (last_test "f03_ex_${example}") if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) - add_test (NAME f03_ex-shared_${example} COMMAND $) + if (HDF5_ENABLE_USING_MEMCHECKER) + add_test (NAME f03_ex-shared_${example} COMMAND $) + else () + add_test (NAME f03_ex-shared_${example} COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$" + -D "TEST_ARGS:STRING=" + -D "TEST_EXPECT=0" + -D "TEST_SKIP_COMPARE=TRUE" + -D "TEST_OUTPUT=f03_ex_${example}-shared.txt" + #-D "TEST_REFERENCE=f03_ex_${example}-shared.out" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) + endif () if (NOT "${last_test}" STREQUAL "") set_tests_properties (f03_ex-shared_${example} PROPERTIES DEPENDS ${last_test}) - endif (NOT "${last_test}" STREQUAL "") + endif () set (last_test "f03_ex-shared_${example}") - endif (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) - endforeach (example ${F2003_examples}) -endif (HDF5_ENABLE_F2003) + endif () + endforeach () +endif () if (H5_HAVE_PARALLEL AND MPI_Fortran_FOUND) add_test (NAME f90_ex_ph5example COMMAND ${MPIEXEC} ${MPIEXEC_PREFLAGS} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_POSTFLAGS} $) if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) add_test (NAME f90_ex-shared_ph5example COMMAND ${MPIEXEC} ${MPIEXEC_PREFLAGS} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_POSTFLAGS} $) - endif (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) -endif (H5_HAVE_PARALLEL AND MPI_Fortran_FOUND) + endif () +endif () diff --git a/fortran/src/CMakeLists.txt b/fortran/src/CMakeLists.txt index a74459f..6d51feb 100644 --- a/fortran/src/CMakeLists.txt +++ b/fortran/src/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 3.1.0) +cmake_minimum_required (VERSION 3.2.2) PROJECT (HDF5_F90_SRC C CXX Fortran) #----------------------------------------------------------------------------- @@ -8,16 +8,16 @@ if (WIN32) if (MSVC) if (NOT H5_HAVE_PARALLEL) set (H5_NOPAREXP ";") - endif (NOT H5_HAVE_PARALLEL) + endif () if (NOT HDF5_ENABLE_F2003) set (H5_NOF03EXP ";") - else (NOT HDF5_ENABLE_F2003) + else () set (H5_F03EXP ";") - endif (NOT HDF5_ENABLE_F2003) + endif () configure_file (${HDF5_F90_SRC_SOURCE_DIR}/hdf5_fortrandll.def.in ${HDF5_F90_SRC_BINARY_DIR}/hdf5_fortrandll.def @ONLY) - endif (MSVC) - endif (BUILD_SHARED_LIBS) -endif (WIN32) + endif () + endif () +endif () # configure for Fortran preprocessor @@ -25,12 +25,12 @@ endif (WIN32) set (CMAKE_H5_HAVE_PARALLEL 0) if (H5_HAVE_PARALLEL) set (CMAKE_H5_HAVE_PARALLEL 1) -endif (H5_HAVE_PARALLEL) +endif () set (CMAKE_H5_HAVE_FLOAT128 0) if (HAVE_FLOAT128) set (CMAKE_H5_HAVE_FLOAT128 1) -endif(HAVE_FLOAT128) +endif () configure_file (${HDF5_F90_SRC_SOURCE_DIR}/H5config_f.inc.cmake ${CMAKE_BINARY_DIR}/H5config_f.inc @ONLY) configure_file (${HDF5_F90_SRC_SOURCE_DIR}/H5fort_type_defines.h.in ${HDF5_F90_BINARY_DIR}/H5fort_type_defines.h @ONLY) @@ -53,12 +53,12 @@ if (WIN32 AND MSVC) PROPERTIES COMPILE_FLAGS "/MT" ) - endif (BUILD_SHARED_LIBS) + endif () set_target_properties (H5_buildiface PROPERTIES LINK_FLAGS "/SUBSYSTEM:CONSOLE" ) -endif (WIN32 AND MSVC) +endif () set_target_properties (H5_buildiface PROPERTIES LINKER_LANGUAGE Fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY} @@ -68,15 +68,15 @@ if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) file (MAKE_DIRECTORY "${HDF5_F90_BINARY_DIR}/shared") if (WIN32) set (MODSH_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/shared/${CMAKE_BUILD_TYPE}) - else (WIN32) + else () set (MODSH_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/shared) - endif (WIN32) -endif (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) + endif () +endif () if (WIN32) set (MOD_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/static/${CMAKE_BUILD_TYPE}) -else (WIN32) +else () set (MOD_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/static) -endif (WIN32) +endif () INCLUDE_DIRECTORIES (${HDF5_F90_BINARY_DIR} ${CMAKE_Fortran_MODULE_DIRECTORY}) @@ -150,7 +150,7 @@ if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) INTERFACE_COMPILE_DEFINITIONS H5_BUILT_AS_DYNAMIC_LIB=1 ) set (install_targets ${install_targets} ${HDF5_F90_C_LIBSH_TARGET}) -endif (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) +endif () #----------------------------------------------------------------------------- # Fortran Modules @@ -186,7 +186,7 @@ if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) DEPENDS ${HDF5_F90_BINARY_DIR}/shared/H5_gen.F90 ) set_source_files_properties (${HDF5_F90_BINARY_DIR}/shared/H5_gen.F90 PROPERTIES GENERATED TRUE) -endif (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) +endif () set (f90_F_BASE_SOURCES # normal distribution @@ -233,7 +233,7 @@ if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) # normal distribution ${HDF5_F90_SRC_SOURCE_DIR}/HDF5.F90 ) -endif (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) +endif () #----------------------------------------------------------------------------- # Add Main fortran library @@ -244,7 +244,7 @@ TARGET_FORTRAN_PROPERTIES (${HDF5_F90_LIB_TARGET} STATIC " " " ") target_link_libraries (${HDF5_F90_LIB_TARGET} ${HDF5_F90_C_LIB_TARGET} ${HDF5_LIB_TARGET}) if (H5_HAVE_PARALLEL AND MPI_Fortran_FOUND) target_link_libraries (${HDF5_F90_LIB_TARGET} ${MPI_Fortran_LIBRARIES}) -endif (H5_HAVE_PARALLEL AND MPI_Fortran_FOUND) +endif () set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_F90_LIB_TARGET}") H5_SET_LIB_OPTIONS (${HDF5_F90_LIB_TARGET} ${HDF5_F90_LIB_NAME} STATIC) set_target_properties (${HDF5_F90_LIB_TARGET} PROPERTIES @@ -257,7 +257,7 @@ if (WIN32) set_property (TARGET ${HDF5_F90_LIB_TARGET} APPEND PROPERTY COMPILE_DEFINITIONS "HDF5F90_WINDOWS" ) -endif (WIN32) +endif () set (install_targets ${install_targets} ${HDF5_F90_LIB_TARGET}) add_dependencies(${HDF5_F90_LIB_TARGET} H5gen) @@ -266,12 +266,12 @@ if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) set (SHARED_LINK_FLAGS " ") if (WIN32 AND MSVC) set (SHARED_LINK_FLAGS "/DLL /DEF:${HDF5_F90_SRC_BINARY_DIR}/hdf5_fortrandll.def") - endif (WIN32 AND MSVC) + endif () TARGET_FORTRAN_PROPERTIES (${HDF5_F90_LIBSH_TARGET} SHARED " " ${SHARED_LINK_FLAGS}) target_link_libraries (${HDF5_F90_LIBSH_TARGET} ${HDF5_F90_C_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) if (H5_HAVE_PARALLEL AND MPI_Fortran_FOUND) target_link_libraries (${HDF5_F90_LIBSH_TARGET} ${MPI_Fortran_LIBRARIES}) - endif (H5_HAVE_PARALLEL AND MPI_Fortran_FOUND) + endif () set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_F90_LIBSH_TARGET}") H5_SET_LIB_OPTIONS (${HDF5_F90_LIBSH_TARGET} ${HDF5_F90_LIB_NAME} SHARED ${HDF5_F_PACKAGE_SOVERSION}) set_target_properties (${HDF5_F90_LIBSH_TARGET} PROPERTIES @@ -286,10 +286,10 @@ if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) set_property (TARGET ${HDF5_F90_LIBSH_TARGET} APPEND PROPERTY COMPILE_DEFINITIONS "BUILD_HDF5_DLL;HDF5F90_WINDOWS" ) - endif (WIN32) + endif () set (install_targets ${install_targets} ${HDF5_F90_LIBSH_TARGET}) add_dependencies(${HDF5_F90_LIBSH_TARGET} H5genSH) -endif (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) +endif () #----------------------------------------------------------------------------- # Add file(s) to CMake Install @@ -367,7 +367,7 @@ if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) COMPONENT fortheaders ) -endif (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) +endif () #----------------------------------------------------------------------------- # Add Target(s) to CMake Install for import into other projects @@ -376,7 +376,9 @@ if (HDF5_EXPORTED_TARGETS) if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) INSTALL_TARGET_PDB (${HDF5_F90_C_LIBSH_TARGET} ${HDF5_INSTALL_BIN_DIR} fortlibraries) #INSTALL_TARGET_PDB (${HDF5_F90_LIBSH_TARGET} ${HDF5_INSTALL_BIN_DIR} fortlibraries) - endif (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) + endif () + INSTALL_TARGET_PDB (${HDF5_F90_C_LIB_TARGET} ${HDF5_INSTALL_BIN_DIR} fortlibraries) + #INSTALL_TARGET_PDB (${HDF5_F90_LIB_TARGET} ${HDF5_INSTALL_BIN_DIR} fortlibraries) install ( TARGETS @@ -389,4 +391,4 @@ if (HDF5_EXPORTED_TARGETS) FRAMEWORK DESTINATION ${HDF5_INSTALL_FWRK_DIR} COMPONENT fortlibraries INCLUDES DESTINATION include ) -endif (HDF5_EXPORTED_TARGETS) +endif () diff --git a/fortran/src/Makefile.am b/fortran/src/Makefile.am index a271666..51775db 100644 --- a/fortran/src/Makefile.am +++ b/fortran/src/Makefile.am @@ -57,9 +57,9 @@ libhdf5_fortran_la_LIBADD=$(LIBHDF5) # Remove it only when distclean. DISTCLEANFILES=h5fc -# H5fortran_types.F90 and H5f90i.h are automatically generaed by +# H5fortran_types.F90 and H5f90i.h are automatically generated by # H5match_types, and must be cleaned explicitly. -MOSTLYCLEANFILES=H5fortran_types.F90 H5f90i_gen.h +MOSTLYCLEANFILES=H5fortran_types.F90 H5f90i_gen.h H5_gen.F90 # Fortran module files can have different extensions and different names # (e.g., different capitalizations) on different platforms. Write rules diff --git a/fortran/test/CMakeLists.txt b/fortran/test/CMakeLists.txt index 5b11a0a..1661a10 100644 --- a/fortran/test/CMakeLists.txt +++ b/fortran/test/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 3.1.0) +cmake_minimum_required (VERSION 3.2.2) PROJECT (HDF5_FORTRAN_TESTS C CXX Fortran) #----------------------------------------------------------------------------- @@ -21,12 +21,12 @@ if (WIN32 AND MSVC) PROPERTIES COMPILE_FLAGS "/MT" ) - endif (BUILD_SHARED_LIBS) + endif () set_target_properties (H5_test_buildiface PROPERTIES LINK_FLAGS "/SUBSYSTEM:CONSOLE" ) -endif (WIN32 AND MSVC) +endif () set_target_properties (H5_test_buildiface PROPERTIES LINKER_LANGUAGE Fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY} @@ -36,15 +36,15 @@ if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) file (MAKE_DIRECTORY "${HDF5_F90_BINARY_DIR}/shared") if (WIN32) set (MODSH_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/shared/${CMAKE_BUILD_TYPE}) - else (WIN32) + else () set (MODSH_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/shared) - endif (WIN32) -endif (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) + endif () +endif () if (WIN32) set (MOD_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/static/${CMAKE_BUILD_TYPE}) -else (WIN32) +else () set (MOD_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/static) -endif (WIN32) +endif () INCLUDE_DIRECTORIES (${CMAKE_Fortran_MODULE_DIRECTORY} ${MOD_BUILD_DIR}) @@ -79,7 +79,7 @@ if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) INTERFACE_INCLUDE_DIRECTORIES "$/include>" INTERFACE_COMPILE_DEFINITIONS H5_BUILT_AS_DYNAMIC_LIB=1 ) -endif (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) +endif () set (CMD $) add_custom_command ( @@ -107,7 +107,7 @@ if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) DEPENDS ${HDF5_F90_BINARY_DIR}/shared/tf_gen.F90 ) set_source_files_properties (${HDF5_F90_BINARY_DIR}/shared/tf_gen.F90 PROPERTIES GENERATED TRUE) -endif (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) +endif () set (HDF5_F90_TF_SOURCES # generated files @@ -126,7 +126,7 @@ if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) tf.F90 ) set_source_files_properties (${HDF5_F90_TF_SOURCES_SHARED} PROPERTIES LANGUAGE Fortran) -endif (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) +endif () add_library (${HDF5_F90_TEST_LIB_TARGET} STATIC ${HDF5_F90_TF_SOURCES}) TARGET_FORTRAN_PROPERTIES (${HDF5_F90_TEST_LIB_TARGET} STATIC " " " ") @@ -147,7 +147,7 @@ if (WIN32) set_property (TARGET ${HDF5_F90_TEST_LIB_TARGET} APPEND PROPERTY COMPILE_DEFINITIONS "HDF5F90_WINDOWS" ) -endif (WIN32) +endif () add_dependencies(${HDF5_F90_TEST_LIB_TARGET} H5testgen) if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) @@ -155,7 +155,7 @@ if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) set (SHARED_LINK_FLAGS " ") if (WIN32 AND MSVC) set (SHARED_LINK_FLAGS "/DLL") - endif (WIN32 AND MSVC) + endif () TARGET_FORTRAN_PROPERTIES (${HDF5_F90_TEST_LIBSH_TARGET} SHARED " " ${SHARED_LINK_FLAGS}) target_link_libraries (${HDF5_F90_TEST_LIBSH_TARGET} ${HDF5_F90_C_TEST_LIBSH_TARGET} @@ -176,9 +176,9 @@ if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) set_property (TARGET ${HDF5_F90_TEST_LIBSH_TARGET} APPEND PROPERTY COMPILE_DEFINITIONS "BUILD_HDF5_TEST_DLL;HDF5F90_WINDOWS" ) - endif (WIN32) + endif () add_dependencies(${HDF5_F90_TEST_LIBSH_TARGET} H5testgenSH) -endif (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) +endif () #----------------------------------------------------------------------------- # Add Tests @@ -211,7 +211,7 @@ target_link_libraries (testhdf5_fortran ) if (WIN32 AND MSVC) target_link_libraries (testhdf5_fortran "ws2_32.lib") -endif (WIN32 AND MSVC) +endif () target_include_directories (testhdf5_fortran PRIVATE ${CMAKE_Fortran_MODULE_DIRECTORY}/static) set_target_properties (testhdf5_fortran PROPERTIES LINKER_LANGUAGE Fortran @@ -247,7 +247,7 @@ if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) ) if (WIN32 AND MSVC) target_link_libraries (testhdf5_fortran-shared "ws2_32.lib") - endif (WIN32 AND MSVC) + endif () target_include_directories (testhdf5_fortran-shared PRIVATE ${CMAKE_Fortran_MODULE_DIRECTORY}/shared) set_target_properties (testhdf5_fortran-shared PROPERTIES LINKER_LANGUAGE Fortran @@ -255,7 +255,7 @@ if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared ) add_dependencies (testhdf5_fortran-shared ${HDF5_F90_TEST_LIBSH_TARGET}) -endif (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) +endif () #-- Adding test for testhdf5_fortran_1_8 add_executable (testhdf5_fortran_1_8 @@ -275,7 +275,7 @@ target_link_libraries (testhdf5_fortran_1_8 ) if (WIN32 AND MSVC) target_link_libraries (testhdf5_fortran_1_8 "ws2_32.lib") -endif (WIN32 AND MSVC) +endif () target_include_directories (testhdf5_fortran_1_8 PRIVATE ${CMAKE_Fortran_MODULE_DIRECTORY}/static) set_target_properties (testhdf5_fortran_1_8 PROPERTIES LINKER_LANGUAGE Fortran @@ -302,7 +302,7 @@ if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) ) if (WIN32 AND MSVC) target_link_libraries (testhdf5_fortran_1_8-shared "ws2_32.lib") - endif (WIN32 AND MSVC) + endif () target_include_directories (testhdf5_fortran_1_8-shared PRIVATE ${CMAKE_Fortran_MODULE_DIRECTORY}/shared) set_target_properties (testhdf5_fortran_1_8-shared PROPERTIES LINKER_LANGUAGE Fortran @@ -310,7 +310,7 @@ if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared ) add_dependencies (testhdf5_fortran_1_8-shared ${HDF5_F90_TEST_LIBSH_TARGET}) -endif (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) +endif () #-- Adding test for fortranlib_test_F03 add_executable (fortranlib_test_F03 @@ -332,7 +332,7 @@ target_link_libraries (fortranlib_test_F03 ) if (WIN32 AND MSVC) target_link_libraries (fortranlib_test_F03 "ws2_32.lib") -endif (WIN32 AND MSVC) +endif () target_include_directories (fortranlib_test_F03 PRIVATE ${CMAKE_Fortran_MODULE_DIRECTORY}/static) set_target_properties (fortranlib_test_F03 PROPERTIES LINKER_LANGUAGE Fortran @@ -361,7 +361,7 @@ if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) ) if (WIN32 AND MSVC) target_link_libraries (fortranlib_test_F03-shared "ws2_32.lib") - endif (WIN32 AND MSVC) + endif () target_include_directories (fortranlib_test_F03-shared PRIVATE ${CMAKE_Fortran_MODULE_DIRECTORY}/shared) set_target_properties (fortranlib_test_F03-shared PROPERTIES @@ -370,7 +370,7 @@ if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared ) add_dependencies (fortranlib_test_F03-shared ${HDF5_F90_TEST_LIBSH_TARGET}) -endif (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) +endif () #-- Adding test for fflush1 add_executable (fflush1 fflush1.F90) @@ -383,7 +383,7 @@ target_link_libraries (fflush1 ) if (WIN32 AND MSVC) target_link_libraries (fflush1 "ws2_32.lib") -endif (WIN32 AND MSVC) +endif () target_include_directories (fflush1 PRIVATE ${CMAKE_Fortran_MODULE_DIRECTORY}/static) set_target_properties (fflush1 PROPERTIES LINKER_LANGUAGE Fortran @@ -403,7 +403,7 @@ if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) ) if (WIN32 AND MSVC) target_link_libraries (fflush1-shared "ws2_32.lib") - endif (WIN32 AND MSVC) + endif () target_include_directories (fflush1-shared PRIVATE ${CMAKE_Fortran_MODULE_DIRECTORY}/shared) set_target_properties (fflush1-shared PROPERTIES LINKER_LANGUAGE Fortran @@ -411,7 +411,7 @@ if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared ) add_dependencies (fflush1-shared ${HDF5_F90_TEST_LIBSH_TARGET}) -endif (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) +endif () #-- Adding test for fflush2 add_executable (fflush2 fflush2.F90) @@ -424,7 +424,7 @@ target_link_libraries (fflush2 ) if (WIN32 AND MSVC) target_link_libraries (fflush2 "ws2_32.lib") -endif (WIN32 AND MSVC) +endif () target_include_directories (fflush2 PRIVATE ${CMAKE_Fortran_MODULE_DIRECTORY}/static) set_target_properties (fflush2 PROPERTIES LINKER_LANGUAGE Fortran @@ -444,7 +444,7 @@ if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) ) if (WIN32 AND MSVC) target_link_libraries (fflush2-shared "ws2_32.lib") - endif (WIN32 AND MSVC) + endif () target_include_directories (fflush2-shared PRIVATE ${CMAKE_Fortran_MODULE_DIRECTORY}/shared) set_target_properties (fflush2-shared PROPERTIES LINKER_LANGUAGE Fortran @@ -452,6 +452,6 @@ if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared ) add_dependencies (fflush2-shared ${HDF5_F90_TEST_LIBSH_TARGET}) -endif (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) +endif () include (CMakeTests.cmake) diff --git a/fortran/test/CMakeTests.cmake b/fortran/test/CMakeTests.cmake index e91e820..a282ec6 100644 --- a/fortran/test/CMakeTests.cmake +++ b/fortran/test/CMakeTests.cmake @@ -6,7 +6,7 @@ ############################################################################## if (BUILD_SHARED_LIBS) file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/fshared") -endif (BUILD_SHARED_LIBS) +endif () # Remove any output file left over from previous test run add_test ( @@ -49,24 +49,69 @@ add_test ( ) if (NOT "${last_test}" STREQUAL "") set_tests_properties (FORTRAN_testhdf5-clear-objects PROPERTIES DEPENDS ${last_test}) -endif (NOT "${last_test}" STREQUAL "") +endif () set (last_test "FORTRAN_testhdf5-clear-objects") -add_test (NAME FORTRAN_testhdf5_fortran COMMAND $) -set_tests_properties (FORTRAN_testhdf5_fortran PROPERTIES PASS_REGULAR_EXPRESSION "[ ]*0 error.s") +if (HDF5_ENABLE_USING_MEMCHECKER) + add_test (NAME FORTRAN_testhdf5_fortran COMMAND $) +else () + add_test (NAME FORTRAN_testhdf5_fortran COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$" + -D "TEST_ARGS:STRING=" + -D "TEST_EXPECT=0" + -D "TEST_SKIP_COMPARE=TRUE" + -D "TEST_REGEX= 0 error.s." + -D "TEST_MATCH= 0 error(s)" + -D "TEST_OUTPUT=testhdf5_fortran.txt" + #-D "TEST_REFERENCE=testhdf5_fortran.out" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) +endif () +#set_tests_properties (FORTRAN_testhdf5_fortran PROPERTIES PASS_REGULAR_EXPRESSION "[ ]*0 error.s") set_tests_properties (FORTRAN_testhdf5_fortran PROPERTIES DEPENDS FORTRAN_testhdf5-clear-objects) #-- Adding test for testhdf5_fortran_1_8 -add_test (NAME FORTRAN_testhdf5_fortran_1_8 COMMAND $) -set_tests_properties (FORTRAN_testhdf5_fortran_1_8 PROPERTIES PASS_REGULAR_EXPRESSION "[ ]*0 error.s") +if (HDF5_ENABLE_USING_MEMCHECKER) + add_test (NAME FORTRAN_testhdf5_fortran_1_8 COMMAND $) +else () + add_test (NAME FORTRAN_testhdf5_fortran_1_8 COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$" + -D "TEST_ARGS:STRING=" + -D "TEST_EXPECT=0" + -D "TEST_SKIP_COMPARE=TRUE" + -D "TEST_REGEX= 0 error.s." + -D "TEST_MATCH= 0 error(s)" + -D "TEST_OUTPUT=testhdf5_fortran_1_8.txt" + #-D "TEST_REFERENCE=testhdf5_fortran_1_8.out" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) +endif () +#set_tests_properties (FORTRAN_testhdf5_fortran_1_8 PROPERTIES PASS_REGULAR_EXPRESSION "[ ]*0 error.s") set_tests_properties (FORTRAN_testhdf5_fortran_1_8 PROPERTIES DEPENDS FORTRAN_testhdf5_fortran) #-- Adding test for fortranlib_test_F03 if (HDF5_ENABLE_F2003) - add_test (NAME FORTRAN_fortranlib_test_F03 COMMAND $) - set_tests_properties (FORTRAN_fortranlib_test_F03 PROPERTIES PASS_REGULAR_EXPRESSION "[ ]*0 error.s") + if (HDF5_ENABLE_USING_MEMCHECKER) + add_test (NAME FORTRAN_fortranlib_test_F03 COMMAND $) + else () + add_test (NAME FORTRAN_fortranlib_test_F03 COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$" + -D "TEST_ARGS:STRING=" + -D "TEST_EXPECT=0" + -D "TEST_SKIP_COMPARE=TRUE" + -D "TEST_REGEX= 0 error.s." + -D "TEST_MATCH= 0 error(s)" + -D "TEST_OUTPUT=fortranlib_test_F03.txt" + #-D "TEST_REFERENCE=fortranlib_test_F03.out" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) + endif () +# set_tests_properties (FORTRAN_fortranlib_test_F03 PROPERTIES PASS_REGULAR_EXPRESSION "[ ]*0 error.s") set_tests_properties (FORTRAN_fortranlib_test_F03 PROPERTIES DEPENDS FORTRAN_testhdf5_fortran_1_8) -endif (HDF5_ENABLE_F2003) +endif () #-- Adding test for fflush1 add_test (NAME FORTRAN_fflush1 COMMAND $) @@ -119,21 +164,66 @@ if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) ) set_tests_properties (FORTRAN_testhdf5-shared-clear-objects PROPERTIES DEPENDS FORTRAN_testhdf5-clear-objects) - add_test (NAME FORTRAN_testhdf5_fortran-shared COMMAND $) - set_tests_properties (FORTRAN_testhdf5_fortran-shared PROPERTIES PASS_REGULAR_EXPRESSION "[ ]*0 error.s") + if (HDF5_ENABLE_USING_MEMCHECKER) + add_test (NAME FORTRAN_testhdf5_fortran-shared COMMAND $) + else () + add_test (NAME FORTRAN_testhdf5_fortran-shared COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$" + -D "TEST_ARGS:STRING=" + -D "TEST_EXPECT=0" + -D "TEST_SKIP_COMPARE=TRUE" + -D "TEST_REGEX= 0 error.s." + -D "TEST_MATCH= 0 error(s)" + -D "TEST_OUTPUT=testhdf5_fortran.txt" + #-D "TEST_REFERENCE=testhdf5_fortran.out" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/fshared" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) + endif () +# set_tests_properties (FORTRAN_testhdf5_fortran-shared PROPERTIES PASS_REGULAR_EXPRESSION "[ ]*0 error.s") set_tests_properties (FORTRAN_testhdf5_fortran-shared PROPERTIES DEPENDS "FORTRAN_testhdf5_fortran;FORTRAN_testhdf5-shared-clear-objects") #-- Adding test for testhdf5_fortran_1_8 - add_test (NAME FORTRAN_testhdf5_fortran_1_8-shared COMMAND $) - set_tests_properties (FORTRAN_testhdf5_fortran_1_8-shared PROPERTIES PASS_REGULAR_EXPRESSION "[ ]*0 error.s") + if (HDF5_ENABLE_USING_MEMCHECKER) + add_test (NAME FORTRAN_testhdf5_fortran_1_8-shared COMMAND $) + else () + add_test (NAME FORTRAN_testhdf5_fortran_1_8-shared COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$" + -D "TEST_ARGS:STRING=" + -D "TEST_EXPECT=0" + -D "TEST_SKIP_COMPARE=TRUE" + -D "TEST_REGEX= 0 error.s." + -D "TEST_MATCH= 0 error(s)" + -D "TEST_OUTPUT=testhdf5_fortran_1_8.txt" + #-D "TEST_REFERENCE=testhdf5_fortran_1_8.out" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/fshared" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) + endif () +# set_tests_properties (FORTRAN_testhdf5_fortran_1_8-shared PROPERTIES PASS_REGULAR_EXPRESSION "[ ]*0 error.s") set_tests_properties (FORTRAN_testhdf5_fortran_1_8-shared PROPERTIES DEPENDS FORTRAN_testhdf5_fortran_1_8) #-- Adding test for fortranlib_test_F03 if (HDF5_ENABLE_F2003) - add_test (NAME FORTRAN_fortranlib_test_F03-shared COMMAND $) - set_tests_properties (FORTRAN_fortranlib_test_F03-shared PROPERTIES PASS_REGULAR_EXPRESSION "[ ]*0 error.s") + if (HDF5_ENABLE_USING_MEMCHECKER) + add_test (NAME FORTRAN_fortranlib_test_F03-shared COMMAND $) + else () + add_test (NAME FORTRAN_fortranlib_test_F03-shared COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$" + -D "TEST_ARGS:STRING=" + -D "TEST_EXPECT=0" + -D "TEST_SKIP_COMPARE=TRUE" + -D "TEST_REGEX= 0 error.s." + -D "TEST_MATCH= 0 error(s)" + -D "TEST_OUTPUT=fortranlib_test_F03.txt" + #-D "TEST_REFERENCE=fortranlib_test_F03.out" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/fshared" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) + endif () +# set_tests_properties (FORTRAN_fortranlib_test_F03-shared PROPERTIES PASS_REGULAR_EXPRESSION "[ ]*0 error.s") set_tests_properties (FORTRAN_fortranlib_test_F03-shared PROPERTIES DEPENDS FORTRAN_fortranlib_test_F03) - endif (HDF5_ENABLE_F2003) + endif () #-- Adding test for fflush1 add_test (NAME FORTRAN_fflush1-shared COMMAND $) @@ -142,4 +232,4 @@ if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) #-- Adding test for fflush2 add_test (NAME FORTRAN_fflush2-shared COMMAND $) set_tests_properties (FORTRAN_fflush2-shared PROPERTIES DEPENDS FORTRAN_fflush1-shared) -endif (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) +endif () diff --git a/fortran/testpar/CMakeLists.txt b/fortran/testpar/CMakeLists.txt index 4f21419..909cbaf 100644 --- a/fortran/testpar/CMakeLists.txt +++ b/fortran/testpar/CMakeLists.txt @@ -1,10 +1,10 @@ -cmake_minimum_required (VERSION 3.1.0) +cmake_minimum_required (VERSION 3.2.2) PROJECT (HDF5_FORTRAN_TESTPAR C CXX Fortran) #----------------------------------------------------------------------------- # Setup include Directories #----------------------------------------------------------------------------- -INCLUDE_DIRECTORIES (${HDF5_F90_BINARY_DIR} ${HDF5_F90_SRC_DIR}/src) +INCLUDE_DIRECTORIES (${MPI_Fortran_INCLUDE_PATH} ${HDF5_F90_BINARY_DIR} ${HDF5_F90_SRC_DIR}/src) #----------------------------------------------------------------------------- # Add Tests @@ -18,15 +18,15 @@ add_executable (parallel_test ) TARGET_NAMING (parallel_test STATIC) TARGET_FORTRAN_PROPERTIES (parallel_test STATIC " " " ") -target_link_libraries (parallel_test +target_link_libraries (parallel_test ${HDF5_F90_TEST_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} - ${MPI_Fortran_LIBRARIES} + ${LINK_Fortran_LIBS} ) if (WIN32 AND MSVC) target_link_libraries (parallel_test "ws2_32.lib") -endif (WIN32 AND MSVC) +endif () target_include_directories (parallel_test PRIVATE ${CMAKE_Fortran_MODULE_DIRECTORY}/static) set_target_properties (parallel_test PROPERTIES LINKER_LANGUAGE Fortran) set_target_properties (parallel_test PROPERTIES FOLDER test/fortran) diff --git a/hl/CMakeLists.txt b/hl/CMakeLists.txt index bed8291..a47e023 100644 --- a/hl/CMakeLists.txt +++ b/hl/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 3.1.0) +cmake_minimum_required (VERSION 3.2.2) PROJECT (HDF5_HL C CXX) #----------------------------------------------------------------------------- @@ -17,16 +17,16 @@ add_subdirectory (${HDF5_HL_SOURCE_DIR}/src ${HDF5_HL_BINARY_DIR}/src) #-- Build the High level Tools if (HDF5_BUILD_TOOLS) add_subdirectory (${HDF5_HL_SOURCE_DIR}/tools ${HDF5_HL_BINARY_DIR}/tools) -endif (HDF5_BUILD_TOOLS) +endif () #-- Add High Level Examples if (HDF5_BUILD_EXAMPLES) add_subdirectory (${HDF5_HL_SOURCE_DIR}/examples ${HDF5_HL_BINARY_DIR}/examples) -endif (HDF5_BUILD_EXAMPLES) +endif () #-- Build the Unit testing if requested if (NOT HDF5_EXTERNALLY_CONFIGURED) if (BUILD_TESTING) add_subdirectory (${HDF5_HL_SOURCE_DIR}/test ${HDF5_HL_BINARY_DIR}/test) - endif (BUILD_TESTING) -endif (NOT HDF5_EXTERNALLY_CONFIGURED) + endif () +endif () diff --git a/hl/c++/CMakeLists.txt b/hl/c++/CMakeLists.txt index 36f4c30..91bfa14 100644 --- a/hl/c++/CMakeLists.txt +++ b/hl/c++/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 3.1.0) +cmake_minimum_required (VERSION 3.2.2) PROJECT (HDF5_HL_CPP) #----------------------------------------------------------------------------- @@ -11,7 +11,7 @@ add_subdirectory (${HDF5_HL_CPP_SOURCE_DIR}/src ${HDF5_HL_CPP_BINARY_DIR}/src) # -------------------------------------------------------------------- if (HDF5_BUILD_EXAMPLES) add_subdirectory (${HDF5_HL_CPP_SOURCE_DIR}/examples ${HDF5_HL_CPP_BINARY_DIR}/examples) -endif (HDF5_BUILD_EXAMPLES) +endif () # -------------------------------------------------------------------- # Add in the unit tests for the packet table c++ wrapper @@ -19,4 +19,4 @@ endif (HDF5_BUILD_EXAMPLES) if (BUILD_TESTING) add_subdirectory (${HDF5_HL_CPP_SOURCE_DIR}/test ${HDF5_HL_CPP_BINARY_DIR}/test) -endif (BUILD_TESTING) +endif () diff --git a/hl/c++/examples/CMakeLists.txt b/hl/c++/examples/CMakeLists.txt index 77a50bf..33ad1e5 100644 --- a/hl/c++/examples/CMakeLists.txt +++ b/hl/c++/examples/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 3.1.0) +cmake_minimum_required (VERSION 3.2.2) PROJECT (HDF5_HL_CPP_EXAMPLES) #----------------------------------------------------------------------------- @@ -23,4 +23,4 @@ set_target_properties (ptExampleFL PROPERTIES FOLDER examples/hl/cpp) if (BUILD_TESTING) include (CMakeTests.cmake) -endif (BUILD_TESTING) +endif () diff --git a/hl/c++/examples/CMakeTests.cmake b/hl/c++/examples/CMakeTests.cmake index bac9fdf..86bdd93 100644 --- a/hl/c++/examples/CMakeTests.cmake +++ b/hl/c++/examples/CMakeTests.cmake @@ -8,9 +8,22 @@ add_test ( NAME HL_CPP_ex_ptExampleFL-clear-objects COMMAND ${CMAKE_COMMAND} - -E remove + -E remove PTcppexampleFL.h5 ) -add_test (NAME HL_CPP_ex_ptExampleFL COMMAND $) +if (HDF5_ENABLE_USING_MEMCHECKER) + add_test (NAME HL_CPP_ex_ptExampleFL COMMAND $) +else () + add_test (NAME HL_CPP_ex_ptExampleFL COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$" + -D "TEST_ARGS:STRING=" + -D "TEST_EXPECT=0" + -D "TEST_SKIP_COMPARE=TRUE" + -D "TEST_OUTPUT=ptExampleFL.txt" + #-D "TEST_REFERENCE=ptExampleFL.out" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) +endif () set_tests_properties (HL_CPP_ex_ptExampleFL PROPERTIES DEPENDS HL_CPP_ex_ptExampleFL-clear-objects) diff --git a/hl/c++/src/CMakeLists.txt b/hl/c++/src/CMakeLists.txt index f30e684..38604cd 100644 --- a/hl/c++/src/CMakeLists.txt +++ b/hl/c++/src/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 3.1.0) +cmake_minimum_required (VERSION 3.2.2) PROJECT (HDF5_HL_CPP_SRC) #----------------------------------------------------------------------------- @@ -42,7 +42,7 @@ if (BUILD_SHARED_LIBS) INTERFACE_COMPILE_DEFINITIONS H5_BUILT_AS_DYNAMIC_LIB=1 ) set (install_targets ${install_targets} ${HDF5_HL_CPP_LIBSH_TARGET}) -endif (BUILD_SHARED_LIBS) +endif () #----------------------------------------------------------------------------- # Add file(s) to CMake Install @@ -62,7 +62,8 @@ install ( if (HDF5_EXPORTED_TARGETS) if (BUILD_SHARED_LIBS) INSTALL_TARGET_PDB (${HDF5_HL_CPP_LIBSH_TARGET} ${HDF5_INSTALL_BIN_DIR} hlcpplibraries) - endif (BUILD_SHARED_LIBS) + endif () + INSTALL_TARGET_PDB (${HDF5_HL_CPP_LIB_TARGET} ${HDF5_INSTALL_BIN_DIR} hlcpplibraries) install ( TARGETS @@ -75,4 +76,4 @@ if (HDF5_EXPORTED_TARGETS) FRAMEWORK DESTINATION ${HDF5_INSTALL_FWRK_DIR} COMPONENT hlcpplibraries INCLUDES DESTINATION include ) -endif (HDF5_EXPORTED_TARGETS) +endif () diff --git a/hl/c++/test/CMakeLists.txt b/hl/c++/test/CMakeLists.txt index de5b363..a2f9429 100644 --- a/hl/c++/test/CMakeLists.txt +++ b/hl/c++/test/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 3.1.0) +cmake_minimum_required (VERSION 3.2.2) PROJECT (HDF5_HL_CPP_TEST) #----------------------------------------------------------------------------- diff --git a/hl/c++/test/CMakeTests.cmake b/hl/c++/test/CMakeTests.cmake index e36b5aa..d41f79e 100644 --- a/hl/c++/test/CMakeTests.cmake +++ b/hl/c++/test/CMakeTests.cmake @@ -4,5 +4,18 @@ ### T E S T I N G ### ############################################################################## ############################################################################## - + +if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME HL_CPP_ptableTest COMMAND $) +else () + add_test (NAME HL_CPP_ptableTest COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$" + -D "TEST_ARGS:STRING=" + -D "TEST_EXPECT=0" + -D "TEST_SKIP_COMPARE=TRUE" + -D "TEST_OUTPUT=hl_ptableTest.txt" + #-D "TEST_REFERENCE=hl_ptableTest.out" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) +endif () diff --git a/hl/examples/CMakeLists.txt b/hl/examples/CMakeLists.txt index f5e6f5e..1144e0f 100644 --- a/hl/examples/CMakeLists.txt +++ b/hl/examples/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 3.1.0) +cmake_minimum_required (VERSION 3.2.2) PROJECT (HDF5_HL_EXAMPLES ) #----------------------------------------------------------------------------- @@ -32,10 +32,10 @@ foreach (example ${examples}) TARGET_C_PROPERTIES (hl_ex_${example} STATIC " " " ") target_link_libraries (hl_ex_${example} ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET}) set_target_properties (hl_ex_${example} PROPERTIES FOLDER examples/hl) -endforeach (example ${examples}) +endforeach () if (BUILD_TESTING) include (CMakeTests.cmake) -endif (BUILD_TESTING) +endif () diff --git a/hl/examples/CMakeTests.cmake b/hl/examples/CMakeTests.cmake index 6384aa5..5645155 100644 --- a/hl/examples/CMakeTests.cmake +++ b/hl/examples/CMakeTests.cmake @@ -12,7 +12,7 @@ set (HDF5_TEST_FILES foreach (h5_file ${HDF5_TEST_FILES}) HDFTEST_COPY_FILE("${PROJECT_SOURCE_DIR}/${h5_file}" "${PROJECT_BINARY_DIR}/${h5_file}" "hl_ex_ex_ds1_files") -endforeach (h5_file ${HDF5_TEST_FILES}) +endforeach () add_custom_target(hl_ex_ex_ds1_files ALL COMMENT "Copying files needed by hl_ex_ex_ds1 tests" DEPENDS ${hl_ex_ex_ds1_files_list}) # Remove any output file left over from previous test run @@ -46,9 +46,22 @@ add_custom_target(hl_ex_ex_ds1_files ALL COMMENT "Copying files needed by hl_ex_ set (last_test "HL_ex-clear-objects") foreach (example ${examples}) - add_test (NAME HL_ex_${example} COMMAND $) - if (NOT "${last_test}" STREQUAL "") - set_tests_properties (HL_ex_${example} PROPERTIES DEPENDS ${last_test}) - endif () - set (last_test "HL_ex_${example}") -endforeach (example ${examples}) + if (HDF5_ENABLE_USING_MEMCHECKER) + add_test (NAME HL_ex_${example} COMMAND $) + else () + add_test (NAME HL_ex_${example} COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$" + -D "TEST_ARGS:STRING=" + -D "TEST_EXPECT=0" + -D "TEST_SKIP_COMPARE=TRUE" + -D "TEST_OUTPUT=hl_ex_${example}.txt" + #-D "TEST_REFERENCE=hl_ex_${example}.out" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) + endif () + if (NOT "${last_test}" STREQUAL "") + set_tests_properties (HL_ex_${example} PROPERTIES DEPENDS ${last_test}) + endif () + set (last_test "HL_ex_${example}") +endforeach () diff --git a/hl/fortran/CMakeLists.txt b/hl/fortran/CMakeLists.txt index 892169c..c651ce9 100644 --- a/hl/fortran/CMakeLists.txt +++ b/hl/fortran/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 3.1.0) +cmake_minimum_required (VERSION 3.2.2) PROJECT (HDF5_HL_F90 C CXX Fortran) #----------------------------------------------------------------------------- @@ -11,11 +11,11 @@ add_subdirectory (${HDF5_HL_F90_SOURCE_DIR}/src ${HDF5_HL_F90_BINARY_DIR}/src) #----------------------------------------------------------------------------- if (HDF5_BUILD_EXAMPLES) add_subdirectory (${HDF5_HL_F90_SOURCE_DIR}/examples ${HDF5_HL_F90_BINARY_DIR}/examples) -endif (HDF5_BUILD_EXAMPLES) +endif () #----------------------------------------------------------------------------- # Testing #----------------------------------------------------------------------------- if (BUILD_TESTING) add_subdirectory (${HDF5_HL_F90_SOURCE_DIR}/test ${HDF5_HL_F90_BINARY_DIR}/test) -endif (BUILD_TESTING) +endif () diff --git a/hl/fortran/examples/CMakeLists.txt b/hl/fortran/examples/CMakeLists.txt index 87838a0..dfe6102 100644 --- a/hl/fortran/examples/CMakeLists.txt +++ b/hl/fortran/examples/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 3.1.0) +cmake_minimum_required (VERSION 3.2.2) PROJECT (HDF5_HL_F90_EXAMPLES C CXX Fortran) #----------------------------------------------------------------------------- @@ -18,7 +18,7 @@ foreach (example ${examples}) add_executable (hl_f90_ex_${example} ${HDF5_HL_F90_EXAMPLES_SOURCE_DIR}/${example}.f90) TARGET_NAMING (hl_f90_ex_${example} STATIC) TARGET_FORTRAN_PROPERTIES (hl_f90_ex_${example} STATIC " " " ") - target_link_libraries (hl_f90_ex_${example} + target_link_libraries (hl_f90_ex_${example} ${HDF5_HL_F90_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} @@ -27,10 +27,10 @@ foreach (example ${examples}) set_target_properties (hl_f90_ex_${example} PROPERTIES LINKER_LANGUAGE Fortran) set_target_properties (hl_f90_ex_${example} PROPERTIES FOLDER examples/hl/fortran) -endforeach (example ${examples}) +endforeach () if (BUILD_TESTING) include (CMakeTests.cmake) -endif (BUILD_TESTING) +endif () diff --git a/hl/fortran/examples/CMakeTests.cmake b/hl/fortran/examples/CMakeTests.cmake index 2c10295..b5f5fc6 100644 --- a/hl/fortran/examples/CMakeTests.cmake +++ b/hl/fortran/examples/CMakeTests.cmake @@ -16,6 +16,19 @@ add_test ( foreach (example ${examples}) - add_test (NAME HL_FORTRAN_f90_ex_${example} COMMAND $) + if (HDF5_ENABLE_USING_MEMCHECKER) + add_test (NAME HL_FORTRAN_f90_ex_${example} COMMAND $) + else () + add_test (NAME HL_FORTRAN_f90_ex_${example} COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$" + -D "TEST_ARGS:STRING=" + -D "TEST_EXPECT=0" + -D "TEST_SKIP_COMPARE=TRUE" + -D "TEST_OUTPUT=hl_f90_ex_${example}.txt" + #-D "TEST_REFERENCE=hl_f90_ex_${example}.out" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) + endif () set_tests_properties (HL_FORTRAN_f90_ex_${example} PROPERTIES DEPENDS HL_FORTRAN_f90_ex-clear-objects) -endforeach (example ${examples}) +endforeach () diff --git a/hl/fortran/src/CMakeLists.txt b/hl/fortran/src/CMakeLists.txt index 2eaac31..345a739 100644 --- a/hl/fortran/src/CMakeLists.txt +++ b/hl/fortran/src/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 3.1.0) +cmake_minimum_required (VERSION 3.2.2) PROJECT(HDF5_HL_F90_SRC C CXX Fortran) #----------------------------------------------------------------------------- @@ -7,9 +7,9 @@ if (WIN32) if (BUILD_SHARED_LIBS) if (MSVC) configure_file (${HDF5_HL_F90_SRC_SOURCE_DIR}/hdf5_hl_fortrandll.def.in ${HDF5_HL_F90_SRC_BINARY_DIR}/hdf5_hl_fortrandll.def @ONLY) - endif (MSVC) - endif (BUILD_SHARED_LIBS) -endif (WIN32) + endif () + endif () +endif () #----------------------------------------------------------------------------- # Generate the H5LT and H5TB REAL APIs @@ -25,12 +25,12 @@ if (WIN32 AND MSVC) PROPERTIES COMPILE_FLAGS "/MT" ) - endif (BUILD_SHARED_LIBS) + endif () set_target_properties (H5HL_buildiface PROPERTIES LINK_FLAGS "/SUBSYSTEM:CONSOLE" ) -endif (WIN32 AND MSVC) +endif () set_target_properties (H5HL_buildiface PROPERTIES LINKER_LANGUAGE Fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY} @@ -40,15 +40,15 @@ if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) file (MAKE_DIRECTORY "${HDF5_HL_F90_SRC_BINARY_DIR}/shared") if (WIN32) set (MODSH_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/shared/${CMAKE_BUILD_TYPE}) - else (WIN32) + else () set (MODSH_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/shared) - endif (WIN32) -endif (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) + endif () +endif () if (WIN32) set (MOD_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/static/${CMAKE_BUILD_TYPE}) -else (WIN32) +else () set (MOD_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/static) -endif (WIN32) +endif () #----------------------------------------------------------------------------- # Setup include Directories @@ -101,7 +101,7 @@ if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) INTERFACE_COMPILE_DEFINITIONS H5_BUILT_AS_DYNAMIC_LIB=1 ) set (install_targets ${install_targets} ${HDF5_HL_F90_C_LIBSH_TARGET}) -endif (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) +endif () #----------------------------------------------------------------------------- # Fortran Modules @@ -146,7 +146,7 @@ if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) ${HDF5_HL_F90_SRC_BINARY_DIR}/shared/H5TBff_gen.F90 PROPERTIES GENERATED TRUE ) -endif (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) +endif () set (HDF5_HL_F90_F_SOURCES ${HDF5_HL_F90_F_BASE_SOURCES} @@ -166,7 +166,7 @@ if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) ${HDF5_HL_F90_SRC_BINARY_DIR}/shared/H5TBff_gen.F90 ) set_source_files_properties (${HDF5_HL_F90_F_SOURCES_SHARED} PROPERTIES LANGUAGE Fortran) -endif (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) +endif () add_library (${HDF5_HL_F90_LIB_TARGET} STATIC ${HDF5_HL_F90_F_SOURCES}) TARGET_FORTRAN_PROPERTIES (${HDF5_HL_F90_LIB_TARGET} STATIC " " " ") @@ -183,7 +183,7 @@ if (WIN32) set_property (TARGET ${HDF5_HL_F90_LIB_TARGET} APPEND PROPERTY COMPILE_DEFINITIONS "HDF5F90_WINDOWS" ) -endif (WIN32) +endif () set (install_targets ${install_targets} ${HDF5_HL_F90_LIB_TARGET}) add_dependencies(${HDF5_HL_F90_LIB_TARGET} H5HLgen) @@ -192,7 +192,7 @@ if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) set (SHARED_LINK_FLAGS " ") if (WIN32 AND MSVC) set (SHARED_LINK_FLAGS "/DLL /DEF:${HDF5_HL_F90_SRC_BINARY_DIR}/hdf5_hl_fortrandll.def") - endif (WIN32 AND MSVC) + endif () TARGET_FORTRAN_PROPERTIES (${HDF5_HL_F90_LIBSH_TARGET} SHARED " " ${SHARED_LINK_FLAGS}) target_link_libraries (${HDF5_HL_F90_LIBSH_TARGET} ${HDF5_HL_F90_C_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET}) set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_HL_F90_LIBSH_TARGET}") @@ -208,10 +208,10 @@ if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) set_property (TARGET ${HDF5_HL_F90_LIBSH_TARGET} APPEND PROPERTY COMPILE_DEFINITIONS "BUILD_HDF5_HL_DLL;HDF5F90_WINDOWS" ) - endif (WIN32) + endif () set (install_targets ${install_targets} ${HDF5_HL_F90_LIBSH_TARGET}) add_dependencies(${HDF5_HL_F90_LIBSH_TARGET} H5HLgenSH) -endif (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) +endif () #----------------------------------------------------------------------------- # Add file(s) to CMake Install @@ -253,7 +253,7 @@ if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) COMPONENT fortheaders ) -endif (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) +endif () #----------------------------------------------------------------------------- # Add Target(s) to CMake Install for import into other projects @@ -262,7 +262,9 @@ if (HDF5_EXPORTED_TARGETS) if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) INSTALL_TARGET_PDB (${HDF5_HL_F90_C_LIBSH_TARGET} ${HDF5_INSTALL_BIN_DIR} hlfortlibraries) #INSTALL_TARGET_PDB (${HDF5_HL_F90_LIBSH_TARGET} ${HDF5_INSTALL_BIN_DIR} hlfortlibraries) - endif (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) + endif () + INSTALL_TARGET_PDB (${HDF5_HL_F90_C_LIB_TARGET} ${HDF5_INSTALL_BIN_DIR} hlfortlibraries) + #INSTALL_TARGET_PDB (${HDF5_HL_F90_LIB_TARGET} ${HDF5_INSTALL_BIN_DIR} hlfortlibraries) install ( TARGETS @@ -275,4 +277,4 @@ if (HDF5_EXPORTED_TARGETS) FRAMEWORK DESTINATION ${HDF5_INSTALL_FWRK_DIR} COMPONENT hlfortlibraries INCLUDES DESTINATION include ) -endif (HDF5_EXPORTED_TARGETS) +endif () diff --git a/hl/fortran/test/CMakeLists.txt b/hl/fortran/test/CMakeLists.txt index 13cb177..3138173 100644 --- a/hl/fortran/test/CMakeLists.txt +++ b/hl/fortran/test/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 3.1.0) +cmake_minimum_required (VERSION 3.2.2) PROJECT (HDF5_HL_FORTRAN_TESTS C CXX Fortran) #----------------------------------------------------------------------------- @@ -25,7 +25,7 @@ if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) FOLDER test/hl/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared ) -endif (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) +endif () #-- Adding test for hl_f90_tstlite add_executable (hl_f90_tstlite tstlite.F90) @@ -46,7 +46,7 @@ if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) FOLDER test/hl/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared ) -endif (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) +endif () #-- Adding test for hl_f90_tstimage add_executable (hl_f90_tstimage tstimage.F90) @@ -67,7 +67,7 @@ if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) FOLDER test/hl/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared ) -endif (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) +endif () #-- Adding test for hl_f90_tsttable add_executable (hl_f90_tsttable tsttable.F90) @@ -88,6 +88,6 @@ if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) FOLDER test/hl/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared ) -endif (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) +endif () include (CMakeTests.cmake) diff --git a/hl/fortran/test/CMakeTests.cmake b/hl/fortran/test/CMakeTests.cmake index c538ae8..3c8a831 100644 --- a/hl/fortran/test/CMakeTests.cmake +++ b/hl/fortran/test/CMakeTests.cmake @@ -21,16 +21,68 @@ add_test ( tstds.h5 ) -add_test (NAME HL_FORTRAN_f90_tstds COMMAND $) +if (HDF5_ENABLE_USING_MEMCHECKER) + add_test (NAME HL_FORTRAN_f90_tstds COMMAND $) +else () + add_test (NAME HL_FORTRAN_f90_tstds COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$" + -D "TEST_ARGS:STRING=" + -D "TEST_EXPECT=0" + -D "TEST_SKIP_COMPARE=TRUE" + -D "TEST_OUTPUT=hl_f90_tstds.txt" + #-D "TEST_REFERENCE=hl_f90_tstds.out" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) +endif () set_tests_properties (HL_FORTRAN_f90_tstds PROPERTIES DEPENDS HL_FORTRAN_test-clear-objects) -add_test (NAME HL_FORTRAN_f90_tstlite COMMAND $) +if (HDF5_ENABLE_USING_MEMCHECKER) + add_test (NAME HL_FORTRAN_f90_tstlite COMMAND $) +else () + add_test (NAME HL_FORTRAN_f90_tstlite COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$" + -D "TEST_ARGS:STRING=" + -D "TEST_EXPECT=0" + -D "TEST_SKIP_COMPARE=TRUE" + -D "TEST_OUTPUT=hl_f90_tstlite.txt" + #-D "TEST_REFERENCE=hl_f90_tstlite.out" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) +endif () set_tests_properties (HL_FORTRAN_f90_tstlite PROPERTIES DEPENDS HL_FORTRAN_test-clear-objects) -add_test (NAME HL_FORTRAN_f90_tstimage COMMAND $) +if (HDF5_ENABLE_USING_MEMCHECKER) + add_test (NAME HL_FORTRAN_f90_tstimage COMMAND $) +else () + add_test (NAME HL_FORTRAN_f90_tstimage COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$" + -D "TEST_ARGS:STRING=" + -D "TEST_EXPECT=0" + -D "TEST_SKIP_COMPARE=TRUE" + -D "TEST_OUTPUT=hl_f90_tstimage.txt" + #-D "TEST_REFERENCE=hl_f90_tstimage.out" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) +endif () set_tests_properties (HL_FORTRAN_f90_tstimage PROPERTIES DEPENDS HL_FORTRAN_test-clear-objects) -add_test (NAME HL_FORTRAN_f90_tsttable COMMAND $) +if (HDF5_ENABLE_USING_MEMCHECKER) + add_test (NAME HL_FORTRAN_f90_tsttable COMMAND $) +else () + add_test (NAME HL_FORTRAN_f90_tsttable COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$" + -D "TEST_ARGS:STRING=" + -D "TEST_EXPECT=0" + -D "TEST_SKIP_COMPARE=TRUE" + -D "TEST_OUTPUT=hl_f90_tsttable.txt" + #-D "TEST_REFERENCE=hl_f90_tsttable.out" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) +endif () set_tests_properties (HL_FORTRAN_f90_tsttable PROPERTIES DEPENDS HL_FORTRAN_test-clear-objects) if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) @@ -52,15 +104,67 @@ if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) PROPERTIES DEPENDS "HL_FORTRAN_f90_tsttable;HL_FORTRAN_f90_tstimage;HL_FORTRAN_f90_tstlite;HL_FORTRAN_f90_tstds" ) - add_test (NAME HL_FORTRAN_f90_tstds-shared COMMAND $) + if (HDF5_ENABLE_USING_MEMCHECKER) + add_test (NAME HL_FORTRAN_f90_tstds-shared COMMAND $) + else () + add_test (NAME HL_FORTRAN_f90_tstds-shared COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$" + -D "TEST_ARGS:STRING=" + -D "TEST_EXPECT=0" + -D "TEST_SKIP_COMPARE=TRUE" + -D "TEST_OUTPUT=hl_f90_tstds-shared.txt" + #-D "TEST_REFERENCE=hl_f90_tstds-shared.out" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) + endif () set_tests_properties (HL_FORTRAN_f90_tstds-shared PROPERTIES DEPENDS HL_FORTRAN_test-shared-clear-objects) - add_test (NAME HL_FORTRAN_f90_tstlite-shared COMMAND $) + if (HDF5_ENABLE_USING_MEMCHECKER) + add_test (NAME HL_FORTRAN_f90_tstlite-shared COMMAND $) + else () + add_test (NAME HL_FORTRAN_f90_tstlite-shared COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$" + -D "TEST_ARGS:STRING=" + -D "TEST_EXPECT=0" + -D "TEST_SKIP_COMPARE=TRUE" + -D "TEST_OUTPUT=hl_f90_tstlite-shared.txt" + #-D "TEST_REFERENCE=hl_f90_tstlite-shared.out" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) + endif () set_tests_properties (HL_FORTRAN_f90_tstlite-shared PROPERTIES DEPENDS HL_FORTRAN_test-shared-clear-objects) - add_test (NAME HL_FORTRAN_f90_tstimage-shared COMMAND $) + if (HDF5_ENABLE_USING_MEMCHECKER) + add_test (NAME HL_FORTRAN_f90_tstimage-shared COMMAND $) + else () + add_test (NAME HL_FORTRAN_f90_tstimage-shared COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$" + -D "TEST_ARGS:STRING=" + -D "TEST_EXPECT=0" + -D "TEST_SKIP_COMPARE=TRUE" + -D "TEST_OUTPUT=hl_f90_tstimage-shared.txt" + #-D "TEST_REFERENCE=hl_f90_tstimage-shared.out" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) + endif () set_tests_properties (HL_FORTRAN_f90_tstimage-shared PROPERTIES DEPENDS HL_FORTRAN_test-shared-clear-objects) - add_test (NAME HL_FORTRAN_f90_tsttable-shared COMMAND $) + if (HDF5_ENABLE_USING_MEMCHECKER) + add_test (NAME HL_FORTRAN_f90_tsttable-shared COMMAND $) + else () + add_test (NAME HL_FORTRAN_f90_tsttable-shared COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$" + -D "TEST_ARGS:STRING=" + -D "TEST_EXPECT=0" + -D "TEST_SKIP_COMPARE=TRUE" + -D "TEST_OUTPUT=hl_f90_tsttable-shared.txt" + #-D "TEST_REFERENCE=hl_f90_tsttable-shared.out" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) + endif () set_tests_properties (HL_FORTRAN_f90_tsttable-shared PROPERTIES DEPENDS HL_FORTRAN_test-shared-clear-objects) -endif (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) +endif () diff --git a/hl/src/CMakeLists.txt b/hl/src/CMakeLists.txt index 0c71583..86472fb 100644 --- a/hl/src/CMakeLists.txt +++ b/hl/src/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 3.1.0) +cmake_minimum_required (VERSION 3.2.2) PROJECT (HDF5_HL_SRC) #----------------------------------------------------------------------------- @@ -53,7 +53,7 @@ if (BUILD_SHARED_LIBS) ) set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_HL_LIBSH_TARGET}") set (install_targets ${install_targets} ${HDF5_HL_LIBSH_TARGET}) -endif (BUILD_SHARED_LIBS) +endif () #----------------------------------------------------------------------------- # Add file(s) to CMake Install @@ -73,7 +73,8 @@ install ( if (HDF5_EXPORTED_TARGETS) if (BUILD_SHARED_LIBS) INSTALL_TARGET_PDB (${HDF5_HL_LIBSH_TARGET} ${HDF5_INSTALL_BIN_DIR} hllibraries) - endif (BUILD_SHARED_LIBS) + endif () + INSTALL_TARGET_PDB (${HDF5_HL_LIB_TARGET} ${HDF5_INSTALL_BIN_DIR} hllibraries) install ( TARGETS @@ -86,4 +87,4 @@ if (HDF5_EXPORTED_TARGETS) FRAMEWORK DESTINATION ${HDF5_INSTALL_FWRK_DIR} COMPONENT hllibraries INCLUDES DESTINATION include ) -endif (HDF5_EXPORTED_TARGETS) +endif () diff --git a/hl/test/CMakeLists.txt b/hl/test/CMakeLists.txt index 987c5bb..8845505 100644 --- a/hl/test/CMakeLists.txt +++ b/hl/test/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 3.1.0) +cmake_minimum_required (VERSION 3.2.2) PROJECT (HDF5_HL_TEST) # -------------------------------------------------------------------- # Notes: When creating unit test executables they should be prefixed @@ -30,7 +30,7 @@ MACRO (HL_ADD_EXE hl_name) ${HDF5_LIB_TARGET} ) set_target_properties (hl_${hl_name} PROPERTIES FOLDER test/hl) -ENDMACRO (HL_ADD_EXE) +ENDMACRO () MACRO (HL_ADD_SHEXE hl_name) add_executable (hl_${hl_name} ${hl_name}.c) @@ -42,7 +42,7 @@ MACRO (HL_ADD_SHEXE hl_name) ${HDF5_LIBSH_TARGET} ) set_target_properties (hl_${hl_name} PROPERTIES FOLDER test/hl) -ENDMACRO (HL_ADD_SHEXE) +ENDMACRO () HL_ADD_EXE (test_lite) HL_ADD_EXE (test_image) @@ -88,6 +88,6 @@ if (HDF5_BUILD_GENERATORS) ${HDF5_LIB_TARGET} ) set_target_properties (hl_gen_test_ld PROPERTIES FOLDER test/hl/gen) -endif (HDF5_BUILD_GENERATORS) +endif () include (CMakeTests.cmake) diff --git a/hl/test/CMakeTests.cmake b/hl/test/CMakeTests.cmake index 228853d..211c501 100644 --- a/hl/test/CMakeTests.cmake +++ b/hl/test/CMakeTests.cmake @@ -29,21 +29,34 @@ set (HL_REFERENCE_TEST_FILES # -------------------------------------------------------------------- foreach (h5_file ${HL_REFERENCE_TEST_FILES}) HDFTEST_COPY_FILE("${HDF5_HL_TEST_SOURCE_DIR}/${h5_file}" "${HDF5_HL_TEST_BINARY_DIR}/${h5_file}" "hl_test_files") -endforeach (h5_file ${HL_REFERENCE_TEST_FILES}) +endforeach () add_custom_target(hl_test_files ALL COMMENT "Copying files needed by hl_test tests" DEPENDS ${hl_test_files_list}) # -------------------------------------------------------------------- # Macro used to add a unit test # -------------------------------------------------------------------- -MACRO (HL_ADD_TEST hl_name) - add_test (NAME HL_${hl_name} COMMAND $) +macro (HL_ADD_TEST hl_name) + if (HDF5_ENABLE_USING_MEMCHECKER) + add_test (NAME HL_${hl_name} COMMAND $) + else () + add_test (NAME HL_${hl_name} COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$" + -D "TEST_ARGS:STRING=" + -D "TEST_EXPECT=0" + -D "TEST_SKIP_COMPARE=TRUE" + -D "TEST_OUTPUT=hl_${hl_name}.txt" + #-D "TEST_REFERENCE=hl_${hl_name}.out" + -D "TEST_FOLDER=${HDF5_HL_TEST_BINARY_DIR}" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) + endif () if (NOT "${last_test}" STREQUAL "") set_tests_properties (HL_${hl_name} PROPERTIES DEPENDS ${last_test} ENVIRONMENT "srcdir=${HDF5_HL_TEST_BINARY_DIR}" WORKING_DIRECTORY ${HDF5_HL_TEST_BINARY_DIR} ) endif () -ENDMACRO (HL_ADD_TEST) +endmacro () # Remove any output file left over from previous test run add_test ( @@ -82,7 +95,7 @@ add_test ( ) if (NOT "${last_test}" STREQUAL "") set_tests_properties (HL_test-clear-objects PROPERTIES DEPENDS ${last_test}) -endif (NOT "${last_test}" STREQUAL "") +endif () set (last_test "HL_test-clear-objects") HL_add_test (test_lite ) diff --git a/hl/tools/CMakeLists.txt b/hl/tools/CMakeLists.txt index 8384b59..9536517 100644 --- a/hl/tools/CMakeLists.txt +++ b/hl/tools/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 3.1.0) +cmake_minimum_required (VERSION 3.2.2) PROJECT (HDF5_HL_TOOLS C CXX) add_subdirectory (${HDF5_HL_TOOLS_SOURCE_DIR}/gif2h5 ${HDF5_HL_TOOLS_BINARY_DIR}/gif2h5) diff --git a/hl/tools/gif2h5/CMakeLists.txt b/hl/tools/gif2h5/CMakeLists.txt index 9e6e828..9d7a406 100644 --- a/hl/tools/gif2h5/CMakeLists.txt +++ b/hl/tools/gif2h5/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 3.1.0) +cmake_minimum_required (VERSION 3.2.2) PROJECT (HDF5_HL_TOOLS_GIF2H5) #----------------------------------------------------------------------------- @@ -50,19 +50,21 @@ if (BUILD_TESTING) set_target_properties (hl_h52gifgentest PROPERTIES FOLDER generator/tools/hl) # add_test (NAME hl_h52gifgentest COMMAND $) - endif (HDF5_BUILD_GENERATORS) + endif () include (CMakeTests.cmake) -endif (BUILD_TESTING) +endif () #----------------------------------------------------------------------------- # Add file(s) to CMake Install #----------------------------------------------------------------------------- -install ( - TARGETS - gif2h5 - h52gif - EXPORT - ${HDF5_EXPORTED_TARGETS} - RUNTIME DESTINATION ${HDF5_INSTALL_BIN_DIR} COMPONENT hltoolsapplications -) +if (HDF5_EXPORTED_TARGETS) + install ( + TARGETS + gif2h5 + h52gif + EXPORT + ${HDF5_EXPORTED_TARGETS} + RUNTIME DESTINATION ${HDF5_INSTALL_BIN_DIR} COMPONENT hltoolsapplications + ) +endif () diff --git a/hl/tools/h5watch/CMakeLists.txt b/hl/tools/h5watch/CMakeLists.txt index 6d55abc..fde40e3 100644 --- a/hl/tools/h5watch/CMakeLists.txt +++ b/hl/tools/h5watch/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 3.1.0) +cmake_minimum_required (VERSION 3.2.2) PROJECT (HDF5_HL_TOOLS_H5WATCH) #----------------------------------------------------------------------------- @@ -49,13 +49,17 @@ if (BUILD_TESTING) set_target_properties (h5watchgentest PROPERTIES FOLDER generator/tools/hl) include (CMakeTests.cmake) -endif (BUILD_TESTING) +endif () #----------------------------------------------------------------------------- # Add file(s) to CMake Install #----------------------------------------------------------------------------- -install ( - TARGETS - h5watch - RUNTIME DESTINATION ${HDF5_INSTALL_BIN_DIR} COMPONENT hltoolsapplications -) +if (HDF5_EXPORTED_TARGETS) + install ( + TARGETS + h5watch + EXPORT + ${HDF5_EXPORTED_TARGETS} + RUNTIME DESTINATION ${HDF5_INSTALL_BIN_DIR} COMPONENT hltoolsapplications + ) +endif () diff --git a/hl/tools/h5watch/CMakeTests.cmake b/hl/tools/h5watch/CMakeTests.cmake index 3242a72..2242692 100644 --- a/hl/tools/h5watch/CMakeTests.cmake +++ b/hl/tools/h5watch/CMakeTests.cmake @@ -56,7 +56,7 @@ foreach (h5watch_file ${H5WATCH_TEST_FILES}) COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different ${HDF5_HL_TOOLS_DIR}/testfiles/${h5watch_file} ${dest} ) -endforeach (h5watch_file ${H5WATCH_TEST_FILES}) +endforeach () ############################################################################## ############################################################################## @@ -64,21 +64,9 @@ endforeach (h5watch_file ${H5WATCH_TEST_FILES}) ############################################################################## ############################################################################## - MACRO (ADD_H5_TEST resultfile resultcode) + macro (ADD_H5_TEST resultfile resultcode) if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( - NAME H5WATCH_ARGS-${resultfile}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - ${resultfile}.out - ${resultfile}.out.err - ) - set_tests_properties (H5WATCH_ARGS-${resultfile}-clear-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") - if (NOT "${last_test}" STREQUAL "") - set_tests_properties (H5WATCH_ARGS-${resultfile}-clear-objects PROPERTIES DEPENDS ${last_test}) - endif (NOT "${last_test}" STREQUAL "") - set (last_test "H5WATCH_ARGS-${resultfile}-clearall-objects") - add_test ( NAME H5WATCH_ARGS-h5watch-${resultfile} COMMAND "${CMAKE_COMMAND}" -D "TEST_PROGRAM=$" @@ -89,20 +77,18 @@ endforeach (h5watch_file ${H5WATCH_TEST_FILES}) -D "TEST_REFERENCE=${resultfile}.ddl" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) - set_tests_properties (H5WATCH_ARGS-h5watch-${resultfile} PROPERTIES DEPENDS H5WATCH_ARGS-${resultfile}-clear-objects) - set (last_test "H5WATCH_ARGS-${resultfile}") - endif (NOT HDF5_ENABLE_USING_MEMCHECKER) - ENDMACRO (ADD_H5_TEST resultfile resultcode resultoption) + set_tests_properties (H5WATCH_ARGS-h5watch-${resultfile} PROPERTIES DEPENDS ${last_test}) + set (last_test "H5WATCH_ARGS-h5watch-${resultfile}") + endif () + endmacro () - MACRO (ADD_H5_WATCH resultfile resultcode) + macro (ADD_H5_WATCH resultfile resultcode) if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( NAME H5WATCH-${resultfile}-clear-objects COMMAND ${CMAKE_COMMAND} -E remove ${resultfile}.h5 - ${resultfile}.out - ${resultfile}.out.err ) set_tests_properties (H5WATCH-${resultfile}-clear-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") add_test ( @@ -117,8 +103,8 @@ endforeach (h5watch_file ${H5WATCH_TEST_FILES}) -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) set_tests_properties (H5WATCH-${resultfile} PROPERTIES DEPENDS H5WATCH-${resultfile}-clear-objects) - endif (NOTHDF5_ENABLE_USING_MEMCHECKER) - ENDMACRO (ADD_H5_WATCH resultfile resultcode) + endif () + endmacro () ############################################################################## ############################################################################## @@ -130,7 +116,7 @@ endforeach (h5watch_file ${H5WATCH_TEST_FILES}) # supports SWMR. set (SWMR_INCOMPAT ${hl_swmr_check_compat_vfd}) -IF (NOT SWMR_INCOMPAT) +if (NOT SWMR_INCOMPAT) # Remove any output file left over from previous test run add_test ( NAME H5WATCH-clearall-objects @@ -140,7 +126,7 @@ IF (NOT SWMR_INCOMPAT) ) if (NOT "${last_test}" STREQUAL "") set_tests_properties (H5WATCH-clearall-objects PROPERTIES DEPENDS ${last_test}) - endif (NOT "${last_test}" STREQUAL "") + endif () set (last_test "H5WATCH-clearall-objects") ################################################################################################# @@ -169,23 +155,23 @@ IF (NOT SWMR_INCOMPAT) set (last_test "H5WATCH-h5watchgentest") # Test on --help options - ADD_H5_TEST(w-help1 0 --help) + ADD_H5_TEST (w-help1 0 --help) # # Tests on expected failures - ADD_H5_TEST(w-err-dset1 1 WATCH.h5) - ADD_H5_TEST(w-err-dset2 1 WATCH.h5/group/DSET_CMPD) - ADD_H5_TEST(w-err-dset-none 1 WATCH.h5/DSET_NONE) - ADD_H5_TEST(w-err-dset-nomax 1 WATCH.h5/DSET_NOMAX) - ADD_H5_TEST(w-err-file 1 ../WATCH.h5/DSET_CMPD) - ADD_H5_TEST(w-err-width 1 --width=-8 WATCH.h5/DSET_ONE) - ADD_H5_TEST(w-err-poll 1 --polling=-8 WATCH.h5/DSET_ONE) - ADD_H5_TEST(w-err-poll0 1 --polling=0 WATCH.h5/DSET_ONE) + ADD_H5_TEST (w-err-dset1 1 WATCH.h5) + ADD_H5_TEST (w-err-dset2 1 WATCH.h5/group/DSET_CMPD) + ADD_H5_TEST (w-err-dset-none 1 WATCH.h5/DSET_NONE) + ADD_H5_TEST (w-err-dset-nomax 1 WATCH.h5/DSET_NOMAX) + ADD_H5_TEST (w-err-file 1 ../WATCH.h5/DSET_CMPD) + ADD_H5_TEST (w-err-width 1 --width=-8 WATCH.h5/DSET_ONE) + ADD_H5_TEST (w-err-poll 1 --polling=-8 WATCH.h5/DSET_ONE) + ADD_H5_TEST (w-err-poll0 1 --polling=0 WATCH.h5/DSET_ONE) # # Tests on invalid field names via --fields option for a compound typed dataset: DSET_CMPD - ADD_H5_TEST(w-err-cmpd1 1 --fields=fieldx WATCH.h5/DSET_CMPD) - ADD_H5_TEST(w-err-cmpd2 1 --fields=field1,field2. WATCH.h5/DSET_CMPD) - ADD_H5_TEST(w-err-cmpd3 1 --fields=field1,field2, WATCH.h5/DSET_CMPD) - ADD_H5_TEST(w-err-cmpd4 1 --fields=field1,field2.b.k WATCH.h5/DSET_CMPD) - ADD_H5_TEST(w-err-cmpd5 1 --fields=field1 --fields=field2.b.k WATCH.h5/DSET_CMPD) + ADD_H5_TEST (w-err-cmpd1 1 --fields=fieldx WATCH.h5/DSET_CMPD) + ADD_H5_TEST (w-err-cmpd2 1 --fields=field1,field2. WATCH.h5/DSET_CMPD) + ADD_H5_TEST (w-err-cmpd3 1 --fields=field1,field2, WATCH.h5/DSET_CMPD) + ADD_H5_TEST (w-err-cmpd4 1 --fields=field1,field2.b.k WATCH.h5/DSET_CMPD) + ADD_H5_TEST (w-err-cmpd5 1 --fields=field1 --fields=field2.b.k WATCH.h5/DSET_CMPD) # -ENDIF (NOT SWMR_INCOMPAT) +endif () diff --git a/java/CMakeLists.txt b/java/CMakeLists.txt index 706b196..d37a409 100644 --- a/java/CMakeLists.txt +++ b/java/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.1.0) +cmake_minimum_required(VERSION 3.2.2) PROJECT ( HDF5_JAVA C Java ) set (CMAKE_MODULE_PATH "${HDF_RESOURCES_DIR};${HDF_RESOURCES_EXT_DIR}") @@ -15,9 +15,9 @@ INCLUDE_DIRECTORIES ( ${JNI_INCLUDE_DIRS} ) if (WIN32) set (HDF_JRE_DIRECTORY "C:/Program Files/Java/jre8") -else (WIN32) +else () set (HDF_JRE_DIRECTORY "/usr/lib/jvm/jre") -endif (WIN32) +endif () #----------------------------------------------------------------------------- # Include the main src and config directories @@ -41,14 +41,14 @@ add_subdirectory (${HDF5_JAVA_SOURCE_DIR}/src ${HDF5_JAVA_BINARY_DIR}/src) #----------------------------------------------------------------------------- if (HDF5_BUILD_EXAMPLES) add_subdirectory (${HDF5_JAVA_SOURCE_DIR}/examples ${HDF5_JAVA_BINARY_DIR}/examples) -endif (HDF5_BUILD_EXAMPLES) +endif () #----------------------------------------------------------------------------- # Testing #----------------------------------------------------------------------------- if (BUILD_TESTING) add_subdirectory (${HDF5_JAVA_SOURCE_DIR}/test ${HDF5_JAVA_BINARY_DIR}/test) -endif (BUILD_TESTING) +endif () #----------------------------------------------------------------------------- # Add Required Jar(s) @@ -72,4 +72,4 @@ if (HDF5_JAVA_PACK_JRE) DESTINATION ${HDF5_INSTALL_BIN_DIR} USE_SOURCE_PERMISSIONS ) -endif (HDF5_JAVA_PACK_JRE) +endif () diff --git a/java/examples/CMakeLists.txt b/java/examples/CMakeLists.txt index 0430bdb..a1a7483 100644 --- a/java/examples/CMakeLists.txt +++ b/java/examples/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 3.1.0) +cmake_minimum_required (VERSION 3.2.2) PROJECT (HDFJAVA_EXAMPLES) add_subdirectory (${HDFJAVA_EXAMPLES_SOURCE_DIR}/datasets datasets) diff --git a/java/examples/datasets/CMakeLists.txt b/java/examples/datasets/CMakeLists.txt index 3a69359..d698cfd 100644 --- a/java/examples/datasets/CMakeLists.txt +++ b/java/examples/datasets/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 3.1.0) +cmake_minimum_required (VERSION 3.2.2) PROJECT (HDFJAVA_EXAMPLES_DATASETS Java) set (CMAKE_VERBOSE_MAKEFILE 1) @@ -31,16 +31,16 @@ set (HDF_JAVA_EXAMPLES if (WIN32) set (CMAKE_JAVA_INCLUDE_FLAG_SEP ";") -else (WIN32) +else () set (CMAKE_JAVA_INCLUDE_FLAG_SEP ":") -endif (WIN32) +endif () set (CMAKE_JAVA_INCLUDE_PATH "${HDF5_JAVA_JARS}") set (CMAKE_JAVA_CLASSPATH ".") foreach (CMAKE_INCLUDE_PATH ${CMAKE_JAVA_INCLUDE_PATH}) set (CMAKE_JAVA_CLASSPATH "${CMAKE_JAVA_CLASSPATH}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${CMAKE_INCLUDE_PATH}") -endforeach (CMAKE_INCLUDE_PATH) +endforeach () foreach (example ${HDF_JAVA_EXAMPLES}) file (WRITE ${PROJECT_BINARY_DIR}/${example}_Manifest.txt @@ -52,23 +52,23 @@ foreach (example ${HDF_JAVA_EXAMPLES}) # install_jar (${example} ${HJAVA_INSTALL_DATA_DIR}/examples examples) get_target_property (${example}_CLASSPATH ${example} CLASSDIR) add_dependencies (${example} ${HDF5_JAVA_HDF5_LIB_TARGET}) -endforeach (example ${HDF_JAVA_EXAMPLES}) +endforeach () set (CMAKE_JAVA_INCLUDE_PATH "${HDF5_JAVA_JARS};${HDF5_JAVA_LOGGING_JAR};${HDF5_JAVA_LOGGING_NOP_JAR}") set (CMAKE_JAVA_CLASSPATH ".") foreach (HDFJAVA_JAR ${CMAKE_JAVA_INCLUDE_PATH}) set (CMAKE_JAVA_CLASSPATH "${CMAKE_JAVA_CLASSPATH}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${HDFJAVA_JAR}") -endforeach (HDFJAVA_JAR) +endforeach () MACRO (ADD_H5_TEST resultfile resultcode) if (CMAKE_BUILD_TYPE MATCHES Debug) if (WIN32) set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=hdf5_java_D;") - else() + else () set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=hdf5_java_debug;") - endif() - endif(CMAKE_BUILD_TYPE MATCHES Debug) + endif () + endif () add_test ( NAME JAVA_datasets-${resultfile} COMMAND "${CMAKE_COMMAND}" @@ -85,16 +85,16 @@ MACRO (ADD_H5_TEST resultfile resultcode) ) if (NOT "${last_test}" STREQUAL "") set_tests_properties (JAVA_datasets-${resultfile} PROPERTIES DEPENDS ${last_test}) - endif (NOT "${last_test}" STREQUAL "") + endif () set (last_test "JAVA_datasets-${resultfile}") -ENDMACRO (ADD_H5_TEST file) +ENDMACRO () if (BUILD_TESTING) # detect whether the encoder is present. if (H5_HAVE_FILTER_DEFLATE) set (USE_FILTER_DEFLATE "true") - endif (H5_HAVE_FILTER_DEFLATE) + endif () if (H5_HAVE_FILTER_SZIP) set (USE_FILTER_SZIP "true") @@ -109,17 +109,17 @@ if (BUILD_TESTING) ${HDFJAVA_EXAMPLES_BINARY_DIR}/${example}.h5 ${HDFJAVA_EXAMPLES_BINARY_DIR}/${example}.data ) - else (${example} STREQUAL "H5Ex_D_External") + else () add_test ( NAME JAVA_datasets-${example}-clear-objects COMMAND ${CMAKE_COMMAND} -E remove ${HDFJAVA_EXAMPLES_BINARY_DIR}/${example}.h5 ) - endif (${example} STREQUAL "H5Ex_D_External") + endif () if (NOT "${last_test}" STREQUAL "") set_tests_properties (JAVA_datasets-${example}-clear-objects PROPERTIES DEPENDS ${last_test}) - endif (NOT "${last_test}" STREQUAL "") + endif () add_test ( NAME JAVA_datasets-${example}-copy-objects COMMAND ${CMAKE_COMMAND} @@ -132,10 +132,10 @@ if (BUILD_TESTING) if (${example} STREQUAL "H5Ex_D_Szip") if (USE_FILTER_SZIP) ADD_H5_TEST (${example} 0) - endif (USE_FILTER_SZIP) - else (${example} STREQUAL "H5Ex_D_Szip") + endif () + else () ADD_H5_TEST (${example} 0) - endif (${example} STREQUAL "H5Ex_D_Szip") + endif () - endforeach (example ${HDF_JAVA_EXAMPLES}) -endif (BUILD_TESTING) + endforeach () +endif () diff --git a/java/examples/datasets/H5Ex_D_Chunk.java b/java/examples/datasets/H5Ex_D_Chunk.java index 7f02e5a..b12b227 100644 --- a/java/examples/datasets/H5Ex_D_Chunk.java +++ b/java/examples/datasets/H5Ex_D_Chunk.java @@ -44,7 +44,7 @@ public class H5Ex_D_Chunk { // Values for the status of space allocation enum H5D_layout { - H5D_LAYOUT_ERROR(-1), H5D_COMPACT(0), H5D_CONTIGUOUS(1), H5D_CHUNKED(2), H5D_NLAYOUTS(3); + H5D_LAYOUT_ERROR(-1), H5D_COMPACT(0), H5D_CONTIGUOUS(1), H5D_CHUNKED(2), H5D_VIRTUAL(3), H5D_NLAYOUTS(4); private static final Map lookup = new HashMap(); static { @@ -250,6 +250,9 @@ public class H5Ex_D_Chunk { case H5D_CHUNKED: System.out.println("H5D_CHUNKED"); break; + case H5D_VIRTUAL: + System.out.println("H5D_VIRTUAL"); + break; case H5D_LAYOUT_ERROR: break; case H5D_NLAYOUTS: diff --git a/java/examples/datasets/H5Ex_D_Compact.java b/java/examples/datasets/H5Ex_D_Compact.java index 4f1e2f0..0417c7c 100644 --- a/java/examples/datasets/H5Ex_D_Compact.java +++ b/java/examples/datasets/H5Ex_D_Compact.java @@ -38,7 +38,7 @@ public class H5Ex_D_Compact { // Values for the status of space allocation enum H5D_layout { - H5D_LAYOUT_ERROR(-1), H5D_COMPACT(0), H5D_CONTIGUOUS(1), H5D_CHUNKED(2), H5D_NLAYOUTS(3); + H5D_LAYOUT_ERROR(-1), H5D_COMPACT(0), H5D_CONTIGUOUS(1), H5D_CHUNKED(2), H5D_VIRTUAL(3), H5D_NLAYOUTS(4); private static final Map lookup = new HashMap(); static { @@ -212,6 +212,9 @@ public class H5Ex_D_Compact { case H5D_CHUNKED: System.out.println("H5D_CHUNKED"); break; + case H5D_VIRTUAL: + System.out.println("H5D_VIRTUAL"); + break; case H5D_LAYOUT_ERROR: break; case H5D_NLAYOUTS: diff --git a/java/examples/datasets/runExample.sh.in b/java/examples/datasets/runExample.sh.in index 440de33..53d8070 100644 --- a/java/examples/datasets/runExample.sh.in +++ b/java/examples/datasets/runExample.sh.in @@ -161,6 +161,8 @@ CLEAN_DATAFILES_AND_BLDDIR() { $RM $BLDDIR/examples.datasets.H5Ex_D_*.txt $RM $BLDDIR/H5Ex_D_*.out + $RM $BLDDIR/H5Ex_D_*.h5 + $RM $BLDDIR/H5Ex_D_External.data } # Print a line-line message left justified in a field of 70 characters diff --git a/java/examples/datatypes/CMakeLists.txt b/java/examples/datatypes/CMakeLists.txt index 3eae115..8569b8b 100644 --- a/java/examples/datatypes/CMakeLists.txt +++ b/java/examples/datatypes/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 3.1.0) +cmake_minimum_required (VERSION 3.2.2) PROJECT (HDFJAVA_EXAMPLES_DATATYPES Java) set (CMAKE_VERBOSE_MAKEFILE 1) @@ -31,16 +31,16 @@ set (HDF_JAVA_EXAMPLES if (WIN32) set (CMAKE_JAVA_INCLUDE_FLAG_SEP ";") -else (WIN32) +else () set (CMAKE_JAVA_INCLUDE_FLAG_SEP ":") -endif (WIN32) +endif () set (CMAKE_JAVA_INCLUDE_PATH "${HDF5_JAVA_JARS}") set (CMAKE_JAVA_CLASSPATH ".") foreach (CMAKE_INCLUDE_PATH ${CMAKE_JAVA_INCLUDE_PATH}) set (CMAKE_JAVA_CLASSPATH "${CMAKE_JAVA_CLASSPATH}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${CMAKE_INCLUDE_PATH}") -endforeach (CMAKE_INCLUDE_PATH) +endforeach () foreach (example ${HDF_JAVA_EXAMPLES}) file (WRITE ${PROJECT_BINARY_DIR}/${example}_Manifest.txt @@ -52,23 +52,23 @@ foreach (example ${HDF_JAVA_EXAMPLES}) # install_jar (${example} ${HJAVA_INSTALL_DATA_DIR}/examples examples) get_target_property (${example}_CLASSPATH ${example} CLASSDIR) add_dependencies (${example} ${HDF5_JAVA_HDF5_LIB_TARGET}) -endforeach (example ${HDF_JAVA_EXAMPLES}) +endforeach () set (CMAKE_JAVA_INCLUDE_PATH "${HDF5_JAVA_JARS};${HDF5_JAVA_LOGGING_JAR};${HDF5_JAVA_LOGGING_NOP_JAR}") set (CMAKE_JAVA_CLASSPATH ".") foreach (HDFJAVA_JAR ${CMAKE_JAVA_INCLUDE_PATH}) set (CMAKE_JAVA_CLASSPATH "${CMAKE_JAVA_CLASSPATH}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${HDFJAVA_JAR}") -endforeach (HDFJAVA_JAR) +endforeach () MACRO (ADD_H5_TEST resultfile resultcode) if (CMAKE_BUILD_TYPE MATCHES Debug) if (WIN32) set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=hdf5_java_D;") - else() + else () set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=hdf5_java_debug;") - endif() - endif(CMAKE_BUILD_TYPE MATCHES Debug) + endif () + endif () add_test ( NAME JAVA_datatypes-${resultfile} COMMAND "${CMAKE_COMMAND}" @@ -85,9 +85,9 @@ MACRO (ADD_H5_TEST resultfile resultcode) ) if (NOT "${last_test}" STREQUAL "") set_tests_properties (JAVA_datatypes-${resultfile} PROPERTIES DEPENDS ${last_test}) - endif (NOT "${last_test}" STREQUAL "") + endif () set (last_test "JAVA_datatypes-${resultfile}") -ENDMACRO (ADD_H5_TEST file) +ENDMACRO () if (BUILD_TESTING) foreach (example ${HDF_JAVA_EXAMPLES}) @@ -99,7 +99,7 @@ if (BUILD_TESTING) ) if (NOT "${last_test}" STREQUAL "") set_tests_properties (JAVA_datatypes-${example}-clear-objects PROPERTIES DEPENDS ${last_test}) - endif (NOT "${last_test}" STREQUAL "") + endif () add_test ( NAME JAVA_datatypes-${example}-copy-objects COMMAND ${CMAKE_COMMAND} @@ -110,5 +110,5 @@ if (BUILD_TESTING) set_tests_properties (JAVA_datatypes-${example}-copy-objects PROPERTIES DEPENDS JAVA_datatypes-${example}-clear-objects) set (last_test "JAVA_datatypes-${example}-copy-objects") ADD_H5_TEST (${example} 0) - endforeach (example ${HDF_JAVA_EXAMPLES}) -endif (BUILD_TESTING) + endforeach () +endif () diff --git a/java/examples/datatypes/runExample.sh.in b/java/examples/datatypes/runExample.sh.in index 1b02774..5b8816c 100644 --- a/java/examples/datatypes/runExample.sh.in +++ b/java/examples/datatypes/runExample.sh.in @@ -158,6 +158,7 @@ CLEAN_DATAFILES_AND_BLDDIR() { $RM $BLDDIR/examples.datatypes.H5Ex_T_*.txt $RM $BLDDIR/H5Ex_T_*.out + $RM $BLDDIR/H5Ex_T_*.h5 } # Print a line-line message left justified in a field of 70 characters diff --git a/java/examples/groups/CMakeLists.txt b/java/examples/groups/CMakeLists.txt index 2cab211..bb5f80f 100644 --- a/java/examples/groups/CMakeLists.txt +++ b/java/examples/groups/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 3.1.0) +cmake_minimum_required (VERSION 3.2.2) PROJECT (HDFJAVA_EXAMPLES_GROUPS Java) set (CMAKE_VERBOSE_MAKEFILE 1) @@ -20,16 +20,16 @@ set (HDF_JAVA_EXAMPLES if (WIN32) set (CMAKE_JAVA_INCLUDE_FLAG_SEP ";") -else (WIN32) +else () set (CMAKE_JAVA_INCLUDE_FLAG_SEP ":") -endif (WIN32) +endif () set (CMAKE_JAVA_INCLUDE_PATH "${HDF5_JAVA_JARS}") set (CMAKE_JAVA_CLASSPATH ".") foreach (CMAKE_INCLUDE_PATH ${CMAKE_JAVA_INCLUDE_PATH}) set (CMAKE_JAVA_CLASSPATH "${CMAKE_JAVA_CLASSPATH}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${CMAKE_INCLUDE_PATH}") -endforeach (CMAKE_INCLUDE_PATH) +endforeach () foreach (example ${HDF_JAVA_EXAMPLES}) file (WRITE ${PROJECT_BINARY_DIR}/${example}_Manifest.txt @@ -41,14 +41,14 @@ foreach (example ${HDF_JAVA_EXAMPLES}) # install_jar (${example} ${HJAVA_INSTALL_DATA_DIR}/examples examples) get_target_property (${example}_CLASSPATH ${example} CLASSDIR) add_dependencies (${example} ${HDF5_JAVA_HDF5_LIB_TARGET}) -endforeach (example ${HDF_JAVA_EXAMPLES}) +endforeach () set (CMAKE_JAVA_INCLUDE_PATH "${HDF5_JAVA_JARS};${HDF5_JAVA_LOGGING_JAR};${HDF5_JAVA_LOGGING_NOP_JAR}") set (CMAKE_JAVA_CLASSPATH ".") foreach (HDFJAVA_JAR ${CMAKE_JAVA_INCLUDE_PATH}) set (CMAKE_JAVA_CLASSPATH "${CMAKE_JAVA_CLASSPATH}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${HDFJAVA_JAR}") -endforeach (HDFJAVA_JAR) +endforeach () set (HDF_JAVA_TEST_FILES h5ex_g_iterate.h5 @@ -57,17 +57,17 @@ set (HDF_JAVA_TEST_FILES foreach (h5_file ${HDF_JAVA_TEST_FILES}) HDFTEST_COPY_FILE("${PROJECT_SOURCE_DIR}/${h5_file}" "${PROJECT_BINARY_DIR}/${h5_file}" "H5Ex_G_Visit_files") -endforeach (h5_file ${HDF_JAVA_TEST_FILES}) +endforeach () add_custom_target(H5Ex_G_Visit_files ALL COMMENT "Copying files needed by H5Ex_G_Visit tests" DEPENDS ${H5Ex_G_Visit_files_list}) MACRO (ADD_H5_TEST resultfile resultcode) if (CMAKE_BUILD_TYPE MATCHES Debug) if (WIN32) set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=hdf5_java_D;") - else() + else () set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=hdf5_java_debug;") - endif() - endif(CMAKE_BUILD_TYPE MATCHES Debug) + endif () + endif () add_test ( NAME JAVA_groups-${resultfile} COMMAND "${CMAKE_COMMAND}" @@ -84,9 +84,9 @@ MACRO (ADD_H5_TEST resultfile resultcode) ) if (NOT "${last_test}" STREQUAL "") set_tests_properties (JAVA_groups-${resultfile} PROPERTIES DEPENDS ${last_test}) - endif (NOT "${last_test}" STREQUAL "") + endif () set (last_test "JAVA_groups-${resultfile}") -ENDMACRO (ADD_H5_TEST file) +ENDMACRO () if (BUILD_TESTING) foreach (example ${HDF_JAVA_EXAMPLES}) @@ -99,19 +99,19 @@ if (BUILD_TESTING) ${HDFJAVA_EXAMPLES_BINARY_DIR}/${example}1.h5 ${HDFJAVA_EXAMPLES_BINARY_DIR}/${example}2.h5 ) - else (${example} STREQUAL "H5Ex_G_Compact") + else () add_test ( NAME JAVA_groups-${example}-clear-h5s COMMAND ${CMAKE_COMMAND} -E remove ${HDFJAVA_EXAMPLES_BINARY_DIR}/${example}.h5 ) - endif (${example} STREQUAL "H5Ex_G_Compact") + endif () if (NOT "${last_test}" STREQUAL "") set_tests_properties (JAVA_groups-${example}-clear-h5s PROPERTIES DEPENDS ${last_test}) - endif (NOT "${last_test}" STREQUAL "") + endif () set (last_test "JAVA_groups-${example}-clear-h5s") - endif (NOT ${example} STREQUAL "H5Ex_G_Iterate" AND NOT ${example} STREQUAL "H5Ex_G_Visit") + endif () add_test ( NAME JAVA_groups-${example}-copy-objects COMMAND ${CMAKE_COMMAND} @@ -121,8 +121,8 @@ if (BUILD_TESTING) ) if (NOT "${last_test}" STREQUAL "") set_tests_properties (JAVA_groups-${example}-copy-objects PROPERTIES DEPENDS ${last_test}) - endif (NOT "${last_test}" STREQUAL "") + endif () set (last_test "JAVA_groups-${example}-copy-objects") ADD_H5_TEST (${example} 0) - endforeach (example ${HDF_JAVA_EXAMPLES}) -endif (BUILD_TESTING) + endforeach () +endif () diff --git a/java/examples/groups/runExample.sh.in b/java/examples/groups/runExample.sh.in index 665b307..2a3f1c6 100644 --- a/java/examples/groups/runExample.sh.in +++ b/java/examples/groups/runExample.sh.in @@ -153,6 +153,14 @@ CLEAN_DATAFILES_AND_BLDDIR() { $RM $BLDDIR/examples.groups.H5Ex_G_*.txt $RM $BLDDIR/H5Ex_G_*.out + $RM $BLDDIR/H5Ex_G_*.h5 + SDIR=`$DIRNAME $tstfile` + INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` + INODE_DDIR=`$LS -i -d $BLDDIR | $AWK -F' ' '{print $1}'` + if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then SDIR=`$DIRNAME $tstfile` + $RM $BLDDIR/h5ex_g_iterate.h5 + $RM $BLDDIR/h5ex_g_visit.h5 + fi } COPY_REFFILES="$LIST_REF_FILES" diff --git a/java/examples/intro/CMakeLists.txt b/java/examples/intro/CMakeLists.txt index 2d0c218..9dc4dd7 100644 --- a/java/examples/intro/CMakeLists.txt +++ b/java/examples/intro/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 3.1.0) +cmake_minimum_required (VERSION 3.2.2) PROJECT (HDFJAVA_EXAMPLES_INTRO Java) set (CMAKE_VERBOSE_MAKEFILE 1) @@ -20,16 +20,16 @@ set (HDF_JAVA_EXAMPLES if (WIN32) set (CMAKE_JAVA_INCLUDE_FLAG_SEP ";") -else (WIN32) +else () set (CMAKE_JAVA_INCLUDE_FLAG_SEP ":") -endif (WIN32) +endif () set (CMAKE_JAVA_INCLUDE_PATH "${HDF5_JAVA_JARS}") set (CMAKE_JAVA_CLASSPATH ".") foreach (CMAKE_INCLUDE_PATH ${CMAKE_JAVA_INCLUDE_PATH}) set (CMAKE_JAVA_CLASSPATH "${CMAKE_JAVA_CLASSPATH}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${CMAKE_INCLUDE_PATH}") -endforeach (CMAKE_INCLUDE_PATH) +endforeach () foreach (example ${HDF_JAVA_EXAMPLES}) file (WRITE ${PROJECT_BINARY_DIR}/${example}_Manifest.txt @@ -41,14 +41,14 @@ foreach (example ${HDF_JAVA_EXAMPLES}) # install_jar (${example} ${HJAVA_INSTALL_DATA_DIR}/examples examples) get_target_property (${example}_CLASSPATH ${example} CLASSDIR) add_dependencies (${example} ${HDF5_JAVA_HDF5_LIB_TARGET}) -endforeach (example ${HDF_JAVA_EXAMPLES}) +endforeach () set (CMAKE_JAVA_INCLUDE_PATH "${HDF5_JAVA_JARS};${HDF5_JAVA_LOGGING_JAR};${HDF5_JAVA_LOGGING_NOP_JAR}") set (CMAKE_JAVA_CLASSPATH ".") foreach (HDFJAVA_JAR ${CMAKE_JAVA_INCLUDE_PATH}) set (CMAKE_JAVA_CLASSPATH "${CMAKE_JAVA_CLASSPATH}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${HDFJAVA_JAR}") -endforeach (HDFJAVA_JAR) +endforeach () foreach (example ${HDF_JAVA_OBJECT_EXAMPLES}) file (WRITE ${PROJECT_BINARY_DIR}/${example}_Manifest.txt @@ -60,16 +60,16 @@ foreach (example ${HDF_JAVA_OBJECT_EXAMPLES}) # install_jar (${example} ${HJAVA_INSTALL_DATA_DIR}/examples examples) get_target_property (${example}_CLASSPATH ${example} CLASSDIR) add_dependencies (${example} ${HDFJAVA_H5_LIB_TARGET}) -endforeach (example ${HDF_JAVA_OBJECT_EXAMPLES}) +endforeach () MACRO (ADD_H5_TEST resultfile resultcode) if (CMAKE_BUILD_TYPE MATCHES Debug) if (WIN32) set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=hdf5_java_D;") - else() + else () set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=hdf5_java_debug;") - endif() - endif(CMAKE_BUILD_TYPE MATCHES Debug) + endif () + endif () add_test ( NAME JAVA_intro-${resultfile} COMMAND "${CMAKE_COMMAND}" @@ -86,9 +86,9 @@ MACRO (ADD_H5_TEST resultfile resultcode) ) if (NOT "${last_test}" STREQUAL "") set_tests_properties (JAVA_intro-${resultfile} PROPERTIES DEPENDS ${last_test}) - endif (NOT "${last_test}" STREQUAL "") + endif () set (last_test "JAVA_intro-${resultfile}") -ENDMACRO (ADD_H5_TEST file) +ENDMACRO () if (BUILD_TESTING) @@ -101,7 +101,7 @@ if (BUILD_TESTING) ) if (NOT "${last_test}" STREQUAL "") set_tests_properties (JAVA_intro-${example}-clear-objects PROPERTIES DEPENDS ${last_test}) - endif (NOT "${last_test}" STREQUAL "") + endif () add_test ( NAME JAVA_intro-${example}-copy-objects COMMAND ${CMAKE_COMMAND} @@ -112,6 +112,6 @@ if (BUILD_TESTING) set_tests_properties (JAVA_intro-${example}-copy-objects PROPERTIES DEPENDS JAVA_intro-${example}-clear-objects) set (last_test "JAVA_intro-${example}-copy-objects") ADD_H5_TEST (${example} 0) - endforeach (example ${HDF_JAVA_EXAMPLES}) + endforeach () -endif (BUILD_TESTING) +endif () diff --git a/java/examples/intro/runExample.sh.in b/java/examples/intro/runExample.sh.in index a8e65ff..65ca160 100644 --- a/java/examples/intro/runExample.sh.in +++ b/java/examples/intro/runExample.sh.in @@ -147,6 +147,7 @@ CLEAN_DATAFILES_AND_BLDDIR() { $RM $BLDDIR/examples.intro.H5_*.txt $RM $BLDDIR/H5_*.out + $RM $BLDDIR/H5_*.h5 } # Print a line-line message left justified in a field of 70 characters diff --git a/java/src/CMakeLists.txt b/java/src/CMakeLists.txt index ae78201..3f93f39 100644 --- a/java/src/CMakeLists.txt +++ b/java/src/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.1.0) +cmake_minimum_required(VERSION 3.2.2) PROJECT ( HDF5_JAVA_SRC C Java ) #----------------------------------------------------------------------------- diff --git a/java/src/Makefile.am b/java/src/Makefile.am index 21aa5ec..d9e6f50 100644 --- a/java/src/Makefile.am +++ b/java/src/Makefile.am @@ -130,6 +130,7 @@ CLEANFILES = classhdf5_java.stamp $(jarfile) $(JAVAROOT)/$(pkgpath)/callbacks/*. clean: rm -rf $(JAVAROOT)/* rm -f $(jarfile) + rm -rf javadoc rm -f classhdf5_java.stamp diff --git a/java/src/hdf/CMakeLists.txt b/java/src/hdf/CMakeLists.txt index f465da9..84bda53 100644 --- a/java/src/hdf/CMakeLists.txt +++ b/java/src/hdf/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 3.1.0) +cmake_minimum_required (VERSION 3.2.2) PROJECT (HDF5_JAVA_HDF) add_subdirectory (${HDF5_JAVA_HDF_SOURCE_DIR}/hdf5lib hdf5lib) diff --git a/java/src/hdf/hdf5lib/CMakeLists.txt b/java/src/hdf/hdf5lib/CMakeLists.txt index 5362c44..c856c04 100644 --- a/java/src/hdf/hdf5lib/CMakeLists.txt +++ b/java/src/hdf/hdf5lib/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 3.1.0) +cmake_minimum_required (VERSION 3.2.2) PROJECT (HDF5_JAVA_HDF_HDF5 Java) set (CMAKE_VERBOSE_MAKEFILE 1) @@ -105,7 +105,7 @@ add_jar (${HDF5_JAVA_HDF5_LIB_TARGET} OUTPUT_NAME "${HDF5_JAVA_HDF5_LIB_TARGET}- install_jar (${HDF5_JAVA_HDF5_LIB_TARGET} LIBRARY DESTINATION ${HDF5_INSTALL_JAR_DIR} COMPONENT libraries) #if (NOT WIN32) # install_jni_symlink (${HDF5_JAVA_HDF5_LIB_TARGET} ${HDF5_INSTALL_JAR_DIR} libraries) -#endif (NOT WIN32) +#endif () get_target_property (${HDF5_JAVA_HDF5_LIB_TARGET}_JAR_FILE ${HDF5_JAVA_HDF5_LIB_TARGET} JAR_FILE) SET_GLOBAL_VARIABLE (HDF5_JAVA_JARS_TO_EXPORT "${HDF5_JAVA_JARS_TO_EXPORT};${${HDF5_JAVA_HDF5_LIB_TARGET}_JAR_FILE}") diff --git a/java/src/hdf/hdf5lib/H5.java b/java/src/hdf/hdf5lib/H5.java index 6b2af4b..02d35ba 100644 --- a/java/src/hdf/hdf5lib/H5.java +++ b/java/src/hdf/hdf5lib/H5.java @@ -151,7 +151,7 @@ import hdf.hdf5lib.structs.H5O_info_t; * layout of the source and destination, and the data for the array passed as a block of bytes, for instance, * *
- *      herr_t H5Dread(int fid, int filetype, int memtype, int memspace,
+ *      herr_t H5Dread(long fid, long filetype, long memtype, long memspace,
  *      void * data);
  * 
* @@ -171,7 +171,7 @@ import hdf.hdf5lib.structs.H5O_info_t; * library. So the function above would be declared: * *
- * public synchronized static native int H5Dread(int fid, int filetype, int memtype, int memspace, Object data);
+ * public synchronized static native int H5Dread(long fid, long filetype, long memtype, long memspace, Object data);
  * 
* OPEN_IDS.addElement(id); @@ -192,7 +192,7 @@ import hdf.hdf5lib.structs.H5O_info_t; * can be accessed as public variables of the Java class, such as: * *
- * int data_type = HDF5CDataTypes.JH5T_NATIVE_INT;
+ * long data_type = HDF5CDataTypes.JH5T_NATIVE_INT;
  * 
* * The Java application uses both types of constants the same way, the only difference is that the diff --git a/java/src/jni/CMakeLists.txt b/java/src/jni/CMakeLists.txt index 9da31ee..9e6c099 100644 --- a/java/src/jni/CMakeLists.txt +++ b/java/src/jni/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 3.1.0) +cmake_minimum_required (VERSION 3.2.2) PROJECT (HDF5_JAVA_JNI C CXX) set (HDF5_JAVA_JNI_CSRCS @@ -67,8 +67,8 @@ if (WIN32) COMMENT "Copying ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${CMAKE_CFG_INTDIR}/${HDF5_JAVA_JNI_DLL_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX} to ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/" ) add_dependencies (HDF5_JAVA_JNI-Test-Copy ${HDF5_JAVA_JNI_LIB_TARGET}) - endif (BUILD_TESTING) -endif (WIN32) + endif () +endif () #----------------------------------------------------------------------------- # Add Target(s) to CMake Install for import into other projects @@ -79,11 +79,11 @@ if (HDF5_EXPORTED_TARGETS) TARGETS ${HDF5_JAVA_JNI_LIB_TARGET} EXPORT - ${HDF5_JAVA_EXPORTED_TARGETS} + ${HDF5_EXPORTED_TARGETS} LIBRARY DESTINATION ${HDF5_INSTALL_LIB_DIR} COMPONENT libraries ARCHIVE DESTINATION ${HDF5_INSTALL_LIB_DIR} COMPONENT libraries RUNTIME DESTINATION ${HDF5_INSTALL_LIB_DIR} COMPONENT libraries FRAMEWORK DESTINATION ${HDF5_INSTALL_FWRK_DIR} COMPONENT libraries INCLUDES DESTINATION include ) -endif (HDF5_EXPORTED_TARGETS) +endif () diff --git a/java/src/jni/h5Constants.c b/java/src/jni/h5Constants.c index 976a224..ccd0b91 100644 --- a/java/src/jni/h5Constants.c +++ b/java/src/jni/h5Constants.c @@ -28,396 +28,396 @@ extern "C" { #pragma GCC diagnostic ignored "-Wmissing-prototypes" -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5_1QUARTER_1HADDR_1MAX(JNIEnv *env, jclass cls) { return (hsize_t)HADDR_MAX/4; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5_1SZIP_1ALLOW_1K13_1OPTION_1MASK(JNIEnv *env, jclass cls) { return H5_SZIP_ALLOW_K13_OPTION_MASK; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5_1SZIP_1CHIP_1OPTION_1MASK(JNIEnv *env, jclass cls) { return H5_SZIP_CHIP_OPTION_MASK; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5_1SZIP_1EC_1OPTION_1MASK(JNIEnv *env, jclass cls) { return H5_SZIP_EC_OPTION_MASK; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5_1SZIP_1MAX_1PIXELS_1PER_1BLOCK(JNIEnv *env, jclass cls) { return H5_SZIP_MAX_PIXELS_PER_BLOCK; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5_1SZIP_1NN_1OPTION_1MASK(JNIEnv *env, jclass cls) { return H5_SZIP_NN_OPTION_MASK; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5_1INDEX_1UNKNOWN(JNIEnv *env, jclass cls) { return H5_INDEX_UNKNOWN; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5_1INDEX_1NAME(JNIEnv *env, jclass cls) { return H5_INDEX_NAME; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5_1INDEX_1CRT_1ORDER(JNIEnv *env, jclass cls) { return H5_INDEX_CRT_ORDER; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5_1INDEX_1N(JNIEnv *env, jclass cls) { return H5_INDEX_N; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5_1ITER_1UNKNOWN(JNIEnv *env, jclass cls) { return H5_ITER_UNKNOWN; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5_1ITER_1INC(JNIEnv *env, jclass cls) { return H5_ITER_INC; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5_1ITER_1DEC(JNIEnv *env, jclass cls) { return H5_ITER_DEC; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5_1ITER_1NATIVE(JNIEnv *env, jclass cls) { return H5_ITER_NATIVE; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5_1ITER_1N(JNIEnv *env, jclass cls) { return H5_ITER_N; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5AC_1CURR_1CACHE_1CONFIG_1VERSION(JNIEnv *env, jclass cls) { return H5AC__CURR_CACHE_CONFIG_VERSION; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5AC_1MAX_1TRACE_1FILE_1NAME_1LEN(JNIEnv *env, jclass cls) { return H5AC__MAX_TRACE_FILE_NAME_LEN; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5AC_1METADATA_1WRITE_1STRATEGY_1PROCESS_1ZERO_1ONLY(JNIEnv *env, jclass cls) { return H5AC_METADATA_WRITE_STRATEGY__PROCESS_0_ONLY; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5AC_1METADATA_1WRITE_1STRATEGY_1DISTRIBUTED(JNIEnv *env, jclass cls) { return H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5C_1incr_1off(JNIEnv *env, jclass cls) { return H5C_incr__off; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5C_1incr_1threshold(JNIEnv *env, jclass cls) { return H5C_incr__threshold; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5C_1flash_1incr_1off(JNIEnv *env, jclass cls) { return H5C_flash_incr__off; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5C_1flash_1incr_1add_1space(JNIEnv *env, jclass cls) { return H5C_flash_incr__add_space; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5C_1decr_1off(JNIEnv *env, jclass cls) { return H5C_decr__off; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5C_1decr_1threshold(JNIEnv *env, jclass cls) { return H5C_decr__threshold; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5C_1decr_1age_1out(JNIEnv *env, jclass cls) { return H5C_decr__age_out; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5C_1decr_1age_1out_1with_1threshold(JNIEnv *env, jclass cls) { return H5C_decr__age_out_with_threshold; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5D_1CHUNK_1IDX_1BTREE(JNIEnv *env, jclass cls) { return H5D_CHUNK_IDX_BTREE; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5D_1ALLOC_1TIME_1DEFAULT(JNIEnv *env, jclass cls) { return H5D_ALLOC_TIME_DEFAULT; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5D_1ALLOC_1TIME_1EARLY(JNIEnv *env, jclass cls) { return H5D_ALLOC_TIME_EARLY; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5D_1ALLOC_1TIME_1ERROR(JNIEnv *env, jclass cls) { return H5D_ALLOC_TIME_ERROR; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5D_1ALLOC_1TIME_1INCR(JNIEnv *env, jclass cls) { return H5D_ALLOC_TIME_INCR; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5D_1ALLOC_1TIME_1LATE(JNIEnv *env, jclass cls) { return H5D_ALLOC_TIME_LATE; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5D_1FILL_1TIME_1ERROR(JNIEnv *env, jclass cls) { return H5D_FILL_TIME_ERROR; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5D_1FILL_1TIME_1ALLOC(JNIEnv *env, jclass cls) { return H5D_FILL_TIME_ALLOC; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5D_1FILL_1TIME_1NEVER(JNIEnv *env, jclass cls) { return H5D_FILL_TIME_NEVER; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5D_1FILL_1TIME_1IFSET(JNIEnv *env, jclass cls) { return H5D_FILL_TIME_IFSET; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5D_1FILL_1VALUE_1DEFAULT(JNIEnv *env, jclass cls) { return H5D_FILL_VALUE_DEFAULT; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5D_1FILL_1VALUE_1ERROR(JNIEnv *env, jclass cls) { return H5D_FILL_VALUE_ERROR; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5D_1FILL_1VALUE_1UNDEFINED(JNIEnv *env, jclass cls) { return H5D_FILL_VALUE_UNDEFINED; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5D_1FILL_1VALUE_1USER_1DEFINED(JNIEnv *env, jclass cls) { return H5D_FILL_VALUE_USER_DEFINED; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5D_1LAYOUT_1ERROR(JNIEnv *env, jclass cls) { return H5D_LAYOUT_ERROR; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5D_1CHUNKED(JNIEnv *env, jclass cls) { return H5D_CHUNKED; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5D_1COMPACT(JNIEnv *env, jclass cls) { return H5D_COMPACT; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5D_1CONTIGUOUS(JNIEnv *env, jclass cls) { return H5D_CONTIGUOUS; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5D_1VIRTUAL(JNIEnv *env, jclass cls) { return H5D_VIRTUAL; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5D_1NLAYOUTS(JNIEnv *env, jclass cls) { return H5D_NLAYOUTS; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5D_1SPACE_1STATUS_1ALLOCATED(JNIEnv *env, jclass cls) { return H5D_SPACE_STATUS_ALLOCATED; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5D_1SPACE_1STATUS_1ERROR(JNIEnv *env, jclass cls) { return H5D_SPACE_STATUS_ERROR; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5D_1SPACE_1STATUS_1NOT_1ALLOCATED(JNIEnv *env, jclass cls) { return H5D_SPACE_STATUS_NOT_ALLOCATED; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5D_1SPACE_1STATUS_1PART_1ALLOCATED(JNIEnv *env, jclass cls) { return H5D_SPACE_STATUS_PART_ALLOCATED; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5D_1VDS_1ERROR(JNIEnv *env, jclass cls) { return H5D_VDS_ERROR; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5D_1VDS_1FIRST_1MISSING(JNIEnv *env, jclass cls) { return H5D_VDS_FIRST_MISSING; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5D_1VDS_1LAST_1AVAILABLE(JNIEnv *env, jclass cls) { return H5D_VDS_LAST_AVAILABLE; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1ALIGNMENT(JNIEnv *env, jclass cls) { return H5E_ALIGNMENT; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1ALREADYEXISTS(JNIEnv *env, jclass cls) { return H5E_ALREADYEXISTS; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1ALREADYINIT(JNIEnv *env, jclass cls) { return H5E_ALREADYINIT; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1ARGS(JNIEnv *env, jclass cls) { return H5E_ARGS; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1ATOM(JNIEnv *env, jclass cls) { return H5E_ATOM; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1ATTR(JNIEnv *env, jclass cls) { return H5E_ATTR; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1BADATOM(JNIEnv *env, jclass cls) { return H5E_BADATOM; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1BADFILE(JNIEnv *env, jclass cls) { return H5E_BADFILE; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1BADGROUP(JNIEnv *env, jclass cls) { return H5E_BADGROUP; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1BADMESG(JNIEnv *env, jclass cls) { return H5E_BADMESG; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1BADRANGE(JNIEnv *env, jclass cls) { return H5E_BADRANGE; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1BADSELECT(JNIEnv *env, jclass cls) { return H5E_BADSELECT; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1BADSIZE(JNIEnv *env, jclass cls) { return H5E_BADSIZE; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1BADTYPE(JNIEnv *env, jclass cls) { return H5E_BADTYPE; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1BADVALUE(JNIEnv *env, jclass cls) { return H5E_BADVALUE; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1BTREE(JNIEnv *env, jclass cls) { return H5E_BTREE; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1CACHE(JNIEnv *env, jclass cls) { return H5E_CACHE; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1CALLBACK(JNIEnv *env, jclass cls) { return H5E_CALLBACK; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1CANAPPLY(JNIEnv *env, jclass cls) { return H5E_CANAPPLY; } -/*JNIEXPORT jlong JNICALL +/*JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTALLOC(JNIEnv *env, jclass cls) { return H5E_CANTALLOC; }*/ -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTCLIP(JNIEnv *env, jclass cls) { return H5E_CANTCLIP; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTCLOSEFILE(JNIEnv *env, jclass cls) { return H5E_CANTCLOSEFILE; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTCONVERT(JNIEnv *env, jclass cls) { return H5E_CANTCONVERT; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTCOPY(JNIEnv *env, jclass cls) { return H5E_CANTCOPY; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTCOUNT(JNIEnv *env, jclass cls) { return H5E_CANTCOUNT; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTCREATE(JNIEnv *env, jclass cls) { return H5E_CANTCREATE; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTDEC(JNIEnv *env, jclass cls) { return H5E_CANTDEC; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTDECODE(JNIEnv *env, jclass cls) { return H5E_CANTDECODE; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTDELETE(JNIEnv *env, jclass cls) { return H5E_CANTDELETE; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTENCODE(JNIEnv *env, jclass cls) { return H5E_CANTENCODE; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTFLUSH(JNIEnv *env, jclass cls) { return H5E_CANTFLUSH; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTFREE(JNIEnv *env, jclass cls) { return H5E_CANTFREE; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTGET(JNIEnv *env, jclass cls) { return H5E_CANTGET; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTINC(JNIEnv *env, jclass cls) { return H5E_CANTINC; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTINIT(JNIEnv *env, jclass cls) { return H5E_CANTINIT; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTINSERT(JNIEnv *env, jclass cls) { return H5E_CANTINSERT; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTLIST(JNIEnv *env, jclass cls) { return H5E_CANTLIST; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTLOAD(JNIEnv *env, jclass cls) { return H5E_CANTLOAD; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTLOCK(JNIEnv *env, jclass cls) { return H5E_CANTLOCK; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTNEXT(JNIEnv *env, jclass cls) { return H5E_CANTNEXT; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTOPENFILE(JNIEnv *env, jclass cls) { return H5E_CANTOPENFILE; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTOPENOBJ(JNIEnv *env, jclass cls) { return H5E_CANTOPENOBJ; } -/*JNIEXPORT jlong JNICALL +/*JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTRECV(JNIEnv *env, jclass cls) { return H5E_CANTRECV; }*/ -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTREGISTER(JNIEnv *env, jclass cls) { return H5E_CANTREGISTER; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTRELEASE(JNIEnv *env, jclass cls) { return H5E_CANTRELEASE; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTSELECT(JNIEnv *env, jclass cls) { return H5E_CANTSELECT; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTSET(JNIEnv *env, jclass cls) { return H5E_CANTSET; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTSPLIT(JNIEnv *env, jclass cls) { return H5E_CANTSPLIT; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTUNLOCK(JNIEnv *env, jclass cls) { return H5E_CANTUNLOCK; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1CLOSEERROR(JNIEnv *env, jclass cls) { return H5E_CLOSEERROR; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1COMPLEN(JNIEnv *env, jclass cls) { return H5E_COMPLEN; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1DATASET(JNIEnv *env, jclass cls) { return H5E_DATASET; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1DATASPACE(JNIEnv *env, jclass cls) { return H5E_DATASPACE; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1DATATYPE(JNIEnv *env, jclass cls) { return H5E_DATATYPE; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1DEFAULT(JNIEnv *env, jclass cls) { return H5E_DEFAULT; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1DUPCLASS(JNIEnv *env, jclass cls) { return H5E_DUPCLASS; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1EFL(JNIEnv *env, jclass cls) { return H5E_EFL; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1EXISTS(JNIEnv *env, jclass cls) { return H5E_EXISTS; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1FCNTL(JNIEnv *env, jclass cls) { return H5E_FCNTL; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1FILE(JNIEnv *env, jclass cls) { return H5E_FILE; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1FILEEXISTS(JNIEnv *env, jclass cls) { return H5E_FILEEXISTS; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1FILEOPEN(JNIEnv *env, jclass cls) { return H5E_FILEOPEN; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1FUNC(JNIEnv *env, jclass cls) { return H5E_FUNC; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1HEAP(JNIEnv *env, jclass cls) { return H5E_HEAP; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1INTERNAL(JNIEnv *env, jclass cls) { return H5E_INTERNAL; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1IO(JNIEnv *env, jclass cls) { return H5E_IO; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1LINK(JNIEnv *env, jclass cls) { return H5E_LINK; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1LINKCOUNT(JNIEnv *env, jclass cls) { return H5E_LINKCOUNT; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1MAJOR(JNIEnv *env, jclass cls) { return H5E_MAJOR; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1MINOR(JNIEnv *env, jclass cls) { return H5E_MINOR; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1MOUNT(JNIEnv *env, jclass cls) { return H5E_MOUNT; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1MPI(JNIEnv *env, jclass cls) { return H5E_MPI; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1MPIERRSTR(JNIEnv *env, jclass cls) { return H5E_MPIERRSTR; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1NOFILTER(JNIEnv *env, jclass cls) { return H5E_NOFILTER; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1NOIDS(JNIEnv *env, jclass cls) { return H5E_NOIDS; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1NONE_1MAJOR(JNIEnv *env, jclass cls) { return H5E_NONE_MAJOR; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1NONE_1MINOR(JNIEnv *env, jclass cls) { return H5E_NONE_MINOR; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1NOSPACE(JNIEnv *env, jclass cls) { return H5E_NOSPACE; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1NOTCACHED(JNIEnv *env, jclass cls) { return H5E_NOTCACHED; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1NOTFOUND(JNIEnv *env, jclass cls) { return H5E_NOTFOUND; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1NOTHDF5(JNIEnv *env, jclass cls) { return H5E_NOTHDF5; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1OHDR(JNIEnv *env, jclass cls) { return H5E_OHDR; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1OVERFLOW(JNIEnv *env, jclass cls) { return H5E_OVERFLOW; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1PLINE(JNIEnv *env, jclass cls) { return H5E_PLINE; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1PLIST(JNIEnv *env, jclass cls) { return H5E_PLIST; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1PROTECT(JNIEnv *env, jclass cls) { return H5E_PROTECT; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1READERROR(JNIEnv *env, jclass cls) { return H5E_READERROR; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1REFERENCE(JNIEnv *env, jclass cls) { return H5E_REFERENCE; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1RESOURCE(JNIEnv *env, jclass cls) { return H5E_RESOURCE; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1RS(JNIEnv *env, jclass cls) { return H5E_RS; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1SEEKERROR(JNIEnv *env, jclass cls) { return H5E_SEEKERROR; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1SETLOCAL(JNIEnv *env, jclass cls) { return H5E_SETLOCAL; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1STORAGE(JNIEnv *env, jclass cls) { return H5E_STORAGE; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1SYM(JNIEnv *env, jclass cls) { return H5E_SYM; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1TRUNCATED(JNIEnv *env, jclass cls) { return H5E_TRUNCATED; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1TST(JNIEnv *env, jclass cls) { return H5E_TST; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1UNINITIALIZED(JNIEnv *env, jclass cls) { return H5E_UNINITIALIZED; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1UNSUPPORTED(JNIEnv *env, jclass cls) { return H5E_UNSUPPORTED; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1VERSION(JNIEnv *env, jclass cls) { return H5E_VERSION; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1VFL(JNIEnv *env, jclass cls) { return H5E_VFL; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1WALK_1DOWNWARD(JNIEnv *env, jclass cls) { return H5E_WALK_DOWNWARD; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1WALK_1UPWARD(JNIEnv *env, jclass cls) { return H5E_WALK_UPWARD; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1WRITEERROR(JNIEnv *env, jclass cls) { return H5E_WRITEERROR; } /* Java does not have unsigned native types */ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wsign-conversion" -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5F_1ACC_1CREAT(JNIEnv *env, jclass cls) { return H5F_ACC_CREAT; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5F_1ACC_1EXCL(JNIEnv *env, jclass cls) { return H5F_ACC_EXCL; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5F_1ACC_1RDONLY(JNIEnv *env, jclass cls) { return H5F_ACC_RDONLY; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5F_1ACC_1RDWR(JNIEnv *env, jclass cls) { return H5F_ACC_RDWR; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5F_1ACC_1TRUNC(JNIEnv *env, jclass cls) { return H5F_ACC_TRUNC; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5F_1ACC_1DEFAULT(JNIEnv *env, jclass cls) { return H5F_ACC_DEFAULT; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5F_1ACC_1SWMR_1READ(JNIEnv *env, jclass cls) { return H5F_ACC_SWMR_READ; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5F_1ACC_1SWMR_1WRITE(JNIEnv *env, jclass cls) { return H5F_ACC_SWMR_WRITE; } #pragma GCC diagnostic pop -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5F_1CLOSE_1DEFAULT(JNIEnv *env, jclass cls) { return H5F_CLOSE_DEFAULT; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5F_1CLOSE_1SEMI(JNIEnv *env, jclass cls) { return H5F_CLOSE_SEMI; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5F_1CLOSE_1STRONG(JNIEnv *env, jclass cls) { return H5F_CLOSE_STRONG; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5F_1CLOSE_1WEAK(JNIEnv *env, jclass cls) { return H5F_CLOSE_WEAK; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5F_1LIBVER_1EARLIEST(JNIEnv *env, jclass cls){return H5F_LIBVER_EARLIEST;} -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5F_1LIBVER_1LATEST(JNIEnv *env, jclass cls){return H5F_LIBVER_LATEST;} -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5F_1OBJ_1ALL(JNIEnv *env, jclass cls) { return H5F_OBJ_ALL; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5F_1OBJ_1ATTR(JNIEnv *env, jclass cls) { return H5F_OBJ_ATTR; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5F_1OBJ_1DATASET(JNIEnv *env, jclass cls) { return H5F_OBJ_DATASET; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5F_1OBJ_1DATATYPE(JNIEnv *env, jclass cls) { return H5F_OBJ_DATATYPE; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5F_1OBJ_1FILE(JNIEnv *env, jclass cls) { return H5F_OBJ_FILE; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5F_1OBJ_1GROUP(JNIEnv *env, jclass cls) { return H5F_OBJ_GROUP; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5F_1OBJ_1LOCAL(JNIEnv *env, jclass cls) { return H5F_OBJ_LOCAL; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5F_1SCOPE_1GLOBAL(JNIEnv *env, jclass cls) { return H5F_SCOPE_GLOBAL; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5F_1SCOPE_1LOCAL(JNIEnv *env, jclass cls) { return H5F_SCOPE_LOCAL; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5F_1UNLIMITED(JNIEnv *env, jclass cls) { return (jint)H5F_UNLIMITED; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5F_1FILE_1SPACE_1DEFAULT(JNIEnv *env, jclass cls) { return H5F_FILE_SPACE_DEFAULT; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5F_1FILE_1SPACE_1ALL_1PERSIST(JNIEnv *env, jclass cls) { return H5F_FILE_SPACE_ALL_PERSIST; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5F_1FILE_1SPACE_1ALL(JNIEnv *env, jclass cls) { return H5F_FILE_SPACE_ALL; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5F_1FILE_1SPACE_1AGGR_1VFD(JNIEnv *env, jclass cls) { return H5F_FILE_SPACE_AGGR_VFD; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5F_1FILE_1SPACE_1VFD(JNIEnv *env, jclass cls) { return H5F_FILE_SPACE_VFD; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5F_1FILE_1SPACE_1NTYPES(JNIEnv *env, jclass cls) { return H5F_FILE_SPACE_NTYPES; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1CORE(JNIEnv *env, jclass cls) { return H5FD_CORE; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1DIRECT(JNIEnv *env, jclass cls) { #ifdef H5_HAVE_DIRECT return H5FD_DIRECT; @@ -425,19 +425,19 @@ Java_hdf_hdf5lib_HDF5Constants_H5FD_1DIRECT(JNIEnv *env, jclass cls) { return -1; #endif } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1FAMILY(JNIEnv *env, jclass cls) { return H5FD_FAMILY; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1LOG(JNIEnv *env, jclass cls) { return H5FD_LOG; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1MPIO(JNIEnv *env, jclass cls) { return H5FD_MPIO; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1MULTI(JNIEnv *env, jclass cls) { return H5FD_MULTI; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1SEC2(JNIEnv *env, jclass cls) { return H5FD_SEC2; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1STDIO(JNIEnv *env, jclass cls) { return H5FD_STDIO; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1WINDOWS(JNIEnv *env, jclass cls) { #ifdef H5_HAVE_WINDOWS return H5FD_DIRECT; @@ -445,84 +445,84 @@ Java_hdf_hdf5lib_HDF5Constants_H5FD_1WINDOWS(JNIEnv *env, jclass cls) { return -1; #endif } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1LOG_1LOC_1READ(JNIEnv *env, jclass cls) { return H5FD_LOG_LOC_READ; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1LOG_1LOC_1WRITE(JNIEnv *env, jclass cls) { return H5FD_LOG_LOC_WRITE; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1LOG_1LOC_1SEEK(JNIEnv *env, jclass cls) { return H5FD_LOG_LOC_SEEK; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1LOG_1LOC_1IO(JNIEnv *env, jclass cls) { return H5FD_LOG_LOC_IO; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1LOG_1FILE_1READ(JNIEnv *env, jclass cls) { return H5FD_LOG_FILE_READ; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1LOG_1FILE_1WRITE(JNIEnv *env, jclass cls) { return H5FD_LOG_FILE_WRITE; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1LOG_1FILE_1IO(JNIEnv *env, jclass cls) { return H5FD_LOG_FILE_IO; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1LOG_1FLAVOR(JNIEnv *env, jclass cls) { return H5FD_LOG_FLAVOR; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1LOG_1NUM_1READ(JNIEnv *env, jclass cls) { return H5FD_LOG_NUM_READ; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1LOG_1NUM_1WRITE(JNIEnv *env, jclass cls) { return H5FD_LOG_NUM_WRITE; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1LOG_1NUM_1SEEK(JNIEnv *env, jclass cls) { return H5FD_LOG_NUM_SEEK; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1LOG_1NUM_1TRUNCATE(JNIEnv *env, jclass cls) { return H5FD_LOG_NUM_TRUNCATE; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1LOG_1NUM_1IO(JNIEnv *env, jclass cls) { return H5FD_LOG_NUM_IO; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1LOG_1TIME_1OPEN(JNIEnv *env, jclass cls) { return H5FD_LOG_TIME_OPEN; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1LOG_1TIME_1STAT(JNIEnv *env, jclass cls) { return H5FD_LOG_TIME_STAT; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1LOG_1TIME_1READ(JNIEnv *env, jclass cls) { return H5FD_LOG_TIME_READ; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1LOG_1TIME_1WRITE(JNIEnv *env, jclass cls) { return H5FD_LOG_TIME_WRITE; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1LOG_1TIME_1SEEK(JNIEnv *env, jclass cls) { return H5FD_LOG_TIME_SEEK; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1LOG_1TIME_1CLOSE(JNIEnv *env, jclass cls) { return H5FD_LOG_TIME_CLOSE; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1LOG_1TIME_1IO(JNIEnv *env, jclass cls) { return H5FD_LOG_TIME_IO; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1LOG_1ALLOC(JNIEnv *env, jclass cls) { return H5FD_LOG_ALLOC; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1LOG_1ALL(JNIEnv *env, jclass cls) { return H5FD_LOG_ALL; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1MEM_1NOLIST(JNIEnv *env, jclass cls) { return H5FD_MEM_NOLIST; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1MEM_1DEFAULT(JNIEnv *env, jclass cls) { return H5FD_MEM_DEFAULT; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1MEM_1SUPER(JNIEnv *env, jclass cls) { return H5FD_MEM_SUPER; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1MEM_1BTREE(JNIEnv *env, jclass cls) { return H5FD_MEM_BTREE; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1MEM_1DRAW(JNIEnv *env, jclass cls) { return H5FD_MEM_DRAW; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1MEM_1GHEAP(JNIEnv *env, jclass cls) { return H5FD_MEM_GHEAP; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1MEM_1LHEAP(JNIEnv *env, jclass cls) { return H5FD_MEM_LHEAP; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1MEM_1OHDR(JNIEnv *env, jclass cls) { return H5FD_MEM_OHDR; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1MEM_1NTYPES(JNIEnv *env, jclass cls) { return H5FD_MEM_NTYPES; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1DEFAULT_1HADDR_1SIZE(JNIEnv *env, jclass cls) { return (hsize_t)(HADDR_MAX/H5FD_MEM_NTYPES); } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1MEM_1DEFAULT_1SIZE(JNIEnv *env, jclass cls) { return (hsize_t)0; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1MEM_1DEFAULT_1SUPER_1SIZE(JNIEnv *env, jclass cls) { return (hsize_t)0; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1MEM_1DEFAULT_1BTREE_1SIZE(JNIEnv *env, jclass cls) { return (hsize_t)(1 * (HADDR_MAX / (H5FD_MEM_NTYPES-1))); } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1MEM_1DEFAULT_1DRAW_1SIZE(JNIEnv *env, jclass cls) { return (hsize_t)(2 * (HADDR_MAX / (H5FD_MEM_NTYPES-1))); } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1MEM_1DEFAULT_1GHEAP_1SIZE(JNIEnv *env, jclass cls) { return (hsize_t)(3 * (HADDR_MAX / (H5FD_MEM_NTYPES-1))); } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1MEM_1DEFAULT_1LHEAP_1SIZE(JNIEnv *env, jclass cls) { return (hsize_t)(4 * (HADDR_MAX / (H5FD_MEM_NTYPES-1))); } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1MEM_1DEFAULT_1OHDR_1SIZE(JNIEnv *env, jclass cls) { return (hsize_t)(5 * (HADDR_MAX / (H5FD_MEM_NTYPES-1))); } @@ -532,769 +532,769 @@ Java_hdf_hdf5lib_HDF5Constants_H5FD_1MEM_1DEFAULT_1OHDR_1SIZE(JNIEnv *env, jclas */ #ifndef H5_NO_DEPRECATED_SYMBOLS -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5G_1DATASET(JNIEnv *env, jclass cls) { return H5G_DATASET; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5G_1GROUP(JNIEnv *env, jclass cls) { return H5G_GROUP; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5G_1LINK(JNIEnv *env, jclass cls) { return H5G_LINK; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5G_1UDLINK(JNIEnv *env, jclass cls) { return H5G_UDLINK; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5G_1RESERVED_15(JNIEnv *env, jclass cls) { return H5G_RESERVED_5; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5G_1RESERVED_16(JNIEnv *env, jclass cls) { return H5G_RESERVED_6; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5G_1RESERVED_17(JNIEnv *env, jclass cls) { return H5G_RESERVED_7; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5G_1TYPE(JNIEnv *env, jclass cls) { return H5G_TYPE; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5G_1UNKNOWN(JNIEnv *env, jclass cls) { return H5G_UNKNOWN; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5G_1LINK_1ERROR(JNIEnv *env, jclass cls) { return H5G_LINK_ERROR; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5G_1LINK_1HARD(JNIEnv *env, jclass cls) { return H5G_LINK_HARD; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5G_1LINK_1SOFT(JNIEnv *env, jclass cls) { return H5G_LINK_SOFT; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5G_1NLIBTYPES(JNIEnv *env, jclass cls) { return H5G_NLIBTYPES; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5G_1NTYPES(JNIEnv *env, jclass cls) { return H5G_NTYPES; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5G_1NUSERTYPES(JNIEnv *env, jclass cls) { return H5G_NUSERTYPES; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5G_1SAME_1LOC(JNIEnv *env, jclass cls) { return H5G_SAME_LOC; } #endif /* H5_NO_DEPRECATED_SYMBOLS */ -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5G_1STORAGE_1TYPE_1UNKNOWN(JNIEnv *env, jclass cls){ return H5G_STORAGE_TYPE_UNKNOWN; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5G_1STORAGE_1TYPE_1SYMBOL_1TABLE(JNIEnv *env, jclass cls){ return H5G_STORAGE_TYPE_SYMBOL_TABLE; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5G_1STORAGE_1TYPE_1COMPACT(JNIEnv *env, jclass cls){ return H5G_STORAGE_TYPE_COMPACT; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5G_1STORAGE_1TYPE_1DENSE(JNIEnv *env, jclass cls){ return H5G_STORAGE_TYPE_DENSE; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5I_1UNINIT(JNIEnv *env, jclass cls) { return H5I_UNINIT; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5I_1BADID(JNIEnv *env, jclass cls) { return H5I_BADID; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5I_1FILE(JNIEnv *env, jclass cls) { return H5I_FILE; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5I_1GROUP(JNIEnv *env, jclass cls) { return H5I_GROUP; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5I_1DATATYPE(JNIEnv *env, jclass cls) { return H5I_DATATYPE; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5I_1DATASPACE(JNIEnv *env, jclass cls) { return H5I_DATASPACE; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5I_1DATASET(JNIEnv *env, jclass cls) { return H5I_DATASET; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5I_1ATTR(JNIEnv *env, jclass cls) { return H5I_ATTR; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5I_1REFERENCE(JNIEnv *env, jclass cls) { return H5I_REFERENCE; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5I_1VFL(JNIEnv *env, jclass cls) { return H5I_VFL; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5I_1INVALID_1HID(JNIEnv *env, jclass cls) { return H5I_INVALID_HID; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5I_1GENPROP_1CLS(JNIEnv *env, jclass cls) { return H5I_GENPROP_CLS; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5I_1GENPROP_1LST(JNIEnv *env, jclass cls) { return H5I_GENPROP_LST; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5I_1ERROR_1CLASS(JNIEnv *env, jclass cls) { return H5I_ERROR_CLASS; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5I_1ERROR_1MSG(JNIEnv *env, jclass cls) { return H5I_ERROR_MSG; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5I_1ERROR_1STACK(JNIEnv *env, jclass cls) { return H5I_ERROR_STACK; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5I_1NTYPES(JNIEnv *env, jclass cls) { return H5I_NTYPES; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5L_1TYPE_1ERROR(JNIEnv *env, jclass cls) { return H5L_TYPE_ERROR; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5L_1TYPE_1HARD(JNIEnv *env, jclass cls) { return H5L_TYPE_HARD; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5L_1TYPE_1SOFT(JNIEnv *env, jclass cls) { return H5L_TYPE_SOFT; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5L_1TYPE_1EXTERNAL(JNIEnv *env, jclass cls) { return H5L_TYPE_EXTERNAL; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5L_1TYPE_1MAX(JNIEnv *env, jclass cls) { return H5L_TYPE_MAX; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5O_1COPY_1SHALLOW_1HIERARCHY_1FLAG(JNIEnv *env, jclass cls){return H5O_COPY_SHALLOW_HIERARCHY_FLAG; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5O_1COPY_1EXPAND_1SOFT_1LINK_1FLAG(JNIEnv *env, jclass cls){return H5O_COPY_EXPAND_SOFT_LINK_FLAG; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5O_1COPY_1EXPAND_1EXT_1LINK_1FLAG(JNIEnv *env, jclass cls){return H5O_COPY_EXPAND_EXT_LINK_FLAG; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5O_1COPY_1EXPAND_1REFERENCE_1FLAG(JNIEnv *env, jclass cls){return H5O_COPY_EXPAND_REFERENCE_FLAG; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5O_1COPY_1WITHOUT_1ATTR_1FLAG(JNIEnv *env, jclass cls){return H5O_COPY_WITHOUT_ATTR_FLAG; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5O_1COPY_1PRESERVE_1NULL_1FLAG(JNIEnv *env, jclass cls){return H5O_COPY_PRESERVE_NULL_FLAG; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5O_1SHMESG_1NONE_1FLAG(JNIEnv *env, jclass cls){return H5O_SHMESG_NONE_FLAG; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5O_1SHMESG_1SDSPACE_1FLAG(JNIEnv *env, jclass cls){return H5O_SHMESG_SDSPACE_FLAG; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5O_1SHMESG_1DTYPE_1FLAG(JNIEnv *env, jclass cls){return H5O_SHMESG_DTYPE_FLAG; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5O_1SHMESG_1FILL_1FLAG(JNIEnv *env, jclass cls){return H5O_SHMESG_FILL_FLAG; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5O_1SHMESG_1PLINE_1FLAG(JNIEnv *env, jclass cls){return H5O_SHMESG_PLINE_FLAG; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5O_1SHMESG_1ATTR_1FLAG(JNIEnv *env, jclass cls){return H5O_SHMESG_ATTR_FLAG; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5O_1SHMESG_1ALL_1FLAG(JNIEnv *env, jclass cls){return H5O_SHMESG_ALL_FLAG; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5O_1TYPE_1UNKNOWN(JNIEnv *env, jclass cls) { return H5O_TYPE_UNKNOWN; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5O_1TYPE_1GROUP(JNIEnv *env, jclass cls) { return H5O_TYPE_GROUP; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5O_1TYPE_1DATASET(JNIEnv *env, jclass cls) { return H5O_TYPE_DATASET; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5O_1TYPE_1NAMED_1DATATYPE(JNIEnv *env, jclass cls) { return H5O_TYPE_NAMED_DATATYPE; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5O_1TYPE_1NTYPES(JNIEnv *env, jclass cls) { return H5O_TYPE_NTYPES; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5P_1ROOT(JNIEnv *env, jclass cls){return H5P_ROOT;} -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5P_1OBJECT_1CREATE(JNIEnv *env, jclass cls){return H5P_OBJECT_CREATE;} -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5P_1FILE_1CREATE(JNIEnv *env, jclass cls){return H5P_FILE_CREATE;} -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5P_1FILE_1ACCESS(JNIEnv *env, jclass cls){return H5P_FILE_ACCESS;} -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5P_1DATASET_1CREATE(JNIEnv *env, jclass cls){return H5P_DATASET_CREATE;} -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5P_1DATASET_1ACCESS(JNIEnv *env, jclass cls){return H5P_DATASET_ACCESS;} -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5P_1DATASET_1XFER(JNIEnv *env, jclass cls){return H5P_DATASET_XFER;} -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5P_1FILE_1MOUNT(JNIEnv *env, jclass cls){return H5P_FILE_MOUNT;} -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5P_1GROUP_1CREATE(JNIEnv *env, jclass cls){return H5P_GROUP_CREATE;} -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5P_1GROUP_1ACCESS(JNIEnv *env, jclass cls){return H5P_GROUP_ACCESS;} -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5P_1DATATYPE_1CREATE(JNIEnv *env, jclass cls){return H5P_DATATYPE_CREATE;} -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5P_1DATATYPE_1ACCESS(JNIEnv *env, jclass cls){return H5P_DATATYPE_ACCESS;} -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5P_1STRING_1CREATE(JNIEnv *env, jclass cls){return H5P_STRING_CREATE;} -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5P_1ATTRIBUTE_1CREATE(JNIEnv *env, jclass cls){return H5P_ATTRIBUTE_CREATE;} -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5P_1ATTRIBUTE_1ACCESS(JNIEnv *env, jclass cls){return H5P_ATTRIBUTE_ACCESS;} -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5P_1OBJECT_1COPY(JNIEnv *env, jclass cls){return H5P_OBJECT_COPY;} -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5P_1LINK_1CREATE(JNIEnv *env, jclass cls){return H5P_LINK_CREATE;} -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5P_1LINK_1ACCESS(JNIEnv *env, jclass cls){return H5P_LINK_ACCESS;} -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5P_1FILE_1CREATE_1DEFAULT(JNIEnv *env, jclass cls){return H5P_FILE_CREATE_DEFAULT;} -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5P_1FILE_1ACCESS_1DEFAULT(JNIEnv *env, jclass cls){return H5P_FILE_ACCESS_DEFAULT;} -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5P_1DATASET_1CREATE_1DEFAULT(JNIEnv *env, jclass cls){return H5P_DATASET_CREATE_DEFAULT;} -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5P_1DATASET_1ACCESS_1DEFAULT(JNIEnv *env, jclass cls){return H5P_DATASET_ACCESS_DEFAULT;} -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5P_1DATASET_1XFER_1DEFAULT(JNIEnv *env, jclass cls){return H5P_DATASET_XFER_DEFAULT;} -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5P_1FILE_1MOUNT_1DEFAULT(JNIEnv *env, jclass cls){return H5P_FILE_MOUNT_DEFAULT;} -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5P_1GROUP_1CREATE_1DEFAULT(JNIEnv *env, jclass cls){return H5P_GROUP_CREATE_DEFAULT;} -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5P_1GROUP_1ACCESS_1DEFAULT(JNIEnv *env, jclass cls){return H5P_GROUP_ACCESS_DEFAULT;} -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5P_1DATATYPE_1CREATE_1DEFAULT(JNIEnv *env, jclass cls){return H5P_DATATYPE_CREATE_DEFAULT;} -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5P_1DATATYPE_1ACCESS_1DEFAULT(JNIEnv *env, jclass cls){return H5P_DATATYPE_ACCESS_DEFAULT;} -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5P_1ATTRIBUTE_1CREATE_1DEFAULT(JNIEnv *env, jclass cls){return H5P_ATTRIBUTE_CREATE_DEFAULT;} -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5P_1ATTRIBUTE_1ACCESS_1DEFAULT(JNIEnv *env, jclass cls){return H5P_ATTRIBUTE_ACCESS_DEFAULT;} -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5P_1OBJECT_1COPY_1DEFAULT(JNIEnv *env, jclass cls){return H5P_OBJECT_COPY_DEFAULT;} -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5P_1LINK_1CREATE_1DEFAULT(JNIEnv *env, jclass cls){return H5P_LINK_CREATE_DEFAULT;} -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5P_1LINK_1ACCESS_1DEFAULT(JNIEnv *env, jclass cls){return H5P_LINK_ACCESS_DEFAULT;} -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5P_1CRT_1ORDER_1TRACKED(JNIEnv *env, jclass cls){return H5P_CRT_ORDER_TRACKED;} -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5P_1CRT_1ORDER_1INDEXED(JNIEnv *env, jclass cls){return H5P_CRT_ORDER_INDEXED;} -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5P_1DEFAULT(JNIEnv *env, jclass cls) { return H5P_DEFAULT; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5P_1NO_1CLASS(JNIEnv *env, jclass cls) { return H5P_ROOT; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5PL_1TYPE_1ERROR(JNIEnv *env, jclass cls) { return H5PL_TYPE_ERROR; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5PL_1TYPE_1FILTER(JNIEnv *env, jclass cls) { return H5PL_TYPE_FILTER; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5PL_1FILTER_1PLUGIN(JNIEnv *env, jclass cls) { return H5PL_FILTER_PLUGIN; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5PL_1ALL_1PLUGIN(JNIEnv *env, jclass cls) { return H5PL_ALL_PLUGIN; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5R_1BADTYPE(JNIEnv *env, jclass cls) { return H5R_BADTYPE; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5R_1MAXTYPE(JNIEnv *env, jclass cls) { return H5R_MAXTYPE; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5R_1OBJ_1REF_1BUF_1SIZE(JNIEnv *env, jclass cls) { return H5R_OBJ_REF_BUF_SIZE; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5R_1DSET_1REG_1REF_1BUF_1SIZE(JNIEnv *env, jclass cls) { return H5R_DSET_REG_REF_BUF_SIZE; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5R_1OBJECT(JNIEnv *env, jclass cls) { return H5R_OBJECT; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5R_1DATASET_1REGION(JNIEnv *env, jclass cls) { return H5R_DATASET_REGION; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5S_1ALL(JNIEnv *env, jclass cls) { return H5S_ALL; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5S_1MAX_1RANK(JNIEnv *env, jclass cls) { return H5S_MAX_RANK; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5S_1NO_1CLASS(JNIEnv *env, jclass cls) { return H5S_NO_CLASS; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5S_1NULL(JNIEnv *env, jclass cls) { return H5S_NULL; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5S_1SCALAR(JNIEnv *env, jclass cls) { return H5S_SCALAR; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5S_1SEL_1ALL(JNIEnv *env, jclass cls) { return H5S_SEL_ALL; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5S_1SEL_1ERROR(JNIEnv *env, jclass cls) { return H5S_SEL_ERROR; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5S_1SEL_1HYPERSLABS(JNIEnv *env, jclass cls) { return H5S_SEL_HYPERSLABS; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5S_1SEL_1N(JNIEnv *env, jclass cls) { return H5S_SEL_N; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5S_1SEL_1NONE(JNIEnv *env, jclass cls) { return H5S_SEL_NONE; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5S_1SEL_1POINTS(JNIEnv *env, jclass cls) { return H5S_SEL_POINTS; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5S_1SELECT_1AND(JNIEnv *env, jclass cls) { return H5S_SELECT_AND; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5S_1SELECT_1APPEND(JNIEnv *env, jclass cls) { return H5S_SELECT_APPEND; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5S_1SELECT_1INVALID(JNIEnv *env, jclass cls) { return H5S_SELECT_INVALID; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5S_1SELECT_1NOOP(JNIEnv *env, jclass cls) { return H5S_SELECT_NOOP; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5S_1SELECT_1NOTA(JNIEnv *env, jclass cls) { return H5S_SELECT_NOTA; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5S_1SELECT_1NOTB(JNIEnv *env, jclass cls) { return H5S_SELECT_NOTB; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5S_1SELECT_1OR(JNIEnv *env, jclass cls) { return H5S_SELECT_OR; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5S_1SELECT_1PREPEND(JNIEnv *env, jclass cls) { return H5S_SELECT_PREPEND; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5S_1SELECT_1SET(JNIEnv *env, jclass cls) { return H5S_SELECT_SET; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5S_1SELECT_1XOR(JNIEnv *env, jclass cls) { return H5S_SELECT_XOR; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5S_1SIMPLE(JNIEnv *env, jclass cls) { return H5S_SIMPLE; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5S_1UNLIMITED(JNIEnv *env, jclass cls) { return (jint)H5S_UNLIMITED; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1ALPHA_1B16(JNIEnv *env, jclass cls) { return H5T_ALPHA_B16; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1ALPHA_1B32(JNIEnv *env, jclass cls) { return H5T_ALPHA_B32; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1ALPHA_1B64(JNIEnv *env, jclass cls) { return H5T_ALPHA_B64; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1ALPHA_1B8(JNIEnv *env, jclass cls) { return H5T_ALPHA_B8; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1ALPHA_1F32(JNIEnv *env, jclass cls) { return H5T_ALPHA_F32; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1ALPHA_1F64(JNIEnv *env, jclass cls) { return H5T_ALPHA_F64; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1ALPHA_1I16(JNIEnv *env, jclass cls) { return H5T_ALPHA_I16; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1ALPHA_1I32(JNIEnv *env, jclass cls) { return H5T_ALPHA_I32; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1ALPHA_1I64(JNIEnv *env, jclass cls) { return H5T_ALPHA_I64; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1ALPHA_1I8(JNIEnv *env, jclass cls) { return H5T_ALPHA_I8; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1ALPHA_1U16(JNIEnv *env, jclass cls) { return H5T_ALPHA_U16; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1ALPHA_1U32(JNIEnv *env, jclass cls) { return H5T_ALPHA_U32; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1ALPHA_1U64(JNIEnv *env, jclass cls) { return H5T_ALPHA_U64; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1ALPHA_1U8(JNIEnv *env, jclass cls) { return H5T_ALPHA_U8; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1ARRAY(JNIEnv *env, jclass cls) { return H5T_ARRAY; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1BITFIELD(JNIEnv *env, jclass cls) { return H5T_BITFIELD; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1BKG_1NO(JNIEnv *env, jclass cls) { return H5T_BKG_NO; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1BKG_1YES(JNIEnv *env, jclass cls) { return H5T_BKG_YES; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1C_1S1(JNIEnv *env, jclass cls) { return H5T_C_S1; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1COMPOUND(JNIEnv *env, jclass cls) { return H5T_COMPOUND; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1CONV_1CONV(JNIEnv *env, jclass cls) { return H5T_CONV_CONV; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1CONV_1FREE(JNIEnv *env, jclass cls) { return H5T_CONV_FREE; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1CONV_1INIT(JNIEnv *env, jclass cls) { return H5T_CONV_INIT; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1CSET_1ERROR(JNIEnv *env, jclass cls) { return H5T_CSET_ERROR; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1CSET_1ASCII(JNIEnv *env, jclass cls) { return H5T_CSET_ASCII; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1CSET_1UTF8(JNIEnv *env, jclass cls) { return H5T_CSET_UTF8; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1CSET_1RESERVED_110(JNIEnv *env, jclass cls) { return H5T_CSET_RESERVED_10; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1CSET_1RESERVED_111(JNIEnv *env, jclass cls) { return H5T_CSET_RESERVED_11; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1CSET_1RESERVED_112(JNIEnv *env, jclass cls) { return H5T_CSET_RESERVED_12; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1CSET_1RESERVED_113(JNIEnv *env, jclass cls) { return H5T_CSET_RESERVED_13; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1CSET_1RESERVED_114(JNIEnv *env, jclass cls) { return H5T_CSET_RESERVED_14; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1CSET_1RESERVED_115(JNIEnv *env, jclass cls) { return H5T_CSET_RESERVED_15; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1CSET_1RESERVED_12(JNIEnv *env, jclass cls) { return H5T_CSET_RESERVED_2; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1CSET_1RESERVED_13(JNIEnv *env, jclass cls) { return H5T_CSET_RESERVED_3; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1CSET_1RESERVED_14(JNIEnv *env, jclass cls) { return H5T_CSET_RESERVED_4; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1CSET_1RESERVED_15(JNIEnv *env, jclass cls) { return H5T_CSET_RESERVED_5; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1CSET_1RESERVED_16(JNIEnv *env, jclass cls) { return H5T_CSET_RESERVED_6; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1CSET_1RESERVED_17(JNIEnv *env, jclass cls) { return H5T_CSET_RESERVED_7; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1CSET_1RESERVED_18(JNIEnv *env, jclass cls) { return H5T_CSET_RESERVED_8; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1CSET_1RESERVED_19(JNIEnv *env, jclass cls) { return H5T_CSET_RESERVED_9; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1DIR_1ASCEND(JNIEnv *env, jclass cls) { return H5T_DIR_ASCEND; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1DIR_1DEFAULT(JNIEnv *env, jclass cls) { return H5T_DIR_DEFAULT; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1DIR_1DESCEND(JNIEnv *env, jclass cls) { return H5T_DIR_DESCEND; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1ENUM(JNIEnv *env, jclass cls) { return H5T_ENUM; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1FLOAT(JNIEnv *env, jclass cls) { return H5T_FLOAT; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1FORTRAN_1S1(JNIEnv *env, jclass cls) { return H5T_FORTRAN_S1; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1IEEE_1F32BE(JNIEnv *env, jclass cls) { return H5T_IEEE_F32BE; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1IEEE_1F32LE(JNIEnv *env, jclass cls) { return H5T_IEEE_F32LE; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1IEEE_1F64BE(JNIEnv *env, jclass cls) { return H5T_IEEE_F64BE; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1IEEE_1F64LE(JNIEnv *env, jclass cls) { return H5T_IEEE_F64LE; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1INTEGER(JNIEnv *env, jclass cls) { return H5T_INTEGER; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1INTEL_1B16(JNIEnv *env, jclass cls) { return H5T_INTEL_B16; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1INTEL_1B32(JNIEnv *env, jclass cls) { return H5T_INTEL_B32; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1INTEL_1B64(JNIEnv *env, jclass cls) { return H5T_INTEL_B64; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1INTEL_1B8(JNIEnv *env, jclass cls) { return H5T_INTEL_B8; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1INTEL_1F32(JNIEnv *env, jclass cls) { return H5T_INTEL_F32; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1INTEL_1F64(JNIEnv *env, jclass cls) { return H5T_INTEL_F64; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1INTEL_1I16(JNIEnv *env, jclass cls) { return H5T_INTEL_I16; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1INTEL_1I32(JNIEnv *env, jclass cls) { return H5T_INTEL_I32; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1INTEL_1I64(JNIEnv *env, jclass cls) { return H5T_INTEL_I64; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1INTEL_1I8(JNIEnv *env, jclass cls) { return H5T_INTEL_I8; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1INTEL_1U16(JNIEnv *env, jclass cls) { return H5T_INTEL_U16; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1INTEL_1U32(JNIEnv *env, jclass cls) { return H5T_INTEL_U32; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1INTEL_1U64(JNIEnv *env, jclass cls) { return H5T_INTEL_U64; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1INTEL_1U8(JNIEnv *env, jclass cls) { return H5T_INTEL_U8; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1MIPS_1B16(JNIEnv *env, jclass cls) { return H5T_MIPS_B16; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1MIPS_1B32(JNIEnv *env, jclass cls) { return H5T_MIPS_B32; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1MIPS_1B64(JNIEnv *env, jclass cls) { return H5T_MIPS_B64; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1MIPS_1B8(JNIEnv *env, jclass cls) { return H5T_MIPS_B8; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1MIPS_1F32(JNIEnv *env, jclass cls) { return H5T_MIPS_F32; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1MIPS_1F64(JNIEnv *env, jclass cls) { return H5T_MIPS_F64; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1MIPS_1I16(JNIEnv *env, jclass cls) { return H5T_MIPS_I16; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1MIPS_1I32(JNIEnv *env, jclass cls) { return H5T_MIPS_I32; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1MIPS_1I64(JNIEnv *env, jclass cls) { return H5T_MIPS_I64; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1MIPS_1I8(JNIEnv *env, jclass cls) { return H5T_MIPS_I8; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1MIPS_1U16(JNIEnv *env, jclass cls) { return H5T_MIPS_U16; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1MIPS_1U32(JNIEnv *env, jclass cls) { return H5T_MIPS_U32; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1MIPS_1U64(JNIEnv *env, jclass cls) { return H5T_MIPS_U64; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1MIPS_1U8(JNIEnv *env, jclass cls) { return H5T_MIPS_U8; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1B16(JNIEnv *env, jclass cls) { return H5T_NATIVE_B16; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1B32(JNIEnv *env, jclass cls) { return H5T_NATIVE_B32; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1B64(JNIEnv *env, jclass cls) { return H5T_NATIVE_B64; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1B8(JNIEnv *env, jclass cls) { return H5T_NATIVE_B8; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1CHAR(JNIEnv *env, jclass cls) { return H5T_NATIVE_CHAR; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1DOUBLE(JNIEnv *env, jclass cls) { return H5T_NATIVE_DOUBLE; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1FLOAT(JNIEnv *env, jclass cls) { return H5T_NATIVE_FLOAT; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1HADDR(JNIEnv *env, jclass cls) { return H5T_NATIVE_HADDR; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1HBOOL(JNIEnv *env, jclass cls) { return H5T_NATIVE_HBOOL; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1HERR(JNIEnv *env, jclass cls) { return H5T_NATIVE_HERR; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1HSIZE(JNIEnv *env, jclass cls) { return H5T_NATIVE_HSIZE; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1HSSIZE(JNIEnv *env, jclass cls) { return H5T_NATIVE_HSSIZE; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1INT(JNIEnv *env, jclass cls) { return H5T_NATIVE_INT; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1INT_1FAST16(JNIEnv *env, jclass cls) { return H5T_NATIVE_INT_FAST16; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1INT_1FAST32(JNIEnv *env, jclass cls) { return H5T_NATIVE_INT_FAST32; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1INT_1FAST64(JNIEnv *env, jclass cls) { return H5T_NATIVE_INT_FAST64; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1INT_1FAST8(JNIEnv *env, jclass cls) { return H5T_NATIVE_INT_FAST8; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1INT_1LEAST16(JNIEnv *env, jclass cls) { return H5T_NATIVE_INT_LEAST16; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1INT_1LEAST32(JNIEnv *env, jclass cls) { return H5T_NATIVE_INT_LEAST32; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1INT_1LEAST64(JNIEnv *env, jclass cls) { return H5T_NATIVE_INT_LEAST64; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1INT_1LEAST8(JNIEnv *env, jclass cls) { return H5T_NATIVE_INT_LEAST8; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1INT16(JNIEnv *env, jclass cls) { return H5T_NATIVE_INT16; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1INT32(JNIEnv *env, jclass cls) { return H5T_NATIVE_INT32; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1INT64(JNIEnv *env, jclass cls) { return H5T_NATIVE_INT64; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1INT8(JNIEnv *env, jclass cls) { return H5T_NATIVE_INT8; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1LDOUBLE(JNIEnv *env, jclass cls) { return H5T_NATIVE_LDOUBLE; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1LLONG(JNIEnv *env, jclass cls) { return H5T_NATIVE_LLONG; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1LONG(JNIEnv *env, jclass cls) { return H5T_NATIVE_LONG; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1OPAQUE(JNIEnv *env, jclass cls) { return H5T_NATIVE_OPAQUE; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1SCHAR(JNIEnv *env, jclass cls) { return H5T_NATIVE_SCHAR; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1SHORT(JNIEnv *env, jclass cls) { return H5T_NATIVE_SHORT; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1UCHAR(JNIEnv *env, jclass cls) { return H5T_NATIVE_UCHAR; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1UINT(JNIEnv *env, jclass cls) { return H5T_NATIVE_UINT; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1UINT_1FAST16(JNIEnv *env, jclass cls) { return H5T_NATIVE_UINT_FAST16; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1UINT_1FAST32(JNIEnv *env, jclass cls) { return H5T_NATIVE_UINT_FAST32; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1UINT_1FAST64(JNIEnv *env, jclass cls) { return H5T_NATIVE_UINT_FAST64; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1UINT_1FAST8(JNIEnv *env, jclass cls) { return H5T_NATIVE_UINT_FAST8; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1UINT_1LEAST16(JNIEnv *env, jclass cls) { return H5T_NATIVE_UINT_LEAST16; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1UINT_1LEAST32(JNIEnv *env, jclass cls) { return H5T_NATIVE_UINT_LEAST32; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1UINT_1LEAST64(JNIEnv *env, jclass cls) { return H5T_NATIVE_UINT_LEAST64; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1UINT_1LEAST8(JNIEnv *env, jclass cls) { return H5T_NATIVE_UINT_LEAST8; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1UINT16(JNIEnv *env, jclass cls) { return H5T_NATIVE_UINT16; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1UINT32(JNIEnv *env, jclass cls) { return H5T_NATIVE_UINT32; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1UINT64(JNIEnv *env, jclass cls) { return H5T_NATIVE_UINT64; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1UINT8(JNIEnv *env, jclass cls) { return H5T_NATIVE_UINT8; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1ULLONG(JNIEnv *env, jclass cls) { return H5T_NATIVE_ULLONG; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1ULONG(JNIEnv *env, jclass cls) { return H5T_NATIVE_ULONG; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1USHORT(JNIEnv *env, jclass cls) { return H5T_NATIVE_USHORT; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NCLASSES(JNIEnv *env, jclass cls) { return H5T_NCLASSES; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NO_1CLASS(JNIEnv *env, jclass cls) { return H5T_NO_CLASS; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NORM_1ERROR(JNIEnv *env, jclass cls) { return H5T_NORM_ERROR; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NORM_1IMPLIED(JNIEnv *env, jclass cls) { return H5T_NORM_IMPLIED; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NORM_1MSBSET(JNIEnv *env, jclass cls) { return H5T_NORM_MSBSET; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NORM_1NONE(JNIEnv *env, jclass cls) { return H5T_NORM_NONE; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NPAD(JNIEnv *env, jclass cls) { return H5T_NPAD; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NSGN(JNIEnv *env, jclass cls) { return H5T_NSGN; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1OPAQUE(JNIEnv *env, jclass cls) { return H5T_OPAQUE; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1OPAQUE_1TAG_1MAX(JNIEnv *env, jclass cls) { return H5T_OPAQUE_TAG_MAX; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1ORDER_1BE(JNIEnv *env, jclass cls) { return H5T_ORDER_BE; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1ORDER_1ERROR(JNIEnv *env, jclass cls) { return H5T_ORDER_ERROR; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1ORDER_1LE(JNIEnv *env, jclass cls) { return H5T_ORDER_LE; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1ORDER_1NONE(JNIEnv *env, jclass cls) { return H5T_ORDER_NONE; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1ORDER_1VAX(JNIEnv *env, jclass cls) { return H5T_ORDER_VAX; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1PAD_1BACKGROUND(JNIEnv *env, jclass cls) { return H5T_PAD_BACKGROUND; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1PAD_1ERROR(JNIEnv *env, jclass cls) { return H5T_PAD_ERROR; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1PAD_1ONE(JNIEnv *env, jclass cls) { return H5T_PAD_ONE; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1PAD_1ZERO(JNIEnv *env, jclass cls) { return H5T_PAD_ZERO; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1PERS_1DONTCARE(JNIEnv *env, jclass cls) { return H5T_PERS_DONTCARE; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1PERS_1HARD(JNIEnv *env, jclass cls) { return H5T_PERS_HARD; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1PERS_1SOFT(JNIEnv *env, jclass cls) { return H5T_PERS_SOFT; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1REFERENCE(JNIEnv *env, jclass cls) { return H5T_REFERENCE; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1SGN_12(JNIEnv *env, jclass cls) { return H5T_SGN_2; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1SGN_1ERROR(JNIEnv *env, jclass cls) { return H5T_SGN_ERROR; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1SGN_1NONE(JNIEnv *env, jclass cls) { return H5T_SGN_NONE; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1B16BE(JNIEnv *env, jclass cls) { return H5T_STD_B16BE; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1B16LE(JNIEnv *env, jclass cls) { return H5T_STD_B16LE; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1B32BE(JNIEnv *env, jclass cls) { return H5T_STD_B32BE; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1B32LE(JNIEnv *env, jclass cls) { return H5T_STD_B32LE; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1B64BE(JNIEnv *env, jclass cls) { return H5T_STD_B64BE; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1B64LE(JNIEnv *env, jclass cls) { return H5T_STD_B64LE; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1B8BE(JNIEnv *env, jclass cls) { return H5T_STD_B8BE; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1B8LE(JNIEnv *env, jclass cls) { return H5T_STD_B8LE; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1I16BE(JNIEnv *env, jclass cls) { return H5T_STD_I16BE; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1I16LE(JNIEnv *env, jclass cls) { return H5T_STD_I16LE; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1I32BE(JNIEnv *env, jclass cls) { return H5T_STD_I32BE; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1I32LE(JNIEnv *env, jclass cls) { return H5T_STD_I32LE; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1I64BE(JNIEnv *env, jclass cls) { return H5T_STD_I64BE; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1I64LE(JNIEnv *env, jclass cls) { return H5T_STD_I64LE; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1I8BE(JNIEnv *env, jclass cls) { return H5T_STD_I8BE; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1I8LE(JNIEnv *env, jclass cls) { return H5T_STD_I8LE; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1REF_1DSETREG(JNIEnv *env, jclass cls) { return H5T_STD_REF_DSETREG; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1REF_1OBJ(JNIEnv *env, jclass cls) { return H5T_STD_REF_OBJ; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1U16BE(JNIEnv *env, jclass cls) { return H5T_STD_U16BE; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1U16LE(JNIEnv *env, jclass cls) { return H5T_STD_U16LE; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1U32BE(JNIEnv *env, jclass cls) { return H5T_STD_U32BE; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1U32LE(JNIEnv *env, jclass cls) { return H5T_STD_U32LE; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1U64BE(JNIEnv *env, jclass cls) { return H5T_STD_U64BE; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1U64LE(JNIEnv *env, jclass cls) { return H5T_STD_U64LE; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1U8BE(JNIEnv *env, jclass cls) { return H5T_STD_U8BE; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1U8LE(JNIEnv *env, jclass cls) { return H5T_STD_U8LE; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1STR_1ERROR(JNIEnv *env, jclass cls) { return H5T_STR_ERROR; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1STR_1NULLPAD(JNIEnv *env, jclass cls) { return H5T_STR_NULLPAD; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1STR_1NULLTERM(JNIEnv *env, jclass cls) { return H5T_STR_NULLTERM; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1STR_1RESERVED_110(JNIEnv *env, jclass cls) { return H5T_STR_RESERVED_10; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1STR_1RESERVED_111(JNIEnv *env, jclass cls) { return H5T_STR_RESERVED_11; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1STR_1RESERVED_112(JNIEnv *env, jclass cls) { return H5T_STR_RESERVED_12; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1STR_1RESERVED_113(JNIEnv *env, jclass cls) { return H5T_STR_RESERVED_13; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1STR_1RESERVED_114(JNIEnv *env, jclass cls) { return H5T_STR_RESERVED_14; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1STR_1RESERVED_115(JNIEnv *env, jclass cls) { return H5T_STR_RESERVED_15; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1STR_1RESERVED_13(JNIEnv *env, jclass cls) { return H5T_STR_RESERVED_3; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1STR_1RESERVED_14(JNIEnv *env, jclass cls) { return H5T_STR_RESERVED_4; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1STR_1RESERVED_15(JNIEnv *env, jclass cls) { return H5T_STR_RESERVED_5; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1STR_1RESERVED_16(JNIEnv *env, jclass cls) { return H5T_STR_RESERVED_6; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1STR_1RESERVED_17(JNIEnv *env, jclass cls) { return H5T_STR_RESERVED_7; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1STR_1RESERVED_18(JNIEnv *env, jclass cls) { return H5T_STR_RESERVED_8; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1STR_1RESERVED_19(JNIEnv *env, jclass cls) { return H5T_STR_RESERVED_9; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1STR_1SPACEPAD(JNIEnv *env, jclass cls) { return H5T_STR_SPACEPAD; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1STRING(JNIEnv *env, jclass cls) { return H5T_STRING; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1TIME(JNIEnv *env, jclass cls) { return H5T_TIME; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1UNIX_1D32BE(JNIEnv *env, jclass cls) { return H5T_UNIX_D32BE; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1UNIX_1D32LE(JNIEnv *env, jclass cls) { return H5T_UNIX_D32LE; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1UNIX_1D64BE(JNIEnv *env, jclass cls) { return H5T_UNIX_D64BE; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1UNIX_1D64LE(JNIEnv *env, jclass cls) { return H5T_UNIX_D64LE; } -JNIEXPORT jlong JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1VARIABLE(JNIEnv *env, jclass cls) { return (int)H5T_VARIABLE; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1VLEN(JNIEnv *env, jclass cls) { return H5T_VLEN; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5Z_1CB_1CONT(JNIEnv *env, jclass cls) { return H5Z_CB_CONT; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5Z_1CB_1ERROR(JNIEnv *env, jclass cls) { return H5Z_CB_ERROR; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5Z_1CB_1FAIL(JNIEnv *env, jclass cls) { return H5Z_CB_FAIL; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5Z_1CB_1NO(JNIEnv *env, jclass cls) { return H5Z_CB_NO; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5Z_1DISABLE_1EDC(JNIEnv *env, jclass cls) { return H5Z_DISABLE_EDC; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5Z_1ENABLE_1EDC(JNIEnv *env, jclass cls) { return H5Z_ENABLE_EDC; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5Z_1ERROR_1EDC(JNIEnv *env, jclass cls) { return H5Z_ERROR_EDC; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5Z_1FILTER_1CONFIG_1DECODE_1ENABLED(JNIEnv *env, jclass cls) { return H5Z_FILTER_CONFIG_DECODE_ENABLED; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5Z_1FILTER_1CONFIG_1ENCODE_1ENABLED(JNIEnv *env, jclass cls) { return H5Z_FILTER_CONFIG_ENCODE_ENABLED; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5Z_1FILTER_1DEFLATE(JNIEnv *env, jclass cls) { return H5Z_FILTER_DEFLATE; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5Z_1FILTER_1ERROR(JNIEnv *env, jclass cls) { return H5Z_FILTER_ERROR; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5Z_1FILTER_1FLETCHER32(JNIEnv *env, jclass cls) { return H5Z_FILTER_FLETCHER32; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5Z_1FILTER_1MAX(JNIEnv *env, jclass cls) { return H5Z_FILTER_MAX; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5Z_1FILTER_1NBIT(JNIEnv *env, jclass cls) {return H5Z_FILTER_NBIT; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5Z_1FILTER_1NONE(JNIEnv *env, jclass cls) { return H5Z_FILTER_NONE; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5Z_1FILTER_1RESERVED(JNIEnv *env, jclass cls) { return H5Z_FILTER_RESERVED; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5Z_1FILTER_1SCALEOFFSET(JNIEnv *env, jclass cls){ return H5Z_FILTER_SCALEOFFSET; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5Z_1FILTER_1SHUFFLE(JNIEnv *env, jclass cls) { return H5Z_FILTER_SHUFFLE; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5Z_1FILTER_1SZIP(JNIEnv *env, jclass cls) { return H5Z_FILTER_SZIP; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5Z_1FLAG_1DEFMASK(JNIEnv *env, jclass cls) { return H5Z_FLAG_DEFMASK; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5Z_1FLAG_1INVMASK(JNIEnv *env, jclass cls) { return H5Z_FLAG_INVMASK; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5Z_1FLAG_1MANDATORY(JNIEnv *env, jclass cls) { return H5Z_FLAG_MANDATORY; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5Z_1FLAG_1OPTIONAL(JNIEnv *env, jclass cls) { return H5Z_FLAG_OPTIONAL; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5Z_1FLAG_1REVERSE(JNIEnv *env, jclass cls) { return H5Z_FLAG_REVERSE; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5Z_1FLAG_1SKIP_1EDC(JNIEnv *env, jclass cls) { return H5Z_FLAG_SKIP_EDC; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5Z_1MAX_1NFILTERS(JNIEnv *env, jclass cls) { return H5Z_MAX_NFILTERS; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5Z_1NO_1EDC(JNIEnv *env, jclass cls) { return H5Z_NO_EDC; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5Z_1SO_1INT_1MINBITS_1DEFAULT(JNIEnv *env, jclass cls) { return H5Z_SO_INT_MINBITS_DEFAULT; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5Z_1SO_1FLOAT_1DSCALE(JNIEnv *env, jclass cls){return H5Z_SO_FLOAT_DSCALE; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5Z_1SO_1FLOAT_1ESCALE(JNIEnv *env, jclass cls){return H5Z_SO_FLOAT_ESCALE; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5Z_1SO_1INT(JNIEnv *env, jclass cls){return H5Z_SO_INT; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5Z_1SHUFFLE_1USER_1NPARMS(JNIEnv *env, jclass cls) { return H5Z_SHUFFLE_USER_NPARMS; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5Z_1SHUFFLE_1TOTAL_1NPARMS(JNIEnv *env, jclass cls) { return H5Z_SHUFFLE_TOTAL_NPARMS; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5Z_1SZIP_1USER_1NPARMS(JNIEnv *env, jclass cls) { return H5Z_SZIP_USER_NPARMS; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5Z_1SZIP_1TOTAL_1NPARMS(JNIEnv *env, jclass cls) { return H5Z_SZIP_TOTAL_NPARMS; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5Z_1SZIP_1PARM_1MASK(JNIEnv *env, jclass cls) { return H5Z_SZIP_PARM_MASK; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5Z_1SZIP_1PARM_1PPB(JNIEnv *env, jclass cls) { return H5Z_SZIP_PARM_PPB; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5Z_1SZIP_1PARM_1BPP(JNIEnv *env, jclass cls) { return H5Z_SZIP_PARM_BPP; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5Z_1SZIP_1PARM_1PPS(JNIEnv *env, jclass cls) { return H5Z_SZIP_PARM_PPS; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5Z_1NBIT_1USER_1NPARMS(JNIEnv *env, jclass cls) { return H5Z_NBIT_USER_NPARMS; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5Z_1SCALEOFFSET_1USER_1NPARMS(JNIEnv *env, jclass cls) { return H5Z_SCALEOFFSET_USER_NPARMS; } -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5Z_1FILTER_1ALL(JNIEnv *env, jclass cls) { return H5Z_FILTER_ALL; } #pragma GCC diagnostic pop diff --git a/java/src/jni/h5dImp.h b/java/src/jni/h5dImp.h index 2a91334..eb26265 100644 --- a/java/src/jni/h5dImp.h +++ b/java/src/jni/h5dImp.h @@ -353,7 +353,7 @@ Java_hdf_hdf5lib_H5_H5Diterate * Method: H5Dflush * Signature: (J)V */ -JNIEXPORT void JNICALL +JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Dflush (JNIEnv*, jclass, jlong); @@ -362,7 +362,7 @@ Java_hdf_hdf5lib_H5_H5Dflush * Method: H5Drefresh * Signature: (J)V */ -JNIEXPORT void JNICALL +JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Drefresh (JNIEnv*, jclass, jlong); diff --git a/java/src/jni/h5fImp.h b/java/src/jni/h5fImp.h index 7aff835..396df65 100644 --- a/java/src/jni/h5fImp.h +++ b/java/src/jni/h5fImp.h @@ -217,7 +217,7 @@ Java_hdf_hdf5lib_H5_H5Fclear_1elink_1file_1cache * Method: H5Fstart_swmr_write * Signature: (J)V */ -JNIEXPORT void JNICALL +JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Fstart_1swmr_1write (JNIEnv *, jclass, jlong); @@ -226,7 +226,7 @@ Java_hdf_hdf5lib_H5_H5Fstart_1swmr_1write * Method: H5Fstart_mdc_logging * Signature: (J)V */ -JNIEXPORT void JNICALL +JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Fstart_1mdc_1logging (JNIEnv *, jclass, jlong); @@ -235,7 +235,7 @@ Java_hdf_hdf5lib_H5_H5Fstart_1mdc_1logging * Method: H5Fstop_mdc_logging * Signature: (J)V */ -JNIEXPORT void JNICALL +JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Fstop_1mdc_1logging (JNIEnv *, jclass, jlong); @@ -244,7 +244,7 @@ Java_hdf_hdf5lib_H5_H5Fstop_1mdc_1logging * Method: H5Fget_mdc_logging_status * Signature: (J[Z)V */ -JNIEXPORT void JNICALL +JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Fget_1mdc_1logging_1status (JNIEnv *, jclass, jlong, jbooleanArray); diff --git a/java/src/jni/h5gImp.h b/java/src/jni/h5gImp.h index 3113689..dce1247 100644 --- a/java/src/jni/h5gImp.h +++ b/java/src/jni/h5gImp.h @@ -102,7 +102,7 @@ Java_hdf_hdf5lib_H5_H5Gget_1info_1by_1idx * Method: H5Gflush * Signature: (J)V */ -JNIEXPORT void JNICALL +JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Gflush (JNIEnv*, jclass, jlong); @@ -111,7 +111,7 @@ Java_hdf_hdf5lib_H5_H5Gflush * Method: H5Grefresh * Signature: (J)V */ -JNIEXPORT void JNICALL +JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Grefresh (JNIEnv*, jclass, jlong); diff --git a/java/src/jni/h5oImp.h b/java/src/jni/h5oImp.h index 293dc2e..5d07c29 100644 --- a/java/src/jni/h5oImp.h +++ b/java/src/jni/h5oImp.h @@ -191,7 +191,7 @@ Java_hdf_hdf5lib_H5__1H5Oopen_1by_1idx * Method: H5Oflush * Signature: (J)V */ -JNIEXPORT void JNICALL +JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Oflush (JNIEnv*, jclass, jlong); @@ -200,7 +200,7 @@ Java_hdf_hdf5lib_H5_H5Oflush * Method: H5Orefresh * Signature: (J)V */ -JNIEXPORT void JNICALL +JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Orefresh (JNIEnv*, jclass, jlong); diff --git a/java/src/jni/h5tImp.h b/java/src/jni/h5tImp.h index e614082..417d231 100644 --- a/java/src/jni/h5tImp.h +++ b/java/src/jni/h5tImp.h @@ -613,7 +613,7 @@ Java_hdf_hdf5lib_H5_H5Tconvert * Method: H5Tflush * Signature: (J)V */ -JNIEXPORT void JNICALL +JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Tflush (JNIEnv*, jclass, jlong); @@ -622,7 +622,7 @@ Java_hdf_hdf5lib_H5_H5Tflush * Method: H5Trefresh * Signature: (J)V */ -JNIEXPORT void JNICALL +JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Trefresh (JNIEnv*, jclass, jlong); diff --git a/java/test/CMakeLists.txt b/java/test/CMakeLists.txt index b3a996b..8912b3f 100644 --- a/java/test/CMakeLists.txt +++ b/java/test/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 3.1.0) +cmake_minimum_required (VERSION 3.2.2) PROJECT (HDF5_JAVA_TEST Java) set (CMAKE_VERBOSE_MAKEFILE 1) @@ -70,31 +70,31 @@ set (HDF_JAVA_TEST_FILES foreach (h5_file ${HDF_JAVA_TEST_FILES}) HDFTEST_COPY_FILE("${PROJECT_SOURCE_DIR}/${h5_file}" "${PROJECT_BINARY_DIR}/${h5_file}" "${HDF5_JAVA_TEST_LIB_TARGET}_files") -endforeach (h5_file ${HDF_JAVA_TEST_FILES}) +endforeach () HDFTEST_COPY_FILE("${PROJECT_SOURCE_DIR}/h5ex_g_iterate.orig" "${PROJECT_BINARY_DIR}/h5ex_g_iterate.hdf" "${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}) if (WIN32) set (CMAKE_JAVA_INCLUDE_FLAG_SEP ";") -else (WIN32) +else () set (CMAKE_JAVA_INCLUDE_FLAG_SEP ":") -endif (WIN32) +endif () set (CMAKE_JAVA_CLASSPATH ".") foreach (CMAKE_INCLUDE_PATH ${CMAKE_JAVA_INCLUDE_PATH}) set (CMAKE_JAVA_CLASSPATH "${CMAKE_JAVA_CLASSPATH}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${CMAKE_INCLUDE_PATH}") -endforeach (CMAKE_INCLUDE_PATH) +endforeach () set (CMAKE_JAVA_CLASSPATH "${CMAKE_JAVA_CLASSPATH}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${${HDF5_JAVA_TEST_LIB_TARGET}_JAR_FILE}") set (testfilter "OK (598 tests)") if (CMAKE_BUILD_TYPE MATCHES Debug) if (WIN32) set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=hdf5_java_D;") - else() + else () set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=hdf5_java_debug;") - endif() -endif(CMAKE_BUILD_TYPE MATCHES Debug) + endif () +endif () add_test ( NAME JUnit-interface-clearall-objects diff --git a/java/test/JUnit-interface.txt b/java/test/JUnit-interface.txt index 7fd80f8..34ec02a 100644 --- a/java/test/JUnit-interface.txt +++ b/java/test/JUnit-interface.txt @@ -530,6 +530,7 @@ JUnit version 4.11 .testH5Pvirtual_storage .testH5Pget_selection_source_dataset .testH5Pget_source_filename +.testH5Pset_get_virtual_printf_gap .testH5Pget_virtual_count .testH5Pset_get_virtual_view .testH5Pget_mapping_parameters @@ -637,7 +638,7 @@ JUnit version 4.11 Time: XXXX -OK (635 tests) +OK (636 tests) HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Fopen(): can't set access and transfer property lists diff --git a/java/test/TestH5Ocopy.java b/java/test/TestH5Ocopy.java index 62dd886..cf0fb1f 100644 --- a/java/test/TestH5Ocopy.java +++ b/java/test/TestH5Ocopy.java @@ -239,6 +239,7 @@ public class TestH5Ocopy { try {H5.H5Pclose(ocp_plist_id);} catch (Exception ex) {} try {H5.H5Fclose(H5fid2);} catch (Exception ex) {} } + _deleteFile("copy.h5"); } @Test diff --git a/java/test/TestH5Pvirtual.java b/java/test/TestH5Pvirtual.java index 9372ae1..15fbd03 100644 --- a/java/test/TestH5Pvirtual.java +++ b/java/test/TestH5Pvirtual.java @@ -220,6 +220,7 @@ public class TestH5Pvirtual { try {H5.H5Dclose(H5did);} catch (Exception ex) {} } assertTrue("testH5Pget_virtual_count: "+num_map, num_map >= 0); + assertEquals(3, num_map); } @Test @@ -406,7 +407,7 @@ public class TestH5Pvirtual { } } - @Ignore + @Test public void testH5Pset_get_virtual_printf_gap() { long ret_val = -1; H5did = _createDataset(H5fid, H5dsid, "VDS", H5dcplid, H5dapl_id); @@ -415,7 +416,7 @@ public class TestH5Pvirtual { assertTrue("H5Pget_virtual_printf_gap", ret_val >= 0); assertEquals(0, ret_val); H5.H5Pset_virtual_printf_gap(H5dapl_id, 2); - ret_val = H5.H5Pget_virtual_view(H5dapl_id); + ret_val = H5.H5Pget_virtual_printf_gap(H5dapl_id); assertTrue("H5Pget_virtual_printf_gap", ret_val >= 0); assertEquals(2, ret_val); } diff --git a/java/test/junit.sh.in b/java/test/junit.sh.in index a9a71cb..31037ba 100644 --- a/java/test/junit.sh.in +++ b/java/test/junit.sh.in @@ -183,7 +183,16 @@ CLEAN_DATAFILES_AND_BLDDIR() $RM $BLDDIR/JUnit-interface.out $RM $BLDDIR/JUnit-interface.err $RM $BLDDIR/JUnit-interface.ext + # skip rm if srcdir is same as destdir + # this occurs when build/test performed in source dir and + # make cp fail + SDIR=`$DIRNAME $tstfile` + INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` + INODE_DDIR=`$LS -i -d $BLDDIR | $AWK -F' ' '{print $1}'` + if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then + $RM $BLDDIR/JUnit-interface.ert $RM $BLDDIR/JUnit-interface.txt + fi } # Print a line-line message left justified in a field of 70 characters diff --git a/release_docs/INSTALL_CMake.txt b/release_docs/INSTALL_CMake.txt index ee331a8..70ec47f 100644 --- a/release_docs/INSTALL_CMake.txt +++ b/release_docs/INSTALL_CMake.txt @@ -30,7 +30,7 @@ Obtaining HDF5 source code CMake version 1. We suggest you obtain the latest CMake from the Kitware web site. - The HDF5 1.10."X" product requires a minimum CMake version 3.1.0, + The HDF5 1.10."X" product requires a minimum CMake version 3.2.2, where "X" is the current HDF5 release version. Note: @@ -51,7 +51,7 @@ The following files referenced below are available at the HDF web site: http://www.hdfgroup.org/HDF5/release/cmakebuild.html Single compressed file with all the files needed, including source: - hdf5-1.10.0-CMake.zip or hdf5-1.10.0-CMake.tar.gz + hdf5-1.10.X-CMake.zip or hdf5-1.10.X-CMake.tar.gz Individual files ----------------------------------------------- @@ -249,7 +249,7 @@ IV. Further considerations ======================================================================== 1. We suggest you obtain the latest CMake for windows from the Kitware - web site. The HDF5 1.10."X" product requires a minimum CMake version 3.1.0. + web site. The HDF5 1.10."X" product requires a minimum CMake version 3.2.2. 2. If you plan to use Zlib or Szip: A. Download the binary packages and install them in a central location. @@ -263,10 +263,10 @@ IV. Further considerations B. Use source packages from an SVN server by adding the following CMake options: - HDF5_ALLOW_EXTERNAL_SUPPORT:STRING="SVN" - ZLIB_SVN_URL:STRING="http://some_location/zlib/trunk" - SZIP_SVN_URL:STRING="http://some_location/szip/trunk" - where "some_location" is the URL to the SVN repository. Also set + HDF5_ALLOW_EXTERNAL_SUPPORT:STRING="GIT" + ZLIB_GIT_URL:STRING="http://some_location/zlib" + SZIP_GIT_URL:STRING="http://some_location/szip" + where "some_location" is the URL to the GIT repository. Also set CMAKE_BUILD_TYPE to the configuration type. C. Use source packages from a compressed file by adding the following @@ -376,10 +376,10 @@ These five steps are described in detail below. * MinGW Makefiles * NMake Makefiles * Unix Makefiles - * Visual Studio 12 2013 - * Visual Studio 12 2013 Win64 * Visual Studio 11 2012 * Visual Studio 11 2012 Win64 + * Visual Studio 12 2013 + * Visual Studio 12 2013 Win64 * Visual Studio 14 2015 * Visual Studio 14 2015 Win64 @@ -396,6 +396,7 @@ These five steps are described in detail below. # EXTERNAL cache entries ######################## set (CMAKE_INSTALL_FRAMEWORK_PREFIX "Library/Frameworks" CACHE STRING "Frameworks installation directory" FORCE) + set (HDF5_GENERATE_HEADERS ON CACHE BOOL "Rebuild Generated Files" FORCE) set (HDF_PACKAGE_EXT "" CACHE STRING "Name of HDF package extension" FORCE) set (HDF5_BUILD_FORTRAN ON CACHE BOOL "Build FORTRAN support" FORCE) set (HDF5_BUILD_GENERATORS OFF CACHE BOOL "Build Test Generators" FORCE) @@ -403,7 +404,7 @@ These five steps are described in detail below. set (HDF5_ENABLE_SZIP_SUPPORT ON CACHE BOOL "Use SZip Filter" FORCE) set (HDF5_ENABLE_SZIP_ENCODING ON CACHE BOOL "Use SZip Encoding" FORCE) set (HDF5_ENABLE_HSIZET ON CACHE BOOL "Enable datasets larger than memory" FORCE) - set (HDF5_ENABLE_UNSUPPORTED OFF CACHE BOOL "Enable unsupported combinations of configuration options" FORCE) + set (ALLOW_UNSUPPORTED OFF CACHE BOOL "Enable unsupported combinations of configuration options" FORCE) set (HDF5_ENABLE_DEPRECATED_SYMBOLS ON CACHE BOOL "Enable deprecated public API symbols" FORCE) set (HDF5_ENABLE_DIRECT_VFD OFF CACHE BOOL "Build the Direct I/O Virtual File Driver" FORCE) set (HDF5_ENABLE_PARALLEL OFF CACHE BOOL "Enable parallel build (requires MPI)" FORCE) @@ -413,14 +414,16 @@ These five steps are described in detail below. set (HDF5_ENABLE_USING_MEMCHECKER OFF CACHE BOOL "Indicate that a memory checker is used" FORCE) set (HDF5_MEMORY_ALLOC_SANITY_CHECK OFF CACHE BOOL "Indicate that internal memory allocation sanity checks are enabled" FORCE) set (HDF5_DISABLE_COMPILER_WARNINGS OFF CACHE BOOL "Disable compiler warnings" FORCE) + set (HDF5_ENABLE_ALL_WARNINGS ON CACHE BOOL "Enable all warnings" FORCE) set (HDF5_USE_FOLDERS ON CACHE BOOL "Enable folder grouping of projects in IDEs." FORCE) set (HDF5_USE_16_API_DEFAULT OFF CACHE BOOL "Use the HDF5 1.6.x API by default" FORCE) + set (HDF5_USE_18_API_DEFAULT OFF CACHE BOOL "Use the HDF5 1.8.x API by default" FORCE) set (HDF5_ENABLE_THREADSAFE OFF CACHE BOOL "(WINDOWS)Enable Threadsafety" FORCE) set (HDF_TEST_EXPRESS "2" CACHE STRING "Control testing framework (0-3)" FORCE) set (HDF5_PACKAGE_EXTLIBS OFF CACHE BOOL "(WINDOWS)CPACK - include external libraries" FORCE) set (HDF5_NO_PACKAGES OFF CACHE BOOL "CPACK - Disable packaging" FORCE) - set (HDF5_ALLOW_EXTERNAL_SUPPORT "NO" CACHE STRING "Allow External Library Building (NO SVN TGZ)" FORCE) - set_property (CACHE HDF5_ALLOW_EXTERNAL_SUPPORT PROPERTY STRINGS NO SVN TGZ) + set (HDF5_ALLOW_EXTERNAL_SUPPORT "NO" CACHE STRING "Allow External Library Building (NO GIT SVN TGZ)" FORCE) + set_property (CACHE HDF5_ALLOW_EXTERNAL_SUPPORT PROPERTY STRINGS NO GIT SVN TGZ) set (ZLIB_TGZ_NAME "ZLib.tar.gz" CACHE STRING "Use ZLib from compressed file" FORCE) set (SZIP_TGZ_NAME "SZip.tar.gz" CACHE STRING "Use SZip from compressed file" FORCE) set (ZLIB_PACKAGE_NAME "zlib" CACHE STRING "Name of ZLIB package" FORCE) @@ -477,15 +480,15 @@ These five steps are described in detail below. Release and build the solution. 3.2.1 The external libraries (zlib and szip) can be configured - to allow building the libraries by downloading from an SVN repository. + to allow building the libraries by downloading from an GIT repository. The option is 'HDF5_ALLOW_EXTERNAL_SUPPORT'; by adding the following configuration option: - -DHDF5_ALLOW_EXTERNAL_SUPPORT:STRING="SVN" + -DHDF5_ALLOW_EXTERNAL_SUPPORT:STRING="GIT" - The options to control the SVN URL (config/cmake/cacheinit.cmake file) are: - ZLIB_SVN_URL:STRING="http://${svn_url}/zlib/trunk" - SZIP_SVN_URL:STRING="http://${svn_url}/szip/trunk" - ${svn_url} should be changed to your location. Also define CMAKE_BUILD_TYPE + The options to control the GIT URL (config/cmake/cacheinit.cmake file) are: + ZLIB_GIT_URL:STRING="http://${git_url}/zlib" + SZIP_GIT_URL:STRING="http://${git_url}/szip" + ${git_url} should be changed to your location. Also define CMAKE_BUILD_TYPE to be the configuration type. 3.2.2 Or the external libraries (zlib and szip) can be configured @@ -525,8 +528,8 @@ These five steps are described in detail below. NOTE: See note 8 of this document for NSIS information. See note 9 of this document for WiX information. - Also, if you are using a Visual Studio Express version or do not - want to enable the packaging components, set HDF5_NO_PACKAGES + Also, if you are using a Visual Studio Express version or + want to disable the packaging components, set HDF5_NO_PACKAGES to ON (on the command line add -DHDF5_NO_PACKAGES:BOOL=ON) 6. The files that support building HDF5 with CMake are all the files in the @@ -563,7 +566,7 @@ The config/cmake/cacheinit.cmake file can override the following values. ---------------- General Build Options --------------------- BUILD_SHARED_LIBS "Build Shared Libraries" ON -BUILD_STATIC_EXECS "Build Static Executabless" OFF +BUILD_STATIC_EXECS "Build Static Executables" OFF BUILD_TESTING "Build HDF5 Unit Testing" ON ---------------- HDF5 Build Options --------------------- @@ -624,9 +627,9 @@ if (HDF5_ENABLE_SZIP_SUPPORT) HDF5_ENABLE_SZIP_ENCODING "Use SZip Encoding" OFF if (WINDOWS) H5_DEFAULT_PLUGINDIR "%ALLUSERSPROFILE%/hdf5/lib/plugin" -else (WINDOWS) +else () H5_DEFAULT_PLUGINDIR "/usr/local/hdf5/lib/plugin" -endif (WINDOWS) +endif () @@ -647,9 +650,9 @@ build and test process. VIII. Options for Platform Configuration Files ======================================================================== -Below is the HDF5config.cmake ctest script with extra comments. +Below is the HDF5config.cmake and HDF5options.cmake ctest scripts. Execute: - ctest -S HDF5config.cmake,BUILD_GENERATOR=xxx -C Release -V -O hdf5.log + ctest -S HDF5config.cmake,BUILD_GENERATOR=xxx -C Release -VV -O hdf5.log The same scripts can be used on Linux, Mac OSX or a Windows machine by adding an option (${CTEST_SCRIPT_ARG}) to the platform configuration script. @@ -657,10 +660,10 @@ adding an option (${CTEST_SCRIPT_ARG}) to the platform configuration script. ############################################################################################# ### ${CTEST_SCRIPT_ARG} is of the form OPTION=VALUE ### ### BUILD_GENERATOR required [Unix, VS2015, VS201564, VS2013, VS201364, VS2012, VS201264] ### -### ctest -S HDF5config.cmake,BUILD_GENERATOR=VS201264 -C Release -V -O hdf5.log ### +### ctest -S HDF5config.cmake,BUILD_GENERATOR=VS201264 -C Release -VV -O hdf5.log ### ############################################################################################# -cmake_minimum_required(VERSION 3.1.0 FATAL_ERROR) +cmake_minimum_required(VERSION 3.2.2 FATAL_ERROR) ############################################################################ # Usage: # ctest -S HDF5config.cmake,OPTION=VALUE -C Release -VV -O test.log @@ -677,22 +680,22 @@ cmake_minimum_required(VERSION 3.1.0 FATAL_ERROR) # INSTALLDIR - root folder where hdf5 is installed # CTEST_CONFIGURATION_TYPE - Release, Debug, etc # CTEST_SOURCE_NAME - source folder -# STATIC_LIBRARIES - Build/use static libraries +# STATIC_ONLY - Build/use static libraries # FORTRAN_LIBRARIES - Build/use fortran libraries # JAVA_LIBRARIES - Build/use java libraries # NO_MAC_FORTRAN - Yes to be SHARED on a Mac ############################################################################## -set(CTEST_SOURCE_VERSION 1.10.0) -set(CTEST_SOURCE_VERSEXT "-pre1") +set(CTEST_SOURCE_VERSION 1.10.1) +set(CTEST_SOURCE_VERSEXT "") ############################################################################## # handle input parameters to script. #BUILD_GENERATOR - which CMake generator to use, required #INSTALLDIR - HDF5-1.10.0 root folder #CTEST_CONFIGURATION_TYPE - Release, Debug, RelWithDebInfo -#CTEST_SOURCE_NAME - name of source folder; HDF5-1.10.0 -#STATIC_LIBRARIES - Default is YES +#CTEST_SOURCE_NAME - name of source folder; HDF5-1.10.1 +#STATIC_ONLY - Default is YES #FORTRAN_LIBRARIES - Default is NO #JAVA_LIBRARIES - Default is NO #NO_MAC_FORTRAN - set to TRUE to allow shared libs on a Mac @@ -704,14 +707,14 @@ if(DEFINED CTEST_SCRIPT_ARG) foreach(current_var ${script_args}) if ("${current_var}" MATCHES "^([^=]+)=(.+)$") set("${CMAKE_MATCH_1}" "${CMAKE_MATCH_2}") - endif() - endforeach() -endif() + endif () + endforeach () +endif () # build generator must be defined if(NOT DEFINED BUILD_GENERATOR) message(FATAL_ERROR "BUILD_GENERATOR must be defined - Unix, VS2015, VS201564, VS2013, VS201364, VS2012, or VS201264") -else() +else () if(${BUILD_GENERATOR} STREQUAL "Unix") set(CTEST_CMAKE_GENERATOR "Unix Makefiles") elseif(${BUILD_GENERATOR} STREQUAL "VS2015") @@ -726,49 +729,54 @@ else() set(CTEST_CMAKE_GENERATOR "Visual Studio 11 2012") elseif(${BUILD_GENERATOR} STREQUAL "VS201264") set(CTEST_CMAKE_GENERATOR "Visual Studio 11 2012 Win64") - else() + else () message(FATAL_ERROR "Invalid BUILD_GENERATOR must be - Unix, VS2015, VS201564, VS2013, VS201364, VS2012, or VS201264") - endif() -endif() + endif () +endif () + +################################################################### +### Following Line is one of [Release, RelWithDebInfo, Debug] ##### +set(CTEST_CONFIGURATION_TYPE "$ENV{CMAKE_CONFIG_TYPE}") +################################################################### if(NOT DEFINED INSTALLDIR) if(WIN32) - set(INSTALLDIR "C:\\Program\ Files\\myhdf5") - else() - set(INSTALLDIR "/usr/local/myhdf5") - endif() -endif() + set(INSTALLDIR "C:/Program Files/HDF_Group/HDF5/${CTEST_SOURCE_VERSION}") + else () + set(INSTALLDIR "${CTEST_SCRIPT_DIRECTORY}/HDF_Group/HDF5/${CTEST_SOURCE_VERSION}") + endif () +endif () if(NOT DEFINED CTEST_CONFIGURATION_TYPE) set(CTEST_CONFIGURATION_TYPE "Release") -endif() +endif () if(NOT DEFINED CTEST_SOURCE_NAME) set(CTEST_SOURCE_NAME "hdf5-${CTEST_SOURCE_VERSION}${CTEST_SOURCE_VERSEXT}") -endif() -if(NOT DEFINED STATIC_LIBRARIES) - set(STATICLIBRARIES "YES") -else() - set(STATICLIBRARIES "NO") -endif() +endif () +if(NOT DEFINED STATIC_ONLY) + set(STATICONLYLIBRARIES "YES") +else () + set(STATICONLYLIBRARIES "NO") +endif () if(NOT DEFINED FORTRAN_LIBRARIES) set(FORTRANLIBRARIES "NO") -else() +else () set(FORTRANLIBRARIES "YES") -endif() +endif () if(NOT DEFINED JAVA_LIBRARIES) set(JAVALIBRARIES "NO") -else() +else () set(JAVALIBRARIES "YES") -endif() +endif () set(CTEST_BINARY_NAME "build") set(CTEST_DASHBOARD_ROOT "${CTEST_SCRIPT_DIRECTORY}") if(WIN32) set(CTEST_SOURCE_DIRECTORY "${CTEST_DASHBOARD_ROOT}\\${CTEST_SOURCE_NAME}") set(CTEST_BINARY_DIRECTORY "${CTEST_DASHBOARD_ROOT}\\${CTEST_BINARY_NAME}") -else() +else () set(CTEST_SOURCE_DIRECTORY "${CTEST_DASHBOARD_ROOT}/${CTEST_SOURCE_NAME}") set(CTEST_BINARY_DIRECTORY "${CTEST_DASHBOARD_ROOT}/${CTEST_BINARY_NAME}") -endif() +endif () ################################################################### ######### Following describes compiler ############ @@ -799,17 +807,33 @@ if(WIN32) set(SITE_OS_BITS "32") set(SITE_COMPILER_NAME "vs2012") set(SITE_COMPILER_VERSION "11") - endif() + endif () ## Set the following to unique id your computer ## set(CTEST_SITE "WIN7${BUILD_GENERATOR}.XXXX") -else() +else () + set(CTEST_CMAKE_GENERATOR "Unix Makefiles") ## Set the following to unique id your computer ## if(APPLE) set(CTEST_SITE "MAC.XXXX") - else() + else () set(CTEST_SITE "LINUX.XXXX") - endif() -endif() + endif () + if(APPLE) + execute_process(COMMAND xcrun --find cc OUTPUT_VARIABLE XCODE_CC OUTPUT_STRIP_TRAILING_WHITESPACE) + execute_process(COMMAND xcrun --find c++ OUTPUT_VARIABLE XCODE_CXX OUTPUT_STRIP_TRAILING_WHITESPACE) + set(ENV{CC} "${XCODE_CC}") + set(ENV{CXX} "${XCODE_CXX}") + set(CTEST_USE_LAUNCHERS 1) + set(RR_WARNINGS_COMMON "-Wno-format-nonliteral -Wno-cast-align -Wno-unused -Wno-unused-variable -Wno-unused-function -Wno-self-assign -Wno-unused-parameter -Wno-sign-compare") + set(RR_WARNINGS_C "${RR_WARNINGS_COMMON} -Wno-deprecated-declarations -Wno-uninitialized") + set(RR_WARNINGS_CXX "${RR_WARNINGS_COMMON} -Woverloaded-virtual -Wshadow -Wwrite-strings -Wc++11-compat") + set(RR_FLAGS_COMMON "-g -O0 -fstack-protector-all -D_FORTIFY_SOURCE=2") + set(RR_FLAGS_C "${RR_FLAGS_COMMON}") + set(RR_FLAGS_CXX "${RR_FLAGS_COMMON}") + set(ENV{CFLAGS} "${RR_WARNINGS_C} ${RR_FLAGS_C}") + set(ENV{CXXFLAGS} "${RR_WARNINGS_CXX} ${RR_FLAGS_CXX}") + endif () +endif () ################################################################### ################################################################### @@ -829,106 +853,128 @@ set(MODEL "Experimental") #set(LOCAL_NO_PACKAGE "TRUE") ##### Following controls source update ##### #set(LOCAL_UPDATE "TRUE") -set(REPOSITORY_URL "http://svn.hdfgroup.uiuc.edu/hdf5/trunk") +set(REPOSITORY_URL "https://git@bitbucket.hdfgroup.org/scm/hdffv/hdf5.git") +set(REPOSITORY_BRANCH "develop") + #uncomment to use a compressed source file: *.tar on linux or mac *.zip on windows #set(CTEST_USE_TAR_SOURCE "${CTEST_SOURCE_VERSION}") ################################################################### ################################################################### -#### Change default configuration of options in config/cmake/cacheinit.cmake file ### -#### format: set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DXXX:YY=ZZZZ") - -################################################################### -if(${STATICLIBRARIES}) +if(${STATICONLYLIBRARIES}) set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DBUILD_SHARED_LIBS:BOOL=OFF") ######### Following describes computer ############ ## following is optional to describe build ## set(SITE_BUILDNAME_SUFFIX "STATIC") -endif() +endif () +################################################################### +#### fortran #### +if(${FORTRANLIBRARIES}) + set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_FORTRAN:BOOL=ON") + ### enable Fortran 2003 depends on HDF5_BUILD_FORTRAN + set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_F2003:BOOL=ON") +else () + set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_FORTRAN:BOOL=OFF") + ### enable Fortran 2003 depends on HDF5_BUILD_FORTRAN + set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_F2003:BOOL=OFF") +endif () +#### java #### +if(${JAVALIBRARIES}) + set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_JAVA:BOOL=ON") +else () + set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_JAVA:BOOL=OFF") +endif () + +### change install prefix +set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DCMAKE_INSTALL_PREFIX:PATH=${INSTALLDIR}") +set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DCTEST_CONFIGURATION_TYPE:STRING=$ENV{CMAKE_CONFIG_TYPE}") + ################################################################### +if(WIN32) + set(BINFILEBASE "HDF5-${CTEST_SOURCE_VERSION}${CTEST_SOURCE_VERSEXT}-win${SITE_OS_BITS}") + include(${CTEST_SCRIPT_DIRECTORY}\\HDF5options.cmake) + include(${CTEST_SCRIPT_DIRECTORY}\\CTestScript.cmake) + if(EXISTS "${CTEST_BINARY_DIRECTORY}\\${BINFILEBASE}.exe") + file(COPY "${CTEST_BINARY_DIRECTORY}\\${BINFILEBASE}.exe" DESTINATION ${CTEST_SCRIPT_DIRECTORY}) + endif () + if(EXISTS "${CTEST_BINARY_DIRECTORY}\\${BINFILEBASE}.msi") + file(COPY "${CTEST_BINARY_DIRECTORY}\\${BINFILEBASE}.msi" DESTINATION ${CTEST_SCRIPT_DIRECTORY}) + endif () + if(EXISTS "${CTEST_BINARY_DIRECTORY}\\${BINFILEBASE}.zip") + file(COPY "${CTEST_BINARY_DIRECTORY}\\${BINFILEBASE}.zip" DESTINATION ${CTEST_SCRIPT_DIRECTORY}) + endif () +else () + set(BINFILEBASE "HDF5-${CTEST_SOURCE_VERSION}${CTEST_SOURCE_VERSEXT}") + include(${CTEST_SCRIPT_DIRECTORY}/HDF5options.cmake) + include(${CTEST_SCRIPT_DIRECTORY}/CTestScript.cmake) + if(APPLE) + if(EXISTS "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-Darwin.dmg") + file(COPY "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-Darwin.dmg" DESTINATION ${CTEST_SCRIPT_DIRECTORY}) + endif () + if(EXISTS "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-Darwin.tar.gz") + file(COPY "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-Darwin.tar.gz" DESTINATION ${CTEST_SCRIPT_DIRECTORY}) + endif () + if(EXISTS "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-Darwin.sh") + file(COPY "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-Darwin.sh" DESTINATION ${CTEST_SCRIPT_DIRECTORY}) + endif () + else () + if(CYGWIN) + if(EXISTS "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-CYGWIN.sh") + file(COPY "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-CYGWIN.sh" DESTINATION ${CTEST_SCRIPT_DIRECTORY}) + endif () + if(EXISTS "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-CYGWIN.tar.gz") + file(COPY "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-CYGWIN.tar.gz" DESTINATION ${CTEST_SCRIPT_DIRECTORY}) + endif () + else () + if(EXISTS "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-Linux.sh") + file(COPY "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-Linux.sh" DESTINATION ${CTEST_SCRIPT_DIRECTORY}) + endif () + if(EXISTS "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-Linux.tar.gz") + file(COPY "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-Linux.tar.gz" DESTINATION ${CTEST_SCRIPT_DIRECTORY}) + endif () + endif () + endif () +endif () + +HDF5options.cmake: +############################################################################################# +#### Change default configuration of options in config/cmake/cacheinit.cmake file ### +#### format: set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DXXX:YY=ZZZZ") ### +############################################################################################# + ### uncomment/comment and change the following lines for other configuration options +############################################################################################# #### ext libraries #### + ### ext libs from tgz set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ALLOW_EXTERNAL_SUPPORT:STRING=TGZ -DTGZPATH:PATH=${CTEST_SCRIPT_DIRECTORY}") -### ext libs from svn -#set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ALLOW_EXTERNAL_SUPPORT:STRING=SVN") +### ext libs from git +#set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ALLOW_EXTERNAL_SUPPORT:STRING=GIT") ### ext libs on system #set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DZLIB_LIBRARY:FILEPATH=some_location/lib/zlib.lib -DZLIB_INCLUDE_DIR:PATH=some_location/include") #set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DSZIP_LIBRARY:FILEPATH=some_location/lib/szlib.lib -DSZIP_INCLUDE_DIR:PATH=some_location/include") -### disable ext libs building + +### disable ext zlib building #set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_Z_LIB_SUPPORT:BOOL=OFF") +### disable ext szip building #set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_SZIP_SUPPORT:BOOL=OFF") #set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_SZIP_ENCODING:BOOL=OFF") -#### fortran #### -if(${FORTRANLIBRARIES}) - set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_FORTRAN:BOOL=ON") -else() - set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_FORTRAN:BOOL=OFF") -endif() -#### java #### -if(${JAVALIBRARIES}) - set(BUILD_OPTIONS "${BUILD_OPTIONS} -DHDF_BUILD_JAVA:BOOL=ON") -else() - set(BUILD_OPTIONS "${BUILD_OPTIONS} -DHDF_BUILD_JAVA:BOOL=OFF") -endif() +############################################################################################# ### disable test program builds + #set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DBUILD_TESTING:BOOL=OFF") +############################################################################################# ### disable packaging + #set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_NO_PACKAGES:BOOL=ON") ### Create install package with external libraries (szip, zlib, jpeg) set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_PACKAGE_EXTLIBS:BOOL=ON") -### change install prefix -set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DCMAKE_INSTALL_PREFIX:PATH=${INSTALLDIR}") - -################################################################### - -if(WIN32) - include(${CTEST_SCRIPT_DIRECTORY}\\CTestScript.cmake) - if(EXISTS "${CTEST_BINARY_DIRECTORY}\\HDF5-${CTEST_SOURCE_VERSION}${CTEST_SOURCE_VERSEXT}-win${SITE_OS_BITS}.exe") - file(COPY "${CTEST_BINARY_DIRECTORY}\\HDF5-${CTEST_SOURCE_VERSION}${CTEST_SOURCE_VERSEXT}-win${SITE_OS_BITS}.exe" DESTINATION ${CTEST_SCRIPT_DIRECTORY}) - endif() - if(EXISTS "${CTEST_BINARY_DIRECTORY}\\HDF5-${CTEST_SOURCE_VERSION}${CTEST_SOURCE_VERSEXT}-win${SITE_OS_BITS}.msi") - file(COPY "${CTEST_BINARY_DIRECTORY}\\HDF5-${CTEST_SOURCE_VERSION}${CTEST_SOURCE_VERSEXT}-win${SITE_OS_BITS}.msi" DESTINATION ${CTEST_SCRIPT_DIRECTORY}) - endif() - if(EXISTS "${CTEST_BINARY_DIRECTORY}\\HDF5-${CTEST_SOURCE_VERSION}${CTEST_SOURCE_VERSEXT}-win${SITE_OS_BITS}.zip") - file(COPY "${CTEST_BINARY_DIRECTORY}\\HDF5-${CTEST_SOURCE_VERSION}${CTEST_SOURCE_VERSEXT}-win${SITE_OS_BITS}.zip" DESTINATION ${CTEST_SCRIPT_DIRECTORY}) - endif() -else() - include(${CTEST_SCRIPT_DIRECTORY}/CTestScript.cmake) - if(APPLE) - if(EXISTS "${CTEST_BINARY_DIRECTORY}/HDF5-${CTEST_SOURCE_VERSION}${CTEST_SOURCE_VERSEXT}-Darwin.dmg") - file(COPY "${CTEST_BINARY_DIRECTORY}/HDF5-${CTEST_SOURCE_VERSION}${CTEST_SOURCE_VERSEXT}-Darwin.dmg" DESTINATION ${CTEST_SCRIPT_DIRECTORY}) - endif() - if(EXISTS "${CTEST_BINARY_DIRECTORY}/HDF5-${CTEST_SOURCE_VERSION}${CTEST_SOURCE_VERSEXT}-Darwin.tar.gz") - file(COPY "${CTEST_BINARY_DIRECTORY}/HDF5-${CTEST_SOURCE_VERSION}${CTEST_SOURCE_VERSEXT}-Darwin.tar.gz" DESTINATION ${CTEST_SCRIPT_DIRECTORY}) - endif() - if(EXISTS "${CTEST_BINARY_DIRECTORY}/HDF5-${CTEST_SOURCE_VERSION}${CTEST_SOURCE_VERSEXT}-Darwin.sh") - file(COPY "${CTEST_BINARY_DIRECTORY}/HDF5-${CTEST_SOURCE_VERSION}${CTEST_SOURCE_VERSEXT}-Darwin.sh" DESTINATION ${CTEST_SCRIPT_DIRECTORY}) - endif() - else() - if(CYGWIN) - if(EXISTS "${CTEST_BINARY_DIRECTORY}/HDF5-${CTEST_SOURCE_VERSION}${CTEST_SOURCE_VERSEXT}-CYGWIN.sh") - file(COPY "${CTEST_BINARY_DIRECTORY}/HDF5-${CTEST_SOURCE_VERSION}${CTEST_SOURCE_VERSEXT}-CYGWIN.sh" DESTINATION ${CTEST_SCRIPT_DIRECTORY}) - endif() - if(EXISTS "${CTEST_BINARY_DIRECTORY}/HDF5-${CTEST_SOURCE_VERSION}${CTEST_SOURCE_VERSEXT}-CYGWIN.tar.gz") - file(COPY "${CTEST_BINARY_DIRECTORY}/HDF5-${CTEST_SOURCE_VERSION}${CTEST_SOURCE_VERSEXT}-CYGWIN.tar.gz" DESTINATION ${CTEST_SCRIPT_DIRECTORY}) - endif() - else() - if(EXISTS "${CTEST_BINARY_DIRECTORY}/HDF5-${CTEST_SOURCE_VERSION}${CTEST_SOURCE_VERSEXT}-Linux.sh") - file(COPY "${CTEST_BINARY_DIRECTORY}/HDF5-${CTEST_SOURCE_VERSION}${CTEST_SOURCE_VERSEXT}-Linux.sh" DESTINATION ${CTEST_SCRIPT_DIRECTORY}) - endif() - if(EXISTS "${CTEST_BINARY_DIRECTORY}/HDF5-${CTEST_SOURCE_VERSION}${CTEST_SOURCE_VERSEXT}-Linux.tar.gz") - file(COPY "${CTEST_BINARY_DIRECTORY}/HDF5-${CTEST_SOURCE_VERSION}${CTEST_SOURCE_VERSEXT}-Linux.tar.gz" DESTINATION ${CTEST_SCRIPT_DIRECTORY}) - endif() - endif() - endif() -endif() - +############################################################################################# ======================================================================== For further assistance, send email to help@hdfgroup.org diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index cc77fcb..fdae007 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -4,21 +4,34 @@ HDF5 version 1.9.236 currently under development INTRODUCTION -This document describes the differences between HDF5-1.9.0 and -HDF5 1.9.x snapshot, and contains information on the platforms -tested and known problems in HDF5-1.9.x. +This document describes the differences between HDF5-1.10.0-patch1 and +HDF5 1.10.1, and contains information on the platforms tested and known problems in HDF5-1.10.1. For more details check the HISTORY*.txt files in the HDF5 source. -Links to HDF5 1.9.x source code can be found on The HDF Group's -development FTP server at the following location: - ftp://ftp.hdfgroup.uiuc.edu/pub/outgoing/hdf5/snapshots +Links to HDF5 1.10.1 source code, documentation, and additional materials can be found on The HDF5 web page at: + + https://support.hdfgroup.org/HDF5/ + +The HDF5 1.10.1 release can be obtained from: + + https://support.hdfgroup.org/HDF5/release/obtain5110.html + User documentation for the snapshot can be accessed directly at this location: - http://www.hdfgroup.uiuc.edu/HDF5/doc_dev_snapshot/H5_dev/ -For more information, see the HDF5 home page: + https://support.hdfgroup.org/HDF5/doc1.10/ + +New features in the HDF5-1.10.x release series, including brief general +descriptions of some new and modified APIs, are described in the "What's New +in 1.10.1?" document: + + https://support.hdfgroup.org/HDF5/doc/ADGuide/WhatsNew1101.html + +All new and modified APIs are listed in detail in the "HDF5 Software Changes +from Release to Release" document, in the section "Release 1.8.19 (current +release) versus Release 1.10.1 - http://www.hdfgroup.org/HDF5/ + https://support.hdfgroup.org/HDF5/doc1.10/ADGuide/Changes.html If you have any questions or comments, please send them to the HDF Help Desk: @@ -29,7 +42,7 @@ CONTENTS - New Features - Support for new platforms and languages -- Bug Fixes since HDF5-1.8.0 +- Bug Fixes since HDF5-1.10.0-patch1 - Supported Platforms - Tested Configuration Features Summary - More Tested Platforms @@ -41,1196 +54,77 @@ New Features Configuration: ------------- - - CMake - Added NAMESPACE hdf5:: to package configuration files - - CMake: change CTEST_BUILD_CONFIGURATION to CTEST_CONFIGURATION_TYPE, which is - recommended by CMake documentation. - HDFFV-9971 (ADB 2016/8/22) - - Java JNI library API wrappers and supporting files added as HDF_JAVA language - option. Both configure and CMake disable this option by default. - HDFFV-9552 (ADB 2016/02/28) - - CMake minimum is now 3.1.0. (ADB 2015/11/14) - - cmakehdf5: configure options added to enable or disable the building of - different API's and testings. See "cmakehdf5 --help" for details. - (AKC - 2014/12/09 HDFFV-8932) - - Autotools: Automake updated to 1.14.1 (ADB - 2014/04/08) - - CMake: Moved minimum CMake version to 2.8.11 which enables better library - include processing. (ADB - 2014/03/26) - - New configuration option added to change the default plugin path. - configure option is --with-default-plugin=location - cmake option is -DH5_DEFAULT_PLUGINDIR:PATH=location - HDFFV-8513. (ADB 2013/09/04) - - Rename FFLAGS to FCFLAGS in configure (ADB 2013/08/13) - - CMake minimum is now 2.8.10. (ADB 2013/01/14) - - A new tool, cmakehdf5, which is a build command script similar to - buildhdf5 is added and is available in the bin directory. - (AKC - 2012/12/12) - - Fixed AIX Fortran compiler flags to use appropriate settings for - debugging, profiling, optimization situations. HDFFV-8069. (AKC - 2012/09/27) - - Updated to latest autotools and changed all hard *.sh scripts to - configure managed *.sh.in files. Removed overloading of autotools - TESTS variable by examples and tests. Renamed configure.in to - configure.ac. (ADB - 2012/08/23 - HDFFV-8129) - - Added code to display the version information of XL fortran and C++ - in the summary of configure. (AKC - 2012/02/28 - HDFFV-7793) - - Configure now generates Makefiles that build in "silent make mode" - by default in which compile and link lines are significantly - simplified for clarity. To override this and view actual compile and - link lines during building, the --disable-silent-rules flag can be used - at configure time, or the 'make' command can be followed by V=1, to - indicate a "verbose" make. (MAM - 2011/4/14). - - Added mpicc and mpif90 as the default C and Fortran compilers for Linux - systems when --enable-parallel is specified but no $CC or $FC is defined. - (AKC - 2011/2/7) - - Added a new configure option, "--enable-unsupported", which can - be used to stop configure from preventing the use of unsupported - configure option combinations, such as c++ in parallel or parallel - HDF5 with threadsafe. Use at your own risk, as it may result in a - library that won't compile or run as expected! - (MAM - 2010/11/17 - Bug 2061) - - PHDF5 changed to use "mpiexec", instead of mpirun, as the default MPI - applications startup command as defined in the MPI-2 definition, section - 4.1. (AKC - 2010/6/11 - Bug 1921) - - Configure now adds appropriate defines for supporting large (64-bit) - files on all systems, where supported, by default, instead of only linux. - This largefile support is controllable with the --enable-largefile - configure option. This is replacing the linux-specific --enable-linux-lfs - option, which has been removed from configure. - (MAM - 2010/05/05 - 1772/1434) - - Upgraded versions of autotools used to generate configuration suite. - We now use Automake 1.11.1, Autoconf 2.65, and Libtool 2.2.6b. - MAM 2010/04/15. - - Added the xlc-* and mpcc_r-* BASENAME patterns to be recognized as IBM - compilers so that the ibm compiler options can be added properly. This - allows non-system-default compiler command names (e.g. xlc-m.n.k.l) be - recognized. AKC 2009/11/26. - - Configuration suite now uses Automake 1.11 and Autoconf 2.64. - MAM 2009/08/11. - - Changed default Gnu fortran compiler from g95 to gfortran since - gfortran is more likely installed with gcc now. -AKC 2009/07/19- - - Added libtool version numbers to generated c++, fortran, and - hl libraries. MAM 2009/04/19. - - Regenerated Makefile.ins using Automake 1.10.2. MAM 2009/04/19. - - Added a Make target of check-all-install to test the correctness of - installing via the prefix= or $DESTDIR options. AKC - 2009/04/14 - - Configuration suite now uses Libtool 2.2.6a. MAM 2008/10/24 - - - Configuration suite now uses Autoconf 2.61, Automake 1.10.1. - MAM 2008/05/05. - - - The new configure option "--disable-sharedlib-rpath" disables - embedding the '-Wl,-rpath' information into executables when - shared libraries are produced, and instead solely relies on the - information in LD_LIBRARY_PATH. (MAM - 2008/05/15) + - CMake minimum is now 3.2.2. (ADB 2016/01/10) + Library: -------- - - Java API added new H5Iget_name that returns a string. - The old function, now deprecated, would cause a memory leak and - not return a proper String value. - HDFFV-9972 (ADB 2016/8/22) - - Add support to expand the plugin path value on Windows when the path - includes an environment variable. - HDFFV-9706 (ADB 2016/8/22) - - - H5F_ACC_DEBUG labeled "deprecated" - - The symbol was originally used to emit some extra debugging - informationi in the multi VFD. The underlying functionality - was removed due to disuse in HDF5 1.8.16 though the symbol - remained defined since it was visible in H5Fpublic.h. - - In this release, the symbol has been labeled deprecated and will - not be defined when H5_NO_DEPRECATED_SYMBOLS is defined. - - (DER - 2015-04-30, HDFFV-1074) - - - The library can load filter libraries dynamically during runtime. Users - can set the search path through environment variable HDF5_PLUGIN_PATH - and call H5Pset_filter to enable a dynamic filter. (SLU - 2013/04/08) - - Added new API functions H5Dscatter and H5Dgather to scatter data to and - and gather data from a selection within a memory buffer. - (NAF - 2013/02/05) - - The library now supports the data conversion from enumeration to numeric - (integer and floating-point number) datatypes. See Issue 8221. - (SLU - 2012/10/23) - - The data sieve buffer size was for all the datasets in the file. It - could waste memory if any dataset size is smaller than the sieve buffer - size. Now the library picks the smaller one between the dataset size - and the sieve buffer size from the file access property. See Issue 7934. - (SLU - 2012/4/2) - - I added a new parameter of object access property list to the function - H5Rdereference (Issue 2763). It's called H5Rdereference2 now. The former - H5Rdereference function has been deprecated to H5Rdereference1. (SLU - - 2011/7/18) - - H5Tcreate now supports string type (fixed-length and variable-length). - (SLU - 2011/05/20) - - Added ability to cache files opened through external links. Added new - public functions H5Pset_elink_file_cache_size(), - H5Pget_elink_file_cache_size(), and H5Fclear_elink_file_cache(). - (NAF - 2011/02/17) - - Removed all old code for Metraowerks compilers, bracketed by - __MWERKS__). Metraowerks compiler is long gone. (AKC - 2010/11/17) - - Added support for threadsafety on windows using the windows threads - library. Use the HDF5_ENABLE_THREADSAFE option in CMake while on a - windows platform to enable this functionality. This is supported on - Windows Vista and newer Windows operating systems. (MAM - 2010/09/10) - - When a mandatory filter failed to write data chunks, the dataset - couldn't close (bug 1260). The fix releases all resources and closes - the dataset but returns a failure. (SLU - 2010/9/8) - - H5Tset_order and H5Tget_order now support all data types. A new byte - order H5T_ORDER_MIXED has been added specifically for compound datatype - and its derived type. Please see bug #1934. (SLU - 2010/8/23) - - Improved performance of the chunk cache by avoiding unnecessary b-tree - lookups of chunks already in cache. (NAF - 2010/06/15) - - Greatly improved performance of extending a dataset with early - allocation. (NAF - 2010/03/24 - 1637) - - Added support for filtering densely stored groups. Many of the API - functions related to filters have been extended to support dense groups - as well as datasets. Pipeline messages can now be stored in a group's - object header. (NAF/QAK - 2009/10/8) - - The embedded library information is displayed by H5check_version() if a - version mismatch is detected. Also changed H5check_version() to - suppress the warning message totally if $HDF5_DISABLE_VERSION_CHECK is 2 - or higher. (Old behavior treated 3 or higher the same as 1, that is - print a warning and allows the program to continue. (AKC - 2009/9/28) - - If a user does not care for the extra library information insert - in the executables, he may turn it off by --disable-embedded-libinfo - during configure. (AKC - 2009/9/15) - - Corrected problem where library would re-write the superblock in a file - opened for R/W access, even when no changes were made to the file. - (QAK - 2009/08/20, Bz#1473) - - Separated "factory" free list class from block free lists. These free - lists are dynamically created and manage blocks of a fixed size. - H5set_free_list_limits() will use the same settings specified for block - free lists for factory free lists. (NAF - 2009/04/08) - - Added support for dense attributes to H5Ocopy. (XCao/NAF - 2009/01/29) - - Added H5Pset_elink_cb and H5Pget_elink_cb functions to support a - user-defined callback function for external link traversal. - (NAF - 2009/01/08) - - Added H5Pset_elink_acc_flags and H5Pget_elink_acc_flags functions to - allow the user to specify the file access flags used to open the target - file of an external link. (NAF - 2009/01/08) - - Added H5Pset_chunk_cache() and H5Pget_chunk_cache() functions to allow - individual rdcc configuration for each dataset. Added - H5Dget_access_plist() function to retrieve a dataset access property - list from a dataset. (NAF - 2008/11/12) - - Added H5Iis_valid() function to check if an id is valid without producing - an error message. (NAF - 2008/11/5) - - Added two new public routines: H5Pget_elink_fapl() and - H5Pset_elink_fapl(). (see bug #1247) (VC - 2008/10/13) - - Improved free space tracking in file to be faster. (QAK - 2008/10/06) - - Added 'mounted' field to H5G_info_t struct. (QAK - 2008/07/15) + - Parallel Library: ----------------- - - Add H5Pget_mpio_no_collective_cause() function that retrive reasons - why the collective I/O was broken during read/write IO access. - (JKM - 2012/08/30 HDFFV-8143) - - Special Collective IO (IO when some processes do not contribute to the - IO) and Complex Derived Datatype MPI functionalities are no longer - conditionally enabled in the library by configure. They are always - enabled in order to take advantage of performance boosts from these - behaviors. Older MPI implementations that do not allow for these - functionalities can no longer by used by HDF5. (MAM - 2011/07/08). - - Modified parallel tests to run with arbitrary number of processes. The - modified tests are testphdf5 (parallel dataset access), t_chunk_alloc - (chunk allocation), and t_posix_compliant (posix compliance). The rest of - the parallel tests already use in the code the number of processes - available in the communicator. (CMC - 2009/04/28) + - Fortran Library: ---------------- - - - Added parallel routine H5Pget_mpio_actual_io_mode_f (MSB - 2012/09/27) - - - Added for the C API the Fortran wrapper: - h5ocopy_f (MSB - 2012/03/22) - - - HDF5 Fortran library was enhanced to support Fortran 2003 standard. - The following features are available when the HDF5 library is configured - using --enable-fortran --enable-fortran2003 configure flags AND - if fortran compiler is Fortran2003 compliant: - - - Subroutines overloaded with the C_PTR derived type: - h5pget_f - h5pget_fill_value_f - h5pinsert_f - h5pregister_f - h5pset_f - h5pset_fill_value_f - h5rcreate_f - h5rderefrence_f - h5rget_name_f - h5rget_obj_type_f - - Subroutines overloaded with the C_PTR derived type - and simplified signatures: - h5aread_f - h5awrite_f - h5dread_f - h5dwrite_f - - New subroutines - h5dvlen_reclaim_f - h5literate_by_name_f - h5literate_f - h5ovisit_f - h5tconvert_f - - - Subroutines with additional optional parameters: - h5pcreate_class_f - (EIP - 2011/10/14) - - - Added for the C APIs the Fortran wrappers: - h5dget_access_plist_f - h5iis_valid_f - h5pset_chunk_cache_f - h5pget_chunk_cache_f - (MSB - 2009/04/17) - - + - C++ Library: ------------ - - New member function added - - The assignment operator ArrayType::operator= is added because ArrayType - has pointer data members. - - (BMR, 2016/03/07, HDFFV-9562) - - - New member functions - + Overloaded CommonFG::getObjnameByIdx to take char* for name - + Overloaded CommonFG::getObjTypeByIdx to return type name as a char*. - (BMR - 2010/05/02) - + DataSet::getInMemDataSize() to simplify getting the dataset's - data size in memory. (BMR - 2009/07/26) - - These member functions were added as wrapper for H5Rdereference to - replace the incorrect IdComponent::dereference(). - void H5Object::dereference(H5File& h5file, void* ref) - void H5Object::dereference(H5Object& obj, void* ref) - In addition, these constructors were added to create the associated - objects by way of dereference: - Attribute(H5Object& obj, void* ref); - Attribute(H5File& file, void* ref); - DataSet(H5Object& obj, void* ref); - DataSet(H5File& file, void* ref); - DataType(H5Object& obj, void* ref); - DataType(H5File& file, void* ref); - Group(H5Object& obj, void* ref); - Group(H5File& obj, void* ref); - (BMR - 2008/08/10) - - + - Tools: ------ - - h5repack: Added ability to use plugin filters. HDFFV-8345 (ADB - 2013/09/04). - - h5dump: Added option -N --any_path, which searches the file for paths that - match the search path. HDFFV-7989 (ADB - 2013/08/12). - - h5dump: Added optional arg 0 to -A, which excludes attributes from display. - HDFFV-8134 (ADB - 2013/08/01). - - h5dump: Fixed displaying compression ratio for unknown or user-defined - filters. HDFFV-8344 (XCAO 2013/03/19) - - h5dump: Changed UNKNOWN_FILTER to USER_DEFINED_FILTER for user defined filter. - HDFFV-8346 (XCAO 2013/03/19) - - h5dump: Added capability for "-a" option to show attributes containing "/" - by using an escape character. For example, for a dataset "/dset" - containing attribute "speed(m/h)", use "h5dump -a "/dset/speed(\/h)" - to show the content of the attribute. See details at HDFFV-7523 - (PC -- 2012/03/12) - - h5dump: Added ability to apply command options across multiple files using a - wildcard in the filename. Example; "h5dump -H -d Dataset1 tarr*.h5". - HDFFV-7876 (ADB - 2012/03/12). - - h5repack: Improved performance for big chunked datasets (size > 128MB) - when used with layout (-l) or compression (-f) option. - It would perform much better prior to the improvement, - especially for cases that chunk dimentions looks like - "1024x5x1" (compare to "1x5x1024"). When bigger numbers - are toward front and smaller number is toward back in chunk - dimentions. HDFFV-7862 (JKM - 2012/03/01) - - h5dump: Added new option --no-compact-subset. This option will not - interpret the '[' character as starting the compact form of - subsetting. This is useful when the "h5dump error: unable to - open dataset "datset_name"" message is output because a dataset - name contains a '[' character. HDFFV-7689 (ADB - 2012/01/31) - - h5dump: Corrected schema location: - - (ADB - 2011/08/10) - - h5diff: Added new level for -v (verbose) option. The new levels are - 1 and 2. So -v1 and -v2 can be specified to view more - information about attributes differences. - Bug#2121 (JKM 2011/3/23) - - h5dump: Added new option --enable-error-stack. This option will display - error stack information in the output stream. This is useful - when the "h5dump: Unable to print data" message is output. - (ADB - 2011/02/24) - - h5diff: Add a new flag --exclude-path. Specified path to an object will - be excluded from comparing the two files or two groups. If group - is specified all the member objects will be excluded. - (JKM - 2010/09/16). - - h5ls: Add new flag --no-dangling-links. (refer to --help for details) - (JKM - 2010/06/15) - - h5ls: Add new flag --follow-symlinks. (refer to --help for details) - (JKM - 2010/05/25) - - h5diff: Add new flag --no-dangling-links. (refer to --help for details) - (JKM - 2010/02/10) - - h5diff: Add new flag --follow-symlinks. (refer to --help for details) - (JKM - 2010/01/25) - - h5diff: fix for displaying garbage value on LE machine for BE data. - (JKM - 2009/11/20) - - h5dump: subsetting now allows default for count. Also trailing ; in short form - can be omitted after last specified value. - (ADB - 2009/09/04) - - h5dump/h5ls: now can display data in region references - using new -R, --region flag. - (ADB - 2009/09/04) - - h5diff: new flag, -c, --compare, list objects that are not comparable. - (PVN - 2009/4/10 - 1368) - - h5diff new flag, -N, --nan, avoids NaNs detection. (PVN - 2009/4/10) - - h5dump correctly specifies XML dtd / schema urls (ADB - 2009/4/3 - 1519) - - h5repack now handles group creation order. (PVN - 2009/4/2 - 1402) - - h5dump: added a printing of the compression ratio of uncompressed and compressed - sizes for cases where compression filters are present. (PVN - 2008/05/01) - - h5dump: added an option to allow a user defined formatting string for printf - regarding floating point numbers. (PVN - 2008/05/06) - - h5dump: support for external links, display the object that the external link - points to. (PVN - 2008/05/12) - - h5repack: add a userblock to an HDF5 file during the repack. (PVN - 2008/08/26) - - h5repack: add 2 options that call H5Pset_alignment in the repacked file. (PVN - 2008/08/29) - - h5ls: added capability to traverse through external links when the -r - (recursive) flag is given. (NAF - 2008/09/16) - - h5ls: added -E option to enable traversal of external links. h5ls will - not traverse external links without this flag being set. - (NAF - 2008/10/06) - - h5diff: added support for long double (PVN - 2008/10/28) - - h5dump: binary output defaults to NATIVE with -b optionally accepting - the form of binary output (NATIVE, FILE, BE, LE). (PVN - 2008/10/30) - - h5diff: return 1 for file differences when both file graphs differ by any object. - Error return code was changed to 2 from -1. (PVN - 2008/10/30) - - h5import: TEXTFPE (scientific format) was deprecated. Use TEXTFP - instead (PVN - 2008/10/30) - - h5repack: When user doesn't specify a chunk size, h5repack now defines a default - chunk size as the same size of the size of the hyperslab used to read the chunks. - The size of the hyperslabs are defined as the size of each dimension or a - predefined constant, whatever is smaller. This assures that the chunk - read fits in the chunk cache. (PVN - 2008/11/21) - - h5diff: h5diff treats two INFINITY values different. Fixed by checking (value==expect) - before call ABS(...) at h5diff_array.c This will make that (INF==INF) is true - (INF is treated as an number instead of NaN) (PC -- 2009/07/28) - - h5diff: add option "--use-system-epsilon" to print difference if (|a-b| > EPSILON) - Change default to use strict equality (PC -- 2009/09/12) - + - High-Level APIs: --------------- - C Packet Table API - ------------------ - - Replacement of a public function - - The existing function H5PTcreate_fl limits applications to deflate - compression only. The public function H5PTcreate is added to replace - H5PTcreate_fl. H5PTcreate takes a property list ID to provide - flexibility on creation properties. - - hid_t H5PTcreate(hid_t loc_id, const char *dset_name, - hid_t dtype_id, hsize_t chunk_size, hid_t plist_id); - (BMR, 2016/03/04, HDFFV-8623) - - - New public functions - - Two accessor functions were added per HDFFV-8623/patch 003. - /* Returns the ID of the dataset associated with the packet table */ - hid_t H5PTget_dataset(hid_t table_id); - - /* Returns the ID of the datatype the packet table uses */ - hid_t H5PTget_type(hid_t table_id); - (BMR, 2016/03/04, HDFFV-8623) - - - Regarding #ifdef VLPT_REMOVED - - The #ifdef VLPT_REMOVED blocks are removed from the PT library source - except the following cases: - + H5PTis_varlen() is made available again. - + H5PTfree_vlen_readbuff() now became H5PTfree_vlen_buff() - (BMR, 2016/03/04, HDFFV-442) - - C++ Packet Table API - -------------------- - - New constructor - - An overloaded constructor is added to FL_PacketTable and takes a property - list ID to provide flexibility on creation properties. - - FL_PacketTable(hid_t fileID, hid_t plist_id, const char* name, hid_t dtypeID, hsize_t chunkSize); - (BMR, 2016/03/08, HDFFV-8623) - - - New public functions - - Two accessor wrappers to class PacketTable, per HDFFV-8623/patch 004. - /* Returns the ID of the dataset associated with the packet table */ - hid_t PacketTable::GetDataset() - - /* Returns the ID of the datatype the packet table uses */ - hid_t PacketTable::GetDataset() - (BMR, 2016/03/04, HDFFV-8623) - - - Member functions having "char*" as an argument - - Overloaded functions were added to provide "const char*" argument, the - existing version will be deprecated. - (BMR, 2016/03/04) - - - Regarding #ifdef VLPT_REMOVED - - The #ifdef VLPT_REMOVED blocks are removed from the PT library source - except the following cases: - + VL_PacketTable::IsVariableLength() is moved to PacketTable - + VL_PacketTable::FreeReadBuff() now became PacketTable::FreeBuff() - - (BMR, 2016/03/04, HDFFV-442) - - - Internal header file - -------------------- - - A new API function H5DOwrite_chunk. It writes a data chunk directly - into a file bypassing hyperslab selection, data conversion, and - filter pipeline. The user must be careful with the function and - clearly understand the I/O process of the library. - (SLU - 2013/2/11) - - New API: h5ltpath_valid (Fortran: h5ltpath_valid_f) which checks - if a path is correct and determines if a link resolves to a valid - object and checks that the link does not dangle. (MSB- 2012/3/15) - - - Added Fortran wrappers for Dimension Scale APIs. HDFFV-3797 - h5dsset_scale_f - h5dsattach_scale_f - h5dsdetach_scale_f - h5dsis_attached_f - h5dsis_scale_f - h5dsset_label_f - h5dsget_label_f - h5dsget_scale_name_f - h5dsget_num_scales_f - (EIP for SB - 2011/10/13) - - - Table: In version 3.0 of Table, "NROWS" (used to store number of records) was - deprecated (PVN - 2008/11/24) + C Packet Table API + ------------------ + - + Internal header file + -------------------- + - + Documentation ------------- Support for new platforms, languages and compilers. ======================================= - - Intel V11.1 uses now -O3 optimization in production mode (EIP - 2010/10/08) - - PathScale compilers are recognized and can build the HDF5 library - properly. AKC - 2009/7/28 - - - SunOS 5.11 (emu) 32-bit and 64-bit with Sun C/C++ 5.12 compiler and - Sun Fortran 95 8.6 compiler. (SLU - 2013/04/15) + - -Bug Fixes since HDF5-1.8.0 release +Bug Fixes since HDF5-1.10.0-patch1 release ================================== Library ------- - - Fixed a memory bug that could occur when a message was improperly marked - as sharable on disk. - - (NAF, 2016/07/01, HDFFV-9950) - - - Incorrect usage of list in CMake COMPILE_DEFINITIONS set_property - - The CMake command, set_property with COMPILE_DEFINITIONS property - needs a quoted semi-colon separated list of values. CMake will - transform the list to a series of -D{value} for the compile. - - (ADB - 2014/12/09, HDFV-9041) - - - H5Z.c: H5Zfilter_avail(H5Z_filter_t id) - Added else block if the call to the internal H5Z_filter_avail(id) does not - fail and returns FALSE. This block calls the H5PL_load(H5PL_TYPE_FILTER, (int)id) - function to attempt to dynamically load the filter plugin. - (ADB - 2014/03/03 HDFFV-8629) - - Added const qualifier to source buffer parameters in H5Dgather and - H5D_scatter_func_t (H5Dscatter callback). (NAF - 2013/7/02) - - Fixed an error involving failure to write fill values to the user's - buffer when reading unallocated chunks from datasets that have a - fill value set to H5D_FILL_VALUE_DEFAULT. A consequence of this - was the reporting of spurious data values in h5dump and h5diff - output. - (HDFFV-8247; JP - 2013/05/03) - - Fixed an error that could occur when calling H5Ocopy within an - H5Literate callback (and possibly other situations). - (NAF - 2012/7/25 - HDFFV-5853) - - Fixed an error that would occur when copying an object with attribute - creation order tracked and indexed. (NAF - 2012/3/28 - HDFFV-7762) - - Fixed a bug in H5Ocopy(): When copying an opened object, call the - object's flush class action to ensure that cached data is flushed - so that H5Ocopy will get the correct data. - (VC - 2012/3/27 - HDFFV-7853) - - When an application tries to write or read many small data chunks and - runs out of memory, the library had a seg fault. The fix is to - return the error stack with proper information. (SLU - 2012/3/23. - Issue 7785) - - H5Pset_data_transform had seg fault in some cases like x*-100. It - works correctly now and handles other cases like 100-x or 2/x. - (SLU - 2012/3/15. Issue 7922) - - Fixed rare corruption bugs that could occur when using the new object - header format. (NAF - 2012/3/15 - HDFFV-7879) - - Creating a dataset in a read-only file caused seg fault when the file - is closed. It's fixed. The attemp to create a dataset will fail - with the error stack indicating the file is read-only. (SLU - - 2012/1/25. Issue 7756) - - Fixed a seg fault that could occur when shrinking a dataset with chunks - larger than 1 MB. (NAF - 2011/11/30 - HDFFV-7833) - - Fixed a bug that could cause file corruption when copying named - datatypes to a file using shared messages. (NAF - 2011/11/14) - - Fixed a bug that could cause H5Oget_info to return the wrong address - after copying a named datatype. (NAF - 2011/11/14) - - The library allowed the conversion of strings between ASCII and UTF8 - (Issue 7582). We have corrected it to report an error under this - situation. (SLU - 2011/11/8) - - The library had seg fault when it tried to shrink the size of compound type - through H5Tset_size immediately after the type was created (Issue - 7618). It's fixed now. (SLU - 2011/10/26) - - Fixed a bug that occurred when using H5Ocopy on a committed datatype - containing an attribute using that committed datatype. - (NAF - 2011/10/13 - Issue 5854) - - #ifdef _WIN32 instances changed to #ifdef H5_HAVE_WIN32_API and added - H5_HAVE_VISUAL_STUDIO checks where necessary. CMake only as configure - never set _WIN32. - - CLANG compiler with the options -fcatch-undefined-behavior and -ftrapv - discovered 3 problems in tests and tools' library (Issue 7674): - 1. In dsets.c, left shifting an unsigned int for 32 bits or more - caused undefined behavior. - 2. In dt_arith.c, the INIT_INTEGER macro definition has an overflow - when the value is negative minimal and is being subtracted one. - 3. In tools/lib/h5tools_str.c, right shifting an int value for 32 bits - or more caused undefined behavior. - All the problems have been corrected. (SLU - 2011/9/2) - - In v1.6 library, there was EOA for the whole MULTI file saved in the - super block. We took it out in v1.8 library because it's meaningless - for the MULTI file. v1.8 library saves the EOA for the metadata file, - instead. But this caused some backward compatibility problem. - v1.8 library couldn't open the file created with v1.6 library. We - fixed the problem by checking the EOA value to detect the file - created with v1.6 library. (SLU - 2011/6/22) - - When a dataset had filters and reading data failed, the error message - didn't say which filter isn't registered. It's fixed now. - (SLU - 2011/6/3) - - The datatype handler created with H5Tencode/decode used to have the - reference count 0 (zero). I have fixed it. It is 1 (one) now. - (SLU - 2011/2/18) - - Fixed a bug that caused big endian machines to generate corrupt files - when using the scale-offset filter with floating point data or - fill values. Note that such datasets will no longer be readable - by any machine after this patch. (NAF - 2010/02/02 - Bug 2131) - - Retrieving a link's name by index in the case where the link is - external and the file that the link refers to doesn't exist will - now fail gracefully rather than cause a segmentation fault. - (MAM - 2010/11/17) - - Modified library to always cache symbol table information. Libraries - version 1.6.3 have a bug which causes them to require this - information for some operations. (NAF - 2010/09/21 - 1864) - - Fixed a bug that could occur when getting information for a new-style - group that was previously opened through a file handle that was - later closed. (NAF - 2010/09/15) - - Added define check in H5public.h if stdint.h is supported by the C++ - compiler. This define is only available on Windows with VS2010 and - using CMake to build the library. (ADB - 2010/09/13 - Bug 1938) - - H5Eset_current_stack now also closes the error stack to be set as the - default. This is to avoid a potential problem (Bug 1799). - (SLU - 2010/9/7) - - Fixed the bug in the filter's public CAN_APPLY function. The return - value should be htri_t not herr_t (Bug #1239). (SLU - 2010/8/5) - - Fixed a bug in the direct I/O driver that could render files with - certain kinds of unaligned data unreadable or corrupt them. - (NAF - 2010/07/28) - - valgrind reported an error of copying data to itself when a new attribute - is written (Bug #1956). I fixed it by taking out the memcpy step in - the attribute code. (SLU - 2010/07/28) - - Fixed a bug that could cause file corruption when using non-default - sizes of addresses and/or lengths. This bug could also cause - uncorrupted files with this property to be unreadable. This bug - was introduced in 1.8.5. (NAF - 2010/07/16 - 1951) - - Fixed a file corruption bug that could happen when shrinking a - compressed dataset. (NAF - 2010/05/20) - - Fixed some memory leaks in VL datatype conversion when strings are - used as fill values. (MAM - 2010/05/12 - BZ# 1826) - - Fixed a bug when copying objects with NULL references with the - H5O_COPY_EXPAND_REFERENCE_FLAG flag set. (NAF - 2010/04/08 - 1815) - - Files can now be concurrently opened more than once using the core file - driver, as long as the backing store is used. (NAF - 2010/03/09) - - Added support for H5O_COPY_EXPAND_EXT_LINK_FLAG to H5Ocopy. External - links will now be expanded if this flag is set. - (NAF - 2010/03/05 - 1733) - - Fixed a bug where the library, when traversing an external link, would - reopen the source file if nothing else worked. (NAF - 2010/03/05) - - Fixed an intermittent bug in the b-tree code which could be triggered - by expanding and shrinking chunked datasets in certain ways. - (NAF - 2010/02/16) - - H5Tdetect_class said a VL string is a string type. But when it's - in a compound type, it said it's a VL type (Bug #1584). I fixed it - to be consistent. It always return string type. (SLU - 2009/12/10) - - Fixed a bug where writing and deleting many global heap objects (i.e. - variable length data) would render the file unreadable. Previously - created files exhibiting this problem should now be readable. - (NAF - 2009/10/27 - 1483) - - Fixed incorrect return value for H5Pget_preserve. (AKC - 2009/10/08 - 1628) - - Fixed an assertion failure that occurred when H5Ocopy was called on a - dataset using a vlen inside a compound. (NAF - 2009/10/02 - 1597) - - Fixed incorrect return value for H5Pget_filter_by_id1/2 in H5Ppublic.h. - (NAF - 2009/09/25 - 1620) - - Fixed a bug where properties weren't being compared with the registered - compare callback. (NAF - 2009/09/25 - 1555) - - Fixed a bug where H5Pget_fitler_by_id would succeed when called for a - filter that wasn't present. (NAF - 2009/06/25 - 1250) - - Fixed an issue with committed compound datatypes containing a vlen. - Also fixed memory leaks involving committed datatypes. - (NAF - 2009/06/10 - 1593) - - Added versioning to H5Z_class_t struct to allow compatibility with 1.6 - API. (NAF - 2009/04/20 - 1533) - - Fixed a problem with using data transforms with non-native types in the - file. (NAF - 2009/04/20 - 1548) - - Added direct.h include file to windows section of H5private.h - to fix _getcwd() warning. (ADB - 2009/04/14 - 1536) - - Fixed a bug that prevented external links from working after calling - H5close(). (NAF - 2009/04/10 - 1539) - - Modified library to write cached symbol table information to the - superblock, to allow library versions 1.3.0 to 1.6.3 to read files - created by this version. (NAF - 2009/04/08 - 1423) - - Changed skip lists to use a deterministic algorithm. The library should - now never call rand() or srand(). (NAF - 2009/04/08 - 503) - - Fixed a bug where H5Lcopy and H5Lmove wouldn't create intermediate - groups when that property was set. (NAF - 2009/04/07 - 1526) - - Fixed a bug that caused files with a user block to grow by the size of - the user block every time they were opened. - (NAF - 2009/03/26 - 1499) - - Fixed a rare problem that could occur with files using the old (pre 1.4) - array datatype. (NAF - 2009/03/23) - - Modified library to be able to open files with corrupt root group symbol - table messages, and correct these errors if they are found. Such - files can only be successfully opened with write access. - (NAF - 2009/03/23 - 1189) - - Removed the long_long #define and replaced all instances with - "long long". This caused problems with third party products. All - currently supported compliers support the type. (ADB - 2009/03/05) - - Fixed various bugs that could prevent the fill value from being written - in certain rare cases. (NAF - 2009/02/26 - 1469) - - Fixed a bug that prevented more than one dataset chunk from being cached - at a time. (NAF - 2009/02/12 - 1015) - - Fixed an assertion failure caused by opening an attribute multiple times - through multiple file handles. (NAF - 2009/02/12 - 1420) - - Fixed a problem that could prevent the user from adding attributes (or - any object header message) in some circumstances. - (NAF - 2009/02/12 - 1427) - - Fixed a bug that could cause problems when an attribute was added to a - committed datatype using the committed datatype's datatype. - (NAF - 2009/02/12) - - Fixed a bug that could cause problems when copying an object with a - shared message in its own object header. (NAF - 2009/01/29) - - Changed H5Tset_order to properly reject H5T_ORDER_NONE for most - datatypes. (NAF - 2009/01/27 - 1443) - - Fixed a bug where H5Tpack wouldn't remove trailing space from an - otherwise packed compound type. (NAF - 2009/01/14) - - Fixed up some old v2 btree assertions that get run in debug mode that - were previously failing on compilation, and removed some of the - more heavily outdated and non-rewritable ones. (MAM - 2008/12/15) - - Fixed a bug that could cause problems when "automatically" unmounting - multiple files. (NAF - 2008/11/17) - - H5Ovisit and H5Ovisit_by_name will now properly terminate when the - callback function returns a positive value on the starting object. - (NAF - 2008/11/03) - - Fixed an error where a null message could be created that was larger - than could be written to the file. (NAF - 2008/10/23) - - Corrected error with family/split/multi VFD not updating driver info - when "latest" version of the file format used. (QAK - 2008/10/14) - - Corrected alignment+threshold errors to work correctly when metadata - aggregation is enabled. (QAK - 2008/10/06) - - Changed H5Fget_obj_count and H5Fget_obj_ids to ignore objects registered - by the library for internal library use. (NAF - 2008/10/06) - - Fixed potential memory leak during compound conversion. - (NAF - 2008/10/06) - - Changed the return value of H5Fget_obj_count from INT to SSIZE_T. Also - changed the return value of H5Fget_obj_ids from HERR_T to SSIZE_T and - the type of the parameter MAX_OBJS from INT to SIZE_T. (SLU - 2008/09/26) - - Fixed an issue that could cause data to be improperly overwritten - during compound type conversion. (NAF - 2008/09/19) - - Fixed pointer alignment violations that could occur during vlen - conversion. (NAF - 2008/09/16) - - Fixed problem where library could cause a segmentation fault when - an invalid location ID was given to H5Giterate(). (QAK - 2008/08/19) - - Fixed improper shutdown when objects have reference count > 1. The - library now tracks reference count due to the application separately - from that due to internal library routines. (NAF - 2008/08/19) - - Fixed assertion failure caused by incorrect array datatype version. - (NAF - 2008/08/08) - - Fixed an issue where mount point traversal would fail when using - multiple handles for the child. (NAF - 2008/08/07) - - Fixed an issue where mount points were inaccessible when using multiple - file handles for the parent. The mount table is now in the shared - file structure (the parent pointer is still in the top structure). - (NAF - 2008/08/07) - - when an attribute was opened twice and data was written with one of the handles, - the file didn't have the data. It happened because each handle had its own - object structure, and the empty one overwrote the data with fill value. This is - fixed by making some attribute information like the data be shared in the - attribute structure. SLU - 2008/07/22 - - Fixed issue where a group could have a file mounted on it twice. - (QAK - 2008/07/15) - - Fixed a Windows-specific issue in the ohdr test which was causing users - in some timezones to get false errors. This a deficiency in the Windows - mktime() function, and has been handled properly. SJW - 2008/06/19 - - Fixed the problem with the searching of target file for H5Lcreate_external(). - The searching pattern will depend on whether the target file's - pathname is an absolute or a relative path. Please see the description - in the RM for H5Lcreate_external(). (VC - 2008/04/08) - - Fixed possible file corruption bug when encoding datatype - descriptions for compound datatypes whose size was between - 256 & 511 bytes and the file was opened with the "use the - latest format" property enabled (with H5Pset_libver_bounds). - (QAK - 2008/03/13) - - Fixed bug in H5Aget_num_attrs() routine to handle invalid location - ID correctly. (QAK - 2008/03/11) - - H5Dset_extent: when shrinking dimensions, some chunks were not deleted. - (PVN - 2009/01/8) - - Added code to maintain a min_clean_fraction in the metadata cache when - in serial mode. (MAM - 2009/01/9) - - + - Configuration ------------- - - CMake: When CMake commands are executed individually on the command line - and the external filters are being built, the CMAKE_BUILD_TYPE define - must be set to the same value as the configuration - (-DCMAKE_BUILD_TYPE:STRING=Release if using -C Release). This is needed - by the the szip and zlib filter build commands. (ADB - HDFFV-8695) - - CMake: Remove use of XLATE_UTILITY program. (ADB - 2014/03/28 HDFFV-8640) - - CMake: Added missing quotes in setting the CMAKE_EXE_LINKER_FLAGS for the - MPI option. (ADB - 2014/02/27 HDFFV-8674) - - Modified H5detect.c to scan floating point types for padding bits before - analyzing the type further. This should fix problems with gcc 4.8 - (NAF - 2013/09/19 - HDFFV-8523/HDFFV-8500) - - Fixed Makefile issue in which "-Wl," was not properly specified - prior to -rpath when building parallel fortran libraries with - an Intel compiler. (MAM - 2012/03/26) - - Makefiles generated by other packages using h5cc as the compiler - no longer error when 'make' is invoked more than once in order - to 'rebuild' after changes to source. (MAM - 2012/03/26) - - Added --enable-fortran2003 flag to enable Fortran2003 support - in the HDF5 Fortran library. The flag should be used along with the - --enable-fortran flag and takes affect only when Fortran compiler - is Fortran2003 compliant. (EIP - 2011/11/14) - - - In Windows platform, the default VFD, was Windows VFD, is restored back - to the SEC2, aka POSIX, VFD. The Windows VFD is deprecated. HDFFV-7740 - (AKC 2011/09/26) - - Removed config/ibm-aix6.x. All IBM-AIX settings are in one file, - ibm-aix. (AKC - 2011/4/14) - - Shared C libraries are no longer disabled on Mac when Fortran - is enabled. Shared Fortran libraries are still not supported on Mac, - so configure will disable them by default, but this is overridable - with the new --enable-unsupported configure option. The configure - summary has been updated to reflect the fact that the shared-ness of - the C++/Fortran wrapper libraries may not align with the C library. - (MAM - 04/11/2011 - HDFFV-4353). - - Removed recognition of the parallel compilers of LAM(hcc) and - ChMPIon(cmpicc) since we have no access to these two MPI implementations - and cannot verify their correctness. (AKC - 2010/7/14 - Bug 1921) - - Removed the following config files, as we no longer support them: - config/dec-osf*, config/hpux11.00, config/irix5.x, - config/powerpc-ibm-aix4.x config/rs6000-ibm-aix5.x config/unicos* - MAM - 2009/10/08 - - Modified configure and make process to properly preserve user's CFLAGS - (and company) environment variables. Build will now properly use - automake's AM_CFLAGS for any compiler flags set by the configure - process. Configure will no longer modify CFLAGS directly, nor will - setting CFLAGS during make completely replace what configure has set up. - MAM - 2009/10/08 - - Support for TFLOPS, config/intel-osf1, is removed since the TFLOPS - machine has long retired. AKC - 2009/10/06. - - Added $(EXEEXT) extension to H5detect when it's executed in the - src/Makfile to generate H5Tinit.c so it works correctly on platforms - that require the full extension when running executables. - MAM - 2009/10/01 - BZ #1613 - - Configure will now set FC and CXX to "no" when fortran and c++ - are not being compiled, respectively, so configure will not run - some of the compiler tests for these languages when they are not - being used. MAM - 2009/10/01 - - The PathScale compiler (v3.2) was mistaken as gcc v4.2.0 but it fails to - recognize some gcc options. Fixed. (see bug 1301). AKC - 2009/7/28 - - - The --enable-static-exec flag will now properly place the -static flag - on the link line of all installed executables. This will force the - executable to link with static libraries over shared libraries, provided - the static libraries are available. MAM - 2009/08/31 - BZ #1583 - - The --includedir=DIR configuration option now works as intended, and can - be used to specify the location to install C header files. The default - location remains unchanged, residing at ${prefix}/include. - MAM - 2009/03/10 - BZ #1381 - - Configure no longer removes the '-g' flag from CFLAGS when in production - mode if it has been explicitly set in the CFLAGS environment variable - prior to configuration. MAM - 2009/03/09 - BZ #1401. - - Fixed error with 'make check install' failing due to h5dump - needing other tools built first. MAM - 2008/10/24. - - Wpen using shared szip, it is no longer necessary to specify - the path to the shared szip libraries in LD_LIBRARY_PATH. MAM - - 2008/10/24. - - The file libhdf5_fortran.settings is not installed since its content - is included in libhdf5.settings now. AKC - 2008/10/21 - - "make DESTDIR=xxx install" failed to install some tools and files - (e.g., h5cc and fortran modules). Fixed. AKC - 2008/10/8. - - Autotools: An export of LD_LIBRARY_PATH= was - removed from configure and make installcheck was revised to run - scripts installed in share/hdf5_examples to use the installed h5cc, etc. - to compile and run example source files also installed there. Make - installcheck will now fail when a shared szip or other external lib file - cannot be found in the same manner that executables compiled and linked - with h5cc will fail to run when those lib files cannot be found after - install. Make installcheck should pass after setting LD_LIBRARY_PATH to the - szip location. - (LRK - 2014/04/16) + - Performance ------------- - - Removed program perform/benchpar from the enable-build-all list. The - program will be retired or moved to another location. HDFFV-8156 - (AKC 2012/10/01) - - Retired program perform/mpi-perf. Its purpose has been incorporated - into h5perf before. (AKC 2012/09/20) - - ifdefs added to tests around include unistd.h and function to simulate - getlogin() on Windows. - (ADB - 2011/08/15) - - perf_serial test added to Windows projects and check batch file. - (ADB - 2009/06/11) + - + Fortran -------- - - Fixed a typo in return value of the nh5dread_f_c function ( was 1 - instead of 0 on success); fixed the return value to make it consistent - with other Fortran functions; cleaned the code from debug statements. - (EIP - 2012/06/23) - - - Fixed problem writing/reading control characters to a dataset; writing - a string containing: alerts, backspace, carriage_return, form_feed, - horizontal_tab, vertical_tab, new_line is now tested and working. - (MSB - 2012/09/01) - - - Corrected the integer type of H5S_UNLIMITED_F to HSIZE_T (MSB - 2012/09/01) - - - Corrected the number of continuation lines in the src files - to be less then 32 lines for F95 compliance. (MSB - 2012/10/01) + - Tools ----- - - h5dump subsetting fixed for dims greater then two - When a dataset has more then two dimensions, subsetting would incorrectly - calculate the data that needed to be displayed. - Added in block and stride calculation that account for dimensions greater - then two. NOTE: lines that have line breaks inserted because of display - length calculations, may have index info that is incorrect until the next - dimension break. (ADB, 2016/03/04, HDFFV-9698) - - h5repack: h5repack would not attempt to remove UD filters. Added a - check to h5repack for UD filters that checks if the filter can - be dynamically loaded. This will require a change in the library to - add the H5PL_load() to the H5Zfilter_avail(). (ADB - 2014/03/03 HDFFV-8629) - - h5repack: Fixed failure for converting a layout of small chunked dataset - (size < 1K) to contiguous layout. HDFFV-8214 (JKM 2013/03/18) - - h5diff: Fixed to return correct exit code 1 when detect unique extra - attribute. Prior to this fix, h5diff returned exit code 0 indicating - two files are identical. HDFFV-7643 (JKM 2013/02/15) - - h5diff: Improved speed when comparing HDF5 files with lots of - attributes. Much slower performance was identified with release - version from 1.8.7 to 1.8.10 compared to 1.8.6. (JKM 2012/10/19) - - h5repack: "h5repack -f NONE file1.h5 out.h5" command failed if - source file contains chunked dataset and a chunk dim is bigger than - the dataset dim. Another issue is that the command changed max dims - if chunk dim is smaller than the dataset dim. - These issue occurred when dataset size is smaller than 64k (compact - size limit) Fixed both. - HDFFV-8012 (JKM 2012/09/24) - - h5diff: Fixed not to accumulate attribute difference to dataset - difference in verbose mode (-v, -r), which caused incorrect - difference between dataset and group/datatype object if attribute - exist with any differences. This also lead to fix inconsistent - format indicating difference between dataset and group/datatype - object. HDFFV-5919 (JKM 2012/09/05) - - h5diff: Fixed the incorrect result when comparing attribute data - values and the data type has same class but different size. - HDFFV-7942 (JKM 2012/08/15) - - ph5diff: Fixed intermittent hang issue on a certain operation in - parallel mode. It was detected by daily test for comparing - non-comparable objects, but it could have occurred in other - operations depend on machine condition. HDFFV-8003 (JKM 2012/08/01) - - h5diff: Fixed test failure for "make check" due to failure of - copying test files when performed in HDF5 source tree. Also applied - to other tools. - HDFFV-8107 (JKM 2012/08/01) - - h5diff: Fixed the Function COPY_TESTFILES_TO_TESTDIR() of - testh5diff.sh to better report when there is an error in the file - copying. HDFFV-8105 (AKC -2012/07/22) - - h5diff: Fixed not to check and display dangling link status without - --follow-symlinks option. This also improved performance when - comparing lots of external links without the --follow-symlinks - option. HDFFV-7998 (JKM 2012/04/26) - - h5unjam: Fixed sefgault when used -V (show version) option. - HDFFV-8001 (JKM 2012/04/19) - - h5repack: Fixed a failure when change the chunk size of a specified - chunked dataset with unlimited max dims. HDFFV-7993 (JKM 2012/04/11) - - h5diff: Fixed failure for comparing same named object with different - object types in comparing groups. Prior to the fix, h5diff resulted - in error. After the fix, h5diff detects such case as non-comparable - and display messages accordingly. HDFFV-7664 (JKM 2012/03/28) - - h5diff: If unique objects exists only in one file and try to exclude - the unique objects with --exclude-path option, h5diff missed - excluding some objects. - Fixed to exclude objects correctly in such case. - HDFFV-7837 (JKM 2012/03/20) - - h5dump: Added tools library error stack to properly catch error - information generated within the library. - HDFFV-7958 (ADB 2012/03/12) - - h5dump: Dangling links no longer throw error message, change process - when open link fails. - HDFFV-7839 (ADB 2012/03/12) - - h5diff: When two symbolic dangling links are compared with - --follow-symlinks option, the result should be same. It worked for - comparing two files, but didn't work for comparing two objects. - HDFFV-7835 (JKM 2012/03/09) - - h5dump: Refactored code to remove duplicated functions. Split XML - functions from DDL functions. Corrected indentation and formatting - errors. Also fixed subsetting counting overflow (HDFFV-5874). Verified - all tools call tools_init() in main. - HDFFV-7560 (ADB 2012/02/17) - - h5diff: fixed to prevent from displaying error stack message when - comparing the two dangling symlinks with follow-symlinks option. - HDFFV-7836 (JKM 2012/01/13) - - h5repack: fixed memory leak for handling variable length string in - attribute. HDFFV-7840 (JKM 2012/01/06) - - h5ls: fixed segfault when access region reference data in an - attribute. HDFFV-7838 (JKM 2011/12/29) - - h5diff: fixed segfault over non-comparable attribute with different - dimention or rank, along with '-c' option to display details. - HDFFV-7770 (JKM 2011/10/24) - - Fixed h5diff to display all the comparable object and attribute - regardless of non-comparables. HDFFV-7693 (JKM 2011/09/16) - - Fixed h5repack to update values of references(object and region) of - attributes in h5repack for 1) references, 2) ARRAY of references, - 3) VLEN of references, and 4) COMPOUND of references. - (JIRA HDF5 5932) PC -2011/09/14 - - h5diff: fixed segfault over dataset with container types - (array,lven) with multiple nested compound types. - (ex: compound->array->compound, compound->vlen->compound) - HDFFV-7712 JKM (2011/09/01) - - h5repack: added macro to handle failure in H5Dread/write when memory - allocation failed inside the library. (PC -- 2011/08/19) - - Fixed h5jam not to allow specifying an HDF5 formatted file as input - file for -u (user block file) option, because the original HDF5 file - will not be accessible if allows. HDFFV-5941 (JKM 2011/08/15) - - Revised command help pages of h5jam and h5unjam. The descriptions - were not up to date and some were missing. - HDFFV-7515 (JKM 2011/08/15) - - h5repack: h5repack failed to copy dataset if the layout is changed - from chunked with unlimited dims to contiguous. HDFFV-7649 - (PC -- 2011/07/15) - - h5diff: "--delta" option considers two NaN of the same type are - different, which is wrong based on h5diff description in Reference - Manual. HDFFV-7656 (PC -- 2011/07/15) - - Fixed h5diff to display instructive error message and exit with 1 - when mutually exclusive options (-d, -p and --use-system-epsilon) - are used together. HDFFV-7600 (JKM 2011/07/07) - - Fixed h5dump to display the first line of each element into correct - position for multiple dimention array type. - Before this fix, the first line of each element in array were - displayed after the last line of previous element without - moving to the next line (+indentation). - Bug #HDFFV-5878 (JKM 2011/06/15) - - Fixed h5dump to display correct value for H5T_STD_I8LE dataset - on a system (ppc64, linux, Big-Endian, clustering). - Bug #HDFFV-7594 (ABERT & JKM 2011/05/12) - - Fixed h5diff to compare file itself correctly. Previously h5diff - reported either different or not compatible in certain cases even - comparing file itself. This fix also improve performance when - comparing same target objects through verifying the obj&file - addresses before comparing the details in the objects (ex: datasets - or attributes) Bug #HDFFV-5928 (XCAO & JKM 2011/05/06) - - Updated h5dump test case script to prevent entire test failure upon - source directory is read-only. Bug# HDFFV-4342 (JKM 2011/4/12) - - Fixed h5dump displaying incorrect values for H5T_STD_I8BE type data in - attribute on Big-Endian machine. H5T_STD_I8BE is unsigned 8bit type, - so h5dump is supposed to display -2 instead of 254. It worked - correctly on Little-Endian system , but not on Big-Endian system. - Bug #HDFFV-4358 (JKM 2011/04/08) - - Updated to unify option name to '--enable-error-stack' for printing - HDF5 error stack messages for HDF5 tools. h5ls and h5dump for now. - For h5ls, this replaces "-e/--errors" option, which is deprecated. - Bug#2182 (JKM 2011/3/30) - - Fix h5diff for --use-system-epsilon option: the calculation changed - from ( |a - b| / b ) to ( |a - b| ). This was decided for better - performance. Bug#2184 (JKM 2011/3/24) - - Fixed output for H5T_REFERENCE in h5dump. According to the BNF document - the output of a H5T_REFERENCE should be followed by the type; - ::= H5T_REFERENCE { } - ::= H5T_STD_REF_OBJECT | H5T_STD_REF_DSETREG - Previously this was only displayed if the -R option was used. - Bug#1725 (ADB 2011/3/28) - - Fix h5diff issues for #1: h5diff compared attributes correctly only - when two objects have the same number of attributes and attribute - names are identical, #2: didn't display useful information about - attribute difference. Bug#2121 (JKM 2011/3/17) - - Fixed memory leak for h5diff when accessing symbolic links with - --follow-symlink option. Bug#2214 (JKM 2011/3/18) - - Fixed memory leak for h5diff when access variable length string - data. Bug#2216 (JKM 2011/3/18) - - Fixed and improved help page for -a option of h5ls. - Bug#1904 (JKM 2011/3/11) - - Fixed h5dump not to include attribute values in the output file when - h5dump "-y -o output_file" options were used. The problem was introduced - in HDF5 1.8.6 by showing data pointed by region references. (XCAO 2011/3/9) - - Fixed h5copy to be able to copy any object into the same HDF5 file. - Previously h5copy displayed error message when target file is same - as source file. (XCAO 2011/3/8) - - Fixed h5dump for skipping some values for long array type dataset on - Windows. This issue only occurred on Windows due to the different - return behavior from _vsnprintf() funtion. Bug#2161 (JKM 2011/3/3) - - Fixed h5dump for skipping array indices every certain number - when the array type dataset is relatively big. The certain number - varies according to the size of array. Bug#2092 (JKM 2011/2/15). - - Fixed h5diff for the segfault when compares compound datasets - with combination of fixed length string types and vlen string types - in certain orders. bug#2089 (JKM 2010/12/28) - - Improve h5diff performance. 1) use HDmemcmp() before comparing each - elements. 2) replace expensive H5Tequals() calls 3) retrieve datatype - information at dataset level not each element level for compound - datasets - - Fixed h5ls to display nested compound type with curly bracket - when -S (--simple) option is used with -l (--label), so it shows - which member (in curly bracket) belong to which nested compound type - and make the output make sense. bug#1979 (JKM 2010/11/09) - - Fixed h5diff to handle variable-length strings in a compound dataset - correctly. (also variable-length string array in a compound dataset) - Garbage values were displayed when h5diff compared multiple - variable-length strings in a compound type dataset. - Bug#1989 (JKM 2010/10/28) - - Fixed h5copy to fail gracefully when copying object to non-exist - group without -p option. Bug#2040 (JKM 2010/10/18) - - Fixed to compare member objects and groups recursively when two - files or groups are specified to be compared. Bug#1975 - (JKM 2010/9/16) - - Make h5repack be able to convert a layout to COMPACT for small size - dataset as default. bug#1896 (JKM 2010/09/15) - - Change h5ls not to manipulate special characters in object name or - attribute name for smart display. bug#1784 (JKM 2010/06/28) - - Fixed h5ls to return exit code 1 (error) when non-existent file is - specified. bug#1793. (JKM 2010/04/27) - - h5copy failed to copy dangling link when the link is specified - directly. bug#1817. (JKM 2010/04/22) - - h5repack lost attributes from a dataset of reference type. bug#1726. - (JKM 2010/3/25) - - h5repack sets NULL for object reference value for group or - named datatype. bug#1814. (JKM 2010/03/19) - - h5diff: fixed incorrect behavior (hang) in parallel mode when - specify invalid options (ex: -v and -q) (JKM 2010/02/17) - - h5dump/h5ls display buffer resize fixed in tools library. - (ADB - 2009/07/21 - 1520) - - Fixed many problems that could occur when using h5repack with named - datatypes. (NAF - 2009/4/20 - 1516/1466) - - h5dump, h5diff, h5repack were not reading (by hyperslabs) datasets - that have a datatype datum size greater than H5TOOLS_BUFSIZE, a - constant defined as 1024Kb, such as array types with large - dimensions (PVN - 2009/4/1 - 1501) - - h5import: By selecting a compression type, a big endian byte order was being - selected (PVN - 2009/3/11 - 1462) - - zip_perf.c had missing argument on one of the open() calls. Fixed. - (AKC - 2008/12/9) - - h5dump now checks for uniqueness of committed datatypes. - (NAF - 2008/10/15) - - Fixed unnecessary indentation of committed datatypes in h5dump. - (NAF - 2008/10/15) - - Fixed bugs in h5stat:segmemtation fault when printing groups and - print warning message when traversal of objects is unsuccessful. - (see bug #1253) (VC- 2008/10/13) - - Fixed bug in h5ls that prevented relative group listings (like - "h5ls foo.h5/bar") from working correctly (QAK - 2008/06/03) - - Fixed bug in h5diff that prevented datasets & attributes with - variable-length string elements from comparing correctly. - (QAK - 2008/02/28) - - h5import bug on Windows w/binary datasets. fread in windows needs a - binary file to be open with 'rb' instead of 'r' otherwise it - terminates execution if an end of file character is found on the - input file. Besides that the binary file generated needs to be open - with 'wb' , otherwise an end of line character is read twice. - (PVN - 2008/02/19) - - Fixed bug in h5dump that caused binary output to be made only for the first - dataset, when several datasets were requested. (PVN - 2008/04/07) - - h5dump: when doing binary output (-b), the stdout printing of attributes - was done incorrectly. Removed printing of attributes when doing binary - output. PVN - 2008/06/05 - + - High-Level APIs: - ------ - - Packet Table is updated. - - In the Packet Table C API, there are changes with the following functions, - which had been ifdef'ed out with VLPT_REMOVED since 2006 - * H5PTcreate_vl, is removed from this release - * H5PTfree_vlen_readbuff, is renamed to H5PTfree_vlen_buff - * H5PTis_varlen, is made available again - - Various cleanup: replacing 0/-1 with SUCCEED/FAIL and H5I_BADID with - H5I_INVALID_HID. (BMR, 2016/03/04, HDFFV-442) - - - Fixed problem with H5DSget_scale_name including the NULL terminator in - the size calculation returned by the function. The API does not - include the NULL terminator in the size returned (MSB- 2013/2/10) - - - Fixed problem with H5TBdelete_record destroying all data following the deletion - of a row. (MSB- 2012/7/26) - - - Fixed H5LTget_attribute_string not closing an object identifier when an - error occurs. (MSB- 2012/7/21) - - - Fixed the H5LTdtype_to_text function. It had some memory problems when - dealing with some complicated data types. HDFFVI-7701 (SLU - 2011/10/19) - - - Fixed a bug in H5DSattach_scale, H5DSis_attached and H5DSdetach_scale - caused by using H5Tget_native_type function to determine the native - type for reading REFERENCE_LIST attribute. The bug was exposed - on Mac PPC. - (EIP - 2010/05/22 -1851) - - Fixed a bug in the H5DSdetach_scale function when 0 bytes - were allocated after the last reference to a dim. scale - was removed from the list of references in a VL element of the - DIMENSION_LIST attribute; modified the function to comply - with the Spec: DIMENSION_LIST attribute is deleted now when no - dimension scales left attached. - (EIP - 2010/05/14 -1822) - - Fixed a bug where the H5TB API would forget the order of fields when - added out of offset order. (NAF - 2009/10/27 - 1582) - - H5DSis_attached failed to account for different platform types. Added a - get native type call. (ADB - 2009/9/29 - 1562) - - Dimension scales: The scale index return value in H5DSiterate_scales was not always - incremented. (PVN - 2009/4/8 - 1538) + ------ + - Fortran High-Level APIs: - ------ - - - Lite: The h5ltget_attribute_string_f used to return the C NULL character in the - returned character buffer. The returned Fortran charactor buffer now does - not return the C NULL character. (MSB - 2012/3/23) - - Lite: The h5ltget_dataset_info_f function (gets information about a dataset) - was not correctly returning the dimension array. (PVN - 2009/3/23) - - Lite: the h5ltread_dataset_string_f and h5ltget_attribute_string_f functions - had memory problems with the g95 fortran compiler. (PVN � 5/13/2009) 1522 - - - - + ------ + - Documentation ------------- @@ -1238,141 +132,80 @@ Bug Fixes since HDF5-1.8.0 release F90 APIs -------- - - Modified the h5open_f and h5close_f subroutines to not to call H5open - and H5close correspodningly. While the H5open call just adds overhead, - the H5close call called by an Fortran application shuts down the HDF5 - library making it unaccessible to the application. - HDFFV-915 (EIP & SB - 2011/10/13) + - C++ APIs -------- - - The constructor PropList::PropList(id) was fixed to act properly - according to the nature of 'id'. When 'id' is a property class id, - a new property list will be created. When 'id' id a property list id, - a copy of the property list will be made. (BMR - 2010/5/9) - - The parameters 'size' and 'bufsize' in CommonFG::getLinkval and - CommonFG::getComment, respectively, now have default values for - user's convenience. (BMR - 2009/10/23) - - NULL pointer accessing was fixed, bugzilla 1061. (BMR - 2009/10/05) - - read/write methods of DataSet and Attribute classes were fixed - to handle string correctly. (BMR - 2009/07/26) - - Fixed bug that caused segfaults in Attribute::read. (BMR - 2008/04/20) - - Fixed bug in PropList::getClassName to use portable HDfree instead - of free. (BMR - 2008/04/20) - - Fixed a design bug which allowed an Attribute object to create/modify - attributes (bugzilla #1068). The API class hierarchy was revised - to address the problem. Classes AbstractDS and Attribute are moved - out of H5Object. Class Attribute now multiply inherits from - IdComponent and AbstractDs and class DataSet from H5Object and - AbstractDs. In addition, the data member IdComponent::id was - moved into subclasses: Attribute, DataSet, DataSpace, DataType, - H5File, Group, and PropList. (BMR - 2008/08/10) - - IdComponent::dereference was incorrect and replaced as described - in "New Features" section. - (BMR - 2008/08/10) - + - + Testing ------- - - tools/h5diff/testh5diff.sh is run in every "make check", even after it - has passed in the previous run. It should not run again if there is no - code changes. Fixed. (AKC - 2013/07/19 HDFFV-8392) - - In some Mac system, testlibinfo.sh failed with this error: - Check file ../src/.libs/libhdf5.7.dylib - strings: object: ../src/.libs/libhdf5.7.dylib malformed object \ - (unknown load command 15) - The strings command of Mac inspects library files and older - versions of strings may not know newer library format, resulting - in errors. Fixed by sending the library file as stdin to the strings - coommand to avoid this problem. (AKC - 2013/03/08 HDFFV-8305) - - - Fixed a typo in the ERROR macro in test/testhdf5.h. It segmentation - faulted when used before. (AKC - 2013/02/12 HDFFV-8267) - + - Supported Platforms =================== - AIX 6.1 xlc 10.1.0.5 - (NASA G-ADA) xlC 10.1.0.5 - xlf90 12.1.0.6 - - Linux 2.6.18-308.13.1.el5PAE GNU C (gcc), Fortran (gfortran), C++ (g++) - #1 SMP i686 i686 i386 compilers for 32-bit applications; - (jam) Version 4.1.2 20080704 (Red Hat 4.1.2-54) - Version 4.8.2 - PGI C, Fortran, C++ Compilers for 32-bit - applications; - Version 13.7-0 - Intel(R) C, C++, Fortran Compiler for 32-bit - applications; - Version 14.0.2 (Build 20140120) - - Linux 2.6.18-371.6.1.el5 GNU C (gcc), Fortran (gfortran), C++ (g++) - #1 SMP x86_64 GNU/Linux compilers for 64-bit applications; - (koala) Version 4.1.2 20080704 (Red Hat 4.1.2-54) - Version 4.8.2 - Intel(R) C, C++, Fortran Compilers for - applications running on Intel(R) 64; - Version 14.0.2 (Build 20140120) - - Linux 2.6.32-431.11.2.el6 GNU C (gcc), Fortran (gfortran), C++ (g++) + + Linux 2.6.32-573.22.1.el6 GNU C (gcc), Fortran (gfortran), C++ (g++) #1 SMP x86_64 GNU/Linux compilers: - (platypus) Version 4.4.7 20120313 - Version 4.8.2 + (mayll/platypus) Version 4.4.7 20120313 + Version 4.8.4 PGI C, Fortran, C++ for 64-bit target on x86-64; - Version 13.7-0 + Version 16.10-0 Intel(R) C (icc), C++ (icpc), Fortran (icc) compilers: - Version 14.0.2 (Build 20140120) + Version 15.0.3.187 (Build 20150407) + MPICH 3.1.4 compiled with GCC 4.9.3 - Linux 2.6.32-431.29.2.el6.ppc64 gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-4) + Linux 2.6.32-573.18.1.el6.ppc64 gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-4) #1 SMP ppc64 GNU/Linux g++ (GCC) 4.4.7 20120313 (Red Hat 4.4.7-4) (ostrich) GNU Fortran (GCC) 4.4.7 20120313 (Red Hat 4.4.7-4) IBM XL C/C++ V13.1 IBM XL Fortran V15.1 - Linux 2.6.32-220.23.1.1chaos Intel C, C++, Fortran Compilers - ch5.x86_64 GNU/Linux Version 12.1.5.339 - (LLNL Aztec) - - IBM Blue Gene/P XL C for Blue Gene/P, bgxlc V9.0 - (LLNL uDawn) XL C++ for Blue Gene/P, bgxlC V9.0 - XL Fortran for Blue Gene/P, bgxlf90 V11.1 - + Linux 3.10.0-327.10.1.el7 GNU C (gcc), Fortran (gfortran), C++ (g++) + #1 SMP x86_64 GNU/Linux compilers: + (kituo/moohan) Version 4.8.5 20150623 (Red Hat 4.8.5-4) + Version 4.9.3, Version 5.2.0 + Intel(R) C (icc), C++ (icpc), Fortran (icc) + compilers: + Version 15.0.3.187 Build 20150407 + MPICH 3.1.4 compiled with GCC 4.9.3 + SunOS 5.11 32- and 64-bit Sun C 5.12 SunOS_sparc (emu) Sun Fortran 95 8.6 SunOS_sparc Sun C++ 5.12 SunOS_sparc - Windows 7 Visual Studio 2008 (cmake) - Visual Studio 2010 w/ Intel Fortran 14 (cmake) - Visual Studio 2012 w/ Intel Fortran 15 (cmake) + Windows 7 Visual Studio 2012 w/ Intel Fortran 15 (cmake) Visual Studio 2013 w/ Intel Fortran 15 (cmake) - Visual Studio 2015 (cmake) - Cygwin(CYGWIN_NT-6.1 1.7.34(0.285/5/3) gcc(4.9.2) compiler and gfortran) + Visual Studio 2015 w/ Intel Fortran 16 (cmake) + Cygwin(CYGWIN_NT-6.1 2.2.1(0.289/5/3) gcc(4.9.3) compiler and gfortran) (cmake and autotools) - Windows 7 x64 Visual Studio 2008 (cmake) - Visual Studio 2010 w/ Intel Fortran 14 (cmake) - Visual Studio 2012 w/ Intel Fortran 15 (cmake) + Windows 7 x64 Visual Studio 2012 w/ Intel Fortran 15 (cmake) Visual Studio 2013 w/ Intel Fortran 15 (cmake) - Visual Studio 2015 (cmake) + Visual Studio 2015 w/ Intel Fortran 16 (cmake) + + Windows 10 Visual Studio 2015 w/ Intel Fortran 16 (cmake) - Windows 8.1 Visual Studio 2012 w/ Intel Fortran 15 (cmake) - Visual Studio 2013 w/ Intel Fortran 15 (cmake) + Windows 10 x64 Visual Studio 2015 w/ Intel Fortran 16 (cmake) + + Mac OS X Mt. Lion 10.8.5 Apple clang/clang++ version 5.1 from Xcode 5.1 + 64-bit gfortran GNU Fortran (GCC) 4.8.2 + (swallow/kite) Intel icc/icpc/ifort version 15.0.3 - Windows 8.1 x64 Visual Studio 2012 w/ Intel Fortran 15 (cmake) - Visual Studio 2013 w/ Intel Fortran 15 (cmake) + Mac OS X Mavericks 10.9.5 Apple clang/clang++ version 6.0 from Xcode 6.2 + 64-bit gfortran GNU Fortran (GCC) 4.9.2 + (wren/quail) Intel icc/icpc/ifort version 15.0.3 - Mac OS X Lion 10.7.3 gcc i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 from Xcode 4.2.1 - 32- and 64-bit g++ i686-apple-darwin11-llvm-g++-4.2 (GCC) 4.2.1 from Xcode 4.2.1 - (duck) gfortran GNU Fortran (GCC) 4.6.2 + Mac OS X Yosemite 10.10.5 Apple clang/clang++ version 6.1 from Xcode 7.0 + 64-bit gfortran GNU Fortran (GCC) 4.9.2 + (osx1010dev/osx1010test) Intel icc/icpc/ifort version 15.0.3 - Mac OS X Mountain Lion 10.8.1 cc Apple clang version 4.0 from Xcode 4.5.1 - (owl) c++ Apple clang version 4.0 from Xcode 4.5.1 - gcc i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 from Xcode 4.5.1 - g++ i686-apple-darwin11-llvm-g++-4.2 (GCC) 4.2.1 from Xcode 4.5.1 - gfortran GNU Fortran (GCC) 4.6.2 + Mac OS X El Capitan 10.11.6 Apple clang/clang++ version 7.3.0 from Xcode 7.3 + 64-bit gfortran GNU Fortran (GCC) 5.2.0 + (osx1010dev/osx1010test) Intel icc/icpc/ifort version 16.0.2 Tested Configuration Features Summary @@ -1396,22 +229,18 @@ Windows 7 y y/y n y y y Windows 7 x64 y y/y n y y y Windows 7 Cygwin n y/n n y y y Windows 7 x64 Cygwin n y/n n y y y -Windows 8 y y/y n y y y -Windows 8 x64 y y/y n y y y -Mac OS X Lion 10.7.3 32-bit n y/y n y y n -Mac OS X Lion 10.7.3 64-bit n y/y n y y y -Mac OS X Mountain Lion 10.8.1 64-bit n y/y n y y y -Mac OS X Mavericks 10.9.1 64-bit n y/y n y y ? -AIX 6.1 32- and 64-bit n y/n n y y y -CentOS 5.9 Linux 2.6.18-308 i686 GNU y y/y y y y y -CentOS 5.9 Linux 2.6.18-308 i686 Intel n y/y n y y y -CentOS 5.9 Linux 2.6.18-308 i686 PGI n y/y n y y y -CentOS 5.9 Linux 2.6.18 x86_64 GNU n y/y n y y y -CentOS 5.9 Linux 2.6.18 x86_64 Intel n y/y n y y y -CentOS 6.4 Linux 2.6.32 x86_64 GNU y y/y y y y y -CentOS 6.4 Linux 2.6.32 x86_64 Intel n y/y n y y y -CentOS 6.4 Linux 2.6.32 x86_64 PGI n y/y n y y y -Linux 2.6.32-431.11.2.el6.ppc64 n y/n n y y y +Windows 10 y y/y n y y y +Windows 10 x64 y y/y n y y y +Mac OS X Mountain Lion 10.8.5 64-bit n y/y n y y y +Mac OS X Mavericks 10.9.5 64-bit n y/y n y y ? +Mac OS X Yosemite 10.10.5 64-bit n y/y n y y ? +Mac OS X El Capitan 10.11.6 64-bit n y/y n y y ? +CentOS 6.7 Linux 2.6.18 x86_64 GNU n y/y n y y y +CentOS 6.7 Linux 2.6.18 x86_64 Intel n y/y n y y y +CentOS 6.7 Linux 2.6.32 x86_64 PGI n y/y n y y y +CentOS 7.2 Linux 2.6.32 x86_64 GNU y y/y y y y y +CentOS 7.2 Linux 2.6.32 x86_64 Intel n y/y n y y y +Linux 2.6.32-573.18.1.el6.ppc64 n y/n n y y y Platform Shared Shared Shared Thread- @@ -1422,22 +251,18 @@ Windows 7 y y y y Windows 7 x64 y y y y Windows 7 Cygwin n n n y Windows 7 x64 Cygwin n n n y -Windows 8 y y y y -Windows 8 x64 y y y y -Mac OS X Lion 10.7.3 32-bit y n y y -Mac OS X Lion 10.7.3 64-bit y n y y -Mac OS X Mountain Lion 10.8.1 64-bit y n y y -Mac OS X Mavericks 10.9.1 64-bit y n y y -AIX 6.1 32- and 64-bit y n n y -CentOS 5.9 Linux 2.6.18-308 i686 GNU y y y y -CentOS 5.9 Linux 2.6.18-308 i686 Intel y y y n -CentOS 5.9 Linux 2.6.18-308 i686 PGI y y y n -CentOS 5.9 Linux 2.6.18 x86_64 GNU y y y y -CentOS 5.9 Linux 2.6.18 x86_64 Intel y y y n -CentOS 6.4 Linux 2.6.32 x86_64 GNU y y y n -CentOS 6.4 Linux 2.6.32 x86_64 Intel y y y n -CentOS 6.4 Linux 2.6.32 x86_64 PGI y y y n -Linux 2.6.32-431.11.2.el6.ppc64 y y y n +Windows 10 y y y y +Windows 10 x64 y y y y +Mac OS X Mountain Lion 10.8.5 64-bit y n y y +Mac OS X Mavericks 10.9.5 64-bit y n y y +Mac OS X Yosemite 10.10.5 64-bit y n y y +Mac OS X El Capitan 10.11.6 64-bit y n y y +CentOS 6.7 Linux 2.6.18 x86_64 GNU y y y y +CentOS 6.7 Linux 2.6.18 x86_64 Intel y y y n +CentOS 6.7 Linux 2.6.32 x86_64 PGI y y y n +CentOS 7.2 Linux 2.6.32 x86_64 GNU y y y n +CentOS 7.2 Linux 2.6.32 x86_64 Intel y y y n +Linux 2.6.32-573.18.1.el6.ppc64 y y y n Compiler versions for each platform are listed in the preceding "Supported Platforms" table. @@ -1447,70 +272,26 @@ More Tested Platforms ===================== The following platforms are not supported but have been tested for this release. - Linux 2.6.18-308.13.1.el5PAE MPICH mpich 3.1.2 compiled with - #1 SMP i686 i686 i386 gcc 4.9.1 and gfortran 4.9.1 - (jam) g95 (GCC 4.0.3 (g95 0.94!) - - Linux 2.6.18-431.11.2.el6 MPICH mpich 3.1.2 compiled with - #1 SMP x86_64 GNU/Linux gcc 4.9.1 and gfortran 4.9.1 - (platypus) g95 (GCC 4.0.3 (g95 0.94!) - - FreeBSD 8.2-STABLE i386 gcc 4.2.1 [FreeBSD] 20070719 - (loyalty) gcc 4.6.1 20110422 - g++ 4.6.1 20110422 - gfortran 4.6.1 20110422 - - FreeBSD 8.2-STABLE amd64 gcc 4.2.1 [FreeBSD] 20070719 - (freedom) gcc 4.6.1 20110422 - g++ 4.6.1 20110422 - gfortran 4.6.1 20110422 - - Debian7.5.0 3.2.0-4-686 #1 SMP Debian 3.2.51-1 i686 GNU/Linux - gcc (Debian 4.7.2-5) 4.7.2 - GNU Fortran (Debian 4.7.2-5) 4.7.2 - (cmake and autotools) - - Debian7.5.0 3.2.0-4-amd64 #1 SMP Debian 3.2.51-1 x86_64 GNU/Linux - gcc (Debian 4.7.2-5) 4.7.2 - GNU Fortran (Debian 4.7.2-5) 4.7.2 - (cmake and autotools) + Linux 2.6.32-573.18.1.el6.ppc64 MPICH mpich 3.1.4 compiled with + #1 SMP ppc64 GNU/Linux IBM XL C/C++ for Linux, V13.1 + (ostrich) and IBM XL Fortran for Linux, V15.1 - Fedora20 3.15.3-200.fc20.i6866 #1 SMP i686 i686 i386 GNU/Linux - gcc (GCC) 4.8.3 20140624 (Red Hat 4.8.3-1) - GNU Fortran (GCC) 4.8.3 20140624 (Red Hat 4.8.3-1) + Debian 8.4 3.16.0-4-amd64 #1 SMP Debian 3.16.36-1 x86_64 GNU/Linux + gcc, g++ (Debian 4.9.2-10) 4.9.2 + GNU Fortran (Debian 4.9.2-10) 4.9.2 (cmake and autotools) - Fedora20 3.15.3-200.fc20.x86_64 #1 SMP x86_64 x86_64 x86_64 GNU/Linux - gcc (GCC) 4.8.3 20140624 (Red Hat 4.8.3-1) - GNU Fortran (GCC) 4.8.3 20140624 (Red Hat 4.8.3-1) + Fedora 24 4.7.2-201.fc24.x86_64 #1 SMP x86_64 x86_64 x86_64 GNU/Linux + gcc, g++ (GCC) 6.1.1 20160621 (Red Hat 6.1.1-3) + GNU Fortran (GCC) 6.1.1 20160621 (Red Hat 6.1.1-3) (cmake and autotools) - SUSE 13.1 3.11.10-17-desktop #1 SMP PREEMPT i686 athlon i386 GNU/Linux - gcc (SUSE Linux) 4.8.1 - GNU Fortran (SUSE Linux) 4.8.1 + Ubuntu 16.04.1 4.4.0-38-generic #57-Ubuntu SMP x86_64 GNU/Linux + gcc, g++ (Ubuntu 5.4.0-6ubuntu1~16.04.2) 5.4.0 20160609 + GNU Fortran (Ubuntu 5.4.0-6ubuntu1~16.04.2) 5.4.0 20160609 (cmake and autotools) - SUSE 13.1 3.11.10-17-desktop #1 SMP PREEMPT x86_64 x86_64 x86_64 GNU/Linux - gcc (SUSE Linux) 4.8.1 - GNU Fortran (SUSE Linux) 4.8.1 - (cmake and autotools) - - Ubuntu 14.04 3.13.0-35-generic #62-Ubuntu SMP i686 GNU/Linux - gcc (Ubuntu/Linaro 4.9.1-0ubuntu1) 4.9.1 - GNU Fortran (Ubuntu/Linaro 4.9.1-0ubuntu1) 4.9.1 - (cmake and autotools) - - Ubuntu 14.04 3.13.0-35-generic #62-Ubuntu SMP x86_64 GNU/Linux - gcc (Ubuntu/Linaro 4.9.1-0ubuntu1) 4.9.1 - GNU Fortran (Ubuntu/Linaro 4.9.1-0ubuntu1) 4.9.1 - (cmake and autotools) - - Cray Linux Environment (CLE) PrgEnv-pgi/4.0.46 - hopper.nersc.gov pgcc 12.5-0 64-bit target on x86-64 Linux -tp shanghai - pgf90 12.5-0 64-bit target on x86-64 Linux -tp shanghai - pgCC 12.5-0 64-bit target on x86-64 Linux -tp shanghai - - + Known Problems ============== * "make check" fails on CYGWIN when building shared lib files is enabled. The diff --git a/release_docs/USING_CMake_Examples.txt b/release_docs/USING_CMake_Examples.txt index d3618e9..f188ab3 100644 --- a/release_docs/USING_CMake_Examples.txt +++ b/release_docs/USING_CMake_Examples.txt @@ -22,7 +22,7 @@ I. Preconditions 1. We suggest you obtain the latest CMake for windows from the Kitware web site. The HDF5 1.10.x product requires a minimum CMake version - of 3.1.0. + of 3.2.2. 2. You have installed the HDF5 library built with CMake, by executing the HDF Install Utility (the *.msi file in the binary package for @@ -52,7 +52,7 @@ Default installation process: with the CTEST_CONFIGURATION_TYPE script option. Note that this must be the same as the value used with the -C command line option. The default build configuration is defined to build and use static libraries. - Shared libraries can be used with the STATIC_LIBRARIES script option set to "NO". + Shared libraries can be used with the STATIC_ONLY script option set to "NO". Other options can be changed by editing the HDF5_Examples.cmake file. If the defaults are okay, execute from this directory: diff --git a/release_docs/USING_HDF5_CMake.txt b/release_docs/USING_HDF5_CMake.txt index 313af83..87ebafc 100644 --- a/release_docs/USING_HDF5_CMake.txt +++ b/release_docs/USING_HDF5_CMake.txt @@ -37,7 +37,7 @@ I. Preconditions 1. We suggest you obtain the latest CMake for windows from the Kitware web site. The HDF5 1.10.x product requires a minimum CMake version - of 3.1.0. + of 3.2.2. 2. You have installed the HDF5 library built with CMake, by executing the HDF Install Utility (the *.msi file in the binary package for @@ -180,7 +180,7 @@ Given the preconditions in section I, create a CMakeLists.txt file at the source root. Include the following text in the file: ########################################################## -cmake_minimum_required (VERSION 3.1.0) +cmake_minimum_required (VERSION 3.2.2) project (HDF5MyApp C CXX) set (LIB_TYPE STATIC) # or SHARED @@ -227,97 +227,97 @@ NOTE: this file is available at the HDF web site: ctest ======================================================================== -cmake_minimum_required(VERSION 3.1.0 FATAL_ERROR) +cmake_minimum_required(VERSION 3.2.2 FATAL_ERROR) ############################################################################################################### # This script will build and run the examples from a folder # Execute from a command line: # ctest -S HDF5_Examples.cmake,OPTION=VALUE -C Release -V -O test.log ############################################################################################################### -set(CTEST_CMAKE_GENERATOR "@CMAKE_GENERATOR@") -set(CTEST_DASHBOARD_ROOT ${CTEST_SCRIPT_DIRECTORY}) +set (CTEST_CMAKE_GENERATOR "@CMAKE_GENERATOR@") +set (CTEST_DASHBOARD_ROOT ${CTEST_SCRIPT_DIRECTORY}) # handle input parameters to script. #INSTALLDIR - HDF5 root folder #CTEST_CONFIGURATION_TYPE - Release, Debug, RelWithDebInfo #CTEST_SOURCE_NAME - name of source folder; HDF4Examples -#STATIC_LIBRARIES - Default is YES +#STATIC_ONLY - Default is YES #FORTRAN_LIBRARIES - Default is NO #JAVA_LIBRARIES - Default is NO ##NO_MAC_FORTRAN - set to TRUE to allow shared libs on a Mac) -if(DEFINED CTEST_SCRIPT_ARG) +if (DEFINED CTEST_SCRIPT_ARG) # transform ctest script arguments of the form # script.ctest,var1=value1,var2=value2 # to variables with the respective names set to the respective values - string(REPLACE "," ";" script_args "${CTEST_SCRIPT_ARG}") - foreach(current_var ${script_args}) + string (REPLACE "," ";" script_args "${CTEST_SCRIPT_ARG}") + foreach (current_var ${script_args}) if ("${current_var}" MATCHES "^([^=]+)=(.+)$") set("${CMAKE_MATCH_1}" "${CMAKE_MATCH_2}") - endif() - endforeach() -endif() -if(NOT DEFINED INSTALLDIR) - set(INSTALLDIR "@CMAKE_INSTALL_PREFIX@") -endif() -if(NOT DEFINED CTEST_CONFIGURATION_TYPE) - set(CTEST_CONFIGURATION_TYPE "Release") -endif() -if(NOT DEFINED CTEST_SOURCE_NAME) - set(CTEST_SOURCE_NAME "HDF5Examples") -endif() -if(NOT DEFINED STATIC_LIBRARIES) - set(STATICLIBRARIES "YES") -else(NOT DEFINED STATIC_LIBRARIES) - set(STATICLIBRARIES "NO") -endif() -if(NOT DEFINED FORTRAN_LIBRARIES) - set(FORTRANLIBRARIES "NO") -else(NOT DEFINED FORTRAN_LIBRARIES) - set(FORTRANLIBRARIES "YES") -endif() -if(NOT DEFINED JAVA_LIBRARIES) - set(JAVALIBRARIES "NO") -else(NOT DEFINED JAVA_LIBRARIES) - set(JAVALIBRARIES "YES") -endif() + endif () + endforeach () +endif () +if (NOT DEFINED INSTALLDIR) + set (INSTALLDIR "@CMAKE_INSTALL_PREFIX@") +endif () +if (NOT DEFINED CTEST_CONFIGURATION_TYPE) + set (CTEST_CONFIGURATION_TYPE "Release") +endif () +if (NOT DEFINED CTEST_SOURCE_NAME) + set (CTEST_SOURCE_NAME "HDF5Examples") +endif () +if (NOT DEFINED STATIC_ONLY) + set (STATICONLYLIBRARIES "YES") +else () + set (STATICONLYLIBRARIES "NO") +endif () +if (NOT DEFINED FORTRAN_LIBRARIES) + set (FORTRANLIBRARIES "NO") +else () + set (FORTRANLIBRARIES "YES") +endif () +if (NOT DEFINED JAVA_LIBRARIES) + set (JAVALIBRARIES "NO") +else () + set (JAVALIBRARIES "YES") +endif () #TAR_SOURCE - name of tarfile -#if(NOT DEFINED TAR_SOURCE) -# set(CTEST_USE_TAR_SOURCE "HDF5Examples-1.10.1-Source") -#endif() +#if (NOT DEFINED TAR_SOURCE) +# set (CTEST_USE_TAR_SOURCE "HDF5Examples-1.10.1-Source") +#endif () ############################################################################################################### # Adjust the following SET Commands as needed ############################################################################################################### -if(WIN32) - if(${STATICLIBRARIES}) - set(BUILD_OPTIONS "${BUILD_OPTIONS} -DBUILD_SHARED_LIBS:BOOL=OFF") - endif() - set(ENV{HDF5_DIR} "${INSTALLDIR}/cmake") - set(CTEST_BINARY_NAME ${CTEST_SOURCE_NAME}\\build) - set(CTEST_SOURCE_DIRECTORY "${CTEST_DASHBOARD_ROOT}\\${CTEST_SOURCE_NAME}") - set(CTEST_BINARY_DIRECTORY "${CTEST_DASHBOARD_ROOT}\\${CTEST_BINARY_NAME}") -else(WIN32) - if(${STATICLIBRARIES}) - set(BUILD_OPTIONS "${BUILD_OPTIONS} -DBUILD_SHARED_LIBS:BOOL=OFF -DCMAKE_ANSI_CFLAGS:STRING=-fPIC") - endif() - set(ENV{HDF5_DIR} "${INSTALLDIR}/share/cmake") - set(ENV{LD_LIBRARY_PATH} "${INSTALLDIR}/lib") - set(CTEST_BINARY_NAME ${CTEST_SOURCE_NAME}/build) - set(CTEST_SOURCE_DIRECTORY "${CTEST_DASHBOARD_ROOT}/${CTEST_SOURCE_NAME}") - set(CTEST_BINARY_DIRECTORY "${CTEST_DASHBOARD_ROOT}/${CTEST_BINARY_NAME}") +if (WIN32) + if (${STATICONLYLIBRARIES}) + set (BUILD_OPTIONS "${BUILD_OPTIONS} -DBUILD_SHARED_LIBS:BOOL=OFF") + endif () + set (ENV{HDF5_DIR} "${INSTALLDIR}/cmake") + set (CTEST_BINARY_NAME ${CTEST_SOURCE_NAME}\\build) + set (CTEST_SOURCE_DIRECTORY "${CTEST_DASHBOARD_ROOT}\\${CTEST_SOURCE_NAME}") + set (CTEST_BINARY_DIRECTORY "${CTEST_DASHBOARD_ROOT}\\${CTEST_BINARY_NAME}") +else (WIN32) + if (${STATICONLYLIBRARIES}) + set (BUILD_OPTIONS "${BUILD_OPTIONS} -DBUILD_SHARED_LIBS:BOOL=OFF -DCMAKE_ANSI_CFLAGS:STRING=-fPIC") + endif () + set (ENV{HDF5_DIR} "${INSTALLDIR}/share/cmake") + set (ENV{LD_LIBRARY_PATH} "${INSTALLDIR}/lib") + set (CTEST_BINARY_NAME ${CTEST_SOURCE_NAME}/build) + set (CTEST_SOURCE_DIRECTORY "${CTEST_DASHBOARD_ROOT}/${CTEST_SOURCE_NAME}") + set (CTEST_BINARY_DIRECTORY "${CTEST_DASHBOARD_ROOT}/${CTEST_BINARY_NAME}") endif(WIN32) -if(${FORTRANLIBRARIES}) - set(BUILD_OPTIONS "${BUILD_OPTIONS} -DHDF_BUILD_FORTRAN:BOOL=ON") -else() - set(BUILD_OPTIONS "${BUILD_OPTIONS} -DHDF_BUILD_FORTRAN:BOOL=OFF") -endif() -if(${JAVALIBRARIES}) - set(BUILD_OPTIONS "${BUILD_OPTIONS} -DHDF_BUILD_JAVA:BOOL=ON") -else() - set(BUILD_OPTIONS "${BUILD_OPTIONS} -DHDF_BUILD_JAVA:BOOL=OFF") -endif() -set(BUILD_OPTIONS "${BUILD_OPTIONS} -DHDF5_PACKAGE_NAME:STRING=@HDF5_PACKAGE@@HDF_PACKAGE_EXT@") +if (${FORTRANLIBRARIES}) + set (BUILD_OPTIONS "${BUILD_OPTIONS} -DHDF_BUILD_FORTRAN:BOOL=ON") +else () + set (BUILD_OPTIONS "${BUILD_OPTIONS} -DHDF_BUILD_FORTRAN:BOOL=OFF") +endif () +if (${JAVALIBRARIES}) + set (BUILD_OPTIONS "${BUILD_OPTIONS} -DHDF_BUILD_JAVA:BOOL=ON") +else () + set (BUILD_OPTIONS "${BUILD_OPTIONS} -DHDF_BUILD_JAVA:BOOL=OFF") +endif () +set (BUILD_OPTIONS "${BUILD_OPTIONS} -DHDF5_PACKAGE_NAME:STRING=@HDF5_PACKAGE@@HDF_PACKAGE_EXT@") ############################################################################################################### # For any comments please contact cdashhelp@hdfgroup.org @@ -327,90 +327,90 @@ set(BUILD_OPTIONS "${BUILD_OPTIONS} -DHDF5_PACKAGE_NAME:STRING=@HDF5_PACKAGE@@HD #----------------------------------------------------------------------------- # MAC machines need special option #----------------------------------------------------------------------------- -if(APPLE) +if (APPLE) # Compiler choice - execute_process(COMMAND xcrun --find cc OUTPUT_VARIABLE XCODE_CC OUTPUT_STRIP_TRAILING_WHITESPACE) - execute_process(COMMAND xcrun --find c++ OUTPUT_VARIABLE XCODE_CXX OUTPUT_STRIP_TRAILING_WHITESPACE) - set(ENV{CC} "${XCODE_CC}") - set(ENV{CXX} "${XCODE_CXX}") - if(NOT NO_MAC_FORTRAN) + execute_process (COMMAND xcrun --find cc OUTPUT_VARIABLE XCODE_CC OUTPUT_STRIP_TRAILING_WHITESPACE) + execute_process (COMMAND xcrun --find c++ OUTPUT_VARIABLE XCODE_CXX OUTPUT_STRIP_TRAILING_WHITESPACE) + set (ENV{CC} "${XCODE_CC}") + set (ENV{CXX} "${XCODE_CXX}") + if (NOT NO_MAC_FORTRAN) # Shared fortran is not supported, build static - set(BUILD_OPTIONS "${BUILD_OPTIONS} -DBUILD_SHARED_LIBS:BOOL=OFF -DCMAKE_ANSI_CFLAGS:STRING=-fPIC") - else() - set(BUILD_OPTIONS "${BUILD_OPTIONS} -DHDF_BUILD_FORTRAN:BOOL=OFF") - endif() - set(BUILD_OPTIONS "${BUILD_OPTIONS} -DCTEST_USE_LAUNCHERS:BOOL=ON -DCMAKE_BUILD_WITH_INSTALL_RPATH:BOOL=OFF") -endif() + set (BUILD_OPTIONS "${BUILD_OPTIONS} -DBUILD_SHARED_LIBS:BOOL=OFF -DCMAKE_ANSI_CFLAGS:STRING=-fPIC") + else () + set (BUILD_OPTIONS "${BUILD_OPTIONS} -DHDF_BUILD_FORTRAN:BOOL=OFF") + endif () + set (BUILD_OPTIONS "${BUILD_OPTIONS} -DCTEST_USE_LAUNCHERS:BOOL=ON -DCMAKE_BUILD_WITH_INSTALL_RPATH:BOOL=OFF") +endif () #----------------------------------------------------------------------------- -set(CTEST_CMAKE_COMMAND "\"${CMAKE_COMMAND}\"") +set (CTEST_CMAKE_COMMAND "\"${CMAKE_COMMAND}\"") ## -------------------------- -if(CTEST_USE_TAR_SOURCE) +if (CTEST_USE_TAR_SOURCE) ## Uncompress source if tar or zip file provided ## -------------------------- - if(WIN32) - message(STATUS "extracting... [${CMAKE_EXECUTABLE_NAME} -E tar -xvf ${CTEST_USE_TAR_SOURCE}.zip]") - execute_process(COMMAND ${CMAKE_EXECUTABLE_NAME} -E tar -xvf ${CTEST_DASHBOARD_ROOT}\\${CTEST_USE_TAR_SOURCE}.zip RESULT_VARIABLE rv) - else() - message(STATUS "extracting... [${CMAKE_EXECUTABLE_NAME} -E tar -xvf ${CTEST_USE_TAR_SOURCE}.tar]") - execute_process(COMMAND ${CMAKE_EXECUTABLE_NAME} -E tar -xvf ${CTEST_DASHBOARD_ROOT}/${CTEST_USE_TAR_SOURCE}.tar RESULT_VARIABLE rv) - endif() - - if(NOT rv EQUAL 0) - message(STATUS "extracting... [error-(${rv}) clean up]") - file(REMOVE_RECURSE "${CTEST_SOURCE_DIRECTORY}") - message(FATAL_ERROR "error: extract of ${CTEST_SOURCE_NAME} failed") - endif() -endif(CTEST_USE_TAR_SOURCE) + if (WIN32) + message (STATUS "extracting... [${CMAKE_EXECUTABLE_NAME} -E tar -xvf ${CTEST_USE_TAR_SOURCE}.zip]") + execute_process (COMMAND ${CMAKE_EXECUTABLE_NAME} -E tar -xvf ${CTEST_DASHBOARD_ROOT}\\${CTEST_USE_TAR_SOURCE}.zip RESULT_VARIABLE rv) + else () + message (STATUS "extracting... [${CMAKE_EXECUTABLE_NAME} -E tar -xvf ${CTEST_USE_TAR_SOURCE}.tar]") + execute_process (COMMAND ${CMAKE_EXECUTABLE_NAME} -E tar -xvf ${CTEST_DASHBOARD_ROOT}/${CTEST_USE_TAR_SOURCE}.tar RESULT_VARIABLE rv) + endif () + + if (NOT rv EQUAL 0) + message (STATUS "extracting... [error-(${rv}) clean up]") + file (REMOVE_RECURSE "${CTEST_SOURCE_DIRECTORY}") + message (FATAL_ERROR "error: extract of ${CTEST_SOURCE_NAME} failed") + endif () +endif () #----------------------------------------------------------------------------- ## Clear the build directory ## -------------------------- -set(CTEST_START_WITH_EMPTY_BINARY_DIRECTORY TRUE) +set (CTEST_START_WITH_EMPTY_BINARY_DIRECTORY TRUE) if (EXISTS "${CTEST_BINARY_DIRECTORY}" AND IS_DIRECTORY "${CTEST_BINARY_DIRECTORY}") - ctest_empty_binary_directory(${CTEST_BINARY_DIRECTORY}) + ctest_empty_binary_directory (${CTEST_BINARY_DIRECTORY}) else () - file(MAKE_DIRECTORY "${CTEST_BINARY_DIRECTORY}") + file (MAKE_DIRECTORY "${CTEST_BINARY_DIRECTORY}") endif () # Use multiple CPU cores to build -include(ProcessorCount) -ProcessorCount(N) -if(NOT N EQUAL 0) - if(NOT WIN32) - set(CTEST_BUILD_FLAGS -j${N}) - endif() - set(ctest_test_args ${ctest_test_args} PARALLEL_LEVEL ${N}) -endif() +include (ProcessorCount) +ProcessorCount (N) +if (NOT N EQUAL 0) + if (NOT WIN32) + set (CTEST_BUILD_FLAGS -j${N}) + endif () + set (ctest_test_args ${ctest_test_args} PARALLEL_LEVEL ${N}) +endif () set (CTEST_CONFIGURE_COMMAND "${CTEST_CMAKE_COMMAND} -C \"${CTEST_SOURCE_DIRECTORY}/config/cmake/cacheinit.cmake\" -DCMAKE_BUILD_TYPE:STRING=${CTEST_CONFIGURATION_TYPE} ${BUILD_OPTIONS} \"-G${CTEST_CMAKE_GENERATOR}\" \"${CTEST_SOURCE_DIRECTORY}\"" ) #----------------------------------------------------------------------------- ## -- set output to english -set($ENV{LC_MESSAGES} "en_EN") +set ($ENV{LC_MESSAGES} "en_EN") #----------------------------------------------------------------------------- -configure_file(${CTEST_SOURCE_DIRECTORY}/config/cmake/CTestCustom.cmake ${CTEST_BINARY_DIRECTORY}/CTestCustom.cmake) +configure_file (${CTEST_SOURCE_DIRECTORY}/config/cmake/CTestCustom.cmake ${CTEST_BINARY_DIRECTORY}/CTestCustom.cmake) ctest_read_custom_files ("${CTEST_BINARY_DIRECTORY}") ## NORMAL process ## -------------------------- ctest_start (Experimental) ctest_configure (BUILD "${CTEST_BINARY_DIRECTORY}") -if(LOCAL_SUBMIT) +if (LOCAL_SUBMIT) ctest_submit (PARTS Configure Notes) -endif() +endif () ctest_build (BUILD "${CTEST_BINARY_DIRECTORY}" APPEND) -if(LOCAL_SUBMIT) +if (LOCAL_SUBMIT) ctest_submit (PARTS Build) -endif() +endif () ctest_test (BUILD "${CTEST_BINARY_DIRECTORY}" APPEND ${ctest_test_args} RETURN_VALUE res) -if(LOCAL_SUBMIT) +if (LOCAL_SUBMIT) ctest_submit (PARTS Test) -endif() -if(res GREATER 0) +endif () +if (res GREATER 0) message (FATAL_ERROR "tests FAILED") -endif() +endif () #----------------------------------------------------------------------------- ############################################################################################################## diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 55de5ea..ef361b2 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 3.1.0) +cmake_minimum_required (VERSION 3.2.2) PROJECT (HDF5_SRC C CXX) #----------------------------------------------------------------------------- @@ -90,8 +90,10 @@ set (H5C_SOURCES ${HDF5_SRC_DIR}/H5C.c ${HDF5_SRC_DIR}/H5Cdbg.c ${HDF5_SRC_DIR}/H5Cepoch.c + ${HDF5_SRC_DIR}/H5Cimage.c ${HDF5_SRC_DIR}/H5Clog.c ${HDF5_SRC_DIR}/H5Cmpio.c + ${HDF5_SRC_DIR}/H5Cprefetched.c ${HDF5_SRC_DIR}/H5Cquery.c ${HDF5_SRC_DIR}/H5Ctag.c ${HDF5_SRC_DIR}/H5Ctest.c @@ -439,6 +441,7 @@ set (H5O_SOURCES ${HDF5_SRC_DIR}/H5Obogus.c ${HDF5_SRC_DIR}/H5Obtreek.c ${HDF5_SRC_DIR}/H5Ocache.c + ${HDF5_SRC_DIR}/H5Ocache_image.c ${HDF5_SRC_DIR}/H5Ochunk.c ${HDF5_SRC_DIR}/H5Ocont.c ${HDF5_SRC_DIR}/H5Ocopy.c @@ -658,7 +661,7 @@ set (H5Z_SOURCES if (H5_ZLIB_HEADER) SET_PROPERTY(SOURCE ${HDF5_SRC_DIR}/H5Zdeflate.c PROPERTY COMPILE_DEFINITIONS H5_ZLIB_HEADER="${H5_ZLIB_HEADER}") -endif (H5_ZLIB_HEADER) +endif () set (H5Z_HDRS @@ -816,10 +819,10 @@ if (HDF5_GENERATE_HEADERS) COMMAND ${PERL_EXECUTABLE} ${HDF5_SOURCE_DIR}/bin/make_overflow ${HDF5_SRC_DIR}/H5overflow.txt OUTPUT_VARIABLE SCRIPT_OUTPUT ) message(STATUS ${SCRIPT_OUTPUT}) - else (PERL_FOUND) + else () message (STATUS "Cannot generate headers - perl not found") - endif (PERL_FOUND) -endif (HDF5_GENERATE_HEADERS) + endif () +endif () #----------------------------------------------------------------------------- # Setup the H5Detect utility which generates H5Tinit with platform @@ -829,7 +832,7 @@ add_executable (H5detect ${HDF5_SRC_DIR}/H5detect.c) TARGET_C_PROPERTIES (H5detect STATIC " " " ") if (MSVC OR MINGW) target_link_libraries (H5detect "ws2_32.lib") -endif (MSVC OR MINGW) +endif () set (CMD $) add_custom_command ( @@ -843,7 +846,7 @@ add_executable (H5make_libsettings ${HDF5_SRC_DIR}/H5make_libsettings.c) TARGET_C_PROPERTIES (H5make_libsettings STATIC " " " ") if (MSVC OR MINGW) target_link_libraries (H5make_libsettings "ws2_32.lib") -endif (MSVC OR MINGW) +endif () set (CMD $) add_custom_command ( @@ -864,10 +867,10 @@ TARGET_C_PROPERTIES (${HDF5_LIB_TARGET} STATIC " " " ") target_link_libraries (${HDF5_LIB_TARGET} ${LINK_LIBS}) if (NOT WIN32) target_link_libraries (${HDF5_LIB_TARGET} dl) -endif (NOT WIN32) +endif () if (H5_HAVE_PARALLEL AND MPI_C_FOUND) target_link_libraries (${HDF5_LIB_TARGET} ${MPI_C_LIBRARIES}) -endif (H5_HAVE_PARALLEL AND MPI_C_FOUND) +endif () set_global_variable (HDF5_LIBRARIES_TO_EXPORT ${HDF5_LIB_TARGET}) H5_SET_LIB_OPTIONS (${HDF5_LIB_TARGET} ${HDF5_LIB_NAME} STATIC) set_target_properties (${HDF5_LIB_TARGET} PROPERTIES @@ -881,7 +884,7 @@ if (HDF5_ENABLE_DEBUG_APIS) COMPILE_DEFINITIONS "H5Z_DEBUG;H5T_DEBUG;H5ST_DEBUG;H5S_DEBUG;H5O_DEBUG;H5I_DEBUG;H5HL_DEBUG;H5F_DEBUG;H5D_DEBUG;H5B2_DEBUG;H5AC_DEBUG" ) -endif (HDF5_ENABLE_DEBUG_APIS) +endif () set (install_targets ${HDF5_LIB_TARGET}) if (BUILD_SHARED_LIBS) @@ -908,10 +911,10 @@ if (BUILD_SHARED_LIBS) target_link_libraries (${HDF5_LIBSH_TARGET} ${LINK_SHARED_LIBS}) if (NOT WIN32) target_link_libraries (${HDF5_LIBSH_TARGET} dl) - endif (NOT WIN32) + endif () if (H5_HAVE_PARALLEL AND MPI_C_FOUND) target_link_libraries (${HDF5_LIBSH_TARGET} ${MPI_C_LIBRARIES}) - endif (H5_HAVE_PARALLEL AND MPI_C_FOUND) + endif () set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_LIBSH_TARGET}") H5_SET_LIB_OPTIONS (${HDF5_LIBSH_TARGET} ${HDF5_LIB_NAME} SHARED ${HDF5_PACKAGE_SOVERSION}) set_target_properties (${HDF5_LIBSH_TARGET} PROPERTIES @@ -926,16 +929,16 @@ if (BUILD_SHARED_LIBS) "H5_HAVE_THREADSAFE" ) target_link_libraries (${HDF5_LIBSH_TARGET} Threads::Threads) - endif (HDF5_ENABLE_THREADSAFE) + endif () if (HDF5_ENABLE_DEBUG_APIS) set_property (TARGET ${HDF5_LIBSH_TARGET} APPEND PROPERTY COMPILE_DEFINITIONS "H5Z_DEBUG;H5T_DEBUG;H5ST_DEBUG;H5S_DEBUG;H5O_DEBUG;H5I_DEBUG;H5HL_DEBUG;H5F_DEBUG;H5D_DEBUG;H5B2_DEBUG;H5AC_DEBUG" ) - endif (HDF5_ENABLE_DEBUG_APIS) + endif () set (install_targets ${install_targets} ${HDF5_LIBSH_TARGET}) -endif (BUILD_SHARED_LIBS) +endif () #----------------------------------------------------------------------------- # Add file(s) to CMake Install @@ -950,7 +953,7 @@ if (NOT HDF5_INSTALL_NO_DEVELOPMENT) COMPONENT headers ) -endif (NOT HDF5_INSTALL_NO_DEVELOPMENT) +endif () #----------------------------------------------------------------------------- # Add Target(s) to CMake Install for import into other projects @@ -958,7 +961,8 @@ endif (NOT HDF5_INSTALL_NO_DEVELOPMENT) if (HDF5_EXPORTED_TARGETS) if (BUILD_SHARED_LIBS) INSTALL_TARGET_PDB (${HDF5_LIBSH_TARGET} ${HDF5_INSTALL_BIN_DIR} libraries) - endif (BUILD_SHARED_LIBS) + endif () + INSTALL_TARGET_PDB (${HDF5_LIB_TARGET} ${HDF5_INSTALL_BIN_DIR} libraries) install ( TARGETS @@ -971,4 +975,4 @@ if (HDF5_EXPORTED_TARGETS) FRAMEWORK DESTINATION ${HDF5_INSTALL_FWRK_DIR} COMPONENT libraries INCLUDES DESTINATION include ) -endif (HDF5_EXPORTED_TARGETS) +endif () diff --git a/src/H5AC.c b/src/H5AC.c index 117e662..ee68a6f 100644 --- a/src/H5AC.c +++ b/src/H5AC.c @@ -107,38 +107,43 @@ hbool_t H5_coll_api_sanity_check_g = false; /* Local Variables */ /*******************/ -static const char *H5AC_entry_type_names[H5AC_NTYPES] = -{ - "B-tree nodes", - "symbol table nodes", - "local heap prefixes", - "local heap data blocks", - "global heaps", - "object headers", - "object header chunks", - "v2 B-tree headers", - "v2 B-tree internal nodes", - "v2 B-tree leaf nodes", - "fractal heap headers", - "fractal heap direct blocks", - "fractal heap indirect blocks", - "free space headers", - "free space sections", - "shared OH message master table", - "shared OH message index", - "extensible array headers", - "extensible array index blocks", - "extensible array super blocks", - "extensible array data blocks", - "extensible array data block pages", - "fixed array headers", - "fixed array data block", - "fixed array data block pages", - "superblock", - "driver info", - "epoch marker", /* internal to cache only */ - "proxy entry", - "test entry" /* for testing only -- not used for actual files */ +/* Metadata entry class list */ + +/* Remember to add new type ID to the H5AC_type_t enum in H5ACprivate.h when + * adding a new class. + */ + +static const H5AC_class_t *const H5AC_class_s[] = { + H5AC_BT, /* ( 0) B-tree nodes */ + H5AC_SNODE, /* ( 1) symbol table nodes */ + H5AC_LHEAP_PRFX, /* ( 2) local heap prefix */ + H5AC_LHEAP_DBLK, /* ( 3) local heap data block */ + H5AC_GHEAP, /* ( 4) global heap */ + H5AC_OHDR, /* ( 5) object header */ + H5AC_OHDR_CHK, /* ( 6) object header chunk */ + H5AC_BT2_HDR, /* ( 7) v2 B-tree header */ + H5AC_BT2_INT, /* ( 8) v2 B-tree internal node */ + H5AC_BT2_LEAF, /* ( 9) v2 B-tree leaf node */ + H5AC_FHEAP_HDR, /* (10) fractal heap header */ + H5AC_FHEAP_DBLOCK, /* (11) fractal heap direct block */ + H5AC_FHEAP_IBLOCK, /* (12) fractal heap indirect block */ + H5AC_FSPACE_HDR, /* (13) free space header */ + H5AC_FSPACE_SINFO, /* (14) free space sections */ + H5AC_SOHM_TABLE, /* (15) shared object header message master table */ + H5AC_SOHM_LIST, /* (16) shared message index stored as a list */ + H5AC_EARRAY_HDR, /* (17) extensible array header */ + H5AC_EARRAY_IBLOCK, /* (18) extensible array index block */ + H5AC_EARRAY_SBLOCK, /* (19) extensible array super block */ + H5AC_EARRAY_DBLOCK, /* (20) extensible array data block */ + H5AC_EARRAY_DBLK_PAGE, /* (21) extensible array data block page */ + H5AC_FARRAY_HDR, /* (22) fixed array header */ + H5AC_FARRAY_DBLOCK, /* (23) fixed array data block */ + H5AC_FARRAY_DBLK_PAGE, /* (24) fixed array data block page */ + H5AC_SUPERBLOCK, /* (25) file superblock */ + H5AC_DRVRINFO, /* (26) driver info block (supplements superblock) */ + H5AC_EPOCH_MARKER, /* (27) epoch marker - always internal to cache */ + H5AC_PROXY_ENTRY, /* (28) cache entry proxy */ + H5AC_PREFETCHED_ENTRY /* (29) prefetched entry - always internal to cache */ }; @@ -366,12 +371,13 @@ H5AC_term_package(void) *------------------------------------------------------------------------- */ herr_t -H5AC_create(const H5F_t *f, H5AC_cache_config_t *config_ptr) +H5AC_create(const H5F_t *f, H5AC_cache_config_t *config_ptr, H5AC_cache_image_config_t * image_config_ptr) { #ifdef H5_HAVE_PARALLEL char prefix[H5C__PREFIX_LEN] = ""; H5AC_aux_t * aux_ptr = NULL; #endif /* H5_HAVE_PARALLEL */ + struct H5C_cache_image_ctl_t int_ci_config = H5C__DEFAULT_CACHE_IMAGE_CTL; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -380,11 +386,16 @@ H5AC_create(const H5F_t *f, H5AC_cache_config_t *config_ptr) HDassert(f); HDassert(NULL == f->shared->cache); HDassert(config_ptr != NULL) ; - HDcompile_assert(NELMTS(H5AC_entry_type_names) == H5AC_NTYPES); + HDassert(image_config_ptr != NULL) ; + HDassert(image_config_ptr->version == H5AC__CURR_CACHE_IMAGE_CONFIG_VERSION); + HDcompile_assert(NELMTS(H5AC_class_s) == H5AC_NTYPES); HDcompile_assert(H5C__MAX_NUM_TYPE_IDS == H5AC_NTYPES); + /* Validate configurations */ if(H5AC_validate_config(config_ptr) < 0) HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "Bad cache configuration") + if(H5AC_validate_cache_image_config(image_config_ptr) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "Bad cache image configuration") #ifdef H5_HAVE_PARALLEL if(H5F_HAS_FEATURE(f, H5FD_FEAT_HAS_MPI)) { @@ -402,7 +413,7 @@ H5AC_create(const H5F_t *f, H5AC_cache_config_t *config_ptr) HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "can't get mpi size") if(NULL == (aux_ptr = H5FL_CALLOC(H5AC_aux_t))) - HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "Can't allocate H5AC auxilary structure.") + HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "Can't allocate H5AC auxilary structure") aux_ptr->magic = H5AC__H5AC_AUX_T_MAGIC; aux_ptr->mpi_comm = mpi_comm; @@ -426,15 +437,16 @@ H5AC_create(const H5F_t *f, H5AC_cache_config_t *config_ptr) aux_ptr->candidate_slist_ptr = NULL; aux_ptr->write_done = NULL; aux_ptr->sync_point_done = NULL; + aux_ptr->p0_image_len = 0; sprintf(prefix, "%d:", mpi_rank); if(mpi_rank == 0) { if(NULL == (aux_ptr->d_slist_ptr = H5SL_create(H5SL_TYPE_HADDR, NULL))) - HGOTO_ERROR(H5E_CACHE, H5E_CANTCREATE, FAIL, "can't create dirtied entry list.") + HGOTO_ERROR(H5E_CACHE, H5E_CANTCREATE, FAIL, "can't create dirtied entry list") if(NULL == (aux_ptr->c_slist_ptr = H5SL_create(H5SL_TYPE_HADDR, NULL))) - HGOTO_ERROR(H5E_CACHE, H5E_CANTCREATE, FAIL, "can't create cleaned entry list.") + HGOTO_ERROR(H5E_CACHE, H5E_CANTCREATE, FAIL, "can't create cleaned entry list") } /* end if */ /* construct the candidate slist for all processes. @@ -442,25 +454,25 @@ H5AC_create(const H5F_t *f, H5AC_cache_config_t *config_ptr) * will use it in the case of a flush. */ if(NULL == (aux_ptr->candidate_slist_ptr = H5SL_create(H5SL_TYPE_HADDR, NULL))) - HGOTO_ERROR(H5E_CACHE, H5E_CANTCREATE, FAIL, "can't create candidate entry list.") + HGOTO_ERROR(H5E_CACHE, H5E_CANTCREATE, FAIL, "can't create candidate entry list") if(aux_ptr != NULL) if(aux_ptr->mpi_rank == 0) f->shared->cache = H5C_create(H5AC__DEFAULT_MAX_CACHE_SIZE, H5AC__DEFAULT_MIN_CLEAN_SIZE, (H5AC_NTYPES - 1), - (const char **)H5AC_entry_type_names, + H5AC_class_s, H5AC__check_if_write_permitted, TRUE, H5AC__log_flushed_entry, (void *)aux_ptr); else f->shared->cache = H5C_create(H5AC__DEFAULT_MAX_CACHE_SIZE, H5AC__DEFAULT_MIN_CLEAN_SIZE, (H5AC_NTYPES - 1), - (const char **)H5AC_entry_type_names, + H5AC_class_s, H5AC__check_if_write_permitted, TRUE, NULL, (void *)aux_ptr); else f->shared->cache = H5C_create(H5AC__DEFAULT_MAX_CACHE_SIZE, H5AC__DEFAULT_MIN_CLEAN_SIZE, (H5AC_NTYPES - 1), - (const char **)H5AC_entry_type_names, + H5AC_class_s, H5AC__check_if_write_permitted, TRUE, NULL, NULL); } /* end if */ else { @@ -471,7 +483,7 @@ H5AC_create(const H5F_t *f, H5AC_cache_config_t *config_ptr) */ f->shared->cache = H5C_create(H5AC__DEFAULT_MAX_CACHE_SIZE, H5AC__DEFAULT_MIN_CLEAN_SIZE, (H5AC_NTYPES - 1), - (const char **)H5AC_entry_type_names, + H5AC_class_s, H5AC__check_if_write_permitted, TRUE, NULL, NULL); #ifdef H5_HAVE_PARALLEL } /* end else */ @@ -500,6 +512,20 @@ H5AC_create(const H5F_t *f, H5AC_cache_config_t *config_ptr) if(H5AC_set_cache_auto_resize_config(f->shared->cache, config_ptr) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "auto resize configuration failed") + /* don't need to get the current H5C image config here since the + * cache has just been created, and thus f->shared->cache->image_ctl + * must still set to its initial value (H5C__DEFAULT_CACHE_IMAGE_CTL). + * Note that this not true as soon as control returns to the application + * program, as some test code modifies f->shared->cache->image_ctl. + */ + int_ci_config.version = image_config_ptr->version; + int_ci_config.generate_image = image_config_ptr->generate_image; + int_ci_config.save_resize_status = image_config_ptr->save_resize_status; + int_ci_config.entry_ageout = image_config_ptr->entry_ageout; + + if(H5C_set_cache_image_config(f, f->shared->cache, &int_ci_config) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "auto resize configuration failed") + done: #ifdef H5_HAVE_PARALLEL /* if there is a failure, try to tidy up the auxilary structure */ @@ -557,7 +583,7 @@ H5AC_dest(H5F_t *f, hid_t dxpl_id) #if H5AC__TRACE_FILE_ENABLED if(H5AC__close_trace_file(f->shared->cache) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5AC__close_trace_file() failed.") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5AC__close_trace_file() failed") #endif /* H5AC__TRACE_FILE_ENABLED */ if(H5F_USE_MDC_LOGGING(f)) { @@ -571,7 +597,7 @@ H5AC_dest(H5F_t *f, hid_t dxpl_id) #ifdef H5_HAVE_PARALLEL /* destroying the cache, so clear all collective entries */ if(H5C_clear_coll_entries(f->shared->cache, FALSE) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "H5C_clear_coll_entries() failed.") + HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "H5C_clear_coll_entries() failed") aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(f->shared->cache); if(aux_ptr) @@ -580,7 +606,7 @@ H5AC_dest(H5F_t *f, hid_t dxpl_id) /* Attempt to flush all entries from rank 0 & Bcast clean list to other ranks */ if(H5AC__flush_entries(f, dxpl_id) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't flush.") + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't flush") #endif /* H5_HAVE_PARALLEL */ /* Destroy the cache */ @@ -590,12 +616,18 @@ H5AC_dest(H5F_t *f, hid_t dxpl_id) #ifdef H5_HAVE_PARALLEL if(aux_ptr != NULL) { - if(aux_ptr->d_slist_ptr != NULL) + if(aux_ptr->d_slist_ptr != NULL) { + HDassert(H5SL_count(aux_ptr->d_slist_ptr) == 0); H5SL_close(aux_ptr->d_slist_ptr); - if(aux_ptr->c_slist_ptr != NULL) + } /* end if */ + if(aux_ptr->c_slist_ptr != NULL) { + HDassert(H5SL_count(aux_ptr->c_slist_ptr) == 0); H5SL_close(aux_ptr->c_slist_ptr); - if(aux_ptr->candidate_slist_ptr != NULL) + } /* end if */ + if(aux_ptr->candidate_slist_ptr != NULL) { + HDassert(H5SL_count(aux_ptr->candidate_slist_ptr) == 0); H5SL_close(aux_ptr->candidate_slist_ptr); + } /* end if */ aux_ptr->magic = 0; aux_ptr = H5FL_FREE(H5AC_aux_t, aux_ptr); } /* end if */ @@ -706,7 +738,7 @@ H5AC_expunge_entry(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, #endif /* H5AC__TRACE_FILE_ENABLED */ if(H5C_expunge_entry(f, dxpl_id, type, addr, flags) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTEXPUNGE, FAIL, "H5C_expunge_entry() failed.") + HGOTO_ERROR(H5E_CACHE, H5E_CANTEXPUNGE, FAIL, "H5C_expunge_entry() failed") done: #if H5AC__TRACE_FILE_ENABLED @@ -776,17 +808,17 @@ H5AC_flush(H5F_t *f, hid_t dxpl_id) #ifdef H5_HAVE_PARALLEL /* flushing the cache, so clear all collective entries */ if(H5C_clear_coll_entries(f->shared->cache, FALSE) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "H5C_clear_coll_entries() failed.") + HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "H5C_clear_coll_entries() failed") /* Attempt to flush all entries from rank 0 & Bcast clean list to other ranks */ if(H5AC__flush_entries(f, dxpl_id) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't flush.") + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't flush") #endif /* H5_HAVE_PARALLEL */ /* Flush the cache */ /* (Again, in parallel - writes out the superblock) */ if(H5C_flush_cache(f, dxpl_id, H5AC__NO_FLAGS_SET) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't flush cache.") + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't flush cache") done: #if H5AC__TRACE_FILE_ENABLED @@ -840,11 +872,11 @@ H5AC_get_entry_status(const H5F_t *f, haddr_t addr, unsigned *status) FUNC_ENTER_NOAPI(FAIL) if((f == NULL) || (!H5F_addr_defined(addr)) || (status == NULL)) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Bad param(s) on entry.") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Bad param(s) on entry") if(H5C_get_entry_status(f, addr, NULL, &in_cache, &is_dirty, &is_protected, &is_pinned, &is_corked, &is_flush_dep_parent, &is_flush_dep_child, &image_is_up_to_date) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C_get_entry_status() failed.") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C_get_entry_status() failed") if(in_cache) { *status |= H5AC_ES__IN_CACHE; @@ -958,7 +990,7 @@ H5AC_insert_entry(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t add /* Check if we should try to flush */ if(aux_ptr->dirty_bytes >= aux_ptr->dirty_bytes_threshold) if(H5AC__run_sync_point(f, dxpl_id, H5AC_SYNC_POINT_OP__FLUSH_TO_MIN_CLEAN) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't run sync point.") + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't run sync point") } /* end if */ } #endif /* H5_HAVE_PARALLEL */ @@ -978,6 +1010,41 @@ done: /*------------------------------------------------------------------------- + * Function: H5AC_load_cache_image_on_next_protect + * + * Purpose: Load the cache image block at the specified location, + * decode it, and insert its contents into the metadata + * cache. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: John Mainzer + * 7/6/15 + * + *------------------------------------------------------------------------- + */ +herr_t +H5AC_load_cache_image_on_next_protect(H5F_t * f, haddr_t addr, hsize_t len, + hbool_t rw) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity checks */ + HDassert(f); + HDassert(f->shared); + HDassert(f->shared->cache); + + if(H5C_load_cache_image_on_next_protect(f, addr, len, rw) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTLOAD, FAIL, "call to H5C_load_cache_image_on_next_protect failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5AC_load_cache_image_on_next_protect() */ + + +/*------------------------------------------------------------------------- * Function: H5AC_mark_entry_dirty * * Purpose: Mark a pinned or protected entry as dirty. The target @@ -1330,13 +1397,13 @@ H5_ATTR_UNUSED #endif /* H5_HAVE_PARALLEL */ if(H5C_move_entry(f->shared->cache, type, old_addr, new_addr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTMOVE, FAIL, "H5C_move_entry() failed.") + HGOTO_ERROR(H5E_CACHE, H5E_CANTMOVE, FAIL, "H5C_move_entry() failed") #ifdef H5_HAVE_PARALLEL /* Check if we should try to flush */ if(NULL != aux_ptr && aux_ptr->dirty_bytes >= aux_ptr->dirty_bytes_threshold) if(H5AC__run_sync_point(f, dxpl_id, H5AC_SYNC_POINT_OP__FLUSH_TO_MIN_CLEAN) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't run sync point.") + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't run sync point") #endif /* H5_HAVE_PARALLEL */ done: @@ -1426,7 +1493,7 @@ done: * Function: H5AC_prep_for_file_close * * Purpose: This function should be called just prior to the cache - * flushes at file close. + * flushes at file close. * * The objective of the call is to allow the metadata cache * to do any preparatory work prior to generation of a @@ -1508,7 +1575,7 @@ H5AC_create_flush_dependency(void * parent_thing, void * child_thing) /* Create the flush dependency */ if(H5C_create_flush_dependency(parent_thing, child_thing) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTDEPEND, FAIL, "H5C_create_flush_dependency() failed.") + HGOTO_ERROR(H5E_CACHE, H5E_CANTDEPEND, FAIL, "H5C_create_flush_dependency() failed") done: #if H5AC__TRACE_FILE_ENABLED @@ -1609,7 +1676,7 @@ H5AC_protect(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr, #endif /* H5AC_DO_TAGGING_SANITY_CHECKS */ if(NULL == (thing = H5C_protect(f, dxpl_id, type, addr, udata, flags))) - HGOTO_ERROR(H5E_CACHE, H5E_CANTPROTECT, NULL, "H5C_protect() failed.") + HGOTO_ERROR(H5E_CACHE, H5E_CANTPROTECT, NULL, "H5C_protect() failed") #if H5AC__TRACE_FILE_ENABLED if(trace_file_ptr != NULL) @@ -1832,7 +1899,7 @@ H5AC_destroy_flush_dependency(void * parent_thing, void * child_thing) /* Destroy the flush dependency */ if(H5C_destroy_flush_dependency(parent_thing, child_thing) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTUNDEPEND, FAIL, "H5C_destroy_flush_dependency() failed.") + HGOTO_ERROR(H5E_CACHE, H5E_CANTUNDEPEND, FAIL, "H5C_destroy_flush_dependency() failed") done: #if H5AC__TRACE_FILE_ENABLED @@ -1956,18 +2023,18 @@ H5AC_unprotect(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr, if(deleted && aux_ptr->mpi_rank == 0) if(H5AC__log_deleted_entry((H5AC_info_t *)thing) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, "H5AC__log_deleted_entry() failed.") + HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, "H5AC__log_deleted_entry() failed") } /* end if */ #endif /* H5_HAVE_PARALLEL */ if(H5C_unprotect(f, dxpl_id, addr, thing, flags) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, "H5C_unprotect() failed.") + HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, "H5C_unprotect() failed") #ifdef H5_HAVE_PARALLEL /* Check if we should try to flush */ if((aux_ptr != NULL) && (aux_ptr->dirty_bytes >= aux_ptr->dirty_bytes_threshold)) if(H5AC__run_sync_point(f, dxpl_id, H5AC_SYNC_POINT_OP__FLUSH_TO_MIN_CLEAN) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't run sync point.") + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't run sync point") #endif /* H5_HAVE_PARALLEL */ done: @@ -2010,22 +2077,22 @@ H5AC_get_cache_auto_resize_config(const H5AC_t *cache_ptr, /* Check args */ if((cache_ptr == NULL) || (config_ptr == NULL) || (config_ptr->version != H5AC__CURR_CACHE_CONFIG_VERSION)) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Bad cache_ptr or config_ptr on entry.") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Bad cache_ptr or config_ptr on entry") #ifdef H5_HAVE_PARALLEL { H5AC_aux_t *aux_ptr; aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(cache_ptr); if((aux_ptr != NULL) && (aux_ptr->magic != H5AC__H5AC_AUX_T_MAGIC)) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Bad aux_ptr on entry.") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Bad aux_ptr on entry") } #endif /* H5_HAVE_PARALLEL */ /* Retrieve the configuration */ if(H5C_get_cache_auto_resize_config((const H5C_t *)cache_ptr, &internal_config) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C_get_cache_auto_resize_config() failed.") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C_get_cache_auto_resize_config() failed") if(H5C_get_evictions_enabled((const H5C_t *)cache_ptr, &evictions_enabled) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C_get_resize_enabled() failed.") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C_get_resize_enabled() failed") /* Set the information to return */ if(internal_config.rpt_fcn == NULL) @@ -2094,7 +2161,7 @@ done: */ herr_t H5AC_get_cache_size(H5AC_t *cache_ptr, size_t *max_size_ptr, size_t *min_clean_size_ptr, - size_t *cur_size_ptr, int32_t *cur_num_entries_ptr) + size_t *cur_size_ptr, uint32_t *cur_num_entries_ptr) { herr_t ret_value = SUCCEED; /* Return value */ @@ -2102,7 +2169,7 @@ H5AC_get_cache_size(H5AC_t *cache_ptr, size_t *max_size_ptr, size_t *min_clean_s if(H5C_get_cache_size((H5C_t *)cache_ptr, max_size_ptr, min_clean_size_ptr, cur_size_ptr, cur_num_entries_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C_get_cache_size() failed.") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C_get_cache_size() failed") done: FUNC_LEAVE_NOAPI(ret_value) @@ -2129,7 +2196,7 @@ H5AC_get_cache_hit_rate(H5AC_t *cache_ptr, double *hit_rate_ptr) FUNC_ENTER_NOAPI(FAIL) if(H5C_get_cache_hit_rate((H5C_t *)cache_ptr, hit_rate_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C_get_cache_hit_rate() failed.") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C_get_cache_hit_rate() failed") done: FUNC_LEAVE_NOAPI(ret_value) @@ -2156,7 +2223,7 @@ H5AC_reset_cache_hit_rate_stats(H5AC_t * cache_ptr) FUNC_ENTER_NOAPI(FAIL) if(H5C_reset_cache_hit_rate_stats((H5C_t *)cache_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C_reset_cache_hit_rate_stats() failed.") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C_reset_cache_hit_rate_stats() failed") done: FUNC_LEAVE_NOAPI(ret_value) @@ -2205,14 +2272,14 @@ H5AC_set_cache_auto_resize_config(H5AC_t *cache_ptr, H5AC_cache_config_t *config #endif /* H5AC__TRACE_FILE_ENABLED */ if(cache_ptr == NULL) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "bad cache_ptr on entry.") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "bad cache_ptr on entry") #ifdef H5_HAVE_PARALLEL { H5AC_aux_t *aux_ptr; aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(cache_ptr); if((aux_ptr != NULL) && (aux_ptr->magic != H5AC__H5AC_AUX_T_MAGIC)) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "bad aux_ptr on entry.") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "bad aux_ptr on entry") } #endif /* H5_HAVE_PARALLEL */ @@ -2224,29 +2291,29 @@ H5AC_set_cache_auto_resize_config(H5AC_t *cache_ptr, H5AC_cache_config_t *config FILE * file_ptr; if(NULL == (file_ptr = H5C_get_trace_file_ptr(cache_ptr))) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C_get_trace_file_ptr() failed.") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C_get_trace_file_ptr() failed") if((!(config_ptr->close_trace_file)) && (file_ptr != NULL)) - HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "Trace file already open.") + HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "Trace file already open") } /* end if */ /* Close & reopen trace file, if requested */ if(config_ptr->close_trace_file) if(H5AC__close_trace_file(cache_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5AC__close_trace_file() failed.") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5AC__close_trace_file() failed") if(config_ptr->open_trace_file) if(H5AC__open_trace_file(cache_ptr, config_ptr->trace_file_name) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "H5AC__open_trace_file() failed.") + HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "H5AC__open_trace_file() failed") /* Convert external configuration to internal representation */ if(H5AC__ext_config_2_int_config(config_ptr, &internal_config) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5AC__ext_config_2_int_config() failed.") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5AC__ext_config_2_int_config() failed") /* Set configuration */ if(H5C_set_cache_auto_resize_config(cache_ptr, &internal_config) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C_set_cache_auto_resize_config() failed.") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C_set_cache_auto_resize_config() failed") if(H5C_set_evictions_enabled(cache_ptr, config_ptr->evictions_enabled) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C_set_evictions_enabled() failed.") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C_set_evictions_enabled() failed") #ifdef H5_HAVE_PARALLEL { @@ -2345,9 +2412,9 @@ H5AC_validate_config(H5AC_cache_config_t *config_ptr) /* Check args */ if(config_ptr == NULL) - HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "NULL config_ptr on entry.") + HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "NULL config_ptr on entry") if(config_ptr->version != H5AC__CURR_CACHE_CONFIG_VERSION) - HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "Unknown config version.") + HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "Unknown config version") /* don't bother to test trace_file_name unless open_trace_file is TRUE */ if(config_ptr->open_trace_file) { @@ -2359,31 +2426,31 @@ H5AC_validate_config(H5AC_cache_config_t *config_ptr) */ name_len = HDstrlen(config_ptr->trace_file_name); if(name_len == 0) - HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "config_ptr->trace_file_name is empty.") + HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "config_ptr->trace_file_name is empty") else if(name_len > H5AC__MAX_TRACE_FILE_NAME_LEN) - HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "config_ptr->trace_file_name too long.") + HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "config_ptr->trace_file_name too long") } /* end if */ if((config_ptr->evictions_enabled == FALSE) && ((config_ptr->incr_mode != H5C_incr__off) || (config_ptr->flash_incr_mode != H5C_flash_incr__off) || (config_ptr->decr_mode != H5C_decr__off))) - HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "Can't disable evictions while auto-resize is enabled.") + HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "Can't disable evictions while auto-resize is enabled") if(config_ptr->dirty_bytes_threshold < H5AC__MIN_DIRTY_BYTES_THRESHOLD) - HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "dirty_bytes_threshold too small.") + HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "dirty_bytes_threshold too small") else if(config_ptr->dirty_bytes_threshold > H5AC__MAX_DIRTY_BYTES_THRESHOLD) - HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "dirty_bytes_threshold too big.") + HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "dirty_bytes_threshold too big") if((config_ptr->metadata_write_strategy != H5AC_METADATA_WRITE_STRATEGY__PROCESS_0_ONLY) && (config_ptr->metadata_write_strategy != H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED)) - HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "config_ptr->metadata_write_strategy out of range.") + HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "config_ptr->metadata_write_strategy out of range") if(H5AC__ext_config_2_int_config(config_ptr, &internal_config) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5AC__ext_config_2_int_config() failed.") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5AC__ext_config_2_int_config() failed") if(H5C_validate_resize_config(&internal_config, H5C_RESIZE_CFG__VALIDATE_ALL) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "error(s) in new config.") + HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "error(s) in new config") done: FUNC_LEAVE_NOAPI(ret_value) @@ -2391,6 +2458,61 @@ done: /*------------------------------------------------------------------------- + * Function: H5AC_validate_cache_image_config() + * + * Purpose: Run a sanity check on the contents of the supplied + * instance of H5AC_cache_image_config_t. + * + * Do nothing and return SUCCEED if no errors are detected, + * and flag an error and return FAIL otherwise. + * + * At present, this function operates by packing the data + * from the instance of H5AC_cache_image_config_t into an + * instance of H5C_cache_image_ctl_t, and then calling + * H5C_validate_cache_image_config(). If and when + * H5AC_cache_image_config_t and H5C_cache_image_ctl_t + * diverge, we may have to change this. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: John Mainzer + * 6/25/15 + * + *------------------------------------------------------------------------- + */ +herr_t +H5AC_validate_cache_image_config(H5AC_cache_image_config_t *config_ptr) +{ + H5C_cache_image_ctl_t internal_config = H5C__DEFAULT_CACHE_IMAGE_CTL; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Check args */ + if(config_ptr == NULL) + HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "NULL config_ptr on entry") + + if(config_ptr->version != H5AC__CURR_CACHE_IMAGE_CONFIG_VERSION) + HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "Unknown image config version") + + /* don't need to get the current H5C image config here since the + * default values of fields not in the H5AC config will always be + * valid. + */ + internal_config.version = config_ptr->version; + internal_config.generate_image = config_ptr->generate_image; + internal_config.save_resize_status = config_ptr->save_resize_status; + internal_config.entry_ageout = config_ptr->entry_ageout; + + if(H5C_validate_cache_image_config(&internal_config) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "error(s) in new cache image config") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5AC_validate_cache_image_config() */ + + +/*------------------------------------------------------------------------- * * Function: H5AC__check_if_write_permitted * @@ -2473,7 +2595,7 @@ H5AC__ext_config_2_int_config(H5AC_cache_config_t *ext_conf_ptr, if((ext_conf_ptr == NULL) || (ext_conf_ptr->version != H5AC__CURR_CACHE_CONFIG_VERSION) || (int_conf_ptr == NULL)) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Bad ext_conf_ptr or inf_conf_ptr on entry.") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Bad ext_conf_ptr or inf_conf_ptr on entry") int_conf_ptr->version = H5C__CURR_AUTO_SIZE_CTL_VER; if(ext_conf_ptr->rpt_fcn_enabled) @@ -2540,7 +2662,7 @@ H5AC_ignore_tags(const H5F_t *f) /* Set up a new metadata tag */ if(H5C_ignore_tags(f->shared->cache) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTSET, FAIL, "H5C_ignore_tags() failed.") + HGOTO_ERROR(H5E_CACHE, H5E_CANTSET, FAIL, "H5C_ignore_tags() failed") done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5ACdbg.c b/src/H5ACdbg.c index 8d99c6f..8ca5102 100644 --- a/src/H5ACdbg.c +++ b/src/H5ACdbg.c @@ -252,6 +252,207 @@ done: /*------------------------------------------------------------------------- * + * Function: H5AC_get_entry_ptr_from_addr() + * + * Purpose: Debugging function that attempts to look up an entry in the + * cache by its file address, and if found, returns a pointer + * to the entry in *entry_ptr_ptr. If the entry is not in the + * cache, *entry_ptr_ptr is set to NULL. + * + * WARNING: This call should be used only in debugging + * routines, and it should be avoided when + * possible. + * + * Further, if we ever multi-thread the cache, + * this routine will have to be either discarded + * or heavily re-worked. + * + * Finally, keep in mind that the entry whose + * pointer is obtained in this fashion may not + * be in a stable state. + * + * Note that this function is only defined if NDEBUG + * is not defined. + * + * As heavy use of this function is almost certainly a + * bad idea, the metadata cache tracks the number of + * successful calls to this function, and (if + * H5C_DO_SANITY_CHECKS is defined) displays any + * non-zero count on cache shutdown. + * + * This function is just a wrapper that calls the H5C + * version of the function. + * + * Return: FAIL if error is detected, SUCCEED otherwise. + * + * Programmer: John Mainzer, 5/30/14 + * + *------------------------------------------------------------------------- + */ +#ifndef NDEBUG +herr_t +H5AC_get_entry_ptr_from_addr(const H5F_t *f, haddr_t addr, void **entry_ptr_ptr) +{ + H5C_t *cache_ptr; /* Ptr to cache */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity checks */ + HDassert(f); + HDassert(f->shared); + cache_ptr = f->shared->cache; + + if(H5C_get_entry_ptr_from_addr(cache_ptr, addr, entry_ptr_ptr) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C_get_entry_ptr_from_addr() failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5AC_get_entry_ptr_from_addr() */ +#endif /* NDEBUG */ + + +/*------------------------------------------------------------------------- + * Function: H5AC_flush_dependency_exists() + * + * Purpose: Test to see if a flush dependency relationship exists + * between the supplied parent and child. Both parties + * are indicated by addresses so as to avoid the necessity + * of protect / unprotect calls prior to this call. + * + * If either the parent or the child is not in the metadata + * cache, the function sets *fd_exists_ptr to FALSE. + * + * If both are in the cache, the childs list of parents is + * searched for the proposed parent. If the proposed parent + * is found in the childs parent list, the function sets + * *fd_exists_ptr to TRUE. In all other non-error cases, + * the function sets *fd_exists_ptr FALSE. + * + * Return: SUCCEED on success/FAIL on failure. Note that + * *fd_exists_ptr is undefined on failure. + * + * Programmer: John Mainzer + * 9/28/16 + * + *------------------------------------------------------------------------- + */ +#ifndef NDEBUG +herr_t +H5AC_flush_dependency_exists(H5F_t *f, haddr_t parent_addr, haddr_t child_addr, + hbool_t *fd_exists_ptr) +{ + H5C_t *cache_ptr; /* Ptr to cache */ + herr_t ret_value = FAIL; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT_NOERR + + /* Sanity checks */ + HDassert(f); + HDassert(f->shared); + cache_ptr = f->shared->cache; + + ret_value = H5C_flush_dependency_exists(cache_ptr, parent_addr, child_addr, fd_exists_ptr); + + FUNC_LEAVE_NOAPI(ret_value) +} /* H5AC_flush_dependency_exists() */ +#endif /* NDEBUG */ + + +/*------------------------------------------------------------------------- + * + * Function: H5AC_verify_entry_type() + * + * Purpose: Debugging function that attempts to look up an entry in the + * cache by its file address, and if found, test to see if its + * type field contains the expected value. + * + * If the specified entry is in cache, *in_cache_ptr is set + * to TRUE, and *type_ok_ptr is set to TRUE or FALSE depending + * on whether the entries type field matches the + * expected_type parameter + * + * If the target entry is not in cache, *in_cache_ptr is + * set to FALSE, and *type_ok_ptr is undefined. + * + * Note that this function is only defined if NDEBUG + * is not defined. + * + * This function is just a wrapper that calls the H5C + * version of the function. + * + * Return: FAIL if error is detected, SUCCEED otherwise. + * + * Programmer: John Mainzer, 5/30/14 + * + * Changes: None. + * + * JRM -- 9/17/16 + * + *------------------------------------------------------------------------- + */ +#ifndef NDEBUG +herr_t +H5AC_verify_entry_type(const H5F_t *f, haddr_t addr, + const H5AC_class_t *expected_type, hbool_t *in_cache_ptr, + hbool_t *type_ok_ptr) +{ + H5C_t * cache_ptr; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity checks */ + HDassert(f); + HDassert(f->shared); + cache_ptr = f->shared->cache; + + if(H5C_verify_entry_type(cache_ptr, addr, expected_type, in_cache_ptr, type_ok_ptr) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C_verify_entry_type() failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5AC_verify_entry_type() */ +#endif /* NDEBUG */ + + +/*------------------------------------------------------------------------- + * Function: H5AC_get_serialization_in_progress + * + * Purpose: Return the current value of + * cache_ptr->serialization_in_progress. + * + * Return: Current value of cache_ptr->serialization_in_progress. + * + * Programmer: John Mainzer + * 8/24/15 + * + *------------------------------------------------------------------------- + */ +#ifndef NDEBUG +hbool_t +H5AC_get_serialization_in_progress(H5F_t *f) +{ + H5C_t * cache_ptr; + hbool_t ret_value = FALSE; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT_NOERR + + /* Sanity check */ + HDassert(f); + HDassert(f->shared); + cache_ptr = f->shared->cache; + + /* Set return value */ + ret_value = H5C_get_serialization_in_progress(cache_ptr); + + FUNC_LEAVE_NOAPI(ret_value) +} /* H5AC_get_serialization_in_progress() */ +#endif /* NDEBUG */ + + +/*------------------------------------------------------------------------- + * * Function: H5AC_cache_is_clean() * * Purpose: Debugging function that verifies that all rings in the @@ -274,7 +475,7 @@ hbool_t H5AC_cache_is_clean(const H5F_t *f, H5AC_ring_t inner_ring) { H5C_t *cache_ptr; - hbool_t ret_value; /* Return value */ + hbool_t ret_value = FALSE; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR diff --git a/src/H5ACmpio.c b/src/H5ACmpio.c index 44ffd9d..945aaba 100644 --- a/src/H5ACmpio.c +++ b/src/H5ACmpio.c @@ -81,7 +81,7 @@ typedef struct H5AC_addr_list_ud_t { H5AC_aux_t * aux_ptr; /* 'Auxiliary' parallel cache info */ haddr_t * addr_buf_ptr; /* Array to store addresses */ - int i; /* Counter for position in array */ + unsigned u; /* Counter for position in array */ } H5AC_addr_list_ud_t; @@ -90,21 +90,21 @@ typedef struct H5AC_addr_list_ud_t /********************/ static herr_t H5AC__broadcast_candidate_list(H5AC_t *cache_ptr, - int *num_entries_ptr, haddr_t **haddr_buf_ptr_ptr); + unsigned *num_entries_ptr, haddr_t **haddr_buf_ptr_ptr); static herr_t H5AC__broadcast_clean_list(H5AC_t *cache_ptr); static herr_t H5AC__construct_candidate_list(H5AC_t *cache_ptr, H5AC_aux_t *aux_ptr, int sync_point_op); static herr_t H5AC__copy_candidate_list_to_buffer(const H5AC_t *cache_ptr, - int *num_entries_ptr, haddr_t **haddr_buf_ptr_ptr); + unsigned *num_entries_ptr, haddr_t **haddr_buf_ptr_ptr); static herr_t H5AC__propagate_and_apply_candidate_list(H5F_t *f, hid_t dxpl_id); static herr_t H5AC__propagate_flushed_and_still_clean_entries_list(H5F_t *f, hid_t dxpl_id); -static herr_t H5AC__receive_haddr_list(MPI_Comm mpi_comm, int *num_entries_ptr, +static herr_t H5AC__receive_haddr_list(MPI_Comm mpi_comm, unsigned *num_entries_ptr, haddr_t **haddr_buf_ptr_ptr); static herr_t H5AC__receive_candidate_list(const H5AC_t *cache_ptr, - int *num_entries_ptr, haddr_t **haddr_buf_ptr_ptr); + unsigned *num_entries_ptr, haddr_t **haddr_buf_ptr_ptr); static herr_t H5AC__receive_and_apply_clean_list(H5F_t *f, hid_t dxpl_id); -static herr_t H5AC__tidy_cache_0_lists(H5AC_t *cache_ptr, int num_candidates, +static herr_t H5AC__tidy_cache_0_lists(H5AC_t *cache_ptr, unsigned num_candidates, haddr_t *candidates_list_ptr); static herr_t H5AC__rsp__dist_md_write__flush(H5F_t *f, hid_t dxpl_id); static herr_t H5AC__rsp__dist_md_write__flush_to_min_clean(H5F_t *f, hid_t dxpl_id); @@ -151,7 +151,7 @@ H5FL_DEFINE_STATIC(H5AC_slist_entry_t); */ herr_t H5AC__set_sync_point_done_callback(H5C_t * cache_ptr, - void (* sync_point_done)(int num_writes, haddr_t * written_entries_tbl)) + void (* sync_point_done)(unsigned num_writes, haddr_t * written_entries_tbl)) { H5AC_aux_t * aux_ptr; @@ -282,13 +282,13 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5AC__broadcast_candidate_list(H5AC_t *cache_ptr, int *num_entries_ptr, +H5AC__broadcast_candidate_list(H5AC_t *cache_ptr, unsigned *num_entries_ptr, haddr_t **haddr_buf_ptr_ptr) { H5AC_aux_t * aux_ptr = NULL; haddr_t * haddr_buf_ptr = NULL; int mpi_result; - int num_entries; + unsigned num_entries; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC @@ -310,13 +310,13 @@ H5AC__broadcast_candidate_list(H5AC_t *cache_ptr, int *num_entries_ptr, * receivers can set up buffers to receive them. If there aren't * any, we are done. */ - num_entries = (int)H5SL_count(aux_ptr->candidate_slist_ptr); - if(MPI_SUCCESS != (mpi_result = MPI_Bcast(&num_entries, 1, MPI_INT, 0, aux_ptr->mpi_comm))) + num_entries = (unsigned)H5SL_count(aux_ptr->candidate_slist_ptr); + if(MPI_SUCCESS != (mpi_result = MPI_Bcast(&num_entries, 1, MPI_UNSIGNED, 0, aux_ptr->mpi_comm))) HMPI_GOTO_ERROR(FAIL, "MPI_Bcast failed", mpi_result) if(num_entries > 0) { size_t buf_size = 0; - int chk_num_entries = 0; + unsigned chk_num_entries = 0; /* convert the candidate list into the format we * are used to receiving from process 0, and also load it @@ -328,7 +328,7 @@ H5AC__broadcast_candidate_list(H5AC_t *cache_ptr, int *num_entries_ptr, HDassert(haddr_buf_ptr != NULL); /* Now broadcast the list of candidate entries */ - buf_size = sizeof(haddr_t) * (size_t)num_entries; + buf_size = sizeof(haddr_t) * num_entries; if(MPI_SUCCESS != (mpi_result = MPI_Bcast((void *)haddr_buf_ptr, (int)buf_size, MPI_BYTE, 0, aux_ptr->mpi_comm))) HMPI_GOTO_ERROR(FAIL, "MPI_Bcast failed", mpi_result) } /* end if */ @@ -378,8 +378,8 @@ H5AC__broadcast_clean_list_cb(void *_item, void H5_ATTR_UNUSED *_key, /* Store the entry's address in the buffer */ addr = slist_entry_ptr->addr; - udata->addr_buf_ptr[udata->i] = addr; - udata->i++; + udata->addr_buf_ptr[udata->u] = addr; + udata->u++; /* now release the entry */ slist_entry_ptr = H5FL_FREE(H5AC_slist_entry_t, slist_entry_ptr); @@ -420,7 +420,7 @@ H5AC__broadcast_clean_list(H5AC_t * cache_ptr) haddr_t * addr_buf_ptr = NULL; H5AC_aux_t * aux_ptr; int mpi_result; - int num_entries = 0; + unsigned num_entries = 0; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC @@ -437,8 +437,8 @@ H5AC__broadcast_clean_list(H5AC_t * cache_ptr) * receives can set up a buffer to receive them. If there aren't * any, we are done. */ - num_entries = (int)H5SL_count(aux_ptr->c_slist_ptr); - if(MPI_SUCCESS != (mpi_result = MPI_Bcast(&num_entries, 1, MPI_INT, 0, aux_ptr->mpi_comm))) + num_entries = (unsigned)H5SL_count(aux_ptr->c_slist_ptr); + if(MPI_SUCCESS != (mpi_result = MPI_Bcast(&num_entries, 1, MPI_UNSIGNED, 0, aux_ptr->mpi_comm))) HMPI_GOTO_ERROR(FAIL, "MPI_Bcast failed", mpi_result) if(num_entries > 0) { @@ -446,14 +446,14 @@ H5AC__broadcast_clean_list(H5AC_t * cache_ptr) size_t buf_size; /* allocate a buffer to store the list of entry base addresses in */ - buf_size = sizeof(haddr_t) * (size_t)num_entries; + buf_size = sizeof(haddr_t) * num_entries; if(NULL == (addr_buf_ptr = (haddr_t *)H5MM_malloc(buf_size))) HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "memory allocation failed for addr buffer") /* Set up user data for callback */ udata.aux_ptr = aux_ptr; udata.addr_buf_ptr = addr_buf_ptr; - udata.i = 0; + udata.u = 0; /* Free all the clean list entries, building the address list in the callback */ /* (Callback also removes the matching entries from the dirtied list) */ @@ -568,8 +568,8 @@ H5AC__copy_candidate_list_to_buffer_cb(void *_item, void H5_ATTR_UNUSED *_key, HDassert(udata); /* Store the entry's address in the buffer */ - udata->addr_buf_ptr[udata->i] = slist_entry_ptr->addr; - udata->i++; + udata->addr_buf_ptr[udata->u] = slist_entry_ptr->addr; + udata->u++; /* now release the entry */ slist_entry_ptr = H5FL_FREE(H5AC_slist_entry_t, slist_entry_ptr); @@ -610,14 +610,14 @@ H5AC__copy_candidate_list_to_buffer_cb(void *_item, void H5_ATTR_UNUSED *_key, *------------------------------------------------------------------------- */ static herr_t -H5AC__copy_candidate_list_to_buffer(const H5AC_t *cache_ptr, int *num_entries_ptr, +H5AC__copy_candidate_list_to_buffer(const H5AC_t *cache_ptr, unsigned *num_entries_ptr, haddr_t **haddr_buf_ptr_ptr) { H5AC_aux_t * aux_ptr = NULL; H5AC_addr_list_ud_t udata; haddr_t * haddr_buf_ptr = NULL; size_t buf_size; - int num_entries = 0; + unsigned num_entries = 0; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC @@ -635,19 +635,19 @@ H5AC__copy_candidate_list_to_buffer(const H5AC_t *cache_ptr, int *num_entries_pt HDassert(haddr_buf_ptr_ptr != NULL); HDassert(*haddr_buf_ptr_ptr == NULL); - num_entries = (int)H5SL_count(aux_ptr->candidate_slist_ptr); + num_entries = (unsigned)H5SL_count(aux_ptr->candidate_slist_ptr); /* allocate a buffer(s) to store the list of candidate entry * base addresses in */ - buf_size = sizeof(haddr_t) * (size_t)num_entries; + buf_size = sizeof(haddr_t) * num_entries; if(NULL == (haddr_buf_ptr = (haddr_t *)H5MM_malloc(buf_size))) HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "memory allocation failed for haddr buffer") /* Set up user data for callback */ udata.aux_ptr = aux_ptr; udata.addr_buf_ptr = haddr_buf_ptr; - udata.i = 0; + udata.u = 0; /* Free all the candidate list entries, building the address list in the callback */ if(H5SL_free(aux_ptr->candidate_slist_ptr, H5AC__copy_candidate_list_to_buffer_cb, &udata) < 0) @@ -1234,7 +1234,7 @@ H5AC__propagate_and_apply_candidate_list(H5F_t *f, hid_t dxpl_id) H5AC_aux_t * aux_ptr; haddr_t * candidates_list_ptr = NULL; int mpi_result; - int num_candidates = 0; + unsigned num_candidates = 0; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC @@ -1448,12 +1448,12 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5AC__receive_haddr_list(MPI_Comm mpi_comm, int *num_entries_ptr, +H5AC__receive_haddr_list(MPI_Comm mpi_comm, unsigned *num_entries_ptr, haddr_t **haddr_buf_ptr_ptr) { haddr_t * haddr_buf_ptr = NULL; int mpi_result; - int num_entries; + unsigned num_entries; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC @@ -1468,14 +1468,14 @@ H5AC__receive_haddr_list(MPI_Comm mpi_comm, int *num_entries_ptr, * can set up a buffer to receive them. If there aren't * any, we are done. */ - if(MPI_SUCCESS != (mpi_result = MPI_Bcast(&num_entries, 1, MPI_INT, 0, mpi_comm))) + if(MPI_SUCCESS != (mpi_result = MPI_Bcast(&num_entries, 1, MPI_UNSIGNED, 0, mpi_comm))) HMPI_GOTO_ERROR(FAIL, "MPI_Bcast failed", mpi_result) if(num_entries > 0) { size_t buf_size; /* allocate buffers to store the list of entry base addresses in */ - buf_size = sizeof(haddr_t) * (size_t)num_entries; + buf_size = sizeof(haddr_t) * num_entries; if(NULL == (haddr_buf_ptr = (haddr_t *)H5MM_malloc(buf_size))) HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "memory allocation failed for haddr buffer") @@ -1523,7 +1523,7 @@ H5AC__receive_and_apply_clean_list(H5F_t *f, hid_t dxpl_id) H5AC_t * cache_ptr; H5AC_aux_t * aux_ptr; haddr_t * haddr_buf_ptr = NULL; - int num_entries = 0; + unsigned num_entries = 0; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC @@ -1543,7 +1543,7 @@ H5AC__receive_and_apply_clean_list(H5F_t *f, hid_t dxpl_id) if(num_entries > 0) /* mark the indicated entries as clean */ - if(H5C_mark_entries_as_clean(f, dxpl_id, (int32_t)num_entries, haddr_buf_ptr) < 0) + if(H5C_mark_entries_as_clean(f, dxpl_id, num_entries, haddr_buf_ptr) < 0) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't mark entries clean.") /* if it is defined, call the sync point done callback. Note @@ -1582,7 +1582,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5AC__receive_candidate_list(const H5AC_t *cache_ptr, int *num_entries_ptr, +H5AC__receive_candidate_list(const H5AC_t *cache_ptr, unsigned *num_entries_ptr, haddr_t **haddr_buf_ptr_ptr) { H5AC_aux_t * aux_ptr; @@ -1667,7 +1667,7 @@ H5AC__rsp__dist_md_write__flush(H5F_t *f, hid_t dxpl_id) H5AC_aux_t * aux_ptr; haddr_t * haddr_buf_ptr = NULL; int mpi_result; - int num_entries = 0; + unsigned num_entries = 0; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC @@ -2224,11 +2224,11 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5AC__tidy_cache_0_lists(H5AC_t *cache_ptr, int num_candidates, +H5AC__tidy_cache_0_lists(H5AC_t *cache_ptr, unsigned num_candidates, haddr_t *candidates_list_ptr) { H5AC_aux_t * aux_ptr; - int i; + unsigned u; FUNC_ENTER_STATIC_NOERR @@ -2249,12 +2249,12 @@ H5AC__tidy_cache_0_lists(H5AC_t *cache_ptr, int num_candidates, * cleaned list. However, for this metadata write strategy, * we just want to remove all references to the candidate entries. */ - for(i = 0; i < num_candidates; i++) { + for(u = 0; u < num_candidates; u++) { H5AC_slist_entry_t * d_slist_entry_ptr; H5AC_slist_entry_t * c_slist_entry_ptr; haddr_t addr; - addr = candidates_list_ptr[i]; + addr = candidates_list_ptr[u]; /* addr may be either on the dirtied list, or on the flushed * and still clean list. Remove it. diff --git a/src/H5ACpkg.h b/src/H5ACpkg.h index dbbd8a0..77ba0ae 100644 --- a/src/H5ACpkg.h +++ b/src/H5ACpkg.h @@ -351,6 +351,12 @@ H5FL_EXTERN(H5AC_aux_t); * this verification. The field is set to NULL when the * callback is not needed. * + * The following field supports the metadata cache image feature. + * + * p0_image_len: unsiged integer containing the length of the metadata cache + * image constructed by MPI process 0. This field should be 0 + * if the value is unknown, or if cache image is not enabled. + * ****************************************************************************/ #ifdef H5_HAVE_PARALLEL @@ -398,8 +404,11 @@ typedef struct H5AC_aux_t void (* write_done)(void); - void (* sync_point_done)(int num_writes, + void (* sync_point_done)(unsigned num_writes, haddr_t * written_entries_tbl); + + unsigned p0_image_len; + } H5AC_aux_t; /* struct H5AC_aux_t */ #endif /* H5_HAVE_PARALLEL */ @@ -421,7 +430,7 @@ H5_DLL herr_t H5AC__log_moved_entry(const H5F_t *f, haddr_t old_addr, H5_DLL herr_t H5AC__flush_entries(H5F_t *f, hid_t dxpl_id); H5_DLL herr_t H5AC__run_sync_point(H5F_t *f, hid_t dxpl_id, int sync_point_op); H5_DLL herr_t H5AC__set_sync_point_done_callback(H5C_t *cache_ptr, - void (*sync_point_done)(int num_writes, haddr_t *written_entries_tbl)); + void (*sync_point_done)(unsigned num_writes, haddr_t *written_entries_tbl)); H5_DLL herr_t H5AC__set_write_done_callback(H5C_t * cache_ptr, void (* write_done)(void)); #endif /* H5_HAVE_PARALLEL */ diff --git a/src/H5ACprivate.h b/src/H5ACprivate.h index 3dd6079..1fe6456 100644 --- a/src/H5ACprivate.h +++ b/src/H5ACprivate.h @@ -88,7 +88,7 @@ typedef enum { H5AC_DRVRINFO_ID, /* (26) driver info block (supplements superblock) */ H5AC_EPOCH_MARKER_ID, /* (27) epoch marker - always internal to cache */ H5AC_PROXY_ENTRY_ID, /* (28) cache entry proxy */ - H5AC_TEST_ID, /* (29) test entry -- not used for actual files */ + H5AC_PREFETCHED_ENTRY_ID, /* (29) prefetched entry - always internal to cache */ H5AC_NTYPES /* Number of types, must be last */ } H5AC_type_t; @@ -111,14 +111,22 @@ typedef enum { * use the dump_stats parameter to takedown_cache(), or call * H5C_stats() directly. * JRM -- 4/12/15 + * + * Added the H5AC_DUMP_IMAGE_STATS_ON_CLOSE #define, which works much + * the same way as H5AC_DUMP_STATS_ON_CLOSE. However, the set of stats + * displayed is much smaller, and directed purely at the cache image feature. + * + * JRM -- 11/1/15 */ #if H5C_COLLECT_CACHE_STATS #define H5AC_DUMP_STATS_ON_CLOSE 0 +#define H5AC_DUMP_IMAGE_STATS_ON_CLOSE 0 #else /* H5C_COLLECT_CACHE_STATS */ #define H5AC_DUMP_STATS_ON_CLOSE 0 +#define H5AC_DUMP_IMAGE_STATS_ON_CLOSE 0 #endif /* H5C_COLLECT_CACHE_STATS */ @@ -319,7 +327,13 @@ H5_DLLVAR hid_t H5AC_rawdata_dxpl_id; } #endif /* H5_HAVE_PARALLEL */ - +#define H5AC__DEFAULT_CACHE_IMAGE_CONFIG \ +{ \ + /* int32_t version = */ H5AC__CURR_CACHE_IMAGE_CONFIG_VERSION, \ + /* hbool_t generate_image = */ FALSE, \ + /* hbool_t save_resize_status = */ FALSE, \ + /* int32_t entry_ageout = */ H5AC__CACHE_IMAGE__ENTRY_AGEOUT__NONE \ +} /* * Library prototypes. */ @@ -344,7 +358,6 @@ H5_DLLVAR hid_t H5AC_rawdata_dxpl_id; #define H5AC__TAKE_OWNERSHIP_FLAG H5C__TAKE_OWNERSHIP_FLAG #define H5AC__FLUSH_LAST_FLAG H5C__FLUSH_LAST_FLAG #define H5AC__FLUSH_COLLECTIVELY_FLAG H5C__FLUSH_COLLECTIVELY_FLAG -#define H5AC__EVICT_ALLOW_LAST_PINS_FLAG H5C__EVICT_ALLOW_LAST_PINS_FLAG /* #defines of flags used to report entry status in the @@ -360,11 +373,44 @@ H5_DLLVAR hid_t H5AC_rawdata_dxpl_id; #define H5AC_ES__IS_CORKED 0x0040 #define H5AC_ES__IMAGE_IS_UP_TO_DATE 0x0080 +/* Metadata entry class declarations */ +H5_DLLVAR const H5AC_class_t H5AC_BT[1]; +H5_DLLVAR const H5AC_class_t H5AC_SNODE[1]; +H5_DLLVAR const H5AC_class_t H5AC_LHEAP_PRFX[1]; +H5_DLLVAR const H5AC_class_t H5AC_LHEAP_DBLK[1]; +H5_DLLVAR const H5AC_class_t H5AC_GHEAP[1]; +H5_DLLVAR const H5AC_class_t H5AC_OHDR[1]; +H5_DLLVAR const H5AC_class_t H5AC_OHDR_CHK[1]; +H5_DLLVAR const H5AC_class_t H5AC_BT2_HDR[1]; +H5_DLLVAR const H5AC_class_t H5AC_BT2_INT[1]; +H5_DLLVAR const H5AC_class_t H5AC_BT2_LEAF[1]; +H5_DLLVAR const H5AC_class_t H5AC_FHEAP_HDR[1]; +H5_DLLVAR const H5AC_class_t H5AC_FHEAP_DBLOCK[1]; +H5_DLLVAR const H5AC_class_t H5AC_FHEAP_IBLOCK[1]; +H5_DLLVAR const H5AC_class_t H5AC_FSPACE_HDR[1]; +H5_DLLVAR const H5AC_class_t H5AC_FSPACE_SINFO[1]; +H5_DLLVAR const H5AC_class_t H5AC_SOHM_TABLE[1]; +H5_DLLVAR const H5AC_class_t H5AC_SOHM_LIST[1]; +H5_DLLVAR const H5AC_class_t H5AC_EARRAY_HDR[1]; +H5_DLLVAR const H5AC_class_t H5AC_EARRAY_IBLOCK[1]; +H5_DLLVAR const H5AC_class_t H5AC_EARRAY_SBLOCK[1]; +H5_DLLVAR const H5AC_class_t H5AC_EARRAY_DBLOCK[1]; +H5_DLLVAR const H5AC_class_t H5AC_EARRAY_DBLK_PAGE[1]; +H5_DLLVAR const H5AC_class_t H5AC_FARRAY_HDR[1]; +H5_DLLVAR const H5AC_class_t H5AC_FARRAY_DBLOCK[1]; +H5_DLLVAR const H5AC_class_t H5AC_FARRAY_DBLK_PAGE[1]; +H5_DLLVAR const H5AC_class_t H5AC_SUPERBLOCK[1]; +H5_DLLVAR const H5AC_class_t H5AC_DRVRINFO[1]; +H5_DLLVAR const H5AC_class_t H5AC_EPOCH_MARKER[1]; +H5_DLLVAR const H5AC_class_t H5AC_PROXY_ENTRY[1]; +H5_DLLVAR const H5AC_class_t H5AC_PREFETCHED_ENTRY[1]; + /* external function declarations: */ H5_DLL herr_t H5AC_init(void); -H5_DLL herr_t H5AC_create(const H5F_t *f, H5AC_cache_config_t *config_ptr); +H5_DLL herr_t H5AC_create(const H5F_t *f, H5AC_cache_config_t *config_ptr, + H5AC_cache_image_config_t * image_config_ptr); H5_DLL herr_t H5AC_get_entry_status(const H5F_t *f, haddr_t addr, unsigned *status_ptr); H5_DLL herr_t H5AC_insert_entry(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, @@ -394,13 +440,18 @@ H5_DLL herr_t H5AC_remove_entry(void *entry); H5_DLL herr_t H5AC_get_cache_auto_resize_config(const H5AC_t * cache_ptr, H5AC_cache_config_t *config_ptr); H5_DLL herr_t H5AC_get_cache_size(H5AC_t *cache_ptr, size_t *max_size_ptr, - size_t *min_clean_size_ptr, size_t *cur_size_ptr, int32_t *cur_num_entries_ptr); + size_t *min_clean_size_ptr, size_t *cur_size_ptr, uint32_t *cur_num_entries_ptr); H5_DLL herr_t H5AC_get_cache_hit_rate(H5AC_t *cache_ptr, double *hit_rate_ptr); H5_DLL herr_t H5AC_reset_cache_hit_rate_stats(H5AC_t *cache_ptr); H5_DLL herr_t H5AC_set_cache_auto_resize_config(H5AC_t *cache_ptr, H5AC_cache_config_t *config_ptr); H5_DLL herr_t H5AC_validate_config(H5AC_cache_config_t *config_ptr); +/* Cache image routines */ +H5_DLL herr_t H5AC_load_cache_image_on_next_protect(H5F_t *f, haddr_t addr, + hsize_t len, hbool_t rw); +H5_DLL herr_t H5AC_validate_cache_image_config(H5AC_cache_image_config_t *config_ptr); + /* Tag & Ring routines */ H5_DLL herr_t H5AC_tag(hid_t dxpl_id, haddr_t metadata_tag, haddr_t *prev_tag); H5_DLL herr_t H5AC_flush_tagged_metadata(H5F_t * f, haddr_t metadata_tag, hid_t dxpl_id); @@ -433,6 +484,14 @@ H5_DLL herr_t H5AC_add_candidate(H5AC_t * cache_ptr, haddr_t addr); H5_DLL herr_t H5AC_stats(const H5F_t *f); H5_DLL herr_t H5AC_dump_cache(const H5F_t *f); #ifndef NDEBUG +H5_DLL herr_t H5AC_get_entry_ptr_from_addr(const H5F_t *f, haddr_t addr, + void **entry_ptr_ptr); +H5_DLL herr_t H5AC_flush_dependency_exists(H5F_t *f, haddr_t parent_addr, + haddr_t child_addr, hbool_t *fd_exists_ptr); +H5_DLL herr_t H5AC_verify_entry_type(const H5F_t *f, haddr_t addr, + const H5AC_class_t *expected_type, hbool_t *in_cache_ptr, + hbool_t *type_ok_ptr); +H5_DLL hbool_t H5AC_get_serialization_in_progress(H5F_t *f); H5_DLL hbool_t H5AC_cache_is_clean(const H5F_t *f, H5AC_ring_t inner_ring); #endif /* NDEBUG */ /* end debugging functions */ diff --git a/src/H5ACpublic.h b/src/H5ACpublic.h index dd16764..5fdb3f4 100644 --- a/src/H5ACpublic.h +++ b/src/H5ACpublic.h @@ -508,6 +508,67 @@ typedef struct H5AC_cache_config_t } H5AC_cache_config_t; +/**************************************************************************** + * + * structure H5AC_cache_image_config_t + * + * H5AC_cache_image_ctl_t is a public structure intended for use in public + * APIs. At least in its initial incarnation, it is a copy of struct + * H5C_cache_image_ctl_t. + * + * The fields of the structure are discussed individually below: + * + * version: Integer field containing the version number of this version + * of the H5C_image_ctl_t structure. Any instance of + * H5C_image_ctl_t passed to the cache must have a known + * version number, or an error will be flagged. + * + * generate_image: Boolean flag indicating whether a cache image should + * be created on file close. + * + * save_resize_status: Boolean flag indicating whether the cache image + * should include the adaptive cache resize configuration and status. + * Note that this field is ignored at present. + * + * entry_ageout: Integer field indicating the maximum number of + * times a prefetched entry can appear in subsequent cache images. + * This field exists to allow the user to avoid the buildup of + * infrequently used entries in long sequences of cache images. + * + * The value of this field must lie in the range + * H5AC__CACHE_IMAGE__ENTRY_AGEOUT__NONE (-1) to + * H5AC__CACHE_IMAGE__ENTRY_AGEOUT__MAX (100). + * + * H5AC__CACHE_IMAGE__ENTRY_AGEOUT__NONE means that no limit + * is imposed on number of times a prefeteched entry can appear + * in subsequent cache images. + * + * A value of 0 prevents prefetched entries from being included + * in cache images. + * + * Positive integers restrict prefetched entries to the specified + * number of appearances. + * + * Note that the number of subsequent cache images that a prefetched + * entry has appeared in is tracked in an 8 bit field. Thus, while + * H5AC__CACHE_IMAGE__ENTRY_AGEOUT__MAX can be increased from its + * current value, any value in excess of 255 will be the functional + * equivalent of H5AC__CACHE_IMAGE__ENTRY_AGEOUT__NONE. + * + ****************************************************************************/ + +#define H5AC__CURR_CACHE_IMAGE_CONFIG_VERSION 1 + +#define H5AC__CACHE_IMAGE__ENTRY_AGEOUT__NONE -1 +#define H5AC__CACHE_IMAGE__ENTRY_AGEOUT__MAX 100 + +typedef struct H5AC_cache_image_config_t { + int32_t version; + hbool_t generate_image; + hbool_t save_resize_status; + int32_t entry_ageout; +} H5AC_cache_image_config_t; + #ifdef __cplusplus } #endif diff --git a/src/H5B2pkg.h b/src/H5B2pkg.h index 7b1ec4d..71fdfde 100644 --- a/src/H5B2pkg.h +++ b/src/H5B2pkg.h @@ -307,15 +307,6 @@ typedef struct H5B2_node_info_test_t { /* Package Private Variables */ /*****************************/ -/* H5B2 header inherits cache-like properties from H5AC */ -H5_DLLVAR const H5AC_class_t H5AC_BT2_HDR[1]; - -/* H5B2 internal node inherits cache-like properties from H5AC */ -H5_DLLVAR const H5AC_class_t H5AC_BT2_INT[1]; - -/* H5B2 leaf node inherits cache-like properties from H5AC */ -H5_DLLVAR const H5AC_class_t H5AC_BT2_LEAF[1]; - /* Declare a free list to manage the H5B2_internal_t struct */ H5FL_EXTERN(H5B2_internal_t); diff --git a/src/H5Bpkg.h b/src/H5Bpkg.h index 41e0951..fb93b8a 100644 --- a/src/H5Bpkg.h +++ b/src/H5Bpkg.h @@ -73,9 +73,6 @@ typedef struct H5B_cache_ud_t { /* Package Private Variables */ /*****************************/ -/* H5B header inherits cache-like properties from H5AC */ -H5_DLLVAR const H5AC_class_t H5AC_BT[1]; - /* Declare a free list to manage the haddr_t sequence information */ H5FL_SEQ_EXTERN(haddr_t); diff --git a/src/H5C.c b/src/H5C.c index 4adee6d..805b4f5 100644 --- a/src/H5C.c +++ b/src/H5C.c @@ -46,9 +46,9 @@ * - Change protect/unprotect to lock/unlock. * * - Flush entries in increasing address order in - * H5C_make_space_in_cache(). + * H5C__make_space_in_cache(). * - * - Also in H5C_make_space_in_cache(), use high and low water marks + * - Also in H5C__make_space_in_cache(), use high and low water marks * to reduce the number of I/O calls. * * - When flushing, attempt to combine contiguous entries to reduce @@ -75,7 +75,7 @@ /****************/ #include "H5Cmodule.h" /* This source code file is part of the H5C module */ -#define H5F_FRIEND /*suppress error about including H5Fpkg */ +#define H5F_FRIEND /* suppress error about including H5Fpkg */ /***********/ @@ -155,21 +155,17 @@ static void * H5C_load_entry(H5F_t * f, haddr_t addr, void * udata); -static herr_t H5C_make_space_in_cache(H5F_t * f, - hid_t dxpl_id, - size_t space_needed, - hbool_t write_permitted); - static herr_t H5C__mark_flush_dep_dirty(H5C_cache_entry_t * entry); static herr_t H5C__mark_flush_dep_clean(H5C_cache_entry_t * entry); +static herr_t H5C__serialize_ring(H5F_t *f, hid_t dxpl_id, H5C_ring_t ring); +static herr_t H5C__serialize_single_entry(H5F_t *f, hid_t dxpl_id, + H5C_t *cache_ptr, H5C_cache_entry_t *entry_ptr); + static herr_t H5C__verify_len_eoa(H5F_t *f, const H5C_class_t * type, haddr_t addr, size_t *len, hbool_t actual); -static herr_t H5C__generate_image(H5F_t *f, H5C_t * cache_ptr, H5C_cache_entry_t *entry_ptr, - hid_t dxpl_id); - #if H5C_DO_SLIST_SANITY_CHECKS static hbool_t H5C_entry_in_skip_list(H5C_t * cache_ptr, H5C_cache_entry_t *target_ptr); @@ -243,7 +239,7 @@ H5C_t * H5C_create(size_t max_cache_size, size_t min_clean_size, int max_type_id, - const char * (* type_name_table_ptr), + const H5C_class_t * const * class_table_ptr, H5C_write_permitted_func_t check_write_permitted, hbool_t write_permitted, H5C_log_flush_func_t log_flush, @@ -261,21 +257,21 @@ H5C_create(size_t max_cache_size, HDassert( max_type_id >= 0 ); HDassert( max_type_id < H5C__MAX_NUM_TYPE_IDS ); - HDassert( type_name_table_ptr ); + HDassert( class_table_ptr ); for ( i = 0; i <= max_type_id; i++ ) { - HDassert( (type_name_table_ptr)[i] ); - HDassert( HDstrlen(( type_name_table_ptr)[i]) > 0 ); + HDassert( (class_table_ptr)[i] ); + HDassert(HDstrlen((class_table_ptr)[i]->name) > 0); } /* end for */ if(NULL == (cache_ptr = H5FL_CALLOC(H5C_t))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") if(NULL == (cache_ptr->slist_ptr = H5SL_create(H5SL_TYPE_HADDR, NULL))) - HGOTO_ERROR(H5E_CACHE, H5E_CANTCREATE, NULL, "can't create skip list.") + HGOTO_ERROR(H5E_CACHE, H5E_CANTCREATE, NULL, "can't create skip list") if(NULL == (cache_ptr->tag_list = H5SL_create(H5SL_TYPE_HADDR, NULL))) - HGOTO_ERROR(H5E_CACHE, H5E_CANTCREATE, NULL, "can't create skip list for tagged entry addresses.") + HGOTO_ERROR(H5E_CACHE, H5E_CANTCREATE, NULL, "can't create skip list for tagged entry addresses") /* If we get this far, we should succeed. Go ahead and initialize all * the fields. @@ -297,7 +293,7 @@ H5C_create(size_t max_cache_size, cache_ptr->max_type_id = max_type_id; - cache_ptr->type_name_table_ptr = type_name_table_ptr; + cache_ptr->class_table_ptr = class_table_ptr; cache_ptr->max_cache_size = max_cache_size; cache_ptr->min_clean_size = min_clean_size; @@ -389,6 +385,7 @@ H5C_create(size_t max_cache_size, cache_ptr->resize_enabled = FALSE; cache_ptr->cache_full = FALSE; cache_ptr->size_decreased = FALSE; + cache_ptr->resize_in_progress = FALSE; (cache_ptr->resize_ctl).version = H5C__CURR_AUTO_SIZE_CTL_VER; (cache_ptr->resize_ctl).rpt_fcn = NULL; @@ -434,28 +431,52 @@ H5C_create(size_t max_cache_size, ((cache_ptr->epoch_markers)[i]).magic = H5C__H5C_CACHE_ENTRY_T_MAGIC; ((cache_ptr->epoch_markers)[i]).addr = (haddr_t)i; - ((cache_ptr->epoch_markers)[i]).type = &H5C__epoch_marker_class; + ((cache_ptr->epoch_markers)[i]).type = H5AC_EPOCH_MARKER; } + /* Initialize cache image generation on file close related fields. + * Initial value of image_ctl must match H5C__DEFAULT_CACHE_IMAGE_CTL + * in H5Cprivate.h. + */ + cache_ptr->image_ctl.version = H5C__CURR_CACHE_IMAGE_CTL_VER; + cache_ptr->image_ctl.generate_image = FALSE; + cache_ptr->image_ctl.save_resize_status = FALSE; + cache_ptr->image_ctl.entry_ageout = -1; + cache_ptr->image_ctl.flags = H5C_CI__ALL_FLAGS; + + cache_ptr->serialization_in_progress= FALSE; + cache_ptr->load_image = FALSE; + cache_ptr->image_loaded = FALSE; + cache_ptr->delete_image = FALSE; + cache_ptr->image_addr = HADDR_UNDEF; + cache_ptr->image_len = 0; + cache_ptr->image_data_len = 0; + cache_ptr->entries_loaded_counter = 0; cache_ptr->entries_inserted_counter = 0; cache_ptr->entries_relocated_counter = 0; + cache_ptr->entry_fd_height_change_counter = 0; + + cache_ptr->num_entries_in_image = 0; + cache_ptr->image_entries = NULL; + cache_ptr->image_buffer = NULL; /* initialize free space manager related fields: */ cache_ptr->rdfsm_settled = FALSE; cache_ptr->mdfsm_settled = FALSE; - if ( H5C_reset_cache_hit_rate_stats(cache_ptr) != SUCCEED ) { - + if(H5C_reset_cache_hit_rate_stats(cache_ptr) < 0) /* this should be impossible... */ - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, NULL, \ - "H5C_reset_cache_hit_rate_stats failed.") - } + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, NULL, "H5C_reset_cache_hit_rate_stats failed") H5C_stats__reset(cache_ptr); cache_ptr->prefix[0] = '\0'; /* empty string */ +#ifndef NDEBUG + cache_ptr->get_entry_ptr_from_addr_counter = 0; +#endif /* NDEBUG */ + /* Set return value */ ret_value = cache_ptr; @@ -733,6 +754,11 @@ H5C_prep_for_file_close(H5F_t *f, hid_t dxpl_id) /* Make certain there aren't any protected entries */ HDassert(cache_ptr->pl_len == 0); + /* Prepare cache image */ + if(H5C__prep_image_for_file_close(f, dxpl_id) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTCREATE, FAIL, "can't create cache image") + + done: FUNC_LEAVE_NOAPI(ret_value) } /* H5C_prep_for_file_close() */ @@ -775,10 +801,20 @@ H5C_dest(H5F_t * f, hid_t dxpl_id) HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); HDassert(cache_ptr->close_warning_received); +#if H5AC_DUMP_IMAGE_STATS_ON_CLOSE + if(H5C_image_stats(cache_ptr, TRUE) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't display cache image stats") +#endif /* H5AC_DUMP_IMAGE_STATS_ON_CLOSE */ + /* Flush and invalidate all cache entries */ if(H5C_flush_invalidate_cache(f, dxpl_id, H5C__NO_FLAGS_SET) < 0 ) HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush cache") + /* Generate & write cache image if requested */ + if(cache_ptr->image_ctl.generate_image) + if(H5C__generate_cache_image(f, dxpl_id, cache_ptr) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTCREATE, FAIL, "Can't generate metadata cache image") + if(cache_ptr->slist_ptr != NULL) { H5SL_close(cache_ptr->slist_ptr); cache_ptr->slist_ptr = NULL; @@ -790,6 +826,12 @@ H5C_dest(H5F_t * f, hid_t dxpl_id) } /* end if */ #ifndef NDEBUG +#if H5C_DO_SANITY_CHECKS + if(cache_ptr->get_entry_ptr_from_addr_counter > 0) + HDfprintf(stdout, "*** %ld calls to H5C_get_entry_ptr_from_add(). ***\n", + cache_ptr->get_entry_ptr_from_addr_counter); +#endif /* H5C_DO_SANITY_CHECKS */ + cache_ptr->magic = 0; #endif /* NDEBUG */ @@ -815,14 +857,12 @@ done: herr_t H5C_evict(H5F_t * f, hid_t dxpl_id) { - H5C_t *cache_ptr = f->shared->cache; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ - HDassert(cache_ptr); - HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); + HDassert(f); /* Flush and invalidate all cache entries except the pinned entries */ if(H5C_flush_invalidate_cache(f, dxpl_id, H5C__EVICT_ALLOW_LAST_PINS_FLAG) < 0 ) @@ -868,7 +908,7 @@ H5C_expunge_entry(H5F_t *f, hid_t dxpl_id, const H5C_class_t *type, #if H5C_DO_EXTREME_SANITY_CHECKS if(H5C_validate_lru_list(cache_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "LRU extreme sanity check failed on entry.\n") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "LRU extreme sanity check failed on entry") #endif /* H5C_DO_EXTREME_SANITY_CHECKS */ /* Look for entry in cache */ @@ -882,9 +922,9 @@ H5C_expunge_entry(H5F_t *f, hid_t dxpl_id, const H5C_class_t *type, /* Check for entry being pinned or protected */ if(entry_ptr->is_protected) - HGOTO_ERROR(H5E_CACHE, H5E_CANTEXPUNGE, FAIL, "Target entry is protected.") + HGOTO_ERROR(H5E_CACHE, H5E_CANTEXPUNGE, FAIL, "Target entry is protected") if(entry_ptr->is_pinned) - HGOTO_ERROR(H5E_CACHE, H5E_CANTEXPUNGE, FAIL, "Target entry is pinned.") + HGOTO_ERROR(H5E_CACHE, H5E_CANTEXPUNGE, FAIL, "Target entry is pinned") #ifdef H5_HAVE_PARALLEL if(entry_ptr->coll_access) { entry_ptr->coll_access = FALSE; @@ -909,7 +949,7 @@ H5C_expunge_entry(H5F_t *f, hid_t dxpl_id, const H5C_class_t *type, done: #if H5C_DO_EXTREME_SANITY_CHECKS if(H5C_validate_lru_list(cache_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "LRU extreme sanity check failed on exit.\n") + HDONE_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "LRU extreme sanity check failed on exit") #endif /* H5C_DO_EXTREME_SANITY_CHECKS */ FUNC_LEAVE_NOAPI(ret_value) @@ -968,12 +1008,12 @@ H5C_flush_cache(H5F_t *f, hid_t dxpl_id, unsigned flags) { #if H5C_DO_SANITY_CHECKS int i; - int32_t index_len = 0; + uint32_t index_len = 0; size_t index_size = (size_t)0; size_t clean_index_size = (size_t)0; size_t dirty_index_size = (size_t)0; size_t slist_size = (size_t)0; - int32_t slist_len = 0; + uint32_t slist_len = 0; #endif /* H5C_DO_SANITY_CHECKS */ H5C_ring_t ring; H5C_t * cache_ptr; @@ -1020,7 +1060,7 @@ H5C_flush_cache(H5F_t *f, hid_t dxpl_id, unsigned flags) if((H5C_validate_protected_entry_list(cache_ptr) < 0) || (H5C_validate_pinned_entry_list(cache_ptr) < 0) || (H5C_validate_lru_list(cache_ptr) < 0)) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on entry.\n") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on entry") #endif /* H5C_DO_EXTREME_SANITY_CHECKS */ ignore_protected = ( (flags & H5C__FLUSH_IGNORE_PROTECTED_FLAG) != 0 ); @@ -1032,7 +1072,7 @@ H5C_flush_cache(H5F_t *f, hid_t dxpl_id, unsigned flags) if(destroy) { if(H5C_flush_invalidate_cache(f, dxpl_id, flags) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "flush invalidate failed.") + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "flush invalidate failed") } /* end if */ else { /* flush each ring, starting from the outermost ring and @@ -1040,9 +1080,9 @@ H5C_flush_cache(H5F_t *f, hid_t dxpl_id, unsigned flags) */ ring = H5C_RING_USER; while(ring < H5C_RING_NTYPES) { - /* only call the free space manager settle routines when close - * warning has been received, and then only when the index is - * non-empty for that ring. + + /* Only call the free space manager settle routines when close + * warning has been received. */ if(cache_ptr->close_warning_received) { switch(ring) { @@ -1050,36 +1090,20 @@ H5C_flush_cache(H5F_t *f, hid_t dxpl_id, unsigned flags) break; case H5C_RING_RDFSM: - if(!cache_ptr->rdfsm_settled) { - hbool_t fsm_settled = FALSE; /* Whether the FSM was actually settled */ - - /* Settle raw data FSM */ - if(H5MF_settle_raw_data_fsm(f, dxpl_id, &fsm_settled) < 0) + /* Settle raw data FSM */ + if(!cache_ptr->rdfsm_settled) + if(H5MF_settle_raw_data_fsm(f, dxpl_id, &cache_ptr->rdfsm_settled) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "RD FSM settle failed") - - /* Only set the flag if the FSM was actually settled */ - if(fsm_settled) - cache_ptr->rdfsm_settled = TRUE; - } /* end if */ break; case H5C_RING_MDFSM: - if(!cache_ptr->mdfsm_settled) { - hbool_t fsm_settled = FALSE; /* Whether the FSM was actually settled */ - - /* Settle metadata FSM */ - if(H5MF_settle_meta_data_fsm(f, dxpl_id, &fsm_settled) < 0) + /* Settle metadata FSM */ + if(!cache_ptr->mdfsm_settled) + if(H5MF_settle_meta_data_fsm(f, dxpl_id, &cache_ptr->mdfsm_settled) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "MD FSM settle failed") - - /* Only set the flag if the FSM was actually settled */ - if(fsm_settled) - cache_ptr->mdfsm_settled = TRUE; - } /* end if */ break; case H5C_RING_SBE: - break; - case H5C_RING_SB: break; @@ -1090,7 +1114,7 @@ H5C_flush_cache(H5F_t *f, hid_t dxpl_id, unsigned flags) } /* end if */ if(H5C_flush_ring(f, dxpl_id, ring, flags) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "flush ring failed.") + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "flush ring failed") ring++; } /* end while */ } /* end else */ @@ -1131,7 +1155,6 @@ H5C_flush_to_min_clean(H5F_t * f, hid_t dxpl_id) { H5C_t * cache_ptr; - herr_t result; hbool_t write_permitted; #if 0 /* modified code -- commented out for now */ /* JRM */ int i; @@ -1153,36 +1176,19 @@ H5C_flush_to_min_clean(H5F_t * f, HDassert( cache_ptr ); HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC ); - if ( cache_ptr->check_write_permitted != NULL ) { - - result = (cache_ptr->check_write_permitted)(f, &write_permitted); - - if ( result < 0 ) { - - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ - "Can't get write_permitted") - } - } else { - + if(cache_ptr->check_write_permitted != NULL) { + if((cache_ptr->check_write_permitted)(f, &write_permitted) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "can't get write_permitted") + } /* end if */ + else write_permitted = cache_ptr->write_permitted; - } - if ( ! write_permitted ) { + if(!write_permitted) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "cache write is not permitted!?!") - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ - "cache write is not permitted!?!\n"); - } #if 1 /* original code */ - result = H5C_make_space_in_cache(f, - dxpl_id, - (size_t)0, - write_permitted); - - if ( result < 0 ) { - - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ - "H5C_make_space_in_cache failed.") - } + if(H5C__make_space_in_cache(f, dxpl_id, (size_t)0, write_permitted) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C__make_space_in_cache failed") #else /* modified code -- commented out for now */ if ( cache_ptr->max_cache_size > cache_ptr->index_size ) { @@ -1220,12 +1226,8 @@ H5C_flush_to_min_clean(H5F_t * f, */ flushed_entries_list = (haddr_t *)H5MM_malloc(sizeof(haddr_t) * (size_t)(cache_ptr->slist_len)); - - if ( flushed_entries_list == NULL ) { - - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, \ - "memory allocation failed for flushed entries list") - } + if(flushed_entries_list == NULL) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for flushed entries list") /* Scan the dirty LRU list from tail forward and mark sufficient * entries to free up the necessary space. Keep a list of the @@ -1255,13 +1257,8 @@ H5C_flush_to_min_clean(H5F_t * f, /* Flush the marked entries */ - result = H5C_flush_cache(f, primary_dxpl_id, secondary_dxpl_id, - H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_IGNORE_PROTECTED_FLAG); - - if ( result < 0 ) { - - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C_flush_cache failed.") - } + if(H5C_flush_cache(f, primary_dxpl_id, secondary_dxpl_id, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_IGNORE_PROTECTED_FLAG) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C_flush_cache failed") /* Now touch up the LRU list so as to place the flushed entries in * the order they they would be in if we had flushed them in the @@ -1336,8 +1333,9 @@ H5C_insert_entry(H5F_t * f, hbool_t set_flush_marker; hbool_t write_permitted = TRUE; size_t empty_space; - H5C_cache_entry_t *entry_ptr; + H5C_cache_entry_t *entry_ptr = NULL; H5C_cache_entry_t *test_entry_ptr; + hbool_t entry_tagged = FALSE; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -1350,6 +1348,7 @@ H5C_insert_entry(H5F_t * f, HDassert( cache_ptr ); HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC ); HDassert( type ); + HDassert( type->mem_type == cache_ptr->class_table_ptr[type->id]->mem_type ); HDassert( type->image_len ); HDassert( H5F_addr_defined(addr) ); HDassert( thing ); @@ -1357,14 +1356,10 @@ H5C_insert_entry(H5F_t * f, #if H5C_DO_EXTREME_SANITY_CHECKS /* no need to verify that entry is not already in the index as */ /* we already make that check below. */ - - if ( ( H5C_validate_protected_entry_list(cache_ptr) < 0 ) || - ( H5C_validate_pinned_entry_list(cache_ptr) < 0 ) || - ( H5C_validate_lru_list(cache_ptr) < 0 ) ) { - - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ - "an extreme sanity check failed on entry.\n"); - } + if((H5C_validate_protected_entry_list(cache_ptr) < 0) || + (H5C_validate_pinned_entry_list(cache_ptr) < 0) || + (H5C_validate_lru_list(cache_ptr) < 0)) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on entry") #endif /* H5C_DO_EXTREME_SANITY_CHECKS */ set_flush_marker = ( (flags & H5C__SET_FLUSH_MARKER_FLAG) != 0 ); @@ -1389,9 +1384,9 @@ H5C_insert_entry(H5F_t * f, if(test_entry_ptr != NULL) { if(test_entry_ptr == entry_ptr) - HGOTO_ERROR(H5E_CACHE, H5E_CANTINS, FAIL, "entry already in cache.") + HGOTO_ERROR(H5E_CACHE, H5E_CANTINS, FAIL, "entry already in cache") else - HGOTO_ERROR(H5E_CACHE, H5E_CANTINS, FAIL, "duplicate entry in cache.") + HGOTO_ERROR(H5E_CACHE, H5E_CANTINS, FAIL, "duplicate entry in cache") } /* end if */ entry_ptr->magic = H5C__H5C_CACHE_ENTRY_T_MAGIC; @@ -1458,16 +1453,33 @@ H5C_insert_entry(H5F_t * f, entry_ptr->coll_prev = NULL; #endif /* H5_HAVE_PARALLEL */ + /* initialize cache image related fields */ + entry_ptr->include_in_image = FALSE; + entry_ptr->lru_rank = 0; + entry_ptr->image_dirty = FALSE; + entry_ptr->fd_parent_count = 0; + entry_ptr->fd_parent_addrs = NULL; + entry_ptr->fd_child_count = 0; + entry_ptr->fd_dirty_child_count = 0; + entry_ptr->image_fd_height = 0; + entry_ptr->prefetched = FALSE; + entry_ptr->prefetch_type_id = 0; + entry_ptr->age = 0; +#ifndef NDEBUG /* debugging field */ + entry_ptr->serialization_count = 0; +#endif /* NDEBUG */ + /* Apply tag to newly inserted entry */ if(H5C__tag_entry(cache_ptr, entry_ptr, dxpl_id) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, FAIL, "Cannot tag metadata entry") + entry_tagged = TRUE; H5C__RESET_CACHE_ENTRY_STATS(entry_ptr) if(cache_ptr->flash_size_increase_possible && (entry_ptr->size > cache_ptr->flash_size_increase_threshold)) if(H5C__flash_increase_cache_size(cache_ptr, 0, entry_ptr->size) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTINS, FAIL, "H5C__flash_increase_cache_size failed.") + HGOTO_ERROR(H5E_CACHE, H5E_CANTINS, FAIL, "H5C__flash_increase_cache_size failed") if(cache_ptr->index_size >= cache_ptr->max_cache_size) empty_space = 0; @@ -1497,7 +1509,7 @@ H5C_insert_entry(H5F_t * f, /* Note that space_needed is just the amount of space that * needed to insert the new entry without exceeding the cache - * size limit. The subsequent call to H5C_make_space_in_cache() + * size limit. The subsequent call to H5C__make_space_in_cache() * may evict the entries required to free more or less space * depending on conditions. It MAY be less if the cache is * currently undersized, or more if the cache is oversized. @@ -1520,9 +1532,9 @@ H5C_insert_entry(H5F_t * f, * no point in worrying about the third. */ - if(H5C_make_space_in_cache(f, dxpl_id, space_needed, write_permitted) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTINS, FAIL, "H5C_make_space_in_cache failed.") - } + if(H5C__make_space_in_cache(f, dxpl_id, space_needed, write_permitted) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTINS, FAIL, "H5C__make_space_in_cache failed") + } /* end if */ H5C__INSERT_IN_INDEX(cache_ptr, entry_ptr, FAIL) @@ -1533,10 +1545,10 @@ H5C_insert_entry(H5F_t * f, H5C__UPDATE_RP_FOR_INSERTION(cache_ptr, entry_ptr, FAIL) #if H5C_DO_EXTREME_SANITY_CHECKS - if ( ( H5C_validate_protected_entry_list(cache_ptr) < 0 ) || - ( H5C_validate_pinned_entry_list(cache_ptr) < 0 ) || - ( H5C_validate_lru_list(cache_ptr) < 0 ) ) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed just before done.\n") + if((H5C_validate_protected_entry_list(cache_ptr) < 0) || + (H5C_validate_pinned_entry_list(cache_ptr) < 0) || + (H5C_validate_lru_list(cache_ptr) < 0)) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed just before done") #endif /* H5C_DO_EXTREME_SANITY_CHECKS */ /* If the entry's type has a 'notify' callback send a 'after insertion' @@ -1588,12 +1600,16 @@ H5C_insert_entry(H5F_t * f, done: #if H5C_DO_EXTREME_SANITY_CHECKS - if ( ( H5C_validate_protected_entry_list(cache_ptr) < 0 ) || - ( H5C_validate_pinned_entry_list(cache_ptr) < 0 ) || - ( H5C_validate_lru_list(cache_ptr) < 0 ) ) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on exit.\n") + if((H5C_validate_protected_entry_list(cache_ptr) < 0) || + (H5C_validate_pinned_entry_list(cache_ptr) < 0) || + (H5C_validate_lru_list(cache_ptr) < 0)) + HDONE_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on exit") #endif /* H5C_DO_EXTREME_SANITY_CHECKS */ + if(ret_value < 0 && entry_tagged) + if(H5C__untag_entry(cache_ptr, entry_ptr) < 0) + HDONE_ERROR(H5E_CACHE, H5E_CANTREMOVE, FAIL, "can't remove entry from tag list") + FUNC_LEAVE_NOAPI(ret_value) } /* H5C_insert_entry() */ @@ -1915,7 +1931,7 @@ H5C_move_entry(H5C_t * cache_ptr, if((H5C_validate_protected_entry_list(cache_ptr) < 0) || (H5C_validate_pinned_entry_list(cache_ptr) < 0) || (H5C_validate_lru_list(cache_ptr) < 0)) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on entry.\n") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on entry") #endif /* H5C_DO_EXTREME_SANITY_CHECKS */ H5C__SEARCH_INDEX(cache_ptr, old_addr, entry_ptr, FAIL) @@ -2019,7 +2035,7 @@ done: if((H5C_validate_protected_entry_list(cache_ptr) < 0) || (H5C_validate_pinned_entry_list(cache_ptr) < 0) || (H5C_validate_lru_list(cache_ptr) < 0)) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on exit.\n") + HDONE_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on exit") #endif /* H5C_DO_EXTREME_SANITY_CHECKS */ FUNC_LEAVE_NOAPI(ret_value) @@ -2060,17 +2076,14 @@ H5C_resize_entry(void *thing, size_t new_size) /* Check for usage errors */ if(new_size <= 0) - HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "New size is non-positive.") + HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "New size is non-positive") if(!(entry_ptr->is_pinned || entry_ptr->is_protected)) HGOTO_ERROR(H5E_CACHE, H5E_BADTYPE, FAIL, "Entry isn't pinned or protected??") #if H5C_DO_EXTREME_SANITY_CHECKS - if ( ( H5C_validate_protected_entry_list(cache_ptr) < 0 ) || - ( H5C_validate_pinned_entry_list(cache_ptr) < 0 ) ) { - - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ - "an extreme sanity check failed on entry.\n"); - } + if((H5C_validate_protected_entry_list(cache_ptr) < 0) || + (H5C_validate_pinned_entry_list(cache_ptr) < 0)) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on entry") #endif /* H5C_DO_EXTREME_SANITY_CHECKS */ /* update for change in entry size if necessary */ @@ -2167,14 +2180,10 @@ H5C_resize_entry(void *thing, size_t new_size) } /* end if */ done: - #if H5C_DO_EXTREME_SANITY_CHECKS - if ( ( H5C_validate_protected_entry_list(cache_ptr) < 0 ) || - ( H5C_validate_pinned_entry_list(cache_ptr) < 0 ) ) { - - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ - "an extreme sanity check failed on exit.\n"); - } + if((H5C_validate_protected_entry_list(cache_ptr) < 0) || + (H5C_validate_pinned_entry_list(cache_ptr) < 0)) + HDONE_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on exit") #endif /* H5C_DO_EXTREME_SANITY_CHECKS */ FUNC_LEAVE_NOAPI(ret_value) @@ -2270,13 +2279,10 @@ H5C_pin_protected_entry(void *thing) HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); #if H5C_DO_EXTREME_SANITY_CHECKS - if ( ( H5C_validate_protected_entry_list(cache_ptr) < 0 ) || - ( H5C_validate_pinned_entry_list(cache_ptr) < 0 ) || - ( H5C_validate_lru_list(cache_ptr) < 0 ) ) { - - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ - "an extreme sanity check failed on entry.\n"); - } + if((H5C_validate_protected_entry_list(cache_ptr) < 0) || + (H5C_validate_pinned_entry_list(cache_ptr) < 0) || + (H5C_validate_lru_list(cache_ptr) < 0)) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on entry") #endif /* H5C_DO_EXTREME_SANITY_CHECKS */ @@ -2289,15 +2295,11 @@ H5C_pin_protected_entry(void *thing) HGOTO_ERROR(H5E_CACHE, H5E_CANTPIN, FAIL, "Can't pin entry by client") done: - #if H5C_DO_EXTREME_SANITY_CHECKS - if ( ( H5C_validate_protected_entry_list(cache_ptr) < 0 ) || - ( H5C_validate_pinned_entry_list(cache_ptr) < 0 ) || - ( H5C_validate_lru_list(cache_ptr) < 0 ) ) { - - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ - "an extreme sanity check failed on exit.\n"); - } + if((H5C_validate_protected_entry_list(cache_ptr) < 0) || + (H5C_validate_pinned_entry_list(cache_ptr) < 0) || + (H5C_validate_lru_list(cache_ptr) < 0)) + HDONE_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on exit") #endif /* H5C_DO_EXTREME_SANITY_CHECKS */ FUNC_LEAVE_NOAPI(ret_value) @@ -2324,32 +2326,6 @@ done: * * Programmer: John Mainzer - 6/2/04 * - * JRM -- 11/13/08 - * Modified function to call H5C_make_space_in_cache() when - * the min_clean_size is violated, not just when there isn't - * enough space for and entry that has just been loaded. - * - * The purpose of this modification is to avoid "metadata - * blizzards" in the write only case. In such instances, - * the cache was allowed to fill with dirty metadata. When - * we finally needed to evict an entry to make space, we had - * to flush out a whole cache full of metadata -- which has - * interesting performance effects. We hope to avoid (or - * perhaps more accurately hide) this effect by maintaining - * the min_clean_size, which should force us to start flushing - * entries long before we actually have to evict something - * to make space. - * - * JRM -- 9/1/14 - * Replace the old rw parameter with the flags parameter. - * This allows H5C_protect to accept flags other than - * H5C__READ_ONLY_FLAG. - * - * Added support for the H5C__FLUSH_LAST_FLAG. - * At present, this flag is only applied if the entry is - * not in cache, and is loaded into the cache as a result of - * this call. - * *------------------------------------------------------------------------- */ void * @@ -2388,17 +2364,23 @@ H5C_protect(H5F_t * f, HDassert( cache_ptr ); HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC ); HDassert( type ); + HDassert( type->mem_type == cache_ptr->class_table_ptr[type->id]->mem_type ); HDassert( H5F_addr_defined(addr) ); #if H5C_DO_EXTREME_SANITY_CHECKS - if ( ( H5C_validate_protected_entry_list(cache_ptr) < 0 ) || - ( H5C_validate_pinned_entry_list(cache_ptr) < 0 ) || - ( H5C_validate_lru_list(cache_ptr) < 0 ) ) { - - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, NULL, "an extreme sanity check failed on entry.\n") - } + if((H5C_validate_protected_entry_list(cache_ptr) < 0) || + (H5C_validate_pinned_entry_list(cache_ptr) < 0) || + (H5C_validate_lru_list(cache_ptr) < 0)) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, NULL, "an extreme sanity check failed on entry") #endif /* H5C_DO_EXTREME_SANITY_CHECKS */ + /* Load the cache image, if requested */ + if(cache_ptr->load_image) { + cache_ptr->load_image = FALSE; + if(H5C__load_cache_image(f, dxpl_id) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTLOAD, NULL, "Can't load cache image") + } /* end if */ + read_only = ( (flags & H5C__READ_ONLY_FLAG) != 0 ); flush_last = ( (flags & H5C__FLUSH_LAST_FLAG) != 0 ); @@ -2428,9 +2410,24 @@ H5C_protect(H5F_t * f, /* first check to see if the target is in cache */ H5C__SEARCH_INDEX(cache_ptr, addr, entry_ptr, NULL) - if ( entry_ptr != NULL ) { + if(entry_ptr != NULL) { if(entry_ptr->ring != ring) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, NULL, "ring type mismatch occured for cache entry\n") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, NULL, "ring type mismatch occured for cache entry") + + HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); + + if(entry_ptr->prefetched) { + /* This call removes the prefetched entry from the cache, + * and replaces it with an entry deserialized from the + * image of the prefetched entry. + */ + if(H5C__deserialize_prefetched_entry(f, dxpl_id, cache_ptr, &entry_ptr, type, addr, udata) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTLOAD, NULL, "can't deserialize prefetched entry") + + HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); + HDassert(!entry_ptr->prefetched); + HDassert(entry_ptr->addr == addr); + } /* end if */ /* Check for trying to load the wrong type of entry from an address */ if(entry_ptr->type != type) @@ -2523,6 +2520,8 @@ H5C_protect(H5F_t * f, HGOTO_ERROR(H5E_CACHE, H5E_CANTLOAD, NULL, "can't load entry") entry_ptr = (H5C_cache_entry_t *)thing; + cache_ptr->entries_loaded_counter++; + entry_ptr->ring = ring; #ifdef H5_HAVE_PARALLEL if(H5F_HAS_FEATURE(f, H5FD_FEAT_HAS_MPI) && entry_ptr->coll_access) @@ -2540,7 +2539,7 @@ H5C_protect(H5F_t * f, ( entry_ptr->size > cache_ptr->flash_size_increase_threshold ) ) { if(H5C__flash_increase_cache_size(cache_ptr, 0, entry_ptr->size) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTPROTECT, NULL, "H5C__flash_increase_cache_size failed.") + HGOTO_ERROR(H5E_CACHE, H5E_CANTPROTECT, NULL, "H5C__flash_increase_cache_size failed") } if(cache_ptr->index_size >= cache_ptr->max_cache_size) @@ -2549,7 +2548,7 @@ H5C_protect(H5F_t * f, empty_space = cache_ptr->max_cache_size - cache_ptr->index_size; /* try to free up if necceary and if evictions are permitted. Note - * that if evictions are enabled, we will call H5C_make_space_in_cache() + * that if evictions are enabled, we will call H5C__make_space_in_cache() * regardless if the min_free_space requirement is not met. */ if ( ( cache_ptr->evictions_enabled ) && @@ -2584,7 +2583,7 @@ H5C_protect(H5F_t * f, /* Note that space_needed is just the amount of space that * needed to insert the new entry without exceeding the cache - * size limit. The subsequent call to H5C_make_space_in_cache() + * size limit. The subsequent call to H5C__make_space_in_cache() * may evict the entries required to free more or less space * depending on conditions. It MAY be less if the cache is * currently undersized, or more if the cache is oversized. @@ -2611,9 +2610,9 @@ H5C_protect(H5F_t * f, * see no point in worrying about the fourth. */ - if(H5C_make_space_in_cache(f, dxpl_id, space_needed, write_permitted) < 0 ) - HGOTO_ERROR(H5E_CACHE, H5E_CANTPROTECT, NULL, "H5C_make_space_in_cache failed 1.") - } + if(H5C__make_space_in_cache(f, dxpl_id, space_needed, write_permitted) < 0 ) + HGOTO_ERROR(H5E_CACHE, H5E_CANTPROTECT, NULL, "H5C__make_space_in_cache failed") + } /* end if */ /* Insert the entry in the hash table. It can't be dirty yet, so * we don't even check to see if it should go in the skip list. @@ -2648,44 +2647,34 @@ H5C_protect(H5F_t * f, */ H5C__UPDATE_RP_FOR_INSERTION(cache_ptr, entry_ptr, NULL) - /* Update entries loaded in cache counter */ - cache_ptr->entries_loaded_counter++; - /* Record that the entry was loaded, to trigger a notify callback later */ /* (After the entry is fully added to the cache) */ was_loaded = TRUE; - } - - HDassert( entry_ptr->addr == addr ); - HDassert( entry_ptr->type == type ); - - if ( entry_ptr->is_protected ) { - - if ( ( read_only ) && ( entry_ptr->is_read_only ) ) { + } /* end else */ - HDassert( entry_ptr->ro_ref_count > 0 ); + HDassert(entry_ptr->addr == addr); + HDassert(entry_ptr->type == type); + if(entry_ptr->is_protected) { + if(read_only && entry_ptr->is_read_only) { + HDassert(entry_ptr->ro_ref_count > 0); (entry_ptr->ro_ref_count)++; - - } else { - - HGOTO_ERROR(H5E_CACHE, H5E_CANTPROTECT, NULL, \ - "Target already protected & not read only?!?.") - } - } else { - + } /* end if */ + else + HGOTO_ERROR(H5E_CACHE, H5E_CANTPROTECT, NULL, "Target already protected & not read only?!?") + } /* end if */ + else { H5C__UPDATE_RP_FOR_PROTECT(cache_ptr, entry_ptr, NULL) entry_ptr->is_protected = TRUE; if ( read_only ) { - entry_ptr->is_read_only = TRUE; entry_ptr->ro_ref_count = 1; - } + } /* end if */ entry_ptr->dirtied = FALSE; - } + } /* end else */ H5C__UPDATE_CACHE_HIT_RATE_STATS(cache_ptr, hit) @@ -2703,7 +2692,7 @@ H5C_protect(H5F_t * f, if ( cache_ptr->check_write_permitted != NULL ) { if((cache_ptr->check_write_permitted)(f, &write_permitted) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTPROTECT, NULL, "Can't get write_permitted 2") + HGOTO_ERROR(H5E_CACHE, H5E_CANTPROTECT, NULL, "Can't get write_permitted") else have_write_permitted = TRUE; } else { @@ -2715,16 +2704,14 @@ H5C_protect(H5F_t * f, } } - if ( ( cache_ptr->resize_enabled ) && - ( cache_ptr->cache_accesses >= - (cache_ptr->resize_ctl).epoch_length ) ) { + if(cache_ptr->resize_enabled && + (cache_ptr->cache_accesses >= (cache_ptr->resize_ctl).epoch_length)) { if(H5C__auto_adjust_cache_size(f, dxpl_id, write_permitted) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTPROTECT, NULL, "Cache auto-resize failed.") - } - - if ( cache_ptr->size_decreased ) { + HGOTO_ERROR(H5E_CACHE, H5E_CANTPROTECT, NULL, "Cache auto-resize failed") + } /* end if */ + if(cache_ptr->size_decreased) { cache_ptr->size_decreased = FALSE; /* check to see if the cache is now oversized due to the cache @@ -2732,7 +2719,7 @@ H5C_protect(H5F_t * f, * bring the cache size down to the current maximum cache size. * * Also, if the min_clean_size requirement is not met, we - * should also call H5C_make_space_in_cache() to bring us + * should also call H5C__make_space_in_cache() to bring us * into complience. */ @@ -2749,10 +2736,10 @@ H5C_protect(H5F_t * f, if(cache_ptr->index_size > cache_ptr->max_cache_size) cache_ptr->cache_full = TRUE; - if(H5C_make_space_in_cache(f, dxpl_id, (size_t)0, write_permitted) < 0 ) - HGOTO_ERROR(H5E_CACHE, H5E_CANTPROTECT, NULL, "H5C_make_space_in_cache failed 2.") + if(H5C__make_space_in_cache(f, dxpl_id, (size_t)0, write_permitted) < 0 ) + HGOTO_ERROR(H5E_CACHE, H5E_CANTPROTECT, NULL, "H5C__make_space_in_cache failed") } - } + } /* end if */ } /* If we loaded the entry and the entry's type has a 'notify' callback, send @@ -2789,10 +2776,10 @@ H5C_protect(H5F_t * f, done: #if H5C_DO_EXTREME_SANITY_CHECKS - if ( ( H5C_validate_protected_entry_list(cache_ptr) < 0 ) || - ( H5C_validate_pinned_entry_list(cache_ptr) < 0 ) || - ( H5C_validate_lru_list(cache_ptr) < 0 ) ) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, NULL, "an extreme sanity check failed on exit.\n") + if((H5C_validate_protected_entry_list(cache_ptr) < 0) || + (H5C_validate_pinned_entry_list(cache_ptr) < 0) || + (H5C_validate_lru_list(cache_ptr) < 0)) + HDONE_ERROR(H5E_CACHE, H5E_SYSTEM, NULL, "an extreme sanity check failed on exit") #endif /* H5C_DO_EXTREME_SANITY_CHECKS */ FUNC_LEAVE_NOAPI(ret_value) @@ -2819,7 +2806,7 @@ H5C_reset_cache_hit_rate_stats(H5C_t * cache_ptr) FUNC_ENTER_NOAPI(FAIL) if((cache_ptr == NULL) || (cache_ptr->magic != H5C__H5C_T_MAGIC)) - HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "bad cache_ptr on entry.") + HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "bad cache_ptr on entry") cache_ptr->cache_hits = 0; cache_ptr->cache_accesses = 0; @@ -2859,27 +2846,27 @@ H5C_set_cache_auto_resize_config(H5C_t *cache_ptr, FUNC_ENTER_NOAPI(FAIL) if((cache_ptr == NULL) || (cache_ptr->magic != H5C__H5C_T_MAGIC)) - HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "bad cache_ptr on entry.") + HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "bad cache_ptr on entry") if(config_ptr == NULL) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "NULL config_ptr on entry.") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "NULL config_ptr on entry") if(config_ptr->version != H5C__CURR_AUTO_SIZE_CTL_VER) - HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "unknown config version.") + HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "unknown config version") /* check general configuration section of the config: */ if(H5C_validate_resize_config(config_ptr, H5C_RESIZE_CFG__VALIDATE_GENERAL) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "error in general configuration fields of new config.") + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "error in general configuration fields of new config") /* check size increase control fields of the config: */ if(H5C_validate_resize_config(config_ptr, H5C_RESIZE_CFG__VALIDATE_INCREMENT) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "error in the size increase control fields of new config.") + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "error in the size increase control fields of new config") /* check size decrease control fields of the config: */ if(H5C_validate_resize_config(config_ptr, H5C_RESIZE_CFG__VALIDATE_DECREMENT) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "error in the size decrease control fields of new config.") + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "error in the size decrease control fields of new config") /* check for conflicts between size increase and size decrease controls: */ if(H5C_validate_resize_config(config_ptr, H5C_RESIZE_CFG__VALIDATE_INTERACTIONS) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "conflicting threshold fields in new config.") + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "conflicting threshold fields in new config") /* will set the increase possible fields to FALSE later if needed */ cache_ptr->size_increase_possible = TRUE; @@ -2899,7 +2886,7 @@ H5C_set_cache_auto_resize_config(H5C_t *cache_ptr, break; default: /* should be unreachable */ - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Unknown incr_mode?!?!?.") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Unknown incr_mode?!?!?") } /* end switch */ /* logically, this is were configuration for flash cache size increases @@ -2933,7 +2920,7 @@ H5C_set_cache_auto_resize_config(H5C_t *cache_ptr, break; default: /* should be unreachable */ - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Unknown decr_mode?!?!?.") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Unknown decr_mode?!?!?") } /* end switch */ if(config_ptr->max_size == config_ptr->min_size) { @@ -2989,18 +2976,18 @@ H5C_set_cache_auto_resize_config(H5C_t *cache_ptr, if(H5C_reset_cache_hit_rate_stats(cache_ptr) < 0) /* this should be impossible... */ - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C_reset_cache_hit_rate_stats failed.") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C_reset_cache_hit_rate_stats failed") /* remove excess epoch markers if any */ if((config_ptr->decr_mode == H5C_decr__age_out_with_threshold) || (config_ptr->decr_mode == H5C_decr__age_out)) { if(cache_ptr->epoch_markers_active > cache_ptr->resize_ctl.epochs_before_eviction) if(H5C__autoadjust__ageout__remove_excess_markers(cache_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "can't remove excess epoch markers.") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "can't remove excess epoch markers") } /* end if */ else if(cache_ptr->epoch_markers_active > 0) { if(H5C__autoadjust__ageout__remove_all_markers(cache_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "error removing all epoch markers.") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "error removing all epoch markers") } /* configure flash size increase facility. We wait until the @@ -3024,7 +3011,7 @@ H5C_set_cache_auto_resize_config(H5C_t *cache_ptr, break; default: /* should be unreachable */ - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Unknown flash_incr_mode?!?!?.") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Unknown flash_incr_mode?!?!?") break; } /* end switch */ } /* end if */ @@ -3055,7 +3042,7 @@ H5C_set_evictions_enabled(H5C_t *cache_ptr, hbool_t evictions_enabled) FUNC_ENTER_NOAPI(FAIL) if((cache_ptr == NULL) || (cache_ptr->magic != H5C__H5C_T_MAGIC)) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Bad cache_ptr on entry.") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Bad cache_ptr on entry") /* There is no fundamental reason why we should not permit * evictions to be disabled while automatic resize is enabled. @@ -3066,7 +3053,7 @@ H5C_set_evictions_enabled(H5C_t *cache_ptr, hbool_t evictions_enabled) if((evictions_enabled != TRUE) && ((cache_ptr->resize_ctl.incr_mode != H5C_incr__off) || (cache_ptr->resize_ctl.decr_mode != H5C_decr__off))) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't disable evictions when auto resize enabled.") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't disable evictions when auto resize enabled") cache_ptr->evictions_enabled = evictions_enabled; @@ -3161,13 +3148,10 @@ H5C_unpin_entry(void *_entry_ptr) HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); #if H5C_DO_EXTREME_SANITY_CHECKS - if ( ( H5C_validate_protected_entry_list(cache_ptr) < 0 ) || - ( H5C_validate_pinned_entry_list(cache_ptr) < 0 ) || - ( H5C_validate_lru_list(cache_ptr) < 0 ) ) { - - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ - "an extreme sanity check failed on entry.\n"); - } + if((H5C_validate_protected_entry_list(cache_ptr) < 0) || + (H5C_validate_pinned_entry_list(cache_ptr) < 0) || + (H5C_validate_lru_list(cache_ptr) < 0)) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on entry") #endif /* H5C_DO_EXTREME_SANITY_CHECKS */ @@ -3176,19 +3160,14 @@ H5C_unpin_entry(void *_entry_ptr) HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPIN, FAIL, "Can't unpin entry from client") done: - #if H5C_DO_EXTREME_SANITY_CHECKS - if ( ( H5C_validate_protected_entry_list(cache_ptr) < 0 ) || - ( H5C_validate_pinned_entry_list(cache_ptr) < 0 ) || - ( H5C_validate_lru_list(cache_ptr) < 0 ) ) { - - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ - "an extreme sanity check failed on exit.\n"); - } + if((H5C_validate_protected_entry_list(cache_ptr) < 0) || + (H5C_validate_pinned_entry_list(cache_ptr) < 0) || + (H5C_validate_lru_list(cache_ptr) < 0)) + HDONE_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on exit") #endif /* H5C_DO_EXTREME_SANITY_CHECKS */ FUNC_LEAVE_NOAPI(ret_value) - } /* H5C_unpin_entry() */ @@ -3275,13 +3254,10 @@ H5C_unprotect(H5F_t * f, was_clean = ! ( entry_ptr->is_dirty ); #if H5C_DO_EXTREME_SANITY_CHECKS - if ( ( H5C_validate_protected_entry_list(cache_ptr) < 0 ) || - ( H5C_validate_pinned_entry_list(cache_ptr) < 0 ) || - ( H5C_validate_lru_list(cache_ptr) < 0 ) ) { - - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ - "an extreme sanity check failed on entry.\n"); - } + if((H5C_validate_protected_entry_list(cache_ptr) < 0) || + (H5C_validate_pinned_entry_list(cache_ptr) < 0) || + (H5C_validate_lru_list(cache_ptr) < 0)) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on entry") #endif /* H5C_DO_EXTREME_SANITY_CHECKS */ /* if the entry has multiple read only protects, just decrement @@ -3438,9 +3414,9 @@ H5C_unprotect(H5F_t * f, /* verify that the target entry is in the cache. */ H5C__SEARCH_INDEX(cache_ptr, addr, test_entry_ptr, FAIL) if(test_entry_ptr == NULL) - HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, "entry not in hash table?!?.") + HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, "entry not in hash table?!?") else if(test_entry_ptr != entry_ptr) - HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, "hash table contains multiple entries for addr?!?.") + HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, "hash table contains multiple entries for addr?!?") /* Set the 'free file space' flag for the flush, if needed */ if(free_file_space) @@ -3463,9 +3439,9 @@ H5C_unprotect(H5F_t * f, /* verify that the target entry is in the cache. */ H5C__SEARCH_INDEX(cache_ptr, addr, test_entry_ptr, FAIL) if(test_entry_ptr == NULL) - HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, "entry not in hash table?!?.") + HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, "entry not in hash table?!?") else if(test_entry_ptr != entry_ptr) - HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, "hash table contains multiple entries for addr?!?.") + HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, "hash table contains multiple entries for addr?!?") if(H5C__flush_single_entry(f, dxpl_id, entry_ptr, H5C__FLUSH_CLEAR_ONLY_FLAG | H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, "Can't clear entry") @@ -3476,19 +3452,14 @@ H5C_unprotect(H5F_t * f, H5C__UPDATE_STATS_FOR_UNPROTECT(cache_ptr) done: - #if H5C_DO_EXTREME_SANITY_CHECKS - if ( ( H5C_validate_protected_entry_list(cache_ptr) < 0 ) || - ( H5C_validate_pinned_entry_list(cache_ptr) < 0 ) || - ( H5C_validate_lru_list(cache_ptr) < 0 ) ) { - - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ - "an extreme sanity check failed on exit.\n"); - } + if((H5C_validate_protected_entry_list(cache_ptr) < 0) || + (H5C_validate_pinned_entry_list(cache_ptr) < 0) || + (H5C_validate_lru_list(cache_ptr) < 0)) { + HDONE_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on exit") #endif /* H5C_DO_EXTREME_SANITY_CHECKS */ FUNC_LEAVE_NOAPI(ret_value) - } /* H5C_unprotect() */ @@ -3496,23 +3467,20 @@ done: * * Function: H5C_unsettle_entry_ring * - * Purpose: Advise the metadata cache that the specified entry's metadata - * cache manager ring is no longer settled (if it was on entry). + * Purpose: Advise the metadata cache that the specified entry's free space + * manager ring is no longer settled (if it was on entry). * - * If the target metadata cache manager ring is already + * If the target free space manager ring is already * unsettled, do nothing, and return SUCCEED. * - * If the target metadata cache manager ring is settled, and + * If the target free space manager ring is settled, and * we are not in the process of a file shutdown, mark * the ring as unsettled, and return SUCCEED. * - * If the target metadata cache manager is settled, and we + * If the target free space manager is settled, and we * are in the process of a file shutdown, post an error * message, and return FAIL. * - * Note that this function simply passes the call on to - * the metadata cache proper, and returns the result. - * * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol @@ -3592,18 +3560,13 @@ H5C_validate_resize_config(H5C_auto_size_ctl_t * config_ptr, FUNC_ENTER_NOAPI(FAIL) - if ( config_ptr == NULL ) { - - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "NULL config_ptr on entry.") - } - - if ( config_ptr->version != H5C__CURR_AUTO_SIZE_CTL_VER ) { - - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Unknown config version.") - } + if(config_ptr == NULL) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "NULL config_ptr on entry") + if(config_ptr->version != H5C__CURR_AUTO_SIZE_CTL_VER) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Unknown config version") - if ( (tests & H5C_RESIZE_CFG__VALIDATE_GENERAL) != 0 ) { + if((tests & H5C_RESIZE_CFG__VALIDATE_GENERAL) != 0) { if(config_ptr->max_size > H5C__MAX_MAX_CACHE_SIZE) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "max_size too big") @@ -3614,43 +3577,29 @@ H5C_validate_resize_config(H5C_auto_size_ctl_t * config_ptr, if(config_ptr->min_size > config_ptr->max_size) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "min_size > max_size") - if ( ( config_ptr->set_initial_size ) && - ( ( config_ptr->initial_size < config_ptr->min_size ) || - ( config_ptr->initial_size > config_ptr->max_size ) ) ) { - - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, \ - "initial_size must be in the interval [min_size, max_size]"); - } - - if ( ( config_ptr->min_clean_fraction < (double)0.0f ) || - ( config_ptr->min_clean_fraction > (double)1.0f ) ) { + if(config_ptr->set_initial_size && + ((config_ptr->initial_size < config_ptr->min_size) || + (config_ptr->initial_size > config_ptr->max_size))) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "initial_size must be in the interval [min_size, max_size]") - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, \ - "min_clean_fraction must be in the interval [0.0, 1.0]"); - } - - if ( config_ptr->epoch_length < H5C__MIN_AR_EPOCH_LENGTH ) { + if((config_ptr->min_clean_fraction < (double)0.0f) || + (config_ptr->min_clean_fraction > (double)1.0f)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "min_clean_fraction must be in the interval [0.0, 1.0]") + if(config_ptr->epoch_length < H5C__MIN_AR_EPOCH_LENGTH) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "epoch_length too small") - } - - if ( config_ptr->epoch_length > H5C__MAX_AR_EPOCH_LENGTH ) { + if(config_ptr->epoch_length > H5C__MAX_AR_EPOCH_LENGTH) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "epoch_length too big") - } } /* H5C_RESIZE_CFG__VALIDATE_GENERAL */ - if ( (tests & H5C_RESIZE_CFG__VALIDATE_INCREMENT) != 0 ) { - - if ( ( config_ptr->incr_mode != H5C_incr__off ) && - ( config_ptr->incr_mode != H5C_incr__threshold ) ) { - + if((tests & H5C_RESIZE_CFG__VALIDATE_INCREMENT) != 0) { + if((config_ptr->incr_mode != H5C_incr__off) && + (config_ptr->incr_mode != H5C_incr__threshold)) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Invalid incr_mode") - } - - if ( config_ptr->incr_mode == H5C_incr__threshold ) { + if(config_ptr->incr_mode == H5C_incr__threshold) { if((config_ptr->lower_hr_threshold < (double)0.0f) || (config_ptr->lower_hr_threshold > (double)1.0f)) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "lower_hr_threshold must be in the range [0.0, 1.0]") @@ -3663,33 +3612,24 @@ H5C_validate_resize_config(H5C_auto_size_ctl_t * config_ptr, */ } /* H5C_incr__threshold */ - switch ( config_ptr->flash_incr_mode ) - { + switch(config_ptr->flash_incr_mode) { case H5C_flash_incr__off: /* nothing to do here */ break; case H5C_flash_incr__add_space: - if ( ( config_ptr->flash_multiple < (double)0.1f ) || - ( config_ptr->flash_multiple > (double)10.0f ) ) { - - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, \ - "flash_multiple must be in the range [0.1, 10.0]"); - } - - if ( ( config_ptr->flash_threshold < (double)0.1f ) || - ( config_ptr->flash_threshold > (double)1.0f ) ) { - - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, \ - "flash_threshold must be in the range [0.1, 1.0]"); - } + if((config_ptr->flash_multiple < (double)0.1f) || + (config_ptr->flash_multiple > (double)10.0f)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "flash_multiple must be in the range [0.1, 10.0]") + if((config_ptr->flash_threshold < (double)0.1f) || + (config_ptr->flash_threshold > (double)1.0f)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "flash_threshold must be in the range [0.1, 1.0]") break; default: - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, \ - "Invalid flash_incr_mode"); + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Invalid flash_incr_mode") break; - } + } /* end switch */ } /* H5C_RESIZE_CFG__VALIDATE_INCREMENT */ @@ -3705,35 +3645,23 @@ H5C_validate_resize_config(H5C_auto_size_ctl_t * config_ptr, } if ( config_ptr->decr_mode == H5C_decr__threshold ) { + if(config_ptr->upper_hr_threshold > (double)1.0f) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "upper_hr_threshold must be <= 1.0") - if ( config_ptr->upper_hr_threshold > (double)1.0f ) { - - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, \ - "upper_hr_threshold must be <= 1.0"); - } - - if ( ( config_ptr->decrement > (double)1.0f ) || - ( config_ptr->decrement < (double)0.0f ) ) { - - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, \ - "decrement must be in the interval [0.0, 1.0]"); - } + if((config_ptr->decrement > (double)1.0f) || + (config_ptr->decrement < (double)0.0f)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "decrement must be in the interval [0.0, 1.0]") /* no need to check max_decrement as it is a size_t * and thus must be non-negative. */ } /* H5C_decr__threshold */ - if ( ( config_ptr->decr_mode == H5C_decr__age_out ) || - ( config_ptr->decr_mode == H5C_decr__age_out_with_threshold ) - ) { - - if ( config_ptr->epochs_before_eviction < 1 ) { - - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, \ - "epochs_before_eviction must be positive"); - } + if((config_ptr->decr_mode == H5C_decr__age_out) || + (config_ptr->decr_mode == H5C_decr__age_out_with_threshold)) { + if(config_ptr->epochs_before_eviction < 1) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "epochs_before_eviction must be positive") if(config_ptr->epochs_before_eviction > H5C__MAX_EPOCH_MARKERS) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "epochs_before_eviction too big") @@ -3747,43 +3675,24 @@ H5C_validate_resize_config(H5C_auto_size_ctl_t * config_ptr, */ } /* H5C_decr__age_out || H5C_decr__age_out_with_threshold */ - if ( config_ptr->decr_mode == H5C_decr__age_out_with_threshold ) { - - if ( ( config_ptr->upper_hr_threshold > (double)1.0f ) || - ( config_ptr->upper_hr_threshold < (double)0.0f ) ) { - - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, \ - "upper_hr_threshold must be in the interval [0.0, 1.0]"); - } + if(config_ptr->decr_mode == H5C_decr__age_out_with_threshold) { + if((config_ptr->upper_hr_threshold > (double)1.0f) || + (config_ptr->upper_hr_threshold < (double)0.0f)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "upper_hr_threshold must be in the interval [0.0, 1.0]") } /* H5C_decr__age_out_with_threshold */ - } /* H5C_RESIZE_CFG__VALIDATE_DECREMENT */ if ( (tests & H5C_RESIZE_CFG__VALIDATE_INTERACTIONS) != 0 ) { - - if ( ( config_ptr->incr_mode == H5C_incr__threshold ) - && - ( ( config_ptr->decr_mode == H5C_decr__threshold ) - || - ( config_ptr->decr_mode == H5C_decr__age_out_with_threshold ) - ) - && - ( config_ptr->lower_hr_threshold - >= - config_ptr->upper_hr_threshold - ) - ) { - - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, \ - "conflicting threshold fields in config.") - } + if((config_ptr->incr_mode == H5C_incr__threshold) + && ((config_ptr->decr_mode == H5C_decr__threshold) || + (config_ptr->decr_mode == H5C_decr__age_out_with_threshold)) + && (config_ptr->lower_hr_threshold >= config_ptr->upper_hr_threshold)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "conflicting threshold fields in config") } /* H5C_RESIZE_CFG__VALIDATE_INTERACTIONS */ done: - FUNC_LEAVE_NOAPI(ret_value) - } /* H5C_validate_resize_config() */ @@ -3879,6 +3788,7 @@ H5C_create_flush_dependency(void * parent_thing, void * child_thing) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for flush dependency parent list") child_entry->flush_dep_parent_nalloc *= 2; } /* end else */ + cache_ptr->entry_fd_height_change_counter++; } /* end if */ /* Add the dependency to the child's parent array */ @@ -4086,7 +3996,7 @@ H5C__auto_adjust_cache_size(H5F_t * f, hbool_t write_permitted) { H5C_t * cache_ptr = f->shared->cache; - herr_t result; + hbool_t reentrant_call = FALSE; hbool_t inserted_epoch_marker = FALSE; size_t new_max_cache_size = 0; size_t old_max_cache_size = 0; @@ -4106,29 +4016,33 @@ H5C__auto_adjust_cache_size(H5F_t * f, HDassert( (double)0.0f <= (cache_ptr->resize_ctl).min_clean_fraction ); HDassert( (cache_ptr->resize_ctl).min_clean_fraction <= (double)100.0f ); - if ( !cache_ptr->resize_enabled ) { + /* check to see if cache_ptr->resize_in_progress is TRUE. If it, this + * is a re-entrant call via a client callback called in the resize + * process. To avoid an infinite recursion, set reentrant_call to + * TRUE, and goto done. + */ + if(cache_ptr->resize_in_progress) { + reentrant_call = TRUE; + HGOTO_DONE(SUCCEED) + } /* end if */ - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Auto cache resize disabled.") - } + cache_ptr->resize_in_progress = TRUE; - HDassert( ( (cache_ptr->resize_ctl).incr_mode != H5C_incr__off ) || \ - ( (cache_ptr->resize_ctl).decr_mode != H5C_decr__off ) ); + if(!cache_ptr->resize_enabled) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Auto cache resize disabled") - if ( H5C_get_cache_hit_rate(cache_ptr, &hit_rate) != SUCCEED ) { + HDassert(((cache_ptr->resize_ctl).incr_mode != H5C_incr__off) || \ + ((cache_ptr->resize_ctl).decr_mode != H5C_decr__off)); - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't get hit rate.") - } + if(H5C_get_cache_hit_rate(cache_ptr, &hit_rate) != SUCCEED) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't get hit rate") HDassert( ( (double)0.0f <= hit_rate ) && ( hit_rate <= (double)1.0f ) ); - switch ( (cache_ptr->resize_ctl).incr_mode ) - { + switch((cache_ptr->resize_ctl).incr_mode) { case H5C_incr__off: - if ( cache_ptr->size_increase_possible ) { - - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ - "size_increase_possible but H5C_incr__off?!?!?") - } + if(cache_ptr->size_increase_possible) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "size_increase_possible but H5C_incr__off?!?!?") break; case H5C_incr__threshold: @@ -4178,7 +4092,7 @@ H5C__auto_adjust_cache_size(H5F_t * f, break; default: - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unknown incr_mode.") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unknown incr_mode") } /* If the decr_mode is either age out or age out with threshold, we @@ -4205,17 +4119,10 @@ H5C__auto_adjust_cache_size(H5F_t * f, ) ) { - result = H5C__autoadjust__ageout__insert_new_marker(cache_ptr); - - if ( result != SUCCEED ) { - - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ - "can't insert new epoch marker.") - - } else { + if(H5C__autoadjust__ageout__insert_new_marker(cache_ptr) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "can't insert new epoch marker") - inserted_epoch_marker = TRUE; - } + inserted_epoch_marker = TRUE; } /* don't run the cache size decrease code unless the cache size @@ -4275,32 +4182,18 @@ H5C__auto_adjust_cache_size(H5F_t * f, case H5C_decr__age_out_with_threshold: case H5C_decr__age_out: - if ( ! inserted_epoch_marker ) { - - if ( ! cache_ptr->size_decrease_possible ) { - + if(!inserted_epoch_marker) { + if(!cache_ptr->size_decrease_possible) status = decrease_disabled; - - } else { - - result = H5C__autoadjust__ageout(f, - dxpl_id, - hit_rate, - &status, - &new_max_cache_size, - write_permitted); - - if ( result != SUCCEED ) { - - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ - "ageout code failed.") - } - } - } + else { + if(H5C__autoadjust__ageout(f, dxpl_id, hit_rate, &status, &new_max_cache_size, write_permitted) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "ageout code failed") + } /* end else */ + } /* end if */ break; default: - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unknown incr_mode.") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unknown incr_mode") } } @@ -4316,13 +4209,8 @@ H5C__auto_adjust_cache_size(H5F_t * f, ) { /* move last epoch marker to the head of the LRU list */ - result = H5C__autoadjust__ageout__cycle_epoch_marker(cache_ptr); - - if ( result != SUCCEED ) { - - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ - "error cycling epoch marker.") - } + if(H5C__autoadjust__ageout__cycle_epoch_marker(cache_ptr) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "error cycling epoch marker") } if ( ( status == increase ) || ( status == decrease ) ) { @@ -4363,9 +4251,7 @@ H5C__auto_adjust_cache_size(H5F_t * f, switch ( (cache_ptr->resize_ctl).flash_incr_mode ) { case H5C_flash_incr__off: - - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ - "flash_size_increase_possible but H5C_flash_incr__off?!") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "flash_size_increase_possible but H5C_flash_incr__off?!") break; case H5C_flash_incr__add_space: @@ -4376,15 +4262,13 @@ H5C__auto_adjust_cache_size(H5F_t * f, break; default: /* should be unreachable */ - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ - "Unknown flash_incr_mode?!?!?.") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Unknown flash_incr_mode?!?!?") break; } } } if ( (cache_ptr->resize_ctl).rpt_fcn != NULL ) { - (*((cache_ptr->resize_ctl).rpt_fcn)) (cache_ptr, H5C__CURR_AUTO_RESIZE_RPT_FCN_VER, @@ -4396,14 +4280,17 @@ H5C__auto_adjust_cache_size(H5F_t * f, new_min_clean_size); } - if ( H5C_reset_cache_hit_rate_stats(cache_ptr) != SUCCEED ) { - + if(H5C_reset_cache_hit_rate_stats(cache_ptr) < 0) /* this should be impossible... */ - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ - "H5C_reset_cache_hit_rate_stats failed.") - } + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C_reset_cache_hit_rate_stats failed") done: + /* Sanity checks */ + HDassert(cache_ptr->resize_in_progress); + if(!reentrant_call) + cache_ptr->resize_in_progress = FALSE; + HDassert((!reentrant_call) || (cache_ptr->resize_in_progress)); + FUNC_LEAVE_NOAPI(ret_value) } /* H5C__auto_adjust_cache_size() */ @@ -4436,7 +4323,6 @@ H5C__autoadjust__ageout(H5F_t * f, hbool_t write_permitted) { H5C_t * cache_ptr = f->shared->cache; - herr_t result; size_t test_size; herr_t ret_value = SUCCEED; /* Return value */ @@ -4449,17 +4335,9 @@ H5C__autoadjust__ageout(H5F_t * f, HDassert( ( new_max_cache_size_ptr ) && ( *new_max_cache_size_ptr == 0 ) ); /* remove excess epoch markers if any */ - if ( cache_ptr->epoch_markers_active > - (cache_ptr->resize_ctl).epochs_before_eviction ) { - - result = H5C__autoadjust__ageout__remove_excess_markers(cache_ptr); - - if ( result != SUCCEED ) { - - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ - "can't remove excess epoch markers.") - } - } + if(cache_ptr->epoch_markers_active > (cache_ptr->resize_ctl).epochs_before_eviction) + if(H5C__autoadjust__ageout__remove_excess_markers(cache_ptr) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "can't remove excess epoch markers") if ( ( (cache_ptr->resize_ctl).decr_mode == H5C_decr__age_out ) || @@ -4475,7 +4353,7 @@ H5C__autoadjust__ageout(H5F_t * f, /* evict aged out cache entries if appropriate... */ if(H5C__autoadjust__ageout__evict_aged_out_entries(f, dxpl_id, write_permitted) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "error flushing aged out entries.") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "error flushing aged out entries") /* ... and then reduce cache size if appropriate */ if ( cache_ptr->index_size < cache_ptr->max_cache_size ) { @@ -4557,11 +4435,8 @@ H5C__autoadjust__ageout__cycle_epoch_marker(H5C_t * cache_ptr) HDassert( cache_ptr ); HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC ); - if ( cache_ptr->epoch_markers_active <= 0 ) { - - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ - "No active epoch markers on entry?!?!?.") - } + if(cache_ptr->epoch_markers_active <= 0) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "No active epoch markers on entry?!?!?") /* remove the last marker from both the ring buffer and the LRU list */ @@ -4573,15 +4448,10 @@ H5C__autoadjust__ageout__cycle_epoch_marker(H5C_t * cache_ptr) cache_ptr->epoch_marker_ringbuf_size -= 1; - if ( cache_ptr->epoch_marker_ringbuf_size < 0 ) { - - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "ring buffer underflow.") - } - - if ( (cache_ptr->epoch_marker_active)[i] != TRUE ) { - - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unused marker in LRU?!?") - } + if(cache_ptr->epoch_marker_ringbuf_size < 0) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "ring buffer underflow") + if((cache_ptr->epoch_marker_active)[i] != TRUE) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unused marker in LRU?!?") H5C__DLL_REMOVE((&((cache_ptr->epoch_markers)[i])), \ (cache_ptr)->LRU_head_ptr, \ @@ -4594,9 +4464,9 @@ H5C__autoadjust__ageout__cycle_epoch_marker(H5C_t * cache_ptr) * the ring buffer. */ - HDassert( ((cache_ptr->epoch_markers)[i]).addr == (haddr_t)i ); - HDassert( ((cache_ptr->epoch_markers)[i]).next == NULL ); - HDassert( ((cache_ptr->epoch_markers)[i]).prev == NULL ); + HDassert(((cache_ptr->epoch_markers)[i]).addr == (haddr_t)i); + HDassert(((cache_ptr->epoch_markers)[i]).next == NULL); + HDassert(((cache_ptr->epoch_markers)[i]).prev == NULL); cache_ptr->epoch_marker_ringbuf_last = (cache_ptr->epoch_marker_ringbuf_last + 1) % @@ -4606,10 +4476,8 @@ H5C__autoadjust__ageout__cycle_epoch_marker(H5C_t * cache_ptr) cache_ptr->epoch_marker_ringbuf_size += 1; - if ( cache_ptr->epoch_marker_ringbuf_size > H5C__MAX_EPOCH_MARKERS ) { - - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "ring buffer overflow.") - } + if(cache_ptr->epoch_marker_ringbuf_size > H5C__MAX_EPOCH_MARKERS) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "ring buffer overflow") H5C__DLL_PREPEND((&((cache_ptr->epoch_markers)[i])), \ (cache_ptr)->LRU_head_ptr, \ @@ -4671,19 +4539,6 @@ done: * * Programmer: John Mainzer, 11/22/04 * - * Changes: Modified function to detect deletions of entries - * during a scan of the LRU, and where appropriate, - * restart the scan to avoid proceeding with a next - * entry that is no longer in the cache. - * - * Note the absence of checks after flushes of clean - * entries. As a second entry can only be removed by - * by a call to the pre_serialize or serialize callback - * of the first, and as these callbacks will not be called - * on clean entries, no checks are needed. - * - * JRM -- 4/6/15 - * *------------------------------------------------------------------------- */ static herr_t @@ -4775,39 +4630,26 @@ H5C__autoadjust__ageout__evict_aged_out_entries(H5F_t * f, HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush entry") } - if ( prev_ptr != NULL ) { - + if(prev_ptr != NULL) { if(corked) /* dirty corked entry is skipped */ entry_ptr = prev_ptr; - - else if ( ( restart_scan ) - || - ( prev_ptr->is_dirty != prev_is_dirty ) - || - ( prev_ptr->next != next_ptr ) - || - ( prev_ptr->is_protected ) - || - ( prev_ptr->is_pinned ) ) { - - /* something has happened to the LRU -- start over + else if(restart_scan || (prev_ptr->is_dirty != prev_is_dirty) + || (prev_ptr->next != next_ptr) + || (prev_ptr->is_protected) + || (prev_ptr->is_pinned)) { + /* Something has happened to the LRU -- start over * from the tail. */ restart_scan = FALSE; entry_ptr = cache_ptr->LRU_tail_ptr; H5C__UPDATE_STATS_FOR_LRU_SCAN_RESTART(cache_ptr) - - } else { - + } /* end else-if */ + else entry_ptr = prev_ptr; - - } - } else { - + } /* end if */ + else entry_ptr = NULL; - - } } /* end while */ /* for now at least, don't bother to maintain the minimum clean size, @@ -4825,9 +4667,9 @@ H5C__autoadjust__ageout__evict_aged_out_entries(H5F_t * f, * entry). */ - } else /* ! write_permitted */ { - - /* since we are not allowed to write, all we can do is evict + } /* end if */ + else /* ! write_permitted */ { + /* Since we are not allowed to write, all we can do is evict * any clean entries that we may encounter before we either * hit the eviction size limit, or encounter the epoch marker. * @@ -4840,23 +4682,19 @@ H5C__autoadjust__ageout__evict_aged_out_entries(H5F_t * f, * performance implications, but it shouldn't cause any net * slowdown. */ - - HDassert( H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS ); - + HDassert(H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS); entry_ptr = cache_ptr->LRU_tail_ptr; - - while ( ( entry_ptr != NULL ) && - ( (entry_ptr->type)->id != H5AC_EPOCH_MARKER_ID ) && - ( bytes_evicted < eviction_size_limit ) ) - { - HDassert( ! (entry_ptr->is_protected) ); + while(entry_ptr != NULL && + ((entry_ptr->type)->id != H5AC_EPOCH_MARKER_ID) && + (bytes_evicted < eviction_size_limit)) { + HDassert(!(entry_ptr->is_protected)); prev_ptr = entry_ptr->prev; - if ( ! (entry_ptr->is_dirty) ) { + if(!(entry_ptr->is_dirty)) { if(H5C__flush_single_entry(f, dxpl_id, entry_ptr, H5C__FLUSH_INVALIDATE_FLAG | H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush clean entry") - } + } /* end if */ /* just skip the entry if it is dirty, as we can't do * anything with it now since we can't write. * @@ -4864,21 +4702,15 @@ H5C__autoadjust__ageout__evict_aged_out_entries(H5F_t * f, * and thus we needn't test to see if the LRU has been changed * out from under us. */ - entry_ptr = prev_ptr; - } /* end while */ - } - - if ( cache_ptr->index_size < cache_ptr->max_cache_size ) { + } /* end else */ + if(cache_ptr->index_size < cache_ptr->max_cache_size) cache_ptr->cache_full = FALSE; - } done: - FUNC_LEAVE_NOAPI(ret_value) - } /* H5C__autoadjust__ageout__evict_aged_out_entries() */ @@ -4907,23 +4739,16 @@ H5C__autoadjust__ageout__insert_new_marker(H5C_t * cache_ptr) HDassert( cache_ptr ); HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC ); - if ( cache_ptr->epoch_markers_active >= - (cache_ptr->resize_ctl).epochs_before_eviction ) { - - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ - "Already have a full complement of markers.") - } + if(cache_ptr->epoch_markers_active >= (cache_ptr->resize_ctl).epochs_before_eviction) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Already have a full complement of markers") /* find an unused marker */ i = 0; - while ( ( (cache_ptr->epoch_marker_active)[i] ) && - ( i < H5C__MAX_EPOCH_MARKERS ) ) - { + while((cache_ptr->epoch_marker_active)[i] && i < H5C__MAX_EPOCH_MARKERS) i++; - } if(i >= H5C__MAX_EPOCH_MARKERS) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't find unused marker.") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't find unused marker") HDassert( ((cache_ptr->epoch_markers)[i]).addr == (haddr_t)i ); HDassert( ((cache_ptr->epoch_markers)[i]).next == NULL ); @@ -4941,7 +4766,7 @@ H5C__autoadjust__ageout__insert_new_marker(H5C_t * cache_ptr) if ( cache_ptr->epoch_marker_ringbuf_size > H5C__MAX_EPOCH_MARKERS ) { - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "ring buffer overflow.") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "ring buffer overflow") } H5C__DLL_PREPEND((&((cache_ptr->epoch_markers)[i])), \ @@ -5000,15 +4825,11 @@ H5C__autoadjust__ageout__remove_all_markers(H5C_t * cache_ptr) cache_ptr->epoch_marker_ringbuf_size -= 1; - if ( cache_ptr->epoch_marker_ringbuf_size < 0 ) { - - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "ring buffer underflow.") - } - - if ( (cache_ptr->epoch_marker_active)[i] != TRUE ) { + if(cache_ptr->epoch_marker_ringbuf_size < 0) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "ring buffer underflow") + if((cache_ptr->epoch_marker_active)[i] != TRUE) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unused marker in LRU?!?") - } /* remove the epoch marker from the LRU list */ H5C__DLL_REMOVE((&((cache_ptr->epoch_markers)[i])), \ @@ -5066,15 +4887,10 @@ H5C__autoadjust__ageout__remove_excess_markers(H5C_t * cache_ptr) HDassert( cache_ptr ); HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC ); - if ( cache_ptr->epoch_markers_active <= - (cache_ptr->resize_ctl).epochs_before_eviction ) { + if(cache_ptr->epoch_markers_active <= (cache_ptr->resize_ctl).epochs_before_eviction) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "no excess markers on entry") - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "no excess markers on entry.") - } - - while ( cache_ptr->epoch_markers_active > - (cache_ptr->resize_ctl).epochs_before_eviction ) - { + while(cache_ptr->epoch_markers_active > (cache_ptr->resize_ctl).epochs_before_eviction) { /* get the index of the last epoch marker in the LRU list * and remove it from the ring buffer. */ @@ -5088,15 +4904,10 @@ H5C__autoadjust__ageout__remove_excess_markers(H5C_t * cache_ptr) cache_ptr->epoch_marker_ringbuf_size -= 1; - if ( cache_ptr->epoch_marker_ringbuf_size < 0 ) { - - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "ring buffer underflow.") - } - - if ( (cache_ptr->epoch_marker_active)[i] != TRUE ) { - + if(cache_ptr->epoch_marker_ringbuf_size < 0) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "ring buffer underflow") + if((cache_ptr->epoch_marker_active)[i] != TRUE) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unused marker in LRU?!?") - } /* remove the epoch marker from the LRU list */ H5C__DLL_REMOVE((&((cache_ptr->epoch_markers)[i])), \ @@ -5165,11 +4976,8 @@ H5C__flash_increase_cache_size(H5C_t * cache_ptr, HDassert( new_entry_size > cache_ptr->flash_size_increase_threshold ); HDassert( old_entry_size < new_entry_size ); - if ( old_entry_size >= new_entry_size ) { - - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ - "old_entry_size >= new_entry_size") - } + if(old_entry_size >= new_entry_size) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "old_entry_size >= new_entry_size") space_needed = new_entry_size - old_entry_size; @@ -5182,8 +4990,7 @@ H5C__flash_increase_cache_size(H5C_t * cache_ptr, switch ( (cache_ptr->resize_ctl).flash_incr_mode ) { case H5C_flash_incr__off: - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ - "flash_size_increase_possible but H5C_flash_incr__off?!") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "flash_size_increase_possible but H5C_flash_incr__off?!") break; case H5C_flash_incr__add_space: @@ -5203,8 +5010,7 @@ H5C__flash_increase_cache_size(H5C_t * cache_ptr, break; default: /* should be unreachable */ - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ - "Unknown flash_incr_mode?!?!?.") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Unknown flash_incr_mode?!?!?") break; } @@ -5233,8 +5039,7 @@ H5C__flash_increase_cache_size(H5C_t * cache_ptr, switch ( (cache_ptr->resize_ctl).flash_incr_mode ) { case H5C_flash_incr__off: - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ - "flash_size_increase_possible but H5C_flash_incr__off?!") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "flash_size_increase_possible but H5C_flash_incr__off?!") break; case H5C_flash_incr__add_space: @@ -5245,8 +5050,7 @@ H5C__flash_increase_cache_size(H5C_t * cache_ptr, break; default: /* should be unreachable */ - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ - "Unknown flash_incr_mode?!?!?.") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Unknown flash_incr_mode?!?!?") break; } @@ -5260,10 +5064,8 @@ H5C__flash_increase_cache_size(H5C_t * cache_ptr, /* get the hit rate for the reporting function. Should still * be good as we havent reset the hit rate statistics. */ - if ( H5C_get_cache_hit_rate(cache_ptr, &hit_rate) != SUCCEED ) { - - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't get hit rate.") - } + if(H5C_get_cache_hit_rate(cache_ptr, &hit_rate) != SUCCEED) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't get hit rate") (*((cache_ptr->resize_ctl).rpt_fcn)) (cache_ptr, @@ -5276,12 +5078,9 @@ H5C__flash_increase_cache_size(H5C_t * cache_ptr, new_min_clean_size); } - if ( H5C_reset_cache_hit_rate_stats(cache_ptr) != SUCCEED ) { - + if(H5C_reset_cache_hit_rate_stats(cache_ptr) < 0) /* this should be impossible... */ - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ - "H5C_reset_cache_hit_rate_stats failed.") - } + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C_reset_cache_hit_rate_stats failed") } done: @@ -5347,8 +5146,8 @@ H5C_flush_invalidate_cache(H5F_t *f, hid_t dxpl_id, unsigned flags) #if H5C_DO_SANITY_CHECKS { int32_t i; - int32_t index_len = 0; - int32_t slist_len = 0; + uint32_t index_len = 0; + uint32_t slist_len = 0; size_t index_size = (size_t)0; size_t clean_index_size = (size_t)0; size_t dirty_index_size = (size_t)0; @@ -5383,7 +5182,7 @@ H5C_flush_invalidate_cache(H5F_t *f, hid_t dxpl_id, unsigned flags) /* remove ageout markers if present */ if(cache_ptr->epoch_markers_active > 0) if(H5C__autoadjust__ageout__remove_all_markers(cache_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "error removing all epoch markers.") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "error removing all epoch markers") /* flush invalidate each ring, starting from the outermost ring and * working inward. @@ -5391,7 +5190,7 @@ H5C_flush_invalidate_cache(H5F_t *f, hid_t dxpl_id, unsigned flags) ring = H5C_RING_USER; while(ring < H5C_RING_NTYPES) { if(H5C_flush_invalidate_ring(f, dxpl_id, ring, flags) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "flush invalidate ring failed.") + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "flush invalidate ring failed") ring++; } /* end while */ @@ -5479,7 +5278,7 @@ H5C_flush_invalidate_ring(H5F_t * f, hid_t dxpl_id, H5C_ring_t ring, { H5C_t *cache_ptr; hbool_t restart_slist_scan; - int32_t protected_entries = 0; + uint32_t protected_entries = 0; int32_t i; int32_t cur_ring_pel_len; int32_t old_ring_pel_len; @@ -5489,7 +5288,7 @@ H5C_flush_invalidate_ring(H5F_t * f, hid_t dxpl_id, H5C_ring_t ring, H5C_cache_entry_t *entry_ptr = NULL; H5C_cache_entry_t *next_entry_ptr = NULL; #if H5C_DO_SANITY_CHECKS - int64_t initial_slist_len = 0; + uint32_t initial_slist_len = 0; size_t initial_slist_size = 0; #endif /* H5C_DO_SANITY_CHECKS */ herr_t ret_value = SUCCEED; @@ -5674,9 +5473,10 @@ H5C_flush_invalidate_ring(H5F_t * f, hid_t dxpl_id, H5C_ring_t ring, * everything we can before we flag an error. */ protected_entries++; - } else if(entry_ptr->is_pinned) { + } /* end if */ + else if(entry_ptr->is_pinned) { if(H5C__flush_single_entry(f, dxpl_id, entry_ptr, H5C__DURING_FLUSH_FLAG) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "dirty pinned entry flush failed.") + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "dirty pinned entry flush failed") if(cache_ptr->slist_changed) { /* The slist has been modified by something @@ -5690,10 +5490,10 @@ H5C_flush_invalidate_ring(H5F_t * f, hid_t dxpl_id, H5C_ring_t ring, cache_ptr->slist_changed = FALSE; H5C__UPDATE_STATS_FOR_SLIST_SCAN_RESTART(cache_ptr); } /* end if */ - } /* end if */ + } /* end else-if */ else { if(H5C__flush_single_entry(f, dxpl_id, entry_ptr, (cooked_flags | H5C__DURING_FLUSH_FLAG | H5C__FLUSH_INVALIDATE_FLAG | H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG)) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "dirty entry flush destroy failed.") + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "dirty entry flush destroy failed") if(cache_ptr->slist_changed) { /* The slist has been modified by something @@ -5722,8 +5522,8 @@ H5C_flush_invalidate_ring(H5F_t * f, hid_t dxpl_id, H5C_ring_t ring, */ if(node_ptr == NULL) { - HDassert(cache_ptr->slist_len == (initial_slist_len + cache_ptr->slist_len_increase)); - HDassert((int64_t)cache_ptr->slist_size == ((int64_t)initial_slist_size + cache_ptr->slist_size_increase)); + HDassert(cache_ptr->slist_len == (uint32_t)((int32_t)initial_slist_len + cache_ptr->slist_len_increase)); + HDassert(cache_ptr->slist_size == (size_t)((ssize_t)initial_slist_size + cache_ptr->slist_size_increase)); } /* end if */ #endif /* H5C_DO_SANITY_CHECKS */ @@ -5797,7 +5597,7 @@ H5C_flush_invalidate_ring(H5F_t * f, hid_t dxpl_id, H5C_ring_t ring, cache_ptr->entry_watched_for_removal = next_entry_ptr; if(H5C__flush_single_entry(f, dxpl_id, entry_ptr, (cooked_flags | H5C__DURING_FLUSH_FLAG | H5C__FLUSH_INVALIDATE_FLAG | H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG)) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Entry flush destroy failed.") + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Entry flush destroy failed") /* Restart the index list scan if necessary. Must * do this if the next entry is evicted, and also if @@ -5878,9 +5678,9 @@ H5C_flush_invalidate_ring(H5F_t * f, hid_t dxpl_id, H5C_ring_t ring, HDassert(protected_entries <= cache_ptr->pl_len); if(protected_entries > 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Cache has protected entries.") + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Cache has protected entries") else if(cur_ring_pel_len > 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't unpin all pinned entries in ring.") + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't unpin all pinned entries in ring") done: FUNC_LEAVE_NOAPI(ret_value) @@ -5920,12 +5720,12 @@ H5C_flush_ring(H5F_t *f, hid_t dxpl_id, H5C_ring_t ring, unsigned flags) hbool_t ignore_protected; hbool_t tried_to_flush_protected_entry = FALSE; hbool_t restart_slist_scan; - int32_t protected_entries = 0; + uint32_t protected_entries = 0; H5SL_node_t * node_ptr = NULL; H5C_cache_entry_t * entry_ptr = NULL; H5C_cache_entry_t * next_entry_ptr = NULL; #if H5C_DO_SANITY_CHECKS - int64_t initial_slist_len = 0; + uint32_t initial_slist_len = 0; size_t initial_slist_size = 0; #endif /* H5C_DO_SANITY_CHECKS */ int i; @@ -5944,7 +5744,7 @@ H5C_flush_ring(H5F_t *f, hid_t dxpl_id, H5C_ring_t ring, unsigned flags) if((H5C_validate_protected_entry_list(cache_ptr) < 0) || (H5C_validate_pinned_entry_list(cache_ptr) < 0) || (H5C_validate_lru_list(cache_ptr) < 0)) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on entry.\n") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on entry") #endif /* H5C_DO_EXTREME_SANITY_CHECKS */ ignore_protected = ( (flags & H5C__FLUSH_IGNORE_PROTECTED_FLAG) != 0 ); @@ -6108,7 +5908,7 @@ H5C_flush_ring(H5F_t *f, hid_t dxpl_id, H5C_ring_t ring, unsigned flags) } /* end if */ else { if(H5C__flush_single_entry(f, dxpl_id, entry_ptr, (flags | H5C__DURING_FLUSH_FLAG)) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't flush entry.") + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't flush entry") if(cache_ptr->slist_changed) { /* The slist has been modified by something @@ -6130,8 +5930,8 @@ H5C_flush_ring(H5F_t *f, hid_t dxpl_id, H5C_ring_t ring, unsigned flags) #if H5C_DO_SANITY_CHECKS /* Verify that the slist size and length are as expected. */ - HDassert((initial_slist_len + cache_ptr->slist_len_increase) == cache_ptr->slist_len); - HDassert((size_t)((int64_t)initial_slist_size + cache_ptr->slist_size_increase) == cache_ptr->slist_size); + HDassert((uint32_t)((int32_t)initial_slist_len + cache_ptr->slist_len_increase) == cache_ptr->slist_len); + HDassert((size_t)((ssize_t)initial_slist_size + cache_ptr->slist_size_increase) == cache_ptr->slist_size); #endif /* H5C_DO_SANITY_CHECKS */ } /* while */ @@ -6183,34 +5983,6 @@ done: * * Programmer: John Mainzer, 5/5/04 * - * Changes: Refactored function to remove the type_ptr parameter. - * - * JRM -- 8/7/14 - * - * Added code to check for slist changes in pre_serialize and - * serialize calls, and set - * cache_ptr->slist_change_in_pre_serialize and - * cache_ptr->slist_change_in_serialize as appropriate. - * - * JRM -- 12/13/14 - * - * Refactored function to delay all modifications of the - * metadata cache data structures until after any calls - * to the pre-serialize or serialize callbacks. - * - * Need to do this, as some pre-serialize or serialize - * calls result in calls to the metadata cache and - * modifications to its data structures. Thus, at the - * time of any such call, the target entry flags and - * the metadata cache must all be consistant. - * - * Also added the entry_size_change_ptr parameter, which - * allows the function to report back any change in the size - * of the entry during the flush. Such size changes may - * occur during the pre-serialize callback. - * - * JRM -- 12/24/14 - * *------------------------------------------------------------------------- */ herr_t @@ -6228,6 +6000,8 @@ H5C__flush_single_entry(H5F_t *f, hid_t dxpl_id, H5C_cache_entry_t *entry_ptr, hbool_t destroy_entry; /* internal flag */ hbool_t generate_image; /* internal flag */ hbool_t was_dirty; + hbool_t suppress_image_entry_writes = FALSE; + hbool_t suppress_image_entry_frees = FALSE; haddr_t entry_addr = HADDR_UNDEF; herr_t ret_value = SUCCEED; /* Return value */ @@ -6240,6 +6014,7 @@ H5C__flush_single_entry(H5F_t *f, hid_t dxpl_id, H5C_cache_entry_t *entry_ptr, HDassert(entry_ptr); HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); HDassert(entry_ptr->ring != H5C_RING_UNDEFINED); + HDassert(entry_ptr->type); /* setup external flags from the flags parameter */ destroy = ((flags & H5C__FLUSH_INVALIDATE_FLAG) != 0); @@ -6270,44 +6045,64 @@ H5C__flush_single_entry(H5F_t *f, hid_t dxpl_id, H5C_cache_entry_t *entry_ptr, else write_entry = FALSE; + /* if we have received close warning, and we have been instructed to + * generate a metadata cache image, and we have actually constructed + * the entry images, set suppress_image_entry_frees to TRUE. + * + * Set suppress_image_entry_writes to TRUE if indicated by the + * image_ctl flags. + */ + if(cache_ptr->close_warning_received && cache_ptr->image_ctl.generate_image + && cache_ptr->num_entries_in_image > 0 && cache_ptr->image_entries) { + /* Sanity checks */ + HDassert(entry_ptr->image_up_to_date || !(entry_ptr->include_in_image)); + HDassert(entry_ptr->image_ptr || !(entry_ptr->include_in_image)); + HDassert((!clear_only) || !(entry_ptr->include_in_image)); + HDassert((!take_ownership) || !(entry_ptr->include_in_image)); + HDassert((!free_file_space) || !(entry_ptr->include_in_image)); + + suppress_image_entry_frees = TRUE; + + if(cache_ptr->image_ctl.flags & H5C_CI__SUPRESS_ENTRY_WRITES) + suppress_image_entry_writes = TRUE; + } /* end if */ + /* run initial sanity checks */ #if H5C_DO_SANITY_CHECKS if(entry_ptr->in_slist) { HDassert(entry_ptr->is_dirty); if((entry_ptr->flush_marker) && (!entry_ptr->is_dirty)) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "entry in slist failed sanity checks.") - } else { + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "entry in slist failed sanity checks") + } /* end if */ + else { HDassert(!entry_ptr->is_dirty); HDassert(!entry_ptr->flush_marker); if((entry_ptr->is_dirty) || (entry_ptr->flush_marker)) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "entry failed sanity checks.") - } + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "entry failed sanity checks") + } /* end else */ #endif /* H5C_DO_SANITY_CHECKS */ if(entry_ptr->is_protected) { HDassert(!entry_ptr->is_protected); /* Attempt to flush a protected entry -- scream and die. */ - HGOTO_ERROR(H5E_CACHE, H5E_PROTECT, FAIL, "Attempt to flush a protected entry.") + HGOTO_ERROR(H5E_CACHE, H5E_PROTECT, FAIL, "Attempt to flush a protected entry") } /* end if */ - /* set entry_ptr->flush_in_progress = TRUE and set + /* Set entry_ptr->flush_in_progress = TRUE and set * entry_ptr->flush_marker = FALSE * - * in the parallel case, do some sanity checking in passing. - */ - HDassert(entry_ptr->type); - - was_dirty = entry_ptr->is_dirty; /* needed later for logging */ - - /* We will set flush_in_progress back to FALSE at the end if the + * We will set flush_in_progress back to FALSE at the end if the * entry still exists at that point. */ entry_ptr->flush_in_progress = TRUE; entry_ptr->flush_marker = FALSE; + /* Preserve current dirty state for later */ + was_dirty = entry_ptr->is_dirty; + /* The entry is dirty, and we are doing a flush, a flush destroy or have * been requested to generate an image. In those cases, serialize the * entry. @@ -6324,6 +6119,9 @@ H5C__flush_single_entry(H5F_t *f, hid_t dxpl_id, H5C_cache_entry_t *entry_ptr, } /* end if */ if(!(entry_ptr->image_up_to_date)) { + /* Sanity check */ + HDassert(!entry_ptr->prefetched); + /* Generate the entry's image */ if(H5C__generate_image(f, cache_ptr, entry_ptr, dxpl_id) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "can't generate entry's image") @@ -6344,7 +6142,17 @@ H5C__flush_single_entry(H5F_t *f, hid_t dxpl_id, H5C_cache_entry_t *entry_ptr, HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Write when writes are always forbidden!?!?!") #endif /* H5C_DO_SANITY_CHECKS */ - if(((entry_ptr->type->flags) & H5C__CLASS_SKIP_WRITES) == 0) { + /* Write the image to disk unless the write is suppressed. + * + * This happens if both suppress_image_entry_writes and + * entry_ptr->include_in_image are TRUE, or if the + * H5AC__CLASS_SKIP_WRITES is set in the entry's type. This + * flag should only be used in test code + */ + if((!suppress_image_entry_writes || !entry_ptr->include_in_image) + && (((entry_ptr->type->flags) & H5C__CLASS_SKIP_WRITES) == 0)) { + H5FD_mem_t mem_type = H5FD_MEM_DEFAULT; + #ifdef H5_HAVE_PARALLEL if(cache_ptr->coll_write_list) { if(H5SL_insert(cache_ptr->coll_write_list, entry_ptr, &entry_ptr->addr) < 0) @@ -6352,8 +6160,16 @@ H5C__flush_single_entry(H5F_t *f, hid_t dxpl_id, H5C_cache_entry_t *entry_ptr, } /* end if */ else #endif /* H5_HAVE_PARALLEL */ - if(H5F_block_write(f, entry_ptr->type->mem_type, entry_ptr->addr, entry_ptr->size, dxpl_id, entry_ptr->image_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't write image to file.") + + if(entry_ptr->prefetched) { + HDassert(entry_ptr->type->id == H5AC_PREFETCHED_ENTRY_ID); + mem_type = cache_ptr->class_table_ptr[entry_ptr->prefetch_type_id]->mem_type; + } /* end if */ + else + mem_type = entry_ptr->type->mem_type; + + if(H5F_block_write(f, mem_type, entry_ptr->addr, entry_ptr->size, dxpl_id, entry_ptr->image_ptr) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't write image to file") } /* end if */ /* if the entry has a notify callback, notify it that we have @@ -6497,10 +6313,29 @@ H5C__flush_single_entry(H5F_t *f, hid_t dxpl_id, H5C_cache_entry_t *entry_ptr, /* Sanity check */ HDassert(0 == entry_ptr->flush_dep_nparents); - /* Start by freeing the buffer for the on disk image */ - if(entry_ptr->image_ptr != NULL) + /* if both suppress_image_entry_frees and entry_ptr->include_in_image + * are true, simply set entry_ptr->image_ptr to NULL, as we have + * another pointer to the buffer in an instance of H5C_image_entry_t + * in cache_ptr->image_entries. + * + * Otherwise, free the buffer if it exists. + */ + if(suppress_image_entry_frees && entry_ptr->include_in_image) + entry_ptr->image_ptr = NULL; + else if(entry_ptr->image_ptr != NULL) entry_ptr->image_ptr = H5MM_xfree(entry_ptr->image_ptr); + /* If the entry is not a prefetched entry, verify that the flush + * dependency parents addresses array has been transfered. + * + * If the entry is prefetched, the free_isr routine will dispose of + * the flush dependency parents adresses array if necessary. + */ + if(!entry_ptr->prefetched) { + HDassert(0 == entry_ptr->fd_parent_count); + HDassert(NULL == entry_ptr->fd_parent_addrs); + } /* end if */ + /* Check whether we should free the space in the file that * the entry occupies */ @@ -6584,7 +6419,7 @@ H5C__flush_single_entry(H5F_t *f, hid_t dxpl_id, H5C_cache_entry_t *entry_ptr, HDassert(entry_ptr->image_ptr == NULL); if(entry_ptr->type->free_icr((void *)entry_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "free_icr callback failed.") + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "free_icr callback failed") } /* end if */ else { HDassert(take_ownership); @@ -6599,12 +6434,11 @@ H5C__flush_single_entry(H5F_t *f, hid_t dxpl_id, H5C_cache_entry_t *entry_ptr, if(cache_ptr->log_flush) if((cache_ptr->log_flush)(cache_ptr, entry_addr, was_dirty, flags) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "log_flush callback failed.") + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "log_flush callback failed") done: HDassert( ( ret_value != SUCCEED ) || ( destroy_entry ) || ( ! entry_ptr->flush_in_progress ) ); - HDassert( ( ret_value != SUCCEED ) || ( destroy_entry ) || ( take_ownership ) || ( ! entry_ptr->is_dirty ) ); @@ -6662,14 +6496,14 @@ H5C__verify_len_eoa(H5F_t *f, const H5C_class_t *type, haddr_t addr, /* Check if the amount of data to read will be past the EOA */ if(H5F_addr_gt((addr + *len), eoa)) { if(actual) - HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "actual len exceeds EOA.") + HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "actual len exceeds EOA") else /* Trim down the length of the metadata */ *len = (size_t)(eoa - addr); } /* end if */ if(*len <= 0) - HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "len not positive after adjustment for EOA.") + HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "len not positive after adjustment for EOA") done: FUNC_LEAVE_NOAPI(ret_value) @@ -6749,7 +6583,7 @@ H5C_load_entry(H5F_t * f, /* Allocate the buffer for reading the on-disk entry image */ if(NULL == (image = (uint8_t *)H5MM_malloc(len + H5C_IMAGE_EXTRA_SPACE))) - HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, NULL, "memory allocation failed for on disk image buffer.") + HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, NULL, "memory allocation failed for on disk image buffer") #if H5C_DO_MEMORY_SANITY_CHECKS HDmemcpy(image + len, H5C_IMAGE_SANITY_VALUE, H5C_IMAGE_EXTRA_SPACE); #endif /* H5C_DO_MEMORY_SANITY_CHECKS */ @@ -6826,7 +6660,7 @@ H5C_load_entry(H5F_t * f, if(actual_len != len) { /* Verify that the length isn't past the EOA for the file */ if(H5C__verify_len_eoa(f, type, addr, &actual_len, TRUE) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, NULL, "actual_len exceeds EOA.") + HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, NULL, "actual_len exceeds EOA") /* Expand buffer to new size */ if(NULL == (new_image = H5MM_realloc(image, actual_len + H5C_IMAGE_EXTRA_SPACE))) @@ -6976,6 +6810,22 @@ H5C_load_entry(H5F_t * f, entry->coll_prev = NULL; #endif /* H5_HAVE_PARALLEL */ + /* initialize cache image related fields */ + entry->include_in_image = FALSE; + entry->lru_rank = 0; + entry->image_dirty = FALSE; + entry->fd_parent_count = 0; + entry->fd_parent_addrs = NULL; + entry->fd_child_count = 0; + entry->fd_dirty_child_count = 0; + entry->image_fd_height = 0; + entry->prefetched = FALSE; + entry->prefetch_type_id = 0; + entry->age = 0; +#ifndef NDEBUG /* debugging field */ + entry->serialization_count = 0; +#endif /* NDEBUG */ + H5C__RESET_CACHE_ENTRY_STATS(entry); ret_value = thing; @@ -6996,7 +6846,7 @@ done: /*------------------------------------------------------------------------- * - * Function: H5C_make_space_in_cache + * Function: H5C__make_space_in_cache * * Purpose: Attempt to evict cache entries until the index_size * is at least needed_space below max_cache_size. @@ -7027,53 +6877,19 @@ done: * * Programmer: John Mainzer, 5/14/04 * - * Changes: Modified function to skip over entries with the - * flush_in_progress flag set. If this is not done, - * an infinite recursion is possible if the cache is - * full, and the pre-serialize or serialize routine - * attempts to load another entry. - * - * This error was exposed by a re-factor of the - * H5C__flush_single_entry() routine. However, it was - * a potential bug from the moment that entries were - * allowed to load other entries on flush. - * - * In passing, note that the primary and secondary dxpls - * mentioned in the comment above have been replaced by - * a single dxpl at some point, and thus the discussion - * above is somewhat obsolete. Date of this change is - * unkown. - * - * JRM -- 12/26/14 - * - * Modified function to detect deletions of entries - * during a scan of the LRU, and where appropriate, - * restart the scan to avoid proceeding with a next - * entry that is no longer in the cache. - * - * Note the absence of checks after flushes of clean - * entries. As a second entry can only be removed by - * by a call to the pre_serialize or serialize callback - * of the first, and as these callbacks will not be called - * on clean entries, no checks are needed. - * - * JRM -- 4/6/15 - * *------------------------------------------------------------------------- */ -static herr_t -H5C_make_space_in_cache(H5F_t * f, - hid_t dxpl_id, - size_t space_needed, - hbool_t write_permitted) +herr_t +H5C__make_space_in_cache(H5F_t *f, hid_t dxpl_id, size_t space_needed, + hbool_t write_permitted) { H5C_t * cache_ptr = f->shared->cache; #if H5C_COLLECT_CACHE_STATS int32_t clean_entries_skipped = 0; int32_t total_entries_scanned = 0; #endif /* H5C_COLLECT_CACHE_STATS */ - int32_t entries_examined = 0; - int32_t initial_list_len; + uint32_t entries_examined = 0; + uint32_t initial_list_len; size_t empty_space; hbool_t prev_is_dirty = FALSE; hbool_t didnt_flush_entry = FALSE; @@ -7081,33 +6897,27 @@ H5C_make_space_in_cache(H5F_t * f, H5C_cache_entry_t * entry_ptr; H5C_cache_entry_t * prev_ptr; H5C_cache_entry_t * next_ptr; - int32_t num_corked_entries = 0; + uint32_t num_corked_entries = 0; herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE - HDassert( f ); - HDassert( cache_ptr ); - HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC ); - HDassert( cache_ptr->index_size == - (cache_ptr->clean_index_size + cache_ptr->dirty_index_size) ); + /* Sanity checks */ + HDassert(f); + HDassert(cache_ptr); + HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); + HDassert(cache_ptr->index_size == (cache_ptr->clean_index_size + cache_ptr->dirty_index_size)); if ( write_permitted ) { - restart_scan = FALSE; initial_list_len = cache_ptr->LRU_list_len; entry_ptr = cache_ptr->LRU_tail_ptr; - if ( cache_ptr->index_size >= cache_ptr->max_cache_size ) { - + if(cache_ptr->index_size >= cache_ptr->max_cache_size) empty_space = 0; - - } else { - + else empty_space = cache_ptr->max_cache_size - cache_ptr->index_size; - } - while ( ( ( (cache_ptr->index_size + space_needed) > cache_ptr->max_cache_size @@ -7353,10 +7163,8 @@ H5C_make_space_in_cache(H5F_t * f, } done: - FUNC_LEAVE_NOAPI(ret_value) - -} /* H5C_make_space_in_cache() */ +} /* H5C__make_space_in_cache() */ /*------------------------------------------------------------------------- @@ -8166,6 +7974,515 @@ H5C__assert_flush_dep_nocycle(const H5C_cache_entry_t * entry, /*------------------------------------------------------------------------- + * Function: H5C__serialize_cache + * + * Purpose: Serialize (i.e. construct an on disk image) for all entries + * in the metadata cache including clean entries. + * + * Note that flush dependencies and "flush me last" flags + * must be observed in the serialization process. + * + * Note also that entries may be loaded, flushed, evicted, + * expunged, relocated, resized, or removed from the cache + * during this process, just as these actions may occur during + * a regular flush. + * + * However, we are given that the cache will contain no protected + * entries on entry to this routine (although entries may be + * briefly protected and then unprotected during the serialize + * process). + * + * The objective of this routine is serialize all entries and + * to force all entries into their actual locations on disk. + * + * The initial need for this routine is to settle all entries + * in the cache prior to construction of the metadata cache + * image so that the size of the cache image can be calculated. + * However, I gather that other uses for the routine are + * under consideration. + * + * Return: Non-negative on success/Negative on failure or if there was + * a request to flush all items and something was protected. + * + * Programmer: John Mainzer + * 7/22/15 + * + *------------------------------------------------------------------------- + */ +herr_t +H5C__serialize_cache(H5F_t *f, hid_t dxpl_id) +{ +#if H5C_DO_SANITY_CHECKS + int i; + uint32_t index_len = 0; + size_t index_size = (size_t)0; + size_t clean_index_size = (size_t)0; + size_t dirty_index_size = (size_t)0; + size_t slist_size = (size_t)0; + uint32_t slist_len = 0; +#endif /* H5C_DO_SANITY_CHECKS */ + H5C_ring_t ring; + H5C_t * cache_ptr; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_PACKAGE + + /* Sanity checks */ + HDassert(f); + HDassert(f->shared); + cache_ptr = f->shared->cache; + HDassert(cache_ptr); + HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); + HDassert(cache_ptr->slist_ptr); + +#if H5C_DO_SANITY_CHECKS + HDassert(cache_ptr->index_ring_len[H5C_RING_UNDEFINED] == 0); + HDassert(cache_ptr->index_ring_size[H5C_RING_UNDEFINED] == (size_t)0); + HDassert(cache_ptr->clean_index_ring_size[H5C_RING_UNDEFINED] == (size_t)0); + HDassert(cache_ptr->dirty_index_ring_size[H5C_RING_UNDEFINED] == (size_t)0); + HDassert(cache_ptr->slist_ring_len[H5C_RING_UNDEFINED] == 0); + HDassert(cache_ptr->slist_ring_size[H5C_RING_UNDEFINED] == (size_t)0); + + for(i = H5C_RING_USER; i < H5C_RING_NTYPES; i++) { + index_len += cache_ptr->index_ring_len[i]; + index_size += cache_ptr->index_ring_size[i]; + clean_index_size += cache_ptr->clean_index_ring_size[i]; + dirty_index_size += cache_ptr->dirty_index_ring_size[i]; + + slist_len += cache_ptr->slist_ring_len[i]; + slist_size += cache_ptr->slist_ring_size[i]; + } /* end for */ + + HDassert(cache_ptr->index_len == index_len); + HDassert(cache_ptr->index_size == index_size); + HDassert(cache_ptr->clean_index_size == clean_index_size); + HDassert(cache_ptr->dirty_index_size == dirty_index_size); + HDassert(cache_ptr->slist_len == slist_len); + HDassert(cache_ptr->slist_size == slist_size); +#endif /* H5C_DO_SANITY_CHECKS */ + +#if H5C_DO_EXTREME_SANITY_CHECKS + if((H5C_validate_protected_entry_list(cache_ptr) < 0) || + (H5C_validate_pinned_entry_list(cache_ptr) < 0) || + (H5C_validate_lru_list(cache_ptr) < 0)) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on entry") +#endif /* H5C_DO_EXTREME_SANITY_CHECKS */ + +#ifndef NDEBUG + /* if this is a debug build, set the serialization_count field of + * each entry in the cache to zero before we start the serialization. + * This allows us to detect the case in which any entry is serialized + * more than once (a performance issues), and more importantly, the + * case is which any flush depencency parent is serializes more than + * once (a correctness issue). + */ + { + H5C_cache_entry_t * scan_ptr = NULL; + + scan_ptr = cache_ptr->il_head; + while(scan_ptr != NULL) { + HDassert(scan_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); + scan_ptr->serialization_count = 0; + scan_ptr = scan_ptr->il_next; + } /* end while */ + } /* end block */ +#endif /* NDEBUG */ + + /* set cache_ptr->serialization_in_progress to TRUE, and back + * to FALSE at the end of the function. Must maintain this flag + * to support H5C_get_serialization_in_progress(), which is in + * turn required to support sanity checking in some cache + * clients. + */ + HDassert(!cache_ptr->serialization_in_progress); + cache_ptr->serialization_in_progress = TRUE; + + /* Serialize each ring, starting from the outermost ring and + * working inward. + */ + ring = H5C_RING_USER; + while(ring < H5C_RING_NTYPES) { + HDassert(cache_ptr->close_warning_received); + switch(ring) { + case H5C_RING_USER: + break; + + case H5C_RING_RDFSM: + /* Settle raw data FSM */ + if(!cache_ptr->rdfsm_settled) + if(H5MF_settle_raw_data_fsm(f, dxpl_id, &cache_ptr->rdfsm_settled) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "RD FSM settle failed") + break; + + case H5C_RING_MDFSM: + /* Settle metadata FSM */ + if(!cache_ptr->mdfsm_settled) + if(H5MF_settle_meta_data_fsm(f, dxpl_id, &cache_ptr->mdfsm_settled) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "MD FSM settle failed") + break; + + case H5C_RING_SBE: + case H5C_RING_SB: + break; + + default: + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Unknown ring?!?!") + break; + } /* end switch */ + + if(H5C__serialize_ring(f, dxpl_id, ring) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTSERIALIZE, FAIL, "serialize ring failed") + + ring++; + } /* end while */ + +#ifndef NDEBUG + /* Verify that no entry has been serialized more than once. + * FD parents with multiple serializations should have been caught + * elsewhere, so no specific check for them here. + */ + { + H5C_cache_entry_t * scan_ptr = NULL; + + scan_ptr = cache_ptr->il_head; + while(scan_ptr != NULL) { + HDassert(scan_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); + HDassert(scan_ptr->serialization_count <= 1); + + scan_ptr = scan_ptr->il_next; + } /* end while */ + } /* end block */ +#endif /* NDEBUG */ + +done: + cache_ptr->serialization_in_progress = FALSE; + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C__serialize_cache() */ + + +/*------------------------------------------------------------------------- + * Function: H5C__serialize_ring + * + * Purpose: Serialize the entries contained in the specified cache and + * ring. All entries in rings outside the specified ring + * must have been serialized on entry. + * + * If the cache contains protected entries in the specified + * ring, the function will fail, as protected entries cannot + * be serialized. However all unprotected entries in the + * target ring should be serialized before the function + * returns failure. + * + * If flush dependencies appear in the target ring, the + * function makes repeated passes through the index list + * serializing entries in flush dependency order. + * + * All entries outside the H5C_RING_SBE are marked for + * inclusion in the cache image. Entries in H5C_RING_SBE + * and below are marked for exclusion from the image. + * + * Return: Non-negative on success/Negative on failure or if there was + * a request to flush all items and something was protected. + * + * Programmer: John Mainzer + * 9/11/15 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5C__serialize_ring(H5F_t *f, hid_t dxpl_id, H5C_ring_t ring) +{ + hbool_t done = FALSE; + H5C_t * cache_ptr; + H5C_cache_entry_t * entry_ptr; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_STATIC + + /* Sanity checks */ + HDassert(f); + HDassert(f->shared); + cache_ptr = f->shared->cache; + HDassert(cache_ptr); + HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); + HDassert(ring > H5C_RING_UNDEFINED); + HDassert(ring < H5C_RING_NTYPES); + + HDassert(cache_ptr->serialization_in_progress); + + /* The objective here is to serialize all entries in the cache ring + * in flush dependency order. + * + * The basic algorithm is to scan the cache index list looking for + * unserialized entries that are either not in a flush dependency + * relationship, or which have no unserialized children. Any such + * entry is serialized and its flush dependency parents (if any) are + * informed -- allowing them to decrement their userialized child counts. + * + * However, this algorithm is complicated by the ability + * of client serialization callbacks to perform operations on + * on the cache which can result in the insertion, deletion, + * relocation, resize, dirty, flush, eviction, or removal (via the + * take ownership flag) of entries. Changes in the flush dependency + * structure are also possible. + * + * On the other hand, the algorithm is simplified by the fact that + * we are serializing, not flushing. Thus, as long as all entries + * are serialized correctly, it doesn't matter if we have to go back + * and serialize an entry a second time. + * + * These possible actions result in the following modfications to + * tha basic algorithm: + * + * 1) In the event of an entry expunge, eviction or removal, we must + * restart the scan as it is possible that the next entry in our + * scan is no longer in the cache. Were we to examine this entry, + * we would be accessing deallocated memory. + * + * 2) A resize, dirty, or insertion of an entry may result in the + * the increment of a flush dependency parent's dirty and/or + * unserialized child count. In the context of serializing the + * the cache, this is a non-issue, as even if we have already + * serialized the parent, it will be marked dirty and its image + * marked out of date if appropriate when the child is serialized. + * + * However, this is a major issue for a flush, as were this to happen + * in a flush, it would violate the invariant that the flush dependency + * feature is intended to enforce. As the metadata cache has no + * control over the behavior of cache clients, it has no way of + * preventing this behaviour. However, it should detect it if at all + * possible. + * + * Do this by maintaining a count of the number of times each entry is + * serialized during a cache serialization. If any flush dependency + * parent is serialized more than once, throw an assertion failure. + * + * 3) An entry relocation will typically change the location of the + * entry in the index list. This shouldn't cause problems as we + * will scan the index list until we make a complete pass without + * finding anything to serialize -- making relocations of either + * the current or next entries irrelevant. + * + * Note that since a relocation may result in our skipping part of + * the index list, we must always do at least one more pass through + * the index list after an entry relocation. + * + * 4) Changes in the flush dependency structure are possible on + * entry insertion, load, expunge, evict, or remove. Destruction + * of a flush dependency has no effect, as it can only relax the + * flush dependencies. Creation of a flush dependency can create + * an unserialized child of a flush dependency parent where all + * flush dependency children were previously serialized. Should + * this child dirty the flush dependency parent when it is serialized, + * the parent will be re-serialized. + * + * Per the discussion of 2) above, this is a non issue for cache + * serialization, and a major problem for cache flush. Using the + * same detection mechanism, throw an assertion failure if this + * condition appears. + * + * Observe that either eviction or removal of entries as a result of + * a serialization is not a problem as long as the flush depencency + * tree does not change beyond the removal of a leaf. + */ + while(!done) { + /* Reset the counters so that we can detect insertions, loads, + * moves, and flush dependency height changes caused by the pre_serialize + * and serialize callbacks. + */ + cache_ptr->entries_loaded_counter = 0; + cache_ptr->entries_inserted_counter = 0; + cache_ptr->entries_relocated_counter = 0; + + done = TRUE; /* set to FALSE if any activity in inner loop */ + entry_ptr = cache_ptr->il_head; + while(entry_ptr != NULL) { + HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); + + /* Verify that either the entry is already serialized, or + * that it is assigned to either the target or an inner + * ring. + */ + HDassert((entry_ptr->ring >= ring) || (entry_ptr->image_up_to_date)); + + /* Skip flush me last entries or inner ring entries */ + if(!entry_ptr->flush_me_last && entry_ptr->ring == ring) { + + /* if we encounter an unserialized entry in the current + * ring that is not marked flush me last, we are not done. + */ + if(!entry_ptr->image_up_to_date) + done = FALSE; + + /* Serialize the entry if its image is not up to date + * and it has no unserialized flush dependency children. + */ + if(!entry_ptr->image_up_to_date && entry_ptr->flush_dep_nunser_children == 0) { + HDassert(entry_ptr->serialization_count == 0); + + /* Serialize the entry */ + if(H5C__serialize_single_entry(f, dxpl_id, cache_ptr, entry_ptr) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTSERIALIZE, FAIL, "entry serialization failed") + + HDassert(entry_ptr->flush_dep_nunser_children == 0); + HDassert(entry_ptr->serialization_count == 0); + +#ifndef NDEBUG + /* Increment serialization counter (to detect multiple serializations) */ + entry_ptr->serialization_count++; +#endif /* NDEBUG */ + } /* end if */ + } /* end if */ + + /* Check for the cache being perturbed during the entry serialize */ + if((cache_ptr->entries_loaded_counter > 0) || + (cache_ptr->entries_inserted_counter > 0) || + (cache_ptr->entries_relocated_counter > 0)) { + +#if H5C_COLLECT_CACHE_STATS + H5C__UPDATE_STATS_FOR_INDEX_SCAN_RESTART(cache_ptr); +#endif /* H5C_COLLECT_CACHE_STATS */ + + /* Reset the counters */ + cache_ptr->entries_loaded_counter = 0; + cache_ptr->entries_inserted_counter = 0; + cache_ptr->entries_relocated_counter = 0; + + /* Restart scan */ + entry_ptr = cache_ptr->il_head; + } /* end if */ + else + /* Advance to next entry */ + entry_ptr = entry_ptr->il_next; + } /* while ( entry_ptr != NULL ) */ + } /* while ( ! done ) */ + + + /* Reset the counters so that we can detect insertions, loads, + * moves, and flush dependency height changes caused by the pre_serialize + * and serialize callbacks. + */ + cache_ptr->entries_loaded_counter = 0; + cache_ptr->entries_inserted_counter = 0; + cache_ptr->entries_relocated_counter = 0; + + /* At this point, all entries not marked "flush me last" and in + * the current ring or outside it should be serialized and have up + * to date images. Scan the index list again to serialize the + * "flush me last" entries (if they are in the current ring) and to + * verify that all other entries have up to date images. + */ + entry_ptr = cache_ptr->il_head; + while(entry_ptr != NULL) { + HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); + HDassert(entry_ptr->ring > H5C_RING_UNDEFINED); + HDassert(entry_ptr->ring < H5C_RING_NTYPES); + HDassert((entry_ptr->ring >= ring) || (entry_ptr->image_up_to_date)); + + if(entry_ptr->ring == ring) { + if(entry_ptr->flush_me_last) { + if(!entry_ptr->image_up_to_date) { + HDassert(entry_ptr->serialization_count == 0); + HDassert(entry_ptr->flush_dep_nunser_children == 0); + + /* Serialize the entry */ + if(H5C__serialize_single_entry(f, dxpl_id, cache_ptr, entry_ptr) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTSERIALIZE, FAIL, "entry serialization failed") + + /* Check for the cache changing */ + if((cache_ptr->entries_loaded_counter > 0) || + (cache_ptr->entries_inserted_counter > 0) || + (cache_ptr->entries_relocated_counter > 0)) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "flush_me_last entry serialization triggered restart") + + HDassert(entry_ptr->flush_dep_nunser_children == 0); + HDassert(entry_ptr->serialization_count == 0); +#ifndef NDEBUG + /* Increment serialization counter (to detect multiple serializations) */ + entry_ptr->serialization_count++; +#endif /* NDEBUG */ + } /* end if */ + } /* end if */ + else { + HDassert(entry_ptr->image_up_to_date); + HDassert(entry_ptr->serialization_count <= 1); + HDassert(entry_ptr->flush_dep_nunser_children == 0); + } /* end else */ + } /* if ( entry_ptr->ring == ring ) */ + + entry_ptr = entry_ptr->il_next; + } /* while ( entry_ptr != NULL ) */ + +done: + HDassert(cache_ptr->serialization_in_progress); + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C__serialize_ring() */ + + +/*------------------------------------------------------------------------- + * Function: H5C__serialize_single_entry + * + * Purpose: Serialize the cache entry pointed to by the entry_ptr + * parameter. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: John Mainzer, 7/24/15 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5C__serialize_single_entry(H5F_t *f, hid_t dxpl_id, H5C_t *cache_ptr, + H5C_cache_entry_t *entry_ptr) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity checks */ + HDassert(f); + HDassert(cache_ptr); + HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); + HDassert(entry_ptr); + HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); + HDassert(!entry_ptr->prefetched); + HDassert(!entry_ptr->image_up_to_date); + HDassert(entry_ptr->is_dirty); + HDassert(!entry_ptr->is_protected); + HDassert(!entry_ptr->flush_in_progress); + HDassert(entry_ptr->type); + + /* Set entry_ptr->flush_in_progress to TRUE so the the target entry + * will not be evicted out from under us. Must set it back to FALSE + * when we are done. + */ + entry_ptr->flush_in_progress = TRUE; + + /* Allocate buffer for the entry image if required. */ + if(NULL == entry_ptr->image_ptr) { + HDassert(entry_ptr->size > 0); + if(NULL == (entry_ptr->image_ptr = H5MM_malloc(entry_ptr->size + H5C_IMAGE_EXTRA_SPACE)) ) + HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "memory allocation failed for on disk image buffer") +#if H5C_DO_MEMORY_SANITY_CHECKS + HDmemcpy(((uint8_t *)entry_ptr->image_ptr) + image_size, H5C_IMAGE_SANITY_VALUE, H5C_IMAGE_EXTRA_SPACE); +#endif /* H5C_DO_MEMORY_SANITY_CHECKS */ + } /* end if */ + + /* Generate image for entry */ + if(H5C__generate_image(f, cache_ptr, entry_ptr, dxpl_id) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTSERIALIZE, FAIL, "Can't generate image for cache entry") + + /* Reset the flush_in progress flag */ + entry_ptr->flush_in_progress = FALSE; + +done: + HDassert((ret_value != SUCCEED) || (!entry_ptr->flush_in_progress)); + HDassert((ret_value != SUCCEED) || (entry_ptr->image_up_to_date)); + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C__serialize_single_entry() */ + + +/*------------------------------------------------------------------------- * Function: H5C__generate_image * * Purpose: Serialize an entry and generate its image. @@ -8186,7 +8503,7 @@ H5C__assert_flush_dep_nocycle(const H5C_cache_entry_t * entry, * *------------------------------------------------------------------------- */ -static herr_t +herr_t H5C__generate_image(H5F_t *f, H5C_t *cache_ptr, H5C_cache_entry_t *entry_ptr, hid_t dxpl_id) { @@ -8196,10 +8513,18 @@ H5C__generate_image(H5F_t *f, H5C_t *cache_ptr, H5C_cache_entry_t *entry_ptr, unsigned serialize_flags = H5C__SERIALIZE_NO_FLAGS_SET; herr_t ret_value = SUCCEED; - FUNC_ENTER_STATIC + FUNC_ENTER_PACKAGE /* Sanity check */ + HDassert(f); + HDassert(cache_ptr); + HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); + HDassert(entry_ptr); + HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); HDassert(!entry_ptr->image_up_to_date); + HDassert(entry_ptr->is_dirty); + HDassert(!entry_ptr->is_protected); + HDassert(entry_ptr->type); /* make note of the entry's current address */ old_addr = entry_ptr->addr; @@ -8213,8 +8538,7 @@ H5C__generate_image(H5F_t *f, H5C_t *cache_ptr, H5C_cache_entry_t *entry_ptr, /* Check for any flags set in the pre-serialize callback */ if(serialize_flags != H5C__SERIALIZE_NO_FLAGS_SET) { /* Check for unexpected flags from serialize callback */ - if(serialize_flags & ~(H5C__SERIALIZE_RESIZED_FLAG | - H5C__SERIALIZE_MOVED_FLAG)) + if(serialize_flags & ~(H5C__SERIALIZE_RESIZED_FLAG | H5C__SERIALIZE_MOVED_FLAG)) HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unknown serialize flag(s)") #ifdef H5_HAVE_PARALLEL @@ -8245,12 +8569,15 @@ H5C__generate_image(H5F_t *f, H5C_t *cache_ptr, H5C_cache_entry_t *entry_ptr, * tests will be necessary. */ if(cache_ptr->aux_ptr != NULL) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "resize/move in serialize occured in parallel case.") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "resize/move in serialize occured in parallel case") #endif /* If required, resize the buffer and update the entry and the cache * data structures */ if(serialize_flags & H5C__SERIALIZE_RESIZED_FLAG) { + /* Sanity check */ + HDassert(new_len > 0); + /* Allocate a new image buffer */ if(NULL == (entry_ptr->image_ptr = H5MM_realloc(entry_ptr->image_ptr, new_len + H5C_IMAGE_EXTRA_SPACE))) HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "memory allocation failed for on disk image buffer") @@ -8261,9 +8588,8 @@ H5C__generate_image(H5F_t *f, H5C_t *cache_ptr, H5C_cache_entry_t *entry_ptr, /* Update statistics for resizing the entry */ H5C__UPDATE_STATS_FOR_ENTRY_SIZE_CHANGE(cache_ptr, entry_ptr, new_len); - /* update the hash table for the size change */ - H5C__UPDATE_INDEX_FOR_SIZE_CHANGE(cache_ptr, entry_ptr->size, \ - new_len, entry_ptr, !(entry_ptr->is_dirty)); + /* Update the hash table for the size change */ + H5C__UPDATE_INDEX_FOR_SIZE_CHANGE(cache_ptr, entry_ptr->size, new_len, entry_ptr, !(entry_ptr->is_dirty)); /* The entry can't be protected since we are in the process of * flushing it. Thus we must update the replacement policy data @@ -8276,10 +8602,11 @@ H5C__generate_image(H5F_t *f, H5C_t *cache_ptr, H5C_cache_entry_t *entry_ptr, * for the flush or flush destroy yet, the entry should * be in the slist. Thus update it for the size change. */ + HDassert(entry_ptr->is_dirty); HDassert(entry_ptr->in_slist); H5C__UPDATE_SLIST_FOR_SIZE_CHANGE(cache_ptr, entry_ptr->size, new_len); - /* finally, update the entry for its new size */ + /* Finally, update the entry for its new size */ entry_ptr->size = new_len; } /* end if */ @@ -8296,10 +8623,10 @@ H5C__generate_image(H5F_t *f, H5C_t *cache_ptr, H5C_cache_entry_t *entry_ptr, H5C__DELETE_FROM_INDEX(cache_ptr, entry_ptr, FAIL); H5C__REMOVE_ENTRY_FROM_SLIST(cache_ptr, entry_ptr, FALSE); - /* update the entry for its new address */ + /* Update the entry for its new address */ entry_ptr->addr = new_addr; - /* and then reinsert in the index and slist */ + /* And then reinsert in the index and slist */ H5C__INSERT_IN_INDEX(cache_ptr, entry_ptr, FAIL); H5C__INSERT_ENTRY_IN_SLIST(cache_ptr, entry_ptr, FAIL); } /* end if */ @@ -8316,6 +8643,13 @@ H5C__generate_image(H5F_t *f, H5C_t *cache_ptr, H5C_cache_entry_t *entry_ptr, #endif /* H5C_DO_MEMORY_SANITY_CHECKS */ entry_ptr->image_up_to_date = TRUE; + /* Propagate the fact that the entry is serialized up the + * flush dependency chain if appropriate. Since the image must + * have been out of date for this function to have been called + * (see assertion on entry), no need to check that -- only check + * for flush dependency parents. + */ + HDassert(entry_ptr->flush_dep_nunser_children == 0); if(entry_ptr->flush_dep_nparents > 0) if(H5C__mark_flush_dep_serialized(entry_ptr) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, "Can't propagate serialization status to fd parents") diff --git a/src/H5Cdbg.c b/src/H5Cdbg.c index 5697bff..eb5f123 100644 --- a/src/H5Cdbg.c +++ b/src/H5Cdbg.c @@ -35,6 +35,7 @@ /* Headers */ /***********/ #include "H5private.h" /* Generic Functions */ +#include "H5ACprivate.h" /* Metadata Cache */ #include "H5Cpkg.h" /* Cache */ #include "H5Eprivate.h" /* Error Handling */ @@ -53,10 +54,6 @@ /* Local Prototypes */ /********************/ -#if 0 /* debugging routines */ -herr_t H5C_dump_cache_skip_list(H5C_t *cache_ptr, char *calling_fcn); -#endif /* debugging routines */ - /*********************/ /* Package Variables */ @@ -104,7 +101,7 @@ H5C_dump_cache(H5C_t * cache_ptr, const char * cache_name) /* First, create a skip list */ if(NULL == (slist_ptr = H5SL_create(H5SL_TYPE_HADDR, NULL))) - HGOTO_ERROR(H5E_CACHE, H5E_CANTCREATE, FAIL, "can't create skip list.") + HGOTO_ERROR(H5E_CACHE, H5E_CANTCREATE, FAIL, "can't create skip list") /* Next, scan the index, and insert all entries in the skip list. * Do this, as we want to display cache entries in increasing address @@ -194,7 +191,7 @@ done: * *------------------------------------------------------------------------- */ -#if 0 /* debugging routine */ +#ifndef NDEBUG herr_t H5C_dump_cache_skip_list(H5C_t * cache_ptr, char * calling_fcn) { @@ -203,14 +200,14 @@ H5C_dump_cache_skip_list(H5C_t * cache_ptr, char * calling_fcn) H5C_cache_entry_t * entry_ptr = NULL; H5SL_node_t * node_ptr = NULL; - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_NOAPI_NOERR HDassert(cache_ptr != NULL); HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); HDassert(calling_fcn != NULL); HDfprintf(stdout, "\n\nDumping metadata cache skip list from %s.\n", calling_fcn); - HDfprintf(stdout, " slist len = %d.\n", cache_ptr->slist_len); + HDfprintf(stdout, " slist len = %u.\n", cache_ptr->slist_len); HDfprintf(stdout, " slist size = %lld.\n", (long long)(cache_ptr->slist_size)); if(cache_ptr->slist_len > 0) { @@ -240,9 +237,9 @@ H5C_dump_cache_skip_list(H5C_t * cache_ptr, char * calling_fcn) (int)(entry_ptr->is_dirty), entry_ptr->type->name); - HDfprintf(stdout, " node_ptr = 0x%llx, item = 0x%llx\n", + HDfprintf(stdout, " node_ptr = 0x%llx, item = %p\n", (unsigned long long)node_ptr, - (unsigned long long)H5SL_item(node_ptr)); + H5SL_item(node_ptr)); /* increment node_ptr before we delete its target */ node_ptr = H5SL_next(node_ptr); @@ -257,10 +254,9 @@ H5C_dump_cache_skip_list(H5C_t * cache_ptr, char * calling_fcn) HDfprintf(stdout, "\n\n"); -done: FUNC_LEAVE_NOAPI(ret_value) } /* H5C_dump_cache_skip_list() */ -#endif /* debugging routine */ +#endif /* NDEBUG */ /*------------------------------------------------------------------------- @@ -285,7 +281,7 @@ H5C_set_prefix(H5C_t * cache_ptr, char * prefix) if((cache_ptr == NULL) || (cache_ptr->magic != H5C__H5C_T_MAGIC) || (prefix == NULL) || (HDstrlen(prefix) >= H5C__PREFIX_LEN)) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Bad param(s) on entry.") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Bad param(s) on entry") HDstrncpy(&(cache_ptr->prefix[0]), prefix, (size_t)(H5C__PREFIX_LEN)); @@ -385,6 +381,7 @@ H5C_stats(H5C_t * cache_ptr, size_t aggregate_max_size = 0; int32_t aggregate_max_pins = 0; double hit_rate; + double prefetch_use_rate; double average_successful_search_depth = 0.0f; double average_failed_search_depth = 0.0f; double average_entries_skipped_per_calls_to_msic = 0.0f; @@ -490,12 +487,12 @@ H5C_stats(H5C_t * cache_ptr, average_failed_search_depth); HDfprintf(stdout, - "%s current (max) index size / length = %ld (%ld) / %ld (%ld)\n", + "%s current (max) index size / length = %ld (%ld) / %lu (%lu)\n", cache_ptr->prefix, (long)(cache_ptr->index_size), (long)(cache_ptr->max_index_size), - (long)(cache_ptr->index_len), - (long)(cache_ptr->max_index_len)); + (unsigned long)(cache_ptr->index_len), + (unsigned long)(cache_ptr->max_index_len)); HDfprintf(stdout, "%s current (max) clean/dirty idx size = %ld (%ld) / %ld (%ld)\n", @@ -506,46 +503,46 @@ H5C_stats(H5C_t * cache_ptr, (long)(cache_ptr->max_dirty_index_size)); HDfprintf(stdout, - "%s current (max) slist size / length = %ld (%ld) / %ld (%ld)\n", + "%s current (max) slist size / length = %ld (%ld) / %lu (%lu)\n", cache_ptr->prefix, (long)(cache_ptr->slist_size), (long)(cache_ptr->max_slist_size), - (long)(cache_ptr->slist_len), - (long)(cache_ptr->max_slist_len)); + (unsigned long)(cache_ptr->slist_len), + (unsigned long)(cache_ptr->max_slist_len)); HDfprintf(stdout, - "%s current (max) PL size / length = %ld (%ld) / %ld (%ld)\n", + "%s current (max) PL size / length = %ld (%ld) / %lu (%lu)\n", cache_ptr->prefix, (long)(cache_ptr->pl_size), (long)(cache_ptr->max_pl_size), - (long)(cache_ptr->pl_len), - (long)(cache_ptr->max_pl_len)); + (unsigned long)(cache_ptr->pl_len), + (unsigned long)(cache_ptr->max_pl_len)); HDfprintf(stdout, - "%s current (max) PEL size / length = %ld (%ld) / %ld (%ld)\n", + "%s current (max) PEL size / length = %ld (%ld) / %lu (%lu)\n", cache_ptr->prefix, (long)(cache_ptr->pel_size), (long)(cache_ptr->max_pel_size), - (long)(cache_ptr->pel_len), - (long)(cache_ptr->max_pel_len)); + (unsigned long)(cache_ptr->pel_len), + (unsigned long)(cache_ptr->max_pel_len)); HDfprintf(stdout, - "%s current LRU list size / length = %ld / %ld\n", + "%s current LRU list size / length = %ld / %lu\n", cache_ptr->prefix, (long)(cache_ptr->LRU_list_size), - (long)(cache_ptr->LRU_list_len)); + (unsigned long)(cache_ptr->LRU_list_len)); HDfprintf(stdout, - "%s current clean LRU size / length = %ld / %ld\n", + "%s current clean LRU size / length = %ld / %lu\n", cache_ptr->prefix, (long)(cache_ptr->cLRU_list_size), - (long)(cache_ptr->cLRU_list_len)); + (unsigned long)(cache_ptr->cLRU_list_len)); HDfprintf(stdout, - "%s current dirty LRU size / length = %ld / %ld\n", + "%s current dirty LRU size / length = %ld / %lu\n", cache_ptr->prefix, (long)(cache_ptr->dLRU_list_size), - (long)(cache_ptr->dLRU_list_len)); + (unsigned long)(cache_ptr->dLRU_list_len)); HDfprintf(stdout, "%s Total hits / misses / hit_rate = %ld / %ld / %f\n", @@ -648,6 +645,38 @@ H5C_stats(H5C_t * cache_ptr, (long long)(cache_ptr->LRU_scan_restarts), (long long)(cache_ptr->index_scan_restarts)); + HDfprintf(stdout, + "%s cache image creations/loads/size = %d / %d / %Hu\n", + cache_ptr->prefix, + cache_ptr->images_created, + cache_ptr->images_loaded, + cache_ptr->last_image_size); + + HDfprintf(stdout, + "%s prefetches / dirty prefetches = %lld / %lld\n", + cache_ptr->prefix, + (long long)(cache_ptr->prefetches), + (long long)(cache_ptr->dirty_prefetches)); + + HDfprintf(stdout, + "%s prefetch hits/flushes/evictions = %lld / %lld / %lld\n", + cache_ptr->prefix, + (long long)(cache_ptr->prefetch_hits), + (long long)(cache_ptr->flushes[H5AC_PREFETCHED_ENTRY_ID]), + (long long)(cache_ptr->evictions[H5AC_PREFETCHED_ENTRY_ID])); + + if(cache_ptr->prefetches > 0) + prefetch_use_rate = + (double)100.0f * ((double)(cache_ptr->prefetch_hits)) / + ((double)(cache_ptr->prefetches)); + else + prefetch_use_rate = 0.0f; + + HDfprintf(stdout, + "%s prefetched entry use rate = %lf\n", + cache_ptr->prefix, + prefetch_use_rate); + #if H5C_COLLECT_CACHE_ENTRY_STATS HDfprintf(stdout, "%s aggregate max / min accesses = %d / %d\n", @@ -673,7 +702,7 @@ H5C_stats(H5C_t * cache_ptr, HDfprintf(stdout, "%s Stats on %s:\n", cache_ptr->prefix, - ((cache_ptr->type_name_table_ptr))[i]); + ((cache_ptr->class_table_ptr))[i]->name); if((cache_ptr->hits[i] > 0) || (cache_ptr->misses[i] > 0)) hit_rate = (double)100.0f * ((double)(cache_ptr->hits[i])) / @@ -869,6 +898,14 @@ H5C_stats__reset(H5C_t H5_ATTR_UNUSED * cache_ptr) cache_ptr->LRU_scan_restarts = 0; cache_ptr->index_scan_restarts = 0; + cache_ptr->images_created = 0; + cache_ptr->images_loaded = 0; + cache_ptr->last_image_size = (hsize_t)0; + + cache_ptr->prefetches = 0; + cache_ptr->dirty_prefetches = 0; + cache_ptr->prefetch_hits = 0; + #if H5C_COLLECT_CACHE_ENTRY_STATS for(i = 0; i <= cache_ptr->max_type_id; i++) { cache_ptr->max_accesses[i] = 0; @@ -952,6 +989,303 @@ H5C__dump_entry(H5C_t *cache_ptr, const H5C_cache_entry_t *entry_ptr, if(entry_ptr->flush_dep_nchildren) H5C__dump_children(cache_ptr, entry_ptr, FALSE, "Child", indent); } /* end H5C__dump_entry() */ + + +/*------------------------------------------------------------------------- + * Function: H5C_flush_dependency_exists() + * + * Purpose: Test to see if a flush dependency relationship exists + * between the supplied parent and child. Both parties + * are indicated by addresses so as to avoid the necessity + * of protect / unprotect calls prior to this call. + * + * If either the parent or the child is not in the metadata + * cache, the function sets *fd_exists_ptr to FALSE. + * + * If both are in the cache, the childs list of parents is + * searched for the proposed parent. If the proposed parent + * is found in the childs parent list, the function sets + * *fd_exists_ptr to TRUE. In all other non-error cases, + * the function sets *fd_exists_ptr FALSE. + * + * Return: SUCCEED on success/FAIL on failure. Note that + * *fd_exists_ptr is undefined on failure. + * + * Programmer: John Mainzer + * 9/28/16 + * + *------------------------------------------------------------------------- + */ +#ifndef NDEBUG +herr_t +H5C_flush_dependency_exists(H5C_t *cache_ptr, haddr_t parent_addr, haddr_t child_addr, + hbool_t *fd_exists_ptr) +{ + hbool_t fd_exists = FALSE; /* whether flush dependency exists */ + H5C_cache_entry_t * parent_ptr; /* Ptr to parent entry */ + H5C_cache_entry_t * child_ptr; /* Ptr to child entry */ + hbool_t ret_value = FALSE; /* Return value */ + + FUNC_ENTER_NOAPI(NULL) + + /* Sanity checks */ + HDassert(cache_ptr); + HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); + HDassert(H5F_addr_defined(parent_addr)); + HDassert(H5F_addr_defined(child_addr)); + HDassert(fd_exists_ptr); + + H5C__SEARCH_INDEX(cache_ptr, parent_addr, parent_ptr, FAIL) + H5C__SEARCH_INDEX(cache_ptr, child_addr, child_ptr, FAIL) + + if(parent_ptr && child_ptr) { + HDassert(parent_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); + HDassert(child_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); + + if(child_ptr->flush_dep_nparents > 0) { + unsigned u; /* Local index variable */ + + HDassert(child_ptr->flush_dep_parent); + HDassert(child_ptr->flush_dep_parent_nalloc >= child_ptr->flush_dep_nparents); + + for(u = 0; u < child_ptr->flush_dep_nparents; u++) { + if(child_ptr->flush_dep_parent[u] == parent_ptr) { + fd_exists = TRUE; + HDassert(parent_ptr->flush_dep_nchildren > 0); + break; + } /* end if */ + } /* end for */ + } /* end if */ + } /* end if */ + + *fd_exists_ptr = fd_exists; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C_flush_dependency_exists() */ +#endif /* NDEBUG */ + + +/*------------------------------------------------------------------------- + * + * Function: H5C_validate_index_list + * + * Purpose: Debugging function that scans the index list for errors. + * + * If an error is detected, the function generates a + * diagnostic and returns FAIL. If no error is detected, + * the function returns SUCCEED. + * + * Return: FAIL if error is detected, SUCCEED otherwise. + * + * Programmer: John Mainzer, 9/16/16 + * + *------------------------------------------------------------------------- + */ +#ifndef NDEBUG +herr_t +H5C_validate_index_list(H5C_t *cache_ptr) +{ + H5C_cache_entry_t * entry_ptr = NULL; + uint32_t len = 0; + int32_t index_ring_len[H5C_RING_NTYPES]; + size_t size = 0; + size_t clean_size = 0; + size_t dirty_size = 0; + size_t index_ring_size[H5C_RING_NTYPES]; + size_t clean_index_ring_size[H5C_RING_NTYPES]; + size_t dirty_index_ring_size[H5C_RING_NTYPES]; + int i; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT + + /* Sanity checks */ + HDassert(cache_ptr); + HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); + + for(i = 0; i < H5C_RING_NTYPES; i++) { + index_ring_len[i] = 0; + index_ring_size[i] = 0; + clean_index_ring_size[i] = 0; + dirty_index_ring_size[i] = 0; + } /* end if */ + + if(((cache_ptr->il_head == NULL) || (cache_ptr->il_tail == NULL)) + && (cache_ptr->il_head != cache_ptr->il_tail)) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Index list pointer validation failed") + + if((cache_ptr->index_len == 1) && ((cache_ptr->il_head != cache_ptr->il_tail) + || (cache_ptr->il_head == NULL) || (cache_ptr->il_head->size != cache_ptr->index_size))) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Index list pointer sanity checks failed") + + if((cache_ptr->index_len >= 1) + && ((cache_ptr->il_head == NULL) + || (cache_ptr->il_head->il_prev != NULL) + || (cache_ptr->il_tail == NULL) + || (cache_ptr->il_tail->il_next != NULL))) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Index list length sanity checks failed") + + entry_ptr = cache_ptr->il_head; + while(entry_ptr != NULL) { + if((entry_ptr != cache_ptr->il_head) + && ((entry_ptr->il_prev == NULL) || (entry_ptr->il_prev->il_next != entry_ptr))) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Index list pointers for entry are invalid") + + if((entry_ptr != cache_ptr->il_tail) + && ((entry_ptr->il_next == NULL) || (entry_ptr->il_next->il_prev != entry_ptr))) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Index list pointers for entry are invalid") + + HDassert(entry_ptr->ring > 0); + HDassert(entry_ptr->ring < H5C_RING_NTYPES); + + len++; + index_ring_len[entry_ptr->ring] += 1; + + size += entry_ptr->size; + index_ring_size[entry_ptr->ring] += entry_ptr->size; + + if(entry_ptr->is_dirty) { + dirty_size += entry_ptr->size; + dirty_index_ring_size[entry_ptr->ring] += entry_ptr->size; + } /* end if */ + else { + clean_size += entry_ptr->size; + clean_index_ring_size[entry_ptr->ring] += entry_ptr->size; + } /* end else */ + + entry_ptr = entry_ptr->il_next; + } /* end while */ + + if((cache_ptr->index_len != len) || (cache_ptr->il_len != len) + || (cache_ptr->index_size != size) || (cache_ptr->il_size != size) + || (cache_ptr->clean_index_size != clean_size) + || (cache_ptr->dirty_index_size != dirty_size) + || (clean_size + dirty_size != size)) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Index, clean and dirty sizes for cache are invalid") + + size = 0; + clean_size = 0; + dirty_size = 0; + for(i = 0; i < H5C_RING_NTYPES; i++) { + size += clean_index_ring_size[i] + dirty_index_ring_size[i]; + clean_size += clean_index_ring_size[i]; + dirty_size += dirty_index_ring_size[i]; + } /* end for */ + + if((cache_ptr->index_size != size) + || (cache_ptr->clean_index_size != clean_size) + || (cache_ptr->dirty_index_size != dirty_size)) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Index, clean and dirty sizes for cache are invalid") + +done: + if(ret_value != SUCCEED) + HDassert(0); + + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C_validate_index_list() */ +#endif /* NDEBUG */ + + +/*------------------------------------------------------------------------- + * + * Function: H5C_get_entry_ptr_from_addr() + * + * Purpose: Debugging function that attempts to look up an entry in the + * cache by its file address, and if found, returns a pointer + * to the entry in *entry_ptr_ptr. If the entry is not in the + * cache, *entry_ptr_ptr is set to NULL. + * + * WARNING: This call should be used only in debugging + * routines, and it should be avoided when + * possible. + * + * Further, if we ever multi-thread the cache, + * this routine will have to be either discarded + * or heavily re-worked. + * + * Finally, keep in mind that the entry whose + * pointer is obtained in this fashion may not + * be in a stable state. + * + * Note that this function is only defined if NDEBUG + * is not defined. + * + * As heavy use of this function is almost certainly a + * bad idea, the metadata cache tracks the number of + * successful calls to this function, and (if + * H5C_DO_SANITY_CHECKS is defined) displays any + * non-zero count on cache shutdown. + * + * Return: FAIL if error is detected, SUCCEED otherwise. + * + * Programmer: John Mainzer, 5/30/14 + * + *------------------------------------------------------------------------- + */ +#ifndef NDEBUG +herr_t +H5C_get_entry_ptr_from_addr(H5C_t *cache_ptr, haddr_t addr, void **entry_ptr_ptr) +{ + H5C_cache_entry_t * entry_ptr = NULL; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity checks */ + HDassert(cache_ptr); + HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); + HDassert(H5F_addr_defined(addr)); + HDassert(entry_ptr_ptr); + + H5C__SEARCH_INDEX(cache_ptr, addr, entry_ptr, FAIL) + + if(entry_ptr == NULL) + /* the entry doesn't exist in the cache -- report this + * and quit. + */ + *entry_ptr_ptr = NULL; + else { + *entry_ptr_ptr = entry_ptr; + + /* increment call counter */ + (cache_ptr->get_entry_ptr_from_addr_counter)++; + } /* end else */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C_get_entry_ptr_from_addr() */ +#endif /* NDEBUG */ + + +/*------------------------------------------------------------------------- + * Function: H5C_get_serialization_in_progress + * + * Purpose: Return the current value of + * cache_ptr->serialization_in_progress. + * + * Return: Current value of cache_ptr->serialization_in_progress. + * + * Programmer: John Mainzer + * 8/24/15 + * + *------------------------------------------------------------------------- + */ +#ifndef NDEBUG +hbool_t +H5C_get_serialization_in_progress(const H5C_t *cache_ptr) +{ + FUNC_ENTER_NOAPI_NOINIT_NOERR + + /* Sanity check */ + HDassert(cache_ptr); + HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); + + FUNC_LEAVE_NOAPI(cache_ptr->serialization_in_progress) +} /* H5C_get_serialization_in_progress() */ +#endif /* NDEBUG */ + + /*------------------------------------------------------------------------- * * Function: H5C_cache_is_clean() @@ -986,12 +1320,79 @@ H5C_cache_is_clean(const H5C_t *cache_ptr, H5C_ring_t inner_ring) while(ring <= inner_ring) { if(cache_ptr->dirty_index_ring_size[ring] > 0) - ret_value = FALSE; + HGOTO_DONE(FALSE) ring++; } /* end while */ +done: FUNC_LEAVE_NOAPI(ret_value) } /* H5C_cache_is_clean() */ #endif /* NDEBUG */ + +/*------------------------------------------------------------------------- + * + * Function: H5C_verify_entry_type() + * + * Purpose: Debugging function that attempts to look up an entry in the + * cache by its file address, and if found, test to see if its + * type field contains the expted value. + * + * If the specified entry is in cache, *in_cache_ptr is set + * to TRUE, and *type_ok_ptr is set to TRUE or FALSE depending + * on whether the entries type field matches the expected_type + * parameter. + * + * If the target entry is not in cache, *in_cache_ptr is + * set to FALSE, and *type_ok_ptr is undefined. + * + * Note that this function is only defined if NDEBUG + * is not defined. + * + * Return: FAIL if error is detected, SUCCEED otherwise. + * + * Programmer: John Mainzer, 5/30/14 + * + *------------------------------------------------------------------------- + */ +#ifndef NDEBUG +herr_t +H5C_verify_entry_type(H5C_t *cache_ptr, haddr_t addr, + const H5C_class_t *expected_type, hbool_t *in_cache_ptr, + hbool_t *type_ok_ptr) +{ + H5C_cache_entry_t * entry_ptr = NULL; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity checks */ + HDassert(cache_ptr); + HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); + HDassert(H5F_addr_defined(addr)); + HDassert(expected_type); + HDassert(in_cache_ptr); + HDassert(type_ok_ptr); + + H5C__SEARCH_INDEX(cache_ptr, addr, entry_ptr, FAIL) + + if(entry_ptr == NULL) + /* the entry doesn't exist in the cache -- report this + * and quit. + */ + *in_cache_ptr = FALSE; + else { + *in_cache_ptr = TRUE; + + if(entry_ptr->prefetched) + *type_ok_ptr = (expected_type->id == entry_ptr->prefetch_type_id); + else + *type_ok_ptr = (expected_type == entry_ptr->type); + } /* end else */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C_verify_entry_type() */ +#endif /* NDEBUG */ + diff --git a/src/H5Cepoch.c b/src/H5Cepoch.c index e576028..655d795 100644 --- a/src/H5Cepoch.c +++ b/src/H5Cepoch.c @@ -92,8 +92,7 @@ static herr_t H5C__epoch_marker_fsf_size(const void H5_ATTR_UNUSED * thing, /*******************/ -const H5C_class_t H5C__epoch_marker_class = -{ +const H5AC_class_t H5AC_EPOCH_MARKER[1] = {{ /* id = */ H5AC_EPOCH_MARKER_ID, /* name = */ "epoch marker", /* mem_type = */ H5FD_MEM_DEFAULT, /* value doesn't matter */ @@ -108,7 +107,7 @@ const H5C_class_t H5C__epoch_marker_class = /* notify = */ H5C__epoch_marker_notify, /* free_icr = */ H5C__epoch_marker_free_icr, /* fsf_size = */ H5C__epoch_marker_fsf_size, -}; +}}; /*************************************************************************** diff --git a/src/H5Cmpio.c b/src/H5Cmpio.c index ab94879..ebb98b3 100644 --- a/src/H5Cmpio.c +++ b/src/H5Cmpio.c @@ -164,38 +164,13 @@ static herr_t H5C__collective_write(H5F_t *f, hid_t dxpl_id); * Programmer: John Mainzer * 3/17/10 * - * Changes: Ported code to detect next entry status changes as the - * the result of a flush from the serial code in the scan of - * the LRU. Also added code to detect and adapt to the - * removal from the cache of the next entry in the scan of - * the LRU. - * - * Note that at present, all of these changes should not - * be required as the operations on entries as they are - * flushed that can cause these condiditions are not premitted - * in the parallel case. However, Quincey indicates that - * this may change, and thus has requested the modification. - * - * Note the assert(FALSE) in the if statement whose body - * restarts the scan of the LRU. As the body of the if - * statement should be unreachable, it should never be - * triggered until the constraints on the parallel case - * are relaxed. Please remove the assertion at that time. - * - * Also added warning on the Pinned Entry List scan, as it - * is potentially subject to the same issue. As there is - * no cognate of this scan in the serial code, I don't have - * a fix to port to it. - * - * JRM -- 4/10/19 - * *------------------------------------------------------------------------- */ herr_t H5C_apply_candidate_list(H5F_t * f, hid_t dxpl_id, H5C_t * cache_ptr, - int num_candidates, + unsigned num_candidates, haddr_t * candidates_list_ptr, int mpi_rank, int mpi_size) @@ -205,19 +180,19 @@ H5C_apply_candidate_list(H5F_t * f, int i; int m; int n; - int first_entry_to_flush; - int last_entry_to_flush; - int entries_to_clear = 0; - int entries_to_flush = 0; - int entries_to_flush_or_clear_last = 0; - int entries_to_flush_collectively = 0; - int entries_cleared = 0; - int entries_flushed = 0; - int entries_delayed = 0; - int entries_flushed_or_cleared_last = 0; - int entries_flushed_collectively = 0; - int entries_examined = 0; - int initial_list_len; + unsigned first_entry_to_flush; + unsigned last_entry_to_flush; + unsigned entries_to_clear = 0; + unsigned entries_to_flush = 0; + unsigned entries_to_flush_or_clear_last = 0; + unsigned entries_to_flush_collectively = 0; + unsigned entries_cleared = 0; + unsigned entries_flushed = 0; + unsigned entries_delayed = 0; + unsigned entries_flushed_or_cleared_last = 0; + unsigned entries_flushed_collectively = 0; + unsigned entries_examined = 0; + unsigned initial_list_len; int * candidate_assignment_table = NULL; haddr_t addr; H5C_cache_entry_t * clear_ptr = NULL; @@ -231,29 +206,30 @@ H5C_apply_candidate_list(H5F_t * f, #if H5C_APPLY_CANDIDATE_LIST__DEBUG char tbl_buf[1024]; #endif /* H5C_APPLY_CANDIDATE_LIST__DEBUG */ - herr_t ret_value = SUCCEED; /* Return value */ + unsigned u; /* Local index variable */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) - HDassert( cache_ptr != NULL ); - HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC ); - HDassert( num_candidates > 0 ); - HDassert( num_candidates <= cache_ptr->slist_len ); - HDassert( candidates_list_ptr != NULL ); - HDassert( 0 <= mpi_rank ); - HDassert( mpi_rank < mpi_size ); + /* Sanity checks */ + HDassert(cache_ptr != NULL); + HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); + HDassert(num_candidates > 0); + HDassert(num_candidates <= cache_ptr->slist_len); + HDassert(candidates_list_ptr != NULL); + HDassert(0 <= mpi_rank); + HDassert(mpi_rank < mpi_size); #if H5C_APPLY_CANDIDATE_LIST__DEBUG - HDfprintf(stdout, "%s:%d: setting up candidate assignment table.\n", - FUNC, mpi_rank); - for ( i = 0; i < 1024; i++ ) tbl_buf[i] = '\0'; + HDfprintf(stdout, "%s:%d: setting up candidate assignment table.\n", FUNC, mpi_rank); + + HDmemset(tbl_buf, 0, sizeof(tbl_buf)); + sprintf(&(tbl_buf[0]), "candidate list = "); - for ( i = 0; i < num_candidates; i++ ) - { - sprintf(&(tbl_buf[HDstrlen(tbl_buf)]), " 0x%llx", - (long long)(*(candidates_list_ptr + i))); - } + for(u = 0; u < num_candidates; u++) + sprintf(&(tbl_buf[HDstrlen(tbl_buf)]), " 0x%llx", (long long)(*(candidates_list_ptr + u))); sprintf(&(tbl_buf[HDstrlen(tbl_buf)]), "\n"); + HDfprintf(stdout, "%s", tbl_buf); #endif /* H5C_APPLY_CANDIDATE_LIST__DEBUG */ @@ -269,7 +245,6 @@ H5C_apply_candidate_list(H5F_t * f, n = num_candidates / mpi_size; m = num_candidates % mpi_size; HDassert(n >= 0); - if(NULL == (candidate_assignment_table = (int *)H5MM_malloc(sizeof(int) * (size_t)(mpi_size + 1)))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for candidate assignment table") @@ -297,9 +272,8 @@ H5C_apply_candidate_list(H5F_t * f, HDassert((candidate_assignment_table[mpi_size - 1] + n) == num_candidates); #if H5C_DO_SANITY_CHECKS - /* verify that the candidate assignment table has the expected form */ - for ( i = 1; i < mpi_size - 1; i++ ) - { + /* Verify that the candidate assignment table has the expected form */ + for(i = 1; i < mpi_size - 1; i++) { int a, b; a = candidate_assignment_table[i] - candidate_assignment_table[i - 1]; @@ -323,73 +297,71 @@ H5C_apply_candidate_list(H5F_t * f, sprintf(&(tbl_buf[HDstrlen(tbl_buf)]), "\n"); HDfprintf(stdout, "%s", tbl_buf); - HDfprintf(stdout, "%s:%d: flush entries [%d, %d].\n", + HDfprintf(stdout, "%s:%d: flush entries [%u, %u].\n", FUNC, mpi_rank, first_entry_to_flush, last_entry_to_flush); HDfprintf(stdout, "%s:%d: marking entries.\n", FUNC, mpi_rank); #endif /* H5C_APPLY_CANDIDATE_LIST__DEBUG */ - for(i = 0; i < num_candidates; i++) { - addr = candidates_list_ptr[i]; - HDassert( H5F_addr_defined(addr) ); + for(u = 0; u < num_candidates; u++) { + addr = candidates_list_ptr[u]; + HDassert(H5F_addr_defined(addr)); #if H5C_DO_SANITY_CHECKS - if ( i > 0 ) { - if ( last_addr == addr ) { - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Duplicate entry in cleaned list.\n") - } else if ( last_addr > addr ) { - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "candidate list not sorted.\n") - } - } + if(u > 0) { + if(last_addr == addr) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "duplicate entry in cleaned list") + else if(last_addr > addr) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "candidate list not sorted") + } /* end if */ last_addr = addr; #endif /* H5C_DO_SANITY_CHECKS */ H5C__SEARCH_INDEX(cache_ptr, addr, entry_ptr, FAIL) - if(entry_ptr == NULL) { - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Listed candidate entry not in cache?!?!?.") - } else if(!entry_ptr->is_dirty) { - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Listed entry not dirty?!?!?.") - } else if ( entry_ptr->is_protected ) { + if(entry_ptr == NULL) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "listed candidate entry not in cache?!?!?") + if(!entry_ptr->is_dirty) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Listed entry not dirty?!?!?") + if(entry_ptr->is_protected) /* For now at least, we can't deal with protected entries. * If we encounter one, scream and die. If it becomes an * issue, we should be able to work around this. */ - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Listed entry is protected?!?!?.") - } else { - /* determine whether the entry is to be cleared or flushed, - * and mark it accordingly. We will scan the protected and - * pinned list shortly, and clear or flush according to these - * markings. - */ - if((i >= first_entry_to_flush) && (i <= last_entry_to_flush)) { - entries_to_flush++; - entry_ptr->flush_immediately = TRUE; - } /* end if */ - else { - entries_to_clear++; - entry_ptr->clear_on_unprotect = TRUE; - } /* end else */ - - /* Entries marked as collectively accessed and are in the - candidate list to clear from the cache have to be - removed from the coll list. This is OK since the - candidate list is collective and uniform across all - ranks. */ - if(TRUE == entry_ptr->coll_access) { - entry_ptr->coll_access = FALSE; - H5C__REMOVE_FROM_COLL_LIST(cache_ptr, entry_ptr, FAIL) - } /* end if */ + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Listed entry is protected?!?!?") + + /* Determine whether the entry is to be cleared or flushed, + * and mark it accordingly. We will scan the protected and + * pinned list shortly, and clear or flush according to these + * markings. + */ + if(u >= first_entry_to_flush && u <= last_entry_to_flush) { + entries_to_flush++; + entry_ptr->flush_immediately = TRUE; + } /* end if */ + else { + entries_to_clear++; + entry_ptr->clear_on_unprotect = TRUE; } /* end else */ + + /* Entries marked as collectively accessed and are in the + * candidate list to clear from the cache have to be + * removed from the coll list. This is OK since the + * candidate list is collective and uniform across all + * ranks. + */ + if(entry_ptr->coll_access) { + entry_ptr->coll_access = FALSE; + H5C__REMOVE_FROM_COLL_LIST(cache_ptr, entry_ptr, FAIL) + } /* end if */ } /* end for */ #if H5C_APPLY_CANDIDATE_LIST__DEBUG - HDfprintf(stdout, "%s:%d: num candidates/to clear/to flush = %d/%d/%d.\n", - FUNC, mpi_rank, (int)num_candidates, (int)entries_to_clear, - (int)entries_to_flush); + HDfprintf(stdout, "%s:%d: num candidates/to clear/to flush = %u/%u/%u.\n", + FUNC, mpi_rank, num_candidates, entries_to_clear, + entries_to_flush); #endif /* H5C_APPLY_CANDIDATE_LIST__DEBUG */ - /* We have now marked all the entries on the candidate list for * either flush or clear -- now scan the LRU and the pinned list * for these entries and do the deed. @@ -586,7 +558,7 @@ H5C_apply_candidate_list(H5F_t * f, } /* end while */ #if H5C_APPLY_CANDIDATE_LIST__DEBUG - HDfprintf(stdout, "%s:%d: entries examined/cleared/flushed = %d/%d/%d.\n", + HDfprintf(stdout, "%s:%d: entries examined/cleared/flushed = %u/%u/%u.\n", FUNC, mpi_rank, entries_examined, entries_cleared, entries_flushed); #endif /* H5C_APPLY_CANDIDATE_LIST__DEBUG */ @@ -713,7 +685,7 @@ H5C_apply_candidate_list(H5F_t * f, #if H5C_APPLY_CANDIDATE_LIST__DEBUG HDfprintf(stdout, - "%s:%d: pel entries examined/cleared/flushed = %d/%d/%d.\n", + "%s:%d: pel entries examined/cleared/flushed = %u/%u/%u.\n", FUNC, mpi_rank, entries_examined, entries_cleared, entries_flushed); HDfprintf(stdout, "%s:%d: done.\n", FUNC, mpi_rank); @@ -758,7 +730,7 @@ H5C_apply_candidate_list(H5F_t * f, /* Write collective list */ if(H5C__collective_write(f, dxpl_id) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_WRITEERROR, FAIL, "Can't write metadata collectively") + HGOTO_ERROR(H5E_CACHE, H5E_WRITEERROR, FAIL, "can't write metadata collectively") } /* end if */ /* ====================================================================== * @@ -774,12 +746,11 @@ H5C_apply_candidate_list(H5F_t * f, (entries_cleared != entries_to_clear) || (entries_flushed_or_cleared_last != entries_to_flush_or_clear_last) || (entries_flushed_collectively != entries_to_flush_collectively)) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "entry count mismatch.") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "entry count mismatch") done: if(candidate_assignment_table != NULL) candidate_assignment_table = (int *)H5MM_xfree((void *)candidate_assignment_table); - if(cache_ptr->coll_write_list) { if(H5SL_close(cache_ptr->coll_write_list) < 0) HDONE_ERROR(H5E_CACHE, H5E_CANTFREE, FAIL, "failed to destroy skip list") @@ -836,7 +807,7 @@ H5C_construct_candidate_list__clean_cache(H5C_t * cache_ptr) if(space_needed > 0) { /* we have work to do */ H5C_cache_entry_t *entry_ptr; - int nominated_entries_count = 0; + unsigned nominated_entries_count = 0; size_t nominated_entries_size = 0; haddr_t nominated_addr; @@ -857,7 +828,7 @@ H5C_construct_candidate_list__clean_cache(H5C_t * cache_ptr) nominated_addr = entry_ptr->addr; if(H5AC_add_candidate((H5AC_t *)cache_ptr, nominated_addr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5AC_add_candidate() failed(1).") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5AC_add_candidate() failed") nominated_entries_size += entry_ptr->size; nominated_entries_count++; @@ -881,7 +852,7 @@ H5C_construct_candidate_list__clean_cache(H5C_t * cache_ptr) nominated_addr = entry_ptr->addr; if(H5AC_add_candidate((H5AC_t *)cache_ptr, nominated_addr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5AC_add_candidate() failed(2).") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5AC_add_candidate() failed") nominated_entries_size += entry_ptr->size; nominated_entries_count++; @@ -950,7 +921,7 @@ H5C_construct_candidate_list__min_clean(H5C_t * cache_ptr) if(space_needed > 0) { /* we have work to do */ H5C_cache_entry_t *entry_ptr; - int nominated_entries_count = 0; + unsigned nominated_entries_count = 0; size_t nominated_entries_size = 0; HDassert( cache_ptr->slist_len > 0 ); @@ -973,7 +944,7 @@ H5C_construct_candidate_list__min_clean(H5C_t * cache_ptr) nominated_addr = entry_ptr->addr; if(H5AC_add_candidate((H5AC_t *)cache_ptr, nominated_addr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5AC_add_candidate() failed.") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5AC_add_candidate() failed") nominated_entries_size += entry_ptr->size; nominated_entries_count++; @@ -1017,51 +988,28 @@ done: * Programmer: John Mainzer * 7/5/05 * - * Changes: Tidied up code, removeing some old commented out - * code that had been left in pending success of the - * new version. - * - * Note that unlike H5C_apply_candidate_list(), - * H5C_mark_entries_as_clean() makes all its calls to - * H5C__flush_single_entry() with the - * H5C__FLUSH_CLEAR_ONLY_FLAG set. As a result, - * the pre_serialize() and serialize calls are not made. - * - * This then implies that (assuming such actions were - * permitted in the parallel case) no loads, dirties, - * resizes, or removals of other entries can occur as - * a side effect of the flush. Hence, there is no need - * for the checks for entry removal / status change - * that I ported to H5C_apply_candidate_list(). - * - * However, if (in addition to allowing such operations - * in the parallel case), we allow such operations outside - * of the pre_serialize / serialize routines, this may - * cease to be the case -- requiring a review of this - * function. - * *------------------------------------------------------------------------- */ herr_t H5C_mark_entries_as_clean(H5F_t * f, hid_t dxpl_id, - int32_t ce_array_len, + unsigned ce_array_len, haddr_t * ce_array_ptr) { H5C_t * cache_ptr; - int entries_cleared; - int entries_examined; - int i; - int initial_list_len; + unsigned entries_cleared; + unsigned entries_examined; + unsigned initial_list_len; haddr_t addr; #if H5C_DO_SANITY_CHECKS - int pinned_entries_marked = 0; - int protected_entries_marked = 0; - int other_entries_marked = 0; + unsigned pinned_entries_marked = 0; + unsigned protected_entries_marked = 0; + unsigned other_entries_marked = 0; haddr_t last_addr; #endif /* H5C_DO_SANITY_CHECKS */ H5C_cache_entry_t * clear_ptr = NULL; H5C_cache_entry_t * entry_ptr = NULL; + unsigned u; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -1076,46 +1024,30 @@ H5C_mark_entries_as_clean(H5F_t * f, HDassert( ce_array_ptr != NULL ); #if H5C_DO_EXTREME_SANITY_CHECKS - if ( ( H5C_validate_protected_entry_list(cache_ptr) < 0 ) || - ( H5C_validate_pinned_entry_list(cache_ptr) < 0 ) || - ( H5C_validate_lru_list(cache_ptr) < 0 ) ) { - - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ - "an extreme sanity check failed on entry.\n"); - } + if(H5C_validate_protected_entry_list(cache_ptr) < 0 || + H5C_validate_pinned_entry_list(cache_ptr) < 0 || + H5C_validate_lru_list(cache_ptr) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on entry") #endif /* H5C_DO_EXTREME_SANITY_CHECKS */ - for ( i = 0; i < ce_array_len; i++ ) - { - addr = ce_array_ptr[i]; + for(u = 0; u < ce_array_len; u++) { + addr = ce_array_ptr[u]; #if H5C_DO_SANITY_CHECKS - if ( i == 0 ) { - + if(u == 0) last_addr = addr; - - } else { - - if ( last_addr == addr ) { - - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ - "Duplicate entry in cleaned list.\n"); - - } else if ( last_addr > addr ) { - - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ - "cleaned list not sorted.\n"); - } - } + else { + if(last_addr == addr) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Duplicate entry in cleaned list") + if(last_addr > addr) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "cleaned list not sorted") + } /* end else */ #if H5C_DO_EXTREME_SANITY_CHECKS - if ( ( H5C_validate_protected_entry_list(cache_ptr) < 0 ) || - ( H5C_validate_pinned_entry_list(cache_ptr) < 0 ) || - ( H5C_validate_lru_list(cache_ptr) < 0 ) ) { - - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ - "an extreme sanity check failed in for loop.\n"); - } + if(H5C_validate_protected_entry_list(cache_ptr) < 0 + || H5C_validate_pinned_entry_list(cache_ptr) < 0 + || H5C_validate_lru_list(cache_ptr) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed in for loop") #endif /* H5C_DO_EXTREME_SANITY_CHECKS */ #endif /* H5C_DO_SANITY_CHECKS */ @@ -1123,28 +1055,24 @@ H5C_mark_entries_as_clean(H5F_t * f, H5C__SEARCH_INDEX(cache_ptr, addr, entry_ptr, FAIL) - if ( entry_ptr == NULL ) { + if(entry_ptr == NULL) { #if H5C_DO_SANITY_CHECKS HDfprintf(stdout, - "H5C_mark_entries_as_clean: entry[%d] = %ld not in cache.\n", - (int)i, - (long)addr); + "H5C_mark_entries_as_clean: entry[%u] = %a not in cache.\n", + u, + addr); #endif /* H5C_DO_SANITY_CHECKS */ - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ - "Listed entry not in cache?!?!?.") - - } else if ( ! entry_ptr->is_dirty ) { - + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Listed entry not in cache?!?!?") + } /* end if */ + else if(!entry_ptr->is_dirty) { #if H5C_DO_SANITY_CHECKS HDfprintf(stdout, - "H5C_mark_entries_as_clean: entry %ld is not dirty!?!\n", - (long)addr); + "H5C_mark_entries_as_clean: entry %a is not dirty!?!\n", + addr); #endif /* H5C_DO_SANITY_CHECKS */ - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ - "Listed entry not dirty?!?!?.") - - } else { - + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Listed entry not dirty?!?!?") + } /* end else-if */ + else { /* Mark the entry to be cleared on unprotect. We will * scan the LRU list shortly, and clear all those entries * not currently protected. @@ -1200,31 +1128,25 @@ H5C_mark_entries_as_clean(H5F_t * f, * point. * JRM -- 4/7/15 */ - entries_cleared = 0; entries_examined = 0; initial_list_len = cache_ptr->LRU_list_len; entry_ptr = cache_ptr->LRU_tail_ptr; - - while ( ( entry_ptr != NULL ) && - ( entries_examined <= initial_list_len ) && - ( entries_cleared < ce_array_len ) ) - { - if ( entry_ptr->clear_on_unprotect ) { - + while(entry_ptr != NULL && entries_examined <= initial_list_len && + entries_cleared < ce_array_len) { + if(entry_ptr->clear_on_unprotect) { entry_ptr->clear_on_unprotect = FALSE; clear_ptr = entry_ptr; entry_ptr = entry_ptr->prev; entries_cleared++; if(H5C__flush_single_entry(f, dxpl_id, clear_ptr, H5C__FLUSH_CLEAR_ONLY_FLAG | H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't clear entry.") - } else { - + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "can't clear entry") + } /* end if */ + else entry_ptr = entry_ptr->prev; - } entries_examined++; - } + } /* end while */ #if H5C_DO_SANITY_CHECKS HDassert( entries_cleared == other_entries_marked ); @@ -1233,25 +1155,20 @@ H5C_mark_entries_as_clean(H5F_t * f, /* It is also possible that some of the cleared entries are on the * pinned list. Must scan that also. */ - entry_ptr = cache_ptr->pel_head_ptr; - - while ( entry_ptr != NULL ) - { - if ( entry_ptr->clear_on_unprotect ) { - + while(entry_ptr != NULL) { + if(entry_ptr->clear_on_unprotect) { entry_ptr->clear_on_unprotect = FALSE; clear_ptr = entry_ptr; entry_ptr = entry_ptr->next; entries_cleared++; - if(H5C__flush_single_entry(f, dxpl_id, clear_ptr, H5C__FLUSH_CLEAR_ONLY_FLAG | H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG) < 0 ) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't clear entry.") - } else { - + if(H5C__flush_single_entry(f, dxpl_id, clear_ptr, H5C__FLUSH_CLEAR_ONLY_FLAG | H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't clear entry") + } /* end if */ + else entry_ptr = entry_ptr->next; - } - } + } /* end while */ #if H5C_DO_SANITY_CHECKS HDassert( entries_cleared == pinned_entries_marked + other_entries_marked ); @@ -1262,33 +1179,28 @@ H5C_mark_entries_as_clean(H5F_t * f, ( (ce_array_len - entries_cleared) <= cache_ptr->pl_len ) ); #if H5C_DO_SANITY_CHECKS - i = 0; + u = 0; entry_ptr = cache_ptr->pl_head_ptr; while ( entry_ptr != NULL ) { if ( entry_ptr->clear_on_unprotect ) { - i++; + u++; } entry_ptr = entry_ptr->next; } - HDassert( (entries_cleared + i) == ce_array_len ); + HDassert( (entries_cleared + u) == ce_array_len ); #endif /* H5C_DO_SANITY_CHECKS */ done: - #if H5C_DO_EXTREME_SANITY_CHECKS - if ( ( H5C_validate_protected_entry_list(cache_ptr) < 0 ) || - ( H5C_validate_pinned_entry_list(cache_ptr) < 0 ) || - ( H5C_validate_lru_list(cache_ptr) < 0 ) ) { - - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ - "an extreme sanity check failed on exit.\n"); - } + if(H5C_validate_protected_entry_list(cache_ptr) < 0 + || H5C_validate_pinned_entry_list(cache_ptr) < 0 + || H5C_validate_lru_list(cache_ptr) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on exit") #endif /* H5C_DO_EXTREME_SANITY_CHECKS */ FUNC_LEAVE_NOAPI(ret_value) - } /* H5C_mark_entries_as_clean() */ @@ -1309,7 +1221,7 @@ done: herr_t H5C_clear_coll_entries(H5C_t *cache_ptr, hbool_t partial) { - int32_t clear_cnt; + uint32_t clear_cnt; H5C_cache_entry_t * entry_ptr = NULL; herr_t ret_value = SUCCEED; @@ -1499,4 +1411,3 @@ done: FUNC_LEAVE_NOAPI(ret_value); } /* end H5C__collective_write() */ #endif /* H5_HAVE_PARALLEL */ - diff --git a/src/H5Cpkg.h b/src/H5Cpkg.h index 6e37bca..5b923e9 100644 --- a/src/H5Cpkg.h +++ b/src/H5Cpkg.h @@ -209,7 +209,6 @@ if ( ( (entry_ptr) == NULL ) || \ ( ( ( (head_ptr) == NULL ) || ( (tail_ptr) == NULL ) ) && \ ( (head_ptr) != (tail_ptr) ) \ ) || \ - ( (len) < 0 ) || \ ( ( (len) == 1 ) && \ ( ( (head_ptr) != (tail_ptr) ) || \ ( (head_ptr) == NULL ) || ( (head_ptr)->size != (Size) ) \ @@ -375,7 +374,6 @@ if ( ( (entry_ptr) == NULL ) || \ ( ( ( (hd_ptr) == NULL ) || ( (tail_ptr) == NULL ) ) && \ ( (hd_ptr) != (tail_ptr) ) \ ) || \ - ( (len) < 0 ) || \ ( ( (len) == 1 ) && \ ( ( (hd_ptr) != (tail_ptr) ) || ( (Size) <= 0 ) || \ ( (hd_ptr) == NULL ) || ( (hd_ptr)->size != (Size) ) \ @@ -483,7 +481,7 @@ if ( ( (hd_ptr) == NULL ) || \ ) \ ) \ ) { \ - HDassert(0 && "il DLL pre remove SC failed"); \ + HDassert(0 && "il DLL pre remove SC failed"); \ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, (fv), "il DLL pre remove SC failed") \ } @@ -494,7 +492,6 @@ if ( ( (entry_ptr) == NULL ) || \ ( ( ( (hd_ptr) == NULL ) || ( (tail_ptr) == NULL ) ) && \ ( (hd_ptr) != (tail_ptr) ) \ ) || \ - ( (len) < 0 ) || \ ( ( (len) == 1 ) && \ ( ( (hd_ptr) != (tail_ptr) ) || ( (Size) <= 0 ) || \ ( (hd_ptr) == NULL ) || ( (hd_ptr)->size != (Size) ) \ @@ -506,7 +503,7 @@ if ( ( (entry_ptr) == NULL ) || \ ) \ ) \ ) { \ - HDassert(0 && "IL DLL pre insert SC failed"); \ + HDassert(0 && "IL DLL pre insert SC failed"); \ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, (fv), "IL DLL pre insert SC failed") \ } @@ -514,7 +511,6 @@ if ( ( (entry_ptr) == NULL ) || \ if ( ( ( ( (head_ptr) == NULL ) || ( (tail_ptr) == NULL ) ) && \ ( (head_ptr) != (tail_ptr) ) \ ) || \ - ( (len) < 0 ) || \ ( ( (len) == 1 ) && \ ( ( (head_ptr) != (tail_ptr) ) || \ ( (head_ptr) == NULL ) || ( (head_ptr)->size != (Size) ) \ @@ -526,7 +522,7 @@ if ( ( ( ( (head_ptr) == NULL ) || ( (tail_ptr) == NULL ) ) && \ ) \ ) \ ) { \ - HDassert(0 && "IL DLL sanity check failed"); \ + HDassert(0 && "IL DLL sanity check failed"); \ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, (fv), "IL DLL sanity check failed") \ } @@ -599,23 +595,6 @@ if ( ( ( ( (head_ptr) == NULL ) || ( (tail_ptr) == NULL ) ) && \ * H5C__UPDATE_CACHE_HIT_RATE_STATS(), which is always active as * the cache hit rate stats are always collected and available. * - * Changes: - * - * JRM -- 3/21/06 - * Added / updated macros for pinned entry related stats. - * - * JRM -- 8/9/06 - * More pinned entry stats related updates. - * - * JRM -- 3/31/07 - * Updated H5C__UPDATE_STATS_FOR_PROTECT() to keep stats on - * read and write protects. - * - * MAM -- 1/15/09 - * Created H5C__UPDATE_MAX_INDEX_SIZE_STATS to contain - * common code within macros that update the maximum - * index, clean_index, and dirty_index statistics fields. - * ***********************************************************************/ #define H5C__UPDATE_CACHE_HIT_RATE_STATS(cache_ptr, hit) \ @@ -702,6 +681,31 @@ if ( ( ( ( (head_ptr) == NULL ) || ( (tail_ptr) == NULL ) ) && \ #define H5C__UPDATE_STATS_FOR_INDEX_SCAN_RESTART(cache_ptr) \ ((cache_ptr)->index_scan_restarts)++; +#define H5C__UPDATE_STATS_FOR_CACHE_IMAGE_CREATE(cache_ptr) \ +{ \ + (cache_ptr)->images_created++; \ +} + +#define H5C__UPDATE_STATS_FOR_CACHE_IMAGE_LOAD(cache_ptr) \ +{ \ + /* make sure image len is still good */ \ + HDassert((cache_ptr)->image_len > 0); \ + (cache_ptr)->images_loaded++; \ + (cache_ptr)->last_image_size = (cache_ptr)->image_len; \ +} + +#define H5C__UPDATE_STATS_FOR_PREFETCH(cache_ptr, dirty) \ +{ \ + (cache_ptr)->prefetches++; \ + if ( dirty ) \ + (cache_ptr)->dirty_prefetches++; \ +} + +#define H5C__UPDATE_STATS_FOR_PREFETCH_HIT(cache_ptr) \ +{ \ + (cache_ptr)->prefetch_hits++; \ +} + #if H5C_COLLECT_CACHE_ENTRY_STATS #define H5C__RESET_CACHE_ENTRY_STATS(entry_ptr) \ @@ -926,6 +930,10 @@ if ( ( ( ( (head_ptr) == NULL ) || ( (tail_ptr) == NULL ) ) && \ #define H5C__UPDATE_STATS_FOR_SLIST_SCAN_RESTART(cache_ptr) #define H5C__UPDATE_STATS_FOR_LRU_SCAN_RESTART(cache_ptr) #define H5C__UPDATE_STATS_FOR_INDEX_SCAN_RESTART(cache_ptr) +#define H5C__UPDATE_STATS_FOR_CACHE_IMAGE_CREATE(cache_ptr) +#define H5C__UPDATE_STATS_FOR_CACHE_IMAGE_LOAD(cache_ptr) +#define H5C__UPDATE_STATS_FOR_PREFETCH(cache_ptr, dirty) +#define H5C__UPDATE_STATS_FOR_PREFETCH_HIT(cache_ptr) #endif /* H5C_COLLECT_CACHE_STATS */ @@ -999,8 +1007,7 @@ if ( ( (cache_ptr) == NULL ) || \ ( (cache_ptr)->index_len != (cache_ptr)->il_len ) || \ ( (cache_ptr)->index_size != (cache_ptr)->il_size ) ) { \ HDassert(FALSE); \ - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, fail_val, \ - "Pre HT insert SC failed") \ + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, fail_val, "pre HT insert SC failed") \ } #define H5C__POST_HT_INSERT_SC(cache_ptr, entry_ptr, fail_val) \ @@ -1022,8 +1029,7 @@ if ( ( (cache_ptr) == NULL ) || \ ( (cache_ptr)->index_len != (cache_ptr)->il_len ) || \ ( (cache_ptr)->index_size != (cache_ptr)->il_size) ) { \ HDassert(FALSE); \ - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, fail_val, \ - "Post HT insert SC failed") \ + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, fail_val, "post HT insert SC failed") \ } #define H5C__PRE_HT_REMOVE_SC(cache_ptr, entry_ptr) \ @@ -1064,7 +1070,7 @@ if ( ( (cache_ptr) == NULL ) || \ ( (cache_ptr)->index_len != (cache_ptr)->il_len ) || \ ( (cache_ptr)->index_size != (cache_ptr)->il_size ) ) { \ HDassert(FALSE); \ - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Pre HT remove SC failed") \ + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "pre HT remove SC failed") \ } #define H5C__POST_HT_REMOVE_SC(cache_ptr, entry_ptr) \ @@ -1090,7 +1096,7 @@ if ( ( (cache_ptr) == NULL ) || \ ( (cache_ptr)->index_len != (cache_ptr)->il_len ) || \ ( (cache_ptr)->index_size != (cache_ptr)->il_size ) ) { \ HDassert(FALSE); \ - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Post HT remove SC failed") \ + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "post HT remove SC failed") \ } /* (Keep in sync w/H5C_TEST__PRE_HT_SEARCH_SC macro in test/cache_common.h -QAK) */ @@ -1102,7 +1108,7 @@ if ( ( (cache_ptr) == NULL ) || \ ( ! H5F_addr_defined(Addr) ) || \ ( H5C__HASH_FCN(Addr) < 0 ) || \ ( H5C__HASH_FCN(Addr) >= H5C__HASH_TABLE_LEN ) ) { \ - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, fail_val, "Pre HT search SC failed") \ + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, fail_val, "pre HT search SC failed") \ } /* (Keep in sync w/H5C_TEST__POST_SUC_HT_SEARCH_SC macro in test/cache_common.h -QAK) */ @@ -1124,8 +1130,7 @@ if ( ( (cache_ptr) == NULL ) || \ ( (entry_ptr)->ht_prev->ht_next != (entry_ptr) ) ) || \ ( ( (entry_ptr)->ht_next != NULL ) && \ ( (entry_ptr)->ht_next->ht_prev != (entry_ptr) ) ) ) { \ - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, fail_val, \ - "Post successful HT search SC failed") \ + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, fail_val, "post successful HT search SC failed") \ } /* (Keep in sync w/H5C_TEST__POST_HT_SHIFT_TO_FRONT macro in test/cache_common.h -QAK) */ @@ -1133,8 +1138,7 @@ if ( ( (cache_ptr) == NULL ) || \ if ( ( (cache_ptr) == NULL ) || \ ( ((cache_ptr)->index)[k] != (entry_ptr) ) || \ ( (entry_ptr)->ht_prev != NULL ) ) { \ - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, fail_val, \ - "Post HT shift to front SC failed") \ + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, fail_val, "post HT shift to front SC failed") \ } #define H5C__PRE_HT_ENTRY_SIZE_CHANGE_SC(cache_ptr, old_size, new_size, \ @@ -1169,8 +1173,7 @@ if ( ( (cache_ptr) == NULL ) || \ ( (cache_ptr)->index_len != (cache_ptr)->il_len ) || \ ( (cache_ptr)->index_size != (cache_ptr)->il_size ) ) { \ HDassert(FALSE); \ - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ - "Pre HT entry size change SC failed") \ + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "pre HT entry size change SC failed") \ } #define H5C__POST_HT_ENTRY_SIZE_CHANGE_SC(cache_ptr, old_size, new_size, \ @@ -1200,8 +1203,7 @@ if ( ( (cache_ptr) == NULL ) || \ ( (cache_ptr)->index_len != (cache_ptr)->il_len ) || \ ( (cache_ptr)->index_size != (cache_ptr)->il_size ) ) { \ HDassert(FALSE); \ - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ - "Post HT entry size change SC failed") \ + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "post HT entry size change SC failed") \ } #define H5C__PRE_HT_UPDATE_FOR_ENTRY_CLEAN_SC(cache_ptr, entry_ptr) \ @@ -1228,8 +1230,7 @@ if ( \ ((cache_ptr)->clean_index_ring_size[(entry_ptr)->ring] + \ (cache_ptr)->dirty_index_ring_size[(entry_ptr)->ring]) ) ) { \ HDassert(FALSE); \ - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ - "Pre HT update for entry clean SC failed") \ + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "pre HT update for entry clean SC failed") \ } #define H5C__PRE_HT_UPDATE_FOR_ENTRY_DIRTY_SC(cache_ptr, entry_ptr) \ @@ -1256,8 +1257,7 @@ if ( \ ((cache_ptr)->clean_index_ring_size[(entry_ptr)->ring] + \ (cache_ptr)->dirty_index_ring_size[(entry_ptr)->ring]) ) ) { \ HDassert(FALSE); \ - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ - "Pre HT update for entry dirty SC failed") \ + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "pre HT update for entry dirty SC failed") \ } #define H5C__POST_HT_UPDATE_FOR_ENTRY_CLEAN_SC(cache_ptr, entry_ptr) \ @@ -1273,8 +1273,7 @@ if ( ( (cache_ptr)->index_size != \ ((cache_ptr)->clean_index_ring_size[(entry_ptr)->ring] + \ (cache_ptr)->dirty_index_ring_size[(entry_ptr)->ring]) ) ) { \ HDassert(FALSE); \ - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ - "Post HT update for entry clean SC failed") \ + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "post HT update for entry clean SC failed") \ } #define H5C__POST_HT_UPDATE_FOR_ENTRY_DIRTY_SC(cache_ptr, entry_ptr) \ @@ -1290,8 +1289,7 @@ if ( ( (cache_ptr)->index_size != \ ((cache_ptr)->clean_index_ring_size[(entry_ptr)->ring] + \ (cache_ptr)->dirty_index_ring_size[(entry_ptr)->ring]) ) ) { \ HDassert(FALSE); \ - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ - "Post HT update for entry dirty SC failed") \ + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "post HT update for entry dirty SC failed") \ } #else /* H5C_DO_SANITY_CHECKS */ @@ -1592,8 +1590,7 @@ if ( ( (cache_ptr)->index_size != \ (cache_ptr)->slist_size ); \ \ if(H5SL_insert((cache_ptr)->slist_ptr, entry_ptr, &(entry_ptr)->addr) < 0) \ - HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, (fail_val), \ - "Can't insert entry in skip list") \ + HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, (fail_val), "can't insert entry in skip list") \ \ (entry_ptr)->in_slist = TRUE; \ (cache_ptr)->slist_changed = TRUE; \ @@ -1628,8 +1625,7 @@ if ( ( (cache_ptr)->index_size != \ (cache_ptr)->slist_size ); \ \ if(H5SL_insert((cache_ptr)->slist_ptr, entry_ptr, &(entry_ptr)->addr) < 0) \ - HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, (fail_val), \ - "Can't insert entry in skip list") \ + HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, (fail_val), "can't insert entry in skip list") \ \ (entry_ptr)->in_slist = TRUE; \ (cache_ptr)->slist_changed = TRUE; \ @@ -1681,8 +1677,7 @@ if ( ( (cache_ptr)->index_size != \ \ if ( H5SL_remove((cache_ptr)->slist_ptr, &(entry_ptr)->addr) \ != (entry_ptr) ) \ - HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, \ - "Can't delete entry from skip list.") \ + HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "can't delete entry from skip list") \ \ HDassert( (cache_ptr)->slist_len > 0 ); \ if(!(during_flush)) \ @@ -1719,8 +1714,7 @@ if ( ( (cache_ptr)->index_size != \ \ if ( H5SL_remove((cache_ptr)->slist_ptr, &(entry_ptr)->addr) \ != (entry_ptr) ) \ - HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, \ - "Can't delete entry from skip list.") \ + HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "can't delete entry from skip list") \ \ HDassert( (cache_ptr)->slist_len > 0 ); \ if(!(during_flush)) \ @@ -2239,6 +2233,120 @@ if ( ( (cache_ptr)->index_size != \ /*------------------------------------------------------------------------- * + * Macro: H5C__UPDATE_RP_FOR_INSERT_APPEND + * + * Purpose: Update the replacement policy data structures for an + * insertion of the specified cache entry. + * + * Unlike H5C__UPDATE_RP_FOR_INSERTION below, mark the + * new entry as the LEAST recently used entry, not the + * most recently used. + * + * For now at least, this macro should only be used in + * the reconstruction of the metadata cache from a cache + * image block. + * + * At present, we only support the modified LRU policy, so + * this function deals with that case unconditionally. If + * we ever support other replacement policies, the function + * should switch on the current policy and act accordingly. + * + * Return: N/A + * + * Programmer: John Mainzer, 8/15/15 + * + *------------------------------------------------------------------------- + */ + +#if H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS + +#define H5C__UPDATE_RP_FOR_INSERT_APPEND(cache_ptr, entry_ptr, fail_val) \ +{ \ + HDassert( (cache_ptr) ); \ + HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \ + HDassert( (entry_ptr) ); \ + HDassert( !((entry_ptr)->is_protected) ); \ + HDassert( !((entry_ptr)->is_read_only) ); \ + HDassert( ((entry_ptr)->ro_ref_count) == 0 ); \ + HDassert( (entry_ptr)->size > 0 ); \ + \ + if ( (entry_ptr)->is_pinned ) { \ + \ + H5C__DLL_PREPEND((entry_ptr), (cache_ptr)->pel_head_ptr, \ + (cache_ptr)->pel_tail_ptr, \ + (cache_ptr)->pel_len, \ + (cache_ptr)->pel_size, (fail_val)) \ + \ + } else { \ + \ + /* modified LRU specific code */ \ + \ + /* insert the entry at the tail of the LRU list. */ \ + \ + H5C__DLL_APPEND((entry_ptr), (cache_ptr)->LRU_head_ptr, \ + (cache_ptr)->LRU_tail_ptr, \ + (cache_ptr)->LRU_list_len, \ + (cache_ptr)->LRU_list_size, (fail_val)) \ + \ + /* insert the entry at the tail of the clean or dirty LRU list as \ + * appropriate. \ + */ \ + \ + if ( entry_ptr->is_dirty ) { \ + H5C__AUX_DLL_APPEND((entry_ptr), (cache_ptr)->dLRU_head_ptr, \ + (cache_ptr)->dLRU_tail_ptr, \ + (cache_ptr)->dLRU_list_len, \ + (cache_ptr)->dLRU_list_size, (fail_val)) \ + } else { \ + H5C__AUX_DLL_APPEND((entry_ptr), (cache_ptr)->cLRU_head_ptr, \ + (cache_ptr)->cLRU_tail_ptr, \ + (cache_ptr)->cLRU_list_len, \ + (cache_ptr)->cLRU_list_size, (fail_val)) \ + } \ + \ + /* End modified LRU specific code. */ \ + } \ +} + +#else /* H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS */ + +#define H5C__UPDATE_RP_FOR_INSERT_APPEND(cache_ptr, entry_ptr, fail_val) \ +{ \ + HDassert( (cache_ptr) ); \ + HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \ + HDassert( (entry_ptr) ); \ + HDassert( !((entry_ptr)->is_protected) ); \ + HDassert( !((entry_ptr)->is_read_only) ); \ + HDassert( ((entry_ptr)->ro_ref_count) == 0 ); \ + HDassert( (entry_ptr)->size > 0 ); \ + \ + if ( (entry_ptr)->is_pinned ) { \ + \ + H5C__DLL_PREPEND((entry_ptr), (cache_ptr)->pel_head_ptr, \ + (cache_ptr)->pel_tail_ptr, \ + (cache_ptr)->pel_len, \ + (cache_ptr)->pel_size, (fail_val)) \ + \ + } else { \ + \ + /* modified LRU specific code */ \ + \ + /* insert the entry at the tail of the LRU list. */ \ + \ + H5C__DLL_APPEND((entry_ptr), (cache_ptr)->LRU_head_ptr, \ + (cache_ptr)->LRU_tail_ptr, \ + (cache_ptr)->LRU_list_len, \ + (cache_ptr)->LRU_list_size, (fail_val)) \ + \ + /* End modified LRU specific code. */ \ + } \ +} + +#endif /* H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS */ + + +/*------------------------------------------------------------------------- + * * Macro: H5C__UPDATE_RP_FOR_INSERTION * * Purpose: Update the replacement policy data structures for an @@ -2437,7 +2545,6 @@ if ( ( (cache_ptr)->index_size != \ (cache_ptr)->pel_tail_ptr, \ (cache_ptr)->pel_len, \ (cache_ptr)->pel_size, (fail_val)) \ - HDassert( (cache_ptr)->pel_len >= 0 ); \ \ } else { \ \ @@ -2500,7 +2607,6 @@ if ( ( (cache_ptr)->index_size != \ (cache_ptr)->pel_tail_ptr, \ (cache_ptr)->pel_len, \ (cache_ptr)->pel_size, (fail_val)) \ - HDassert( (cache_ptr)->pel_len >= 0 ); \ \ } else { \ \ @@ -2844,41 +2950,40 @@ if ( ( (cache_ptr)->index_size != \ H5C__DLL_REMOVE((entry_ptr), (cache_ptr)->pel_head_ptr, \ (cache_ptr)->pel_tail_ptr, (cache_ptr)->pel_len, \ (cache_ptr)->pel_size, (fail_val)) \ - HDassert( (cache_ptr)->pel_len >= 0 ); \ \ - /* modified LRU specific code */ \ + /* modified LRU specific code */ \ \ - /* insert the entry at the head of the LRU list. */ \ + /* insert the entry at the head of the LRU list. */ \ \ - H5C__DLL_PREPEND((entry_ptr), (cache_ptr)->LRU_head_ptr, \ - (cache_ptr)->LRU_tail_ptr, \ - (cache_ptr)->LRU_list_len, \ - (cache_ptr)->LRU_list_size, (fail_val)) \ + H5C__DLL_PREPEND((entry_ptr), (cache_ptr)->LRU_head_ptr, \ + (cache_ptr)->LRU_tail_ptr, \ + (cache_ptr)->LRU_list_len, \ + (cache_ptr)->LRU_list_size, (fail_val)) \ \ - /* Similarly, insert the entry at the head of either the clean \ - * or dirty LRU list as appropriate. \ - */ \ + /* Similarly, insert the entry at the head of either the clean \ + * or dirty LRU list as appropriate. \ + */ \ \ - if ( (entry_ptr)->is_dirty ) { \ + if ( (entry_ptr)->is_dirty ) { \ \ - H5C__AUX_DLL_PREPEND((entry_ptr), \ - (cache_ptr)->dLRU_head_ptr, \ - (cache_ptr)->dLRU_tail_ptr, \ - (cache_ptr)->dLRU_list_len, \ - (cache_ptr)->dLRU_list_size, \ - (fail_val)) \ + H5C__AUX_DLL_PREPEND((entry_ptr), \ + (cache_ptr)->dLRU_head_ptr, \ + (cache_ptr)->dLRU_tail_ptr, \ + (cache_ptr)->dLRU_list_len, \ + (cache_ptr)->dLRU_list_size, \ + (fail_val)) \ \ - } else { \ + } else { \ \ - H5C__AUX_DLL_PREPEND((entry_ptr), \ - (cache_ptr)->cLRU_head_ptr, \ - (cache_ptr)->cLRU_tail_ptr, \ - (cache_ptr)->cLRU_list_len, \ - (cache_ptr)->cLRU_list_size, \ - (fail_val)) \ - } \ + H5C__AUX_DLL_PREPEND((entry_ptr), \ + (cache_ptr)->cLRU_head_ptr, \ + (cache_ptr)->cLRU_tail_ptr, \ + (cache_ptr)->cLRU_list_len, \ + (cache_ptr)->cLRU_list_size, \ + (fail_val)) \ + } \ \ - /* End modified LRU specific code. */ \ + /* End modified LRU specific code. */ \ \ } /* H5C__UPDATE_RP_FOR_UNPIN */ @@ -2901,7 +3006,6 @@ if ( ( (cache_ptr)->index_size != \ H5C__DLL_REMOVE((entry_ptr), (cache_ptr)->pel_head_ptr, \ (cache_ptr)->pel_tail_ptr, (cache_ptr)->pel_len, \ (cache_ptr)->pel_size, (fail_val)) \ - HDassert( (cache_ptr)->pel_len >= 0 ); \ \ /* modified LRU specific code */ \ \ @@ -3074,22 +3178,22 @@ if ( ( (hd_ptr) == NULL ) || \ ( (len) <= 0 ) || \ ( (Size) < (entry_ptr)->size ) || \ ( ( (Size) == (entry_ptr)->size ) && ( ! ( (len) == 1 ) ) ) || \ - ( ( (entry_ptr)->coll_prev == NULL ) && ( (hd_ptr) != (entry_ptr) ) ) || \ + ( ( (entry_ptr)->coll_prev == NULL ) && ( (hd_ptr) != (entry_ptr) ) ) || \ ( ( (entry_ptr)->coll_next == NULL ) && ( (tail_ptr) != (entry_ptr) ) ) || \ ( ( (len) == 1 ) && \ ( ! ( ( (hd_ptr) == (entry_ptr) ) && ( (tail_ptr) == (entry_ptr) ) && \ - ( (entry_ptr)->coll_next == NULL ) && \ - ( (entry_ptr)->coll_prev == NULL ) && \ + ( (entry_ptr)->coll_next == NULL ) && \ + ( (entry_ptr)->coll_prev == NULL ) && \ ( (Size) == (entry_ptr)->size ) \ ) \ ) \ ) \ ) { \ - HDassert(0 && "coll DLL pre remove SC failed"); \ - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, (fv), "coll DLL pre remove SC failed") \ + HDassert(0 && "coll DLL pre remove SC failed"); \ + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, (fv), "coll DLL pre remove SC failed") \ } -#define H5C__COLL_DLL_SC(head_ptr, tail_ptr, len, Size, fv) \ +#define H5C__COLL_DLL_SC(head_ptr, tail_ptr, len, Size, fv) \ if ( ( ( ( (head_ptr) == NULL ) || ( (tail_ptr) == NULL ) ) && \ ( (head_ptr) != (tail_ptr) ) \ ) || \ @@ -3101,36 +3205,35 @@ if ( ( ( ( (head_ptr) == NULL ) || ( (tail_ptr) == NULL ) ) && \ ) \ ) || \ ( ( (len) >= 1 ) && \ - ( ( (head_ptr) == NULL ) || ( (head_ptr)->coll_prev != NULL ) || \ - ( (tail_ptr) == NULL ) || ( (tail_ptr)->coll_next != NULL ) \ + ( ( (head_ptr) == NULL ) || ( (head_ptr)->coll_prev != NULL ) || \ + ( (tail_ptr) == NULL ) || ( (tail_ptr)->coll_next != NULL ) \ ) \ ) \ ) { \ - HDassert(0 && "COLL DLL sanity check failed"); \ + HDassert(0 && "COLL DLL sanity check failed"); \ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, (fv), "COLL DLL sanity check failed") \ } #define H5C__COLL_DLL_PRE_INSERT_SC(entry_ptr, hd_ptr, tail_ptr, len, Size, fv) \ if ( ( (entry_ptr) == NULL ) || \ - ( (entry_ptr)->coll_next != NULL ) || \ - ( (entry_ptr)->coll_prev != NULL ) || \ + ( (entry_ptr)->coll_next != NULL ) || \ + ( (entry_ptr)->coll_prev != NULL ) || \ ( ( ( (hd_ptr) == NULL ) || ( (tail_ptr) == NULL ) ) && \ ( (hd_ptr) != (tail_ptr) ) \ ) || \ - ( (len) < 0 ) || \ ( ( (len) == 1 ) && \ ( ( (hd_ptr) != (tail_ptr) ) || ( (Size) <= 0 ) || \ ( (hd_ptr) == NULL ) || ( (hd_ptr)->size != (Size) ) \ ) \ ) || \ ( ( (len) >= 1 ) && \ - ( ( (hd_ptr) == NULL ) || ( (hd_ptr)->coll_prev != NULL ) || \ - ( (tail_ptr) == NULL ) || ( (tail_ptr)->coll_next != NULL ) \ + ( ( (hd_ptr) == NULL ) || ( (hd_ptr)->coll_prev != NULL ) || \ + ( (tail_ptr) == NULL ) || ( (tail_ptr)->coll_next != NULL ) \ ) \ ) \ ) { \ - HDassert(0 && "COLL DLL pre insert SC failed"); \ - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, (fv), "COLL DLL pre insert SC failed") \ + HDassert(0 && "COLL DLL pre insert SC failed"); \ + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, (fv), "COLL DLL pre insert SC failed") \ } #else /* H5C_DO_SANITY_CHECKS */ @@ -3433,10 +3536,8 @@ typedef struct H5C_tag_info_t { * types are stored in the type_name_table discussed below, and * indexed by the ids. * - * type_name_table_ptr: Pointer to an array of pointer to char of length - * max_type_id + 1. The strings pointed to by the entries - * in the array are the names of the entry types associated - * with the indexing type IDs. + * class_table_ptr: Pointer to an array of H5C_class_t of length + * max_type_id + 1. Entry classes for the cache. * * max_cache_size: Nominal maximum number of bytes that may be stored in the * cache. This value should be viewed as a soft limit, as the @@ -3986,7 +4087,22 @@ typedef struct H5C_tag_info_t { * * size_decreased: Boolean flag set to TRUE whenever the maximum cache * size is decreased. The flag triggers a call to - * H5C_make_space_in_cache() on the next call to H5C_protect(). + * H5C__make_space_in_cache() on the next call to H5C_protect(). + * + * resize_in_progress: As the metadata cache has become re-entrant, it is + * possible that a protect may trigger a call to + * H5C__auto_adjust_cache_size(), which may trigger a flush, + * which may trigger a protect, which will result in another + * call to H5C__auto_adjust_cache_size(). + * + * The resize_in_progress boolean flag is used to detect this, + * and to prevent the infinite recursion that would otherwise + * occur. + * + * Note that this issue is not hypothetical -- this field + * was added 12/29/15 to fix a bug exposed in the testing + * of changes to the file driver info superblock extension + * management code needed to support rings. * * resize_ctl: Instance of H5C_auto_size_ctl_t containing configuration * data for automatic cache resizing. @@ -4063,6 +4179,77 @@ typedef struct H5C_tag_info_t { * this field will be reset every automatic resize epoch. * * + * Metadata cache image management related fields. + * + * image_ctl: Instance of H5C_cache_image_ctl_t containing configuration + * data for generation of a cache image on file close. + * + * serialization_in_progress: Boolean field that is set to TRUE iff + * the cache is in the process of being serialized. This + * field is needed to support the H5C_serialization_in_progress() + * call, which is in turn required for sanity checks in some + * cache clients. + * + * load_image: Boolean flag indicating that the metadata cache image + * superblock extension message exists and should be + * read, and the image block read and decoded on the next + * call to H5C_protect(). + * + * image_loaded: Boolean flag indicating that the metadata cache has + * loaded the metadata cache image as directed by the + * MDC cache image superblock extension message. + * + * delete_image: Boolean flag indicating whether the metadata cache image + * superblock message should be deleted and the cache image + * file space freed after they have been read and decoded. + * + * This flag should be set to TRUE iff the file is opened + * R/W and there is a cache image to be read. + * + * image_addr: haddr_t containing the base address of the on disk + * metadata cache image, or HADDR_UNDEF if that value is + * undefined. Note that this field is used both in the + * construction and write, and the read and decode of + * metadata cache image blocks. + * + * image_len: hsize_t containing the size of the on disk metadata cache + * image, or zero if that value is undefined. Note that this + * field is used both in the construction and write, and the + * read and decode of metadata cache image blocks. + * + * image_data_len: size_t containing the number of bytes of data in the + * on disk metadata cache image, or zero if that value is + * undefined. + * + * In most cases, this value is the same as the image_len + * above. It exists to allow for metadata cache image blocks + * that are larger than the actual image. Thus in all + * cases image_data_len <= image_len. + * + * To create the metadata cache image, we must first serialize all the + * entries in the metadata cache. This is done by a scan of the index. + * As entries must be serialized in increasing flush dependency height + * order, we scan the index repeatedly, once for each flush dependency + * height in increasing order. + * + * This operation is complicated by the fact that entries other the the + * target may be inserted, loaded, relocated, or removed from the cache + * (either by eviction or the take ownership flag) as the result of a + * pre_serialize or serialize callback. While entry removals are not + * a problem for the scan of the index, insertions, loads, and relocations + * are. Hence the entries loaded, inserted, and relocated counters + * listed below have been implemented to allow these conditions to be + * detected and dealt with by restarting the scan. + * + * The serialization operation is further complicated by the fact that + * the flush dependency height of a given entry may increase (as the + * result of an entry load or insert) or decrease (as the result of an + * entry removal -- via either eviction or the take ownership flag). The + * entry_fd_height_change_counter field is maintained to allow detection + * of this condition, and a restart of the scan when it occurs. + * + * Note that all these new fields would work just as well as booleans. + * * entries_loaded_counter: Number of entries loaded into the cache * since the last time this field was reset. * @@ -4072,6 +4259,29 @@ typedef struct H5C_tag_info_t { * entries relocated_counter: Number of entries whose base address has * been changed since the last time this field was reset. * + * entry_fd_height_change_counter: Number of entries whose flush dependency + * height has changed since the last time this field was reset. + * + * The following fields are used assemble the cache image prior to + * writing it to disk. + * + * num_entries_in_image: Unsigned integer field containing the number of entries + * to be copied into the metadata cache image. Note that + * this value will be less than the number of entries in + * the cache, and the superblock and its related entries + * are not written to the metadata cache image. + * + * image_entries: Pointer to a dynamically allocated array of instance of + * H5C_image_entry_t of length num_entries_in_image, or NULL + * if that array does not exist. This array is used to + * assemble entry data to be included in the image, and to + * sort them by flush dependency height and LRU rank. + * + * image_buffer: Pointer to the dynamically allocated buffer of length + * image_len in which the metadata cache image is assembled, + * or NULL if that buffer does not exist. + * + * * Free Space Manager Related fields: * * The free space managers must be informed when we are about to close @@ -4080,10 +4290,10 @@ typedef struct H5C_tag_info_t { * page buffering, this is no longer viable, as we must finalize the on * disk image of all metadata much sooner. * - * This is handled by the H5FS_settle_raw_data_fsm() and - * H5FS_settle_meta_data_fsm() routines. As these calls are expensive, + * This is handled by the H5MF_settle_raw_data_fsm() and + * H5MF_settle_meta_data_FSM() routines. As these calls are expensive, * the following fields are used to track whether the target free space - * managers are clean. + * managers are clean. * * They are also used in sanity checking, as once a free space manager is * settled, it should not become unsettled (i.e. be asked to allocate or @@ -4100,7 +4310,7 @@ typedef struct H5C_tag_info_t { * free space manager metadata. * * mdfsm_settled: Boolean flag indicating whether the meta data free space - * manager is settled -- i.e. whether the correct space has + * manager is settled -- i.e. whether the correct space has * been allocated for it in the file. * * Note that the name of this field is deceptive. In the @@ -4285,23 +4495,63 @@ typedef struct H5C_tag_info_t { * max_pel_size: Largest value attained by the pel_size field in the * current epoch. * - * calls_to_msic: Total number of calls to H5C_make_space_in_cache + * calls_to_msic: Total number of calls to H5C__make_space_in_cache * * total_entries_skipped_in_msic: Number of clean entries skipped while - * enforcing the min_clean_fraction in H5C_make_space_in_cache(). + * enforcing the min_clean_fraction in H5C__make_space_in_cache(). * * total_entries_scanned_in_msic: Number of clean entries skipped while - * enforcing the min_clean_fraction in H5C_make_space_in_cache(). + * enforcing the min_clean_fraction in H5C__make_space_in_cache(). * * max_entries_skipped_in_msic: Maximum number of clean entries skipped - * in any one call to H5C_make_space_in_cache(). + * in any one call to H5C__make_space_in_cache(). * * max_entries_scanned_in_msic: Maximum number of entries scanned over - * in any one call to H5C_make_space_in_cache(). + * in any one call to H5C__make_space_in_cache(). * * entries_scanned_to_make_space: Number of entries scanned only when looking * for entries to evict in order to make space in cache. * + * + * The following fields track statistics on cache images. + * + * images_created: Integer field containing the number of cache images + * created since the last time statistics were reset. + * + * At present, this field must always be either 0 or 1. + * Further, since cache images are only created at file + * close, this field should only be set at that time. + * + * images_loaded: Integer field containing the number of cache images + * loaded since the last time statistics were reset. + * + * At present, this field must always be either 0 or 1. + * Further, since cache images are only loaded at the + * time of the first protect or on file close, this value + * should only change on those events. + * + * last_image_size: Size of the most recently loaded metadata cache image + * loaded into the cache, or zero if no image has been + * loaded. + * + * At present, at most one cache image can be loaded into + * the metadata cache for any given file, and this image + * will be loaded either on the first protect, or on file + * close if no entry is protected before then. + * + * + * Fields for tracking prefetched entries. Note that flushes and evictions + * of prefetched entries are tracked in the flushes and evictions arrays + * discused above. + * + * prefetches: Number of prefetched entries that are loaded to the + * cache. + * + * dirty_prefetches: Number of dirty prefetched entries that are loaded + * into the cache. + * + * prefetch_hits: Number of prefetched entries that are actually used. + * * * As entries are now capable of moving, loading, dirtying, and deleting * other entries in their pre_serialize and serialize callbacks, it has @@ -4372,6 +4622,11 @@ typedef struct H5C_tag_info_t { * field is intended to allow marking of output of with * the processes mpi rank. * + * get_entry_ptr_from_addr_counter: Counter used to track the number of + * times the H5C_get_entry_ptr_from_addr() function has been + * called successfully. This field is only defined when + * NDEBUG is not #defined. + * ****************************************************************************/ struct H5C_t { uint32_t magic; @@ -4382,7 +4637,7 @@ struct H5C_t { FILE * log_file_ptr; void * aux_ptr; int32_t max_type_id; - const char * (* type_name_table_ptr); + const H5C_class_t * const *class_table_ptr; size_t max_cache_size; size_t min_clean_size; H5C_write_permitted_func_t check_write_permitted; @@ -4392,16 +4647,16 @@ struct H5C_t { hbool_t close_warning_received; /* Fields for maintaining [hash table] index of entries */ - int32_t index_len; + uint32_t index_len; size_t index_size; - int32_t index_ring_len[H5C_RING_NTYPES]; + uint32_t index_ring_len[H5C_RING_NTYPES]; size_t index_ring_size[H5C_RING_NTYPES]; size_t clean_index_size; size_t clean_index_ring_size[H5C_RING_NTYPES]; size_t dirty_index_size; size_t dirty_index_ring_size[H5C_RING_NTYPES]; H5C_cache_entry_t * index[H5C__HASH_TABLE_LEN]; - int32_t il_len; + uint32_t il_len; size_t il_size; H5C_cache_entry_t * il_head; H5C_cache_entry_t * il_tail; @@ -4413,15 +4668,15 @@ struct H5C_t { /* Fields for maintaining list of in-order entries, for flushing */ hbool_t slist_changed; - int32_t slist_len; + uint32_t slist_len; size_t slist_size; - int32_t slist_ring_len[H5C_RING_NTYPES]; + uint32_t slist_ring_len[H5C_RING_NTYPES]; size_t slist_ring_size[H5C_RING_NTYPES]; H5SL_t * slist_ptr; - int32_t num_last_entries; + uint32_t num_last_entries; #if H5C_DO_SANITY_CHECKS - int64_t slist_len_increase; - int64_t slist_size_increase; + int32_t slist_len_increase; + ssize_t slist_size_increase; #endif /* H5C_DO_SANITY_CHECKS */ /* Fields for maintaining list of tagged entries */ @@ -4429,38 +4684,38 @@ struct H5C_t { hbool_t ignore_tags; /* Fields for tracking protected entries */ - int32_t pl_len; + uint32_t pl_len; size_t pl_size; H5C_cache_entry_t * pl_head_ptr; H5C_cache_entry_t * pl_tail_ptr; /* Fields for tracking pinned entries */ - int32_t pel_len; + uint32_t pel_len; size_t pel_size; H5C_cache_entry_t * pel_head_ptr; H5C_cache_entry_t * pel_tail_ptr; /* Fields for complete LRU list of entries */ - int32_t LRU_list_len; + uint32_t LRU_list_len; size_t LRU_list_size; H5C_cache_entry_t * LRU_head_ptr; H5C_cache_entry_t * LRU_tail_ptr; /* Fields for clean LRU list of entries */ - int32_t cLRU_list_len; + uint32_t cLRU_list_len; size_t cLRU_list_size; H5C_cache_entry_t * cLRU_head_ptr; H5C_cache_entry_t * cLRU_tail_ptr; /* Fields for dirty LRU list of entries */ - int32_t dLRU_list_len; + uint32_t dLRU_list_len; size_t dLRU_list_size; H5C_cache_entry_t * dLRU_head_ptr; H5C_cache_entry_t * dLRU_tail_ptr; #ifdef H5_HAVE_PARALLEL /* Fields for collective metadata reads */ - int32_t coll_list_len; + uint32_t coll_list_len; size_t coll_list_size; H5C_cache_entry_t * coll_head_ptr; H5C_cache_entry_t * coll_tail_ptr; @@ -4477,6 +4732,7 @@ struct H5C_t { hbool_t resize_enabled; hbool_t cache_full; hbool_t size_decreased; + hbool_t resize_in_progress; H5C_auto_size_ctl_t resize_ctl; /* Fields for epoch markers used in automatic cache size adjustment */ @@ -4492,9 +4748,23 @@ struct H5C_t { int64_t cache_hits; int64_t cache_accesses; + /* fields supporting generation of a cache image on file close */ + H5C_cache_image_ctl_t image_ctl; + hbool_t serialization_in_progress; + hbool_t load_image; + hbool_t image_loaded; + hbool_t delete_image; + haddr_t image_addr; + hsize_t image_len; + hsize_t image_data_len; int64_t entries_loaded_counter; int64_t entries_inserted_counter; int64_t entries_relocated_counter; + int64_t entry_fd_height_change_counter; + uint32_t num_entries_in_image; + H5C_image_entry_t * image_entries; + void * image_buffer; + /* Free Space Manager Related fields */ hbool_t rdfsm_settled; hbool_t mdfsm_settled; @@ -4532,21 +4802,21 @@ struct H5C_t { int64_t total_successful_ht_search_depth; int64_t failed_ht_searches; int64_t total_failed_ht_search_depth; - int32_t max_index_len; + uint32_t max_index_len; size_t max_index_size; size_t max_clean_index_size; size_t max_dirty_index_size; /* Fields for in-order skip list */ - int32_t max_slist_len; + uint32_t max_slist_len; size_t max_slist_size; /* Fields for protected entry list */ - int32_t max_pl_len; + uint32_t max_pl_len; size_t max_pl_size; /* Fields for pinned entry list */ - int32_t max_pel_len; + uint32_t max_pel_len; size_t max_pel_size; /* Fields for tracking 'make space in cache' (msic) operations */ @@ -4562,6 +4832,16 @@ struct H5C_t { int64_t LRU_scan_restarts; int64_t index_scan_restarts; + /* Fields for tracking cache image operations */ + int32_t images_created; + int32_t images_loaded; + hsize_t last_image_size; + + /* Fields for tracking prefetched entries */ + int64_t prefetches; + int64_t dirty_prefetches; + int64_t prefetch_hits; + #if H5C_COLLECT_CACHE_ENTRY_STATS int32_t max_accesses[H5C__MAX_NUM_TYPE_IDS + 1]; int32_t min_accesses[H5C__MAX_NUM_TYPE_IDS + 1]; @@ -4573,6 +4853,10 @@ struct H5C_t { #endif /* H5C_COLLECT_CACHE_STATS */ char prefix[H5C__PREFIX_LEN]; + +#ifndef NDEBUG + int64_t get_entry_ptr_from_addr_counter; +#endif /* NDEBUG */ }; /* Define typedef for tagged cache entry iteration callbacks */ @@ -4583,20 +4867,28 @@ typedef int (*H5C_tag_iter_cb_t)(H5C_cache_entry_t *entry, void *ctx); /* Package Private Variables */ /*****************************/ -/* Metadata cache epoch class */ -H5_DLLVAR const H5C_class_t H5C__epoch_marker_class; - /******************************/ /* Package Private Prototypes */ /******************************/ +H5_DLL herr_t H5C__prep_image_for_file_close(H5F_t *f, hid_t dxpl_id); +H5_DLL herr_t H5C__deserialize_prefetched_entry(H5F_t *f, hid_t dxpl_id, + H5C_t * cache_ptr, H5C_cache_entry_t** entry_ptr_ptr, + const H5C_class_t * type, haddr_t addr, void * udata); /* General routines */ H5_DLL herr_t H5C__flush_single_entry(H5F_t *f, hid_t dxpl_id, H5C_cache_entry_t *entry_ptr, unsigned flags); +H5_DLL herr_t H5C__generate_cache_image(H5F_t *f, hid_t dxpl_id, H5C_t *cache_ptr); +H5_DLL herr_t H5C__load_cache_image(H5F_t *f, hid_t dxpl_id); H5_DLL herr_t H5C__mark_flush_dep_serialized(H5C_cache_entry_t * entry_ptr); H5_DLL herr_t H5C__mark_flush_dep_unserialized(H5C_cache_entry_t * entry_ptr); +H5_DLL herr_t H5C__make_space_in_cache(H5F_t * f, hid_t dxpl_id, + size_t space_needed, hbool_t write_permitted); H5_DLL herr_t H5C__flush_marked_entries(H5F_t * f, hid_t dxpl_id); +H5_DLL herr_t H5C__generate_image(H5F_t *f, H5C_t *cache_ptr, + H5C_cache_entry_t *entry_ptr, hid_t dxpl_id); +H5_DLL herr_t H5C__serialize_cache(H5F_t *f, hid_t dxpl_id); H5_DLL herr_t H5C__iter_tagged_entries(H5C_t *cache, haddr_t tag, hbool_t match_global, H5C_tag_iter_cb_t cb, void *cb_ctx); diff --git a/src/H5Cprivate.h b/src/H5Cprivate.h index 654ce35..28eacf2 100644 --- a/src/H5Cprivate.h +++ b/src/H5Cprivate.h @@ -114,6 +114,7 @@ /* Cache configuration versions */ #define H5C__CURR_AUTO_SIZE_CTL_VER 1 #define H5C__CURR_AUTO_RESIZE_RPT_FCN_VER 1 +#define H5C__CURR_CACHE_IMAGE_CTL_VER 1 /* Default configuration settings */ #define H5C__DEF_AR_UPPER_THRESHHOLD 0.9999f @@ -994,16 +995,16 @@ typedef int H5C_ring_t; * just before the entry is freed. * * This is necessary, as the LRU list can be changed out - * from under H5C_make_space_in_cache() by the serialize + * from under H5C__make_space_in_cache() by the serialize * callback which may change the size of an existing entry, * and/or load a new entry while serializing the target entry. * * This in turn can cause a recursive call to - * H5C_make_space_in_cache() which may either flush or evict + * H5C__make_space_in_cache() which may either flush or evict * the next entry that the first invocation of that function * was about to examine. * - * The magic field allows H5C_make_space_in_cache() to + * The magic field allows H5C__make_space_in_cache() to * detect this case, and re-start its scan from the bottom * of the LRU when this situation occurs. * @@ -1338,6 +1339,187 @@ typedef int H5C_ring_t; * In either case, when there is no previous item, it should * be NULL. * + * Fields supporting the cache image feature: + * + * The following fields are used to store data about the entry which must + * be stored in the cache image block, but which will typically be either + * lost or heavily altered in the process of serializing the cache and + * preparing its contents to be copied into the cache image block. + * + * Some fields are also used in loading the contents of the metadata cache + * image back into the cache, and in managing such entries until they are + * either protected by the library (at which point they become regular + * entries) or are evicted. See discussion of the prefetched field for + * further details. + * + * include_in_image: Boolean flag indicating whether this entry should + * be included in the metadata cache image. This field should + * always be false prior to the H5C_prep_for_file_close() call. + * During that call, it should be set to TRUE for all entries + * that are to be included in the metadata cache image. At + * present, only the superblock, the superblock extension + * object header and its chunks (if any) are omitted from + * the image. + * + * lru_rank: Rank of the entry in the LRU just prior to file close. + * + * Note that the first entry on the LRU has lru_rank 1, + * and that entries not on the LRU at that time will have + * either lru_rank -1 (if pinned) or 0 (if loaded during + * the process of flushing the cache. + * + * image_dirty: Boolean flag indicating whether the entry should be marked + * as dirty in the metadata cache image. The flag is set to + * TRUE iff the entry is dirty when H5C_prep_for_file_close() + * is called. + * + * fd_parent_count: If the entry is a child in one or more flush dependency + * relationships, this field contains the number of flush + * dependency parents. + * + * In all other cases, the field is set to zero. + * + * Note that while this count is initially taken from the + * flush dependency fields above, if the entry is in the + * cache image (i.e. include_in_image is TRUE), any parents + * that are not in the image are removed from this count and + * from the fd_parent_addrs array below. + * + * Finally observe that if the entry is dirty and in the + * cache image, and its parent is dirty and not in the cache + * image, then the entry must be removed from the cache image + * to avoid violating the flush dependency flush ordering. + * + * fd_parent_addrs: If the entry is a child in one or more flush dependency + * relationship when H5C_prep_for_file_close() is called, this + * field must contain a pointer to an array of size + * fd_parent_count containing the on disk addresses of the + * parent. + * + * In all other cases, the field is set to NULL. + * + * Note that while this list of addresses is initially taken + * from the flush dependency fields above, if the entry is in the + * cache image (i.e. include_in_image is TRUE), any parents + * that are not in the image are removed from this list, and + * and from the fd_parent_count above. + * + * Finally observe that if the entry is dirty and in the + * cache image, and its parent is dirty and not in the cache + * image, then the entry must be removed from the cache image + * to avoid violating the flush dependency flush ordering. + * + * fd_child_count: If the entry is a parent in a flush dependency + * relationship, this field contains the number of flush + * dependency children. + * + * In all other cases, the field is set to zero. + * + * Note that while this count is initially taken from the + * flush dependency fields above, if the entry is in the + * cache image (i.e. include_in_image is TRUE), any children + * that are not in the image are removed from this count. + * + * fd_dirty_child_count: If the entry is a parent in a flush dependency + * relationship, this field contains the number of dirty flush + * dependency children. + * + * In all other cases, the field is set to zero. + * + * Note that while this count is initially taken from the + * flush dependency fields above, if the entry is in the + * cache image (i.e. include_in_image is TRUE), any dirty + * children that are not in the image are removed from this + * count. + * + * image_fd_height: Flush dependency height of the entry in the cache image. + * + * The flush dependency height of any entry involved in a + * flush dependency relationship is defined to be the + * longest flush dependency path from that entry to an entry + * with no flush depenency children. + * + * Since the image_fd_height is used to order entries in the + * cache image so that fd parents preceed fd children, for + * purposes of this field, and entry is at flush dependency + * level 0 if it either has no children, or if all of its + * children are not in the cache image. + * + * Note that if a child in a flush dependency relationship is + * dirty and in the cache image, and its parent is dirty and + * not in the cache image, then the child must be excluded + * from the cache image to maintain flush ordering. + * + * prefetched: Boolean flag indicating that the on disk image of the entry + * has been loaded into the cache prior any request for the + * entry by the rest of the library. + * + * As of this writing (8/10/15), this can only happen through + * the load of a cache image block, although other scenarios + * are contemplated for the use of this feature. Note that + * unlike the usual prefetch situation, this means that a + * pre fetched entry can be dirty, and/or can be a party to + * flush dependency relationship(s). This complicates matters + * somewhat. + * + * The essential feature of a pre-fetched entry is that it + * consists only of a buffer containing the on disk image of + * the entry. Thus it must be deserialized before it can + * be passed back to the library on a protect call. This + * task is handled by H5C_deserialized_prefetched_entry(). + * In essence, this routine calls the deserialize callback + * provided in the protect call with the on disk image, + * deletes the prefetched entry from the cache, and replaces + * it with the deserialized entry returned by the deserialize + * callback. + * + * Further, if the prefetched entry is a flush dependency parent, + * all its flush dependency children (which must also be + * pre-fetched entries), must be tranfered to the new cache + * entry returned by the deserailization callback. + * + * Finally, if the prefetched entry is a flush dependency child, + * this flush dependency must be destroyed prior to the + * deserialize call. + * + * In addition to the above special processing on the first + * protect call on a prefetched entry (after which is no longer + * a prefetched entry), prefetched entries also require special + * tretment on flush and evict. + * + * On flush, a dirty prefetched entry must simply be written + * to disk and marked clean without any call to any client + * callback. + * + * On eviction, if a prefetched entry is a flush dependency + * child, that flush dependency relationship must be destroyed + * just prior to the eviction. If the flush dependency code + * is working properly, it should be impossible for any entry + * that is a flush dependency parent to be evicted. + * + * prefetch_type_id: Integer field containing the type ID of the prefetched + * entry. This ID must match the ID of the type provided in any + * protect call on the prefetched entry. + * + * The value of this field is undefined in prefetched is FALSE. + * + * age: Number of times a prefetched entry has appeared in + * subsequent cache images. The field exists to allow + * imposition of a limit on how many times a prefetched + * entry can appear in subsequent cache images without being + * converted to a regular entry. + * + * This field must be zero if prefetched is FALSE. + * + * serialization_count: Integer field used to maintain a count of the + * number of times each entry is serialized during cache + * serialization. While no entry should be serialized more than + * once in any serialization call, throw an assertion if any + * flush depencency parent is serialized more than once during + * a single cache serialization. + * + * This is a debugging field, and thus is maintained only if + * NDEBUG is undefined. * * Fields supporting tagged entries: * @@ -1433,6 +1615,23 @@ typedef struct H5C_cache_entry_t { struct H5C_cache_entry_t *coll_prev; #endif /* H5_HAVE_PARALLEL */ + /* fields supporting cache image */ + hbool_t include_in_image; + int32_t lru_rank; + hbool_t image_dirty; + uint64_t fd_parent_count; + haddr_t *fd_parent_addrs; + uint64_t fd_child_count; + uint64_t fd_dirty_child_count; + uint32_t image_fd_height; + hbool_t prefetched; + int prefetch_type_id; + int32_t age; + +#ifndef NDEBUG /* debugging field */ + int serialization_count; +#endif /* NDEBUG */ + /* fields supporting tag lists */ struct H5C_cache_entry_t *tl_next; struct H5C_cache_entry_t *tl_prev; @@ -1447,6 +1646,168 @@ typedef struct H5C_cache_entry_t { #endif /* H5C_COLLECT_CACHE_ENTRY_STATS */ } H5C_cache_entry_t; + +/**************************************************************************** + * + * structure H5C_image_entry_t + * + * Instances of the H5C_image_entry_t structure are used to store data on + * metadata cache entries used in the construction of the metadata cache + * image block. In essence this structure is a greatly simplified version + * of H5C_cache_entry_t. + * + * The fields of this structure are discussed individually below: + * + * JRM - 8/5/15 + * + * magic: Unsigned 32 bit integer that must always be set to + * H5C_IMAGE_ENTRY_T_MAGIC when the entry is valid. + * The field must be set to H5C_IMAGE_ENTRY_T_BAD_MAGIC + * just before the entry is freed. + * + * addr: Base address of the cache entry on disk. + * + * size: Length of the cache entry on disk in bytes. + * + * ring: Instance of H5C_ring_t indicating the flush ordering ring + * to which this entry is assigned. + * + * age: Number of times this prefetech entry has appeared in + * the current sequence of cache images. This field is + * initialized to 0 if the instance of H5C_image_entry_t + * is constructed from a regular entry. + * + * If the instance is constructed from a prefetched entry + * currently residing in the metadata cache, the field is + * set to 1 + the age of the prefetched entry, or to + * H5AC__CACHE_IMAGE__ENTRY_AGEOUT__MAX if that sum exceeds + * H5AC__CACHE_IMAGE__ENTRY_AGEOUT__MAX. + * + * type_id: Integer field containing the type ID of the entry. + * + * lru_rank: Rank of the entry in the LRU just prior to file close. + * + * Note that the first entry on the LRU has lru_rank 1, + * and that entries not on the LRU at that time will have + * either lru_rank -1 (if pinned) or 0 (if loaded during + * the process of flushing the cache. + * + * is_dirty: Boolean flag indicating whether the contents of the cache + * entry has been modified since the last time it was written + * to disk as a regular piece of metadata. + * + * image_fd_height: Flush dependency height of the entry in the cache image. + * + * The flush dependency height of any entry involved in a + * flush dependency relationship is defined to be the + * longest flush dependency path from that entry to an entry + * with no flush depenency children. + * + * Since the image_fd_height is used to order entries in the + * cache image so that fd parents preceed fd children, for + * purposes of this field, an entry is at flush dependency + * level 0 if it either has no children, or if all of its + * children are not in the cache image. + * + * Note that if a child in a flush dependency relationship is + * dirty and in the cache image, and its parent is dirty and + * not in the cache image, then the child must be excluded + * from the cache image to maintain flush ordering. + * + * fd_parent_count: If the entry is a child in one or more flush dependency + * relationships, this field contains the number of flush + * dependency parents. + * + * In all other cases, the field is set to zero. + * + * Note that while this count is initially taken from the + * flush dependency fields in the associated instance of + * H5C_cache_entry_t, if the entry is in the cache image + * (i.e. include_in_image is TRUE), any parents that are + * not in the image are removed from this count and + * from the fd_parent_addrs array below. + * + * Finally observe that if the entry is dirty and in the + * cache image, and its parent is dirty and not in the cache + * image, then the entry must be removed from the cache image + * to avoid violating the flush dependency flush ordering. + * This should have happened before the construction of + * the instance of H5C_image_entry_t. + * + * fd_parent_addrs: If the entry is a child in one or more flush dependency + * relationship when H5C_prep_for_file_close() is called, this + * field must contain a pointer to an array of size + * fd_parent_count containing the on disk addresses of the + * parents. + * + * In all other cases, the field is set to NULL. + * + * Note that while this list of addresses is initially taken + * from the flush dependency fields in the associated instance of + * H5C_cache_entry_t, if the entry is in the cache image + * (i.e. include_in_image is TRUE), any parents that are not + * in the image are removed from this list, and from the + * fd_parent_count above. + * + * Finally observe that if the entry is dirty and in the + * cache image, and its parent is dirty and not in the cache + * image, then the entry must be removed from the cache image + * to avoid violating the flush dependency flush ordering. + * This should have happened before the construction of + * the instance of H5C_image_entry_t. + * + * fd_child_count: If the entry is a parent in a flush dependency + * relationship, this field contains the number of flush + * dependency children. + * + * In all other cases, the field is set to zero. + * + * Note that while this count is initially taken from the + * flush dependency fields in the associated instance of + * H5C_cache_entry_t, if the entry is in the cache image + * (i.e. include_in_image is TRUE), any children + * that are not in the image are removed from this count. + * + * fd_dirty_child_count: If the entry is a parent in a flush dependency + * relationship, this field contains the number of dirty flush + * dependency children. + * + * In all other cases, the field is set to zero. + * + * Note that while this count is initially taken from the + * flush dependency fields in the associated instance of + * H5C_cache_entry_t, if the entry is in the cache image + * (i.e. include_in_image is TRUE), any dirty children + * that are not in the image are removed from this count. + * + * image_ptr: Pointer to void. When not NULL, this field points to a + * dynamically allocated block of size bytes in which the + * on disk image of the metadata cache entry is stored. + * + * If the entry is dirty, the pre-serialize and serialize + * callbacks must be used to update this image before it is + * written to disk + * + * + ****************************************************************************/ + +typedef struct H5C_image_entry_t { + uint32_t magic; + haddr_t addr; + size_t size; + H5C_ring_t ring; + int32_t age; + int32_t type_id; + int32_t lru_rank; + hbool_t is_dirty; + unsigned image_fd_height; + uint64_t fd_parent_count; + haddr_t *fd_parent_addrs; + uint64_t fd_child_count; + uint64_t fd_dirty_child_count; + void *image_ptr; +} H5C_image_entry_t; + /**************************************************************************** * * structure H5C_auto_size_ctl_t @@ -1736,12 +2097,98 @@ typedef struct H5C_auto_size_ctl_t { double empty_reserve; } H5C_auto_size_ctl_t; +/**************************************************************************** + * + * structure H5C_cache_image_ctl_t + * + * Instances of H5C_image_ctl_t are used to get and set the control + * fields for generation of a metadata cache image on file close. + * + * At present control of construction of a cache image is via a FAPL + * property at file open / create. + * + * The fields of the structure are discussed individually below: + * + * version: Integer field containing the version number of this version + * of the H5C_image_ctl_t structure. Any instance of + * H5C_image_ctl_t passed to the cache must have a known + * version number, or an error will be flagged. + * + * generate_image: Boolean flag indicating whether a cache image should + * be created on file close. + * + * save_resize_status: Boolean flag indicating whether the cache image + * should include the adaptive cache resize configuration and status. + * Note that this field is ignored at present. + * + * entry_ageout: Integer field indicating the maximum number of + * times a prefetched entry can appear in subsequent cache images. + * This field exists to allow the user to avoid the buildup of + * infrequently used entries in long sequences of cache images. + * + * The value of this field must lie in the range + * H5AC__CACHE_IMAGE__ENTRY_AGEOUT__NONE (-1) to + * H5AC__CACHE_IMAGE__ENTRY_AGEOUT__MAX (100). + * + * H5AC__CACHE_IMAGE__ENTRY_AGEOUT__NONE means that no limit + * is imposed on number of times a prefeteched entry can appear + * in subsequent cache images. + * + * A value of 0 prevents prefetched entries from being included + * in cache images. + * + * Positive integers restrict prefetched entries to the specified + * number of appearances. + * + * Note that the number of subsequent cache images that a prefetched + * entry has appeared in is tracked in an 8 bit field. Thus, while + * H5AC__CACHE_IMAGE__ENTRY_AGEOUT__MAX can be increased from its + * current value, any value in excess of 255 will be the functional + * equivalent of H5AC__CACHE_IMAGE__ENTRY_AGEOUT__NONE. + * + * flags: Unsigned integer containing flags controling which aspects of the + * cache image functinality is actually executed. The primary impetus + * behind this field is to allow developement of tests for partial + * implementations that will require little if any modification to run + * with the full implementation. In normal operation, all flags should + * be set. + * + ****************************************************************************/ + +#define H5C_CI__GEN_MDCI_SBE_MESG ((unsigned)0x0001) +#define H5C_CI__GEN_MDC_IMAGE_BLK ((unsigned)0x0002) +#define H5C_CI__SUPRESS_ENTRY_WRITES ((unsigned)0x0004) +#define H5C_CI__WRITE_CACHE_IMAGE ((unsigned)0x0008) + +/* This #define must set all defined H5C_CI flags. It is + * used in the default value for instances of H5C_cache_image_ctl_t. + * This value will only be modified in test code. + */ +#define H5C_CI__ALL_FLAGS ((unsigned)0x000F) + +#define H5C__DEFAULT_CACHE_IMAGE_CTL \ +{ \ + /* version = */ H5C__CURR_CACHE_IMAGE_CTL_VER, \ + /* generate_image = */ FALSE, \ + /* save_resize_status = */ FALSE, \ + /* entry_ageout = */ H5AC__CACHE_IMAGE__ENTRY_AGEOUT__NONE, \ + /* flags = */ H5C_CI__ALL_FLAGS \ +} + +typedef struct H5C_cache_image_ctl_t { + int32_t version; + hbool_t generate_image; + hbool_t save_resize_status; + int32_t entry_ageout; + unsigned flags; +} H5C_cache_image_ctl_t; + /***************************************/ /* Library-private Function Prototypes */ /***************************************/ H5_DLL H5C_t *H5C_create(size_t max_cache_size, size_t min_clean_size, - int max_type_id, const char *(*type_name_table_ptr), + int max_type_id, const H5C_class_t * const *class_table_ptr, H5C_write_permitted_func_t check_write_permitted, hbool_t write_permitted, H5C_log_flush_func_t log_flush, void *aux_ptr); H5_DLL herr_t H5C_set_up_logging(H5C_t *cache_ptr, const char log_location[], hbool_t start_immediately); @@ -1770,9 +2217,11 @@ herr_t H5C_verify_tag(int id, haddr_t tag); H5_DLL herr_t H5C_flush_to_min_clean(H5F_t *f, hid_t dxpl_id); H5_DLL herr_t H5C_get_cache_auto_resize_config(const H5C_t *cache_ptr, H5C_auto_size_ctl_t *config_ptr); +H5_DLL herr_t H5C_get_cache_image_config(const H5C_t * cache_ptr, + H5C_cache_image_ctl_t *config_ptr); H5_DLL herr_t H5C_get_cache_size(H5C_t *cache_ptr, size_t *max_size_ptr, size_t *min_clean_size_ptr, size_t *cur_size_ptr, - int32_t *cur_num_entries_ptr); + uint32_t *cur_num_entries_ptr); H5_DLL herr_t H5C_get_cache_hit_rate(H5C_t *cache_ptr, double *hit_rate_ptr); H5_DLL herr_t H5C_get_entry_status(const H5F_t *f, haddr_t addr, size_t *size_ptr, hbool_t *in_cache_ptr, hbool_t *is_dirty_ptr, @@ -1783,8 +2232,11 @@ H5_DLL herr_t H5C_get_evictions_enabled(const H5C_t *cache_ptr, hbool_t *evictio H5_DLL void * H5C_get_aux_ptr(const H5C_t *cache_ptr); H5_DLL FILE *H5C_get_trace_file_ptr(const H5C_t *cache_ptr); H5_DLL FILE *H5C_get_trace_file_ptr_from_entry(const H5C_cache_entry_t *entry_ptr); +H5_DLL herr_t H5C_image_stats(H5C_t * cache_ptr, hbool_t print_header); H5_DLL herr_t H5C_insert_entry(H5F_t *f, hid_t dxpl_id, const H5C_class_t *type, haddr_t addr, void *thing, unsigned int flags); +H5_DLL herr_t H5C_load_cache_image_on_next_protect(H5F_t *f, haddr_t addr, + hsize_t len, hbool_t rw); H5_DLL herr_t H5C_mark_entry_dirty(void *thing); H5_DLL herr_t H5C_mark_entry_clean(void *thing); H5_DLL herr_t H5C_mark_entry_unserialized(void *thing); @@ -1799,6 +2251,8 @@ H5_DLL void * H5C_protect(H5F_t *f, hid_t dxpl_id, const H5C_class_t *type, H5_DLL herr_t H5C_reset_cache_hit_rate_stats(H5C_t *cache_ptr); H5_DLL herr_t H5C_resize_entry(void *thing, size_t new_size); H5_DLL herr_t H5C_set_cache_auto_resize_config(H5C_t *cache_ptr, H5C_auto_size_ctl_t *config_ptr); +H5_DLL herr_t H5C_set_cache_image_config(const H5F_t *f, H5C_t *cache_ptr, + H5C_cache_image_ctl_t *config_ptr); H5_DLL herr_t H5C_set_evictions_enabled(H5C_t *cache_ptr, hbool_t evictions_enabled); H5_DLL herr_t H5C_set_prefix(H5C_t *cache_ptr, char *prefix); H5_DLL herr_t H5C_set_trace_file_ptr(H5C_t *cache_ptr, FILE *trace_file_ptr); @@ -1810,6 +2264,7 @@ H5_DLL herr_t H5C_unpin_entry(void *thing); H5_DLL herr_t H5C_destroy_flush_dependency(void *parent_thing, void *child_thing); H5_DLL herr_t H5C_unprotect(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *thing, unsigned int flags); +H5_DLL herr_t H5C_validate_cache_image_config(H5C_cache_image_ctl_t * ctl_ptr); H5_DLL herr_t H5C_validate_resize_config(H5C_auto_size_ctl_t *config_ptr, unsigned int tests); H5_DLL herr_t H5C_ignore_tags(H5C_t *cache_ptr); @@ -1819,20 +2274,32 @@ H5_DLL herr_t H5C_cork(H5C_t *cache_ptr, haddr_t obj_addr, unsigned action, hboo H5_DLL herr_t H5C_get_entry_ring(const H5F_t *f, haddr_t addr, H5C_ring_t *ring); H5_DLL herr_t H5C_unsettle_entry_ring(void *thing); H5_DLL herr_t H5C_remove_entry(void *thing); +H5_DLL herr_t H5C_cache_image_status(H5F_t * f, hbool_t *load_ci_ptr, + hbool_t *write_ci_ptr); #ifdef H5_HAVE_PARALLEL H5_DLL herr_t H5C_apply_candidate_list(H5F_t *f, hid_t dxpl_id, - H5C_t *cache_ptr, int num_candidates, haddr_t *candidates_list_ptr, + H5C_t *cache_ptr, unsigned num_candidates, haddr_t *candidates_list_ptr, int mpi_rank, int mpi_size); H5_DLL herr_t H5C_construct_candidate_list__clean_cache(H5C_t *cache_ptr); H5_DLL herr_t H5C_construct_candidate_list__min_clean(H5C_t *cache_ptr); H5_DLL herr_t H5C_clear_coll_entries(H5C_t * cache_ptr, hbool_t partial); -H5_DLL herr_t H5C_mark_entries_as_clean(H5F_t *f, hid_t dxpl_id, int32_t ce_array_len, +H5_DLL herr_t H5C_mark_entries_as_clean(H5F_t *f, hid_t dxpl_id, unsigned ce_array_len, haddr_t *ce_array_ptr); #endif /* H5_HAVE_PARALLEL */ #ifndef NDEBUG /* debugging functions */ +H5_DLL hbool_t H5C_get_serialization_in_progress(const H5C_t *cache_ptr); H5_DLL hbool_t H5C_cache_is_clean(const H5C_t *cache_ptr, H5C_ring_t inner_ring); +H5_DLL herr_t H5C_dump_cache_skip_list(H5C_t *cache_ptr, char *calling_fcn); +H5_DLL herr_t H5C_get_entry_ptr_from_addr(H5C_t *cache_ptr, haddr_t addr, + void **entry_ptr_ptr); +H5_DLL herr_t H5C_flush_dependency_exists(H5C_t *cache_ptr, haddr_t parent_addr, + haddr_t child_addr, hbool_t *fd_exists_ptr); +H5_DLL herr_t H5C_verify_entry_type(H5C_t *cache_ptr, haddr_t addr, + const H5C_class_t *expected_type, hbool_t *in_cache_ptr, + hbool_t *type_ok_ptr); +H5_DLL herr_t H5C_validate_index_list(H5C_t *cache_ptr); #endif /* NDEBUG */ #endif /* !_H5Cprivate_H */ diff --git a/src/H5Cquery.c b/src/H5Cquery.c index f5409f7..33a322d 100644 --- a/src/H5Cquery.c +++ b/src/H5Cquery.c @@ -131,7 +131,7 @@ H5C_get_cache_size(H5C_t * cache_ptr, size_t * max_size_ptr, size_t * min_clean_size_ptr, size_t * cur_size_ptr, - int32_t * cur_num_entries_ptr) + uint32_t * cur_num_entries_ptr) { herr_t ret_value = SUCCEED; /* Return value */ @@ -444,7 +444,8 @@ H5C_get_entry_ring(const H5F_t *f, haddr_t addr, H5C_ring_t *ring) /* Locate the entry at the address */ H5C__SEARCH_INDEX(cache_ptr, addr, entry_ptr, FAIL) - HDassert(entry_ptr); + if(entry_ptr == NULL) + HGOTO_ERROR(H5E_CACHE, H5E_NOTFOUND, FAIL, "can't find entry in index") /* Return the ring value */ *ring = entry_ptr->ring; diff --git a/src/H5EApkg.h b/src/H5EApkg.h index 093403c..7540ff2 100644 --- a/src/H5EApkg.h +++ b/src/H5EApkg.h @@ -378,21 +378,6 @@ typedef struct H5EA__ctx_cb_t { /* Package Private Variables */ /*****************************/ -/* H5EA header inherits cache-like properties from H5AC */ -H5_DLLVAR const H5AC_class_t H5AC_EARRAY_HDR[1]; - -/* H5EA index block inherits cache-like properties from H5AC */ -H5_DLLVAR const H5AC_class_t H5AC_EARRAY_IBLOCK[1]; - -/* H5EA index block inherits cache-like properties from H5AC */ -H5_DLLVAR const H5AC_class_t H5AC_EARRAY_SBLOCK[1]; - -/* H5EA data block inherits cache-like properties from H5AC */ -H5_DLLVAR const H5AC_class_t H5AC_EARRAY_DBLOCK[1]; - -/* H5EA data block page inherits cache-like properties from H5AC */ -H5_DLLVAR const H5AC_class_t H5AC_EARRAY_DBLK_PAGE[1]; - /* Internal extensible array testing class */ H5_DLLVAR const H5EA_class_t H5EA_CLS_TEST[1]; diff --git a/src/H5F.c b/src/H5F.c index a43009b..5fd3a7d 100644 --- a/src/H5F.c +++ b/src/H5F.c @@ -445,6 +445,8 @@ done: hid_t H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id) { + hbool_t ci_load = FALSE; /* whether MDC ci load requested */ + hbool_t ci_write = FALSE; /* whether MDC CI write requested */ H5F_t *new_file = NULL; /*file struct for new file */ hid_t dxpl_id = H5AC_ind_read_dxpl_id; /*dxpl used by library */ hid_t ret_value; /*return value */ @@ -490,6 +492,12 @@ H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id) if(NULL == (new_file = H5F_open(filename, flags, fcpl_id, fapl_id, dxpl_id))) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "unable to create file") + /* Check to see if both SWMR and cache image are requested. Fail if so */ + if(H5C_cache_image_status(new_file, &ci_load, &ci_write) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get MDC cache image status") + if((ci_load || ci_write) && (flags & (H5F_ACC_SWMR_READ | H5F_ACC_SWMR_WRITE))) + HGOTO_ERROR(H5E_FILE, H5E_UNSUPPORTED, FAIL, "can't have both SWMR and cache image") + /* Get an atom for the file */ if((ret_value = H5I_register(H5I_FILE, new_file, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize file") @@ -498,9 +506,8 @@ H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id) new_file->file_id = ret_value; done: - if(ret_value < 0 && new_file) - if(H5F_close(new_file) < 0) - HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "problems closing file") + if(ret_value < 0 && new_file && H5F_try_close(new_file, NULL) < 0) + HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "problems closing file") FUNC_LEAVE_API(ret_value) } /* end H5Fcreate() */ @@ -549,6 +556,8 @@ done: hid_t H5Fopen(const char *filename, unsigned flags, hid_t fapl_id) { + hbool_t ci_load = FALSE; /* whether MDC ci load requested */ + hbool_t ci_write = FALSE; /* whether MDC CI write requested */ H5F_t *new_file = NULL; /*file struct for new file */ hid_t dxpl_id = H5AC_ind_read_dxpl_id; /*dxpl used by library */ hid_t ret_value; /*return value */ @@ -578,6 +587,12 @@ H5Fopen(const char *filename, unsigned flags, hid_t fapl_id) if(NULL == (new_file = H5F_open(filename, flags, H5P_FILE_CREATE_DEFAULT, fapl_id, dxpl_id))) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "unable to open file") + /* Check to see if both SWMR and cache image are requested. Fail if so */ + if(H5C_cache_image_status(new_file, &ci_load, &ci_write) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get MDC cache image status") + if((ci_load || ci_write) && (flags & (H5F_ACC_SWMR_READ | H5F_ACC_SWMR_WRITE))) + HGOTO_ERROR(H5E_FILE, H5E_UNSUPPORTED, FAIL, "can't have both SWMR and cache image") + /* Get an atom for the file */ if((ret_value = H5I_register(H5I_FILE, new_file, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize file handle") @@ -1177,7 +1192,7 @@ H5Fget_mdc_size(hid_t file_id, size_t *max_size_ptr, size_t *min_clean_size_ptr, size_t *cur_size_ptr, int *cur_num_entries_ptr) { H5F_t *file; /* File object for file ID */ - int32_t cur_num_entries; + uint32_t cur_num_entries; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1593,6 +1608,8 @@ done: herr_t H5Fstart_swmr_write(hid_t file_id) { + hbool_t ci_load = FALSE; /* whether MDC ci load requested */ + hbool_t ci_write = FALSE; /* whether MDC CI write requested */ H5F_t *file = NULL; /* File info */ size_t grp_dset_count=0; /* # of open objects: groups & datasets */ size_t nt_attr_count=0; /* # of opened named datatypes + opened attributes */ @@ -1626,6 +1643,12 @@ H5Fstart_swmr_write(hid_t file_id) HDassert(file->shared->sblock->status_flags & H5F_SUPER_WRITE_ACCESS); + /* Check to see if cache image is enabled. Fail if so */ + if(H5C_cache_image_status(file, &ci_load, &ci_write) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get MDC cache image status") + if(ci_load || ci_write ) + HGOTO_ERROR(H5E_FILE, H5E_UNSUPPORTED, FAIL, "can't have both SWMR and MDC cache image") + /* Flush data buffers */ if(H5F_flush(file, H5AC_ind_read_dxpl_id, FALSE) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush file's cached information") @@ -1868,7 +1891,48 @@ H5Fget_mdc_logging_status(hid_t file_id, hbool_t *is_enabled, done: FUNC_LEAVE_API(ret_value) -} /* H5Fstop_mdc_logging() */ +} /* H5Fget_mdc_logging_status() */ + + +/*------------------------------------------------------------------------- + * Function: H5Fset_latest_format + * + * Purpose: Enable switching the "latest format" flag while a file is open. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * Monday, September 21, 2015 + *------------------------------------------------------------------------- + */ +herr_t +H5Fset_latest_format(hid_t file_id, hbool_t latest_format) +{ + H5F_t *f; /* File */ + unsigned latest_flags; /* Latest format flags for file */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE2("e", "ib", file_id, latest_format); + + /* Check args */ + if(NULL == (f = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) + HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "not a file ID") + + /* Check if the value is changing */ + latest_flags = H5F_USE_LATEST_FLAGS(f, H5F_LATEST_ALL_FLAGS); + if(latest_format != (H5F_LATEST_ALL_FLAGS == latest_flags)) { + /* Call the flush routine, for this file */ + if(H5F_flush(f, H5AC_ind_read_dxpl_id, FALSE) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush file's cached information") + + /* Toggle the 'latest format' flag */ + H5F_SET_LATEST_FLAGS(f, latest_format ? H5F_LATEST_ALL_FLAGS : 0); + } /* end if */ + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Fset_latest_format() */ /*------------------------------------------------------------------------- diff --git a/src/H5FApkg.h b/src/H5FApkg.h index ccef562..63eacff 100644 --- a/src/H5FApkg.h +++ b/src/H5FApkg.h @@ -249,15 +249,6 @@ typedef struct H5FA_dblk_page_cache_ud_t { /* Package Private Variables */ /*****************************/ -/* H5FA header inherits cache-like properties from H5AC */ -H5_DLLVAR const H5AC_class_t H5AC_FARRAY_HDR[1]; - -/* H5FA data block inherits cache-like properties from H5AC */ -H5_DLLVAR const H5AC_class_t H5AC_FARRAY_DBLOCK[1]; - -/* H5FA data block page inherits cache-like properties from H5AC */ -H5_DLLVAR const H5AC_class_t H5AC_FARRAY_DBLK_PAGE[1]; - /* Internal fixed array testing class */ H5_DLLVAR const H5FA_class_t H5FA_CLS_TEST[1]; diff --git a/src/H5FDmulti.c b/src/H5FDmulti.c index befcaca..7e12869 100644 --- a/src/H5FDmulti.c +++ b/src/H5FDmulti.c @@ -1151,14 +1151,18 @@ H5FD_multi_cmp(const H5FD_t *_f1, const H5FD_t *_f2) ALL_MEMBERS(mt) { out_mt = mt; - if (f1->memb[mt] && f2->memb[mt]) break; - if (!cmp) { - if (f1->memb[mt]) cmp = -1; - else if (f2->memb[mt]) cmp = 1; + if(f1->memb[mt] && f2->memb[mt]) + break; + if(!cmp) { + if(f1->memb[mt]) + cmp = -1; + else if(f2->memb[mt]) + cmp = 1; } } END_MEMBERS; assert(cmp || out_mt=H5FD_MEM_NTYPES) return cmp; + if(out_mt>=H5FD_MEM_NTYPES) + return cmp; return H5FDcmp(f1->memb[out_mt], f2->memb[out_mt]); } diff --git a/src/H5FSpkg.h b/src/H5FSpkg.h index f07ffad..4411236 100644 --- a/src/H5FSpkg.h +++ b/src/H5FSpkg.h @@ -199,12 +199,6 @@ struct H5FS_t { /* Package Private Variables */ /*****************************/ -/* H5FS header inherits cache-like properties from H5AC */ -H5_DLLVAR const H5AC_class_t H5AC_FSPACE_HDR[1]; - -/* H5FS section info inherits cache-like properties from H5AC */ -H5_DLLVAR const H5AC_class_t H5AC_FSPACE_SINFO[1]; - /* Declare a free list to manage the H5FS_node_t struct */ H5FL_EXTERN(H5FS_node_t); diff --git a/src/H5Fint.c b/src/H5Fint.c index 8ad97a8..d122357 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -188,6 +188,8 @@ H5F_get_access_plist(H5F_t *f, hbool_t app_ref) if(H5P_set(new_plist, H5F_ACS_COLL_MD_WRITE_FLAG_NAME, &(f->coll_md_write)) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set collective metadata read flag") #endif /* H5_HAVE_PARALLEL */ + if(H5P_set(new_plist, H5F_ACS_META_CACHE_INIT_IMAGE_CONFIG_NAME, &(f->shared->mdc_initCacheImageCfg)) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set initial metadata cache resize config.") /* Prepare the driver property */ driver_prop.driver_id = f->shared->lf->driver_id; @@ -667,6 +669,8 @@ H5F_new(H5F_file_t *shared, unsigned flags, hid_t fcpl_id, hid_t fapl_id, H5FD_t if(H5P_get(plist, H5F_ACS_COLL_MD_WRITE_FLAG_NAME, &(f->coll_md_write)) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get collective metadata write flag") #endif /* H5_HAVE_PARALLEL */ + if(H5P_get(plist, H5F_ACS_META_CACHE_INIT_IMAGE_CONFIG_NAME, &(f->shared->mdc_initCacheImageCfg)) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get initial metadata cache resize config") /* Get the VFD values to cache */ f->shared->maxaddr = H5FD_get_maxaddr(lf); @@ -750,7 +754,7 @@ H5F_new(H5F_file_t *shared, unsigned flags, hid_t fcpl_id, hid_t fapl_id, H5FD_t * The cache might be created with a different number of elements and * the access property list should be updated to reflect that. */ - if(H5AC_create(f, &(f->shared->mdc_initCacheCfg)) < 0) + if(H5AC_create(f, &(f->shared->mdc_initCacheCfg), &(f->shared->mdc_initCacheImageCfg)) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "unable to create metadata cache") /* Create the file's "open object" information */ @@ -829,7 +833,7 @@ H5F_dest(H5F_t *f, hid_t dxpl_id, hbool_t flush) if((H5F_ACC_RDWR & H5F_INTENT(f)) && flush) if(H5F__flush_phase1(f, dxpl_id) < 0) /* Push error, but keep going*/ - HDONE_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush cache") + HDONE_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush cached data (phase 1)") /* Notify the metadata cache that the file is about to be closed. * This allows the cache to set up for creating a metadata cache @@ -845,8 +849,8 @@ H5F_dest(H5F_t *f, hid_t dxpl_id, hbool_t flush) */ if((H5F_ACC_RDWR & H5F_INTENT(f)) && flush) if(H5F__flush_phase2(f, dxpl_id, TRUE) < 0) - /* Push error, but keep going*/ - HDONE_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush cache") + /* Push error, but keep going */ + HDONE_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush cached data (phase 2)") /* With the shutdown modifications, the contents of the metadata cache * should be clean at this point, with the possible exception of the @@ -865,7 +869,7 @@ H5F_dest(H5F_t *f, hid_t dxpl_id, hbool_t flush) } /* end if */ /* With the shutdown modifications, the contents of the metadata cache - * should be clean at this point, with the possible exception of the + * should be clean at this point, with the possible exception of the * the superblock and superblock extension. * * Verify this. @@ -888,18 +892,21 @@ H5F_dest(H5F_t *f, hid_t dxpl_id, hbool_t flush) * (assuming they are persistent). In this case, closing the * free space managers should have no effect on EOA. * - * -- JRM + * -- JRM */ if(H5F_ACC_RDWR & H5F_INTENT(f)) { if(H5MF_close(f, dxpl_id) < 0) /* Push error, but keep going*/ HDONE_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "can't release file free space info") - /* at this point, only the superblock and superblock + /* at this point, only the superblock and superblock * extension should be dirty. */ HDassert(H5AC_cache_is_clean(f, H5AC_RING_MDFSM)); + /* Flush the file again (if requested), as shutting down the + * free space manager may dirty some data structures again. + */ if(flush) { /* Clear status_flags */ f->shared->sblock->status_flags &= (uint8_t)(~H5F_SUPER_WRITE_ACCESS); @@ -914,7 +921,7 @@ H5F_dest(H5F_t *f, hid_t dxpl_id, hbool_t flush) * so that the eoa value corresponds to the end of the * space written to in the file. * - * At most, this should change the superblock or the + * At most, this should change the superblock or the * superblock extension messages. */ if(H5MF_free_aggrs(f, dxpl_id) < 0) @@ -926,7 +933,7 @@ H5F_dest(H5F_t *f, hid_t dxpl_id, hbool_t flush) /* Push error, but keep going*/ HDONE_ERROR(H5E_FILE, H5E_WRITEERROR, FAIL, "low level truncate failed") - /* at this point, only the superblock and superblock + /* at this point, only the superblock and superblock * extension should be dirty. */ HDassert(H5AC_cache_is_clean(f, H5AC_RING_MDFSM)); @@ -948,7 +955,7 @@ H5F_dest(H5F_t *f, hid_t dxpl_id, hbool_t flush) f->shared->sblock = NULL; } /* end if */ - /* with the possible exception of the superblock and superblock + /* with the possible exception of the superblock and superblock * extension, the metadata cache should be clean at this point. * * Verify this. @@ -1278,6 +1285,10 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, shared = file->shared; lf = shared->lf; + /* Get the file access property list, for future queries */ + if(NULL == (a_plist = (H5P_genplist_t *)H5I_object(fapl_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not file access property list") + /* * Read or write the file superblock, depending on whether the file is * empty or not. @@ -1311,10 +1322,6 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to read root group") } /* end if */ - /* Get the file access property list, for future queries */ - if(NULL == (a_plist = (H5P_genplist_t *)H5I_object(fapl_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not file access property list") - /* * Decide the file close degree. If it's the first time to open the * file, set the degree to access property list value; if it's the @@ -1522,7 +1529,7 @@ H5F__flush_phase2(H5F_t *f, hid_t dxpl_id, hbool_t closing) /* Flush file buffers to disk. */ if(H5FD_flush(f->shared->lf, dxpl_id, closing) < 0) /* Push error, but keep going*/ - HDONE_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "low level flush failed") + HDONE_ERROR(H5E_IO, H5E_CANTFLUSH, FAIL, "low level flush failed") FUNC_LEAVE_NOAPI(ret_value) } /* end H5F__flush_phase2() */ @@ -2671,3 +2678,33 @@ H5F_set_coll_md_read(H5F_t *f, H5P_coll_md_read_flag_t cmr) } /* H5F_set_coll_md_read() */ #endif /* H5_HAVE_PARALLEL */ + +/*------------------------------------------------------------------------- + * Function: H5F_set_latest_flags + * + * Purpose: Set the latest_flags field with a new value. + * + * Return: Success: SUCCEED + * Failure: FAIL + * + * Programmer: Quincey Koziol + * 4/26/16 + * + *------------------------------------------------------------------------- + */ +herr_t +H5F_set_latest_flags(H5F_t *f, unsigned flags) +{ + /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ + FUNC_ENTER_NOAPI_NOINIT_NOERR + + /* Sanity check */ + HDassert(f); + HDassert(f->shared); + HDassert(0 == ((~flags) & H5F_LATEST_ALL_FLAGS)); + + f->shared->latest_flags = flags; + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* H5F_set_latest_flags() */ + diff --git a/src/H5Fio.c b/src/H5Fio.c index e215666..afe1278 100644 --- a/src/H5Fio.c +++ b/src/H5Fio.c @@ -302,7 +302,7 @@ H5F__evict_cache_entries(H5F_t *f, hid_t dxpl_id) #ifndef NDEBUG { unsigned status = 0; - int32_t cur_num_entries; + uint32_t cur_num_entries; /* Retrieve status of the superblock */ if(H5AC_get_entry_status(f, (haddr_t)0, &status) < 0) diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h index 11665f4..93a3978 100644 --- a/src/H5Fpkg.h +++ b/src/H5Fpkg.h @@ -287,6 +287,12 @@ struct H5F_file_t { /* metadata cache. This structure is */ /* fixed at creation time and should */ /* not change thereafter. */ + H5AC_cache_image_config_t + mdc_initCacheImageCfg; /* initial configuration for the */ + /* generate metadata cache image on */ + /* close option. This structure is */ + /* fixed at creation time and should */ + /* not change thereafter. */ hbool_t use_mdc_logging; /* Set when metadata logging is desired */ hbool_t start_mdc_log_on_access; /* set when mdc logging should */ /* begin on file access/create */ @@ -369,9 +375,6 @@ H5FL_EXTERN(H5F_t); /* Declare a free list to manage the H5F_file_t struct */ H5FL_EXTERN(H5F_file_t); -H5_DLLVAR const H5AC_class_t H5AC_SUPERBLOCK[1]; -H5_DLLVAR const H5AC_class_t H5AC_DRVRINFO[1]; - /******************************/ /* Package Private Prototypes */ @@ -400,7 +403,8 @@ H5_DLL herr_t H5F__super_free(H5F_super_t *sblock); /* Superblock extension related routines */ H5_DLL herr_t H5F_super_ext_open(H5F_t *f, haddr_t ext_addr, H5O_loc_t *ext_ptr); -H5_DLL herr_t H5F_super_ext_write_msg(H5F_t *f, hid_t dxpl_id, unsigned id, void *mesg, hbool_t may_create); +H5_DLL herr_t H5F_super_ext_write_msg(H5F_t *f, hid_t dxpl_id, unsigned id, + void *mesg, hbool_t may_create, unsigned mesg_flags); H5_DLL herr_t H5F_super_ext_remove_msg(H5F_t *f, hid_t dxpl_id, unsigned id); H5_DLL herr_t H5F_super_ext_close(H5F_t *f, H5O_loc_t *ext_ptr, hid_t dxpl_id, hbool_t was_created); diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index bcc56c6..7d288fa 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -317,6 +317,7 @@ #define H5F_SET_GRP_BTREE_SHARED(F, RC) (((F)->shared->grp_btree_shared = (RC)) ? SUCCEED : FAIL) #define H5F_USE_TMP_SPACE(F) ((F)->shared->use_tmp_space) #define H5F_IS_TMP_ADDR(F, ADDR) (H5F_addr_le((F)->shared->tmp_addr, (ADDR))) +#define H5F_SET_LATEST_FLAGS(F, FL) ((F)->shared->latest_flags = (FL)) #ifdef H5_HAVE_PARALLEL #define H5F_COLL_MD_READ(F) ((F)->coll_md_read) #endif /* H5_HAVE_PARALLEL */ @@ -367,6 +368,7 @@ #define H5F_SET_GRP_BTREE_SHARED(F, RC) (H5F_set_grp_btree_shared((F), (RC))) #define H5F_USE_TMP_SPACE(F) (H5F_use_tmp_space(F)) #define H5F_IS_TMP_ADDR(F, ADDR) (H5F_is_tmp_addr((F), (ADDR))) +#define H5F_SET_LATEST_FLAGS(F, FL) (H5F_set_latest_flags((F), (FL))) #ifdef H5_HAVE_PARALLEL #define H5F_COLL_MD_READ(F) (H5F_coll_md_read(F)) #endif /* H5_HAVE_PARALLEL */ @@ -481,6 +483,7 @@ #define H5F_ACS_EVICT_ON_CLOSE_FLAG_NAME "evict_on_close_flag" /* Whether or not the metadata cache will evict objects on close */ #define H5F_ACS_CORE_WRITE_TRACKING_PAGE_SIZE_NAME "core_write_tracking_page_size" /* The page size in kiB when core VFD write tracking is enabled */ #define H5F_ACS_COLL_MD_WRITE_FLAG_NAME "collective_metadata_write" /* property indicating whether metadata writes are done collectively or not */ +#define H5F_ACS_META_CACHE_INIT_IMAGE_CONFIG_NAME "mdc_initCacheImageCfg" /* Initial metadata cache image creation configuration */ /* ======================== File Mount properties ====================*/ #define H5F_MNT_SYM_LOCAL_NAME "local" /* Whether absolute symlinks local to file. */ @@ -700,6 +703,7 @@ H5_DLL struct H5UC_t *H5F_grp_btree_shared(const H5F_t *f); H5_DLL herr_t H5F_set_grp_btree_shared(H5F_t *f, struct H5UC_t *rc); H5_DLL hbool_t H5F_use_tmp_space(const H5F_t *f); H5_DLL hbool_t H5F_is_tmp_addr(const H5F_t *f, haddr_t addr); +H5_DLL herr_t H5F_set_latest_flags(H5F_t *f, unsigned flags); #ifdef H5_HAVE_PARALLEL H5_DLL H5P_coll_md_read_flag_t H5F_coll_md_read(const H5F_t *f); H5_DLL void H5F_set_coll_md_read(H5F_t *f, H5P_coll_md_read_flag_t flag); diff --git a/src/H5Fpublic.h b/src/H5Fpublic.h index a79da75..c57a821 100644 --- a/src/H5Fpublic.h +++ b/src/H5Fpublic.h @@ -246,6 +246,7 @@ H5_DLL herr_t H5Fstart_swmr_write(hid_t file_id); H5_DLL ssize_t H5Fget_free_sections(hid_t file_id, H5F_mem_t type, size_t nsects, H5F_sect_info_t *sect_info/*out*/); H5_DLL herr_t H5Fclear_elink_file_cache(hid_t file_id); +H5_DLL herr_t H5Fset_latest_format(hid_t file_id, hbool_t latest_format); H5_DLL herr_t H5Fstart_mdc_logging(hid_t file_id); H5_DLL herr_t H5Fstop_mdc_logging(hid_t file_id); H5_DLL herr_t H5Fget_mdc_logging_status(hid_t file_id, diff --git a/src/H5Fsuper.c b/src/H5Fsuper.c index 893ce26..3b86dae 100644 --- a/src/H5Fsuper.c +++ b/src/H5Fsuper.c @@ -240,7 +240,7 @@ done: * *------------------------------------------------------------------------- */ -herr_t +static herr_t H5F__update_super_ext_driver_msg(H5F_t *f, hid_t dxpl_id) { H5F_super_t *sblock; /* Pointer to the super block */ @@ -290,7 +290,7 @@ H5F__update_super_ext_driver_msg(H5F_t *f, hid_t dxpl_id) */ drvinfo.len = driver_size; drvinfo.buf = dbuf; - if(H5F_super_ext_write_msg(f, dxpl_id, H5O_DRVINFO_ID, &drvinfo, FALSE) < 0) + if(H5F_super_ext_write_msg(f, dxpl_id, H5O_DRVINFO_ID, &drvinfo, FALSE, H5O_MSG_NO_FLAGS_SET) < 0) HGOTO_ERROR(H5E_FILE, H5E_WRITEERROR, FAIL, "unable to update driver info header message") } /* end if driver_size > 0 */ } /* end if !H5F_HAS_FEATURE(f, H5FD_FEAT_IGNORE_DRVRINFO) */ @@ -692,6 +692,34 @@ H5F__super_read(H5F_t *f, hid_t dxpl_id, hbool_t initial_read) f->shared->fs_addr[u] = fsinfo.fs_addr[u-1]; } /* end if */ + /* Check for the extension having a 'metadata cache image' message */ + if((status = H5O_msg_exists(&ext_loc, H5O_MDCI_MSG_ID, dxpl_id)) < 0) + HGOTO_ERROR(H5E_FILE, H5E_EXISTS, FAIL, "unable to read object header") + if(status) { + hbool_t rw = ((rw_flags & H5AC__READ_ONLY_FLAG) == 0); + H5O_mdci_t mdci_msg; + + /* if the metadata cache image superblock extension message exists, + * read its contents and pass the data on to the metadata cache. + * Given this data, the cache will load and decode the metadata + * cache image block, decoded it and load its contents into the + * the cache on the test protect call. + * + * Further, if the file is opened R/W, the metadata cache will + * delete the metadata cache image superblock extension and free + * the cache image block. Don't do this now as f->shared + * is not fully setup, which complicates matters. + */ + + /* Retrieve the 'metadata cache image message' structure */ + if(NULL == H5O_msg_read(&ext_loc, H5O_MDCI_MSG_ID, &mdci_msg, dxpl_id)) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get metadata cache image message") + + /* Indicate to the cache that there's an image to load on first protect call */ + if(H5AC_load_cache_image_on_next_protect(f, mdci_msg.addr, mdci_msg.size, rw) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTLOAD, FAIL, "call to H5AC_load_cache_image_on_next_protect failed"); + } /* end if */ + /* Close superblock extension */ if(H5F_super_ext_close(f, &ext_loc, dxpl_id, FALSE) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEOBJ, FAIL, "unable to close file's superblock extension") @@ -737,7 +765,7 @@ H5F__super_read(H5F_t *f, hid_t dxpl_id, hbool_t initial_read) HDassert(f->shared->sblock == NULL); f->shared->sblock = sblock; #endif /* JRM */ - if(H5F_super_ext_write_msg(f, dxpl_id, H5O_DRVINFO_ID, &drvinfo, FALSE) < 0) + if(H5F_super_ext_write_msg(f, dxpl_id, H5O_DRVINFO_ID, &drvinfo, FALSE, H5O_MSG_NO_FLAGS_SET) < 0) HGOTO_ERROR(H5E_FILE, H5E_WRITEERROR, FAIL, "error in writing message to superblock extension") #if 1 /* bug fix test code -- tidy this up if all goes well */ /* JRM */ @@ -833,6 +861,7 @@ H5F__super_init(H5F_t *f, hid_t dxpl_id) H5O_loc_t ext_loc; /* Superblock extension object location */ hbool_t need_ext; /* Whether the superblock extension is needed */ hbool_t ext_created = FALSE; /* Whether the extension has been created */ + hbool_t non_default_fs_settings = FALSE; /* Whether the file has non-default free-space settings */ herr_t ret_value = SUCCEED; /* Return Value */ FUNC_ENTER_PACKAGE_TAG(dxpl_id, H5AC__SUPERBLOCK_TAG, FAIL) @@ -859,6 +888,11 @@ H5F__super_init(H5F_t *f, hid_t dxpl_id) if(H5P_get(plist, H5F_CRT_BTREE_RANK_NAME, &sblock->btree_k[0]) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get rank for btree internal nodes") + /* Check for non-default free-space settings */ + if(!(f->shared->fs_strategy == H5F_FILE_SPACE_STRATEGY_DEF && + f->shared->fs_threshold == H5F_FREE_SPACE_THRESHOLD_DEF)) + non_default_fs_settings = TRUE; + /* Bump superblock version if latest superblock version support is enabled */ if(H5F_USE_LATEST_FLAGS(f, H5F_LATEST_SUPERBLOCK)) super_vers = HDF5_SUPERBLOCK_VERSION_LATEST; @@ -868,8 +902,7 @@ H5F__super_init(H5F_t *f, hid_t dxpl_id) /* Bump superblock version to create superblock extension for * non-default file space strategy or non-default free-space threshold */ - else if(f->shared->fs_strategy != H5F_FILE_SPACE_STRATEGY_DEF || - f->shared->fs_threshold != H5F_FREE_SPACE_THRESHOLD_DEF) + else if(non_default_fs_settings) super_vers = HDF5_SUPERBLOCK_VERSION_2; /* Check for non-default indexed storage B-tree internal 'K' value * and set the version # of the superblock to 1 if it is a non-default @@ -986,8 +1019,7 @@ H5F__super_init(H5F_t *f, hid_t dxpl_id) need_ext = TRUE; } /* end if */ /* Files with non-default free space settings always need the superblock extension */ - else if(f->shared->fs_strategy != H5F_FILE_SPACE_STRATEGY_DEF || - f->shared->fs_threshold != H5F_FREE_SPACE_THRESHOLD_DEF) { + else if(non_default_fs_settings) { HDassert(super_vers >= HDF5_SUPERBLOCK_VERSION_2); need_ext = TRUE; } /* end if */ @@ -1075,9 +1107,8 @@ H5F__super_init(H5F_t *f, hid_t dxpl_id) f->shared->drvinfo_sb_msg_exists = TRUE; } /* end if */ - /* Check for non-default free space settings */ - if(f->shared->fs_strategy != H5F_FILE_SPACE_STRATEGY_DEF || - f->shared->fs_threshold != H5F_FREE_SPACE_THRESHOLD_DEF) { + /* Check for non-default free-space info settings */ + if(non_default_fs_settings) { H5FD_mem_t type; /* Memory type for iteration */ H5O_fsinfo_t fsinfo; /* Free space manager info message */ @@ -1365,7 +1396,8 @@ done: *------------------------------------------------------------------------- */ herr_t -H5F_super_ext_write_msg(H5F_t *f, hid_t dxpl_id, unsigned id, void *mesg, hbool_t may_create) +H5F_super_ext_write_msg(H5F_t *f, hid_t dxpl_id, unsigned id, void *mesg, + hbool_t may_create, unsigned mesg_flags) { H5P_genplist_t *dxpl = NULL; /* DXPL for setting ring */ H5AC_ring_t orig_ring = H5AC_RING_INV; /* Original ring value */ @@ -1410,7 +1442,7 @@ H5F_super_ext_write_msg(H5F_t *f, hid_t dxpl_id, unsigned id, void *mesg, hbool_ HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "Message should not exist") /* Create the message with ID in the superblock extension */ - if(H5O_msg_create(&ext_loc, id, H5O_MSG_FLAG_DONTSHARE, H5O_UPDATE_TIME, mesg, dxpl_id) < 0) + if(H5O_msg_create(&ext_loc, id, (mesg_flags | H5O_MSG_FLAG_DONTSHARE), H5O_UPDATE_TIME, mesg, dxpl_id) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to create the message in object header") } /* end if */ else { @@ -1418,7 +1450,7 @@ H5F_super_ext_write_msg(H5F_t *f, hid_t dxpl_id, unsigned id, void *mesg, hbool_ HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "Message should exist") /* Update the message with ID in the superblock extension */ - if(H5O_msg_write(&ext_loc, id, H5O_MSG_FLAG_DONTSHARE, H5O_UPDATE_TIME, mesg, dxpl_id) < 0) + if(H5O_msg_write(&ext_loc, id, (mesg_flags | H5O_MSG_FLAG_DONTSHARE), H5O_UPDATE_TIME, mesg, dxpl_id) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to write the message in object header") } /* end else */ diff --git a/src/H5Gpkg.h b/src/H5Gpkg.h index c994da3..1e8ad31 100644 --- a/src/H5Gpkg.h +++ b/src/H5Gpkg.h @@ -312,9 +312,6 @@ typedef struct H5G_copy_file_ud_t { */ H5_DLLVAR H5B_class_t H5B_SNODE[1]; -/* The cache subclass */ -H5_DLLVAR const H5AC_class_t H5AC_SNODE[1]; - /* The v2 B-tree class for indexing 'name' field on links */ H5_DLLVAR const H5B2_class_t H5G_BT2_NAME[1]; diff --git a/src/H5HFcache.c b/src/H5HFcache.c index 302fe04..ffdac9a 100644 --- a/src/H5HFcache.c +++ b/src/H5HFcache.c @@ -116,14 +116,17 @@ static herr_t H5HF__cache_dblock_free_icr(void *thing); /* Debugging Function Prototypes */ #ifndef NDEBUG -static herr_t H5HF__cache_verify_hdr_descendants_clean(H5F_t *f, H5HF_hdr_t *hdr, - hbool_t *clean); -static herr_t H5HF__cache_verify_iblock_descendants_clean(H5F_t *f, - H5HF_indirect_t *iblock, unsigned *iblock_status, hbool_t *clean); -static herr_t H5HF__cache_verify_iblocks_dblocks_clean(H5F_t *f, - H5HF_indirect_t *iblock, hbool_t *clean, hbool_t *has_dblocks); -static herr_t H5HF__cache_verify_descendant_iblocks_clean(H5F_t *f, - H5HF_indirect_t *iblock, hbool_t *clean, hbool_t *has_iblocks); +static herr_t H5HF__cache_verify_hdr_descendants_clean(H5F_t *f, hid_t dxpl_id, + H5HF_hdr_t *hdr, hbool_t *fd_clean, hbool_t *clean); +static herr_t H5HF__cache_verify_iblock_descendants_clean(H5F_t *f, + hid_t dxpl_id, haddr_t fd_parent_addr, H5HF_indirect_t *iblock, + unsigned *iblock_status, hbool_t *fd_clean, hbool_t *clean); +static herr_t H5HF__cache_verify_iblocks_dblocks_clean(H5F_t *f, + haddr_t fd_parent_addr, H5HF_indirect_t *iblock, hbool_t *fd_clean, + hbool_t *clean, hbool_t *has_dblocks); +static herr_t H5HF__cache_verify_descendant_iblocks_clean(H5F_t *f, + hid_t dxpl_id, haddr_t fd_parent_addr, H5HF_indirect_t *iblock, + hbool_t *fd_clean, hbool_t *clean, hbool_t *has_iblocks); #endif /* NDEBUG */ @@ -687,6 +690,7 @@ H5HF__cache_hdr_pre_serialize(H5F_t *f, hid_t H5_ATTR_UNUSED dxpl_id, #ifndef NDEBUG { hbool_t descendants_clean = TRUE; + hbool_t fd_children_clean = TRUE; /* Verify that flush dependencies are working correctly. Do this * by verifying that either: @@ -701,10 +705,22 @@ H5HF__cache_hdr_pre_serialize(H5F_t *f, hid_t H5_ATTR_UNUSED dxpl_id, * constraint is met by default. * * Do this with a call to H5HF__cache_verify_hdr_descendants_clean(). + * + * Note that decendants need not be clean if the pre_serialize call + * is made during a cache serialization instead of an entry or cache + * flush. + * + * Note also that with the recent change in the definition of flush + * dependency, not all decendants need be clean -- only direct flush + * dependency children. + * + * Finally, observe that the H5HF__cache_verify_hdr_descendants_clean() + * call still looks for dirty descendants. At present we do not check + * this value. */ - if(H5HF__cache_verify_hdr_descendants_clean((H5F_t *)f, hdr, &descendants_clean) < 0) + if(H5HF__cache_verify_hdr_descendants_clean((H5F_t *)f, dxpl_id, hdr, &fd_children_clean, &descendants_clean) < 0) HGOTO_ERROR(H5E_HEAP, H5E_SYSTEM, FAIL, "can't verify hdr descendants clean.") - HDassert(descendants_clean); + HDassert(fd_children_clean); } #endif /* NDEBUG */ @@ -1176,8 +1192,9 @@ H5HF__cache_iblock_image_len(const void *_thing, size_t *image_len) * and if so, to move it to real file space before the entry is * serialized. * - * In debug compiles, this function also verifies that all children - * of this indirect block are either clean or are not in cache. + * In debug compiles, this function also verifies that all + * immediate flush dependency children of this indirect block + * are either clean or are not in cache. * * Return: Success: SUCCEED * Failure: FAIL @@ -1217,10 +1234,12 @@ H5HF__cache_iblock_pre_serialize(H5F_t *f, hid_t dxpl_id, void *_thing, #ifndef NDEBUG { hbool_t descendants_clean = TRUE; + hbool_t fd_children_clean = TRUE; unsigned iblock_status = 0; /* verify that flush dependencies are working correctly. Do this - * by verifying that all children of this iblock are clean. + * by verifying that all immediate flush dependency children of this + * iblock are clean. */ if(H5AC_get_entry_status(f, iblock->addr, &iblock_status) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't get iblock status") @@ -1230,9 +1249,9 @@ H5HF__cache_iblock_pre_serialize(H5F_t *f, hid_t dxpl_id, void *_thing, * there is no need to check to see if it is pinned or protected, or to * protect it if it is not. */ - if(H5HF__cache_verify_iblock_descendants_clean((H5F_t *)f, iblock, &iblock_status, &descendants_clean) < 0) + if(H5HF__cache_verify_iblock_descendants_clean((H5F_t *)f, dxpl_id, iblock->addr, iblock, &iblock_status, &fd_children_clean, &descendants_clean) < 0) HGOTO_ERROR(H5E_HEAP, H5E_SYSTEM, FAIL, "can't verify descendants clean.") - HDassert(descendants_clean); + HDassert(fd_children_clean); } #endif /* NDEBUG */ @@ -2585,6 +2604,54 @@ done: * instance of H5HF_hdr_t are clean. Set *clean to * TRUE if this is the case, and to FALSE otherwise. * + * Update -- 8/24/15 + * + * With the advent of the metadata cache image feature, it is + * possible for the pre-serialize and serialize calls to be + * invoked outside of a flush. While this serialization + * observes flush dependencies for the order of serialization, + * the entries are not written to disk, and hence dirty entries + * remain dirty. + * + * To address this, updated the sanity checks in this function + * to treat entries whose images are up to date as clean if + * a cache serialization is in progress. + * + * Update -- 9/29/16 + * + * The implementation of flush dependencies has been changed. + * Prior to this change, a flush dependency parent could be + * flushed if and only if all its flush dependency decendants + * were clean. In the new definition, a flush dependency + * parent can be flushed if all its immediate flush dependency + * children are clean, regardless of any other dirty + * decendants. + * + * Further, metadata cache entries are now allowed to have + * multiple flush dependency parents. + * + * This means that the fractal heap is no longer ncessarily + * flushed from the bottom up. + * + * For example, it is now possible for a dirty fractal heap + * header to be flushed before a dirty dblock, as long as the + * there in an interviening iblock, and the header has no + * dirty immediate flush dependency children. + * + * Also, I gather that under some circumstances, a dblock + * will be direct a flush dependency child both of the iblock + * that points to it, and of the fractal heap header. + * + * As a result of these changes, the functionality of these + * sanity checking routines has been modified significantly. + * Instead of scanning the fractal heap from a starting point + * down, and verifying that there were no dirty entries, the + * functions now scan downward from the starting point and + * verify that there are no dirty flush dependency children + * of the specified flush dependency parent. In passing, + * they also walk the data structure, and verify it. + * + * * Return: Non-negative on success/Negative on failure * * Programmer: John Mainzer @@ -2594,9 +2661,10 @@ done: */ #ifndef NDEBUG static herr_t -H5HF__cache_verify_hdr_descendants_clean(H5F_t *f, H5HF_hdr_t *hdr, - hbool_t *clean) +H5HF__cache_verify_hdr_descendants_clean(H5F_t *f, hid_t dxpl_id, + H5HF_hdr_t *hdr, hbool_t *fd_clean, hbool_t *clean) { + hbool_t fd_exists = FALSE; /* whether flush dependency exists. */ haddr_t hdr_addr; /* Address of header */ unsigned hdr_status = 0; /* Header cache entry status */ herr_t ret_value = SUCCEED; /* Return value */ @@ -2608,6 +2676,7 @@ H5HF__cache_verify_hdr_descendants_clean(H5F_t *f, H5HF_hdr_t *hdr, HDassert(hdr); HDassert(hdr->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); HDassert(hdr->cache_info.type == H5AC_FHEAP_HDR); + HDassert(fd_clean); HDassert(clean); hdr_addr = hdr->cache_info.addr; HDassert(hdr_addr == hdr->heap_addr); @@ -2672,15 +2741,165 @@ H5HF__cache_verify_hdr_descendants_clean(H5F_t *f, H5HF_hdr_t *hdr, root_iblock_in_cache = ( (root_iblock_status & H5AC_ES__IN_CACHE) != 0); HDassert(root_iblock_in_cache || (root_iblock == NULL)); - if(!root_iblock_in_cache) /* we are done */ - *clean = TRUE; - else if(root_iblock_status & H5AC_ES__IS_DIRTY) - *clean = FALSE; + if(!root_iblock_in_cache) { /* we are done */ + *clean = TRUE; + *fd_clean = TRUE; + } /* end if */ + else if((root_iblock_status & H5AC_ES__IS_DIRTY) && + (((root_iblock_status & H5AC_ES__IMAGE_IS_UP_TO_DATE) == 0) || + (!H5AC_get_serialization_in_progress(f)))) { + *clean = FALSE; + + /* verify that a flush dependency exists between the header and + * the root inode. + */ + if(H5AC_flush_dependency_exists(f, hdr->heap_addr, root_iblock_addr, &fd_exists) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't check flush dependency") + HDassert(fd_exists); + + *fd_clean = FALSE; + } /* end else-if */ + else { /* must examine children */ + hbool_t unprotect_root_iblock = FALSE; + + /* At this point, the root iblock may be pinned, protected, + * both, or neither, and we may or may not have a pointer + * to root iblock in memory. + * + * Before we call H5HF__cache_verify_iblock_descendants_clean(), + * we must ensure that the root iblock is either pinned or + * protected or both, and that we have a pointer to it. + * Do this as follows: + */ + if(root_iblock == NULL) { /* we don't have ptr to root iblock */ + if(0 == (root_iblock_status & H5AC_ES__IS_PROTECTED)) { + /* just protect the root iblock -- this will give us + * the pointer we need to proceed, and ensure that + * it is locked into the metadata cache for the + * duration. + * + * Note that the udata is only used in the load callback. + * While the fractal heap makes heavy use of the udata + * in this case, since we know that the entry is in cache, + * we can pass NULL udata. + * + * The tag specified in the dxpl we received + * as a parameter (via dxpl_id) may not be correct. + * Grab the (hopefully) correct tag from the header, + * and load it into the dxpl via the H5_BEGIN_TAG and + * H5_END_TAG macros. Note that any error bracked by + * these macros must be reported with HGOTO_ERROR_TAG. + */ + H5_BEGIN_TAG(dxpl_id, hdr->heap_addr, FAIL) + + if(NULL == (root_iblock = (H5HF_indirect_t *)H5AC_protect(f, dxpl_id, H5AC_FHEAP_IBLOCK, root_iblock_addr, NULL, H5AC__READ_ONLY_FLAG))) + HGOTO_ERROR_TAG(H5E_HEAP, H5E_CANTPROTECT, FAIL, "H5AC_protect() faild.") + + H5_END_TAG(FAIL) + + unprotect_root_iblock = TRUE; + } /* end if */ + else { + /* the root iblock is protected, and we have no + * legitimate way of getting a pointer to it. + * + * We square this circle by using the + * H5AC_get_entry_ptr_from_addr() to get the needed + * pointer. + * + * WARNING: This call should be used only in debugging + * routines, and it should be avoided there when + * possible. + * + * Further, if we ever multi-thread the cache, + * this routine will have to be either discarded + * or heavily re-worked. + * + * Finally, keep in mind that the entry whose + * pointer is obtained in this fashion may not + * be in a stable state. + * + * Assuming that the flush dependency code is working + * as it should, the only reason for the root iblock to + * be unpinned is if none of its children are in cache. + * This unfortunately means that if it is protected and + * not pinned, the fractal heap is in the process of loading + * or inserting one of its children. The obvious + * implication is that there is a significant chance that + * the root iblock is in an unstable state. + * + * All this suggests that using + * H5AC_get_entry_ptr_from_addr() to obtain the pointer + * to the protected root iblock is questionable here. + * However, since this is test/debugging code, I expect + * that we will use this approach until it causes problems, + * or we think of a better way. + */ + if(H5AC_get_entry_ptr_from_addr(f, root_iblock_addr, (void **)(&root_iblock)) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "H5AC_get_entry_ptr_from_addr() failed.") + HDassert(root_iblock); + } /* end else */ + } /* end if */ + else { /* root_iblock != NULL */ + /* we have the pointer to the root iblock. Protect it + * if it is neither pinned nor protected -- otherwise we + * are ready to go. + */ + H5HF_indirect_t * iblock = NULL; + + if(((root_iblock_status & H5AC_ES__IS_PINNED) == 0) && + ((root_iblock_status & H5AC_ES__IS_PROTECTED) == 0)) { + /* the root iblock is neither pinned nor protected -- hence + * we must protect it before we proceed + * + * Note that the udata is only used in the load callback. + * While the fractal heap makes heavy use of the udata + * in this case, since we know that the entry is in cache, + * we can pass NULL udata. + * + * The tag associated specified in the dxpl we received + * as a parameter (via dxpl_id) may not be correct. + * Grab the (hopefully) correct tag from the header, + * and load it into the dxpl via the H5_BEGIN_TAG and + * H5_END_TAG macros. Note that any error bracked by + * these macros must be reported with HGOTO_ERROR_TAG. + */ + H5_BEGIN_TAG(dxpl_id, hdr->heap_addr, FAIL) + + if(NULL == (iblock = (H5HF_indirect_t *)H5AC_protect(f, dxpl_id, H5AC_FHEAP_IBLOCK, root_iblock_addr, NULL, H5AC__READ_ONLY_FLAG))) + HGOTO_ERROR_TAG(H5E_HEAP, H5E_CANTPROTECT, FAIL, "H5AC_protect() faild.") + + H5_END_TAG(FAIL) + + unprotect_root_iblock = TRUE; + HDassert(iblock == root_iblock); + } /* end if */ + } /* end else */ + + /* at this point, one way or another, the root iblock is locked + * in memory for the duration of the call. Do some sanity checks, + * and then call H5HF__cache_verify_iblock_descendants_clean(). + */ + HDassert(root_iblock->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); + HDassert(root_iblock->cache_info.type == H5AC_FHEAP_IBLOCK); + + if(H5HF__cache_verify_iblock_descendants_clean(f, dxpl_id, hdr->heap_addr, root_iblock, &root_iblock_status, fd_clean, clean) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_SYSTEM, FAIL, "can't verify root iblock & descendants clean.") + + /* Unprotect the root indirect block if required */ + if(unprotect_root_iblock) { + HDassert(root_iblock); + if(H5AC_unprotect(f, dxpl_id, H5AC_FHEAP_IBLOCK, root_iblock_addr, root_iblock, H5AC__NO_FLAGS_SET) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "H5AC_unprotect() faild.") + } /* end if */ + } /* end else */ } /* end if */ else if((hdr->man_dtable.curr_root_rows == 0) && (HADDR_UNDEF != hdr->man_dtable.table_addr)) { haddr_t root_dblock_addr; unsigned root_dblock_status = 0; + hbool_t in_cache; + hbool_t type_ok; /* this is scenario 2 -- we have a root dblock */ root_dblock_addr = hdr->man_dtable.table_addr; @@ -2688,25 +2907,48 @@ H5HF__cache_verify_hdr_descendants_clean(H5F_t *f, H5HF_hdr_t *hdr, HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't get root dblock status") if(root_dblock_status & H5AC_ES__IN_CACHE) { + if(H5AC_verify_entry_type(f, root_dblock_addr, &H5AC_FHEAP_DBLOCK[0], &in_cache, &type_ok) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't check dblock type") + HDassert(in_cache); + if(!type_ok) + HGOTO_ERROR(H5E_HEAP, H5E_SYSTEM, FAIL, "root dblock addr doesn't refer to a dblock?!?") + /* If a root dblock is in cache, it must have a flush - * dependency relationship with the header. + * dependency relationship with the header, and it + * may not be the parent in any flush dependency + * relationship. + * + * We don't test this fully, but we will verify that + * the root iblock is a child in a flush dependency + * relationship with the header. */ - if(0 == (root_dblock_status & H5AC_ES__IS_FLUSH_DEP_CHILD)) - HGOTO_ERROR(H5E_HEAP, H5E_SYSTEM, FAIL, "root dblock in cache and not a flush dep child.") + if(H5AC_flush_dependency_exists(f, hdr->heap_addr, root_dblock_addr, &fd_exists) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't check flush dependency") + if(!fd_exists) + HGOTO_ERROR(H5E_HEAP, H5E_SYSTEM, FAIL, "root dblock is not a flush dep parent of header.") + if(0 != (root_dblock_status & H5AC_ES__IS_FLUSH_DEP_PARENT)) HGOTO_ERROR(H5E_HEAP, H5E_SYSTEM, FAIL, "root dblock in cache and is a flush dep parent.") - if(root_dblock_status & H5AC_ES__IS_DIRTY) - *clean = FALSE; - } /* end if */ - else /* root dblock not in cache */ - *clean = TRUE; + *clean = !((root_dblock_status & H5AC_ES__IS_DIRTY) && + (((root_dblock_status & + H5AC_ES__IMAGE_IS_UP_TO_DATE) == 0) || + (!H5AC_get_serialization_in_progress(f)))); + + *fd_clean = *clean; + } /* end if */ + else { /* root dblock not in cache */ + *fd_clean = TRUE; + *clean = TRUE; + } /* end else */ } /* end else-if */ - else - /* this is scenario 3 -- the fractal heap is empty, and we - * have nothing to do. - */ - *clean = TRUE; + else { + /* this is scenario 3 -- the fractal heap is empty, and we + * have nothing to do. + */ + *fd_clean = TRUE; + *clean = TRUE; + } /* end else */ done: FUNC_LEAVE_NOAPI(ret_value) @@ -2741,6 +2983,40 @@ done: * H5HF__cache_verify_descendant_iblocks_clean() are * recursive co-routines. * + * Update -- 9/29/16 + * + * The implementation of flush dependencies has been changed. + * Prior to this change, a flush dependency parent could be + * flushed if and only if all its flush dependency decendants + * were clean. In the new definition, a flush dependency + * parent can be flushed if all its immediate flush dependency + * children are clean, regardless of any other dirty + * decendants. + * + * Further, metadata cache entries are now allowed to have + * multiple flush dependency parents. + * + * This means that the fractal heap is no longer ncessarily + * flushed from the bottom up. + * + * For example, it is now possible for a dirty fractal heap + * header to be flushed before a dirty dblock, as long as the + * there in an interviening iblock, and the header has no + * dirty immediate flush dependency children. + * + * Also, I gather that under some circumstances, a dblock + * will be direct a flush dependency child both of the iblock + * that points to it, and of the fractal heap header. + * + * As a result of these changes, the functionality of these + * sanity checking routines has been modified significantly. + * Instead of scanning the fractal heap from a starting point + * down, and verifying that there were no dirty entries, the + * functions now scan downward from the starting point and + * verify that there are no dirty flush dependency children + * of the specified flush dependency parent. In passing, + * they also walk the data structure, and verify it. + * * Return: Non-negative on success/Negative on failure * * Programmer: John Mainzer @@ -2750,8 +3026,9 @@ done: */ #ifndef NDEBUG static herr_t -H5HF__cache_verify_iblock_descendants_clean(H5F_t *f, H5HF_indirect_t *iblock, - unsigned *iblock_status, hbool_t *clean) +H5HF__cache_verify_iblock_descendants_clean(H5F_t *f, hid_t dxpl_id, + haddr_t fd_parent_addr, H5HF_indirect_t *iblock, unsigned *iblock_status, + hbool_t * fd_clean, hbool_t *clean) { hbool_t has_dblocks = FALSE; hbool_t has_iblocks = FALSE; @@ -2761,17 +3038,19 @@ H5HF__cache_verify_iblock_descendants_clean(H5F_t *f, H5HF_indirect_t *iblock, /* Sanity checks */ HDassert(f); + HDassert(H5F_addr_defined(fd_parent_addr)); HDassert(iblock); HDassert(iblock->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); HDassert(iblock->cache_info.type == H5AC_FHEAP_IBLOCK); HDassert(iblock_status); - HDassert(clean); - HDassert(*clean); + HDassert(fd_clean); + HDassert(*fd_clean); + HDassert(clean); /* note that *clean need not be TRUE */ - if((*clean) && H5HF__cache_verify_iblocks_dblocks_clean(f, iblock, clean, &has_dblocks) < 0) + if((*fd_clean) && H5HF__cache_verify_iblocks_dblocks_clean(f, fd_parent_addr, iblock, fd_clean, clean, &has_dblocks) < 0) HGOTO_ERROR(H5E_HEAP, H5E_SYSTEM, FAIL, "can't verify dblocks clean.") - if((*clean) && H5HF__cache_verify_descendant_iblocks_clean(f, iblock, clean, &has_iblocks) < 0) + if((*fd_clean) && H5HF__cache_verify_descendant_iblocks_clean(f, dxpl_id, fd_parent_addr, iblock, fd_clean, clean, &has_iblocks) < 0) HGOTO_ERROR(H5E_HEAP, H5E_SYSTEM, FAIL, "can't verify iblocks clean.") /* verify that flush dependency setup is plausible */ @@ -2808,6 +3087,53 @@ done: * during the call. Caller must ensure that this is * the case before the call. * + * Update -- 8/24/15 + * + * With the advent of the metadata cache image feature, it is + * possible for the pre-serialize and serialize calls to be + * invoked outside of a flush. While this serialization + * observes flush dependencies for the order of serialization, + * the entries are not written to disk, and hence dirty entries + * remain dirty. + * + * To address this, updated the sanity checks in this function + * to treat entries whose images are up to date as clean if + * a cache serialization is in progress. + * + * Update -- 9/29/16 + * + * The implementation of flush dependencies has been changed. + * Prior to this change, a flush dependency parent could be + * flushed if and only if all its flush dependency decendants + * were clean. In the new definition, a flush dependency + * parent can be flushed if all its immediate flush dependency + * children are clean, regardless of any other dirty + * decendants. + * + * Further, metadata cache entries are now allowed to have + * multiple flush dependency parents. + * + * This means that the fractal heap is no longer ncessarily + * flushed from the bottom up. + * + * For example, it is now possible for a dirty fractal heap + * header to be flushed before a dirty dblock, as long as the + * there in an interviening iblock, and the header has no + * dirty immediate flush dependency children. + * + * Also, I gather that under some circumstances, a dblock + * will be direct a flush dependency child both of the iblock + * that points to it, and of the fractal heap header. + * + * As a result of these changes, the functionality of these + * sanity checking routines has been modified significantly. + * Instead of scanning the fractal heap from a starting point + * down, and verifying that there were no dirty entries, the + * functions now scan downward from the starting point and + * verify that there are no dirty flush dependency children + * of the specified flush dependency parent. In passing, + * they also walk the data structure, and verify it. + * * Return: Non-negative on success/Negative on failure * * Programmer: John Mainzer @@ -2817,53 +3143,82 @@ done: */ #ifndef NDEBUG static herr_t -H5HF__cache_verify_iblocks_dblocks_clean(H5F_t *f, H5HF_indirect_t *iblock, - hbool_t *clean, hbool_t *has_dblocks) +H5HF__cache_verify_iblocks_dblocks_clean(H5F_t *f, haddr_t fd_parent_addr, + H5HF_indirect_t *iblock, hbool_t *fd_clean, hbool_t *clean, + hbool_t *has_dblocks) { unsigned num_direct_rows; unsigned max_dblock_index; unsigned i; + haddr_t iblock_addr; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC /* Sanity checks */ HDassert(f); + HDassert(H5F_addr_defined(fd_parent_addr)); HDassert(iblock); HDassert(iblock->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); HDassert(iblock->cache_info.type == H5AC_FHEAP_IBLOCK); - HDassert(clean); - HDassert(*clean); + HDassert(fd_clean); + HDassert(*fd_clean); + HDassert(clean); /* note that *clean need not be true */ HDassert(has_dblocks); i = 0; num_direct_rows = MIN(iblock->nrows, iblock->hdr->man_dtable.max_direct_rows); HDassert(num_direct_rows <= iblock->nrows); max_dblock_index = (num_direct_rows * iblock->hdr->man_dtable.cparam.width) - 1; - while((*clean) && (i <= max_dblock_index)) { + iblock_addr = iblock->addr; + HDassert(H5F_addr_defined(iblock_addr)); + + while((*fd_clean) && (i <= max_dblock_index)) { haddr_t dblock_addr; dblock_addr = iblock->ents[i].addr; if(H5F_addr_defined(dblock_addr)) { - unsigned dblock_status = 0; + hbool_t in_cache; + hbool_t type_ok; + + if(H5AC_verify_entry_type(f, dblock_addr, &H5AC_FHEAP_DBLOCK[0], &in_cache, &type_ok) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't check dblock type") + + if(in_cache) { /* dblock is in cache */ + hbool_t fd_exists; + unsigned dblock_status = 0; + + if(!type_ok) + HGOTO_ERROR(H5E_HEAP, H5E_SYSTEM, FAIL, "dblock addr doesn't refer to a dblock?!?") + + if(H5AC_get_entry_status(f, dblock_addr, &dblock_status) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't get dblock status") + + HDassert(dblock_status & H5AC_ES__IN_CACHE); - if(H5AC_get_entry_status(f, dblock_addr, &dblock_status) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't get dblock status") - if(dblock_status & H5AC_ES__IN_CACHE) { *has_dblocks = TRUE; - if(dblock_status & H5AC_ES__IS_DIRTY) + if((dblock_status & H5AC_ES__IS_DIRTY) && + (((dblock_status & H5AC_ES__IMAGE_IS_UP_TO_DATE) == 0) || + (!H5AC_get_serialization_in_progress(f)))) { *clean = FALSE; + + if(H5AC_flush_dependency_exists(f, fd_parent_addr, dblock_addr, &fd_exists) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't check flush dependency") + + if(fd_exists) + *fd_clean = FALSE; + } /* end if */ - /* If a child dblock is in cache, it must have a flush - * dependency relationship with this iblock, and it - * may not be the parent in any flush dependency - * relationship. + /* If a child dblock is in cache, it must have a flush + * dependency relationship with this iblock. Test this + * here. */ - if(0 == (dblock_status & H5AC_ES__IS_FLUSH_DEP_CHILD)) - HGOTO_ERROR(H5E_HEAP, H5E_SYSTEM, FAIL, "dblock in cache and not a flush dep child.") - if(0 != (dblock_status & H5AC_ES__IS_FLUSH_DEP_PARENT)) - HGOTO_ERROR(H5E_HEAP, H5E_SYSTEM, FAIL, "dblock in cache and is a flush dep parent.") + if(H5AC_flush_dependency_exists(f, iblock_addr, dblock_addr, &fd_exists) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't check flush dependency") + + if(!fd_exists) + HGOTO_ERROR(H5E_HEAP, H5E_SYSTEM, FAIL, "dblock in cache and not a flush dep child of iblock.") } /* end if */ } /* end if */ @@ -2896,6 +3251,54 @@ done: * during the call. Caller must ensure that this is * the case before the call. * + * Update -- 8/24/15 + * + * With the advent of the metadata cache image feature, it is + * possible for the pre-serialize and serialize calls to be + * invoked outside of a flush. While this serialization + * observes flush dependencies for the order of serialization, + * the entries are not written to disk, and hence dirty entries + * remain dirty. + * + * To address this, updated the sanity checks in this function + * to treat entries whose images are up to date as clean if + * a cache serialization is in progress. + * + * Update -- 9/29/16 + * + * The implementation of flush dependencies has been changed. + * Prior to this change, a flush dependency parent could be + * flushed if and only if all its flush dependency decendants + * were clean. In the new definition, a flush dependency + * parent can be flushed if all its immediate flush dependency + * children are clean, regardless of any other dirty + * decendants. + * + * Further, metadata cache entries are now allowed to have + * multiple flush dependency parents. + * + * This means that the fractal heap is no longer ncessarily + * flushed from the bottom up. + * + * For example, it is now possible for a dirty fractal heap + * header to be flushed before a dirty dblock, as long as the + * there in an interviening iblock, and the header has no + * dirty immediate flush dependency children. + * + * Also, I gather that under some circumstances, a dblock + * will be direct a flush dependency child both of the iblock + * that points to it, and of the fractal heap header. + * + * As a result of these changes, the functionality of these + * sanity checking routines has been modified significantly. + * Instead of scanning the fractal heap from a starting point + * down, and verifying that there were no dirty entries, the + * functions now scan downward from the starting point and + * verify that there are no dirty flush dependency children + * of the specified flush dependency parent. In passing, + * they also walk the data structure, and verify it. + * + * * Return: Non-negative on success/Negative on failure * * Programmer: John Mainzer @@ -2905,33 +3308,38 @@ done: */ #ifndef NDEBUG static herr_t -H5HF__cache_verify_descendant_iblocks_clean(H5F_t *f, H5HF_indirect_t *iblock, +H5HF__cache_verify_descendant_iblocks_clean(H5F_t *f, hid_t dxpl_id, + haddr_t fd_parent_addr, H5HF_indirect_t *iblock, hbool_t *fd_clean, hbool_t *clean, hbool_t *has_iblocks) { unsigned first_iblock_index; unsigned last_iblock_index; unsigned num_direct_rows; unsigned i; + haddr_t iblock_addr; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC /* Sanity checks */ HDassert(f); + HDassert(H5F_addr_defined(fd_parent_addr)); HDassert(iblock); HDassert(iblock->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); HDassert(iblock->cache_info.type == H5AC_FHEAP_IBLOCK); - HDassert(clean); - HDassert(*clean); + HDassert(fd_clean); + HDassert(*fd_clean); + HDassert(clean); /* note that *clean need not be true */ HDassert(has_iblocks); num_direct_rows = MIN(iblock->nrows, iblock->hdr->man_dtable.max_direct_rows); HDassert(num_direct_rows <= iblock->nrows); + iblock_addr = iblock->addr; first_iblock_index = num_direct_rows * iblock->hdr->man_dtable.cparam.width; last_iblock_index = (iblock->nrows * iblock->hdr->man_dtable.cparam.width) - 1; i = first_iblock_index; - while((*clean) && (i <= last_iblock_index)) { + while((*fd_clean) && (i <= last_iblock_index)) { haddr_t child_iblock_addr = iblock->ents[i].addr; if(H5F_addr_defined(child_iblock_addr)) { @@ -2941,9 +3349,157 @@ H5HF__cache_verify_descendant_iblocks_clean(H5F_t *f, H5HF_indirect_t *iblock, HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't get iblock status") if(child_iblock_status & H5AC_ES__IN_CACHE) { + hbool_t fd_exists; + *has_iblocks = TRUE; - if(child_iblock_status & H5AC_ES__IS_DIRTY) - *clean = FALSE; + + if((child_iblock_status & H5AC_ES__IS_DIRTY) && + (((child_iblock_status & H5AC_ES__IMAGE_IS_UP_TO_DATE) == 0) || + (!H5AC_get_serialization_in_progress(f)))) { + + *clean = FALSE; + + if(H5AC_flush_dependency_exists(f, fd_parent_addr, child_iblock_addr, &fd_exists) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't check flush dependency") + + if(fd_exists) + *fd_clean = FALSE; + } /* end if */ + + /* if the child iblock is in cache and *fd_clean is TRUE, + * we must continue to explore down the fractal heap tree + * structure to verify that all descendant blocks that are + * flush dependency children of the entry at parent_addr are + * either clean, or not in the metadata cache. We do this + * with a recursive call to + * H5HF__cache_verify_iblock_descendants_clean(). + * However, we can't make this call unless the child iblock + * is somehow locked into the cache -- typically via either + * pinning or protecting. + * + * If the child iblock is pinned, we can look up its pointer + * on the current iblock's pinned child iblock list, and + * and use that pointer in the recursive call. + * + * If the entry is unprotected and unpinned, we simply + * protect it. + * + * If, however, the the child iblock is already protected, + * but not pinned, we have a bit of a problem, as we have + * no legitimate way of looking up its pointer in memory. + * + * To solve this problem, I have added a new metadata cache + * call to obtain the pointer. + * + * WARNING: This call should be used only in debugging + * routines, and it should be avoided there when + * possible. + * + * Further, if we ever multi-thread the cache, + * this routine will have to be either discarded + * or heavily re-worked. + * + * Finally, keep in mind that the entry whose + * pointer is obtained in this fashion may not + * be in a stable state. + * + * Assuming that the flush dependency code is working + * as it should, the only reason for the child entry to + * be unpinned is if none of its children are in cache. + * This unfortunately means that if it is protected and + * not pinned, the fractal heap is in the process of loading + * or inserting one of its children. The obvious implication + * is that there is a significant chance that the child + * iblock is in an unstable state. + * + * All this suggests that using the new call to obtain the + * pointer to the protected child iblock is questionable + * here. However, since this is test/debugging code, I + * expect that we will use this approach until it causes + * problems, or we think of a better way. + */ + if(*fd_clean) { + H5HF_indirect_t *child_iblock = NULL; + hbool_t unprotect_child_iblock = FALSE; + + if(0 == (child_iblock_status & H5AC_ES__IS_PINNED)) { + /* child iblock is not pinned */ + if(0 == (child_iblock_status & H5AC_ES__IS_PROTECTED)) { + /* child iblock is unprotected, and unpinned */ + /* protect it. Note that the udata is only */ + /* used in the load callback. While the */ + /* fractal heap makes heavy use of the udata */ + /* in this case, since we know that the */ + /* entry is in cache, we can pass NULL udata */ + /* */ + /* The tag associated specified in the dxpl */ + /* we received as a parameter (via dxpl_id) */ + /* may not be correct. */ + /* */ + /* Grab the (hopefully) correct tag from the */ + /* parent iblock, and load it into the dxpl */ + /* via the H5_BEGIN_TAG and H5_END_TAG */ + /* macros. Note that any error bracked by */ + /* these macros must be reported with */ + /* HGOTO_ERROR_TAG. */ + + H5_BEGIN_TAG(dxpl_id, iblock->hdr->heap_addr, FAIL) + + if(NULL == (child_iblock = (H5HF_indirect_t *) H5AC_protect(f, dxpl_id, H5AC_FHEAP_IBLOCK, child_iblock_addr, NULL, H5AC__READ_ONLY_FLAG))) + HGOTO_ERROR_TAG(H5E_HEAP, H5E_CANTPROTECT, FAIL, "H5AC_protect() faild.") + + H5_END_TAG(FAIL) + + unprotect_child_iblock = TRUE; + } /* end if */ + else { + /* child iblock is protected -- use */ + /* H5AC_get_entry_ptr_from_addr() to get a */ + /* pointer to the entry. This is very slimy -- */ + /* come up with a better solution. */ + if(H5AC_get_entry_ptr_from_addr(f, child_iblock_addr, (void **)(&child_iblock)) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "H5AC_get_entry_ptr_from_addr() faild.") + HDassert(child_iblock); + } /* end else */ + } /* end if */ + else { + /* child iblock is pinned -- look it up in the */ + /* parent iblocks child_iblocks array. */ + HDassert(iblock->child_iblocks); + child_iblock = iblock->child_iblocks[i - first_iblock_index]; + } /* end else */ + + /* At this point, one way or another we should have + * a pointer to the child iblock. Verify that we + * that we have the correct one. + */ + HDassert(child_iblock); + HDassert(child_iblock->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); + HDassert(child_iblock->cache_info.type == H5AC_FHEAP_IBLOCK); + HDassert(child_iblock->addr == child_iblock_addr); + + /* now make the recursive call */ + if(H5HF__cache_verify_iblock_descendants_clean(f, dxpl_id, fd_parent_addr, child_iblock, &child_iblock_status, fd_clean, clean) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_SYSTEM, FAIL, "can't verify child iblock clean.") + + /* if iblock_addr != fd_parent_addr, verify that a flush + * dependency relationship exists between iblock and + * the child iblock. + */ + if(fd_parent_addr != iblock_addr) { + if(H5AC_flush_dependency_exists(f, iblock_addr, child_iblock_addr, &fd_exists) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't check flush dependency") + + if(!fd_exists) + HGOTO_ERROR(H5E_HEAP, H5E_SYSTEM, FAIL, "iblock is not a flush dep parent of child_iblock.") + } /* end if */ + + /* if we protected the child iblock, unprotect it now */ + if(unprotect_child_iblock) { + if(H5AC_unprotect(f, dxpl_id, H5AC_FHEAP_IBLOCK, child_iblock_addr, child_iblock, H5AC__NO_FLAGS_SET) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "H5AC_unprotect() faild.") + } /* end if */ + } /* end if */ } /* end if */ } /* end if */ diff --git a/src/H5HFpkg.h b/src/H5HFpkg.h index 6abae65..9c1d9a6 100644 --- a/src/H5HFpkg.h +++ b/src/H5HFpkg.h @@ -559,15 +559,6 @@ typedef struct H5HF_dblock_cache_ud_t { /* Package Private Variables */ /*****************************/ -/* H5HF header inherits cache-like properties from H5AC */ -H5_DLLVAR const H5AC_class_t H5AC_FHEAP_HDR[1]; - -/* H5HF indirect block inherits cache-like properties from H5AC */ -H5_DLLVAR const H5AC_class_t H5AC_FHEAP_IBLOCK[1]; - -/* H5HF direct block inherits cache-like properties from H5AC */ -H5_DLLVAR const H5AC_class_t H5AC_FHEAP_DBLOCK[1]; - /* The v2 B-tree class for tracking indirectly accessed 'huge' objects */ H5_DLLVAR const H5B2_class_t H5HF_HUGE_BT2_INDIR[1]; diff --git a/src/H5HGpkg.h b/src/H5HGpkg.h index e566ece..a5c80ea 100644 --- a/src/H5HGpkg.h +++ b/src/H5HGpkg.h @@ -40,9 +40,6 @@ /* Package Private Variables */ /*****************************/ -/* The cache subclass */ -H5_DLLVAR const H5AC_class_t H5AC_GHEAP[1]; - /* Declare extern the free list to manage the H5HG_t struct */ H5FL_EXTERN(H5HG_heap_t); diff --git a/src/H5HLpkg.h b/src/H5HLpkg.h index 7075b2a..06db696 100644 --- a/src/H5HLpkg.h +++ b/src/H5HLpkg.h @@ -39,12 +39,6 @@ /* Package Private Variables */ /*****************************/ -/* The local heap prefix cache subclass */ -H5_DLLVAR const H5AC_class_t H5AC_LHEAP_PRFX[1]; - -/* The local heap data block cache subclass */ -H5_DLLVAR const H5AC_class_t H5AC_LHEAP_DBLK[1]; - /* Declare extern the free list to manage the H5HL_free_t struct */ H5FL_EXTERN(H5HL_free_t); diff --git a/src/H5MF.c b/src/H5MF.c index 3ed6d28..23f128f 100644 --- a/src/H5MF.c +++ b/src/H5MF.c @@ -273,7 +273,7 @@ H5MF__alloc_open(H5F_t *f, hid_t dxpl_id, H5FD_mem_t type) /* Open an existing free space structure for the file */ if(NULL == (f->shared->fs_man[type] = H5FS_open(f, dxpl_id, f->shared->fs_addr[type], NELMTS(classes), classes, f, f->shared->alignment, f->shared->threshold))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't initialize free space info") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't initialize free space info") /* Set the state for the free space manager to "open", if it is now */ if(f->shared->fs_man[type]) @@ -419,7 +419,7 @@ H5MF__alloc_close(H5F_t *f, hid_t dxpl_id, H5FD_mem_t type) /* Close an existing free space structure for the file */ if(H5FS_close(f, dxpl_id, f->shared->fs_man[type]) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTRELEASE, FAIL, "can't release free space info") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't release free space info") f->shared->fs_man[type] = NULL; f->shared->fs_state[type] = H5F_FS_STATE_CLOSED; @@ -548,7 +548,7 @@ HDfprintf(stderr, "%s: Check 2.0\n", FUNC); /* Allocate from the metadata aggregator (or the VFD) */ if(HADDR_UNDEF == (ret_value = H5MF_aggr_vfd_alloc(f, alloc_type, dxpl_id, size))) - HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, HADDR_UNDEF, "allocation failed from aggr/vfd") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, HADDR_UNDEF, "allocation failed from aggr/vfd") done: /* Reset the ring in the DXPL */ @@ -663,7 +663,7 @@ HDfprintf(stderr, "%s: Entering - alloc_type = %u, addr = %a, size = %Hu\n", FUN /* check arguments */ HDassert(f); if(!H5F_addr_defined(addr) || 0 == size) - HGOTO_DONE(SUCCEED); + HGOTO_DONE(SUCCEED) HDassert(addr != 0); /* Can't deallocate the superblock :-) */ /* Check for attempting to free space that's a 'temporary' file address */ @@ -712,7 +712,7 @@ HDfprintf(stderr, "%s: Trying to avoid starting up free space manager\n", FUNC); #endif /* H5MF_ALLOC_DEBUG_MORE */ /* Try to shrink the file or absorb the block into a block aggregator */ if((status = H5MF_try_shrink(f, alloc_type, dxpl_id, addr, size)) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTMERGE, FAIL, "can't check for absorbing block") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTMERGE, FAIL, "can't check for absorbing block") else if(status > 0) /* Indicate success */ HGOTO_DONE(SUCCEED) @@ -1222,7 +1222,7 @@ H5MF__close_shrink_eoa(H5F_t *f, hid_t dxpl_id) if(f->shared->fs_man[type]) { udata.alloc_type = type; if((status = H5FS_sect_try_shrink_eoa(f, dxpl_id, f->shared->fs_man[type], &udata)) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTSHRINK, FAIL, "can't check for shrinking eoa") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTSHRINK, FAIL, "can't check for shrinking eoa") else if(status > 0) eoa_shrank = TRUE; } /* end if */ @@ -1251,18 +1251,18 @@ done: * Purpose: Handle any tasks required before the metadata cache * can serialize or flush the raw data free space manager * and any metadata free space managers that reside in the - * raw data free space manager ring. + * raw data free space manager ring. * * Specifically, any metadata managers that DON'T handle - * space allocation for free space manager header or section - * info will reside in the raw data free space manager ring. - * As of this writing, the plan is to move to only two free space + * space allocation for free space manager header or section + * info will reside in the raw data free space manager ring. + * As of this writing, the plan is to move to only two free space * managers, one for raw data and one for metadata -- which * means that only the raw data free space manager will reside * in the free space manager ring. However, this has not been * fully implemented yet, so this code must support the * possibilty of multiple metadata free space managers, at most - * two of which handle free space manager header or section info, + * two of which handle free space manager header or section info, * and thus reside in the metadata free space manager ring. * * At present, the task list is: @@ -1271,20 +1271,20 @@ done: * * a) Free both aggregators. Space not at EOA will be * added to the appropriate free space manager. - * + * * The raw data aggregator should not be restarted * after this point. It is possible that the metadata * aggregator will be. - * + * * b) Free all file space currently allocated to free - * space managers. + * space managers. * * c) Delete the free space manager superblock * extension message if allocated. * * This done, reduce the EOA by moving it to just before * the last piece of free memory in the file. - * + * * 2) Ensure that space is allocated for the free space * manager superblock extension message. Must do this * now, before reallocating file space for free space @@ -1309,6 +1309,7 @@ done: * We will allocate space for free space managers involved * in the allocation of file space for free space managers * in H5MF_settle_meta_data_fsm() + * * Return: SUCCEED/FAIL * * Programmer: John Mainzer @@ -1348,16 +1349,16 @@ H5MF_settle_raw_data_fsm(H5F_t *f, hid_t dxpl_id, hbool_t *fsm_settled) /* a) Free the space in aggregators: * - * (for space not at EOF, it may be put into free space managers) + * (for space not at EOF, it may be put into free space managers) * - * Do this now so that the raw data FSM (and any other FSM that isn't + * Do this now so that the raw data FSM (and any other FSM that isn't * involved in space allocation for FSMs) will have no further activity. * * Note that while the raw data aggregator should not be restarted during * the close process, this need not be the case for the metadata aggregator. */ if(H5MF_free_aggrs(f, dxpl_id) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTFREE, FAIL, "can't free aggregators") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "can't free aggregators") /* Set the ring type in the DXPL. In most cases, we will * need H5AC_RING_MDFSM first, so initialy set the ring in @@ -1365,29 +1366,29 @@ H5MF_settle_raw_data_fsm(H5F_t *f, hid_t dxpl_id, hbool_t *fsm_settled) * needed. */ if(H5AC_set_ring(dxpl_id, H5AC_RING_MDFSM, &dxpl, &orig_ring) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTSET, FAIL, "unable to set ring value(0)") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTSET, FAIL, "unable to set ring value(0)") reset_ring = TRUE; curr_ring = H5AC_RING_MDFSM; /* b) Free the file space (if any) allocated to each free space manager. * - * Do this to facilitate reduction of the size of the file to the - * extent possible. We will re-allocate space to free space managers + * Do this to facilitate reduction of the size of the file to the + * extent possible. We will re-allocate space to free space managers * that have free space to save after this reduction. * * In the case of the raw data free space manager, and any other free * space manager that does not allocate space for free space managers, * allocations should be complete at this point, as all raw data should * have space allocated and be flushed to file at this point. Thus we - * can examine such free space managers and only re-allocate space for + * can examine such free space managers and only re-allocate space for * them if they contain free space. Do this later in this function after * the EOA has been reduced to the extent possible. * - * For free space managers that allocate file space for free space - * managers (usually just a single metadata free space manager, but for - * now at least, free space managers for different types of metadata + * For free space managers that allocate file space for free space + * managers (usually just a single metadata free space manager, but for + * now at least, free space managers for different types of metadata * are possible), the matter is more ticklish due to the self- - * referential nature of the problem. These FSMs are dealt with in + * referential nature of the problem. These FSMs are dealt with in * H5MF_settle_meta_data_fsm(). */ for(type = H5FD_MEM_SUPER; type < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, type)) { @@ -1403,8 +1404,8 @@ H5MF_settle_raw_data_fsm(H5F_t *f, hid_t dxpl_id, hbool_t *fsm_settled) if(!fsm_visited[fsm_type]) { fsm_visited[fsm_type] = TRUE; - /* If there is no active FSM for this type, but such a FSM has - * space allocated in file, open it so that we can free its file + /* If there is no active FSM for this type, but such a FSM has + * space allocated in file, open it so that we can free its file * space. */ if(NULL == f->shared->fs_man[fsm_type]) { @@ -1414,7 +1415,7 @@ H5MF_settle_raw_data_fsm(H5F_t *f, hid_t dxpl_id, hbool_t *fsm_settled) /* Start up FSM for the file memory type */ if(H5MF__alloc_open(f, dxpl_id, fsm_type) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTINIT, FAIL, "can't initialize file free space manager") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't initialize file free space manager") fsm_opened[fsm_type] = TRUE; } /* end if */ } /* end if */ @@ -1429,14 +1430,14 @@ H5MF_settle_raw_data_fsm(H5F_t *f, hid_t dxpl_id, hbool_t *fsm_settled) else needed_ring = H5AC_RING_RDFSM; if(needed_ring != curr_ring) { - if(H5AC_set_ring(dxpl_id, needed_ring, &dxpl, &curr_ring)< 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTSET, FAIL, "unable to set ring value.") + if(H5AC_set_ring(dxpl_id, needed_ring, &dxpl, &curr_ring) < 0) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTSET, FAIL, "unable to set ring value") curr_ring = needed_ring; } /* end if */ /* Query free space manager info for this type */ if(H5FS_stat_info(f, f->shared->fs_man[fsm_type], &fs_stat) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTRELEASE, FAIL, "can't get free-space info") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't get free-space info") /* Check if the free space manager has space in the file */ if(H5F_addr_defined(fs_stat.addr) || H5F_addr_defined(fs_stat.sect_addr)) { @@ -1445,7 +1446,7 @@ H5MF_settle_raw_data_fsm(H5F_t *f, hid_t dxpl_id, hbool_t *fsm_settled) * any free space. */ if(H5FS_free(f, f->shared->fs_man[fsm_type], dxpl_id) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTRELEASE, FAIL, "can't release free-space headers") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't release free-space headers") f->shared->fs_addr[fsm_type] = HADDR_UNDEF; } /* end if */ } /* end if */ @@ -1456,54 +1457,54 @@ H5MF_settle_raw_data_fsm(H5F_t *f, hid_t dxpl_id, hbool_t *fsm_settled) } /* end if */ } /* end for */ - /* c) Delete the free space manager superblock extension message + /* c) Delete the free space manager superblock extension message * if allocated. * * Must do this since the routine that writes / creates superblock - * extension messages will choke if the target message is + * extension messages will choke if the target message is * unexpectedly either absent or present. */ if(H5F_addr_defined(f->shared->sblock->ext_addr)) if(H5F_super_ext_remove_msg(f, dxpl_id, H5O_FSINFO_ID) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTRELEASE, FAIL, "error in removing message from superblock extension") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "error in removing message from superblock extension") /* As the final element in 1), shrink the EOA for the file */ if(H5MF__close_shrink_eoa(f, dxpl_id) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTSHRINK, FAIL, "can't shrink eoa") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTSHRINK, FAIL, "can't shrink eoa") - - /* 2) Ensure that space is allocated for the free space manager superblock - * extension message. Must do this now, before reallocating file space + + /* 2) Ensure that space is allocated for the free space manager superblock + * extension message. Must do this now, before reallocating file space * for free space managers, as it is possible that this allocation may - * grab the last section in a FSM -- making it unnecessary to + * grab the last section in a FSM -- making it unnecessary to * re-allocate file space for it. * * Do this by writing a free space manager superblock extension message. - * - * Since no free space manager has file space allocated for it, this + * + * Since no free space manager has file space allocated for it, this * message must be invalid since we can't save addresses of FSMs when * those addresses are unknown. This is OK -- we will write the correct * values to the message at free space manager shutdown. */ - for(type = H5FD_MEM_SUPER; type < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, type)) - fsinfo.fs_addr[type-1] = HADDR_UNDEF; + for(type = H5FD_MEM_SUPER; type < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, type)) + fsinfo.fs_addr[type - 1] = HADDR_UNDEF; fsinfo.strategy = f->shared->fs_strategy; fsinfo.threshold = f->shared->fs_threshold; - if(H5F_super_ext_write_msg(f, dxpl_id, H5O_FSINFO_ID, &fsinfo, TRUE) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_WRITEERROR, FAIL, "error in writing message to superblock extension") + if(H5F_super_ext_write_msg(f, dxpl_id, H5O_FSINFO_ID, &fsinfo, TRUE, H5O_MSG_NO_FLAGS_SET) < 0) + HGOTO_ERROR(H5E_RESOURCE, H5E_WRITEERROR, FAIL, "error in writing fsinfo message to superblock extension") /* 3) Scan all free space managers not involved in allocating * space for free space managers. For each such free space - * manager, test to see if it contains free space. If + * manager, test to see if it contains free space. If * it does, allocate file space for its header and section - * data. If it contains no free space, leave it without - * allocated file space as there is no need to save it to + * data. If it contains no free space, leave it without + * allocated file space as there is no need to save it to * file. * * Note that all free space managers in this class should - * see no further space allocations / deallocations as - * at this point, all raw data allocations should be + * see no further space allocations / deallocations as + * at this point, all raw data allocations should be * finalized, as should all metadata allocations not involving * free space managers. * @@ -1529,11 +1530,11 @@ H5MF_settle_raw_data_fsm(H5F_t *f, hid_t dxpl_id, hbool_t *fsm_settled) if(needed_ring != curr_ring) { if(H5AC_set_ring(dxpl_id, needed_ring, &dxpl, &curr_ring)< 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTSET, FAIL, "unable to set ring value.") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTSET, FAIL, "unable to set ring value") curr_ring = needed_ring; } /* end if */ - /* Since there can be a many-to-one mapping from memory types + /* Since there can be a many-to-one mapping from memory types * to free space managers, ensure that we don't visit any FSM * more than once. */ @@ -1555,10 +1556,10 @@ H5MF_settle_raw_data_fsm(H5F_t *f, hid_t dxpl_id, hbool_t *fsm_settled) /* Query free space manager info for this type */ if(H5FS_stat_info(f, f->shared->fs_man[fsm_type], &fs_stat) < 0 ) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTRELEASE, FAIL, "can't get free-space info") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "can't get free-space info") - /* If the free space manager contains section info, - * allocate space for the header and sinfo (note that + /* If the free space manager contains section info, + * allocate space for the header and sinfo (note that * space must not be allocated at present -- verify * verify this with assertions). */ @@ -1568,18 +1569,18 @@ H5MF_settle_raw_data_fsm(H5F_t *f, hid_t dxpl_id, hbool_t *fsm_settled) /* Allocate FSM header */ if(H5FS_alloc_hdr(f, f->shared->fs_man[fsm_type], &f->shared->fs_addr[fsm_type], dxpl_id) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTALLOC, FAIL, "can't allocated free-space header") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't allocated free-space header") /* Allocate FSM section info */ HDassert(!H5F_addr_defined(fs_stat.sect_addr)); HDassert(fs_stat.alloc_sect_size == 0); if(H5FS_alloc_sect(f, f->shared->fs_man[fsm_type], dxpl_id) < 0 ) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTALLOC, FAIL, "can't allocate free-space section info") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't allocate free-space section info") #ifndef NDEBUG /* Re-Query free space manager info for this type */ if(H5FS_stat_info(f, f->shared->fs_man[fsm_type], &fs_stat) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTRELEASE, FAIL, "can't get free-space info") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't get free-space info") HDassert(H5F_addr_defined(fs_stat.addr)); HDassert(H5F_addr_defined(fs_stat.sect_addr)); @@ -1600,7 +1601,7 @@ H5MF_settle_raw_data_fsm(H5F_t *f, hid_t dxpl_id, hbool_t *fsm_settled) /* Close any opened FSMs */ if(fsm_opened[fsm_type]) { if(H5MF__alloc_close(f, dxpl_id, fsm_type) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTINIT, FAIL, "can't close file free space manager") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't close file free space manager") fsm_opened[fsm_type] = FALSE; } /* end if */ } /* end if */ @@ -1618,7 +1619,7 @@ done: /* Reset the ring in the DXPL */ if(reset_ring) if(H5AC_reset_ring(dxpl, orig_ring) < 0) - HDONE_ERROR(H5E_FSPACE, H5E_CANTSET, FAIL, "unable to set property value") + HDONE_ERROR(H5E_RESOURCE, H5E_CANTSET, FAIL, "unable to set property value") FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL) } /* H5MF_settle_raw_data_fsm() */ @@ -1761,7 +1762,7 @@ H5MF_settle_meta_data_fsm(H5F_t *f, hid_t dxpl_id, hbool_t *fsm_settled) /* Set the ring in the dxpl appropriately for subsequent calls */ if(H5AC_set_ring(dxpl_id, H5AC_RING_MDFSM, &dxpl, &orig_ring) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTSET, FAIL, "unable to set ring value") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTSET, FAIL, "unable to set ring value") reset_ring = TRUE; #ifndef NDEBUG @@ -1769,7 +1770,7 @@ H5MF_settle_meta_data_fsm(H5F_t *f, hid_t dxpl_id, hbool_t *fsm_settled) if(hdr_fspace) { /* Query free space manager info for this type */ if(H5FS_stat_info(f, hdr_fspace, &fs_stat) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTGET, FAIL, "can't get free-space info") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "can't get free-space info") HDassert(!H5F_addr_defined(fs_stat.addr)); HDassert(!H5F_addr_defined(fs_stat.sect_addr)); @@ -1780,7 +1781,7 @@ H5MF_settle_meta_data_fsm(H5F_t *f, hid_t dxpl_id, hbool_t *fsm_settled) if((sinfo_fspace) && (hdr_fspace != sinfo_fspace)) { /* Query free space manager info for this type */ if(H5FS_stat_info(f, sinfo_fspace, &fs_stat) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTGET, FAIL, "can't get free-space info") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "can't get free-space info") HDassert(!H5F_addr_defined(fs_stat.addr)); HDassert(!H5F_addr_defined(fs_stat.sect_addr)); @@ -1788,32 +1789,32 @@ H5MF_settle_meta_data_fsm(H5F_t *f, hid_t dxpl_id, hbool_t *fsm_settled) } /* end if */ #endif /* NDEBUG */ - /* Free the space in the metadata aggregator. Do this via the + /* Free the space in the metadata aggregator. Do this via the * H5MF_free_aggrs() call. Note that the raw data aggregator must * have already been freed. Sanity checks for this? */ /* (for space not at EOF, it may be put into free space managers) */ if(H5MF_free_aggrs(f, dxpl_id) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTFREE, FAIL, "can't free aggregators") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "can't free aggregators") /* Trying shrinking the EOA for the file */ if(H5MF__close_shrink_eoa(f, dxpl_id) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTSHRINK, FAIL, "can't shrink eoa") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTSHRINK, FAIL, "can't shrink eoa") /* ******************* PROBLEM: ******************** * - * If the file has an alignement other than 1, and if - * the EOA is not a multiple of this alignment, allocating sapce - * for the section via the VFD info has the potential of generating - * a fragment that will be added to the free space manager. This + * If the file has an alignement other than 1, and if + * the EOA is not a multiple of this alignment, allocating sapce + * for the section via the VFD info has the potential of generating + * a fragment that will be added to the free space manager. This * of course undoes everything we have been doing here. * - * Need a way around this. Obvious solution is to force the EOA to - * be a multiple of the alignment. + * Need a way around this. Obvious solution is to force the EOA to + * be a multiple of the alignment. * * Fortunately, alignment is typically 1, so this is a non-issue in - * most cases. In cases where the alignment is not 1, for now we - * have decided to drop the fragment on the floor. + * most cases. In cases where the alignment is not 1, for now we + * have decided to drop the fragment on the floor. * * Eventually, we should fix this by modifying the on disk representations * of free space managers to allow for empty space, so as to bypass the @@ -1823,40 +1824,40 @@ H5MF_settle_meta_data_fsm(H5F_t *f, hid_t dxpl_id, hbool_t *fsm_settled) /* HDassert(f->shared->alignment == 1); */ - /* The free space manager(s) that handle space allocations for free - * space managers should be settled now, albeit without file space + /* The free space manager(s) that handle space allocations for free + * space managers should be settled now, albeit without file space * allocated to them. To avoid the possibility of changing the sizes - * of their section info blocks, allocate space for them now at the + * of their section info blocks, allocate space for them now at the * end of file via H5FD_alloc(). * - * In the past, this issue of allocating space without touching the - * free space managers has been deal with by calling - * H5MF_aggr_vfd_alloc(), which in turn calls H5MF_aggr_alloc(). - * This is problematic since (if I read the code correctly) it will - * re-constitute the metadata aggregator, which will add any left - * over space to one of the free space managers when freed. + * In the past, this issue of allocating space without touching the + * free space managers has been deal with by calling + * H5MF_aggr_vfd_alloc(), which in turn calls H5MF_aggr_alloc(). + * This is problematic since (if I read the code correctly) it will + * re-constitute the metadata aggregator, which will add any leftover + * space to one of the free space managers when freed. * * This is a non-starter, since the entire objective is to settle the * free space managers. * - * Hence the decision to call H5FD_alloc() directly. - * - * As discussed in PROBLEM above, if f->shared->alignment is not 1, + * Hence the decision to call H5FD_alloc() directly. + * + * As discussed in PROBLEM above, if f->shared->alignment is not 1, * this has the possibility of generating a fragment of file space * that would typically be inserted into one of the free space managers. * * This is isn't good, but due to schedule pressure, we will just drop - * the fragement on the floor for now. + * the fragment on the floor for now. */ if(hdr_fspace) if(H5FS_alloc_vfd_alloc_hdr_and_section_info(f, dxpl_id, hdr_fspace, &(f->shared->fs_addr[hdr_fsm_alloc_type])) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTALLOC, FAIL, "can't vfd allocate hdr FSM file space") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't vfd allocate hdr FSM file space") if(sinfo_fspace && (sinfo_fspace != hdr_fspace)) if(H5FS_alloc_vfd_alloc_hdr_and_section_info(f, dxpl_id, sinfo_fspace, &(f->shared->fs_addr[sinfo_fsm_alloc_type])) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTALLOC, FAIL, "can't vfd allocate sinfo FSM file space") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't vfd allocate sinfo FSM file space") /* Indicate that the FSM was settled successfully */ *fsm_settled = TRUE; @@ -1865,7 +1866,7 @@ H5MF_settle_meta_data_fsm(H5F_t *f, hid_t dxpl_id, hbool_t *fsm_settled) done: if(reset_ring) if(H5AC_reset_ring(dxpl, orig_ring) < 0) - HDONE_ERROR(H5E_FSPACE, H5E_CANTSET, FAIL, "unable to set property value") + HDONE_ERROR(H5E_RESOURCE, H5E_CANTSET, FAIL, "unable to set property value") FUNC_LEAVE_NOAPI(ret_value) } /* H5MF_settle_meta_data_fsm() */ @@ -1927,7 +1928,7 @@ HDfprintf(stderr, "%s: Check 1.0 - f->shared->fs_man[%u] = %p, f->shared->fs_add HDfprintf(stderr, "%s: Before closing free space manager\n", FUNC); #endif /* H5MF_ALLOC_DEBUG_MORE */ if(H5FS_close(f, dxpl_id, f->shared->fs_man[type]) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTRELEASE, FAIL, "can't release free space info") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't release free space info") f->shared->fs_man[type] = NULL; f->shared->fs_state[type] = H5F_FS_STATE_CLOSED; } /* end if */ @@ -1955,7 +1956,7 @@ HDfprintf(stderr, "%s: Before deleting free space manager\n", FUNC); /* Delete free space manager for this type */ if(H5FS_delete(f, dxpl_id, tmp_fs_addr) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTFREE, FAIL, "can't delete free space manager") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "can't delete free space manager") /* Shift [back] to closed state */ HDassert(f->shared->fs_state[type] == H5F_FS_STATE_DELETING); @@ -2113,7 +2114,7 @@ HDfprintf(stderr, "%s: Entering\n", FUNC); fsinfo.threshold = f->shared->fs_threshold; /* Write the free space manager message -- message must already exist */ - if(H5F_super_ext_write_msg(f, dxpl_id, H5O_FSINFO_ID, &fsinfo, FALSE) < 0) + if(H5F_super_ext_write_msg(f, dxpl_id, H5O_FSINFO_ID, &fsinfo, FALSE, H5O_MSG_NO_FLAGS_SET) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_WRITEERROR, FAIL, "error in writing message to superblock extension") /* Final close of free-space managers */ @@ -2136,7 +2137,7 @@ HDfprintf(stderr, "%s: Entering\n", FUNC); HDassert(f->shared->fs_state[type] == H5F_FS_STATE_OPEN); if(H5FS_close(f, dxpl_id, f->shared->fs_man[type]) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTRELEASE, FAIL, "can't close free space manager") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't close free space manager") f->shared->fs_man[type] = NULL; f->shared->fs_state[type] = H5F_FS_STATE_CLOSED; } /* end if */ diff --git a/src/H5MFaggr.c b/src/H5MFaggr.c index 7b5a298..1510645 100644 --- a/src/H5MFaggr.c +++ b/src/H5MFaggr.c @@ -116,15 +116,15 @@ HDfprintf(stderr, "%s: alloc_type = %u, size = %Hu\n", FUNC, (unsigned)alloc_typ /* Get the EOA for the file -- need for sanity check below */ if(HADDR_UNDEF == (eoa = H5F_get_eoa(f, alloc_type))) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTGET, HADDR_UNDEF, "Unable to get eoa") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, HADDR_UNDEF, "Unable to get eoa") /* Check for overlap into temporary allocation space */ if(H5F_addr_gt((eoa + size), f->shared->tmp_addr)) - HGOTO_ERROR(H5E_FSPACE, H5E_BADRANGE, HADDR_UNDEF, "hdr file space alloc will overlap into 'temporary' file space") + HGOTO_ERROR(H5E_RESOURCE, H5E_BADRANGE, HADDR_UNDEF, "hdr file space alloc will overlap into 'temporary' file space") /* Allocate space for the header */ if(HADDR_UNDEF == (ret_value = H5FD_alloc(f->shared->lf, dxpl_id, alloc_type, f, size, &eoa_frag_addr, &eoa_frag_size))) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTALLOC, HADDR_UNDEF, "can't allocate file space for hdr") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, HADDR_UNDEF, "can't allocate file space for hdr") /* Sanity check for overlapping into file's temporary allocation space */ HDassert(H5F_addr_le((ret_value + size), f->shared->tmp_addr)); @@ -232,9 +232,9 @@ haddr_t H5MF_aggr_alloc(H5F_t *f, hid_t dxpl_id, H5F_blk_aggr_t *aggr, H5F_blk_aggr_t *other_aggr, H5FD_mem_t type, hsize_t size) { - haddr_t eoa_frag_addr = HADDR_UNDEF; /* Address of fragment at EOA */ - hsize_t eoa_frag_size = 0; /* Size of fragment at EOA */ - haddr_t eoa = HADDR_UNDEF; /* Initial EOA for the file */ + haddr_t eoa_frag_addr = HADDR_UNDEF; /* Address of fragment at EOA */ + hsize_t eoa_frag_size = 0; /* Size of fragment at EOA */ + haddr_t eoa = HADDR_UNDEF; /* Initial EOA for the file */ haddr_t ret_value = HADDR_UNDEF; /* Return value */ FUNC_ENTER_NOAPI(HADDR_UNDEF) @@ -543,7 +543,8 @@ H5MF_aggr_try_extend(H5F_t *f, hid_t dxpl_id, H5F_blk_aggr_t *aggr, } /* end else-if */ } /* end else */ } /* end if */ - else { /* The aggreator is not at end of file */ + else { + /* The aggreator is not at end of file */ /* Check if aggregator has enough internal space to satisfy the extension. */ if(aggr->size >= extra_requested) { /* Extend block into aggregator */ diff --git a/src/H5MFprivate.h b/src/H5MFprivate.h index 330fe80..e258677 100644 --- a/src/H5MFprivate.h +++ b/src/H5MFprivate.h @@ -51,15 +51,13 @@ /* File space manager routines */ H5_DLL herr_t H5MF_init_merge_flags(H5F_t *f); -H5_DLL herr_t H5MF_get_freespace(H5F_t *f, hid_t dxpl_id, hsize_t *tot_space, - hsize_t *meta_size); +H5_DLL herr_t H5MF_get_freespace(H5F_t *f, hid_t dxpl_id, hsize_t *tot_space, hsize_t *meta_size); H5_DLL herr_t H5MF_close(H5F_t *f, hid_t dxpl_id); H5_DLL herr_t H5MF_try_close(H5F_t *f, hid_t dxpl_id); /* File space allocation routines */ H5_DLL haddr_t H5MF_alloc(H5F_t *f, H5FD_mem_t type, hid_t dxpl_id, hsize_t size); -H5_DLL haddr_t H5MF_aggr_vfd_alloc(H5F_t *f, H5FD_mem_t type, hid_t dxpl_id, - hsize_t size); +H5_DLL haddr_t H5MF_aggr_vfd_alloc(H5F_t *f, H5FD_mem_t type, hid_t dxpl_id, hsize_t size); H5_DLL haddr_t H5MF_vfd_alloc(H5F_t *f, hid_t dxpl_id, H5FD_mem_t alloc_type, hsize_t size, hbool_t keep_fragment); H5_DLL herr_t H5MF_xfree(H5F_t *f, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, @@ -78,7 +76,7 @@ H5_DLL haddr_t H5MF_alloc_tmp(H5F_t *f, hsize_t size); H5_DLL herr_t H5MF_free_aggrs(H5F_t *f, hid_t dxpl_id); H5_DLL htri_t H5MF_aggrs_try_shrink_eoa(H5F_t *f, hid_t dxpl_id); -/* Settling routines */ +/* Free space manager settling routines */ H5_DLL herr_t H5MF_settle_raw_data_fsm(H5F_t *f, hid_t dxpl_id, hbool_t *fsm_settled); H5_DLL herr_t H5MF_settle_meta_data_fsm(H5F_t *f, hid_t dxpl_id, hbool_t *fsm_settled); diff --git a/src/H5O.c b/src/H5O.c index e0c0f0b..1b58703 100644 --- a/src/H5O.c +++ b/src/H5O.c @@ -130,11 +130,12 @@ const H5O_msg_class_t *const H5O_msg_class_g[] = { H5O_MSG_AINFO, /*0x0015 Attribute information */ H5O_MSG_REFCOUNT, /*0x0016 Object's ref. count */ H5O_MSG_FSINFO, /*0x0017 Free-space manager info */ - H5O_MSG_UNKNOWN, /*0x0018 Placeholder for unknown message */ + H5O_MSG_MDCI, /*0x0018 Metadata cache image */ + H5O_MSG_UNKNOWN, /*0x0019 Placeholder for unknown message */ #ifdef H5O_ENABLE_BOGUS - H5O_MSG_BOGUS_INVALID, /*0x0019 "Bogus invalid" (for testing) */ + H5O_MSG_BOGUS_INVALID, /*0x001A "Bogus invalid" (for testing) */ #else /* H5O_ENABLE_BOGUS */ - NULL, /*0x0019 "Bogus invalid" (for testing) */ + NULL, /*0x001A "Bogus invalid" (for testing) */ #endif /* H5O_ENABLE_BOGUS */ }; diff --git a/src/H5Opkg.h b/src/H5Opkg.h index ef49535..e1fa0be 100644 --- a/src/H5Opkg.h +++ b/src/H5Opkg.h @@ -31,7 +31,7 @@ #define H5O_NMESGS 8 /*initial number of messages */ #define H5O_NCHUNKS 2 /*initial number of chunks */ #define H5O_MIN_SIZE 22 /* Min. obj header data size (must be big enough for a message prefix and a continuation message) */ -#define H5O_MSG_TYPES 26 /* # of types of messages */ +#define H5O_MSG_TYPES 27 /* # of types of messages */ #define H5O_MAX_CRT_ORDER_IDX 65535 /* Max. creation order index value */ /* Versions of object header structure */ @@ -419,12 +419,6 @@ typedef struct H5O_chk_cache_ud_t { } H5O_chk_cache_ud_t; -/* H5O object header inherits cache-like properties from H5AC */ -H5_DLLVAR const H5AC_class_t H5AC_OHDR[1]; - -/* H5O object header chunk inherits cache-like properties from H5AC */ -H5_DLLVAR const H5AC_class_t H5AC_OHDR_CHK[1]; - /* Header message ID to class mapping */ H5_DLLVAR const H5O_msg_class_t *const H5O_msg_class_g[H5O_MSG_TYPES]; @@ -544,7 +538,10 @@ H5_DLLVAR const H5O_msg_class_t H5O_MSG_REFCOUNT[1]; /* Free-space Manager Info message. (0x0017) */ H5_DLLVAR const H5O_msg_class_t H5O_MSG_FSINFO[1]; -/* Placeholder for unknown message. (0x0018) */ +/* Metadata Cache Image message. (0x0018) */ +H5_DLLVAR const H5O_msg_class_t H5O_MSG_MDCI[1]; + +/* Placeholder for unknown message. (0x0019) */ H5_DLLVAR const H5O_msg_class_t H5O_MSG_UNKNOWN[1]; diff --git a/src/H5Oprivate.h b/src/H5Oprivate.h index f6df874..71c512c 100644 --- a/src/H5Oprivate.h +++ b/src/H5Oprivate.h @@ -69,6 +69,7 @@ typedef struct H5O_t H5O_t; #define H5O_FIRST (-2) /* Operate on first message of type */ /* Flags needed when encoding messages */ +#define H5O_MSG_NO_FLAGS_SET 0x00u #define H5O_MSG_FLAG_CONSTANT 0x01u #define H5O_MSG_FLAG_SHARED 0x02u #define H5O_MSG_FLAG_DONTSHARE 0x04u @@ -204,7 +205,8 @@ typedef struct H5O_copy_t { #define H5O_AINFO_ID 0x0015 /* Attribute info message. */ #define H5O_REFCOUNT_ID 0x0016 /* Reference count message. */ #define H5O_FSINFO_ID 0x0017 /* File space info message. */ -#define H5O_UNKNOWN_ID 0x0018 /* Placeholder message ID for unknown message. */ +#define H5O_MDCI_MSG_ID 0x0018 /* Metadata Cache Image Message */ +#define H5O_UNKNOWN_ID 0x0019 /* Placeholder message ID for unknown message. */ /* (this should never exist in a file) */ /* * Note: Must increment H5O_MSG_TYPES in H5Opkg.h and update H5O_msg_class_g @@ -214,7 +216,7 @@ typedef struct H5O_copy_t { * * (this should never exist in a file) */ -#define H5O_BOGUS_INVALID_ID 0x0019 /* "Bogus invalid" Message. */ +#define H5O_BOGUS_INVALID_ID 0x001A /* "Bogus invalid" Message. */ /* Shared object message types. * Shared objects can be committed, in which case the shared message contains @@ -794,6 +796,16 @@ typedef struct H5O_fsinfo_t { haddr_t fs_addr[H5FD_MEM_NTYPES-1]; /* Addresses of free space managers */ } H5O_fsinfo_t; +/* + * Metadata Cache Image Message. + * Contains base address and length of the metadata cache image. + * (Data structure in memory) + */ +typedef struct H5O_mdci_t { + haddr_t addr; /* address of MDC image block */ + hsize_t size; /* size of MDC image block */ +} H5O_mdci_t; + /* Typedef for "application" iteration operations */ typedef herr_t (*H5O_operator_t)(const void *mesg/*in*/, unsigned idx, void *operator_data/*in,out*/); diff --git a/src/H5Pfapl.c b/src/H5Pfapl.c index 91a0e03..7ea0fe0 100644 --- a/src/H5Pfapl.c +++ b/src/H5Pfapl.c @@ -225,6 +225,13 @@ #define H5F_ACS_COLL_MD_WRITE_FLAG_ENC H5P__encode_hbool_t #define H5F_ACS_COLL_MD_WRITE_FLAG_DEC H5P__decode_hbool_t #endif /* H5_HAVE_PARALLEL */ +/* Definitions for the initial metadata cache image configuration */ +#define H5F_ACS_META_CACHE_INIT_IMAGE_CONFIG_SIZE sizeof(H5AC_cache_image_config_t) +#define H5F_ACS_META_CACHE_INIT_IMAGE_CONFIG_DEF H5AC__DEFAULT_CACHE_IMAGE_CONFIG +#define H5F_ACS_META_CACHE_INIT_IMAGE_CONFIG_ENC H5P__facc_cache_image_config_enc +#define H5F_ACS_META_CACHE_INIT_IMAGE_CONFIG_DEC H5P__facc_cache_image_config_dec +#define H5F_ACS_META_CACHE_INIT_IMAGE_CONFIG_CMP H5P__facc_cache_image_config_cmp + /******************/ /* Local Typedefs */ @@ -279,6 +286,11 @@ static herr_t H5P_facc_mdc_log_location_copy(const char *name, size_t size, void static int H5P_facc_mdc_log_location_cmp(const void *value1, const void *value2, size_t size); static herr_t H5P_facc_mdc_log_location_close(const char *name, size_t size, void *value); +/* Metadata cache image property callbacks */ +static int H5P__facc_cache_image_config_cmp(const void *_config1, const void *_config2, size_t H5_ATTR_UNUSED size); +static herr_t H5P__facc_cache_image_config_enc(const void *value, void **_pp, size_t *size); +static herr_t H5P__facc_cache_image_config_dec(const void **_pp, void *_value); + /*********************/ /* Package Variables */ @@ -346,6 +358,7 @@ static const hbool_t H5F_def_evict_on_close_flag_g = H5F_ACS_EVICT_ON_CLOSE_FLAG static const H5P_coll_md_read_flag_t H5F_def_coll_md_read_flag_g = H5F_ACS_COLL_MD_READ_FLAG_DEF; /* Default setting for the collective metedata read flag */ static const hbool_t H5F_def_coll_md_write_flag_g = H5F_ACS_COLL_MD_WRITE_FLAG_DEF; /* Default setting for the collective metedata write flag */ #endif /* H5_HAVE_PARALLEL */ +static const H5AC_cache_image_config_t H5F_def_mdc_initCacheImageCfg_g = H5F_ACS_META_CACHE_INIT_IMAGE_CONFIG_DEF; /* Default metadata cache image settings */ /*------------------------------------------------------------------------- @@ -555,6 +568,12 @@ H5P__facc_reg_prop(H5P_genclass_t *pclass) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") #endif /* H5_HAVE_PARALLEL */ + /* Register the initial metadata cache image configuration */ + if(H5P_register_real(pclass, H5F_ACS_META_CACHE_INIT_IMAGE_CONFIG_NAME, H5F_ACS_META_CACHE_INIT_IMAGE_CONFIG_SIZE, &H5F_def_mdc_initCacheImageCfg_g, + NULL, NULL, NULL, H5F_ACS_META_CACHE_INIT_IMAGE_CONFIG_ENC, H5F_ACS_META_CACHE_INIT_IMAGE_CONFIG_DEC, + NULL, NULL, H5F_ACS_META_CACHE_INIT_IMAGE_CONFIG_CMP, NULL) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5P__facc_reg_prop() */ @@ -1543,6 +1562,101 @@ done: /*------------------------------------------------------------------------- + * Function: H5Pset_mdc_image_config + * + * Purpose: Set the initial metadata cache image configuration in the + * target FAPL. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: J. Mainzer + * Thursday, June 25, 2015 + * + *------------------------------------------------------------------------- + */ +herr_t +H5Pset_mdc_image_config(hid_t plist_id, H5AC_cache_image_config_t *config_ptr) +{ + H5P_genplist_t *plist; /* Property list pointer */ + herr_t ret_value = SUCCEED; /* return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE2("e", "i*x", plist_id, config_ptr); + + /* Get the plist structure */ + if(NULL == (plist = H5P_object_verify(plist_id,H5P_FILE_ACCESS))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + + /* validate the new configuration */ + if(H5AC_validate_cache_image_config(config_ptr) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid metadata cache image configuration") + + /* set the modified metadata cache image config */ + + /* If we ever support multiple versions of H5AC_cache_image_config_t, we + * will have to test the version and do translation here. + */ + + if(H5P_set(plist, H5F_ACS_META_CACHE_INIT_IMAGE_CONFIG_NAME, config_ptr) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set metadata cache image initial config") + +done: + FUNC_LEAVE_API(ret_value) +} /* H5Pset_mdc_image_config() */ + + +/*------------------------------------------------------------------------- + * Function: H5Pget_mdc_image_config + * + * Purpose: Retrieve the metadata cache initial image configuration + * from the target FAPL. + * + * Observe that the function will fail if config_ptr is + * NULL, or if config_ptr->version specifies an unknown + * version of H5AC_cache_image_config_t. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: J. Mainzer + * Friday, June 26, 2015 + * + *------------------------------------------------------------------------- + */ +herr_t +H5Pget_mdc_image_config(hid_t plist_id, H5AC_cache_image_config_t *config_ptr) +{ + H5P_genplist_t *plist; /* Property list pointer */ + herr_t ret_value = SUCCEED; /* return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE2("e", "i*x", plist_id, config_ptr); + + /* Get the plist structure */ + if(NULL == (plist = H5P_object_verify(plist_id,H5P_FILE_ACCESS))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + + /* validate the config_ptr */ + if(config_ptr == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL config_ptr on entry.") + + if(config_ptr->version != H5AC__CURR_CACHE_IMAGE_CONFIG_VERSION) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Unknown image config version.") + + /* If we ever support multiple versions of H5AC_cache_config_t, we + * will have to get the cannonical version here, and then translate + * to the version of the structure supplied. + */ + + /* Get the current initial metadata cache resize configuration */ + if(H5P_get(plist, H5F_ACS_META_CACHE_INIT_IMAGE_CONFIG_NAME, config_ptr) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET,FAIL, "can't get metadata cache initial image config") + +done: + FUNC_LEAVE_API(ret_value) +} /* H5Pget_mdc_image_config() */ + + +/*------------------------------------------------------------------------- * Function: H5Pset_mdc_config * * Purpose: Set the initial metadata cache resize configuration in the @@ -2754,6 +2868,147 @@ done: /*------------------------------------------------------------------------- + * Function: H5P__facc_cache_image_config_cmp + * + * Purpose: Compare two cache image configurations. + * + * Return: positive if VALUE1 is greater than VALUE2, negative if VALUE2 is + * greater than VALUE1 and zero if VALUE1 and VALUE2 are equal. + * + * Programmer: John Mainzer + * June 26, 2015 + * + *------------------------------------------------------------------------- + */ +static int +H5P__facc_cache_image_config_cmp(const void *_config1, const void *_config2, size_t H5_ATTR_UNUSED size) +{ + const H5AC_cache_image_config_t *config1 = (const H5AC_cache_image_config_t *)_config1; /* Create local aliases for values */ + const H5AC_cache_image_config_t *config2 = (const H5AC_cache_image_config_t *)_config2; /* Create local aliases for values */ + int ret_value = 0; /* Return value */ + + FUNC_ENTER_STATIC_NOERR + + /* Check for a property being set */ + if(config1 == NULL && config2 != NULL) HGOTO_DONE(-1); + if(config1 != NULL && config2 == NULL) HGOTO_DONE(1); + + if(config1->version < config2->version) HGOTO_DONE(-1); + if(config1->version > config2->version) HGOTO_DONE(1); + + if(config1->generate_image < config2->generate_image) HGOTO_DONE(-1); + if(config1->generate_image > config2->generate_image) HGOTO_DONE(1); + + if(config1->save_resize_status < config2->save_resize_status) HGOTO_DONE(-1); + if(config1->save_resize_status > config2->save_resize_status) HGOTO_DONE(1); + + if(config1->entry_ageout < config2->entry_ageout) HGOTO_DONE(-1); + if(config1->entry_ageout > config2->entry_ageout) HGOTO_DONE(1); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__facc_cache_image_config_cmp() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__facc_cache_image_config_enc + * + * Purpose: Callback routine which is called whenever the default + * cache image config property in the file creation + * property list is encoded. + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: John Mainzer + * June 26, 2015 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__facc_cache_image_config_enc(const void *value, void **_pp, size_t *size) +{ + const H5AC_cache_image_config_t *config = (const H5AC_cache_image_config_t *)value; /* Create local aliases for value */ + uint8_t **pp = (uint8_t **)_pp; + + FUNC_ENTER_STATIC_NOERR + + /* Sanity check */ + HDassert(value); + + if(NULL != *pp) { + /* Encode type sizes (as a safety check) */ + *(*pp)++ = (uint8_t)sizeof(unsigned); + + INT32ENCODE(*pp, (int32_t)config->version); + + H5_ENCODE_UNSIGNED(*pp, config->generate_image); + + H5_ENCODE_UNSIGNED(*pp, config->save_resize_status); + + INT32ENCODE(*pp, (int32_t)config->entry_ageout); + } /* end if */ + + /* Compute encoded size of fixed-size values */ + *size += (1 + (2 * sizeof(unsigned)) + (2 * sizeof(int32_t))); + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5P__facc_cache_image_config_enc() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__facc_cache_image_config_dec + * + * Purpose: Callback routine which is called whenever the default + * cache image config property in the file creation property + * list is decoded. + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: John Mainzer + * June 26, 2015 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__facc_cache_image_config_dec(const void **_pp, void *_value) +{ + H5AC_cache_image_config_t *config = (H5AC_cache_image_config_t *)_value; + const uint8_t **pp = (const uint8_t **)_pp; + unsigned enc_size; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity checks */ + HDassert(pp); + HDassert(*pp); + HDassert(config); + HDcompile_assert(sizeof(size_t) <= sizeof(uint64_t)); + + /* Set property to default value */ + HDmemcpy(config, &H5F_def_mdc_initCacheImageCfg_g, sizeof(H5AC_cache_image_config_t)); + + /* Decode type sizes */ + enc_size = *(*pp)++; + if(enc_size != sizeof(unsigned)) + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "unsigned value can't be decoded") + + INT32DECODE(*pp, config->version); + + H5_DECODE_UNSIGNED(*pp, config->generate_image); + + H5_DECODE_UNSIGNED(*pp, config->save_resize_status); + + INT32DECODE(*pp, config->entry_ageout); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__facc_cache_image_config_dec() */ + + +/*------------------------------------------------------------------------- * Function: H5P__facc_file_image_info_set * * Purpose: Copies a file image property when it's set for a property list diff --git a/src/H5Ppublic.h b/src/H5Ppublic.h index c736d7b..5aa8301 100644 --- a/src/H5Ppublic.h +++ b/src/H5Ppublic.h @@ -365,6 +365,8 @@ H5_DLL herr_t H5Pget_all_coll_metadata_ops(hid_t plist_id, hbool_t *is_collectiv H5_DLL herr_t H5Pset_coll_metadata_write(hid_t plist_id, hbool_t is_collective); H5_DLL herr_t H5Pget_coll_metadata_write(hid_t plist_id, hbool_t *is_collective); #endif /* H5_HAVE_PARALLEL */ +H5_DLL herr_t H5Pset_mdc_image_config(hid_t plist_id, H5AC_cache_image_config_t *config_ptr); +H5_DLL herr_t H5Pget_mdc_image_config(hid_t plist_id, H5AC_cache_image_config_t *config_ptr /*out*/); /* Dataset creation property list (DCPL) routines */ H5_DLL herr_t H5Pset_layout(hid_t plist_id, H5D_layout_t layout); diff --git a/src/H5SMpkg.h b/src/H5SMpkg.h index 3b13e23..342543d 100644 --- a/src/H5SMpkg.h +++ b/src/H5SMpkg.h @@ -256,8 +256,6 @@ H5FL_ARR_EXTERN(H5SM_index_header_t); H5FL_EXTERN(H5SM_list_t); H5FL_ARR_EXTERN(H5SM_sohm_t); -H5_DLLVAR const H5AC_class_t H5AC_SOHM_TABLE[1]; -H5_DLLVAR const H5AC_class_t H5AC_SOHM_LIST[1]; H5_DLLVAR const H5B2_class_t H5SM_INDEX[1]; /****************************/ diff --git a/src/H5win32defs.h b/src/H5win32defs.h index 63c3a16..b419f06 100644 --- a/src/H5win32defs.h +++ b/src/H5win32defs.h @@ -75,8 +75,8 @@ struct timezone { #if (_MSC_VER < 1900) struct timespec { - time_t tv_sec; // Seconds - >= 0 - long tv_nsec; // Nanoseconds - [0, 999999999] + time_t tv_sec; /* Seconds - >= 0 */ + long tv_nsec; /* Nanoseconds - [0, 999999999] */ }; #endif /* MSC_VER < 1900 */ diff --git a/src/Makefile.am b/src/Makefile.am index 939e151..69b54b4 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -46,7 +46,8 @@ libhdf5_la_SOURCES= H5.c H5checksum.c H5dbg.c H5system.c H5timer.c H5trace.c \ H5B.c H5Bcache.c H5Bdbg.c \ H5B2.c H5B2cache.c H5B2dbg.c H5B2hdr.c H5B2int.c H5B2internal.c \ H5B2leaf.c H5B2stat.c H5B2test.c \ - H5C.c H5Cdbg.c H5Cepoch.c H5Clog.c H5Cquery.c H5Ctag.c H5Ctest.c \ + H5C.c H5Cdbg.c H5Cepoch.c H5Cimage.c H5Clog.c H5Cprefetched.c \ + H5Cquery.c H5Ctag.c H5Ctest.c \ H5CS.c \ H5D.c H5Dbtree.c H5Dbtree2.c H5Dchunk.c H5Dcompact.c H5Dcontig.c H5Ddbg.c \ H5Ddeprec.c H5Dearray.c H5Defl.c H5Dfarray.c H5Dfill.c H5Dint.c \ @@ -81,7 +82,8 @@ libhdf5_la_SOURCES= H5.c H5checksum.c H5dbg.c H5system.c H5timer.c H5trace.c \ H5MF.c H5MFaggr.c H5MFdbg.c H5MFsection.c \ H5MM.c H5MP.c H5MPtest.c \ H5O.c H5Oainfo.c H5Oalloc.c H5Oattr.c \ - H5Oattribute.c H5Obogus.c H5Obtreek.c H5Ocache.c H5Ochunk.c \ + H5Oattribute.c H5Obogus.c H5Obtreek.c H5Ocache.c H5Ocache_image.c \ + H5Ochunk.c \ H5Ocont.c H5Ocopy.c H5Odbg.c H5Odrvinfo.c H5Odtype.c H5Oefl.c \ H5Ofill.c H5Oflush.c H5Ofsinfo.c H5Oginfo.c \ H5Olayout.c \ diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 8891af7..9657971 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 3.1.0) +cmake_minimum_required (VERSION 3.2.2) PROJECT (HDF5_TEST) #----------------------------------------------------------------------------- @@ -20,21 +20,23 @@ set (TEST_LIB_SOURCES ${HDF5_TEST_SOURCE_DIR}/h5test.c ${HDF5_TEST_SOURCE_DIR}/testframe.c ${HDF5_TEST_SOURCE_DIR}/cache_common.c + ${HDF5_TEST_SOURCE_DIR}/swmr_common.c ) set (TEST_LIB_HEADERS ${HDF5_TEST_SOURCE_DIR}/h5test.h ${HDF5_TEST_SOURCE_DIR}/cache_common.h + ${HDF5_TEST_SOURCE_DIR}/swmr_common.h ) add_library (${HDF5_TEST_LIB_TARGET} STATIC ${TEST_LIB_SOURCES} ${TEST_LIB_HEADERS}) TARGET_C_PROPERTIES (${HDF5_TEST_LIB_TARGET} STATIC " " " ") if (MSVC) target_link_libraries (${HDF5_TEST_LIB_TARGET} "ws2_32.lib") -endif (MSVC) +endif () if (MINGW) target_link_libraries (${HDF5_TEST_LIB_TARGET} "wsock32.lib") -endif (MINGW) +endif () target_link_libraries (${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET}) H5_SET_LIB_OPTIONS (${HDF5_TEST_LIB_TARGET} ${HDF5_TEST_LIB_NAME} STATIC) set_target_properties (${HDF5_TEST_LIB_TARGET} PROPERTIES @@ -47,10 +49,10 @@ if (BUILD_SHARED_LIBS) TARGET_C_PROPERTIES (${HDF5_TEST_LIBSH_TARGET} SHARED " " " ") if (MSVC) target_link_libraries (${HDF5_TEST_LIBSH_TARGET} "ws2_32.lib") - endif (MSVC) + endif () if (MINGW) target_link_libraries (${HDF5_TEST_LIBSH_TARGET} "wsock32.lib") - endif (MINGW) + endif () target_link_libraries (${HDF5_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) H5_SET_LIB_OPTIONS (${HDF5_TEST_LIBSH_TARGET} ${HDF5_TEST_LIB_NAME} SHARED ${HDF5_PACKAGE_SOVERSION}) set_target_properties (${HDF5_TEST_LIBSH_TARGET} PROPERTIES @@ -64,8 +66,8 @@ if (BUILD_SHARED_LIBS) APPEND PROPERTY COMPILE_DEFINITIONS "H5_HAVE_THREADSAFE" ) - endif (HDF5_ENABLE_THREADSAFE) -endif (BUILD_SHARED_LIBS) + endif () +endif () #----------------------------------------------------------------------------- # If plugin library tests can be tested @@ -110,7 +112,7 @@ endif (BUILD_SHARED_LIBS) "$" "${CMAKE_BINARY_DIR}/testdir1/$" ) - endforeach (test_lib ${TEST_PLUGIN_LIBS}) + endforeach () foreach (test_lib ${TEST2_PLUGIN_LIBS}) set (HDF5_TEST_PLUGIN_LIB_CORENAME "${test_lib}") @@ -136,7 +138,7 @@ endif (BUILD_SHARED_LIBS) "$" "${CMAKE_BINARY_DIR}/testdir2/$" ) - endforeach (test_lib ${TEST2_PLUGIN_LIBS}) + endforeach () set (testhdf5_SOURCES ${HDF5_TEST_SOURCE_DIR}/testhdf5.c @@ -178,7 +180,7 @@ if (BUILD_SHARED_LIBS) TARGET_C_PROPERTIES (testhdf5-shared SHARED " " " ") target_link_libraries (testhdf5-shared ${HDF5_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) set_target_properties (testhdf5-shared PROPERTIES FOLDER test) -endif (BUILD_SHARED_LIBS) +endif () MACRO (ADD_H5_EXE file) add_executable (${file} ${HDF5_TEST_SOURCE_DIR}/${file}.c) @@ -192,8 +194,8 @@ MACRO (ADD_H5_EXE file) TARGET_C_PROPERTIES (${file}-shared SHARED " " " ") target_link_libraries (${file}-shared ${HDF5_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) set_target_properties (${file}-shared PROPERTIES FOLDER test) - endif (BUILD_SHARED_LIBS) -ENDMACRO (ADD_H5_EXE file) + endif () +ENDMACRO () set (H5_TESTS cache @@ -223,6 +225,7 @@ set (H5_TESTS objcopy links unlink + twriteorder big mtime fillval @@ -253,15 +256,34 @@ set (H5_TESTS foreach (test ${H5_TESTS}) ADD_H5_EXE(${test}) -endforeach (test ${H5_TESTS}) +endforeach () set (H5_SWMR_TESTS + swmr_addrem_writer swmr_check_compat_vfd + swmr_generator + swmr_reader + swmr_remove_reader + swmr_remove_writer + swmr_sparse_reader + swmr_sparse_writer + swmr_start_write + swmr_writer ) foreach (test ${H5_SWMR_TESTS}) ADD_H5_EXE(${test}) -endforeach (test ${H5_SWMR_TESTS}) +endforeach () + +set (H5_VDS_SWMR_TESTS + vds_swmr_gen + vds_swmr_reader + vds_swmr_writer +) + +foreach (test ${H5_VDS_SWMR_TESTS}) + ADD_H5_EXE(${test}) +endforeach () ############################################################################## ############################################################################## @@ -269,6 +291,26 @@ endforeach (test ${H5_SWMR_TESTS}) ############################################################################## ############################################################################## +#-- Adding test for cache_image +add_executable (cache_image + ${HDF5_TEST_SOURCE_DIR}/cache_image.c + ${HDF5_TEST_SOURCE_DIR}/genall5.c +) +TARGET_NAMING (cache_image STATIC) +TARGET_C_PROPERTIES (cache_image STATIC " " " ") +target_link_libraries (cache_image ${HDF5_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) +set_target_properties (cache_image PROPERTIES FOLDER test) +if (BUILD_SHARED_LIBS) + add_executable (cache_image-shared + ${HDF5_TEST_SOURCE_DIR}/cache_image.c + ${HDF5_TEST_SOURCE_DIR}/genall5.c + ) + TARGET_NAMING (cache_image-shared SHARED) + TARGET_C_PROPERTIES (cache_image-shared SHARED " " " ") + target_link_libraries (cache_image-shared ${HDF5_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) + set_target_properties (cache_image-shared PROPERTIES FOLDER test) +endif () + #-- Adding test for hyperslab add_executable (hyperslab ${HDF5_TEST_SOURCE_DIR}/hyperslab.c) TARGET_NAMING (hyperslab STATIC) @@ -286,8 +328,8 @@ if (BUILD_SHARED_LIBS) APPEND PROPERTY COMPILE_DEFINITIONS "H5_HAVE_THREADSAFE" ) - endif (HDF5_ENABLE_THREADSAFE) -endif (BUILD_SHARED_LIBS) + endif () +endif () #-- Adding test for ttsafe add_executable (ttsafe @@ -318,21 +360,23 @@ if (BUILD_SHARED_LIBS) APPEND PROPERTY COMPILE_DEFINITIONS "H5_HAVE_THREADSAFE" ) - endif (HDF5_ENABLE_THREADSAFE) -endif (BUILD_SHARED_LIBS) + endif () +endif () set (H5_CHECK_TESTS error_test err_compat tcheck_version testmeta + atomic_writer + atomic_reader links_env flushrefresh ) foreach (test ${H5_CHECK_TESTS}) ADD_H5_EXE(${test}) -endforeach (test ${H5_CHECK_TESTS}) +endforeach () #-- Adding test for accum_swmr_reader # This has to be copied to the test directory for execve() to find it @@ -347,7 +391,7 @@ set_target_properties (accum_swmr_reader PROPERTIES FOLDER test) set_target_properties (accum PROPERTIES DEPENDS accum_swmr_reader) if (BUILD_SHARED_LIBS) set_target_properties (accum-shared PROPERTIES DEPENDS accum_swmr_reader) -endif (BUILD_SHARED_LIBS) +endif () #-- Adding test for libinfo set (GREP_RUNNER ${PROJECT_BINARY_DIR}/GrepRunner.cmake) @@ -355,9 +399,9 @@ file (WRITE ${GREP_RUNNER} "file (STRINGS \${TEST_PROGRAM} TEST_RESULT REGEX \"SUMMARY OF THE HDF5 CONFIGURATION\") if (\${TEST_RESULT} STREQUAL \"0\") message (FATAL_ERROR \"Failed: The output: \${TEST_RESULT} of \${TEST_PROGRAM} did not contain SUMMARY OF THE HDF5 CONFIGURATION\") -else (\${TEST_RESULT} STREQUAL \"0\") +else () message (STATUS \"COMMAND Result: \${TEST_RESULT}\") -endif (\${TEST_RESULT} STREQUAL \"0\") +endif () " ) @@ -370,12 +414,57 @@ if (BUILD_SHARED_LIBS) TARGET_C_PROPERTIES (plugin SHARED " " " ") target_link_libraries (plugin ${HDF5_TEST_LIB_TARGET}) set_target_properties (plugin PROPERTIES FOLDER test) -else (BUILD_SHARED_LIBS) +else () add_executable (plugin ${HDF5_TEST_SOURCE_DIR}/plugin.c) TARGET_NAMING (plugin STATIC) TARGET_C_PROPERTIES (plugin STATIC " " " ") target_link_libraries (plugin ${HDF5_TEST_LIB_TARGET}) set_target_properties (plugin PROPERTIES FOLDER test) -endif (BUILD_SHARED_LIBS) +endif () + +############################################################################## +### U S E C A S E S T E S T S +############################################################################## +set (use_append_chunk_SOURCES ${HDF5_TEST_SOURCE_DIR}/use_append_chunk.c ${HDF5_TEST_SOURCE_DIR}/use_common.c) +add_executable (use_append_chunk ${use_append_chunk_SOURCES}) +TARGET_NAMING (use_append_chunk STATIC) +TARGET_C_PROPERTIES (use_append_chunk STATIC " " " ") +target_link_libraries (use_append_chunk ${HDF5_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) +set_target_properties (use_append_chunk PROPERTIES FOLDER test) +if (BUILD_SHARED_LIBS) + add_executable (use_append_chunk-shared ${use_append_chunk_SOURCES}) + TARGET_NAMING (use_append_chunk-shared SHARED) + TARGET_C_PROPERTIES (use_append_chunk-shared SHARED " " " ") + target_link_libraries (use_append_chunk-shared ${HDF5_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) + set_target_properties (use_append_chunk-shared PROPERTIES FOLDER test) +endif () + +set (use_append_mchunks_SOURCES ${HDF5_TEST_SOURCE_DIR}/use_append_mchunks.c ${HDF5_TEST_SOURCE_DIR}/use_common.c) +add_executable (use_append_mchunks ${use_append_mchunks_SOURCES}) +TARGET_NAMING (use_append_mchunks STATIC) +TARGET_C_PROPERTIES (use_append_mchunks STATIC " " " ") +target_link_libraries (use_append_mchunks ${HDF5_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) +set_target_properties (use_append_mchunks PROPERTIES FOLDER test) +if (BUILD_SHARED_LIBS) + add_executable (use_append_mchunks-shared ${use_append_mchunks_SOURCES}) + TARGET_NAMING (use_append_mchunks-shared SHARED) + TARGET_C_PROPERTIES (use_append_mchunks-shared SHARED " " " ") + target_link_libraries (use_append_mchunks-shared ${HDF5_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) + set_target_properties (use_append_mchunks-shared PROPERTIES FOLDER test) +endif () + +set (use_disable_mdc_flushes_SOURCES ${HDF5_TEST_SOURCE_DIR}/use_disable_mdc_flushes.c) +add_executable (use_disable_mdc_flushes ${use_disable_mdc_flushes_SOURCES}) +TARGET_NAMING (use_disable_mdc_flushes STATIC) +TARGET_C_PROPERTIES (use_disable_mdc_flushes STATIC " " " ") +target_link_libraries (use_disable_mdc_flushes ${HDF5_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) +set_target_properties (use_disable_mdc_flushes PROPERTIES FOLDER test) +if (BUILD_SHARED_LIBS) + add_executable (use_disable_mdc_flushes-shared ${use_disable_mdc_flushes_SOURCES}) + TARGET_NAMING (use_disable_mdc_flushes-shared SHARED) + TARGET_C_PROPERTIES (use_disable_mdc_flushes-shared SHARED " " " ") + target_link_libraries (use_disable_mdc_flushes-shared ${HDF5_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) + set_target_properties (use_disable_mdc_flushes-shared PROPERTIES FOLDER test) +endif () include (CMakeTests.cmake) diff --git a/test/CMakeTests.cmake b/test/CMakeTests.cmake index 5b3d0bf..fc8587b 100644 --- a/test/CMakeTests.cmake +++ b/test/CMakeTests.cmake @@ -13,7 +13,7 @@ if (BUILD_SHARED_LIBS) file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/H5TEST-shared") file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/H5TEST-shared/testfiles") file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/H5TEST-shared/testfiles/plist_files") -endif (BUILD_SHARED_LIBS) +endif () if (HDF5_TEST_VFD) set (VFD_LIST @@ -27,14 +27,14 @@ if (HDF5_TEST_VFD) ) if (DIRECT_VFD) set (VFD_LIST ${VFD_LIST} direct) - endif (DIRECT_VFD) + endif () foreach (vfdtest ${VFD_LIST}) file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/${vfdtest}") #if (BUILD_SHARED_LIBS) # file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/${vfdtest}-shared") - #endif (BUILD_SHARED_LIBS) - endforeach (vfdtest ${VFD_LIST}) -endif (HDF5_TEST_VFD) + #endif () + endforeach () +endif () # -------------------------------------------------------------------- # Copy all the HDF5 files from the source directory into the test directory @@ -56,24 +56,24 @@ if (BUILD_SHARED_LIBS) COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different "$" "${PROJECT_BINARY_DIR}/H5TEST-shared/accum_swmr_reader" ) -endif (BUILD_SHARED_LIBS) +endif () foreach (h5_tfile ${HDF5_TEST_FILES}) HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/${h5_tfile}" "${PROJECT_BINARY_DIR}/H5TEST/${h5_tfile}" "HDF5_TEST_LIB_files") if (BUILD_SHARED_LIBS) HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/${h5_tfile}" "${PROJECT_BINARY_DIR}/H5TEST-shared/${h5_tfile}" "HDF5_TEST_LIBSH_files") - endif (BUILD_SHARED_LIBS) -endforeach (h5_tfile ${HDF5_TEST_FILES}) + endif () +endforeach () if (HDF5_TEST_VFD) foreach (vfdtest ${VFD_LIST}) foreach (h5_tfile ${HDF5_TEST_FILES}) HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/${h5_tfile}" "${PROJECT_BINARY_DIR}/${vfdtest}/${h5_tfile}" "HDF5_TEST_LIB_files") if (BUILD_SHARED_LIBS) HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/${h5_tfile}" "${PROJECT_BINARY_DIR}/${vfdtest}-shared/${h5_tfile}" "HDF5_TEST_LIBSH_files") - endif (BUILD_SHARED_LIBS) - endforeach (h5_tfile ${HDF5_TEST_FILES}) - endforeach (vfdtest ${VFD_LIST}) -endif (HDF5_TEST_VFD) + endif () + endforeach () + endforeach () +endif () # -------------------------------------------------------------------- # Copy all the HDF5 files from the test directory into the source directory @@ -90,18 +90,18 @@ foreach (ref_file ${HDF5_REFERENCE_FILES}) HDFTEST_COPY_FILE("${HDF5_TEST_SOURCE_DIR}/testfiles/${ref_file}" "${PROJECT_BINARY_DIR}/H5TEST/${ref_file}" "HDF5_TEST_LIB_files") if (BUILD_SHARED_LIBS) HDFTEST_COPY_FILE("${HDF5_TEST_SOURCE_DIR}/testfiles/${ref_file}" "${PROJECT_BINARY_DIR}/H5TEST-shared/${ref_file}" "HDF5_TEST_LIBSH_files") - endif (BUILD_SHARED_LIBS) -endforeach (ref_file ${HDF5_REFERENCE_FILES}) + endif () +endforeach () if (HDF5_TEST_VFD) foreach (vfdtest ${VFD_LIST}) foreach (ref_file ${HDF5_REFERENCE_FILES}) HDFTEST_COPY_FILE("${HDF5_TEST_SOURCE_DIR}/testfiles/${ref_file}" "${PROJECT_BINARY_DIR}/${vfdtest}/${ref_file}" "HDF5_TEST_LIB_files") if (BUILD_SHARED_LIBS) HDFTEST_COPY_FILE("${HDF5_TEST_SOURCE_DIR}/testfiles/${ref_file}" "${PROJECT_BINARY_DIR}/${vfdtest}-shared/${ref_file}" "HDF5_TEST_LIBSH_files") - endif (BUILD_SHARED_LIBS) - endforeach (ref_file ${HDF5_REFERENCE_FILES}) - endforeach (vfdtest ${VFD_LIST}) -endif (HDF5_TEST_VFD) + endif () + endforeach () + endforeach () +endif () # -------------------------------------------------------------------- # Copy test files from test/testfiles/plist_files dir to test dir @@ -163,8 +163,8 @@ foreach (plistfile ${HDF5_REFERENCE_PLIST_FILES}) if (BUILD_SHARED_LIBS) HDFTEST_COPY_FILE("${HDF5_TEST_SOURCE_DIR}/testfiles/plist_files/${plistfile}" "${PROJECT_BINARY_DIR}/H5TEST-shared/testfiles/plist_files/${plistfile}" "HDF5_TEST_LIBSH_files") HDFTEST_COPY_FILE("${HDF5_TEST_SOURCE_DIR}/testfiles/plist_files/def_${plistfile}" "${PROJECT_BINARY_DIR}/H5TEST-shared/testfiles/plist_files/def_${plistfile}" "HDF5_TEST_LIBSH_files") - endif (BUILD_SHARED_LIBS) -endforeach (plistfile ${HDF5_REFERENCE_PLIST_FILES}) + endif () +endforeach () # -------------------------------------------------------------------- #-- Copy all the HDF5 files from the test directory into the source directory @@ -212,22 +212,22 @@ foreach (h5_file ${HDF5_REFERENCE_TEST_FILES}) HDFTEST_COPY_FILE("${HDF5_TEST_SOURCE_DIR}/${h5_file}" "${HDF5_TEST_BINARY_DIR}/H5TEST/${h5_file}" "HDF5_TEST_LIB_files") if (BUILD_SHARED_LIBS) HDFTEST_COPY_FILE("${HDF5_TEST_SOURCE_DIR}/${h5_file}" "${HDF5_TEST_BINARY_DIR}/H5TEST-shared/${h5_file}" "HDF5_TEST_LIBSH_files") - endif (BUILD_SHARED_LIBS) -endforeach (h5_file ${HDF5_REFERENCE_TEST_FILES}) + endif () +endforeach () if (HDF5_TEST_VFD) foreach (vfdtest ${VFD_LIST}) foreach (h5_file ${HDF5_REFERENCE_TEST_FILES}) HDFTEST_COPY_FILE("${HDF5_TEST_SOURCE_DIR}/${h5_file}" "${HDF5_TEST_BINARY_DIR}/${vfdtest}/${h5_file}" "HDF5_TEST_LIB_files") if (BUILD_SHARED_LIBS) HDFTEST_COPY_FILE("${HDF5_TEST_SOURCE_DIR}/${h5_file}" "${HDF5_TEST_BINARY_DIR}/${vfdtest}-shared/${h5_file}" "HDF5_TEST_LIBSH_files") - endif (BUILD_SHARED_LIBS) - endforeach (h5_file ${HDF5_REFERENCE_TEST_FILES}) - endforeach (vfdtest ${VFD_LIST}) -endif (HDF5_TEST_VFD) + endif () + endforeach () + endforeach () +endif () add_custom_target(HDF5_TEST_LIB_files ALL COMMENT "Copying files needed by HDF5_TEST_LIB tests" DEPENDS ${HDF5_TEST_LIB_files_list}) if (BUILD_SHARED_LIBS) add_custom_target(HDF5_TEST_LIBSH_files ALL COMMENT "Copying files needed by HDF5_TEST_LIBSH tests" DEPENDS ${HDF5_TEST_LIBSH_files_list}) -endif() +endif () # Remove any output file left over from previous test run add_test (NAME H5TEST-clear-testhdf5-objects @@ -279,8 +279,17 @@ if (HDF5_ENABLE_USING_MEMCHECKER) ENVIRONMENT "HDF5_ALARM_SECONDS=3600;srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) -else (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5TEST-testhdf5 COMMAND $) +else () + add_test (NAME H5TEST-testhdf5 COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$" + -D "TEST_ARGS:STRING=" + -D "TEST_EXPECT=0" + -D "TEST_SKIP_COMPARE=TRUE" + -D "TEST_OUTPUT=testhdf5.txt" + #-D "TEST_REFERENCE=testhdf5.out" + -D "TEST_FOLDER=${HDF5_TEST_BINARY_DIR}/H5TEST" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) set_tests_properties (H5TEST-testhdf5 PROPERTIES DEPENDS H5TEST-clear-testhdf5-objects ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST" @@ -310,14 +319,23 @@ else (HDF5_ENABLE_USING_MEMCHECKER) WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST-shared ) - add_test (NAME H5TEST-shared-testhdf5 COMMAND $) + add_test (NAME H5TEST-shared-testhdf5 COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$" + -D "TEST_ARGS:STRING=" + -D "TEST_EXPECT=0" + -D "TEST_SKIP_COMPARE=TRUE" + -D "TEST_OUTPUT=testhdf5.txt" + #-D "TEST_REFERENCE=testhdf5.out" + -D "TEST_FOLDER=${HDF5_TEST_BINARY_DIR}/H5TEST-shared" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) set_tests_properties (H5TEST-shared-testhdf5 PROPERTIES DEPENDS H5TEST-shared-clear-testhdf5-objects ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST-shared" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST-shared ) - endif (BUILD_SHARED_LIBS) -endif (HDF5_ENABLE_USING_MEMCHECKER) + endif () +endif () ############################################################################## ############################################################################## @@ -346,6 +364,10 @@ set (test_CLEANFILES layout_extend.h5 zero_chunk.h5 chunk_single.h5 + swmr_non_latest.h5 + earray_hdr_fd.h5 + farray_hdr_fd.h5 + bt2_hdr_fd.h5 storage_size.h5 dls_01_strings.h5 extend.h5 @@ -439,6 +461,7 @@ set (test_CLEANFILES tvltypes.h5 tvlstr.h5 tvlstr2.h5 + twriteorder.dat flush.h5 flush-swmr.h5 noflush.h5 @@ -514,16 +537,24 @@ set (test_CLEANFILES vds_dapl.h5 vds_src_0.h5 vds_src_1.h5 + swmr_data.h5 + use_use_append_chunk.h5 + use_append_mchunks.h5 + use_disable_mdc_flushes.h5 tbogus.h5.copy flushrefresh.h5 flushrefresh_VERIFICATION_START flushrefresh_VERIFICATION_CHECKPOINT1 flushrefresh_VERIFICATION_CHECKPOINT2 flushrefresh_VERIFICATION_DONE + atomic_data accum_swmr_big.h5 ohdr_swmr.h5 + test_swmr*.h5 cache_logging.h5 cache_logging.out + vds_swmr.h5 + vds_swmr_src_*.h5 ) # Remove any output file left over from previous test run @@ -565,6 +596,7 @@ set (H5TEST_TESTS objcopy links unlink + twriteorder big mtime fillval @@ -595,19 +627,37 @@ set (H5TEST_TESTS ) foreach (test ${H5TEST_TESTS}) - if (${test} STREQUAL "big" AND CYGWIN) - add_test (NAME H5TEST-${test} - COMMAND ${CMAKE_COMMAND} -E echo "SKIP ${test}" - ) - else (${test} STREQUAL "big" AND CYGWIN) + if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME H5TEST-${test} COMMAND $) - endif (${test} STREQUAL "big" AND CYGWIN) - set_tests_properties (H5TEST-${test} PROPERTIES - DEPENDS H5TEST-clear-objects - ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST" - WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST - ) -endforeach (test ${H5TEST_TESTS}) + set_tests_properties (H5TEST-${test} PROPERTIES + DEPENDS H5TEST-clear-objects + ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST" + WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST + ) + else () + if (${test} STREQUAL "big" AND CYGWIN) + add_test (NAME H5TEST-${test} + COMMAND ${CMAKE_COMMAND} -E echo "SKIP ${test}" + ) + else () + add_test (NAME H5TEST-${test} COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$" + -D "TEST_ARGS:STRING=" + -D "TEST_EXPECT=0" + -D "TEST_SKIP_COMPARE=TRUE" + -D "TEST_OUTPUT=${test}.txt" + #-D "TEST_REFERENCE=${test}.out" + -D "TEST_FOLDER=${HDF5_TEST_BINARY_DIR}/H5TEST" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) + endif () + set_tests_properties (H5TEST-${test} PROPERTIES + DEPENDS H5TEST-clear-objects + ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST" + WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST + ) + endif () +endforeach () set_tests_properties (H5TEST-flush2 PROPERTIES DEPENDS H5TEST-flush1) set_tests_properties (H5TEST-fheap PROPERTIES TIMEOUT 1800) @@ -630,22 +680,31 @@ if (BUILD_SHARED_LIBS) add_test (NAME H5TEST-shared-${test} COMMAND ${CMAKE_COMMAND} -E echo "SKIP ${test}-shared" ) - else (${test} STREQUAL "big" AND CYGWIN) - add_test (NAME H5TEST-shared-${test} COMMAND $) - endif (${test} STREQUAL "big" AND CYGWIN) + else () + add_test (NAME H5TEST-shared-${test} COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$" + -D "TEST_ARGS:STRING=" + -D "TEST_EXPECT=0" + -D "TEST_SKIP_COMPARE=TRUE" + -D "TEST_OUTPUT=${test}.txt" + #-D "TEST_REFERENCE=${test}.out" + -D "TEST_FOLDER=${HDF5_TEST_BINARY_DIR}/H5TEST-shared" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) + endif () set_tests_properties (H5TEST-shared-${test} PROPERTIES DEPENDS H5TEST-shared-clear-objects ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST-shared" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST-shared ) - endforeach (test ${H5TEST_TESTS}) + endforeach () set_tests_properties (H5TEST-shared-flush2 PROPERTIES DEPENDS H5TEST-shared-flush1) set_tests_properties (H5TEST-shared-fheap PROPERTIES TIMEOUT 1800) set_tests_properties (H5TEST-shared-big PROPERTIES TIMEOUT 1800) set_tests_properties (H5TEST-shared-btree2 PROPERTIES TIMEOUT 1800) set_tests_properties (H5TEST-shared-objcopy PROPERTIES TIMEOUT 1800) -endif (BUILD_SHARED_LIBS) +endif () ############################################################################## ############################################################################## @@ -662,14 +721,43 @@ if (NOT CYGWIN) WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) - add_test (NAME H5TEST-cache COMMAND $) + if (HDF5_ENABLE_USING_MEMCHECKER) + add_test (NAME H5TEST-cache COMMAND $) + else () + add_test (NAME H5TEST-cache COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$" + -D "TEST_ARGS:STRING=" + -D "TEST_EXPECT=0" + -D "TEST_SKIP_COMPARE=TRUE" + -D "TEST_OUTPUT=cache.txt" + #-D "TEST_REFERENCE=cache.out" + -D "TEST_FOLDER=${HDF5_TEST_BINARY_DIR}/H5TEST" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) + endif () set_tests_properties (H5TEST-cache PROPERTIES DEPENDS H5TEST-clear-cache-objects ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST;HDF5TestExpress=${HDF_TEST_EXPRESS}" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) set_tests_properties (H5TEST-cache PROPERTIES TIMEOUT 1800) -endif (NOT CYGWIN) +endif () + +#-- Adding test for cache_image +add_test ( + NAME H5TEST-clear-cache_image-objects + COMMAND ${CMAKE_COMMAND} + -E remove + cache_image_test.h5 + WORKING_DIRECTORY + ${HDF5_TEST_BINARY_DIR}/H5TEST +) +add_test (NAME H5TEST-cache_image COMMAND $) +set_tests_properties (H5TEST-cache_image PROPERTIES + DEPENDS H5TEST-clear-cache_image-objects + ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST" + WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST +) #-- Adding test for err_compat if (HDF5_ENABLE_DEPRECATED_SYMBOLS) @@ -696,7 +784,7 @@ if (HDF5_ENABLE_DEPRECATED_SYMBOLS) ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) -endif (HDF5_ENABLE_DEPRECATED_SYMBOLS) +endif () #-- Adding test for error_test add_test (NAME H5TEST-clear-error_test-objects @@ -761,7 +849,7 @@ add_test (NAME H5TEST-testlibinfo if (BUILD_SHARED_LIBS) #-- Adding test for cache - if (NOT CYGWIN) + if (NOT CYGWIN AND NOT WIN32) add_test (NAME H5TEST-shared-clear-cache-objects COMMAND ${CMAKE_COMMAND} -E remove @@ -769,14 +857,27 @@ if (BUILD_SHARED_LIBS) WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST-shared ) - add_test (NAME H5TEST-shared-cache COMMAND $) + if (HDF5_ENABLE_USING_MEMCHECKER) + add_test (NAME H5TEST-shared-cache COMMAND $) + else () + add_test (NAME H5TEST-shared-cache COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$" + -D "TEST_ARGS:STRING=" + -D "TEST_EXPECT=0" + -D "TEST_SKIP_COMPARE=TRUE" + -D "TEST_OUTPUT=cache-shared.txt" + #-D "TEST_REFERENCE=cache-shared.out" + -D "TEST_FOLDER=${HDF5_TEST_BINARY_DIR}/H5TEST-shared" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) + endif () set_tests_properties (H5TEST-shared-cache PROPERTIES DEPENDS H5TEST-shared-clear-cache-objects ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST-shared;HDF5TestExpress=${HDF_TEST_EXPRESS}" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST-shared ) set_tests_properties (H5TEST-shared-cache PROPERTIES TIMEOUT 1800) - endif (NOT CYGWIN) + endif () #-- Adding test for err_compat if (HDF5_ENABLE_DEPRECATED_SYMBOLS) @@ -803,7 +904,7 @@ if (BUILD_SHARED_LIBS) ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST-shared" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST-shared ) - endif (HDF5_ENABLE_DEPRECATED_SYMBOLS) + endif () #-- Adding test for error_test add_test (NAME H5TEST-shared-clear-error_test-objects @@ -865,16 +966,16 @@ if (BUILD_SHARED_LIBS) WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST-shared ) -endif (BUILD_SHARED_LIBS) +endif () ############################################################################## ### P L U G I N T E S T S ############################################################################## if (WIN32) set (CMAKE_SEP "\;") -else (WIN32) +else () set (CMAKE_SEP ":") -endif (WIN32) +endif () add_test (NAME H5PLUGIN-plugin COMMAND $) set_tests_properties (H5PLUGIN-plugin PROPERTIES @@ -886,6 +987,9 @@ set_tests_properties (H5PLUGIN-plugin PROPERTIES ### S W M R T E S T S ############################################################################## # testflushrefresh.sh: flushrefresh +# test_usecases.sh: use_append_chunk, use_append_mchunks, use_disable_mdc_flushes +# testswmr.sh: swmr* +# testvdsswmr.sh: vds_swmr* ############################################################################## ############################################################################## @@ -953,9 +1057,10 @@ if (HDF5_TEST_VFD) ) if (NOT CYGWIN) set (H5_VFD_TESTS ${H5_VFD_TESTS} big cache) - endif (NOT CYGWIN) + endif () - MACRO (CHECK_VFD_TEST vfdtest vfdname resultcode) + # Windows only macro + macro (CHECK_VFD_TEST vfdtest vfdname resultcode) if (${vfdtest} STREQUAL "flush1" OR ${vfdtest} STREQUAL "flush2") if (${vfdname} STREQUAL "multi" OR ${vfdname} STREQUAL "split") if (NOT BUILD_SHARED_LIBS AND NOT CMAKE_BUILD_TYPE MATCHES Debug) @@ -988,8 +1093,8 @@ if (HDF5_TEST_VFD) ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/${vfdname}-shared" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/${vfdname}-shared ) - endif (BUILD_SHARED_LIBS) - else (NOT BUILD_SHARED_LIBS AND NOT CMAKE_BUILD_TYPE MATCHES Debug) + endif () + else () add_test (NAME VFD-${vfdname}-${vfdtest} COMMAND ${CMAKE_COMMAND} -E echo "SKIP VFD-${vfdname}-${vfdtest}" ) @@ -997,9 +1102,9 @@ if (HDF5_TEST_VFD) add_test (NAME VFD-${vfdname}-${test}-shared COMMAND ${CMAKE_COMMAND} -E echo "SKIP VFD-${vfdname}-${vfdtest}-shared" ) - endif (BUILD_SHARED_LIBS) - endif(NOT BUILD_SHARED_LIBS AND NOT CMAKE_BUILD_TYPE MATCHES Debug) - else (${vfdname} STREQUAL "multi" OR ${vfdname} STREQUAL "split") + endif () + endif () + else () add_test (NAME VFD-${vfdname}-${vfdtest} COMMAND "${CMAKE_COMMAND}" -D "TEST_PROGRAM=$" @@ -1029,9 +1134,9 @@ if (HDF5_TEST_VFD) ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/${vfdname}-shared" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/${vfdname}-shared ) - endif (BUILD_SHARED_LIBS) - endif (${vfdname} STREQUAL "multi" OR ${vfdname} STREQUAL "split") - else (${vfdtest} STREQUAL "flush1" OR ${vfdtest} STREQUAL "flush2") + endif () + endif () + else () add_test (NAME VFD-${vfdname}-${vfdtest} COMMAND "${CMAKE_COMMAND}" -D "TEST_PROGRAM=$" @@ -1046,7 +1151,7 @@ if (HDF5_TEST_VFD) ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/${vfdname};HDF5TestExpress=${HDF_TEST_EXPRESS}" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/${vfdname} ) - if (BUILD_SHARED_LIBS) + if (BUILD_SHARED_LIBS AND NOT ${vfdtest} STREQUAL "cache") add_test (NAME VFD-${vfdname}-${vfdtest}-shared COMMAND "${CMAKE_COMMAND}" -D "TEST_PROGRAM=$" @@ -1061,15 +1166,15 @@ if (HDF5_TEST_VFD) ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/${vfdname}-shared;HDF5TestExpress=${HDF_TEST_EXPRESS}" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/${vfdname}-shared ) - endif (BUILD_SHARED_LIBS) - endif (${vfdtest} STREQUAL "flush1" OR ${vfdtest} STREQUAL "flush2") - ENDMACRO (CHECK_VFD_TEST vfdtest vfdname resultcode) + endif () + endif () + endmacro () - MACRO (ADD_VFD_TEST vfdname resultcode) + macro (ADD_VFD_TEST vfdname resultcode) foreach (test ${H5_VFD_TESTS}) if (WIN32) CHECK_VFD_TEST (${test} ${vfdname} ${resultcode}) - else (WIN32) + else () add_test (NAME VFD-${vfdname}-${test} COMMAND "${CMAKE_COMMAND}" -D "TEST_PROGRAM=$" @@ -1099,25 +1204,25 @@ if (HDF5_TEST_VFD) ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/${vfdname}-shared" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/${vfdname}-shared ) - endif (BUILD_SHARED_LIBS) - endif (WIN32) - endforeach (test ${H5_VFD_TESTS}) + endif () + endif () + endforeach () set_tests_properties (VFD-${vfdname}-flush2 PROPERTIES DEPENDS VFD-${vfdname}-flush1) set_tests_properties (VFD-${vfdname}-flush1 PROPERTIES TIMEOUT 10) set_tests_properties (VFD-${vfdname}-flush2 PROPERTIES TIMEOUT 10) set_tests_properties (VFD-${vfdname}-istore PROPERTIES TIMEOUT 1800) if (NOT CYGWIN) set_tests_properties (VFD-${vfdname}-cache PROPERTIES TIMEOUT 1800) - endif (NOT CYGWIN) + endif () if (BUILD_SHARED_LIBS) set_tests_properties (VFD-${vfdname}-flush2-shared PROPERTIES DEPENDS VFD-${vfdname}-flush1-shared) set_tests_properties (VFD-${vfdname}-flush1-shared PROPERTIES TIMEOUT 10) set_tests_properties (VFD-${vfdname}-flush2-shared PROPERTIES TIMEOUT 10) set_tests_properties (VFD-${vfdname}-istore-shared PROPERTIES TIMEOUT 1800) - if (NOT CYGWIN) + if (NOT CYGWIN AND NOT WIN32) set_tests_properties (VFD-${vfdname}-cache-shared PROPERTIES TIMEOUT 1800) - endif (NOT CYGWIN) - endif (BUILD_SHARED_LIBS) + endif () + endif () if (HDF5_TEST_FHEAP_VFD) add_test (NAME VFD-${vfdname}-fheap COMMAND "${CMAKE_COMMAND}" @@ -1150,16 +1255,16 @@ if (HDF5_TEST_VFD) ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/${vfdname}-shared;HDF5TestExpress=${HDF_TEST_EXPRESS}" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/${vfdname}-shared ) - endif (BUILD_SHARED_LIBS) - endif (HDF5_TEST_FHEAP_VFD) - ENDMACRO (ADD_VFD_TEST) + endif () + endif () + endmacro () # Run test with different Virtual File Driver foreach (vfd ${VFD_LIST}) ADD_VFD_TEST (${vfd} 0) - endforeach (vfd ${VFD_LIST}) + endforeach () -endif (HDF5_TEST_VFD) +endif () ############################################################################## ############################################################################## @@ -1168,13 +1273,13 @@ endif (HDF5_TEST_VFD) ############################################################################## if (HDF5_BUILD_GENERATORS) - MACRO (ADD_H5_GENERATOR genfile) + macro (ADD_H5_GENERATOR genfile) add_executable (${genfile} ${HDF5_TEST_SOURCE_DIR}/${genfile}.c) TARGET_NAMING (${genfile} STATIC) TARGET_C_PROPERTIES (${genfile} STATIC " " " ") target_link_libraries (${genfile} ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET}) set_target_properties (${genfile} PROPERTIES FOLDER generator/test) - ENDMACRO (ADD_H5_GENERATOR genfile) + endmacro () # generator executables set (H5_GENERATORS @@ -1183,6 +1288,7 @@ if (HDF5_BUILD_GENERATORS) gen_cross gen_deflate gen_filters + gen_idx gen_new_array gen_new_fill gen_new_group @@ -1201,6 +1307,6 @@ if (HDF5_BUILD_GENERATORS) foreach (gen ${H5_GENERATORS}) ADD_H5_GENERATOR (${gen}) - endforeach (gen ${H5_GENERATORS}) + endforeach () -endif (HDF5_BUILD_GENERATORS) +endif () diff --git a/test/Makefile.am b/test/Makefile.am index 37883c4..98cfc42 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -29,10 +29,17 @@ AM_CPPFLAGS+=-I$(top_srcdir)/src -I$(top_builddir)/src # testcheck_version.sh: tcheck_version # tetlinks_env.sh: links_env # testflushrefresh.sh: flushrefresh +# test_usecases.sh: use_append_chunk, use_append_mchunks, use_disable_mdc_flushes +# testswmr.sh: swmr* +# testvdsswmr.sh: vds_swmr* TEST_SCRIPT = testerror.sh testlibinfo.sh testcheck_version.sh testlinks_env.sh \ - testflushrefresh.sh + testswmr.sh testvdsswmr.sh testflushrefresh.sh test_usecases.sh SCRIPT_DEPEND = error_test$(EXEEXT) err_compat$(EXEEXT) links_env$(EXEEXT) \ - testflushrefresh.sh + flushrefresh$(EXEEXT) use_append_chunk$(EXEEXT) use_append_mchunks$(EXEEXT) use_disable_mdc_flushes$(EXEEXT) \ + swmr_generator$(EXEEXT) swmr_reader$(EXEEXT) swmr_writer$(EXEEXT) \ + swmr_remove_reader$(EXEEXT) swmr_remove_writer$(EXEEXT) swmr_addrem_writer$(EXEEXT) \ + swmr_sparse_reader$(EXEEXT) swmr_sparse_writer$(EXEEXT) swmr_start_write$(EXEEXT) \ + vds_swmr_gen$(EXEEXT) vds_swmr_reader$(EXEEXT) vds_swmr_writer$(EXEEXT) if HAVE_SHARED_CONDITIONAL TEST_SCRIPT += test_plugin.sh SCRIPT_DEPEND += plugin$(EXEEXT) @@ -44,11 +51,12 @@ check_SCRIPTS = $(TEST_SCRIPT) # executed, generally most specific tests to least specific tests. # As an exception, long-running tests should occur earlier in the list. # This gives them more time to run when tests are executing in parallel. -TEST_PROG= testhdf5 cache cache_api cache_tagging lheap ohdr stab gheap \ +TEST_PROG= testhdf5 \ + cache cache_api cache_image cache_tagging lheap ohdr stab gheap \ evict_on_close farray earray btree2 fheap \ pool accum hyperslab istore bittests dt_arith \ dtypes dsets cmpd_dset filter_fail extend external efc objcopy links unlink \ - big mtime fillval mount flush1 flush2 app_ref enum \ + twriteorder big mtime fillval mount flush1 flush2 app_ref enum \ set_extent ttsafe enc_dec_plist enc_dec_plist_cross_platform\ getname vfd ntypes dangle dtransform reserved cross_read \ freespace mf vds file_image unregister cache_logging cork swmr @@ -57,15 +65,21 @@ TEST_PROG= testhdf5 cache cache_api cache_tagging lheap ohdr stab gheap \ # error_test and err_compat are built at the same time as the other tests, but executed by testerror.sh. # tcheck_version is used by testcheck_version.sh. # accum_swmr_reader is used by accum.c. +# atomic_writer and atomic_reader are standalone programs. # links_env is used by testlinks_env.sh # flushrefresh is used by testflushrefresh.sh. +# use_append_chunk, use_append_mchunks and use_disable_mdc_flushes are used by test_usecases.sh +# swmr_* files (besides swmr.c) are used by testswmr.sh. +# vds_swmr_* files are used by testvdsswmr.sh # 'make check' doesn't run them directly, so they are not included in TEST_PROG. # Also build testmeta, which is used for timings test. It builds quickly, # and this lets automake keep all its test programs in one place. check_PROGRAMS=$(TEST_PROG) error_test err_compat tcheck_version \ - testmeta accum_swmr_reader \ - links_env flushrefresh \ - swmr_check_compat_vfd + testmeta accum_swmr_reader atomic_writer atomic_reader \ + links_env flushrefresh use_append_chunk use_append_mchunks use_disable_mdc_flushes \ + swmr_generator swmr_start_write swmr_reader swmr_writer swmr_remove_reader \ + swmr_remove_writer swmr_addrem_writer swmr_sparse_reader swmr_sparse_writer \ + swmr_check_compat_vfd vds_swmr_gen vds_swmr_reader vds_swmr_writer if HAVE_SHARED_CONDITIONAL check_PROGRAMS+= plugin endif @@ -77,7 +91,7 @@ endif # --enable-build-all at configure time. # The gen_old_* files can only be compiled with older versions of the library # so do not appear in this list. -BUILD_ALL_PROGS=gen_bad_ohdr gen_bogus gen_cross gen_deflate gen_filters gen_new_array \ +BUILD_ALL_PROGS=gen_bad_ohdr gen_bogus gen_cross gen_deflate gen_filters gen_idx gen_new_array \ gen_new_fill gen_new_group gen_new_mtime gen_new_super gen_noencoder \ gen_nullspace gen_udlinks space_overflow gen_filespace gen_specmetaread \ gen_sizes_lheap gen_file_image gen_plist @@ -106,7 +120,7 @@ else noinst_LTLIBRARIES=libh5test.la endif -libh5test_la_SOURCES=h5test.c testframe.c cache_common.c +libh5test_la_SOURCES=h5test.c testframe.c cache_common.c swmr_common.c # Use libhd5test.la to compile all of the tests LDADD=libh5test.la $(LIBHDF5) @@ -114,6 +128,7 @@ LDADD=libh5test.la $(LIBHDF5) # List the source files for tests that have more than one ttsafe_SOURCES=ttsafe.c ttsafe_dcreate.c ttsafe_error.c ttsafe_cancel.c \ ttsafe_acreate.c +cache_image_SOURCES=cache_image.c genall5.c VFD_LIST = sec2 stdio core core_paged split multi family if DIRECT_VFD_CONDITIONAL @@ -153,7 +168,7 @@ CHECK_CLEANFILES+=accum.h5 cmpd_dset.h5 compact_dataset.h5 dataset.h5 dset_offse stdio.h5 sec2.h5 dtypes[0-9].h5 dtypes1[0].h5 dt_arith[1-2].h5 tattr.h5 \ tselect.h5 mtime.h5 unlink.h5 unicode.h5 coord.h5 \ fillval_[0-9].h5 fillval.raw mount_[0-9].h5 testmeta.h5 ttime.h5 \ - trefer[1-3].h5 tvltypes.h5 tvlstr.h5 tvlstr2.h5 \ + trefer[1-3].h5 tvltypes.h5 tvlstr.h5 tvlstr2.h5 twriteorder.dat \ flush.h5 flush-swmr.h5 noflush.h5 noflush-swmr.h5 flush_extend.h5 \ flush_extend-swmr.h5 noflush_extend.h5 noflush_extend-swmr.h5 \ enum1.h5 titerate.h5 ttsafe.h5 tarray1.h5 tgenprop.h5 \ @@ -170,19 +185,27 @@ CHECK_CLEANFILES+=accum.h5 cmpd_dset.h5 compact_dataset.h5 dataset.h5 dset_offse split_get_file_image_test-m.h5 split_get_file_image_test-r.h5 \ file_image_core_test.h5.copy unregister_filter_1.h5 unregister_filter_2.h5 \ vds_virt.h5 vds_dapl.h5 vds_src_[0-1].h5 \ + swmr_data.h5 use_use_append_chunk.h5 use_append_mchunks.h5 use_disable_mdc_flushes.h5 \ flushrefresh.h5 flushrefresh_VERIFICATION_START \ flushrefresh_VERIFICATION_CHECKPOINT1 flushrefresh_VERIFICATION_CHECKPOINT2 \ - flushrefresh_VERIFICATION_DONE accum_swmr_big.h5 ohdr_swmr.h5 \ - cache_logging.h5 cache_logging.out \ - swmr[0-2].h5 + flushrefresh_VERIFICATION_DONE atomic_data accum_swmr_big.h5 ohdr_swmr.h5 \ + test_swmr*.h5 cache_logging.h5 cache_logging.out vds_swmr.h5 vds_swmr_src_*.h5 \ + swmr[0-2].h5 swmr_writer.out swmr_writer.log.* swmr_reader.out.* swmr_reader.log.* \ + tbogus.h5.copy cache_image_test.h5 + # Sources for testhdf5 executable testhdf5_SOURCES=testhdf5.c tarray.c tattr.c tchecksum.c tconfig.c tfile.c \ tgenprop.c th5o.c th5s.c tcoords.c theap.c tid.c titerate.c tmeta.c tmisc.c \ trefer.c trefstr.c tselect.c tskiplist.c tsohm.c ttime.c ttst.c tunicode.c \ tvlstr.c tvltypes.c +# Sources for Use Cases +use_append_chunk_SOURCES=use_append_chunk.c use_common.c +use_append_mchunks_SOURCES=use_append_mchunks.c use_common.c +use_disable_mdc_flushes_SOURCES=use_disable_mdc_flushes.c + # Temporary files. DISTCLEANFILES=testerror.sh testlibinfo.sh testcheck_version.sh testlinks_env.sh test_plugin.sh \ - testflushrefresh.sh + testswmr.sh testvdsswmr.sh test_usecases.sh testflushrefresh.sh include $(top_srcdir)/config/conclude.am diff --git a/test/cache.c b/test/cache.c index 2209d8f..87b1272 100644 --- a/test/cache.c +++ b/test/cache.c @@ -19,9 +19,6 @@ * This file contains tests for the cache implemented in * H5C.c */ -#include "h5test.h" -#include "H5Iprivate.h" -#include "H5ACprivate.h" #include "cache_common.h" @@ -118,12 +115,12 @@ static void check_flush_cache__multi_entry(H5F_t * file_ptr); static void check_flush_cache__multi_entry_test(H5F_t * file_ptr, int test_num, unsigned int flush_flags, - int spec_size, + unsigned int spec_size, struct flush_cache_test_spec spec[]); static void check_flush_cache__pe_multi_entry_test(H5F_t * file_ptr, int test_num, unsigned int flush_flags, - int spec_size, + unsigned int spec_size, struct pe_flush_cache_test_spec spec[]); static void check_flush_cache__single_entry(H5F_t * file_ptr); static void check_flush_cache__single_entry_test(H5F_t * file_ptr, @@ -155,9 +152,9 @@ static void check_flush_cache__flush_op_test(H5F_t * file_ptr, unsigned int flush_flags, int spec_size, const struct fo_flush_cache_test_spec spec[], - int init_expected_index_len, + unsigned init_expected_index_len, size_t init_expected_index_size, - int expected_index_len, + unsigned expected_index_len, size_t expected_index_size, int check_size, struct fo_flush_entry_check check[]); @@ -3312,7 +3309,7 @@ check_flush_cache__multi_entry(H5F_t * file_ptr) { int test_num = 1; unsigned int flush_flags = H5C__NO_FLAGS_SET; - int spec_size = 8; + unsigned int spec_size = 8; struct flush_cache_test_spec spec[8] = { { @@ -3406,7 +3403,7 @@ check_flush_cache__multi_entry(H5F_t * file_ptr) { int test_num = 2; unsigned int flush_flags = H5C__FLUSH_INVALIDATE_FLAG; - int spec_size = 8; + unsigned int spec_size = 8; struct flush_cache_test_spec spec[8] = { { @@ -3500,7 +3497,7 @@ check_flush_cache__multi_entry(H5F_t * file_ptr) { int test_num = 3; unsigned int flush_flags = H5C__FLUSH_CLEAR_ONLY_FLAG; - int spec_size = 8; + unsigned int spec_size = 8; struct flush_cache_test_spec spec[8] = { { @@ -3594,7 +3591,7 @@ check_flush_cache__multi_entry(H5F_t * file_ptr) { int test_num = 4; unsigned int flush_flags = H5C__FLUSH_MARKED_ENTRIES_FLAG; - int spec_size = 8; + unsigned int spec_size = 8; struct flush_cache_test_spec spec[8] = { { @@ -3689,7 +3686,7 @@ check_flush_cache__multi_entry(H5F_t * file_ptr) int test_num = 5; unsigned int flush_flags = H5C__FLUSH_INVALIDATE_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG; - int spec_size = 8; + unsigned int spec_size = 8; struct flush_cache_test_spec spec[8] = { { @@ -3784,7 +3781,7 @@ check_flush_cache__multi_entry(H5F_t * file_ptr) int test_num = 6; unsigned int flush_flags = H5C__FLUSH_INVALIDATE_FLAG | H5C__FLUSH_MARKED_ENTRIES_FLAG; - int spec_size = 8; + unsigned int spec_size = 8; struct flush_cache_test_spec spec[8] = { { @@ -3879,7 +3876,7 @@ check_flush_cache__multi_entry(H5F_t * file_ptr) int test_num = 7; unsigned int flush_flags = H5C__FLUSH_CLEAR_ONLY_FLAG | H5C__FLUSH_MARKED_ENTRIES_FLAG; - int spec_size = 8; + unsigned int spec_size = 8; struct flush_cache_test_spec spec[8] = { { @@ -3975,7 +3972,7 @@ check_flush_cache__multi_entry(H5F_t * file_ptr) unsigned int flush_flags = H5C__FLUSH_INVALIDATE_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG | H5C__FLUSH_MARKED_ENTRIES_FLAG; - int spec_size = 8; + unsigned int spec_size = 8; struct flush_cache_test_spec spec[8] = { { @@ -4073,7 +4070,7 @@ check_flush_cache__multi_entry(H5F_t * file_ptr) ~(H5C__FLUSH_INVALIDATE_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG | H5C__FLUSH_MARKED_ENTRIES_FLAG); - int spec_size = 8; + unsigned int spec_size = 8; struct flush_cache_test_spec spec[8] = { { @@ -4172,7 +4169,7 @@ check_flush_cache__multi_entry(H5F_t * file_ptr) { int test_num = 1; unsigned int flush_flags = H5C__NO_FLAGS_SET; - int spec_size = 8; + unsigned int spec_size = 8; struct pe_flush_cache_test_spec spec[8] = { { @@ -4318,7 +4315,7 @@ check_flush_cache__multi_entry(H5F_t * file_ptr) { int test_num = 2; unsigned int flush_flags = H5C__FLUSH_INVALIDATE_FLAG; - int spec_size = 8; + unsigned int spec_size = 8; struct pe_flush_cache_test_spec spec[8] = { { @@ -4448,7 +4445,7 @@ check_flush_cache__multi_entry(H5F_t * file_ptr) int test_num = 3; unsigned int flush_flags = H5C__FLUSH_INVALIDATE_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG; - int spec_size = 8; + unsigned int spec_size = 8; struct pe_flush_cache_test_spec spec[8] = { { @@ -4570,7 +4567,7 @@ check_flush_cache__multi_entry(H5F_t * file_ptr) int test_num = 4; unsigned int flush_flags = H5C__FLUSH_INVALIDATE_FLAG | H5C__FLUSH_MARKED_ENTRIES_FLAG; - int spec_size = 8; + unsigned int spec_size = 8; struct pe_flush_cache_test_spec spec[8] = { { @@ -4701,7 +4698,7 @@ check_flush_cache__multi_entry(H5F_t * file_ptr) unsigned int flush_flags = H5C__FLUSH_INVALIDATE_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG | H5C__FLUSH_MARKED_ENTRIES_FLAG; - int spec_size = 8; + unsigned int spec_size = 8; struct pe_flush_cache_test_spec spec[8] = { { @@ -4845,13 +4842,13 @@ static void check_flush_cache__multi_entry_test(H5F_t * file_ptr, int test_num, unsigned int flush_flags, - int spec_size, + unsigned int spec_size, struct flush_cache_test_spec spec[]) { H5C_t * cache_ptr = file_ptr->shared->cache; static char msg[128]; herr_t result; - int i; + unsigned u; size_t total_entry_size = 0; test_entry_t * base_addr; test_entry_t * entry_ptr; @@ -4890,43 +4887,43 @@ check_flush_cache__multi_entry_test(H5F_t * file_ptr, failure_mssg = msg; } - i = 0; - while(pass && (i < spec_size)) + u = 0; + while(pass && (u < spec_size)) { - if((spec[i].entry_num != i) || - (spec[i].entry_type < 0) || - (spec[i].entry_type >= NUMBER_OF_ENTRY_TYPES) || - (spec[i].entry_index < 0) || - (spec[i].entry_index > max_indices[spec[i].entry_type])) { + if(((unsigned)spec[u].entry_num != u) || + (spec[u].entry_type < 0) || + (spec[u].entry_type >= NUMBER_OF_ENTRY_TYPES) || + (spec[u].entry_index < 0) || + (spec[u].entry_index > max_indices[spec[u].entry_type])) { pass = FALSE; HDsnprintf(msg, (size_t)128, - "bad data in spec[%d] on entry to multi entry test #%d.", - i, test_num); + "bad data in spec[%u] on entry to multi entry test #%d.", + u, test_num); failure_mssg = msg; } - i++; + u++; } - i = 0; - while(pass && (i < spec_size)) + u = 0; + while(pass && (u < spec_size)) { - if(spec[i].insert_flag) { + if(spec[u].insert_flag) { - insert_entry(file_ptr, spec[i].entry_type, spec[i].entry_index, - spec[i].flags); + insert_entry(file_ptr, spec[u].entry_type, spec[u].entry_index, + spec[u].flags); } else { - protect_entry(file_ptr, spec[i].entry_type, spec[i].entry_index); + protect_entry(file_ptr, spec[u].entry_type, spec[u].entry_index); - unprotect_entry(file_ptr, spec[i].entry_type, spec[i].entry_index, - spec[i].flags); + unprotect_entry(file_ptr, spec[u].entry_type, spec[u].entry_index, + spec[u].flags); } - total_entry_size += entry_sizes[spec[i].entry_type]; + total_entry_size += entry_sizes[spec[u].entry_type]; - i++; + u++; } if(pass) { @@ -4943,36 +4940,36 @@ check_flush_cache__multi_entry_test(H5F_t * file_ptr, } } - i = 0; - while(pass && (i < spec_size)) + u = 0; + while(pass && (u < spec_size)) { - base_addr = entries[spec[i].entry_type]; - entry_ptr = &(base_addr[spec[i].entry_index]); + base_addr = entries[spec[u].entry_type]; + entry_ptr = &(base_addr[spec[u].entry_index]); - if((entry_ptr->deserialized != spec[i].expected_deserialized) || - (entry_ptr->serialized != spec[i].expected_serialized) || - (entry_ptr->destroyed != spec[i].expected_destroyed)) { + if((entry_ptr->deserialized != spec[u].expected_deserialized) || + (entry_ptr->serialized != spec[u].expected_serialized) || + (entry_ptr->destroyed != spec[u].expected_destroyed)) { #if 0 /* This is useful debugging code. Lets keep it around. */ HDfprintf(stdout, "deslzd = %d(%d), slzd = %d(%d), dest = %d(%d)\n", (int)(entry_ptr->deserialized), - (int)(spec[i].expected_deserialized), + (int)(spec[u].expected_deserialized), (int)(entry_ptr->serialized), - (int)(spec[i].expected_serialized), + (int)(spec[u].expected_serialized), (int)(entry_ptr->destroyed), - (int)(spec[i].expected_destroyed)); + (int)(spec[u].expected_destroyed)); #endif pass = FALSE; HDsnprintf(msg, (size_t)128, - "Bad status on entry %d after flush in multi entry test #%d.", - i, test_num); + "Bad status on entry %u after flush in multi entry test #%d.", + u, test_num); failure_mssg = msg; } - i++; + u++; } if(pass) { @@ -5027,17 +5024,17 @@ check_flush_cache__multi_entry_test(H5F_t * file_ptr, } } - i = 0; - while(pass && (i < spec_size)) + u = 0; + while(pass && (u < spec_size)) { - base_addr = entries[spec[i].entry_type]; - entry_ptr = &(base_addr[spec[i].entry_index]); + base_addr = entries[spec[u].entry_type]; + entry_ptr = &(base_addr[spec[u].entry_index]); entry_ptr->deserialized = FALSE; entry_ptr->serialized = FALSE; entry_ptr->destroyed = FALSE; - i++; + u++; } return; @@ -5064,13 +5061,13 @@ static void check_flush_cache__pe_multi_entry_test(H5F_t * file_ptr, int test_num, unsigned int flush_flags, - int spec_size, + unsigned int spec_size, struct pe_flush_cache_test_spec spec[]) { H5C_t *cache_ptr = file_ptr->shared->cache; static char msg[128]; herr_t result; - int i; + unsigned u; int j; size_t total_entry_size = 0; test_entry_t * base_addr; @@ -5110,54 +5107,54 @@ check_flush_cache__pe_multi_entry_test(H5F_t * file_ptr, failure_mssg = msg; } - i = 0; - while(pass && (i < spec_size)) + u = 0; + while(pass && (u < spec_size)) { - if((spec[i].entry_num != i) || - (spec[i].entry_type < 0) || - (spec[i].entry_type >= NUMBER_OF_ENTRY_TYPES) || - (spec[i].entry_index < 0) || - (spec[i].entry_index > max_indices[spec[i].entry_type]) || - (spec[i].num_pins < 0) || - (spec[i].num_pins > MAX_PINS)) { + if(((unsigned)spec[u].entry_num != u) || + (spec[u].entry_type < 0) || + (spec[u].entry_type >= NUMBER_OF_ENTRY_TYPES) || + (spec[u].entry_index < 0) || + (spec[u].entry_index > max_indices[spec[u].entry_type]) || + (spec[u].num_pins < 0) || + (spec[u].num_pins > MAX_PINS)) { pass = FALSE; HDsnprintf(msg, (size_t)128, - "bad data in spec[%d] on entry to pe multi entry test #%d.", - i, test_num); + "bad data in spec[%u] on entry to pe multi entry test #%d.", + u, test_num); failure_mssg = msg; } - i++; + u++; } - i = 0; - while(pass && (i < spec_size)) + u = 0; + while(pass && (u < spec_size)) { - if(spec[i].insert_flag) { + if(spec[u].insert_flag) { - insert_entry(file_ptr, spec[i].entry_type, spec[i].entry_index, - spec[i].flags); + insert_entry(file_ptr, spec[u].entry_type, spec[u].entry_index, + spec[u].flags); } else { - protect_entry(file_ptr, spec[i].entry_type, spec[i].entry_index); + protect_entry(file_ptr, spec[u].entry_type, spec[u].entry_index); - unprotect_entry(file_ptr, spec[i].entry_type, spec[i].entry_index, - spec[i].flags); + unprotect_entry(file_ptr, spec[u].entry_type, spec[u].entry_index, + spec[u].flags); } - total_entry_size += entry_sizes[spec[i].entry_type]; + total_entry_size += entry_sizes[spec[u].entry_type]; - for (j = 0; j < spec[i].num_pins; j++) + for (j = 0; j < spec[u].num_pins; j++) { create_pinned_entry_dependency(file_ptr, - spec[i].entry_type, - spec[i].entry_index, - spec[i].pin_type[j], - spec[i].pin_idx[j]); + spec[u].entry_type, + spec[u].entry_index, + spec[u].pin_type[j], + spec[u].pin_idx[j]); } - i++; + u++; } if(pass) { @@ -5174,36 +5171,36 @@ check_flush_cache__pe_multi_entry_test(H5F_t * file_ptr, } } - i = 0; - while(pass && (i < spec_size)) + u = 0; + while(pass && (u < spec_size)) { - base_addr = entries[spec[i].entry_type]; - entry_ptr = &(base_addr[spec[i].entry_index]); + base_addr = entries[spec[u].entry_type]; + entry_ptr = &(base_addr[spec[u].entry_index]); - if((entry_ptr->deserialized != spec[i].expected_deserialized) || - (entry_ptr->serialized != spec[i].expected_serialized) || - (entry_ptr->destroyed != spec[i].expected_destroyed)) { + if((entry_ptr->deserialized != spec[u].expected_deserialized) || + (entry_ptr->serialized != spec[u].expected_serialized) || + (entry_ptr->destroyed != spec[u].expected_destroyed)) { #if 0 /* This is useful debugging code. Lets keep it around. */ HDfprintf(stdout, "desrlzd = %d(%d), srlzd = %d(%d), dest = %d(%d)\n", (int)(entry_ptr->deserialized), - (int)(spec[i].expected_deserialized), + (int)(spec[u].expected_deserialized), (int)(entry_ptr->serialized), - (int)(spec[i].expected_serialized), + (int)(spec[u].expected_serialized), (int)(entry_ptr->destroyed), - (int)(spec[i].expected_destroyed)); + (int)(spec[u].expected_destroyed)); #endif pass = FALSE; HDsnprintf(msg, (size_t)128, - "Bad status on entry %d after flush in pe multi entry test #%d.", - i, test_num); + "Bad status on entry %u after flush in pe multi entry test #%d.", + u, test_num); failure_mssg = msg; } - i++; + u++; } if(pass) { @@ -5258,17 +5255,17 @@ check_flush_cache__pe_multi_entry_test(H5F_t * file_ptr, } } - i = 0; - while(pass && (i < spec_size)) + u = 0; + while(pass && (u < spec_size)) { - base_addr = entries[spec[i].entry_type]; - entry_ptr = &(base_addr[spec[i].entry_index]); + base_addr = entries[spec[u].entry_type]; + entry_ptr = &(base_addr[spec[u].entry_index]); entry_ptr->deserialized = FALSE; entry_ptr->serialized = FALSE; entry_ptr->destroyed = FALSE; - i++; + u++; } return; @@ -5323,9 +5320,9 @@ check_flush_cache__flush_ops(H5F_t * file_ptr) int test_num = 1; unsigned int flush_flags = H5C__NO_FLAGS_SET; int spec_size = 2; - int init_expected_index_len = 2; + unsigned init_expected_index_len = 2; size_t init_expected_index_size = 2 * PICO_ENTRY_SIZE; - int expected_index_len = 2; + unsigned expected_index_len = 2; size_t expected_index_size = 2 * PICO_ENTRY_SIZE; struct fo_flush_cache_test_spec spec[2] = { @@ -5430,9 +5427,9 @@ check_flush_cache__flush_ops(H5F_t * file_ptr) int test_num = 2; unsigned int flush_flags = H5C__FLUSH_INVALIDATE_FLAG; int spec_size = 2; - int init_expected_index_len = 2; + unsigned init_expected_index_len = 2; size_t init_expected_index_size = 2 * PICO_ENTRY_SIZE; - int expected_index_len = 0; + unsigned expected_index_len = 0; size_t expected_index_size = 0; struct fo_flush_cache_test_spec spec[2] = { @@ -5534,9 +5531,9 @@ check_flush_cache__flush_ops(H5F_t * file_ptr) int test_num = 3; unsigned int flush_flags = H5C__NO_FLAGS_SET; int spec_size = 1; - int init_expected_index_len = 1; + unsigned init_expected_index_len = 1; size_t init_expected_index_size = VARIABLE_ENTRY_SIZE / 4; - int expected_index_len = 1; + unsigned expected_index_len = 1; size_t expected_index_size = VARIABLE_ENTRY_SIZE / 2; struct fo_flush_cache_test_spec spec[1] = { @@ -5612,9 +5609,9 @@ check_flush_cache__flush_ops(H5F_t * file_ptr) int test_num = 4; unsigned int flush_flags = H5C__FLUSH_INVALIDATE_FLAG; int spec_size = 1; - int init_expected_index_len = 1; + unsigned init_expected_index_len = 1; size_t init_expected_index_size = VARIABLE_ENTRY_SIZE / 4; - int expected_index_len = 0; + unsigned expected_index_len = 0; size_t expected_index_size = 0; struct fo_flush_cache_test_spec spec[1] = { @@ -5697,9 +5694,9 @@ check_flush_cache__flush_ops(H5F_t * file_ptr) int test_num = 5; /* and 6 */ unsigned int flush_flags = H5C__NO_FLAGS_SET; int spec_size = 1; - int init_expected_index_len = 1; + unsigned init_expected_index_len = 1; size_t init_expected_index_size = VARIABLE_ENTRY_SIZE; - int expected_index_len = 1; + unsigned expected_index_len = 1; size_t expected_index_size = VARIABLE_ENTRY_SIZE / 2; struct fo_flush_cache_test_spec spec[1] = { @@ -5814,9 +5811,9 @@ check_flush_cache__flush_ops(H5F_t * file_ptr) int test_num = 7; /* and 8 */ unsigned int flush_flags = H5C__NO_FLAGS_SET; int spec_size = 1; - int init_expected_index_len = 1; + unsigned init_expected_index_len = 1; size_t init_expected_index_size = VARIABLE_ENTRY_SIZE; - int expected_index_len = 1; + unsigned expected_index_len = 1; size_t expected_index_size = VARIABLE_ENTRY_SIZE / 2; struct fo_flush_cache_test_spec spec[1] = { @@ -5927,9 +5924,9 @@ check_flush_cache__flush_ops(H5F_t * file_ptr) int test_num = 9; /* and 10 */ unsigned int flush_flags = H5C__NO_FLAGS_SET; int spec_size = 1; - int init_expected_index_len = 1; + unsigned init_expected_index_len = 1; size_t init_expected_index_size = VARIABLE_ENTRY_SIZE / 2; - int expected_index_len = 1; + unsigned expected_index_len = 1; size_t expected_index_size = VARIABLE_ENTRY_SIZE / 4; struct fo_flush_cache_test_spec spec[1] = { @@ -6038,9 +6035,9 @@ check_flush_cache__flush_ops(H5F_t * file_ptr) int test_num = 11; /* and 12 */ unsigned int flush_flags = H5C__NO_FLAGS_SET; int spec_size = 1; - int init_expected_index_len = 1; + unsigned init_expected_index_len = 1; size_t init_expected_index_size = VARIABLE_ENTRY_SIZE / 2; - int expected_index_len = 1; + unsigned expected_index_len = 1; size_t expected_index_size = VARIABLE_ENTRY_SIZE / 4; struct fo_flush_cache_test_spec spec[1] = { @@ -6152,9 +6149,9 @@ check_flush_cache__flush_ops(H5F_t * file_ptr) int test_num = 13; unsigned int flush_flags = H5C__NO_FLAGS_SET; int spec_size = 1; - int init_expected_index_len = 1; + unsigned init_expected_index_len = 1; size_t init_expected_index_size = 1 * PICO_ENTRY_SIZE; - int expected_index_len = 3; + unsigned expected_index_len = 3; size_t expected_index_size = 3 * PICO_ENTRY_SIZE; struct fo_flush_cache_test_spec spec[1] = { @@ -6248,9 +6245,9 @@ check_flush_cache__flush_ops(H5F_t * file_ptr) int test_num = 14; unsigned int flush_flags = H5C__FLUSH_INVALIDATE_FLAG; int spec_size = 1; - int init_expected_index_len = 1; + unsigned init_expected_index_len = 1; size_t init_expected_index_size = 1 * PICO_ENTRY_SIZE; - int expected_index_len = 0; + unsigned expected_index_len = 0; size_t expected_index_size = (size_t)0; struct fo_flush_cache_test_spec spec[1] = { @@ -6341,9 +6338,9 @@ check_flush_cache__flush_ops(H5F_t * file_ptr) int test_num = 15; unsigned int flush_flags = H5C__NO_FLAGS_SET; int spec_size = 1; - int init_expected_index_len = 1; + unsigned init_expected_index_len = 1; size_t init_expected_index_size = 1 * VARIABLE_ENTRY_SIZE; - int expected_index_len = 3; + unsigned expected_index_len = 3; size_t expected_index_size = VARIABLE_ENTRY_SIZE + (VARIABLE_ENTRY_SIZE / 4) + (VARIABLE_ENTRY_SIZE / 2); @@ -6438,9 +6435,9 @@ check_flush_cache__flush_ops(H5F_t * file_ptr) int test_num = 16; unsigned int flush_flags = H5C__FLUSH_INVALIDATE_FLAG; int spec_size = 1; - int init_expected_index_len = 1; + unsigned init_expected_index_len = 1; size_t init_expected_index_size = 1 * VARIABLE_ENTRY_SIZE; - int expected_index_len = 0; + unsigned expected_index_len = 0; size_t expected_index_size = (size_t)0; struct fo_flush_cache_test_spec spec[1] = { @@ -6531,9 +6528,9 @@ check_flush_cache__flush_ops(H5F_t * file_ptr) int test_num = 17; /* and 18 */ unsigned int flush_flags = H5C__NO_FLAGS_SET; int spec_size = 1; - int init_expected_index_len = 1; + unsigned init_expected_index_len = 1; size_t init_expected_index_size = 1 * VARIABLE_ENTRY_SIZE; - int expected_index_len = 3; + unsigned expected_index_len = 3; size_t expected_index_size = VARIABLE_ENTRY_SIZE + (VARIABLE_ENTRY_SIZE / 4) + (VARIABLE_ENTRY_SIZE / 2); @@ -6658,9 +6655,9 @@ check_flush_cache__flush_ops(H5F_t * file_ptr) int test_num = 19; /* and 20 */ unsigned int flush_flags = H5C__NO_FLAGS_SET; int spec_size = 1; - int init_expected_index_len = 1; + unsigned init_expected_index_len = 1; size_t init_expected_index_size = 1 * VARIABLE_ENTRY_SIZE; - int expected_index_len = 3; + unsigned expected_index_len = 3; size_t expected_index_size = VARIABLE_ENTRY_SIZE + (VARIABLE_ENTRY_SIZE / 4) + (VARIABLE_ENTRY_SIZE / 2); @@ -6796,9 +6793,9 @@ check_flush_cache__flush_ops(H5F_t * file_ptr) int test_num = 21; unsigned int flush_flags = H5C__FLUSH_MARKED_ENTRIES_FLAG; int spec_size = 4; - int init_expected_index_len = 4; + unsigned init_expected_index_len = 4; size_t init_expected_index_size = (2 * VARIABLE_ENTRY_SIZE) + (2 * PICO_ENTRY_SIZE); - int expected_index_len = 6; + unsigned expected_index_len = 6; size_t expected_index_size = (2 * VARIABLE_ENTRY_SIZE) + (VARIABLE_ENTRY_SIZE / 4) + (VARIABLE_ENTRY_SIZE / 2) + @@ -7007,9 +7004,9 @@ check_flush_cache__flush_ops(H5F_t * file_ptr) int test_num = 22; unsigned int flush_flags = H5C__NO_FLAGS_SET; int spec_size = 6; - int init_expected_index_len = 6; + unsigned init_expected_index_len = 6; size_t init_expected_index_size = (2 * VARIABLE_ENTRY_SIZE) + (4 * PICO_ENTRY_SIZE); - int expected_index_len = 10; + unsigned expected_index_len = 10; size_t expected_index_size = (2 * VARIABLE_ENTRY_SIZE) + (2 * (VARIABLE_ENTRY_SIZE / 4)) + (2 * (VARIABLE_ENTRY_SIZE / 2)) + @@ -7276,9 +7273,9 @@ check_flush_cache__flush_ops(H5F_t * file_ptr) int test_num = 23; unsigned int flush_flags = H5C__FLUSH_INVALIDATE_FLAG; int spec_size = 6; - int init_expected_index_len = 6; + unsigned init_expected_index_len = 6; size_t init_expected_index_size = (2 * VARIABLE_ENTRY_SIZE) + (4 * PICO_ENTRY_SIZE); - int expected_index_len = 0; + unsigned expected_index_len = 0; size_t expected_index_size = 0; struct fo_flush_cache_test_spec spec[6] = { @@ -7538,9 +7535,9 @@ check_flush_cache__flush_ops(H5F_t * file_ptr) int test_num = 24; unsigned int flush_flags = H5C__NO_FLAGS_SET; int spec_size = 3; - int init_expected_index_len = 3; + unsigned init_expected_index_len = 3; size_t init_expected_index_size = 3 * PICO_ENTRY_SIZE; - int expected_index_len = 3; + unsigned expected_index_len = 3; size_t expected_index_size = 3 * PICO_ENTRY_SIZE; struct fo_flush_cache_test_spec spec[3] = { @@ -7671,9 +7668,9 @@ check_flush_cache__flush_ops(H5F_t * file_ptr) int test_num = 25; unsigned int flush_flags = H5C__FLUSH_INVALIDATE_FLAG; int spec_size = 3; - int init_expected_index_len = 3; + unsigned init_expected_index_len = 3; size_t init_expected_index_size = 3 * PICO_ENTRY_SIZE; - int expected_index_len = 0; + unsigned expected_index_len = 0; size_t expected_index_size = (size_t)0; struct fo_flush_cache_test_spec spec[3] = { @@ -7874,9 +7871,9 @@ check_flush_cache__flush_ops(H5F_t * file_ptr) int test_num = 26; unsigned int flush_flags = H5C__NO_FLAGS_SET; int spec_size = 10; - int init_expected_index_len = 10; + unsigned init_expected_index_len = 10; size_t init_expected_index_size = 10 * VARIABLE_ENTRY_SIZE; - int expected_index_len = 13; + unsigned expected_index_len = 13; size_t expected_index_size = 9 * VARIABLE_ENTRY_SIZE; struct fo_flush_cache_test_spec spec[10] = { @@ -8308,9 +8305,9 @@ check_flush_cache__flush_ops(H5F_t * file_ptr) int test_num = 27; unsigned int flush_flags = H5C__FLUSH_INVALIDATE_FLAG; int spec_size = 10; - int init_expected_index_len = 10; + unsigned init_expected_index_len = 10; size_t init_expected_index_size = 10 * VARIABLE_ENTRY_SIZE; - int expected_index_len = 0; + unsigned expected_index_len = 0; size_t expected_index_size = (size_t)0; struct fo_flush_cache_test_spec spec[10] = { @@ -8667,9 +8664,9 @@ check_flush_cache__flush_ops(H5F_t * file_ptr) int test_num = 28; unsigned int flush_flags = H5C__NO_FLAGS_SET; int spec_size = 5; - int init_expected_index_len = 5; + unsigned init_expected_index_len = 5; size_t init_expected_index_size = 3 * VARIABLE_ENTRY_SIZE; - int expected_index_len = 5; + unsigned expected_index_len = 5; size_t expected_index_size = 4 * VARIABLE_ENTRY_SIZE; struct fo_flush_cache_test_spec spec[5] = { @@ -8859,9 +8856,9 @@ check_flush_cache__flush_ops(H5F_t * file_ptr) int test_num = 29; unsigned int flush_flags = H5C__FLUSH_INVALIDATE_FLAG; int spec_size = 5; - int init_expected_index_len = 5; + unsigned init_expected_index_len = 5; size_t init_expected_index_size = 3 * VARIABLE_ENTRY_SIZE; - int expected_index_len = 0; + unsigned expected_index_len = 0; size_t expected_index_size = 0; struct fo_flush_cache_test_spec spec[5] = { @@ -9070,9 +9067,9 @@ check_flush_cache__flush_op_test(H5F_t * file_ptr, unsigned int flush_flags, int spec_size, const struct fo_flush_cache_test_spec spec[], - int init_expected_index_len, + unsigned init_expected_index_len, size_t init_expected_index_size, - int expected_index_len, + unsigned expected_index_len, size_t expected_index_size, int check_size, struct fo_flush_entry_check check[]) @@ -13700,7 +13697,7 @@ check_move_entry(void) { unsigned u; H5F_t * file_ptr = NULL; - struct move_entry_test_spec test_specs[8] = + struct move_entry_test_spec test_specs[4] = { { /* int entry_type = */ PICO_ENTRY_TYPE, @@ -15901,7 +15898,6 @@ check_destroy_pinned_err(void) * should fail. Unpin the entry and flush destroy again -- should * succeed. */ - if(pass) { reset_entries(); @@ -15912,7 +15908,7 @@ check_destroy_pinned_err(void) protect_entry(file_ptr, 0, 0); unprotect_entry(file_ptr, 0, 0, H5C__PIN_ENTRY_FLAG); - if(H5C_prep_for_file_close(file_ptr, H5P_DATASET_XFER_DEFAULT) < 0 ) { + if(H5C_prep_for_file_close(file_ptr, H5P_DATASET_XFER_DEFAULT) < 0) { pass = FALSE; failure_mssg = "unexpected failure of prep for file close.\n"; } /* end if */ @@ -15928,9 +15924,8 @@ check_destroy_pinned_err(void) pass = FALSE; failure_mssg = "destroy failed after unpin.\n"; } /* end if */ - else { + else file_ptr->shared->cache = NULL; - } /* end else */ } /* end else */ if(saved_cache != NULL) { @@ -15992,16 +15987,16 @@ check_destroy_protected_err(void) file_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024)); - /* Note: normally this call would go just before the series of - * flushes prior to file close -- in particular, all entries + /* Note: normally this call would go just before the series of + * flushes prior to file close -- in particular, all entries * should be unprotected when this call is made. * * Thus H5C_prep_for_file_close() contains an assert to verify - * this. Since this assert would be triggered by the condition + * this. Since this assert would be triggered by the condition * we are trying to test, put the call to H5C_prep_for_file_close() * prior to the final protect call. */ - if(H5C_prep_for_file_close(file_ptr, H5P_DATASET_XFER_DEFAULT) < 0 ) { + if(H5C_prep_for_file_close(file_ptr, H5P_DATASET_XFER_DEFAULT) < 0) { pass = FALSE; failure_mssg = "unexpected failure of prep for file close.\n"; } /* end if */ @@ -16093,7 +16088,7 @@ check_duplicate_insert_err(void) entry_ptr = &(base_addr[0]); result = H5C_insert_entry(file_ptr, H5AC_ind_read_dxpl_id, - &(types[0]), entry_ptr->addr, + types[0], entry_ptr->addr, (void *)entry_ptr, H5C__NO_FLAGS_SET); if(result >= 0) { @@ -16461,7 +16456,7 @@ check_double_protect_err(void) if(pass) { cache_entry_ptr = (H5C_cache_entry_t *)H5C_protect(file_ptr, H5AC_ind_read_dxpl_id, - &(types[0]), entry_ptr->addr, + types[0], entry_ptr->addr, &entry_ptr->addr, H5C__NO_FLAGS_SET); if(cache_entry_ptr != NULL) { @@ -16705,7 +16700,7 @@ check_expunge_entry_errs(void) if(pass) { result = H5C_expunge_entry(file_ptr, H5AC_ind_read_dxpl_id, - &(types[0]), entry_ptr->addr, H5C__NO_FLAGS_SET); + types[0], entry_ptr->addr, H5C__NO_FLAGS_SET); if(result > 0) { @@ -16723,7 +16718,7 @@ check_expunge_entry_errs(void) if(pass) { result = H5C_expunge_entry(file_ptr, H5AC_ind_read_dxpl_id, - &(types[0]), entry_ptr->addr, H5C__NO_FLAGS_SET); + types[0], entry_ptr->addr, H5C__NO_FLAGS_SET); if(result > 0) { @@ -16741,7 +16736,7 @@ check_expunge_entry_errs(void) if(pass) { result = H5C_expunge_entry(file_ptr, H5AC_ind_read_dxpl_id, - &(types[0]), entry_ptr->addr, H5C__NO_FLAGS_SET); + types[0], entry_ptr->addr, H5C__NO_FLAGS_SET); if(result < 0) { @@ -16784,7 +16779,6 @@ check_expunge_entry_errs(void) * *------------------------------------------------------------------------- */ - static unsigned check_move_entry_errs(void) { @@ -16806,7 +16800,6 @@ check_move_entry_errs(void) */ if(pass) { - reset_entries(); file_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024)); @@ -16819,36 +16812,29 @@ check_move_entry_errs(void) entry_0_0_ptr = &((entries[0])[0]); entry_0_1_ptr = &((entries[0])[1]); entry_1_0_ptr = &((entries[1])[0]); - } + } /* end if */ if(pass) { - - result = H5C_move_entry(cache_ptr, &(types[0]), - entry_0_0_ptr->addr, entry_0_1_ptr->addr); + result = H5C_move_entry(cache_ptr, types[0], entry_0_0_ptr->addr, entry_0_1_ptr->addr); if(result >= 0) { - pass = FALSE; failure_mssg = "move to addr of same type succeeded.\n"; - } - } + } /* end if */ + } /* end if */ if(pass) { - - result = H5C_move_entry(cache_ptr, &(types[0]), - entry_0_0_ptr->addr, entry_1_0_ptr->addr); + result = H5C_move_entry(cache_ptr, types[0], entry_0_0_ptr->addr, entry_1_0_ptr->addr); if(result >= 0) { - pass = FALSE; failure_mssg = "move to addr of different type succeeded.\n"; - } - } + } /* end if */ + } /* end if */ if(pass) takedown_cache(file_ptr, FALSE, FALSE); - /* Allocate a cache, protect an entry R/O, and then call * H5C_move_entry() to move it -- this should fail. * @@ -16857,7 +16843,6 @@ check_move_entry_errs(void) */ if(pass) { - reset_entries(); file_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024)); @@ -16865,29 +16850,21 @@ check_move_entry_errs(void) cache_ptr = file_ptr->shared->cache; insert_entry(file_ptr, 0, 0, H5C__NO_FLAGS_SET); - protect_entry_ro(file_ptr, 0, 0); entry_ptr = &((entries[0])[0]); - - } + } /* end if */ if(pass) { - - result = H5C_move_entry(cache_ptr, &(types[0]), entry_ptr->header.addr, entry_ptr->header.addr + 10); + result = H5C_move_entry(cache_ptr, types[0], entry_ptr->header.addr, entry_ptr->header.addr + 10); if(result >= 0) { - pass = FALSE; - failure_mssg = - "Call to H5C_move_entry on a R/O protected entry succeeded.\n"; - - } else { - + failure_mssg = "Call to H5C_move_entry on a R/O protected entry succeeded.\n"; + } /* end if */ + else unprotect_entry(file_ptr, 0, 0, H5C__NO_FLAGS_SET); - - } - } + } /* end if */ if(pass) takedown_cache(file_ptr, FALSE, FALSE); @@ -16897,8 +16874,7 @@ check_move_entry_errs(void) else { H5_FAILED() - HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", - FUNC, failure_mssg); + HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", FUNC, failure_mssg); } /* end else */ return (unsigned)!pass; @@ -17179,7 +17155,7 @@ check_protect_ro_rw_err(void) if(pass) { thing_ptr = (H5C_cache_entry_t *)H5C_protect(file_ptr, H5AC_ind_read_dxpl_id, - &(types[0]), entry_ptr->addr, + types[0], entry_ptr->addr, &entry_ptr->addr, H5C__NO_FLAGS_SET); if(thing_ptr != NULL) { @@ -17272,13 +17248,13 @@ check_protect_retries(void) entry_ptr->verify_ct = 0; cache_entry_ptr = (H5C_cache_entry_t *)H5C_protect(file_ptr, H5AC_ind_read_dxpl_id, - &(types[type]), entry_ptr->addr, &entry_ptr->addr, H5C__READ_ONLY_FLAG); + types[type], entry_ptr->addr, &entry_ptr->addr, H5C__READ_ONLY_FLAG); if((cache_entry_ptr != (void *)entry_ptr) || (!(entry_ptr->header.is_protected)) || (!(entry_ptr->header.is_read_only)) || (entry_ptr->header.ro_ref_count <= 0) || - (entry_ptr->header.type != &(types[type])) || + (entry_ptr->header.type != types[type]) || (entry_ptr->size != entry_ptr->header.size) || (entry_ptr->addr != entry_ptr->header.addr) || (entry_ptr->verify_ct != entry_ptr->max_verify_ct)) { @@ -17317,7 +17293,7 @@ check_protect_retries(void) entry_ptr->verify_ct = 0; cache_entry_ptr = (H5C_cache_entry_t *)H5C_protect(file_ptr, H5AC_ind_read_dxpl_id, - &(types[type]), entry_ptr->addr, &entry_ptr->addr, H5C__READ_ONLY_FLAG); + types[type], entry_ptr->addr, &entry_ptr->addr, H5C__READ_ONLY_FLAG); /* H5C_protect() should fail after all retries fail */ if(cache_entry_ptr != NULL) @@ -27433,7 +27409,7 @@ check_auto_cache_resize_aux_fcns(void) size_t max_size; size_t min_clean_size; size_t cur_size; - int32_t cur_num_entries; + uint32_t cur_num_entries; H5C_auto_size_ctl_t auto_size_ctl = { /* int32_t version = */ H5C__CURR_AUTO_SIZE_CTL_VER, @@ -28157,8 +28133,7 @@ check_metadata_blizzard_absence(hbool_t fill_via_insertion) } if(show_progress) /* 0 */ - HDfprintf(stdout, "\n%s: check point %d -- pass %d\n", - FUNC, checkpoint++, pass); + HDfprintf(stdout, "\n%s: check point %d -- pass %d\n", FUNC, checkpoint++, pass); if(pass) { @@ -33718,14 +33693,10 @@ check_metadata_cork(hbool_t fill_via_insertion) reset_entries(); - if(fill_via_insertion) { - - TESTING("to ensure cork/uncork metadata when inserting"); - - } else { - - TESTING("to ensure cork/uncork metadata on protect/unprotect"); - } + if(fill_via_insertion) + TESTING("to ensure cork/uncork metadata when inserting") + else + TESTING("to ensure cork/uncork metadata on protect/unprotect") if(show_progress) /* 0 */ HDfprintf(stdout, "\n%s: check point %d -- pass %d\n", @@ -34580,7 +34551,7 @@ cedds__expunge_dirty_entry_in_flush_test(H5F_t * file_ptr) /*------------------------------------------------------------------------- * Function: cedds__H5C_make_space_in_cache() * - * Purpose: Verify that H5C_make_space_in_cache() can handle the + * Purpose: Verify that H5C__make_space_in_cache() can handle the * removal from the cache of the next item in its reverse scan * of the LRU list. * @@ -34590,7 +34561,7 @@ cedds__expunge_dirty_entry_in_flush_test(H5F_t * file_ptr) * load an additional entry, triggering the flush of the last * item, and thereby the deletion of the second to last item. * - * H5C_make_space_in_cache() should detect this deletion, and + * H5C__make_space_in_cache() should detect this deletion, and * restart its scan of the LRU from the tail, instead of * examining the now deleted next item up on the LRU. * @@ -34668,7 +34639,7 @@ cedds__H5C_make_space_in_cache(H5F_t * file_ptr) if(cache_ptr == NULL) { pass = FALSE; - failure_mssg = "cache_ptr NULL on entry to cedds for H5C_make_space_in_cache() test."; + failure_mssg = "cache_ptr NULL on entry to cedds for H5C__make_space_in_cache() test."; } else if((cache_ptr->index_len != 0) || (cache_ptr->index_size != 0)) { @@ -34808,7 +34779,7 @@ cedds__H5C_make_space_in_cache(H5F_t * file_ptr) * and HET 0, 2, and 3 will be evicted to make room for the new * monster entry (MET, 31). * - * Verify this. If H5C_make_space_in_cache() chokes, failure will + * Verify this. If H5C__make_space_in_cache() chokes, failure will * be detected in protect_entry(). Thus end the "if(pass)" clause * there so the error message will not be overwritten. */ @@ -34971,7 +34942,7 @@ cedds__H5C_make_space_in_cache(H5F_t * file_ptr) * access the first item in the LRU repeatedly until the * item, and thereby the deletion of the second to last item. * - * H5C_make_space_in_cache() should detect this deletion, and + * H5C__make_space_in_cache() should detect this deletion, and * restart its scan of the LRU from the tail, instead of * examining the now deleted next item up on the LRU. * diff --git a/test/cache_api.c b/test/cache_api.c index 1d3c9cf..710e38f 100644 --- a/test/cache_api.c +++ b/test/cache_api.c @@ -20,9 +20,6 @@ * with the cache implemented in H5C.c */ -#include "h5test.h" -#include "H5Iprivate.h" -#include "H5ACprivate.h" #include "cache_common.h" /* extern declarations */ @@ -2317,19 +2314,12 @@ main(void) nerrs += 1; } - if ( invalid_configs ) { - + if(invalid_configs) HDfree(invalid_configs); - } - - if ( nerrs > 0 ) { + if(nerrs > 0) return EXIT_FAILURE; - - } else { - + else return EXIT_SUCCESS; - } - } /* main() */ diff --git a/test/cache_common.c b/test/cache_common.c index 5151d65..d1bbf10 100644 --- a/test/cache_common.c +++ b/test/cache_common.c @@ -19,9 +19,6 @@ * This file contains common code for tests of the cache * implemented in H5C.c */ -#include "h5test.h" -#include "H5Cprivate.h" -#include "H5Iprivate.h" #include "H5MFprivate.h" #include "H5MMprivate.h" #include "cache_common.h" @@ -288,27 +285,9 @@ const haddr_t alt_base_addrs[NUMBER_OF_ENTRY_TYPES] = NOTIFY_ALT_BASE_ADDR }; -const char *entry_type_names[NUMBER_OF_ENTRY_TYPES] = -{ - "pico entries -- 1 B", - "nano entries -- 4 B", - "micro entries -- 16 B", - "tiny entries -- 64 B", - "small entries -- 256 B", - "medium entries -- 1 KB", - "large entries -- 4 KB", - "huge entries -- 16 KB", - "monster entries -- 64 KB", - "variable entries -- 1B - 10KB", - "notify entries -- 1B" -}; - -/* callback table declaration */ - -const H5C_class_t types[NUMBER_OF_ENTRY_TYPES] = -{ - { +/* Callback classes */ +static const H5C_class_t pico_class[1] = {{ PICO_ENTRY_TYPE, "pico_entry", H5FD_MEM_DEFAULT, @@ -323,8 +302,9 @@ const H5C_class_t types[NUMBER_OF_ENTRY_TYPES] = NULL, pico_free_icr, NULL, - }, - { +}}; + +static const H5C_class_t nano_class[1] = {{ NANO_ENTRY_TYPE, "nano_entry", H5FD_MEM_DEFAULT, @@ -339,8 +319,9 @@ const H5C_class_t types[NUMBER_OF_ENTRY_TYPES] = NULL, nano_free_icr, NULL, - }, - { +}}; + +static const H5C_class_t micro_class[1] = {{ MICRO_ENTRY_TYPE, "micro_entry", H5FD_MEM_DEFAULT, @@ -355,8 +336,9 @@ const H5C_class_t types[NUMBER_OF_ENTRY_TYPES] = NULL, micro_free_icr, NULL, - }, - { +}}; + +static const H5C_class_t tiny_class[1] = {{ TINY_ENTRY_TYPE, "tiny_entry", H5FD_MEM_DEFAULT, @@ -371,8 +353,9 @@ const H5C_class_t types[NUMBER_OF_ENTRY_TYPES] = NULL, tiny_free_icr, NULL, - }, - { +}}; + +static const H5C_class_t small_class[1] = {{ SMALL_ENTRY_TYPE, "small_entry", H5FD_MEM_DEFAULT, @@ -387,8 +370,9 @@ const H5C_class_t types[NUMBER_OF_ENTRY_TYPES] = NULL, small_free_icr, NULL, - }, - { +}}; + +static const H5C_class_t medium_class[1] = {{ MEDIUM_ENTRY_TYPE, "medium_entry", H5FD_MEM_DEFAULT, @@ -403,8 +387,9 @@ const H5C_class_t types[NUMBER_OF_ENTRY_TYPES] = NULL, medium_free_icr, NULL, - }, - { +}}; + +static const H5C_class_t large_class[1] = {{ LARGE_ENTRY_TYPE, "large_entry", H5FD_MEM_DEFAULT, @@ -419,8 +404,9 @@ const H5C_class_t types[NUMBER_OF_ENTRY_TYPES] = NULL, large_free_icr, NULL, - }, - { +}}; + +static const H5C_class_t huge_class[1] = {{ HUGE_ENTRY_TYPE, "huge_entry", H5FD_MEM_DEFAULT, @@ -435,8 +421,9 @@ const H5C_class_t types[NUMBER_OF_ENTRY_TYPES] = NULL, huge_free_icr, NULL, - }, - { +}}; + +static const H5C_class_t monster_class[1] = {{ MONSTER_ENTRY_TYPE, "monster_entry", H5FD_MEM_DEFAULT, @@ -451,8 +438,9 @@ const H5C_class_t types[NUMBER_OF_ENTRY_TYPES] = NULL, monster_free_icr, NULL, - }, - { +}}; + +static const H5C_class_t variable_class[1] = {{ VARIABLE_ENTRY_TYPE, "variable_entry", H5FD_MEM_DEFAULT, @@ -467,8 +455,9 @@ const H5C_class_t types[NUMBER_OF_ENTRY_TYPES] = NULL, variable_free_icr, NULL, - }, - { +}}; + +static const H5C_class_t notify_class[1] = {{ NOTIFY_ENTRY_TYPE, "notify_entry", H5FD_MEM_DEFAULT, @@ -483,7 +472,22 @@ const H5C_class_t types[NUMBER_OF_ENTRY_TYPES] = notify_notify, notify_free_icr, NULL, - } +}}; + +/* callback table declaration */ + +const H5C_class_t *types[NUMBER_OF_ENTRY_TYPES] = { + pico_class, + nano_class, + micro_class, + tiny_class, + small_class, + medium_class, + large_class, + huge_class, + monster_class, + variable_class, + notify_class }; /* address translation functions: */ @@ -3231,8 +3235,8 @@ setup_cache(size_t max_cache_size, if(verbose) HDfprintf(stdout, "%s: H5Fcreate() failed.\n", FUNC); - } - } + } /* end if */ + } /* end if */ if(show_progress) /* 4 */ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", @@ -3300,7 +3304,7 @@ setup_cache(size_t max_cache_size, cache_ptr = H5C_create(max_cache_size, min_clean_size, (NUMBER_OF_ENTRY_TYPES - 1), - (const char **)entry_type_names, + types, check_write_permitted, TRUE, NULL, @@ -3533,7 +3537,7 @@ expunge_entry(H5F_t * file_ptr, HDassert( ! ( entry_ptr->is_pinned ) ); result = H5C_expunge_entry(file_ptr, H5AC_ind_read_dxpl_id, - &(types[type]), entry_ptr->addr, H5C__NO_FLAGS_SET); + types[type], entry_ptr->addr, H5C__NO_FLAGS_SET); if ( result < 0 ) { @@ -3754,11 +3758,11 @@ insert_entry(H5F_t * file_ptr, } result = H5C_insert_entry(file_ptr, xfer, - &(types[type]), entry_ptr->addr, (void *)entry_ptr, flags); + types[type], entry_ptr->addr, (void *)entry_ptr, flags); if ( ( result < 0 ) || ( entry_ptr->header.is_protected ) || - ( entry_ptr->header.type != &(types[type]) ) || + ( entry_ptr->header.type != types[type] ) || ( entry_ptr->size != entry_ptr->header.size ) || ( entry_ptr->addr != entry_ptr->header.addr ) ) { @@ -3771,8 +3775,8 @@ insert_entry(H5F_t * file_ptr, HDfprintf(stdout, "entry_ptr->header.is_protected = %d\n", (int)(entry_ptr->header.is_protected)); HDfprintf(stdout, - "entry_ptr->header.type != &(types[type]) = %d\n", - (int)(entry_ptr->header.type != &(types[type]))); + "entry_ptr->header.type != types[type] = %d\n", + (int)(entry_ptr->header.type != types[type])); HDfprintf(stdout, "entry_ptr->size != entry_ptr->header.size = %d\n", (int)(entry_ptr->size != entry_ptr->header.size)); @@ -3855,7 +3859,7 @@ mark_entry_dirty(int32_t type, ( !entry_ptr->header.is_protected && !entry_ptr->header.is_pinned ) || ( entry_ptr->header.is_protected && !entry_ptr->header.dirtied ) || ( !entry_ptr->header.is_protected && !entry_ptr->header.is_dirty ) || - ( entry_ptr->header.type != &(types[type]) ) || + ( entry_ptr->header.type != types[type] ) || ( entry_ptr->size != entry_ptr->header.size ) || ( entry_ptr->addr != entry_ptr->header.addr ) ) { @@ -3948,7 +3952,7 @@ move_entry(H5C_t * cache_ptr, mark_flush_dep_dirty(entry_ptr); entry_ptr->action = TEST_ENTRY_ACTION_MOVE; - result = H5C_move_entry(cache_ptr, &(types[type]), old_addr, new_addr); + result = H5C_move_entry(cache_ptr, types[type], old_addr, new_addr); entry_ptr->action = TEST_ENTRY_ACTION_NUL; } @@ -4027,12 +4031,12 @@ protect_entry(H5F_t * file_ptr, int32_t type, int32_t idx) } /* end if */ cache_entry_ptr = (H5C_cache_entry_t *)H5C_protect(file_ptr, xfer, - &(types[type]), entry_ptr->addr, &entry_ptr->addr, + types[type], entry_ptr->addr, &entry_ptr->addr, H5C__NO_FLAGS_SET); if ( ( cache_entry_ptr != (void *)entry_ptr ) || ( !(entry_ptr->header.is_protected) ) || - ( entry_ptr->header.type != &(types[type]) ) || + ( entry_ptr->header.type != types[type] ) || ( entry_ptr->size != entry_ptr->header.size ) || ( entry_ptr->addr != entry_ptr->header.addr ) ) { @@ -4049,8 +4053,8 @@ protect_entry(H5F_t * file_ptr, int32_t type, int32_t idx) HDfprintf(stdout, "entry_ptr->header.is_protected = %d\n", (int)(entry_ptr->header.is_protected)); HDfprintf(stdout, - "( entry_ptr->header.type != &(types[type]) ) = %d\n", - (int)( entry_ptr->header.type != &(types[type]) )); + "( entry_ptr->header.type != types[type] ) = %d\n", + (int)( entry_ptr->header.type != types[type] )); HDfprintf(stdout, "entry_ptr->size = %d, entry_ptr->header.size = %d\n", (int)(entry_ptr->size), (int)(entry_ptr->header.size)); @@ -4131,13 +4135,13 @@ protect_entry_ro(H5F_t * file_ptr, ( entry_ptr->ro_ref_count > 0 ) ) ); cache_entry_ptr = (H5C_cache_entry_t *)H5C_protect(file_ptr, H5AC_ind_read_dxpl_id, - &(types[type]), entry_ptr->addr, &entry_ptr->addr, H5C__READ_ONLY_FLAG); + types[type], entry_ptr->addr, &entry_ptr->addr, H5C__READ_ONLY_FLAG); if ( ( cache_entry_ptr != (void *)entry_ptr ) || ( !(entry_ptr->header.is_protected) ) || ( !(entry_ptr->header.is_read_only) ) || ( entry_ptr->header.ro_ref_count <= 0 ) || - ( entry_ptr->header.type != &(types[type]) ) || + ( entry_ptr->header.type != types[type] ) || ( entry_ptr->size != entry_ptr->header.size ) || ( entry_ptr->addr != entry_ptr->header.addr ) ) { @@ -4268,7 +4272,7 @@ unpin_entry(int32_t type, if ( ( result < 0 ) || ( entry_ptr->header.pinned_from_client ) || ( entry_ptr->header.is_pinned && !entry_ptr->header.pinned_from_cache ) || - ( entry_ptr->header.type != &(types[type]) ) || + ( entry_ptr->header.type != types[type] ) || ( entry_ptr->size != entry_ptr->header.size ) || ( entry_ptr->addr != entry_ptr->header.addr ) ) { @@ -4353,7 +4357,7 @@ unprotect_entry(H5F_t * file_ptr, ( ( entry_ptr->header.is_protected ) && ( ( ! ( entry_ptr->is_read_only ) ) || ( entry_ptr->ro_ref_count <= 0 ) ) ) || - ( entry_ptr->header.type != &(types[type]) ) || + ( entry_ptr->header.type != types[type] ) || ( entry_ptr->size != entry_ptr->header.size ) || ( entry_ptr->addr != entry_ptr->header.addr ) ) { @@ -6128,7 +6132,7 @@ check_and_validate_cache_size(hid_t file_id, size_t min_clean_size; size_t expected_cur_size; size_t cur_size; - int32_t expected_cur_num_entries; + uint32_t expected_cur_num_entries; int cur_num_entries; H5F_t * file_ptr = NULL; H5C_t * cache_ptr = NULL; @@ -6434,7 +6438,7 @@ dump_LRU(H5F_t * file_ptr) entry_ptr = cache_ptr->LRU_head_ptr; HDfprintf(stdout, - "\n\nIndex len/size/clean size/dirty size = %d/%lld/%lld/%lld\n", + "\n\nIndex len/size/clean size/dirty size = %u/%lld/%lld/%lld\n", cache_ptr->index_len, (long long)(cache_ptr->index_size), (long long)(cache_ptr->clean_index_size), (long long)(cache_ptr->dirty_index_size)); diff --git a/test/cache_common.h b/test/cache_common.h index befcee4..f003189 100644 --- a/test/cache_common.h +++ b/test/cache_common.h @@ -553,11 +553,10 @@ H5TEST_DLLVAR const int32_t max_indices[NUMBER_OF_ENTRY_TYPES]; H5TEST_DLLVAR const size_t entry_sizes[NUMBER_OF_ENTRY_TYPES]; H5TEST_DLLVAR const haddr_t base_addrs[NUMBER_OF_ENTRY_TYPES]; H5TEST_DLLVAR const haddr_t alt_base_addrs[NUMBER_OF_ENTRY_TYPES]; -H5TEST_DLLVAR const char * entry_type_names[NUMBER_OF_ENTRY_TYPES]; /* callback table extern */ -H5TEST_DLLVAR const H5C_class_t types[NUMBER_OF_ENTRY_TYPES]; +H5TEST_DLLVAR const H5C_class_t *types[NUMBER_OF_ENTRY_TYPES]; #ifdef __cplusplus diff --git a/test/cache_tagging.c b/test/cache_tagging.c index 473851e..02ce19b 100644 --- a/test/cache_tagging.c +++ b/test/cache_tagging.c @@ -21,11 +21,8 @@ #include "H5Fpkg.h" #include "testhdf5.h" -#include "h5test.h" #include "cache_common.h" -#include "H5Iprivate.h" -#include "H5ACprivate.h" #include "H5HLprivate.h" /* ============ */ @@ -956,9 +953,9 @@ check_dense_attribute_tags(void) int verbose = FALSE; /* verbose file outout */ int i = 0; /* iterator */ hid_t fapl = -1; /* File access property list */ - haddr_t d_tag = 0; /* Dataset tag value */ - haddr_t root_tag = 0; /* Root group tag value */ - char attrname[500]; /* Name of attribute */ + haddr_t d_tag = 0; /* Dataset tag value */ + haddr_t root_tag = 0; /* Root group tag value */ + char attrname[500]; /* Name of attribute */ /* Testing Macro */ TESTING("tag application during dense attribute manipulation"); @@ -1536,6 +1533,7 @@ check_attribute_rename_tags(hid_t fcpl, int type) /* Close and Reopen the file and group */ if ( H5Gclose(gid) < 0 ) TEST_ERROR; if ( H5Fclose(fid) < 0 ) TEST_ERROR; + if ( (fid = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT)) < 0 ) TEST_ERROR; if ( (gid = H5Gopen2(fid, GROUPNAME, H5P_DEFAULT)) < 0 ) TEST_ERROR; diff --git a/test/dsets.c b/test/dsets.c index d086c58..39b7c22 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -507,7 +507,7 @@ test_simple_io(const char *env_h5_drvr, hid_t fapl) TESTING("simple I/O"); - /* Can't run this test with multi-file VFDs */ + /* Can't run this test with multi-file VFDs because of HDopen/read/seek the file directly */ if(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi") && HDstrcmp(env_h5_drvr, "family")) { h5_fixname(FILENAME[4], fapl, filename, sizeof filename); @@ -645,7 +645,7 @@ test_userblock_offset(const char *env_h5_drvr, hid_t fapl) TESTING("dataset offset with user block"); - /* Can't run this test with multi-file VFDs */ + /* Can't run this test with multi-file VFDs because of HDopen/read/seek the file directly */ if(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi") && HDstrcmp(env_h5_drvr, "family")) { h5_fixname(FILENAME[2], fapl, filename, sizeof filename); @@ -1984,10 +1984,11 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl, int if_fletcher32, } } - PASSED(); - /* Get the storage size of the dataset */ if((*dset_size=H5Dget_storage_size(dataset))==0) goto error; + + PASSED(); + /* Clean up objects used for this test */ if(H5Dclose (dataset) < 0) goto error; if(H5Sclose (sid) < 0) goto error; @@ -2932,6 +2933,7 @@ test_nbit_int(hid_t file) PASSED(); return 0; + error: return -1; } diff --git a/test/earray.c b/test/earray.c index 07acbb5..c6f5986 100644 --- a/test/earray.c +++ b/test/earray.c @@ -159,15 +159,6 @@ typedef struct earray_test_t { /* Local prototypes */ -/* Metadata cache (H5AC) callbacks */ -static herr_t earray_cache_test_get_initial_load_size(void *udata, size_t *image_len); -static void *earray_cache_test_deserialize(const void *image_ptr, size_t len, - void *udata_ptr, hbool_t *dirty_ptr); -static herr_t earray_cache_test_image_len(const void *thing, size_t *image_len_ptr); -static herr_t earray_cache_test_serialize(const H5F_t *f, void *image_ptr, - size_t len, void *thing); -static herr_t earray_cache_test_free_icr(void *thing); - /* Local variables */ const char *FILENAME[] = { @@ -182,24 +173,6 @@ char filename_g[EARRAY_FILENAME_LEN]; /* Empty file size */ h5_stat_size_t empty_size_g; -/* H5EA test object inherits cache-like properties from H5AC */ -const H5AC_class_t H5AC_EARRAY_TEST[1] = {{ - /* id */ H5AC_TEST_ID, - /* name */ "earray test", - /* mem_type */ H5FD_MEM_DEFAULT, - /* flags */ H5AC__CLASS_SKIP_READS | H5AC__CLASS_SKIP_WRITES, - /* get_initial_load_size */ earray_cache_test_get_initial_load_size, - /* get_final_load_size */ NULL, - /* verify_chksum */ NULL, - /* deserialize */ earray_cache_test_deserialize, - /* image_len */ earray_cache_test_image_len, - /* pre_serialize */ NULL, - /* serialize */ earray_cache_test_serialize, - /* notify */ NULL, - /* free_icr */ earray_cache_test_free_icr, - /* fsf_size */ NULL, -}}; - /*------------------------------------------------------------------------- * Function: init_cparam @@ -619,225 +592,6 @@ error: /*------------------------------------------------------------------------- - * Function: earray_cache_test_get_initial_load_size() - * - * Purpose: place holder function -- should never be called - * - * A generic discussion of metadata cache callbacks of this type - * may be found in H5Cprivate.h. - * - * Return: Success: SUCCEED - * Failure: FAIL - * - * Programmer: John Mainzer - * 8/2/14 - * - *------------------------------------------------------------------------- - */ -static herr_t -earray_cache_test_get_initial_load_size( void *udata, size_t *image_len) -{ - HDassert(udata); - HDassert(image_len); - - /* Should never be called */ - HDassert(0 && "Can't be called!"); - - *image_len = 0; - - return(SUCCEED); -} /* end earray_cache_test_get_initial_load_size() */ - - -/*------------------------------------------------------------------------- - * Function: earray_cache_test_deserialize - * - * Purpose: place holder function -- should never be called. - * - * - * A generic discussion of metadata cache callbacks of this type - * may be found in H5Cprivate.h: - * - * Return: Success: Pointer to in core representation - * Failure: NULL - * - * Programmer: John Mainzer - * 8/2/14 - * - *------------------------------------------------------------------------- - */ -static void * -earray_cache_test_deserialize(const void *image_ptr, - size_t len, - void *udata_ptr, - hbool_t *dirty_ptr) -{ - HDassert(image_ptr); - HDassert(len > 0 ); - HDassert(udata_ptr); - HDassert(dirty_ptr); - - /* Should never be called */ - HDassert(0 && "Can't be called!"); - - return(NULL); -} /* end earray_cache_test_deserialize() */ - - -/*------------------------------------------------------------------------- - * Function: earray_cache_test_image_len - * - * Purpose: test code place holder function -- just set *image_len_ptr to - * one. - * - * - * A generic discussion of metadata cache callbacks of this type - * may be found in H5Cprivate.h: - * - * Return: Success: SUCCEED - * Failure: FAIL - * - * Programmer: John Mainzer - * 8/2/14 - * - *------------------------------------------------------------------------- - */ -static herr_t -earray_cache_test_image_len(const void *thing, size_t *image_len_ptr) -{ - HDassert(thing); - HDassert(image_len_ptr); - - /* Set size value */ - /* (hard-code to 1) */ - *image_len_ptr = 1; - - return(SUCCEED); -} /* end earray_cache_test_image_len() */ - - - -/*------------------------------------------------------------------------- - * Function: earray_cache_test_serialize - * - * Purpose: Validate the contents of the instance of earray_test_t. - * - * - * A generic discussion of metadata cache callbacks of this type - * may be found in H5Cprivate.h: - * - * - * Return: Success: SUCCEED - * Failure: FAIL - * - * Programmer: John Mainzer - * 8/2/14 - * - *------------------------------------------------------------------------- - */ -static herr_t -earray_cache_test_serialize(const H5F_t *f, - void *image_ptr, - H5_ATTR_UNUSED size_t len, - void *thing) -{ - earray_test_t *test; - - HDassert(f); - HDassert(image_ptr); - HDassert(thing); - test = (earray_test_t *)thing; - HDassert(test); - HDassert(test->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert((const H5AC_class_t *)(test->cache_info.type) == - &(H5AC_EARRAY_TEST[0])); - - /* Check for out of order flush */ - if(test->fd_info->base_obj) - TEST_ERROR - - /* Check which index this entry corresponds to */ - if((uint64_t)0 == test->idx) { - /* Check for out of order flush */ - if(test->fd_info->idx0_obj || test->fd_info->idx0_elem) - TEST_ERROR - - /* Set flag for object flush */ - test->fd_info->idx0_obj = TRUE; - } /* end if */ - else if((uint64_t)1 == test->idx) { - /* Check for out of order flush */ - if(test->fd_info->idx1_obj || test->fd_info->idx1_elem) - TEST_ERROR - - /* Set flag for object flush */ - test->fd_info->idx1_obj = TRUE; - } /* end if */ - else if((uint64_t)10000 == test->idx) { - /* Check for out of order flush */ - if(test->fd_info->idx10000_obj || test->fd_info->idx10000_elem) - TEST_ERROR - - /* Set flag for object flush */ - test->fd_info->idx10000_obj = TRUE; - } /* end if */ - else if((uint64_t)-1 == test->idx) { - /* Set flag for object flush */ - test->fd_info->base_obj = TRUE; - } /* end if */ - - return(SUCCEED); - -error: - return(FAIL); -} /* end earray_cache_test_serialize() */ - - - -/*------------------------------------------------------------------------- - * Function: earray_cache_test_free_icr - * - * Purpose: Destroy an extensible array test object in memory. - * - * - * A generic discussion of metadata cache callbacks of this type - * may be found in H5Cprivate.h: - * - * - * Return: Success: SUCCEED - * Failure: FAIL - * - * Programmer: John Mainzer - * 8/2/14 - * - *------------------------------------------------------------------------- - */ -static herr_t -earray_cache_test_free_icr(void *thing) -{ - earray_test_t *test; - - HDassert(thing); - test = (earray_test_t *)thing; - HDassert(test); - - /* the metadata cache sets cache_info.magic to - * H5C__H5C_CACHE_ENTRY_T_BAD_MAGIC before calling the - * free_icr routine. Hence the following assert: - */ - - HDassert(test->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_BAD_MAGIC); - HDassert((const H5AC_class_t *)(test->cache_info.type) == - &(H5AC_EARRAY_TEST[0])); - - /* Free the shared info itself */ - HDfree(test); - - return(SUCCEED); -} /* end earray_cache_test_free_icr() */ - - -/*------------------------------------------------------------------------- * Function: test_create * * Purpose: Test creating extensible array diff --git a/test/enc_dec_plist.c b/test/enc_dec_plist.c index 4f0147e..5179e8e 100644 --- a/test/enc_dec_plist.c +++ b/test/enc_dec_plist.c @@ -117,6 +117,11 @@ main(void) 0.2f, (256 * 2048), H5AC__DEFAULT_METADATA_WRITE_STRATEGY}; + H5AC_cache_image_config_t my_cache_image_config = { + H5AC__CURR_CACHE_IMAGE_CONFIG_VERSION, + TRUE, + FALSE, + -1}; if(VERBOSE_MED) printf("Encode/Decode DCPLs\n"); @@ -455,6 +460,8 @@ main(void) FAIL_STACK_ERROR if((H5Pset_mdc_config(fapl, &my_cache_config)) < 0) FAIL_STACK_ERROR + if((H5Pset_mdc_image_config(fapl, &my_cache_image_config)) < 0) + FAIL_STACK_ERROR if((H5Pset_core_write_tracking(fapl, TRUE, 1024 * 1024)) < 0) FAIL_STACK_ERROR diff --git a/test/evict_on_close.c b/test/evict_on_close.c index e0a7a73..3986d5a 100644 --- a/test/evict_on_close.c +++ b/test/evict_on_close.c @@ -600,7 +600,7 @@ check_group_layout(hid_t fid, const char *group_name) hid_t gid1 = -1, gid2 = -1; /* group IDs */ H5G_t *grp_ptr = NULL; /* ptr to internal group struct */ haddr_t tag1, tag2; /* MD cache tags for groups */ - int32_t before, during, after; /* cache sizes */ + uint32_t before, during, after; /* cache sizes */ int i; /* iterator */ /* NOTE: The TESTING() macro is called in main() */ @@ -616,7 +616,7 @@ check_group_layout(hid_t fid, const char *group_name) HDprintf("\nCACHE BEFORE GROUP OPEN:\n"); if(H5AC_dump_cache(file_ptr) < 0) TEST_ERROR; - HDprintf("NUMBER OF CACHE ENTRIES: %d\n", before); + HDprintf("NUMBER OF CACHE ENTRIES: %u\n", before); #endif /* Open the main group and get its tag */ @@ -658,7 +658,7 @@ check_group_layout(hid_t fid, const char *group_name) if(H5AC_dump_cache(file_ptr) < 0) TEST_ERROR; HDprintf("MAIN GROUP TAG: %#X\n", tag1); - HDprintf("NUMBER OF CACHE ENTRIES: %d\n", during); + HDprintf("NUMBER OF CACHE ENTRIES: %u\n", during); #endif /* Close the main group */ @@ -672,7 +672,7 @@ check_group_layout(hid_t fid, const char *group_name) HDprintf("\nCACHE AFTER CLOSING GROUPS:\n"); if(H5AC_dump_cache(file_ptr) < 0) TEST_ERROR; - HDprintf("NUMBER OF CACHE ENTRIES: %d\n", after); + HDprintf("NUMBER OF CACHE ENTRIES: %u\n", after); #endif /* Ensure that the cache does not contain entries with the tag */ @@ -718,7 +718,7 @@ check_dset_scheme(hid_t fid, const char *dset_name) H5D_t *dset_ptr = NULL; /* ptr to internal dset struct */ haddr_t tag; /* MD cache tag for dataset */ int *data = NULL; /* buffer for fake data */ - int32_t before, during, after; /* cache sizes */ + uint32_t before, during, after; /* cache sizes */ /* NOTE: The TESTING() macro is called in main() */ @@ -737,7 +737,7 @@ check_dset_scheme(hid_t fid, const char *dset_name) HDprintf("\nCACHE BEFORE DATASET OPEN:\n"); if(H5AC_dump_cache(file_ptr) < 0) TEST_ERROR; - HDprintf("NUMBER OF CACHE ENTRIES: %d\n", before); + HDprintf("NUMBER OF CACHE ENTRIES: %u\n", before); #endif /* Open dataset and get the metadata tag */ @@ -761,7 +761,7 @@ check_dset_scheme(hid_t fid, const char *dset_name) if(H5AC_dump_cache(file_ptr) < 0) TEST_ERROR; HDprintf("TAG: %#X\n", tag); - HDprintf("NUMBER OF CACHE ENTRIES: %d\n", during); + HDprintf("NUMBER OF CACHE ENTRIES: %u\n", during); #endif /* Close the dataset */ @@ -775,7 +775,7 @@ check_dset_scheme(hid_t fid, const char *dset_name) HDprintf("\nCACHE AFTER DATASET CLOSE:\n"); if(H5AC_dump_cache(file_ptr) < 0) TEST_ERROR; - HDprintf("NUMBER OF CACHE ENTRIES: %d\n", after); + HDprintf("NUMBER OF CACHE ENTRIES: %u\n", after); #endif /* Ensure that the cache does not contain entries with the tag */ diff --git a/test/fheap.c b/test/fheap.c index 8e364de..82859d2 100644 --- a/test/fheap.c +++ b/test/fheap.c @@ -16360,6 +16360,7 @@ main(void) /* Reset library */ h5_reset(); + fapl = h5_fileaccess(); ExpressMode = GetTestExpress(); if(ExpressMode > 1) @@ -16379,13 +16380,7 @@ main(void) shared_wobj_g[u] = (unsigned char)u; /* Iterate over the testing parameters */ -#ifndef QAK for(curr_test = FHEAP_TEST_NORMAL; curr_test < FHEAP_TEST_NTESTS; H5_INC_ENUM(fheap_test_type_t, curr_test)) { -#else /* QAK */ -HDfprintf(stderr, "Uncomment test loop!\n"); -curr_test = FHEAP_TEST_NORMAL; -/* curr_test = FHEAP_TEST_REOPEN; */ -#endif /* QAK */ /* Clear the testing parameters */ HDmemset(&tparam, 0, sizeof(fheap_test_param_t)); tparam.actual_id_len = HEAP_ID_LEN; @@ -16410,7 +16405,6 @@ curr_test = FHEAP_TEST_NORMAL; } /* end switch */ /* Test fractal heap creation */ -#ifndef QAK nerrors += test_create(fapl, &small_cparam, &tparam); nerrors += test_reopen(fapl, &small_cparam, &tparam); nerrors += test_open_twice(fapl, &small_cparam, &tparam); @@ -16419,23 +16413,12 @@ curr_test = FHEAP_TEST_NORMAL; nerrors += test_filtered_create(fapl, &small_cparam); nerrors += test_size(fapl, &small_cparam); nerrors += test_reopen_hdr(fapl, &small_cparam); -#else /* QAK */ -HDfprintf(stderr, "Uncomment tests!\n"); -#endif /* QAK */ -#ifndef QAK2 -#ifndef QAK { fheap_test_fill_t fill; /* Size of objects to fill heap blocks with */ -#ifndef QAK2 /* Filling with different sized objects */ for(fill = FHEAP_TEST_FILL_LARGE; fill < FHEAP_TEST_FILL_N; H5_INC_ENUM(fheap_test_fill_t, fill)) { -#else /* QAK2 */ -HDfprintf(stderr, "Uncomment test loop!\n"); -fill = FHEAP_TEST_FILL_LARGE; -/* fill = FHEAP_TEST_FILL_SINGLE; */ -#endif /* QAK2 */ tparam.fill = fill; /* Set appropriate testing parameters for each test */ @@ -16460,12 +16443,8 @@ fill = FHEAP_TEST_FILL_LARGE; * Test fractal heap managed object insertion */ -#ifndef QAK /* "Weird" sized objects */ nerrors += test_man_insert_weird(fapl, &small_cparam, &tparam); -#else /* QAK */ -HDfprintf(stderr, "Uncomment tests!\n"); -#endif /* QAK */ #ifdef ALL_INSERT_TESTS /* "Standard" sized objects, building from simple to complex heaps */ @@ -16501,20 +16480,15 @@ HDfprintf(stderr, "Uncomment tests!\n"); /* If this test fails, uncomment the tests above, which build up to this * level of complexity gradually. -QAK */ -#ifndef QAK if(ExpressMode > 1) printf("***Express test mode on. test_man_start_5th_recursive_indirect is skipped\n"); else nerrors += test_man_start_5th_recursive_indirect(fapl, &small_cparam, &tparam); -#else /* QAK */ -HDfprintf(stderr, "Uncomment tests!\n"); -#endif /* QAK */ /* * Test fractal heap object deletion */ /* Simple removal */ -#ifndef QAK nerrors += test_man_remove_bogus(fapl, &small_cparam, &tparam); nerrors += test_man_remove_one(fapl, &small_cparam, &tparam); nerrors += test_man_remove_two(fapl, &small_cparam, &tparam); @@ -16531,12 +16505,7 @@ HDfprintf(stderr, "Uncomment tests!\n"); /* Incremental insert & removal */ tparam.del_dir = FHEAP_DEL_FORWARD; nerrors += test_man_incr_insert_remove(fapl, &small_cparam, &tparam); -#else /* QAK */ -HDfprintf(stderr, "Uncomment tests!\n"); -#endif /* QAK */ -#ifndef QAK -#ifndef QAK2 { fheap_test_del_dir_t del_dir; /* Deletion direction */ fheap_test_del_drain_t drain_half; /* Deletion draining */ @@ -16546,19 +16515,10 @@ HDfprintf(stderr, "Uncomment tests!\n"); tparam.del_dir = del_dir; for(drain_half = FHEAP_DEL_DRAIN_ALL; drain_half < FHEAP_DEL_DRAIN_N; H5_INC_ENUM(fheap_test_del_drain_t, drain_half)) { tparam.drain_half = drain_half; -#else /* QAK2 */ -HDfprintf(stderr, "Uncomment test loops!\n"); -/* tparam.del_dir = FHEAP_DEL_FORWARD; */ -/* tparam.del_dir = FHEAP_DEL_REVERSE; */ -tparam.del_dir = FHEAP_DEL_HEAP; -tparam.drain_half = FHEAP_DEL_DRAIN_ALL; -/* tparam.drain_half = FHEAP_DEL_DRAIN_HALF; */ -#endif /* QAK2 */ /* Don't need to test deletion directions when deleting entire heap */ if(tparam.del_dir == FHEAP_DEL_HEAP && tparam.drain_half > FHEAP_DEL_DRAIN_ALL) break; -#ifndef QAK /* Simple insertion patterns */ nerrors += test_man_remove_root_direct(fapl, &small_cparam, &tparam); nerrors += test_man_remove_two_direct(fapl, &small_cparam, &tparam); @@ -16572,11 +16532,7 @@ tparam.drain_half = FHEAP_DEL_DRAIN_ALL; nerrors += test_man_remove_2nd_indirect(fapl, &small_cparam, &tparam); nerrors += test_man_remove_3rd_indirect(fapl, &small_cparam, &tparam); } /* end else */ -#else /* QAK */ -HDfprintf(stderr, "Uncomment tests!\n"); -#endif /* QAK */ -#ifndef QAK /* Skip blocks insertion */ /* (covers insertion & deletion of skipped blocks) */ nerrors += test_man_skip_start_block(fapl, &small_cparam, &tparam); @@ -16608,21 +16564,13 @@ HDfprintf(stderr, "Uncomment tests!\n"); nerrors += test_man_fill_3rd_direct_fill_2nd_direct_fill_direct_skip_3rd_indirect_wrap_start_block_add_skipped(fapl, &small_cparam, &tparam); nerrors += test_man_fill_4th_direct_less_one_fill_2nd_direct_fill_direct_skip_3rd_indirect_wrap_start_block_add_skipped(fapl, &small_cparam, &tparam); } /* end else */ -#else /* QAK */ -HDfprintf(stderr, "Uncomment tests!\n"); -#endif /* QAK */ -#ifndef QAK /* Fragmented insertion patterns */ /* (covers insertion & deletion of fragmented blocks) */ nerrors += test_man_frag_simple(fapl, &small_cparam, &tparam); nerrors += test_man_frag_direct(fapl, &small_cparam, &tparam); nerrors += test_man_frag_2nd_direct(fapl, &small_cparam, &tparam); nerrors += test_man_frag_3rd_direct(fapl, &small_cparam, &tparam); -#else /* QAK */ - HDfprintf(stderr, "Uncomment tests!\n"); -#endif /* QAK */ -#ifndef QAK2 } /* end for */ } /* end for */ @@ -16630,22 +16578,12 @@ HDfprintf(stderr, "Uncomment tests!\n"); tparam.drain_half = FHEAP_DEL_DRAIN_ALL; } /* end block */ -#endif /* QAK2 */ -#else /* QAK */ -HDfprintf(stderr, "Uncomment tests!\n"); -#endif /* QAK */ -#ifndef QAK2 } /* end for */ -#endif /* QAK2 */ } /* end block */ -#else /* QAK */ -HDfprintf(stderr, "Uncomment tests!\n"); -#endif /* QAK */ /* * Test fractal heap 'huge' & 'tiny' object insertion & deletion */ -#ifndef QAK { fheap_test_del_dir_t del_dir; /* Deletion direction */ unsigned id_len; /* Length of heap IDs */ @@ -16687,24 +16625,16 @@ HDfprintf(stderr, "Uncomment tests!\n"); tparam.del_dir = del_dir; /* Test 'huge' object insert & delete */ -#ifndef QAK nerrors += test_huge_insert_one(fapl, &small_cparam, &tparam); nerrors += test_huge_insert_two(fapl, &small_cparam, &tparam); nerrors += test_huge_insert_three(fapl, &small_cparam, &tparam); nerrors += test_huge_insert_mix(fapl, &small_cparam, &tparam); nerrors += test_filtered_huge(fapl, &small_cparam, &tparam); -#else /* QAK */ -HDfprintf(stderr, "Uncomment tests!\n"); -#endif /* QAK */ -#ifndef QAK /* Test 'tiny' object insert & delete */ nerrors += test_tiny_insert_one(fapl, &small_cparam, &tparam); nerrors += test_tiny_insert_two(fapl, &small_cparam, &tparam); nerrors += test_tiny_insert_mix(fapl, &small_cparam, &tparam); -#else /* QAK */ -HDfprintf(stderr, "Uncomment tests!\n"); -#endif /* QAK */ } /* end for */ } /* end for */ @@ -16712,16 +16642,9 @@ HDfprintf(stderr, "Uncomment tests!\n"); small_cparam.id_len = 0; tparam.actual_id_len = HEAP_ID_LEN; } /* end block */ -#else /* QAK */ -HDfprintf(stderr, "Uncomment tests!\n"); -#endif /* QAK */ -#else /* QAK2 */ -HDfprintf(stderr, "Uncomment tests!\n"); -#endif /* QAK2 */ /* Test I/O filter support */ -#ifndef QAK /* Try several different methods of deleting objects */ { fheap_test_del_dir_t del_dir; /* Deletion direction */ @@ -16743,16 +16666,11 @@ HDfprintf(stderr, "Uncomment tests!\n"); tparam.comp = FHEAP_TEST_NO_COMPRESS; } /* end for */ } /* end block */ -#else /* QAK */ -HDfprintf(stderr, "Uncomment tests!\n"); -#endif /* QAK */ -#ifndef QAK /* Random object insertion & deletion */ if(ExpressMode > 1) printf("***Express test mode on. Some tests skipped\n"); else { -#ifndef QAK /* Random tests using "small" heap creation parameters */ puts("Using 'small' heap creation parameters"); @@ -16765,11 +16683,7 @@ HDfprintf(stderr, "Uncomment tests!\n"); tparam.del_dir = FHEAP_DEL_HEAP; nerrors += test_random((curr_test == FHEAP_TEST_NORMAL ? (hsize_t)(100*1000*1000) : (hsize_t)(50*1000*1000)), fapl, &small_cparam, &tparam); nerrors += test_random_pow2((curr_test == FHEAP_TEST_NORMAL ? (hsize_t)(100*1000*1000) : (hsize_t)(4*1000*1000)), fapl, &small_cparam, &tparam); -#else /* QAK */ -HDfprintf(stderr, "Uncomment tests!\n"); -#endif /* QAK */ -#ifndef QAK /* Random tests using "large" heap creation parameters */ puts("Using 'large' heap creation parameters"); tparam.actual_id_len = LARGE_HEAP_ID_LEN; @@ -16783,18 +16697,11 @@ HDfprintf(stderr, "Uncomment tests!\n"); tparam.del_dir = FHEAP_DEL_HEAP; nerrors += test_random((curr_test == FHEAP_TEST_NORMAL ? (hsize_t)(100*1000*1000) : (hsize_t)(50*1000*1000)), fapl, &large_cparam, &tparam); nerrors += test_random_pow2((curr_test == FHEAP_TEST_NORMAL ? (hsize_t)(100*1000*1000) : (hsize_t)(4*1000*1000)), fapl, &large_cparam, &tparam); -#else /* QAK */ -HDfprintf(stderr, "Uncomment tests!\n"); -#endif /* QAK */ /* Reset the "normal" heap ID length */ tparam.actual_id_len = SMALL_HEAP_ID_LEN; } /* end else */ -#else /* QAK */ -HDfprintf(stderr, "Uncomment tests!\n"); -#endif /* QAK */ -#ifndef QAK /* Test object writing support */ /* Basic object writing */ @@ -16806,19 +16713,10 @@ HDfprintf(stderr, "Uncomment tests!\n"); /* Reset block compression */ tparam.comp = FHEAP_TEST_NO_COMPRESS; -#else /* QAK */ -HDfprintf(stderr, "Uncomment tests!\n"); -#endif /* QAK */ -#ifndef QAK } /* end for */ -#endif /* QAK */ /* Tests that address specific bugs */ -#ifndef QAK nerrors += test_bug1(fapl, &small_cparam, &tparam); -#else /* QAK */ -HDfprintf(stderr, "Uncomment tests!\n"); -#endif /* QAK */ /* Verify symbol table messages are cached */ nerrors += (h5_verify_cached_stabs(FILENAME, fapl) < 0 ? 1 : 0); diff --git a/test/fillval.c b/test/fillval.c index 4f7adc1..6eb3565 100644 --- a/test/fillval.c +++ b/test/fillval.c @@ -2370,7 +2370,7 @@ main(int argc, char *argv[]) { int nerrors=0, argno, test_contig=1, test_chunk=1, test_compact=1; hid_t fapl = (-1), fapl2 = (-1); /* File access property lists */ - unsigned new_format; /* Whether to use the new format or not */ + unsigned new_format; /* Whether to use the new format or not */ if(argc >= 2) { test_contig = test_chunk = test_compact = 0; diff --git a/test/freespace.c b/test/freespace.c index d963a6e..181e6a1 100644 --- a/test/freespace.c +++ b/test/freespace.c @@ -1995,7 +1995,8 @@ test_fs_sect_shrink(hid_t fapl) (hsize_t)(TEST_SECT_SIZE50), (H5FS_section_info_t **)&node)) < 0) FAIL_STACK_ERROR - if (node_found) TEST_ERROR + if (node_found) + TEST_ERROR if(check_stats(f, frsp, &state)) TEST_ERROR @@ -2095,7 +2096,8 @@ test_fs_sect_shrink(hid_t fapl) (hsize_t)(TEST_SECT_SIZE50), (H5FS_section_info_t **)&node)) < 0) FAIL_STACK_ERROR - if (node_found) TEST_ERROR + if (node_found) + TEST_ERROR /* section A should not be there in free-space */ if((node_found = H5FS_sect_find(f, dxpl_id, frsp, @@ -2238,8 +2240,8 @@ test_fs_sect_change_class(hid_t fapl) TEST_ERROR if (H5FS_sect_change_class(f, dxpl_id, frsp, (H5FS_section_info_t *)sect_node1, - TEST_FSPACE_SECT_TYPE_NONE) < 0) - TEST_ERROR + TEST_FSPACE_SECT_TYPE_NONE) < 0) + TEST_ERROR state.serial_sect_count += 1; state.ghost_sect_count -=1; diff --git a/test/gen_plist.c b/test/gen_plist.c index c617ad0..8cb6c00 100644 --- a/test/gen_plist.c +++ b/test/gen_plist.c @@ -81,6 +81,12 @@ main(void) 0.2f, (256 * 2048), H5AC_METADATA_WRITE_STRATEGY__PROCESS_0_ONLY}; + H5AC_cache_image_config_t my_cache_image_config = { + H5AC__CURR_CACHE_IMAGE_CONFIG_VERSION, + TRUE, + FALSE, + -1}; + /* check endianess */ { @@ -356,6 +362,9 @@ main(void) assert(ret > 0); if((ret = H5Pset_mdc_config(fapl1, &my_cache_config)) < 0) assert(ret > 0); + if((ret = H5Pset_mdc_image_config(fapl1, &my_cache_image_config)) < 0) + assert(ret > 0); + if((ret = H5Pset_core_write_tracking(fapl1, TRUE, (size_t)(1024 * 1024))) < 0) assert(ret > 0); diff --git a/test/h5test.c b/test/h5test.c index 9759fa8..a36d580 100644 --- a/test/h5test.c +++ b/test/h5test.c @@ -1744,9 +1744,7 @@ error: void h5_send_message(const char *send, const char *arg1, const char *arg2) { - FILE *signalfile; - - HDremove(TMP_SIGNAL_FILE); + FILE *signalfile = NULL; /* Create signal file (which will send signal to some other process) */ signalfile = HDfopen(TMP_SIGNAL_FILE, "w+"); diff --git a/test/links.c b/test/links.c index 182eb6c..3364c7e 100644 --- a/test/links.c +++ b/test/links.c @@ -21,18 +21,22 @@ */ /* + * This file needs to access private information from the H5FD package. + * This file also needs to access the file driver testing code. + */ +#define H5FD_FRIEND /*suppress error about including H5FDpkg */ +#define H5FD_TESTING + +/* * This file needs to access private information from the H5G package. * This file also needs to access the group testing code. */ #define H5G_FRIEND /*suppress error about including H5Gpkg */ #define H5G_TESTING -#define H5FD_FRIEND /*suppress error about including H5FDpkg */ -#define H5FD_TESTING - #include "h5test.h" #include "H5srcdir.h" -#include "H5FDpkg.h" /* File drivers */ +#include "H5FDpkg.h" /* File drivers */ #include "H5Gpkg.h" /* Groups */ #include "H5Iprivate.h" /* IDs */ #include "H5Lprivate.h" /* Links */ @@ -820,7 +824,7 @@ long_links(hid_t fapl, hbool_t new_format) static int toomany(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ + hid_t fid = (-1); /* File ID */ hid_t gid = (-1), gid2 = (-1); /* Group IDs */ char objname[NAME_BUF_SIZE]; /* Object name */ char filename[NAME_BUF_SIZE]; @@ -2623,7 +2627,6 @@ external_link_toomany(hid_t fapl, hbool_t new_format) /* Close first file */ if(H5Fclose(fid) < 0) TEST_ERROR - PASSED(); return 0; diff --git a/test/objcopy.c b/test/objcopy.c index 4166284..0711fb0 100644 --- a/test/objcopy.c +++ b/test/objcopy.c @@ -7200,7 +7200,7 @@ test_copy_ext_link(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fap if(H5Gclose(gid) < 0) TEST_ERROR /* create file to hold external links to the src file */ - if((fid_ext = H5Fcreate(ext_filename, H5F_ACC_TRUNC, H5P_DEFAULT, src_fapl)) < 0) TEST_ERROR + if((fid_ext = H5Fcreate(ext_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR /* create group in the file that will hold the external link */ if((gid = H5Gcreate2(fid_ext, NAME_GROUP_LINK, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR diff --git a/test/swmr_check_compat_vfd.c b/test/swmr_check_compat_vfd.c index d1134ee..1bbfda3 100644 --- a/test/swmr_check_compat_vfd.c +++ b/test/swmr_check_compat_vfd.c @@ -18,12 +18,13 @@ * * It is intended for use in shell scripts. */ + #include "h5test.h" /* This file needs to access the file driver testing code */ -#define H5FD_FRIEND /*suppress error about including H5FDpkg */ +#define H5FD_FRIEND /*suppress error about including H5FDpkg */ #define H5FD_TESTING -#include "H5FDpkg.h" /* File drivers */ +#include "H5FDpkg.h" /* File drivers */ /*------------------------------------------------------------------------- @@ -53,4 +54,3 @@ main(void) return EXIT_FAILURE; } /* end main() */ - diff --git a/test/testfiles/plist_files/dapl_32be b/test/testfiles/plist_files/dapl_32be index 4df4e7f..4dedda2 100644 Binary files a/test/testfiles/plist_files/dapl_32be and b/test/testfiles/plist_files/dapl_32be differ diff --git a/test/testfiles/plist_files/dapl_32le b/test/testfiles/plist_files/dapl_32le index 4df4e7f..4dedda2 100644 Binary files a/test/testfiles/plist_files/dapl_32le and b/test/testfiles/plist_files/dapl_32le differ diff --git a/test/testfiles/plist_files/dapl_64be b/test/testfiles/plist_files/dapl_64be index 4df4e7f..4dedda2 100644 Binary files a/test/testfiles/plist_files/dapl_64be and b/test/testfiles/plist_files/dapl_64be differ diff --git a/test/testfiles/plist_files/dapl_64le b/test/testfiles/plist_files/dapl_64le index 4df4e7f..4dedda2 100644 Binary files a/test/testfiles/plist_files/dapl_64le and b/test/testfiles/plist_files/dapl_64le differ diff --git a/test/testfiles/plist_files/def_dapl_32be b/test/testfiles/plist_files/def_dapl_32be index c9b7ea9..3df7289 100644 Binary files a/test/testfiles/plist_files/def_dapl_32be and b/test/testfiles/plist_files/def_dapl_32be differ diff --git a/test/testfiles/plist_files/def_dapl_32le b/test/testfiles/plist_files/def_dapl_32le index c9b7ea9..3df7289 100644 Binary files a/test/testfiles/plist_files/def_dapl_32le and b/test/testfiles/plist_files/def_dapl_32le differ diff --git a/test/testfiles/plist_files/def_dapl_64be b/test/testfiles/plist_files/def_dapl_64be index c9b7ea9..3df7289 100644 Binary files a/test/testfiles/plist_files/def_dapl_64be and b/test/testfiles/plist_files/def_dapl_64be differ diff --git a/test/testfiles/plist_files/def_dapl_64le b/test/testfiles/plist_files/def_dapl_64le index c9b7ea9..3df7289 100644 Binary files a/test/testfiles/plist_files/def_dapl_64le and b/test/testfiles/plist_files/def_dapl_64le differ diff --git a/test/testfiles/plist_files/def_dxpl_32be b/test/testfiles/plist_files/def_dxpl_32be index b13f456..3b77a32 100644 Binary files a/test/testfiles/plist_files/def_dxpl_32be and b/test/testfiles/plist_files/def_dxpl_32be differ diff --git a/test/testfiles/plist_files/def_dxpl_32le b/test/testfiles/plist_files/def_dxpl_32le index b13f456..3b77a32 100644 Binary files a/test/testfiles/plist_files/def_dxpl_32le and b/test/testfiles/plist_files/def_dxpl_32le differ diff --git a/test/testfiles/plist_files/def_dxpl_64be b/test/testfiles/plist_files/def_dxpl_64be index b13f456..3b77a32 100644 Binary files a/test/testfiles/plist_files/def_dxpl_64be and b/test/testfiles/plist_files/def_dxpl_64be differ diff --git a/test/testfiles/plist_files/def_dxpl_64le b/test/testfiles/plist_files/def_dxpl_64le index b13f456..3b77a32 100644 Binary files a/test/testfiles/plist_files/def_dxpl_64le and b/test/testfiles/plist_files/def_dxpl_64le differ diff --git a/test/testfiles/plist_files/def_fapl_32be b/test/testfiles/plist_files/def_fapl_32be index 6b6baee..3b35501 100644 Binary files a/test/testfiles/plist_files/def_fapl_32be and b/test/testfiles/plist_files/def_fapl_32be differ diff --git a/test/testfiles/plist_files/def_fapl_32le b/test/testfiles/plist_files/def_fapl_32le index 6b6baee..3b35501 100644 Binary files a/test/testfiles/plist_files/def_fapl_32le and b/test/testfiles/plist_files/def_fapl_32le differ diff --git a/test/testfiles/plist_files/def_fapl_64be b/test/testfiles/plist_files/def_fapl_64be index 6b6baee..3b35501 100644 Binary files a/test/testfiles/plist_files/def_fapl_64be and b/test/testfiles/plist_files/def_fapl_64be differ diff --git a/test/testfiles/plist_files/def_fapl_64le b/test/testfiles/plist_files/def_fapl_64le index 6b6baee..3b35501 100644 Binary files a/test/testfiles/plist_files/def_fapl_64le and b/test/testfiles/plist_files/def_fapl_64le differ diff --git a/test/testfiles/plist_files/dxpl_32be b/test/testfiles/plist_files/dxpl_32be index 5ff2ea0..22fbdc8 100644 Binary files a/test/testfiles/plist_files/dxpl_32be and b/test/testfiles/plist_files/dxpl_32be differ diff --git a/test/testfiles/plist_files/dxpl_32le b/test/testfiles/plist_files/dxpl_32le index 5ff2ea0..22fbdc8 100644 Binary files a/test/testfiles/plist_files/dxpl_32le and b/test/testfiles/plist_files/dxpl_32le differ diff --git a/test/testfiles/plist_files/dxpl_64be b/test/testfiles/plist_files/dxpl_64be index 5ff2ea0..22fbdc8 100644 Binary files a/test/testfiles/plist_files/dxpl_64be and b/test/testfiles/plist_files/dxpl_64be differ diff --git a/test/testfiles/plist_files/dxpl_64le b/test/testfiles/plist_files/dxpl_64le index 5ff2ea0..22fbdc8 100644 Binary files a/test/testfiles/plist_files/dxpl_64le and b/test/testfiles/plist_files/dxpl_64le differ diff --git a/test/testfiles/plist_files/fapl_32be b/test/testfiles/plist_files/fapl_32be index 65e2070..43e5e67 100644 Binary files a/test/testfiles/plist_files/fapl_32be and b/test/testfiles/plist_files/fapl_32be differ diff --git a/test/testfiles/plist_files/fapl_32le b/test/testfiles/plist_files/fapl_32le index 65e2070..43e5e67 100644 Binary files a/test/testfiles/plist_files/fapl_32le and b/test/testfiles/plist_files/fapl_32le differ diff --git a/test/testfiles/plist_files/fapl_64be b/test/testfiles/plist_files/fapl_64be index 65e2070..43e5e67 100644 Binary files a/test/testfiles/plist_files/fapl_64be and b/test/testfiles/plist_files/fapl_64be differ diff --git a/test/testfiles/plist_files/fapl_64le b/test/testfiles/plist_files/fapl_64le index 65e2070..43e5e67 100644 Binary files a/test/testfiles/plist_files/fapl_64le and b/test/testfiles/plist_files/fapl_64le differ diff --git a/test/testfiles/plist_files/fcpl_32be b/test/testfiles/plist_files/fcpl_32be index ffa5242..3ce8bf4 100644 Binary files a/test/testfiles/plist_files/fcpl_32be and b/test/testfiles/plist_files/fcpl_32be differ diff --git a/test/testfiles/plist_files/fcpl_32le b/test/testfiles/plist_files/fcpl_32le index ffa5242..3ce8bf4 100644 Binary files a/test/testfiles/plist_files/fcpl_32le and b/test/testfiles/plist_files/fcpl_32le differ diff --git a/test/testfiles/plist_files/fcpl_64be b/test/testfiles/plist_files/fcpl_64be index ffa5242..3ce8bf4 100644 Binary files a/test/testfiles/plist_files/fcpl_64be and b/test/testfiles/plist_files/fcpl_64be differ diff --git a/test/testfiles/plist_files/fcpl_64le b/test/testfiles/plist_files/fcpl_64le index ffa5242..3ce8bf4 100644 Binary files a/test/testfiles/plist_files/fcpl_64le and b/test/testfiles/plist_files/fcpl_64le differ diff --git a/test/testfiles/plist_files/lapl_32be b/test/testfiles/plist_files/lapl_32be index e9f43e2..f3e9865 100644 Binary files a/test/testfiles/plist_files/lapl_32be and b/test/testfiles/plist_files/lapl_32be differ diff --git a/test/testfiles/plist_files/lapl_32le b/test/testfiles/plist_files/lapl_32le index e9f43e2..f3e9865 100644 Binary files a/test/testfiles/plist_files/lapl_32le and b/test/testfiles/plist_files/lapl_32le differ diff --git a/test/testfiles/plist_files/lapl_64be b/test/testfiles/plist_files/lapl_64be index e9f43e2..f3e9865 100644 Binary files a/test/testfiles/plist_files/lapl_64be and b/test/testfiles/plist_files/lapl_64be differ diff --git a/test/testfiles/plist_files/lapl_64le b/test/testfiles/plist_files/lapl_64le index e9f43e2..f3e9865 100644 Binary files a/test/testfiles/plist_files/lapl_64le and b/test/testfiles/plist_files/lapl_64le differ diff --git a/test/testflushrefresh.sh.in b/test/testflushrefresh.sh.in index 7bfeb60..83b7134 100644 --- a/test/testflushrefresh.sh.in +++ b/test/testflushrefresh.sh.in @@ -118,7 +118,7 @@ until [ $verification_done -eq 1 ]; do # Check to see if we timed out looking for the signal before continuing. if [ $timedout -gt 0 ]; then - echo timed out waiting for signal from test program. + echo "timed out waiting for signal from test program (flush)." break fi @@ -158,7 +158,7 @@ if [ $timedout -eq 0 ]; then # Check to see if we timed out looking for the signal before continuing. if [ $timedout -gt 0 ]; then - echo timed out waiting for signal from test program. + echo "timed out waiting for signal from test program (refresh)." break fi diff --git a/test/tfile.c b/test/tfile.c index 19a2df4..6987493 100644 --- a/test/tfile.c +++ b/test/tfile.c @@ -103,14 +103,14 @@ #define USERBLOCK_SIZE ((hsize_t) 512) /* Declarations for test_filespace_*() */ -#define FILENAME_LEN 1024 /* length of file name */ +#define FILENAME_LEN 1024 /* length of file name */ #define CORE_INCREMENT 1024 /* core file */ #define FAMILY_SIZE 1024 /* family file */ -#define DSETNAME "dset" /* Name of dataset */ -#define NELMTS(X) (sizeof(X)/sizeof(X[0])) /* # of elements */ -#define READ_OLD_BUFSIZE 1024 /* Buffer for holding file data */ -#define FILE5 "tfile5.h5" /* Test file */ -#define TEST_THRESHOLD10 10 /* Free space section threshold */ +#define DSETNAME "dset" /* Name of dataset */ +#define NELMTS(X) (sizeof(X)/sizeof(X[0])) /* # of elements */ +#define READ_OLD_BUFSIZE 1024 /* Buffer for holding file data */ +#define FILE5 "tfile5.h5" /* Test file */ +#define TEST_THRESHOLD10 10 /* Free space section threshold */ /* Declaration for test_libver_macros2() */ #define FILE6 "tfile6.h5" /* Test file */ @@ -120,7 +120,8 @@ #define NGROUPS 2 #define NDSETS 4 -const char *OLD_FILENAME[] = { /* Files created under 1.6 branch and 1.8 branch */ +/* Files created under 1.6 branch and 1.8 branch--used in test_filespace_compatible() */ +const char *OLD_FILENAME[] = { "filespace_1_6.h5", /* 1.6 HDF5 file */ "filespace_1_8.h5" /* 1.8 HDF5 file */ }; @@ -888,9 +889,8 @@ test_file_close(void) ret = H5Gclose(group_id3); CHECK(ret, FAIL, "H5Gclose"); break; - - case H5F_CLOSE_DEFAULT: - default: + case H5F_CLOSE_DEFAULT: + default: CHECK(fc_degree, H5F_CLOSE_DEFAULT, "H5Pget_fclose_degree"); break; } @@ -3605,36 +3605,36 @@ static void test_filespace_compatible(void) { int fd_old = (-1), fd_new = (-1); /* File descriptors for copying data */ - hid_t fid; /* File id */ - hid_t fcpl; /* File creation property list template */ - hid_t did; /* Dataset id */ - int check[100]; /* Temporary buffer for verifying dataset data */ - int rdbuf[100]; /* Temporary buffer for reading in dataset data */ + hid_t fid = -1; /* File id */ + hid_t did = -1; /* Dataset id */ + hid_t fcpl; /* File creation property list template */ + int check[100]; /* Temporary buffer for verifying dataset data */ + int rdbuf[100]; /* Temporary buffer for reading in dataset data */ uint8_t buf[READ_OLD_BUFSIZE]; /* temporary buffer for reading */ - ssize_t nread; /* Number of bytes read in */ - unsigned i, j; /* Local index variable */ - hssize_t free_space; /* Amount of free space in the file */ - hsize_t threshold; /* Free space section threshold */ + ssize_t nread; /* Number of bytes read in */ + unsigned i, j; /* Local index variable */ + hssize_t free_space; /* Amount of free-space in the file */ + hsize_t threshold; /* Free-space section threshold */ H5F_file_space_type_t strategy; /* File space handling strategy */ - herr_t ret; /* Return value */ + herr_t ret; /* Return value */ /* Output message about test being performed */ - MESSAGE(5, ("Testing File space compatibility for 1.6 and 1.8 files\n")); + MESSAGE(5, ("File space compatibility testing for 1.6 and 1.8 files\n")); for(j = 0; j < NELMTS(OLD_FILENAME); j++) { const char *filename = H5_get_srcdir_filename(OLD_FILENAME[j]); /* Corrected test file name */ - /* Copy old file into test file */ + /* Open and copy the test file into a temporary file */ fd_old = HDopen(filename, O_RDONLY, 0666); CHECK(fd_old, FAIL, "HDopen"); fd_new = HDopen(FILE5, O_RDWR|O_CREAT|O_TRUNC, 0666); CHECK(fd_new, FAIL, "HDopen"); /* Copy data */ - while((nread = HDread(fd_old, buf, (size_t)READ_OLD_BUFSIZE)) > 0) { - ssize_t write_err = HDwrite(fd_new, buf, (size_t)nread); - CHECK(write_err, -1, "HDwrite"); - } /* end while */ + while((nread = HDread(fd_old, buf, (size_t)READ_OLD_BUFSIZE)) > 0) { + ssize_t write_err = HDwrite(fd_new, buf, (size_t)nread); + CHECK(write_err, -1, "HDwrite"); + } /* end while */ /* Close the files */ ret = HDclose(fd_old); @@ -3642,7 +3642,7 @@ test_filespace_compatible(void) ret = HDclose(fd_new); CHECK(ret, FAIL, "HDclose"); - /* Open the test file */ + /* Open the temporary test file */ fid = H5Fopen(FILE5, H5F_ACC_RDWR, H5P_DEFAULT); CHECK(fid, FAIL, "H5Fopen"); @@ -3651,10 +3651,11 @@ test_filespace_compatible(void) CHECK(free_space, FAIL, "H5Fget_freespace"); VERIFY(free_space, (hssize_t)0, "H5Fget_freespace"); - /* Get the file's file creation property list */ + /* Get the file's file creation property list */ + fcpl = H5Fget_create_plist(fid); + CHECK(fcpl, FAIL, "H5Fget_create_plist"); + /* Retrieve the file space handling strategy and threshold */ - fcpl = H5Fget_create_plist(fid); - CHECK(fcpl, FAIL, "H5Fget_create_plist"); ret = H5Pget_file_space(fcpl, &strategy, &threshold); CHECK(ret, FAIL, "H5Pget_file_space"); @@ -3685,13 +3686,13 @@ test_filespace_compatible(void) ret = H5Ldelete(fid, DSETNAME, H5P_DEFAULT); CHECK(ret, FAIL, "H5Ldelete"); - /* Close the plist */ - ret = H5Pclose(fcpl); - CHECK(ret, FAIL, "H5Pclose"); + /* Close the plist */ + ret = H5Pclose(fcpl); + CHECK(ret, FAIL, "H5Pclose"); - /* Close the file */ - ret = H5Fclose(fid); - CHECK(ret, FAIL, "H5Fclose"); + /* Close the file */ + ret = H5Fclose(fid); + CHECK(ret, FAIL, "H5Fclose"); /* Re-Open the file */ fid = H5Fopen(FILE5, H5F_ACC_RDONLY, H5P_DEFAULT); @@ -4090,37 +4091,37 @@ test_file(void) /* Output message about test being performed */ MESSAGE(5, ("Testing Low-Level File I/O\n")); - test_file_create(); /* Test file creation(also creation templates)*/ - test_file_open(); /* Test file opening */ - test_file_reopen(); /* Test file reopening */ - test_file_close(); /* Test file close behavior */ - test_get_file_id(); /* Test H5Iget_file_id */ - test_get_obj_ids(); /* Test H5Fget_obj_ids for Jira Issue 8528 */ - test_file_perm(); /* Test file access permissions */ - test_file_perm2(); /* Test file access permission again */ + test_file_create(); /* Test file creation(also creation templates)*/ + test_file_open(); /* Test file opening */ + test_file_reopen(); /* Test file reopening */ + test_file_close(); /* Test file close behavior */ + test_get_file_id(); /* Test H5Iget_file_id */ + test_get_obj_ids(); /* Test H5Fget_obj_ids for Jira Issue 8528 */ + test_file_perm(); /* Test file access permissions */ + test_file_perm2(); /* Test file access permission again */ test_file_freespace(); /* Test file free space information */ - test_file_ishdf5(); /* Test detecting HDF5 files correctly */ - test_file_open_dot(); /* Test opening objects with "." for a name */ - test_file_open_overlap(); /* Test opening files in an overlapping manner */ - test_file_getname(); /* Test basic H5Fget_name() functionality */ - test_file_double_root_open(); /* Test opening root group from two files works properly */ - test_file_double_group_open(); /* Test opening same group from two files works properly */ - test_file_double_dataset_open(); /* Test opening same dataset from two files works properly */ - test_file_double_datatype_open(); /* Test opening same named datatype from two files works properly */ + test_file_ishdf5(); /* Test detecting HDF5 files correctly */ + test_file_open_dot(); /* Test opening objects with "." for a name */ + test_file_open_overlap(); /* Test opening files in an overlapping manner */ + test_file_getname(); /* Test basic H5Fget_name() functionality */ + test_file_double_root_open(); /* Test opening root group from two files works properly */ + test_file_double_group_open(); /* Test opening same group from two files works properly */ + test_file_double_dataset_open(); /* Test opening same dataset from two files works properly */ + test_file_double_datatype_open(); /* Test opening same named datatype from two files works properly */ test_file_double_file_dataset_open(TRUE); test_file_double_file_dataset_open(FALSE); - test_userblock_file_size(); /* Tests that files created with a userblock have the correct size */ - test_cached_stab_info(); /* Tests that files are created with cached stab info in the superblock */ - test_rw_noupdate(); /* Test to ensure that RW permissions don't write the file unless dirtied */ - test_userblock_alignment(); /* Tests that files created with a userblock and alignment interact properly */ + test_userblock_file_size(); /* Tests that files created with a userblock have the correct size */ + test_cached_stab_info(); /* Tests that files are created with cached stab info in the superblock */ + test_rw_noupdate(); /* Test to ensure that RW permissions don't write the file unless dirtied */ + test_userblock_alignment(); /* Tests that files created with a userblock and alignment interact properly */ test_filespace_sects(); /* Test file free space section information */ test_filespace_info(); /* Test file creation public routines:H5Pget/set_file_space */ - test_filespace_compatible();/* Test compatibility for file space management */ - test_libver_bounds(); /* Test compatibility for file space management */ - test_libver_macros(); /* Test the macros for library version comparison */ - test_libver_macros2(); /* Test the macros for library version comparison */ + test_filespace_compatible(); /* Test compatibility for file space management */ + test_libver_bounds(); /* Test compatibility for file space management */ + test_libver_macros(); /* Test the macros for library version comparison */ + test_libver_macros2(); /* Test the macros for library version comparison */ #ifndef H5_NO_DEPRECATED_SYMBOLS - test_deprec(); /* Test deprecated routines */ + test_deprec(); /* Test deprecated routines */ #endif /* H5_NO_DEPRECATED_SYMBOLS */ } /* test_file() */ diff --git a/test/unlink.c b/test/unlink.c index 660a155..e52699a 100644 --- a/test/unlink.c +++ b/test/unlink.c @@ -2440,9 +2440,9 @@ int main(void) { hid_t fapl, fapl2, file; - int nerrors = 0; + int nerrors = 0; char filename[1024]; - unsigned new_format; + unsigned new_format; /* Metadata cache parameters */ int mdc_nelmts; diff --git a/test/vds.c b/test/vds.c index 2fd492a..e6bfeb3 100644 --- a/test/vds.c +++ b/test/vds.c @@ -2812,7 +2812,7 @@ test_basic_io(unsigned config, hid_t fapl) /* Write data directly to source dataset */ if(H5Dwrite(srcdset[0], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) - TEST_ERROR + TEST_ERROR /* Close srcdset and srcfile if config option specified */ if(config & TEST_IO_CLOSE_SRC) { @@ -7265,6 +7265,12 @@ test_printf(unsigned config, hid_t fapl) if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR + /* Test H5Pget_virtual_printf_gap() */ + if(H5Pget_virtual_printf_gap(dapl, &gap_size) < 0) + TEST_ERROR + if(gap_size != (hsize_t)2) + TEST_ERROR + /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) TEST_ERROR @@ -7329,6 +7335,12 @@ test_printf(unsigned config, hid_t fapl) if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR + /* Test H5Pget_virtual_printf_gap() */ + if(H5Pget_virtual_printf_gap(dapl, &gap_size) < 0) + TEST_ERROR + if(gap_size != (hsize_t)3) + TEST_ERROR + /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) TEST_ERROR @@ -7393,6 +7405,12 @@ test_printf(unsigned config, hid_t fapl) if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR + /* Test H5Pget_virtual_printf_gap() */ + if(H5Pget_virtual_printf_gap(dapl, &gap_size) < 0) + TEST_ERROR + if(gap_size != (hsize_t)4) + TEST_ERROR + /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) TEST_ERROR @@ -11121,23 +11139,23 @@ error: static int test_dapl_values(hid_t fapl_id) { - hid_t fid = -1; /* file to write to */ - hid_t dcpl_id = -1; /* dataset creation properties */ - hid_t dapl_id1 = -1; /* dataset access properties */ - hid_t dapl_id2 = -1; /* dataset access properties */ - hid_t vds_sid = -1; /* vds data space */ - hid_t src_sid = -1; /* source data space */ - hid_t did1 = -1; /* dataset */ - hid_t did2 = -1; /* dataset */ - hsize_t start; /* hyperslab start */ - hsize_t stride; /* hyperslab count */ - hsize_t count; /* hyperslab count */ - hsize_t block; /* hyperslab count */ - hsize_t dims; /* dataset size */ - hsize_t max_dims; /* dataset max size */ - H5D_vds_view_t view; /* view from dapl */ - hsize_t gap_size; /* gap size from dapl */ - char filename[1024]; /* file names */ + hid_t fid = -1; /* file to write to */ + hid_t dcpl_id = -1; /* dataset creation properties */ + hid_t dapl_id1 = -1; /* dataset access properties */ + hid_t dapl_id2 = -1; /* dataset access properties */ + hid_t vds_sid = -1; /* vds data space */ + hid_t src_sid = -1; /* source data space */ + hid_t did1 = -1; /* dataset */ + hid_t did2 = -1; /* dataset */ + hsize_t start; /* hyperslab start */ + hsize_t stride; /* hyperslab count */ + hsize_t count; /* hyperslab count */ + hsize_t block; /* hyperslab count */ + hsize_t dims; /* dataset size */ + hsize_t max_dims; /* dataset max size */ + H5D_vds_view_t view; /* view from dapl */ + hsize_t gap_size; /* gap size from dapl */ + char filename[1024]; /* file names */ TESTING("H5Dget_access_plist() returns dapl w/ correct values"); @@ -11221,6 +11239,7 @@ test_dapl_values(hid_t fapl_id) if(H5Pget_virtual_printf_gap(dapl_id2, &gap_size) < 0) FAIL_STACK_ERROR if(gap_size != 123) + TEST_ERROR /* Close everything */ if(H5Sclose(vds_sid) < 0) FAIL_STACK_ERROR diff --git a/testpar/CMakeLists.txt b/testpar/CMakeLists.txt index 58135b7..298d326 100644 --- a/testpar/CMakeLists.txt +++ b/testpar/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 3.1.0) +cmake_minimum_required (VERSION 3.2.2) PROJECT (HDF5_TEST_PAR) #----------------------------------------------------------------------------- @@ -54,6 +54,6 @@ set (H5P_TESTS foreach (testp ${H5P_TESTS}) ADD_H5P_EXE(${testp}) -endforeach (testp ${H5P_TESTS}) +endforeach () include (CMakeTests.cmake) diff --git a/testpar/CMakeTests.cmake b/testpar/CMakeTests.cmake index 3716ee6..7dce6d6 100644 --- a/testpar/CMakeTests.cmake +++ b/testpar/CMakeTests.cmake @@ -9,7 +9,7 @@ add_test (NAME TEST_PAR_testphdf5 COMMAND ${MPIEXEC} ${MPIEXEC_PREFLAGS} ${MPIEX foreach (testp ${H5P_TESTS}) add_test (NAME TEST_PAR_${testp} COMMAND ${MPIEXEC} ${MPIEXEC_PREFLAGS} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_POSTFLAGS} $) -endforeach (testp ${H5P_TESTS}) +endforeach () # The following will only be correct on windows shared #set_tests_properties (TEST_PAR_t_pflush1 PROPERTIES WILL_FAIL "true") @@ -31,16 +31,16 @@ if (HDF5_TEST_VFD) t_pflush1 t_pflush2 ) - + if (DIRECT_VFD) set (VFD_LIST ${VFD_LIST} direct) - endif (DIRECT_VFD) + endif () - MACRO (ADD_VFD_TEST vfdname resultcode) + macro (ADD_VFD_TEST vfdname resultcode) if (NOT HDF5_ENABLE_USING_MEMCHECKER) foreach (test ${H5P_VFD_TESTS}) add_test ( - NAME TEST_PAR_VFD-${vfdname}-${test} + NAME TEST_PAR_VFD-${vfdname}-${test} COMMAND "${CMAKE_COMMAND}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=" @@ -50,13 +50,13 @@ if (HDF5_TEST_VFD) -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" -P "${HDF_RESOURCES_DIR}/vfdTest.cmake" ) - endforeach (test ${H5P_VFD_TESTS}) - endif (NOT HDF5_ENABLE_USING_MEMCHECKER) - ENDMACRO (ADD_VFD_TEST) - + endforeach () + endif () + endmacro () + # Run test with different Virtual File Driver foreach (vfd ${VFD_LIST}) ADD_VFD_TEST (${vfd} 0) - endforeach (vfd ${VFD_LIST}) + endforeach () -endif (HDF5_TEST_VFD) +endif () diff --git a/testpar/t_cache.c b/testpar/t_cache.c index 8753325..bfa4c8f 100644 --- a/testpar/t_cache.c +++ b/testpar/t_cache.c @@ -333,7 +333,7 @@ struct mssg_t haddr_t base_addr; unsigned len; int ver; - int count; + unsigned count; unsigned magic; }; @@ -410,7 +410,8 @@ static herr_t datum_notify(H5C_notify_action_t action, void *thing); static herr_t datum_free_icr(void * thing); -#define DATUM_ENTRY_TYPE H5AC_TEST_ID +/* Masquerade as object header entries to the cache */ +#define DATUM_ENTRY_TYPE H5AC_OHDR_ID #define NUMBER_OF_ENTRY_TYPES 1 @@ -434,7 +435,7 @@ const H5C_class_t types[NUMBER_OF_ENTRY_TYPES] = { /* id */ DATUM_ENTRY_TYPE, /* name */ "datum", - /* mem_type */ H5FD_MEM_DEFAULT, + /* mem_type */ H5FD_MEM_OHDR, /* flags */ H5AC__CLASS_SKIP_READS | H5AC__CLASS_SKIP_WRITES, /* get_initial_load_size */ datum_get_initial_load_size, /* get_final_load_size */ NULL, @@ -484,8 +485,8 @@ static hbool_t take_down_cache(hid_t fid, H5C_t * cache_ptr); static hbool_t verify_entry_reads(haddr_t addr, int expected_entry_reads); static hbool_t verify_entry_writes(haddr_t addr, int expected_entry_writes); static hbool_t verify_total_reads(int expected_total_reads); -static hbool_t verify_total_writes(int expected_total_writes); -static void verify_writes(int num_writes, haddr_t * written_entries_tbl); +static hbool_t verify_total_writes(unsigned expected_total_writes); +static void verify_writes(unsigned num_writes, haddr_t * written_entries_tbl); static void unlock_entry(H5F_t * file_ptr, int32_t type, unsigned int flags); static void unpin_entry(H5F_t * file_ptr, int32_t idx, hbool_t global, hbool_t dirty, hbool_t via_unprotect); @@ -1213,7 +1214,7 @@ setup_derived_types(void) int result; MPI_Datatype mpi_types[9] = {MPI_INT, MPI_INT, MPI_INT, MPI_LONG, HADDR_AS_MPI_TYPE, MPI_INT, MPI_INT, - MPI_INT, MPI_UNSIGNED}; + MPI_UNSIGNED, MPI_UNSIGNED}; int block_len[9] = {1, 1, 1, 1, 1, 1, 1, 1, 1}; MPI_Aint displs[9]; struct mssg_t sample; /* used to compute displacements */ @@ -4333,15 +4334,13 @@ setup_cache_for_test(hid_t * fid_ptr, * *****************************************************************************/ static void -verify_writes(int num_writes, - haddr_t * written_entries_tbl) +verify_writes(unsigned num_writes, haddr_t *written_entries_tbl) { const hbool_t report = FALSE; hbool_t proceed = TRUE; - int i = 0; + unsigned u = 0; HDassert( world_mpi_rank != world_server_mpi_rank ); - HDassert( num_writes >= 0 ); HDassert( ( num_writes == 0 ) || ( written_entries_tbl != NULL ) ); @@ -4361,15 +4360,12 @@ verify_writes(int num_writes, } } - if ( proceed ) { - + if(proceed) proceed = verify_total_writes(num_writes); - } - while ( ( proceed ) && ( i < num_writes ) ) - { - proceed = verify_entry_writes(written_entries_tbl[i], 1); - i++; + while(proceed && u < num_writes) { + proceed = verify_entry_writes(written_entries_tbl[u], 1); + u++; } /* barrier to ensure that all other processes have finished verifying @@ -4398,12 +4394,12 @@ verify_writes(int num_writes, if ( proceed ) { - HDfprintf(stdout, "%d:%s: verified %d writes.\n", + HDfprintf(stdout, "%d:%s: verified %u writes.\n", world_mpi_rank, FUNC, num_writes); } else { - HDfprintf(stdout, "%d:%s: FAILED to verify %d writes.\n", + HDfprintf(stdout, "%d:%s: FAILED to verify %u writes.\n", world_mpi_rank, FUNC, num_writes); } @@ -4928,10 +4924,10 @@ verify_total_reads(int expected_total_reads) * *****************************************************************************/ static hbool_t -verify_total_writes(int expected_total_writes) +verify_total_writes(unsigned expected_total_writes) { hbool_t success = TRUE; /* will set to FALSE if appropriate. */ - long reported_total_writes; + unsigned reported_total_writes; struct mssg_t mssg; if ( success ) { @@ -4996,7 +4992,7 @@ verify_total_writes(int expected_total_writes) success = FALSE; if ( verbose ) { HDfprintf(stdout, - "%d:%s: reported/expected total writes mismatch (%ld/%ld).\n", + "%d:%s: reported/expected total writes mismatch (%u/%u).\n", world_mpi_rank, FUNC, reported_total_writes, expected_total_writes); } @@ -5318,7 +5314,7 @@ server_smoke_check(void) if ( success ) { - success = verify_total_writes(world_mpi_size - 1); + success = verify_total_writes((unsigned)(world_mpi_size - 1)); } if ( success ) { @@ -5422,7 +5418,7 @@ server_smoke_check(void) if ( success ) { - success = verify_total_writes(world_mpi_size - 1); + success = verify_total_writes((unsigned)(world_mpi_size - 1)); } if ( success ) { diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt index 4b9b765..4b3b3d5 100644 --- a/tools/CMakeLists.txt +++ b/tools/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 3.1.0) +cmake_minimum_required (VERSION 3.2.2) PROJECT (HDF5_TOOLS) #----------------------------------------------------------------------------- @@ -11,7 +11,7 @@ add_definitions (${HDF_EXTRA_C_FLAGS}) # -------------------------------------------------------------------- if (NOT BUILD_TESTING) add_subdirectory (${HDF5_TOOLS_SOURCE_DIR}/lib) -endif (NOT BUILD_TESTING) +endif () #----------------------------------------------------------------------------- # Setup include Directories @@ -24,4 +24,4 @@ add_subdirectory (${HDF5_TOOLS_SOURCE_DIR}/src) #-- Add the tests if (BUILD_TESTING) add_subdirectory (${HDF5_TOOLS_SOURCE_DIR}/test) -endif (BUILD_TESTING) +endif () diff --git a/tools/lib/CMakeLists.txt b/tools/lib/CMakeLists.txt index bfd1af2..ade7671 100644 --- a/tools/lib/CMakeLists.txt +++ b/tools/lib/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 3.1.0) +cmake_minimum_required (VERSION 3.2.2) PROJECT (HDF5_TOOLS_LIB) #----------------------------------------------------------------------------- @@ -63,7 +63,7 @@ if (BUILD_SHARED_LIBS) ) #set_property (TARGET ${HDF5_TOOLS_LIBSH_TARGET} APPEND PROPERTY COMPILE_DEFINITIONS H5DIFF_DEBUG) set (install_targets ${install_targets} ${HDF5_TOOLS_LIBSH_TARGET}) -endif (BUILD_SHARED_LIBS) +endif () ############################################################################## ############################################################################## @@ -89,7 +89,8 @@ install ( if (HDF5_EXPORTED_TARGETS) if (BUILD_SHARED_LIBS) INSTALL_TARGET_PDB (${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_INSTALL_BIN_DIR} toolslibraries) - endif (BUILD_SHARED_LIBS) + endif () + INSTALL_TARGET_PDB (${HDF5_TOOLS_LIB_TARGET} ${HDF5_INSTALL_BIN_DIR} toolslibraries) install ( TARGETS @@ -102,4 +103,4 @@ if (HDF5_EXPORTED_TARGETS) FRAMEWORK DESTINATION ${HDF5_INSTALL_FWRK_DIR} COMPONENT toolslibraries INCLUDES DESTINATION include ) -endif (HDF5_EXPORTED_TARGETS) +endif () diff --git a/tools/lib/h5diff.c b/tools/lib/h5diff.c index 79dc51f..e6ff7e0 100644 --- a/tools/lib/h5diff.c +++ b/tools/lib/h5diff.c @@ -47,7 +47,7 @@ void do_print_objname (const char *OBJ, const char *path1, const char *path2, di { /* if verbose level is higher than 0, put space line before * displaying any object or symbolic links. This improves - * readability of the output. + * readability of the output. */ if (opts->m_verbose_level >= 1) parallel_print("\n"); @@ -71,7 +71,7 @@ do_print_attrname (const char *attr, const char *path1, const char *path2) * Function: print_warn * * Purpose: check print warning condition. - * Return: + * Return: * 1 if verbose mode * 0 if not verbos mode * Programmer: Jonathan Kim @@ -146,7 +146,7 @@ static void print_incoming_data(void) * * Purpose: check if options are valid * - * Return: + * Return: * 1 : Valid * 0 : Not valid * @@ -189,10 +189,10 @@ out: * * Purpose: check if 'paths' are part of exclude path list * - * Return: + * Return: * 1 - excluded path * 0 - not excluded path - * + * * Programmer: Jonathan Kim * Date: Aug 23, 2010 *------------------------------------------------------------------------*/ @@ -221,11 +221,11 @@ static int is_exclude_path (char * path, h5trav_type_t type, diff_opt_t *options { size_t len_grp; - /* check if given path belong to an excluding group, if so + /* check if given path belong to an excluding group, if so * exclude it as well. * This verifies if “/grp1/dset1” is only under “/grp1”, but - * not under “/grp1xxx/” group. - */ + * not under “/grp1xxx/” group. + */ len_grp = HDstrlen(exclude_path_ptr->obj_path); if (path[len_grp] == '/') { @@ -236,15 +236,15 @@ static int is_exclude_path (char * path, h5trav_type_t type, diff_opt_t *options } } /* exclude target is not group, just exclude the object */ - else + else { ret_cmp = HDstrcmp(exclude_path_ptr->obj_path, path); if (ret_cmp == 0) /* found matching object */ { /* excluded non-group object */ ret = 1; - /* remember the type of this maching object. - * if it's group, it can be used for excluding its member + /* remember the type of this maching object. + * if it's group, it can be used for excluding its member * objects in this while() loop */ exclude_path_ptr->obj_type = type; break; /* while */ @@ -339,7 +339,7 @@ static void build_match_list (const char *objname1, trav_info_t *info1, const ch path2_lp = (info2->paths[curr2].path) + path2_offset; type1_l = info1->paths[curr1].type; type2_l = info2->paths[curr2].type; - + /* criteria is string compare */ cmp = HDstrcmp(path1_lp, path2_lp); @@ -410,7 +410,7 @@ static void build_match_list (const char *objname1, trav_info_t *info1, const ch if (!is_exclude_path(path2_lp, type2_l, options)) { trav_table_addflags(infile, path2_lp, info2->paths[curr2].type, table); - } + } curr2++; } /* end while */ @@ -424,8 +424,8 @@ static void build_match_list (const char *objname1, trav_info_t *info1, const ch /*------------------------------------------------------------------------- * Function: trav_grp_objs * - * Purpose: - * Call back function from h5trav_visit(). + * Purpose: + * Call back function from h5trav_visit(). * * Programmer: Jonathan Kim * @@ -437,22 +437,22 @@ static herr_t trav_grp_objs(const char *path, const H5O_info_t *oinfo, trav_info_visit_obj(path, oinfo, already_visited, udata); return 0; -} +} /*------------------------------------------------------------------------- * Function: trav_grp_symlinks * - * Purpose: - * Call back function from h5trav_visit(). + * Purpose: + * Call back function from h5trav_visit(). * Track and extra checkings while visiting all symbolic-links. * * Programmer: Jonathan Kim * * Date: Aug 16, 2010 *------------------------------------------------------------------------*/ -static herr_t trav_grp_symlinks(const char *path, const H5L_info_t *linfo, +static herr_t trav_grp_symlinks(const char *path, const H5L_info_t *linfo, void *udata) -{ +{ trav_info_t *tinfo = (trav_info_t *)udata; diff_opt_t *opts = (diff_opt_t *)tinfo->opts; int ret; @@ -482,18 +482,18 @@ static herr_t trav_grp_symlinks(const char *path, const H5L_info_t *linfo, tinfo->symlink_visited.dangle_link = TRUE; trav_info_visit_lnk(path, linfo, tinfo); if (opts->no_dangle_links) - opts->err_stat = 1; /* make dgangling link is error */ + opts->err_stat = 1; /* make dangling link is error */ goto done; } - /* check if already visit the target object */ - if(symlink_is_visited( &(tinfo->symlink_visited), linfo->type, NULL, lnk_info.trg_path)) + /* check if already visit the target object */ + if(symlink_is_visited( &(tinfo->symlink_visited), linfo->type, NULL, lnk_info.trg_path)) goto done; /* add this link as visited link */ - if(symlink_visit_add( &(tinfo->symlink_visited), linfo->type, NULL, lnk_info.trg_path) < 0) + if(symlink_visit_add( &(tinfo->symlink_visited), linfo->type, NULL, lnk_info.trg_path) < 0) goto done; - + if(h5trav_visit(tinfo->fid, path, TRUE, TRUE, trav_grp_objs,trav_grp_symlinks, tinfo) < 0) { @@ -502,8 +502,8 @@ static herr_t trav_grp_symlinks(const char *path, const H5L_info_t *linfo, goto done; } break; - - case H5L_TYPE_EXTERNAL: + + case H5L_TYPE_EXTERNAL: ret = H5tools_get_symlink_info(tinfo->fid, path, &lnk_info, opts->follow_links); /* error */ if (ret < 0) @@ -514,21 +514,21 @@ static herr_t trav_grp_symlinks(const char *path, const H5L_info_t *linfo, tinfo->symlink_visited.dangle_link = TRUE; trav_info_visit_lnk(path, linfo, tinfo); if (opts->no_dangle_links) - opts->err_stat = 1; /* make dgangling link is error */ + opts->err_stat = 1; /* make dangling link is error */ goto done; } - if(H5Lunpack_elink_val(lnk_info.trg_path, linfo->u.val_size, NULL, &ext_fname, &ext_path) < 0) + if(H5Lunpack_elink_val(lnk_info.trg_path, linfo->u.val_size, NULL, &ext_fname, &ext_path) < 0) goto done; - /* check if already visit the target object */ - if(symlink_is_visited( &(tinfo->symlink_visited), linfo->type, ext_fname, ext_path)) + /* check if already visit the target object */ + if(symlink_is_visited( &(tinfo->symlink_visited), linfo->type, ext_fname, ext_path)) goto done; /* add this link as visited link */ - if(symlink_visit_add( &(tinfo->symlink_visited), linfo->type, ext_fname, ext_path) < 0) + if(symlink_visit_add( &(tinfo->symlink_visited), linfo->type, ext_fname, ext_path) < 0) goto done; - + if(h5trav_visit(tinfo->fid, path, TRUE, TRUE, trav_grp_objs,trav_grp_symlinks, tinfo) < 0) { @@ -548,11 +548,11 @@ static herr_t trav_grp_symlinks(const char *path, const H5L_info_t *linfo, break; } /* end of switch */ -done: +done: if (lnk_info.trg_path) HDfree(lnk_info.trg_path); return 0; -} +} /*------------------------------------------------------------------------- @@ -630,7 +630,7 @@ hsize_t h5diff(const char *fname1, H5E_BEGIN_TRY { /* open file 1 */ - if((file1_id = h5tools_fopen(fname1, H5F_ACC_RDONLY, H5P_DEFAULT, NULL, NULL, (size_t)0)) < 0) + if((file1_id = h5tools_fopen(fname1, H5F_ACC_RDONLY, H5P_DEFAULT, NULL, NULL, (size_t)0)) < 0) { parallel_print("h5diff: <%s>: unable to open file\n", fname1); options->err_stat = 1; @@ -639,7 +639,7 @@ hsize_t h5diff(const char *fname1, /* open file 2 */ - if((file2_id = h5tools_fopen(fname2, H5F_ACC_RDONLY, H5P_DEFAULT, NULL, NULL, (size_t)0)) < 0) + if((file2_id = h5tools_fopen(fname2, H5F_ACC_RDONLY, H5P_DEFAULT, NULL, NULL, (size_t)0)) < 0) { parallel_print("h5diff: <%s>: unable to open file\n", fname2); options->err_stat = 1; @@ -704,14 +704,14 @@ hsize_t h5diff(const char *fname1, else { /* check if link itself exist */ - if(H5Lexists(file1_id, obj1fullname, H5P_DEFAULT) <= 0) + if(H5Lexists(file1_id, obj1fullname, H5P_DEFAULT) <= 0) { parallel_print ("Object <%s> could not be found in <%s>\n", obj1fullname, fname1); options->err_stat = 1; goto out; } /* get info from link */ - if(H5Lget_info(file1_id, obj1fullname, &src_linfo1, H5P_DEFAULT) < 0) + if(H5Lget_info(file1_id, obj1fullname, &src_linfo1, H5P_DEFAULT) < 0) { parallel_print("Unable to get link info from <%s>\n", obj1fullname); goto out; @@ -719,7 +719,7 @@ hsize_t h5diff(const char *fname1, info1_lp = info1_obj; - /* + /* * check the type of specified path for hard and symbolic links */ if(src_linfo1.type == H5L_TYPE_HARD) @@ -764,14 +764,14 @@ hsize_t h5diff(const char *fname1, else { /* check if link itself exist */ - if(H5Lexists(file2_id, obj2fullname, H5P_DEFAULT) <= 0) + if(H5Lexists(file2_id, obj2fullname, H5P_DEFAULT) <= 0) { parallel_print ("Object <%s> could not be found in <%s>\n", obj2fullname, fname2); options->err_stat = 1; goto out; } /* get info from link */ - if(H5Lget_info(file2_id, obj2fullname, &src_linfo2, H5P_DEFAULT) < 0) + if(H5Lget_info(file2_id, obj2fullname, &src_linfo2, H5P_DEFAULT) < 0) { parallel_print("Unable to get link info from <%s>\n", obj2fullname); goto out; @@ -779,7 +779,7 @@ hsize_t h5diff(const char *fname1, info2_lp = info2_obj; - /* + /* * check the type of specified path for hard and symbolic links */ if(src_linfo2.type == H5L_TYPE_HARD) @@ -811,7 +811,7 @@ hsize_t h5diff(const char *fname1, obj2type = H5TRAV_TYPE_UDLINK; trav_info_add(info2_obj, obj2fullname, obj2type); } - } + } } /* if no object specified */ else @@ -830,7 +830,7 @@ hsize_t h5diff(const char *fname1, l_ret2 = H5tools_get_symlink_info(file2_id, obj2fullname, &trg_linfo2, options->follow_links); /*--------------------------------------------- - * check for following symlinks + * check for following symlinks */ if (options->follow_links) { @@ -915,7 +915,7 @@ hsize_t h5diff(const char *fname1, } } } - else if(l_ret2 < 0) /* fail */ + else if(l_ret2 < 0) /* fail */ { parallel_print ("Object <%s> could not be found in <%s>\n", obj2fullname, fname2); options->err_stat = 1; @@ -936,11 +936,11 @@ hsize_t h5diff(const char *fname1, } } /* end of if follow symlinks */ - /* + /* * If verbose options is not used, don't need to traverse through the list * of objects in the group to display objects information, - * So use h5tools_is_obj_same() to improve performance by skipping - * comparing details of same objects. + * So use h5tools_is_obj_same() to improve performance by skipping + * comparing details of same objects. */ if(!(options->m_verbose || options->m_report)) @@ -1087,10 +1087,10 @@ out: /*------------------------------------------------------------------------- * Function: diff_match * - * Purpose: - * Compare common objects in given groups according to table structure. - * The table structure has flags which can be used to find common objects - * and will be compared. + * Purpose: + * Compare common objects in given groups according to table structure. + * The table structure has flags which can be used to find common objects + * and will be compared. * Common object means same name (absolute path) objects in both location. * * Return: Number of differences found @@ -1126,7 +1126,7 @@ hsize_t diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1, h5difftrace("diff_match start\n"); - /* + /* * if not root, prepare object name to be pre-appended to group path to * make full path */ @@ -1141,8 +1141,8 @@ hsize_t diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1, * 2) the graph must match, i.e same names (absolute path) * 3) objects with the same name must be of the same type *------------------------------------------------------------------------- - */ - + */ + /* not valid compare used when --exclude-path option is used */ if (!options->exclude_path) { @@ -1152,7 +1152,7 @@ hsize_t diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1, options->contents = 0; } } - + /* objects in one file and not the other */ for( i = 0; i < table->nobjs; i++) { @@ -1209,7 +1209,7 @@ hsize_t diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1, #endif /* H5_HAVE_ASPRINTF */ /* get index to figure out type of the object in file1 */ - while(info1->paths[idx1].path && + while(info1->paths[idx1].path && (HDstrcmp(obj1_fullpath, info1->paths[idx1].path) != 0)) idx1++; /* get index to figure out type of the object in file2 */ @@ -1226,7 +1226,7 @@ hsize_t diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1, if(!g_Parallel) { nfound += diff(file1_id, obj1_fullpath, - file2_id, obj2_fullpath, + file2_id, obj2_fullpath, options, &argdata); } /* end if */ #ifdef H5_HAVE_PARALLEL @@ -1244,7 +1244,7 @@ hsize_t diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1, */ /*Set up args to pass to worker task. */ - if(HDstrlen(obj1_fullpath) > 255 || + if(HDstrlen(obj1_fullpath) > 255 || HDstrlen(obj2_fullpath) > 255) { printf("The parallel diff only supports object names up to 255 characters\n"); @@ -1401,7 +1401,7 @@ hsize_t diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1, #endif /* H5_HAVE_PARALLEL */ if(obj1_fullpath) HDfree(obj1_fullpath); - if(obj2_fullpath) + if(obj2_fullpath) HDfree(obj2_fullpath); } /* end if */ } /* end for */ @@ -1568,14 +1568,14 @@ hsize_t diff(hid_t file1_id, if(print_warn(options)) linkinfo1.opt.msg_mode = linkinfo2.opt.msg_mode = 1; - /* for symbolic links, take care follow symlink and no dangling link + /* for symbolic links, take care follow symlink and no dangling link * options */ - if (argdata->type[0] == H5TRAV_TYPE_LINK || + if (argdata->type[0] == H5TRAV_TYPE_LINK || argdata->type[0] == H5TRAV_TYPE_UDLINK || - argdata->type[1] == H5TRAV_TYPE_LINK || + argdata->type[1] == H5TRAV_TYPE_LINK || argdata->type[1] == H5TRAV_TYPE_UDLINK ) { - /* + /* * check dangling links for path1 and path2 */ @@ -1586,7 +1586,7 @@ hsize_t diff(hid_t file1_id, { if (options->no_dangle_links) { - /* gangling link is error */ + /* dangling link is error */ if(options->m_verbose) parallel_print("Warning: <%s> is a dangling link.\n", path1); goto out; @@ -1604,7 +1604,7 @@ hsize_t diff(hid_t file1_id, { if (options->no_dangle_links) { - /* gangling link is error */ + /* dangling link is error */ if(options->m_verbose) parallel_print("Warning: <%s> is a dangling link.\n", path2); goto out; @@ -1614,7 +1614,7 @@ hsize_t diff(hid_t file1_id, } else if (ret < 0) goto out; - + /* found dangling link */ if (is_dangle_link1 || is_dangle_link2) goto out2; @@ -1637,7 +1637,7 @@ hsize_t diff(hid_t file1_id, if (options->m_verbose||options->m_list_not_cmp) { parallel_print("Not comparable: <%s> is of type %s and <%s> is of type %s\n", - path1, get_type(argdata->type[0]), + path1, get_type(argdata->type[0]), path2, get_type(argdata->type[1])); } options->not_cmp=1; @@ -1648,11 +1648,11 @@ hsize_t diff(hid_t file1_id, } else /* now both object types are same */ object_type = argdata->type[0]; - - /* + + /* * If both points to the same target object, skip comparing details inside * of the objects to improve performance. - * Always check for the hard links, otherwise if follow symlink option is + * Always check for the hard links, otherwise if follow symlink option is * specified. * * Perform this to match the outputs as bypassing. @@ -1672,7 +1672,7 @@ hsize_t diff(hid_t file1_id, { case H5TRAV_TYPE_DATASET: do_print_objname("dataset", path1, path2, options); - break; + break; case H5TRAV_TYPE_NAMED_DATATYPE: do_print_objname("datatype", path1, path2, options); break; @@ -1687,7 +1687,7 @@ hsize_t diff(hid_t file1_id, do_print_objname("external link", path1, path2, options); else do_print_objname ("user defined link", path1, path2, options); - break; + break; case H5TRAV_TYPE_UNKNOWN: default: parallel_print("Comparison not supported: <%s> and <%s> are of type %s\n", @@ -1735,14 +1735,14 @@ hsize_t diff(hid_t file1_id, if (nfound) { do_print_objname("dataset", path1, path2, options); - print_found(nfound); + print_found(nfound); } } /*--------------------------------------------------------- * compare attributes - * if condition refers to cases when the dataset is a + * if condition refers to cases when the dataset is a * referenced object *--------------------------------------------------------- */ @@ -1781,7 +1781,7 @@ hsize_t diff(hid_t file1_id, /*----------------------------------------------------------------- * compare attributes - * the if condition refers to cases when the dataset is a + * the if condition refers to cases when the dataset is a * referenced object *----------------------------------------------------------------- */ @@ -1813,7 +1813,7 @@ hsize_t diff(hid_t file1_id, /*----------------------------------------------------------------- * compare attributes - * the if condition refers to cases when the dataset is a + * the if condition refers to cases when the dataset is a * referenced object *----------------------------------------------------------------- */ @@ -1855,10 +1855,10 @@ hsize_t diff(hid_t file1_id, case H5TRAV_TYPE_UDLINK: { /* Only external links will have a query function registered */ - if(linkinfo1.linfo.type == H5L_TYPE_EXTERNAL && linkinfo2.linfo.type == H5L_TYPE_EXTERNAL) + if(linkinfo1.linfo.type == H5L_TYPE_EXTERNAL && linkinfo2.linfo.type == H5L_TYPE_EXTERNAL) { /* If the buffers are the same size, compare them */ - if(linkinfo1.linfo.u.val_size == linkinfo2.linfo.u.val_size) + if(linkinfo1.linfo.u.val_size == linkinfo2.linfo.u.val_size) { ret = HDmemcmp(linkinfo1.trg_path, linkinfo2.trg_path, linkinfo1.linfo.u.val_size); } @@ -1866,7 +1866,7 @@ hsize_t diff(hid_t file1_id, ret = 1; /* if "linkinfo1.trg_path" != "linkinfo2.trg_path" then the links - * are "different" extlinkinfo#.path is combination string of + * are "different" extlinkinfo#.path is combination string of * file_name and obj_name */ nfound = (ret != 0) ? 1 : 0; @@ -1875,7 +1875,7 @@ hsize_t diff(hid_t file1_id, do_print_objname("external link", path1, path2, options); } /* end if */ - else + else { /* If one or both of these links isn't an external link, we can only * compare information from H5Lget_info since we don't have a query @@ -1884,7 +1884,7 @@ hsize_t diff(hid_t file1_id, * If the link classes or the buffer length are not the * same, the links are "different" */ - if((linkinfo1.linfo.type != linkinfo2.linfo.type) || + if((linkinfo1.linfo.type != linkinfo2.linfo.type) || (linkinfo1.linfo.u.val_size != linkinfo2.linfo.u.val_size)) nfound = 1; else @@ -1922,7 +1922,7 @@ out: out2: /*----------------------------------- - * handle dangling link(s) + * handle dangling link(s) */ /* both path1 and path2 are dangling links */ if(is_dangle_link1 && is_dangle_link2) diff --git a/tools/lib/h5diff_array.c b/tools/lib/h5diff_array.c index 9aadffe..e066937 100644 --- a/tools/lib/h5diff_array.c +++ b/tools/lib/h5diff_array.c @@ -130,7 +130,7 @@ typedef struct mcomp_t { unsigned n; /* number of members */ hid_t *ids; /* member type id */ - size_t *offsets; + size_t *offsets; struct mcomp_t **m; /* members */ }mcomp_t; @@ -546,7 +546,7 @@ hsize_t diff_array( void *_mem1, * Recursively call this function for each element * H5T_STRING * compare byte by byte in a cycle from 0 to type_size. this type_size is the - * value obtained by the get_size function but it is the string lenght for + * value obtained by the get_size function but it is the string length for * variable sized strings * H5T_OPAQUE * compare byte by byte in a cycle from 0 to type_size @@ -602,7 +602,7 @@ static hsize_t diff_datum(void *_mem1, /* Fast comparison first for atomic type by memcmp(). * It is OK not to list non-atomic type here because it will not be caught - * by the confition, but it gives more clarity for code planning + * by the condition, but it gives more clarity for code planning */ if (type_class != H5T_REFERENCE && type_class != H5T_COMPOUND && @@ -692,6 +692,13 @@ static hsize_t diff_datum(void *_mem1, * of length of strings. * For now mimic the previous way. */ + h5diffdebug2("diff_datum string size:%d\n",size1); + h5diffdebug2("diff_datum string size:%d\n",size2); + if(size1 != size2) + { + h5difftrace("diff_datum string sizes\n"); + nfound++; + } if(size1 < size2) { size = size1; @@ -712,7 +719,7 @@ static hsize_t diff_datum(void *_mem1, pad = H5Tget_strpad(m_type); - for (u=0; um[u] = (mcomp_t *)HDmalloc(sizeof(mcomp_t)); HDmemset(members->m[u], 0, sizeof(mcomp_t)); get_member_types(members->ids[u], members->m[u]); - } + } } - + return; diff --git a/tools/lib/h5diff_dset.c b/tools/lib/h5diff_dset.c index 63f1483..aca8d02 100644 --- a/tools/lib/h5diff_dset.c +++ b/tools/lib/h5diff_dset.c @@ -89,6 +89,9 @@ hsize_t diff_dataset( hid_t file1_id, obj2_name, options); } + else + goto error; + /*------------------------------------------------------------------------- * close *------------------------------------------------------------------------- diff --git a/tools/lib/h5tools_dump.c b/tools/lib/h5tools_dump.c index 67585d1..a673d15 100644 --- a/tools/lib/h5tools_dump.c +++ b/tools/lib/h5tools_dump.c @@ -31,73 +31,73 @@ #include "H5private.h" h5tool_format_t h5tools_dataformat = { -0, /*raw */ - -"", /*fmt_raw */ -"%d", /*fmt_int */ -"%u", /*fmt_uint */ -"%hhd", /*fmt_schar */ -"%u", /*fmt_uchar */ -"%d", /*fmt_short */ -"%u", /*fmt_ushort */ -"%ld", /*fmt_long */ -"%lu", /*fmt_ulong */ -NULL, /*fmt_llong */ -NULL, /*fmt_ullong */ -"%g", /*fmt_double */ -"%g", /*fmt_float */ - -0, /*ascii */ -0, /*str_locale */ -0, /*str_repeat */ - -"[ ", /*arr_pre */ -",", /*arr_sep */ -" ]", /*arr_suf */ -1, /*arr_linebreak */ - -"", /*cmpd_name */ -",\n", /*cmpd_sep */ -"{", /*cmpd_pre */ -"}", /*cmpd_suf */ -"\n", /*cmpd_end */ -NULL, /* cmpd_listv */ - -", ", /*vlen_sep */ -"(", /*vlen_pre */ -")", /*vlen_suf */ -"", /*vlen_end */ - -"%s", /*elmt_fmt */ -",", /*elmt_suf1 */ -" ", /*elmt_suf2 */ - -"", /*idx_n_fmt */ -"", /*idx_sep */ -"", /*idx_fmt */ - -80, /*line_ncols *//*standard default columns */ -0, /*line_per_line */ -"", /*line_pre */ -"%s", /*line_1st */ -"%s", /*line_cont */ -"", /*line_suf */ -"", /*line_sep */ -1, /*line_multi_new */ -" ", /*line_indent */ - -1, /*skip_first */ - -1, /*obj_hidefileno */ -" "H5_PRINTF_HADDR_FMT, /*obj_format */ - -1, /*dset_hidefileno */ -"DATASET %s ", /*dset_format */ -"%s", /*dset_blockformat_pre */ -"%s", /*dset_ptformat_pre */ -"%s", /*dset_ptformat */ -1, /*array indices */ -1 /*escape non printable characters */ + 0, /*raw */ + + "", /*fmt_raw */ + "%d", /*fmt_int */ + "%u", /*fmt_uint */ + "%hhd", /*fmt_schar */ + "%u", /*fmt_uchar */ + "%d", /*fmt_short */ + "%u", /*fmt_ushort */ + "%ld", /*fmt_long */ + "%lu", /*fmt_ulong */ + NULL, /*fmt_llong */ + NULL, /*fmt_ullong */ + "%g", /*fmt_double */ + "%g", /*fmt_float */ + + 0, /*ascii */ + 0, /*str_locale */ + 0, /*str_repeat */ + + "[ ", /*arr_pre */ + ",", /*arr_sep */ + " ]", /*arr_suf */ + 1, /*arr_linebreak */ + + "", /*cmpd_name */ + ",\n", /*cmpd_sep */ + "{", /*cmpd_pre */ + "}", /*cmpd_suf */ + "\n", /*cmpd_end */ + NULL, /* cmpd_listv */ + + ", ", /*vlen_sep */ + "(", /*vlen_pre */ + ")", /*vlen_suf */ + "", /*vlen_end */ + + "%s", /*elmt_fmt */ + ",", /*elmt_suf1 */ + " ", /*elmt_suf2 */ + + "", /*idx_n_fmt */ + "", /*idx_sep */ + "", /*idx_fmt */ + + 80, /*line_ncols *//*standard default columns */ + 0, /*line_per_line */ + "", /*line_pre */ + "%s", /*line_1st */ + "%s", /*line_cont */ + "", /*line_suf */ + "", /*line_sep */ + 1, /*line_multi_new */ + " ", /*line_indent */ + + 1, /*skip_first */ + + 1, /*obj_hidefileno */ + " "H5_PRINTF_HADDR_FMT, /*obj_format */ + + 1, /*dset_hidefileno */ + "DATASET %s ", /*dset_format */ + "%s", /*dset_blockformat_pre */ + "%s", /*dset_ptformat_pre */ + "%s", /*dset_ptformat */ + 1, /*array indices */ + 1 /*escape non printable characters */ }; const h5tools_dump_header_t h5tools_standardformat = { diff --git a/tools/src/CMakeLists.txt b/tools/src/CMakeLists.txt index 5001b26..37680dd 100644 --- a/tools/src/CMakeLists.txt +++ b/tools/src/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 3.1.0) +cmake_minimum_required (VERSION 3.2.2) PROJECT (HDF5_TOOLS_SRC) #----------------------------------------------------------------------------- diff --git a/tools/src/h5copy/CMakeLists.txt b/tools/src/h5copy/CMakeLists.txt index 2a33c9e..d1f5f50 100644 --- a/tools/src/h5copy/CMakeLists.txt +++ b/tools/src/h5copy/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 3.1.0) +cmake_minimum_required (VERSION 3.2.2) PROJECT (HDF5_TOOLS_SRC_H5COPY) #----------------------------------------------------------------------------- @@ -18,6 +18,17 @@ set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5copy") set (H5_DEP_EXECUTABLES h5copy) +if (BUILD_SHARED_LIBS) + add_executable (h5copy-shared ${HDF5_TOOLS_SRC_H5COPY_SOURCE_DIR}/h5copy.c) + TARGET_NAMING (h5copy-shared SHARED) + TARGET_C_PROPERTIES (h5copy-shared SHARED " " " ") + target_link_libraries (h5copy-shared ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) + set_target_properties (h5copy-shared PROPERTIES FOLDER tools) + set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5copy-shared") + + set (H5_DEP_EXECUTABLES ${H5_DEP_EXECUTABLES} h5copy-shared) +endif () + ############################################################################## ############################################################################## ### I N S T A L L A T I O N ### @@ -27,13 +38,17 @@ set (H5_DEP_EXECUTABLES h5copy) #----------------------------------------------------------------------------- # Rules for Installation of tools using make Install target #----------------------------------------------------------------------------- +if (HDF5_EXPORTED_TARGETS) + if (BUILD_SHARED_LIBS) + INSTALL_PROGRAM_PDB (h5copy-shared ${HDF5_INSTALL_BIN_DIR} toolsapplications) + endif () + INSTALL_PROGRAM_PDB (h5copy ${HDF5_INSTALL_BIN_DIR} toolsapplications) -#INSTALL_PROGRAM_PDB (h5copy ${HDF5_INSTALL_BIN_DIR} toolsapplications) - -install ( - TARGETS - h5copy - EXPORT - ${HDF5_EXPORTED_TARGETS} - RUNTIME DESTINATION ${HDF5_INSTALL_BIN_DIR} COMPONENT toolsapplications -) + install ( + TARGETS + ${H5_DEP_EXECUTABLES} + EXPORT + ${HDF5_EXPORTED_TARGETS} + RUNTIME DESTINATION ${HDF5_INSTALL_BIN_DIR} COMPONENT toolsapplications + ) +endif () diff --git a/tools/src/h5diff/CMakeLists.txt b/tools/src/h5diff/CMakeLists.txt index 85a24ef..00d93de 100644 --- a/tools/src/h5diff/CMakeLists.txt +++ b/tools/src/h5diff/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 3.1.0) +cmake_minimum_required (VERSION 3.2.2) PROJECT (HDF5_TOOLS_SRC_H5DIFF) #----------------------------------------------------------------------------- @@ -21,6 +21,20 @@ set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5diff") set (H5_DEP_EXECUTABLES h5diff) +if (BUILD_SHARED_LIBS) + add_executable (h5diff-shared + ${HDF5_TOOLS_SRC_H5DIFF_SOURCE_DIR}/h5diff_common.c + ${HDF5_TOOLS_SRC_H5DIFF_SOURCE_DIR}/h5diff_main.c + ) + TARGET_NAMING (h5diff-shared SHARED) + TARGET_C_PROPERTIES (h5diff-shared SHARED " " " ") + target_link_libraries (h5diff-shared ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) + set_target_properties (h5diff-shared PROPERTIES FOLDER tools) + set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5diff-shared") + + set (H5_DEP_EXECUTABLES ${H5_DEP_EXECUTABLES} h5diff-shared) +endif () + if (H5_HAVE_PARALLEL) add_executable (ph5diff ${HDF5_TOOLS_SRC_H5DIFF_SOURCE_DIR}/h5diff_common.c @@ -31,7 +45,7 @@ if (H5_HAVE_PARALLEL) target_link_libraries (ph5diff ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) set_target_properties (ph5diff PROPERTIES FOLDER tools) set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};ph5diff") -endif (H5_HAVE_PARALLEL) +endif () ############################################################################## ############################################################################## @@ -42,26 +56,29 @@ endif (H5_HAVE_PARALLEL) #----------------------------------------------------------------------------- # Rules for Installation of tools using make Install target #----------------------------------------------------------------------------- - -#INSTALL_PROGRAM_PDB (h5diff ${HDF5_INSTALL_BIN_DIR} toolsapplications) - -install ( - TARGETS - h5diff - EXPORT - ${HDF5_EXPORTED_TARGETS} - RUNTIME DESTINATION ${HDF5_INSTALL_BIN_DIR} COMPONENT toolsapplications -) - -if (H5_HAVE_PARALLEL) - - #INSTALL_PROGRAM_PDB (ph5diff ${HDF5_INSTALL_BIN_DIR} toolsapplications) +if (HDF5_EXPORTED_TARGETS) + if (BUILD_SHARED_LIBS) + INSTALL_PROGRAM_PDB (h5diff-shared ${HDF5_INSTALL_BIN_DIR} toolsapplications) + endif () + INSTALL_PROGRAM_PDB (h5diff ${HDF5_INSTALL_BIN_DIR} toolsapplications) install ( TARGETS - ph5diff + ${H5_DEP_EXECUTABLES} EXPORT ${HDF5_EXPORTED_TARGETS} RUNTIME DESTINATION ${HDF5_INSTALL_BIN_DIR} COMPONENT toolsapplications ) -endif (H5_HAVE_PARALLEL) + + if (H5_HAVE_PARALLEL) + #INSTALL_PROGRAM_PDB (ph5diff ${HDF5_INSTALL_BIN_DIR} toolsapplications) + + install ( + TARGETS + ph5diff + EXPORT + ${HDF5_EXPORTED_TARGETS} + RUNTIME DESTINATION ${HDF5_INSTALL_BIN_DIR} COMPONENT toolsapplications + ) + endif () +endif () diff --git a/tools/src/h5dump/CMakeLists.txt b/tools/src/h5dump/CMakeLists.txt index ab310db..65a7cdd 100644 --- a/tools/src/h5dump/CMakeLists.txt +++ b/tools/src/h5dump/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 3.1.0) +cmake_minimum_required (VERSION 3.2.2) PROJECT (HDF5_TOOLS_SRC_H5DUMP) #----------------------------------------------------------------------------- @@ -22,6 +22,21 @@ set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5dump") set (H5_DEP_EXECUTABLES h5dump) +if (BUILD_SHARED_LIBS) + add_executable (h5dump-shared + ${HDF5_TOOLS_SRC_H5DUMP_SOURCE_DIR}/h5dump.c + ${HDF5_TOOLS_SRC_H5DUMP_SOURCE_DIR}/h5dump_ddl.c + ${HDF5_TOOLS_SRC_H5DUMP_SOURCE_DIR}/h5dump_xml.c + ) + TARGET_NAMING (h5dump-shared SHARED) + TARGET_C_PROPERTIES (h5dump-shared SHARED " " " ") + target_link_libraries (h5dump-shared ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) + set_target_properties (h5dump-shared PROPERTIES FOLDER tools) + set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5dump-shared") + + set (H5_DEP_EXECUTABLES ${H5_DEP_EXECUTABLES} h5dump-shared) +endif () + ############################################################################## ############################################################################## ### I N S T A L L A T I O N ### @@ -31,13 +46,17 @@ set (H5_DEP_EXECUTABLES h5dump) #----------------------------------------------------------------------------- # Rules for Installation of tools using make Install target #----------------------------------------------------------------------------- +if (HDF5_EXPORTED_TARGETS) + if (BUILD_SHARED_LIBS) + INSTALL_PROGRAM_PDB (h5dump-shared ${HDF5_INSTALL_BIN_DIR} toolsapplications) + endif () + INSTALL_PROGRAM_PDB (h5dump ${HDF5_INSTALL_BIN_DIR} toolsapplications) -#INSTALL_PROGRAM_PDB (h5dump ${HDF5_INSTALL_BIN_DIR} toolsapplications) - -install ( - TARGETS - h5dump - EXPORT - ${HDF5_EXPORTED_TARGETS} - RUNTIME DESTINATION ${HDF5_INSTALL_BIN_DIR} COMPONENT toolsapplications -) + install ( + TARGETS + ${H5_DEP_EXECUTABLES} + EXPORT + ${HDF5_EXPORTED_TARGETS} + RUNTIME DESTINATION ${HDF5_INSTALL_BIN_DIR} COMPONENT toolsapplications + ) +endif () diff --git a/tools/src/h5dump/h5dump_xml.c b/tools/src/h5dump/h5dump_xml.c index 5290c3d..8ed88d2 100644 --- a/tools/src/h5dump/h5dump_xml.c +++ b/tools/src/h5dump/h5dump_xml.c @@ -69,7 +69,7 @@ static h5tool_format_t xml_dataformat = { "", /*cmpd_pre */ "", /*cmpd_suf */ "", /*cmpd_end */ - "", /*cmpd_listv */ + NULL, /*cmpd_listv */ " ", /*vlen_sep */ " ", /*vlen_pre */ diff --git a/tools/src/h5format_convert/CMakeLists.txt b/tools/src/h5format_convert/CMakeLists.txt index 957055d..fa3abc0 100644 --- a/tools/src/h5format_convert/CMakeLists.txt +++ b/tools/src/h5format_convert/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 3.1.0) +cmake_minimum_required (VERSION 3.2.2) PROJECT (HDF5_TOOLS_SRC_H5FC) #----------------------------------------------------------------------------- @@ -27,13 +27,14 @@ set (H5_DEP_EXECUTABLES h5format_convert) #----------------------------------------------------------------------------- # Rules for Installation of tools using make Install target #----------------------------------------------------------------------------- +if (HDF5_EXPORTED_TARGETS) + INSTALL_PROGRAM_PDB (h5format_convert ${HDF5_INSTALL_BIN_DIR} toolsapplications) -#INSTALL_PROGRAM_PDB (h5format_convert ${HDF5_INSTALL_BIN_DIR} toolsapplications) - -install ( - TARGETS - h5format_convert - EXPORT - ${HDF5_EXPORTED_TARGETS} - RUNTIME DESTINATION ${HDF5_INSTALL_BIN_DIR} COMPONENT toolsapplications -) + install ( + TARGETS + h5format_convert + EXPORT + ${HDF5_EXPORTED_TARGETS} + RUNTIME DESTINATION ${HDF5_INSTALL_BIN_DIR} COMPONENT toolsapplications + ) +endif () \ No newline at end of file diff --git a/tools/src/h5import/CMakeLists.txt b/tools/src/h5import/CMakeLists.txt index 97ab4ec..9a61beb 100644 --- a/tools/src/h5import/CMakeLists.txt +++ b/tools/src/h5import/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 3.1.0) +cmake_minimum_required (VERSION 3.2.2) PROJECT (HDF5_TOOLS_SRC_H5IMPORT) #----------------------------------------------------------------------------- @@ -28,13 +28,14 @@ set (H5_DEP_EXECUTABLES h5import) #----------------------------------------------------------------------------- # Rules for Installation of tools using make Install target #----------------------------------------------------------------------------- +if (HDF5_EXPORTED_TARGETS) + INSTALL_PROGRAM_PDB (h5import ${HDF5_INSTALL_BIN_DIR} toolsapplications) -#INSTALL_PROGRAM_PDB (h5import ${HDF5_INSTALL_BIN_DIR} toolsapplications) - -install ( - TARGETS - h5import - EXPORT - ${HDF5_EXPORTED_TARGETS} - RUNTIME DESTINATION ${HDF5_INSTALL_BIN_DIR} COMPONENT toolsapplications -) + install ( + TARGETS + h5import + EXPORT + ${HDF5_EXPORTED_TARGETS} + RUNTIME DESTINATION ${HDF5_INSTALL_BIN_DIR} COMPONENT toolsapplications + ) +endif () diff --git a/tools/src/h5jam/CMakeLists.txt b/tools/src/h5jam/CMakeLists.txt index cef54c2..3cca771 100644 --- a/tools/src/h5jam/CMakeLists.txt +++ b/tools/src/h5jam/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 3.1.0) +cmake_minimum_required (VERSION 3.2.2) PROJECT (HDF5_TOOLS_SRC_H5JAM) #----------------------------------------------------------------------------- @@ -37,13 +37,14 @@ set (H5_DEP_EXECUTABLES #----------------------------------------------------------------------------- # Rules for Installation of tools using make Install target #----------------------------------------------------------------------------- - -#INSTALL_PROGRAM_PDB (h5jam ${HDF5_INSTALL_BIN_DIR} toolsapplications) - -install ( - TARGETS - h5jam h5unjam - EXPORT - ${HDF5_EXPORTED_TARGETS} - RUNTIME DESTINATION ${HDF5_INSTALL_BIN_DIR} COMPONENT toolsapplications -) +if (HDF5_EXPORTED_TARGETS) + INSTALL_PROGRAM_PDB (h5jam ${HDF5_INSTALL_BIN_DIR} toolsapplications) + + install ( + TARGETS + h5jam h5unjam + EXPORT + ${HDF5_EXPORTED_TARGETS} + RUNTIME DESTINATION ${HDF5_INSTALL_BIN_DIR} COMPONENT toolsapplications + ) +endif () diff --git a/tools/src/h5ls/CMakeLists.txt b/tools/src/h5ls/CMakeLists.txt index 24e11cc..2e23634 100644 --- a/tools/src/h5ls/CMakeLists.txt +++ b/tools/src/h5ls/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 3.1.0) +cmake_minimum_required (VERSION 3.2.2) PROJECT (HDF5_TOOLS_SRC_H5LS) #----------------------------------------------------------------------------- @@ -16,9 +16,18 @@ target_link_libraries (h5ls ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) set_target_properties (h5ls PROPERTIES FOLDER tools) set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5ls") -set (H5_DEP_EXECUTABLES - h5ls -) +set (H5_DEP_EXECUTABLES h5ls) + +if (BUILD_SHARED_LIBS) + add_executable (h5ls-shared ${HDF5_TOOLS_SRC_H5LS_SOURCE_DIR}/h5ls.c) + TARGET_NAMING (h5ls-shared SHARED) + TARGET_C_PROPERTIES (h5ls-shared SHARED " " " ") + target_link_libraries (h5ls-shared ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) + set_target_properties (h5ls-shared PROPERTIES FOLDER tools) + set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5ls-shared") + + set (H5_DEP_EXECUTABLES ${H5_DEP_EXECUTABLES} h5ls-shared) +endif () ############################################################################## ############################################################################## @@ -29,13 +38,17 @@ set (H5_DEP_EXECUTABLES #----------------------------------------------------------------------------- # Rules for Installation of tools using make Install target #----------------------------------------------------------------------------- +if (HDF5_EXPORTED_TARGETS) + if (BUILD_SHARED_LIBS) + INSTALL_PROGRAM_PDB (h5ls-shared ${HDF5_INSTALL_BIN_DIR} toolsapplications) + endif () + INSTALL_PROGRAM_PDB (h5ls ${HDF5_INSTALL_BIN_DIR} toolsapplications) -#INSTALL_PROGRAM_PDB (h5ls ${HDF5_INSTALL_BIN_DIR} toolsapplications) - -install ( - TARGETS - h5ls - EXPORT - ${HDF5_EXPORTED_TARGETS} - RUNTIME DESTINATION ${HDF5_INSTALL_BIN_DIR} COMPONENT toolsapplications -) + install ( + TARGETS + ${H5_DEP_EXECUTABLES} + EXPORT + ${HDF5_EXPORTED_TARGETS} + RUNTIME DESTINATION ${HDF5_INSTALL_BIN_DIR} COMPONENT toolsapplications + ) +endif () diff --git a/tools/src/h5repack/CMakeLists.txt b/tools/src/h5repack/CMakeLists.txt index cb7f5f6..81e6275 100644 --- a/tools/src/h5repack/CMakeLists.txt +++ b/tools/src/h5repack/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 3.1.0) +cmake_minimum_required (VERSION 3.2.2) PROJECT (HDF5_TOOLS_SRC_H5REPACK) #----------------------------------------------------------------------------- @@ -29,6 +29,17 @@ set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5repack") set (H5_DEP_EXECUTABLES h5repack) +if (BUILD_SHARED_LIBS) + add_executable (h5repack-shared ${REPACK_COMMON_SOURCES} ${HDF5_TOOLS_SRC_H5REPACK_SOURCE_DIR}/h5repack_main.c) + TARGET_NAMING (h5repack-shared SHARED) + TARGET_C_PROPERTIES (h5repack-shared SHARED " " " ") + target_link_libraries (h5repack-shared ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) + set_target_properties (h5repack-shared PROPERTIES FOLDER tools) + set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5repack-shared") + + set (H5_DEP_EXECUTABLES ${H5_DEP_EXECUTABLES} h5repack-shared) +endif () + ############################################################################## ############################################################################## ### I N S T A L L A T I O N ### @@ -38,13 +49,17 @@ set (H5_DEP_EXECUTABLES h5repack) #----------------------------------------------------------------------------- # Rules for Installation of tools using make Install target #----------------------------------------------------------------------------- +if (HDF5_EXPORTED_TARGETS) + if (BUILD_SHARED_LIBS) + INSTALL_PROGRAM_PDB (h5repack-shared ${HDF5_INSTALL_BIN_DIR} toolsapplications) + endif () + INSTALL_PROGRAM_PDB (h5repack ${HDF5_INSTALL_BIN_DIR} toolsapplications) -#INSTALL_PROGRAM_PDB (h5repack ${HDF5_INSTALL_BIN_DIR} toolsapplications) - -install ( - TARGETS - h5repack - EXPORT - ${HDF5_EXPORTED_TARGETS} - RUNTIME DESTINATION ${HDF5_INSTALL_BIN_DIR} COMPONENT toolsapplications -) + install ( + TARGETS + ${H5_DEP_EXECUTABLES} + EXPORT + ${HDF5_EXPORTED_TARGETS} + RUNTIME DESTINATION ${HDF5_INSTALL_BIN_DIR} COMPONENT toolsapplications + ) +endif () diff --git a/tools/src/h5repack/h5repack.c b/tools/src/h5repack/h5repack.c index ef2085c..c79db1c 100644 --- a/tools/src/h5repack/h5repack.c +++ b/tools/src/h5repack/h5repack.c @@ -77,27 +77,29 @@ int h5repack(const char* infile, const char* outfile, pack_opt_t *options) { * *------------------------------------------------------------------------- */ -int h5repack_init(pack_opt_t *options, int verbose, hbool_t latest, - H5F_file_space_type_t strategy, hsize_t threshold) { - int k, n; - - HDmemset(options, 0, sizeof(pack_opt_t)); - options->min_comp = 0; - options->verbose = verbose; - options->latest = latest; - options->layout_g = H5D_LAYOUT_ERROR; - - for (n = 0; n < H5_REPACK_MAX_NFILTERS; n++) { - options->filter_g[n].filtn = -1; - options->filter_g[n].cd_nelmts = 0; - for (k = 0; k < CD_VALUES; k++) - options->filter_g[n].cd_values[k] = 0; - } +int +h5repack_init(pack_opt_t *options, int verbose, hbool_t latest, + H5F_file_space_type_t strategy, hsize_t threshold) +{ + int k, n; + + HDmemset(options, 0, sizeof(pack_opt_t)); + options->min_comp = 0; + options->verbose = verbose; + options->latest = latest; + options->layout_g = H5D_LAYOUT_ERROR; + + for (n = 0; n < H5_REPACK_MAX_NFILTERS; n++) { + options->filter_g[n].filtn = -1; + options->filter_g[n].cd_nelmts = 0; + for (k = 0; k < CD_VALUES; k++) + options->filter_g[n].cd_values[k] = 0; + } options->fs_strategy = strategy; options->fs_threshold = threshold; - return (options_table_init(&(options->op_tbl))); + return (options_table_init(&(options->op_tbl))); } /*------------------------------------------------------------------------- diff --git a/tools/src/h5repack/h5repack_copy.c b/tools/src/h5repack/h5repack_copy.c index 547f61a..1519053 100644 --- a/tools/src/h5repack/h5repack_copy.c +++ b/tools/src/h5repack/h5repack_copy.c @@ -84,28 +84,18 @@ static herr_t walk_error_callback(H5_ATTR_UNUSED unsigned n, const H5E_error2_t * * Date: October, 23, 2003 * - * Modification: - * Peter Cao, June 13, 2007 - * Add "-L, --latest" and other options to pack a file with the latest file format - * - * Peter Cao, September 25, 2007 - * Copy user block when repacking a file - * - * Pedro Vicente, August 20, 2008 - * Add a user block to file if requested - * *------------------------------------------------------------------------- */ int copy_objects(const char* fnamein, const char* fnameout, pack_opt_t *options) { - int ret_value = 0; /*no need to LEAVE() on ERROR: HERR_INIT(int, SUCCEED) */ - hid_t fidin; - hid_t fidout = -1; - trav_table_t *travt = NULL; - hsize_t ub_size = 0; /* size of user block */ - hid_t fcpl = H5P_DEFAULT; /* file creation property list ID */ - hid_t fapl = H5P_DEFAULT; /* file access property list ID */ + int ret_value = 0; /*no need to LEAVE() on ERROR: HERR_INIT(int, SUCCEED) */ + hid_t fidin; + hid_t fidout = -1; + trav_table_t *travt = NULL; + hsize_t ub_size = 0; /* size of user block */ + hid_t fcpl = H5P_DEFAULT; /* file creation property list ID */ + hid_t fapl = H5P_DEFAULT; /* file access property list ID */ /*------------------------------------------------------------------------- * open input file diff --git a/tools/src/h5repack/h5repack_main.c b/tools/src/h5repack/h5repack_main.c index 657e1a9..1807056 100644 --- a/tools/src/h5repack/h5repack_main.c +++ b/tools/src/h5repack/h5repack_main.c @@ -52,8 +52,8 @@ static struct long_options l_opts[] = { { "metadata_block_size", require_arg, 'M' }, { "threshold", require_arg, 't' }, { "alignment", require_arg, 'a' }, - { "infile", require_arg, 'i' }, /* -i for backward compability */ - { "outfile", require_arg, 'o' }, /* -o for backward compability */ + { "infile", require_arg, 'i' }, /* -i for backward compability */ + { "outfile", require_arg, 'o' }, /* -o for backward compability */ { "fs_strategy", require_arg, 'S' }, { "fs_threshold", require_arg, 'T' }, { "enable-error-stack", no_arg, 'E' }, @@ -208,14 +208,12 @@ static void usage(const char *prog) { * Programmer: Quincey Koziol * Saturday, 31. January 2004 * - * Modifications: - * *------------------------------------------------------------------------- */ -static void leave(int ret) { - h5tools_close(); - - HDexit(ret); +static void leave(int ret) +{ + h5tools_close(); + HDexit(ret); } /*------------------------------------------------------------------------- @@ -231,11 +229,10 @@ static void leave(int ret) { * *------------------------------------------------------------------------- */ - static -int read_info(const char *filename, pack_opt_t *options) { - - char stype[10]; +int read_info(const char *filename, pack_opt_t *options) +{ + char stype[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; char comp_info[1024]; FILE *fp = NULL; char c; @@ -368,210 +365,204 @@ done: * *------------------------------------------------------------------------- */ - static -int parse_command_line(int argc, const char **argv, pack_opt_t* options) { - - int opt; - int ret_value = 0; - - /* parse command line options */ - while ((opt = get_option(argc, argv, s_opts, l_opts)) != EOF) { - switch ((char) opt) { - - /* -i for backward compability */ - case 'i': - infile = opt_arg; - has_i_o = 1; - break; - - /* -o for backward compability */ - case 'o': - outfile = opt_arg; - has_i_o = 1; - break; - - case 'h': - usage(h5tools_getprogname()); - h5tools_setstatus(EXIT_SUCCESS); - ret_value = -1; - goto done; - - case 'V': - print_version(h5tools_getprogname()); - h5tools_setstatus(EXIT_SUCCESS); - ret_value = -1; - goto done; - - case 'v': - options->verbose = 1; - break; - - case 'f': - /* parse the -f filter option */ - if (h5repack_addfilter(opt_arg, options) < 0) { - error_msg("in parsing filter\n"); - h5tools_setstatus(EXIT_FAILURE); - ret_value = -1; - goto done; - } - break; - - case 'l': - /* parse the -l layout option */ - if (h5repack_addlayout(opt_arg, options) < 0) { - error_msg("in parsing layout\n"); - h5tools_setstatus(EXIT_FAILURE); - ret_value = -1; - goto done; - } - break; - - case 'm': - options->min_comp = HDstrtoull(opt_arg , NULL, 0); - if ((int) options->min_comp <= 0) { - error_msg("invalid minimum compress size <%s>\n", opt_arg); - h5tools_setstatus(EXIT_FAILURE); - ret_value = -1; - goto done; - } - break; - - case 'e': - ret_value = read_info(opt_arg, options); - if (ret_value < 0) - goto done; - break; - - case 'n': - options->use_native = 1; - break; - - case 'L': - options->latest = TRUE; - break; - - case 'c': - options->grp_compact = HDatoi( opt_arg ); - if (options->grp_compact > 0) - options->latest = TRUE; /* must use latest format */ - break; - - case 'd': - options->grp_indexed = HDatoi( opt_arg ); - if (options->grp_indexed > 0) - options->latest = TRUE; /* must use latest format */ - break; - - case 's': - { - int idx = 0; - int ssize = 0; - char *msgPtr = HDstrchr( opt_arg, ':'); - options->latest = TRUE; /* must use latest format */ - if (msgPtr == NULL) { - ssize = HDatoi( opt_arg ); - for (idx = 0; idx < 5; idx++) - options->msg_size[idx] = ssize; - } - else { - char msgType[10]; - HDstrcpy(msgType, msgPtr + 1); - msgPtr[0] = '\0'; - ssize = HDatoi( opt_arg ); - if (HDstrncmp(msgType, "dspace",6) == 0) { - options->msg_size[0] = ssize; - } - else if (HDstrncmp(msgType, "dtype", 5) == 0) { - options->msg_size[1] = ssize; - } - else if (HDstrncmp(msgType, "fill", 4) == 0) { - options->msg_size[2] = ssize; - } - else if (HDstrncmp(msgType, "pline", 5) == 0) { - options->msg_size[3] = ssize; - } - else if (HDstrncmp(msgType, "attr", 4) == 0) { - options->msg_size[4] = ssize; - } - } - } - break; - - case 'u': - options->ublock_filename = opt_arg; - break; - - case 'b': - options->ublock_size = (hsize_t) HDatol( opt_arg ); - break; - - case 'M': - options->meta_block_size = (hsize_t) HDatol( opt_arg ); - break; - - case 't': - options->threshold = (hsize_t) HDatol( opt_arg ); - break; - - case 'a': - options->alignment = HDstrtoull(opt_arg , NULL, 0); - if (options->alignment < 1) { - error_msg("invalid alignment size\n", opt_arg); - h5tools_setstatus(EXIT_FAILURE); - ret_value = -1; - goto done; - } - break; - - case 'S': - { - char strategy[MAX_NC_NAME]; - - HDstrcpy(strategy, opt_arg); - if (!HDstrcmp(strategy, "ALL_PERSIST")) - options->fs_strategy = H5F_FILE_SPACE_ALL_PERSIST; - else if (!HDstrcmp(strategy, "ALL")) - options->fs_strategy = H5F_FILE_SPACE_ALL; - else if (!HDstrcmp(strategy, "AGGR_VFD")) - options->fs_strategy = H5F_FILE_SPACE_AGGR_VFD; - else if (!HDstrcmp(strategy, "VFD")) - options->fs_strategy = H5F_FILE_SPACE_VFD; - else { - error_msg("invalid file space management strategy\n", opt_arg); - h5tools_setstatus(EXIT_FAILURE); - ret_value = -1; - goto done; - } - } - break; - - case 'T': - options->fs_threshold = (hsize_t) HDatol( opt_arg ); - break; - - case 'E': - enable_error_stack = TRUE; - break; +int parse_command_line(int argc, const char **argv, pack_opt_t* options) +{ + int opt; + int ret_value = 0; + + /* parse command line options */ + while ((opt = get_option(argc, argv, s_opts, l_opts)) != EOF) { + switch ((char) opt) { + + /* -i for backward compability */ + case 'i': + infile = opt_arg; + has_i_o = 1; + break; + + /* -o for backward compability */ + case 'o': + outfile = opt_arg; + has_i_o = 1; + break; + + case 'h': + usage(h5tools_getprogname()); + h5tools_setstatus(EXIT_SUCCESS); + ret_value = -1; + goto done; - default: - break; - } /* switch */ + case 'V': + print_version(h5tools_getprogname()); + h5tools_setstatus(EXIT_SUCCESS); + ret_value = -1; + goto done; + + case 'v': + options->verbose = 1; + break; + case 'f': + /* parse the -f filter option */ + if (h5repack_addfilter(opt_arg, options) < 0) { + error_msg("in parsing filter\n"); + h5tools_setstatus(EXIT_FAILURE); + ret_value = -1; + goto done; + } + break; + + case 'l': + /* parse the -l layout option */ + if (h5repack_addlayout(opt_arg, options) < 0) { + error_msg("in parsing layout\n"); + h5tools_setstatus(EXIT_FAILURE); + ret_value = -1; + goto done; + } + break; + + case 'm': + options->min_comp = HDstrtoull(opt_arg , NULL, 0); + if ((int) options->min_comp <= 0) { + error_msg("invalid minimum compress size <%s>\n", opt_arg); + h5tools_setstatus(EXIT_FAILURE); + ret_value = -1; + goto done; + } + break; + + case 'e': + ret_value = read_info(opt_arg, options); + if (ret_value < 0) + goto done; + break; + + case 'n': + options->use_native = 1; + break; + + case 'L': + options->latest = TRUE; + break; + + case 'c': + options->grp_compact = HDatoi( opt_arg ); + if (options->grp_compact > 0) + options->latest = TRUE; /* must use latest format */ + break; + + case 'd': + options->grp_indexed = HDatoi( opt_arg ); + if (options->grp_indexed > 0) + options->latest = TRUE; /* must use latest format */ + break; + + case 's': + { + int idx = 0; + int ssize = 0; + char *msgPtr = HDstrchr( opt_arg, ':'); + options->latest = TRUE; /* must use latest format */ + if (msgPtr == NULL) { + ssize = HDatoi( opt_arg ); + for (idx = 0; idx < 5; idx++) + options->msg_size[idx] = ssize; + } + else { + char msgType[10]; + + HDstrcpy(msgType, msgPtr + 1); + msgPtr[0] = '\0'; + ssize = HDatoi( opt_arg ); + if (HDstrncmp(msgType, "dspace",6) == 0) + options->msg_size[0] = ssize; + else if (HDstrncmp(msgType, "dtype", 5) == 0) + options->msg_size[1] = ssize; + else if (HDstrncmp(msgType, "fill", 4) == 0) + options->msg_size[2] = ssize; + else if (HDstrncmp(msgType, "pline", 5) == 0) + options->msg_size[3] = ssize; + else if (HDstrncmp(msgType, "attr", 4) == 0) + options->msg_size[4] = ssize; + } + } + break; + + case 'u': + options->ublock_filename = opt_arg; + break; + + case 'b': + options->ublock_size = (hsize_t) HDatol( opt_arg ); + break; + + case 'M': + options->meta_block_size = (hsize_t) HDatol( opt_arg ); + break; + + case 't': + options->threshold = (hsize_t) HDatol( opt_arg ); + break; + + case 'a': + options->alignment = HDstrtoull(opt_arg , NULL, 0); + if (options->alignment < 1) { + error_msg("invalid alignment size\n", opt_arg); + h5tools_setstatus(EXIT_FAILURE); + ret_value = -1; + goto done; + } + break; + + case 'S': + { + char strategy[MAX_NC_NAME]; + + HDstrcpy(strategy, opt_arg); + if(!HDstrcmp(strategy, "ALL_PERSIST")) + options->fs_strategy = H5F_FILE_SPACE_ALL_PERSIST; + else if(!HDstrcmp(strategy, "ALL")) + options->fs_strategy = H5F_FILE_SPACE_ALL; + else if(!HDstrcmp(strategy, "AGGR_VFD")) + options->fs_strategy = H5F_FILE_SPACE_AGGR_VFD; + else if(!HDstrcmp(strategy, "VFD")) + options->fs_strategy = H5F_FILE_SPACE_VFD; + else { + error_msg("invalid file space management strategy\n", opt_arg); + h5tools_setstatus(EXIT_FAILURE); + ret_value = -1; + goto done; + } + } + break; + + case 'T': + options->fs_threshold = (hsize_t) HDatol( opt_arg ); + break; + + case 'E': + enable_error_stack = TRUE; + break; + + default: + break; + } /* switch */ } /* while */ if (has_i_o == 0) { - /* check for file names to be processed */ - if (argc <= opt_ind || argv[opt_ind + 1] == NULL) { - error_msg("missing file names\n"); - usage(h5tools_getprogname()); - h5tools_setstatus(EXIT_FAILURE); - ret_value = -1; - } - } + /* check for file names to be processed */ + if (argc <= opt_ind || argv[opt_ind + 1] == NULL) { + error_msg("missing file names\n"); + usage(h5tools_getprogname()); + h5tools_setstatus(EXIT_FAILURE); + ret_value = -1; + } + } done: - return ret_value; + return ret_value; } /*------------------------------------------------------------------------- @@ -591,16 +582,16 @@ done: * *------------------------------------------------------------------------- */ -int main(int argc, const char **argv) { +int main(int argc, const char **argv) +{ + pack_opt_t options; /*the global options */ H5E_auto2_t func; H5E_auto2_t tools_func; void *edata; void *tools_edata; - pack_opt_t options; /*the global options */ - - h5tools_setprogname(PROGRAMNAME); - h5tools_setstatus(EXIT_SUCCESS); + h5tools_setprogname(PROGRAMNAME); + h5tools_setstatus(EXIT_SUCCESS); /* Disable error reporting */ H5Eget_auto2(H5E_DEFAULT, &func, &edata); @@ -653,12 +644,12 @@ int main(int argc, const char **argv) { } /* pack it */ - h5tools_setstatus(h5repack(infile, outfile, &options)); + h5tools_setstatus(h5repack(infile, outfile, &options)); done: - /* free tables */ - h5repack_end(&options); + /* free tables */ + h5repack_end(&options); - leave(h5tools_getstatus()); + leave(h5tools_getstatus()); } diff --git a/tools/src/h5repack/h5repack_parse.c b/tools/src/h5repack/h5repack_parse.c index 004b9e4..6759169 100644 --- a/tools/src/h5repack/h5repack_parse.c +++ b/tools/src/h5repack/h5repack_parse.c @@ -47,9 +47,9 @@ obj_list_t* parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt, int k, l, p, q, end_obj = -1, no_param = 0; unsigned j, n; char sobj[MAX_NC_NAME]; - char scomp[10]; - char stype[6]; - char smask[3]; + char scomp[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; + char stype[6] = {0, 0, 0, 0, 0, 0}; + char smask[3] = {0, 0, 0}; obj_list_t* obj_list = NULL; unsigned pixels_per_block; @@ -396,6 +396,7 @@ obj_list_t* parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt, error_msg("invalid filter type in <%s>\n", str); HDexit(EXIT_FAILURE); } + break; } } /*i*/ diff --git a/tools/src/h5repack/h5repack_verify.c b/tools/src/h5repack/h5repack_verify.c index 6765c49..58dea03 100644 --- a/tools/src/h5repack/h5repack_verify.c +++ b/tools/src/h5repack/h5repack_verify.c @@ -39,11 +39,6 @@ static int verify_filters(hid_t pid, hid_t tid, int nfilters, filter_info_t *fil * Programmer: Pedro Vicente, pvn@hdfgroup.org * * Date: December 19, 2003 - * Modified: December, 19, 2007 (exactly 4 years later :-) ) - * Separate into 3 cases - * 1) no filter input, get all datasets and compare DCPLs. TO DO - * 2) filter input on selected datasets, get each one trough OBJ and match - * 3) filter input on all datasets, get all objects and match * *------------------------------------------------------------------------- */ @@ -51,8 +46,8 @@ static int verify_filters(hid_t pid, hid_t tid, int nfilters, filter_info_t *fil int h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options) { - int ret_value = 0; /*no need to LEAVE() on ERROR: HERR_INIT(int, SUCCEED) */ - hid_t fidin = -1; /* file ID for input file*/ + int ret_value = 0; /*no need to LEAVE() on ERROR: HERR_INIT(int, SUCCEED) */ + hid_t fidin = -1; /* file ID for input file*/ hid_t fidout = -1; /* file ID for output file*/ hid_t did = -1; /* dataset ID */ hid_t pid = -1; /* dataset creation property list ID */ diff --git a/tools/src/h5stat/CMakeLists.txt b/tools/src/h5stat/CMakeLists.txt index d4e14cb..9762dbb 100644 --- a/tools/src/h5stat/CMakeLists.txt +++ b/tools/src/h5stat/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 3.1.0) +cmake_minimum_required (VERSION 3.2.2) PROJECT (HDF5_TOOLS_SRC_H5STAT) #----------------------------------------------------------------------------- @@ -18,6 +18,17 @@ set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5stat") set (H5_DEP_EXECUTABLES h5stat) +if (BUILD_SHARED_LIBS) + add_executable (h5stat-shared ${HDF5_TOOLS_SRC_H5STAT_SOURCE_DIR}/h5stat.c) + TARGET_NAMING (h5stat-shared SHARED) + TARGET_C_PROPERTIES (h5stat-shared SHARED " " " ") + target_link_libraries (h5stat-shared ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) + set_target_properties (h5stat-shared PROPERTIES FOLDER tools) + set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5stat-shared") + + set (H5_DEP_EXECUTABLES ${H5_DEP_EXECUTABLES} h5stat-shared) +endif () + ############################################################################## ############################################################################## ### I N S T A L L A T I O N ### @@ -27,13 +38,17 @@ set (H5_DEP_EXECUTABLES h5stat) #----------------------------------------------------------------------------- # Rules for Installation of tools using make Install target #----------------------------------------------------------------------------- +if (HDF5_EXPORTED_TARGETS) + if (BUILD_SHARED_LIBS) + INSTALL_PROGRAM_PDB (h5stat-shared ${HDF5_INSTALL_BIN_DIR} toolsapplications) + endif () + INSTALL_PROGRAM_PDB (h5stat ${HDF5_INSTALL_BIN_DIR} toolsapplications) -#INSTALL_PROGRAM_PDB (h5stat ${HDF5_INSTALL_BIN_DIR} toolsapplications) - -install ( - TARGETS - h5stat - EXPORT - ${HDF5_EXPORTED_TARGETS} - RUNTIME DESTINATION ${HDF5_INSTALL_BIN_DIR} COMPONENT toolsapplications -) + install ( + TARGETS + ${H5_DEP_EXECUTABLES} + EXPORT + ${HDF5_EXPORTED_TARGETS} + RUNTIME DESTINATION ${HDF5_INSTALL_BIN_DIR} COMPONENT toolsapplications + ) +endif () diff --git a/tools/src/misc/CMakeLists.txt b/tools/src/misc/CMakeLists.txt index 0bda701..1292628 100644 --- a/tools/src/misc/CMakeLists.txt +++ b/tools/src/misc/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 3.1.0) +cmake_minimum_required (VERSION 3.2.2) PROJECT (HDF5_TOOLS_SRC_MISC) #----------------------------------------------------------------------------- @@ -50,7 +50,7 @@ set (H5_DEP_EXECUTABLES #----------------------------------------------------------------------------- #if (NOT WIN32) # configure_file (${HDF5_TOOLS_SRC_MISC_SOURCE_DIR}/h5cc.in ${HDF5_BINARY_DIR}/h5cc @ONLY) -#endif (NOT WIN32) +#endif () ############################################################################## ############################################################################## @@ -61,15 +61,16 @@ set (H5_DEP_EXECUTABLES #----------------------------------------------------------------------------- # Rules for Installation of tools using make Install target #----------------------------------------------------------------------------- +if (HDF5_EXPORTED_TARGETS) + INSTALL_PROGRAM_PDB (h5debug ${HDF5_INSTALL_BIN_DIR} toolsapplications) + INSTALL_PROGRAM_PDB (h5repart ${HDF5_INSTALL_BIN_DIR} toolsapplications) + INSTALL_PROGRAM_PDB (h5mkgrp ${HDF5_INSTALL_BIN_DIR} toolsapplications) -#INSTALL_PROGRAM_PDB (h5debug ${HDF5_INSTALL_BIN_DIR} toolsapplications) -#INSTALL_PROGRAM_PDB (h5repart ${HDF5_INSTALL_BIN_DIR} toolsapplications) -#INSTALL_PROGRAM_PDB (h5mkgrp ${HDF5_INSTALL_BIN_DIR} toolsapplications) - -install ( - TARGETS - h5debug h5repart h5mkgrp - EXPORT - ${HDF5_EXPORTED_TARGETS} - RUNTIME DESTINATION ${HDF5_INSTALL_BIN_DIR} COMPONENT toolsapplications -) + install ( + TARGETS + h5debug h5repart h5mkgrp + EXPORT + ${HDF5_EXPORTED_TARGETS} + RUNTIME DESTINATION ${HDF5_INSTALL_BIN_DIR} COMPONENT toolsapplications + ) +endif () diff --git a/tools/test/CMakeLists.txt b/tools/test/CMakeLists.txt index 608dd6e..a7dd11f 100644 --- a/tools/test/CMakeLists.txt +++ b/tools/test/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 3.1.0) +cmake_minimum_required (VERSION 3.2.2) PROJECT (HDF5_TOOLS_TEST) #----------------------------------------------------------------------------- diff --git a/tools/test/h5copy/CMakeLists.txt b/tools/test/h5copy/CMakeLists.txt index 5bab57b..4a519ab 100644 --- a/tools/test/h5copy/CMakeLists.txt +++ b/tools/test/h5copy/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 3.1.0) +cmake_minimum_required (VERSION 3.2.2) PROJECT (HDF5_TOOLS_TEST_H5COPY) #----------------------------------------------------------------------------- @@ -18,6 +18,6 @@ INCLUDE_DIRECTORIES (${HDF5_TOOLS_DIR}/lib) set_target_properties (h5copygentest PROPERTIES FOLDER generator/tools) #add_test (NAME h5copygentest COMMAND $) - endif (HDF5_BUILD_GENERATORS) + endif () include (CMakeTests.cmake) diff --git a/tools/test/h5copy/CMakeTests.cmake b/tools/test/h5copy/CMakeTests.cmake index fe36ca9..42495de 100644 --- a/tools/test/h5copy/CMakeTests.cmake +++ b/tools/test/h5copy/CMakeTests.cmake @@ -24,7 +24,7 @@ foreach (listfiles ${LIST_HDF5_TEST_FILES} ${LIST_OTHER_TEST_FILES}) get_filename_component(fname "${listfiles}" NAME) HDFTEST_COPY_FILE("${listfiles}" "${PROJECT_BINARY_DIR}/testfiles/${fname}" "h5copy_files") - endforeach (listfiles ${LIST_HDF5_TEST_FILES} ${LIST_OTHER_TEST_FILES}) + endforeach () add_custom_target(h5copy_files ALL COMMENT "Copying files needed by h5copy tests" DEPENDS ${h5copy_files_list}) ############################################################################## @@ -36,7 +36,7 @@ # # Perform h5copy according to passing parmeters # - MACRO (ADD_H5_F_TEST testname resultcode infile fparam vparam sparam srcname dparam dstname) + macro (ADD_H5_F_TEST testname resultcode infile fparam vparam sparam srcname dparam dstname) if (NOT HDF5_ENABLE_USING_MEMCHECKER) # Remove any output file left over from previous test run add_test ( @@ -45,7 +45,7 @@ -E remove ./testfiles/${testname}.out.h5 ) - endif (NOT HDF5_ENABLE_USING_MEMCHECKER) + endif () add_test ( NAME H5COPY_F-${testname} @@ -54,10 +54,10 @@ if (HDF5_ENABLE_USING_MEMCHECKER) if (NOT "${last_test}" STREQUAL "") set_tests_properties (H5COPY_F-${testname} PROPERTIES DEPENDS ${last_test}) - endif (NOT "${last_test}" STREQUAL "") - else (HDF5_ENABLE_USING_MEMCHECKER) + endif () + else () set_tests_properties (H5COPY_F-${testname} PROPERTIES DEPENDS H5COPY_F-${testname}-clear-objects) - endif (HDF5_ENABLE_USING_MEMCHECKER) + endif () # resultcode=2 will cause the test to skip the diff test if (NOT ${resultcode} STREQUAL "2") @@ -68,11 +68,11 @@ SET_TESTS_PROPERTIES(H5COPY_F-${testname}-DIFF PROPERTIES DEPENDS H5COPY_F-${testname}) if (${resultcode} STREQUAL "1") set_tests_properties (H5COPY_F-${testname}-DIFF PROPERTIES WILL_FAIL "true") - endif (${resultcode} STREQUAL "1") - endif (NOT ${resultcode} STREQUAL "2") - ENDMACRO (ADD_H5_F_TEST) + endif () + endif () + endmacro () - MACRO (ADD_H5_TEST testname resultcode infile vparam sparam srcname dparam dstname) + macro (ADD_H5_TEST testname resultcode infile vparam sparam srcname dparam dstname) if (NOT HDF5_ENABLE_USING_MEMCHECKER) # Remove any output file left over from previous test run add_test ( @@ -81,7 +81,7 @@ -E remove ./testfiles/${testname}.out.h5 ) - endif (NOT HDF5_ENABLE_USING_MEMCHECKER) + endif () add_test ( NAME H5COPY-${testname} @@ -90,10 +90,10 @@ if (HDF5_ENABLE_USING_MEMCHECKER) if (NOT "${last_test}" STREQUAL "") set_tests_properties (H5COPY-${testname} PROPERTIES DEPENDS ${last_test}) - endif (NOT "${last_test}" STREQUAL "") - else (HDF5_ENABLE_USING_MEMCHECKER) + endif () + else () set_tests_properties (H5COPY-${testname} PROPERTIES DEPENDS H5COPY-${testname}-clear-objects) - endif (HDF5_ENABLE_USING_MEMCHECKER) + endif () # resultcode=2 will cause the test to skip the diff test if (NOT ${resultcode} STREQUAL "2") @@ -104,11 +104,20 @@ SET_TESTS_PROPERTIES(H5COPY-${testname}-DIFF PROPERTIES DEPENDS H5COPY-${testname}) if (${resultcode} STREQUAL "1") set_tests_properties (H5COPY-${testname}-DIFF PROPERTIES WILL_FAIL "true") - endif (${resultcode} STREQUAL "1") - endif (NOT ${resultcode} STREQUAL "2") - ENDMACRO (ADD_H5_TEST) + endif () + endif () + endmacro () - MACRO (ADD_H5_TEST2 testname resultcode infile psparam pdparam vparam sparam srcname dparam dstname) + macro (ADD_SKIP_H5_TEST testname skipresultfile) + if (NOT HDF5_ENABLE_USING_MEMCHECKER) + add_test ( + NAME H5COPY-${testname}-${skipresultfile}-SKIPPED + COMMAND ${CMAKE_COMMAND} -E echo "SKIP ${testname}-${skipresultfile} ${ARGN}" + ) + endif () + endmacro () + + macro (ADD_H5_TEST2 testname resultcode infile psparam pdparam vparam sparam srcname dparam dstname) if (NOT HDF5_ENABLE_USING_MEMCHECKER) # Remove any output file left over from previous test run add_test ( @@ -117,7 +126,7 @@ -E remove ./testfiles/${testname}.out.h5 ) - endif (NOT HDF5_ENABLE_USING_MEMCHECKER) + endif () add_test ( NAME H5COPY-${testname}-prefill @@ -126,10 +135,10 @@ if (HDF5_ENABLE_USING_MEMCHECKER) if (NOT "${last_test}" STREQUAL "") set_tests_properties (H5COPY-${testname}-prefill PROPERTIES DEPENDS ${last_test}) - endif (NOT "${last_test}" STREQUAL "") - else (HDF5_ENABLE_USING_MEMCHECKER) + endif () + else () set_tests_properties (H5COPY-${testname}-prefill PROPERTIES DEPENDS H5COPY-${testname}-clear-objects) - endif (HDF5_ENABLE_USING_MEMCHECKER) + endif () add_test ( NAME H5COPY-${testname} @@ -145,11 +154,11 @@ SET_TESTS_PROPERTIES(H5COPY-${testname}-DIFF PROPERTIES DEPENDS H5COPY-${testname}) if (${resultcode} STREQUAL "1") set_tests_properties (H5COPY-${testname}-DIFF PROPERTIES WILL_FAIL "true") - endif (${resultcode} STREQUAL "1") - endif (NOT ${resultcode} STREQUAL "2") - ENDMACRO (ADD_H5_TEST2) + endif () + endif () + endmacro () - MACRO (ADD_H5_TEST_SAME testname resultcode pfile psparam pdparam vparam sparam srcname dparam dstname) + macro (ADD_H5_TEST_SAME testname resultcode pfile psparam pdparam vparam sparam srcname dparam dstname) if (NOT HDF5_ENABLE_USING_MEMCHECKER) # Remove any output file left over from previous test run add_test ( @@ -158,7 +167,7 @@ -E remove ./testfiles/${testname}.out.h5 ) - endif (NOT HDF5_ENABLE_USING_MEMCHECKER) + endif () add_test ( NAME H5COPY_SAME-${testname}-prefill @@ -167,10 +176,10 @@ if (HDF5_ENABLE_USING_MEMCHECKER) if (NOT "${last_test}" STREQUAL "") set_tests_properties (H5COPY_SAME-${testname}-prefill PROPERTIES DEPENDS ${last_test}) - endif (NOT "${last_test}" STREQUAL "") + endif () else (HDF5_ENABLE_USING_MEMCHECKER) set_tests_properties (H5COPY_SAME-${testname}-prefill PROPERTIES DEPENDS H5COPY_SAME-${testname}-clear-objects) - endif (HDF5_ENABLE_USING_MEMCHECKER) + endif () add_test ( NAME H5COPY_SAME-${testname} @@ -186,25 +195,25 @@ SET_TESTS_PROPERTIES(H5COPY_SAME-${testname}-DIFF PROPERTIES DEPENDS H5COPY_SAME-${testname}) if (${resultcode} STREQUAL "1") set_tests_properties (H5COPY_SAME-${testname}-DIFF PROPERTIES WILL_FAIL "true") - endif (${resultcode} STREQUAL "1") - endif (NOT ${resultcode} STREQUAL "2") - ENDMACRO (ADD_H5_TEST_SAME) + endif () + endif () + endmacro () # # Similiar to ADD_H5_TEST macro. Compare to outputs from source & target # files instead of checking with h5ls. # - MACRO (ADD_H5_CMP_TEST testname resultcode infile vparam sparam srcname dparam dstname) + macro (ADD_H5_CMP_TEST testname resultcode infile vparam sparam srcname dparam dstname) # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME H5COPY-CMP-${testname} COMMAND $ -i ./testfiles/${infile} -o ./testfiles/${testname}.out.h5 ${vparam} ${sparam} ${srcname} ${dparam} ${dstname} ${ARGN}) if (${resultcode} STREQUAL "1") set_tests_properties (H5COPY-CMP-${testname} PROPERTIES WILL_FAIL "true") - endif (${resultcode} STREQUAL "1") + endif () if (NOT "${last_test}" STREQUAL "") set_tests_properties (H5COPY-CMP-${testname} PROPERTIES DEPENDS ${last_test}) - endif (NOT "${last_test}" STREQUAL "") - else (HDF5_ENABLE_USING_MEMCHECKER) + endif () + else () # Remove any output file left over from previous test run add_test ( NAME H5COPY-CMP-${testname}-clear-objects @@ -225,8 +234,8 @@ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) set_tests_properties (H5COPY-CMP-${testname} PROPERTIES DEPENDS H5COPY-CMP-${testname}-clear-objects) - endif (HDF5_ENABLE_USING_MEMCHECKER) - ENDMACRO (ADD_H5_CMP_TEST) + endif () + endmacro () ############################################################################## ############################################################################## @@ -286,18 +295,38 @@ set_tests_properties (H5COPY-clearall-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") if (NOT "${last_test}" STREQUAL "") set_tests_properties (H5COPY-clearall-objects PROPERTIES DEPENDS ${last_test}) - endif (NOT "${last_test}" STREQUAL "") + endif () set (last_test "H5COPY-clearall-objects") - endif (HDF5_ENABLE_USING_MEMCHECKER) + endif () + +# See which filters are usable (and skip tests for filters we +# don't have). Do this by searching H5pubconf.h to see which +# filters are defined. + +# detect whether the encoder is present. + if (H5_HAVE_FILTER_DEFLATE) + set (USE_FILTER_DEFLATE "true") + endif () + + if (H5_HAVE_FILTER_SZIP) + set (USE_FILTER_SZIP "true") + endif () # "Test copying various forms of datasets" ADD_H5_TEST (simple 0 ${HDF_FILE1}.h5 -v -s simple -d simple) ADD_H5_TEST (chunk 0 ${HDF_FILE1}.h5 -v -s chunk -d chunk) ADD_H5_TEST (compact 0 ${HDF_FILE1}.h5 -v -s compact -d compact) ADD_H5_TEST (compound 0 ${HDF_FILE1}.h5 -v -s compound -d compound) - ADD_H5_TEST (compressed 0 ${HDF_FILE1}.h5 -v -s compressed -d compressed) + + if (USE_FILTER_DEFLATE) + ADD_H5_TEST (compressed 0 ${HDF_FILE1}.h5 -v -s compressed -d compressed) + else () + ADD_H5_TEST (compressed 2 ${HDF_FILE1}.h5 -v -s compressed -d compressed) + endif () + ADD_H5_TEST (named_vl 0 ${HDF_FILE1}.h5 -v -s named_vl -d named_vl) ADD_H5_TEST (nested_vl 0 ${HDF_FILE1}.h5 -v -s nested_vl -d nested_vl) + ADD_H5_TEST (dset_attr 0 ${HDF_FILE1}.h5 -v -s dset_attr -d dset_attr) # "Test copying dataset within group in source file to root of destination" ADD_H5_TEST (simple_top 0 ${HDF_FILE1}.h5 -v -s grp_dsets/simple -d simple_top) @@ -307,24 +336,41 @@ # "Test copying empty, 'full' & 'nested' groups" ADD_H5_TEST (grp_empty 0 ${HDF_FILE1}.h5 -v -s grp_empty -d grp_empty) - ADD_H5_TEST (grp_dsets 0 ${HDF_FILE1}.h5 -v -s grp_dsets -d grp_dsets) - ADD_H5_TEST (grp_nested 0 ${HDF_FILE1}.h5 -v -s grp_nested -d grp_nested) + if (USE_FILTER_DEFLATE) + ADD_H5_TEST (grp_dsets 0 ${HDF_FILE1}.h5 -v -s grp_dsets -d grp_dsets) + ADD_H5_TEST (grp_nested 0 ${HDF_FILE1}.h5 -v -s grp_nested -d grp_nested) + else () + ADD_H5_TEST (grp_dsets 2 ${HDF_FILE1}.h5 -v -s grp_dsets -d grp_dsets) + ADD_H5_TEST (grp_nested 2 ${HDF_FILE1}.h5 -v -s grp_nested -d grp_nested) + endif () + ADD_H5_TEST (grp_attr 0 ${HDF_FILE1}.h5 -v -s grp_attr -d grp_attr) # "Test copying dataset within group in source file to group in destination" ADD_H5_TEST2 (simple_group 0 ${HDF_FILE1}.h5 grp_dsets grp_dsets -v -s /grp_dsets/simple -d /grp_dsets/simple_group) - # "Test copying & renaming group" - ADD_H5_TEST (grp_rename 0 ${HDF_FILE1}.h5 -v -s grp_dsets -d grp_rename) - - # "Test copying 'full' group hierarchy into group in destination file" - ADD_H5_TEST2 (grp_dsets_rename 0 ${HDF_FILE1}.h5 grp_dsets grp_rename -v -s grp_dsets -d /grp_rename/grp_dsets) + if (USE_FILTER_DEFLATE) + # "Test copying & renaming group" + ADD_H5_TEST (grp_rename 0 ${HDF_FILE1}.h5 -v -s grp_dsets -d grp_rename) + # "Test copying 'full' group hierarchy into group in destination file" + ADD_H5_TEST2 (grp_dsets_rename 0 ${HDF_FILE1}.h5 grp_dsets grp_rename -v -s grp_dsets -d /grp_rename/grp_dsets) + else () + # "Test copying & renaming group" + ADD_H5_TEST (grp_rename 2 ${HDF_FILE1}.h5 -v -s grp_dsets -d grp_rename) + # "Test copying 'full' group hierarchy into group in destination file" + ADD_H5_TEST2 (grp_dsets_rename 2 ${HDF_FILE1}.h5 grp_dsets grp_rename -v -s grp_dsets -d /grp_rename/grp_dsets) + endif () # "Test copying objects into group hier. that doesn't exist yet in destination file" ADD_H5_TEST (A_B1_simple 0 ${HDF_FILE1}.h5 -vp -s simple -d /A/B1/simple) ADD_H5_TEST (A_B2_simple2 0 ${HDF_FILE1}.h5 -vp -s simple -d /A/B2/simple2) ADD_H5_TEST (C_D_simple 0 ${HDF_FILE1}.h5 -vp -s /grp_dsets/simple -d /C/D/simple) - ADD_H5_TEST (E_F_grp_dsets 0 ${HDF_FILE1}.h5 -vp -s /grp_dsets -d /E/F/grp_dsets) - ADD_H5_TEST (G_H_grp_nested 0 ${HDF_FILE1}.h5 -vp -s /grp_nested -d /G/H/grp_nested) + if (USE_FILTER_DEFLATE) + ADD_H5_TEST (E_F_grp_dsets 0 ${HDF_FILE1}.h5 -vp -s /grp_dsets -d /E/F/grp_dsets) + ADD_H5_TEST (G_H_grp_nested 0 ${HDF_FILE1}.h5 -vp -s /grp_nested -d /G/H/grp_nested) + else () + ADD_H5_TEST (E_F_grp_dsets 2 ${HDF_FILE1}.h5 -vp -s /grp_dsets -d /E/F/grp_dsets) + ADD_H5_TEST (G_H_grp_nested 2 ${HDF_FILE1}.h5 -vp -s /grp_nested -d /G/H/grp_nested) + endif () ############# COPY REFERENCES ############## @@ -370,4 +416,8 @@ # - dataset ADD_H5_TEST_SAME (samefile1 0 ${HDF_FILE1}.h5 /simple /simple -v -s /simple -d /simple_cp) # - group with some datasets - ADD_H5_TEST_SAME (samefile2 0 ${HDF_FILE1}.h5 /grp_dsets /grp_dsets -v -s /grp_dsets -d /grp_dsets_cp) + if (USE_FILTER_DEFLATE) + ADD_H5_TEST_SAME (samefile2 0 ${HDF_FILE1}.h5 /grp_dsets /grp_dsets -v -s /grp_dsets -d /grp_dsets_cp) + else () + ADD_H5_TEST_SAME (samefile2 2 ${HDF_FILE1}.h5 /grp_dsets /grp_dsets -v -s /grp_dsets -d /grp_dsets_cp) + endif () diff --git a/tools/test/h5copy/testh5copy.sh.in b/tools/test/h5copy/testh5copy.sh.in index 6d1478a..dbee089 100644 --- a/tools/test/h5copy/testh5copy.sh.in +++ b/tools/test/h5copy/testh5copy.sh.in @@ -21,6 +21,10 @@ srcdir=@srcdir@ +# Determine which filters are available +USE_FILTER_SZIP="@USE_FILTER_SZIP@" +USE_FILTER_DEFLATE="@USE_FILTER_DEFLATE@" + # source dirs SRC_TOOLS="$srcdir/../.." SRC_TOOLS_TESTFILES="$SRC_TOOLS/testfiles" @@ -78,7 +82,7 @@ AWK='awk' nerrors=0 verbose=yes -h5haveexitcode=yes # default is yes +h5haveexitcode=yes # default is yes TESTDIR=./testfiles test -d $TESTDIR || mkdir $TESTDIR @@ -111,10 +115,10 @@ COPY_TESTFILES_TO_TESTDIR() INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'` if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then - $CP -f $tstfile $TESTDIR + $CP -f $tstfile $TESTDIR if [ $? -ne 0 ]; then echo "Error: FAILED to copy $tstfile ." - + # Comment out this to CREATE expected file exit $EXIT_FAILURE fi @@ -139,13 +143,13 @@ CLEAN_TESTFILES_AND_TESTDIR() # Print a "SKIP" message SKIP() { - TESTING $H5COPY $@ - echo " -SKIP-" + TESTING $H5COPY $@ + echo " -SKIP-" } # Print a line-line message left justified in a field of 70 characters # beginning with the word "Testing". -TESTING() +TESTING() { SPACES=" " echo "Testing $* $SPACES" |cut -c1-70 |tr -d '\012' @@ -154,7 +158,7 @@ TESTING() # Print a line-line message left justified in a field of 70 characters # beginning with the word "Verifying". # -VERIFY() +VERIFY() { SPACES=" " echo "Verifying h5diff output $* $SPACES" | cut -c1-70 | tr -d '\012' @@ -163,7 +167,7 @@ VERIFY() # Print a line-line message left justified in a field of 70 characters # beginning with the word "Verifying". # -VERIFY_OUTPUT() +VERIFY_OUTPUT() { SPACES=" " echo "Verifying output files $* $SPACES" | cut -c1-70 | tr -d '\012' @@ -182,7 +186,7 @@ VERIFY_OUTPUT() # $4 is output file # $* everything else arguments for h5copy. -TOOLTEST() +TOOLTEST() { actualout="$TESTDIR/tooltest.actualout" actualerr="$TESTDIR/tooltest.actualerr" @@ -199,7 +203,7 @@ TOOLTEST() fi if [ "$3" = -o ]; then outputfile=$4 - else + else if [ "$1" = -f ]; then outputfile=$6 else @@ -207,7 +211,7 @@ TOOLTEST() fi runh5diff=no fi - + TESTING $H5COPY $@ ( echo "#############################" @@ -223,7 +227,7 @@ TOOLTEST() nerrors="`expr $nerrors + 1`" else echo " PASSED" - + if [ $runh5diff != no ]; then H5DIFFTEST $inputfile $outputfile $7 $9 fi @@ -236,7 +240,7 @@ TOOLTEST() } # TOOLTEST back-to-back -TOOLTEST_PREFILL() +TOOLTEST_PREFILL() { actualout="$TESTDIR/tooltest.actualout" actualerr="$TESTDIR/tooltest.actualerr" @@ -248,21 +252,21 @@ TOOLTEST_PREFILL() fi if [ "$3" = -o ]; then outputfile=$4 - else + else runh5diff=no fi - + grp_name=$5 grp_name2=$6 obj_name=$7 obj_name2=$8 - + TESTING $H5COPY $@ ( echo "#############################" echo " output for '$H5COPY $@'" echo "#############################" - $RUNSERIAL $H5COPY_BIN -i $inputfile -o $outputfile -v -s $grp_name -d $grp_name2 + $RUNSERIAL $H5COPY_BIN -i $inputfile -o $outputfile -v -s $grp_name -d $grp_name2 ) > $actualout 2> $actualerr RET=$? if [ $RET != 0 ]; then @@ -276,7 +280,7 @@ TOOLTEST_PREFILL() echo "#############################" echo " output for '$H5COPY $@'" echo "#############################" - $RUNSERIAL $H5COPY_BIN -i $inputfile -o $outputfile -v -s $obj_name -d $obj_name2 + $RUNSERIAL $H5COPY_BIN -i $inputfile -o $outputfile -v -s $obj_name -d $obj_name2 ) > $actualout 2> $actualerr RET=$? if [ $RET != 0 ]; then @@ -286,11 +290,11 @@ TOOLTEST_PREFILL() nerrors="`expr $nerrors + 1`" else echo " PASSED" - + if [ $runh5diff != no ]; then H5DIFFTEST $inputfile $outputfile $obj_name $obj_name2 fi - + # Clean up output file if test -z "$HDF5_NOCLEANUP"; then rm -f $actualout $actualerr $outputfile @@ -300,7 +304,7 @@ TOOLTEST_PREFILL() } # TOOLTEST back-to-back -TOOLTEST_SAME() +TOOLTEST_SAME() { actualout="$TESTDIR/tooltest.actualout" actualerr="$TESTDIR/tooltest.actualerr" @@ -312,19 +316,19 @@ TOOLTEST_SAME() fi if [ "$3" = -o ]; then outputfile=$4 - else + else runh5diff=no fi - + grp_name=$5 grp_name2=$6 - + TESTING $H5COPY $@ ( echo "#############################" echo " output for '$H5COPY $@'" echo "#############################" - $RUNSERIAL $H5COPY_BIN -i $inputfile -o $outputfile -v -s $grp_name -d $grp_name + $RUNSERIAL $H5COPY_BIN -i $inputfile -o $outputfile -v -s $grp_name -d $grp_name ) > $actualout 2> $actualerr RET=$? if [ $RET != 0 ]; then @@ -338,7 +342,7 @@ TOOLTEST_SAME() echo "#############################" echo " output for '$H5COPY $@'" echo "#############################" - $RUNSERIAL $H5COPY_BIN -i $outputfile -o $outputfile -v -s $grp_name -d $grp_name2 + $RUNSERIAL $H5COPY_BIN -i $outputfile -o $outputfile -v -s $grp_name -d $grp_name2 ) > $actualout 2> $actualerr RET=$? if [ $RET != 0 ]; then @@ -348,11 +352,11 @@ TOOLTEST_SAME() nerrors="`expr $nerrors + 1`" else echo " PASSED" - + if [ $runh5diff != no ]; then H5DIFFTEST $outputfile $outputfile $grp_name $grp_name2 fi - + # Clean up output file if test -z "$HDF5_NOCLEANUP"; then rm -f $actualout $actualerr $outputfile @@ -389,7 +393,7 @@ CMP_OUTPUT() fi } -TOOLTEST_FAIL() +TOOLTEST_FAIL() { expectout="$TESTDIR/$1" actualout="$TESTDIR/$1.actualout" @@ -433,7 +437,7 @@ TOOLTEST_FAIL() cat $actualout nerrors="`expr $nerrors + 1`" fi - + # Clean up output file if test -z "$HDF5_NOCLEANUP"; then @@ -444,10 +448,10 @@ TOOLTEST_FAIL() # Call the h5diff tool # -H5DIFFTEST() +H5DIFFTEST() { VERIFY $@ - $RUNSERIAL $H5DIFF_BIN -q "$@" + $RUNSERIAL $H5DIFF_BIN -q "$@" RET=$? if [ $RET != 0 ] ; then echo "*FAILED*" @@ -459,10 +463,10 @@ H5DIFFTEST() # Call the h5diff tool with a call that is expected to fail # -H5DIFFTEST_FAIL() +H5DIFFTEST_FAIL() { VERIFY $@ - $RUNSERIAL $H5DIFF_BIN -q "$@" + $RUNSERIAL $H5DIFF_BIN -q "$@" RET=$? if [ $h5haveexitcode = 'yes' -a $RET != 1 ] ; then @@ -478,7 +482,7 @@ H5DIFFTEST_FAIL() # # Assumed arguments: # -COPY_OBJECTS() +COPY_OBJECTS() { TESTFILE="$TESTDIR/h5copytst.h5" @@ -487,7 +491,9 @@ COPY_OBJECTS() TOOLTEST -i $TESTFILE -o $TESTDIR/chunk.out.h5 -v -s chunk -d chunk TOOLTEST -i $TESTFILE -o $TESTDIR/compact.out.h5 -v -s compact -d compact TOOLTEST -i $TESTFILE -o $TESTDIR/compound.out.h5 -v -s compound -d compound +if test $USE_FILTER_DEFLATE = "yes" ; then TOOLTEST -i $TESTFILE -o $TESTDIR/compressed.out.h5 -v -s compressed -d compressed +fi TOOLTEST -i $TESTFILE -o $TESTDIR/named_vl.out.h5 -v -s named_vl -d named_vl TOOLTEST -i $TESTFILE -o $TESTDIR/nested_vl.out.h5 -v -s nested_vl -d nested_vl TOOLTEST -i $TESTFILE -o $TESTDIR/dset_attr.out.h5 -v -s /dset_attr -d /dset_attr @@ -499,16 +505,19 @@ COPY_OBJECTS() TOOLTEST -i $TESTFILE -o $TESTDIR/dsrename.out.h5 -v -s compound -d rename echo "Test copying empty, 'full' & 'nested' groups" +if test $USE_FILTER_DEFLATE = "yes" ; then TOOLTEST -i $TESTFILE -o $TESTDIR/grp_empty.out.h5 -v -s grp_empty -d grp_empty +fi TOOLTEST -i $TESTFILE -o $TESTDIR/grp_dsets.out.h5 -v -s grp_dsets -d grp_dsets TOOLTEST -i $TESTFILE -o $TESTDIR/grp_nested.out.h5 -v -s grp_nested -d grp_nested TOOLTEST -i $TESTFILE -o $TESTDIR/grp_attr.out.h5 -v -s grp_attr -d grp_attr +if test $USE_FILTER_DEFLATE = "yes" ; then echo "Test copying dataset within group in source file to group in destination" TOOLTEST_PREFILL -i $TESTFILE -o $TESTDIR/simple_group.out.h5 grp_dsets grp_dsets /grp_dsets/simple /grp_dsets/simple_group - echo "Test copying & renaming group" TOOLTEST -i $TESTFILE -o $TESTDIR/grp_rename.out.h5 -v -s grp_dsets -d grp_rename +fi echo "Test copying 'full' group hierarchy into group in destination file" TOOLTEST_PREFILL -i $TESTFILE -o $TESTDIR/grp_dsets_rename.out.h5 grp_dsets grp_rename grp_dsets /grp_rename/grp_dsets @@ -517,15 +526,17 @@ COPY_OBJECTS() TOOLTEST -i $TESTFILE -o $TESTDIR/A_B1_simple.out.h5 -vp -s simple -d /A/B1/simple TOOLTEST -i $TESTFILE -o $TESTDIR/A_B2_simple2.out.h5 -vp -s simple -d /A/B2/simple2 TOOLTEST -i $TESTFILE -o $TESTDIR/C_D_simple.out.h5 -vp -s /grp_dsets/simple -d /C/D/simple +if test $USE_FILTER_DEFLATE = "yes" ; then TOOLTEST -i $TESTFILE -o $TESTDIR/E_F_grp_dsets.out.h5 -vp -s /grp_dsets -d /E/F/grp_dsets TOOLTEST -i $TESTFILE -o $TESTDIR/G_H_grp_nested.out.h5 -vp -s /grp_nested -d /G/H/grp_nested +fi } # Copy references in various way. # # Assumed arguments: # -COPY_REFERENCES() +COPY_REFERENCES() { TESTFILE="$TESTDIR/h5copy_ref.h5" @@ -538,7 +549,7 @@ COPY_REFERENCES() # # Assumed arguments: # -COPY_EXT_LINKS() +COPY_EXT_LINKS() { TESTFILE="$TESTDIR/h5copy_extlinks_src.h5" @@ -571,7 +582,7 @@ COPY_EXT_LINKS() # # Assumed arguments: # -TEST_MISC() +TEST_MISC() { TESTFILE="$TESTDIR/h5copytst.h5" @@ -579,8 +590,10 @@ TEST_MISC() TOOLTEST_FAIL h5copy_misc1.out -i $TESTFILE -o $TESTDIR/h5copy_misc1.out.h5 -v -s /simple -d /g1/g2/simple echo "Test copying objects to the same file " - TOOLTEST_SAME -i $TESTFILE -o $TESTDIR/samefile1.out.h5 /simple /simple_cp + TOOLTEST_SAME -i $TESTFILE -o $TESTDIR/samefile1.out.h5 /simple /simple_cp +if test $USE_FILTER_DEFLATE = "yes" ; then TOOLTEST_SAME -i $TESTFILE -o $TESTDIR/samefile2.out.h5 /grp_dsets /grp_dsets_cp +fi } ############################################################################## @@ -590,7 +603,7 @@ TEST_MISC() COPY_TESTFILES_TO_TESTDIR # Start tests -COPY_OBJECTS +COPY_OBJECTS COPY_REFERENCES COPY_EXT_LINKS TEST_MISC diff --git a/tools/test/h5diff/CMakeLists.txt b/tools/test/h5diff/CMakeLists.txt index 2507664..f6951a3 100644 --- a/tools/test/h5diff/CMakeLists.txt +++ b/tools/test/h5diff/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 3.1.0) +cmake_minimum_required (VERSION 3.2.2) PROJECT (HDF5_TOOLS_TEST_H5DIFF) #----------------------------------------------------------------------------- @@ -17,6 +17,34 @@ INCLUDE_DIRECTORIES (${HDF5_TOOLS_DIR}/lib) set_target_properties (h5diffgentest PROPERTIES FOLDER generator/tools) #add_test (NAME h5diffgentest COMMAND $) - endif (HDF5_BUILD_GENERATORS) + endif () + + #----------------------------------------------------------------------------- + # If plugin library tests can be tested + #----------------------------------------------------------------------------- + set (HDF5_TOOL_PLUGIN_LIB_CORENAME "dynlibdiff") + set (HDF5_TOOL_PLUGIN_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_TOOL_PLUGIN_LIB_CORENAME}") + set (HDF5_TOOL_PLUGIN_LIB_TARGET ${HDF5_TOOL_PLUGIN_LIB_CORENAME}) + add_definitions (${HDF_EXTRA_C_FLAGS}) + INCLUDE_DIRECTORIES (${HDF5_SRC_DIR}) + + add_library (${HDF5_TOOL_PLUGIN_LIB_TARGET} SHARED dynlib_diff.c) + TARGET_C_PROPERTIES (${HDF5_TOOL_PLUGIN_LIB_TARGET} SHARED " " " ") + target_link_libraries (${HDF5_TOOL_PLUGIN_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) + H5_SET_LIB_OPTIONS (${HDF5_TOOL_PLUGIN_LIB_TARGET} ${HDF5_TOOL_PLUGIN_LIB_NAME} SHARED ${HDF5_PACKAGE_SOVERSION}) + + # make plugins dir + file (MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/plugins") + #----------------------------------------------------------------------------- + # Copy plugin library to a plugins folder + #----------------------------------------------------------------------------- + add_custom_command ( + TARGET ${HDF5_TOOL_PLUGIN_LIB_TARGET} + POST_BUILD + COMMAND ${CMAKE_COMMAND} + ARGS -E copy_if_different + "$" + "${CMAKE_BINARY_DIR}/plugins/$" + ) include (CMakeTests.cmake) diff --git a/tools/test/h5diff/CMakeTests.cmake b/tools/test/h5diff/CMakeTests.cmake index 3687574..ca23677 100644 --- a/tools/test/h5diff/CMakeTests.cmake +++ b/tools/test/h5diff/CMakeTests.cmake @@ -55,6 +55,10 @@ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/tmptest2.he5 ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/tmpSingleSiteBethe.reference.h5 ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/tmpSingleSiteBethe.output.h5 + ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/tudfilter.h5 + ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/tudfilter2.h5 + ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/diff_strings1.h5 + ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/diff_strings2.h5 # tools/testfiles/vds ${HDF5_TOOLS_DIR}/testfiles/vds/1_a.h5 ${HDF5_TOOLS_DIR}/testfiles/vds/1_b.h5 @@ -207,6 +211,10 @@ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_518.txt ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_530.txt ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_540.txt + ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_60.txt + ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_61.txt + ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_62.txt + ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_63.txt ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_600.txt ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_601.txt ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_603.txt @@ -259,6 +267,8 @@ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_90.txt ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_tmp1.txt ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_tmp2.txt + ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_ud.txt + ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_udfail.txt ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_v1.txt ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_v2.txt ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_v3.txt @@ -273,6 +283,9 @@ # Make testfiles dir under build dir file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") + if (H5_HAVE_PARALLEL) + file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/PAR/testfiles") + endif () # # copy test files from source to build dir @@ -280,6 +293,9 @@ foreach (h5_tstfiles ${LIST_HDF5_TEST_FILES} ${LIST_OTHER_TEST_FILES}) get_filename_component(fname "${h5_tstfiles}" NAME) HDFTEST_COPY_FILE("${h5_tstfiles}" "${PROJECT_BINARY_DIR}/testfiles/${fname}" "h5diff_files") + if (H5_HAVE_PARALLEL) + HDFTEST_COPY_FILE("${h5_tstfiles}" "${PROJECT_BINARY_DIR}/PAR/testfiles/${fname}" "h5diff_files") + endif () endforeach () @@ -290,11 +306,17 @@ foreach (h5_tstfiles ${LIST_WIN_TEST_FILES}) get_filename_component(fname "${h5_tstfiles}" NAME) HDFTEST_COPY_FILE("${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/${h5_tstfiles}w.txt" "${PROJECT_BINARY_DIR}/testfiles/${fname}.txt" "h5diff_files") + if (H5_HAVE_PARALLEL) + HDFTEST_COPY_FILE("${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/${h5_tstfiles}w.txt" "${PROJECT_BINARY_DIR}/PAR/testfiles/${fname}.txt" "h5diff_files") + endif () endforeach () else () foreach (h5_tstfiles ${LIST_WIN_TEST_FILES}) get_filename_component(fname "${h5_tstfiles}" NAME) HDFTEST_COPY_FILE("${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/${h5_tstfiles}.txt" "${PROJECT_BINARY_DIR}/testfiles/${fname}.txt" "h5diff_files") + if (H5_HAVE_PARALLEL) + HDFTEST_COPY_FILE("${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/${h5_tstfiles}.txt" "${PROJECT_BINARY_DIR}/PAR/testfiles/${fname}.txt" "h5diff_files") + endif () endforeach () endif () add_custom_target(h5diff_files ALL COMMENT "Copying files needed by h5diff tests" DEPENDS ${h5diff_files_list}) @@ -305,7 +327,7 @@ ############################################################################## ############################################################################## - MACRO (ADD_H5_TEST resultfile resultcode) + macro (ADD_H5_TEST resultfile resultcode) # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME H5DIFF-${resultfile} COMMAND $ ${ARGN}) @@ -316,7 +338,7 @@ if (NOT "${last_test}" STREQUAL "") set_tests_properties (H5DIFF-${resultfile} PROPERTIES DEPENDS ${last_test}) endif () - else (HDF5_ENABLE_USING_MEMCHECKER) + else () add_test ( NAME H5DIFF-${resultfile} COMMAND "${CMAKE_COMMAND}" @@ -329,40 +351,90 @@ -D "TEST_APPEND=EXIT CODE:" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) - endif (HDF5_ENABLE_USING_MEMCHECKER) + endif () if (H5_HAVE_PARALLEL) ADD_PH5_TEST (${resultfile} ${resultcode} ${ARGN}) endif () - ENDMACRO (ADD_H5_TEST file) + endmacro () - MACRO (ADD_PH5_TEST resultfile resultcode) + macro (ADD_PH5_TEST resultfile resultcode) # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME PH5DIFF-${resultfile} COMMAND $ ${MPIEXEC} ${MPIEXEC_PREFLAGS} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_POSTFLAGS} ${ARGN}) - set_tests_properties (PH5DIFF-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") + set_tests_properties (PH5DIFF-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/PAR/testfiles") if (NOT ${resultcode} STREQUAL "0") set_tests_properties (PH5DIFF-${resultfile} PROPERTIES WILL_FAIL "true") endif () if (NOT "${last_test}" STREQUAL "") set_tests_properties (PH5DIFF-${resultfile} PROPERTIES DEPENDS ${last_test}) endif () - else (HDF5_ENABLE_USING_MEMCHECKER) + else () add_test ( NAME PH5DIFF-${resultfile} COMMAND "${CMAKE_COMMAND}" -D "TEST_PROGRAM=${MPIEXEC};${MPIEXEC_PREFLAGS};${MPIEXEC_NUMPROC_FLAG};${MPIEXEC_MAX_NUMPROCS};${MPIEXEC_POSTFLAGS};$" -D "TEST_ARGS:STRING=${ARGN}" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" - -D "TEST_OUTPUT=P_${resultfile}.out" - -D "TEST_EXPECT=${resultcode}" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/PAR/testfiles" + -D "TEST_OUTPUT=${resultfile}.out" + -D "TEST_EXPECT=0" -D "TEST_REFERENCE=${resultfile}.txt" -# -D "TEST_APPEND=EXIT CODE: [0-9]" -# -D "TEST_REF_FILTER=EXIT CODE: 0" - -D "TEST_SKIP_COMPARE=TRUE" - -P "${HDF_RESOURCES_EXT_DIR}/prunTest.cmake" + -D "TEST_APPEND=EXIT CODE:" + -D "TEST_REF_APPEND=EXIT CODE: [0-9]" + -D "TEST_REF_FILTER=EXIT CODE: 0" + -D "TEST_SORT_COMPARE=TRUE" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) + if (NOT "${last_test}" STREQUAL "") + set_tests_properties (PH5DIFF-${resultfile} PROPERTIES DEPENDS ${last_test}) + endif () + set (last_test "PH5DIFF-${resultfile}") + endif () + endmacro () + + macro (ADD_H5_UD_TEST testname resultcode resultfile) + if (NOT HDF5_ENABLE_USING_MEMCHECKER) + # Remove any output file left over from previous test run + add_test ( + NAME H5DIFF_UD-${testname}-clearall-objects + COMMAND ${CMAKE_COMMAND} + -E remove + testfiles/${resultfile}.out + testfiles/${resultfile}.out.err ) - endif (HDF5_ENABLE_USING_MEMCHECKER) - ENDMACRO (ADD_PH5_TEST file) + if (${resultcode} STREQUAL "2") + add_test ( + NAME H5DIFF_UD-${testname} + COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$" + -D "TEST_ARGS:STRING=${ARGN}" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" + -D "TEST_OUTPUT=${resultfile}.out" + -D "TEST_EXPECT=${resultcode}" + -D "TEST_REFERENCE=${resultfile}.txt" + -D "TEST_APPEND=EXIT CODE:" + -D "TEST_ENV_VAR=HDF5_PLUGIN_PATH" + -D "TEST_ENV_VALUE=${CMAKE_BINARY_DIR}" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) + else () + add_test ( + NAME H5DIFF_UD-${testname} + COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$" + -D "TEST_ARGS:STRING=${ARGN}" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" + -D "TEST_OUTPUT=${resultfile}.out" + -D "TEST_EXPECT=${resultcode}" + -D "TEST_REFERENCE=${resultfile}.txt" + -D "TEST_APPEND=EXIT CODE:" + -D "TEST_ENV_VAR=HDF5_PLUGIN_PATH" + -D "TEST_ENV_VALUE=${CMAKE_BINARY_DIR}/plugins" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) + endif () + set_tests_properties (H5DIFF_UD-${testname} PROPERTIES DEPENDS H5DIFF_UD-${testname}-clearall-objects) + endif () + endmacro () ############################################################################## ############################################################################## @@ -419,6 +491,10 @@ # attrs with verbose option level set (ATTR_VERBOSE_LEVEL_FILE1 h5diff_attr_v_level1.h5) set (ATTR_VERBOSE_LEVEL_FILE2 h5diff_attr_v_level2.h5) + # strings + set (STRINGS1 diff_strings1.h5) + set (STRINGS2 diff_strings2.h5) + # VDS tests set (FILEV1 1_vds.h5) set (FILEV2 2_vds.h5) @@ -683,6 +759,14 @@ h5diff_530.out.err h5diff_540.out h5diff_540.out.err + h5diff_60.out + h5diff_60.out.err + h5diff_61.out + h5diff_61.out.err + h5diff_62.out + h5diff_62.out.err + h5diff_63.out + h5diff_63.out.err h5diff_600.out h5diff_600.out.err h5diff_601.out @@ -789,9 +873,9 @@ set_tests_properties (H5DIFF-clearall-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") if (NOT "${last_test}" STREQUAL "") set_tests_properties (H5DIFF-clearall-objects PROPERTIES DEPENDS ${last_test}) - endif (NOT "${last_test}" STREQUAL "") + endif () set (last_test "H5DIFF-clearall-objects") - endif (HDF5_ENABLE_USING_MEMCHECKER) + endif () # ############################################################################ # # Common usage @@ -918,6 +1002,13 @@ ADD_H5_TEST (h5diff_58 1 -v ${FILE7} ${FILE8} refreg) # ( HDDFV-7942 ) ADD_H5_TEST (h5diff_59 0 -v ${FILE4} ${FILE4} dset11a dset11b) +# Strings +# ( HDFFV-10128 ) +ADD_H5_TEST (h5diff_60 1 -v ${STRINGS1} ${STRINGS2} string1 string1) +ADD_H5_TEST (h5diff_61 1 -v ${STRINGS1} ${STRINGS2} string2 string2) +ADD_H5_TEST (h5diff_62 1 -v ${STRINGS1} ${STRINGS2} string3 string3) +ADD_H5_TEST (h5diff_63 1 -v ${STRINGS1} ${STRINGS2} string4 string4) + # ############################################################################## # # Error messages # ############################################################################## @@ -1084,8 +1175,7 @@ ADD_H5_TEST (h5diff_103 1 -v --use-system-epsilon ${FILE1} ${FILE1} g1/d1 g1/d2) # with --use-system-epsilon for float value. expect less differences -ADD_H5_TEST (h5diff_104 1 -v --use-system-epsilon ${FILE1} ${FILE1} g1/fp1 -g1/fp2) +ADD_H5_TEST (h5diff_104 1 -v --use-system-epsilon ${FILE1} ${FILE1} g1/fp1 g1/fp2) # not comparable -c flag ADD_H5_TEST (h5diff_200 0 ${FILE2} ${FILE2} g2/dset1 g2/dset2) @@ -1376,8 +1466,19 @@ ADD_H5_TEST (h5diff_644 1 -v --use-system-epsilon -d 5 ${FILE1} ${FILE2} /g1/dse ADD_H5_TEST (h5diff_645 1 -v -p 0.05 --use-system-epsilon ${FILE1} ${FILE2} /g1/dset3 /g1/dset4) ADD_H5_TEST (h5diff_646 1 -v --use-system-epsilon -p 0.05 ${FILE1} ${FILE2} /g1/dset3 /g1/dset4) -# VDS +# ############################################################################## +# VDS tests +# ############################################################################## ADD_H5_TEST (h5diff_v1 0 -v ${FILEV1} ${FILEV2}) ADD_H5_TEST (h5diff_v2 0 -r ${FILEV1} ${FILEV2}) ADD_H5_TEST (h5diff_v3 0 -c ${FILEV1} ${FILEV2}) +############################################################################## +### P L U G I N T E S T S +############################################################################## +ADD_H5_UD_TEST (h5diff_plugin_test 0 h5diff_ud -v tudfilter.h5 tudfilter2.h5) +ADD_H5_UD_TEST (h5diff_plugin_fail 2 h5diff_udfail -v tudfilter.h5 tudfilter2.h5) + +# ############################################################################## +# # END +# ############################################################################## diff --git a/tools/test/h5diff/Makefile.am b/tools/test/h5diff/Makefile.am index c366199..1d700ea 100644 --- a/tools/test/h5diff/Makefile.am +++ b/tools/test/h5diff/Makefile.am @@ -38,6 +38,11 @@ check_PROGRAMS=$(TEST_PROG) check_SCRIPTS=$(TEST_SCRIPT) $(TEST_SCRIPT_PARA) # The parallel test script testph5diff.sh actually depends on testh5diff.sh. SCRIPT_DEPEND=../../src/h5diff/h5diff$(EXEEXT) $(H5PDIFF) ../../src/h5diff/testh5diff.sh +if HAVE_SHARED_CONDITIONAL +if USE_PLUGINS_CONDITIONAL + TEST_SCRIPT += h5diff_plugin.sh +endif +endif # Source files for the program h5diffgentest_SOURCES=h5diffgentest.c @@ -45,9 +50,20 @@ h5diffgentest_SOURCES=h5diffgentest.c # Programs depend on the main HDF5 library and tools library LDADD=$(LIBH5TOOLS) $(LIBHDF5) +if HAVE_SHARED_CONDITIONAL + # Build it as shared library if configure is enabled for shared library. + lib_LTLIBRARIES=libdynlibdiff.la + libdynlibdiff_la_SOURCES=dynlib_diff.c + +install-exec-hook: + $(RM) $(DESTDIR)$(libdir)/*dynlib* +endif + # Temporary files. *.h5 are generated by h5diff. They should # be copied to the testfiles/ directory if update is required CHECK_CLEANFILES+=*.h5 expect_sorted actual_sorted +DISTCLEANFILES=h5diff_plugin.sh + include $(top_srcdir)/config/conclude.am diff --git a/tools/test/h5diff/h5diffgentest.c b/tools/test/h5diff/h5diffgentest.c index 339ff6c..c3b45bc 100644 --- a/tools/test/h5diff/h5diffgentest.c +++ b/tools/test/h5diff/h5diffgentest.c @@ -24,9 +24,9 @@ * size of that temporary buffer in bytes. For efficiency's sake, choose the * largest value suitable for your machine (for testing use a small value). */ -/* Maximum size used in a call to malloc for a dataset +/* Maximum size used in a call to malloc for a dataset * NOTE: this value should stay in sync with the value defined in the tools - * library file: h5tools_utils.h + * library file: h5tools_utils.h */ size_t H5TOOLS_MALLOCSIZE = (128 * 1024 * 1024); @@ -95,6 +95,9 @@ size_t H5TOOLS_MALLOCSIZE = (128 * 1024 * 1024); /* non-comparable dataset and attribute */ #define NON_COMPARBLES1 "non_comparables1.h5" #define NON_COMPARBLES2 "non_comparables2.h5" +/* string dataset and attribute */ +#define DIFF_STRINGS1 "diff_strings1.h5" +#define DIFF_STRINGS2 "diff_strings2.h5" #define UIMAX 4294967295u /*Maximum value for a variable of type unsigned int */ #define STR_SIZE 3 @@ -159,6 +162,7 @@ static void test_comps_array_vlen (const char *fname, const char *dset, const ch static void test_comps_vlen_arry (const char *fname, const char *dset,const char *attr, int diff, int is_file_new); static void test_data_nocomparables (const char *fname, int diff); static void test_objs_nocomparables (const char *fname1, const char *fname2); +static void test_objs_strings (const char *fname, const char *fname2); /* called by test_attributes() and test_datasets() */ static void write_attr_in(hid_t loc_id,const char* dset_name,hid_t fid,int make_diffs); @@ -214,11 +218,11 @@ int main(void) test_special_datasets(FILE19,0); test_special_datasets(FILE20,1); - /* + /* * Generate 2 files: FILE21 with old format; FILE22 with new format - * Create 2 datasets in each file: - * One dataset: chunked layout, w/o filters, fixed dimension - * One dataset: chunked layout, w/ filters, fixed dimension + * Create 2 datasets in each file: + * One dataset: chunked layout, w/o filters, fixed dimension + * One dataset: chunked layout, w/ filters, fixed dimension */ gen_dataset_idx(FILE21, 0); gen_dataset_idx(FILE22, 1); @@ -244,7 +248,7 @@ int main(void) test_enums(ENUM_INVALID_VALUES); /* ------------------------------------------------- - * Create test files with dataset and attribute with container types + * Create test files with dataset and attribute with container types * (array, vlen) with multiple nested compound types. */ /* file1 */ @@ -259,8 +263,8 @@ int main(void) test_comps_vlen_arry(COMPS_COMPLEX2,"dset4", "attr4", 5, 0); /*------------------------------------------------- - * Create test files with non-comparable dataset and attributes with - * comparable datasets and attributes. All the comparables should display + * Create test files with non-comparable dataset and attributes with + * comparable datasets and attributes. All the comparables should display * differences. */ test_data_nocomparables(NON_COMPARBLES1,0); @@ -269,6 +273,9 @@ int main(void) /* common objects (same name) with different object types. HDFFV-7644 */ test_objs_nocomparables(NON_COMPARBLES1, NON_COMPARBLES2); + /* string dataset and attribute. HDFFV-10028 */ + test_objs_strings(DIFF_STRINGS1, DIFF_STRINGS2); + return 0; } @@ -2120,33 +2127,33 @@ out: * Function: gen_dataset_idx * * Purpose: Create a file with either the new or old format -* Create two datasets in the file: -* one dataset: fixed dimension, chunked layout, w/o filters -* one dataset: fixed dimension, chunked layout, w/ filters +* Create two datasets in the file: +* one dataset: fixed dimension, chunked layout, w/o filters +* one dataset: fixed dimension, chunked layout, w/ filters * *------------------------------------------------------------------------- */ static int gen_dataset_idx(const char *file, int format) { - hid_t fid; /* file id */ - hid_t did, did2; /* dataset id */ - hid_t sid; /* space id */ - hid_t fapl; /* file access property id */ - hid_t dcpl; /* dataset creation property id */ - hsize_t dims[1] = {10}; /* dataset dimension */ - hsize_t c_dims[1] = {2}; /* chunk dimension */ - herr_t status; /* return status */ - int buf[10]; /* data buffer */ - int i; /* local index variable */ + hid_t fid; /* file id */ + hid_t did, did2; /* dataset id */ + hid_t sid; /* space id */ + hid_t fapl; /* file access property id */ + hid_t dcpl; /* dataset creation property id */ + hsize_t dims[1] = {10}; /* dataset dimension */ + hsize_t c_dims[1] = {2}; /* chunk dimension */ + herr_t status; /* return status */ + int buf[10]; /* data buffer */ + int i; /* local index variable */ /* Get a copy of the file aaccess property */ fapl = H5Pcreate(H5P_FILE_ACCESS); /* Set the "use the latest format" bounds for creating objects in the file */ if(format) { - status = H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST); - assert(status >= 0); + status = H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST); + assert(status >= 0); } /* Create a file */ @@ -2155,7 +2162,7 @@ int gen_dataset_idx(const char *file, int format) /* Create data */ for(i = 0; i < 10; i++) - buf[i] = i; + buf[i] = i; /* Set chunk */ dcpl = H5Pcreate(H5P_DATASET_CREATE); @@ -2165,7 +2172,7 @@ int gen_dataset_idx(const char *file, int format) /* Create a 1D dataset */ sid = H5Screate_simple(1, dims, NULL); did = H5Dcreate2(fid, "dset", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT); - + /* Write to the dataset */ status = H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf); assert(status >= 0); @@ -4422,8 +4429,8 @@ out: /*------------------------------------------------------------------------- * -* Purpose: -* Create test files with dataset and attribute with container types +* Purpose: +* Create test files with dataset and attribute with container types * (array, vlen) with multiple nested compound types. * * Function: test_comps_array() @@ -4447,7 +4454,7 @@ out: static void test_comps_array (const char *fname, const char *dset, const char *attr,int diff, int is_file_new) { /* sub compound 2 */ - typedef struct { + typedef struct { int i2; float f2; } cmpd2_t; @@ -4469,14 +4476,14 @@ static void test_comps_array (const char *fname, const char *dset, const char *a hid_t tid_attr; hsize_t sdims_dset[] = {SDIM_DSET}; hsize_t sdims_cmpd_arry[] = {SDIM_CMPD_ARRAY}; - int i,j; + int i,j; herr_t ret; /* Generic return value */ /* Initialize array data to write */ for(i=0; i < SDIM_DSET; i++) { wdata[i].i1 = i; - for(j=0; j < SDIM_CMPD_ARRAY; j++) + for(j=0; j < SDIM_CMPD_ARRAY; j++) { wdata[i].cmpd2[j].i2 = i * 10 + diff; wdata[i].cmpd2[j].f2 = (float)i * 10.5F + (float)diff; @@ -4520,7 +4527,7 @@ static void test_comps_array (const char *fname, const char *dset, const char *a /* ------------------- - * Create a dataset + * Create a dataset */ /* Create dataspace for datasets */ sid_dset = H5Screate_simple(1, sdims_dset, NULL); @@ -4562,18 +4569,18 @@ static void test_comps_array (const char *fname, const char *dset, const char *a static void test_comps_vlen (const char * fname, const char *dset, const char *attr, int diff, int is_file_new) { /* sub compound 2 */ - typedef struct { + typedef struct { int i2; float f2; } cmpd2_t; /* top compound 1 */ - typedef struct { + typedef struct { int i1; hvl_t vl; /* VL information for compound2 */ } cmpd1_t; - cmpd1_t wdata[SDIM_DSET]; /* Dataset for compound1 */ + cmpd1_t wdata[SDIM_DSET]; /* Dataset for compound1 */ hid_t fid; /* HDF5 File ID */ hid_t did_dset; /* dataset ID */ @@ -4629,7 +4636,7 @@ static void test_comps_vlen (const char * fname, const char *dset, const char *a assert(ret >= 0); /* ------------------------------- - * Create dataset with compound1 + * Create dataset with compound1 */ /* Create dataspace for dataset */ sid_dset = H5Screate_simple(1, sdims_dset, NULL); @@ -4674,11 +4681,11 @@ static void test_comps_vlen (const char * fname, const char *dset, const char *a static void test_comps_array_vlen (const char * fname, const char *dset,const char *attr, int diff, int is_file_new) { - typedef struct { + typedef struct { int i3; float f3; } cmpd3_t; - + typedef struct { /* Typedef for compound datatype */ int i2; hvl_t vl; /* VL information to write */ @@ -4817,19 +4824,19 @@ static void test_comps_array_vlen (const char * fname, const char *dset,const ch static void test_comps_vlen_arry (const char * fname, const char *dset, const char *attr, int diff, int is_file_new) { /* sub compound 3 */ - typedef struct { + typedef struct { int i3; float f3; } cmpd3_t; /* sub compound 2 */ - typedef struct { + typedef struct { int i2; cmpd3_t cmpd3[SDIM_CMPD_ARRAY]; } cmpd2_t; /* top compound 1 */ - typedef struct { + typedef struct { int i1; hvl_t vl; /* VL information for compound2 */ } cmpd1_t; @@ -4910,7 +4917,7 @@ static void test_comps_vlen_arry (const char * fname, const char *dset, const ch assert(ret >= 0); /* ------------------------------- - * Create dataset with compound1 + * Create dataset with compound1 */ /* Create dataspace for dataset */ sid_dset = H5Screate_simple(1, sdims_dset, NULL); @@ -4960,9 +4967,9 @@ static void test_comps_vlen_arry (const char * fname, const char *dset, const ch /*------------------------------------------------------------------------- * Function: test_data_nocomparables * -* Purpose: -* Create test files with non-comparable dataset and attributes with -* comparable datasets and attributes. All the comparables should display +* Purpose: +* Create test files with non-comparable dataset and attributes with +* comparable datasets and attributes. All the comparables should display * differences. * *-------------------------------------------------------------------------*/ @@ -5020,8 +5027,8 @@ static void test_data_nocomparables (const char * fname, int make_diffs) dset_data_ptr2=(int*)&data2; attr_data_ptr1=(int*)&data2; - /* ----------- - * group2 + /* ----------- + * group2 */ dset_data_ptr3=(int*)&data2; /* dset1/attr1 */ @@ -5143,10 +5150,10 @@ static void test_data_nocomparables (const char * fname, int make_diffs) goto out; } - + out: - + /*----------------------------------------------------------------------- * Close IDs *-----------------------------------------------------------------------*/ @@ -5171,9 +5178,9 @@ out: /*------------------------------------------------------------------------- * Function: test_objs_nocomparables * -* Purpose: +* Purpose: * Create test files with common objects (same name) but different object -* types. +* types. * h5diff should show non-comparable output from these common objects. *-------------------------------------------------------------------------*/ static void test_objs_nocomparables(const char *fname1, const char *fname2) @@ -5317,6 +5324,160 @@ out: } +static hid_t mkstr(int size, H5T_str_t pad) { + hid_t type; + + if((type=H5Tcopy(H5T_C_S1)) < 0) return -1; + if(H5Tset_size(type, (size_t)size) < 0) return -1; + if(H5Tset_strpad(type, pad) < 0) return -1; + + return type; +} + +/*------------------------------------------------------------------------- +* Function: test_objs_strings +* +* Purpose: +* Create test files with common objects (same name) but different string +* types. +* h5diff should show differences output from these common objects. +*-------------------------------------------------------------------------*/ +static void test_objs_strings(const char *fname1, const char *fname2) +{ + herr_t status = SUCCEED; + hid_t fid1=0; + hid_t fid2=0; + hid_t dataset=0; + hid_t space=0; + hid_t f_type=0; + hid_t m_type=0; + hsize_t dims1[] = {3, 4}; + char string1A[12][3] = {"s1","s2","s3","s4","s5","s6","s","s","s9", + "s0","s1","s2"}; + char string1B[12][3] = {"s1","s2","s3","s4","s","s","s7","s8","s9", + "s0","s1","s2"}; + + hsize_t dims2[]={20}; + char string2A[20][10] = {"ab cd ef1", "ab cd ef2", "ab cd ef3", "ab cd ef4", + "ab cd ef5", "ab cd ef6", "ab cd ef7", "ab cd ef8", + "ab cd 9", "ab cd 0", "ab cd 1", "ab cd 2", + "ab cd ef3", "ab cd ef4", "ab cd ef5", "ab cd ef6", + "ab cd ef7", "ab cd ef8", "ab cd ef9", "ab cd ef0"}; + char string2B[20][10] = {"ab cd ef1", "ab cd ef2", "ab cd ef3", "ab cd ef4", + "ab cd ef5", "ab cd ef6", "ab cd ef7", "ab cd ef8", + "ab cd ef9", "ab cd ef0", "ab cd ef1", "ab cd ef2", + "ab cd 3", "ab cd 4", "ab cd 5", "ab cd 6", + "ab cd ef7", "ab cd ef8", "ab cd ef9", "ab cd ef0"}; + + hsize_t dims3[] = {27}; + char string3A[27][6] = {"abcd0", "abcd1", "abcd2", "abcd3", + "abcd4", "abcd5", "abcd6", "abcd7", + "abcd8", "abcd9", "abcd0", "abcd1", + "abd2", "abc3", "bcd4", "acd5", + "abcd6", "abcd7", "abcd8", "abcd9", + "abcd0", "abcd1", "abcd2", "abcd3", + "abc4", "abc5", "abc6"}; + char string3B[27][6] = {"abcd0", "abcd1", "abcd2", "abcd3", + "abcd4", "abcd5", "abcd6", "abcd7", + "abcd8", "abcd9", "abcd0", "abcd1", + "abcd2", "abcd3", "abcd4", "abcd5", + "abd6", "abc7", "bcd8", "acd9", + "abcd0", "abcd1", "abcd2", "abcd3", + "abd4", "abd5", "abd6"}; + + hsize_t dims4[] = {3}; + char string4A[3][21] = { "s1234567890123456789", "s1234567890123456789", + "s12345678901234567"}; + char string4B[3][21] = { "s1234567890123456789", "s12345678901234567", + "s1234567890123456789"}; + + /*----------------------------------------------------------------------- + * Create file(s) + *------------------------------------------------------------------------*/ + /* file1 */ + fid1 = H5Fcreate (fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + if (fid1 < 0) + { + fprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname1); + status = FAIL; + goto out; + } + + /* file2 */ + fid2 = H5Fcreate (fname2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + if (fid2 < 0) + { + fprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname2); + status = FAIL; + goto out; + } + + /* string 1 : nullterm string */ + space = H5Screate_simple(2, dims1, NULL); + f_type = mkstr(5, H5T_STR_NULLTERM); + m_type = mkstr(3, H5T_STR_NULLTERM); + dataset = H5Dcreate2(fid1, "/string1", f_type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + H5Dwrite(dataset, m_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, string1A); + H5Dclose(dataset); + dataset = H5Dcreate2(fid2, "/string1", f_type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + H5Dwrite(dataset, m_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, string1B); + H5Tclose(m_type); + H5Tclose(f_type); + H5Sclose(space); + H5Dclose(dataset); + + /* string 2 : space pad string */ + space = H5Screate_simple(1, dims2, NULL); + f_type = mkstr(11, H5T_STR_SPACEPAD); + m_type = mkstr(10, H5T_STR_NULLTERM); + dataset = H5Dcreate2(fid1, "/string2", f_type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + H5Dwrite(dataset, m_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, string2A); + H5Dclose(dataset); + dataset = H5Dcreate2(fid2, "/string2", f_type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + H5Dwrite(dataset, m_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, string2B); + H5Tclose(m_type); + H5Tclose(f_type); + H5Sclose(space); + H5Dclose(dataset); + + /* string 3 : null pad string */ + space = H5Screate_simple(1, dims3, NULL); + f_type = mkstr(8, H5T_STR_NULLPAD); + m_type = mkstr(6, H5T_STR_NULLTERM); + dataset = H5Dcreate2(fid1, "/string3", f_type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + H5Dwrite(dataset, m_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, string3A); + H5Dclose(dataset); + dataset = H5Dcreate2(fid2, "/string3", f_type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + H5Dwrite(dataset, m_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, string3B); + H5Tclose(m_type); + H5Tclose(f_type); + H5Sclose(space); + H5Dclose(dataset); + + /* string 4 : space pad long string */ + space = H5Screate_simple(1, dims4, NULL); + f_type = mkstr(168, H5T_STR_SPACEPAD); + m_type = mkstr(21, H5T_STR_NULLTERM); + dataset = H5Dcreate2(fid1, "/string4", f_type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + H5Dwrite(dataset, m_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, string4A); + H5Dclose(dataset); + dataset = H5Dcreate2(fid2, "/string4", f_type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + H5Dwrite(dataset, m_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, string4B); + H5Tclose(m_type); + H5Tclose(f_type); + H5Sclose(space); + H5Dclose(dataset); + +out: + /*----------------------------------------------------------------------- + * Close IDs + *-----------------------------------------------------------------------*/ + if(fid1) + H5Fclose(fid1); + if(fid2) + H5Fclose(fid2); +} + /*------------------------------------------------------------------------- * Function: write_attr_in * diff --git a/tools/test/h5diff/testh5diff.sh.in b/tools/test/h5diff/testh5diff.sh.in index d2f1397..1069ed5 100644 --- a/tools/test/h5diff/testh5diff.sh.in +++ b/tools/test/h5diff/testh5diff.sh.in @@ -124,6 +124,8 @@ $SRC_H5DIFF_TESTFILES/tmptest.he5 $SRC_H5DIFF_TESTFILES/tmptest2.he5 $SRC_H5DIFF_TESTFILES/tmpSingleSiteBethe.reference.h5 $SRC_H5DIFF_TESTFILES/tmpSingleSiteBethe.output.h5 +$SRC_H5DIFF_TESTFILES/diff_strings1.h5 +$SRC_H5DIFF_TESTFILES/diff_strings2.h5 " LIST_HDF5_VDS_TEST_FILES=" @@ -282,6 +284,10 @@ $SRC_H5DIFF_TESTFILES/h5diff_517.txt $SRC_H5DIFF_TESTFILES/h5diff_518.txt $SRC_H5DIFF_TESTFILES/h5diff_530.txt $SRC_H5DIFF_TESTFILES/h5diff_540.txt +$SRC_H5DIFF_TESTFILES/h5diff_60.txt +$SRC_H5DIFF_TESTFILES/h5diff_61.txt +$SRC_H5DIFF_TESTFILES/h5diff_62.txt +$SRC_H5DIFF_TESTFILES/h5diff_63.txt $SRC_H5DIFF_TESTFILES/h5diff_600.txt $SRC_H5DIFF_TESTFILES/h5diff_601.txt $SRC_H5DIFF_TESTFILES/h5diff_603.txt @@ -382,6 +388,21 @@ CLEAN_TESTFILES_AND_TESTDIR() INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'` if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then $RM $TESTDIR + else + # files in $LIST_HDF5_VDS_TEST_FILES are copied in from a different + # directory, so when srcdir is the same as destdir and $TESTDIR is + # not deleted, the copy n $TESTDIR of each file from + # $LIST_HDF5_VDS_TEST_FILES will need to be deleted. + for tstfile in $LIST_HDF5_VDS_TEST_FILES + do + # ignore '#' comment + echo $tstfile | tr -d ' ' | grep '^#' > /dev/null + RET=$? + if [ $RET -eq 1 ]; then + fname=`basename $tstfile` + rm $TESTDIR/$fname + fi + done fi } @@ -638,8 +659,6 @@ TOOLTEST h5diff_28.txt -v h5diff_types.h5 h5diff_types.h5 l1 l2 TOOLTEST h5diff_30.txt -v h5diff_enum_invalid_values.h5 h5diff_enum_invalid_values.h5 dset1 dset2 - - # ############################################################################## # # Dataset datatypes # ############################################################################## @@ -675,6 +694,13 @@ TOOLTEST h5diff_58.txt -v h5diff_dset1.h5 h5diff_dset2.h5 refreg # ( HDDFV-7942 ) TOOLTEST h5diff_59.txt -v h5diff_dtypes.h5 h5diff_dtypes.h5 dset11a dset11b +# Strings +# ( HDFFV-10128 ) +TOOLTEST h5diff_60.txt -v diff_strings1.h5 diff_strings2.h5 string1 string1 +TOOLTEST h5diff_61.txt -v diff_strings1.h5 diff_strings2.h5 string2 string2 +TOOLTEST h5diff_62.txt -v diff_strings1.h5 diff_strings2.h5 string3 string3 +TOOLTEST h5diff_63.txt -v diff_strings1.h5 diff_strings2.h5 string4 string4 + # ############################################################################## # # Error messages # ############################################################################## @@ -746,8 +772,6 @@ TOOLTEST h5diff_618.txt -p 2 h5diff_basic1.h5 h5diff_basic2.h5 g1/dset3 g1/dset4 # 6.19: number smaller than smallest difference TOOLTEST h5diff_619.txt -p 0.005 h5diff_basic1.h5 h5diff_basic2.h5 g1/dset3 g1/dset4 - - # ############################################################################## # # -n # ############################################################################## @@ -800,7 +824,6 @@ TOOLTEST h5diff_tmp2.txt tmpSingleSiteBethe.output.h5 tmpSingleSiteBethe.referen # ################################################## # attrs with verbose option level # ################################################## - TOOLTEST h5diff_700.txt -v1 h5diff_attr1.h5 h5diff_attr2.h5 TOOLTEST h5diff_701.txt -v2 h5diff_attr1.h5 h5diff_attr2.h5 TOOLTEST h5diff_702.txt --verbose=1 h5diff_attr1.h5 h5diff_attr2.h5 @@ -851,7 +874,6 @@ TOOLTEST h5diff_103.txt -v --use-system-epsilon h5diff_basic1.h5 h5diff_basic1.h # with --use-system-epsilon for float value TOOLTEST h5diff_104.txt -v --use-system-epsilon h5diff_basic1.h5 h5diff_basic1.h5 g1/fp1 g1/fp2 - # not comparable -c flag TOOLTEST h5diff_200.txt h5diff_basic2.h5 h5diff_basic2.h5 g2/dset1 g2/dset2 @@ -979,7 +1001,6 @@ TOOLTEST h5diff_424.txt --follow-symlinks -v h5diff_ext2softlink_trg.h5 h5diff_e # extlink_to_softlink_to_dset1 vs extlink_to_softlink_to_dset2" TOOLTEST h5diff_425.txt --follow-symlinks -v h5diff_ext2softlink_src.h5 h5diff_ext2softlink_src.h5 /ext_link_to_slink1 /ext_link_to_slink2 - # ############################################################################## # # Dangling links compare (--follow-symlinks and --no-dangling-links) # ############################################################################## @@ -1130,6 +1151,7 @@ TOOLTEST h5diff_540.txt -v compounds_array_vlen1.h5 compounds_array_vlen2.h5 # ############################################################################## # # Test mutually exclusive options # ############################################################################## +# # Test with -d , -p and --use-system-epsilon. TOOLTEST h5diff_640.txt -v -d 5 -p 0.05 --use-system-epsilon h5diff_basic1.h5 h5diff_basic2.h5 /g1/dset3 /g1/dset4 TOOLTEST h5diff_641.txt -v -d 5 -p 0.05 h5diff_basic1.h5 h5diff_basic2.h5 /g1/dset3 /g1/dset4 diff --git a/tools/test/h5dump/CMakeLists.txt b/tools/test/h5dump/CMakeLists.txt index 1398aca..89c7534 100644 --- a/tools/test/h5dump/CMakeLists.txt +++ b/tools/test/h5dump/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 3.1.0) +cmake_minimum_required (VERSION 3.2.2) PROJECT (HDF5_TOOLS_TEST_H5DUMP) #----------------------------------------------------------------------------- @@ -6,6 +6,34 @@ PROJECT (HDF5_TOOLS_TEST_H5DUMP) #----------------------------------------------------------------------------- INCLUDE_DIRECTORIES (${HDF5_TOOLS_DIR}/lib) + #----------------------------------------------------------------------------- + # If plugin library tests can be tested + #----------------------------------------------------------------------------- + set (HDF5_TOOL_PLUGIN_LIB_CORENAME "dynlibdump") + set (HDF5_TOOL_PLUGIN_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_TOOL_PLUGIN_LIB_CORENAME}") + set (HDF5_TOOL_PLUGIN_LIB_TARGET ${HDF5_TOOL_PLUGIN_LIB_CORENAME}) + add_definitions (${HDF_EXTRA_C_FLAGS}) + INCLUDE_DIRECTORIES (${HDF5_SRC_DIR}) + + add_library (${HDF5_TOOL_PLUGIN_LIB_TARGET} SHARED dynlib_dump.c) + TARGET_C_PROPERTIES (${HDF5_TOOL_PLUGIN_LIB_TARGET} SHARED " " " ") + target_link_libraries (${HDF5_TOOL_PLUGIN_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) + H5_SET_LIB_OPTIONS (${HDF5_TOOL_PLUGIN_LIB_TARGET} ${HDF5_TOOL_PLUGIN_LIB_NAME} SHARED ${HDF5_PACKAGE_SOVERSION}) + + # make plugins dir + file (MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/plugins") + #----------------------------------------------------------------------------- + # Copy plugin library to a plugins folder + #----------------------------------------------------------------------------- + add_custom_command ( + TARGET ${HDF5_TOOL_PLUGIN_LIB_TARGET} + POST_BUILD + COMMAND ${CMAKE_COMMAND} + ARGS -E copy_if_different + "$" + "${CMAKE_BINARY_DIR}/plugins/$" + ) + # -------------------------------------------------------------------- # Add the h5dump test executable # -------------------------------------------------------------------- @@ -17,7 +45,7 @@ INCLUDE_DIRECTORIES (${HDF5_TOOLS_DIR}/lib) set_target_properties (h5dumpgentest PROPERTIES FOLDER generator/tools) #add_test (NAME h5dumpgentest COMMAND $) - endif (HDF5_BUILD_GENERATORS) + endif () include (CMakeTests.cmake) diff --git a/tools/test/h5dump/CMakeTests.cmake b/tools/test/h5dump/CMakeTests.cmake index ad3c5ba..ae760bf 100644 --- a/tools/test/h5dump/CMakeTests.cmake +++ b/tools/test/h5dump/CMakeTests.cmake @@ -166,6 +166,7 @@ ${HDF5_TOOLS_DIR}/testfiles/tstring2.ddl ${HDF5_TOOLS_DIR}/testfiles/tstringe.ddl ${HDF5_TOOLS_DIR}/testfiles/tszip.ddl + ${HDF5_TOOLS_DIR}/testfiles/tudfilter.ddl ${HDF5_TOOLS_DIR}/testfiles/tudlink-1.ddl ${HDF5_TOOLS_DIR}/testfiles/tudlink-2.ddl ${HDF5_TOOLS_DIR}/testfiles/tuserfilter.ddl @@ -291,6 +292,7 @@ ${HDF5_TOOLS_DIR}/testfiles/tstr.h5 ${HDF5_TOOLS_DIR}/testfiles/tstr2.h5 ${HDF5_TOOLS_DIR}/testfiles/tstr3.h5 + ${HDF5_TOOLS_DIR}/testfiles/tudfilter.h5 ${HDF5_TOOLS_DIR}/testfiles/tudlink.h5 ${HDF5_TOOLS_DIR}/testfiles/tvldtypes1.h5 ${HDF5_TOOLS_DIR}/testfiles/tvldtypes2.h5 @@ -381,16 +383,16 @@ ############################################################################## ############################################################################## - MACRO (ADD_HELP_TEST testname resultcode) + macro (ADD_HELP_TEST testname resultcode) # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME H5DUMP-${testname} COMMAND $ ${ARGN}) set_tests_properties (H5DUMP-${testname} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") if (NOT "${last_test}" STREQUAL "") set_tests_properties (H5DUMP-${testname} PROPERTIES DEPENDS ${last_test}) - endif (NOT "${last_test}" STREQUAL "") + endif () set (last_test "H5DUMP-${testname}") - else (HDF5_ENABLE_USING_MEMCHECKER) + else () add_test ( NAME H5DUMP-h5dump-${testname} COMMAND "${CMAKE_COMMAND}" @@ -402,34 +404,34 @@ -D "TEST_REFERENCE=h5dump-${testname}.txt" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) - endif (HDF5_ENABLE_USING_MEMCHECKER) - ENDMACRO (ADD_HELP_TEST) + endif () + endmacro () - MACRO (ADD_SKIP_H5_TEST skipresultfile skipresultcode testtype) + macro (ADD_SKIP_H5_TEST skipresultfile skipresultcode testtype) if (${testtype} STREQUAL "SKIP") if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( NAME H5DUMP-${skipresultfile}-SKIPPED COMMAND ${CMAKE_COMMAND} -E echo "SKIP ${skipresultfile} ${ARGN}" ) - endif (NOT HDF5_ENABLE_USING_MEMCHECKER) - else (${testtype} STREQUAL "SKIP") + endif () + else () ADD_H5_TEST (${skipresultfile} ${skipresultcode} ${ARGN}) - endif (${testtype} STREQUAL "SKIP") - ENDMACRO (ADD_SKIP_H5_TEST) + endif () + endmacro () - MACRO (ADD_H5_TEST resultfile resultcode) + macro (ADD_H5_TEST resultfile resultcode) # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME H5DUMP-${resultfile} COMMAND $ ${ARGN}) set_tests_properties (H5DUMP-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") if (NOT ${resultcode} STREQUAL "0") set_tests_properties (H5DUMP-${resultfile} PROPERTIES WILL_FAIL "true") - endif (NOT ${resultcode} STREQUAL "0") + endif () if (NOT "${last_test}" STREQUAL "") set_tests_properties (H5DUMP-${resultfile} PROPERTIES DEPENDS ${last_test}) - endif (NOT "${last_test}" STREQUAL "") - else (HDF5_ENABLE_USING_MEMCHECKER) + endif () + else () add_test ( NAME H5DUMP-${resultfile}-clear-objects COMMAND ${CMAKE_COMMAND} @@ -448,21 +450,21 @@ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) set_tests_properties (H5DUMP-${resultfile} PROPERTIES DEPENDS "H5DUMP-${resultfile}-clear-objects") - endif (HDF5_ENABLE_USING_MEMCHECKER) - ENDMACRO (ADD_H5_TEST file) + endif () + endmacro () - MACRO (ADD_H5_TEST_N resultfile resultcode) + macro (ADD_H5_TEST_N resultfile resultcode) # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME H5DUMP-N-${resultfile} COMMAND $ ${ARGN}) set_tests_properties (H5DUMP-N-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") if (NOT ${resultcode} STREQUAL "0") set_tests_properties (H5DUMP-N-${resultfile} PROPERTIES WILL_FAIL "true") - endif (NOT ${resultcode} STREQUAL "0") + endif () if (NOT "${last_test}" STREQUAL "") set_tests_properties (H5DUMP-N-${resultfile} PROPERTIES DEPENDS ${last_test}) - endif (NOT "${last_test}" STREQUAL "") - else (HDF5_ENABLE_USING_MEMCHECKER) + endif () + else () add_test ( NAME H5DUMP-N-${resultfile}-clear-objects COMMAND ${CMAKE_COMMAND} @@ -481,21 +483,21 @@ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) set_tests_properties (H5DUMP-N-${resultfile} PROPERTIES DEPENDS "H5DUMP-N-${resultfile}-clear-objects") - endif (HDF5_ENABLE_USING_MEMCHECKER) - ENDMACRO (ADD_H5_TEST_N file) + endif () + endmacro () - MACRO (ADD_H5_TEST_EXPORT resultfile targetfile resultcode) + macro (ADD_H5_TEST_EXPORT resultfile targetfile resultcode) # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME H5DUMP-${resultfile} COMMAND $ ${ARGN} ${resultfile}.txt ${targetfile}) set_tests_properties (H5DUMP-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") if (NOT ${resultcode} STREQUAL "0") set_tests_properties (H5DUMP-${resultfile} PROPERTIES WILL_FAIL "true") - endif (NOT ${resultcode} STREQUAL "0") + endif () if (NOT "${last_test}" STREQUAL "") set_tests_properties (H5DUMP-${resultfile} PROPERTIES DEPENDS ${last_test}) - endif (NOT "${last_test}" STREQUAL "") - else (HDF5_ENABLE_USING_MEMCHECKER) + endif () + else () add_test ( NAME H5DUMP-${resultfile}-clear-objects COMMAND ${CMAKE_COMMAND} @@ -521,21 +523,21 @@ ) set_tests_properties (H5DUMP-${resultfile}-output-cmp PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") set_tests_properties (H5DUMP-${resultfile}-output-cmp PROPERTIES DEPENDS H5DUMP-${resultfile}) - endif (HDF5_ENABLE_USING_MEMCHECKER) - ENDMACRO (ADD_H5_TEST_EXPORT file) + endif () + endmacro () - MACRO (ADD_H5_TEST_EXPORT_DDL resultfile targetfile resultcode ddlfile) + macro (ADD_H5_TEST_EXPORT_DDL resultfile targetfile resultcode ddlfile) # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME H5DUMP-${resultfile} COMMAND $ --ddl=${ddlfile}.txt ${ARGN} ${resultfile}.txt ${targetfile}) set_tests_properties (H5DUMP-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") if (NOT ${resultcode} STREQUAL "0") set_tests_properties (H5DUMP-${resultfile} PROPERTIES WILL_FAIL "true") - endif (NOT ${resultcode} STREQUAL "0") + endif () if (NOT "${last_test}" STREQUAL "") set_tests_properties (H5DUMP-${resultfile} PROPERTIES DEPENDS ${last_test}) - endif (NOT "${last_test}" STREQUAL "") - else (HDF5_ENABLE_USING_MEMCHECKER) + endif () + else () add_test ( NAME H5DUMP-${resultfile}-clear-objects COMMAND ${CMAKE_COMMAND} @@ -568,10 +570,10 @@ ) set_tests_properties (H5DUMP-${resultfile}-output-cmp-ddl PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") set_tests_properties (H5DUMP-${resultfile}-output-cmp-ddl PROPERTIES DEPENDS H5DUMP-${resultfile}-output-cmp) - endif (HDF5_ENABLE_USING_MEMCHECKER) - ENDMACRO (ADD_H5_TEST_EXPORT_DDL file) + endif () + endmacro () - MACRO (ADD_H5_EXPORT_TEST resultfile targetfile resultcode) + macro (ADD_H5_EXPORT_TEST resultfile targetfile resultcode) if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( NAME H5DUMP-output-${resultfile}-clear-objects @@ -592,10 +594,10 @@ ) set_tests_properties (H5DUMP-output-cmp-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") set_tests_properties (H5DUMP-output-cmp-${resultfile} PROPERTIES DEPENDS H5DUMP-output-${resultfile}) - endif (NOT HDF5_ENABLE_USING_MEMCHECKER) - ENDMACRO (ADD_H5_EXPORT_TEST file) + endif () + endmacro () - MACRO (ADD_H5_MASK_TEST resultfile resultcode) + macro (ADD_H5_MASK_TEST resultfile resultcode) if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( NAME H5DUMP-${resultfile} @@ -609,10 +611,10 @@ -D "TEST_MASK_ERROR=true" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) - endif (NOT HDF5_ENABLE_USING_MEMCHECKER) - ENDMACRO (ADD_H5_MASK_TEST file) + endif () + endmacro () - MACRO (ADD_H5ERR_MASK_TEST resultfile resultcode) + macro (ADD_H5ERR_MASK_TEST resultfile resultcode) if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( NAME H5DUMP-${resultfile} @@ -627,10 +629,10 @@ -D "TEST_MASK_ERROR=true" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) - endif (NOT HDF5_ENABLE_USING_MEMCHECKER) - ENDMACRO (ADD_H5ERR_MASK_TEST file) + endif () + endmacro () - MACRO (ADD_H5ERR_MASK_ENV_TEST resultfile resultcode envvar envval) + macro (ADD_H5ERR_MASK_ENV_TEST resultfile resultcode envvar envval) if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( NAME H5DUMP-${resultfile} @@ -647,10 +649,10 @@ -D "TEST_ENV_VALUE:STRING=${envval}" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) - endif (NOT HDF5_ENABLE_USING_MEMCHECKER) - ENDMACRO (ADD_H5ERR_MASK_ENV_TEST) + endif () + endmacro () - MACRO (ADD_H5_TEST_IMPORT conffile resultfile testfile resultcode) + macro (ADD_H5_TEST_IMPORT conffile resultfile testfile resultcode) # If using memchecker add tests without using scripts if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( @@ -677,12 +679,39 @@ add_test (NAME H5DUMP-IMPORT-h5diff-${resultfile} COMMAND h5diff ${testfile} ${resultfile}.h5 /integer /integer) set_tests_properties (H5DUMP-IMPORT-h5diff-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") set_tests_properties (H5DUMP-IMPORT-h5diff-${resultfile} PROPERTIES DEPENDS H5DUMP-IMPORT-h5import-${resultfile}) - endif (NOT HDF5_ENABLE_USING_MEMCHECKER) - ENDMACRO (ADD_H5_TEST_IMPORT file) + endif () + endmacro () + + macro (ADD_H5_UD_TEST testname resultcode resultfile) + if (NOT HDF5_ENABLE_USING_MEMCHECKER) + # Remove any output file left over from previous test run + add_test ( + NAME H5DUMP_UD-${testname}-clearall-objects + COMMAND ${CMAKE_COMMAND} + -E remove + testfiles/std/${resultfile}.out + testfiles/std/${resultfile}.out.err + ) + add_test ( + NAME H5DUMP_UD-${testname} + COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$" + -D "TEST_ARGS:STRING=${ARGN}" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles/std" + -D "TEST_OUTPUT=${resultfile}.out" + -D "TEST_EXPECT=${resultcode}" + -D "TEST_REFERENCE=${resultfile}.ddl" + -D "TEST_ENV_VAR=HDF5_PLUGIN_PATH" + -D "TEST_ENV_VALUE=${CMAKE_BINARY_DIR}/plugins" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) + set_tests_properties (H5DUMP_UD-${testname} PROPERTIES DEPENDS H5DUMP_UD-${testname}-clearall-objects) + endif () + endmacro () ############################################################################## ############################################################################## -### T H E T E S T S HDF5_ENABLE_USING_MEMCHECKER ### +### T H E T E S T S ### ############################################################################## ############################################################################## @@ -1038,9 +1067,9 @@ set_tests_properties (H5DUMP-clearall-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") if (NOT "${last_test}" STREQUAL "") set_tests_properties (H5DUMP-clearall-objects PROPERTIES DEPENDS ${last_test}) - endif (NOT "${last_test}" STREQUAL "") + endif () set (last_test "H5DUMP-clearall-objects") - endif (HDF5_ENABLE_USING_MEMCHECKER) + endif () ADD_HELP_TEST(help 0 -h) @@ -1321,11 +1350,11 @@ # detect whether the encoder is present. if (H5_HAVE_FILTER_DEFLATE) set (USE_FILTER_DEFLATE "true") - endif (H5_HAVE_FILTER_DEFLATE) + endif () if (H5_HAVE_FILTER_SZIP) set (USE_FILTER_SZIP "true") - endif (H5_HAVE_FILTER_SZIP) + endif () if (USE_FILTER_DEFLATE) # data read internal filters @@ -1333,8 +1362,8 @@ if (HDF5_ENABLE_SZIP_SUPPORT) # data read all filters ADD_H5_TEST (treadfilter 0 --enable-error-stack -d all -d szip tfilters.h5) - endif (HDF5_ENABLE_SZIP_SUPPORT) - endif (USE_FILTER_DEFLATE) + endif () + endif () # test for displaying objects with very long names ADD_H5_TEST (tlonglinks 0 --enable-error-stack tlonglinks.h5) @@ -1369,14 +1398,14 @@ if (NOT HDF5_ENABLE_USING_MEMCHECKER) ADD_H5_TEST (tbin2 0 --enable-error-stack -b BE -d float -o tbin2.bin tbinary.h5) - endif (NOT HDF5_ENABLE_USING_MEMCHECKER) + endif () # the NATIVE test can be validated with h5import/h5diff ADD_H5_TEST_IMPORT (tbin3 out3D tbinary.h5 0 --enable-error-stack -d integer -b NATIVE) if (NOT HDF5_ENABLE_USING_MEMCHECKER) ADD_H5_TEST (tbin4 0 --enable-error-stack -d double -b FILE -o tbin4.bin tbinary.h5) - endif (NOT HDF5_ENABLE_USING_MEMCHECKER) + endif () # test for dataset region references ADD_H5_TEST (tdatareg 0 --enable-error-stack tdatareg.h5) @@ -1421,3 +1450,8 @@ # test for non-existing file ADD_H5_TEST (non_existing 1 --enable-error-stack tgroup.h5 non_existing.h5) + +############################################################################## +### P L U G I N T E S T S +############################################################################## +ADD_H5_UD_TEST (h5dump_plugin_test 0 tudfilter --enable-error-stack tudfilter.h5) diff --git a/tools/test/h5dump/CMakeTestsPBITS.cmake b/tools/test/h5dump/CMakeTestsPBITS.cmake index c2ec9cc..770531a 100644 --- a/tools/test/h5dump/CMakeTestsPBITS.cmake +++ b/tools/test/h5dump/CMakeTestsPBITS.cmake @@ -88,18 +88,18 @@ foreach (pbits_h5_file ${HDF5_REFERENCE_TEST_PBITS}) get_filename_component(fname "${pbits_h5_file}" NAME) HDFTEST_COPY_FILE("${pbits_h5_file}" "${PROJECT_BINARY_DIR}/testfiles/pbits/${fname}" "h5dump_pbits_files") - endforeach (pbits_h5_file ${HDF5_REFERENCE_TEST_PBITS}) + endforeach () foreach (ddl_pbits ${HDF5_REFERENCE_PBITS}) get_filename_component(fname "${ddl_pbits}" NAME) HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/pbits/${ddl_pbits}" "${PROJECT_BINARY_DIR}/testfiles/pbits/${fname}" "h5dump_pbits_files") - endforeach (ddl_pbits ${HDF5_REFERENCE_PBITS}) + endforeach () foreach (ddl_pbits ${HDF5_ERROR_REFERENCE_PBITS}) get_filename_component(fname "${ddl_pbits}" NAME) HDFTEST_COPY_FILE("${PROJECT_SOURCE_DIR}/errfiles/${ddl_pbits}" "${PROJECT_BINARY_DIR}/testfiles/pbits/${fname}" "h5dump_pbits_files") - endforeach (ddl_pbits ${HDF5_ERROR_REFERENCE_PBITS}) + endforeach () add_custom_target(h5dump_pbits_files ALL COMMENT "Copying files needed by h5dump_pbits tests" DEPENDS ${h5dump_pbits_files_list}) ############################################################################## @@ -108,7 +108,7 @@ ############################################################################## ############################################################################## - MACRO (ADD_H5_PBITS_TEST resultfile resultcode) + macro (ADD_H5_PBITS_TEST resultfile resultcode) # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME H5DUMP-${resultfile} COMMAND $ ${ARGN}) @@ -119,7 +119,7 @@ if (NOT "${last_pbits_test}" STREQUAL "") set_tests_properties (H5DUMP-${resultfile} PROPERTIES DEPENDS ${last_pbits_test}) endif () - else (HDF5_ENABLE_USING_MEMCHECKER) + else () add_test ( NAME H5DUMP-${resultfile} COMMAND "${CMAKE_COMMAND}" @@ -131,8 +131,8 @@ -D "TEST_REFERENCE=${resultfile}.ddl" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) - endif (HDF5_ENABLE_USING_MEMCHECKER) - ENDMACRO (ADD_H5_PBITS_TEST file) + endif () + endmacro () ############################################################################## ############################################################################## @@ -256,9 +256,9 @@ set_tests_properties (H5DUMP_PACKED_BITS-clearall-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/pbits") if (NOT "${last_pbits_test}" STREQUAL "") set_tests_properties (H5DUMP_PACKED_BITS-clearall-objects PROPERTIES DEPENDS ${last_pbits_test}) - endif (NOT "${last_pbits_test}" STREQUAL "") + endif () set (last_pbits_test "H5DUMP_PACKED_BITS-clearall-objects") - endif (HDF5_ENABLE_USING_MEMCHECKER) + endif () # test failure handling # Missing file name diff --git a/tools/test/h5dump/CMakeTestsVDS.cmake b/tools/test/h5dump/CMakeTestsVDS.cmake index aa85350..d155e55 100644 --- a/tools/test/h5dump/CMakeTestsVDS.cmake +++ b/tools/test/h5dump/CMakeTestsVDS.cmake @@ -67,18 +67,18 @@ foreach (vds_h5_file ${HDF5_REFERENCE_TEST_VDS}) get_filename_component(fname "${vds_h5_file}" NAME) HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/vds/${vds_h5_file}" "${PROJECT_BINARY_DIR}/testfiles/vds/${fname}" "h5dump_vds_files") - endforeach (vds_h5_file ${HDF5_REFERENCE_TEST_VDS}) + endforeach () foreach (ddl_vds ${HDF5_REFERENCE_VDS}) get_filename_component(fname "${ddl_vds}" NAME) HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/vds/${ddl_vds}" "${PROJECT_BINARY_DIR}/testfiles/vds/${fname}" "h5dump_vds_files") - endforeach (ddl_vds ${HDF5_REFERENCE_VDS}) + endforeach () foreach (ddl_vds ${HDF5_ERROR_REFERENCE_VDS}) get_filename_component(fname "${ddl_vds}" NAME) HDFTEST_COPY_FILE("${PROJECT_SOURCE_DIR}/errfiles/${ddl_vds}" "${PROJECT_BINARY_DIR}/testfiles/vds/${fname}" "h5dump_vds_files") - endforeach (ddl_vds ${HDF5_ERROR_REFERENCE_VDS}) + endforeach () add_custom_target(h5dump_vds_files ALL COMMENT "Copying files needed by h5dump_vds tests" DEPENDS ${h5dump_vds_files_list}) ############################################################################## @@ -87,7 +87,7 @@ ############################################################################## ############################################################################## - MACRO (ADD_H5_VDS_TEST resultfile resultcode) + macro (ADD_H5_VDS_TEST resultfile resultcode) # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME H5DUMP-${resultfile} COMMAND $ ${ARGN}) @@ -98,7 +98,7 @@ if (NOT "${last_vds_test}" STREQUAL "") set_tests_properties (H5DUMP-${resultfile} PROPERTIES DEPENDS ${last_VDS_test}) endif () - else (HDF5_ENABLE_USING_MEMCHECKER) + else () add_test ( NAME H5DUMP-${resultfile} COMMAND "${CMAKE_COMMAND}" @@ -110,10 +110,10 @@ -D "TEST_REFERENCE=${resultfile}.ddl" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) - endif (HDF5_ENABLE_USING_MEMCHECKER) - ENDMACRO (ADD_H5_VDS_TEST file) + endif () + endmacro () - MACRO (ADD_H5_VDS_LAYOUT resultfile resultcode) + macro (ADD_H5_VDS_LAYOUT resultfile resultcode) # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME H5DUMP-${resultfile} COMMAND $ -p ${ARGN}) @@ -124,7 +124,7 @@ if (NOT "${last_vds_test}" STREQUAL "") set_tests_properties (H5DUMP-${resultfile} PROPERTIES DEPENDS ${last_VDS_test}) endif () - else (HDF5_ENABLE_USING_MEMCHECKER) + else () add_test ( NAME H5DUMP-${resultfile} COMMAND "${CMAKE_COMMAND}" @@ -137,8 +137,8 @@ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) set_tests_properties (H5DUMP-${resultfile} PROPERTIES DEPENDS "H5DUMP-${resultfile}-clear-objects") - endif (HDF5_ENABLE_USING_MEMCHECKER) - ENDMACRO (ADD_H5_VDS_LAYOUT file) + endif () + endmacro () ############################################################################## ############################################################################## @@ -190,9 +190,9 @@ set_tests_properties (H5DUMP_VDS-clearall-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/vds") if (NOT "${last_vds_test}" STREQUAL "") set_tests_properties (H5DUMP_VDS-clearall-objects PROPERTIES DEPENDS ${last_vds_test}) - endif (NOT "${last_vds_test}" STREQUAL "") + endif () set (last_VDS_test "H5DUMP_VDS-clearall-objects") - endif (HDF5_ENABLE_USING_MEMCHECKER) + endif () # See which filters are usable (and skip tests for filters we # don't have). Do this by searching H5pubconf.h to see which @@ -201,11 +201,11 @@ # detect whether the encoder is present. if (H5_HAVE_FILTER_DEFLATE) set (USE_FILTER_DEFLATE "true") - endif (H5_HAVE_FILTER_DEFLATE) + endif () if (H5_HAVE_FILTER_SZIP) set (USE_FILTER_SZIP "true") - endif (H5_HAVE_FILTER_SZIP) + endif () # Data read if (USE_FILTER_DEFLATE) @@ -218,7 +218,7 @@ ADD_H5_VDS_TEST (vds-first 0 --vds-view-first-missing --enable-error-stack vds-percival-unlim-maxmin.h5) ADD_H5_VDS_TEST (vds-gap1 0 -d /VDS-Eiger --vds-gap-size=1 --enable-error-stack vds-eiger.h5) ADD_H5_VDS_TEST (vds-gap2 0 --vds-gap-size=2 --enable-error-stack vds-eiger.h5) - endif (USE_FILTER_DEFLATE) + endif () # Layout read if (USE_FILTER_DEFLATE) @@ -230,4 +230,4 @@ ADD_H5_VDS_LAYOUT (tvds_layout-5 0 --enable-error-stack 5_vds.h5) ADD_H5_VDS_LAYOUT (vds_layout-eiger 0 --enable-error-stack vds-eiger.h5) ADD_H5_VDS_LAYOUT (vds_layout-maxmin 0 --enable-error-stack vds-percival-unlim-maxmin.h5) - endif (USE_FILTER_DEFLATE) + endif () diff --git a/tools/test/h5dump/CMakeTestsXML.cmake b/tools/test/h5dump/CMakeTestsXML.cmake index 79d3ff8..2e55818 100644 --- a/tools/test/h5dump/CMakeTestsXML.cmake +++ b/tools/test/h5dump/CMakeTestsXML.cmake @@ -130,12 +130,12 @@ foreach (tst_xml_h5_file ${HDF5_XML_REFERENCE_TEST_FILES}) get_filename_component(fname "${tst_xml_h5_file}" NAME) HDFTEST_COPY_FILE("${tst_xml_h5_file}" "${PROJECT_BINARY_DIR}/testfiles/xml/${fname}" "h5dump_xml_files") - endforeach (tst_xml_h5_file ${HDF5_XML_REFERENCE_TEST_FILES}) + endforeach () foreach (tst_xml_other_file ${HDF5_XML_REFERENCE_FILES}) get_filename_component(fname "${tst_xml_other_file}" NAME) HDFTEST_COPY_FILE("${tst_xml_other_file}" "${PROJECT_BINARY_DIR}/testfiles/xml/${fname}" "h5dump_xml_files") - endforeach (tst_xml_other_file ${HDF5_XML_REFERENCE_FILES}) + endforeach () add_custom_target(h5dump_xml_files ALL COMMENT "Copying files needed by h5dump_xml tests" DEPENDS ${h5dump_xml_files_list}) ############################################################################## @@ -144,20 +144,20 @@ ############################################################################## ############################################################################## - MACRO (ADD_XML_SKIP_H5_TEST skipresultfile skipresultcode testtype) + macro (ADD_XML_SKIP_H5_TEST skipresultfile skipresultcode testtype) if (${testtype} STREQUAL "SKIP") if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( NAME H5DUMP-XML-${skipresultfile}-SKIPPED COMMAND ${CMAKE_COMMAND} -E echo "SKIP ${skipresultfile}.xml --xml ${ARGN}" ) - endif (NOT HDF5_ENABLE_USING_MEMCHECKER) - else (${testtype} STREQUAL "SKIP") + endif () + else () ADD_XML_H5_TEST (${skipresultfile} ${skipresultcode} ${ARGN}) - endif (${testtype} STREQUAL "SKIP") - ENDMACRO (ADD_XML_SKIP_H5_TEST) + endif () + endmacro () - MACRO (ADD_XML_H5_TEST resultfile resultcode) + macro (ADD_XML_H5_TEST resultfile resultcode) if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME H5DUMP-XML-${resultfile} COMMAND $ --xml ${ARGN}) set_tests_properties (H5DUMP-XML-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/xml") @@ -167,7 +167,7 @@ if (NOT "${last_xml_test}" STREQUAL "") set_tests_properties (H5DUMP-XML-${resultfile} PROPERTIES DEPENDS ${last_xml_test}) endif () - else (HDF5_ENABLE_USING_MEMCHECKER) + else () add_test ( NAME H5DUMP-XML-${resultfile} COMMAND "${CMAKE_COMMAND}" @@ -179,8 +179,8 @@ -D "TEST_REFERENCE=${resultfile}.xml" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) - endif (HDF5_ENABLE_USING_MEMCHECKER) - ENDMACRO (ADD_XML_H5_TEST file) + endif () + endmacro () ############################################################################## ############################################################################## @@ -326,9 +326,9 @@ set_tests_properties (H5DUMP-XML-clearall-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/xml") if (NOT "${last_xml_test}" STREQUAL "") set_tests_properties (H5DUMP-XML-clearall-objects PROPERTIES DEPENDS ${last_xml_test}) - endif (NOT "${last_xml_test}" STREQUAL "") + endif () set (last_test "H5DUMP-XML-clearall-objects") - endif (HDF5_ENABLE_USING_MEMCHECKER) + endif () ########## test XML ADD_XML_H5_TEST (tall.h5 0 tall.h5) diff --git a/tools/test/h5dump/Makefile.am b/tools/test/h5dump/Makefile.am index aed34ec..a3d1df7 100644 --- a/tools/test/h5dump/Makefile.am +++ b/tools/test/h5dump/Makefile.am @@ -30,13 +30,27 @@ TEST_SCRIPT=testh5dump.sh testh5dumppbits.sh testh5dumpvds.sh testh5dumpxml.sh check_PROGRAMS=$(TEST_PROG) binread check_SCRIPTS=$(TEST_SCRIPT) SCRIPT_DEPEND=../../src/h5dump/h5dump$(EXEEXT) +if HAVE_SHARED_CONDITIONAL +if USE_PLUGINS_CONDITIONAL + TEST_SCRIPT += h5dump_plugin.sh +endif +endif # All the programs depend on the hdf5 and h5tools libraries LDADD=$(LIBH5TOOLS) $(LIBHDF5) +if HAVE_SHARED_CONDITIONAL + # Build it as shared library if configure is enabled for shared library. + lib_LTLIBRARIES=libdynlibdump.la + libdynlibdump_la_SOURCES=dynlib_dump.c + +install-exec-hook: + $(RM) $(DESTDIR)$(libdir)/*dynlib* +endif + # Temporary files. *.h5 are generated by h5dumpgentest. They should # copied to the testfiles/ directory if update is required. CHECK_CLEANFILES+=*.h5 *.bin -DISTCLEANFILES=testh5dump.sh testh5dumppbits.sh testh5dumpxml.sh +DISTCLEANFILES=testh5dump.sh testh5dumppbits.sh testh5dumpxml.sh h5dump_plugin.sh include $(top_srcdir)/config/conclude.am diff --git a/tools/test/h5dump/h5dumpgentest.c b/tools/test/h5dump/h5dumpgentest.c index 335eafa..bf9a698 100644 --- a/tools/test/h5dump/h5dumpgentest.c +++ b/tools/test/h5dump/h5dumpgentest.c @@ -114,6 +114,7 @@ #define FILE81 "tints4dims.h5" #define FILE82 "tcompound_complex2.h5" #define FILE83 "tvlenstr_array.h5" +#define FILE84 "tudfilter.h5" /*------------------------------------------------------------------------- * prototypes @@ -153,6 +154,23 @@ const H5Z_class2_t H5Z_MYFILTER[1] = {{ myfilter, /* The actual filter function */ }}; +#define H5Z_FILTER_DYNLIBUD 300 +#define MULTIPLIER 3 + +static size_t H5Z_filter_dynlibud(unsigned int flags, size_t cd_nelmts, + const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf); + +/* This message derives from H5Z */ +const H5Z_class2_t H5Z_DYNLIBUD[1] = {{ + H5Z_CLASS_T_VERS, /* H5Z_class_t version */ + H5Z_FILTER_DYNLIBUD, /* Filter id number */ + 1, 1, /* Encoding and decoding enabled */ + "dynlibud", /* Filter name for debugging */ + NULL, /* The "can apply" callback */ + NULL, /* The "set local" callback */ + (H5Z_func_t)H5Z_filter_dynlibud, /* The actual filter function */ +}}; + /* A UD link traversal function. Shouldn't actually be called. */ static hid_t UD_traverse(H5_ATTR_UNUSED const char * link_name, H5_ATTR_UNUSED hid_t cur_group, @@ -379,9 +397,9 @@ typedef struct s1_t { /* Dataset dimensions */ #define F82_DIM32 32 #define F82_RANK 1 -//#define F82_RANK2 2 -//#define F82_RANK3 3 -//#define F82_RANK4 4 +/* #define F82_RANK2 2 */ +/* #define F82_RANK3 3 */ +/* #define F82_RANK4 4 */ /* "File 83" macros */ /* Name of dataset to create in datafile */ @@ -10286,6 +10304,132 @@ static void gent_vlenstr_array(void) H5Fclose(file); } +/*------------------------------------------------------------------------- + * Function: gent_udfilter + * + * Purpose: Generate a file to be used in testing user defined filter plugin3. + *------------------------------------------------------------------------- + */ +static void gent_udfilter(void) +{ + hid_t fid; /* file id */ + hid_t dcpl; /* dataset creation property list */ + hid_t dsid; /* dataset ID */ + hid_t sid; /* dataspace ID */ + hid_t tid; /* datatype ID */ + + hsize_t dims1[RANK] = {DIM1,DIM2}; + hsize_t chunk_dims[RANK] = {CDIM1,CDIM2}; + int buf1[DIM1][DIM2]; + int i, j, n, ret; + + for(i=n=0; i=0); + + /* create a space */ + sid = H5Screate_simple(SPACE2_RANK, dims1, NULL); + + dcpl = H5Pcreate(H5P_DATASET_CREATE); + HDassert(dcpl>=0); + + ret = H5Pset_layout(dcpl, H5D_CHUNKED); + HDassert(ret >= 0); + + ret = H5Pset_chunk(dcpl, SPACE2_RANK, chunk_dims); + HDassert(ret >= 0); + + ret = H5Zregister (H5Z_DYNLIBUD); + HDassert(ret >= 0); + + ret = H5Pset_filter (dcpl, H5Z_FILTER_DYNLIBUD, H5Z_FLAG_MANDATORY, 0, NULL); + HDassert(ret >= 0); + + /* create the dataset */ + dsid = H5Dcreate2(fid, "dynlibud", H5T_STD_I32LE, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT); + HDassert(dsid >= 0); + + /* write */ + ret = H5Dwrite(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf1); + HDassert(ret >= 0); + + /* close */ + ret = H5Dclose(dsid); + HDassert(ret >= 0); + + /* remove the filters from the dcpl */ + ret = H5Premove_filter(dcpl, H5Z_FILTER_ALL); + HDassert(ret >= 0); + + /*------------------------------------------------------------------------- + * close + *------------------------------------------------------------------------- + */ + ret = H5Sclose(sid); + HDassert(ret >= 0); + + ret = H5Pclose(dcpl); + HDassert(ret >= 0); + + ret = H5Fclose(fid); + HDassert(ret >= 0); +} + +/*------------------------------------------------------------------------- + * Function: H5Z_filter_dynlibud + * + * Purpose: A dynlibud filter method that multiplies the original value + * during write and divide the original value during read. It + * will be built as a shared library. tools tests will load + * and use this filter as a plugin library. + * + * Return: Success: Data chunk size + * + * Failure: 0 + *------------------------------------------------------------------------- + */ +static size_t +H5Z_filter_dynlibud(unsigned int flags, size_t cd_nelmts, + const unsigned int *cd_values, size_t nbytes, + size_t *buf_size, void **buf) +{ + char *int_ptr = (char *)*buf; /* Pointer to the data values */ + size_t buf_left = *buf_size; /* Amount of data buffer left to process */ + + /* Check for the correct number of parameters */ + if(cd_nelmts > 0) + return(0); + + /* Assignment to eliminate unused parameter warning. */ + cd_values = cd_values; + + if(flags & H5Z_FLAG_REVERSE) { /*read*/ + /* Subtract the original value with MULTIPLIER */ + while(buf_left > 0) { + char temp = *int_ptr; + *int_ptr = temp - MULTIPLIER; + int_ptr++; + buf_left -= sizeof(*int_ptr); + } /* end while */ + } /* end if */ + else { /*write*/ + /* Add the original value with MULTIPLIER */ + while(buf_left > 0) { + char temp = *int_ptr; + *int_ptr = temp + MULTIPLIER; + int_ptr++; + buf_left -= sizeof(*int_ptr); + } /* end while */ + } /* end else */ + + return nbytes; +} /* end H5Z_filter_dynlibud() */ /*------------------------------------------------------------------------- * Function: main @@ -10383,6 +10527,8 @@ int main(void) gent_intsfourdims(); + gent_udfilter(); + return 0; } diff --git a/tools/test/h5format_convert/CMakeLists.txt b/tools/test/h5format_convert/CMakeLists.txt index 1d18e9a..7e47b13 100644 --- a/tools/test/h5format_convert/CMakeLists.txt +++ b/tools/test/h5format_convert/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 3.1.0) +cmake_minimum_required (VERSION 3.2.2) PROJECT (HDF5_TOOLS_TEST_H5FC) #----------------------------------------------------------------------------- @@ -23,6 +23,6 @@ INCLUDE_DIRECTORIES (${HDF5_TOOLS_DIR}/lib) set_target_properties (h5fc_gentest PROPERTIES FOLDER generator/tools) #add_test (NAME h5fc_gentest COMMAND $) - endif (HDF5_BUILD_GENERATORS) + endif () include (CMakeTests.cmake) diff --git a/tools/test/h5format_convert/CMakeTests.cmake b/tools/test/h5format_convert/CMakeTests.cmake index 68f9318..4738be5 100644 --- a/tools/test/h5format_convert/CMakeTests.cmake +++ b/tools/test/h5format_convert/CMakeTests.cmake @@ -64,11 +64,11 @@ foreach (ddl_file ${HDF5_REFERENCE_FILES}) HDFTEST_COPY_FILE("${HDF5_TOOLS_TEST_H5FC_SOURCE_DIR}/testfiles/${ddl_file}" "${PROJECT_BINARY_DIR}/testfiles/${ddl_file}" "h5fc_files") - endforeach (ddl_file ${HDF5_REFERENCE_FILES}) + endforeach () foreach (h5_file ${HDF5_REFERENCE_TEST_FILES}) HDFTEST_COPY_FILE("${HDF5_TOOLS_TEST_H5FC_SOURCE_DIR}/testfiles/${h5_file}" "${PROJECT_BINARY_DIR}/testfiles/${h5_file}" "h5fc_files") - endforeach (h5_file ${HDF5_REFERENCE_TEST_FILES}) + endforeach () add_custom_target(h5fc_files ALL COMMENT "Copying files needed by h5fc tests" DEPENDS ${h5fc_files_list}) ############################################################################## @@ -77,7 +77,7 @@ ############################################################################## ############################################################################## - MACRO (ADD_H5_OUTPUT testname resultfile resultcode testfile) + macro (ADD_H5_OUTPUT testname resultfile resultcode testfile) # If using memchecker add tests without using scripts if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( @@ -87,7 +87,7 @@ ) if (NOT "${last_test}" STREQUAL "") set_tests_properties (H5FC-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) - endif (NOT "${last_test}" STREQUAL "") + endif () if (NOT "${testfile}" STREQUAL "") add_test ( NAME H5FC-${testname}-${testfile}-tmpfile @@ -108,7 +108,7 @@ ) set_tests_properties (H5FC-${testname}-${testfile} PROPERTIES DEPENDS "H5FC-${testname}-${testfile}-tmpfile") set (last_test "H5FC-${testname}-${testfile}") - else (NOT "${testfile}" STREQUAL "") + else () add_test ( NAME H5FC-${testname}-NA COMMAND "${CMAKE_COMMAND}" @@ -122,11 +122,11 @@ ) set_tests_properties (H5FC-${testname}-NA PROPERTIES DEPENDS "H5FC-${testname}-clear-objects") set (last_test "H5FC-${testname}-NA") - endif (NOT "${testfile}" STREQUAL "") - endif (NOT HDF5_ENABLE_USING_MEMCHECKER) - ENDMACRO (ADD_H5_OUTPUT) + endif () + endif () + endmacro () - MACRO (ADD_H5_TEST testname resultcode testfile) + macro (ADD_H5_TEST testname resultcode testfile) # If using memchecker add tests without using scripts if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( @@ -136,7 +136,7 @@ ) if (NOT "${last_test}" STREQUAL "") set_tests_properties (H5FC-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) - endif (NOT "${last_test}" STREQUAL "") + endif () add_test ( NAME H5FC-${testname}-tmpfile COMMAND ${CMAKE_COMMAND} @@ -156,10 +156,10 @@ ) set_tests_properties (H5FC-${testname} PROPERTIES DEPENDS "H5FC-${testname}-tmpfile") set (last_test "H5FC-${testname}") - endif (NOT HDF5_ENABLE_USING_MEMCHECKER) - ENDMACRO (ADD_H5_TEST) + endif () + endmacro () - MACRO (ADD_H5_CHECK_IDX dependtest testname) + macro (ADD_H5_CHECK_IDX dependtest testname) # If using memchecker add tests without using scripts if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( @@ -167,10 +167,10 @@ COMMAND "$" "./testfiles/tmp.h5" "${ARGN}" ) set_tests_properties (H5FC_CHECK_IDX-${testname} PROPERTIES DEPENDS "H5FC-${dependtest}") - endif (NOT HDF5_ENABLE_USING_MEMCHECKER) - ENDMACRO (ADD_H5_CHECK_IDX) + endif () + endmacro () - MACRO (ADD_H5_TEST_CHECK_IDX testname resultcode testfile) + macro (ADD_H5_TEST_CHECK_IDX testname resultcode testfile) # If using memchecker add tests without using scripts if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( @@ -180,7 +180,7 @@ ) if (NOT "${last_test}" STREQUAL "") set_tests_properties (H5FC-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) - endif (NOT "${last_test}" STREQUAL "") + endif () add_test ( NAME H5FC-${testname}-tmpfile COMMAND ${CMAKE_COMMAND} @@ -205,10 +205,10 @@ ) set_tests_properties (H5FC_CHECK_IDX-${testname} PROPERTIES DEPENDS "H5FC-${testname}") set (last_test "H5FC_CHECK_IDX-${testname}") - endif (NOT HDF5_ENABLE_USING_MEMCHECKER) - ENDMACRO (ADD_H5_TEST_CHECK_IDX) + endif () + endmacro () - MACRO (ADD_H5_H5DUMP_CHECK testname) + macro (ADD_H5_H5DUMP_CHECK testname) # If using memchecker add tests without using scripts if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( @@ -218,7 +218,7 @@ ) if (NOT "${last_test}" STREQUAL "") set_tests_properties (H5FC-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) - endif (NOT "${last_test}" STREQUAL "") + endif () add_test ( NAME H5FC-${testname}-tmpfile COMMAND ${CMAKE_COMMAND} @@ -250,8 +250,8 @@ ) set_tests_properties (H5FC_CHECK_DUMP-${testname} PROPERTIES DEPENDS "H5FC-${testname}") set (last_test "H5FC_CHECK_DUMP-${testname}") - endif (NOT HDF5_ENABLE_USING_MEMCHECKER) - ENDMACRO (ADD_H5_H5DUMP_CHECK) + endif () + endmacro () ############################################################################## ############################################################################## @@ -324,9 +324,9 @@ ) if (NOT "${last_test}" STREQUAL "") set_tests_properties (H5FC-clearall-objects PROPERTIES DEPENDS ${last_test}) - endif (NOT "${last_test}" STREQUAL "") + endif () set (last_test "H5FC-clearall-objects") - endif (HDF5_ENABLE_USING_MEMCHECKER) + endif () # h5format_convert --help # h5format_convert (no options) diff --git a/tools/test/h5format_convert/h5fc_gentest.c b/tools/test/h5format_convert/h5fc_gentest.c index fea7eed..9ef8e6e 100644 --- a/tools/test/h5format_convert/h5fc_gentest.c +++ b/tools/test/h5format_convert/h5fc_gentest.c @@ -44,8 +44,6 @@ const char *FILENAME[] = { #define GROUP "GROUP" -#define DSET_BT1 "DSET_BT1" -#define DSET_NDATA_BT1 "DSET_NDATA_BT1" #define DSET_COMPACT "DSET_COMPACT" #define DSET_CONTIGUOUS "DSET_CONTIGUOUS" @@ -770,6 +768,7 @@ error: H5Dclose(did2); H5Gclose(gid); H5Fclose(fid); + H5Pclose(fapl); H5Pclose(fcpl); } H5E_END_TRY; diff --git a/tools/test/h5format_convert/testh5fc.sh.in b/tools/test/h5format_convert/testh5fc.sh.in index 5384354..24f04d6 100644 --- a/tools/test/h5format_convert/testh5fc.sh.in +++ b/tools/test/h5format_convert/testh5fc.sh.in @@ -180,6 +180,9 @@ CLEAN_TESTFILES_AND_TESTDIR() $RM $TESTDIR else $RM $TESTDIR/$TMPFILE + $RM $TESTDIR/$TMPOUTFILE + $RM $TESTDIR/$TMPCHKFILE + $RM $TESTDIR/$TMPDMPFILE fi } diff --git a/tools/test/h5import/CMakeLists.txt b/tools/test/h5import/CMakeLists.txt index 22491b4..0d23e5d 100644 --- a/tools/test/h5import/CMakeLists.txt +++ b/tools/test/h5import/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 3.1.0) +cmake_minimum_required (VERSION 3.2.2) PROJECT (HDF5_TOOLS_TEST_H5IMPORT) #----------------------------------------------------------------------------- diff --git a/tools/test/h5import/CMakeTests.cmake b/tools/test/h5import/CMakeTests.cmake index eb0b413..15b36fc 100644 --- a/tools/test/h5import/CMakeTests.cmake +++ b/tools/test/h5import/CMakeTests.cmake @@ -64,15 +64,15 @@ file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") foreach (conf_file ${HDF5_REFERENCE_CONF_FILES}) HDFTEST_COPY_FILE("${HDF5_TOOLS_TEST_H5IMPORT_SOURCE_DIR}/testfiles/${conf_file}" "${PROJECT_BINARY_DIR}/testfiles/${conf_file}" "h5import_files") - endforeach (conf_file ${HDF5_REFERENCE_CONF_FILES}) + endforeach () foreach (txt_file ${HDF5_REFERENCE_TXT_FILES}) HDFTEST_COPY_FILE("${HDF5_TOOLS_TEST_H5IMPORT_SOURCE_DIR}/testfiles/${txt_file}" "${PROJECT_BINARY_DIR}/testfiles/${txt_file}" "h5import_files") - endforeach (txt_file ${HDF5_REFERENCE_TXT_FILES}) + endforeach () foreach (h5_file ${HDF5_REFERENCE_TEST_FILES}) HDFTEST_COPY_FILE("${HDF5_TOOLS_TEST_H5IMPORT_SOURCE_DIR}/testfiles/${h5_file}" "${PROJECT_BINARY_DIR}/testfiles/${h5_file}" "h5import_files") - endforeach (h5_file ${HDF5_REFERENCE_TEST_FILES}) + endforeach () add_custom_target(h5import_files ALL COMMENT "Copying files needed by h5import tests" DEPENDS ${h5import_files_list}) ############################################################################## @@ -80,14 +80,14 @@ ### T H E T E S T S M A C R O S ### ############################################################################## ############################################################################## - MACRO (ADD_H5_TEST testname importfile conffile testfile) + macro (ADD_H5_TEST testname importfile conffile testfile) # If using memchecker skip macro based tests if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME H5IMPORT-${testname} COMMAND $ ${importfile} -c ${conffile} -o ${testfile}) if (NOT "${last_test}" STREQUAL "") set_tests_properties (H5IMPORT-${testname} PROPERTIES DEPENDS H5IMPORT-h5importtest) endif () - else (HDF5_ENABLE_USING_MEMCHECKER) + else () add_test ( NAME H5IMPORT-${testname}-clear-objects COMMAND ${CMAKE_COMMAND} @@ -125,10 +125,10 @@ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) set_tests_properties (H5IMPORT-${testname}-H5DMP_CMP PROPERTIES DEPENDS H5IMPORT-${testname}-H5DMP) - endif (HDF5_ENABLE_USING_MEMCHECKER) - ENDMACRO (ADD_H5_TEST testname importfile conffile testfile) + endif () + endmacro () - MACRO (ADD_H5_DUMPTEST testname datasetname testfile) + macro (ADD_H5_DUMPTEST testname datasetname testfile) # If using memchecker skip tests if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( @@ -152,7 +152,7 @@ -D "TEST_SKIP_COMPARE=TRUE" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) - else ("${ARGN}" STREQUAL "BINARY") + else () add_test ( NAME H5IMPORT-DUMP-${testname}-H5DMP COMMAND "${CMAKE_COMMAND}" @@ -164,7 +164,7 @@ -D "TEST_SKIP_COMPARE=TRUE" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) - endif ("${ARGN}" STREQUAL "BINARY") + endif () set_tests_properties (H5IMPORT-DUMP-${testname}-H5DMP PROPERTIES DEPENDS "H5IMPORT-DUMP-${testname}-clear-objects") add_test ( @@ -193,24 +193,24 @@ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) set_tests_properties (H5IMPORT-DUMP-${testname}-H5DFF PROPERTIES DEPENDS "H5IMPORT-DUMP-${testname}") - endif (NOT HDF5_ENABLE_USING_MEMCHECKER) - ENDMACRO (ADD_H5_DUMPTEST testname datasetname testfile) + endif () + endmacro () - MACRO (ADD_H5_SKIP_DUMPTEST testname datasetname testfile) + macro (ADD_H5_SKIP_DUMPTEST testname datasetname testfile) if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( NAME H5IMPORT-DUMP-${testname}-SKIPPED COMMAND ${CMAKE_COMMAND} -E echo "SKIP ${testname} ${datasetname} ${testfile} --- DEFLATE filter not available" ) - endif (NOT HDF5_ENABLE_USING_MEMCHECKER) - ENDMACRO (ADD_H5_SKIP_DUMPTEST testname datasetname testfile) + endif () + endmacro () # -------------------------------------------------------------------- # Determine if filter is available for h5diff # -------------------------------------------------------------------- if (H5_HAVE_FILTER_DEFLATE) set (USE_FILTER_DEFLATE "true") - endif (H5_HAVE_FILTER_DEFLATE) + endif () ############################################################################## ############################################################################## @@ -377,7 +377,7 @@ dtxtstr.h5.dff.err ) set (last_test "H5IMPORT-clear-objects") - endif (HDF5_ENABLE_USING_MEMCHECKER) + endif () add_test ( NAME H5IMPORT-h5importtest-clear-objects @@ -393,7 +393,7 @@ ) if (NOT "${last_test}" STREQUAL "") set_tests_properties (H5IMPORT-h5importtest-clear-objects PROPERTIES DEPENDS ${last_test}) - endif (NOT "${last_test}" STREQUAL "") + endif () set (last_test "H5IMPORT-clear-objects") add_test (NAME H5IMPORT-h5importtest COMMAND $) @@ -424,17 +424,17 @@ ADD_H5_TEST (BINARY_F64 binfp64.bin testfiles/binfp64.conf binfp64.h5) if (NOT USE_FILTER_DEFLATE) ADD_H5_SKIP_DUMPTEST (BINARY_F64 "/fp/bin/64-bit" binfp64.h5 BINARY) - else (NOT USE_FILTER_DEFLATE) + else () ADD_H5_DUMPTEST (BINARY_F64 "/fp/bin/64-bit" binfp64.h5 BINARY) - endif (NOT USE_FILTER_DEFLATE) + endif () # ----- TESTING "BINARY I8 - rank 3 - Output I16LE + Chunked+Extended+Compressed " ADD_H5_TEST (BINARY_I8 binin8.bin testfiles/binin8.conf binin8.h5) if (NOT USE_FILTER_DEFLATE) ADD_H5_SKIP_DUMPTEST (BINARY_I8 "/int/bin/8-bit" binin8.h5 BINARY) - else (NOT USE_FILTER_DEFLATE) + else () ADD_H5_DUMPTEST (BINARY_I8 "/int/bin/8-bit" binin8.h5 BINARY) - endif (NOT USE_FILTER_DEFLATE) + endif () # ----- TESTING "BINARY I16 - rank 3 - Output order LE + CHUNKED + extended " ADD_H5_TEST (BINARY_I16 binin16.bin testfiles/binin16.conf binin16.h5) diff --git a/tools/test/h5jam/CMakeLists.txt b/tools/test/h5jam/CMakeLists.txt index d3980c4..562b4f3 100644 --- a/tools/test/h5jam/CMakeLists.txt +++ b/tools/test/h5jam/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 3.1.0) +cmake_minimum_required (VERSION 3.2.2) PROJECT (HDF5_TOOLS_TEST_H5JAM) #----------------------------------------------------------------------------- @@ -17,7 +17,7 @@ INCLUDE_DIRECTORIES (${HDF5_TOOLS_DIR}/lib) set_target_properties (h5jamgentest PROPERTIES FOLDER generator/tools) #add_test (NAME h5jamgentest COMMAND $) - endif (HDF5_BUILD_GENERATORS) + endif () add_executable (getub ${HDF5_TOOLS_TEST_H5JAM_SOURCE_DIR}/getub.c) TARGET_NAMING (getub STATIC) diff --git a/tools/test/h5jam/CMakeTests.cmake b/tools/test/h5jam/CMakeTests.cmake index 9ed2015..d0ba305 100644 --- a/tools/test/h5jam/CMakeTests.cmake +++ b/tools/test/h5jam/CMakeTests.cmake @@ -23,11 +23,11 @@ file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") foreach (h5_file ${HDF5_REFERENCE_TEST_FILES}) HDFTEST_COPY_FILE("${HDF5_TOOLS_TEST_H5JAM_SOURCE_DIR}/testfiles/${h5_file}" "${PROJECT_BINARY_DIR}/testfiles/${h5_file}" "h5jam_files") - endforeach (h5_file ${HDF5_REFERENCE_TEST_FILES}) + endforeach () foreach (txt_file ${HDF5_REFERENCE_TXT_FILES}) HDFTEST_COPY_FILE("${HDF5_TOOLS_TEST_H5JAM_SOURCE_DIR}/testfiles/${txt_file}" "${PROJECT_BINARY_DIR}/testfiles/${txt_file}" "h5jam_files") - endforeach (txt_file ${HDF5_REFERENCE_TXT_FILES}) + endforeach () add_custom_target(h5jam_files ALL COMMENT "Copying files needed by h5jam tests" DEPENDS ${h5jam_files_list}) ############################################################################## @@ -40,14 +40,14 @@ # TEST_H5JAM_OUTPUT # For the purpose to verify only output & exitcode from h5jam # - MACRO (TEST_H5JAM_OUTPUT expectfile resultcode) + macro (TEST_H5JAM_OUTPUT expectfile resultcode) # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME H5JAM-${expectfile} COMMAND $ ${ARGN}) if (NOT "${resultcode}" STREQUAL "0") set_tests_properties (H5JAM-${expectfile} PROPERTIES WILL_FAIL "true") - endif (NOT "${resultcode}" STREQUAL "0") - else (HDF5_ENABLE_USING_MEMCHECKER) + endif () + else () add_test ( NAME H5JAM-${expectfile} COMMAND "${CMAKE_COMMAND}" @@ -59,21 +59,21 @@ -D "TEST_REFERENCE=testfiles/${expectfile}.txt" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) - endif (HDF5_ENABLE_USING_MEMCHECKER) - ENDMACRO (TEST_H5JAM_OUTPUT) + endif () + endmacro () # ============================================================ # TEST_H5UNJAM_OUTPUT # For the purpose to verify only output & exitcode from h5unjam # - MACRO (TEST_H5UNJAM_OUTPUT expectfile resultcode) + macro (TEST_H5UNJAM_OUTPUT expectfile resultcode) # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME H5JAM-UNJAM-${expectfile} COMMAND $ ${ARGN}) if (NOT "${resultcode}" STREQUAL "0") set_tests_properties (H5JAM-UNJAM-${expectfile} PROPERTIES WILL_FAIL "true") - endif (NOT "${resultcode}" STREQUAL "0") - else (HDF5_ENABLE_USING_MEMCHECKER) + endif () + else () add_test ( NAME H5JAM-UNJAM-${expectfile} COMMAND "${CMAKE_COMMAND}" @@ -85,10 +85,10 @@ -D "TEST_REFERENCE=testfiles/${expectfile}.txt" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) - endif (HDF5_ENABLE_USING_MEMCHECKER) - ENDMACRO (TEST_H5UNJAM_OUTPUT) + endif () + endmacro () - MACRO (CHECKFILE testname testdepends expected actual) + macro (CHECKFILE testname testdepends expected actual) # If using memchecker add tests without using scripts if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( @@ -117,10 +117,10 @@ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) set_tests_properties (H5JAM-${testname}-CHECKFILE-H5DMP_CMP PROPERTIES DEPENDS H5JAM-${testname}-CHECKFILE-H5DMP) - endif (NOT HDF5_ENABLE_USING_MEMCHECKER) - ENDMACRO(CHECKFILE testname testdepends expected actual) + endif () + endmacro() - MACRO (UNJAMTEST testname setfile infile ufile chkfile outfile) + macro (UNJAMTEST testname setfile infile ufile chkfile outfile) if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( NAME H5JAM-${testname}-UNJAM-SETUP-clear-objects @@ -145,7 +145,7 @@ add_test (NAME H5JAM-${testname}-UNJAM COMMAND $ -i ${infile} -u ${ufile} -o ${outfile}) set_tests_properties (H5JAM-${testname}-UNJAM PROPERTIES DEPENDS H5JAM-${testname}-UNJAM_D-clear-objects) set (compare_test ${ufile}) - else (NOT "${ufile}" STREQUAL "NONE") + else () if (NOT "${ARGN}" STREQUAL "--delete") add_test ( NAME H5JAM-${testname}-UNJAM @@ -160,12 +160,12 @@ ) set_tests_properties (H5JAM-${testname}-UNJAM PROPERTIES DEPENDS H5JAM-${testname}-UNJAM-clear-objects) set (compare_test "${outfile}.ufile.txt") - else (NOT "${ARGN}" STREQUAL "--delete") + else () add_test (NAME H5JAM-${testname}-UNJAM COMMAND $ -i ${infile} -o ${outfile}) set_tests_properties (H5JAM-${testname}-UNJAM PROPERTIES DEPENDS H5JAM-${testname}-UNJAM-clear-objects) set (compare_test "") - endif (NOT "${ARGN}" STREQUAL "--delete") - endif (NOT "${ufile}" STREQUAL "NONE") + endif () + endif () if (NOT "${compare_test}" STREQUAL "") add_test ( NAME H5JAM-${testname}-UNJAM-CHECK_UB_1-clear-objects @@ -190,7 +190,7 @@ -P "${HDF_RESOURCES_DIR}/userblockTest.cmake" ) set_tests_properties (H5JAM-${testname}-UNJAM-CHECK_UB_1 PROPERTIES DEPENDS H5JAM-${testname}-UNJAM-CHECK_UB_1-clear-objects) - endif (NOT "${compare_test}" STREQUAL "") + endif () add_test ( NAME H5JAM-${testname}-UNJAM-CHECK_NOUB @@ -207,21 +207,21 @@ ) if (NOT "${compare_test}" STREQUAL "") set_tests_properties (H5JAM-${testname}-UNJAM-CHECK_NOUB PROPERTIES DEPENDS H5JAM-${testname}-UNJAM-CHECK_UB_1) - else (NOT "${compare_test}" STREQUAL "") + else () set_tests_properties (H5JAM-${testname}-UNJAM-CHECK_NOUB PROPERTIES DEPENDS H5JAM-${testname}-UNJAM) - endif (NOT "${compare_test}" STREQUAL "") + endif () CHECKFILE (${testname} "H5JAM-${testname}-UNJAM-CHECK_NOUB" ${chkfile} ${outfile}) - endif (NOT HDF5_ENABLE_USING_MEMCHECKER) - ENDMACRO(UNJAMTEST testname infile ufile outfile) + endif () + endmacro() - MACRO (JAMTEST testname jamfile infile chkfile outfile) + macro (JAMTEST testname jamfile infile chkfile outfile) if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( NAME H5JAM-${testname}-clear-objects COMMAND ${CMAKE_COMMAND} -E remove ${outfile} ${infile}.cpy.h5 ) - endif (NOT HDF5_ENABLE_USING_MEMCHECKER) + endif () add_test (NAME H5JAM-${testname} COMMAND $ -u testfiles/${jamfile} -i testfiles/${infile} -o ${outfile} ${ARGN}) if (NOT HDF5_ENABLE_USING_MEMCHECKER) set_tests_properties (H5JAM-${testname} PROPERTIES DEPENDS H5JAM-${testname}-clear-objects) @@ -229,7 +229,7 @@ set (compare_orig testfiles/${infile}) if ("${ARGN}" STREQUAL "--clobber") set (compare_orig "") - endif ("${ARGN}" STREQUAL "--clobber") + endif () add_test ( NAME H5JAM-${testname}-CHECK_UB_1-clear-objects @@ -255,10 +255,10 @@ ) set_tests_properties (H5JAM-${testname}-CHECK_UB_1 PROPERTIES DEPENDS H5JAM-${testname}-CHECK_UB_1-clear-objects) CHECKFILE (${testname} "H5JAM-${testname}-CHECK_UB_1" ${chkfile} ${outfile}) - endif (NOT HDF5_ENABLE_USING_MEMCHECKER) - ENDMACRO (JAMTEST testname jamfile infile outfile) + endif () + endmacro () - MACRO (JAMTEST_NONE testname jamfile infile setfile chkfile) + macro (JAMTEST_NONE testname jamfile infile setfile chkfile) if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( NAME H5JAM-${testname}_NONE-clear-objects @@ -284,7 +284,7 @@ set (compare_orig ${chkfile}.cpy.h5) if ("${ARGN}" STREQUAL "--clobber") set (compare_orig "") - endif ("${ARGN}" STREQUAL "--clobber") + endif () add_test ( NAME H5JAM-${testname}_NONE-CHECK_UB_1-clear-objects @@ -310,8 +310,8 @@ ) set_tests_properties (H5JAM-${testname}_NONE-CHECK_UB_1 PROPERTIES DEPENDS H5JAM-${testname}_NONE-CHECK_UB_1-clear-objects) CHECKFILE (${testname} "H5JAM-${testname}_NONE-CHECK_UB_1" ${infile} ${chkfile}) - endif (NOT HDF5_ENABLE_USING_MEMCHECKER) - ENDMACRO (JAMTEST_NONE testname jamfile infile setfile chkfile) + endif () + endmacro () ############################################################################## ############################################################################## diff --git a/tools/test/h5ls/CMakeLists.txt b/tools/test/h5ls/CMakeLists.txt index 48894fb..c21ca92 100644 --- a/tools/test/h5ls/CMakeLists.txt +++ b/tools/test/h5ls/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 3.1.0) +cmake_minimum_required (VERSION 3.2.2) PROJECT (HDF5_TOOLS_TEST_H5LS) #----------------------------------------------------------------------------- @@ -6,6 +6,34 @@ PROJECT (HDF5_TOOLS_TEST_H5LS) #----------------------------------------------------------------------------- INCLUDE_DIRECTORIES (${HDF5_TOOLS_DIR}/lib) + #----------------------------------------------------------------------------- + # If plugin library tests can be tested + #----------------------------------------------------------------------------- + set (HDF5_TOOL_PLUGIN_LIB_CORENAME "dynlibls") + set (HDF5_TOOL_PLUGIN_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_TOOL_PLUGIN_LIB_CORENAME}") + set (HDF5_TOOL_PLUGIN_LIB_TARGET ${HDF5_TOOL_PLUGIN_LIB_CORENAME}) + add_definitions (${HDF_EXTRA_C_FLAGS}) + INCLUDE_DIRECTORIES (${HDF5_SRC_DIR}) + + add_library (${HDF5_TOOL_PLUGIN_LIB_TARGET} SHARED dynlib_ls.c) + TARGET_C_PROPERTIES (${HDF5_TOOL_PLUGIN_LIB_TARGET} SHARED " " " ") + target_link_libraries (${HDF5_TOOL_PLUGIN_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) + H5_SET_LIB_OPTIONS (${HDF5_TOOL_PLUGIN_LIB_TARGET} ${HDF5_TOOL_PLUGIN_LIB_NAME} SHARED ${HDF5_PACKAGE_SOVERSION}) + + # make plugins dir + file (MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/plugins") + #----------------------------------------------------------------------------- + # Copy plugin library to a plugins folder + #----------------------------------------------------------------------------- + add_custom_command ( + TARGET ${HDF5_TOOL_PLUGIN_LIB_TARGET} + POST_BUILD + COMMAND ${CMAKE_COMMAND} + ARGS -E copy_if_different + "$" + "${CMAKE_BINARY_DIR}/plugins/$" + ) + include (CMakeTests.cmake) include (CMakeTestsVDS.cmake) diff --git a/tools/test/h5ls/CMakeTests.cmake b/tools/test/h5ls/CMakeTests.cmake index a66ae40..d5d0eb1 100644 --- a/tools/test/h5ls/CMakeTests.cmake +++ b/tools/test/h5ls/CMakeTests.cmake @@ -29,6 +29,7 @@ ${HDF5_TOOLS_DIR}/testfiles/tslink.h5 ${HDF5_TOOLS_DIR}/testfiles/tsoftlinks.h5 ${HDF5_TOOLS_DIR}/testfiles/tstr.h5 + ${HDF5_TOOLS_DIR}/testfiles/tudfilter.h5 ${HDF5_TOOLS_DIR}/testfiles/tudlink.h5 ${HDF5_TOOLS_DIR}/testfiles/tvldtypes1.h5 ${HDF5_TOOLS_DIR}/testfiles/tdset_idx.h5 @@ -87,6 +88,7 @@ ${HDF5_TOOLS_DIR}/testfiles/tsaf.ls ${HDF5_TOOLS_DIR}/testfiles/tslink-1.ls ${HDF5_TOOLS_DIR}/testfiles/tstr-1.ls + ${HDF5_TOOLS_DIR}/testfiles/tudfilter.ls ${HDF5_TOOLS_DIR}/testfiles/tudlink-1.ls ${HDF5_TOOLS_DIR}/testfiles/tvldtypes1.ls ${HDF5_TOOLS_DIR}/testfiles/tvldtypes2le.ls @@ -100,7 +102,7 @@ foreach (listfiles ${LIST_HDF5_TEST_FILES} ${LIST_OTHER_TEST_FILES}) get_filename_component(fname "${listfiles}" NAME) HDFTEST_COPY_FILE("${listfiles}" "${PROJECT_BINARY_DIR}/testfiles/${fname}" "h5ls_files") - endforeach (listfiles ${LIST_HDF5_TEST_FILES} ${LIST_OTHER_TEST_FILES}) + endforeach () add_custom_target(h5ls_files ALL COMMENT "Copying files needed by h5ls tests" DEPENDS ${h5ls_files_list}) ############################################################################## @@ -109,7 +111,7 @@ ############################################################################## ############################################################################## - MACRO (ADD_H5_TEST resultfile resultcode) + macro (ADD_H5_TEST resultfile resultcode) # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME H5LS-${resultfile} COMMAND $ ${ARGN}) @@ -120,7 +122,7 @@ if (NOT "${last_test}" STREQUAL "") set_tests_properties (H5LS-${resultfile} PROPERTIES DEPENDS ${last_test}) endif () - else (HDF5_ENABLE_USING_MEMCHECKER) + else () add_test ( NAME H5LS-${resultfile} COMMAND "${CMAKE_COMMAND}" @@ -132,8 +134,35 @@ -D "TEST_REFERENCE=${resultfile}.ls" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) - endif (HDF5_ENABLE_USING_MEMCHECKER) - ENDMACRO (ADD_H5_TEST file) + endif () + endmacro () + + macro (ADD_H5_UD_TEST testname resultcode resultfile) + if (NOT HDF5_ENABLE_USING_MEMCHECKER) + # Remove any output file left over from previous test run + add_test ( + NAME H5LS_UD-${testname}-clearall-objects + COMMAND ${CMAKE_COMMAND} + -E remove + testfiles/${resultfile}.out + testfiles/${resultfile}.out.err + ) + add_test ( + NAME H5LS_UD-${testname} + COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$" + -D "TEST_ARGS=${ARGN}" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" + -D "TEST_OUTPUT=${resultfile}.out" + -D "TEST_EXPECT=${resultcode}" + -D "TEST_REFERENCE=${resultfile}.ls" + -D "TEST_ENV_VAR=HDF5_PLUGIN_PATH" + -D "TEST_ENV_VALUE=${CMAKE_BINARY_DIR}/plugins" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) + set_tests_properties (H5LS_UD-${testname} PROPERTIES DEPENDS H5LS_UD-${testname}-clearall-objects) + endif () + endmacro () ############################################################################## ############################################################################## @@ -257,9 +286,9 @@ set_tests_properties (H5LS-clearall-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") if (NOT "${last_test}" STREQUAL "") set_tests_properties (H5LS-clearall-objects PROPERTIES DEPENDS ${last_test}) - endif (NOT "${last_test}" STREQUAL "") + endif () set (last_test "H5LS-clearall-objects") - endif (HDF5_ENABLE_USING_MEMCHECKER) + endif () # See which filters are usable (and skip tests for filters we # don't have). Do this by searching H5pubconf.h to see which @@ -268,11 +297,11 @@ # detect whether the encoder is present. if (H5_HAVE_FILTER_DEFLATE) set (USE_FILTER_DEFLATE "true") - endif (H5_HAVE_FILTER_DEFLATE) + endif () if (H5_HAVE_FILTER_SZIP) set (USE_FILTER_SZIP "true") - endif (H5_HAVE_FILTER_SZIP) + endif () # test the help syntax ADD_H5_TEST (help-1 0 -w80 -h) @@ -383,9 +412,9 @@ # ( HDFFV-7838, ) if (H5_WORDS_BIGENDIAN) ADD_H5_TEST (tattrreg_be 0 -w80 -v -d tattrreg.h5) - else (H5_WORDS_BIGENDIAN) + else () ADD_H5_TEST (tattrreg_le 0 -w80 -v -d tattrreg.h5) - endif (H5_WORDS_BIGENDIAN) + endif () # test for non-existing file ADD_H5_TEST (nosuchfile 1 nosuchfile.h5) @@ -393,20 +422,25 @@ # test for variable length data types in verbose mode if (H5_WORDS_BIGENDIAN) ADD_H5_TEST (tvldtypes2be 0 -v tvldtypes1.h5) - else (H5_WORDS_BIGENDIAN) + else () ADD_H5_TEST (tvldtypes2le 0 -v tvldtypes1.h5) - endif (H5_WORDS_BIGENDIAN) + endif () # test for dataset region references data types in verbose mode if (H5_WORDS_BIGENDIAN) ADD_H5_TEST (tdataregbe 0 -v tdatareg.h5) - else (H5_WORDS_BIGENDIAN) + else () ADD_H5_TEST (tdataregle 0 -v tdatareg.h5) - endif (H5_WORDS_BIGENDIAN) + endif () # test for file with datasets that use Fixed Array chunk indices if (USE_FILTER_DEFLATE) # data read internal filters ADD_H5_TEST (tdset_idx 0 -w80 -d tdset_idx.h5) - endif (USE_FILTER_DEFLATE) + endif () + +############################################################################## +### P L U G I N T E S T S +############################################################################## +ADD_H5_UD_TEST (h5ls_plugin_test 0 tudfilter -w80 -d tudfilter.h5) diff --git a/tools/test/h5ls/CMakeTestsVDS.cmake b/tools/test/h5ls/CMakeTestsVDS.cmake index 72e14a1..0a7a216 100644 --- a/tools/test/h5ls/CMakeTestsVDS.cmake +++ b/tools/test/h5ls/CMakeTestsVDS.cmake @@ -49,7 +49,7 @@ foreach (listfiles ${LIST_HDF5_TEST_FILES} ${LIST_OTHER_TEST_FILES}) get_filename_component(fname "${listfiles}" NAME) HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/vds/${listfiles}" "${PROJECT_BINARY_DIR}/testfiles/vds/${fname}" "h5ls_vds_files") - endforeach (listfiles ${LIST_HDF5_TEST_FILES} ${LIST_OTHER_TEST_FILES}) + endforeach () add_custom_target(h5ls_vds_files ALL COMMENT "Copying files needed by h5ls_vds tests" DEPENDS ${h5ls_vds_files_list}) ############################################################################## @@ -58,7 +58,7 @@ ############################################################################## ############################################################################## - MACRO (ADD_H5_VDS_TEST resultfile resultcode) + macro (ADD_H5_VDS_TEST resultfile resultcode) # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME H5LS-${resultfile} COMMAND $ ${ARGN}) @@ -69,7 +69,7 @@ if (NOT "${last_test}" STREQUAL "") set_tests_properties (H5LS-${resultfile} PROPERTIES DEPENDS ${last_test}) endif () - else (HDF5_ENABLE_USING_MEMCHECKER) + else () add_test ( NAME H5LS-${resultfile} COMMAND "${CMAKE_COMMAND}" @@ -81,8 +81,8 @@ -D "TEST_REFERENCE=${resultfile}.ls" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) - endif (HDF5_ENABLE_USING_MEMCHECKER) - ENDMACRO (ADD_H5_VDS_TEST file) + endif () + endmacro () ############################################################################## ############################################################################## @@ -124,9 +124,9 @@ set_tests_properties (H5LS_VDS-clearall-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/vds") if (NOT "${last_test}" STREQUAL "") set_tests_properties (H5LS_VDS-clearall-objects PROPERTIES DEPENDS ${last_test}) - endif (NOT "${last_test}" STREQUAL "") + endif () set (last_test "H5LS_VDS-clearall-objects") - endif (HDF5_ENABLE_USING_MEMCHECKER) + endif () ADD_H5_VDS_TEST (tvds-1 0 -w80 -v -S 1_vds.h5) ADD_H5_VDS_TEST (tvds-2 0 -w80 -v -S 2_vds.h5) diff --git a/tools/test/h5ls/Makefile.am b/tools/test/h5ls/Makefile.am index 6f3d3dd..170aa63 100644 --- a/tools/test/h5ls/Makefile.am +++ b/tools/test/h5ls/Makefile.am @@ -27,8 +27,24 @@ AM_CPPFLAGS+=-I$(top_srcdir)/src -I$(top_srcdir)/tools/lib TEST_SCRIPT=testh5ls.sh testh5lsvds.sh check_SCRIPTS=$(TEST_SCRIPT) SCRIPT_DEPEND=../../src/h5ls/h5ls$(EXEEXT) +if HAVE_SHARED_CONDITIONAL +if USE_PLUGINS_CONDITIONAL + TEST_SCRIPT += h5ls_plugin.sh +endif +endif # All programs depend on the hdf5 and h5tools libraries LDADD=$(LIBH5TOOLS) $(LIBHDF5) +if HAVE_SHARED_CONDITIONAL + # Build it as shared library if configure is enabled for shared library. + lib_LTLIBRARIES=libdynlibls.la + libdynlibls_la_SOURCES=dynlib_ls.c + +install-exec-hook: + $(RM) $(DESTDIR)$(libdir)/*dynlib* +endif + +DISTCLEANFILES=h5ls_plugin.sh + include $(top_srcdir)/config/conclude.am diff --git a/tools/test/h5ls/testh5ls.sh.in b/tools/test/h5ls/testh5ls.sh.in index 15282f6..1b3f67d 100644 --- a/tools/test/h5ls/testh5ls.sh.in +++ b/tools/test/h5ls/testh5ls.sh.in @@ -183,7 +183,7 @@ COPY_TESTFILES_TO_TESTDIR() INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'` if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then - $CP -f $tstfile $TESTDIR + $CP -f $tstfile $TESTDIR if [ $? -ne 0 ]; then echo "Error: FAILED to copy $tstfile ." @@ -241,7 +241,7 @@ TOOLTEST() { # any unexpected output from that stream too. TESTING $H5LS $@ ( - cd $TESTDIR + cd $TESTDIR $RUNSERIAL $H5LS_BIN "$@" ) >$actual 2>$actual_err @@ -253,37 +253,37 @@ TOOLTEST() { STDERR_FILTER $actual_err cat $actual_err >> $actual if [ $h5haveexitcode = 'yes' -a $exitcode -ne $retvalexpect ]; then - echo "*FAILED*" - nerrors="`expr $nerrors + 1`" - if [ yes = "$verbose" ]; then - echo "test returned with exit code $exitcode" - echo "test output: (up to $NLINES lines)" - head -$NLINES $actual - echo "***end of test output***" - echo "" - fi + echo "*FAILED*" + nerrors="`expr $nerrors + 1`" + if [ yes = "$verbose" ]; then + echo "test returned with exit code $exitcode" + echo "test output: (up to $NLINES lines)" + head -$NLINES $actual + echo "***end of test output***" + echo "" + fi elif [ ! -f $expect ]; then - # Create the expect file if it doesn't yet exist. + # Create the expect file if it doesn't yet exist. echo " CREATED" cp $actual $expect elif $CMP $expect $actual; then echo " PASSED" else echo "*FAILED*" - echo " Expected result differs from actual result" - nerrors="`expr $nerrors + 1`" - test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/ /' + echo " Expected result differs from actual result" + nerrors="`expr $nerrors + 1`" + test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/ /' fi # Clean up output file if test -z "$HDF5_NOCLEANUP"; then - rm -f $actual $actual_err $actual_sav $actual_err_sav + rm -f $actual $actual_err $actual_sav $actual_err_sav fi } ############################################################################## ############################################################################## -### T H E T E S T S ### +### T H E T E S T S ### ############################################################################## ############################################################################## # prepare for test @@ -427,9 +427,9 @@ fi if test $USE_FILTER_DEFLATE = "yes" ; then # data read internal filters TOOLTEST tdset_idx.ls 0 -w80 -d tdset_idx.h5 +else + echo "***skip testing tdset_idx.h5" fi -echo "***skip testing tdset_idx.h5" -TOOLTEST tdset_idx.ls 0 -w80 -d tdset_idx.h5 # Clean up temporary files/directories CLEAN_TESTFILES_AND_TESTDIR diff --git a/tools/test/h5repack/CMakeLists.txt b/tools/test/h5repack/CMakeLists.txt index cecec53..9d67ec3 100644 --- a/tools/test/h5repack/CMakeLists.txt +++ b/tools/test/h5repack/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 3.1.0) +cmake_minimum_required (VERSION 3.2.2) PROJECT (HDF5_TOOLS_TEST_H5REPACK) #----------------------------------------------------------------------------- diff --git a/tools/test/h5repack/CMakeTests.cmake b/tools/test/h5repack/CMakeTests.cmake index 576fb58..aa5a1b4 100644 --- a/tools/test/h5repack/CMakeTests.cmake +++ b/tools/test/h5repack/CMakeTests.cmake @@ -17,9 +17,9 @@ if (DIRECT_VFD) set (VFD_LIST ${VFD_LIST} direct) - endif (DIRECT_VFD) + endif () - MACRO (ADD_VFD_TEST vfdname resultcode) + macro (ADD_VFD_TEST vfdname resultcode) add_test ( NAME H5REPACK-VFD-${vfdname}-h5repacktest COMMAND "${CMAKE_COMMAND}" @@ -33,10 +33,10 @@ ) if (NOT "${last_test}" STREQUAL "") set_tests_properties (H5REPACK-VFD-${vfdname}-h5repacktest PROPERTIES DEPENDS ${last_test}) - endif (NOT "${last_test}" STREQUAL "") + endif () set (last_test "H5REPACK-VFD-${vfdname}-h5repacktest") - ENDMACRO (ADD_VFD_TEST) - endif (HDF5_TEST_VFD) + endmacro () + endif () # -------------------------------------------------------------------- # Copy all the HDF5 files from the source directory into the test directory @@ -131,7 +131,7 @@ foreach (h5_file ${LIST_HDF5_TEST_FILES} ${LIST_OTHER_TEST_FILES}) get_filename_component(fname "${h5_file}" NAME) HDFTEST_COPY_FILE("${h5_file}" "${PROJECT_BINARY_DIR}/testfiles/${fname}" "h5repack_files") - endforeach (h5_file ${LIST_HDF5_TEST_FILES} ${LIST_OTHER_TEST_FILES}) + endforeach () add_custom_target(h5repack_files ALL COMMENT "Copying files needed by h5repack tests" DEPENDS ${h5repack_files_list}) ############################################################################## @@ -140,7 +140,7 @@ ############################################################################## ############################################################################## - MACRO (ADD_HELP_TEST testname resultcode) + macro (ADD_HELP_TEST testname resultcode) # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME H5REPACK-${testname} COMMAND $ ${ARGN}) @@ -149,7 +149,7 @@ set_tests_properties (H5REPACK-${testname} PROPERTIES DEPENDS ${last_test}) endif () set (last_test "H5REPACK-${testname}") - else (HDF5_ENABLE_USING_MEMCHECKER) + else () add_test ( NAME H5REPACK-h5repack-${testname} COMMAND "${CMAKE_COMMAND}" @@ -161,18 +161,18 @@ -D "TEST_REFERENCE=h5repack-${testname}.txt" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) - endif (HDF5_ENABLE_USING_MEMCHECKER) - ENDMACRO (ADD_HELP_TEST) + endif () + endmacro () - MACRO (ADD_H5_TEST_OLD testname testtype testfile) + macro (ADD_H5_TEST_OLD testname testtype testfile) if ("${testtype}" STREQUAL "SKIP") if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( NAME H5REPACK_OLD-${testname}-SKIPPED COMMAND ${CMAKE_COMMAND} -E echo "SKIP ${ARGN} -i ${PROJECT_BINARY_DIR}/testfiles/${testfile} -o ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile}" ) - endif (NOT HDF5_ENABLE_USING_MEMCHECKER) - else ("${testtype}" STREQUAL "SKIP") + endif () + else () add_test ( NAME H5REPACK_OLD-${testname} COMMAND $ ${ARGN} -i ${PROJECT_BINARY_DIR}/testfiles/${testfile} -o ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} @@ -185,18 +185,18 @@ COMMAND $ ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} ) set_tests_properties (H5REPACK_OLD-${testname}_DFF PROPERTIES DEPENDS H5REPACK_OLD-${testname}) - endif ("${testtype}" STREQUAL "SKIP") - ENDMACRO (ADD_H5_TEST_OLD) + endif () + endmacro () - MACRO (ADD_H5_TEST testname testtype testfile) + macro (ADD_H5_TEST testname testtype testfile) if ("${testtype}" STREQUAL "SKIP") if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( NAME H5REPACK-${testname}-SKIPPED COMMAND ${CMAKE_COMMAND} -E echo "SKIP ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile}" ) - endif (NOT HDF5_ENABLE_USING_MEMCHECKER) - else ("${testtype}" STREQUAL "SKIP") + endif () + else () add_test ( NAME H5REPACK-${testname} COMMAND $ ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} @@ -209,24 +209,24 @@ COMMAND $ ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} ) set_tests_properties (H5REPACK-${testname}_DFF PROPERTIES DEPENDS H5REPACK-${testname}) - endif ("${testtype}" STREQUAL "SKIP") - ENDMACRO (ADD_H5_TEST) + endif () + endmacro () - MACRO (ADD_H5_CMP_TEST testname testfilter testtype resultcode resultfile) + macro (ADD_H5_CMP_TEST testname testfilter testtype resultcode resultfile) if ("${testtype}" STREQUAL "SKIP") if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( NAME H5REPACK_CMP-${testname}-SKIPPED COMMAND ${CMAKE_COMMAND} -E echo "SKIP ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${resultfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${resultfile}" ) - endif (NOT HDF5_ENABLE_USING_MEMCHECKER) - else ("${testtype}" STREQUAL "SKIP") + endif () + else () # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) add_test ( NAME H5REPACK_CMP-${testname} COMMAND $ ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${resultfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${resultfile}) - else (HDF5_ENABLE_USING_MEMCHECKER) + else () add_test ( NAME H5REPACK_CMP-${testname} COMMAND "${CMAKE_COMMAND}" @@ -239,22 +239,22 @@ -D "TEST_REFERENCE=${resultfile}-${testname}.tst" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) - endif (HDF5_ENABLE_USING_MEMCHECKER) + endif () if (NOT "${last_test}" STREQUAL "") set_tests_properties (H5REPACK_CMP-${testname} PROPERTIES DEPENDS ${last_test}) endif () - endif ("${testtype}" STREQUAL "SKIP") - ENDMACRO (ADD_H5_CMP_TEST) + endif () + endmacro () - MACRO (ADD_H5_MASK_TEST testname testtype resultcode resultfile) + macro (ADD_H5_MASK_TEST testname testtype resultcode resultfile) if ("${testtype}" STREQUAL "SKIP") if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( NAME H5REPACK_MASK-${testname}-SKIPPED COMMAND ${CMAKE_COMMAND} -E echo "SKIP ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${resultfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${resultfile}" ) - endif (NOT HDF5_ENABLE_USING_MEMCHECKER) - else ("${testtype}" STREQUAL "SKIP") + endif () + else () # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) add_test ( @@ -273,22 +273,22 @@ -D "TEST_REFERENCE=${resultfile}-${testname}.tst" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) - endif (HDF5_ENABLE_USING_MEMCHECKER) + endif () if (NOT "${last_test}" STREQUAL "") set_tests_properties (H5REPACK_MASK-${testname} PROPERTIES DEPENDS ${last_test}) endif () - endif ("${testtype}" STREQUAL "SKIP") - ENDMACRO (ADD_H5_MASK_TEST) + endif () + endmacro () - MACRO (ADD_H5_DMP_TEST testname testtype resultcode resultfile) + macro (ADD_H5_DMP_TEST testname testtype resultcode resultfile) if ("${testtype}" STREQUAL "SKIP") if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( NAME H5REPACK_DMP-${testname}-SKIPPED COMMAND ${CMAKE_COMMAND} -E echo "SKIP ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${resultfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${resultfile}" ) - endif (NOT HDF5_ENABLE_USING_MEMCHECKER) - else ("${testtype}" STREQUAL "SKIP") + endif () + else () # If using memchecker add tests without using scripts add_test ( NAME H5REPACK_DMP-${testname} @@ -309,19 +309,19 @@ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) set_tests_properties (H5REPACK_DMP-h5dump-${testname} PROPERTIES DEPENDS "H5REPACK_DMP-${testname}") - endif (NOT HDF5_ENABLE_USING_MEMCHECKER) - endif ("${testtype}" STREQUAL "SKIP") - ENDMACRO (ADD_H5_DMP_TEST) + endif () + endif () + endmacro () - MACRO (ADD_H5_VERIFY_TEST testname testtype resultcode testfile testdset testfilter) + macro (ADD_H5_VERIFY_TEST testname testtype resultcode testfile testdset testfilter) if ("${testtype}" STREQUAL "SKIP") if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( NAME H5REPACK_VERIFY_LAYOUT-${testname}-SKIPPED COMMAND ${CMAKE_COMMAND} -E echo "SKIP -d ${testdset} -pH ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${resultfile}" ) - endif (NOT HDF5_ENABLE_USING_MEMCHECKER) - else ("${testtype}" STREQUAL "SKIP") + endif () + else () if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( NAME H5REPACK_VERIFY_LAYOUT-${testname} @@ -349,7 +349,7 @@ -P "${HDF_RESOURCES_EXT_DIR}/grepTest.cmake" ) set_tests_properties (H5REPACK_VERIFY_LAYOUT-${testname}_DMP PROPERTIES DEPENDS H5REPACK_VERIFY_LAYOUT-${testname}_DFF) - else ("${resultcode}" STREQUAL "0") + else () if ("${testfilter}" STREQUAL "CHUNKED") set (nottestfilter "(CONTIGUOUS|COMPACT)") endif () @@ -372,20 +372,20 @@ -P "${HDF_RESOURCES_EXT_DIR}/grepTest.cmake" ) set_tests_properties (H5REPACK_VERIFY_LAYOUT-${testname}_DMP PROPERTIES DEPENDS H5REPACK_VERIFY_LAYOUT-${testname}_DFF) - endif ("${resultcode}" STREQUAL "0") - endif (NOT HDF5_ENABLE_USING_MEMCHECKER) - endif ("${testtype}" STREQUAL "SKIP") - ENDMACRO (ADD_H5_VERIFY_TEST) + endif () + endif () + endif () + endmacro () - MACRO (ADD_H5_VERIFY_VDS testname testtype resultcode testfile testdset testfilter) + macro (ADD_H5_VERIFY_VDS testname testtype resultcode testfile testdset testfilter) if ("${testtype}" STREQUAL "SKIP") if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( NAME H5REPACK_VERIFY_LAYOUT_VDS-${testname}-SKIPPED COMMAND ${CMAKE_COMMAND} -E echo "SKIP -d ${testdset} -pH ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${resultfile}" ) - endif (NOT HDF5_ENABLE_USING_MEMCHECKER) - else ("${testtype}" STREQUAL "SKIP") + endif () + else () if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( NAME H5REPACK_VERIFY_LAYOUT_VDS-${testname} @@ -408,11 +408,11 @@ ) set_tests_properties (H5REPACK_VERIFY_LAYOUT_VDS-${testname}_DMP PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") set_tests_properties (H5REPACK_VERIFY_LAYOUT_VDS-${testname}_DMP PROPERTIES DEPENDS H5REPACK_VERIFY_LAYOUT_VDS-${testname}) - endif (NOT HDF5_ENABLE_USING_MEMCHECKER) - endif ("${testtype}" STREQUAL "SKIP") - ENDMACRO (ADD_H5_VERIFY_VDS) + endif () + endif () + endmacro () - MACRO (ADD_H5_TEST_META testname testfile) + macro (ADD_H5_TEST_META testname testfile) add_test ( NAME H5REPACK_META-${testname}_N COMMAND $ ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}_N.${testname}.h5 @@ -429,9 +429,9 @@ add_test (NAME H5REPACK_META-${testname} COMMAND ${CMAKE_COMMAND} -E compare_files ${PROJECT_BINARY_DIR}/testfiles/out-${testname}_N.${testname}.h5 ${PROJECT_BINARY_DIR}/testfiles/out-${testname}_M.${testname}.h5) set_tests_properties (H5REPACK_META-${testname} PROPERTIES WILL_FAIL "true") set_tests_properties (H5REPACK_META-${testname} PROPERTIES DEPENDS H5REPACK_META-${testname}_M) - ENDMACRO (ADD_H5_TEST_META) + endmacro () - MACRO (ADD_H5_UD_TEST testname resultcode resultfile) + macro (ADD_H5_UD_TEST testname resultcode resultfile) if (NOT HDF5_ENABLE_USING_MEMCHECKER) # Remove any output file left over from previous test run add_test ( @@ -469,8 +469,8 @@ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) set_tests_properties (H5REPACK_UD-h5dump-${testname} PROPERTIES DEPENDS "H5REPACK_UD-${testname}") - endif (NOT HDF5_ENABLE_USING_MEMCHECKER) - ENDMACRO (ADD_H5_UD_TEST) + endif () + endmacro () ############################################################################## ############################################################################## @@ -708,7 +708,7 @@ ) if (NOT "${last_test}" STREQUAL "") set_tests_properties (H5REPACK-clearall-objects PROPERTIES DEPENDS ${last_test}) - endif (NOT "${last_test}" STREQUAL "") + endif () ADD_HELP_TEST(help 0 -h) @@ -717,14 +717,14 @@ if (HDF5_ENABLE_SZIP_ENCODING) set (passRegex "yes") set_tests_properties (H5REPACK-testh5repack_detect_szip PROPERTIES PASS_REGULAR_EXPRESSION "yes") - else (HDF5_ENABLE_SZIP_ENCODING) + else () set (passRegex "no") set_tests_properties (H5REPACK-testh5repack_detect_szip PROPERTIES PASS_REGULAR_EXPRESSION "no") - endif (HDF5_ENABLE_SZIP_ENCODING) - else (HDF5_ENABLE_SZIP_SUPPORT) + endif () + else () set (passRegex "no") set_tests_properties (H5REPACK-testh5repack_detect_szip PROPERTIES PASS_REGULAR_EXPRESSION "no") - endif (HDF5_ENABLE_SZIP_SUPPORT) + endif () set_tests_properties (H5REPACK-testh5repack_detect_szip PROPERTIES DEPENDS H5REPACK-clearall-objects) add_test (NAME H5REPACK-h5repacktest COMMAND $) @@ -748,15 +748,15 @@ set (USE_FILTER_SZIP_ENCODER "no") if (HDF5_ENABLE_SZIP_ENCODING) set (USE_FILTER_SZIP_ENCODER ${testh5repack_detect_szip}) - endif (HDF5_ENABLE_SZIP_ENCODING) + endif () if (H5_HAVE_FILTER_DEFLATE) set (USE_FILTER_DEFLATE "true") - endif (H5_HAVE_FILTER_DEFLATE) + endif () if (H5_HAVE_FILTER_SZIP) set (USE_FILTER_SZIP "true") - endif (H5_HAVE_FILTER_SZIP) + endif () # copy files (these files have no filters) ADD_H5_TEST (fill "TEST" ${FILE0}) @@ -768,10 +768,10 @@ # nested 8bit enum in both deflated and non-deflated datafiles if (NOT USE_FILTER_DEFLATE) - ADD_H5_TEST (nested_8bit_enum "TEST" h5repack_nested_8bit_enum.h5) - else (NOT USE_FILTER_DEFLATE) - ADD_H5_TEST (nested_8bit_enum "TEST" h5repack_nested_8bit_enum_deflated.h5) - endif (NOT USE_FILTER_DEFLATE) + ADD_H5_TEST (nested_8bit_enum "TEST" h5repack_nested_8bit_enum.h5) + else () + ADD_H5_TEST (nested_8bit_enum "TEST" h5repack_nested_8bit_enum_deflated.h5) + endif () # use $FILE4 to write some filters (this file has no filters) @@ -780,7 +780,7 @@ set (TESTTYPE "TEST") if (NOT USE_FILTER_DEFLATE) set (TESTTYPE "SKIP") - endif (NOT USE_FILTER_DEFLATE) + endif () ADD_H5_TEST (gzip_individual ${TESTTYPE} ${arg}) # gzip for all @@ -788,7 +788,7 @@ set (TESTTYPE "TEST") if (NOT USE_FILTER_DEFLATE) set (TESTTYPE "SKIP") - endif (NOT USE_FILTER_DEFLATE) + endif () ADD_H5_TEST (gzip_all ${TESTTYPE} ${arg}) # szip with individual object @@ -796,7 +796,7 @@ set (TESTTYPE "TEST") if (NOT USE_FILTER_SZIP_ENCODER OR NOT USE_FILTER_SZIP) set (TESTTYPE "SKIP") - endif (NOT USE_FILTER_SZIP_ENCODER OR NOT USE_FILTER_SZIP) + endif () ADD_H5_TEST (szip_individual ${TESTTYPE} ${arg}) # szip for all @@ -804,7 +804,7 @@ set (TESTTYPE "TEST") if (NOT USE_FILTER_SZIP_ENCODER OR NOT USE_FILTER_SZIP) set (TESTTYPE "SKIP") - endif (NOT USE_FILTER_SZIP_ENCODER OR NOT USE_FILTER_SZIP) + endif () ADD_H5_TEST (szip_all ${TESTTYPE} ${arg}) # shuffle with individual object @@ -828,7 +828,7 @@ set (TESTTYPE "TEST") if (NOT USE_FILTER_SZIP_ENCODER OR NOT USE_FILTER_SZIP OR NOT USE_FILTER_DEFLATE) set (TESTTYPE "SKIP") - endif (NOT USE_FILTER_SZIP_ENCODER OR NOT USE_FILTER_SZIP OR NOT USE_FILTER_DEFLATE) + endif () ADD_H5_TEST (all_filters ${TESTTYPE} ${arg}) # verbose gzip with individual object @@ -836,7 +836,7 @@ set (TESTTYPE "TEST") if (NOT USE_FILTER_DEFLATE) set (TESTTYPE "SKIP") - endif (NOT USE_FILTER_DEFLATE) + endif () ADD_H5_CMP_TEST (gzip_verbose_filters "O?...ing file[^\n]+\n" ${TESTTYPE} 0 ${arg}) ########################################################### @@ -848,7 +848,7 @@ set (TESTTYPE "TEST") if (NOT USE_FILTER_SZIP_ENCODER OR NOT USE_FILTER_SZIP) set (TESTTYPE "SKIP") - endif (NOT USE_FILTER_SZIP_ENCODER OR NOT USE_FILTER_SZIP) + endif () ADD_H5_TEST (szip_copy ${TESTTYPE} ${arg}) # szip remove @@ -856,7 +856,7 @@ set (TESTTYPE "TEST") if (NOT USE_FILTER_SZIP_ENCODER OR NOT USE_FILTER_SZIP) set (TESTTYPE "SKIP") - endif (NOT USE_FILTER_SZIP_ENCODER OR NOT USE_FILTER_SZIP) + endif () ADD_H5_TEST (szip_remove ${TESTTYPE} ${arg}) # deflate copy @@ -864,7 +864,7 @@ set (TESTTYPE "TEST") if (NOT USE_FILTER_DEFLATE) set (TESTTYPE "SKIP") - endif (NOT USE_FILTER_DEFLATE) + endif () ADD_H5_TEST (deflate_copy ${TESTTYPE} ${arg}) # deflate remove @@ -872,7 +872,7 @@ set (TESTTYPE "TEST") if (NOT USE_FILTER_DEFLATE) set (TESTTYPE "SKIP") - endif (NOT USE_FILTER_DEFLATE) + endif () ADD_H5_TEST (deflate_remove ${TESTTYPE} ${arg}) # shuffle copy @@ -920,7 +920,7 @@ set (TESTTYPE "TEST") if (NOT USE_FILTER_DEFLATE OR NOT USE_FILTER_SZIP OR NOT USE_FILTER_SZIP_ENCODER) set (TESTTYPE "SKIP") - endif (NOT USE_FILTER_DEFLATE OR NOT USE_FILTER_SZIP OR NOT USE_FILTER_SZIP_ENCODER) + endif () ADD_H5_TEST (remove_all ${TESTTYPE} ${arg}) #filter conversions @@ -928,14 +928,14 @@ set (TESTTYPE "TEST") if (NOT USE_FILTER_SZIP_ENCODER OR NOT USE_FILTER_SZIP OR NOT USE_FILTER_DEFLATE) set (TESTTYPE "SKIP") - endif (NOT USE_FILTER_SZIP_ENCODER OR NOT USE_FILTER_SZIP OR NOT USE_FILTER_DEFLATE) + endif () ADD_H5_TEST (deflate_convert ${TESTTYPE} ${arg}) set (arg ${FILE7} -f dset_szip:GZIP=1) set (TESTTYPE "TEST") if (NOT USE_FILTER_SZIP OR NOT USE_FILTER_SZIP_ENCODER OR NOT USE_FILTER_DEFLATE) set (TESTTYPE "SKIP") - endif (NOT USE_FILTER_SZIP OR NOT USE_FILTER_SZIP_ENCODER OR NOT USE_FILTER_DEFLATE) + endif () ADD_H5_TEST (szip_convert ${TESTTYPE} ${arg}) #limit @@ -943,7 +943,7 @@ set (TESTTYPE "TEST") if (NOT USE_FILTER_DEFLATE) set (TESTTYPE "SKIP") - endif (NOT USE_FILTER_DEFLATE) + endif () ADD_H5_DMP_TEST (deflate_limit ${TESTTYPE} 0 ${arg}) #file @@ -951,7 +951,7 @@ set (TESTTYPE "TEST") if (NOT USE_FILTER_DEFLATE) set (TESTTYPE "SKIP") - endif (NOT USE_FILTER_DEFLATE) + endif () ADD_H5_TEST (deflate_file ${TESTTYPE} ${arg}) ######################################################### @@ -1039,7 +1039,7 @@ set (TESTTYPE "TEST") if (NOT USE_FILTER_DEFLATE) set (TESTTYPE "SKIP") - endif (NOT USE_FILTER_DEFLATE) + endif () ADD_H5_VERIFY_TEST (layout_long_switches ${TESTTYPE} 1 ${FILE4} null CHUNKED ${arg}) # latest file format with short switches. use FILE4=h5repack_layout.h5 (no filters) @@ -1047,7 +1047,7 @@ set (TESTTYPE "TEST") if (NOT USE_FILTER_DEFLATE) set (TESTTYPE "SKIP") - endif (NOT USE_FILTER_DEFLATE) + endif () ADD_H5_VERIFY_TEST (layout_short_switches ${TESTTYPE} 1 ${FILE4} null CHUNKED ${arg}) # several global filters @@ -1055,7 +1055,7 @@ set (TESTTYPE "TEST") if (NOT USE_FILTER_DEFLATE) set (TESTTYPE "SKIP") - endif (NOT USE_FILTER_DEFLATE) + endif () ADD_H5_TEST (global_filters ${TESTTYPE} ${arg}) # syntax of -i infile -o outfile @@ -1064,7 +1064,7 @@ set (TESTTYPE "LEGACY") if (NOT USE_FILTER_DEFLATE) set (TESTTYPE "SKIP") - endif (NOT USE_FILTER_DEFLATE) + endif () ADD_H5_TEST_OLD (old_style_layout_short_switches ${TESTTYPE} ${arg}) # add a userblock to file @@ -1080,7 +1080,10 @@ ADD_H5_TEST (upgrade_layout "TEST" ${FILE14}) # test for datum size > H5TOOLS_MALLOCSIZE - ADD_H5_TEST (gt_mallocsize "TEST" ${FILE1} -f GZIP=1) + if (NOT USE_FILTER_DEFLATE) + set (TESTTYPE "SKIP") + endif () + ADD_H5_TEST (gt_mallocsize ${TESTTYPE} ${FILE1} -f GZIP=1) # Check repacking file with committed datatypes in odd configurations ADD_H5_TEST (committed_dt "TEST" ${FILE15}) @@ -1114,31 +1117,31 @@ set (TESTTYPE "TEST") if (NOT USE_FILTER_DEFLATE) set (TESTTYPE "SKIP") - endif (NOT USE_FILTER_DEFLATE) + endif () ADD_H5_VERIFY_VDS (vds_dset_chunk20x10x5 ${TESTTYPE} 0 ${FILEV1} vds_dset CHUNKED -l vds_dset:CHUNK=20x10x5) set (TESTTYPE "TEST") if (NOT USE_FILTER_DEFLATE) set (TESTTYPE "SKIP") - endif (NOT USE_FILTER_DEFLATE) + endif () ADD_H5_VERIFY_VDS (vds_chunk2x5x8 ${TESTTYPE} 0 ${FILEV3_1} vds_dset CHUNKED -l vds_dset:CHUNK=2x5x8) set (TESTTYPE "TEST") if (NOT USE_FILTER_DEFLATE) set (TESTTYPE "SKIP") - endif (NOT USE_FILTER_DEFLATE) + endif () ADD_H5_VERIFY_VDS (vds_chunk3x6x9 ${TESTTYPE} 0 ${FILEV2} vds_dset CHUNKED -l vds_dset:CHUNK=3x6x9) set (TESTTYPE "TEST") if (NOT USE_FILTER_DEFLATE) set (TESTTYPE "SKIP") - endif (NOT USE_FILTER_DEFLATE) + endif () ADD_H5_VERIFY_VDS (vds_compa ${TESTTYPE} 0 ${FILEV4} vds_dset COMPACT -l vds_dset:COMPA) set (TESTTYPE "TEST") if (NOT USE_FILTER_DEFLATE) set (TESTTYPE "SKIP") - endif (NOT USE_FILTER_DEFLATE) + endif () ADD_H5_VERIFY_VDS (vds_conti ${TESTTYPE} 0 ${FILEV4} vds_dset CONTIGUOUS -l vds_dset:CONTI) ############################################################################## @@ -1151,12 +1154,12 @@ set (TESTRETVAL 255) if (WIN32) set (TESTRETVAL -1) - endif() + endif () ADD_H5_CMP_TEST (plugin_zero "" "TEST" ${TESTRETVAL} h5repack_layout.h5 -v -f UD=250,0) if (HDF5_TEST_VFD) # Run test with different Virtual File Driver foreach (vfd ${VFD_LIST}) ADD_VFD_TEST (${vfd} 0) - endforeach (vfd ${VFD_LIST}) - endif (HDF5_TEST_VFD) + endforeach () + endif () diff --git a/tools/test/h5repack/h5repack.sh.in b/tools/test/h5repack/h5repack.sh.in index 4d3cae8..23e0663 100644 --- a/tools/test/h5repack/h5repack.sh.in +++ b/tools/test/h5repack/h5repack.sh.in @@ -29,14 +29,14 @@ TESTNAME=h5repack EXIT_SUCCESS=0 EXIT_FAILURE=1 -H5REPACK=../../src/h5repack/h5repack # The tool name -H5REPACK_BIN=`pwd`/$H5REPACK # The path of the tool binary +H5REPACK=../../src/h5repack/h5repack # The tool name +H5REPACK_BIN=`pwd`/$H5REPACK # The path of the tool binary -H5DIFF=../../src/h5diff/h5diff # The h5diff tool name -H5DIFF_BIN=`pwd`/$H5DIFF # The path of the h5diff tool binary +H5DIFF=../../src/h5diff/h5diff # The h5diff tool name +H5DIFF_BIN=`pwd`/$H5DIFF # The path of the h5diff tool binary -H5DUMP=../../src/h5dump/h5dump # The h5dump tool name -H5DUMP_BIN=`pwd`/$H5DUMP # The path of the h5dump tool binary +H5DUMP=../../src/h5dump/h5dump # The h5dump tool name +H5DUMP_BIN=`pwd`/$H5DUMP # The path of the h5dump tool binary RM='rm -rf' CMP='cmp' @@ -386,7 +386,7 @@ VERIFY_LAYOUT_VDS() # Clean up output file if test -z "$HDF5_NOCLEANUP"; then - rm -f $actual $actual_err + rm -f $actual $actual_err fi # clean up tmp files @@ -1223,27 +1223,27 @@ TOOLTEST_META meta_long h5repack_layout.h5 --metadata_block_size=8192 # layout conversions ############################################################### if test $USE_FILTER_DEFLATE != "yes" ; then - SKIP vds_dset_chunk_20x10x5 + SKIP vds_dset_chunk_20x10x5 else - VERIFY_LAYOUT_VDS vds_dset_chunk_20x10x5 1_vds.h5 vds_dset CHUNKED --layout vds_dset:CHUNK=20x10x5 + VERIFY_LAYOUT_VDS vds_dset_chunk_20x10x5 1_vds.h5 vds_dset CHUNKED --layout vds_dset:CHUNK=20x10x5 fi if test $USE_FILTER_DEFLATE != "yes" ; then - SKIP vds_chunk2x5x8 + SKIP vds_chunk2x5x8 else - VERIFY_LAYOUT_VDS vds_chunk2x5x8 3_1_vds.h5 vds_dset CHUNKED -l vds_dset:CHUNK=2x5x8 + VERIFY_LAYOUT_VDS vds_chunk2x5x8 3_1_vds.h5 vds_dset CHUNKED -l vds_dset:CHUNK=2x5x8 fi if test $USE_FILTER_DEFLATE != "yes" ; then - SKIP vds_chunk3x6x9 + SKIP vds_chunk3x6x9 else - VERIFY_LAYOUT_VDS vds_chunk3x6x9 2_vds.h5 vds_dset CHUNKED -l vds_dset:CHUNK=3x6x9 + VERIFY_LAYOUT_VDS vds_chunk3x6x9 2_vds.h5 vds_dset CHUNKED -l vds_dset:CHUNK=3x6x9 fi if test $USE_FILTER_DEFLATE != "yes" ; then - SKIP vds_compa 4_vds.h5 + SKIP vds_compa 4_vds.h5 else - VERIFY_LAYOUT_VDS vds_compa 4_vds.h5 vds_dset COMPACT -l vds_dset:COMPA + VERIFY_LAYOUT_VDS vds_compa 4_vds.h5 vds_dset COMPACT -l vds_dset:COMPA fi if test $USE_FILTER_DEFLATE != "yes" ; then diff --git a/tools/test/h5repack/h5repacktst.c b/tools/test/h5repack/h5repacktst.c index 82b45fc..abdda08 100644 --- a/tools/test/h5repack/h5repacktst.c +++ b/tools/test/h5repack/h5repacktst.c @@ -97,7 +97,6 @@ const char *H5REPACK_FILENAMES[] = { /* Name of tool */ #define PROGRAMNAME "h5repacktst" - #define DIM1 40 #define DIM2 20 #define CDIM1 DIM1/2 @@ -192,7 +191,7 @@ int main (void) puts("Testing h5repack:"); /* make the test files */ - TESTING(" generating datasets"); + TESTING(" generating files for testing"); if (make_testfiles() < 0) GOERROR; PASSED(); diff --git a/tools/test/h5stat/CMakeLists.txt b/tools/test/h5stat/CMakeLists.txt index 98cfed7..10ac5e0 100644 --- a/tools/test/h5stat/CMakeLists.txt +++ b/tools/test/h5stat/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 3.1.0) +cmake_minimum_required (VERSION 3.2.2) PROJECT (HDF5_TOOLS_TEST_H5STAT) #----------------------------------------------------------------------------- @@ -17,6 +17,6 @@ INCLUDE_DIRECTORIES (${HDF5_TOOLS_DIR}/lib) set_target_properties (h5stat_gentest PROPERTIES FOLDER generator/tools) #add_test (NAME h5stat_gentest COMMAND $) - endif (HDF5_BUILD_GENERATORS) + endif () include (CMakeTests.cmake) diff --git a/tools/test/h5stat/CMakeTests.cmake b/tools/test/h5stat/CMakeTests.cmake index 39faca0..f6735d5 100644 --- a/tools/test/h5stat/CMakeTests.cmake +++ b/tools/test/h5stat/CMakeTests.cmake @@ -52,11 +52,11 @@ foreach (ddl_file ${HDF5_REFERENCE_FILES}) HDFTEST_COPY_FILE("${HDF5_TOOLS_TEST_H5STAT_SOURCE_DIR}/testfiles/${ddl_file}" "${PROJECT_BINARY_DIR}/${ddl_file}" "h5stat_files") - endforeach (ddl_file ${HDF5_REFERENCE_FILES}) + endforeach () foreach (h5_file ${HDF5_REFERENCE_TEST_FILES}) HDFTEST_COPY_FILE("${HDF5_TOOLS_TEST_H5STAT_SOURCE_DIR}/testfiles/${h5_file}" "${PROJECT_BINARY_DIR}/${h5_file}" "h5stat_files") - endforeach (h5_file ${HDF5_REFERENCE_TEST_FILES}) + endforeach () add_custom_target(h5stat_files ALL COMMENT "Copying files needed by h5stat tests" DEPENDS ${h5stat_files_list}) ############################################################################## @@ -65,16 +65,16 @@ ############################################################################## ############################################################################## - MACRO (ADD_H5_TEST resultfile resultcode) + macro (ADD_H5_TEST resultfile resultcode) # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME H5STAT-${resultfile} COMMAND $ ${ARGN}) if (NOT ${resultcode} STREQUAL "0") set_tests_properties (H5STAT-${resultfile} PROPERTIES WILL_FAIL "true") - endif (NOT ${resultcode} STREQUAL "0") + endif () if (NOT "${last_test}" STREQUAL "") set_tests_properties (H5STAT-${resultfile} PROPERTIES DEPENDS ${last_test}) - endif (NOT "${last_test}" STREQUAL "") + endif () else (HDF5_ENABLE_USING_MEMCHECKER) add_test ( NAME H5STAT-${resultfile} @@ -87,8 +87,8 @@ -D "TEST_REFERENCE=${resultfile}.ddl" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) - endif (HDF5_ENABLE_USING_MEMCHECKER) - ENDMACRO (ADD_H5_TEST file) + endif () + endmacro () ############################################################################## ############################################################################## @@ -167,9 +167,9 @@ ) if (NOT "${last_test}" STREQUAL "") set_tests_properties (H5STAT-clearall-objects PROPERTIES DEPENDS ${last_test}) - endif (NOT "${last_test}" STREQUAL "") + endif () set (last_test "H5STAT-clearall-objects") - endif (HDF5_ENABLE_USING_MEMCHECKER) + endif () # Test for help flag ADD_H5_TEST (h5stat_help1 0 -h) diff --git a/tools/test/misc/CMakeLists.txt b/tools/test/misc/CMakeLists.txt index a53fa73..029d7a9 100644 --- a/tools/test/misc/CMakeLists.txt +++ b/tools/test/misc/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 3.1.0) +cmake_minimum_required (VERSION 3.2.2) PROJECT (HDF5_TOOLS_TEST_MISC) #----------------------------------------------------------------------------- @@ -19,7 +19,7 @@ INCLUDE_DIRECTORIES (${HDF5_TOOLS_DIR}/lib) add_subdirectory (${HDF5_TOOLS_TEST_MISC_SOURCE_DIR}/vds) - endif (HDF5_BUILD_GENERATORS) + endif () add_executable (h5repart_test ${HDF5_TOOLS_TEST_MISC_SOURCE_DIR}/repart_test.c) TARGET_NAMING (h5repart_test STATIC) diff --git a/tools/test/misc/CMakeTests.cmake b/tools/test/misc/CMakeTests.cmake index 9835e1e..9ecdeae 100644 --- a/tools/test/misc/CMakeTests.cmake +++ b/tools/test/misc/CMakeTests.cmake @@ -31,7 +31,7 @@ foreach (h5_file ${HDF5_REFERENCE_TEST_FILES}) HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/${h5_file}" "${PROJECT_BINARY_DIR}/${h5_file}" "h5repart_files") - endforeach (h5_file ${HDF5_REFERENCE_TEST_FILES}) + endforeach () add_custom_target(h5repart_files ALL COMMENT "Copying files needed by h5repart tests" DEPENDS ${h5repart_files_list}) set (HDF5_MKGRP_TEST_FILES @@ -56,7 +56,7 @@ foreach (h5_mkgrp_file ${HDF5_MKGRP_TEST_FILES}) HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/${h5_mkgrp_file}" "${PROJECT_BINARY_DIR}/testfiles/${h5_mkgrp_file}" "h5mkgrp_files") - endforeach (h5_mkgrp_file ${HDF5_MKGRP_TEST_FILES}) + endforeach () HDFTEST_COPY_FILE("${HDF5_TOOLS_TEST_MISC_SOURCE_DIR}/testfiles/h5mkgrp_help.txt" "${PROJECT_BINARY_DIR}/testfiles/h5mkgrp_help.txt" "h5mkgrp_files") add_custom_target(h5mkgrp_files ALL COMMENT "Copying files needed by h5mkgrp tests" DEPENDS ${h5mkgrp_files_list}) @@ -69,7 +69,7 @@ ############################################################################## ############################################################################## - MACRO (ADD_H5_TEST resultfile resultcode resultoption) + macro (ADD_H5_TEST resultfile resultcode resultoption) if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( NAME H5MKGRP-${resultfile}-clear-objects @@ -78,7 +78,7 @@ ${resultfile}.h5 ) set_tests_properties (H5MKGRP-${resultfile}-clear-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") - endif (NOT HDF5_ENABLE_USING_MEMCHECKER) + endif () add_test ( NAME H5MKGRP-${resultfile} @@ -88,8 +88,8 @@ if (HDF5_ENABLE_USING_MEMCHECKER) if (NOT "${last_test}" STREQUAL "") set_tests_properties (H5MKGRP-${resultfile} PROPERTIES DEPENDS ${last_test}) - endif (NOT "${last_test}" STREQUAL "") - else (HDF5_ENABLE_USING_MEMCHECKER) + endif () + else () set_tests_properties (H5MKGRP-${resultfile} PROPERTIES DEPENDS H5MKGRP-${resultfile}-clear-objects) add_test ( NAME H5MKGRP-${resultfile}-h5ls @@ -104,13 +104,13 @@ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) set_tests_properties (H5MKGRP-${resultfile}-h5ls PROPERTIES DEPENDS H5MKGRP-${resultfile}) - endif (HDF5_ENABLE_USING_MEMCHECKER) - ENDMACRO (ADD_H5_TEST resultfile resultcode resultoption) + endif () + endmacro () - MACRO (ADD_H5_CMP resultfile resultcode) + macro (ADD_H5_CMP resultfile resultcode) if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME H5MKGRP_CMP-${resultfile} COMMAND $ ${ARGN}) - else (HDF5_ENABLE_USING_MEMCHECKER) + else () add_test ( NAME H5MKGRP_CMP-${resultfile}-clear-objects COMMAND ${CMAKE_COMMAND} @@ -130,8 +130,8 @@ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) set_tests_properties (H5MKGRP_CMP-${resultfile} PROPERTIES DEPENDS H5MKGRP_CMP-${resultfile}-clear-objects) - endif (HDF5_ENABLE_USING_MEMCHECKER) - ENDMACRO (ADD_H5_CMP resultfile resultcode) + endif () + endmacro () ############################################################################## ############################################################################## @@ -154,7 +154,7 @@ ) if (NOT "${last_test}" STREQUAL "") set_tests_properties (H5REPART-clearall-objects PROPERTIES DEPENDS ${last_test}) - endif (NOT "${last_test}" STREQUAL "") + endif () set (last_test "H5REPART-clearall-objects") # repartition family member size to 20,000 bytes. @@ -192,7 +192,7 @@ ) if (NOT "${last_test}" STREQUAL "") set_tests_properties (H5CLEAR-clearall-objects PROPERTIES DEPENDS ${last_test}) - endif (NOT "${last_test}" STREQUAL "") + endif () set (last_test "H5CLEAR-clearall-objects") # create the output files to be used. @@ -313,9 +313,9 @@ set_tests_properties (H5MKGRP-clearall-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") if (NOT "${last_test}" STREQUAL "") set_tests_properties (H5MKGRP-clearall-objects PROPERTIES DEPENDS ${last_test}) - endif (NOT "${last_test}" STREQUAL "") + endif () set (last_test "H5MKGRP-clearall-objects") - endif (HDF5_ENABLE_USING_MEMCHECKER) + endif () # Check that help & version is displayed properly ADD_H5_CMP (h5mkgrp_help 0 "-h") diff --git a/tools/test/misc/Makefile.am b/tools/test/misc/Makefile.am index 1025a8a..fc9e1c1 100644 --- a/tools/test/misc/Makefile.am +++ b/tools/test/misc/Makefile.am @@ -36,7 +36,7 @@ SCRIPT_DEPEND=../../src/misc/h5repart$(EXEEXT) ../../src/misc/h5mkgrp$(EXEEXT) . # Temporary files. *.h5 are generated by h5repart_gentest. They should # copied to the testfiles/ directory if update is required. fst_family*.h5 # and scd_family*.h5 were created by setting the HDF5_NOCLEANUP variable. -CHECK_CLEANFILES+=*.h5 ../testfiles/fst_family*.h5 ../testfiles/scd_family*.h5 +CHECK_CLEANFILES+=*.h5 ../testfiles/fst_family*.h5 ../testfiles/scd_family*.h5 append.log # These were generated by configure. Remove them only when distclean. DISTCLEANFILES=testh5repart.sh testh5clear.sh diff --git a/tools/test/misc/testh5repart.sh.in b/tools/test/misc/testh5repart.sh.in index 2106a1d..9a9dd9a 100644 --- a/tools/test/misc/testh5repart.sh.in +++ b/tools/test/misc/testh5repart.sh.in @@ -43,7 +43,7 @@ SRC_TOOLS="$srcdir/../.." SRC_TOOLS_TESTFILES="$SRC_TOOLS/testfiles" -TESTDIR=./testfiles +TESTDIR=./testrepart test -d $TESTDIR || mkdir -p $TESTDIR # diff --git a/tools/test/misc/vds/CMakeLists.txt b/tools/test/misc/vds/CMakeLists.txt index 23dc85c..ec672e5 100644 --- a/tools/test/misc/vds/CMakeLists.txt +++ b/tools/test/misc/vds/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 3.1.0) +cmake_minimum_required (VERSION 3.2.2) PROJECT (HDF5_TOOLS_TEST_MISC_VDS) #----------------------------------------------------------------------------- @@ -12,7 +12,7 @@ MACRO (ADD_H5_GENERATOR genfile) TARGET_C_PROPERTIES (${genfile} STATIC " " " ") target_link_libraries (${genfile} ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) set_target_properties (${genfile} PROPERTIES FOLDER generator/tools) -ENDMACRO (ADD_H5_GENERATOR genfile) +ENDMACRO () # generator executables set (H5_GENERATORS @@ -25,4 +25,4 @@ set (H5_GENERATORS foreach (gen ${H5_GENERATORS}) ADD_H5_GENERATOR (${gen}) -endforeach (gen ${H5_GENERATORS}) +endforeach () diff --git a/tools/test/perform/CMakeLists.txt b/tools/test/perform/CMakeLists.txt index bea2d0c..20250c6 100644 --- a/tools/test/perform/CMakeLists.txt +++ b/tools/test/perform/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 3.1.0) +cmake_minimum_required (VERSION 3.2.2) PROJECT (HDF5_TOOLS_TEST_PERFORM ) #----------------------------------------------------------------------------- @@ -40,7 +40,7 @@ if (HDF5_BUILD_PERFORM_STANDALONE) set_property (TARGET h5perf_serial_alone APPEND PROPERTY COMPILE_DEFINITIONS STANDALONE ) -endif (HDF5_BUILD_PERFORM_STANDALONE) +endif () #-- Adding test for chunk set (chunk_SOURCES @@ -118,7 +118,7 @@ if (H5_HAVE_PARALLEL AND BUILD_TESTING) set_property (TARGET h5perf_alone APPEND PROPERTY COMPILE_DEFINITIONS STANDALONE ) - endif (HDF5_BUILD_PERFORM_STANDALONE) -endif (H5_HAVE_PARALLEL AND BUILD_TESTING) + endif () +endif () include (CMakeTests.cmake) diff --git a/tools/test/perform/CMakeTests.cmake b/tools/test/perform/CMakeTests.cmake index 0ea40a3..d286988 100644 --- a/tools/test/perform/CMakeTests.cmake +++ b/tools/test/perform/CMakeTests.cmake @@ -27,28 +27,119 @@ add_test ( x-gnuplot ) -add_test (NAME PERFORM_h5perf_serial COMMAND $) +if (HDF5_ENABLE_USING_MEMCHECKER) + add_test (NAME PERFORM_h5perf_serial COMMAND $) +else () + add_test (NAME PERFORM_h5perf_serial COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$" + -D "TEST_ARGS:STRING=" + -D "TEST_EXPECT=0" + -D "TEST_SKIP_COMPARE=TRUE" + -D "TEST_OUTPUT=h5perf_serial.txt" + #-D "TEST_REFERENCE=h5perf_serial.out" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) +endif () set_tests_properties (PERFORM_h5perf_serial PROPERTIES TIMEOUT 1800) if (HDF5_BUILD_PERFORM_STANDALONE) add_test (NAME PERFORM_h5perf_serial_alone COMMAND $) -endif (HDF5_BUILD_PERFORM_STANDALONE) +endif () -add_test (NAME PERFORM_chunk COMMAND $) +if (HDF5_ENABLE_USING_MEMCHECKER) + add_test (NAME PERFORM_chunk COMMAND $) +else () + add_test (NAME PERFORM_chunk COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$" + -D "TEST_ARGS:STRING=" + -D "TEST_EXPECT=0" + -D "TEST_SKIP_COMPARE=TRUE" + -D "TEST_OUTPUT=chunk.txt" + #-D "TEST_REFERENCE=chunk.out" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) +endif () -add_test (NAME PERFORM_iopipe COMMAND $) +if (HDF5_ENABLE_USING_MEMCHECKER) + add_test (NAME PERFORM_iopipe COMMAND $) +else () + add_test (NAME PERFORM_iopipe COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$" + -D "TEST_ARGS:STRING=" + -D "TEST_EXPECT=0" + -D "TEST_SKIP_COMPARE=TRUE" + -D "TEST_OUTPUT=iopipe.txt" + #-D "TEST_REFERENCE=iopipe.out" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) +endif () -add_test (NAME PERFORM_overhead COMMAND $) +if (HDF5_ENABLE_USING_MEMCHECKER) + add_test (NAME PERFORM_overhead COMMAND $) +else () + add_test (NAME PERFORM_overhead COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$" + -D "TEST_ARGS:STRING=" + -D "TEST_EXPECT=0" + -D "TEST_SKIP_COMPARE=TRUE" + -D "TEST_OUTPUT=overhead.txt" + #-D "TEST_REFERENCE=overhead.out" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) +endif () -add_test (NAME PERFORM_perf_meta COMMAND $) +if (HDF5_ENABLE_USING_MEMCHECKER) + add_test (NAME PERFORM_perf_meta COMMAND $) +else () + add_test (NAME PERFORM_perf_meta COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$" + -D "TEST_ARGS:STRING=" + -D "TEST_EXPECT=0" + -D "TEST_SKIP_COMPARE=TRUE" + -D "TEST_OUTPUT=perf_meta.txt" + #-D "TEST_REFERENCE=perf_meta.out" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) +endif () -add_test (NAME PERFORM_zip_perf_help COMMAND $ "-h") -add_test (NAME PERFORM_zip_perf COMMAND $ tfilters.h5) +if (HDF5_ENABLE_USING_MEMCHECKER) + add_test (NAME PERFORM_zip_perf_help COMMAND $ "-h") +else () + add_test (NAME PERFORM_zip_perf_help COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$" + -D "TEST_ARGS:STRING=" + -D "TEST_EXPECT=0" + -D "TEST_SKIP_COMPARE=TRUE" + -D "TEST_OUTPUT=zip_perf-h.txt" + #-D "TEST_REFERENCE=zip_perf-h.out" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) +endif () +if (HDF5_ENABLE_USING_MEMCHECKER) + add_test (NAME PERFORM_zip_perf COMMAND $ tfilters.h5) +else () + add_test (NAME PERFORM_zip_perf COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$" + -D "TEST_ARGS:STRING=" + -D "TEST_EXPECT=0" + -D "TEST_SKIP_COMPARE=TRUE" + -D "TEST_OUTPUT=zip_perf.txt" + #-D "TEST_REFERENCE=zip_perf.out" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) +endif () if (H5_HAVE_PARALLEL) add_test (NAME PERFORM_h5perf COMMAND ${MPIEXEC} ${MPIEXEC_PREFLAGS} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_POSTFLAGS} $) if (HDF5_BUILD_PERFORM_STANDALONE) add_test (NAME PERFORM_h5perf_alone COMMAND ${MPIEXEC} ${MPIEXEC_PREFLAGS} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_POSTFLAGS} $) - endif (HDF5_BUILD_PERFORM_STANDALONE) -endif (H5_HAVE_PARALLEL) + endif () +endif () diff --git a/tools/test/perform/sio_perf.c b/tools/test/perform/sio_perf.c index aceccb0..5bae832 100644 --- a/tools/test/perform/sio_perf.c +++ b/tools/test/perform/sio_perf.c @@ -100,11 +100,7 @@ static const char *progname = "h5perf_serial"; * It seems that only the options that accept additional information * such as dataset size (-e) require the colon next to it. */ -#if 1 static const char *s_opts = "a:A:B:c:Cd:D:e:F:ghi:Imno:p:P:r:stT:v:wx:X:"; -#else -static const char *s_opts = "a:A:bB:c:Cd:D:e:F:ghi:Imno:p:P:r:stT:wx:X:"; -#endif /* 1 */ static struct long_options l_opts[] = { { "align", require_arg, 'a' }, { "alig", require_arg, 'a' }, -- cgit v0.12