[svn-r22987] ported revisions from 22742 to 22986 from the trunk

This commit is contained in:
Raymond Lu 2012-10-29 13:59:05 -05:00
parent 78b07da7ae
commit 0cf58a4755
598 changed files with 15223 additions and 126720 deletions

View File

@ -916,7 +916,7 @@ IF (NOT HDF5_EXTERNALLY_CONFIGURED)
${HDF5_BINARY_DIR}/CMakeFiles/${HDF5_PACKAGE}${HDF_PACKAGE_EXT}-config-version.cmake @ONLY
)
INSTALL (
FILES ${HDF5_BINARY_DIR}/CMakeFiles/${HDF5_PACKAGE}${HDF5_PACKAGE_EXT}-config-version.cmake
FILES ${HDF5_BINARY_DIR}/CMakeFiles/${HDF5_PACKAGE}${HDF_PACKAGE_EXT}-config-version.cmake
DESTINATION ${HDF5_INSTALL_CMAKE_DIR}/${HDF5_PACKAGE}
COMPONENT configinstall
)
@ -955,7 +955,7 @@ IF (NOT HDF5_EXTERNALLY_CONFIGURED)
IF (EXISTS "${HDF5_SOURCE_DIR}/release_docs" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/release_docs")
SET (release_files
${HDF5_SOURCE_DIR}/release_docs/CMake.txt
${HDF5_SOURCE_DIR}/release_docs/Using_CMake.txt
${HDF5_SOURCE_DIR}/release_docs/USING_CMake.txt
${HDF5_SOURCE_DIR}/release_docs/COPYING
${HDF5_SOURCE_DIR}/release_docs/HISTORY-1_9.txt
${HDF5_SOURCE_DIR}/release_docs/INSTALL

455
MANIFEST
View File

@ -349,6 +349,7 @@
./fortran/test/tH5I.f90
./fortran/test/tH5L_F03.f90
./fortran/test/tH5O.f90
./fortran/test/tH5O_F03.f90
./fortran/test/tH5P_F03.f90
./fortran/test/tH5P.f90
./fortran/test/tH5R.f90
@ -441,6 +442,8 @@
./c++/src/H5IntType.h
./c++/src/H5Library.cpp
./c++/src/H5Library.h
./c++/src/H5Location.cpp
./c++/src/H5Location.h
./c++/src/H5Object.cpp
./c++/src/H5Object.h
./c++/src/H5PredType.cpp
@ -494,7 +497,6 @@
./perform/chunk.c
./perform/gen_report.pl
./perform/iopipe.c
./perform/mpi-perf.c
./perform/overhead.c
./perform/perf.c
./perform/perf_meta.c
@ -514,22 +516,19 @@
./perform/sio_timer.h
./perform/zip_perf.c
./release_docs/CMake.txt
./release_docs/COPYING
./release_docs/HISTORY-1_0-1_8_0_rc3.txt
./release_docs/HISTORY-1_9.txt
./release_docs/INSTALL
./release_docs/INSTALL_Cygwin.txt
./release_docs/INSTALL_MinGW.txt
./release_docs/INSTALL_parallel
./release_docs/INSTALL_VMS.txt
./release_docs/INSTALL_Windows.txt
./release_docs/USING_Windows.txt
./release_docs/INSTALL_Windows_From_Command_Line.txt
./release_docs/INSTALL_Windows_Short_NET.TXT
./release_docs/INSTALL_Windows_Short_VS2005.TXT
./release_docs/INSTALL_Windows_Short_VS2008.TXT
./release_docs/CMake.txt
./release_docs/INSTALL_parallel
./release_docs/RELEASE.txt
./release_docs/Using_CMake.txt
./release_docs/USING_CMake.txt
./release_docs/USING_Windows.txt
./src/.indent.pro _DO_NOT_DISTRIBUTE_
./src/hdf5.lnt _DO_NOT_DISTRIBUTE_
@ -822,6 +821,7 @@
./src/H5Pdcpl.c
./src/H5Pdeprec.c
./src/H5Pdxpl.c
./src/H5Pencdec.c
./src/H5Pfapl.c
./src/H5Pfcpl.c
./src/H5Pfmpl.c
@ -947,6 +947,8 @@
./test/dtransform.c
./test/earray.c
./test/efc.c
./test/enc_dec_plist.c
./test/enc_dec_plist_with_endianess.c
./test/enum.c
./test/extend.c
./test/external.c
@ -989,6 +991,7 @@
./test/gen_old_group.c _DO_NOT_DISTRIBUTE_
./test/gen_old_layout.c _DO_NOT_DISTRIBUTE_
./test/gen_old_mtime.c _DO_NOT_DISTRIBUTE_
./test/gen_plist.c _DO_NOT_DISTRIBUTE_
./test/gen_sizes_lheap.c _DO_NOT_DISTRIBUTE_
./test/gen_specmetaread.c _DO_NOT_DISTRIBUTE_
./test/gen_udlinks.c _DO_NOT_DISTRIBUTE_
@ -1079,23 +1082,48 @@
./test/testfiles/error_test_1
./test/testfiles/error_test_2
./test/testfiles/links_env.out
./test/testfiles/plist_files/acpl_be
./test/testfiles/plist_files/acpl_le
./test/testfiles/plist_files/dapl_be
./test/testfiles/plist_files/dapl_le
./test/testfiles/plist_files/dcpl_be
./test/testfiles/plist_files/dcpl_le
./test/testfiles/plist_files/dxpl_be
./test/testfiles/plist_files/dxpl_le
./test/testfiles/plist_files/fapl_be
./test/testfiles/plist_files/fapl_le
./test/testfiles/plist_files/fcpl_be
./test/testfiles/plist_files/fcpl_le
./test/testfiles/plist_files/gcpl_be
./test/testfiles/plist_files/gcpl_le
./test/testfiles/plist_files/lapl_be
./test/testfiles/plist_files/lapl_le
./test/testfiles/plist_files/lcpl_be
./test/testfiles/plist_files/lcpl_le
./test/testfiles/plist_files/ocpl_be
./test/testfiles/plist_files/ocpl_le
./test/testfiles/plist_files/ocpypl_be
./test/testfiles/plist_files/ocpypl_le
./test/testfiles/plist_files/strcpl_be
./test/testfiles/plist_files/strcpl_le
./testpar/COPYING
./testpar/Makefile.am
./testpar/Makefile.in
./testpar/t_cache.c
./testpar/t_chunk_alloc.c
./testpar/t_coll_chunk.c
./testpar/t_dset.c
./testpar/t_file.c
./testpar/t_file_image.c
./testpar/t_filter_read.c
./testpar/t_mdset.c
./testpar/t_mpi.c
./testpar/t_ph5basic.c
./testpar/t_pflush1.c
./testpar/t_pflush2.c
./testpar/t_chunk_alloc.c
./testpar/t_coll_chunk.c
./testpar/t_filter_read.c
./testpar/t_posix_compliant.c
./testpar/t_prop.c
./testpar/t_shapesame.c
./testpar/t_span_tree.c
./testpar/testpar.h
@ -1449,6 +1477,10 @@
./tools/testfiles/topaque.h5
./tools/testfiles/tsaf.ddl
./tools/testfiles/tsaf.h5
./tools/testfiles/tscalarattrintsize.ddl
./tools/testfiles/tscalarattrintsize.h5
./tools/testfiles/tscalarintsize.ddl
./tools/testfiles/tscalarintsize.h5
./tools/testfiles/tscaleoffset.ddl
./tools/testfiles/tslink-1.ddl
./tools/testfiles/tslink-2.ddl
@ -2356,402 +2388,3 @@
./tools/h5stat/CMakeLists.txt
./tools/lib/CMakeLists.txt
./tools/misc/CMakeLists.txt
# Windows-specific Files.
# Batch scripts
./windows/copy_hdf.bat
./windows/COPYING
./windows/hdf5bt.BAT
./windows/hdf5build.BAT
./windows/hdf5build_examples.BAT
./windows/hdf5check.BAT
./windows/InstallcppExamples.BAT
./windows/install_dll.BAT
./windows/InstallExamples.bat
./windows/Installf90Examples.BAT
./windows/installhdf5lib.bat
./windows/install_hlcexamples.BAT
./windows/install_hlf90examples.BAT
# C++ Examples
./windows/c++/examples/testcppExamples.BAT
./windows/c++/examples/allcppexamples/allcppexamples.sln
./windows/c++/examples/allcppexamples/allcppexamples.vcproj
./windows/c++/examples/chunkstest/chunkstest.vcproj
./windows/c++/examples/chunkstestdll/chunkstestdll.vcproj
./windows/c++/examples/compoundtest/compoundtest.vcproj
./windows/c++/examples/compoundtestdll/compoundtestdll.vcproj
./windows/c++/examples/createtest/createtest.vcproj
./windows/c++/examples/createtestdll/createtestdll.vcproj
./windows/c++/examples/extend_dstest/extend_dstest.vcproj
./windows/c++/examples/extend_dstestdll/extend_dstestdll.vcproj
./windows/c++/examples/h5grouptest/h5grouptest.vcproj
./windows/c++/examples/h5grouptestdll/h5grouptestdll.vcproj
./windows/c++/examples/readdatatest/readdatatest.vcproj
./windows/c++/examples/readdatatestdll/readdatatestdll.vcproj
./windows/c++/examples/writedatatest/writedatatest.vcproj
./windows/c++/examples/writedatatestdll/writedatatestdll.vcproj
# C++ Tests
./windows/c++/test/H5srcdir_str.h
./windows/c++/test/checkcpptests.bat
./windows/c++/test/testhdf5_cpp/testhdf5_cpp.vcproj
./windows/c++/test/testhdf5_cppdll/testhdf5_cppdll.vcproj
# Library Examples
./windows/examples/testExamples.bat
./windows/examples/testExamples_exp_output.txt
./windows/examples/allexamples/allexamples.sln
./windows/examples/allexamples/allexamples.vcproj
./windows/examples/attributetest/attributetest.vcproj
./windows/examples/attributetestdll/attributetestdll.vcproj
./windows/examples/chunkread/chunkread.vcproj
./windows/examples/chunkreaddll/chunkreaddll.vcproj
./windows/examples/compoundtest/compoundtest.vcproj
./windows/examples/compoundtestdll/compoundtestdll.vcproj
./windows/examples/extendwritetest/extendwritetest.vcproj
./windows/examples/extendwritetestdll/extendwritetestdll.vcproj
./windows/examples/grouptest/grouptest.vcproj
./windows/examples/grouptestdll/grouptestdll.vcproj
./windows/examples/intermgrouptest/intermgrouptest.vcproj
./windows/examples/intermgrouptestdll/intermgrouptestdll.vcproj
./windows/examples/readtest/readtest.vcproj
./windows/examples/readtestdll/readtestdll.vcproj
./windows/examples/selectest/selectest.vcproj
./windows/examples/selectestdll/selectestdll.vcproj
./windows/examples/writetest/writetest.vcproj
./windows/examples/writetestdll/writetestdll.vcproj
# Fortran Examples
./windows/fortran/examples/allf90examples/allf90examples.sln
./windows/fortran/examples/allf90examples/allf90examples.vcproj
./windows/fortran/examples/attreexampletest/attreexampletest.vfproj
./windows/fortran/examples/attreexampletestdll/attreexampletestdll.vfproj
./windows/fortran/examples/compoundtest/compoundtest.vfproj
./windows/fortran/examples/compoundtestdll/compoundtestdll.vfproj
./windows/fortran/examples/dsetexampletest/dsetexampletest.vfproj
./windows/fortran/examples/dsetexampletestdll/dsetexampletestdll.vfproj
./windows/fortran/examples/fileexampletest/fileexampletest.vfproj
./windows/fortran/examples/fileexampletestdll/fileexampletestdll.vfproj
./windows/fortran/examples/groupexampletest/groupexampletest.vfproj
./windows/fortran/examples/groupexampletestdll/groupexampletestdll.vfproj
./windows/fortran/examples/grpdsetexampletest/grpdsetexampletest.vfproj
./windows/fortran/examples/grpdsetexampletestdll/grpdsetexampletestdll.vfproj
./windows/fortran/examples/grpittest/grpittest.vfproj
./windows/fortran/examples/grpittestdll/grpittestdll.vfproj
./windows/fortran/examples/grpsexampletest/grpsexampletest.vfproj
./windows/fortran/examples/grpsexampletestdll/grpsexampletestdll.vfproj
./windows/fortran/examples/hyperslabtest/hyperslabtest.vfproj
./windows/fortran/examples/hyperslabtestdll/hyperslabtestdll.vfproj
./windows/fortran/examples/mountexampletest/mountexampletest.vfproj
./windows/fortran/examples/mountexampletestdll/mountexampletestdll.vfproj
./windows/fortran/examples/refobjexampletest/refobjexampletest.vfproj
./windows/fortran/examples/refobjexampletestdll/refobjexampletestdll.vfproj
./windows/fortran/examples/refregexampletest/refregexampletest.vfproj
./windows/fortran/examples/refregexampletestdll/refregexampletestdll.vfproj
./windows/fortran/examples/rwdsetexampletest/rwdsetexampletest.vfproj
./windows/fortran/examples/rwdsetexampletestdll/rwdsetexampletestdll.vfproj
./windows/fortran/examples/selecteletest/selecteletest.vfproj
./windows/fortran/examples/selecteletestdll/selecteletestdll.vfproj
# Fortran Tests
./windows/fortran/test/checkfortrantests.bat
./windows/fortran/test/flush1_fortran/flush1_fortran.vfproj
./windows/fortran/test/flush1_fortrandll/flush1_fortrandll.vfproj
./windows/fortran/test/flush2_fortran/flush2_fortran.vfproj
./windows/fortran/test/flush2_fortrandll/flush2_fortrandll.vfproj
./windows/fortran/test/libtest_cstubdll/libtest_cstubdll.vcproj
./windows/fortran/test/libtest_fortran/libtest_cstub.vcproj
./windows/fortran/test/libtest_fortran/libtest_fortran.vfproj
./windows/fortran/test/libtest_fortrandll/libtest_fortrandll.vfproj
./windows/fortran/test/testhdf5_fortran/testhdf5_fortran.vfproj
./windows/fortran/test/testhdf5_fortran_1_8/testhdf5_fortran_1_8.vfproj
./windows/fortran/test/testhdf5_fortran_1_8dll/testhdf5_fortran_1_8dll.vfproj
./windows/fortran/test/testhdf5_fortrandll/testhdf5_fortrandll.vfproj
# High-Leve C++ Tests
./windows/hl/c++/test/checkhlcpptests.bat
./windows/hl/c++/test/hl_test_table_cpp/hl_test_table_cpp.vcproj
./windows/hl/c++/test/hl_test_table_cppdll/hl_test_table_cppdll.vcproj
# High-Level Library Examples
./windows/hl/examples/test_hl_cexamples.BAT
./windows/hl/examples/allhlcexamples/allhlcexamples.sln
./windows/hl/examples/allhlcexamples/allhlcexamples.vcproj
./windows/hl/examples/ex_ds1/ex_ds1.vcproj
./windows/hl/examples/ex_ds1dll/ex_ds1dll.vcproj
./windows/hl/examples/ex_image1/ex_image1.vcproj
./windows/hl/examples/ex_image1dll/ex_image1dll.vcproj
./windows/hl/examples/ex_image2/ex_image2.vcproj
./windows/hl/examples/ex_image2dll/ex_image2dll.vcproj
./windows/hl/examples/ex_lite1/ex_lite1.vcproj
./windows/hl/examples/ex_lite1dll/ex_lite1dll.vcproj
./windows/hl/examples/ex_lite2/ex_lite2.vcproj
./windows/hl/examples/ex_lite2dll/ex_lite2dll.vcproj
./windows/hl/examples/ex_lite3/ex_lite3.vcproj
./windows/hl/examples/ex_lite3dll/ex_lite3dll.vcproj
./windows/hl/examples/ex_table01/ex_table01.vcproj
./windows/hl/examples/ex_table01dll/ex_table01dll.vcproj
./windows/hl/examples/ex_table02/ex_table02.vcproj
./windows/hl/examples/ex_table02dll/ex_table02dll.vcproj
./windows/hl/examples/ex_table03/ex_table03.vcproj
./windows/hl/examples/ex_table03dll/ex_table03dll.vcproj
./windows/hl/examples/ex_table04/ex_table04.vcproj
./windows/hl/examples/ex_table04dll/ex_table04dll.vcproj
./windows/hl/examples/ex_table05/ex_table05.vcproj
./windows/hl/examples/ex_table05dll/ex_table05dll.vcproj
./windows/hl/examples/ex_table06/ex_table06.vcproj
./windows/hl/examples/ex_table06dll/ex_table06dll.vcproj
./windows/hl/examples/ex_table07/ex_table07.vcproj
./windows/hl/examples/ex_table07dll/ex_table07dll.vcproj
./windows/hl/examples/ex_table08/ex_table08.vcproj
./windows/hl/examples/ex_table08dll/ex_table08dll.vcproj
./windows/hl/examples/ex_table09/ex_table09.vcproj
./windows/hl/examples/ex_table09dll/ex_table09dll.vcproj
./windows/hl/examples/ex_table10/ex_table10.vcproj
./windows/hl/examples/ex_table10dll/ex_table10dll.vcproj
./windows/hl/examples/ex_table11/ex_table11.vcproj
./windows/hl/examples/ex_table11dll/ex_table11dll.vcproj
./windows/hl/examples/ex_table12/ex_table12.vcproj
./windows/hl/examples/ex_table12dll/ex_table12dll.vcproj
./windows/hl/examples/ptExampleFL/ptExampleFL.vcproj
./windows/hl/examples/ptExampleFLdll/ptExampleFLdll.vcproj
./windows/hl/examples/ptExampleVL/ptExampleVL.vcproj
./windows/hl/examples/ptExampleVLdll/ptExampleVLdll.vcproj
# High-Level Fortran Examples
./windows/hl/fortran/examples/test_hl_f90examples.BAT
./windows/hl/fortran/examples/allhlf90examples/allhlf90examples.sln
./windows/hl/fortran/examples/allhlf90examples/allhlf90examples.vcproj
./windows/hl/fortran/examples/ex_lite/ex_lite.vfproj
./windows/hl/fortran/examples/ex_litedll/ex_litedll.vfproj
# High-Level Fortran Tests
./windows/hl/fortran/test/checkhlfortrantests.bat
./windows/hl/fortran/test/hl_test_image_fortran/hl_test_image_fortran.vfproj
./windows/hl/fortran/test/hl_test_image_fortrandll/hl_test_image_fortrandll.vfproj
./windows/hl/fortran/test/hl_test_lite_fortran/hl_test_lite_fortran.vfproj
./windows/hl/fortran/test/hl_test_lite_fortrandll/hl_test_lite_fortrandll.vfproj
./windows/hl/fortran/test/hl_test_table_fortran/hl_test_table_fortran.vfproj
./windows/hl/fortran/test/hl_test_table_fortrandll/hl_test_table_fortrandll.vfproj
# High-Level Library Tests
./windows/hl/test/H5srcdir_str.h
./windows/hl/test/checkhltests.bat
./windows/hl/test/hl_test_ds/hl_test_ds.vcproj
./windows/hl/test/hl_test_dsdll/hl_test_dsdll.vcproj
./windows/hl/test/hl_test_image/hl_test_image.vcproj
./windows/hl/test/hl_test_imagedll/hl_test_imagedll.vcproj
./windows/hl/test/hl_test_lite/hl_test_lite.vcproj
./windows/hl/test/hl_test_litedll/hl_test_litedll.vcproj
./windows/hl/test/hl_test_packet/hl_test_packet.vcproj
./windows/hl/test/hl_test_packetdll/hl_test_packetdll.vcproj
./windows/hl/test/hl_test_table/hl_test_table.vcproj
./windows/hl/test/hl_test_tabledll/hl_test_tabledll.vcproj
# High-Level Tools
./windows/hl/tools/gif2h5/h52giftest.bat
./windows/hl/tools/gifconv/gif2h5.vcproj
./windows/hl/tools/gifconv/h52gif.vcproj
./windows/hl/tools/gifconvdll/gif2h5dll.vcproj
./windows/hl/tools/gifconvdll/h52gifdll.vcproj
# Misc. Projects
./windows/misc/typegen/h5fort_type_defines/h5fort_type_defines.vfproj
./windows/misc/typegen/h5fortran_detect/h5fortran_detect.vfproj
./windows/misc/typegen/h5match_types/h5match_types.vcproj
./windows/misc/typegen/h5tinit/h5tinit.vcproj
./windows/misc/typegen/h5libsettings/h5libsettings.vcproj
# Performance Tests
./windows/perform/checkperformtests.bat
./windows/perform/perf_serialdll/perf_serialdll.vcproj
./windows/perform/perf_serial/perf_serial.vcproj
# Project Files
./windows/proj/all/all.sln
./windows/proj/all/all.vcproj
./windows/proj/all_fortran/all_fortran.sln
./windows/proj/all_fortran/all_fortran.vcproj
./windows/proj/hdf5/hdf5.vcproj
./windows/proj/hdf5_cpp/hdf5_cpp.vcproj
./windows/proj/hdf5_cppdll/hdf5_cppdll.vcproj
./windows/proj/hdf5dll/hdf5dll.vcproj
./windows/proj/hdf5_f90cstub/hdf5_f90cstub.vcproj
./windows/proj/hdf5_f90cstubdll/hdf5_f90cstubdll.vcproj
./windows/proj/hdf5_fortran/hdf5_fortran.vfproj
./windows/proj/hdf5_fortrandll/hdf5_fortrandll.vfproj
./windows/proj/hdf5_hl/hdf5_hl.vcproj
./windows/proj/hdf5_hl_cpp/hdf5_hl_cpp.vcproj
./windows/proj/hdf5_hl_cppdll/hdf5_hl_cppdll.vcproj
./windows/proj/hdf5_hldll/hdf5_hldll.vcproj
./windows/proj/hdf5_hl_f90cstubdll/hdf5_hl_f90cstubdll.vcproj
./windows/proj/hdf5_hl_fortran/hdf5_hl_f90cstub.vcproj
./windows/proj/hdf5_hl_fortran/hdf5_hl_fortran.vfproj
./windows/proj/hdf5_hl_fortrandll/hdf5_hl_fortrandll.vfproj
# Visual Studio Property Sheets
./windows/proj/property_sheets/remove-posix-warnings.vsprops
# Windows-maintainted Source
./windows/src/H5pubconf.h
# Library Test Projects
./windows/test/H5srcdir_str.h
./windows/test/checktests.bat
./windows/test/testerror.bat
./windows/test/app_ref/app_ref.vcproj
./windows/test/app_refdll/app_refdll.vcproj
./windows/test/big/big.vcproj
./windows/test/bigdll/bigdll.vcproj
./windows/test/bittests/bittests.vcproj
./windows/test/bittestsdll/bittestsdll.vcproj
./windows/test/btree2/btree2.vcproj
./windows/test/btree2dll/btree2dll.vcproj
./windows/test/cache/cache.vcproj
./windows/test/cache_api/cache_api.vcproj
./windows/test/cache_apidll/cache_apidll.vcproj
./windows/test/cachedll/cachedll.vcproj
./windows/test/chunk/chunk.vcproj
./windows/test/chunk_info/chunk_info.vcproj
./windows/test/chunk_infodll/chunk_infodll.vcproj
./windows/test/chunkdll/chunkdll.vcproj
./windows/test/cmpd_dset/cmpd_dset.vcproj
./windows/test/cmpd_dsetdll/cmpd_dsetdll.vcproj
./windows/test/cross_read/cross_read.vcproj
./windows/test/cross_readdll/cross_readdll.vcproj
./windows/test/dangle/dangle.vcproj
./windows/test/dangledll/dangledll.vcproj
./windows/test/dsets/dsets.vcproj
./windows/test/dsetsdll/dsetsdll.vcproj
./windows/test/dt_arith/dt_arith.vcproj
./windows/test/dt_arithdll/dt_arithdll.vcproj
./windows/test/dtransform/dtransform.vcproj
./windows/test/dtransformdll/dtransformdll.vcproj
./windows/test/dtypes/dtypes.vcproj
./windows/test/dtypesdll/dtypesdll.vcproj
./windows/test/efc/efc.vcproj
./windows/test/efcdll/efcdll.vcproj
./windows/test/earray/earray.vcproj
./windows/test/earraydll/earraydll.vcproj
./windows/test/enum/enum.vcproj
./windows/test/enumdll/enumdll.vcproj
./windows/test/error_test/error_test.vcproj
./windows/test/error_testdll/error_testdll.vcproj
./windows/test/err_compat/err_compat.vcproj
./windows/test/err_compatdll/err_compatdll.vcproj
./windows/test/extend/extend.vcproj
./windows/test/extenddll/extenddll.vcproj
./windows/test/external/external.vcproj
./windows/test/externaldll/externaldll.vcproj
./windows/test/farray/farray.vcproj
./windows/test/farraydll/farraydll.vcproj
./windows/test/fheap/fheap.vcproj
./windows/test/fheapdll/fheapdll.vcproj
./windows/test/fillval/fillval.vcproj
./windows/test/fillvaldll/fillvaldll.vcproj
./windows/test/flush1/flush1.vcproj
./windows/test/flush1dll/flush1dll.vcproj
./windows/test/flush2/flush2.vcproj
./windows/test/flush2dll/flush2dll.vcproj
./windows/test/freespace/freespace.vcproj
./windows/test/freespacedll/freespacedll.vcproj
./windows/test/getname/getname.vcproj
./windows/test/getnamedll/getnamedll.vcproj
./windows/test/getub/getub.vcproj
./windows/test/gheap/gheap.vcproj
./windows/test/gheapdll/gheapdll.vcproj
./windows/test/hyperslab/hyperslab.vcproj
./windows/test/hyperslabdll/hyperslabdll.vcproj
./windows/test/iopipe/iopipe.vcproj
./windows/test/iopipedll/iopipedll.vcproj
./windows/test/istore/istore.vcproj
./windows/test/istoredll/istoredll.vcproj
./windows/test/lheap/lheap.vcproj
./windows/test/lheapdll/lheapdll.vcproj
./windows/test/libtest/libtest.vcproj
./windows/test/libtestdll/libtestdll.vcproj
./windows/test/links/links.vcproj
./windows/test/linksdll/linksdll.vcproj
./windows/test/mf/mf.vcproj
./windows/test/mfdll/mfdll.vcproj
./windows/test/mount/mount.vcproj
./windows/test/mountdll/mountdll.vcproj
./windows/test/mtime/mtime.vcproj
./windows/test/mtimedll/mtimedll.vcproj
./windows/test/ntypes/ntypes.vcproj
./windows/test/ntypesdll/ntypesdll.vcproj
./windows/test/objcopy/objcopy.vcproj
./windows/test/objcopydll/objcopydll.vcproj
./windows/test/ohdr/ohdr.vcproj
./windows/test/ohdrdll/ohdrdll.vcproj
./windows/test/overhead/overhead.vcproj
./windows/test/overheaddll/overheaddll.vcproj
./windows/test/pool/pool.vcproj
./windows/test/pooldll/pooldll.vcproj
./windows/test/reserved/reserved.vcproj
./windows/test/reserveddll/reserveddll.vcproj
./windows/test/set_extent/set_extent.vcproj
./windows/test/set_extentdll/set_extentdll.vcproj
./windows/test/stab/stab.vcproj
./windows/test/stabdll/stabdll.vcproj
./windows/test/tcheckversion/tcheckversion.vcproj
./windows/test/tcheckversiondll/tcheckversiondll.vcproj
./windows/test/tellub/tellub.vcproj
./windows/test/testhdf5/testhdf5.vcproj
./windows/test/testhdf5dll/testhdf5dll.vcproj
./windows/test/ttsafedll/ttsafedll.vcproj
./windows/test/unlink/unlink.vcproj
./windows/test/unlinkdll/unlinkdll.vcproj
./windows/test/vfd/vfd.vcproj
./windows/test/vfddll/vfddll.vcproj
# Library Tools
./windows/tools/checktools.bat
./windows/tools/h5copy/h5copy.vcproj
./windows/tools/h5copy/testh5copy.bat
./windows/tools/h5debug/h5debug.vcproj
./windows/tools/h5debugdll/h5debugdll.vcproj
./windows/tools/h5diff/h5diff.vcproj
./windows/tools/h5diff/testh5diff.bat
./windows/tools/h5diffdll/h5diffdll.vcproj
./windows/tools/h5dump/h5dump.vcproj
./windows/tools/h5dump/testh5dump.bat
./windows/tools/h5dump/testh5dumpxml.bat
./windows/tools/h5dumpdll/h5dumpdll.vcproj
./windows/tools/h5import/h5import.vcproj
./windows/tools/h5import/h5importtestutil.bat
./windows/tools/h5importdll/h5importdll.vcproj
./windows/tools/h5jam/h5jam.vcproj
./windows/tools/h5jam/testh5jam.bat
./windows/tools/h5ls/h5ls.vcproj
./windows/tools/h5ls/testh5ls.bat
./windows/tools/h5lsdll/h5lsdll.vcproj
./windows/tools/h5mkgrp/h5mkgrp.vcproj
./windows/tools/h5mkgrp/testh5mkgrp.bat
./windows/tools/h5repack/h5repack.vcproj
./windows/tools/h5repack/h5repack.bat
./windows/tools/h5repackdll/h5repackdll.vcproj
./windows/tools/h5repart/h5repart.vcproj
./windows/tools/h5repart/testh5repart.bat
./windows/tools/h5repartdll/h5repartdll.vcproj
./windows/tools/h5stat/h5stat.vcproj
./windows/tools/h5stat/testh5stat.bat
./windows/tools/h5statdll/h5statdll.vcproj
./windows/tools/h5unjam/h5unjam.vcproj
./windows/tools/talign/talign.vcproj
./windows/tools/taligndll/taligndll.vcproj
./windows/tools/testfiles/binread/binread.vcproj
./windows/tools/testfiles/h5difftst/h5difftst.vcproj
./windows/tools/testfiles/h5dumptst/h5dumptst.vcproj
./windows/tools/testfiles/h5importtst/h5importtst.vcproj
./windows/tools/testfiles/h5jamtst/h5jamtst.vcproj
./windows/tools/testfiles/h5repacktst/h5repacktst.vcproj
./windows/tools/testfiles/h5repart_gentest/h5repart_gentest.vcproj
./windows/tools/testfiles/h5reparttst/h5reparttst.vcproj
./windows/tools/testfiles/testh5repack_detect_szip/testh5repack_detect_szip.vcproj
./windows/tools/testfiles/testh5repack_detect_szipdll/testh5repack_detect_szipdll.vcproj
./windows/tools/toolslib/toolslib.vcproj
./windows/tools/toolslibdll/toolslibdll.vcproj

View File

@ -1,4 +1,4 @@
HDF5 version 1.9.128 currently under development
HDF5 version 1.9.132 currently under development
Please refer to the release_docs/INSTALL file for installation instructions.
------------------------------------------------------------------------------

9
aclocal.m4 vendored
View File

@ -406,15 +406,6 @@ AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
[AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
])
# Copyright (C) 1996-2012 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# AM_CONFIG_HEADER is obsolete. It has been replaced by AC_CONFIG_HEADERS.
AU_DEFUN([AM_CONFIG_HEADER], [AC_CONFIG_HEADERS($@)])
# Do all the work for Automake. -*- Autoconf -*-
# Copyright (C) 1996-2012 Free Software Foundation, Inc.

View File

@ -187,10 +187,6 @@ die "unable to read file: $RELEASE\n" unless -r $file;
my $CONFIGURE = $file;
$CONFIGURE =~ s/[^\/]*$/..\/configure.ac/;
die "unable to read file: $CONFIGURE\n" unless -r $file;
# windows/src/H5pubconf.h
my $H5PUBCONF = $file;
$H5PUBCONF =~ s/[^\/]*$/..\/windows\/src\/H5pubconf.h/;
die "unable to read file: $H5PUBCONF\n" unless -r $file;
# vms/src/h5pubconf.h
my $H5VMSPUBCONF = $file;
$H5VMSPUBCONF =~ s/[^\/]*$/..\/vms\/src\/h5pubconf.h/;
@ -242,7 +238,6 @@ if ($set) {
$README = "";
$RELEASE = "";
$CONFIGURE = "";
$H5PUBCONF = "";
$H5VMSPUBCONF = "";
$LT_VERS = "";
@newver = @curver;
@ -392,9 +387,6 @@ sub gen_h5pubconf {
close FILE;
}
# Update the Windows-maintained H5pubconf.h file
gen_h5pubconf("HDF5", $H5PUBCONF, @newver) if $H5PUBCONF;
# Update the VMS-maintained h5pubconf.h file
gen_h5pubconf("HDF5", $H5VMSPUBCONF, @newver) if $H5VMSPUBCONF;

View File

@ -64,6 +64,7 @@ $Source = "";
"int32_t" => "Is",
"unsigned" => "Iu",
"unsigned int" => "Iu",
"uint32_t" => "Iu",
"H5I_type_t" => "It",
"H5G_link_t" => "Ll", #Same as H5L_type_t now
"H5L_type_t" => "Ll",

View File

@ -1,6 +1,11 @@
cmake_minimum_required (VERSION 2.8.6)
PROJECT (HDF5_CPP)
#-----------------------------------------------------------------------------
# Apply Definitions to compiler in this directory and below
#-----------------------------------------------------------------------------
ADD_DEFINITIONS (${HDF5_EXTRA_C_FLAGS})
#-----------------------------------------------------------------------------
# Shared/Static Libs
#-----------------------------------------------------------------------------

View File

@ -40,6 +40,7 @@ SET (CPP_SRCS
${HDF5_CPP_SRC_SOURCE_DIR}/H5IdComponent.cpp
${HDF5_CPP_SRC_SOURCE_DIR}/H5IntType.cpp
${HDF5_CPP_SRC_SOURCE_DIR}/H5Library.cpp
${HDF5_CPP_SRC_SOURCE_DIR}/H5Location.cpp
${HDF5_CPP_SRC_SOURCE_DIR}/H5Object.cpp
${HDF5_CPP_SRC_SOURCE_DIR}/H5PredType.cpp
${HDF5_CPP_SRC_SOURCE_DIR}/H5PropList.cpp
@ -74,6 +75,7 @@ SET (CPP_HDRS
${HDF5_CPP_SRC_SOURCE_DIR}/H5Include.h
${HDF5_CPP_SRC_SOURCE_DIR}/H5IntType.h
${HDF5_CPP_SRC_SOURCE_DIR}/H5Library.h
${HDF5_CPP_SRC_SOURCE_DIR}/H5Location.h
${HDF5_CPP_SRC_SOURCE_DIR}/H5Object.h
${HDF5_CPP_SRC_SOURCE_DIR}/H5PredType.h
${HDF5_CPP_SRC_SOURCE_DIR}/H5PropList.h

View File

@ -25,11 +25,6 @@
#include "H5CommonFG.h"
#include "H5Alltypes.h"
#include <iostream> // remove when done
using std::cerr;
using std::endl;
#ifndef H5_NO_NAMESPACE
namespace H5 {
#endif

View File

@ -65,7 +65,7 @@ class H5_DLLCPP AbstractDs {
// dataset - pure virtual.
virtual hsize_t getStorageSize() const = 0;
// Returns this class name
///\brief Returns this class name.
virtual H5std_string fromClass() const = 0;
// Copy constructor

View File

@ -36,7 +36,7 @@ class H5_DLLCPP ArrayType : public DataType {
// Returns the sizes of dimensions of this array datatype.
int getArrayDims(hsize_t* dims);
// Returns this class name
///\brief Returns this class name.
virtual H5std_string fromClass () const { return("ArrayType"); }
// Copy constructor: makes copy of the original object.

View File

@ -57,7 +57,7 @@ class H5_DLLCPP AtomType : public DataType {
// Sets the total size for an atomic datatype.
void setSize( size_t size ) const;
// Returns this class name
///\brief Returns this class name.
virtual H5std_string fromClass () const { return("AtomType"); }
// Copy constructor - makes copy of the original object

View File

@ -384,6 +384,31 @@ hsize_t Attribute::getStorageSize() const
return (storage_size);
}
//--------------------------------------------------------------------------
// Function: Attribute::flush
///\brief Flushes all buffers associated with a file specified by
/// this attribute, 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::AttributeIException
///\par Description
/// This attribute is used to identify the file to be flushed.
// Programmer Binh-Minh Ribler - 2012
// Modification
// Sep 2012 - BMR
// Duplicated from H5Location
//--------------------------------------------------------------------------
void Attribute::flush(H5F_scope_t scope) const
{
herr_t ret_value = H5Fflush(getId(), scope);
if( ret_value < 0 )
{
throw AttributeIException("Attribute::flush", "H5Fflush failed");
}
}
//--------------------------------------------------------------------------
// Function: Attribute::getId
// Purpose: Get the id of this attribute

View File

@ -51,7 +51,11 @@ class H5_DLLCPP Attribute : public AbstractDs, public IdComponent {
void write(const DataType& mem_type, const void *buf ) const;
void write(const DataType& mem_type, const H5std_string& strg ) const;
// Returns this class name
// Flushes all buffers associated with the file specified by this
// attribute to disk
void flush( H5F_scope_t scope ) const;
///\brief Returns this class name.
virtual H5std_string fromClass () const { return("Attribute"); }
// Creates a copy of an existing attribute using the attribute id

View File

@ -22,6 +22,7 @@ namespace H5 {
#endif
class Exception;
class IdComponent;
class H5Location;
class H5Object;
class PropList;
class FileCreatPropList;

View File

@ -68,25 +68,29 @@ namespace H5 {
//--------------------------------------------------------------------------
Group CommonFG::createGroup( const char* name, size_t size_hint ) const
{
// Create group creation property list for size_hint
hid_t gcpl_id = H5Pcreate(H5P_GROUP_CREATE);
// If the creation of the property list failed, throw an exception
if( gcpl_id < 0 )
throwException("createGroup", "H5Pcreate failed");
// Group creation property list for size_hint
hid_t gcpl_id = 0;
// Set the local heap size hint
if( H5Pset_local_heap_size_hint(gcpl_id, size_hint) < 0) {
H5Pclose(gcpl_id);
throwException("createGroup", "H5Pset_local_heap_size failed");
}
if(!(size_hint == (size_t)-1 || 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");
if( H5Pset_local_heap_size_hint(gcpl_id, size_hint) < 0) {
H5Pclose(gcpl_id);
throwException("createGroup", "H5Pset_local_heap_size failed");
}
}
// 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( getLocId(), name, H5P_DEFAULT, gcpl_id, H5P_DEFAULT );
// Close the group creation property list
H5Pclose(gcpl_id);
// 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 )

View File

@ -26,12 +26,21 @@ namespace H5 {
class H5_DLLCPP CompType : public DataType {
public:
// Default constructor
CompType();
// 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
// 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 );
// 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
@ -88,18 +97,9 @@ class H5_DLLCPP CompType : public DataType {
// Recursively removes padding from within this compound datatype.
void pack() const;
// Returns this class name
///\brief Returns this class name.
virtual H5std_string fromClass () const { return("CompType"); }
// Default constructor
CompType();
// Creates a compound datatype using an existing id
CompType( const hid_t existing_id );
// Copy constructor - makes a copy of original object
CompType( const CompType& original );
// Noop destructor.
virtual ~CompType();

View File

@ -22,6 +22,7 @@
#include "H5IdComponent.h"
#include "H5DataSpace.h"
#include "H5PropList.h"
#include "H5Location.h"
#include "H5Object.h"
#include "H5AbstractDs.h"
#include "H5Attribute.h"

View File

@ -30,7 +30,7 @@
* It is assumed that the user has knowledge of the HDF5 file format
* and its components. If you are not familiar with HDF5 file format,
* and would like to find out more, please refer to the HDF5 documentation
* at http://hdf.ncsa.uiuc.edu/HDF5/doc/H5.intro.html
* at http://www.hdfgroup.org/HDF5/doc/index.html
*
* Because the HDF5 library maps very well to
* the object oriented design approach, classes in the C++ API can

View File

@ -644,54 +644,6 @@ void DataSet::fillMemBuf(void *buf, DataType& buf_type, DataSpace& space)
}
}
#ifndef H5_NO_DEPRECATED_SYMBOLS
//--------------------------------------------------------------------------
// Function: DataSet::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_LINK (0) - Object is a symbolic link.
/// \li \c H5G_GROUP (1) - Object is a group.
/// \li \c H5G_DATASET (2) - Object is a dataset.
/// \li \c H5G_TYPE (3) - Object is a named datatype
///\exception H5::DataSetIException
// Programmer Binh-Minh Ribler - May, 2004
//--------------------------------------------------------------------------
H5G_obj_t DataSet::getObjType(void *ref, H5R_type_t ref_type) const
{
try {
return(p_get_obj_type(ref, ref_type));
}
catch (IdComponentException E) {
throw DataSetIException("DataSet::getObjType", E.getDetailMsg());
}
}
#endif /* H5_NO_DEPRECATED_SYMBOLS */
//--------------------------------------------------------------------------
// Function: DataSet::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 instance
///\exception H5::DataSetIException
// Programmer Binh-Minh Ribler - May, 2004
//--------------------------------------------------------------------------
DataSpace DataSet::getRegion(void *ref, H5R_type_t ref_type) const
{
try {
DataSpace dataspace(p_get_region(ref, ref_type));
return(dataspace);
}
catch (IdComponentException E) {
throw DataSetIException("DataSet::getRegion", E.getDetailMsg());
}
}
//--------------------------------------------------------------------------
// Function: DataSet::getId
///\brief Get the id of this dataset.

View File

@ -76,15 +76,10 @@ class H5_DLLCPP DataSet : public H5Object, public AbstractDs {
// 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 );
#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;
#endif /* H5_NO_DEPRECATED_SYMBOLS */
// Retrieves a dataspace with the region pointed to selected.
DataSpace getRegion(void *ref, H5R_type_t ref_type = H5R_DATASET_REGION) const;
// Returns this class name
///\brief Returns this class name.
virtual H5std_string fromClass () const { return("DataSet"); }
// Creates a dataset by way of dereference.
@ -110,6 +105,7 @@ class H5_DLLCPP DataSet : public H5Object, public AbstractDs {
private:
hid_t id; // HDF5 dataset id
#ifndef DOXYGEN_SHOULD_SKIP_THIS
// This function contains the common code that is used by
// getTypeClass and various API functions getXxxType
// defined in AbstractDs for generic datatype and specific
@ -123,6 +119,7 @@ class H5_DLLCPP DataSet : public H5Object, public AbstractDs {
protected:
// Sets the dataset id.
virtual void p_setId(const hid_t new_id);
#endif // DOXYGEN_SHOULD_SKIP_THIS
};
#ifndef H5_NO_NAMESPACE
}

View File

@ -103,7 +103,7 @@ class H5_DLLCPP DataSpace : public IdComponent {
// Sets or resets the size of this dataspace.
void setExtentSimple( int rank, const hsize_t *current_size, const hsize_t *maximum_size = NULL ) const;
// Returns this class name
///\brief Returns this class name.
virtual H5std_string fromClass () const { return("DataSpace"); }
// Creates a DataSpace object using an existing dataspace id.

View File

@ -679,51 +679,6 @@ bool DataType::isVariableStr() const
}
}
#ifndef H5_NO_DEPRECATED_SYMBOLS
//--------------------------------------------------------------------------
// Function: DataType::getObjType
///\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
///\return Object type, which can be one of the following:
/// \li \c H5G_LINK Object is a symbolic link.
/// \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
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - May, 2004
//--------------------------------------------------------------------------
H5G_obj_t DataType::getObjType(void *ref, H5R_type_t ref_type) const
{
try {
return(p_get_obj_type(ref, ref_type));
}
catch (IdComponentException E) {
throw DataTypeIException(inMemFunc("getObjType"), E.getDetailMsg());
}
}
#endif /* H5_NO_DEPRECATED_SYMBOLS */
//--------------------------------------------------------------------------
// Function: DataType::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
///\return DataSpace instance
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - May, 2004
//--------------------------------------------------------------------------
DataSpace DataType::getRegion(void *ref, H5R_type_t ref_type) const
{
try {
DataSpace dataspace(p_get_region(ref, ref_type));
return(dataspace);
}
catch (IdComponentException E) {
throw DataTypeIException(inMemFunc("getRegion"), E.getDetailMsg());
}
}
//--------------------------------------------------------------------------
// Function: DataType::getId
// Purpose: Get the id of this attribute

View File

@ -101,15 +101,10 @@ class H5_DLLCPP DataType : public H5Object {
// Checks whether this datatype is a variable-length string.
bool isVariableStr() 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;
#endif /* H5_NO_DEPRECATED_SYMBOLS */
// Retrieves a dataspace with the region pointed to selected.
DataSpace getRegion(void *ref, H5R_type_t ref_type = H5R_DATASET_REGION) const;
// Returns this class name
///\brief Returns this class name.
virtual H5std_string fromClass () const { return("DataType"); }
// Creates a copy of an existing DataType using its id

View File

@ -107,7 +107,7 @@ class H5_DLLCPP DSetCreatPropList : public PropList {
// Sets SZIP compression method.
void setSzip(unsigned int options_mask, unsigned int pixels_per_block) const;
// Returns this class name
///\brief Returns this class name.
virtual H5std_string fromClass () const { return("DSetCreatPropList"); }
// Copy constructor: creates a copy of a DSetCreatPropList object.

View File

@ -92,7 +92,7 @@ class H5_DLLCPP DSetMemXferPropList : public PropList {
// Determines whether error-detection is enabled for dataset reads.
H5Z_EDC_t getEDCCheck();
// Returns this class name.
///\brief Returns this class name.
virtual H5std_string fromClass () const { return("DSetMemXferPropList"); }
// Copy constructor: makes a copy of a DSetMemXferPropList object.

View File

@ -57,7 +57,7 @@ class H5_DLLCPP EnumType : public DataType {
void valueOf( const char* name, void *value ) const;
void valueOf( const H5std_string& name, void *value ) const;
// Returns this class name
///\brief Returns this class name.
virtual H5std_string fromClass () const { return("EnumType"); }
// Default constructor

View File

@ -123,7 +123,7 @@ class H5_DLLCPP FileAccPropList : public PropList {
// Returns garbage collecting references setting.
unsigned getGcReferences() const;
// Returns this class name
///\brief Returns this class name.
virtual H5std_string fromClass () const { return("FileAccPropList"); }
// Copy constructor: creates a copy of a FileAccPropList object.

View File

@ -62,7 +62,7 @@ class H5_DLLCPP FileCreatPropList : public PropList {
// indexing chunked datasets.
void setIstorek( unsigned ik ) const;
// Returns this class name
///\brief Returns this class name.
virtual H5std_string fromClass () const { return("FileCreatPropList"); }
// Copy constructor: creates a copy of a FileCreatPropList object.

View File

@ -50,7 +50,7 @@ namespace H5 {
///\brief Default constructor: creates a stub H5File object.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
H5File::H5File() : IdComponent(), id(0) {}
H5File::H5File() : H5Location(), id(0) {}
//--------------------------------------------------------------------------
// Function: H5File overloaded constructor
@ -79,7 +79,7 @@ H5File::H5File() : IdComponent(), id(0) {}
/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5F.html#File-Create
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
H5File::H5File( const char* name, unsigned int flags, const FileCreatPropList& create_plist, const FileAccPropList& access_plist ) : IdComponent(0)
H5File::H5File( const char* name, unsigned int flags, const FileCreatPropList& create_plist, const FileAccPropList& access_plist ) : H5Location(0)
{
p_get_file(name, flags, create_plist, access_plist);
}
@ -97,7 +97,7 @@ H5File::H5File( const char* name, unsigned int flags, const FileCreatPropList& c
/// FileCreatPropList::DEFAULT
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
H5File::H5File( const H5std_string& name, unsigned int flags, const FileCreatPropList& create_plist, const FileAccPropList& access_plist ) : IdComponent(0)
H5File::H5File( const H5std_string& name, unsigned int flags, const FileCreatPropList& create_plist, const FileAccPropList& access_plist ) : H5Location(0)
{
p_get_file(name.c_str(), flags, create_plist, access_plist);
}
@ -140,34 +140,15 @@ void H5File::p_get_file(const char* name, unsigned int flags, const FileCreatPro
///\param original - IN: H5File instance to copy
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
H5File::H5File(const H5File& original) : IdComponent(original)
H5File::H5File(const H5File& original) : H5Location(original)
{
id = original.getId();
incRefCount(); // increment number of references to this id
}
//--------------------------------------------------------------------------
// Function: H5File::flush
///\brief Flushes all buffers associated with a file 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::FileIException
// Programmer Binh-Minh Ribler - Dec. 2005
//--------------------------------------------------------------------------
void H5File::flush(H5F_scope_t scope) const
{
herr_t ret_value = H5Fflush( id, scope );
if( ret_value < 0 )
{
throw FileIException("H5File::flush", "H5Fflush failed");
}
}
//--------------------------------------------------------------------------
// Function: H5File::isHdf5
///\brief Determines whether a file in HDF5 format.
///\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
@ -191,7 +172,7 @@ bool H5File::isHdf5(const char* name)
//--------------------------------------------------------------------------
// Function: H5File::isHdf5
///\brief This is an overloaded member function, provided for convenience.
/// It takes an \c H5std_string for \a name.
/// 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
//--------------------------------------------------------------------------
@ -269,8 +250,8 @@ void H5File::reOpen()
throw FileIException("H5File::reOpen", close_error.getDetailMsg());
}
// call C routine to reopen the file - Note: not sure about this
// does id need to be closed later? which id to be the parameter?
// 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");
@ -278,12 +259,10 @@ void H5File::reOpen()
//--------------------------------------------------------------------------
// Function: H5File::reopen
///\brief Reopens this file.
///
///\exception H5::FileIException
///\par Description
/// This function will be replaced by the above function \c reOpen
/// in future releases.
// Purpose: Reopens this file.
// Exception H5::FileIException
// Description
// This function is replaced by the above function reOpen.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void H5File::reopen()
@ -489,70 +468,6 @@ void H5File::getVFDHandle(void **file_handle) const
}
}
//--------------------------------------------------------------------------
// Function: H5File::getFileName
///\brief Gets the name of this file.
///\return File name
///\exception H5::FileIException
// Programmer Binh-Minh Ribler - Jul, 2004
//--------------------------------------------------------------------------
H5std_string H5File::getFileName() const
{
try {
return(p_get_file_name());
}
catch (IdComponentException E) {
throw FileIException("H5File::getFileName", E.getDetailMsg());
}
}
#ifndef H5_NO_DEPRECATED_SYMBOLS
//--------------------------------------------------------------------------
// Function: H5File::getObjType
///\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, valid values are:
/// \li \c H5R_OBJECT - Reference is an object reference
/// \li \c H5R_DATASET_REGION - Reference is a dataset region reference
///\return Object type, which can be one of the following:
/// \li \c H5G_LINK - Object is a symbolic link.
/// \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
///\exception H5::FileIException
// Programmer Binh-Minh Ribler - May, 2004
//--------------------------------------------------------------------------
H5G_obj_t H5File::getObjType(void *ref, H5R_type_t ref_type) const
{
try {
return(p_get_obj_type(ref, ref_type));
}
catch (IdComponentException E) {
throw FileIException("H5File::getObjType", E.getDetailMsg());
}
}
#endif /* H5_NO_DEPRECATED_SYMBOLS */
//--------------------------------------------------------------------------
// Function: H5File::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
///\return DataSpace instance
///\exception H5::FileIException
// Programmer Binh-Minh Ribler - May, 2004
//--------------------------------------------------------------------------
DataSpace H5File::getRegion(void *ref, H5R_type_t ref_type) const
{
try {
DataSpace dataspace(p_get_region(ref, ref_type));
return(dataspace);
}
catch (IdComponentException E) {
throw FileIException("H5File::getRegion", E.getDetailMsg());
}
}
//--------------------------------------------------------------------------
// Function: H5File::getFileSize
///\brief Returns the file size of the HDF5 file.
@ -574,134 +489,6 @@ hsize_t H5File::getFileSize() const
return (file_size);
}
//--------------------------------------------------------------------------
// Function: H5File::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::IdComponentException
// Programmer Binh-Minh Ribler - May, 2004
//--------------------------------------------------------------------------
void H5File::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 IdComponentException("", "H5Rcreate failed");
}
}
//--------------------------------------------------------------------------
// Function: H5File::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 - this is the default
///\exception H5::IdComponentException
// Programmer Binh-Minh Ribler - May, 2004
//--------------------------------------------------------------------------
void H5File::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 (IdComponentException E) {
throw IdComponentException("H5File::reference", E.getDetailMsg());
}
}
//--------------------------------------------------------------------------
// Function: H5File::reference
///\brief This is an overloaded function, provided for your convenience.
/// It differs from the above function in that it only creates
/// a reference to an HDF5 object, not to a dataset region.
///\param ref - IN: Reference pointer
///\param name - IN: Name of the object to be referenced - \c char pointer
///\exception H5::IdComponentException
///\par Description
// This function passes H5R_OBJECT and -1 to the protected
// function for it to pass to the C API H5Rcreate
// to create a reference to the named object.
// Programmer Binh-Minh Ribler - May, 2004
//--------------------------------------------------------------------------
void H5File::reference(void* ref, const char* name) const
{
try {
p_reference(ref, name, -1, H5R_OBJECT);
}
catch (IdComponentException E) {
throw IdComponentException("H5File::reference", E.getDetailMsg());
}
}
//--------------------------------------------------------------------------
// Function: H5File::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
// Programmer Binh-Minh Ribler - May, 2004
//--------------------------------------------------------------------------
void H5File::reference(void* ref, const H5std_string& name) const
{
reference(ref, name.c_str());
}
#ifndef H5_NO_DEPRECATED_SYMBOLS
//--------------------------------------------------------------------------
// Function: H5File::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_LINK Object is a symbolic link.
// H5G_GROUP Object is a group.
// H5G_DATASET Object is a dataset.
// H5G_TYPE Object is a named datatype
// Exception H5::IdComponentException
// Programmer Binh-Minh Ribler - May, 2004
//--------------------------------------------------------------------------
H5G_obj_t H5File::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 IdComponentException("", "H5Rget_obj_type failed");
}
return(obj_type);
}
#endif /* H5_NO_DEPRECATED_SYMBOLS */
//--------------------------------------------------------------------------
// Function: H5File::p_get_region (protected)
// Purpose Retrieves a dataspace with the region pointed to selected.
// Parameters
// ref_type - IN: Type of reference to get region of - default
// to H5R_DATASET_REGION
// ref - IN: Reference to get region of
// Return Dataspace id
// Exception H5::IdComponentException
// Programmer Binh-Minh Ribler - May, 2004
//--------------------------------------------------------------------------
hid_t H5File::p_get_region(void *ref, H5R_type_t ref_type) const
{
hid_t space_id = H5Rget_region(getId(), ref_type, ref);
if (space_id < 0)
{
throw IdComponentException("", "H5Rget_region failed");
}
return(space_id);
}
//--------------------------------------------------------------------------
// Function: H5File::getLocId
// Purpose: Get the id of this file

View File

@ -21,7 +21,7 @@
namespace H5 {
#endif
class H5_DLLCPP H5File : public IdComponent, public CommonFG {
class H5_DLLCPP H5File : public H5Location, public CommonFG {
public:
// Creates or opens an HDF5 file.
H5File( const char* name, unsigned int flags,
@ -40,18 +40,12 @@ class H5_DLLCPP H5File : public IdComponent, public CommonFG {
// Close this file.
virtual void close();
// Flushes all buffers associated with this file to disk
void flush(H5F_scope_t scope) 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 name of this file.
H5std_string getFileName() const;
// Retrieves the file size of an opened file.
hsize_t getFileSize() const;
@ -67,11 +61,6 @@ class H5_DLLCPP H5File : public IdComponent, public CommonFG {
// and datatypes) in the same file.
void getObjIDs(unsigned types, size_t max_objs, hid_t *oid_list) 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;
#endif /* H5_NO_DEPRECATED_SYMBOLS */
// Retrieves a dataspace with the region pointed to selected.
DataSpace getRegion(void *ref, H5R_type_t ref_type = H5R_DATASET_REGION) const;
@ -87,14 +76,7 @@ class H5_DLLCPP H5File : public IdComponent, public CommonFG {
void reOpen(); // added for better name
void reopen();
// Creates a reference to a named HDF5 object or to a dataset region
// in this object.
void reference(void* ref, const char* name, const DataSpace& dataspace,
H5R_type_t ref_type = H5R_DATASET_REGION) const;
void reference(void* ref, const char* name) const;
void reference(void* ref, const H5std_string& name) const;
// Returns this class name
///\brief Returns this class name.
virtual H5std_string fromClass () const { return("H5File"); }
// Throw file exception.
@ -124,17 +106,6 @@ class H5_DLLCPP H5File : public IdComponent, public CommonFG {
// 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 );
// 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;
#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;
#endif /* H5_NO_DEPRECATED_SYMBOLS */
// Retrieves a dataspace with the region pointed to selected.
hid_t p_get_region(void *ref, H5R_type_t ref_type) const;
protected:
// Sets the HDF5 file id.
virtual void p_setId(const hid_t new_id);

View File

@ -53,7 +53,7 @@ class H5_DLLCPP FloatType : public AtomType {
// Sets the mantissa normalization of a floating-point datatype.
void setNorm( H5T_norm_t norm ) const;
// Returns this class name
///\brief Returns this class name.
virtual H5std_string fromClass () const { return("FloatType"); }
// Default constructor

View File

@ -147,53 +147,6 @@ Group::Group(Attribute& attr, const void* ref, H5R_type_t ref_type) : H5Object()
}
}
#ifndef H5_NO_DEPRECATED_SYMBOLS
//--------------------------------------------------------------------------
// Function: Group::getObjType
///\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 H5G_LINK (0) - Object is a symbolic link.
/// \li \c H5G_GROUP (1) - Object is a group.
/// \li \c H5G_DATASET (2) - Object is a dataset.
/// \li \c H5G_TYPE (3) - Object is a named datatype
///\exception H5::GroupIException
// Programmer Binh-Minh Ribler - May, 2004
//--------------------------------------------------------------------------
H5G_obj_t Group::getObjType(void *ref, H5R_type_t ref_type) const
{
try {
return(p_get_obj_type(ref, ref_type));
}
catch (IdComponentException E) {
throw GroupIException("Group::getObjType", E.getDetailMsg());
}
}
#endif /* H5_NO_DEPRECATED_SYMBOLS */
//--------------------------------------------------------------------------
// Function: Group::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
///\return DataSpace instance
///\exception H5::GroupIException
// Programmer Binh-Minh Ribler - May, 2004
//--------------------------------------------------------------------------
DataSpace Group::getRegion(void *ref, H5R_type_t ref_type) const
{
try {
DataSpace dataspace(p_get_region(ref, ref_type));
return(dataspace);
}
catch (IdComponentException E) {
throw GroupIException("Group::getRegion", E.getDetailMsg());
}
}
//--------------------------------------------------------------------------
// Function: Group::getId
// Purpose: Get the id of this attribute

View File

@ -26,15 +26,10 @@ class H5_DLLCPP Group : public H5Object, public CommonFG {
// Close this group.
virtual void close();
#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;
#endif /* H5_NO_DEPRECATED_SYMBOLS */
// Retrieves a dataspace with the region pointed to selected.
DataSpace getRegion(void *ref, H5R_type_t ref_type = H5R_DATASET_REGION) const;
// Returns this class name
///\brief Returns this class name.
virtual H5std_string fromClass () const { return("Group"); }
// Throw group exception.

View File

@ -65,7 +65,7 @@ class H5_DLLCPP IdComponent {
// <class-name> is returned by fromClass().
H5std_string inMemFunc(const char* func_name) const;
// Returns this class name.
///\brief Returns this class name.
virtual H5std_string fromClass() const { return("IdComponent");}
#endif // DOXYGEN_SHOULD_SKIP_THIS

View File

@ -35,7 +35,7 @@ class H5_DLLCPP IntType : public AtomType {
// Sets the sign proprety for an integer type.
void setSign( H5T_sign_t sign ) const;
// Returns this class name
///\brief Returns this class name.
virtual H5std_string fromClass () const { return("IntType"); }
// Default constructor

669
c++/src/H5Location.cpp Normal file
View File

@ -0,0 +1,669 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Copyright by The HDF Group. *
* Copyright by the Board of Trustees of the University of Illinois. *
* All rights reserved. *
* *
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the files COPYING and Copyright.html. COPYING can be found at the root *
* of the source code distribution tree; Copyright.html can be found at the *
* root level of an installed copy of the electronic HDF5 document set and *
* is linked from the top-level documents page. It can also be found at *
* http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have *
* access to either file, you may request a copy from help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include <string>
#include "H5Include.h"
#include "H5Exception.h"
#include "H5IdComponent.h"
#include "H5PropList.h"
#include "H5Location.h"
#include "H5Object.h"
#include "H5DcreatProp.h"
#include "H5DxferProp.h"
#include "H5FaccProp.h"
#include "H5FcreatProp.h"
#include "H5CommonFG.h"
#include "H5DataType.h"
#include "H5DataSpace.h"
#include "H5AbstractDs.h"
#include "H5File.h"
#include "H5DataSet.h"
#include "H5Attribute.h"
#ifndef H5_NO_NAMESPACE
namespace H5 {
#endif
#ifndef DOXYGEN_SHOULD_SKIP_THIS
// userAttrOpWrpr simply interfaces between the user's function and the
// C library function H5Aiterate2; used to resolve the different prototype
// problem. May be moved to Iterator later.
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 );
#ifdef NO_STATIC_CAST
UserData4Aiterate* myData = (UserData4Aiterate *) op_data;
#else
UserData4Aiterate* myData = static_cast <UserData4Aiterate *> (op_data);
#endif
myData->op( *myData->location, s_attr_name, myData->opData );
return 0;
}
//--------------------------------------------------------------------------
// Function: H5Location default constructor (protected)
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
H5Location::H5Location() : IdComponent(0) {}
//--------------------------------------------------------------------------
// 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
//--------------------------------------------------------------------------
H5Location::H5Location(const hid_t object_id) : IdComponent(object_id) {}
#endif // DOXYGEN_SHOULD_SKIP_THIS
//--------------------------------------------------------------------------
// Function: H5Location copy constructor
///\brief Copy constructor: makes a copy of the original H5Location
/// instance.
///\param original - IN: H5Location instance to copy
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
H5Location::H5Location( const H5Location& original ) : IdComponent( original ) {}
//--------------------------------------------------------------------------
// Function: H5Location::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 H5Location::removeAttr, then
/// recreate it with this function.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
Attribute H5Location::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( attr_id );
return( attr );
}
else
throw AttributeIException(inMemFunc("createAttribute"), "H5Acreate2 failed");
}
//--------------------------------------------------------------------------
// Function: H5Location::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 H5Location::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 ));
}
//--------------------------------------------------------------------------
// Function: H5Location::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 H5Location::openAttribute( const char* name ) const
{
hid_t attr_id = H5Aopen(getId(), name, H5P_DEFAULT);
if( attr_id > 0 )
{
Attribute attr( attr_id );
return( attr );
}
else
{
throw AttributeIException(inMemFunc("openAttribute"), "H5Aopen failed");
}
}
//--------------------------------------------------------------------------
// Function: H5Location::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 H5Location::openAttribute( const H5std_string& name ) const
{
return( openAttribute( name.c_str()) );
}
//--------------------------------------------------------------------------
// Function: H5Location::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 H5Location::openAttribute( const unsigned int idx ) const
{
hid_t attr_id = H5Aopen_by_idx(getId(), ".", H5_INDEX_CRT_ORDER,
H5_ITER_INC, (hsize_t)idx, H5P_DEFAULT, H5P_DEFAULT);
if( attr_id > 0 )
{
Attribute attr( attr_id );
return( attr );
}
else
{
throw AttributeIException(inMemFunc("openAttribute"), "H5Aopen_by_idx failed");
}
}
//--------------------------------------------------------------------------
// Function: H5Location::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:
/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5A.html#Annot-Iterate
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
int H5Location::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 ? (hsize_t)*_idx : 0;
int ret_value = H5Aiterate2(getId(), H5_INDEX_NAME, H5_ITER_INC, &idx,
userAttrOpWrpr, (void *) userData);
// release memory
delete userData;
if( ret_value >= 0 ) {
/* Pass back update index value to calling code */
if (_idx)
*_idx = (unsigned)idx;
return( ret_value );
}
else // raise exception when H5Aiterate returns a negative value
throw AttributeIException(inMemFunc("iterateAttrs"), "H5Aiterate2 failed");
}
//--------------------------------------------------------------------------
// Function: H5Location::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 H5Location::getNumAttrs() const
{
H5O_info_t oinfo; /* Object info */
if(H5Oget_info(getId(), &oinfo) < 0)
throw AttributeIException(inMemFunc("getNumAttrs"), "H5Oget_info failed");
else
return( (int)oinfo.num_attrs );
}
//--------------------------------------------------------------------------
// Function: H5Location::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 H5Location::removeAttr( const char* name ) const
{
herr_t ret_value = H5Adelete(getId(), name);
if( ret_value < 0 )
throw AttributeIException(inMemFunc("removeAttr"), "H5Adelete failed");
}
//--------------------------------------------------------------------------
// Function: H5Location::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 H5Location::removeAttr( const H5std_string& name ) const
{
removeAttr( name.c_str() );
}
//--------------------------------------------------------------------------
// Function: H5Location::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 H5Location::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");
}
//--------------------------------------------------------------------------
// Function: H5Location::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 H5Location::renameAttr(const H5std_string& oldname, const H5std_string& newname) const
{
renameAttr (oldname.c_str(), newname.c_str());
}
//--------------------------------------------------------------------------
// 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::FileIException
///\par Description
/// This location is used to identify the file to be flushed.
// Programmer Binh-Minh Ribler - 2012
// Modification
// 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 FileIException(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::IdComponentException
// Programmer Binh-Minh Ribler - Jul, 2004
//--------------------------------------------------------------------------
H5std_string H5Location::getFileName() const
{
try {
return(p_get_file_name());
}
catch (IdComponentException E) {
throw FileIException(inMemFunc("getFileName"), E.getDetailMsg());
}
}
//--------------------------------------------------------------------------
// 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::IdComponentException
// 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("", "H5Rcreate failed");
}
}
//--------------------------------------------------------------------------
// 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. - this is the default
///\exception H5::ReferenceException
// 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("H5Location::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 only creates
/// a reference to an HDF5 object, not to a dataset region.
///\param ref - IN: Reference pointer
///\param name - IN: Name of the object to be referenced - \c char pointer
///\exception H5::ReferenceException
///\par Description
// This function passes H5R_OBJECT and -1 to the protected
// function for it to pass to the C API H5Rcreate
// to create a reference to the named object.
// Programmer Binh-Minh Ribler - May, 2004
//--------------------------------------------------------------------------
void H5Location::reference(void* ref, const char* name) const
{
try {
p_reference(ref, name, -1, H5R_OBJECT);
}
catch (ReferenceException E) {
throw ReferenceException("H5Location::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
// Programmer Binh-Minh Ribler - May, 2004
//--------------------------------------------------------------------------
void H5Location::reference(void* ref, const H5std_string& name) const
{
reference(ref, name.c_str());
}
//--------------------------------------------------------------------------
// 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
// Exception H5::ReferenceException
// Programmer Binh-Minh Ribler - Oct, 2006
// Modification
// May 2008 - BMR
// Moved from IdComponent.
//--------------------------------------------------------------------------
hid_t H5Location::p_dereference(hid_t loc_id, const void* ref, H5R_type_t ref_type)
{
hid_t temp_id;
temp_id = H5Rdereference2(loc_id, H5P_DEFAULT, ref_type, ref);
if (temp_id < 0)
{
throw ReferenceException("", "H5Rdereference failed");
}
// No failure, set id to the object
return(temp_id);
}
//--------------------------------------------------------------------------
// Function: H5Location::dereference
///\brief Dereferences a reference into an HDF5 object, given an HDF5 object.
///\param obj - IN: Object specifying the location of the referenced object
///\param ref - IN: Reference pointer
///\param ref_type - IN: Reference type
///\exception H5::ReferenceException
// Programmer Binh-Minh Ribler - Oct, 2006
// Modification
// May, 2008
// Corrected missing parameters. - BMR
//--------------------------------------------------------------------------
void H5Location::dereference(H5Object& obj, const void* ref, H5R_type_t ref_type)
{
hid_t temp_id;
try {
temp_id = p_dereference(obj.getId(), ref, ref_type);
}
catch (ReferenceException E) {
throw ReferenceException("H5Location::dereference - located by object", E.getDetailMsg());
}
p_setId(temp_id);
}
//--------------------------------------------------------------------------
// Function: H5Location::dereference
///\brief Dereferences a reference into an HDF5 object, given an HDF5 file.
///\param h5file - IN: HDF5 file specifying the location of the referenced object
///\param ref - IN: Reference pointer
///\param ref_type - IN: Reference type
///\exception H5::ReferenceException
// Programmer Binh-Minh Ribler - Oct, 2006
// Modification
// May, 2008
// Corrected missing parameters. - BMR
//--------------------------------------------------------------------------
void H5Location::dereference(H5File& h5file, const void* ref, H5R_type_t ref_type)
{
hid_t temp_id;
try {
temp_id = p_dereference(h5file.getId(), ref, ref_type);
}
catch (ReferenceException E) {
throw ReferenceException("H5Location::dereference - located by file", E.getDetailMsg());
}
p_setId(temp_id);
}
//--------------------------------------------------------------------------
// 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
///\exception H5::ReferenceException
// Programmer Binh-Minh Ribler - Oct, 2006
// Modification
// May, 2008
// Corrected missing parameters. - BMR
//--------------------------------------------------------------------------
void H5Location::dereference(Attribute& attr, const void* ref, H5R_type_t ref_type)
{
hid_t temp_id;
try {
temp_id = p_dereference(attr.getId(), ref, ref_type);
}
catch (ReferenceException E) {
throw ReferenceException("H5Location::dereference - located by attribute", E.getDetailMsg());
}
p_setId(temp_id);
}
#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 \tReference is an object reference.
/// \li \c H5R_DATASET_REGION \tReference 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 \tA failure occurs. (-1)
/// \li \c H5G_GROUP \tObject is a group.
/// \li \c H5G_DATASET \tObject is a dataset.
/// \li \c H5G_TYPE Object \tis a named datatype
/// \li \c H5G_LINK \tObject is a symbolic link.
/// \li \c H5G_UDLINK \tObject 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
//--------------------------------------------------------------------------
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("H5Location::getObjType", E.getDetailMsg());
}
}
//--------------------------------------------------------------------------
// 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
//--------------------------------------------------------------------------
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("", "H5Rget_obj_type1 failed");
}
return(obj_type);
}
#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
//--------------------------------------------------------------------------
H5O_type_t H5Location::getRefObjType(void *ref, H5R_type_t ref_type) const
{
try {
return(p_get_ref_obj_type(ref, ref_type));
}
catch (ReferenceException E) {
throw ReferenceException("H5Location::getRefObjType", E.getDetailMsg());
}
}
//--------------------------------------------------------------------------
// 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
//--------------------------------------------------------------------------
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 (obj_type == H5O_TYPE_UNKNOWN || obj_type >= H5O_TYPE_NTYPES)
{
throw ReferenceException("", "H5Rget_obj_type2 failed");
}
return(obj_type);
}
//--------------------------------------------------------------------------
// Function: H5Location::p_get_region (protected)
// Purpose Retrieves a dataspace with the region pointed to selected.
// Parameters
// ref_type - IN: Type of reference to get region of - default
// to H5R_DATASET_REGION
// ref - IN: Reference to get region of
// Return Dataspace id
// Exception H5::ReferenceException
// Programmer Binh-Minh Ribler - May, 2004
//--------------------------------------------------------------------------
hid_t H5Location::p_get_region(void *ref, H5R_type_t ref_type) const
{
hid_t space_id = H5Rget_region(getId(), ref_type, ref);
if (space_id < 0)
{
throw ReferenceException("", "H5Rget_region failed");
}
return(space_id);
}
//--------------------------------------------------------------------------
// Function: H5Location destructor
///\brief Noop destructor.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
H5Location::~H5Location() {}
#ifndef H5_NO_NAMESPACE
} // end namespace
#endif

146
c++/src/H5Location.h Normal file
View File

@ -0,0 +1,146 @@
// C++ informative line for the emacs editor: -*- C++ -*-
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Copyright by The HDF Group. *
* Copyright by the Board of Trustees of the University of Illinois. *
* All rights reserved. *
* *
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the files COPYING and Copyright.html. COPYING can be found at the root *
* of the source code distribution tree; Copyright.html can be found at the *
* root level of an installed copy of the electronic HDF5 document set and *
* is linked from the top-level documents page. It can also be found at *
* http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have *
* access to either file, you may request a copy from help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#ifndef _H5Location_H
#define _H5Location_H
#include "H5Classes.h" // constains forward class declarations
// H5Location is an abstract class. It provides a collection of wrappers
// of C functions which take location IDs. Most of these were in H5Object
// but are now moved here for H5File's access.
#ifndef H5_NO_NAMESPACE
namespace H5 {
#endif
class H5_DLLCPP H5Location; // forward declaration for UserData4Aiterate
// Define the operator function pointer for H5Aiterate().
typedef void (*attr_operator_t)( H5Location& loc/*in*/,
const H5std_string attr_name/*in*/,
void *operator_data/*in,out*/);
class UserData4Aiterate { // user data for attribute iteration
public:
attr_operator_t op;
void* opData;
H5Location* location;
};
// An H5Location can be a file, group, dataset, named datatype, or attribute.
class H5_DLLCPP H5Location : public IdComponent {
public:
// Creates an attribute for the specified object at this location
// 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 index, opens the attribute that belongs to an object at
// this location.
Attribute openAttribute( const unsigned int idx ) 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;
// Determines the number of attributes at this location.
int getNumAttrs() 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;
#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.
// Iterate user's function over the attributes at this location.
int iterateAttrs( attr_operator_t user_op, unsigned* idx = NULL, void* op_data = NULL );
// Removes the named attribute from this location.
void removeAttr( const char* name ) const;
void removeAttr( 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;
// Creates a reference to a named object or to a dataset region
// in this object.
void reference(void* ref, const char* name, const DataSpace& dataspace,
H5R_type_t ref_type = H5R_DATASET_REGION) const;
void reference(void* ref, const char* name) const;
void reference(void* ref, const H5std_string& name) const;
// Open a referenced object whose location is specified by either
// a file, an HDF5 object, or an attribute.
void dereference(H5File& h5file, const void* ref, H5R_type_t ref_type = H5R_OBJECT);
void dereference(H5Object& obj, const void* ref, H5R_type_t ref_type = H5R_OBJECT);
void dereference(Attribute& attr, const void* ref, H5R_type_t ref_type = H5R_OBJECT);
// For subclasses.
virtual hid_t getId() const = 0;
protected:
#ifndef DOXYGEN_SHOULD_SKIP_THIS
// Default constructor,
H5Location();
// Creates a copy of an existing object giving the location id.
H5Location(const hid_t loc_id);
// Copy constructor.
H5Location(const H5Location& original);
// 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);
#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;
#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 a dataspace with the region pointed to selected.
hid_t p_get_region(void *ref, H5R_type_t ref_type) const;
// Noop destructor.
virtual ~H5Location();
#endif // DOXYGEN_SHOULD_SKIP_THIS
}; /* end class H5Location */
#ifndef H5_NO_NAMESPACE
}
#endif
#endif

View File

@ -37,30 +37,11 @@ namespace H5 {
#endif
#ifndef DOXYGEN_SHOULD_SKIP_THIS
// userAttrOpWrpr simply interfaces between the user's function and the
// C library function H5Aiterate2; used to resolve the different prototype
// problem. May be moved to Iterator later.
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 );
#ifdef NO_STATIC_CAST
UserData4Aiterate* myData = (UserData4Aiterate *) op_data;
#else
UserData4Aiterate* myData = static_cast <UserData4Aiterate *> (op_data);
#endif
myData->op( *myData->object, s_attr_name, myData->opData );
return 0;
}
//--------------------------------------------------------------------------
// Function: H5Object default constructor (protected)
// Description
// The id is set by IdComponent() but subclass constructor will
// set it to a valid HDF5 id.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
H5Object::H5Object() : IdComponent(0) {}
H5Object::H5Object() : H5Location() {}
//--------------------------------------------------------------------------
// Function: H5Object overloaded constructor (protected)
@ -69,7 +50,7 @@ H5Object::H5Object() : IdComponent(0) {}
// Parameters object_id - IN: Id of an existing HDF5 object
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
H5Object::H5Object( const hid_t object_id ) : IdComponent( object_id ) {}
H5Object::H5Object( const hid_t object_id ) : H5Location( object_id ) {}
#endif // DOXYGEN_SHOULD_SKIP_THIS
@ -80,496 +61,7 @@ H5Object::H5Object( const hid_t object_id ) : IdComponent( object_id ) {}
///\param original - IN: H5Object instance to copy
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
H5Object::H5Object( const H5Object& original ) : IdComponent( original ) {}
//--------------------------------------------------------------------------
// 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
{
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( 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
//--------------------------------------------------------------------------
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 ));
}
//--------------------------------------------------------------------------
// 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
{
hid_t attr_id = H5Aopen(getId(), name, H5P_DEFAULT);
if( attr_id > 0 )
{
Attribute 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
//--------------------------------------------------------------------------
Attribute H5Object::openAttribute( const H5std_string& name ) const
{
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
//--------------------------------------------------------------------------
Attribute H5Object::openAttribute( const unsigned int idx ) const
{
hid_t attr_id = H5Aopen_by_idx(getId(), ".", H5_INDEX_CRT_ORDER,
H5_ITER_INC, (hsize_t)idx, H5P_DEFAULT, H5P_DEFAULT);
if( attr_id > 0 )
{
Attribute 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
///\par Description
/// The signature of user_op is
/// void (*)(H5::H5Object&, 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
//--------------------------------------------------------------------------
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->object = this;
// call the C library routine H5Aiterate2 to iterate the attributes
hsize_t idx = _idx ? (hsize_t)*_idx : 0;
int ret_value = H5Aiterate2(getId(), H5_INDEX_NAME, H5_ITER_INC, &idx,
userAttrOpWrpr, (void *) userData);
// release memory
delete userData;
if( ret_value >= 0 ) {
/* Pass back update index value to calling code */
if (_idx)
*_idx = (unsigned)idx;
return( ret_value );
}
else // raise exception when H5Aiterate returns a negative value
throw AttributeIException(inMemFunc("iterateAttrs"), "H5Aiterate2 failed");
}
//--------------------------------------------------------------------------
// 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 */
if(H5Oget_info(getId(), &oinfo) < 0)
throw AttributeIException(inMemFunc("getNumAttrs"), "H5Oget_info failed");
else
return( (int)oinfo.num_attrs );
}
//--------------------------------------------------------------------------
// 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
{
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
//--------------------------------------------------------------------------
void H5Object::removeAttr( const H5std_string& name ) const
{
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
//--------------------------------------------------------------------------
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");
}
//--------------------------------------------------------------------------
// 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());
}
//--------------------------------------------------------------------------
// Function: H5Object::flush
///\brief Flushes all buffers associated with a file 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::AttributeIException
///\par Description
/// This object is used to identify the file to be flushed.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void H5Object::flush(H5F_scope_t scope) const
{
herr_t ret_value = H5Fflush(getId(), scope);
if( ret_value < 0 )
{
throw FileIException(inMemFunc("flush"), "H5Fflush failed");
}
}
//--------------------------------------------------------------------------
// Function: H5Object::getFileName
///\brief Gets the name of the file, in which this HDF5 object belongs.
///\return File name
///\exception H5::IdComponentException
// Programmer Binh-Minh Ribler - Jul, 2004
//--------------------------------------------------------------------------
H5std_string H5Object::getFileName() const
{
try {
return(p_get_file_name());
}
catch (IdComponentException E) {
throw FileIException(inMemFunc("getFileName"), E.getDetailMsg());
}
}
//--------------------------------------------------------------------------
// Function: H5Object::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::IdComponentException
// Programmer Binh-Minh Ribler - May, 2004
//--------------------------------------------------------------------------
void H5Object::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 IdComponentException("", "H5Rcreate failed");
}
}
//--------------------------------------------------------------------------
// Function: H5Object::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. - this is the default
///\exception H5::IdComponentException
// Programmer Binh-Minh Ribler - May, 2004
//--------------------------------------------------------------------------
void H5Object::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 (IdComponentException E) {
throw IdComponentException("H5Object::reference", E.getDetailMsg());
}
}
//--------------------------------------------------------------------------
// Function: H5Object::reference
///\brief This is an overloaded function, provided for your convenience.
/// It differs from the above function in that it only creates
/// a reference to an HDF5 object, not to a dataset region.
///\param ref - IN: Reference pointer
///\param name - IN: Name of the object to be referenced - \c char pointer
///\exception H5::IdComponentException
///\par Description
// This function passes H5R_OBJECT and -1 to the protected
// function for it to pass to the C API H5Rcreate
// to create a reference to the named object.
// Programmer Binh-Minh Ribler - May, 2004
//--------------------------------------------------------------------------
void H5Object::reference(void* ref, const char* name) const
{
try {
p_reference(ref, name, -1, H5R_OBJECT);
}
catch (IdComponentException E) {
throw IdComponentException("H5Object::reference", E.getDetailMsg());
}
}
//--------------------------------------------------------------------------
// Function: H5Object::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
// Programmer Binh-Minh Ribler - May, 2004
//--------------------------------------------------------------------------
void H5Object::reference(void* ref, const H5std_string& name) const
{
reference(ref, name.c_str());
}
//--------------------------------------------------------------------------
// Function: H5Object::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
// Exception H5::ReferenceException
// Programmer Binh-Minh Ribler - Oct, 2006
// Modification
// May 2008 - BMR
// Moved from IdComponent.
//--------------------------------------------------------------------------
hid_t H5Object::p_dereference(hid_t loc_id, const void* ref, H5R_type_t ref_type)
{
hid_t temp_id;
temp_id = H5Rdereference2(loc_id, H5P_DEFAULT, ref_type, ref);
if (temp_id < 0)
{
throw ReferenceException("", "H5Rdereference failed");
}
// No failure, set id to the object
return(temp_id);
}
//--------------------------------------------------------------------------
// Function: H5Object::dereference
///\brief Dereferences a reference into an HDF5 object, given an HDF5 object.
///\param obj - IN: Object specifying the location of the referenced object
///\param ref - IN: Reference pointer
///\param ref_type - IN: Reference type
///\exception H5::ReferenceException
// Programmer Binh-Minh Ribler - Oct, 2006
// Modification
// May, 2008
// Corrected missing parameters. - BMR
//--------------------------------------------------------------------------
void H5Object::dereference(H5Object& obj, const void* ref, H5R_type_t ref_type)
{
hid_t temp_id;
try {
temp_id = p_dereference(obj.getId(), ref, ref_type);
}
catch (ReferenceException E) {
throw ReferenceException("H5Object::dereference - located by object", E.getDetailMsg());
}
p_setId(temp_id);
}
//--------------------------------------------------------------------------
// Function: H5Object::dereference
///\brief Dereferences a reference into an HDF5 object, given an HDF5 file.
///\param h5file - IN: HDF5 file specifying the location of the referenced object
///\param ref - IN: Reference pointer
///\param ref_type - IN: Reference type
///\exception H5::ReferenceException
// Programmer Binh-Minh Ribler - Oct, 2006
// Modification
// May, 2008
// Corrected missing parameters. - BMR
//--------------------------------------------------------------------------
void H5Object::dereference(H5File& h5file, const void* ref, H5R_type_t ref_type)
{
hid_t temp_id;
try {
temp_id = p_dereference(h5file.getId(), ref, ref_type);
}
catch (ReferenceException E) {
throw ReferenceException("H5Object::dereference - located by file", E.getDetailMsg());
}
p_setId(temp_id);
}
//--------------------------------------------------------------------------
// Function: H5Object::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
///\exception H5::ReferenceException
// Programmer Binh-Minh Ribler - Oct, 2006
// Modification
// May, 2008
// Corrected missing parameters. - BMR
//--------------------------------------------------------------------------
void H5Object::dereference(Attribute& attr, const void* ref, H5R_type_t ref_type)
{
hid_t temp_id;
try {
temp_id = p_dereference(attr.getId(), ref, ref_type);
}
catch (ReferenceException E) {
throw ReferenceException("H5Object::dereference - located by attribute", E.getDetailMsg());
}
p_setId(temp_id);
}
#ifndef H5_NO_DEPRECATED_SYMBOLS
//--------------------------------------------------------------------------
// Function: H5Object::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_LINK Object is a symbolic link.
// H5G_GROUP Object is a group.
// H5G_DATASET Object is a dataset.
// H5G_TYPE Object is a named datatype
// Exception H5::IdComponentException
// Programmer Binh-Minh Ribler - May, 2004
//--------------------------------------------------------------------------
H5G_obj_t H5Object::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 IdComponentException("", "H5Rget_obj_type failed");
}
return(obj_type);
}
#endif /* H5_NO_DEPRECATED_SYMBOLS */
//--------------------------------------------------------------------------
// Function: H5Object::p_get_region (protected)
// Purpose Retrieves a dataspace with the region pointed to selected.
// Parameters
// ref_type - IN: Type of reference to get region of - default
// to H5R_DATASET_REGION
// ref - IN: Reference to get region of
// Return Dataspace id
// Exception H5::IdComponentException
// Programmer Binh-Minh Ribler - May, 2004
//--------------------------------------------------------------------------
hid_t H5Object::p_get_region(void *ref, H5R_type_t ref_type) const
{
hid_t space_id = H5Rget_region(getId(), ref_type, ref);
if (space_id < 0)
{
throw IdComponentException("", "H5Rget_region failed");
}
return(space_id);
}
H5Object::H5Object( const H5Object& original ) : H5Location( original ) {}
//--------------------------------------------------------------------------
// Function: H5Object destructor

View File

@ -17,81 +17,29 @@
#ifndef _H5Object_H
#define _H5Object_H
#include "H5Location.h"
#include "H5Classes.h" // constains forward class declarations
// H5Object is a baseclass. It has these subclasses:
// Group, DataSet, and DataType.
// DataType, in turn, has several specific datatypes as subclasses.
// 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
#ifndef H5_NO_NAMESPACE
namespace H5 {
#endif
#ifndef DOXYGEN_SHOULD_SKIP_THIS
class H5_DLLCPP H5Object; // forward declaration for UserData4Aiterate
// Define the operator function pointer for H5Aiterate().
typedef void (*attr_operator_t)( H5Object& loc/*in*/,
const H5std_string attr_name/*in*/,
void *operator_data/*in,out*/);
class UserData4Aiterate { // user data for attribute iteration
class H5_DLLCPP H5Object : public H5Location {
public:
attr_operator_t op;
void* opData;
H5Object* object;
};
#endif // DOXYGEN_SHOULD_SKIP_THIS
// The above part is being moved into Iterator, but not completed
class H5_DLLCPP H5Object : public IdComponent {
public:
// Creates an attribute for a group, dataset, or named datatype.
// 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;
// Opens an attribute given its name.
Attribute openAttribute( const char* name ) const;
Attribute openAttribute( const H5std_string& name ) const;
// Opens an attribute given its index.
Attribute openAttribute( const unsigned int idx ) const;
// Flushes all buffers associated with this object to disk
void flush( H5F_scope_t scope ) const;
// Gets the name of the file, in which this HDF5 object belongs.
H5std_string getFileName() const;
// Determines the number of attributes attached to this object.
int getNumAttrs() 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 );
// Removes the named attribute from this object.
void removeAttr( const char* name ) const;
void removeAttr( const H5std_string& name ) const;
// Renames the 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;
// Creates a reference to a named Hdf5 object or to a dataset region
// in this object.
void reference(void* ref, const char* name, const DataSpace& dataspace,
H5R_type_t ref_type = H5R_DATASET_REGION) const;
void reference(void* ref, const char* name) const;
void reference(void* ref, const H5std_string& name) const;
// Open a referenced HDF5 object whose location is specified by either
// a file, an HDF5 object, or an attribute.
void dereference(H5File& h5file, const void* ref, H5R_type_t ref_type = H5R_OBJECT);
void dereference(H5Object& obj, const void* ref, H5R_type_t ref_type = H5R_OBJECT);
void dereference(Attribute& attr, const void* ref, H5R_type_t ref_type = H5R_OBJECT);
// Copy constructor: makes copy of an H5Object object.
H5Object(const H5Object& original);
@ -106,23 +54,6 @@ class H5_DLLCPP H5Object : public IdComponent {
// Creates a copy of an existing object giving the object id
H5Object( const hid_t object_id );
// Gets the id of the H5 file in which the given object is located.
hid_t p_get_file_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;
// Dereferences a ref into an hdf5 id.
hid_t p_dereference(hid_t loc_id, const void* ref, H5R_type_t ref_type);
#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;
#endif /* H5_NO_DEPRECATED_SYMBOLS */
// Retrieves a dataspace with the region pointed to selected.
hid_t p_get_region(void *ref, H5R_type_t ref_type) const;
#endif // DOXYGEN_SHOULD_SKIP_THIS
}; /* end class H5Object */

View File

@ -36,7 +36,7 @@ namespace H5 {
class H5_DLLCPP PredType : public AtomType {
public:
///\brief Returns this class name
///\brief Returns this class name.
virtual H5std_string fromClass () const { return("PredType"); }
// Makes a copy of the predefined type and stores the new

View File

@ -94,7 +94,7 @@ class H5_DLLCPP PropList : public IdComponent {
void removeProp(const char *name) const;
void removeProp(const H5std_string& name) const;
// Returns this class name
///\brief Returns this class name.
virtual H5std_string fromClass () const { return("PropList"); }
// Default constructor: creates a stub PropList object.

View File

@ -47,7 +47,7 @@ class H5_DLLCPP StrType : public AtomType {
// Defines the storage mechanism for character strings.
void setStrpad(H5T_str_t strpad) const;
// Returns this class name
///\brief Returns this class name.
virtual H5std_string fromClass () const { return("StrType"); }
// default constructor

View File

@ -30,7 +30,7 @@ class H5_DLLCPP VarLenType : public DataType {
// on the specified base type.
VarLenType(const DataType* base_type);
// Returns this class name
///\brief Returns this class name.
virtual H5std_string fromClass () const { return("VarLenType"); }
// Copy constructor: makes copy of the original object.

View File

@ -40,12 +40,12 @@ bin_SCRIPTS=h5c++
# Source files for the library
libhdf5_cpp_la_SOURCES=H5Exception.cpp H5IdComponent.cpp H5Library.cpp \
H5Attribute.cpp H5Object.cpp H5PropList.cpp H5FaccProp.cpp \
H5FcreatProp.cpp H5DcreatProp.cpp H5DxferProp.cpp H5DataType.cpp \
H5DataSpace.cpp H5AbstractDs.cpp H5AtomType.cpp H5PredType.cpp \
H5EnumType.cpp H5IntType.cpp H5FloatType.cpp H5StrType.cpp \
H5ArrayType.cpp H5VarLenType.cpp H5CompType.cpp H5DataSet.cpp \
H5CommonFG.cpp H5Group.cpp H5File.cpp
H5Attribute.cpp H5Location.cpp H5Object.cpp H5PropList.cpp \
H5FaccProp.cpp H5FcreatProp.cpp H5DcreatProp.cpp H5DxferProp.cpp \
H5DataType.cpp H5DataSpace.cpp H5AbstractDs.cpp H5AtomType.cpp \
H5PredType.cpp H5EnumType.cpp H5IntType.cpp H5FloatType.cpp \
H5StrType.cpp H5ArrayType.cpp H5VarLenType.cpp H5CompType.cpp \
H5DataSet.cpp H5CommonFG.cpp H5Group.cpp H5File.cpp
# HDF5 C++ library depends on HDF5 Library.
libhdf5_cpp_la_LIBADD=$(LIBHDF5)
@ -55,8 +55,9 @@ include_HEADERS=H5Cpp.h H5AbstractDs.h H5AtomType.h H5Attribute.h H5Classes.h \
H5CommonFG.h H5CompType.h H5DataSet.h H5DataSpace.h H5DataType.h \
H5DcreatProp.h H5DxferProp.h H5EnumType.h H5Exception.h H5FaccProp.h \
H5FcreatProp.h H5File.h H5FloatType.h H5Group.h H5IdComponent.h \
H5Include.h H5IntType.h H5Library.h H5Object.h H5PredType.h \
H5PropList.h H5StrType.h H5CppDoc.h H5ArrayType.h H5VarLenType.h
H5Include.h H5IntType.h H5Library.h H5Location.h H5Object.h \
H5PredType.h H5PropList.h H5StrType.h H5CppDoc.h H5ArrayType.h \
H5VarLenType.h
# h5c++ and libhdf5.settings are generated during configure. Remove only when
# distclean.

View File

@ -120,12 +120,12 @@ am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" \
LTLIBRARIES = $(lib_LTLIBRARIES)
libhdf5_cpp_la_DEPENDENCIES = $(LIBHDF5)
am_libhdf5_cpp_la_OBJECTS = H5Exception.lo H5IdComponent.lo \
H5Library.lo H5Attribute.lo H5Object.lo H5PropList.lo \
H5FaccProp.lo H5FcreatProp.lo H5DcreatProp.lo H5DxferProp.lo \
H5DataType.lo H5DataSpace.lo H5AbstractDs.lo H5AtomType.lo \
H5PredType.lo H5EnumType.lo H5IntType.lo H5FloatType.lo \
H5StrType.lo H5ArrayType.lo H5VarLenType.lo H5CompType.lo \
H5DataSet.lo H5CommonFG.lo H5Group.lo H5File.lo
H5Library.lo H5Attribute.lo H5Location.lo H5Object.lo \
H5PropList.lo H5FaccProp.lo H5FcreatProp.lo H5DcreatProp.lo \
H5DxferProp.lo H5DataType.lo H5DataSpace.lo H5AbstractDs.lo \
H5AtomType.lo H5PredType.lo H5EnumType.lo H5IntType.lo \
H5FloatType.lo H5StrType.lo H5ArrayType.lo H5VarLenType.lo \
H5CompType.lo H5DataSet.lo H5CommonFG.lo H5Group.lo H5File.lo
libhdf5_cpp_la_OBJECTS = $(am_libhdf5_cpp_la_OBJECTS)
AM_V_lt = $(am__v_lt_@AM_V@)
am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
@ -467,7 +467,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog
# Add libtool shared library version numbers to the HDF5 library
# See libtool versioning documentation online.
LT_VERS_INTERFACE = 6
LT_VERS_REVISION = 118
LT_VERS_REVISION = 122
LT_VERS_AGE = 0
# Include src directory
@ -482,12 +482,12 @@ bin_SCRIPTS = h5c++
# Source files for the library
libhdf5_cpp_la_SOURCES = H5Exception.cpp H5IdComponent.cpp H5Library.cpp \
H5Attribute.cpp H5Object.cpp H5PropList.cpp H5FaccProp.cpp \
H5FcreatProp.cpp H5DcreatProp.cpp H5DxferProp.cpp H5DataType.cpp \
H5DataSpace.cpp H5AbstractDs.cpp H5AtomType.cpp H5PredType.cpp \
H5EnumType.cpp H5IntType.cpp H5FloatType.cpp H5StrType.cpp \
H5ArrayType.cpp H5VarLenType.cpp H5CompType.cpp H5DataSet.cpp \
H5CommonFG.cpp H5Group.cpp H5File.cpp
H5Attribute.cpp H5Location.cpp H5Object.cpp H5PropList.cpp \
H5FaccProp.cpp H5FcreatProp.cpp H5DcreatProp.cpp H5DxferProp.cpp \
H5DataType.cpp H5DataSpace.cpp H5AbstractDs.cpp H5AtomType.cpp \
H5PredType.cpp H5EnumType.cpp H5IntType.cpp H5FloatType.cpp \
H5StrType.cpp H5ArrayType.cpp H5VarLenType.cpp H5CompType.cpp \
H5DataSet.cpp H5CommonFG.cpp H5Group.cpp H5File.cpp
# HDF5 C++ library depends on HDF5 Library.
@ -498,8 +498,9 @@ include_HEADERS = H5Cpp.h H5AbstractDs.h H5AtomType.h H5Attribute.h H5Classes.h
H5CommonFG.h H5CompType.h H5DataSet.h H5DataSpace.h H5DataType.h \
H5DcreatProp.h H5DxferProp.h H5EnumType.h H5Exception.h H5FaccProp.h \
H5FcreatProp.h H5File.h H5FloatType.h H5Group.h H5IdComponent.h \
H5Include.h H5IntType.h H5Library.h H5Object.h H5PredType.h \
H5PropList.h H5StrType.h H5CppDoc.h H5ArrayType.h H5VarLenType.h
H5Include.h H5IntType.h H5Library.h H5Location.h H5Object.h \
H5PredType.h H5PropList.h H5StrType.h H5CppDoc.h H5ArrayType.h \
H5VarLenType.h
# h5c++ and libhdf5.settings are generated during configure. Remove only when
@ -664,6 +665,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5IdComponent.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5IntType.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Library.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Location.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Object.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5PredType.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5PropList.Plo@am__quote@

View File

@ -61,7 +61,6 @@ const int H5Z_FILTER_BOGUS = 305;
static size_t filter_bogus(unsigned int flags, size_t cd_nelmts,
const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf);
/*-------------------------------------------------------------------------
* Function: test_create
*
@ -179,7 +178,7 @@ test_create( H5File& file)
return -1;
}
} // test_create
/*-------------------------------------------------------------------------
* Function: test_simple_io
*
@ -266,7 +265,7 @@ test_simple_io( H5File& file)
return -1;
}
} // test_simple_io
/*-------------------------------------------------------------------------
* Function: test_datasize
*
@ -337,7 +336,7 @@ test_datasize()
return -1;
}
} // test_datasize
/*-------------------------------------------------------------------------
* Function: test_tconv
*
@ -460,7 +459,6 @@ filter_bogus(unsigned int flags, size_t cd_nelmts,
return nbytes;
}
/*-------------------------------------------------------------------------
* Function: test_compression
*
@ -830,7 +828,6 @@ test_multiopen (H5File& file)
}
} // test_multiopen
/*-------------------------------------------------------------------------
* Function: test_types
*
@ -1019,7 +1016,7 @@ test_types(H5File& file)
return -1;
}
} // test_types
/*-------------------------------------------------------------------------
* Function: test_dset
*

View File

@ -100,6 +100,7 @@ void issue_fail_msg(const char* where, int line, const char* file_name,
{
//if (GetTestVerbosity()>=VERBO_HI)
{
cerr << endl;
cerr << ">>> FAILED in " << where << " at line " << line
<< " in " << file_name << " - " << message << endl << endl;
}

View File

@ -42,8 +42,13 @@
#include "h5cpputil.h" // C++ utilility header file
const H5std_string FILENAME("tattr.h5");
const H5std_string ATTR_TMP_NAME("temp_name");
const H5std_string FILE_BASIC("tattr_basic.h5");
const H5std_string FILE_COMPOUND("tattr_compound.h5");
const H5std_string FILE_SCALAR("tattr_scalar.h5");
const H5std_string FILE_MULTI("tattr_multi.h5");
const H5std_string FILE_DTYPE("tattr_dtype.h5");
const H5std_string ATTR_TMP_NAME("temp_attr_name");
const H5std_string FATTR_TMP_NAME("temp_fattr_name");
const size_t ATTR_MAX_DIMS = 7;
/* 3-D dataset with fixed dimensions */
@ -63,6 +68,10 @@ const int ATTR1_RANK = 1;
const int ATTR1_DIM1 = 3;
int attr_data1[ATTR1_DIM1]={512,-234,98123}; /* Test data for 1st attribute */
// File attribute, using the same rank and dimensions as ATTR1_NAME's
const H5std_string FATTR1_NAME("File Attr1");
const H5std_string FATTR2_NAME("File Attr2");
const H5std_string ATTR2_NAME("Attr2");
const int ATTR2_RANK = 2;
const int ATTR2_DIM1 = 2;
@ -121,7 +130,7 @@ static void test_attr_basic_write()
try {
// Create file
H5File fid1 (FILENAME, H5F_ACC_TRUNC);
H5File fid1 (FILE_BASIC, H5F_ACC_TRUNC);
// Create dataspace for dataset
DataSpace ds_space (SPACE1_RANK, dims1);
@ -136,6 +145,12 @@ static void test_attr_basic_write()
// Create dataspace for attribute
DataSpace att_space (ATTR1_RANK, dims2);
// Create a file attribute
Attribute file_attr2 = fid1.createAttribute (FATTR1_NAME, PredType::NATIVE_INT, att_space);
// Create a file attribute
Attribute file_attr1 = fid1.createAttribute (FATTR2_NAME, PredType::NATIVE_INT, att_space);
// Create an attribute for the dataset
Attribute ds_attr1 = dataset.createAttribute (ATTR1_NAME, PredType::NATIVE_INT, att_space);
@ -163,8 +178,9 @@ static void test_attr_basic_write()
if(attr_data1[i]!=read_data1[i])
TestErrPrintf("%d: attribute data different: attr_data1[%d]=%d,read_data1[%d]=%d\n",__LINE__,i,attr_data1[i],i,read_data1[i]);
// Create another attribute for this dataset
Attribute ds_attr2 = dataset.createAttribute (ATTR1A_NAME, PredType::NATIVE_INT, att_space);
// Create two more attributes for this dataset, but only write to one.
Attribute ds_attr2 = dataset.createAttribute (ATTR2_NAME, PredType::NATIVE_INT, att_space);
Attribute ds_attr3 = dataset.createAttribute (ATTR3_NAME, PredType::NATIVE_INT, att_space);
// Write attribute information
ds_attr2.write (PredType::NATIVE_INT, attr_data1a);
@ -180,6 +196,7 @@ static void test_attr_basic_write()
// Close both attributes
ds_attr1.close();
ds_attr2.close();
ds_attr3.close();
/*
* Test attribute with group
@ -240,14 +257,32 @@ static void test_attr_rename()
try {
// Open file
H5File fid1(FILENAME, H5F_ACC_RDWR);
H5File fid1(FILE_BASIC, H5F_ACC_RDWR);
// Check rename of attribute belonging to a file
// Change attribute name
fid1.renameAttr(FATTR1_NAME, FATTR_TMP_NAME);
// Open attribute again
Attribute fattr1(fid1.openAttribute(FATTR_TMP_NAME));
// Verify new attribute name
H5std_string fattr_name = fattr1.getName();
verify_val(fattr_name, FATTR_TMP_NAME, "Attribute::getName", __LINE__, __FILE__);
int num_attrs = fid1.getNumAttrs();
verify_val(num_attrs, 2, "Attribute::getNumAttrs", __LINE__, __FILE__);
// Change first file attribute back to the original name
fid1.renameAttr(FATTR_TMP_NAME, FATTR1_NAME);
// Open the dataset
DataSet dataset = fid1.openDataSet(DSET1_NAME);
// Check rename
// Check rename of attribute belonging to a dataset
// change attribute name
// Change attribute name
dataset.renameAttr(ATTR1_NAME, ATTR_TMP_NAME);
// Open attribute again
@ -269,11 +304,11 @@ static void test_attr_rename()
attr1.close();
// Open the second attribute
Attribute attr2(dataset.openAttribute(ATTR1A_NAME));
Attribute attr2(dataset.openAttribute(ATTR2_NAME));
// Verify second attribute name
H5std_string attr2_name = attr2.getName();
verify_val(attr2_name, ATTR1A_NAME, "Attribute::getName", __LINE__, __FILE__);
verify_val(attr2_name, ATTR2_NAME, "Attribute::getName", __LINE__, __FILE__);
// Read attribute information immediately, without closing attribute
attr2.read (PredType::NATIVE_INT, read_data1);
@ -311,14 +346,14 @@ static void test_attr_basic_read()
try {
// Open file
H5File fid1(FILENAME, H5F_ACC_RDWR);
H5File fid1(FILE_BASIC, H5F_ACC_RDWR);
// Open the dataset
DataSet dataset = fid1.openDataSet(DSET1_NAME);
// Verify the correct number of attributes
int num_attrs = dataset.getNumAttrs();
verify_val(num_attrs, 2, "H5Object::getNumAttrs", __LINE__, __FILE__);
verify_val(num_attrs, 3, "DataSet::getNumAttrs", __LINE__, __FILE__);
// Open an attribute for the dataset
Attribute ds_attr=dataset.openAttribute(ATTR1_NAME);
@ -378,7 +413,7 @@ static void test_attr_compound_write()
try {
// Create file
H5File fid1(FILENAME.c_str(), H5F_ACC_TRUNC);
H5File fid1(FILE_COMPOUND.c_str(), H5F_ACC_TRUNC);
// Create dataspace for dataset
hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3};
@ -442,14 +477,14 @@ static void test_attr_compound_read()
try {
// Open file
H5File fid1(FILENAME, H5F_ACC_RDWR);
H5File fid1(FILE_COMPOUND, H5F_ACC_RDWR);
// Open the dataset
DataSet dataset = fid1.openDataSet(DSET1_NAME);
// Verify the correct number of attributes
int num_attrs = dataset.getNumAttrs();
verify_val(num_attrs, 1, "H5Object::getNumAttrs", __LINE__, __FILE__);
verify_val(num_attrs, 1, "DataSet::getNumAttrs", __LINE__, __FILE__);
// Open 1st attribute for the dataset
Attribute attr = dataset.openAttribute((unsigned)0);
@ -571,7 +606,7 @@ static void test_attr_scalar_write()
try {
// Create file
H5File fid1(FILENAME, H5F_ACC_TRUNC);
H5File fid1(FILE_SCALAR, H5F_ACC_TRUNC);
// Create dataspace for dataset
hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3};
@ -625,14 +660,14 @@ static void test_attr_scalar_read()
try {
// Open file
H5File fid1(FILENAME, H5F_ACC_RDWR);
H5File fid1(FILE_SCALAR, H5F_ACC_RDWR);
// Open the dataset
DataSet dataset = fid1.openDataSet(DSET1_NAME);
// Verify the correct number of attributes
int num_attrs = dataset.getNumAttrs();
verify_val(num_attrs, 1, "H5Object::getNumAttrs", __LINE__, __FILE__);
verify_val(num_attrs, 1, "DataSet::getNumAttrs", __LINE__, __FILE__);
// Open an attribute for the dataset
Attribute ds_attr=dataset.openAttribute(ATTR5_NAME);
@ -669,7 +704,7 @@ static void test_attr_mult_write()
try {
// Create file
H5File fid1 (FILENAME, H5F_ACC_TRUNC);
H5File fid1 (FILE_MULTI, H5F_ACC_TRUNC);
// Create dataspace for dataset
hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3};
@ -746,14 +781,14 @@ static void test_attr_mult_read()
try {
// Open file
H5File fid1(FILENAME, H5F_ACC_RDWR);
H5File fid1(FILE_MULTI, H5F_ACC_RDWR);
// 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, "H5Object::getNumAttrs", __LINE__, __FILE__);
verify_val(num_attrs, 3, "DataSet::getNumAttrs", __LINE__, __FILE__);
// Open 1st attribute for the dataset
Attribute attr = dataset.openAttribute((unsigned)0);
@ -929,22 +964,42 @@ static void test_attr_mult_read()
static void test_attr_delete()
{
H5std_string attr_name; // Buffer for attribute names
int ii;
// Output message about test being performed
// Output message about test being performed
SUBTEST("Removing Attribute Function");
try {
// Open file
H5File fid1(FILENAME, H5F_ACC_RDWR);
// Open file.
H5File fid1(FILE_BASIC, H5F_ACC_RDWR);
// Get the number of file attributes
int num_attrs = fid1.getNumAttrs();
verify_val(num_attrs, 2, "H5File::getNumAttrs", __LINE__, __FILE__);
// Delete the second file attribute
fid1.removeAttr(FATTR2_NAME);
// Get the number of file attributes
num_attrs = fid1.getNumAttrs();
verify_val(num_attrs, 1, "H5File::getNumAttrs", __LINE__, __FILE__);
// Verify the name of the only file attribute left
Attribute fattr = fid1.openAttribute((unsigned)0);
H5std_string attr_name = fattr.getName();
verify_val(attr_name, FATTR1_NAME, "Attribute::getName", __LINE__, __FILE__);
fattr.close();
// Test deleting non-existing attribute
// 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, "H5Object::getNumAttrs", __LINE__, __FILE__);
num_attrs = dataset.getNumAttrs();
verify_val(num_attrs, 3, "DataSet::getNumAttrs", __LINE__, __FILE__);
// Try to delete bogus attribute, should fail.
// Try to delete bogus attribute, should fail
try {
dataset.removeAttr("Bogus");
@ -954,16 +1009,18 @@ static void test_attr_delete()
catch (AttributeIException E) // catching invalid removing attribute
{} // do nothing, exception expected
// Test deleting dataset's attributes
// Verify the correct number of attributes
num_attrs = dataset.getNumAttrs();
verify_val(num_attrs, 3, "H5Object::getNumAttrs", __LINE__, __FILE__);
verify_val(num_attrs, 3, "DataSet::getNumAttrs", __LINE__, __FILE__);
// Delete middle (2nd) attribute
dataset.removeAttr(ATTR2_NAME);
// Verify the correct number of attributes
num_attrs = dataset.getNumAttrs();
verify_val(num_attrs, 2, "H5Object::getNumAttrs", __LINE__, __FILE__);
verify_val(num_attrs, 2, "DataSet::getNumAttrs", __LINE__, __FILE__);
// Open 1st attribute for the dataset
Attribute attr = dataset.openAttribute((unsigned)0);
@ -989,9 +1046,9 @@ static void test_attr_delete()
// Verify the correct number of attributes
num_attrs = dataset.getNumAttrs();
verify_val(num_attrs, 1, "H5Object::getNumAttrs", __LINE__, __FILE__);
verify_val(num_attrs, 1, "DataSet::getNumAttrs", __LINE__, __FILE__);
// Open last (formally 3rd) attribute for the dataset
// Open the only attribute for the dataset (formally 3rd)
attr = dataset.openAttribute((unsigned)0);
// Verify Name
@ -1005,7 +1062,7 @@ static void test_attr_delete()
// Verify the correct number of attributes
num_attrs = dataset.getNumAttrs();
verify_val(num_attrs, 0, "H5Object::getNumAttrs", __LINE__, __FILE__);
verify_val(num_attrs, 0, "DataSet::getNumAttrs", __LINE__, __FILE__);
PASSED();
} // end try block
@ -1035,19 +1092,19 @@ static void test_attr_dtype_shared()
try {
// Create a file
H5File fid1(FILENAME, H5F_ACC_TRUNC);
H5File fid1(FILE_DTYPE, H5F_ACC_TRUNC);
// Close file
fid1.close();
// Get size of file
h5_stat_size_t empty_filesize; // Size of empty file
empty_filesize = h5_get_file_size(FILENAME.c_str(), H5P_DEFAULT);
empty_filesize = h5_get_file_size(FILE_DTYPE.c_str(), H5P_DEFAULT);
if (empty_filesize < 0)
TestErrPrintf("Line %d: file size wrong!\n", __LINE__);
// Open the file again
fid1.openFile(FILENAME, H5F_ACC_RDWR);
fid1.openFile(FILE_DTYPE, H5F_ACC_RDWR);
// Enclosing to work around the issue of unused variables and/or
// objects created by copy constructors stay around until end of
@ -1120,7 +1177,7 @@ static void test_attr_dtype_shared()
fid1.close();
// Open the file again
fid1.openFile(FILENAME, H5F_ACC_RDWR);
fid1.openFile(FILE_DTYPE, H5F_ACC_RDWR);
{ // Second enclosed block...
@ -1161,7 +1218,7 @@ static void test_attr_dtype_shared()
fid1.close();
// Check size of file
filesize = h5_get_file_size(FILENAME.c_str(), H5P_DEFAULT);
filesize = h5_get_file_size(FILE_DTYPE.c_str(), H5P_DEFAULT);
verify_val((long)filesize, (long)empty_filesize, "Checking file size", __LINE__, __FILE__);
PASSED();
@ -1192,7 +1249,7 @@ static void test_string_attr()
try {
// Create file
H5File fid1(FILENAME, H5F_ACC_RDWR);
H5File fid1(FILE_BASIC, H5F_ACC_RDWR);
//
// Fixed-lenth string attributes
@ -1349,6 +1406,6 @@ extern "C"
#endif
void cleanup_attr()
{
HDremove(FILENAME.c_str());
//HDremove(FILENAME.c_str());
}

View File

@ -333,6 +333,7 @@ static void test_file_open()
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__);
PASSED();
} // end of try block
@ -381,8 +382,16 @@ static void test_file_size()
hsize_t file_size = file4.getFileSize();
// Check if file size is reasonable. It's supposed to be 2KB now.
if(file_size<1*KB || file_size>4*KB)
issue_fail_msg("test_file_size()", __LINE__, __FILE__);
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();
// 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();
} // end of try block
@ -415,7 +424,8 @@ const int NX = 4;
const int NY = 5;
const H5std_string GROUPNAME ("group");
const H5std_string DSETNAME ("dataset");
const H5std_string ATTRNAME ("attribute");
const H5std_string DATTRNAME ("dataset attribute");
const H5std_string FATTRNAME ("file attribute");
const H5std_string DTYPENAME ("compound");
// Compound datatype
@ -431,17 +441,17 @@ static void test_file_name()
H5std_string file_name;
try {
// Create a file using default properties.
// Create a file using default properties
H5File file4(FILE4, H5F_ACC_TRUNC);
// Get file name from the file instance.
// Get file name from the file instance
file_name = file4.getFileName();
verify_val(file_name, FILE4, "H5File::getFileName", __LINE__, __FILE__);
// Create a group in the root group
Group group(file4.createGroup(GROUPNAME, 0));
// Get and verify file name
// Get and verify file name via a group
file_name = group.getFileName();
verify_val(file_name, FILE4, "Group::getFileName", __LINE__, __FILE__);
@ -452,12 +462,12 @@ static void test_file_name()
// Create a new dataset
DataSet dataset(file4.createDataSet (DSETNAME, PredType::NATIVE_INT, space));
// Get and verify file name
// 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(ATTRNAME, PredType::NATIVE_INT, space));
Attribute attr(dataset.createAttribute(DATTRNAME, PredType::NATIVE_INT, space));
// Get and verify file name
file_name = attr.getFileName();
@ -485,6 +495,116 @@ static void test_file_name()
} // test_file_name()
#define NUM_OBJS 4
#define NUM_ATTRS 3
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()
{
int rdata[ATTR1_DIM1];
int i;
// Output message about test being performed
SUBTEST("File Attribute");
H5std_string file_name;
try {
// Create a file using default properties.
H5File file5(FILE5, H5F_ACC_TRUNC);
// 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));
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
// 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));
// Write data to the second file attribute
dattr.write(PredType::NATIVE_INT, dattr_data);
// 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));
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 << "element [" << i << "] is " << rdata[i] <<
"but should have been " << dattr_data[i] << endl;
}
}
PASSED();
} // end of try block
catch (Exception E) {
issue_fail_msg("test_file_name()", __LINE__, __FILE__, E.getCDetailMsg());
}
} // test_file_attribute()
/*-------------------------------------------------------------------------
* Function: test_file
@ -513,6 +633,7 @@ void test_file()
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_file()

View File

@ -188,7 +188,7 @@ static void test_h5s_basic()
* 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.
*/
const char *testfile = H5_get_srcdir_filename(TESTFILE.c_str());
const char *testfile = H5_get_srcdir_filename(TESTFILE.c_str());
// Create file
H5File fid1(testfile, H5F_ACC_RDONLY);

View File

@ -149,34 +149,25 @@ static void test_reference_obj(void)
// Create a dataset
dataset = file1->createDataSet("Dataset3", PredType::STD_REF_OBJ, sid1);
// Create reference to dataset
// 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__);
#ifndef H5_NO_DEPRECATED_SYMBOLS
H5G_obj_t obj_type = dataset.getObjType(&wbuf[0], H5R_OBJECT);
verify_val(obj_type, H5G_DATASET, "DataSet::getObjType", __LINE__, __FILE__);
#endif /* H5_NO_DEPRECATED_SYMBOLS */
// Create reference to dataset
// Create reference to dataset and test getRefObjType
file1->reference(&wbuf[1], "/Group1/Dataset2");
#ifndef H5_NO_DEPRECATED_SYMBOLS
obj_type = dataset.getObjType(&wbuf[1], H5R_OBJECT);
verify_val(obj_type, H5G_DATASET, "DataSet::getObjType", __LINE__, __FILE__);
#endif /* H5_NO_DEPRECATED_SYMBOLS */
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");
#ifndef H5_NO_DEPRECATED_SYMBOLS
obj_type = dataset.getObjType(&wbuf[2], H5R_OBJECT);
verify_val(obj_type, H5G_GROUP, "DataSet::getObjType", __LINE__, __FILE__);
#endif /* H5_NO_DEPRECATED_SYMBOLS */
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");
#ifndef H5_NO_DEPRECATED_SYMBOLS
obj_type = dataset.getObjType(&wbuf[3], H5R_OBJECT);
verify_val(obj_type, H5G_TYPE, "DataSet::getObjType", __LINE__, __FILE__);
#endif /* H5_NO_DEPRECATED_SYMBOLS */
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);
@ -253,7 +244,7 @@ static void test_reference_obj(void)
// Test getting the type of objects
// Test getObjTypeByIdx(hsize_t idx)
obj_type = group.getObjTypeByIdx(0);
H5G_obj_t obj_type = group.getObjTypeByIdx(0);
verify_val(obj_type, H5G_DATASET, "Group::getObjTypeByIdx(index)", __LINE__, __FILE__);
// Test getObjTypeByIdx(hsize_t idx, char* type_name)
@ -331,6 +322,18 @@ static void test_reference_obj(void)
delete file1;
} // test_reference_obj()
/****************************************************************
**
** test_reference_compat(): Test basic object reference functionality.
** Tests references to various kinds of objects using deprecated API.
**
****************************************************************/
static void test_reference_compat(void)
{
// Not yet
} // test_reference_compat()
/****************************************************************
**
** test_reference(): Main reference testing routine.
@ -346,6 +349,7 @@ void test_reference(void)
MESSAGE(5, ("Testing References\n"));
test_reference_obj(); // Test basic object reference functionality
test_reference_compat(); // Tests deprecated reference routines (not yet)
} // test_reference()

View File

@ -28,6 +28,22 @@ fi
# Figure out compiler flags
. $srcdir/config/gnu-flags
# temp patch: if GCC 4.2.1 is used in Lion or Mountain Lion systems, do not
# use -O option as it causes failures in test/dt_arith.
#echo host_os=$host_os
case "$host_os" in
darwin1[12].*) # lion & mountain lion
#echo cc_vendor=$cc_vendor'-'cc_version=$cc_version
case "$cc_vendor-$cc_version" in
gcc-4.2.1)
# Remove any -O flags
#echo PROD_CFLAGS=$PROD_CFLAGS
PROD_CFLAGS="`echo $PROD_CFLAGS | sed -e 's/-O[0-3]*//'`"
#echo new PROD_CFLAGS=$PROD_CFLAGS
;;
esac
;;
esac
. $srcdir/config/intel-flags
if test "X-" = "X-$FC"; then

View File

@ -413,6 +413,7 @@ CHECK_INCLUDE_FILE_CONCAT ("netinet/in.h" H5_HAVE_NETINET_IN_H)
# The linux-lfs option is deprecated.
SET (LINUX_LFS 0)
SET (HDF5_EXTRA_C_FLAGS)
SET (HDF5_EXTRA_FLAGS)
IF (NOT WINDOWS)
# Linux Specific flags
@ -422,7 +423,9 @@ IF (NOT WINDOWS)
# correctly.
# POSIX feature information can be found in the gcc manual at:
# http://www.gnu.org/s/libc/manual/html_node/Feature-Test-Macros.html
SET (HDF5_EXTRA_FLAGS -D_POSIX_C_SOURCE=199506L -D_BSD_SOURCE)
SET (HDF5_EXTRA_C_FLAGS -D_POSIX_C_SOURCE=199506L)
SET (HDF5_EXTRA_FLAGS -D_BSD_SOURCE)
OPTION (HDF5_ENABLE_LARGE_FILE "Enable support for large (64-bit) files on Linux." ON)
IF (HDF5_ENABLE_LARGE_FILE)
SET (msg "Performing TEST_LFS_WORKS")

View File

@ -56,12 +56,12 @@ fi
# to ensure the flag is present for both configure as well as for the build.
if test "X-" = "X-$f9x_flags_set"; then
F9XSUFFIXFLAG="-qsuffix=f=f90"
FCFLAGS="$FCFLAGS -O ${F9XSUFFIXFLAG}"
H5_FCFLAGS="$H5_FCFLAGS -O ${F9XSUFFIXFLAG}"
FCFLAGS="$FCFLAGS ${F9XSUFFIXFLAG}"
H5_FCFLAGS="$H5_FCFLAGS ${F9XSUFFIXFLAG}"
FSEARCH_DIRS="-I./ -I../src"
DEBUG_FCFLAGS="-O"
DEBUG_FCFLAGS="-g"
PROD_FCFLAGS="-O"
PROFILE_FCFLAGS="-O"
PROFILE_FCFLAGS="-g -pg"
f9x_flags_set=yes
fi

View File

@ -17,7 +17,7 @@
# Add libtool shared library version numbers to the HDF5 library
# See libtool versioning documentation online.
LT_VERS_INTERFACE = 6
LT_VERS_REVISION = 118
LT_VERS_REVISION = 122
LT_VERS_AGE = 0
## If the API changes *at all*, increment LT_VERS_INTERFACE and

1250
configure vendored

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,11 @@
cmake_minimum_required (VERSION 2.8.6)
PROJECT (HDF5_EXAMPLES)
#-----------------------------------------------------------------------------
# Apply Definitions to compiler in this directory and below
#-----------------------------------------------------------------------------
ADD_DEFINITIONS (${HDF5_EXTRA_C_FLAGS})
#-----------------------------------------------------------------------------
# Define Sources
#-----------------------------------------------------------------------------

View File

@ -9,13 +9,11 @@ items:
AUTHOR
CREATION DATE
MODIFICATION HISTORY
HISTORY
INPUTS
HISTORY
ARGUMENTS
OPTIONS
PARAMETERS
SWITCHES
OUTPUTS
SIDE EFFECTS
RESULT
RETURN VALUE
@ -41,12 +39,77 @@ items:
USED BY
PARENTS
COMMANDS
SOURCE
CONTAINS SUBROUTINES
SOURCE
INPUTS
OUTPUTS
OPTIONAL PARAMETERS
CONTAINS SUBROUTINES
FILE
Fortran2003 Interface:
Fortran90 Interface:
Fortran2003 Derived Type:
Outputs:
Inputs:
Optional parameters:
Components:
ignore items:
NAME
COPYRIGHT
SYNOPSIS
USAGE
FUNCTION
DESCRIPTION
PURPOSE
AUTHOR
CREATION DATE
MODIFICATION HISTORY
HISTORY
ARGUMENTS
OPTIONS
PARAMETERS
SWITCHES
SIDE EFFECTS
RESULT
RETURN VALUE
EXAMPLE
NOTES
DIAGNOSTICS
WARNINGS
ERRORS
BUGS
TODO
IDEAS
PORTABILITY
SEE ALSO
METHODS
NEW METHODS
ATTRIBUTES
NEW ATTRIBUTES
TAGS
DERIVED FROM
DERIVED BY
USES
CHILDREN
USED BY
PARENTS
COMMANDS
CONTAINS SUBROUTINES
FILE
item order:
Fortran90 Interface:
Fortran2003 Interface:
Inputs:
Outputs:
Optional parameters:
Fortran2003 Derived Type:
Components:
source items:
Fortran90 Interface:
Fortran2003 Interface:
Fortran2003 Derived Type:
SOURCE
headertypes:
s Subroutines robo_subroutines
options:
@ -60,14 +123,19 @@ options:
--sections
--sectionnameonly
--documenttitle "HDF5 FORTRAN Developer's Guide"
--cmode
--footless
--headless
--one_file_per_header
ignore files:
.svn
*~
*.o
*e
*.mod
accept files:
*_F90.f90
*.c
accept files:
*_F03.f90
*_F90.f90
*.f90
*.h

View File

@ -300,3 +300,40 @@ nh5pget_fapl_mpiposix_c(hid_t_f *prp_id, int_f* comm, int_f* flag)
ret_value = 0;
return ret_value;
}
/****if* H5Pf/h5pget_mpio_actual_io_mode_c
* NAME
* h5pget_mpio_actual_io_mode_c
* PURPOSE
* Calls H5Pget_mpio_actual_io_mode
*
* INPUTS
* dxpl_id - Dataset transfer property list identifier.
* OUTPUTS
* actual_io_mode - The type of I/O performed by this process.
*
* RETURNS
* 0 on success, -1 on failure
* AUTHOR
* M. Scot Breitenfeld
* July 27, 2012
* SOURCE
*/
int_f
nh5pget_mpio_actual_io_mode_c(hid_t_f *dxpl_id, int_f *actual_io_mode)
/******/
{
int ret_value = -1;
H5D_mpio_actual_io_mode_t c_actual_io_mode;
/*
* Call H5Pget_mpio_actual_io_mode_f function.
*/
if( (H5Pget_mpio_actual_io_mode((hid_t)*dxpl_id, &c_actual_io_mode)) <0 )
return ret_value; /* error occurred */
*actual_io_mode =(int_f)c_actual_io_mode;
ret_value = 0;
return ret_value;
}

View File

@ -174,24 +174,23 @@ CONTAINS
! access property list.
!
! INPUTS
! prp_id - file access property list identifier
! comm - MPI-2 communicator
! use_gpfs - logical flag to use the GPFS hints
! prp_id - File access property list identifier.
! comm - MPI-2 communicator.
! use_gpfs - Logical flag to use the GPFS hints.
! OUTPUTS
! hdferr - Returns 0 if successful and -1 if fails
! hdferr - Returns 0 if successful and -1 if fails.
!
! AUTHOR
! Elena Pourmal
! May 6, 2003
!
! SOURCE
! Fortran90 Interface:
SUBROUTINE h5pset_fapl_mpiposix_f(prp_id, comm, use_gpfs, hdferr)
IMPLICIT NONE
INTEGER(HID_T), INTENT(IN) :: prp_id ! Property list identifier
INTEGER, INTENT(IN) :: comm ! MPI communicator to be used for file open
! as defined in MPI_FILE_OPEN of MPI-2
LOGICAL, INTENT(IN) :: use_gpfs
INTEGER, INTENT(OUT) :: hdferr ! Error code
INTEGER(HID_T), INTENT(IN) :: prp_id
INTEGER, INTENT(IN) :: comm
LOGICAL, INTENT(IN) :: use_gpfs
INTEGER, INTENT(OUT) :: hdferr
!*****
INTEGER :: flag
INTEGER, EXTERNAL :: h5pset_fapl_mpiposix_c
@ -209,22 +208,22 @@ CONTAINS
! Returns MPI communicator information.
!
! INPUTS
! prp_id - file access property list identifier
! prp_id - File access property list identifier.
! OUTPUTS
! comm - MPI-2 communicator
! use_gpfs - flag to use GPFS hints
! hdferr - Returns 0 if successful and -1 if fails
! comm - MPI-2 communicator.
! use_gpfs - Flag to use GPFS hints.
! hdferr - Returns 0 if successful and -1 if fails.
! AUTHOR
! Elena Pourmal
! May 6, 2003
!
! SOURCE
! Fortran90 Interface:
SUBROUTINE h5pget_fapl_mpiposix_f(prp_id, comm, use_gpfs, hdferr)
IMPLICIT NONE
INTEGER(HID_T), INTENT(IN) :: prp_id ! Property list identifier
INTEGER, INTENT(OUT) :: comm ! Buffer to return communicator
LOGICAL, INTENT(OUT) :: use_gpfs
INTEGER, INTENT(OUT) :: hdferr ! Error code
INTEGER(HID_T), INTENT(IN) :: prp_id
INTEGER, INTENT(OUT) :: comm
LOGICAL, INTENT(OUT) :: use_gpfs
INTEGER, INTENT(OUT) :: hdferr
!*****
INTEGER :: flag
@ -234,4 +233,49 @@ CONTAINS
IF (flag .EQ. 1) use_gpfs = .TRUE.
END SUBROUTINE h5pget_fapl_mpiposix_f
!****s* H5P/h5pget_mpio_actual_io_mode_f
! NAME
! h5pget_mpio_actual_io_mode_f
!
! PURPOSE
! Retrieves the type of I/O that HDF5 actually performed on the last
! parallel I/O call. This is not necessarily the type of I/O requested.
!
! INPUTS
! dxpl_id - Dataset transfer property list identifier.
! OUTPUTS
! actual_io_mode - The type of I/O performed by this process.
! hdferr - Returns 0 if successful and -1 if fails.
!
! AUTHOR
! M. Scot Breitenfeld
! July 27, 2012
!
! HISTORY
!
! Fortran90 Interface:
SUBROUTINE h5pget_mpio_actual_io_mode_f(dxpl_id, actual_io_mode, hdferr)
IMPLICIT NONE
INTEGER(HID_T), INTENT(IN) :: dxpl_id
INTEGER , INTENT(OUT) :: actual_io_mode
INTEGER , INTENT(OUT) :: hdferr
!*****
INTERFACE
INTEGER FUNCTION h5pget_mpio_actual_io_mode_c(dxpl_id, actual_io_mode)
USE H5GLOBAL
!DEC$IF DEFINED(HDF5F90_WINDOWS)
!DEC$ATTRIBUTES C,reference,decorate,alias:'H5PGET_MPIO_ACTUAL_IO_MODE_C'::h5pget_mpio_actual_io_mode_c
!DEC$ENDIF
INTEGER(HID_T), INTENT(IN) :: dxpl_id
INTEGER , INTENT(OUT) :: actual_io_mode
END FUNCTION h5pget_mpio_actual_io_mode_c
END INTERFACE
actual_io_mode = -1
hdferr = h5pget_mpio_actual_io_mode_c(dxpl_id, actual_io_mode)
END SUBROUTINE h5pget_mpio_actual_io_mode_f
END MODULE H5FDMPIO

View File

@ -927,7 +927,7 @@ CONTAINS
! Buffer to hold a comment
INTEGER, INTENT(OUT) :: hdferr ! Error code
!*****
INTEGER :: namelen ! Lenghth of the current_name string
INTEGER :: namelen ! Length of the current_name string
INTERFACE
INTEGER FUNCTION h5gget_comment_c(loc_id, name, namelen, size, buffer)

View File

@ -24,6 +24,83 @@
#include "H5f90.h"
#include "H5Eprivate.h"
int_f
fill_h5o_info_t_f(H5O_info_t Oinfo, H5O_info_t_f *object_info) {
struct tm *ts;
object_info->fileno = Oinfo.fileno;
object_info->addr = (haddr_t_f)Oinfo.addr;
object_info->type = (int_f)Oinfo.type;
object_info->rc = (int_f)Oinfo.rc;
ts = HDgmtime(&Oinfo.atime);
object_info->atime[0] = (int_f)ts->tm_year+1900; /* year starts at 1900 */
object_info->atime[1] = (int_f)ts->tm_mon+1; /* month starts at 0 in C */
object_info->atime[2] = (int_f)ts->tm_mday;
object_info->atime[3] = 0; /* time is expressed as UTC (or GMT timezone) */
object_info->atime[4] = (int_f)ts->tm_hour;
object_info->atime[5] = (int_f)ts->tm_min;
object_info->atime[6] = (int_f)ts->tm_sec;
object_info->atime[7] = -32767; /* millisecond is not available, assign it -HUGE(0) */
ts = HDgmtime(&Oinfo.btime);
object_info->btime[0] = (int_f)ts->tm_year+1900; /* year starts at 1900 */
object_info->btime[1] = (int_f)ts->tm_mon+1; /* month starts at 0 in C */
object_info->btime[2] = (int_f)ts->tm_mday;
object_info->btime[3] = 0; /* time is expressed as UTC (or GMT timezone) */
object_info->btime[4] = (int_f)ts->tm_hour;
object_info->btime[5] = (int_f)ts->tm_min;
object_info->btime[6] = (int_f)ts->tm_sec;
object_info->btime[7] = -32767; /* millisecond is not available, assign it -HUGE(0) */
ts = HDgmtime(&Oinfo.ctime);
object_info->ctime[0] = (int_f)ts->tm_year+1900; /* year starts at 1900 */
object_info->ctime[1] = (int_f)ts->tm_mon+1; /* month starts at 0 in C */
object_info->ctime[2] = (int_f)ts->tm_mday;
object_info->ctime[3] = 0; /* time is expressed as UTC (or GMT timezone) */
object_info->ctime[4] = (int_f)ts->tm_hour;
object_info->ctime[5] = (int_f)ts->tm_min;
object_info->ctime[6] = (int_f)ts->tm_sec;
object_info->ctime[7] = -32767; /* millisecond is not available, assign it -HUGE(0) */
ts = HDgmtime(&Oinfo.mtime);
object_info->mtime[0] = (int_f)ts->tm_year+1900; /* year starts at 1900 */
object_info->mtime[1] = (int_f)ts->tm_mon+1; /* month starts at 0 in C */
object_info->mtime[2] = (int_f)ts->tm_mday;
object_info->mtime[3] = 0; /* time is expressed as UTC (or GMT timezone) */
object_info->mtime[4] = (int_f)ts->tm_hour;
object_info->mtime[5] = (int_f)ts->tm_min;
object_info->mtime[6] = (int_f)ts->tm_sec;
object_info->mtime[7] = -32767; /* millisecond is not available, assign it -HUGE(0) */
object_info->num_attrs = (hsize_t_f)Oinfo.num_attrs;
object_info->hdr.version = (int_f)Oinfo.hdr.version;
object_info->hdr.nmesgs = (int_f)Oinfo.hdr.nmesgs;
object_info->hdr.nchunks = (int_f)Oinfo.hdr.nchunks;
object_info->hdr.flags = (int_f)Oinfo.hdr.flags;
object_info->hdr.space.total = (hsize_t_f)Oinfo.hdr.space.total;
object_info->hdr.space.meta = (hsize_t_f)Oinfo.hdr.space.meta;
object_info->hdr.space.mesg = (hsize_t_f)Oinfo.hdr.space.mesg;
object_info->hdr.space.free = (hsize_t_f)Oinfo.hdr.space.free;
object_info->hdr.mesg.present = Oinfo.hdr.mesg.present;
object_info->hdr.mesg.shared = Oinfo.hdr.mesg.shared;
object_info->meta_size.obj.index_size = (hsize_t_f)Oinfo.meta_size.obj.index_size;
object_info->meta_size.obj.heap_size = (hsize_t_f)Oinfo.meta_size.obj.heap_size;
return 0;
}
/****if* H5Of/h5olink_c
* NAME
* h5olink_c
@ -215,7 +292,7 @@ nh5oopen_by_addr_c (hid_t_f *loc_id, haddr_t_f *addr, hid_t_f *obj_id)
return ret_value;
}
/* ***if* H5Of/H5Oget_info_by_name_c
/****if* H5Of/H5Oget_info_by_name_c
* NAME
* H5Oget_info_by_name_c
* PURPOSE
@ -226,10 +303,7 @@ nh5oopen_by_addr_c (hid_t_f *loc_id, haddr_t_f *addr, hid_t_f *obj_id)
* namelen - Name length.
* lapl_id - Link access property list.
* OUTPUTS
* corder_valid - Indicates whether the the creation order data is valid for this attribute.
* corder - Is a positive integer containing the creation order of the attribute.
* cset - Indicates the character set used for the attributes name.
* data_size - indicates the size, in the number of characters, of the attribute.
* object_info - Buffer in which to return object information.
*
* RETURNS
* 0 on success, -1 on failure
@ -261,74 +335,100 @@ nh5oget_info_by_name_c (hid_t_f *loc_id, _fcd name, size_t_f *namelen, hid_t_f *
&Oinfo, (hid_t)*lapl_id) < 0)
HGOTO_DONE(FAIL);
object_info->fileno = Oinfo.fileno;
object_info->addr = (haddr_t_f)Oinfo.addr;
ret_value = fill_h5o_info_t_f(Oinfo,object_info);
object_info->type = (int_f)Oinfo.type;
object_info->rc = (int_f)Oinfo.rc;
done:
if(c_name)
HDfree(c_name);
return ret_value;
}
ts = HDgmtime(&Oinfo.atime);
/****if* H5Of/H5Oget_info_by_idx_c
* NAME
* H5Oget_info_by_idx_c
* PURPOSE
* Calls H5Oget_info_by_idx
* INPUTS
* loc_id - File or group identifier specifying location of group in which object is located.
* name - Name of group, relative to loc_id.
* namelen - Name length.
* lapl_id - Link access property list.
* OUTPUTS
* object_info - Buffer in which to return object information.
*
* RETURNS
* 0 on success, -1 on failure
* AUTHOR
* M. Scot Breitenfeld
* December 1, 2008
* SOURCE
*/
int_f
nh5oget_info_by_idx_c (hid_t_f *loc_id, _fcd group_name, size_t_f *namelen,
int_f *index_field, int_f *order, hsize_t_f *n, hid_t_f *lapl_id, H5O_info_t_f *object_info)
/******/
{
char *c_group_name = NULL; /* Buffer to hold C string */
int_f ret_value = 0; /* Return value */
H5O_info_t Oinfo;
H5_index_t c_index_field;
H5_iter_order_t c_order;
/*
* Convert FORTRAN name to C name
*/
if((c_group_name = HD5f2cstring( group_name, (size_t)*namelen)) == NULL)
HGOTO_DONE(FAIL);
object_info->atime[0] = (int_f)ts->tm_year+1900; /* year starts at 1900 */
object_info->atime[1] = (int_f)ts->tm_mon+1; /* month starts at 0 in C */
object_info->atime[2] = (int_f)ts->tm_mday;
object_info->atime[3] = 0; /* time is expressed as UTC (or GMT timezone) */
object_info->atime[4] = (int_f)ts->tm_hour;
object_info->atime[5] = (int_f)ts->tm_min;
object_info->atime[6] = (int_f)ts->tm_sec;
object_info->atime[7] = -32767; /* millisecond is not available, assign it -HUGE(0) */
c_index_field = (H5_index_t)*index_field;
c_order = (H5_iter_order_t)*order;
ts = HDgmtime(&Oinfo.btime);
/*
* Call H5Oinfo_by_idx function.
*/
if(H5Oget_info_by_idx((hid_t)*loc_id, c_group_name, c_index_field, c_order, (hsize_t)*n,
&Oinfo, (hid_t)*lapl_id) < 0)
HGOTO_DONE(FAIL);
object_info->btime[0] = (int_f)ts->tm_year+1900; /* year starts at 1900 */
object_info->btime[1] = (int_f)ts->tm_mon+1; /* month starts at 0 in C */
object_info->btime[2] = (int_f)ts->tm_mday;
object_info->btime[3] = 0; /* time is expressed as UTC (or GMT timezone) */
object_info->btime[4] = (int_f)ts->tm_hour;
object_info->btime[5] = (int_f)ts->tm_min;
object_info->btime[6] = (int_f)ts->tm_sec;
object_info->btime[7] = -32767; /* millisecond is not available, assign it -HUGE(0) */
ret_value = fill_h5o_info_t_f(Oinfo,object_info);
ts = HDgmtime(&Oinfo.ctime);
done:
if(c_group_name)
HDfree(c_group_name);
return ret_value;
}
object_info->ctime[0] = (int_f)ts->tm_year+1900; /* year starts at 1900 */
object_info->ctime[1] = (int_f)ts->tm_mon+1; /* month starts at 0 in C */
object_info->ctime[2] = (int_f)ts->tm_mday;
object_info->ctime[3] = 0; /* time is expressed as UTC (or GMT timezone) */
object_info->ctime[4] = (int_f)ts->tm_hour;
object_info->ctime[5] = (int_f)ts->tm_min;
object_info->ctime[6] = (int_f)ts->tm_sec;
object_info->ctime[7] = -32767; /* millisecond is not available, assign it -HUGE(0) */
/****if* H5Of/H5Oget_info_c
* NAME
* H5Oget_info_c
* PURPOSE
* Calls H5Oget_info
* INPUTS
* object_id - Identifier for target object.
* OUTPUTS
* object_info - Buffer in which to return object information.
*
* RETURNS
* 0 on success, -1 on failure
* AUTHOR
* M. Scot Breitenfeld
* May 16, 2012
* SOURCE
*/
int_f
nh5oget_info_c (hid_t_f *object_id, H5O_info_t_f *object_info)
/******/
{
int_f ret_value = 0; /* Return value */
H5O_info_t Oinfo;
/*
* Call H5Oinfo_by_name function.
*/
if(H5Oget_info((hid_t)*object_id, &Oinfo) < 0)
HGOTO_DONE(FAIL);
ts = HDgmtime(&Oinfo.mtime);
object_info->mtime[0] = (int_f)ts->tm_year+1900; /* year starts at 1900 */
object_info->mtime[1] = (int_f)ts->tm_mon+1; /* month starts at 0 in C */
object_info->mtime[2] = (int_f)ts->tm_mday;
object_info->mtime[3] = 0; /* time is expressed as UTC (or GMT timezone) */
object_info->mtime[4] = (int_f)ts->tm_hour;
object_info->mtime[5] = (int_f)ts->tm_min;
object_info->mtime[6] = (int_f)ts->tm_sec;
object_info->mtime[7] = -32767; /* millisecond is not available, assign it -HUGE(0) */
object_info->num_attrs = (hsize_t_f)Oinfo.num_attrs;
object_info->hdr.version = (int_f)Oinfo.hdr.version;
object_info->hdr.nmesgs = (int_f)Oinfo.hdr.nmesgs;
object_info->hdr.nchunks = (int_f)Oinfo.hdr.nchunks;
object_info->hdr.flags = (int_f)Oinfo.hdr.flags;
object_info->hdr.space.total = (hsize_t_f)Oinfo.hdr.space.total;
object_info->hdr.space.meta = (hsize_t_f)Oinfo.hdr.space.meta;
object_info->hdr.space.mesg = (hsize_t_f)Oinfo.hdr.space.mesg;
object_info->hdr.space.free = (hsize_t_f)Oinfo.hdr.space.free;
object_info->hdr.mesg.present = Oinfo.hdr.mesg.present;
object_info->hdr.mesg.shared = Oinfo.hdr.mesg.shared;
object_info->meta_size.obj.index_size = (hsize_t_f)Oinfo.meta_size.obj.index_size;
object_info->meta_size.obj.heap_size = (hsize_t_f)Oinfo.meta_size.obj.heap_size;
ret_value = fill_h5o_info_t_f(Oinfo,object_info);
done:
return ret_value;
@ -391,3 +491,428 @@ nh5ocopy_c (hid_t_f *src_loc_id, _fcd src_name, size_t_f *src_name_len,
return ret_value;
}
/****if* H5Of/h5ovisit_by_name_c
* NAME
* h5ovisit_by_name_c
* PURPOSE
* Calls H5Ovisit_by_name
* INPUTS
* object_id - Identifier specifying subject group
* index_type - Type of index which determines the order
* order - Order within index
* idx - Iteration position at which to start
* op - Callback function passing data regarding the link to the calling application
* op_data - User-defined pointer to data required by the application for its processing of the link
*
* OUTPUTS
* idx - Position at which an interrupted iteration may be restarted
*
* RETURNS
* >0 on success, 0< on failure
* AUTHOR
* M. Scot Breitenfeld
* May 16, 2012
* SOURCE
*/
int_f
nh5ovisit_by_name_c(hid_t_f *loc_id, _fcd object_name, size_t_f *namelen, int_f *index_type, int_f *order,
H5O_iterate_t op, void *op_data, hid_t_f *lapl_id )
/******/
{
int_f ret_value = -1; /* Return value */
herr_t func_ret_value; /* H5Linterate return value */
char *c_object_name = NULL; /* Buffer to hold C string */
/*
* Convert FORTRAN name to C name
*/
if( (c_object_name = HD5f2cstring(object_name, (size_t)*namelen)) == NULL)
HGOTO_DONE(FAIL);
/*
* Call H5Ovisit
*/
func_ret_value = H5Ovisit_by_name( (hid_t)*loc_id, c_object_name, (H5_index_t)*index_type, (H5_iter_order_t)*order,
op, op_data, (hid_t)*lapl_id);
ret_value = (int_f)func_ret_value;
done:
if(c_object_name)
HDfree(c_object_name);
return ret_value;
}
/****if* H5Of/h5odecr_refcount_c
* NAME
* h5odecr_refcount_c
* PURPOSE
* Calls H5Odecr_refcount
* INPUTS
* object_id - Object identifier.
* RETURNS
* 0 on success, -1 on failure
* AUTHOR
* M. Scot Breitenfeld
* May 16, 2012
* SOURCE
*/
int_f
nh5odecr_refcount_c (hid_t_f *object_id)
/******/
{
int_f ret_value = 0; /* Return value */
/*
* Call H5Odecr_refcount function.
*/
if((hid_t_f)H5Odecr_refcount((hid_t)*object_id) < 0)
HGOTO_DONE(FAIL);
done:
return ret_value;
}
/****if* H5Of/h5oexists_by_name_c
* NAME
* h5oexists_by_name_c
* PURPOSE
* Calls H5Oexists_by_name
* INPUTS
* loc_id - File or group identifier
* name - Attribute access property list
* namelen - Size of name
* lapl_id - Link access property list
*
* RETURNS
* link status: 0 = false, 1 = true, -1 on failure
* AUTHOR
* M. Scot Breitenfeld
* May 17, 2012
* SOURCE
*/
int_f
nh5oexists_by_name_c (hid_t_f *loc_id, _fcd name, size_t_f *namelen, hid_t_f *lapl_id)
/******/
{
char *c_name = NULL; /* Buffer to hold C string */
int_f ret_value = 0; /* Return value */
htri_t status = 0;
/*
* Convert FORTRAN name to C name
*/
if((c_name = HD5f2cstring(name, (size_t)*namelen)) == NULL)
HGOTO_DONE(FAIL);
/*
* Call H5Oopen function.
*/
if((ret_value = (int_f)H5Oexists_by_name((hid_t)*loc_id, c_name, (hid_t)*lapl_id)) < 0)
HGOTO_DONE(FAIL);
done:
if(c_name)
HDfree(c_name);
return ret_value;
}
/****if* H5Of/h5oincr_refcount_c
* NAME
* h5oincr_refcount_c
* PURPOSE
* Calls H5Oincr_refcount
* INPUTS
* object_id - Object identifier.
* RETURNS
* 0 on success, -1 on failure
* AUTHOR
* M. Scot Breitenfeld
* May 16, 2012
* SOURCE
*/
int_f
nh5oincr_refcount_c (hid_t_f *object_id)
/******/
{
int_f ret_value = 0; /* Return value */
/*
* Call H5Oincr_refcount function.
*/
if((hid_t_f)H5Oincr_refcount((hid_t)*object_id) < 0)
HGOTO_DONE(FAIL);
done:
return ret_value;
}
/****if* H5Of/h5oset_comment_c
* NAME
* h5oset_comment_c
* PURPOSE
* Calls H5Oset_comment
* INPUTS
* object_id - Identifier of the target object.
* comment - The new comment.
* commentlen - Length of the comment.
* RETURNS
* 0 on success, -1 on failure
* AUTHOR
* M. Scot Breitenfeld
* May 17, 2012
* SOURCE
*/
int_f
nh5oset_comment_c (hid_t_f *object_id, _fcd comment, size_t_f *commentlen)
/******/
{
char *c_comment = NULL; /* Buffer to hold C string */
int_f ret_value = 0; /* Return value */
/*
* Convert FORTRAN string to C string
*/
if((c_comment = HD5f2cstring(comment, (size_t)*commentlen)) == NULL)
HGOTO_DONE(FAIL);
/*
* Call H5Oset_comment function.
*/
if((hid_t_f)H5Oset_comment((hid_t)*object_id, c_comment) < 0)
HGOTO_DONE(FAIL);
done:
if(c_comment)
HDfree(c_comment);
return ret_value;
}
/****if* H5Of/h5oset_comment_by_name_c
* NAME
* h5oset_comment_by_name_c
* PURPOSE
* Calls H5Oset_comment_by_name
* INPUTS
* object_id - Identifier of the target object.
* name - Name of the object whose comment is to be set or reset,
* specified as a path relative to loc_id.
* namelen - Length of the name.
* comment - The new comment.
* commentlen - Length of the comment.
* lapl_id - Link access property list identifier.
* RETURNS
* 0 on success, -1 on failure
* AUTHOR
* M. Scot Breitenfeld
* May 17, 2012
* SOURCE
*/
int_f
nh5oset_comment_by_name_c (hid_t_f *object_id, _fcd name, size_t_f *namelen, _fcd comment, size_t_f *commentlen, hid_t_f *lapl_id)
/******/
{
char *c_comment = NULL; /* Buffer to hold C string */
char *c_name = NULL; /* Buffer to hold C string */
int_f ret_value = 0; /* Return value */
/*
* Convert FORTRAN string to C string
*/
if((c_comment = HD5f2cstring(comment, (size_t)*commentlen)) == NULL)
HGOTO_DONE(FAIL);
/*
* Convert FORTRAN string to C string
*/
if((c_name = HD5f2cstring(name, (size_t)*namelen)) == NULL)
HGOTO_DONE(FAIL);
/*
* Call H5Oset_comment_by_name function.
*/
if((hid_t_f)H5Oset_comment_by_name((hid_t)*object_id, c_name, c_comment, (hid_t)*lapl_id) < 0)
HGOTO_DONE(FAIL);
done:
if(c_name)
HDfree(c_name);
if(c_comment)
HDfree(c_comment);
return ret_value;
}
/****if* H5Of/h5oopen_by_idx_c
* NAME
* h5oopen_by_idx_c
* PURPOSE
* Calls H5Oopen_by_idx_c
* INPUTS
* loc_id - A file or group identifier.
* group_name - Name of group, relative to loc_id, in which object is located.
* group_namelen - Length of group_name
* index_type - Type of index by which objects are ordered.
* order - Order of iteration within index.
* n - Object to open.
* lapl_id - Link access property list.
* OUTPUTS
* obj_id - An object identifier for the opened object.
* RETURNS
* 0 on success, -1 on failure
* AUTHOR
* M. Scot Breitenfeld
* May 17, 2012
* SOURCE
*/
int_f
nh5oopen_by_idx_c (hid_t_f *loc_id, _fcd group_name, size_t_f *group_namelen,
int_f *index_type, int_f *order, hsize_t_f *n, hid_t_f *obj_id, hid_t_f *lapl_id)
/******/
{
char *c_group_name = NULL; /* Buffer to hold C string */
int_f ret_value = 0;
H5_index_t c_index_type;
H5_iter_order_t c_order;
/*
* Convert FORTRAN string to C string
*/
if((c_group_name = HD5f2cstring( group_name, (size_t)*group_namelen)) == NULL)
HGOTO_DONE(FAIL);
c_index_type = (H5_index_t)*index_type;
c_order = (H5_iter_order_t)*order;
/*
* Call H5Oopen_by_idx function.
*/
if((*obj_id =(hid_t_f)H5Oopen_by_idx((hid_t)*loc_id, c_group_name, c_index_type, c_order, (hsize_t)*n, (hid_t)*lapl_id)) < 0)
HGOTO_DONE(FAIL);
done:
if(c_group_name)
HDfree(c_group_name);
return ret_value;
}
/****if* H5Of/h5oget_comment_c
* NAME
* h5oget_comment_c
* PURPOSE
* Calls H5Oget_comment
* INPUTS
* object_id - Identifier for the target object.
* bufsize - Anticipated required size of the comment buffer.
* OUTPUTS
* comment - The comment.
*
* RETURNS
* 0 on success, -1 on failure
* AUTHOR
* M. Scot Breitenfeld
* June 24, 2012
* SOURCE
*/
int_f
nh5oget_comment_c (hid_t_f *object_id, _fcd comment, size_t_f *commentsize, hssize_t_f *bufsize)
/******/
{
char *c_comment = NULL; /* Buffer to hold C string */
int_f ret_value = 0; /* Return value */
size_t c_commentsize;
c_commentsize = (size_t)*commentsize + 1;
/*
* Allocate buffer to hold comment name
*/
if(NULL == (c_comment = (char *)HDmalloc(c_commentsize)))
HGOTO_DONE(FAIL);
/*
* Call H5Oget_comment function.
*/
if((*bufsize = (hssize_t_f)H5Oget_comment((hid_t)*object_id, c_comment, (size_t)*commentsize)) < 0)
HGOTO_DONE(FAIL);
/*
* Convert C name to FORTRAN and place it in the given buffer
*/
if(c_comment)
HD5packFstring(c_comment, _fcdtocp(comment), c_commentsize - 1);
return ret_value;
done:
if(c_comment)
HDfree(c_comment);
return ret_value;
}
/****if* H5Of/h5oget_comment_by_name_c
* NAME
* h5oget_comment_by_name_c
* PURPOSE
* Calls H5Oget_comment_by_name
* INPUTS
* object_id - Identifier for the target object.
* bufsize - Anticipated required size of the comment buffer.
* OUTPUTS
* comment - The comment.
*
* RETURNS
* 0 on success, -1 on failure
* AUTHOR
* M. Scot Breitenfeld
* July 6, 2012
* SOURCE
*/
int_f
nh5oget_comment_by_name_c (hid_t_f *loc_id, _fcd name, size_t_f *name_size,
_fcd comment, size_t_f *commentsize, size_t_f *bufsize, hid_t_f *lapl_id)
/******/
{
char *c_comment = NULL; /* Buffer to hold C string */
char *c_name = NULL; /* Buffer to hold C string */
int_f ret_value = 0; /* Return value */
size_t c_commentsize;
/*
* Convert FORTRAN string to C string
*/
if((c_name = HD5f2cstring(name, (size_t)*name_size)) == NULL)
HGOTO_DONE(FAIL);
c_commentsize = (size_t)*commentsize + 1;
/*
* Allocate buffer to hold comment name
*/
if(NULL == (c_comment = (char *)HDmalloc(c_commentsize)))
HGOTO_DONE(FAIL);
/*
* Call H5Oget_comment_by_name function.
*/
if((*bufsize = (size_t_f)H5Oget_comment_by_name((hid_t)*loc_id, c_name, c_comment, (size_t)*commentsize,(hid_t)*lapl_id )) < 0)
HGOTO_DONE(FAIL);
/*
* Convert C name to FORTRAN and place it in the given buffer
*/
if(c_comment)
HD5packFstring(c_comment, _fcdtocp(comment), c_commentsize - 1);
return ret_value;
done:
if(c_comment)
HDfree(c_comment);
if(c_name)
HDfree(c_name);
return ret_value;
}

View File

@ -119,15 +119,15 @@ CONTAINS
! Opens an object in an HDF5 file by location identifier and path name.
!
! Inputs:
! loc_id - File or group identifier.
! name - Path to the object, relative to loc_id.
! loc_id - File or group identifier.
! name - Path to the object, relative to loc_id.
!
! Outputs:
! obj_id - Object identifier for the opened object.
! hdferr - Returns 0 if successful and -1 if fails.
! obj_id - Object identifier for the opened object.
! hdferr - Returns 0 if successful and -1 if fails.
!
! Optional parameters:
! lapl_id - Access property list identifier for the link pointing to the object.
! lapl_id - Access property list identifier for the link pointing to the object.
!
! AUTHOR
! M. Scot Breitenfeld
@ -215,12 +215,12 @@ CONTAINS
! Opens an object using its address within an HDF5 file.
!
! Inputs:
! loc_id - File or group identifier.
! addr - Objects address in the file.
! loc_id - File or group identifier.
! addr - Objects address in the file.
!
! Outputs:
! obj_id - Object identifier for the opened object.
! hdferr - Returns 0 if successful and -1 if fails.
! obj_id - Object identifier for the opened object.
! hdferr - Returns 0 if successful and -1 if fails.
!
! AUTHOR
! M. Scot Breitenfeld
@ -321,5 +321,455 @@ CONTAINS
END SUBROUTINE h5ocopy_f
!****s* H5O/h5odecr_refcount_f
! NAME
! h5odecr_refcount_f
!
! PURPOSE
! Decrements an object reference count.
!
! Inputs:
! object_id - Object identifier.
!
! Outputs:
! hdferr - Returns 0 if successful and -1 if fails.
!
! AUTHOR
! M. Scot Breitenfeld
! May 11, 2012
!
! Fortran90 Interface:
SUBROUTINE h5odecr_refcount_f(object_id, hdferr)
IMPLICIT NONE
INTEGER(HID_T), INTENT(IN) :: object_id
INTEGER , INTENT(OUT) :: hdferr
!*****
INTERFACE
INTEGER FUNCTION h5odecr_refcount_c(object_id)
USE H5GLOBAL
!DEC$IF DEFINED(HDF5F90_WINDOWS)
!DEC$ATTRIBUTES C,reference,decorate,alias:'H5ODECR_REFCOUNT_C'::h5odecr_refcount_c
!DEC$ENDIF
INTEGER(HID_T) , INTENT(IN) :: object_id
END FUNCTION h5odecr_refcount_c
END INTERFACE
hdferr = h5odecr_refcount_c(object_id)
END SUBROUTINE h5odecr_refcount_f
!****s* H5O/h5oexists_by_name_f
! NAME
! h5oexists_by_name_f
!
! PURPOSE
! Determines whether a link resolves to an actual object.
!
! Inputs:
! loc_id - Identifier of the file or group to query.
! name - The name of the link to check.
!
!
! Optional parameters:
! lapl_id - Link access property list identifier.
!
! Outputs:
! link_exists - Existing link resolves to an object.
! hdferr - Returns 0 if successful and -1 if fails.
!
! AUTHOR
! M. Scot Breitenfeld
! May 11, 2012
!
! Fortran90 Interface:
SUBROUTINE h5oexists_by_name_f(loc_id, name, link_exists, hdferr, lapl_id)
IMPLICIT NONE
INTEGER(HID_T) , INTENT(IN) :: loc_id
CHARACTER(LEN=*), INTENT(IN) :: name
LOGICAL , INTENT(OUT) :: link_exists
INTEGER , INTENT(OUT) :: hdferr
INTEGER(HID_T) , INTENT(IN), OPTIONAL :: lapl_id
!*****
INTEGER(size_t) :: namelen
INTEGER :: status
INTEGER(HID_T) :: lapl_id_default
INTERFACE
INTEGER FUNCTION h5oexists_by_name_c(loc_id, name, namelen, lapl_id)
USE H5GLOBAL
!DEC$IF DEFINED(HDF5F90_WINDOWS)
!DEC$ATTRIBUTES C,reference,decorate,alias:'H5OEXISTS_BY_NAME_C'::h5oexists_by_name_c
!DEC$ENDIF
!DEC$ATTRIBUTES reference :: name
INTEGER(HID_T) , INTENT(IN) :: loc_id
CHARACTER(LEN=*), INTENT(IN) :: name
INTEGER(SIZE_T) , INTENT(IN) :: namelen
INTEGER(HID_T) , INTENT(IN) :: lapl_id
END FUNCTION h5oexists_by_name_c
END INTERFACE
namelen = LEN(name)
lapl_id_default = H5P_DEFAULT_F
IF(PRESENT(lapl_id)) lapl_id_default = lapl_id
status = h5oexists_by_name_c(loc_id, name, namelen, lapl_id_default)
link_exists = .FALSE.
IF(status.EQ.1)THEN
link_exists = .TRUE.
ENDIF
hdferr = 0
IF(status.LT.0)THEN
hdferr = -1
ENDIF
END SUBROUTINE h5oexists_by_name_f
!****s* H5O/h5oget_comment_f
! NAME
! h5oget_comment_f
!
! PURPOSE
! Retrieves comment for specified object.
!
! Inputs:
! obj_id - Identifier for the target object.
!
! Optional parameters:
! bufsize - Size of the comment buffer.
!
! Outputs:
! comment - The comment.
! hdferr - Returns 0 if successful and -1 if fails.
!
! AUTHOR
! M. Scot Breitenfeld
! May 11, 2012
!
! Fortran90 Interface:
SUBROUTINE h5oget_comment_f(obj_id, comment, hdferr, bufsize)
IMPLICIT NONE
INTEGER(HID_T) , INTENT(IN) :: obj_id
CHARACTER(LEN=*) , INTENT(OUT) :: comment
INTEGER , INTENT(OUT) :: hdferr
INTEGER(HSSIZE_T), INTENT(OUT), OPTIONAL :: bufsize
!*****
INTEGER(SIZE_T) :: commentsize_default
INTEGER(HSSIZE_T) :: bufsize_default
INTERFACE
INTEGER FUNCTION h5oget_comment_c(obj_id, comment, commentsize_default, bufsize)
USE H5GLOBAL
!DEC$IF DEFINED(HDF5F90_WINDOWS)
!DEC$ATTRIBUTES C,reference,decorate,alias:'H5OGET_COMMENT_C'::h5oget_comment_c
!DEC$ENDIF
!DEC$ATTRIBUTES reference :: comment
INTEGER(HID_T) , INTENT(IN) :: obj_id
CHARACTER(LEN=*), INTENT(OUT) :: comment
INTEGER(SIZE_T) , INTENT(IN) :: commentsize_default
INTEGER(HSSIZE_T) , INTENT(OUT) :: bufsize
END FUNCTION h5oget_comment_c
END INTERFACE
commentsize_default = LEN(comment)
hdferr = h5oget_comment_c(obj_id, comment, commentsize_default, bufsize_default)
IF(PRESENT(bufsize)) bufsize = bufsize_default
END SUBROUTINE h5oget_comment_f
!****s* H5O/h5oget_comment_by_name_f
! NAME
! h5oget_comment_by_name_f
!
! PURPOSE
! Retrieves comment for specified object.
!
! Inputs:
! loc_id - Identifier of a file, group, dataset, or named datatype.
! name - Name of the object whose comment is to be retrieved,
! specified as a path relative to loc_id.
!
! Optional parameters:
! bufsize - Size of the comment buffer.
!
! Outputs:
! comment - The comment.
! hdferr - Returns 0 if successful and -1 if fails.
!
! AUTHOR
! M. Scot Breitenfeld
! July 6, 2012
!
! Fortran90 Interface:
SUBROUTINE h5oget_comment_by_name_f(loc_id, name, comment, hdferr, bufsize, lapl_id)
IMPLICIT NONE
INTEGER(HID_T) , INTENT(IN) :: loc_id
CHARACTER(LEN=*), INTENT(IN) :: name
CHARACTER(LEN=*), INTENT(OUT) :: comment
INTEGER , INTENT(OUT) :: hdferr
INTEGER(SIZE_T) , INTENT(OUT), OPTIONAL :: bufsize
INTEGER(HID_T) , INTENT(IN) , OPTIONAL :: lapl_id
!*****
INTEGER(SIZE_T) :: commentsize_default
INTEGER(SIZE_T) :: name_size
INTEGER(SIZE_T) :: bufsize_default
INTEGER(HID_T) :: lapl_id_default
INTERFACE
INTEGER FUNCTION h5oget_comment_by_name_c(loc_id, name, name_size, &
comment, commentsize_default, bufsize_default, lapl_id)
USE H5GLOBAL
!DEC$IF DEFINED(HDF5F90_WINDOWS)
!DEC$ATTRIBUTES C,reference,decorate,alias:'H5OGET_COMMENT_BY_NAME_C'::h5oget_comment_by_name_c
!DEC$ENDIF
!DEC$ATTRIBUTES reference :: comment, name
INTEGER(HID_T) , INTENT(IN) :: loc_id
CHARACTER(LEN=*), INTENT(IN) :: name
INTEGER(SIZE_T) , INTENT(IN) :: name_size
CHARACTER(LEN=*), INTENT(OUT) :: comment
INTEGER(SIZE_T) , INTENT(IN) :: commentsize_default
INTEGER(SIZE_T) , INTENT(OUT) :: bufsize_default
INTEGER(HID_T) , INTENT(IN) :: lapl_id
END FUNCTION h5oget_comment_by_name_c
END INTERFACE
commentsize_default = LEN(comment)
name_size = LEN(name)
lapl_id_default = H5P_DEFAULT_F
IF(PRESENT(lapl_id)) lapl_id_default = lapl_id
hdferr = h5oget_comment_by_name_c(loc_id, name, name_size, &
comment, commentsize_default, bufsize_default, lapl_id_default)
IF(PRESENT(bufsize)) bufsize = bufsize_default
END SUBROUTINE h5oget_comment_by_name_f
!****s* H5O/h5oincr_refcount_f
! NAME
! h5oincr_refcount_f
!
! PURPOSE
! Increments an object reference count.
!
! Inputs:
! obj_id - Object identifier.
!
! Outputs:
! hdferr - Returns 0 if successful and -1 if fails.
!
! AUTHOR
! M. Scot Breitenfeld
! May 15, 2012
!
! Fortran90 Interface:
SUBROUTINE h5oincr_refcount_f(obj_id, hdferr)
IMPLICIT NONE
INTEGER(HID_T), INTENT(IN) :: obj_id
INTEGER , INTENT(OUT) :: hdferr
!*****
INTERFACE
INTEGER FUNCTION h5oincr_refcount_c(obj_id)
USE H5GLOBAL
!DEC$IF DEFINED(HDF5F90_WINDOWS)
!DEC$ATTRIBUTES C,reference,decorate,alias:'H5OINCR_REFCOUNT_C'::h5oincr_refcount_c
!DEC$ENDIF
INTEGER(HID_T) , INTENT(IN) :: obj_id
END FUNCTION h5oincr_refcount_c
END INTERFACE
hdferr = h5oincr_refcount_c(obj_id)
END SUBROUTINE h5oincr_refcount_f
!****s* H5O/h5oopen_by_idx_f
!
! NAME
! h5oopen_by_idx_f
!
! PURPOSE
! Open the nth object in a group.
!
! Inputs:
! loc_id - A file or group identifier.
! group_name - Name of group, relative to loc_id, in which object is located.
! index_type - Type of index by which objects are ordered.
! order - Order of iteration within index, NOTE: zero-based.
! n - Object to open.
!
! Outputs:
! obj_id - An object identifier for the opened object.
! hdferr - Returns 0 if successful and -1 if fails.
!
! Optional parameters:
! lapl_id - Link access property list.
!
! AUTHOR
! M. Scot Breitenfeld
! May 17, 2012
!
! Fortran90 Interface:
SUBROUTINE h5oopen_by_idx_f(loc_id, group_name, index_type, order, n, obj_id, &
hdferr, lapl_id)
IMPLICIT NONE
INTEGER(HID_T) , INTENT(IN) :: loc_id
CHARACTER(LEN=*), INTENT(IN) :: group_name
INTEGER , INTENT(IN) :: index_type
INTEGER , INTENT(IN) :: order
INTEGER(HSIZE_T), INTENT(IN) :: n
INTEGER(HID_T) , INTENT(OUT) :: obj_id
INTEGER , INTENT(OUT) :: hdferr
INTEGER(HID_T) , INTENT(IN) , OPTIONAL :: lapl_id
!*****
INTEGER(SIZE_T) :: group_namelen
INTEGER(HID_T) :: lapl_id_default
INTERFACE
INTEGER FUNCTION h5oopen_by_idx_c(loc_id, group_name, group_namelen, index_type, order, n, obj_id, lapl_id_default)
USE H5GLOBAL
!DEC$IF DEFINED(HDF5F90_WINDOWS)
!DEC$ATTRIBUTES C,reference,decorate,alias:'H5OOPEN_BY_IDX_C'::h5oopen_by_idx_c
!DEC$ENDIF
!DEC$ATTRIBUTES reference :: group_name
INTEGER(HID_T) , INTENT(IN) :: loc_id
CHARACTER(LEN=*), INTENT(IN) :: group_name
INTEGER(SIZE_T) , INTENT(IN) :: group_namelen
INTEGER , INTENT(IN) :: index_type
INTEGER , INTENT(IN) :: order
INTEGER(HSIZE_T), INTENT(IN) :: n
INTEGER(HID_T) , INTENT(OUT) :: obj_id
INTEGER(HID_T) , INTENT(IN) :: lapl_id_default
END FUNCTION h5oopen_by_idx_c
END INTERFACE
group_namelen = LEN(group_name)
lapl_id_default = H5P_DEFAULT_F
IF(PRESENT(lapl_id)) lapl_id_default = lapl_id
hdferr = h5oopen_by_idx_c(loc_id, group_name, group_namelen, index_type, order, n, obj_id, lapl_id_default)
END SUBROUTINE H5Oopen_by_idx_f
!****s* H5O/h5oset_comment_f
! NAME
! h5oset_comment_f
!
! PURPOSE
! Sets comment for specified object.
!
! Inputs:
! obj_id - Identifier of the target object.
! comment - The new comment.
!
! Outputs:
! hdferr - Returns 0 if successful and -1 if fails.
!
! AUTHOR
! M. Scot Breitenfeld
! May 15, 2012
!
! Fortran90 Interface:
SUBROUTINE h5oset_comment_f(obj_id, comment, hdferr)
IMPLICIT NONE
INTEGER(HID_T) , INTENT(IN) :: obj_id
CHARACTER(LEN=*), INTENT(IN) :: comment
INTEGER , INTENT(OUT) :: hdferr
!*****
INTEGER(SIZE_T) :: commentlen
INTERFACE
INTEGER FUNCTION h5oset_comment_c(obj_id, comment, commentlen)
USE H5GLOBAL
!DEC$IF DEFINED(HDF5F90_WINDOWS)
!DEC$ATTRIBUTES C,reference,decorate,alias:'H5OSET_COMMENT_C'::h5oset_comment_c
!DEC$ENDIF
!DEC$ATTRIBUTES reference :: comment
INTEGER(HID_T) , INTENT(IN) :: obj_id
CHARACTER(LEN=*), INTENT(IN) :: comment
INTEGER(SIZE_T) , INTENT(IN) :: commentlen
END FUNCTION h5oset_comment_c
END INTERFACE
commentlen = LEN(comment)
hdferr = h5oset_comment_c(obj_id, comment, commentlen)
END SUBROUTINE h5oset_comment_f
!****s* H5O/h5oset_comment_by_name_f
! NAME
! h5oset_comment_by_name_f
!
! PURPOSE
! Sets comment for specified object.
!
! Inputs:
! loc_id - Identifier of a file, group, dataset, or named datatype.
! name - Name of the object whose comment is to be set or reset,
! specified as a path relative to loc_id.
! comment - The new comment.
!
! Outputs:
! hdferr - Returns 0 if successful and -1 if fails.
!
! Optional parameters:
! lapl_id - Link access property list identifier.
!
! AUTHOR
! M. Scot Breitenfeld
! May 15, 2012
!
! Fortran90 Interface:
SUBROUTINE h5oset_comment_by_name_f(loc_id, name, comment, hdferr, lapl_id)
IMPLICIT NONE
INTEGER(HID_T) , INTENT(IN) :: loc_id
CHARACTER(LEN=*), INTENT(IN) :: name
CHARACTER(LEN=*), INTENT(IN) :: comment
INTEGER , INTENT(OUT) :: hdferr
INTEGER(HID_T) , INTENT(IN), OPTIONAL :: lapl_id
!*****
INTEGER(SIZE_T) :: commentlen
INTEGER(SIZE_T) :: namelen
INTEGER(HID_T) :: lapl_id_default
INTERFACE
INTEGER FUNCTION h5oset_comment_by_name_c(loc_id, name, namelen, comment, commentlen, lapl_id)
USE H5GLOBAL
!DEC$IF DEFINED(HDF5F90_WINDOWS)
!DEC$ATTRIBUTES C,reference,decorate,alias:'H5OSET_COMMENT_BY_NAME_C'::h5oset_comment_by_name_c
!DEC$ENDIF
!DEC$ATTRIBUTES reference :: name, comment
INTEGER(HID_T) , INTENT(IN) :: loc_id
CHARACTER(LEN=*), INTENT(IN) :: comment
INTEGER(SIZE_T) , INTENT(IN) :: commentlen
CHARACTER(LEN=*), INTENT(IN) :: name
INTEGER(SIZE_T) , INTENT(IN) :: namelen
INTEGER(HID_T) , INTENT(IN) :: lapl_id
END FUNCTION h5oset_comment_by_name_c
END INTERFACE
commentlen = LEN(comment)
namelen = LEN(name)
lapl_id_default = H5P_DEFAULT_F
IF(PRESENT(lapl_id)) lapl_id_default = lapl_id
hdferr = h5oset_comment_by_name_c(loc_id, name, namelen, comment, commentlen, lapl_id_default)
END SUBROUTINE h5oset_comment_by_name_f
END MODULE H5O

View File

@ -82,9 +82,9 @@ MODULE H5O_PROVISIONAL
ENDTYPE meta_size_t
TYPE, BIND(C) :: h5o_info_t
INTEGER(c_long) :: fileno ! File number that object is located in
INTEGER(C_LONG) :: fileno ! File number that object is located in
INTEGER(haddr_t) :: addr ! Object address in file
INTEGER :: type ! Basic object type (group, dataset, etc.)
INTEGER(C_INT) :: type ! Basic object type (group, dataset, etc.)
INTEGER :: rc ! Reference count of object
INTEGER, DIMENSION(8) :: atime ! Access time ! -- NOTE --
@ -181,14 +181,14 @@ CONTAINS
! Inputs:
! loc_id - File or group identifier specifying location of group
! in which object is located.
! name - Name of group, relative to loc_id
! name - Name of group, relative to loc_id.
!
! Outputs:
! object_info - Buffer in which to return object information
! hdferr - Returns 0 if successful and -1 if fails
! object_info - Buffer in which to return object information.
! hdferr - Returns 0 if successful and -1 if fails.
!
! Optional parameters:
! lapl_id - Link access property list
! lapl_id - Link access property list.
!
! AUTHOR
! M. Scot Breitenfeld
@ -218,11 +218,12 @@ CONTAINS
!DEC$IF DEFINED(HDF5F90_WINDOWS)
!DEC$ATTRIBUTES C,reference,decorate,alias:'H5OGET_INFO_BY_NAME_C'::h5oget_info_by_name_c
!DEC$ENDIF
!DEC$ATTRIBUTES reference :: name
INTEGER(HID_T) , INTENT(IN) :: loc_id
CHARACTER(LEN=*), INTENT(IN) :: name
INTEGER(SIZE_T) , INTENT(IN) :: namelen
INTEGER(HID_T) , INTENT(IN) :: lapl_id_default
TYPE(C_PTR),value :: object_info
TYPE(C_PTR),VALUE :: object_info
END FUNCTION h5oget_info_by_name_c
END INTERFACE
@ -238,5 +239,222 @@ CONTAINS
END SUBROUTINE H5Oget_info_by_name_f
!****s* H5O (F03)/h5oget_info_f_F03
!
! NAME
! h5oget_info_f
!
! PURPOSE
! Retrieves the metadata for an object specified by an identifier.
!
! Inputs:
! object_id - Identifier for target object.
!
! Outputs:
! object_info - Buffer in which to return object information.
! hdferr - Returns 0 if successful and -1 if fails.
!
! AUTHOR
! M. Scot Breitenfeld
! May 11, 2012
!
! Fortran2003 Interface:
SUBROUTINE h5oget_info_f(object_id, object_info, hdferr)
USE, INTRINSIC :: ISO_C_BINDING
IMPLICIT NONE
INTEGER(HID_T) , INTENT(IN) :: object_id
TYPE(h5o_info_t), INTENT(OUT), TARGET :: object_info
INTEGER , INTENT(OUT) :: hdferr
!*****
TYPE(C_PTR) :: ptr
INTERFACE
INTEGER FUNCTION h5oget_info_c(object_id, object_info)
USE H5GLOBAL
USE, INTRINSIC :: ISO_C_BINDING
!DEC$IF DEFINED(HDF5F90_WINDOWS)
!DEC$ATTRIBUTES C,reference,decorate,alias:'H5OGET_INFO_C'::h5oget_info_c
!DEC$ENDIF
INTEGER(HID_T), INTENT(IN) :: object_id
TYPE(C_PTR), VALUE :: object_info
END FUNCTION h5oget_info_c
END INTERFACE
ptr = C_LOC(object_info)
hdferr = H5Oget_info_c(object_id, ptr)
END SUBROUTINE H5Oget_info_f
!****s* H5O (F03)/h5oget_info_by_idx_f_F03
!
! NAME
! h5oget_info_by_idx_f
!
! PURPOSE
! Retrieves the metadata for an object, identifying the object by an index position.
!
! Inputs:
! loc_id - File or group identifier specifying location of group
! in which object is located.
! group_name - Name of group in which object is located.
! index_field - Index or field that determines the order.
! order - Order within field or index.
! n - Object for which information is to be returned
!
! Outputs:
! object_info - Buffer in which to return object information.
! hdferr - Returns 0 if successful and -1 if fails.
!
! Optional parameters:
! lapl_id - Link access property list. (Not currently used.)
!
! AUTHOR
! M. Scot Breitenfeld
! May 11, 2012
!
! Fortran2003 Interface:
SUBROUTINE h5oget_info_by_idx_f(loc_id, group_name, index_field, order, n, &
object_info, hdferr, lapl_id)
USE, INTRINSIC :: ISO_C_BINDING
IMPLICIT NONE
INTEGER(HID_T) , INTENT(IN) :: loc_id
CHARACTER(LEN=*), INTENT(IN) :: group_name
INTEGER , INTENT(IN) :: index_field
INTEGER , INTENT(IN) :: order
INTEGER(HSIZE_T), INTENT(IN) :: n
TYPE(h5o_info_t), INTENT(OUT), TARGET :: object_info
INTEGER , INTENT(OUT) :: hdferr
INTEGER(HID_T) , INTENT(IN) , OPTIONAL :: lapl_id
!*****
INTEGER :: corder_valid
INTEGER(SIZE_T) :: namelen
INTEGER(HID_T) :: lapl_id_default
TYPE(C_PTR) :: ptr
INTERFACE
INTEGER FUNCTION h5oget_info_by_idx_c(loc_id, group_name, namelen, &
index_field, order, n, lapl_id_default, object_info)
USE H5GLOBAL
USE, INTRINSIC :: ISO_C_BINDING
!DEC$IF DEFINED(HDF5F90_WINDOWS)
!DEC$ATTRIBUTES C,reference,decorate,alias:'H5OGET_INFO_BY_IDX_C'::h5oget_info_by_idx_c
!DEC$ENDIF
!DEC$ATTRIBUTES reference :: group_name
INTEGER(HID_T) , INTENT(IN) :: loc_id
CHARACTER(LEN=*), INTENT(IN) :: group_name
INTEGER(SIZE_T) , INTENT(IN) :: namelen
INTEGER , INTENT(IN) :: index_field
INTEGER , INTENT(IN) :: order
INTEGER(HSIZE_T), INTENT(IN) :: n
INTEGER(HID_T) , INTENT(IN) :: lapl_id_default
TYPE(C_PTR), VALUE :: object_info
END FUNCTION h5oget_info_by_idx_c
END INTERFACE
namelen = LEN(group_name)
lapl_id_default = H5P_DEFAULT_F
IF(PRESENT(lapl_id)) lapl_id_default = lapl_id
ptr = C_LOC(object_info)
hdferr = H5Oget_info_by_idx_c(loc_id, group_name, namelen, index_field, order, n, lapl_id_default, ptr)
END SUBROUTINE H5Oget_info_by_idx_f
!****s* H5O (F03)/h5ovisit_by_name_f_F03
!
! NAME
! h5ovisit_by_name_f
!
! PURPOSE
! Recursively visits all objects starting from a specified object.
!
! Inputs:
! loc_id - Identifier of a file or group.
! object_name - Name of the object, generally relative to loc_id, that will serve as root of the iteration
! index_type - Type of index; valid values include:
! H5_INDEX_NAME_F
! H5_INDEX_CRT_ORDER_F
! order - Order in which index is traversed; valid values include:
! H5_ITER_DEC_F
! H5_ITER_INC_F
! H5_ITER_NATIVE_F
! op - Callback function passing data regarding the group to the calling application
! op_data - User-defined pointer to data required by the application for its processing of the group
!
! Outputs:
! return_value - Returns the return value of the first operator that returns a positive value, or
! zero if all members were processed with no operator returning non-zero.
! hdferr - Returns 0 if successful and -1 if fails
!
! Optional parameters:
! lapl_id - Link access property list identifier.
!
! AUTHOR
! M. Scot Breitenfeld
! November 19, 2008
!
! Fortran2003 Interface:
SUBROUTINE h5ovisit_by_name_f(loc_id, object_name, index_type, order, op, op_data, &
return_value, hdferr, lapl_id)
USE, INTRINSIC :: ISO_C_BINDING
IMPLICIT NONE
INTEGER(HID_T) , INTENT(IN) :: loc_id
CHARACTER(LEN=*), INTENT(IN) :: object_name
INTEGER , INTENT(IN) :: index_type
INTEGER , INTENT(IN) :: order
TYPE(C_FUNPTR) :: op
TYPE(C_PTR) :: op_data
INTEGER , INTENT(OUT) :: return_value
INTEGER , INTENT(OUT) :: hdferr
INTEGER(HID_T) , INTENT(IN) , OPTIONAL :: lapl_id
!*****
INTEGER(SIZE_T) :: namelen
INTEGER(HID_T) :: lapl_id_default
TYPE(C_PTR) :: ptr
INTERFACE
INTEGER FUNCTION h5ovisit_by_name_c(loc_id, object_name, namelen, index_type, order, &
op, op_data, lapl_id)
USE, INTRINSIC :: ISO_C_BINDING
USE H5GLOBAL
!DEC$IF DEFINED(HDF5F90_WINDOWS)
!DEC$ATTRIBUTES C,reference,decorate,alias:'H5OVISIT_BY_NAME_C'::h5ovisit_by_name_c
!DEC$ENDIF
!DEC$ATTRIBUTES reference :: object_name
INTEGER(HID_T) , INTENT(IN) :: loc_id
CHARACTER(LEN=*), INTENT(IN) :: object_name
INTEGER(SIZE_T) :: namelen
INTEGER , INTENT(IN) :: index_type
INTEGER , INTENT(IN) :: order
TYPE(C_FUNPTR) , VALUE :: op
TYPE(C_PTR) , VALUE :: op_data
INTEGER(HID_T) , INTENT(IN) :: lapl_id
END FUNCTION h5ovisit_by_name_c
END INTERFACE
namelen = LEN(object_name)
lapl_id_default = H5P_DEFAULT_F
IF(PRESENT(lapl_id)) lapl_id_default = lapl_id
return_value = h5ovisit_by_name_c(loc_id, object_name, namelen, index_type, order, &
op, op_data, lapl_id_default)
IF(return_value.GE.0)THEN
hdferr = 0
ELSE
hdferr = -1
END IF
END SUBROUTINE h5ovisit_by_name_f
END MODULE H5O_PROVISIONAL

View File

@ -6419,3 +6419,5 @@ SUBROUTINE h5pset_attr_phase_change_f(ocpl_id, max_compact, min_dense, hdferr)
END MODULE H5P

View File

@ -331,6 +331,47 @@ done:
return ret_value;
} /* end nh5rget_region_region_c() */
/****if* H5Rf/h5rget_region_ptr_c
* NAME
* h5rget_region_ptr_c
* PURPOSE
* Call H5Rget_region to dereference dataspace region
* INPUTS
* dset_id - dataset identifier
* ref - reference to the dataset region
* OUTPUTS
* space_id - dereferenced dataset dataspace identifier
* RETURNS
* 0 on success, -1 on failure
* AUTHOR
* M. Scot Breitenfeld
* August 4, 2012
* HISTORY
*
* SOURCE
*/
int_f
nh5rget_region_ptr_c(hid_t_f *dset_id, void *ref, hid_t_f *space_id)
/******/
{
hid_t c_space_id;
hdset_reg_ref_t ref_c;
int_f ret_value = 0;
/*
* Call H5Rget_region function.
*/
if((c_space_id = H5Rget_region((hid_t)*dset_id, H5R_DATASET_REGION, ref)) < 0)
HGOTO_DONE(FAIL)
/* Copy the dataspace ID */
*space_id = (hid_t_f)c_space_id;
done:
return ret_value;
} /* end nh5rget_region_ptr_c() */
/****if* H5Rf/h5rget_object_type_obj_c
* NAME
* h5rget_object_type_obj_c

View File

@ -53,12 +53,6 @@ MODULE H5R
! END TYPE
!
INTERFACE h5rget_region_f
MODULE PROCEDURE h5rget_region_region_f
END INTERFACE
INTERFACE h5rget_object_type_f
MODULE PROCEDURE h5rget_object_type_obj_f
@ -67,61 +61,6 @@ MODULE H5R
CONTAINS
!****s* H5R/h5rget_region_region_f
!
! NAME
! h5rget_region_region_f
!
! PURPOSE
! Retrieves a dataspace with the specified region selected
!
! INPUTS
! dset_id - identifier of the dataset containing
! reference to the regions
! ref - reference to open
! OUTPUTS
! space_id - dataspace identifier
! hdferr - Returns 0 if successful and -1 if fails
! AUTHOR
! Elena Pourmal
! August 12, 1999
!
! HISTORY
! Explicit Fortran interfaces were added for
! called C functions (it is needed for Windows
! port). February 28, 2001
!
! NOTES
! This is a module procedure for the h5rget_region_f subroutine.
!
! SOURCE
SUBROUTINE h5rget_region_region_f(dset_id, ref, space_id, hdferr)
IMPLICIT NONE
INTEGER(HID_T), INTENT(IN) :: dset_id ! Dataset identifier
TYPE(hdset_reg_ref_t_f), INTENT(IN) :: ref ! Dataset region reference
INTEGER(HID_T), INTENT(OUT) :: space_id ! Space identifier
INTEGER, INTENT(OUT) :: hdferr ! Error code
!*****
INTEGER :: ref_f(REF_REG_BUF_LEN) ! Local buffer to pass reference
INTERFACE
INTEGER FUNCTION h5rget_region_region_c(dset_id, ref_f, space_id)
USE H5GLOBAL
!DEC$IF DEFINED(HDF5F90_WINDOWS)
!DEC$ATTRIBUTES C,reference,decorate,alias:'H5RGET_REGION_REGION_C':: h5rget_region_region_c
!DEC$ENDIF
INTEGER(HID_T), INTENT(IN) :: dset_id
! INTEGER, PARAMETER :: REF_REG_BUF_LEN = 3
INTEGER :: ref_f(REF_REG_BUF_LEN)
INTEGER(HID_T), INTENT(OUT) :: space_id
END FUNCTION h5rget_region_region_c
END INTERFACE
ref_f = ref%ref
hdferr = h5rget_region_region_c(dset_id, ref_f, space_id )
END SUBROUTINE h5rget_region_region_f
!****s* H5R/h5rget_object_type_obj_f
!
! NAME

View File

@ -37,6 +37,7 @@
!*****
MODULE H5R_PROVISIONAL
USE H5GLOBAL
USE, INTRINSIC :: ISO_C_BINDING
! If you change the value of these parameters, do not forget to change corresponding
! values in the H5f90.h file.
@ -51,6 +52,19 @@ MODULE H5R_PROVISIONAL
! INTEGER ref(REF_REG_BUF_LEN)
! END TYPE
!
TYPE :: hdset_reg_ref_t_f03
INTEGER(C_SIGNED_CHAR), DIMENSION(1:H5R_DSET_REG_REF_BUF_SIZE_F) :: ref
END TYPE hdset_reg_ref_t_f03
INTERFACE h5rget_region_f
MODULE PROCEDURE h5rget_region_region_f ! obsolete
MODULE PROCEDURE h5rget_region_ptr_f ! F2003
END INTERFACE
INTERFACE h5rcreate_f
MODULE PROCEDURE h5rcreate_object_f ! obsolete
@ -123,8 +137,114 @@ MODULE H5R_PROVISIONAL
END FUNCTION h5rcreate_ptr_c
END INTERFACE
INTERFACE
INTEGER FUNCTION h5rget_region_ptr_c(dset_id, ref, space_id)
USE, INTRINSIC :: ISO_C_BINDING
USE H5GLOBAL
!DEC$IF DEFINED(HDF5F90_WINDOWS)
!DEC$ATTRIBUTES C,reference,decorate,alias:'H5RGET_REGION_PTR_C':: h5rget_region_ptr_c
!DEC$ENDIF
INTEGER(HID_T), INTENT(IN) :: dset_id
TYPE(C_PTR), VALUE :: ref
INTEGER(HID_T), INTENT(OUT) :: space_id
END FUNCTION h5rget_region_ptr_c
END INTERFACE
CONTAINS
!****s* H5R/h5rget_region_region_f
!
! NAME
! h5rget_region_region_f
!
! PURPOSE
! Retrieves a dataspace with the specified region selected
!
! INPUTS
! dset_id - identifier of the dataset containing
! reference to the regions
! ref - reference to open
! OUTPUTS
! space_id - dataspace identifier
! hdferr - Returns 0 if successful and -1 if fails
! AUTHOR
! Elena Pourmal
! August 12, 1999
!
! HISTORY
! Explicit Fortran interfaces were added for
! called C functions (it is needed for Windows
! port). February 28, 2001
!
! NOTES
! This is a module procedure for the h5rget_region_f subroutine.
!
! SOURCE
SUBROUTINE h5rget_region_region_f(dset_id, ref, space_id, hdferr)
IMPLICIT NONE
INTEGER(HID_T), INTENT(IN) :: dset_id ! Dataset identifier
TYPE(hdset_reg_ref_t_f), INTENT(IN) :: ref ! Dataset region reference
INTEGER(HID_T), INTENT(OUT) :: space_id ! Space identifier
INTEGER, INTENT(OUT) :: hdferr ! Error code
!*****
INTEGER :: ref_f(REF_REG_BUF_LEN) ! Local buffer to pass reference
INTERFACE
INTEGER FUNCTION h5rget_region_region_c(dset_id, ref_f, space_id)
USE H5GLOBAL
!DEC$IF DEFINED(HDF5F90_WINDOWS)
!DEC$ATTRIBUTES C,reference,decorate,alias:'H5RGET_REGION_REGION_C':: h5rget_region_region_c
!DEC$ENDIF
INTEGER(HID_T), INTENT(IN) :: dset_id
! INTEGER, PARAMETER :: REF_REG_BUF_LEN = 3
INTEGER :: ref_f(REF_REG_BUF_LEN)
INTEGER(HID_T), INTENT(OUT) :: space_id
END FUNCTION h5rget_region_region_c
END INTERFACE
ref_f = ref%ref
hdferr = h5rget_region_region_c(dset_id, ref_f, space_id )
END SUBROUTINE h5rget_region_region_f
!****s* H5R/h5rget_region_ptr_f
!
! NAME
! h5rget_region_ptr_f
!
! PURPOSE
! Retrieves a dataspace with the specified region
! selected using pointer
!
! INPUTS
! dset_id - identifier of the dataset containing
! reference to the regions
! ref - reference to open
! OUTPUTS
! space_id - dataspace identifier
! hdferr - Returns 0 if successful and -1 if fails
! AUTHOR
! M. Scot Breitenfeld
! August 4, 2012
!
! NOTES
! This is a module procedure for the h5rget_region_f subroutine.
!
! SOURCE
SUBROUTINE h5rget_region_ptr_f(dset_id, ref, space_id, hdferr)
IMPLICIT NONE
INTEGER(HID_T), INTENT(IN) :: dset_id ! Dataset identifier
TYPE(C_PTR), INTENT(IN) :: ref ! Dataset region reference
INTEGER(HID_T), INTENT(OUT) :: space_id ! Space identifier
INTEGER, INTENT(OUT) :: hdferr ! Error code
!*****
INTEGER :: ref_f(REF_REG_BUF_LEN) ! Local buffer to pass reference
hdferr = h5rget_region_ptr_c(dset_id, ref, space_id )
END SUBROUTINE h5rget_region_ptr_f
!****s* H5R (F03)/h5rcreate_object_f
!
! NAME
@ -175,7 +295,7 @@ CONTAINS
END SUBROUTINE h5rcreate_object_f
!****s* H5R (F03)/h5rcreate_region_f
!****s* H5R (F90)/h5rcreate_region_f
!
! NAME
! h5rcreate_region_f
@ -183,16 +303,15 @@ CONTAINS
! PURPOSE
! Creates reference to the dataset region
!
! Inputs:
! INPUTS
! loc_id - location identifier
! name - name of the dataset at the specified location
! space_id - dataspace identifier that describes selected region
! Outputs:
! OUTPUTS
! ref - reference to the dataset region
! hdferr: - error code
! Success: 0
! Failure: -1
!
! AUTHOR
! Elena Pourmal
! August 12, 1999
@ -205,46 +324,39 @@ CONTAINS
! NOTES
! This is a module procedure for the h5rcreate_f subroutine.
!
! Signature:
! SOURCE
SUBROUTINE h5rcreate_region_f(loc_id, name, space_id, ref, hdferr)
USE, INTRINSIC :: ISO_C_BINDING
IMPLICIT NONE
INTEGER(HID_T), INTENT(IN) :: loc_id ! Location identifier
CHARACTER(LEN=*), INTENT(IN) :: name ! Name of the dataset at location specified
! by loc_id identifier
INTEGER(HID_T), INTENT(IN) :: space_id ! Dataset's dataspace identifier
TYPE(hdset_reg_ref_t_f), INTENT(INOUT), TARGET :: ref ! Dataset region reference
TYPE(hdset_reg_ref_t_f), INTENT(OUT) :: ref ! Dataset region reference
INTEGER, INTENT(OUT) :: hdferr ! Error code
!*****
INTEGER :: namelen ! Name length
INTEGER :: ref_f(REF_REG_BUF_LEN) ! Local buffer to pass reference
TYPE(C_PTR) :: f_ptr
! !$ INTERFACE
! !$ INTEGER FUNCTION h5rcreate_region_c(ref_f, loc_id, name, namelen, space_id)
! !$ USE H5GLOBAL
! !$ !DEC$IF DEFINED(HDF5F90_WINDOWS)
! !$ !DEC$ATTRIBUTES C,reference,decorate,alias:'H5RCREATE_REGION_C':: h5rcreate_region_c
! !$ !DEC$ENDIF
! !$ !DEC$ATTRIBUTES reference :: name
! !$ ! INTEGER, PARAMETER :: REF_REG_BUF_LEN = 3
! !$ INTEGER :: ref_f(REF_REG_BUF_LEN)
! !$ INTEGER(HID_T), INTENT(IN) :: loc_id
! !$ CHARACTER(LEN=*), INTENT(IN) :: name
! !$ INTEGER :: namelen
! !$ INTEGER(HID_T), INTENT(IN) :: space_id
! !$ END FUNCTION h5rcreate_region_c
! !$ END INTERFACE
f_ptr = C_LOC(ref)
INTERFACE
INTEGER FUNCTION h5rcreate_region_c(ref_f, loc_id, name, namelen, space_id)
USE H5GLOBAL
!DEC$IF DEFINED(HDF5F90_WINDOWS)
!DEC$ATTRIBUTES C,reference,decorate,alias:'H5RCREATE_REGION_C':: h5rcreate_region_c
!DEC$ENDIF
!DEC$ATTRIBUTES reference :: name
! INTEGER, PARAMETER :: REF_REG_BUF_LEN = 3
INTEGER :: ref_f(REF_REG_BUF_LEN)
INTEGER(HID_T), INTENT(IN) :: loc_id
CHARACTER(LEN=*), INTENT(IN) :: name
INTEGER :: namelen
INTEGER(HID_T), INTENT(IN) :: space_id
END FUNCTION h5rcreate_region_c
END INTERFACE
namelen = LEN(name)
hdferr = h5rcreate_ptr_c(f_ptr, loc_id, name, namelen, 1, space_id)
! !$ ref_f = 0
! !$ hdferr = h5rcreate_region_c(ref_f, loc_id, name, namelen, space_id )
! !$ ref%ref = ref_f
ref_f = 0
hdferr = h5rcreate_region_c(ref_f, loc_id, name, namelen, space_id )
ref%ref = ref_f
END SUBROUTINE h5rcreate_region_f

View File

@ -72,8 +72,73 @@ MODULE H5R_PROVISIONAL
END INTERFACE
INTERFACE h5rget_region_f
MODULE PROCEDURE h5rget_region_region_f
END INTERFACE
CONTAINS
!****s* H5R/h5rget_region_region_f
!
! NAME
! h5rget_region_region_f
!
! PURPOSE
! Retrieves a dataspace with the specified region selected
!
! INPUTS
! dset_id - identifier of the dataset containing
! reference to the regions
! ref - reference to open
! OUTPUTS
! space_id - dataspace identifier
! hdferr - Returns 0 if successful and -1 if fails
! AUTHOR
! Elena Pourmal
! August 12, 1999
!
! HISTORY
! Explicit Fortran interfaces were added for
! called C functions (it is needed for Windows
! port). February 28, 2001
!
! NOTES
! This is a module procedure for the h5rget_region_f subroutine.
!
! SOURCE
SUBROUTINE h5rget_region_region_f(dset_id, ref, space_id, hdferr)
IMPLICIT NONE
INTEGER(HID_T), INTENT(IN) :: dset_id ! Dataset identifier
TYPE(hdset_reg_ref_t_f), INTENT(IN) :: ref ! Dataset region reference
INTEGER(HID_T), INTENT(OUT) :: space_id ! Space identifier
INTEGER, INTENT(OUT) :: hdferr ! Error code
!*****
INTEGER :: ref_f(REF_REG_BUF_LEN) ! Local buffer to pass reference
INTERFACE
INTEGER FUNCTION h5rget_region_region_c(dset_id, ref_f, space_id)
USE H5GLOBAL
!DEC$IF DEFINED(HDF5F90_WINDOWS)
!DEC$ATTRIBUTES C,reference,decorate,alias:'H5RGET_REGION_REGION_C':: h5rget_region_region_c
!DEC$ENDIF
INTEGER(HID_T), INTENT(IN) :: dset_id
! INTEGER, PARAMETER :: REF_REG_BUF_LEN = 3
INTEGER :: ref_f(REF_REG_BUF_LEN)
INTEGER(HID_T), INTENT(OUT) :: space_id
END FUNCTION h5rget_region_region_c
END INTERFACE
ref_f = ref%ref
hdferr = h5rget_region_region_c(dset_id, ref_f, space_id )
END SUBROUTINE h5rget_region_region_f
!****s* H5R (F90)/h5rcreate_object_f
!
! NAME

View File

@ -398,7 +398,11 @@ nh5init_flags_c( int_f *h5d_flags, int_f *h5e_flags, hid_t_f *h5e_hid_flags, int
h5d_flags[19] = (int_f)H5D_CHUNK_CACHE_NSLOTS_DEFAULT;
h5d_flags[20] = (int_f)H5D_CHUNK_CACHE_NBYTES_DEFAULT;
h5d_flags[21] = (int_f)H5D_CHUNK_CACHE_W0_DEFAULT;
h5d_flags[22] = (int_f)H5D_MPIO_NO_COLLECTIVE;
h5d_flags[23] = (int_f)H5D_MPIO_CHUNK_INDEPENDENT;
h5d_flags[24] = (int_f)H5D_MPIO_CHUNK_COLLECTIVE;
h5d_flags[25] = (int_f)H5D_MPIO_CHUNK_MIXED;
h5d_flags[26] = (int_f)H5D_MPIO_CONTIGUOUS_COLLECTIVE;
/*
* H5E flags
*/

View File

@ -354,7 +354,7 @@ MODULE H5GLOBAL
! H5D flags declaration
!
INTEGER, PARAMETER :: H5D_FLAGS_LEN = 22
INTEGER, PARAMETER :: H5D_FLAGS_LEN = 27
INTEGER H5D_flags(H5D_FLAGS_LEN)
!DEC$if defined(BUILD_HDF5_DLL)
!DEC$ATTRIBUTES DLLEXPORT :: /H5D_FLAGS/
@ -386,11 +386,18 @@ MODULE H5GLOBAL
INTEGER :: H5D_FILL_VALUE_USER_DEFINED_F
! shortened "_DEFAULT" to "_DFLT" to satisfy the limit of 31
! characters for variable names in Fortran.
! shortened "_CONTIGUOUS" to "_CONTIG" to satisfy the limit of 31
! characters for variable names in Fortran.
INTEGER :: H5D_CHUNK_CACHE_NSLOTS_DFLT_F
INTEGER :: H5D_CHUNK_CACHE_NBYTES_DFLT_F
INTEGER :: H5D_CHUNK_CACHE_W0_DFLT_F
INTEGER :: H5D_MPIO_NO_COLLECTIVE_F
INTEGER :: H5D_MPIO_CHUNK_INDEPENDENT_F
INTEGER :: H5D_MPIO_CHUNK_COLLECTIVE_F
INTEGER :: H5D_MPIO_CHUNK_MIXED_F
INTEGER :: H5D_MPIO_CONTIG_COLLECTIVE_F
EQUIVALENCE(H5D_flags(1), H5D_COMPACT_F)
EQUIVALENCE(H5D_flags(2), H5D_CONTIGUOUS_F)
@ -419,6 +426,11 @@ MODULE H5GLOBAL
EQUIVALENCE(H5D_flags(20), H5D_CHUNK_CACHE_NSLOTS_DFLT_F)
EQUIVALENCE(H5D_flags(21), H5D_CHUNK_CACHE_NBYTES_DFLT_F)
EQUIVALENCE(H5D_flags(22), H5D_CHUNK_CACHE_W0_DFLT_F)
EQUIVALENCE(H5D_flags(23), H5D_MPIO_NO_COLLECTIVE_F)
EQUIVALENCE(H5D_flags(24), H5D_MPIO_CHUNK_INDEPENDENT_F)
EQUIVALENCE(H5D_flags(25), H5D_MPIO_CHUNK_COLLECTIVE_F)
EQUIVALENCE(H5D_flags(26), H5D_MPIO_CHUNK_MIXED_F)
EQUIVALENCE(H5D_flags(27), H5D_MPIO_CONTIG_COLLECTIVE_F)
!
! H5E flags declaration

View File

@ -53,7 +53,7 @@ HD5f2cstring(_fcd fdesc, size_t len)
/* Search for the end of the string */
str = _fcdtocp(fdesc);
for(i = (int)len - 1; i >= 0 && !HDisgraph((int)str[i]); i--)
for(i = (int)len - 1; i >= 0 && HDisspace((int)str[i]) && str[i] == ' '; i--)
/*EMPTY*/;
/* Allocate C string */

View File

@ -61,7 +61,7 @@ typedef struct H5O_hdr_info_t_f {
typedef struct H5O_info_t_f {
unsigned long fileno; /* File number that object is located in */
haddr_t_f addr; /* Object address in file */
int_f type; /* Basic object type (group, dataset, etc.) */
int type; /* Basic object type (group, dataset, etc.) */
int_f rc; /* Reference count of object */
int_f atime[8]; /* Access time */
int_f mtime[8]; /* Modification time */
@ -806,11 +806,21 @@ H5_FCDLL int_f nh5tconvert_c(hid_t_f *src_id, hid_t_f *dst_id, size_t_f *nelmts,
#define nh5olink_c H5_FC_FUNC_(h5olink_c, H5OLINK_C)
#define nh5oopen_c H5_FC_FUNC_(h5oopen_c, H5OOPEN_C)
#define nh5oclose_c H5_FC_FUNC_(h5oclose_c, H5OCLOSE_C)
#define nh5ovisit_c H5_FC_FUNC_(h5ovisit_c,H5OVISIT_C)
#define nh5ovisit_c H5_FC_FUNC_(h5ovisit_c, H5OVISIT_C)
#define nh5ovisit_by_name_c H5_FC_FUNC_(h5ovisit_by_name_c, H5OVISIT_BY_NAME_C)
#define nh5oget_info_c H5_FC_FUNC_(h5oget_info_c, H5OGET_INFO_C)
#define nh5oget_info_by_idx_c H5_FC_FUNC_(h5oget_info_by_idx_c ,H5OGET_INFO_BY_IDX_C)
#define nh5oget_info_by_name_c H5_FC_FUNC_(h5oget_info_by_name_c ,H5OGET_INFO_BY_NAME_C)
#define nh5oopen_by_addr_c H5_FC_FUNC_(h5oopen_by_addr_c, H5OOPEN_BY_ADDR_C)
#define nh5ocopy_c H5_FC_FUNC_(h5ocopy_c, H5OCOPY_C)
#define nh5odecr_refcount_c H5_FC_FUNC_(h5odecr_refcount_c, H5ODECR_REFCOUNT_C)
#define nh5oincr_refcount_c H5_FC_FUNC_(h5oincr_refcount_c, H5OINCR_REFCOUNT_C)
#define nh5oexists_by_name_c H5_FC_FUNC_(h5oexists_by_name_c, H5OEXISTS_BY_NAME_C)
#define nh5oset_comment_c H5_FC_FUNC_(h5oset_comment_c, H5OSET_COMMENT_C)
#define nh5oset_comment_by_name_c H5_FC_FUNC_(h5oset_comment_by_name_c, H5OSET_COMMENT_BY_NAME_C)
#define nh5oopen_by_idx_c H5_FC_FUNC_(h5oopen_by_idx_c, H5OOPEN_BY_IDX_C)
#define nh5oget_comment_c H5_FC_FUNC_(h5oget_comment_c, H5OGET_COMMENT_C)
#define nh5oget_comment_by_name_c H5_FC_FUNC_(h5oget_comment_by_name_c, H5OGET_COMMENT_BY_NAME_C)
H5_FCDLL int_f nh5oopen_c (hid_t_f *loc_id, _fcd name, size_t_f *namelen, hid_t_f *lapl_id, hid_t_f *obj_id);
H5_FCDLL int_f nh5oclose_c (hid_t_f *object_id );
@ -818,11 +828,26 @@ H5_FCDLL int_f nh5oopen_by_addr_c (hid_t_f *loc_id, haddr_t_f *addr, hid_t_f *ob
H5_FCDLL int_f nh5olink_c (hid_t_f *object_id, hid_t_f *new_loc_id, _fcd name, size_t_f *namelen,
hid_t_f *lcpl_id, hid_t_f *lapl_id);
H5_FCDLL int_f nh5ovisit_c (hid_t_f *group_id, int_f *index_type, int_f *order, H5O_iterate_t op, void *op_data);
H5_FCDLL int_f nh5oget_info_by_name_c (hid_t_f *loc_id, _fcd name, size_t_f *namelen,hid_t_f *lapl_id,
H5_FCDLL int_f nh5ovisit_by_name_c(hid_t_f *loc_id, _fcd object_name, size_t_f *namelen, int_f *index_type, int_f *order,
H5O_iterate_t op, void *op_data, hid_t_f *lapl_id );
H5_FCDLL int_f nh5oget_info_c (hid_t_f *object_id, H5O_info_t_f *object_info);
H5_FCDLL int_f nh5oget_info_by_idx_c (hid_t_f *loc_id, _fcd group_name, size_t_f *namelen,
int_f *index_field, int_f *order, hsize_t_f *n, hid_t_f *lapl_id, H5O_info_t_f *object_info);
H5_FCDLL int_f nh5oget_info_by_name_c (hid_t_f *loc_id, _fcd name, size_t_f *namelen, hid_t_f *lapl_id,
H5O_info_t_f *object_info);
H5_FCDLL int_f nh5ocopy_c (hid_t_f *src_loc_id, _fcd src_name, size_t_f *src_name_len,
hid_t_f *dst_loc_id, _fcd dst_name, size_t_f *dst_name_len,
hid_t_f *ocpypl_id, hid_t_f *lcpl_id );
H5_FCDLL int_f nh5odecr_refcount_c (hid_t_f *object_id);
H5_FCDLL int_f nh5oincr_refcount_c (hid_t_f *object_id);
H5_FCDLL int_f nh5oexists_by_name_c (hid_t_f *loc_id, _fcd name, size_t_f *namelen, hid_t_f *lapl_id);
H5_FCDLL int_f nh5oset_comment_c (hid_t_f *object_id, _fcd comment, size_t_f *commentlen);
H5_FCDLL int_f nh5oset_comment_by_name_c (hid_t_f *object_id, _fcd name, size_t_f *namelen, _fcd comment, size_t_f *commentlen, hid_t_f *lapl_id);
H5_FCDLL int_f nh5oopen_by_idx_c (hid_t_f *loc_id, _fcd group_name, size_t_f *group_namelen,
int_f *index_type, int_f *order, hsize_t_f *n, hid_t_f *obj_id, hid_t_f *lapl_id);
H5_FCDLL int_f nh5oget_comment_c (hid_t_f *object_id, _fcd comment, size_t_f *commentsize, hssize_t_f *bufsize);
H5_FCDLL int_f nh5oget_comment_by_name_c (hid_t_f *loc_id, _fcd name, size_t_f *name_size,
_fcd comment, size_t_f *commentsize, size_t_f *bufsize, hid_t_f *lapl_id);
/*
* Functions from H5Pf.c
*/
@ -982,6 +1007,7 @@ H5_FCDLL int_f nh5ocopy_c (hid_t_f *src_loc_id, _fcd src_name, size_t_f *src_nam
#define nh5pget_nlinks_c H5_FC_FUNC_(h5pget_nlinks_c, H5PGET_NLINKS_C)
#define nh5pset_chunk_cache_c H5_FC_FUNC_(h5pset_chunk_cache_c, H5PSET_CHUNK_CACHE_C)
#define nh5pget_chunk_cache_c H5_FC_FUNC_(h5pget_chunk_cache_c, H5PGET_CHUNK_CACHE_C)
#define nh5pget_mpio_actual_io_mode_c H5_FC_FUNC_(h5pget_mpio_actual_io_mode_c, H5PGET_MPIO_ACTUAL_IO_MODE_C)
H5_FCDLL int_f nh5pcreate_c ( hid_t_f *cls, hid_t_f *prp_id );
H5_FCDLL int_f nh5pclose_c ( hid_t_f *prp_id );
@ -1142,6 +1168,7 @@ H5_FCDLL int_f nh5pset_nlinks_c(hid_t_f *lapl_id, size_t_f *nlinks);
H5_FCDLL int_f nh5pget_nlinks_c(hid_t_f *lapl_id, size_t_f *nlinks);
H5_FCDLL int_f nh5pset_chunk_cache_c(hid_t_f *dapl_id, size_t_f *rdcc_nslots, size_t_f *rdcc_nbytes, real_f *rdcc_w0);
H5_FCDLL int_f nh5pget_chunk_cache_c(hid_t_f *dapl_id, size_t_f *rdcc_nslots, size_t_f *rdcc_nbytes, real_f *rdcc_w0);
H5_FCDLL int_f nh5pget_mpio_actual_io_mode_c(hid_t_f *dxpl_id, int_f *actual_io_mode);
/*
* Functions frome H5Rf.c
*/
@ -1152,6 +1179,7 @@ H5_FCDLL int_f nh5pget_chunk_cache_c(hid_t_f *dapl_id, size_t_f *rdcc_nslots, si
#define nh5rdereference_object_c H5_FC_FUNC_(h5rdereference_object_c, H5RDEREFERENCE_OBJECT_C)
#define nh5rdereference_ptr_c H5_FC_FUNC_(h5rdereference_ptr_c, H5RDEREFERENCE_PTR_C)
#define nh5rget_region_region_c H5_FC_FUNC_(h5rget_region_region_c, H5RGET_REGION_REGION_C)
#define nh5rget_region_ptr_c H5_FC_FUNC_(h5rget_region_ptr_c, H5RGET_REGION_PTR_C)
#define nh5rget_object_type_obj_c H5_FC_FUNC_(h5rget_object_type_obj_c, H5RGET_OBJECT_TYPE_OBJ_C)
#define nh5rget_name_object_c H5_FC_FUNC_(h5rget_name_object_c, H5RGET_NAME_OBJECT_C)
#define nh5rget_name_region_c H5_FC_FUNC_(h5rget_name_region_c, H5RGET_NAME_REGION_C)
@ -1166,6 +1194,7 @@ H5_FCDLL int_f nh5rdereference_region_c (hid_t_f *dset_id, int_f *ref, hid_t_f *
H5_FCDLL int_f nh5rdereference_object_c (hid_t_f *dset_id, haddr_t_f *ref, hid_t_f *obj_id);
H5_FCDLL int_f nh5rdereference_ptr_c (hid_t_f *obj_id, int_f *ref_type, void *ref, hid_t_f *ref_obj_id);
H5_FCDLL int_f nh5rget_region_region_c (hid_t_f *dset_id, int_f *ref, hid_t_f *space_id);
H5_FCDLL int_f nh5rget_region_ptr_c(hid_t_f *dset_id, void *ref, hid_t_f *space_id);
H5_FCDLL int_f nh5rget_object_type_obj_c (hid_t_f *dset_id, haddr_t_f *ref, int_f *obj_type);
H5_FCDLL int_f nh5rget_name_object_c (hid_t_f *loc_id, haddr_t_f *ref, _fcd name, size_t_f *name_len, size_t_f *size_default);
H5_FCDLL int_f nh5rget_name_region_c (hid_t_f *loc_id, int_f *ref, _fcd name, size_t_f *name_len, size_t_f *size_default);

View File

@ -533,7 +533,21 @@ int main(void)
/* double_f */
#if defined H5_FORTRAN_HAS_DOUBLE_NATIVE_16_KIND
writeFloatToFiles("Fortran_DOUBLE", "double_f", 16, H5_FORTRAN_HAS_DOUBLE_NATIVE_16_KIND);
if(H5_C_HAS_REAL_NATIVE_16 != 0) { /* Check if C has 16 byte floats */
writeFloatToFiles("Fortran_DOUBLE", "double_f", 16, H5_FORTRAN_HAS_DOUBLE_NATIVE_16_KIND);
} else {
#if defined H5_FORTRAN_HAS_REAL_NATIVE_8_KIND /* Fall back to 8 byte floats */
writeFloatToFiles("Fortran_DOUBLE", "double_f", 8, H5_FORTRAN_HAS_REAL_NATIVE_8_KIND);
}
#elif defined H5_FORTRAN_HAS_REAL_NATIVE_4_KIND /* Fall back to 4 byte floats */
writeFloatToFiles("Fortran_DOUBLE", "double_f", 4, H5_FORTRAN_HAS_REAL_NATIVE_4_KIND);
}
#else
/* Error: couldn't find a size for double_f when fortran has 16 byte reals */
return -1;
}
#endif
#elif defined H5_FORTRAN_HAS_DOUBLE_NATIVE_8_KIND
writeFloatToFiles("Fortran_DOUBLE", "double_f", 8, H5_FORTRAN_HAS_DOUBLE_NATIVE_8_KIND);
#else
@ -541,6 +555,14 @@ int main(void)
return -1;
#endif
/* Need the buffer size for the fortran derive type 'hdset_reg_ref_t_f03'
* in order to be interoperable with C's structure, the C buffer size
* H5R_DSET_REG_REF_BUF_SIZE is (sizeof(haddr_t)+4)
*/
fprintf(fort_header, " INTEGER, PARAMETER :: H5R_DSET_REG_REF_BUF_SIZE_F = %u\n", H5_SIZEOF_HADDR_T + 4 );
/* Close files */
endCfile();
endFfile();

View File

@ -517,7 +517,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog
# Add libtool shared library version numbers to the HDF5 library
# See libtool versioning documentation online.
LT_VERS_INTERFACE = 6
LT_VERS_REVISION = 118
LT_VERS_REVISION = 122
LT_VERS_AGE = 0
# Include src directory in both Fortran and C flags (C compiler is used

View File

@ -284,10 +284,25 @@ H5L_mp_H5LIS_REGISTERED_F
H5L_mp_H5LMOVE_F
H5L_mp_H5LGET_NAME_BY_IDX_F
; H5O
H5O_mp_H5OCLOSE_F
H5O_mp_H5OCOPY_F
H5O_mp_H5ODECR_REFCOUNT_F
H5O_mp_H5OEXISTS_BY_NAME_F
H5O_mp_H5OGET_COMMENT_F
H5O_mp_H5OGET_COMMENT_BY_NAME_F
H5O_mp_H5OINCR_REFCOUNT_F
H5O_mp_H5OLINK_F
H5O_mp_H5OOPEN_F
H5O_mp_H5OOPEN_BY_ADDR_F
H5O_mp_H5OOPEN_BY_IDX_F
H5O_mp_H5OOPEN_F
H5O_mp_H5OSET_COMMENT_F
H5O_mp_H5OSET_COMMENT_BY_NAME_F
; These should only get compiled with option --enable-fortran2003
;H5O_PROVISIONAL_mp_H5OGET_INFO_BY_IDX_F
;H5O_PROVISIONAL_mp_H5OGET_INFO_BY_NAME_F
;H5O_PROVISIONAL_mp_H5OGET_INFO_F
;H5O_PROVISIONAL_mp_H5OVISIT_BY_NAME_F
;H5O_PROVISIONAL_mp_H5OVISIT_F
; H5P
H5P_mp_H5PCREATE_F
H5P_mp_H5PSET_PRESERVE_F
@ -429,7 +444,8 @@ H5R_PROVISIONAL_mp_H5RCREATE_OBJECT_F
H5R_PROVISIONAL_mp_H5RCREATE_REGION_F
H5R_PROVISIONAL_mp_H5RDEREFERENCE_OBJECT_F
H5R_PROVISIONAL_mp_H5RDEREFERENCE_REGION_F
H5R_mp_H5RGET_REGION_REGION_F
H5R_PROVISIONAL_mp_H5RGET_REGION_REGION_F
H5R_mp_H5RGET_OBJECT_TYPE_OBJ_F
H5R_PROVISIONAL_mp_H5RGET_NAME_OBJECT_F
H5R_PROVISIONAL_mp_H5RGET_NAME_REGION_F

View File

@ -284,10 +284,25 @@ H5L_mp_H5LIS_REGISTERED_F
H5L_mp_H5LMOVE_F
H5L_mp_H5LGET_NAME_BY_IDX_F
; H5O
H5O_mp_H5OCLOSE_F
H5O_mp_H5OCOPY_F
H5O_mp_H5ODECR_REFCOUNT_F
H5O_mp_H5OEXISTS_BY_NAME_F
H5O_mp_H5OGET_COMMENT_F
H5O_mp_H5OGET_COMMENT_BY_NAME_F
H5O_mp_H5OINCR_REFCOUNT_F
H5O_mp_H5OLINK_F
H5O_mp_H5OOPEN_F
H5O_mp_H5OOPEN_BY_ADDR_F
H5O_mp_H5OOPEN_BY_IDX_F
H5O_mp_H5OOPEN_F
H5O_mp_H5OSET_COMMENT_F
H5O_mp_H5OSET_COMMENT_BY_NAME_F
; These should only get compiled with option --enable-fortran2003
;H5O_PROVISIONAL_mp_H5OGET_INFO_BY_IDX_F
;H5O_PROVISIONAL_mp_H5OGET_INFO_BY_NAME_F
;H5O_PROVISIONAL_mp_H5OGET_INFO_F
;H5O_PROVISIONAL_mp_H5OVISIT_BY_NAME_F
;H5O_PROVISIONAL_mp_H5OVISIT_F
; H5P
H5P_mp_H5PCREATE_F
H5P_mp_H5PSET_PRESERVE_F
@ -429,7 +444,8 @@ H5R_PROVISIONAL_mp_H5RCREATE_OBJECT_F
H5R_PROVISIONAL_mp_H5RCREATE_REGION_F
H5R_PROVISIONAL_mp_H5RDEREFERENCE_OBJECT_F
H5R_PROVISIONAL_mp_H5RDEREFERENCE_REGION_F
H5R_mp_H5RGET_REGION_REGION_F
H5R_PROVISIONAL_mp_H5RGET_REGION_REGION_F
H5R_mp_H5RGET_OBJECT_TYPE_OBJ_F
H5R_PROVISIONAL_mp_H5RGET_NAME_OBJECT_F
H5R_PROVISIONAL_mp_H5RGET_NAME_REGION_F
@ -528,4 +544,9 @@ H5Z_mp_H5ZFILTER_AVAIL_F
H5Z_mp_H5ZGET_FILTER_INFO_F
; Parallel
H5FDMPIO_mp_H5PSET_FAPL_MPIO_F
H5FDMPIO_mp_H5PGET_FAPL_MPIO_F
H5FDMPIO_mp_H5PSET_DXPL_MPIO_F
H5FDMPIO_mp_H5PGET_DXPL_MPIO_F
H5FDMPIO_mp_H5PSET_FAPL_MPIPOSIX_F
H5FDMPIO_mp_H5PGET_FAPL_MPIPOSIX_F
H5FDMPIO_mp_H5PGET_MPIO_ACTUAL_IO_MODE_F

View File

@ -106,6 +106,7 @@ IF (FORTRAN_HAVE_ISO_C_BINDING AND HDF5_ENABLE_F2003)
tH5F.f90
tH5E_F03.f90
tH5L_F03.f90
tH5O_F03.f90
tH5P_F03.f90
tH5T_F03.f90
)

View File

@ -68,7 +68,7 @@ fortranlib_test_1_8_SOURCES = fortranlib_test_1_8.f90 \
if FORTRAN_2003_CONDITIONAL_F
fortranlib_test_F03_SOURCES = fortranlib_test_F03.f90 \
tH5F.f90 tH5E_F03.f90 tH5L_F03.f90 tH5P_F03.f90 tH5T_F03.f90
tH5F.f90 tH5E_F03.f90 tH5L_F03.f90 tH5O_F03.f90 tH5P_F03.f90 tH5T_F03.f90
endif

View File

@ -136,11 +136,13 @@ fortranlib_test_1_8_LDADD = $(LDADD)
fortranlib_test_1_8_DEPENDENCIES = libh5test_fortran.la $(LIBH5TEST) \
$(LIBH5F) $(LIBHDF5)
am__fortranlib_test_F03_SOURCES_DIST = fortranlib_test_F03.f90 \
tH5F.f90 tH5E_F03.f90 tH5L_F03.f90 tH5P_F03.f90 tH5T_F03.f90
tH5F.f90 tH5E_F03.f90 tH5L_F03.f90 tH5O_F03.f90 tH5P_F03.f90 \
tH5T_F03.f90
@FORTRAN_2003_CONDITIONAL_F_TRUE@am_fortranlib_test_F03_OBJECTS = fortranlib_test_F03.$(OBJEXT) \
@FORTRAN_2003_CONDITIONAL_F_TRUE@ tH5F.$(OBJEXT) \
@FORTRAN_2003_CONDITIONAL_F_TRUE@ tH5E_F03.$(OBJEXT) \
@FORTRAN_2003_CONDITIONAL_F_TRUE@ tH5L_F03.$(OBJEXT) \
@FORTRAN_2003_CONDITIONAL_F_TRUE@ tH5O_F03.$(OBJEXT) \
@FORTRAN_2003_CONDITIONAL_F_TRUE@ tH5P_F03.$(OBJEXT) \
@FORTRAN_2003_CONDITIONAL_F_TRUE@ tH5T_F03.$(OBJEXT)
fortranlib_test_F03_OBJECTS = $(am_fortranlib_test_F03_OBJECTS)
@ -525,7 +527,7 @@ fortranlib_test_1_8_SOURCES = fortranlib_test_1_8.f90 \
tH5F.f90 tH5O.f90 tH5A_1_8.f90 tH5G_1_8.f90
@FORTRAN_2003_CONDITIONAL_F_TRUE@fortranlib_test_F03_SOURCES = fortranlib_test_F03.f90 \
@FORTRAN_2003_CONDITIONAL_F_TRUE@ tH5F.f90 tH5E_F03.f90 tH5L_F03.f90 tH5P_F03.f90 tH5T_F03.f90
@FORTRAN_2003_CONDITIONAL_F_TRUE@ tH5F.f90 tH5E_F03.f90 tH5L_F03.f90 tH5O_F03.f90 tH5P_F03.f90 tH5T_F03.f90
fflush1_SOURCES = fflush1.f90
fflush2_SOURCES = fflush2.f90

View File

@ -93,12 +93,6 @@ PROGRAM fortranlibtest
' Testing dataspace encoding and decoding', &
total_error)
ret_total_error = 0
CALL test_nbit(cleanup, ret_total_error )
CALL write_test_status(ret_total_error, &
' Testing nbit filter', &
total_error)
ret_total_error = 0
CALL test_scaleoffset(cleanup, ret_total_error )
CALL write_test_status(ret_total_error, &
@ -400,141 +394,6 @@ SUBROUTINE test_h5s_encode(cleanup, total_error)
END SUBROUTINE test_h5s_encode
!-------------------------------------------------------------------------
! Function: test_nbit
!
! Purpose: Tests (real) datatype for nbit filter
!
! Return: Success: 0
! Failure: >0
!
! Programmer: M. Scot Breitenfeld
! Decemeber 7, 2010
!
! Modifications:
!
!-------------------------------------------------------------------------
!
SUBROUTINE test_nbit(cleanup, total_error )
USE HDF5
IMPLICIT NONE
INTEGER, PARAMETER :: wp = KIND(1.0)
LOGICAL, INTENT(IN) :: cleanup
INTEGER, INTENT(INOUT) :: total_error
INTEGER(hid_t) :: file
INTEGER(hid_t) :: dataset, datatype, space, dc
INTEGER(hsize_t), DIMENSION(1:2) :: dims = (/2,5/)
INTEGER(hsize_t), DIMENSION(1:2) :: chunk_dim = (/2,5/)
! orig_data[] are initialized to be within the range that can be represented by
! dataset datatype (no precision loss during datatype conversion)
!
REAL(kind=wp), DIMENSION(1:2,1:5) :: orig_data = RESHAPE( (/188384.00, 19.103516, -1.0831790e9, -84.242188, &
5.2045898, -49140.000, 2350.2500, -3.2110596e-1, 6.4998865e-5, -0.0000000/) , (/2,5/) )
REAL(kind=wp), DIMENSION(1:2,1:5) :: new_data
INTEGER(size_t) :: PRECISION, offset
INTEGER :: error
LOGICAL :: status
INTEGER*8 :: ii
INTEGER(size_t) :: i, j
! check to see if filter is available
CALL H5Zfilter_avail_f(H5Z_FILTER_NBIT_F, status, error)
IF(.NOT.status)THEN ! We don't have H5Z_FILTER_NBIT_F filter
total_error = -1 ! so return
RETURN
ENDIF
CALL H5Fcreate_f("nbit.h5", H5F_ACC_TRUNC_F, file, error)
CALL check("H5Fcreate_f", error, total_error)
! Define dataset datatype (integer), and set precision, offset
CALL H5Tcopy_f(H5T_IEEE_F32BE, datatype, error)
CALL CHECK(" H5Tcopy_f", error, total_error)
CALL H5Tset_fields_f(datatype, 26_size_t, 20_size_t, 6_size_t, 7_size_t, 13_size_t, error)
CALL CHECK(" H5Tset_fields_f", error, total_error)
offset = 7
CALL H5Tset_offset_f(datatype, offset, error)
CALL CHECK(" H5Tset_offset_f", error, total_error)
PRECISION = 20
CALL H5Tset_precision_f(datatype,PRECISION, error)
CALL CHECK(" H5Tset_precision_f", error, total_error)
CALL H5Tset_size_f(datatype, 4_size_t, error)
CALL CHECK(" H5Tset_size_f", error, total_error)
CALL H5Tset_ebias_f(datatype, 31_size_t, error)
CALL CHECK(" H5Tset_ebias_f", error, total_error)
! Create the data space
CALL H5Screate_simple_f(2, dims, space, error)
CALL CHECK(" H5Screate_simple_f", error, total_error)
! USE nbit filter
CALL H5Pcreate_f(H5P_DATASET_CREATE_F, dc, error)
CALL CHECK(" H5Pcreate_f", error, total_error)
CALL H5Pset_chunk_f(dc, 2, chunk_dim, error)
CALL CHECK(" H5Pset_chunk_f", error, total_error)
CALL H5Pset_nbit_f(dc, error)
CALL CHECK(" H5Pset_nbit_f", error, total_error)
! Create the dataset
CALL H5Dcreate_f(file, "nbit_real", datatype, &
space, dataset, error, dc)
CALL CHECK(" H5Dcreate_f", error, total_error)
!----------------------------------------------------------------------
! STEP 1: Test nbit by setting up a chunked dataset and writing
! to it.
!----------------------------------------------------------------------
!
CALL H5Dwrite_f(dataset, H5T_NATIVE_REAL, orig_data, dims, error)
CALL CHECK(" H5Dwrite_f", error, total_error)
!----------------------------------------------------------------------
! STEP 2: Try to read the data we just wrote.
!----------------------------------------------------------------------
!
CALL H5Dread_f(dataset, H5T_NATIVE_REAL, new_data, dims, error)
CALL CHECK(" H5Dread_f", error, total_error)
! Check that the values read are the same as the values written
! Assume size of long long = size of double
!
i_loop: DO i = 1, dims(1)
j_loop: DO j = 1, dims(2)
IF(.NOT.(orig_data(i,j).EQ.orig_data(i,j))) CYCLE ! skip IF value is NaN
IF(new_data(i,j) .NE. orig_data(i,j))THEN
total_error = total_error + 1
WRITE(*,'(" Read different values than written.")')
WRITE(*,'(" At index ", 2(1X,I0))') i, j
EXIT i_loop
END IF
ENDDO j_loop
ENDDO i_loop
!----------------------------------------------------------------------
! Cleanup
!----------------------------------------------------------------------
!
CALL H5Tclose_f(datatype, error)
CALL CHECK(" H5Tclose_f", error, total_error)
CALL H5Pclose_f(dc, error)
CALL CHECK(" H5Pclose_f", error, total_error)
CALL H5Sclose_f(space, error)
CALL CHECK(" H5Sclose_f", error, total_error)
CALL H5Dclose_f(dataset, error)
CALL CHECK(" H5Dclose_f", error, total_error)
CALL H5Fclose_f(file, error)
CALL CHECK(" H5Fclose_f", error, total_error)
END SUBROUTINE test_nbit
!-------------------------------------------------------------------------
! Function: test_scaleoffset
!

View File

@ -64,10 +64,7 @@ PROGRAM fortranlibtest_F03
! CALL write_test_status(ret_total_error, ' Test error API based on data I/O', total_error)
WRITE(*,*)
! write(*,*)
! write(*,*) '========================================='
! write(*,*) 'Testing DATATYPE interface '
! write(*,*) '========================================='
ret_total_error = 0
CALL test_array_compound_atomic(ret_total_error)
CALL write_test_status(ret_total_error, ' Testing 1-D Array of Compound Datatypes Functionality', total_error)
@ -116,17 +113,17 @@ PROGRAM fortranlibtest_F03
CALL t_string(ret_total_error)
CALL write_test_status(ret_total_error, ' Testing writing/reading string datatypes, using C_LOC', total_error)
ret_total_error = 0
CALL vl_test_special_char(ret_total_error)
CALL write_test_status(ret_total_error, ' Testing string datatypes containing control characters', total_error)
ret_total_error = 0
CALL test_create(ret_total_error)
CALL write_test_status(ret_total_error, &
' Testing filling functions', &
total_error)
CALL write_test_status(ret_total_error, ' Testing filling functions', total_error)
ret_total_error = 0
CALL test_h5kind_to_type(total_error)
CALL write_test_status(ret_total_error, &
' Test function h5kind_to_type', &
total_error)
CALL write_test_status(ret_total_error, ' Test function h5kind_to_type', total_error)
ret_total_error = 0
CALL test_array_bkg(ret_total_error)
@ -138,14 +135,30 @@ PROGRAM fortranlibtest_F03
ret_total_error = 0
CALL test_iter_group(ret_total_error)
CALL write_test_status(ret_total_error, ' Testing Group Iteration Functionality', total_error)
CALL write_test_status(ret_total_error, ' Testing group iteration functionality', total_error)
ret_total_error = 0
CALL test_nbit(ret_total_error)
CALL write_test_status(ret_total_error, ' Testing nbit filter', total_error)
! write(*,*)
! write(*,*) '========================================='
! write(*,*) 'Testing GROUP interface '
! write(*,*) '========================================='
ret_total_error = 0
CALL test_h5o_refcount(ret_total_error)
CALL write_test_status(ret_total_error, ' Testing object functions ', total_error)
ret_total_error = 0
CALL obj_visit(ret_total_error)
CALL write_test_status(ret_total_error, ' Testing object visiting functions ', total_error)
ret_total_error = 0
CALL obj_info(ret_total_error)
CALL write_test_status(ret_total_error, ' Testing object info functions ', total_error)
WRITE(*,*)
WRITE(*,*) ' ============================================ '

View File

@ -100,7 +100,7 @@
CHARACTER(LEN=35), DIMENSION(2) :: aread_data ! Buffer to put read back
! string attr data
CHARACTER :: attr_character_data = 'A'
DOUBLE PRECISION, DIMENSION(1) :: attr_double_data = 3.459
REAL(KIND=Fortran_DOUBLE), DIMENSION(1) :: attr_double_data = 3.459
REAL, DIMENSION(1) :: attr_real_data = 4.0
INTEGER, DIMENSION(1) :: attr_integer_data = 5
INTEGER(HSIZE_T), DIMENSION(7) :: data_dims
@ -109,7 +109,7 @@
CHARACTER :: aread_character_data ! variable to put read back Character attr data
INTEGER, DIMENSION(1) :: aread_integer_data ! variable to put read back integer attr data
INTEGER, DIMENSION(1) :: aread_null_data = 7 ! variable to put read back null attr data
DOUBLE PRECISION, DIMENSION(1) :: aread_double_data ! variable to put read back double attr data
REAL(KIND=Fortran_DOUBLE), DIMENSION(1) :: aread_double_data ! variable to put read back double attr data
REAL, DIMENSION(1) :: aread_real_data ! variable to put read back real attr data
!

View File

@ -35,15 +35,8 @@ SUBROUTINE test_h5o(cleanup, total_error)
INTEGER, INTENT(OUT) :: total_error
INTEGER :: error
! /* Output message about test being performed */
! WRITE(*,*) "Testing Objects"
!!$ test_h5o_open(); /* Test generic OPEN FUNCTION */
!!$ test_h5o_open_by_addr(); /* Test opening objects by address */
!!$ test_h5o_close(); /* Test generic CLOSE FUNCTION */
!!$ test_h5o_refcount(); /* Test incrementing and decrementing reference count */
CALL test_h5o_plist(total_error) ! /* Test object creation properties */
CALL test_h5o_link(total_error) ! /* Test object link routine */
CALL test_h5o_plist(total_error) ! Test object creation properties
CALL test_h5o_link(total_error) ! Test object link routine
IF(cleanup) CALL h5_cleanup_f("TestFile", H5P_DEFAULT_F, error)
CALL check("h5_cleanup_f", error, total_error)
@ -100,6 +93,19 @@ SUBROUTINE test_h5o_link(total_error)
INTEGER(HSIZE_T), DIMENSION(1:1) :: dims2 = (/dim0/) ! size read/write buffer
INTEGER , DIMENSION(1:dim0) :: wdata2, & ! Write buffer
rdata2 ! Read buffer
LOGICAL :: link_exists
CHARACTER(LEN=8) :: chr_exact
CHARACTER(LEN=10) :: chr_lg
INTEGER(size_t) :: nlinks
INTEGER(HID_T) :: plist = -1
CHARACTER(LEN=20) :: dset_comment = "dataset comment"
CHARACTER(LEN=13) :: grp_comment = "group comment"
CHARACTER(LEN=10) :: comment_sm ! to small comment sized buffer
CHARACTER(LEN=15) :: comment ! exact comment sized buffer
CHARACTER(LEN=20) :: comment_lg ! large comment sized buffer
INTEGER(HSSIZE_T) :: comment_size
INTEGER(SIZE_T) :: comment_size2
! Initialize the raw data
DO i = 1, TEST6_DIM1
@ -131,8 +137,6 @@ SUBROUTINE test_h5o_link(total_error)
CALL H5Pset_libver_bounds_f(fapl_id, H5F_LIBVER_LATEST_F, H5F_LIBVER_LATEST_F, error)
CALL check("H5Pset_libver_bounds_f",error, total_error)
!!$ ret = H5Pset_libver_bounds(fapl_id, (new_format ? H5F_LIBVER_LATEST : H5F_LIBVER_EARLIEST), H5F_LIBVER_LATEST);
! Create a new HDF5 file
CALL H5Fcreate_f(TEST_FILENAME, H5F_ACC_TRUNC_F, file_id, error, H5P_DEFAULT_F, fapl_id)
CALL check("H5Fcreate_f", error, total_error)
@ -155,10 +159,9 @@ SUBROUTINE test_h5o_link(total_error)
! Create a dataset with no name using the committed datatype
CALL H5Dcreate_anon_f(file_id, type_id, space_id, dset_id, error ) ! using no optional parameters
CALL check("H5Dcreate_anon_f",error,total_error)
!
! Verify that we can write to and read from the dataset
!
! Write the data to the dataset
!EP CALL h5dwrite_f(dset_id, H5T_NATIVE_INTEGER, wdata, dims, error, &
@ -199,7 +202,6 @@ SUBROUTINE test_h5o_link(total_error)
CALL h5tclose_f(type_id, error)
CALL check("h5tclose_f", error, total_error)
! Re-open datatype using new link
CALL H5Topen_f(group_id, "datatype", type_id, error)
CALL check("h5topen_f", error, total_error)
@ -208,12 +210,10 @@ SUBROUTINE test_h5o_link(total_error)
CALL H5Olink_f(group_id, file_id, "/group", error)
CALL check("H5Olink_f", error, total_error)
CALL h5gclose_f(group_id, error)
CALL check("h5gclose_f",error,total_error)
! Open dataset through root group and verify its data
CALL H5Dopen_f(file_id, "/group/inter_group/dataset", dset_id, error)
CALL check("test_lcpl.h5dopen_f", error, total_error)
@ -236,7 +236,6 @@ SUBROUTINE test_h5o_link(total_error)
CALL h5tclose_f(type_id, error)
CALL check("h5tclose_f",error,total_error)
! Close remaining IDs
CALL h5sclose_f(space_id, error)
CALL check("h5sclose_f",error,total_error)
@ -264,16 +263,214 @@ SUBROUTINE test_h5o_link(total_error)
CALL check("h5gcreate_f", error, total_error)
CALL h5gcreate_f(file_id,"/G1/G2/G3",group_id,error)
CALL check("h5gcreate_f", error, total_error)
! Try putting a comment on the group /G1/G2/G3 by name
CALL h5oset_comment_by_name_f(file_id, "/G1/G2/G3", grp_comment, error)
CALL check("h5oset_comment_by_name_f", error, total_error)
comment_lg = ' '
CALL h5oget_comment_by_name_f(file_id, "/G1/G2/G3", comment_lg, error)
CALL check("h5oget_comment_by_name_f", error, total_error)
IF(comment_lg(1:13).NE.grp_comment)THEN
CALL check("h5oget_comment_by_name_f", -1, total_error)
ENDIF
IF(comment_lg(14:20).NE.' ')THEN ! make sure no NULL terminator
CALL check("h5oget_comment_by_name_f", -1, total_error)
ENDIF
! Try putting a comment on the group /G1/G2/G3 by name with trailing blanks
CALL h5oset_comment_by_name_f(file_id, "/G1/G2/G3"//' ', grp_comment, error)
CALL check("h5oset_comment_by_name_f", error, total_error)
comment_lg = ' '
CALL h5oget_comment_by_name_f(file_id, "/G1/G2/G3"//' ', comment_lg, error)
CALL check("h5oget_comment_by_name_f", error, total_error)
IF(comment_lg(1:13).NE.grp_comment)THEN
CALL check("h5oget_comment_by_name_f", -1, total_error)
ENDIF
IF(comment_lg(14:20).NE.' ')THEN ! make sure no NULL terminator
CALL check("h5oget_comment_by_name_f", -1, total_error)
ENDIF
!
! Create the dataset
!
CALL h5dcreate_f(group_id, dataset, H5T_STD_I32LE, space_id, dset_id, error)
CALL check("h5dcreate_f", error, total_error)
! Putting a comment on the dataset
CALL h5oset_comment_f(dset_id, dset_comment, error)
CALL check("h5oset_comment_f", error, total_error)
! Try reading into a buffer that is the correct size
CALL h5oget_comment_f(dset_id, comment, error)
CALL check("h5oget_comment_f", error, total_error)
IF(comment(1:15).NE.dset_comment(1:15))THEN
CALL check("h5oget_comment_f", -1, total_error)
ENDIF
! Try reading into a buffer that is to small
CALL h5oget_comment_f(dset_id, comment_sm, error)
CALL check("h5oget_comment_f", error, total_error)
IF(comment_sm(1:10).NE.dset_comment(1:10))THEN
CALL check("h5oget_comment_f", -1, total_error)
ENDIF
! Try reading into a buffer that is larger then needed
comment_lg = ' '
CALL h5oget_comment_f(dset_id, comment_lg, error)
CALL check("h5oget_comment_f", error, total_error)
IF(comment_lg(1:15).NE.dset_comment)THEN
CALL check("h5oget_comment_f", -1, total_error)
ENDIF
IF(comment_lg(16:20).NE.' ')THEN ! make sure no NULL terminator
CALL check("h5oget_comment_f", -1, total_error)
ENDIF
!
! Check optional parameter
!
CALL h5oget_comment_f(dset_id, comment_lg, error, comment_size)
CALL check("h5oget_comment_f", error, total_error)
IF( comment_size.NE.15)THEN
CALL check("h5oget_comment_f", -1, total_error)
ENDIF
! CHECK h5oget_comment_by_name_f
! Try reading into a buffer that is the correct size
CALL h5oget_comment_by_name_f(dset_id, ".", comment, error)
CALL check("h5oget_comment_by_name_f", error, total_error)
IF(comment(1:15).NE.dset_comment(1:15))THEN
CALL check("h5oget_comment_by_name_f", -1, total_error)
ENDIF
! Try with trailing blanks in the name
CALL h5oget_comment_by_name_f(dset_id, ". ", comment, error)
CALL check("h5oget_comment_by_name_f", error, total_error)
IF(comment(1:15).NE.dset_comment(1:15))THEN
CALL check("h5oget_comment_by_name_f", -1, total_error)
ENDIF
!
! Check optional parameter
!
CALL h5oget_comment_by_name_f(dset_id, ". ", comment_lg, error, comment_size2)
CALL check("h5oget_comment_by_name_f", error, total_error)
IF( comment_size2.NE.15)THEN
CALL check("h5oget_comment_by_name_f", -1, total_error)
ENDIF
!
! Write the data to the dataset.
!
CALL h5dwrite_f(dset_id, H5T_NATIVE_INTEGER, wdata2, dims2, error)
CALL check("h5dwrite_f", error, total_error)
! *************************
! CHECK H5OEXISTS_BY_NAME_F
! *************************
! Create a soft link to /G1
CALL h5lcreate_soft_f("/G1", file_id, "/G1_LINK", error)
CALL check("h5lcreate_soft_f", error, total_error)
! Create a soft link to /G1000, does not exist
CALL h5lcreate_soft_f("/G1000", file_id, "/G1_FALSE", error)
CALL check("h5lcreate_soft_f", error, total_error)
! Create a soft link to /G1_LINK
CALL h5lcreate_soft_f("/G1_FALSE", file_id, "/G2_FALSE", error)
CALL check("h5lcreate_soft_f", error, total_error)
! See if the link exists
CALL h5oexists_by_name_f(file_id,"/G1_LINK", link_exists, error)
CALL check("h5oexists_by_name_f", error, total_error)
! Object should exist
IF(.NOT.link_exists)THEN
CALL check("h5oexists_by_name_f", -1, total_error)
ENDIF
chr_exact = "/G1_LINK"
! See if the link exists
CALL h5oexists_by_name_f(file_id,chr_exact, link_exists, error, H5P_DEFAULT_F)
CALL check("h5oexists_by_name_f", error, total_error)
! Object should exist
IF(.NOT.link_exists)THEN
CALL check("h5oexists_by_name_f", -1, total_error)
ENDIF
chr_lg = "/G1_LINK"
! See if the link exists
CALL h5oexists_by_name_f(file_id,chr_lg, link_exists, error, H5P_DEFAULT_F)
CALL check("h5oexists_by_name_f", error, total_error)
! Object should exist
IF(.NOT.link_exists)THEN
CALL check("h5oexists_by_name_f", -1, total_error)
ENDIF
chr_lg = "/G1_LINK "
! See if the link exists
CALL h5oexists_by_name_f(file_id,chr_lg, link_exists, error, H5P_DEFAULT_F)
CALL check("h5oexists_by_name_f", error, total_error)
! Object should exist
IF(.NOT.link_exists)THEN
CALL check("h5oexists_by_name_f", -1, total_error)
ENDIF
! See if the link exists
CALL h5oexists_by_name_f(file_id,"/G1_FALSE", link_exists, error)
CALL check("h5oexists_by_name_f", error, total_error)
! Object should not exist
IF(link_exists)THEN
CALL check("h5oexists_by_name_f", -1, total_error)
ENDIF
! Check optional parameter
CALL h5pcreate_f(H5P_LINK_ACCESS_F,plist,error)
CALL check("h5pcreate_f",error,total_error)
nlinks = 2
CALL h5pset_nlinks_f(plist, nlinks, error)
CALL check("h5pset_nlinks_f", error, total_error)
! Ensure that nlinks was set successfully
nlinks = 0
CALL h5pget_nlinks_f(plist, nlinks, error)
CALL check("h5pget_nlinks_f",error,total_error)
CALL VERIFY("h5pget_nlinks_f", INT(nlinks), 2, total_error)
! See if the link exists
CALL h5oexists_by_name_f(file_id,"/G1_LINK", link_exists, error, plist)
CALL check("h5oexists_by_name_f", error, total_error)
! Object should exist
IF(.not.link_exists)THEN
CALL check("h5oexists_by_name_f", -1, total_error)
ENDIF
!
! Close and release resources.
!
@ -283,6 +480,14 @@ SUBROUTINE test_h5o_link(total_error)
CALL check("h5sclose_f", error, total_error)
CALL h5gclose_f(group_id, error)
CALL check("h5gclose_f", error, total_error)
! Test opening an object by index, note
CALL h5oopen_by_idx_f(file_id, "/G1/G2/G3", H5_INDEX_NAME_F, H5_ITER_INC_F, 0_hsize_t, group_id, error)
CALL check("h5oopen_by_idx_f", error, total_error)
CALL h5oclose_f(group_id, error)
CALL check("h5gclose_f", error, total_error)
!
! create property to pass copy options
!
@ -324,7 +529,7 @@ SUBROUTINE test_h5o_link(total_error)
CALL h5tcopy_f(H5T_NATIVE_INTEGER, tid, error)
CALL check("h5tcopy_f", error, total_error)
! create named datatype
! create named datatype
CALL h5tcommit_f(file_id, NAME_DATATYPE_SIMPLE, tid, error)
CALL check("h5tcommit_f", error, total_error)
@ -346,8 +551,7 @@ SUBROUTINE test_h5o_link(total_error)
! Compare the datatypes
CALL h5tequal_f(tid, tid2, flag, error)
IF(.NOT.flag)THEN
WRITE(*,*) "h5ocopy_f FAILED"
total_error = total_error + 1
CALL check("h5ocopy_f FAILED", -1, total_error)
ENDIF
! close the destination datatype
@ -436,7 +640,6 @@ SUBROUTINE test_h5o_plist(total_error)
CALL VERIFY("H5Pget_attr_phase_change_f", max_compact, (def_max_compact + 1), total_error)
CALL VERIFY("H5Pget_attr_phase_change_f", min_dense, (def_min_dense - 1), total_error)
! Create a group, dataset, and committed datatype within the file,
! using the respective type of creation property lists.
!
@ -472,7 +675,6 @@ SUBROUTINE test_h5o_plist(total_error)
CALL h5sclose_f(dspace, error)
CALL check("h5sclose_f",error,total_error)
! Close current creation property lists
CALL h5pclose_f(gcpl,error)
CALL check("h5pclose_f", error, total_error)
@ -482,7 +684,6 @@ SUBROUTINE test_h5o_plist(total_error)
CALL check("h5pclose_f", error, total_error)
! Retrieve each object's creation property list
CALL H5Gget_create_plist_f(grp, gcpl, error)
CALL check("H5Gget_create_plist", error, total_error)
@ -492,7 +693,6 @@ SUBROUTINE test_h5o_plist(total_error)
CALL H5Dget_create_plist_f(dset, dcpl, error)
CALL check("H5Dget_create_plist_f", error, total_error)
! Retrieve attribute phase change values on each creation property list and verify
CALL H5Pget_attr_phase_change_f(gcpl, max_compact, min_dense, error)
CALL check("H5Pget_attr_phase_change_f", error, total_error)
@ -509,9 +709,7 @@ SUBROUTINE test_h5o_plist(total_error)
CALL VERIFY("H5Pget_attr_phase_change_f", max_compact, (def_max_compact + 1), total_error)
CALL VERIFY("H5Pget_attr_phase_change_f", min_dense, (def_min_dense - 1), total_error)
! Close current objects
CALL h5pclose_f(gcpl,error)
CALL check("h5pclose_f", error, total_error)
CALL h5pclose_f(dcpl,error)
@ -552,7 +750,6 @@ SUBROUTINE test_h5o_plist(total_error)
CALL H5Dget_create_plist_f(dset, dcpl, error)
CALL check("H5Dget_create_plist_f", error, total_error)
! Retrieve attribute phase change values on each creation property list and verify
CALL H5Pget_attr_phase_change_f(gcpl, max_compact, min_dense, error)
CALL check("H5Pget_attr_phase_change_f", error, total_error)
@ -569,9 +766,7 @@ SUBROUTINE test_h5o_plist(total_error)
CALL VERIFY("H5Pget_attr_phase_change_f", max_compact, (def_max_compact + 1), total_error)
CALL VERIFY("H5Pget_attr_phase_change_f", min_dense, (def_min_dense - 1), total_error)
! Close current objects
CALL h5pclose_f(gcpl,error)
CALL check("h5pclose_f", error, total_error)
CALL h5pclose_f(dcpl,error)

547
fortran/test/tH5O_F03.f90 Normal file
View File

@ -0,0 +1,547 @@
!****h* root/fortran/test/tH5O_F03.f90
!
! NAME
! tH5O_F03.f90
!
! FUNCTION
! Test FORTRAN HDF5 H5O APIs which are dependent on FORTRAN 2003
! features.
!
! COPYRIGHT
! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
! Copyright by The HDF Group. *
! Copyright by the Board of Trustees of the University of Illinois. *
! All rights reserved. *
! *
! This file is part of HDF5. The full HDF5 copyright notice, including *
! terms governing use, modification, and redistribution, is contained in *
! the files COPYING and Copyright.html. COPYING can be found at the root *
! of the source code distribution tree; Copyright.html can be found at the *
! root level of an installed copy of the electronic HDF5 document set and *
! is linked from the top-level documents page. It can also be found at *
! http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have *
! access to either file, you may request a copy from help@hdfgroup.org. *
! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
!
!*****
! *****************************************
! *** H 5 O T E S T S
! *****************************************
MODULE visit_cb
USE HDF5
USE ISO_C_BINDING
IMPLICIT NONE
INTEGER, PARAMETER :: info_size = 9
!-------------------------------------------------------------------------
! Function: visit_obj_cb
!
! Purpose: Callback routine for visiting objects in a file
!
! Return: Success: 0
! Failure: -1
!
! Programmer: M.S. Breitenfeld
! July 12, 2012
! Adopted from C test.
!
!-------------------------------------------------------------------------
!
! Object visit structs
TYPE, bind(c) :: obj_visit_t
CHARACTER(LEN=1), DIMENSION(1:180) :: path ! Path to object
INTEGER :: type_obj ! type of object
END TYPE obj_visit_t
TYPE, bind(c) :: ovisit_ud_t
INTEGER :: idx ! Index in object visit structure
TYPE(obj_visit_t), DIMENSION(1:info_size) :: info ! Pointer to the object visit structure to use
END TYPE ovisit_ud_t
CONTAINS
INTEGER FUNCTION visit_obj_cb( group_id, name, oinfo, op_data) bind(C)
IMPLICIT NONE
INTEGER(HID_T) :: group_id
CHARACTER(LEN=1), DIMENSION(1:180) :: name
TYPE(h5o_info_t) :: oinfo
TYPE(ovisit_ud_t) :: op_data
INTEGER :: len, i
INTEGER :: idx
visit_obj_cb = 0
! Since the name is generated in C and passed to a Fortran string, it
! will be NULL terminated, so we need to find the end of the string.
len = 1
DO len = 1, 180
IF(name(len) .EQ. C_NULL_CHAR) EXIT
ENDDO
len = len - 1
! Check for correct object information
idx = op_data%idx
DO i = 1, len
IF(op_data%info(idx)%path(i)(1:1) .NE. name(i)(1:1))THEN
visit_obj_cb = -1
RETURN
ENDIF
IF(op_data%info(idx)%type_obj .NE. oinfo%type)THEN
visit_obj_cb = -1
RETURN
ENDIF
ENDDO
! Advance to next location in expected output
op_data%idx = op_data%idx + 1
END FUNCTION visit_obj_cb
END MODULE visit_cb
!/****************************************************************
!**
!** test_h5o_refcount(): Test H5O refcounting functions.
!**
!****************************************************************/
SUBROUTINE test_h5o_refcount(total_error)
USE HDF5
USE ISO_C_BINDING
IMPLICIT NONE
INTEGER, INTENT(INOUT) :: total_error
CHARACTER(LEN=11), PARAMETER :: FILENAME = "th5o_ref.h5"
INTEGER, PARAMETER :: DIM0 = 5
INTEGER, PARAMETER :: DIM1 = 10
INTEGER(hid_t) :: fid ! HDF5 File ID
INTEGER(hid_t) :: grp, dset, dtype, dspace ! Object identifiers
TYPE(h5o_info_t) :: oinfo ! Object info struct
INTEGER(hsize_t), DIMENSION(1:2) :: dims
INTEGER :: error ! Value returned from API calls
! Create a new HDF5 file
CALL h5fcreate_f(FILENAME,H5F_ACC_TRUNC_F,fid,error)
CALL check("h5fcreate_f", error, total_error)
! Create a group, dataset, and committed datatype within the file
! Create the group
CALL h5gcreate_f(fid, "group", grp, error)
CALL check("h5gcreate_f",error, total_error)
! Commit the type inside the group
CALL h5tcopy_f(H5T_NATIVE_INTEGER, dtype, error)
CALL check("H5Tcopy_f",error, total_error)
CALL h5tcommit_f(fid, "datatype", dtype, error)
CALL check("h5tcommit_f", error, total_error)
! Create the data space for the dataset.
dims(1) = DIM0
dims(2) = DIM1
CALL h5screate_simple_f(2, dims, dspace, error)
CALL check("h5screate_simple_f", error, total_error)
! Create the dataset.
CALL h5dcreate_f(fid, "dataset", H5T_NATIVE_INTEGER, dspace, dset, error)
CALL check("h5dcreate_f", error, total_error)
CALL h5sclose_f(dspace, error)
CALL check("h5sclose_f", error, total_error)
! Get ref counts for each object. They should all be 1, since each object has a hard link.
CALL h5oget_info_by_name_f(fid, "group", oinfo, error)
CALL check("h5oget_info_by_name_f", error, total_error)
IF(oinfo%rc.NE.1)THEN
CALL check("h5oget_info_by_name_f", -1, total_error)
ENDIF
CALL h5oget_info_by_name_f(fid, "datatype", oinfo, error)
CALL check("h5oget_info_by_name_f", error, total_error)
IF(oinfo%rc.NE.1)THEN
CALL check("h5oget_info_by_name_f", -1, total_error)
ENDIF
CALL h5oget_info_by_name_f(fid, "dataset", oinfo, error)
CALL check("h5oget_info_by_name_f", error, total_error)
IF(oinfo%rc.NE.1)THEN
CALL check("h5oget_info_by_name_f", -1, total_error)
ENDIF
! Check h5oget_info
CALL h5oget_info_f(grp, oinfo, error)
CALL check("h5oget_info_f", error, total_error)
IF(oinfo%rc.NE.1)THEN
CALL check("h5oget_info_f", -1, total_error)
ENDIF
IF(oinfo%type.NE.H5O_TYPE_GROUP_F)THEN
CALL check("h5oget_info_f", -1, total_error)
ENDIF
! Increment each object's reference count.
CALL h5oincr_refcount_f(grp, error)
CALL check("h5oincr_refcount_f", error, total_error)
CALL h5oincr_refcount_f(dtype, error)
CALL check("h5oincr_refcount_f", error, total_error)
CALL h5oincr_refcount_f(dset, error)
CALL check("h5oincr_refcount_f", error, total_error)
! Get ref counts for each object. They should all be 2 now.
CALL h5oget_info_by_name_f(fid, "group", oinfo, error)
CALL check("h5oget_info_by_name_f", error, total_error)
IF(oinfo%rc.NE.2)THEN
CALL check("h5oget_info_by_name_f", -1, total_error)
ENDIF
CALL h5oget_info_by_name_f(fid, "datatype", oinfo, error)
CALL check("h5oget_info_by_name_f", error, total_error)
IF(oinfo%rc.NE.2)THEN
CALL check("h5oget_info_by_name_f", -1, total_error)
ENDIF
CALL h5oget_info_by_name_f(fid, "dataset", oinfo, error)
CALL check("h5oget_info_by_name_f", error, total_error)
IF(oinfo%rc.NE.2)THEN
CALL check("h5oget_info_by_name_f", -1, total_error)
ENDIF
! Decrement the reference counts and check that they decrease back to 1.
CALL h5odecr_refcount_f(grp, error)
CALL check("h5oincr_refcount_f", error, total_error)
CALL h5odecr_refcount_f(dtype, error)
CALL check("h5oincr_refcount_f", error, total_error)
CALL h5odecr_refcount_f(dset, error)
CALL check("h5oincr_refcount_f", error, total_error)
CALL h5oget_info_by_name_f(fid, "group", oinfo, error)
CALL check("h5oget_info_by_name_f", error, total_error)
IF(oinfo%rc.NE.1)THEN
CALL check("h5oget_info_by_name_f", -1, total_error)
ENDIF
CALL h5oget_info_by_name_f(fid, "datatype", oinfo, error)
CALL check("h5oget_info_by_name_f", error, total_error)
IF(oinfo%rc.NE.1)THEN
CALL check("h5oget_info_by_name_f", -1, total_error)
ENDIF
CALL h5oget_info_by_name_f(fid, "dataset", oinfo, error)
CALL check("h5oget_info_by_name_f", error, total_error)
IF(oinfo%rc.NE.1)THEN
CALL check("h5oget_info_by_name_f", -1, total_error)
ENDIF
CALL h5gclose_f(grp, error)
CALL check("h5gclose_f",error, total_error)
CALL h5tclose_f(dtype, error)
CALL check("h5tclose_f",error, total_error)
CALL h5dclose_f(dset, error)
CALL check("h5dclose_f",error, total_error)
CALL h5fclose_f(fid, error)
CALL check("h5fclose_f",error, total_error)
END SUBROUTINE test_h5o_refcount
!****************************************************************
!**
!** test_h5o_refcount(): Test H5O visit functions.
!**
!****************************************************************
SUBROUTINE obj_visit(total_error)
USE HDF5
USE visit_cb
USE ISO_C_BINDING
IMPLICIT NONE
INTEGER, INTENT(INOUT) :: total_error
TYPE(ovisit_ud_t), TARGET :: udata ! User-data for visiting
INTEGER(hid_t) :: fid = -1
INTEGER(hid_t) :: gid = -1 ! Group ID
TYPE(C_PTR) :: f_ptr
TYPE(C_FUNPTR) :: fun_ptr
CHARACTER(LEN=180) :: object_name
INTEGER :: ret_val
INTEGER :: error
! Construct "interesting" file to visit
CALL build_visit_file(fid)
! Inialize udata for testing purposes
udata%info(1)%path(1:1) ="."
udata%info(1)%type_obj = H5O_TYPE_GROUP_F
udata%info(2)%path(1:12) = &
(/"D","a","t","a","s","e","t","_","z","e","r","o"/)
udata%info(2)%type_obj =H5O_TYPE_DATASET_F
udata%info(3)%path(1:6) = &
(/"G","r","o","u","p","1"/)
udata%info(3)%type_obj = H5O_TYPE_GROUP_F
udata%info(4)%path(1:18) =&
(/"G","r","o","u","p","1","/","D","a","t","a","s","e","t","_","o","n","e"/)
udata%info(4)%type_obj = H5O_TYPE_DATASET_F
udata%info(5)%path(1:13) =&
(/"G","r","o","u","p","1","/","G","r","o","u","p","2"/)
udata%info(5)%type_obj = H5O_TYPE_GROUP_F
udata%info(6)%path(1:25) =&
(/"G","r","o","u","p","1","/","G","r","o","u","p","2","/","D","a","t","a","s","e","t","_","t","w","o"/)
udata%info(6)%type_obj = H5O_TYPE_DATASET_F
udata%info(7)%path(1:22) =&
(/"G","r","o","u","p","1","/","G","r","o","u","p","2","/","T","y","p","e","_","t","w","o"/)
udata%info(7)%type_obj = H5O_TYPE_NAMED_DATATYPE_F
udata%info(8)%path(1:15) =&
(/"G","r","o","u","p","1","/","T","y","p","e","_","o","n","e"/)
udata%info(8)%type_obj = H5O_TYPE_NAMED_DATATYPE_F
udata%info(9)%path(1:9) =&
(/"T","y","p","e","_","z","e","r","o"/)
udata%info(9)%type_obj = H5O_TYPE_NAMED_DATATYPE_F
! Visit all the objects reachable from the root group (with file ID)
udata%idx = 1
fun_ptr = C_FUNLOC(visit_obj_cb)
f_ptr = C_LOC(udata)
! Test h5ovisit_f
CALL h5ovisit_f(fid, H5_INDEX_NAME_F, H5_ITER_INC_F, fun_ptr, f_ptr, ret_val, error)
CALL check("h5ovisit_f", error, total_error)
IF(ret_val.LT.0)THEN
CALL check("h5ovisit_f", -1, total_error)
ENDIF
! Test h5ovisit_by_name_f
object_name = "/"
udata%idx = 1
CALL h5ovisit_by_name_f(fid, object_name, H5_INDEX_NAME_F, H5_ITER_INC_F, fun_ptr, f_ptr, ret_val, error)
CALL check("h5ovisit_by_name_f", error, total_error)
IF(ret_val.LT.0)THEN
CALL check("h5ovisit_by_name_f", -1, total_error)
ENDIF
CALL h5fclose_f(fid, error)
CALL check("h5fclose_f",error, total_error)
END SUBROUTINE obj_visit
!****************************************************************
!**
!** test_h5o_refcount(): Test H5O info functions.
!**
!****************************************************************
SUBROUTINE obj_info(total_error)
USE HDF5
USE ISO_C_BINDING
IMPLICIT NONE
INTEGER, INTENT(INOUT) :: total_error
INTEGER(hid_t) :: fid = -1 ! File ID
INTEGER(hid_t) :: gid = -1, gid2 = -1 ! Group IDs
INTEGER(hid_t) :: did ! Dataset ID
INTEGER(hid_t) :: sid ! Dataspace ID
TYPE(hobj_ref_t_f), TARGET :: wref ! Reference to write
TYPE(hobj_ref_t_f), TARGET :: rref ! Reference to read
TYPE(H5O_info_t) :: oinfo ! Object info struct
INTEGER :: count = 0 ! Count within iterated group
INTEGER :: error
TYPE(C_PTR) :: f_ptr
CHARACTER(LEN=6) :: GROUPNAME = "/group"
CHARACTER(LEN=6) :: GROUPNAME2 = "group2"
CHARACTER(LEN=6) :: GROUPNAME3 = "group3"
CHARACTER(LEN=5) :: DSETNAME = "/dset"
CHARACTER(LEN=5) :: DSETNAME2 = "dset2"
! Create file with a group and a dataset containing an object reference to the group
CALL h5fcreate_f("get_info.h5", H5F_ACC_TRUNC_F, fid, error)
CALL check("h5fcreate_f",error, total_error)
! Create dataspace to use for dataset
CALL h5screate_f(H5S_SCALAR_F, sid, error)
CALL check("h5screate_f",error,total_error)
! Create group to refer to
CALL h5gcreate_f(fid, GROUPNAME, gid, error)
CALL check("h5gcreate_f",error,total_error)
! Create nested groups
CALL h5gcreate_f(gid, GROUPNAME2, gid2, error)
CALL check("h5gcreate_f",error,total_error)
CALL h5gclose_f(gid2, error)
CALL check("h5gclose_f",error,total_error)
CALL h5gcreate_f(gid, GROUPNAME3, gid2, error)
CALL check("h5gcreate_f",error,total_error)
CALL h5gclose_f(gid2, error)
CALL check("h5gclose_f",error,total_error)
! Create bottom dataset
CALL h5dcreate_f(gid, DSETNAME2, H5T_NATIVE_INTEGER, sid, did, error)
CALL check("h5dcreate_f",error, total_error)
CALL h5dclose_f(did, error)
CALL check("h5dclose_f", error, total_error)
CALL h5gclose_f(gid, error)
CALL check("h5gclose_f",error,total_error)
! Create dataset
CALL h5dcreate_f(fid, DSETNAME, H5T_STD_REF_OBJ, sid, did, error)
CALL check("h5dcreate_f",error, total_error)
f_ptr = C_LOC(wref)
! Create reference to group
CALL h5rcreate_f(fid, GROUPNAME, H5R_OBJECT_F, f_ptr, error)
CALL check("h5rcreate_f",error, total_error)
! Write reference to disk
CALL h5dwrite_f(did, H5T_STD_REF_OBJ, f_ptr, error)
CALL check("h5dwrite_f",error, total_error)
! Close objects
CALL h5dclose_f(did, error)
CALL check("h5dclose_f", error, total_error)
CALL h5sclose_f(sid, error)
CALL check("h5sclose_f", error, total_error)
CALL h5fclose_f(fid, error)
CALL check("h5fclose_f", error, total_error)
! Re-open file
CALL h5fopen_f("get_info.h5", H5F_ACC_RDWR_F, fid, error)
CALL check("h5fopen_f", error, total_error)
! Re-open dataset
CALL h5dopen_f(fid, DSETNAME, did, error)
CALL check("h5dopen_f", error, total_error)
! Read in the reference
f_ptr = C_LOC(rref)
CALL h5dread_f(did, H5T_STD_REF_OBJ, f_ptr, error)
CALL check("H5Dread_f",error, total_error)
! Dereference to get the group
CALL h5rdereference_f(did, H5R_OBJECT_F, f_ptr, gid, error)
CALL check("h5rdereference_f", error, total_error)
CALL h5oget_info_by_idx_f(gid, ".", H5_INDEX_NAME_F, H5_ITER_INC_F, 0_hsize_t, oinfo, error)
CALL check("h5oget_info_by_idx_f", error, total_error)
IF(oinfo%rc.NE.1)THEN
CALL check("h5oget_info_by_idx_f", -1, total_error)
ENDIF
IF(oinfo%type.NE.H5O_TYPE_DATASET_F)THEN
CALL check("h5oget_info_by_idx_f", -1, total_error)
ENDIF
! Close objects
CALL h5dclose_f(did, error)
CALL check("h5dclose_f", error, total_error)
CALL h5gclose_f(gid, error)
CALL check("h5sclose_f", error, total_error)
CALL h5fclose_f(fid, error)
CALL check("h5fclose_f", error, total_error)
END SUBROUTINE obj_info
!-------------------------------------------------------------------------
! Function: build_visit_file
!
! Purpose: Build an "interesting" file to use for visiting links & objects
!
! Programmer: M. Scot Breitenfeld
! July 12, 2012
! NOTE: Adapted from C test.
!
!-------------------------------------------------------------------------
!
SUBROUTINE build_visit_file(fid)
USE HDF5
IMPLICIT NONE
INTEGER(hid_t) :: fid ! File ID
INTEGER(hid_t) :: gid = -1, gid2 = -1 ! Group IDs
INTEGER(hid_t) :: sid = -1 ! Dataspace ID
INTEGER(hid_t) :: did = -1 ! Dataset ID
INTEGER(hid_t) :: tid = -1 ! Datatype ID
CHARACTER(LEN=20) :: filename = 'visit.h5'
INTEGER :: error
! Create file for visiting
CALL H5Fcreate_f(filename, H5F_ACC_TRUNC_F, fid, error)
! Create group
CALL H5Gcreate_f(fid, "/Group1", gid, error)
! Create nested group
CALL H5Gcreate_f(gid, "Group2", gid2, error)
! Close groups
CALL h5gclose_f(gid2, error)
CALL h5gclose_f(gid, error)
! Create soft links to groups created
CALL H5Lcreate_soft_f("/Group1", fid, "/soft_one", error)
CALL H5Lcreate_soft_f("/Group1/Group2", fid, "/soft_two", error)
! Create dangling soft link
CALL H5Lcreate_soft_f("nowhere", fid, "/soft_dangle", error)
! Create hard links to all groups
CALL H5Lcreate_hard_f(fid, "/", fid, "hard_zero", error)
CALL H5Lcreate_hard_f(fid, "/Group1", fid, "hard_one", error)
CALL H5Lcreate_hard_f(fid, "/Group1/Group2", fid, "hard_two", error)
! Create loops w/hard links
CALL H5Lcreate_hard_f(fid, "/Group1", fid, "/Group1/hard_one", error)
CALL H5Lcreate_hard_f(fid, "/", fid, "/Group1/Group2/hard_zero", error)
! Create dataset in each group
CALL H5Screate_f(H5S_SCALAR_F, sid, error)
CALL H5Dcreate_f(fid, "/Dataset_zero", H5T_NATIVE_INTEGER, sid, did, error)
CALL H5Dclose_f(did, error)
CALL H5Dcreate_f(fid, "/Group1/Dataset_one", H5T_NATIVE_INTEGER, sid, did, error)
CALL H5Dclose_f(did, error)
CALL H5Dcreate_f(fid, "/Group1/Group2/Dataset_two", H5T_NATIVE_INTEGER, sid, did, error)
CALL H5Dclose_f(did, error)
CALL H5Sclose_f(sid, error)
! Create named datatype in each group
CALL H5Tcopy_f(H5T_NATIVE_INTEGER, tid, error)
CALL H5Tcommit_f(fid, "/Type_zero", tid, error)
CALL H5Tclose_f(tid, error)
CALL H5Tcopy_f(H5T_NATIVE_INTEGER, tid, error)
CALL H5Tcommit_f(fid, "/Group1/Type_one", tid, error)
CALL H5Tclose_f(tid, error)
CALL H5Tcopy_f(H5T_NATIVE_INTEGER, tid, error)
CALL H5Tcommit_f(fid, "/Group1/Group2/Type_two", tid, error)
CALL H5Tclose_f(tid, error)
END SUBROUTINE build_visit_file

View File

@ -86,8 +86,8 @@
CHARACTER(LEN=2), DIMENSION(dimsize) :: char_member_out ! Buffer to read data out
INTEGER, DIMENSION(dimsize) :: int_member
INTEGER, DIMENSION(dimsize) :: int_member_out
DOUBLE PRECISION, DIMENSION(dimsize) :: double_member
DOUBLE PRECISION, DIMENSION(dimsize) :: double_member_out
REAL(KIND=Fortran_DOUBLE), DIMENSION(dimsize) :: double_member
REAL(KIND=Fortran_DOUBLE), DIMENSION(dimsize) :: double_member_out
REAL, DIMENSION(dimsize) :: real_member
REAL, DIMENSION(dimsize) :: real_member_out
INTEGER :: i

View File

@ -103,7 +103,7 @@ SUBROUTINE test_array_compound_atomic(total_error)
! Create file
CALL h5fcreate_f(FILENAME,H5F_ACC_TRUNC_F,fid1,error)
CALL check("h5fcreate_f", error, total_error)
CALL check("h5fcreate_f", error, total_error)
! Create dataspace for datasets
CALL h5screate_simple_f(SPACE1_RANK, sdims1, sid1, error)
@ -1976,8 +1976,8 @@ SUBROUTINE t_regref(total_error)
INTEGER(HSIZE_T), DIMENSION(1:1) :: maxdims
INTEGER(hssize_t) :: npoints
TYPE(hdset_reg_ref_t_f), DIMENSION(1:dim0), TARGET :: wdata ! Write buffer
TYPE(hdset_reg_ref_t_f), DIMENSION(:), ALLOCATABLE, TARGET :: rdata ! Read buffer
TYPE(hdset_reg_ref_t_f03), DIMENSION(1:dim0), TARGET :: wdata ! Write buffer
TYPE(hdset_reg_ref_t_f03), DIMENSION(:), ALLOCATABLE, TARGET :: rdata ! Read buffer
INTEGER(size_t) :: size
CHARACTER(LEN=1), DIMENSION(1:ds2dim0,1:ds2dim1), TARGET :: wdata2
@ -2058,7 +2058,6 @@ SUBROUTINE t_regref(total_error)
CALL check("h5sclose_f",error, total_error)
CALL h5fclose_f(file , error)
CALL check("h5fclose_f",error, total_error)
!
! Now we begin the read section of this example.
!
@ -2095,10 +2094,11 @@ SUBROUTINE t_regref(total_error)
! Open the referenced object, retrieve its region as a
! dataspace selection.
!
CALL H5Rdereference_f(dset, rdata(i), dset2, error)
f_ptr = C_LOC(rdata(i))
CALL H5Rdereference_f(dset, H5R_DATASET_REGION_F, f_ptr, dset2, error)
CALL check("H5Rdereference_f",error, total_error)
CALL H5Rget_region_f(dset, rdata(i), space, error)
CALL H5Rget_region_f(dset, f_ptr, space, error)
CALL check("H5Rget_region_f",error, total_error)
!
@ -2754,7 +2754,7 @@ SUBROUTINE t_string(total_error)
CALL check("H5Dget_type_f",error, total_error)
CALL H5Tget_size_f(filetype, size, error)
CALL check("H5Tget_size_f",error, total_error)
CALL VERIFY("H5Tget_size_f", size, sdim, total_error)
CALL VERIFY("H5Tget_size_f", INT(size), INT(sdim), total_error)
!
! Get dataspace.
!
@ -2800,4 +2800,295 @@ SUBROUTINE t_string(total_error)
END SUBROUTINE t_string
SUBROUTINE vl_test_special_char(cleanup, total_error)
USE hdf5
IMPLICIT NONE
INTERFACE
SUBROUTINE setup_buffer(data_in, line_lengths, char_type)
USE hdf5
USE ISO_C_BINDING
IMPLICIT NONE
CHARACTER(len=*), DIMENSION(:) :: data_in
INTEGER(size_t), DIMENSION(:) :: line_lengths
CHARACTER(KIND=C_CHAR,LEN=*) :: char_type
END SUBROUTINE setup_buffer
END INTERFACE
LOGICAL, INTENT(IN) :: cleanup
INTEGER, INTENT(OUT) :: total_error
CHARACTER(LEN=16), PARAMETER :: filename = "t_controlchar.h5"
INTEGER, PARAMETER :: line_length = 10
INTEGER(hid_t) :: file
INTEGER(hid_t) :: dataset0
CHARACTER(len=line_length), DIMENSION(1:100) :: data_in
CHARACTER(len=line_length), DIMENSION(1:100) :: data_out
INTEGER(size_t), DIMENSION(1:100) :: line_lengths
INTEGER(hid_t) :: string_id, space, dcpl
INTEGER(hsize_t), DIMENSION(1:1) :: dims = (/0/)
INTEGER(hsize_t), DIMENSION(1:1) :: max_dims = (/0/)
INTEGER(hsize_t), DIMENSION(1:2) :: data_dims = (/0,0/)
INTEGER(hsize_t), DIMENSION(1:1) :: chunk =(/10/)
INTEGER, PARAMETER :: ncontrolchar = 7
CHARACTER(KIND=C_CHAR,LEN=1), DIMENSION(1:ncontrolchar) :: controlchar = &
(/C_ALERT, C_BACKSPACE,C_CARRIAGE_RETURN, C_FORM_FEED,C_HORIZONTAL_TAB,C_VERTICAL_TAB, C_NEW_LINE/)
INTEGER :: i, j, n, error
n = 8
!
! Create a new file using the default properties.
!
CALL h5fcreate_f(filename, H5F_ACC_TRUNC_F, file, error)
CALL check("h5fcreate_f",error, total_error)
max_dims = (/H5S_UNLIMITED_F/)
!
! Create the memory datatype.
!
CALL h5tcopy_f(h5t_string, string_id, error)
CALL check("h5tcopy_f", error, total_error)
CALL h5tset_strpad_f(string_id, h5t_str_nullpad_f, error)
CALL check("h5tset_strpad_f", error, total_error)
dims(1) = n
!
! Create dataspace.
!
CALL h5screate_simple_f(1, dims, space, error, max_dims)
CALL check("h5screate_simple_f", error, total_error)
CALL h5pcreate_f(h5p_dataset_create_f, dcpl, error)
CALL check("h5pcreate_f", error, total_error)
CALL h5pset_chunk_f(dcpl, 1, chunk, error)
CALL check("h5pset_chunk_f", error, total_error)
data_dims(1) = line_length
data_dims(2) = n
!
! Create data with strings containing various control characters.
!
DO i = 1, ncontrolchar
!
! Create the dataset, for the string with control character and write the string data to it.
!
CALL h5dcreate_f(file, controlchar(i), string_id, space, dataset0, error, dcpl)
CALL check("h5dcreate_f", error, total_error)
CALL setup_buffer(data_in(1:n), line_lengths, controlchar(i))
CALL h5dwrite_vl_f(dataset0, string_id, data_in(1:n), data_dims, line_lengths(1:n), error, space)
CALL check("h5dwrite_vl_f", error, total_error)
!
! Read the string back.
!
CALL h5dread_vl_f(dataset0, string_id, data_out(1:n), data_dims, line_lengths(1:n), error, space)
CALL check("h5dread_vl_f", error, total_error)
DO j = 1, n
IF(data_in(j).NE.data_out(j))THEN
total_error = total_error + 1
EXIT
ENDIF
ENDDO
CALL h5dclose_f(dataset0, error)
CALL check("h5dclose_f", error, total_error)
ENDDO
CALL h5pclose_f(dcpl, error)
CALL check("h5pclose_f", error, total_error)
CALL h5sclose_f(space, error)
CALL check("h5sclose_f", error, total_error)
CALL h5fclose_f(file, error)
CALL check("h5fclose_f", error, total_error)
END SUBROUTINE vl_test_special_char
SUBROUTINE setup_buffer(data_in, line_lengths, char_type)
USE HDF5
USE ISO_C_BINDING
IMPLICIT NONE
! Creates a simple "Data_in" consisting of the letters of the alphabet,
! one per line, with a control character.
CHARACTER(len=10), DIMENSION(:) :: data_in
INTEGER(size_t), DIMENSION(:) :: line_lengths
INTEGER, DIMENSION(1:3) :: letters
CHARACTER(LEN=3) :: lets
CHARACTER(KIND=C_CHAR,LEN=*) :: char_type
CHARACTER(KIND=C_CHAR,LEN=1) :: char_tmp
INTEGER :: i, j, n, ff
! Convert the letters and special character to integers
lets = 'abc'
READ(lets,'(3A1)') letters
READ(char_type,'(A1)') ff
n = SIZE(data_in)
j = 1
DO i=1,n-1
IF( j .EQ. 4 )THEN
WRITE(char_tmp,'(A1)') ff
data_in(i:i) = char_tmp
ELSE
WRITE(char_tmp,'(A1)') letters(j)
data_in(i:i) = char_tmp
ENDIF
line_lengths(i) = LEN_TRIM(data_in(i))
j = j + 1
IF( j .EQ. 5 ) j = 1
END DO
WRITE(char_tmp,'(A1)') ff
data_in(n:n) = char_tmp
line_lengths(n) = 1
END SUBROUTINE setup_buffer
!-------------------------------------------------------------------------
! Function: test_nbit
!
! Purpose: Tests (real, 4 byte) datatype for nbit filter
!
! Return: Success: 0
! Failure: >0
!
! Programmer: M. Scot Breitenfeld
! Decemeber 7, 2010
!
! Modifications: Moved this subroutine from the 1.8 test file and
! modified it to use F2003 features.
! This routine requires 4 byte reals, so we use F2003 features to
! ensure the requirement is satisfied in a portable way.
! The need for this arises when a user specifies the default real is 8 bytes.
! MSB 7/31/12
!
!-------------------------------------------------------------------------
!
SUBROUTINE test_nbit(cleanup, total_error )
USE HDF5
USE ISO_C_BINDING
IMPLICIT NONE
INTEGER, PARAMETER :: wp = SELECTED_REAL_KIND(Fortran_REAL_4) !should map to REAL*4 on most modern processors
LOGICAL, INTENT(IN) :: cleanup
INTEGER, INTENT(INOUT) :: total_error
INTEGER(hid_t) :: file
INTEGER(hid_t) :: dataset, datatype, space, dc, mem_type_id
INTEGER(hsize_t), DIMENSION(1:2) :: dims = (/2,5/)
INTEGER(hsize_t), DIMENSION(1:2) :: chunk_dim = (/2,5/)
! orig_data[] are initialized to be within the range that can be represented by
! dataset datatype (no precision loss during datatype conversion)
!
REAL(kind=wp), DIMENSION(1:2,1:5), TARGET :: orig_data = &
RESHAPE( (/188384.00, 19.103516, -1.0831790e9, -84.242188, &
5.2045898, -49140.000, 2350.2500, -3.2110596e-1, 6.4998865e-5, -0.0000000/) , (/2,5/) )
REAL(kind=wp), DIMENSION(1:2,1:5), TARGET :: new_data
INTEGER(size_t) :: PRECISION, offset
INTEGER :: error
LOGICAL :: status
INTEGER(size_t) :: i, j
TYPE(C_PTR) :: f_ptr
! check to see if filter is available
CALL H5Zfilter_avail_f(H5Z_FILTER_NBIT_F, status, error)
IF(.NOT.status)THEN ! We don't have H5Z_FILTER_NBIT_F filter
total_error = -1 ! so return
RETURN
ENDIF
CALL H5Fcreate_f("nbit.h5", H5F_ACC_TRUNC_F, file, error)
CALL check("H5Fcreate_f", error, total_error)
! Define dataset datatype (integer), and set precision, offset
CALL H5Tcopy_f(H5T_IEEE_F32BE, datatype, error)
CALL CHECK(" H5Tcopy_f", error, total_error)
CALL H5Tset_fields_f(datatype, 26_size_t, 20_size_t, 6_size_t, 7_size_t, 13_size_t, error)
CALL CHECK(" H5Tset_fields_f", error, total_error)
offset = 7
CALL H5Tset_offset_f(datatype, offset, error)
CALL CHECK(" H5Tset_offset_f", error, total_error)
PRECISION = 20
CALL H5Tset_precision_f(datatype,PRECISION, error)
CALL CHECK(" H5Tset_precision_f", error, total_error)
CALL H5Tset_size_f(datatype, 4_size_t, error)
CALL CHECK(" H5Tset_size_f", error, total_error)
CALL H5Tset_ebias_f(datatype, 31_size_t, error)
CALL CHECK(" H5Tset_ebias_f", error, total_error)
! Create the data space
CALL H5Screate_simple_f(2, dims, space, error)
CALL CHECK(" H5Screate_simple_f", error, total_error)
! USE nbit filter
CALL H5Pcreate_f(H5P_DATASET_CREATE_F, dc, error)
CALL CHECK(" H5Pcreate_f", error, total_error)
CALL H5Pset_chunk_f(dc, 2, chunk_dim, error)
CALL CHECK(" H5Pset_chunk_f", error, total_error)
CALL H5Pset_nbit_f(dc, error)
CALL CHECK(" H5Pset_nbit_f", error, total_error)
! Create the dataset
CALL H5Dcreate_f(file, "nbit_real", datatype, &
space, dataset, error, dc)
CALL CHECK(" H5Dcreate_f", error, total_error)
!----------------------------------------------------------------------
! STEP 1: Test nbit by setting up a chunked dataset and writing
! to it.
!----------------------------------------------------------------------
!
mem_type_id = h5kind_to_type(wp,H5_REAL_KIND)
f_ptr = C_LOC(orig_data(1,1))
CALL H5Dwrite_f(dataset, mem_type_id, f_ptr, error)
CALL CHECK(" H5Dwrite_f", error, total_error)
!----------------------------------------------------------------------
! STEP 2: Try to read the data we just wrote.
!----------------------------------------------------------------------
!
f_ptr = C_LOC(new_data(1,1))
CALL H5Dread_f(dataset, mem_type_id, f_ptr, error)
CALL CHECK(" H5Dread_f", error, total_error)
! Check that the values read are the same as the values written
! Assume size of long long = size of double
!
i_loop: DO i = 1, dims(1)
j_loop: DO j = 1, dims(2)
IF(.NOT.(orig_data(i,j).EQ.orig_data(i,j))) CYCLE ! skip IF value is NaN
IF(new_data(i,j) .NE. orig_data(i,j))THEN
total_error = total_error + 1
WRITE(*,'(" Read different values than written.")')
WRITE(*,'(" At index ", 2(1X,I0))') i, j
EXIT i_loop
END IF
ENDDO j_loop
ENDDO i_loop
!----------------------------------------------------------------------
! Cleanup
!----------------------------------------------------------------------
!
CALL H5Tclose_f(datatype, error)
CALL CHECK(" H5Tclose_f", error, total_error)
CALL H5Pclose_f(dc, error)
CALL CHECK(" H5Pclose_f", error, total_error)
CALL H5Sclose_f(space, error)
CALL CHECK(" H5Sclose_f", error, total_error)
CALL H5Dclose_f(dataset, error)
CALL CHECK(" H5Dclose_f", error, total_error)
CALL H5Fclose_f(file, error)
CALL CHECK(" H5Fclose_f", error, total_error)
END SUBROUTINE test_nbit

View File

@ -50,6 +50,7 @@ SUBROUTINE hyper(length,do_collective,do_chunk, mpi_size, mpi_rank, nerrors)
INTEGER :: icount ! number of elements in array
CHARACTER(len=80) :: filename ! filename
INTEGER :: i
INTEGER :: actual_io_mode ! The type of I/O performed by this process
!//////////////////////////////////////////////////////////
! initialize the array data between the processes (3)
@ -180,6 +181,24 @@ SUBROUTINE hyper(length,do_collective,do_chunk, mpi_size, mpi_rank, nerrors)
CALL check("h5dwrite_f", hdferror, nerrors)
! Check h5pget_mpio_actual_io_mode_f function
CALL h5pget_mpio_actual_io_mode_f(dxpl_id, actual_io_mode, hdferror)
CALL check("h5pget_mpio_actual_io_mode_f", hdferror, nerrors)
IF(do_collective.AND.do_chunk)THEN
IF(actual_io_mode.NE.H5D_MPIO_CHUNK_COLLECTIVE_F)THEN
CALL check("h5pget_mpio_actual_io_mode_f", -1, nerrors)
ENDIF
ELSEIF(.NOT.do_collective)THEN
IF(actual_io_mode.NE.H5D_MPIO_NO_COLLECTIVE_F)THEN
CALL check("h5pget_mpio_actual_io_mode_f", -1, nerrors)
ENDIF
ELSEIF( do_collective.AND.(.NOT.do_chunk))THEN
IF(actual_io_mode.NE.H5D_MPIO_CONTIG_COLLECTIVE_F)THEN
CALL check("h5pget_mpio_actual_io_mode_f", -1, nerrors)
ENDIF
ENDIF
!//////////////////////////////////////////////////////////
! close HDF5 I/O
!//////////////////////////////////////////////////////////

View File

@ -1,6 +1,11 @@
cmake_minimum_required (VERSION 2.8.6)
PROJECT (HDF5_HL C CXX)
#-----------------------------------------------------------------------------
# Apply Definitions to compiler in this directory and below
#-----------------------------------------------------------------------------
ADD_DEFINITIONS (${HDF5_EXTRA_C_FLAGS})
#-----------------------------------------------------------------------------
# Shared Libs
#-----------------------------------------------------------------------------

View File

@ -458,7 +458,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog
# Add libtool shared library version numbers to the HDF5 library
# See libtool versioning documentation online.
LT_VERS_INTERFACE = 6
LT_VERS_REVISION = 118
LT_VERS_REVISION = 122
LT_VERS_AGE = 0
# Include src directory

View File

@ -474,7 +474,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog
# Add libtool shared library version numbers to the HDF5 library
# See libtool versioning documentation online.
LT_VERS_INTERFACE = 6
LT_VERS_REVISION = 118
LT_VERS_REVISION = 122
LT_VERS_AGE = 0
INCLUDES = -I$(top_srcdir)/src -I$(top_srcdir)/hl/src -I$(top_builddir)/hl/src \
-I$(top_srcdir)/fortran/src -I$(top_builddir)/fortran/src

View File

@ -38,7 +38,7 @@
#define yywrap H5LTyywrap
#line 20 "H5LTanalyze.c"
/* A lexical scanner generated by flex */
/* A lexical scanner generated by flex*/
/* Scanner skeleton version:
* $Header: /home/daffy/u0/vern/flex/RCS/flex.skl,v 2.91 96/09/10 16:58:48 vern Exp $
@ -51,7 +51,7 @@
#include <stdio.h>
#ifdef H5_HAVE_UNISTD_H
#include <unistd.h>
#endif
#endif
/* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */
#ifdef c_plusplus
@ -175,6 +175,15 @@ extern FILE *yyin, *yyout;
#define unput(c) yyunput( c, yytext_ptr )
/* Some routines like yy_flex_realloc() are emitted as static but are
not called by all lexers. This generates warnings in some compilers,
notably GCC. Arrange to suppress these. */
#ifdef __GNUC__
#define YY_MAY_BE_UNUSED __attribute__((unused))
#else
#define YY_MAY_BE_UNUSED
#endif
/* The following is because we cannot portably get our hands on size_t
* (without autoconf's help, which isn't available because we want
* flex-generated scanners to compile on their own).
@ -281,7 +290,7 @@ YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *yy_str ));
YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len ));
static void *yy_flex_alloc YY_PROTO(( yy_size_t ));
static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t ));
static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t )) YY_MAY_BE_UNUSED;
static void yy_flex_free YY_PROTO(( void * ));
#define yy_new_buffer yy_create_buffer
@ -849,10 +858,10 @@ hbool_t first_quote = 1;
/* For Lex and Yacc */
/*int input_len;
char *myinput;*/
#define TAG_STRING 1
#line 834 "H5LTanalyze.c"
#line 843 "H5LTanalyze.c"
/* Macros after this point can all be overridden by user definitions in
* section 1.
@ -1006,7 +1015,7 @@ YY_DECL
#line 76 "H5LTanalyze.l"
#line 988 "H5LTanalyze.c"
#line 997 "H5LTanalyze.c"
if ( yy_init )
{
@ -1288,17 +1297,17 @@ YY_RULE_SETUP
case 40:
YY_RULE_SETUP
#line 121 "H5LTanalyze.l"
{return token(H5T_STR_NULLTERM_TOKEN);}
{return token(H5T_STR_NULLTERM_TOKEN);}
YY_BREAK
case 41:
YY_RULE_SETUP
#line 122 "H5LTanalyze.l"
{return token(H5T_STR_NULLPAD_TOKEN);}
{return token(H5T_STR_NULLPAD_TOKEN);}
YY_BREAK
case 42:
YY_RULE_SETUP
#line 123 "H5LTanalyze.l"
{return token(H5T_STR_SPACEPAD_TOKEN);}
{return token(H5T_STR_SPACEPAD_TOKEN);}
YY_BREAK
case 43:
YY_RULE_SETUP
@ -1363,12 +1372,12 @@ YY_RULE_SETUP
case 55:
YY_RULE_SETUP
#line 139 "H5LTanalyze.l"
{
if( is_str_size || (is_enum && is_enum_memb) ||
{
if( is_str_size || (is_enum && is_enum_memb) ||
is_opq_size || (asindex>-1 && arr_stack[asindex].is_dim) ||
(csindex>-1 && cmpd_stack[csindex].is_field) ) {
H5LTyylval.ival = atoi(yytext);
return NUMBER;
return NUMBER;
} else
REJECT;
}
@ -1378,7 +1387,7 @@ YY_RULE_SETUP
#line 149 "H5LTanalyze.l"
{
/*if it's first quote, and is a compound field name or an enum symbol*/
if((is_opq_tag || is_enum || (csindex>-1 && cmpd_stack[csindex].is_field))
if((is_opq_tag || is_enum || (csindex>-1 && cmpd_stack[csindex].is_field))
&& first_quote) {
first_quote = 0;
BEGIN TAG_STRING;
@ -1441,7 +1450,7 @@ YY_RULE_SETUP
#line 174 "H5LTanalyze.l"
ECHO;
YY_BREAK
#line 1423 "H5LTanalyze.c"
#line 1432 "H5LTanalyze.c"
case YY_STATE_EOF(INITIAL):
case YY_STATE_EOF(TAG_STRING):
yyterminate();
@ -2323,8 +2332,8 @@ int main()
int my_yyinput(char *buf, int max_size)
{
int ret;
memcpy(buf, myinput, input_len);
memcpy(buf, myinput, input_len);
ret = input_len;
return ret;
}
@ -2332,6 +2341,7 @@ int my_yyinput(char *buf, int max_size)
int H5LTyyerror(char *msg)
{
printf("ERROR: %s before \"%s\".\n", msg, yytext);
return 0;
}
int yywrap()

View File

@ -184,6 +184,7 @@ int my_yyinput(char *buf, int max_size)
int H5LTyyerror(char *msg)
{
printf("ERROR: %s before \"%s\".\n", msg, yytext);
return 0;
}
int yywrap()

View File

@ -15,6 +15,7 @@
#include <stdlib.h>
#include <string.h>
#include "H5private.h"
#include "H5LTprivate.h"
#include "H5TBprivate.h"
@ -663,7 +664,7 @@ herr_t H5TBwrite_fields_index( hid_t loc_id,
hid_t m_sid=-1;
hid_t file_space_id=-1;
char *member_name;
hsize_t i, j;
hsize_t i;
hid_t preserve_id;
size_t size_native;
@ -688,14 +689,19 @@ herr_t H5TBwrite_fields_index( hid_t loc_id,
/* iterate tru the members */
for ( i = 0; i < nfields; i++)
{
unsigned j;
j = field_index[i];
/* Range check value */
if(field_index[i] < 0)
goto out;
j = (unsigned)field_index[i];
/* get the member name */
member_name = H5Tget_member_name( tid, (unsigned) j );
member_name = H5Tget_member_name( tid, j );
/* get the member type */
if (( member_type_id = H5Tget_member_type( tid, (unsigned) j )) < 0)
if (( member_type_id = H5Tget_member_type( tid, j )) < 0)
goto out;
/* convert to native type */
@ -1149,7 +1155,7 @@ herr_t H5TBread_fields_index( hid_t loc_id,
hid_t m_sid=-1;
hsize_t mem_size[1];
size_t size_native;
hsize_t i, j;
hsize_t i;
/* open the dataset. */
if ((did = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0)
@ -1166,13 +1172,19 @@ herr_t H5TBread_fields_index( hid_t loc_id,
/* iterate tru the members */
for ( i = 0; i < nfields; i++)
{
j = field_index[i];
unsigned j;
/* Range check */
if(field_index[i] < 0)
goto out;
j = (unsigned)field_index[i];
/* get the member name */
member_name = H5Tget_member_name( tid, (unsigned) j );
member_name = H5Tget_member_name( tid, j );
/* get the member type */
if (( member_type_id = H5Tget_member_type( tid, (unsigned) j )) < 0)
if (( member_type_id = H5Tget_member_type( tid, j )) < 0)
goto out;
/* get the member size */
@ -1289,7 +1301,6 @@ herr_t H5TBdelete_record( hid_t loc_id,
hsize_t start,
hsize_t nrecords )
{
hsize_t nfields;
hsize_t ntotal_records;
hsize_t read_start;
@ -1304,8 +1315,8 @@ herr_t H5TBdelete_record( hid_t loc_id,
hsize_t mem_size[1];
unsigned char *tmp_buf=NULL;
size_t src_size;
size_t *src_offset;
size_t *src_sizes;
size_t *src_offset = NULL;
size_t *src_sizes = NULL;
hsize_t dims[1];
/*-------------------------------------------------------------------------
@ -1315,23 +1326,20 @@ herr_t H5TBdelete_record( hid_t loc_id,
/* get the number of records and fields */
if (H5TBget_table_info ( loc_id, dset_name, &nfields, &ntotal_records ) < 0)
return -1;
goto out;
src_offset = (size_t *)malloc((size_t)nfields * sizeof(size_t));
src_sizes = (size_t *)malloc((size_t)nfields * sizeof(size_t));
if (src_offset == NULL )
return -1;
if (src_sizes == NULL )
return -1;
if(NULL == (src_offset = (size_t *)malloc((size_t)nfields * sizeof(size_t))))
goto out;
if(NULL == (src_sizes = (size_t *)malloc((size_t)nfields * sizeof(size_t))))
goto out;
/* get field info */
if (H5TBget_field_info( loc_id, dset_name, NULL, src_sizes, src_offset, &src_size ) < 0)
return -1;
goto out;
/* open the dataset. */
if ((did = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0)
return -1;
goto out;
/*-------------------------------------------------------------------------
* read the records after the deleted one(s)
@ -1343,14 +1351,12 @@ herr_t H5TBdelete_record( hid_t loc_id,
if ( read_nrecords )
{
tmp_buf = (unsigned char *)calloc((size_t) read_nrecords, src_size );
if (tmp_buf == NULL )
return -1;
if(NULL == (tmp_buf = (unsigned char *)calloc((size_t) read_nrecords, src_size )))
goto out;
/* read the records after the deleted one(s) */
if (H5TBread_records( loc_id, dset_name, read_start, read_nrecords, src_size, src_offset, src_sizes, tmp_buf ) < 0)
return -1;
goto out;
/*-------------------------------------------------------------------------
* write the records in another position
@ -1406,31 +1412,34 @@ herr_t H5TBdelete_record( hid_t loc_id,
/* close dataset */
if (H5Dclose( did ) < 0)
return -1;
if (tmp_buf !=NULL)
free( tmp_buf );
free( src_offset );
free( src_sizes );
goto out;
if(tmp_buf)
free(tmp_buf);
if(src_offset)
free(src_offset);
if(src_sizes)
free(src_sizes);
return 0;
/* error zone */
out:
if (tmp_buf !=NULL )
free( tmp_buf );
if(tmp_buf)
free(tmp_buf);
if(src_offset)
free(src_offset);
if(src_sizes)
free(src_sizes);
H5E_BEGIN_TRY
{
H5Tclose(mem_type_id);
H5Dclose(did);
H5Tclose(tid);
H5Sclose(sid);
H5Sclose(m_sid);
} H5E_END_TRY;
return -1;
}
/*-------------------------------------------------------------------------
@ -1629,10 +1638,10 @@ herr_t H5TBadd_records_from( hid_t loc_id,
hsize_t mem_size[1];
hsize_t nfields;
hsize_t ntotal_records;
unsigned char *tmp_buf;
unsigned char *tmp_buf = NULL;
size_t src_size;
size_t *src_offset;
size_t *src_sizes;
size_t *src_offset = NULL;
size_t *src_sizes = NULL;
/*-------------------------------------------------------------------------
* first we get information about type size and offsets on disk
@ -1641,17 +1650,16 @@ herr_t H5TBadd_records_from( hid_t loc_id,
/* get the number of records and fields */
if (H5TBget_table_info ( loc_id, dset_name1, &nfields, &ntotal_records ) < 0)
return -1;
goto out;
src_offset = (size_t *)malloc((size_t)nfields * sizeof(size_t));
src_sizes = (size_t *)malloc((size_t)nfields * sizeof(size_t));
if (src_offset == NULL )
return -1;
if(NULL == (src_offset = (size_t *)malloc((size_t)nfields * sizeof(size_t))))
goto out;
if(NULL == (src_sizes = (size_t *)malloc((size_t)nfields * sizeof(size_t))))
goto out;
/* get field info */
if (H5TBget_field_info( loc_id, dset_name1, NULL, src_sizes, src_offset, &src_size ) < 0)
return -1;
goto out;
/*-------------------------------------------------------------------------
* Get information about the first table and read it
@ -1660,7 +1668,7 @@ herr_t H5TBadd_records_from( hid_t loc_id,
/* open the 1st dataset. */
if ((did_1 = H5Dopen2(loc_id, dset_name1, H5P_DEFAULT)) < 0)
return -1;
goto out;
/* get the datatype */
if ((tid_1 = H5Dget_type( did_1 )) < 0)
@ -1674,7 +1682,8 @@ herr_t H5TBadd_records_from( hid_t loc_id,
if (( type_size1 = H5Tget_size( tid_1 )) == 0 )
goto out;
tmp_buf = (unsigned char *)calloc((size_t)nrecords, type_size1 );
if(NULL == (tmp_buf = (unsigned char *)calloc((size_t)nrecords, type_size1 )))
goto out;
/* define a hyperslab in the dataset of the size of the records */
offset[0] = start1;
@ -1707,18 +1716,27 @@ herr_t H5TBadd_records_from( hid_t loc_id,
if (H5Sclose( sid_1 ) < 0)
goto out;
if (H5Tclose( tid_1 ) < 0)
return -1;
goto out;
if (H5Dclose( did_1 ) < 0)
return -1;
goto out;
free( tmp_buf );
free( src_offset );
free( src_sizes );
if(tmp_buf)
free(tmp_buf);
if(src_offset)
free(src_offset);
if(src_sizes)
free(src_sizes);
return 0;
/* error zone */
out:
if(tmp_buf)
free(tmp_buf);
if(src_offset)
free(src_offset);
if(src_sizes)
free(src_sizes);
H5E_BEGIN_TRY
{
H5Dclose(did_1);
@ -1748,50 +1766,50 @@ out:
*
*-------------------------------------------------------------------------
*/
herr_t H5TBcombine_tables( hid_t loc_id1,
herr_t H5TBcombine_tables(hid_t loc_id1,
const char *dset_name1,
hid_t loc_id2,
const char *dset_name2,
const char *dset_name3 )
const char *dset_name3)
{
/* identifiers for the 1st dataset. */
hid_t did_1=-1;
hid_t tid_1=-1;
hid_t sid_1=-1;
hid_t pid_1=-1;
hid_t did_1 = H5I_BADID;
hid_t tid_1 = H5I_BADID;
hid_t sid_1 = H5I_BADID;
hid_t pid_1 = H5I_BADID;
/* identifiers for the 2nd dataset. */
hid_t did_2=-1;
hid_t tid_2=-1;
hid_t sid_2=-1;
hid_t pid_2=-1;
hid_t did_2 = H5I_BADID;
hid_t tid_2 = H5I_BADID;
hid_t sid_2 = H5I_BADID;
hid_t pid_2 = H5I_BADID;
/* identifiers for the 3rd dataset. */
hid_t did_3=-1;
hid_t tid_3=-1;
hid_t sid_3=-1;
hid_t pid_3=-1;
hid_t did_3 = H5I_BADID;
hid_t tid_3 = H5I_BADID;
hid_t sid_3 = H5I_BADID;
hid_t pid_3 = H5I_BADID;
hid_t sid = H5I_BADID;
hid_t m_sid = H5I_BADID;
hid_t member_type_id = H5I_BADID;
hid_t attr_id = H5I_BADID;
hsize_t count[1];
hsize_t offset[1];
hid_t m_sid;
hsize_t mem_size[1];
hsize_t nfields;
hsize_t nrecords;
hsize_t dims[1];
hsize_t maxdims[1] = { H5S_UNLIMITED };
size_t type_size;
hid_t sid;
hid_t member_type_id;
size_t member_offset;
char attr_name[255];
hid_t attr_id;
char aux[255];
unsigned char *tmp_buf;
unsigned char *tmp_fill_buf;
hsize_t maxdims[1] = {H5S_UNLIMITED};
hsize_t i;
size_t type_size;
size_t member_offset;
size_t src_size;
size_t *src_offset;
size_t *src_sizes;
int has_fill=0;
size_t *src_offset = NULL;
size_t *src_sizes = NULL;
char attr_name[255];
char aux[255];
unsigned char *tmp_buf = NULL;
unsigned char *tmp_fill_buf = NULL;
htri_t has_fill;
int ret_val = -1;
/*-------------------------------------------------------------------------
* first we get information about type size and offsets on disk
@ -1799,18 +1817,17 @@ herr_t H5TBcombine_tables( hid_t loc_id1,
*/
/* get the number of records and fields */
if (H5TBget_table_info ( loc_id1, dset_name1, &nfields, &nrecords ) < 0)
return -1;
if(H5TBget_table_info(loc_id1, dset_name1, &nfields, &nrecords) < 0)
goto out;
src_offset = (size_t *)malloc((size_t)nfields * sizeof(size_t));
src_sizes = (size_t *)malloc((size_t)nfields * sizeof(size_t));
if (src_offset == NULL )
return -1;
if(NULL == (src_offset = (size_t *)HDmalloc((size_t)nfields * sizeof(size_t))))
goto out;
if(NULL == (src_sizes = (size_t *)HDmalloc((size_t)nfields * sizeof(size_t))))
goto out;
/* get field info */
if (H5TBget_field_info( loc_id1, dset_name1, NULL, src_sizes, src_offset, &src_size ) < 0)
return -1;
if(H5TBget_field_info(loc_id1, dset_name1, NULL, src_sizes, src_offset, &src_size) < 0)
goto out;
/*-------------------------------------------------------------------------
* get information about the first table
@ -1818,24 +1835,24 @@ herr_t H5TBcombine_tables( hid_t loc_id1,
*/
/* open the 1st dataset. */
if ((did_1 = H5Dopen2(loc_id1, dset_name1, H5P_DEFAULT)) < 0)
if((did_1 = H5Dopen2(loc_id1, dset_name1, H5P_DEFAULT)) < 0)
goto out;
/* get the datatype */
if ((tid_1 = H5Dget_type( did_1 )) < 0)
if((tid_1 = H5Dget_type(did_1)) < 0)
goto out;
/* get the dataspace handle */
if ((sid_1 = H5Dget_space( did_1 )) < 0)
if((sid_1 = H5Dget_space(did_1)) < 0)
goto out;
/* get creation properties list */
if ((pid_1 = H5Dget_create_plist( did_1 )) < 0)
if((pid_1 = H5Dget_create_plist(did_1)) < 0)
goto out;
/* get the dimensions */
if (H5TBget_table_info ( loc_id1, dset_name1, &nfields, &nrecords ) < 0)
return -1;
if(H5TBget_table_info(loc_id1, dset_name1, &nfields, &nrecords) < 0)
goto out;
/*-------------------------------------------------------------------------
* make the merged table with no data originally
@ -1843,11 +1860,11 @@ herr_t H5TBcombine_tables( hid_t loc_id1,
*/
/* clone the property list */
if ((pid_3 = H5Pcopy(pid_1)) < 0)
if((pid_3 = H5Pcopy(pid_1)) < 0)
goto out;
/* clone the type id */
if ((tid_3 = H5Tcopy(tid_1)) < 0)
if((tid_3 = H5Tcopy(tid_1)) < 0)
goto out;
/*-------------------------------------------------------------------------
@ -1858,96 +1875,97 @@ herr_t H5TBcombine_tables( hid_t loc_id1,
dims[0] = 0;
/* create a simple data space with unlimited size */
if ((sid_3 = H5Screate_simple(1, dims, maxdims)) < 0)
return -1;
if((sid_3 = H5Screate_simple(1, dims, maxdims)) < 0)
goto out;
/* create the dataset */
if ((did_3 = H5Dcreate2(loc_id1, dset_name3, tid_3, sid_3, H5P_DEFAULT, pid_3, H5P_DEFAULT)) < 0)
if((did_3 = H5Dcreate2(loc_id1, dset_name3, tid_3, sid_3, H5P_DEFAULT, pid_3, H5P_DEFAULT)) < 0)
goto out;
/*-------------------------------------------------------------------------
* attach the conforming table attributes
*-------------------------------------------------------------------------
*/
if (H5TB_attach_attributes("Merge table", loc_id1, dset_name3, nfields, tid_3) < 0)
if(H5TB_attach_attributes("Merge table", loc_id1, dset_name3, nfields, tid_3) < 0)
goto out;
/*-------------------------------------------------------------------------
* get attributes
*-------------------------------------------------------------------------
*/
type_size = H5Tget_size(tid_3);
/* alloc fill value attribute buffer */
tmp_fill_buf = (unsigned char *)malloc(type_size);
if(NULL == (tmp_fill_buf = (unsigned char *)HDmalloc(type_size)))
goto out;
/* get the fill value attributes */
has_fill = H5TBAget_fill(loc_id1, dset_name1, did_1, tmp_fill_buf);
if((has_fill = H5TBAget_fill(loc_id1, dset_name1, did_1, tmp_fill_buf)) < 0)
goto out;
/*-------------------------------------------------------------------------
* attach the fill attributes from previous table
*-------------------------------------------------------------------------
*/
if (has_fill == 1 )
{
if(has_fill) {
if (( sid = H5Screate(H5S_SCALAR)) < 0)
if((sid = H5Screate(H5S_SCALAR)) < 0)
goto out;
for ( i = 0; i < nfields; i++)
{
for(i = 0; i < nfields; i++) {
/* get the member type */
if (( member_type_id = H5Tget_member_type( tid_3, (unsigned) i )) < 0)
if((member_type_id = H5Tget_member_type(tid_3, (unsigned)i)) < 0)
goto out;
/* get the member offset */
member_offset = H5Tget_member_offset(tid_3, (unsigned)i);
strcpy(attr_name, "FIELD_");
sprintf(aux, "%d", (int)i);
strcat(attr_name, aux);
sprintf(aux, "%s", "_FILL");
strcat(attr_name, aux);
HDstrncpy(attr_name, "FIELD_", 6);
HDsnprintf(aux, 12, "%d", (int)i);
HDstrncat(attr_name, aux, 12);
HDsnprintf(aux, 6, "%s", "_FILL");
HDstrncat(attr_name, aux, 7);
if ((attr_id = H5Acreate2(did_3, attr_name, member_type_id, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
if((attr_id = H5Acreate2(did_3, attr_name, member_type_id, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
if (H5Awrite(attr_id, member_type_id, tmp_fill_buf+member_offset) < 0)
if(H5Awrite(attr_id, member_type_id, tmp_fill_buf + member_offset) < 0)
goto out;
if (H5Aclose(attr_id) < 0)
if(H5Aclose(attr_id) < 0)
goto out;
attr_id = H5I_BADID;
if (H5Tclose(member_type_id) < 0)
if(H5Tclose(member_type_id) < 0)
goto out;
member_type_id = H5I_BADID;
}
/* close data space. */
if (H5Sclose( sid ) < 0)
if(H5Sclose(sid) < 0)
goto out;
sid = H5I_BADID;
}
/*-------------------------------------------------------------------------
* read data from 1st table
*-------------------------------------------------------------------------
*/
tmp_buf = (unsigned char *)calloc((size_t) nrecords, type_size );
if(NULL == (tmp_buf = (unsigned char *)HDcalloc((size_t)nrecords, type_size)))
goto out;
/* define a hyperslab in the dataset of the size of the records */
offset[0] = 0;
count[0] = nrecords;
if (H5Sselect_hyperslab( sid_1, H5S_SELECT_SET, offset, NULL, count, NULL) < 0)
if(H5Sselect_hyperslab(sid_1, H5S_SELECT_SET, offset, NULL, count, NULL) < 0)
goto out;
/* create a memory dataspace handle */
mem_size[0] = count[0];
if ((m_sid = H5Screate_simple( 1, mem_size, NULL )) < 0)
if((m_sid = H5Screate_simple(1, mem_size, NULL)) < 0)
goto out;
if (H5Dread( did_1, tid_1, m_sid, sid_1, H5P_DEFAULT, tmp_buf ) < 0)
if(H5Dread(did_1, tid_1, m_sid, sid_1, H5P_DEFAULT, tmp_buf) < 0)
goto out;
/*-------------------------------------------------------------------------
@ -1956,27 +1974,32 @@ herr_t H5TBcombine_tables( hid_t loc_id1,
*/
/* append the records to the new table */
if (H5TBappend_records( loc_id1, dset_name3, nrecords, src_size, src_offset, src_sizes, tmp_buf ) < 0)
if(H5TBappend_records(loc_id1, dset_name3, nrecords, src_size, src_offset, src_sizes, tmp_buf) < 0)
goto out;
/*-------------------------------------------------------------------------
* release resources from 1st table
*-------------------------------------------------------------------------
*/
if (H5Sclose( m_sid ) < 0)
if(H5Sclose(m_sid) < 0)
goto out;
if(H5Sclose( sid_1 ) < 0)
m_sid = H5I_BADID;
if(H5Sclose(sid_1) < 0)
goto out;
if(H5Tclose( tid_1 ) < 0)
sid_1 = H5I_BADID;
if(H5Tclose(tid_1) < 0)
goto out;
if(H5Pclose( pid_1 ) < 0)
tid_1 = H5I_BADID;
if(H5Pclose(pid_1) < 0)
goto out;
if(H5Dclose( did_1 ) < 0)
pid_1 = H5I_BADID;
if(H5Dclose(did_1) < 0)
goto out;
did_1 = H5I_BADID;
/* Release resources. */
free( tmp_buf );
free(tmp_buf);
tmp_buf = NULL;
/*-------------------------------------------------------------------------
* get information about the 2nd table
@ -1984,44 +2007,45 @@ herr_t H5TBcombine_tables( hid_t loc_id1,
*/
/* open the dataset. */
if ((did_2 = H5Dopen2(loc_id2, dset_name2, H5P_DEFAULT)) < 0)
if((did_2 = H5Dopen2(loc_id2, dset_name2, H5P_DEFAULT)) < 0)
goto out;
/* get the datatype */
if ((tid_2 = H5Dget_type( did_2 )) < 0)
if((tid_2 = H5Dget_type(did_2)) < 0)
goto out;
/* get the dataspace handle */
if ((sid_2 = H5Dget_space( did_2 )) < 0)
if((sid_2 = H5Dget_space(did_2)) < 0)
goto out;
/* get the property list handle */
if ((pid_2 = H5Dget_create_plist( did_2 )) < 0)
if((pid_2 = H5Dget_create_plist(did_2)) < 0)
goto out;
/* get the dimensions */
if (H5TBget_table_info ( loc_id2, dset_name2, &nfields, &nrecords ) < 0)
return -1;
if(H5TBget_table_info(loc_id2, dset_name2, &nfields, &nrecords) < 0)
goto out;
/*-------------------------------------------------------------------------
* read data from 2nd table
*-------------------------------------------------------------------------
*/
tmp_buf = (unsigned char *)calloc((size_t) nrecords, type_size );
if(NULL == (tmp_buf = (unsigned char *)HDcalloc((size_t)nrecords, type_size)))
goto out;
/* define a hyperslab in the dataset of the size of the records */
offset[0] = 0;
count[0] = nrecords;
if (H5Sselect_hyperslab( sid_2, H5S_SELECT_SET, offset, NULL, count, NULL) < 0)
if(H5Sselect_hyperslab(sid_2, H5S_SELECT_SET, offset, NULL, count, NULL) < 0)
goto out;
/* create a memory dataspace handle */
mem_size[0] = count[0];
if ((m_sid = H5Screate_simple( 1, mem_size, NULL )) < 0)
if((m_sid = H5Screate_simple(1, mem_size, NULL)) < 0)
goto out;
if (H5Dread( did_2, tid_2, m_sid, sid_2, H5P_DEFAULT, tmp_buf ) < 0)
if(H5Dread(did_2, tid_2, m_sid, sid_2, H5P_DEFAULT, tmp_buf) < 0)
goto out;
/*-------------------------------------------------------------------------
@ -2030,7 +2054,7 @@ herr_t H5TBcombine_tables( hid_t loc_id1,
*/
/* append the records to the new table */
if (H5TBappend_records( loc_id1, dset_name3, nrecords, src_size, src_offset, src_sizes, tmp_buf ) < 0)
if(H5TBappend_records(loc_id1, dset_name3, nrecords, src_size, src_offset, src_sizes, tmp_buf) < 0)
goto out;
/*-------------------------------------------------------------------------
@ -2038,58 +2062,88 @@ herr_t H5TBcombine_tables( hid_t loc_id1,
*-------------------------------------------------------------------------
*/
if (H5Sclose( m_sid ) < 0)
if(H5Sclose(m_sid) < 0)
goto out;
if (H5Sclose( sid_2 ) < 0)
m_sid = H5I_BADID;
if(H5Sclose(sid_2) < 0)
goto out;
if (H5Tclose( tid_2 ) < 0)
return -1;
if (H5Pclose( pid_2 ) < 0)
sid_2 = H5I_BADID;
if(H5Tclose(tid_2) < 0)
goto out;
if (H5Dclose( did_2 ) < 0)
return -1;
tid_2 = H5I_BADID;
if(H5Pclose(pid_2) < 0)
goto out;
pid_2 = H5I_BADID;
if(H5Dclose(did_2) < 0)
goto out;
did_2 = H5I_BADID;
/*-------------------------------------------------------------------------
* release resources from 3rd table
*-------------------------------------------------------------------------
*/
if (H5Sclose( sid_3 ) < 0)
return -1;
if (H5Tclose( tid_3 ) < 0)
return -1;
if (H5Pclose( pid_3 ) < 0)
return -1;
if (H5Dclose( did_3 ) < 0)
return -1;
if(H5Sclose(sid_3) < 0)
goto out;
sid_3 = H5I_BADID;
if(H5Tclose(tid_3) < 0)
goto out;
tid_3 = H5I_BADID;
if(H5Pclose(pid_3) < 0)
goto out;
pid_3 = H5I_BADID;
if(H5Dclose(did_3) < 0)
goto out;
did_3 = H5I_BADID;
/* Release resources. */
free( tmp_buf );
free( tmp_fill_buf );
free( src_offset );
free( src_sizes );
ret_val = 0;
return 0;
/* error zone */
out:
H5E_BEGIN_TRY
{
H5Dclose(did_1);
H5Sclose(sid_1);
H5Tclose(tid_1);
H5Pclose(pid_1);
H5Dclose(did_2);
H5Sclose(sid_2);
H5Tclose(tid_2);
H5Pclose(pid_2);
H5Dclose(did_3);
H5Sclose(sid_3);
H5Tclose(tid_3);
H5Pclose(pid_3);
} H5E_END_TRY;
return -1;
if(tmp_buf)
free(tmp_buf);
if(tmp_fill_buf)
free(tmp_fill_buf);
if(src_offset)
free(src_offset);
if(src_sizes)
free(src_sizes);
H5E_BEGIN_TRY {
if(member_type_id > 0)
H5Tclose(member_type_id);
if(attr_id > 0)
H5Aclose(attr_id);
if(sid > 0)
H5Sclose(sid);
if(m_sid > 0)
H5Sclose(m_sid);
if(pid_1 > 0)
H5Pclose(pid_1);
if(tid_1 > 0)
H5Tclose(tid_1);
if(sid_1 > 0)
H5Sclose(sid_1);
if(did_1 > 0)
H5Dclose(did_1);
if(pid_2 > 0)
H5Pclose(pid_2);
if(tid_2 > 0)
H5Tclose(tid_2);
if(sid_2 > 0)
H5Sclose(sid_2);
if(did_2 > 0)
H5Dclose(did_2);
if(pid_3 > 0)
H5Pclose(pid_3);
if(tid_3 > 0)
H5Tclose(tid_3);
if(sid_3 > 0)
H5Sclose(sid_3);
if(did_3 > 0)
H5Dclose(did_3);
} H5E_END_TRY;
return ret_val;
}
/*-------------------------------------------------------------------------
@ -2581,7 +2635,7 @@ herr_t H5TBdelete_field( hid_t loc_id,
size_t member_offset;
hid_t attr_id;
hsize_t i;
int has_fill=0;
htri_t has_fill = 0;
/* get the number of records and fields */
if (H5TBget_table_info ( loc_id, dset_name, &nfields, &nrecords ) < 0)
@ -3017,7 +3071,7 @@ herr_t H5TBAget_title( hid_t loc_id,
*
* Purpose: Read the table attribute fill values
*
* Return: Success: 0, Failure: -1
* Return: Success: TRUE/FALSE, Failure: -1
*
* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
*
@ -3029,12 +3083,10 @@ herr_t H5TBAget_title( hid_t loc_id,
*
*-------------------------------------------------------------------------
*/
herr_t H5TBAget_fill( hid_t loc_id,
htri_t H5TBAget_fill(hid_t loc_id,
const char *dset_name,
hid_t dset_id,
unsigned char *dst_buf )
unsigned char *dst_buf)
{
hsize_t nfields;
@ -3149,9 +3201,7 @@ herr_t H5TBget_table_info ( hid_t loc_id,
*/
if (nfields)
{
*nfields = num_members;
}
*nfields = (hsize_t)num_members;
/*-------------------------------------------------------------------------
@ -3331,19 +3381,19 @@ int H5TB_find_field( const char *field, const char *field_list )
const char *start = field_list;
const char *end;
while ( (end = strstr( start, "," )) != 0 )
while ( (end = HDstrstr( start, "," )) != 0 )
{
size_t count = end - start;
if(strncmp(start, field, count) == 0 && count == strlen(field) )
ptrdiff_t count = end - start;
if(HDstrncmp(start, field, (size_t)count) == 0 && (size_t)count == HDstrlen(field) )
return 1;
start = end + 1;
}
if(strcmp( start, field ) == 0 )
if(HDstrcmp( start, field ) == 0 )
return 1;
return -1;
}

View File

@ -219,10 +219,10 @@ H5_HLDLL herr_t H5TBdelete_field( hid_t loc_id,
H5_HLDLL herr_t H5TBAget_title( hid_t loc_id,
char *table_title );
H5_HLDLL herr_t H5TBAget_fill( hid_t loc_id,
H5_HLDLL htri_t H5TBAget_fill(hid_t loc_id,
const char *dset_name,
hid_t dset_id,
unsigned char *dst_buf );
unsigned char *dst_buf);
#ifdef __cplusplus
}

View File

@ -457,7 +457,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog
# Add libtool shared library version numbers to the HDF5 library
# See libtool versioning documentation online.
LT_VERS_INTERFACE = 6
LT_VERS_REVISION = 118
LT_VERS_REVISION = 122
LT_VERS_AGE = 0
# This library is our main target.

View File

@ -676,7 +676,7 @@ static int test_generate(void)
goto out;
/* Indicate success */
retval = 0;
return 0;
/* error zone, gracefully close */
out:

View File

@ -2152,9 +2152,12 @@ int main( void )
/* test attribute functions */
nerrors += test_attr();
/* test text-dtype functions */
/* test valid path functions */
nerrors += test_valid_path();
/* test text-dtype functions */
nerrors += test_text_dtype();
/* check for errors */
if (nerrors)
goto error;

Some files were not shown because too many files have changed in this diff Show More